@bloomreach/react-banana-ui 1.37.0 → 1.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,12 +6,22 @@ export default meta;
6
6
  export type Story<Value extends NonNullable<unknown> = string, Multiple extends boolean = false, FreeSolo extends boolean = false> = StoryObj<typeof Autocomplete<Value, Multiple, FreeSolo>>;
7
7
  declare const fruits: string[];
8
8
  export declare const Basic: Story;
9
+ export declare const CustomWidth: Story;
9
10
  export declare const AutoSelect: Story;
10
11
  export declare const AutoSelectFreeSoloMultiple: Story<string, true, true>;
11
12
  export declare const DefaultValue: Story;
12
13
  export declare const ControlledSingleValue: Story;
13
14
  export declare const Multiple: Story<(typeof fruits)[0], true>;
15
+ export declare const SelectAll: Story<(typeof fruits)[0], true>;
16
+ export declare const SelectAllWithDisabledOptions: Story<{
17
+ id: number;
18
+ label: string;
19
+ }, true>;
14
20
  export declare const DefaultValueMultiple: Story<(typeof fruits)[0], true>;
21
+ export declare const LimitTags: Story<(typeof fruits)[0], true>;
22
+ export declare const LimitTagsCustomText: Story<(typeof fruits)[0], true>;
23
+ export declare const MaxRows: Story<(typeof fruits)[0], true>;
24
+ export declare const LimitTagsWithMaxRows: Story<(typeof fruits)[0], true>;
15
25
  export declare const ControlledMultipleValue: Story<(typeof fruits)[0], true>;
16
26
  export declare const Disabled: Story;
17
27
  export declare const DisabledMultiple: Story<(typeof fruits)[0], true>;
@@ -49,6 +49,13 @@ export interface AutocompleteProps<AutocompleteOption extends NonNullable<unknow
49
49
  * If `true`, the Autocomplete is free solo, meaning that the user input is not bound to provided options.
50
50
  */
51
51
  freeSolo?: FreeSolo;
52
+ /**
53
+ * Customize the overflow text shown when tags are truncated by `limitTags`.
54
+ * @param more The number of hidden tags
55
+ * @returns Content to render as the overflow indicator
56
+ * @default (more) => `+${more}`
57
+ */
58
+ getLimitTagsText?: (more: number) => ReactNode;
52
59
  /**
53
60
  * Used to determine if an option is disabled.
54
61
  */
@@ -81,6 +88,12 @@ export interface AutocompleteProps<AutocompleteOption extends NonNullable<unknow
81
88
  * Icon or any element displayed at the start of the input.
82
89
  */
83
90
  leftElement?: ReactNode;
91
+ /**
92
+ * The maximum number of tags visible when the popup is closed.
93
+ * Set to `-1` to show all tags. Only works when `multiple` is `true`.
94
+ * @default -1
95
+ */
96
+ limitTags?: number;
84
97
  /**
85
98
  * If `true`, the component is in a loading state.
86
99
  * @default false
@@ -91,6 +104,11 @@ export interface AutocompleteProps<AutocompleteOption extends NonNullable<unknow
91
104
  * @default "Loading..."
92
105
  */
93
106
  loadingText?: string;
107
+ /**
108
+ * The maximum number of visible tag rows before the tag area becomes scrollable while the popup is closed.
109
+ * Only works when `multiple` is `true`.
110
+ */
111
+ maxRows?: number;
94
112
  /**
95
113
  * If `true`, the component allows multiple selections.
96
114
  * @default false
@@ -179,12 +197,30 @@ export interface AutocompleteProps<AutocompleteOption extends NonNullable<unknow
179
197
  * Icon or any element displayed at the end of the input, before the clear button and chevron.
180
198
  */
181
199
  rightElement?: ReactNode;
200
+ /**
201
+ * If `true`, a "Select all" checkbox is shown at the top of the listbox
202
+ * that toggles all currently visible (filtered) enabled options.
203
+ * Only works when `multiple` is `true`.
204
+ * @default false
205
+ */
206
+ selectAll?: boolean;
207
+ /**
208
+ * The label for the select all checkbox.
209
+ * Only applicable when both `selectAll` and `multiple` are `true`.
210
+ * @default "Select all"
211
+ */
212
+ selectAllLabel?: string;
182
213
  /**
183
214
  * The selected value.
184
215
  * Set to `null` in case of single select and `[]` in case of multiple select to clear the selection.
185
216
  * If the value is an object it must have reference equality with the option in order to be selected.
186
217
  */
187
218
  value?: AutocompleteValue<AutocompleteOption, Multiple, FreeSolo>;
219
+ /**
220
+ * The width of the autocomplete input. Accepts any valid CSS width value.
221
+ * @example '100%', '400px', 'auto'
222
+ */
223
+ width?: number | string;
188
224
  }
189
225
  export interface AutocompleteRenderGroupParams extends AutocompleteGroupedOption<object> {
190
226
  children: ReactNode;