Skip to content

Commit

Permalink
Merge pull request #6162 from nitrogenous/multiselect-checkbox
Browse files Browse the repository at this point in the history
MultiSelect Checbox Fix
  • Loading branch information
nitrogenous authored Mar 15, 2024
2 parents cbdfa1c + 19c7dfc commit d00cf0f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
4 changes: 0 additions & 4 deletions components/lib/multiselect/MultiSelectBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ const classes = {
}),
checkboxContainer: 'p-checkbox p-component',
checkboxIcon: 'p-checkbox-icon p-c',
checkbox: ({ itemProps: props }) =>
classNames('p-checkbox-box', {
'p-highlight': props.selected
}),
transition: 'p-connected-overlay'
};

Expand Down
13 changes: 3 additions & 10 deletions components/lib/multiselect/MultiSelectItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ import * as React from 'react';
import { useMergeProps } from '../hooks/Hooks';
import { CheckIcon } from '../icons/check';
import { Ripple } from '../ripple/Ripple';
import { Checkbox } from '../checkbox/Checkbox';
import { IconUtils, ObjectUtils, classNames } from '../utils/Utils';

export const MultiSelectItem = React.memo((props) => {
const [focusedState, setFocusedState] = React.useState(false);
const mergeProps = useMergeProps();
const { ptm, cx } = props;
const { ptm, cx, isUnstyled } = props;

const getPTOptions = (key) => {
return ptm(key, {
Expand Down Expand Up @@ -59,14 +60,6 @@ export const MultiSelectItem = React.memo((props) => {
getPTOptions('checkboxContainer')
);

const checkboxProps = mergeProps(
{
className: cx('checkbox', { itemProps: props }),
'data-p-highlight': props.selected
},
getPTOptions('checkbox')
);

const itemProps = mergeProps(
{
className: classNames(props.className, props.option.className, cx('item', { itemProps: props })),
Expand All @@ -86,7 +79,7 @@ export const MultiSelectItem = React.memo((props) => {
return (
<li {...itemProps}>
<div {...checkboxContainerProps}>
<div {...checkboxProps}>{checkboxIcon}</div>
<Checkbox checked={props.selected} icon={checkboxIcon} pt={ptm('checkbox')} unstyled={isUnstyled()} />
</div>
<span>{content}</span>
<Ripple />
Expand Down
2 changes: 2 additions & 0 deletions components/lib/multiselect/MultiSelectPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ export const MultiSelectPanel = React.memo(
disabled={disabled}
className={props.itemClassName}
checkboxIcon={props.checkboxIcon}
isUnstyled={isUnstyled}
ptm={ptm}
cx={cx}
/>
Expand Down Expand Up @@ -197,6 +198,7 @@ export const MultiSelectPanel = React.memo(
disabled={disabled}
className={props.itemClassName}
checkboxIcon={props.checkboxIcon}
isUnstyled={isUnstyled}
ptm={ptm}
cx={cx}
/>
Expand Down

0 comments on commit d00cf0f

Please sign in to comment.