Skip to content

Commit

Permalink
Merge pull request #6428 from melloware/PR6427
Browse files Browse the repository at this point in the history
Fix #6427: Chips respect removable function
  • Loading branch information
nitrogenous authored Apr 25, 2024
2 parents b244d21 + 6eaed5d commit 80bbfa6
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions components/lib/chips/Chips.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const Chips = React.memo(
}

let values = [...props.value];
const removedItem = values.splice(index, 1);
const removedItem = values.splice(index, 1)[0];

if (!isRemovable(removedItem, index)) {
return;
Expand Down Expand Up @@ -319,18 +319,18 @@ export const Chips = React.memo(
};

const createRemoveIcon = (value, index) => {
const iconProps = mergeProps(
{
className: cx('removeTokenIcon'),
onClick: (event) => removeItem(event, index),
'aria-hidden': 'true'
},
ptm('removeTokenIcon')
);
const icon = props.removeIcon || <TimesCircleIcon {...iconProps} />;
const removeIcon = IconUtils.getJSXIcon(icon, { ...iconProps }, { props });

if (!props.disabled && !props.readOnly && isRemovable(value, index)) {
const iconProps = mergeProps(
{
className: cx('removeTokenIcon'),
onClick: (event) => removeItem(event, index),
'aria-hidden': 'true'
},
ptm('removeTokenIcon')
);
const icon = props.removeIcon || <TimesCircleIcon {...iconProps} />;
const removeIcon = IconUtils.getJSXIcon(icon, { ...iconProps }, { props });

return removeIcon;
}

Expand Down

0 comments on commit 80bbfa6

Please sign in to comment.