diff --git a/.yarn/offline-mirror/compute-scroll-into-view-1.0.13.tgz b/.yarn/offline-mirror/compute-scroll-into-view-1.0.13.tgz new file mode 100644 index 000000000000..7adaa640757d Binary files /dev/null and b/.yarn/offline-mirror/compute-scroll-into-view-1.0.13.tgz differ diff --git a/.yarn/offline-mirror/downshift-5.0.5.tgz b/.yarn/offline-mirror/downshift-5.0.5.tgz new file mode 100644 index 000000000000..c5bdc6f384b2 Binary files /dev/null and b/.yarn/offline-mirror/downshift-5.0.5.tgz differ diff --git a/packages/components/src/components/button/_mixins.scss b/packages/components/src/components/button/_mixins.scss index 38a4134535fc..3a6a3d7ccbf5 100644 --- a/packages/components/src/components/button/_mixins.scss +++ b/packages/components/src/components/button/_mixins.scss @@ -81,6 +81,17 @@ inset 0 0 0 ($button-border-width + $button-outline-width) $ui-02; } + &:disabled:hover, + &:disabled:focus, + &:hover.#{$prefix}--btn--disabled, + &:focus.#{$prefix}--btn--disabled { + color: $ui-04; + background-color: $disabled-02; + border-color: $disabled-02; + text-decoration: none; + box-shadow: none; + } + &:active { background-color: $active-color; } diff --git a/packages/components/src/components/combo-box/_combo-box.scss b/packages/components/src/components/combo-box/_combo-box.scss index db20ed78098a..efa032ab097d 100644 --- a/packages/components/src/components/combo-box/_combo-box.scss +++ b/packages/components/src/components/combo-box/_combo-box.scss @@ -26,6 +26,10 @@ &[disabled]::placeholder { color: $disabled-02; } + + &::-ms-clear { + display: none; + } } .#{$prefix}--combo-box.#{$prefix}--list-box--expanded diff --git a/packages/components/src/components/dropdown/_dropdown.scss b/packages/components/src/components/dropdown/_dropdown.scss index db38b3b74830..c4fc66eb6e4f 100644 --- a/packages/components/src/components/dropdown/_dropdown.scss +++ b/packages/components/src/components/dropdown/_dropdown.scss @@ -56,15 +56,18 @@ outline: 2px solid transparent; transition: background-color $duration--fast-01 motion(standard, productive); - &:focus { - @include focus-outline('outline'); - } - &:hover { background-color: $hover-ui; } } + // Menu's triggering element updated to button with Downshift v5 upgrade + .#{$prefix}--dropdown .#{$prefix}--list-box__field { + @include button-reset; + text-align: left; + padding: 0 rem(48px) 0 rem(16px); + } + .#{$prefix}--dropdown--xl { height: rem(48px); max-height: rem(48px); @@ -327,11 +330,15 @@ outline: none; } - .#{$prefix}--dropdown-text { + // TODO: remove in v11 + .#{$prefix}--dropdown-text, + .#{$prefix}--list-box__label { color: $disabled-02; } - .#{$prefix}--dropdown__arrow { + // TODO: remove in v11 + .#{$prefix}--dropdown__arrow, + .#{$prefix}--list-box__menu-icon svg { fill: $disabled-02; } diff --git a/packages/components/src/components/list-box/_list-box.scss b/packages/components/src/components/list-box/_list-box.scss index 72f8d0bca919..92cea7d7bdd7 100644 --- a/packages/components/src/components/list-box/_list-box.scss +++ b/packages/components/src/components/list-box/_list-box.scss @@ -144,7 +144,7 @@ $list-box-menu-width: rem(300px); } .#{$prefix}--list-box--light.#{$prefix}--list-box--expanded { - border-bottom-color: $decorative-01; + border-bottom-color: transparent; } // Disabled state for `list-box` @@ -159,7 +159,7 @@ $list-box-menu-width: rem(300px); .#{$prefix}--list-box--disabled, .#{$prefix}--list-box--disabled .#{$prefix}--list-box__field, .#{$prefix}--list-box--disabled .#{$prefix}--list-box__field:focus { - border-bottom-width: 0; + border-bottom-color: transparent; outline: none; } @@ -248,6 +248,10 @@ $list-box-menu-width: rem(300px); color: $text-01; } + .#{$prefix}--list-box--inline .#{$prefix}--list-box__field { + height: 100%; + } + // The field we use for input, showing selection, etc. .#{$prefix}--list-box__field { @include button-reset; @@ -377,10 +381,6 @@ $list-box-menu-width: rem(300px); outline: none; } - .#{$prefix}--list-box--disabled .#{$prefix}--list-box__selection > svg { - fill: $disabled-02; - } - // Modifier for a selection to show that multiple selections have been made .#{$prefix}--list-box__selection--multi { @include type-style('label-01'); @@ -406,11 +406,21 @@ $list-box-menu-width: rem(300px); width: rem(20px); height: rem(20px); padding: rem(2px); + + &:hover { + border-radius: 50%; + background-color: $hover-secondary; + } } - .#{$prefix}--list-box__selection--multi > svg:hover { - border-radius: 50%; - background-color: $hover-secondary; + .#{$prefix}--list-box--disabled + .#{$prefix}--list-box__selection--multi + > svg { + fill: $disabled-02; + + &:hover { + background-color: unset; + } } .#{$prefix}--list-box__selection--multi:focus, @@ -429,6 +439,11 @@ $list-box-menu-width: rem(300px); transition: max-height $duration--fast-02 motion(standard, productive); overflow-y: auto; z-index: z('dropdown'); + + &:focus { + // remove default browser focus in firefox + @include focus-outline('border'); + } } .#{$prefix}--list-box @@ -664,9 +679,11 @@ $list-box-menu-width: rem(300px); // Tweaks for descendants // When handling input, we need to target nodes that specifically opt-in to - // the `combobox` role in order to make sure the text input is styled + // the type text in order to make sure the text input is styled // correctly. - .#{$prefix}--list-box input[role='combobox'] { + // TODO: remove [role='combobox'] in v11 + .#{$prefix}--list-box input[role='combobox'], + .#{$prefix}--list-box input[type='text'] { background-color: inherit; min-width: 0; } diff --git a/packages/components/src/components/tag/_tag.scss b/packages/components/src/components/tag/_tag.scss index 890ea7f9bc6d..e978e871bf3c 100644 --- a/packages/components/src/components/tag/_tag.scss +++ b/packages/components/src/components/tag/_tag.scss @@ -23,7 +23,7 @@ @include tag-theme( get-token-value($tag-colors, 'tag-background-gray'), get-token-value($tag-colors, 'tag-color-gray'), - get-token-value($tag-colors, 'tag-hover-gray'), + get-token-value($tag-colors, 'tag-hover-gray') ); display: inline-flex; @@ -50,7 +50,7 @@ @include tag-theme( get-token-value($tag-colors, 'tag-background-red'), get-token-value($tag-colors, 'tag-color-red'), - get-token-value($tag-colors, 'tag-hover-red'), + get-token-value($tag-colors, 'tag-hover-red') ); } @@ -58,7 +58,7 @@ @include tag-theme( get-token-value($tag-colors, 'tag-background-magenta'), get-token-value($tag-colors, 'tag-color-magenta'), - get-token-value($tag-colors, 'tag-hover-magenta'), + get-token-value($tag-colors, 'tag-hover-magenta') ); } @@ -66,7 +66,7 @@ @include tag-theme( get-token-value($tag-colors, 'tag-background-purple'), get-token-value($tag-colors, 'tag-color-purple'), - get-token-value($tag-colors, 'tag-hover-purple'), + get-token-value($tag-colors, 'tag-hover-purple') ); } @@ -74,7 +74,7 @@ @include tag-theme( get-token-value($tag-colors, 'tag-background-blue'), get-token-value($tag-colors, 'tag-color-blue'), - get-token-value($tag-colors, 'tag-hover-blue'), + get-token-value($tag-colors, 'tag-hover-blue') ); } @@ -82,7 +82,7 @@ @include tag-theme( get-token-value($tag-colors, 'tag-background-cyan'), get-token-value($tag-colors, 'tag-color-cyan'), - get-token-value($tag-colors, 'tag-hover-cyan'), + get-token-value($tag-colors, 'tag-hover-cyan') ); } @@ -90,7 +90,7 @@ @include tag-theme( get-token-value($tag-colors, 'tag-background-teal'), get-token-value($tag-colors, 'tag-color-teal'), - get-token-value($tag-colors, 'tag-hover-teal'), + get-token-value($tag-colors, 'tag-hover-teal') ); } @@ -98,7 +98,7 @@ @include tag-theme( get-token-value($tag-colors, 'tag-background-green'), get-token-value($tag-colors, 'tag-color-green'), - get-token-value($tag-colors, 'tag-hover-green'), + get-token-value($tag-colors, 'tag-hover-green') ); } @@ -106,7 +106,7 @@ @include tag-theme( get-token-value($tag-colors, 'tag-background-gray'), get-token-value($tag-colors, 'tag-color-gray'), - get-token-value($tag-colors, 'tag-hover-gray'), + get-token-value($tag-colors, 'tag-hover-gray') ); } @@ -114,7 +114,7 @@ @include tag-theme( get-token-value($tag-colors, 'tag-background-cool-gray'), get-token-value($tag-colors, 'tag-color-cool-gray'), - get-token-value($tag-colors, 'tag-hover-cool-gray'), + get-token-value($tag-colors, 'tag-hover-cool-gray') ); } @@ -122,16 +122,12 @@ @include tag-theme( get-token-value($tag-colors, 'tag-background-warm-gray'), get-token-value($tag-colors, 'tag-color-warm-gray'), - get-token-value($tag-colors, 'tag-hover-warm-gray'), + get-token-value($tag-colors, 'tag-hover-warm-gray') ); } .#{$prefix}--tag--high-contrast { - @include tag-theme( - $inverse-02, - $inverse-01, - $inverse-hover-ui, - ); + @include tag-theme($inverse-02, $inverse-01, $inverse-hover-ui); } .#{$prefix}--tag--disabled, diff --git a/packages/components/src/globals/scss/_component-tokens.scss b/packages/components/src/globals/scss/_component-tokens.scss index c38c21882732..aaba10ee328a 100644 --- a/packages/components/src/globals/scss/_component-tokens.scss +++ b/packages/components/src/globals/scss/_component-tokens.scss @@ -9,6 +9,10 @@ @import 'theme'; @import 'feature-flags'; +$enable-css-custom-properties: feature-flag-enabled( + 'enable-css-custom-properties' +); + /// Get a component token value. /// @access private /// @param {Map} $tokens - Map of component tokens diff --git a/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap b/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap index e82918ad9815..a7b1b7303015 100644 --- a/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap +++ b/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap @@ -329,31 +329,15 @@ Map { "downshiftProps": Object { "args": Array [ Object { - "breakingChanges": Object { - "args": Array [ - Object { - "resetInputOnSelection": Object { - "type": "bool", - }, - }, - ], - "type": "shape", - }, "children": Object { "type": "func", }, "defaultHighlightedIndex": Object { "type": "number", }, - "defaultInputValue": Object { - "type": "string", - }, "defaultIsOpen": Object { "type": "bool", }, - "defaultSelectedItem": Object { - "type": "any", - }, "environment": Object { "args": Array [ Object { @@ -386,12 +370,30 @@ Map { "getA11yStatusMessage": Object { "type": "func", }, + "getItemId": Object { + "type": "func", + }, "highlightedIndex": Object { "type": "number", }, "id": Object { "type": "string", }, + "initialHighlightedIndex": Object { + "type": "number", + }, + "initialInputValue": Object { + "type": "string", + }, + "initialIsOpen": Object { + "type": "bool", + }, + "initialSelectedItem": Object { + "type": "any", + }, + "inputId": Object { + "type": "string", + }, "inputValue": Object { "type": "string", }, @@ -404,6 +406,12 @@ Map { "itemToString": Object { "type": "func", }, + "labelId": Object { + "type": "string", + }, + "menuId": Object { + "type": "string", + }, "onChange": Object { "type": "func", }, @@ -422,7 +430,7 @@ Map { "onUserAction": Object { "type": "func", }, - "render": Object { + "scrollIntoView": Object { "type": "func", }, "selectedItem": Object { @@ -434,6 +442,9 @@ Map { "stateReducer": Object { "type": "func", }, + "suppressRefError": Object { + "type": "bool", + }, }, ], "type": "shape", @@ -2022,118 +2033,6 @@ Map { "disabled": Object { "type": "bool", }, - "downshiftProps": Object { - "args": Array [ - Object { - "breakingChanges": Object { - "args": Array [ - Object { - "resetInputOnSelection": Object { - "type": "bool", - }, - }, - ], - "type": "shape", - }, - "children": Object { - "type": "func", - }, - "defaultHighlightedIndex": Object { - "type": "number", - }, - "defaultInputValue": Object { - "type": "string", - }, - "defaultIsOpen": Object { - "type": "bool", - }, - "defaultSelectedItem": Object { - "type": "any", - }, - "environment": Object { - "args": Array [ - Object { - "addEventListener": Object { - "type": "func", - }, - "document": Object { - "args": Array [ - Object { - "activeElement": Object { - "type": "any", - }, - "body": Object { - "type": "any", - }, - "getElementById": Object { - "type": "func", - }, - }, - ], - "type": "shape", - }, - "removeEventListener": Object { - "type": "func", - }, - }, - ], - "type": "shape", - }, - "getA11yStatusMessage": Object { - "type": "func", - }, - "highlightedIndex": Object { - "type": "number", - }, - "id": Object { - "type": "string", - }, - "inputValue": Object { - "type": "string", - }, - "isOpen": Object { - "type": "bool", - }, - "itemCount": Object { - "type": "number", - }, - "itemToString": Object { - "type": "func", - }, - "onChange": Object { - "type": "func", - }, - "onInputValueChange": Object { - "type": "func", - }, - "onOuterClick": Object { - "type": "func", - }, - "onSelect": Object { - "type": "func", - }, - "onStateChange": Object { - "type": "func", - }, - "onUserAction": Object { - "type": "func", - }, - "render": Object { - "type": "func", - }, - "selectedItem": Object { - "type": "any", - }, - "selectedItemChanged": Object { - "type": "func", - }, - "stateReducer": Object { - "type": "func", - }, - }, - ], - "type": "shape", - }, "helperText": Object { "args": Array [ Array [ @@ -3204,31 +3103,15 @@ Map { "downshiftProps": Object { "args": Array [ Object { - "breakingChanges": Object { - "args": Array [ - Object { - "resetInputOnSelection": Object { - "type": "bool", - }, - }, - ], - "type": "shape", - }, "children": Object { "type": "func", }, "defaultHighlightedIndex": Object { "type": "number", }, - "defaultInputValue": Object { - "type": "string", - }, "defaultIsOpen": Object { "type": "bool", }, - "defaultSelectedItem": Object { - "type": "any", - }, "environment": Object { "args": Array [ Object { @@ -3261,12 +3144,30 @@ Map { "getA11yStatusMessage": Object { "type": "func", }, + "getItemId": Object { + "type": "func", + }, "highlightedIndex": Object { "type": "number", }, "id": Object { "type": "string", }, + "initialHighlightedIndex": Object { + "type": "number", + }, + "initialInputValue": Object { + "type": "string", + }, + "initialIsOpen": Object { + "type": "bool", + }, + "initialSelectedItem": Object { + "type": "any", + }, + "inputId": Object { + "type": "string", + }, "inputValue": Object { "type": "string", }, @@ -3279,6 +3180,12 @@ Map { "itemToString": Object { "type": "func", }, + "labelId": Object { + "type": "string", + }, + "menuId": Object { + "type": "string", + }, "onChange": Object { "type": "func", }, @@ -3297,7 +3204,7 @@ Map { "onUserAction": Object { "type": "func", }, - "render": Object { + "scrollIntoView": Object { "type": "func", }, "selectedItem": Object { @@ -3309,6 +3216,9 @@ Map { "stateReducer": Object { "type": "func", }, + "suppressRefError": Object { + "type": "bool", + }, }, ], "type": "shape", @@ -3414,31 +3324,15 @@ Map { "downshiftProps": Object { "args": Array [ Object { - "breakingChanges": Object { - "args": Array [ - Object { - "resetInputOnSelection": Object { - "type": "bool", - }, - }, - ], - "type": "shape", - }, "children": Object { "type": "func", }, "defaultHighlightedIndex": Object { "type": "number", }, - "defaultInputValue": Object { - "type": "string", - }, "defaultIsOpen": Object { "type": "bool", }, - "defaultSelectedItem": Object { - "type": "any", - }, "environment": Object { "args": Array [ Object { @@ -3471,12 +3365,30 @@ Map { "getA11yStatusMessage": Object { "type": "func", }, + "getItemId": Object { + "type": "func", + }, "highlightedIndex": Object { "type": "number", }, "id": Object { "type": "string", }, + "initialHighlightedIndex": Object { + "type": "number", + }, + "initialInputValue": Object { + "type": "string", + }, + "initialIsOpen": Object { + "type": "bool", + }, + "initialSelectedItem": Object { + "type": "any", + }, + "inputId": Object { + "type": "string", + }, "inputValue": Object { "type": "string", }, @@ -3489,6 +3401,12 @@ Map { "itemToString": Object { "type": "func", }, + "labelId": Object { + "type": "string", + }, + "menuId": Object { + "type": "string", + }, "onChange": Object { "type": "func", }, @@ -3507,7 +3425,7 @@ Map { "onUserAction": Object { "type": "func", }, - "render": Object { + "scrollIntoView": Object { "type": "func", }, "selectedItem": Object { @@ -3519,6 +3437,9 @@ Map { "stateReducer": Object { "type": "func", }, + "suppressRefError": Object { + "type": "bool", + }, }, ], "type": "shape", diff --git a/packages/react/package.json b/packages/react/package.json index afbce7e9c81a..0d4748618092 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -40,7 +40,7 @@ "dependencies": { "@carbon/icons-react": "^10.10.2", "classnames": "2.2.6", - "downshift": "^1.31.14", + "downshift": "^5.0.5", "flatpickr": "4.6.1", "invariant": "^2.2.3", "lodash.debounce": "^4.0.8", diff --git a/packages/react/src/components/Checkbox/Checkbox-test.js b/packages/react/src/components/Checkbox/Checkbox-test.js index e92a721daf47..a98819a378f1 100644 --- a/packages/react/src/components/Checkbox/Checkbox-test.js +++ b/packages/react/src/components/Checkbox/Checkbox-test.js @@ -29,10 +29,6 @@ describe('Checkbox', () => { expect(label.hasClass(`${prefix}--checkbox-label`)).toEqual(true); }); - it('has the expected htmlFor value', () => { - expect(label.props().htmlFor).toEqual('testing'); - }); - it('applies extra classes to label', () => { expect(label.hasClass('extra-class')).toEqual(true); }); @@ -40,10 +36,6 @@ describe('Checkbox', () => { describe('input', () => { const input = () => wrapper.find('input'); - it('has id set as expected', () => { - expect(input().props().id).toEqual('testing'); - }); - it('defaultChecked prop sets defaultChecked on input', () => { expect(input().props().defaultChecked).toBeUndefined(); wrapper.setProps({ defaultChecked: true }); diff --git a/packages/react/src/components/Checkbox/Checkbox.js b/packages/react/src/components/Checkbox/Checkbox.js index a5fec39efab5..7a3feedefd18 100644 --- a/packages/react/src/components/Checkbox/Checkbox.js +++ b/packages/react/src/components/Checkbox/Checkbox.js @@ -57,7 +57,7 @@ const Checkbox = React.forwardRef(function Checkbox( } }} /> -