Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/components/MultiSelect/MultiSelect.scss
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ $dropdown-max-height: 20rem;

&,
.p-checkbox {
max-width: 100%;
width: 100%;
}
}
Expand Down
13 changes: 13 additions & 0 deletions src/components/MultiSelect/MultiSelect.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,19 @@ export const CondensedExample: Story = {
...Array.from({ length: 26 }, (_, i) => ({
label: `${String.fromCharCode(i + 65)}`,
value: `${String.fromCharCode(i + 65)}`,
node: (
<span
style={{
display: "inline flex",
justifyContent: "space-between",
textIndent: 0,
width: "100%",
}}
>
<span>{String.fromCharCode(i + 65)}</span>
<span className="u-text--muted">20 instances</span>
</span>
),
})),
...Array.from({ length: 26 }, (_, i) => ({
label: `Item ${i + 1}`,
Expand Down
3 changes: 2 additions & 1 deletion src/components/MultiSelect/MultiSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { FadeInDown } from "./FadeInDown";
export type MultiSelectItem = {
label: string;
value: string | number;
node?: ReactNode;
group?: string;
};
Comment on lines 10 to 15

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new naming is slightly inconsistent with the CustomSelect. There we have a label: ReactNode and a text?: string with a programmatic guard in getOptionText to ensure a string value is provided. Can we use the same approach here?


Expand Down Expand Up @@ -190,7 +191,7 @@ export const MultiSelectDropdown: React.FC<MultiSelectDropdownProps> = ({
>
<CheckboxInput
disabled={disabledItemValues.has(item.value)}
label={item.label}
label={item.node ?? item.label}
checked={selectedItemValues.has(item.value)}
value={item.value}
Comment on lines 192 to 196
onChange={handleOnChange}
Expand Down
Loading