Skip to content

Commit

Permalink
Merge branch 'main' into bidi-docs-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] committed Oct 22, 2021
2 parents afa04f8 + 7a1e883 commit 3583c0b
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 7 deletions.
Expand Up @@ -25,7 +25,8 @@ const items = [
},
{
id: 'option-3',
text: 'Option 3',
text: 'Option 3 - a disabled item',
disabled: true,
},
{
id: 'option-4',
Expand Down
Expand Up @@ -24,7 +24,8 @@ const items = [
},
{
id: 'option-3',
text: 'Option 3',
text: 'Option 3 - a disabled item',
disabled: true,
},
{
id: 'option-4',
Expand Down
2 changes: 2 additions & 0 deletions packages/components/src/components/list-box/_list-box.scss
Expand Up @@ -660,6 +660,8 @@ $list-box-menu-width: rem(300px);

.#{$prefix}--list-box__menu-item[disabled],
.#{$prefix}--list-box__menu-item[disabled] *,
.#{$prefix}--list-box__menu-item[disabled]
.#{$prefix}--list-box__menu-item__option,
.#{$prefix}--list-box__menu-item[disabled]:hover {
color: $disabled-02;
cursor: not-allowed;
Expand Down
3 changes: 2 additions & 1 deletion packages/react/src/components/ComboBox/ComboBox-story.js
Expand Up @@ -27,7 +27,8 @@ const items = [
},
{
id: 'option-3',
text: 'Option 3',
text: 'Option 3 - a disabled item',
disabled: true,
},
{
id: 'option-4',
Expand Down
1 change: 1 addition & 0 deletions packages/react/src/components/ComboBox/ComboBox.js
Expand Up @@ -357,6 +357,7 @@ const ComboBox = React.forwardRef((props, ref) => {
['aria-current']: selectedItem === item ? true : null,
['aria-selected']:
highlightedIndex === index ? true : null,
disabled: item.disabled,
});
return (
<ListBox.MenuItem
Expand Down
3 changes: 2 additions & 1 deletion packages/react/src/components/Dropdown/Dropdown-story.js
Expand Up @@ -33,7 +33,8 @@ const items = [
},
{
id: 'option-3',
text: 'Option 3',
text: 'Option 3 - a disabled item',
disabled: true,
},
{
id: 'option-4',
Expand Down
6 changes: 5 additions & 1 deletion packages/react/src/components/Dropdown/Dropdown.js
Expand Up @@ -181,7 +181,11 @@ const Dropdown = React.forwardRef(function Dropdown(
<ListBox.Menu {...getMenuProps()}>
{isOpen &&
items.map((item, index) => {
const itemProps = getItemProps({ item, index });
const itemProps = getItemProps({
item,
index,
disabled: item.disabled,
});
const title = itemToElement ? item.text : itemToString(item);
const { offsetWidth, scrollWidth } =
menuItemOptionRefs?.current[index]?.current || {};
Expand Down
Expand Up @@ -569,7 +569,10 @@ export default class FilterableMultiSelect extends React.Component {
locale,
}
).map((item, index) => {
const itemProps = getItemProps({ item });
const itemProps = getItemProps({
item,
disabled: item.disabled,
});
const itemText = itemToString(item);
const isChecked =
selectedItem.filter((selected) =>
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/MultiSelect/MultiSelect.js
Expand Up @@ -282,7 +282,7 @@ const MultiSelect = React.forwardRef(function MultiSelect(
// we don't want Downshift to set aria-selected for us
// we also don't want to set 'false' for reader verbosity's sake
['aria-selected']: isChecked ? true : null,
disabled: item?.disabled,
disabled: item.disabled,
});
const itemText = itemToString(item);
const isChecked =
Expand Down
2 changes: 2 additions & 0 deletions packages/styles/scss/components/list-box/_list-box.scss
Expand Up @@ -670,6 +670,8 @@ $list-box-menu-width: rem(300px);

.#{$prefix}--list-box__menu-item[disabled],
.#{$prefix}--list-box__menu-item[disabled] *,
.#{$prefix}--list-box__menu-item[disabled]
.#{$prefix}--list-box__menu-item__option,
.#{$prefix}--list-box__menu-item[disabled]:hover {
color: $text-disabled;
cursor: not-allowed;
Expand Down

0 comments on commit 3583c0b

Please sign in to comment.