| 110 | ); |
| 111 | |
| 112 | interface MultiSelectProps extends RefAttributes<HTMLDivElement>, CommonProps { |
| 113 | /** The items to display in the listbox. */ |
| 114 | items?: SelectItemType[]; |
| 115 | /** The children to render for each item. */ |
| 116 | children: ReactNode | ((item: SelectItemType) => ReactNode); |
| 117 | /** The currently selected keys (controlled). */ |
| 118 | selectedKeys?: Selection; |
| 119 | /** The initial selected keys (uncontrolled). */ |
| 120 | defaultSelectedKeys?: Selection; |
| 121 | /** Handler that is called when the selection changes. */ |
| 122 | onSelectionChange?: (keys: Selection) => void; |
| 123 | /** Whether the select is disabled. */ |
| 124 | isDisabled?: boolean; |
| 125 | /** Whether the select is required. */ |
| 126 | isRequired?: boolean; |
| 127 | /** Whether the select is in an invalid state. */ |
| 128 | isInvalid?: boolean; |
| 129 | /** Additional class name for the popover. */ |
| 130 | popoverClassName?: string; |
| 131 | /** Additional class name for the root element. */ |
| 132 | className?: string; |
| 133 | /** Handler that is called when the reset button is clicked. */ |
| 134 | onReset?: () => void; |
| 135 | /** Handler that is called when the select all button is clicked. */ |
| 136 | onSelectAll?: () => void; |
| 137 | /** |
| 138 | * Whether to show the footer with reset and select all buttons. |
| 139 | * @default true |
| 140 | */ |
| 141 | showFooter?: boolean; |
| 142 | /** |
| 143 | * Whether to show the search input in the popover. |
| 144 | * @default true |
| 145 | */ |
| 146 | showSearch?: boolean; |
| 147 | /** The title to display when no items match the search. */ |
| 148 | emptyStateTitle?: string; |
| 149 | /** The description to display when no items match the search. */ |
| 150 | emptyStateDescription?: string; |
| 151 | /** Custom formatter for the selected count text in the trigger. */ |
| 152 | selectedCountFormatter?: (count: number) => ReactNode; |
| 153 | /** Supporting text displayed next to the selected count in the trigger. */ |
| 154 | supportingText?: ReactNode; |
| 155 | } |
| 156 | |
| 157 | const MultiSelectRoot = ({ |
| 158 | items, |
nothing calls this directly
no outgoing calls
no test coverage detected