Skip to content

Commit

Permalink
make sure props desconstruction is equivalent with previous renderOpe…
Browse files Browse the repository at this point in the history
…ner function since that's where sharedProps is applied
  • Loading branch information
beaesguerra committed Nov 22, 2024
1 parent 2f163c8 commit e02ada1
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 29 deletions.
32 changes: 17 additions & 15 deletions packages/wonder-blocks-dropdown/src/components/multi-select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,32 +192,33 @@ type Props = AriaProps &
*/
const MultiSelect = (props: Props) => {
const {
alignment = "left",
disabled = false,
error = false,
id,
light = false,
shortcuts = false,
selectedValues = [],
opened,
onToggle,
onChange,
children,
opener,
testId,
alignment = "left",
dropdownStyle,
implicitAllEnabled,
isFilterable,
dropdownId,
labels: propLabels,
onChange,
onToggle,
opened,
selectedValues = [],
shortcuts = false,
style,
className,
dropdownStyle,
"aria-invalid": ariaInvalid,
"aria-required": ariaRequired,
id,
testId,
opener,
disabled = false,
error = false,
children,
dropdownId,
...sharedProps
} = props;

// Merge custom labels with the default ones
const labels = {...defaultLabels, ...props.labels};
const labels = {...defaultLabels, ...propLabels};

// Whether or not the dropdown is open.
const [open, setOpen] = React.useState(false);
Expand Down Expand Up @@ -483,6 +484,7 @@ const MultiSelect = (props: Props) => {
) : (
<SelectOpener
{...sharedProps}
error={error}
disabled={isDisabled}
id={uniqueOpenerId}
aria-controls={dropdownId}
Expand Down
28 changes: 14 additions & 14 deletions packages/wonder-blocks-dropdown/src/components/single-select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,34 +211,34 @@ type Props = AriaProps &
const SingleSelect = (props: Props) => {
const selectedIndex = React.useRef(0);
const {
children,
error = false,
id,
opener,
light = false,
placeholder,
selectedValue,
testId,
alignment = "left",
autoFocus = true,
disabled = false,
dropdownStyle,
enableTypeAhead = true,
error = false,
light = false,
isFilterable,
labels = {
clearSearch: defaultLabels.clearSearch,
filter: defaultLabels.filter,
noResults: defaultLabels.noResults,
someResults: defaultLabels.someSelected,
},
opened,
onToggle,
selectedValue,
onChange,
isFilterable,
children,
id,
opener,
placeholder,
testId,
dropdownId,
dropdownStyle,
onToggle,
opened,
style,
className,
"aria-invalid": ariaInvalid,
"aria-required": ariaRequired,
disabled = false,
dropdownId,
...sharedProps
} = props;

Expand Down

0 comments on commit e02ada1

Please sign in to comment.