Skip to content

Commit

Permalink
Merge branch 'main' into 9617-update-theme-compat-issue
Browse files Browse the repository at this point in the history
  • Loading branch information
sstrubberg authored Sep 21, 2021
2 parents 098f81c + bd402ef commit adb3784
Show file tree
Hide file tree
Showing 34 changed files with 301 additions and 86 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions packages/carbon-react/__tests__/index-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ Array [
"IconSkeleton",
"InlineLoading",
"InlineNotification",
"Layer",
"Link",
"ListItem",
"Loading",
Expand Down
2 changes: 2 additions & 0 deletions packages/carbon-react/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,5 @@ export {
} from './components/Grid';

export { Theme, useTheme } from './components/Theme';

export { Layer } from './components/Layer';
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,10 @@
width: auto;
}

.#{$prefix}--data-table-container--static {
width: fit-content;
}

// -------------
// Sticky header
// -------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
margin-right: 0.75rem;
}

.#{$prefix}--progress-label:active {
.#{$prefix}--tooltip__label.#{$prefix}--progress-label:active {
box-shadow: 0 rem(3px) 0 0 $interactive-01;
color: $interactive-01;
}
Expand Down
10 changes: 6 additions & 4 deletions packages/components/src/components/slider/_slider.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
width: 100%;
min-width: rem(200px);
max-width: rem(640px);
padding: $spacing-05 0;
margin: 0 $carbon--spacing-05;
cursor: pointer;
}

.#{$prefix}--slider__range-label {
Expand All @@ -50,7 +52,6 @@
width: 100%;
height: rem(2px);
background: $ui-03;
cursor: pointer;
transform: translate(0%, -50%);
}

Expand Down Expand Up @@ -80,13 +81,11 @@
.#{$prefix}--slider__thumb {
position: absolute;
z-index: 3;
top: 0;
width: rem(14px);
height: rem(14px);
background: $ui-05;
border-radius: 50%;
box-shadow: inset 0 0 0 1px transparent, inset 0 0 0 2px transparent;
cursor: pointer;
outline: none;
transform: translate(-50%, -50%);
transition: transform $duration--fast-02 motion(standard, productive),
Expand Down Expand Up @@ -143,6 +142,10 @@
color: $disabled-02;
}

.#{$prefix}--slider--disabled.#{$prefix}--slider {
cursor: not-allowed;
}

.#{$prefix}--slider--disabled .#{$prefix}--slider__thumb {
background-color: $ui-03;

Expand Down Expand Up @@ -170,7 +173,6 @@
.#{$prefix}--slider__thumb:focus
~ .#{$prefix}--slider__filled-track {
background-color: $ui-03;
cursor: not-allowed;
}

.#{$prefix}--slider--disabled
Expand Down
51 changes: 39 additions & 12 deletions packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,24 @@ Map {
},
},
"ContentSwitcher" => Object {
"contextType": Object {
"$$typeof": Symbol(react.context),
"Consumer": Object {
"$$typeof": Symbol(react.context),
"_calculateChangedBits": null,
"_context": [Circular],
},
"Provider": Object {
"$$typeof": Symbol(react.provider),
"_context": [Circular],
},
"_calculateChangedBits": null,
"_currentRenderer": null,
"_currentRenderer2": null,
"_currentValue": "bx",
"_currentValue2": "bx",
"_threadCount": 0,
},
"defaultProps": Object {
"onChange": [Function],
"selectedIndex": 0,
Expand Down Expand Up @@ -1132,6 +1150,9 @@ Map {
"title": Object {
"type": "node",
},
"useStaticWidth": Object {
"type": "bool",
},
},
},
"TableExpandHeader": Object {
Expand Down Expand Up @@ -1769,6 +1790,9 @@ Map {
"title": Object {
"type": "node",
},
"useStaticWidth": Object {
"type": "bool",
},
},
},
"TableExpandHeader" => Object {
Expand Down Expand Up @@ -6379,9 +6403,9 @@ Map {
"ClickableTile" => Object {
"defaultProps": Object {
"clicked": false,
"handleClick": [Function],
"handleKeyDown": [Function],
"light": false,
"onClick": [Function],
"onKeyDown": [Function],
},
"propTypes": Object {
"children": Object {
Expand All @@ -6390,18 +6414,20 @@ Map {
"className": Object {
"type": "string",
},
"handleClick": Object {
"type": "func",
},
"handleKeyDown": Object {
"type": "func",
},
"handleClick": [Function],
"handleKeyDown": [Function],
"href": Object {
"type": "string",
},
"light": Object {
"type": "bool",
},
"onClick": Object {
"type": "func",
},
"onKeyDown": Object {
"type": "func",
},
"rel": Object {
"type": "string",
},
Expand All @@ -6410,6 +6436,9 @@ Map {
"SelectableTile" => Object {
"defaultProps": Object {
"light": false,
"onChange": [Function],
"onClick": [Function],
"onKeyDown": [Function],
"selected": false,
"tabIndex": 0,
"title": "title",
Expand Down Expand Up @@ -6474,9 +6503,9 @@ Map {
"ExpandableTile" => Object {
"defaultProps": Object {
"expanded": false,
"handleClick": [Function],
"light": false,
"onBeforeClick": [Function],
"onClick": [Function],
"tabIndex": 0,
"tileCollapsedIconText": "Interact to expand Tile",
"tileExpandedIconText": "Interact to collapse Tile",
Expand All @@ -6493,9 +6522,7 @@ Map {
"expanded": Object {
"type": "bool",
},
"handleClick": Object {
"type": "func",
},
"handleClick": [Function],
"id": Object {
"type": "string",
},
Expand Down
6 changes: 3 additions & 3 deletions packages/react/src/components/Accordion/Accordion.Skeleton.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@ import PropTypes from 'prop-types';
import React from 'react';
import cx from 'classnames';
import { ChevronRight16 } from '@carbon/icons-react';
import { settings } from 'carbon-components';
import SkeletonText from '../SkeletonText';
import deprecate from '../../prop-types/deprecate';

const { prefix } = settings;
import { usePrefix } from '../../internal/usePrefix';

function AccordionSkeleton({ align, open, count, className, ...rest }) {
const prefix = usePrefix();
const classes = cx(`${prefix}--accordion`, `${prefix}--skeleton`, className, {
[`${prefix}--accordion--${align}`]: align,
});
Expand Down Expand Up @@ -77,6 +76,7 @@ AccordionSkeleton.defaultProps = {
};

function AccordionSkeletonItem() {
const prefix = usePrefix();
return (
<li className={`${prefix}--accordion__item`}>
<span className={`${prefix}--accordion__heading`}>
Expand Down
5 changes: 2 additions & 3 deletions packages/react/src/components/Accordion/Accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@
* LICENSE file in the root directory of this source tree.
*/

import { settings } from 'carbon-components';
import cx from 'classnames';
import { usePrefix } from '../../internal/usePrefix';
import PropTypes from 'prop-types';
import React from 'react';

const { prefix } = settings;

function Accordion({
align,
children,
Expand All @@ -20,6 +18,7 @@ function Accordion({
size,
...rest
}) {
const prefix = usePrefix();
const className = cx(`${prefix}--accordion`, customClassName, {
[`${prefix}--accordion--${align}`]: align,
[`${prefix}--accordion--${size}`]: size,
Expand Down
5 changes: 4 additions & 1 deletion packages/react/src/components/Accordion/AccordionItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { settings } from 'carbon-components';
import cx from 'classnames';
import PropTypes from 'prop-types';
import React, { useState } from 'react';
import { Text } from '../Text';
import { match, keys } from '../../internal/keyboard';
import { useId } from '../../internal/useId';
import deprecate from '../../prop-types/deprecate.js';
Expand Down Expand Up @@ -84,7 +85,9 @@ function AccordionItem({
onKeyDown={onKeyDown}
type="button">
<ChevronRight16 className={`${prefix}--accordion__arrow`} />
<div className={`${prefix}--accordion__title`}>{title}</div>
<Text as="div" className={`${prefix}--accordion__title`}>
{title}
</Text>
</Expando>
<div id={id} className={`${prefix}--accordion__content`}>
{children}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ exports[`Accordion should render 1`] = `
</svg>
<div
class="bx--accordion__title"
dir="auto"
>
Heading A
</div>
Expand Down Expand Up @@ -68,6 +69,7 @@ exports[`Accordion should render 1`] = `
</svg>
<div
class="bx--accordion__title"
dir="auto"
>
Heading B
</div>
Expand Down Expand Up @@ -105,6 +107,7 @@ exports[`Accordion should render 1`] = `
</svg>
<div
class="bx--accordion__title"
dir="auto"
>
Heading C
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,17 @@ exports[`AccordionItem should render 1`] = `
</svg>
</Icon>
</ForwardRef(ChevronRight16)>
<div
<Text
as="div"
className="bx--accordion__title"
>
A heading
</div>
<div
className="bx--accordion__title"
dir="auto"
>
A heading
</div>
</Text>
</button>
</defaultRenderExpando>
<div
Expand Down
3 changes: 2 additions & 1 deletion packages/react/src/components/Button/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,15 @@ const Button = React.forwardRef(function Button(
component = 'a';
otherProps = anchorProps;
}

return React.createElement(
component,
{
onMouseEnter: composeEventHandlers([onMouseEnter, handleMouseEnter]),
onMouseLeave: composeEventHandlers([onMouseLeave, handleMouseLeave]),
onFocus: composeEventHandlers([onFocus, handleFocus]),
onBlur: composeEventHandlers([onBlur, handleBlur]),
onClick: composeEventHandlers([handleClick, onClick]),
onClick: composeEventHandlers([onClick, handleClick]),
...other,
...commonProps,
...otherProps,
Expand Down
3 changes: 2 additions & 1 deletion packages/react/src/components/Checkbox/Checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import PropTypes from 'prop-types';
import React from 'react';
import classNames from 'classnames';
import { Text } from '../Text';
import { useFeatureFlag } from '../FeatureFlags';
import { settings } from 'carbon-components';
import deprecate from '../../prop-types/deprecate';
Expand Down Expand Up @@ -69,7 +70,7 @@ const Checkbox = React.forwardRef(function Checkbox(
}}
/>
<label htmlFor={id} className={labelClasses} title={title || null}>
<span className={innerLabelClasses}>{labelText}</span>
<Text className={innerLabelClasses}>{labelText}</Text>
</label>
</div>
);
Expand Down
9 changes: 5 additions & 4 deletions packages/react/src/components/ComboBox/ComboBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import cx from 'classnames';
import Downshift from 'downshift';
import PropTypes from 'prop-types';
import React, { useEffect, useState, useRef } from 'react';
import { Text } from '../Text';
import { settings } from 'carbon-components';
import {
Checkmark16,
Expand Down Expand Up @@ -293,9 +294,9 @@ const ComboBox = React.forwardRef((props, ref) => {
return (
<div className={wrapperClasses}>
{titleText && (
<label className={titleClasses} {...labelProps}>
<Text as="label" className={titleClasses} {...labelProps}>
{titleText}
</label>
</Text>
)}
<ListBox
className={className}
Expand Down Expand Up @@ -391,9 +392,9 @@ const ComboBox = React.forwardRef((props, ref) => {
</ListBox.Menu>
</ListBox>
{helperText && !invalid && !warn && (
<div id={comboBoxHelperId} className={helperClasses}>
<Text as="div" id={comboBoxHelperId} className={helperClasses}>
{helperText}
</div>
</Text>
)}
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ import React from 'react';
import ContentSwitcher from '../ContentSwitcher';
import Switch from '../Switch';
import { mount, shallow } from 'enzyme';
import { settings } from 'carbon-components';

const { prefix } = settings;

describe('ContentSwitcher', () => {
describe('component initial rendering', () => {
Expand All @@ -24,10 +21,6 @@ describe('ContentSwitcher', () => {

const children = wrapper.find(Switch);

it('should have the correct class', () => {
expect(wrapper.hasClass(`${prefix}--content-switcher`)).toEqual(true);
});

it('should render children as expected', () => {
expect(children.length).toEqual(2);
});
Expand Down
Loading

0 comments on commit adb3784

Please sign in to comment.