@jobber/components 6.85.2 → 6.86.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.
@@ -1,7 +1,7 @@
1
1
  import type { Ref, RefAttributes } from "react";
2
2
  import React from "react";
3
- import { type AnyOption, type AutocompleteProps, type Option } from "./Autocomplete.types";
3
+ import { type AnyOption, type AutocompleteLegacyProps, type Option } from "./Autocomplete.types";
4
4
  import type { InputTextRef } from "../InputText";
5
- declare function AutocompleteInternal<GenericOption extends AnyOption = AnyOption, GenericOptionValue extends Option = Option, GenericGetOptionsValue extends AnyOption = AnyOption>({ initialOptions, value, allowFreeForm, size, debounce: debounceRate, onChange, getOptions, placeholder, onBlur, onFocus, validations, customRenderMenu, ...inputProps }: AutocompleteProps<GenericOption, GenericOptionValue, GenericGetOptionsValue>, ref: Ref<InputTextRef>): React.JSX.Element;
6
- export declare const Autocomplete: <GenericOption extends AnyOption = AnyOption, GenericOptionValue extends Option = Option, GenericGetOptionsValue extends AnyOption = AnyOption>(props: AutocompleteProps<GenericOption, GenericOptionValue, GenericGetOptionsValue> & RefAttributes<InputTextRef>) => ReturnType<typeof AutocompleteInternal>;
5
+ declare function AutocompleteInternal<GenericOption extends AnyOption = AnyOption, GenericOptionValue extends Option = Option, GenericGetOptionsValue extends AnyOption = AnyOption>({ initialOptions, value, allowFreeForm, size, debounce: debounceRate, onChange, getOptions, placeholder, onBlur, onFocus, validations, customRenderMenu, ...inputProps }: AutocompleteLegacyProps<GenericOption, GenericOptionValue, GenericGetOptionsValue>, ref: Ref<InputTextRef>): React.JSX.Element;
6
+ export declare const Autocomplete: <GenericOption extends AnyOption = AnyOption, GenericOptionValue extends Option = Option, GenericGetOptionsValue extends AnyOption = AnyOption>(props: AutocompleteLegacyProps<GenericOption, GenericOptionValue, GenericGetOptionsValue> & RefAttributes<InputTextRef>) => ReturnType<typeof AutocompleteInternal>;
7
7
  export {};
@@ -0,0 +1,8 @@
1
+ import type { Ref } from "react";
2
+ import React from "react";
3
+ import type { AutocompleteRebuiltProps, OptionLike } from "./Autocomplete.types";
4
+ export declare const AutocompleteRebuilt: <Value extends OptionLike = OptionLike, Multiple extends boolean = false>(props: AutocompleteRebuiltProps<Value, Multiple> & {
5
+ ref?: Ref<HTMLInputElement | HTMLTextAreaElement>;
6
+ }) => ReturnType<typeof AutocompleteRebuiltInternal>;
7
+ declare function AutocompleteRebuiltInternal<Value extends OptionLike, Multiple extends boolean = false>(props: AutocompleteRebuiltProps<Value, Multiple>, forwardedRef: Ref<HTMLInputElement | HTMLTextAreaElement>): React.JSX.Element;
8
+ export {};
@@ -1,6 +1,7 @@
1
- import type { RefObject } from "react";
1
+ import type { CSSProperties, Key, Ref, RefObject } from "react";
2
2
  import type { FormFieldProps } from "../FormField";
3
- import type { InputTextRef } from "../InputText";
3
+ import type { InputTextRebuiltProps, InputTextRef } from "../InputText";
4
+ export type ExtraProps = Record<string, unknown>;
4
5
  type OptionValue = string | number;
5
6
  export interface BaseOption {
6
7
  label: string;
@@ -16,7 +17,7 @@ export interface GroupOption extends BaseOption {
16
17
  export type OptionCollection = AnyOption[];
17
18
  export type AnyOption<GenericOption extends Option | GroupOption = Option | GroupOption> = GenericOption;
18
19
  export type OptionInGroup<T extends AnyOption> = T extends GroupOption ? T["options"][number] : T;
19
- export interface AutocompleteProps<GenericOption extends AnyOption = AnyOption, GenericOptionValue extends Option = Option, GenericGetOptionsValue extends AnyOption = AnyOption> extends Pick<FormFieldProps, "clearable" | "description" | "invalid" | "name" | "onBlur" | "onFocus" | "prefix" | "size" | "suffix" | "validations"> {
20
+ export interface AutocompleteBaseProps<GenericOption extends AnyOption = AnyOption, GenericOptionValue extends Option = Option, GenericGetOptionsValue extends AnyOption = AnyOption> extends Pick<FormFieldProps, "clearable" | "description" | "invalid" | "name" | "onBlur" | "onFocus" | "prefix" | "size" | "suffix"> {
20
21
  /**
21
22
  * @deprecated
22
23
  * Use `ref` instead.
@@ -59,6 +60,33 @@ export interface AutocompleteProps<GenericOption extends AnyOption = AnyOption,
59
60
  */
60
61
  readonly customRenderMenu?: (props: CustomOptionsMenuProp<GenericOption | GenericGetOptionsValue, GenericOptionValue>) => React.ReactElement;
61
62
  }
63
+ export interface AutocompleteLegacyProps<GenericOption extends AnyOption = AnyOption, GenericOptionValue extends Option = Option, GenericGetOptionsValue extends AnyOption = AnyOption> extends AutocompleteBaseProps<GenericOption, GenericOptionValue, GenericGetOptionsValue> {
64
+ /**
65
+ * Version of the component to use.
66
+ * @default 1
67
+ */
68
+ readonly version?: 1;
69
+ /**
70
+ * @deprecated
71
+ * Use `ref` instead.
72
+ */
73
+ readonly inputRef?: FormFieldProps["inputRef"];
74
+ /**
75
+ * Initial options to display in the autocomplete.
76
+ */
77
+ readonly initialOptions?: GenericOption[];
78
+ /**
79
+ * Called as the user types in the input. The autocomplete will display what
80
+ * is returned from this method to the user as available options.
81
+ * @param newInputText
82
+ */
83
+ readonly getOptions: (newInputText: string) => Array<GenericGetOptionsValue | GenericOption> | Promise<Array<GenericGetOptionsValue | GenericOption>>;
84
+ /**
85
+ * Validations to run on the input.
86
+ */
87
+ readonly validations?: FormFieldProps["validations"];
88
+ }
89
+ export type AutocompleteProps<GenericOption extends AnyOption = AnyOption, GenericOptionValue extends Option = Option, GenericGetOptionsValue extends AnyOption = AnyOption> = AutocompleteLegacyProps<GenericOption, GenericOptionValue, GenericGetOptionsValue>;
62
90
  export type CustomOptionsMenuType<GenericOption extends AnyOption = AnyOption> = (props: CustomOptionsMenuProp<GenericOption>) => React.ReactElement;
63
91
  export interface MenuProps<GenericOption extends AnyOption = AnyOption, GenericOptionValue extends Option = Option> {
64
92
  readonly options: GenericOption[];
@@ -98,8 +126,9 @@ export interface CustomOptionsMenuProp<GenericOption extends AnyOption = AnyOpti
98
126
  readonly inputFocused: boolean;
99
127
  /**
100
128
  * Ref to the TextInput element.
129
+ * v1 provides InputTextRef; v2 provides a DOM element ref.
101
130
  */
102
- readonly inputRef: RefObject<InputTextRef | null>;
131
+ readonly inputRef: RefObject<InputTextRef | HTMLInputElement | HTMLTextAreaElement | null>;
103
132
  /**
104
133
  * Component that wraps the menu content. Used for handling keyboard scroll behavior.
105
134
  */
@@ -108,4 +137,360 @@ export interface CustomOptionsMenuProp<GenericOption extends AnyOption = AnyOpti
108
137
  visible: boolean;
109
138
  }) => React.ReactElement;
110
139
  }
140
+ export interface OptionLike {
141
+ label: string;
142
+ /**
143
+ * "label" will be used as the key by default
144
+ * If labels are not unique, a unique key must be provided
145
+ */
146
+ key?: Key;
147
+ }
148
+ interface MenuActionBase {
149
+ type: "action";
150
+ label: string;
151
+ /**
152
+ * "label" will be used as the key by default
153
+ * If labels are not unique, a unique key must be provided
154
+ */
155
+ key?: Key;
156
+ /**
157
+ * Determines if the menu should close when the action is used.
158
+ *
159
+ * @default true
160
+ */
161
+ shouldClose?: boolean;
162
+ onClick: () => void;
163
+ }
164
+ export type MenuAction<Extra extends object = ExtraProps> = MenuActionBase & Extra;
165
+ export interface ActionConfig {
166
+ run: () => void;
167
+ closeOnRun?: boolean;
168
+ }
169
+ export type MenuSection<T extends OptionLike, SectionExtra extends object = ExtraProps, ActionExtra extends object = ExtraProps> = SectionExtra & {
170
+ type: "section";
171
+ label: string;
172
+ /**
173
+ * "label" will be used as the key by default
174
+ * If labels are not unique, a unique key must be provided
175
+ */
176
+ key?: Key;
177
+ options: T[];
178
+ actions?: MenuAction<ActionExtra>[];
179
+ };
180
+ export interface MenuOptions<T extends OptionLike, ActionExtra extends object = ExtraProps> {
181
+ type: "options";
182
+ options: T[];
183
+ actions?: MenuAction<ActionExtra>[];
184
+ }
185
+ export type MenuHeader<Extra extends object = ExtraProps> = Extra & {
186
+ type: "header";
187
+ label: string;
188
+ /**
189
+ * "label" will be used as the key by default
190
+ * If labels are not unique, a unique key must be provided
191
+ */
192
+ key?: Key;
193
+ /**
194
+ * If provided, the header item is interactive and participates in
195
+ * arrow-key navigation. Activated with Enter.
196
+ */
197
+ onClick?: () => void;
198
+ /**
199
+ * Determines if the menu should close when the header is activated.
200
+ * @default true
201
+ */
202
+ shouldClose?: boolean;
203
+ };
204
+ export type MenuFooter<Extra extends object = ExtraProps> = Extra & {
205
+ type: "footer";
206
+ label: string;
207
+ /**
208
+ * "label" will be used as the key by default
209
+ * If labels are not unique, a unique key must be provided
210
+ */
211
+ key?: Key;
212
+ /**
213
+ * If provided, the footer item is interactive and participates in
214
+ * arrow-key navigation. Activated with Enter.
215
+ */
216
+ onClick?: () => void;
217
+ /**
218
+ * Determines if the menu should close when the footer is activated.
219
+ * @default true
220
+ */
221
+ shouldClose?: boolean;
222
+ };
223
+ export type MenuItem<T extends OptionLike, SectionExtra extends object = ExtraProps, ActionExtra extends object = ExtraProps> = MenuSection<T, SectionExtra, ActionExtra> | MenuOptions<T, ActionExtra> | MenuHeader<ActionExtra> | MenuFooter<ActionExtra>;
224
+ export type AutocompleteValue<Value extends OptionLike, Multiple extends boolean> = Multiple extends true ? Value[] : Value | undefined;
225
+ interface AutocompleteRebuiltBaseProps<Value extends OptionLike, Multiple extends boolean, SectionExtra extends object, ActionExtra extends object> {
226
+ version: 2;
227
+ /**
228
+ * Whether the autocomplete allows multiple selections.
229
+ * WARNING: This is currently incomplete and will not display selections, only data is returned.
230
+ * Do not use this prop unless you are sure you know what you are doing.
231
+ */
232
+ readonly multiple?: Multiple;
233
+ /**
234
+ * The currently selected value of the Autocomplete.
235
+ * Single-select: undefined indicates no selection
236
+ */
237
+ readonly value: AutocompleteValue<Value, Multiple>;
238
+ /**
239
+ * The current input value of the Autocomplete.
240
+ */
241
+ readonly inputValue: string;
242
+ /**
243
+ * Callback invoked when the input value changes.
244
+ */
245
+ readonly onInputChange: (value: string) => void;
246
+ /**
247
+ * Callback invoked when the input is blurred.
248
+ */
249
+ readonly onBlur?: () => void;
250
+ /**
251
+ * Callback invoked when the input is focused.
252
+ */
253
+ readonly onFocus?: () => void;
254
+ /**
255
+ * Custom equality for input text to option mapping.
256
+ * Defaults to case-sensitive label equality via getOptionLabel.
257
+ */
258
+ readonly inputEqualsOption?: (input: string, option: Value) => boolean;
259
+ /**
260
+ * Data structure for the menu.
261
+ * Observes a data hierarchy to determine elements, order, and grouping.
262
+ * Accepts Sections, Options as top level objects in the array.
263
+ * Actions may appear in both sections and options.
264
+ */
265
+ readonly menu: MenuItem<Value, SectionExtra, ActionExtra>[];
266
+ /**
267
+ * Controls how options are filtered in response to the current input value.
268
+ * - Omit to use the default case-insensitive substring match against labels using getOptionLabel
269
+ * - Provide a function to implement custom filtering logic
270
+ * - Set to `false` to opt out of filtering entirely (useful for async options)
271
+ */
272
+ readonly filterOptions?: ((options: Value[], inputValue: string) => Value[]) | false;
273
+ /**
274
+ * Used to determine the label for a given option, useful for custom data for options.
275
+ * Defaults to option.label.
276
+ */
277
+ readonly getOptionLabel?: (option: Value) => string;
278
+ /**
279
+ * Debounce in milliseconds for input-driven filtering and search render.
280
+ * Set to 0 to disable debouncing.
281
+ *
282
+ * @default 300
283
+ */
284
+ readonly debounce?: number;
285
+ /**
286
+ * Render prop to customize the rendering of an option.
287
+ * @param args.value - The option value including all extra keys from the menu item
288
+ * @param args.isActive - Whether the option is currently highlighted/active
289
+ * @param args.isSelected - Whether the option is currently selected
290
+ */
291
+ readonly customRenderOption?: (args: {
292
+ value: Value;
293
+ isActive: boolean;
294
+ isSelected: boolean;
295
+ }) => React.ReactNode;
296
+ /**
297
+ * Render prop to customize the rendering of a section.
298
+ * @param args.section - The section value including all extra keys from the menu item
299
+ */
300
+ readonly customRenderSection?: (section: MenuSection<Value, SectionExtra, ActionExtra>) => React.ReactNode;
301
+ /**
302
+ * Render prop to customize the rendering of an action.
303
+ * @param args.value - The action value including all extra keys from the menu item
304
+ * @param args.isActive - Whether the action is currently highlighted/active
305
+ * @param args.origin - The origin of the action ("menu" or "empty")
306
+ */
307
+ readonly customRenderAction?: (args: {
308
+ value: MenuAction<ActionExtra>;
309
+ isActive: boolean;
310
+ origin?: ActionOrigin;
311
+ }) => React.ReactNode;
312
+ /**
313
+ * Render prop to customize the rendering of header items.
314
+ */
315
+ readonly customRenderHeader?: (args: {
316
+ value: MenuHeader<ActionExtra>;
317
+ isActive?: boolean;
318
+ }) => React.ReactNode;
319
+ /**
320
+ * Render prop to customize the rendering of footer items.
321
+ */
322
+ readonly customRenderFooter?: (args: {
323
+ value: MenuFooter<ActionExtra>;
324
+ isActive?: boolean;
325
+ }) => React.ReactNode;
326
+ /**
327
+ * Render prop to customize the rendering of the input.
328
+ * @param props.inputRef - The ref to the input element
329
+ * @param props.inputProps - The props to pass to the input element
330
+ * Note that you must pass the inputRef to the input
331
+ */
332
+ readonly customRenderInput?: (props: {
333
+ inputRef: Ref<HTMLInputElement | HTMLTextAreaElement>;
334
+ inputProps: InputTextRebuiltProps;
335
+ }) => React.ReactNode;
336
+ /**
337
+ * **Use at your own risk:** Custom class names for specific elements. This should only be used as a
338
+ * **last resort**. Using this may result in unexpected side effects.
339
+ * More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
340
+ */
341
+ readonly UNSAFE_className?: {
342
+ menu?: string;
343
+ option?: string;
344
+ section?: string;
345
+ action?: string;
346
+ input?: string;
347
+ header?: string;
348
+ footer?: string;
349
+ };
350
+ /**
351
+ * **Use at your own risk:** Custom style for specific elements. This should only be used as a
352
+ * **last resort**. Using this may result in unexpected side effects.
353
+ * More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
354
+ */
355
+ readonly UNSAFE_styles?: {
356
+ menu?: CSSProperties;
357
+ option?: CSSProperties;
358
+ section?: CSSProperties;
359
+ action?: CSSProperties;
360
+ input?: CSSProperties;
361
+ header?: CSSProperties;
362
+ footer?: CSSProperties;
363
+ };
364
+ /**
365
+ * Render a custom empty state when the menu is empty.
366
+ * NOTE: Do not put interactive elements in the empty state, it will break accessibility.
367
+ * If you require interactive elements in the empty state, use the `emptyActions` prop.
368
+ * To opt out of the default empty state message entirely use "false".
369
+ *
370
+ * @default string "No options"
371
+ */
372
+ readonly emptyStateMessage?: React.ReactNode;
373
+ /**
374
+ * Actions to display when there are no options to render after filtering.
375
+ * Can be a static list or a function that derives actions from the current input value.
376
+ * When provided and options are empty, these are rendered as navigable actions. Compatible with or without `emptyStateMessage`.
377
+ */
378
+ readonly emptyActions?: MenuAction<ActionExtra>[] | ((args: {
379
+ inputValue: string;
380
+ }) => MenuAction<ActionExtra>[]);
381
+ /**
382
+ * Whether the menu should open when the input gains focus.
383
+ *
384
+ * @default true
385
+ */
386
+ readonly openOnFocus?: boolean;
387
+ /**
388
+ * The placeholder text for the input.
389
+ */
390
+ readonly placeholder?: string;
391
+ /**
392
+ * Whether the input is disabled.
393
+ */
394
+ readonly disabled?: boolean;
395
+ /**
396
+ * Error message to display below the input
397
+ * When present, invalid appearance applied to the input
398
+ */
399
+ readonly error?: string;
400
+ /**
401
+ * Whether the input is invalid. Receives invalid appearance.
402
+ */
403
+ readonly invalid?: boolean;
404
+ /**
405
+ * Whether the input is read-only.
406
+ * @default false
407
+ */
408
+ readonly readOnly?: boolean;
409
+ /**
410
+ * Description to display below the input
411
+ */
412
+ readonly description?: string;
413
+ /**
414
+ * Name of the input for form submission
415
+ */
416
+ readonly name?: string;
417
+ /**
418
+ * Size of the input
419
+ */
420
+ readonly size?: InputTextRebuiltProps["size"];
421
+ readonly suffix?: InputTextRebuiltProps["suffix"];
422
+ readonly prefix?: InputTextRebuiltProps["prefix"];
423
+ /**
424
+ * Callback invoked when the menu opens.
425
+ *
426
+ */
427
+ readonly onOpen?: () => void;
428
+ /**
429
+ * Callback invoked when the menu closes.
430
+ *
431
+ */
432
+ readonly onClose?: () => void;
433
+ /**
434
+ * Whether the menu is loading.
435
+ * Displays glimmers in the menu
436
+ */
437
+ readonly loading?: boolean;
438
+ /**
439
+ * Custom render prop for content to render when `loading` is true.
440
+ */
441
+ readonly customRenderLoading?: React.ReactNode;
442
+ /**
443
+ * Custom equality for option to value mapping.
444
+ * TODO: decide if we wanna keep this
445
+ */
446
+ readonly isOptionEqualToValue?: (option: Value, value: Value) => boolean;
447
+ }
448
+ interface FreeFormOff<Value extends OptionLike, Multiple extends boolean> {
449
+ /**
450
+ * Whether the autocomplete allows free-form input.
451
+ * When true, the input value is not restricted to the options in the menu. Input can be used to create a new value.
452
+ * When false, the input value must match an option in the menu.
453
+ * Input value will be cleared if no selection is made and focus is lost.
454
+ */
455
+ readonly allowFreeForm?: false;
456
+ /**
457
+ * Callback invoked when the selection value changes.
458
+ */
459
+ readonly onChange: (value: AutocompleteValue<Value, Multiple>) => void;
460
+ }
461
+ interface FreeFormOn<Value extends OptionLike, Multiple extends boolean> {
462
+ /**
463
+ * Whether the autocomplete allows free-form input.
464
+ * When true, the input value is not restricted to the options * in the menu. Input can be used to create a new value.
465
+ * When false, the input value must match an option in the menu.
466
+ * Input value will be cleared if no selection is made and
467
+ * Whether the autocomplete allows free-form input.
468
+ * When true, the input value is not restricted to the options in the menu. Input can be used to create a new value.
469
+ * When false, the input value must match an option in the menu.
470
+ * Input value will be cleared if no selection is made and focus is lost.
471
+ * */
472
+ readonly allowFreeForm: true;
473
+ /**
474
+ * Factory used to create a Value from free-form input when committing. Necessary with complex option values. The only value the input can produce is a string.
475
+ * @param input - The input value
476
+ */
477
+ readonly createFreeFormValue: (input: string) => Value;
478
+ /**
479
+ * Callback invoked when the selection value changes.
480
+ * This is called when we consider a selection "committed"
481
+ * - The user presses enter
482
+ * - The user clicks outside the menu with a selection typed
483
+ * - The user clicks the clear button
484
+ * The user clears a previous selection by deleting the input value
485
+ * - The user selects an option with click or enter
486
+ * - The user types a value that matches an option
487
+ * - The user types a value that does not match an option and allowFreeForm is true
488
+ */
489
+ readonly onChange: (value: AutocompleteValue<Value, Multiple>) => void;
490
+ }
491
+ export type ActionOrigin = "menu" | "empty";
492
+ export type AutocompleteRebuiltProps<Value extends OptionLike = OptionLike, Multiple extends boolean = false, SectionExtra extends object = ExtraProps, ActionExtra extends object = ExtraProps> = AutocompleteRebuiltBaseProps<Value, Multiple, SectionExtra, ActionExtra> & (FreeFormOn<Value, Multiple> | FreeFormOff<Value, Multiple>);
493
+ export declare const menuOptions: <T extends OptionLike, ActionExtra extends object = ExtraProps>(options: T[], actions?: MenuAction<ActionExtra>[]) => MenuOptions<T, ActionExtra>;
494
+ export declare const menuSection: <T extends OptionLike, SectionExtra extends object = ExtraProps, ActionExtra extends object = ExtraProps>(label: string, options: T[], actions?: MenuAction<ActionExtra>[], extra?: SectionExtra) => MenuSection<T, SectionExtra, ActionExtra>;
495
+ export declare function defineMenu<T extends OptionLike, S extends object = ExtraProps, A extends object = ExtraProps>(menu: MenuItem<T, S, A>[]): MenuItem<T, S, A>[];
111
496
  export {};
@@ -0,0 +1,37 @@
1
+ import React from "react";
2
+ import type { ActionConfig, AutocompleteRebuiltProps, OptionLike } from "../Autocomplete.types";
3
+ import type { RenderItem } from "../useAutocomplete";
4
+ interface MenuListProps<T extends OptionLike> {
5
+ readonly items: Array<RenderItem<T>>;
6
+ readonly activeIndex: number | null;
7
+ readonly indexOffset?: number;
8
+ readonly getItemProps: (userProps?: Record<string, unknown>) => Record<string, unknown>;
9
+ readonly listRef: React.MutableRefObject<Array<HTMLElement | null>>;
10
+ readonly listboxId: string;
11
+ readonly customRenderOption?: AutocompleteRebuiltProps<T, false>["customRenderOption"];
12
+ readonly customRenderSection?: AutocompleteRebuiltProps<T, false>["customRenderSection"];
13
+ readonly customRenderAction?: AutocompleteRebuiltProps<T, false>["customRenderAction"];
14
+ readonly getOptionLabel: (option: T) => string;
15
+ readonly onSelect: (option: T) => void;
16
+ readonly onAction: (action: ActionConfig) => void;
17
+ readonly isOptionSelected: (option: T) => boolean;
18
+ readonly slotOverrides?: {
19
+ option?: {
20
+ className?: string;
21
+ style?: React.CSSProperties;
22
+ };
23
+ action?: {
24
+ className?: string;
25
+ style?: React.CSSProperties;
26
+ };
27
+ section?: {
28
+ className?: string;
29
+ style?: React.CSSProperties;
30
+ };
31
+ };
32
+ }
33
+ export declare function MenuList<T extends OptionLike>({ items, activeIndex, indexOffset, getItemProps, listRef, listboxId, customRenderOption, customRenderSection, customRenderAction, getOptionLabel, onSelect, onAction, isOptionSelected, slotOverrides, }: MenuListProps<T>): React.JSX.Element;
34
+ export declare function DefaultActionContent({ textContent, }: {
35
+ readonly textContent: string;
36
+ }): React.JSX.Element;
37
+ export {};
@@ -0,0 +1,18 @@
1
+ import React from "react";
2
+ import type { ActionConfig, AutocompleteRebuiltProps, MenuFooter, MenuHeader, OptionLike } from "../Autocomplete.types";
3
+ interface PersistentRegionProps<T extends OptionLike> {
4
+ readonly items: Array<MenuHeader<Record<string, unknown>> | MenuFooter<Record<string, unknown>>>;
5
+ readonly position: "header" | "footer";
6
+ readonly activeIndex: number | null;
7
+ readonly indexOffset: number;
8
+ readonly listboxId?: string;
9
+ readonly getItemProps: (args?: Record<string, unknown>) => Record<string, unknown>;
10
+ readonly listRef: React.MutableRefObject<Array<HTMLElement | null>>;
11
+ readonly customRenderHeader?: AutocompleteRebuiltProps<T, false>["customRenderHeader"];
12
+ readonly customRenderFooter?: AutocompleteRebuiltProps<T, false>["customRenderFooter"];
13
+ readonly className?: string;
14
+ readonly style?: React.CSSProperties;
15
+ readonly onAction: (action: ActionConfig) => void;
16
+ }
17
+ export declare function PersistentRegion<T extends OptionLike>({ items, position, activeIndex, indexOffset, getItemProps, listRef, customRenderHeader, customRenderFooter, className, style, onAction, }: PersistentRegionProps<T>): React.JSX.Element | null;
18
+ export {};
@@ -0,0 +1,22 @@
1
+ import type { UseFloatingReturn, UseInteractionsReturn } from "@floating-ui/react";
2
+ export interface UseAutocompleteListNavReturn {
3
+ refs: UseFloatingReturn["refs"];
4
+ floatingStyles: UseFloatingReturn["context"]["floatingStyles"];
5
+ context: UseFloatingReturn["context"];
6
+ getReferenceProps: UseInteractionsReturn["getReferenceProps"];
7
+ getFloatingProps: UseInteractionsReturn["getFloatingProps"];
8
+ getItemProps: UseInteractionsReturn["getItemProps"];
9
+ activeIndex: number | null;
10
+ setActiveIndex: (index: number | null) => void;
11
+ listRef: React.MutableRefObject<Array<HTMLElement | null>>;
12
+ open: boolean;
13
+ setOpen: (open: boolean) => void;
14
+ setReferenceElement: (el: HTMLElement | null) => void;
15
+ }
16
+ export interface UseAutocompleteListNavProps {
17
+ navigableCount: number;
18
+ shouldResetActiveIndexOnClose?: () => boolean;
19
+ onMenuClose?: (reason?: string) => void;
20
+ selectedIndex?: number | null;
21
+ }
22
+ export declare function useAutocompleteListNav({ navigableCount, shouldResetActiveIndexOnClose, onMenuClose, selectedIndex, }: UseAutocompleteListNavProps): UseAutocompleteListNavReturn;