@fluentui/react-combobox 9.17.3 → 9.17.5
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.
- package/CHANGELOG.md +33 -2
- package/dist/index.d.cts +747 -0
- package/lib/Combobox.js +1 -1
- package/lib/Combobox.js.map +1 -1
- package/lib/Dropdown.js +1 -1
- package/lib/Dropdown.js.map +1 -1
- package/lib/Listbox.js +1 -1
- package/lib/Listbox.js.map +1 -1
- package/lib/Option.js +1 -1
- package/lib/Option.js.map +1 -1
- package/lib/OptionGroup.js +1 -1
- package/lib/OptionGroup.js.map +1 -1
- package/lib/components/Combobox/Combobox.js +6 -6
- package/lib/components/Combobox/Combobox.js.map +1 -1
- package/lib/components/Combobox/index.js +4 -4
- package/lib/components/Combobox/index.js.map +1 -1
- package/lib/components/Combobox/renderCombobox.js +5 -5
- package/lib/components/Combobox/renderCombobox.js.map +1 -1
- package/lib/components/Combobox/useCombobox.js +21 -14
- package/lib/components/Combobox/useCombobox.js.map +1 -1
- package/lib/components/Combobox/useComboboxStyles.styles.js +3 -3
- package/lib/components/Combobox/useComboboxStyles.styles.js.map +1 -1
- package/lib/components/Combobox/useComboboxStyles.styles.raw.js +3 -3
- package/lib/components/Combobox/useComboboxStyles.styles.raw.js.map +1 -1
- package/lib/components/Combobox/useInputTriggerSlot.js +5 -5
- package/lib/components/Combobox/useInputTriggerSlot.js.map +1 -1
- package/lib/components/Dropdown/Dropdown.js +6 -6
- package/lib/components/Dropdown/Dropdown.js.map +1 -1
- package/lib/components/Dropdown/index.js +4 -4
- package/lib/components/Dropdown/index.js.map +1 -1
- package/lib/components/Dropdown/renderDropdown.js +5 -5
- package/lib/components/Dropdown/renderDropdown.js.map +1 -1
- package/lib/components/Dropdown/useButtonTriggerSlot.js +4 -4
- package/lib/components/Dropdown/useButtonTriggerSlot.js.map +1 -1
- package/lib/components/Dropdown/useDropdown.js +21 -14
- package/lib/components/Dropdown/useDropdown.js.map +1 -1
- package/lib/components/Dropdown/useDropdownStyles.styles.js +4 -4
- package/lib/components/Dropdown/useDropdownStyles.styles.js.map +1 -1
- package/lib/components/Dropdown/useDropdownStyles.styles.raw.js +4 -4
- package/lib/components/Dropdown/useDropdownStyles.styles.raw.js.map +1 -1
- package/lib/components/Listbox/Listbox.js +6 -6
- package/lib/components/Listbox/Listbox.js.map +1 -1
- package/lib/components/Listbox/index.js +4 -4
- package/lib/components/Listbox/index.js.map +1 -1
- package/lib/components/Listbox/renderListbox.js +3 -3
- package/lib/components/Listbox/renderListbox.js.map +1 -1
- package/lib/components/Listbox/useListbox.js +10 -10
- package/lib/components/Listbox/useListbox.js.map +1 -1
- package/lib/components/Listbox/useListboxStyles.styles.js +2 -2
- package/lib/components/Listbox/useListboxStyles.styles.js.map +1 -1
- package/lib/components/Listbox/useListboxStyles.styles.raw.js +2 -2
- package/lib/components/Option/Option.js +5 -5
- package/lib/components/Option/Option.js.map +1 -1
- package/lib/components/Option/index.js +4 -4
- package/lib/components/Option/index.js.map +1 -1
- package/lib/components/Option/renderOption.js +1 -1
- package/lib/components/Option/useOption.js +5 -5
- package/lib/components/Option/useOption.js.map +1 -1
- package/lib/components/Option/useOptionStyles.styles.js +3 -3
- package/lib/components/Option/useOptionStyles.styles.js.map +1 -1
- package/lib/components/Option/useOptionStyles.styles.raw.js +3 -3
- package/lib/components/OptionGroup/OptionGroup.js +5 -5
- package/lib/components/OptionGroup/OptionGroup.js.map +1 -1
- package/lib/components/OptionGroup/index.js +4 -4
- package/lib/components/OptionGroup/index.js.map +1 -1
- package/lib/components/OptionGroup/renderOptionGroup.js +1 -1
- package/lib/components/OptionGroup/useOptionGroup.js +1 -1
- package/lib/components/OptionGroup/useOptionGroupStyles.styles.js +2 -2
- package/lib/components/OptionGroup/useOptionGroupStyles.styles.js.map +1 -1
- package/lib/components/OptionGroup/useOptionGroupStyles.styles.raw.js +2 -2
- package/lib/contexts/ComboboxContext.js +1 -1
- package/lib/contexts/ListboxContext.js +1 -1
- package/lib/contexts/useComboboxContextValues.js +1 -1
- package/lib/contexts/useListboxContextValues.js +3 -3
- package/lib/contexts/useListboxContextValues.js.map +1 -1
- package/lib/hooks/useComboboxFilter.js +2 -2
- package/lib/hooks/useComboboxFilter.js.map +1 -1
- package/lib/hooks/useTabsterEscapeIgnore.js +15 -0
- package/lib/hooks/useTabsterEscapeIgnore.js.map +1 -0
- package/lib/index.js +15 -15
- package/lib/index.js.map +1 -1
- package/lib/utils/dropdownKeyActions.js +1 -1
- package/lib/utils/useComboboxBaseState.js +5 -5
- package/lib/utils/useComboboxBaseState.js.map +1 -1
- package/lib/utils/useComboboxPositioning.js +1 -1
- package/lib/utils/useListboxSlot.js +3 -3
- package/lib/utils/useListboxSlot.js.map +1 -1
- package/lib/utils/useOptionCollection.js +1 -1
- package/lib/utils/useSelection.js +2 -2
- package/lib/utils/useTriggerSlot.js +5 -16
- package/lib/utils/useTriggerSlot.js.map +1 -1
- package/lib-commonjs/{Combobox.js → Combobox.cjs} +1 -1
- package/lib-commonjs/{Combobox.js.map → Combobox.cjs.map} +1 -1
- package/lib-commonjs/{Dropdown.js → Dropdown.cjs} +1 -1
- package/lib-commonjs/{Dropdown.js.map → Dropdown.cjs.map} +1 -1
- package/lib-commonjs/{Listbox.js → Listbox.cjs} +1 -1
- package/lib-commonjs/{Listbox.js.map → Listbox.cjs.map} +1 -1
- package/lib-commonjs/{Option.js → Option.cjs} +1 -1
- package/lib-commonjs/{Option.js.map → Option.cjs.map} +1 -1
- package/lib-commonjs/{OptionGroup.js → OptionGroup.cjs} +1 -1
- package/lib-commonjs/{OptionGroup.js.map → OptionGroup.cjs.map} +1 -1
- package/lib-commonjs/components/Combobox/{Combobox.js → Combobox.cjs} +4 -4
- package/lib-commonjs/components/Combobox/{Combobox.js.map → Combobox.cjs.map} +1 -1
- package/lib-commonjs/components/Combobox/{index.js → index.cjs} +4 -4
- package/lib-commonjs/components/Combobox/{index.js.map → index.cjs.map} +1 -1
- package/lib-commonjs/components/Combobox/{renderCombobox.js → renderCombobox.cjs} +2 -2
- package/lib-commonjs/components/Combobox/{renderCombobox.js.map → renderCombobox.cjs.map} +1 -1
- package/lib-commonjs/components/Combobox/{useCombobox.js → useCombobox.cjs} +15 -8
- package/lib-commonjs/components/Combobox/useCombobox.cjs.map +1 -0
- package/lib-commonjs/components/Combobox/useComboboxStyles.styles.cjs.map +1 -0
- package/lib-commonjs/components/Combobox/{useComboboxStyles.styles.raw.js → useComboboxStyles.styles.raw.cjs} +1 -1
- package/lib-commonjs/components/Combobox/{useComboboxStyles.styles.raw.js.map → useComboboxStyles.styles.raw.cjs.map} +1 -1
- package/lib-commonjs/components/Combobox/{useInputTriggerSlot.js → useInputTriggerSlot.cjs} +2 -2
- package/lib-commonjs/components/Combobox/{useInputTriggerSlot.js.map → useInputTriggerSlot.cjs.map} +1 -1
- package/lib-commonjs/components/Dropdown/{Dropdown.js → Dropdown.cjs} +4 -4
- package/lib-commonjs/components/Dropdown/{Dropdown.js.map → Dropdown.cjs.map} +1 -1
- package/lib-commonjs/components/Dropdown/{index.js → index.cjs} +4 -4
- package/lib-commonjs/components/Dropdown/{index.js.map → index.cjs.map} +1 -1
- package/lib-commonjs/components/Dropdown/{renderDropdown.js → renderDropdown.cjs} +2 -2
- package/lib-commonjs/components/Dropdown/{renderDropdown.js.map → renderDropdown.cjs.map} +1 -1
- package/lib-commonjs/components/Dropdown/{useButtonTriggerSlot.js → useButtonTriggerSlot.cjs} +2 -2
- package/lib-commonjs/components/Dropdown/{useButtonTriggerSlot.js.map → useButtonTriggerSlot.cjs.map} +1 -1
- package/lib-commonjs/components/Dropdown/{useDropdown.js → useDropdown.cjs} +15 -8
- package/lib-commonjs/components/Dropdown/useDropdown.cjs.map +1 -0
- package/lib-commonjs/components/Dropdown/useDropdownStyles.styles.cjs.map +1 -0
- package/lib-commonjs/components/Dropdown/{useDropdownStyles.styles.raw.js → useDropdownStyles.styles.raw.cjs} +1 -1
- package/lib-commonjs/components/Dropdown/{useDropdownStyles.styles.raw.js.map → useDropdownStyles.styles.raw.cjs.map} +1 -1
- package/lib-commonjs/components/Listbox/{Listbox.js → Listbox.cjs} +4 -4
- package/lib-commonjs/components/Listbox/{Listbox.js.map → Listbox.cjs.map} +1 -1
- package/lib-commonjs/components/Listbox/{index.js → index.cjs} +4 -4
- package/lib-commonjs/components/Listbox/{index.js.map → index.cjs.map} +1 -1
- package/lib-commonjs/components/Listbox/{renderListbox.js → renderListbox.cjs} +1 -1
- package/lib-commonjs/components/Listbox/{renderListbox.js.map → renderListbox.cjs.map} +1 -1
- package/lib-commonjs/components/Listbox/{useListbox.js → useListbox.cjs} +5 -5
- package/lib-commonjs/components/Listbox/{useListbox.js.map → useListbox.cjs.map} +1 -1
- package/lib-commonjs/components/Listbox/useListboxStyles.styles.cjs.map +1 -0
- package/lib-commonjs/components/Option/{Option.js → Option.cjs} +3 -3
- package/lib-commonjs/components/Option/{Option.js.map → Option.cjs.map} +1 -1
- package/lib-commonjs/components/Option/{index.js → index.cjs} +4 -4
- package/lib-commonjs/components/Option/{index.js.map → index.cjs.map} +1 -1
- package/lib-commonjs/components/Option/{useOption.js → useOption.cjs} +1 -1
- package/lib-commonjs/components/Option/{useOption.js.map → useOption.cjs.map} +1 -1
- package/lib-commonjs/components/Option/useOptionStyles.styles.cjs.map +1 -0
- package/lib-commonjs/components/OptionGroup/{OptionGroup.js → OptionGroup.cjs} +3 -3
- package/lib-commonjs/components/OptionGroup/{OptionGroup.js.map → OptionGroup.cjs.map} +1 -1
- package/lib-commonjs/components/OptionGroup/{index.js → index.cjs} +4 -4
- package/lib-commonjs/components/OptionGroup/{index.js.map → index.cjs.map} +1 -1
- package/lib-commonjs/components/OptionGroup/useOptionGroupStyles.styles.cjs.map +1 -0
- package/lib-commonjs/contexts/{useListboxContextValues.js → useListboxContextValues.cjs} +1 -1
- package/lib-commonjs/contexts/{useListboxContextValues.js.map → useListboxContextValues.cjs.map} +1 -1
- package/lib-commonjs/hooks/{useComboboxFilter.js → useComboboxFilter.cjs} +1 -1
- package/lib-commonjs/hooks/{useComboboxFilter.js.map → useComboboxFilter.cjs.map} +1 -1
- package/lib-commonjs/hooks/useTabsterEscapeIgnore.cjs +22 -0
- package/lib-commonjs/hooks/useTabsterEscapeIgnore.cjs.map +1 -0
- package/lib-commonjs/{index.js → index.cjs} +15 -15
- package/lib-commonjs/{index.js.map → index.cjs.map} +1 -1
- package/lib-commonjs/utils/{useComboboxBaseState.js → useComboboxBaseState.cjs} +2 -2
- package/lib-commonjs/utils/{useComboboxBaseState.js.map → useComboboxBaseState.cjs.map} +1 -1
- package/lib-commonjs/utils/{useListboxSlot.js → useListboxSlot.cjs} +1 -1
- package/lib-commonjs/utils/{useListboxSlot.js.map → useListboxSlot.cjs.map} +1 -1
- package/lib-commonjs/utils/{useTriggerSlot.js → useTriggerSlot.cjs} +2 -13
- package/lib-commonjs/utils/useTriggerSlot.cjs.map +1 -0
- package/package.json +24 -18
- package/lib-commonjs/components/Combobox/useCombobox.js.map +0 -1
- package/lib-commonjs/components/Combobox/useComboboxStyles.styles.js.map +0 -1
- package/lib-commonjs/components/Dropdown/useDropdown.js.map +0 -1
- package/lib-commonjs/components/Dropdown/useDropdownStyles.styles.js.map +0 -1
- package/lib-commonjs/components/Listbox/useListboxStyles.styles.js.map +0 -1
- package/lib-commonjs/components/Option/useOptionStyles.styles.js.map +0 -1
- package/lib-commonjs/components/OptionGroup/useOptionGroupStyles.styles.js.map +0 -1
- package/lib-commonjs/utils/useTriggerSlot.js.map +0 -1
- /package/lib-commonjs/{Selection.js → Selection.cjs} +0 -0
- /package/lib-commonjs/{Selection.js.map → Selection.cjs.map} +0 -0
- /package/lib-commonjs/components/Combobox/{Combobox.types.js → Combobox.types.cjs} +0 -0
- /package/lib-commonjs/components/Combobox/{Combobox.types.js.map → Combobox.types.cjs.map} +0 -0
- /package/lib-commonjs/components/Combobox/{useComboboxStyles.styles.js → useComboboxStyles.styles.cjs} +0 -0
- /package/lib-commonjs/components/Dropdown/{Dropdown.types.js → Dropdown.types.cjs} +0 -0
- /package/lib-commonjs/components/Dropdown/{Dropdown.types.js.map → Dropdown.types.cjs.map} +0 -0
- /package/lib-commonjs/components/Dropdown/{useDropdownStyles.styles.js → useDropdownStyles.styles.cjs} +0 -0
- /package/lib-commonjs/components/Listbox/{Listbox.types.js → Listbox.types.cjs} +0 -0
- /package/lib-commonjs/components/Listbox/{Listbox.types.js.map → Listbox.types.cjs.map} +0 -0
- /package/lib-commonjs/components/Listbox/{useListboxStyles.styles.js → useListboxStyles.styles.cjs} +0 -0
- /package/lib-commonjs/components/Listbox/{useListboxStyles.styles.raw.js → useListboxStyles.styles.raw.cjs} +0 -0
- /package/lib-commonjs/components/Listbox/{useListboxStyles.styles.raw.js.map → useListboxStyles.styles.raw.cjs.map} +0 -0
- /package/lib-commonjs/components/Option/{Option.types.js → Option.types.cjs} +0 -0
- /package/lib-commonjs/components/Option/{Option.types.js.map → Option.types.cjs.map} +0 -0
- /package/lib-commonjs/components/Option/{renderOption.js → renderOption.cjs} +0 -0
- /package/lib-commonjs/components/Option/{renderOption.js.map → renderOption.cjs.map} +0 -0
- /package/lib-commonjs/components/Option/{useOptionStyles.styles.js → useOptionStyles.styles.cjs} +0 -0
- /package/lib-commonjs/components/Option/{useOptionStyles.styles.raw.js → useOptionStyles.styles.raw.cjs} +0 -0
- /package/lib-commonjs/components/Option/{useOptionStyles.styles.raw.js.map → useOptionStyles.styles.raw.cjs.map} +0 -0
- /package/lib-commonjs/components/OptionGroup/{OptionGroup.types.js → OptionGroup.types.cjs} +0 -0
- /package/lib-commonjs/components/OptionGroup/{OptionGroup.types.js.map → OptionGroup.types.cjs.map} +0 -0
- /package/lib-commonjs/components/OptionGroup/{renderOptionGroup.js → renderOptionGroup.cjs} +0 -0
- /package/lib-commonjs/components/OptionGroup/{renderOptionGroup.js.map → renderOptionGroup.cjs.map} +0 -0
- /package/lib-commonjs/components/OptionGroup/{useOptionGroup.js → useOptionGroup.cjs} +0 -0
- /package/lib-commonjs/components/OptionGroup/{useOptionGroup.js.map → useOptionGroup.cjs.map} +0 -0
- /package/lib-commonjs/components/OptionGroup/{useOptionGroupStyles.styles.js → useOptionGroupStyles.styles.cjs} +0 -0
- /package/lib-commonjs/components/OptionGroup/{useOptionGroupStyles.styles.raw.js → useOptionGroupStyles.styles.raw.cjs} +0 -0
- /package/lib-commonjs/components/OptionGroup/{useOptionGroupStyles.styles.raw.js.map → useOptionGroupStyles.styles.raw.cjs.map} +0 -0
- /package/lib-commonjs/contexts/{ComboboxContext.js → ComboboxContext.cjs} +0 -0
- /package/lib-commonjs/contexts/{ComboboxContext.js.map → ComboboxContext.cjs.map} +0 -0
- /package/lib-commonjs/contexts/{ListboxContext.js → ListboxContext.cjs} +0 -0
- /package/lib-commonjs/contexts/{ListboxContext.js.map → ListboxContext.cjs.map} +0 -0
- /package/lib-commonjs/contexts/{useComboboxContextValues.js → useComboboxContextValues.cjs} +0 -0
- /package/lib-commonjs/contexts/{useComboboxContextValues.js.map → useComboboxContextValues.cjs.map} +0 -0
- /package/lib-commonjs/utils/{ComboboxBase.types.js → ComboboxBase.types.cjs} +0 -0
- /package/lib-commonjs/utils/{ComboboxBase.types.js.map → ComboboxBase.types.cjs.map} +0 -0
- /package/lib-commonjs/utils/{OptionCollection.types.js → OptionCollection.types.cjs} +0 -0
- /package/lib-commonjs/utils/{OptionCollection.types.js.map → OptionCollection.types.cjs.map} +0 -0
- /package/lib-commonjs/utils/{Selection.types.js → Selection.types.cjs} +0 -0
- /package/lib-commonjs/utils/{Selection.types.js.map → Selection.types.cjs.map} +0 -0
- /package/lib-commonjs/utils/{dropdownKeyActions.js → dropdownKeyActions.cjs} +0 -0
- /package/lib-commonjs/utils/{dropdownKeyActions.js.map → dropdownKeyActions.cjs.map} +0 -0
- /package/lib-commonjs/utils/{internalTokens.js → internalTokens.cjs} +0 -0
- /package/lib-commonjs/utils/{internalTokens.js.map → internalTokens.cjs.map} +0 -0
- /package/lib-commonjs/utils/{isComboboxOptionElement.js → isComboboxOptionElement.cjs} +0 -0
- /package/lib-commonjs/utils/{isComboboxOptionElement.js.map → isComboboxOptionElement.cjs.map} +0 -0
- /package/lib-commonjs/utils/{useComboboxPositioning.js → useComboboxPositioning.cjs} +0 -0
- /package/lib-commonjs/utils/{useComboboxPositioning.js.map → useComboboxPositioning.cjs.map} +0 -0
- /package/lib-commonjs/utils/{useOptionCollection.js → useOptionCollection.cjs} +0 -0
- /package/lib-commonjs/utils/{useOptionCollection.js.map → useOptionCollection.cjs.map} +0 -0
- /package/lib-commonjs/utils/{useSelection.js → useSelection.cjs} +0 -0
- /package/lib-commonjs/utils/{useSelection.js.map → useSelection.cjs.map} +0 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,747 @@
|
|
|
1
|
+
import type { ActiveDescendantChangeEvent } from '@fluentui/react-aria';
|
|
2
|
+
import type { ActiveDescendantContextValue } from '@fluentui/react-aria';
|
|
3
|
+
import type { ActiveDescendantImperativeRef } from '@fluentui/react-aria';
|
|
4
|
+
import type { ComponentProps } from '@fluentui/react-utilities';
|
|
5
|
+
import type { ComponentState } from '@fluentui/react-utilities';
|
|
6
|
+
import type { ContextSelector } from '@fluentui/react-context-selector';
|
|
7
|
+
import type { DistributiveOmit } from '@fluentui/react-utilities';
|
|
8
|
+
import type { EventData } from '@fluentui/react-utilities';
|
|
9
|
+
import type { EventHandler } from '@fluentui/react-utilities';
|
|
10
|
+
import type { ExtractSlotProps } from '@fluentui/react-utilities';
|
|
11
|
+
import { FC } from 'react';
|
|
12
|
+
import type { ForwardRefComponent } from '@fluentui/react-utilities';
|
|
13
|
+
import type { JSXElement } from '@fluentui/react-utilities';
|
|
14
|
+
import type { PortalProps } from '@fluentui/react-portal';
|
|
15
|
+
import type { PositioningShorthand } from '@fluentui/react-positioning';
|
|
16
|
+
import { Provider } from 'react';
|
|
17
|
+
import { ProviderProps } from 'react';
|
|
18
|
+
import * as React_2 from 'react';
|
|
19
|
+
import type { Slot } from '@fluentui/react-utilities';
|
|
20
|
+
import type { SlotClassNames } from '@fluentui/react-utilities';
|
|
21
|
+
import type { SlotComponentType } from '@fluentui/react-utilities';
|
|
22
|
+
|
|
23
|
+
declare type ActiveOptionChangeData = EventData<'change', ActiveDescendantChangeEvent> & {
|
|
24
|
+
previousOption: OptionValue | null | undefined;
|
|
25
|
+
nextOption: OptionValue | null | undefined;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Combobox Props without design-only props.
|
|
30
|
+
*/
|
|
31
|
+
export declare type BaseComboboxProps = DistributiveOmit<ComboboxProps, 'appearance' | 'size'>;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* State used in rendering Combobox, without design-only state.
|
|
35
|
+
*/
|
|
36
|
+
export declare type BaseComboboxState = DistributiveOmit<ComboboxState, 'appearance' | 'size'>;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Combobox component: a selection control that allows users to choose from a set of possible options
|
|
40
|
+
*/
|
|
41
|
+
export declare const Combobox: ForwardRefComponent<ComboboxProps>;
|
|
42
|
+
|
|
43
|
+
declare type ComboboxBaseContextValues = {
|
|
44
|
+
combobox: ComboboxContextValue;
|
|
45
|
+
activeDescendant: ActiveDescendantContextValue;
|
|
46
|
+
listbox: ListboxContextValue;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Data for the Combobox onOpenChange event.
|
|
51
|
+
*/
|
|
52
|
+
declare type ComboboxBaseOpenChangeData = {
|
|
53
|
+
open: boolean;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/** Possible event types for onOpen */
|
|
57
|
+
declare type ComboboxBaseOpenEvents = React_2.MouseEvent<HTMLElement> | React_2.KeyboardEvent<HTMLElement> | React_2.FocusEvent<HTMLElement>;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* ComboboxBase Props
|
|
61
|
+
* Shared types between Combobox and Dropdown components
|
|
62
|
+
*/
|
|
63
|
+
export declare type ComboboxBaseProps = SelectionProps & HighlightedOptionProps & Pick<PortalProps, 'mountNode'> & {
|
|
64
|
+
/**
|
|
65
|
+
* Controls the colors and borders of the combobox trigger.
|
|
66
|
+
* @default 'outline'
|
|
67
|
+
*/
|
|
68
|
+
appearance?: 'filled-darker' | 'filled-lighter' | 'outline' | 'underline';
|
|
69
|
+
/**
|
|
70
|
+
* If set, the combobox will show an icon to clear the current value.
|
|
71
|
+
*/
|
|
72
|
+
clearable?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* The default open state when open is uncontrolled
|
|
75
|
+
*/
|
|
76
|
+
defaultOpen?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* The default value displayed in the trigger input or button when the combobox's value is uncontrolled
|
|
79
|
+
*/
|
|
80
|
+
defaultValue?: string;
|
|
81
|
+
/**
|
|
82
|
+
* Disable auto-focusing on the first item when mounting.
|
|
83
|
+
*
|
|
84
|
+
* @default false
|
|
85
|
+
*/
|
|
86
|
+
disableAutoFocus?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Render the combobox's popup inline in the DOM.
|
|
89
|
+
* This has accessibility benefits, particularly for touch screen readers.
|
|
90
|
+
*/
|
|
91
|
+
inlinePopup?: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Callback when the open/closed state of the dropdown changes
|
|
94
|
+
*/
|
|
95
|
+
onOpenChange?: (e: ComboboxBaseOpenEvents, data: ComboboxBaseOpenChangeData) => void;
|
|
96
|
+
/**
|
|
97
|
+
* Sets the open/closed state of the dropdown.
|
|
98
|
+
* Use together with onOpenChange to fully control the dropdown's visibility
|
|
99
|
+
*/
|
|
100
|
+
open?: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* If set, the placeholder will show when no value is selected
|
|
103
|
+
*/
|
|
104
|
+
placeholder?: string;
|
|
105
|
+
/**
|
|
106
|
+
* Configure the positioning of the combobox dropdown.
|
|
107
|
+
* Please refer to the [positioning documentation](https://react.fluentui.dev/?path=/docs/concepts-developer-positioning-components--default#anchor-to-target)
|
|
108
|
+
* for more details.
|
|
109
|
+
*
|
|
110
|
+
* @defaultvalue below
|
|
111
|
+
*/
|
|
112
|
+
positioning?: PositioningShorthand;
|
|
113
|
+
/**
|
|
114
|
+
* Controls the size of the combobox faceplate
|
|
115
|
+
* @default 'medium'
|
|
116
|
+
*/
|
|
117
|
+
size?: 'small' | 'medium' | 'large';
|
|
118
|
+
/**
|
|
119
|
+
* The value displayed by the Combobox.
|
|
120
|
+
* Use this with `onOptionSelect` to directly control the displayed value string
|
|
121
|
+
*/
|
|
122
|
+
value?: string;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* State used in rendering Combobox
|
|
127
|
+
*/
|
|
128
|
+
export declare type ComboboxBaseState = Required<Pick<ComboboxBaseProps, 'appearance' | 'open' | 'clearable' | 'inlinePopup' | 'size'>> & Pick<ComboboxBaseProps, 'mountNode' | 'placeholder' | 'value' | 'multiselect'> & OptionCollectionState & SelectionState & {
|
|
129
|
+
/**
|
|
130
|
+
* @deprecated - no longer used internally
|
|
131
|
+
*/
|
|
132
|
+
activeOption?: OptionValue;
|
|
133
|
+
/**
|
|
134
|
+
* @deprecated - no longer used internally and handled automatically be activedescendant utilities
|
|
135
|
+
* @see ACTIVEDESCENDANT_FOCUSVISIBLE_ATTRIBUTE for writing styles involving focusVisible
|
|
136
|
+
*/
|
|
137
|
+
focusVisible: boolean;
|
|
138
|
+
/**
|
|
139
|
+
* @deprecated - no longer used internally
|
|
140
|
+
* Whether the next blur event should be ignored, and the combobox/dropdown will not close.
|
|
141
|
+
*/
|
|
142
|
+
ignoreNextBlur: React_2.MutableRefObject<boolean | null>;
|
|
143
|
+
/**
|
|
144
|
+
* @deprecated - no longer used internally
|
|
145
|
+
*/
|
|
146
|
+
setActiveOption: React_2.Dispatch<React_2.SetStateAction<OptionValue | undefined>>;
|
|
147
|
+
/**
|
|
148
|
+
* @deprecated - no longer used internally and handled automatically be activedescendant utilities
|
|
149
|
+
* @see useSetKeyboardNavigation for imperatively setting focus visible state
|
|
150
|
+
*/
|
|
151
|
+
setFocusVisible(focusVisible: boolean): void;
|
|
152
|
+
/**
|
|
153
|
+
* whether the combobox/dropdown currently has focus
|
|
154
|
+
*/
|
|
155
|
+
hasFocus: boolean;
|
|
156
|
+
setHasFocus(hasFocus: boolean): void;
|
|
157
|
+
setOpen(event: ComboboxBaseOpenEvents, newState: boolean): void;
|
|
158
|
+
setValue(newValue: string | undefined): void;
|
|
159
|
+
onOptionClick: (e: React_2.MouseEvent<HTMLElement>) => void;
|
|
160
|
+
disabled: boolean;
|
|
161
|
+
freeform: boolean;
|
|
162
|
+
onActiveDescendantChange: (event: ActiveDescendantChangeEvent) => void;
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
export declare const comboboxClassNames: SlotClassNames<ComboboxSlots>;
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Context shared with Combobox, Listbox, & Options
|
|
169
|
+
*/
|
|
170
|
+
export declare type ComboboxContextValue = Pick<ComboboxState, 'activeOption' | 'appearance' | 'focusVisible' | 'open' | 'registerOption' | 'setActiveOption' | 'setOpen' | 'size'> & {
|
|
171
|
+
/**
|
|
172
|
+
* @deprecated - no longer used
|
|
173
|
+
*/
|
|
174
|
+
selectedOptions: ComboboxState['selectedOptions'];
|
|
175
|
+
/**
|
|
176
|
+
* @deprecated - no longer used
|
|
177
|
+
*/
|
|
178
|
+
selectOption: ComboboxState['selectOption'];
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
export declare type ComboboxContextValues = ComboboxBaseContextValues;
|
|
182
|
+
|
|
183
|
+
export declare type ComboboxOpenChangeData = ComboboxBaseOpenChangeData;
|
|
184
|
+
|
|
185
|
+
export declare type ComboboxOpenEvents = ComboboxBaseOpenEvents;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Combobox Props
|
|
189
|
+
*/
|
|
190
|
+
export declare type ComboboxProps = Omit<ComponentProps<Partial<ComboboxSlots>, 'input'>, 'children' | 'size'> & ComboboxBaseProps & {
|
|
191
|
+
freeform?: boolean;
|
|
192
|
+
/**
|
|
193
|
+
* The primary slot, `<input>`, does not support children so we need to explicitly include it here.
|
|
194
|
+
*/
|
|
195
|
+
children?: React_2.ReactNode;
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* @deprecated - render ListboxProvider instead
|
|
200
|
+
* @see ListboxProvider
|
|
201
|
+
* @see useListboxContext_unstable
|
|
202
|
+
*/
|
|
203
|
+
export declare const ComboboxProvider: Provider<ComboboxContextValue> & FC<ProviderProps<ComboboxContextValue>>;
|
|
204
|
+
|
|
205
|
+
export declare type ComboboxSlots = {
|
|
206
|
+
/** The root combobox slot */
|
|
207
|
+
root: NonNullable<Slot<'div'>>;
|
|
208
|
+
/** The dropdown arrow icon */
|
|
209
|
+
expandIcon?: Slot<'span'>;
|
|
210
|
+
/** The dropdown clear icon */
|
|
211
|
+
clearIcon?: Slot<'span'>;
|
|
212
|
+
/** The primary slot, an input with role="combobox" */
|
|
213
|
+
input: NonNullable<Slot<'input'>>;
|
|
214
|
+
/** The dropdown listbox slot */
|
|
215
|
+
listbox?: Slot<typeof Listbox>;
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* State used in rendering Combobox
|
|
220
|
+
*/
|
|
221
|
+
export declare type ComboboxState = ComponentState<ComboboxSlots> & ComboboxBaseState & {
|
|
222
|
+
showClearIcon?: boolean;
|
|
223
|
+
activeDescendantController: ActiveDescendantImperativeRef;
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Dropdown component: a selection control that allows users to choose from a set of possible options
|
|
228
|
+
*/
|
|
229
|
+
export declare const Dropdown: ForwardRefComponent<DropdownProps>;
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Dropdown Props without design-only props.
|
|
233
|
+
*/
|
|
234
|
+
export declare type DropdownBaseHookProps = DistributiveOmit<DropdownProps, 'appearance' | 'size'>;
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* State used in rendering Dropdown, without design-only state.
|
|
238
|
+
*/
|
|
239
|
+
export declare type DropdownBaseHookState = DistributiveOmit<DropdownState, 'appearance' | 'size'>;
|
|
240
|
+
|
|
241
|
+
export declare const dropdownClassNames: SlotClassNames<DropdownSlots>;
|
|
242
|
+
|
|
243
|
+
export declare type DropdownContextValues = ComboboxBaseContextValues;
|
|
244
|
+
|
|
245
|
+
export declare type DropdownOpenChangeData = ComboboxBaseOpenChangeData;
|
|
246
|
+
|
|
247
|
+
export declare type DropdownOpenEvents = ComboboxBaseOpenEvents;
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Dropdown Props
|
|
251
|
+
*/
|
|
252
|
+
export declare type DropdownProps = ComponentProps<Partial<DropdownSlots>, 'button'> & ComboboxBaseProps;
|
|
253
|
+
|
|
254
|
+
export declare type DropdownSlots = {
|
|
255
|
+
/** The root dropdown slot */
|
|
256
|
+
root: NonNullable<Slot<'div'>>;
|
|
257
|
+
/** The dropdown arrow icon */
|
|
258
|
+
expandIcon?: Slot<'span'>;
|
|
259
|
+
/** The dropdown clear icon */
|
|
260
|
+
clearButton?: Slot<'button'>;
|
|
261
|
+
/** The primary slot, the element with role="combobox" */
|
|
262
|
+
button: NonNullable<Slot<'button'>>;
|
|
263
|
+
/** The dropdown listbox slot */
|
|
264
|
+
listbox?: Slot<typeof Listbox>;
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* State used in rendering Dropdown
|
|
269
|
+
*/
|
|
270
|
+
export declare type DropdownState = ComponentState<DropdownSlots> & Omit<ComboboxBaseState, 'freeform'> & {
|
|
271
|
+
/** Whether the placeholder is currently displayed */
|
|
272
|
+
placeholderVisible: boolean;
|
|
273
|
+
showClearButton?: boolean;
|
|
274
|
+
activeDescendantController: ActiveDescendantImperativeRef;
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
declare type HighlightedOptionProps = {
|
|
278
|
+
onActiveOptionChange?: EventHandler<ActiveOptionChangeData>;
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Checks whether the given element is a combobox option element.
|
|
283
|
+
* Supports elements with role="option" or role="menuitemcheckbox".
|
|
284
|
+
*
|
|
285
|
+
* @param element - the element to check
|
|
286
|
+
* @returns true if the element has a valid combobox option role, false otherwise
|
|
287
|
+
*/
|
|
288
|
+
export declare function isComboboxOptionElement(element: HTMLElement): boolean;
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Listbox component: a standalone selection control, or the popup in a Combobox
|
|
292
|
+
*/
|
|
293
|
+
export declare const Listbox: ForwardRefComponent<ListboxProps>;
|
|
294
|
+
|
|
295
|
+
export declare const listboxClassNames: SlotClassNames<ListboxSlots>;
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Context shared with all Listbox Options
|
|
299
|
+
*/
|
|
300
|
+
export declare type ListboxContextValue = Pick<ListboxState, 'activeOption' | 'focusVisible' | 'getOptionById' | 'getOptionsMatchingValue' | 'multiselect' | 'registerOption' | 'selectedOptions' | 'selectOption' | 'setActiveOption'> & {
|
|
301
|
+
onOptionClick: (e: React_2.MouseEvent<HTMLElement>) => void;
|
|
302
|
+
onActiveDescendantChange?: (e: ActiveDescendantChangeEvent) => void;
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
export declare type ListboxContextValues = {
|
|
306
|
+
listbox: ListboxContextValue;
|
|
307
|
+
activeDescendant: ActiveDescendantContextValue;
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Listbox Props
|
|
312
|
+
*/
|
|
313
|
+
export declare type ListboxProps = ComponentProps<ListboxSlots> & SelectionProps & {
|
|
314
|
+
/**
|
|
315
|
+
* Disable auto-focusing on the first item when mounting.
|
|
316
|
+
*
|
|
317
|
+
* @default false
|
|
318
|
+
*/
|
|
319
|
+
disableAutoFocus?: boolean;
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
export declare const ListboxProvider: React_2.Provider<ListboxContextValue | undefined> & React_2.FC<React_2.ProviderProps<ListboxContextValue | undefined>>;
|
|
323
|
+
|
|
324
|
+
export declare type ListboxSlots = {
|
|
325
|
+
/** The root slot, a `<div>` with `role="listbox"` */
|
|
326
|
+
root: Slot<'div'>;
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* State used in rendering Listbox
|
|
331
|
+
*/
|
|
332
|
+
export declare type ListboxState = ComponentState<ListboxSlots> & OptionCollectionState & Pick<SelectionProps, 'multiselect'> & SelectionState & {
|
|
333
|
+
/**
|
|
334
|
+
* @deprecated - no longer used internally
|
|
335
|
+
* @see activeDescendantController.active()
|
|
336
|
+
*/
|
|
337
|
+
activeOption?: OptionValue;
|
|
338
|
+
/**
|
|
339
|
+
* @deprecated - no longer used internally
|
|
340
|
+
*/
|
|
341
|
+
focusVisible: boolean;
|
|
342
|
+
/**
|
|
343
|
+
* @deprecated - no longer used internally
|
|
344
|
+
* @see activeDescendantController.focus(id)
|
|
345
|
+
*/
|
|
346
|
+
setActiveOption(option?: OptionValue): void;
|
|
347
|
+
standalone: boolean;
|
|
348
|
+
selectOption(event: SelectionEvents, option: OptionValue): void;
|
|
349
|
+
activeDescendantController: ActiveDescendantImperativeRef;
|
|
350
|
+
onActiveDescendantChange?: (event: ActiveDescendantChangeEvent) => void;
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Option component: a styled child option of a Combobox
|
|
355
|
+
*/
|
|
356
|
+
declare const Option_2: ForwardRefComponent<OptionProps>;
|
|
357
|
+
export { Option_2 as Option }
|
|
358
|
+
|
|
359
|
+
export declare const optionClassNames: SlotClassNames<OptionSlots>;
|
|
360
|
+
|
|
361
|
+
declare type OptionCollectionState = {
|
|
362
|
+
/**
|
|
363
|
+
* @deprecated - no longer used internally
|
|
364
|
+
*/
|
|
365
|
+
getIndexOfId(id: string): number;
|
|
366
|
+
/**
|
|
367
|
+
* @deprecated - no longer used internally
|
|
368
|
+
*/
|
|
369
|
+
getOptionAtIndex(index: number): OptionValue | undefined;
|
|
370
|
+
/**
|
|
371
|
+
* @deprecated - no longer used internally
|
|
372
|
+
*/
|
|
373
|
+
getOptionsMatchingText(matcher: (text: string) => boolean): OptionValue[];
|
|
374
|
+
/** The total number of options in the collection. */
|
|
375
|
+
getCount: () => number;
|
|
376
|
+
/** Returns the option data by key. */
|
|
377
|
+
getOptionById(id: string): OptionValue | undefined;
|
|
378
|
+
/** Returns an array of options filtered by a value matching function against the option's value string. */
|
|
379
|
+
getOptionsMatchingValue(matcher: (value: string) => boolean): OptionValue[];
|
|
380
|
+
/** The unordered option data. */
|
|
381
|
+
options: OptionValue[];
|
|
382
|
+
/** A function that child options call to register their values. Returns a function to unregister the option. */
|
|
383
|
+
registerOption: (option: OptionValue, element: HTMLElement) => () => void;
|
|
384
|
+
};
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* OptionGroup component: allows grouping of Option components within a Combobox
|
|
388
|
+
*/
|
|
389
|
+
export declare const OptionGroup: ForwardRefComponent<OptionGroupProps>;
|
|
390
|
+
|
|
391
|
+
export declare const optionGroupClassNames: SlotClassNames<OptionGroupSlots>;
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* OptionGroup Props
|
|
395
|
+
*/
|
|
396
|
+
export declare type OptionGroupProps = ComponentProps<Partial<OptionGroupSlots>>;
|
|
397
|
+
|
|
398
|
+
export declare type OptionGroupSlots = {
|
|
399
|
+
/** The root group wrapper */
|
|
400
|
+
root: NonNullable<Slot<'div'>>;
|
|
401
|
+
/**
|
|
402
|
+
* The option group label, displayed as static text before the child options.
|
|
403
|
+
* If not using label, it's recommended to set `aria-label` directly on the OptionGroup instead.
|
|
404
|
+
*/
|
|
405
|
+
label?: Slot<'span'>;
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* State used in rendering OptionGroup
|
|
410
|
+
*/
|
|
411
|
+
export declare type OptionGroupState = ComponentState<OptionGroupSlots>;
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* Data for the onOptionSelect callback.
|
|
415
|
+
* `optionValue` and `optionText` will be undefined if multiple options are modified at once.
|
|
416
|
+
*/
|
|
417
|
+
export declare type OptionOnSelectData = {
|
|
418
|
+
optionValue: string | undefined;
|
|
419
|
+
optionText: string | undefined;
|
|
420
|
+
selectedOptions: string[];
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* Option Props
|
|
425
|
+
*/
|
|
426
|
+
export declare type OptionProps = ComponentProps<Partial<OptionSlots>> & {
|
|
427
|
+
/**
|
|
428
|
+
* Sets an option to the `disabled` state.
|
|
429
|
+
* Disabled options cannot be selected, but are still keyboard navigable
|
|
430
|
+
*/
|
|
431
|
+
disabled?: boolean;
|
|
432
|
+
/**
|
|
433
|
+
* Defines a unique identifier for the option.
|
|
434
|
+
* Use this to control selectedOptions, or to get the option value in the onOptionSelect callback.
|
|
435
|
+
* Defaults to `text` if not provided.
|
|
436
|
+
*/
|
|
437
|
+
value?: string;
|
|
438
|
+
} & ({
|
|
439
|
+
/**
|
|
440
|
+
* An optional override the string value of the Option's display text,
|
|
441
|
+
* defaulting to the Option's child content.
|
|
442
|
+
* This is used as the Dropdown button's or Combobox input's value when the option is selected,
|
|
443
|
+
* and as the comparison for type-to-find keyboard functionality.
|
|
444
|
+
*/
|
|
445
|
+
text?: string;
|
|
446
|
+
children: string;
|
|
447
|
+
} | {
|
|
448
|
+
/**
|
|
449
|
+
* The string value of the Option's display text when the Option's children are not a string.
|
|
450
|
+
* This is used as the Dropdown button's or Combobox input's value when the option is selected,
|
|
451
|
+
* and as the comparison for type-to-find keyboard functionality.
|
|
452
|
+
*/
|
|
453
|
+
text: string;
|
|
454
|
+
children?: React_2.ReactNode;
|
|
455
|
+
});
|
|
456
|
+
|
|
457
|
+
export declare type OptionSlots = {
|
|
458
|
+
/** The root option slot, with role="option" */
|
|
459
|
+
root: NonNullable<Slot<'div'>>;
|
|
460
|
+
/** The check icon that is visible for selected options */
|
|
461
|
+
checkIcon: Slot<'span'>;
|
|
462
|
+
};
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* State used in rendering Option
|
|
466
|
+
*/
|
|
467
|
+
export declare type OptionState = ComponentState<OptionSlots> & Pick<OptionProps, 'disabled'> & {
|
|
468
|
+
/**
|
|
469
|
+
* @deprecated - no longer used internally
|
|
470
|
+
*/
|
|
471
|
+
active: boolean;
|
|
472
|
+
/**
|
|
473
|
+
* @deprecated - no longer used internally
|
|
474
|
+
*/
|
|
475
|
+
focusVisible: boolean;
|
|
476
|
+
/** If true, the option is part of a multiselect combobox or listbox */
|
|
477
|
+
multiselect?: boolean;
|
|
478
|
+
/** If true, the option is selected */
|
|
479
|
+
selected: boolean;
|
|
480
|
+
};
|
|
481
|
+
|
|
482
|
+
declare type OptionValue = {
|
|
483
|
+
/** The disabled state of the option. */
|
|
484
|
+
disabled?: boolean;
|
|
485
|
+
/** The `id` attribute of the option. */
|
|
486
|
+
id: string;
|
|
487
|
+
/** The `text` string for the option. */
|
|
488
|
+
text: string;
|
|
489
|
+
/** The value string of the option. */
|
|
490
|
+
value: string;
|
|
491
|
+
};
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* Render the final JSX of Combobox
|
|
495
|
+
*/
|
|
496
|
+
export declare const renderCombobox_unstable: (state: BaseComboboxState, contextValues: ComboboxContextValues) => JSXElement;
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* Render the final JSX of Dropdown
|
|
500
|
+
*/
|
|
501
|
+
export declare const renderDropdown_unstable: (state: DropdownState, contextValues: DropdownContextValues) => JSXElement;
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* Render the final JSX of Listbox
|
|
505
|
+
*/
|
|
506
|
+
export declare const renderListbox_unstable: (state: ListboxState, contextValues: ListboxContextValues) => JSXElement;
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* Render the final JSX of Option
|
|
510
|
+
*/
|
|
511
|
+
export declare const renderOption_unstable: (state: OptionState) => JSXElement;
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* Render the final JSX of OptionGroup
|
|
515
|
+
*/
|
|
516
|
+
export declare const renderOptionGroup_unstable: (state: OptionGroupState) => JSXElement;
|
|
517
|
+
|
|
518
|
+
/** Possible event types for onOptionSelect */
|
|
519
|
+
export declare type SelectionEvents = React_2.ChangeEvent<HTMLElement> | React_2.KeyboardEvent<HTMLElement> | React_2.MouseEvent<HTMLElement>;
|
|
520
|
+
|
|
521
|
+
declare type SelectionProps = {
|
|
522
|
+
/**
|
|
523
|
+
* For an uncontrolled component, sets the initial selection.
|
|
524
|
+
* If this is set, the `defaultValue` prop MUST also be set.
|
|
525
|
+
*/
|
|
526
|
+
defaultSelectedOptions?: string[];
|
|
527
|
+
/**
|
|
528
|
+
* Sets the selection type to multiselect.
|
|
529
|
+
* Set this to true for multiselect, even if fully controlling selection state.
|
|
530
|
+
* This enables styles and accessibility properties to be set.
|
|
531
|
+
* @default false
|
|
532
|
+
*/
|
|
533
|
+
multiselect?: boolean;
|
|
534
|
+
/** Callback when an option is selected */
|
|
535
|
+
onOptionSelect?: (event: SelectionEvents, data: OptionOnSelectData) => void;
|
|
536
|
+
/**
|
|
537
|
+
* An array of selected option keys.
|
|
538
|
+
* Use this with `onOptionSelect` to directly control the selected option(s)
|
|
539
|
+
* If this is set, the `value` prop MUST also be controlled.
|
|
540
|
+
*/
|
|
541
|
+
selectedOptions?: string[];
|
|
542
|
+
};
|
|
543
|
+
|
|
544
|
+
/** Values returned by the useSelection hook */
|
|
545
|
+
declare type SelectionState = {
|
|
546
|
+
clearSelection: (event: SelectionEvents) => void;
|
|
547
|
+
selectedOptions: string[];
|
|
548
|
+
selectOption: (event: SelectionEvents, option: OptionValue) => void;
|
|
549
|
+
};
|
|
550
|
+
|
|
551
|
+
/**
|
|
552
|
+
* useButtonTriggerSlot returns a tuple of trigger/listbox shorthand,
|
|
553
|
+
* with the semantics and event handlers needed for the Combobox and Dropdown components.
|
|
554
|
+
* The element type of the ref should always match the element type used in the trigger shorthand.
|
|
555
|
+
*
|
|
556
|
+
* @internal
|
|
557
|
+
*/
|
|
558
|
+
export declare function useButtonTriggerSlot(triggerFromProps: NonNullable<Slot<'button'>>, ref: React_2.Ref<HTMLButtonElement>, options: UseButtonTriggerSlotOptions): SlotComponentType<ExtractSlotProps<Slot<'button'>>>;
|
|
559
|
+
|
|
560
|
+
declare type UseButtonTriggerSlotOptions = {
|
|
561
|
+
state: UseTriggerSlotState;
|
|
562
|
+
defaultProps: unknown;
|
|
563
|
+
activeDescendantController: ActiveDescendantImperativeRef;
|
|
564
|
+
};
|
|
565
|
+
|
|
566
|
+
/**
|
|
567
|
+
* Create the state required to render Combobox.
|
|
568
|
+
*
|
|
569
|
+
* The returned state can be modified with hooks such as useComboboxStyles_unstable,
|
|
570
|
+
* before being passed to renderCombobox_unstable.
|
|
571
|
+
*
|
|
572
|
+
* @param props - props from this instance of Combobox
|
|
573
|
+
* @param ref - reference to root HTMLElement of Combobox
|
|
574
|
+
*/
|
|
575
|
+
export declare const useCombobox_unstable: (props: ComboboxProps, ref: React_2.Ref<HTMLInputElement>) => ComboboxState;
|
|
576
|
+
|
|
577
|
+
/**
|
|
578
|
+
* Create the base state required to render Combobox, without design-only props.
|
|
579
|
+
*
|
|
580
|
+
* @param props - props from this instance of Combobox (without appearance and size)
|
|
581
|
+
* @param ref - reference to root HTMLInputElement of Combobox
|
|
582
|
+
*/
|
|
583
|
+
export declare const useComboboxBase_unstable: (props: BaseComboboxProps, ref: React_2.Ref<HTMLInputElement>) => BaseComboboxState;
|
|
584
|
+
|
|
585
|
+
/**
|
|
586
|
+
* State shared between Combobox and Dropdown components
|
|
587
|
+
*
|
|
588
|
+
* @internal
|
|
589
|
+
*/
|
|
590
|
+
export declare const useComboboxBaseState: (props: ComboboxBaseProps & {
|
|
591
|
+
children?: React_2.ReactNode;
|
|
592
|
+
editable?: boolean;
|
|
593
|
+
disabled?: boolean;
|
|
594
|
+
freeform?: boolean;
|
|
595
|
+
activeDescendantController: ActiveDescendantImperativeRef;
|
|
596
|
+
}) => ComboboxBaseState;
|
|
597
|
+
|
|
598
|
+
export declare function useComboboxContextValues(state: Omit<ComboboxBaseState, 'freeform'> & Pick<ComboboxState, 'activeDescendantController'>): ComboboxBaseContextValues;
|
|
599
|
+
|
|
600
|
+
/**
|
|
601
|
+
* @internal
|
|
602
|
+
*/
|
|
603
|
+
export declare function useComboboxFilter<T extends {
|
|
604
|
+
children: React_2.ReactNode;
|
|
605
|
+
value: string;
|
|
606
|
+
} | string>(query: string, options: T[], config: UseComboboxFilterConfig<T>): JSXElement[];
|
|
607
|
+
|
|
608
|
+
declare type UseComboboxFilterConfig<T extends {
|
|
609
|
+
children: React_2.ReactNode;
|
|
610
|
+
value: string;
|
|
611
|
+
} | string> = {
|
|
612
|
+
/** Provides a custom filter for the option. */
|
|
613
|
+
filter?: (optionText: string, query: string) => boolean;
|
|
614
|
+
/** Provides a custom message to display when there are no options. */
|
|
615
|
+
noOptionsMessage?: React_2.ReactNode;
|
|
616
|
+
/** Provides a way to map an option object to a React key. By default, "value" is used. */
|
|
617
|
+
optionToReactKey?: (option: T) => string;
|
|
618
|
+
/** Provides a way to map an option object to a text used for search. By default, "value" is used. */
|
|
619
|
+
optionToText?: (option: T) => string;
|
|
620
|
+
/** Provides a custom render for the option. */
|
|
621
|
+
renderOption?: (option: T) => JSXElement;
|
|
622
|
+
};
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* Apply styling to the Combobox slots based on the state
|
|
626
|
+
*/
|
|
627
|
+
export declare const useComboboxStyles_unstable: (state: ComboboxState) => ComboboxState;
|
|
628
|
+
|
|
629
|
+
declare type UsedComboboxState = UseTriggerSlotState & Pick<ComboboxBaseState, 'value' | 'setValue' | 'selectedOptions' | 'clearSelection' | 'getOptionById'>;
|
|
630
|
+
|
|
631
|
+
/**
|
|
632
|
+
* Create the state required to render Dropdown.
|
|
633
|
+
*
|
|
634
|
+
* The returned state can be modified with hooks such as useDropdownStyles_unstable,
|
|
635
|
+
* before being passed to renderDropdown_unstable.
|
|
636
|
+
*
|
|
637
|
+
* @param props - props from this instance of Dropdown
|
|
638
|
+
* @param ref - reference to root HTMLElement of Dropdown
|
|
639
|
+
*/
|
|
640
|
+
export declare const useDropdown_unstable: (props: DropdownProps, ref: React_2.Ref<HTMLButtonElement>) => DropdownState;
|
|
641
|
+
|
|
642
|
+
/**
|
|
643
|
+
* Create the base state required to render Dropdown, without design-only props.
|
|
644
|
+
*
|
|
645
|
+
* @param props - props from this instance of Dropdown (without appearance and size)
|
|
646
|
+
* @param ref - reference to root HTMLButtonElement of Dropdown
|
|
647
|
+
*/
|
|
648
|
+
export declare const useDropdownBase_unstable: (props: DropdownBaseHookProps, ref: React_2.Ref<HTMLButtonElement>) => DropdownBaseHookState;
|
|
649
|
+
|
|
650
|
+
/**
|
|
651
|
+
* Apply styling to the Dropdown slots based on the state
|
|
652
|
+
*/
|
|
653
|
+
export declare const useDropdownStyles_unstable: (state: DropdownState) => DropdownState;
|
|
654
|
+
|
|
655
|
+
/**
|
|
656
|
+
* useInputTriggerSlot returns a tuple of trigger/listbox shorthand,
|
|
657
|
+
* with the semantics and event handlers needed for the Combobox and Dropdown components.
|
|
658
|
+
* The element type of the ref should always match the element type used in the trigger shorthand.
|
|
659
|
+
*
|
|
660
|
+
* @internal
|
|
661
|
+
*/
|
|
662
|
+
export declare function useInputTriggerSlot(triggerFromProps: NonNullable<Slot<'input'>>, ref: React_2.Ref<HTMLInputElement>, options: UseInputTriggerSlotOptions): SlotComponentType<ExtractSlotProps<Slot<'input'>>>;
|
|
663
|
+
|
|
664
|
+
declare type UseInputTriggerSlotOptions = {
|
|
665
|
+
state: UsedComboboxState;
|
|
666
|
+
freeform: boolean | undefined;
|
|
667
|
+
defaultProps?: Partial<ComboboxProps>;
|
|
668
|
+
activeDescendantController: ActiveDescendantImperativeRef;
|
|
669
|
+
};
|
|
670
|
+
|
|
671
|
+
/**
|
|
672
|
+
* Create the state required to render Listbox.
|
|
673
|
+
*
|
|
674
|
+
* The returned state can be modified with hooks such as useListboxStyles_unstable,
|
|
675
|
+
* before being passed to renderListbox_unstable.
|
|
676
|
+
*
|
|
677
|
+
* @param props - props from this instance of Listbox
|
|
678
|
+
* @param ref - reference to root HTMLElement of Listbox
|
|
679
|
+
*/
|
|
680
|
+
export declare const useListbox_unstable: (props: ListboxProps, ref: React_2.Ref<HTMLElement>) => ListboxState;
|
|
681
|
+
|
|
682
|
+
export declare const useListboxContext_unstable: <T>(selector: ContextSelector<ListboxContextValue, T>) => T;
|
|
683
|
+
|
|
684
|
+
export declare function useListboxContextValues(state: ListboxState): ListboxContextValues;
|
|
685
|
+
|
|
686
|
+
/**
|
|
687
|
+
* @internal
|
|
688
|
+
* @returns listbox slot with desired behaviour and props
|
|
689
|
+
*/
|
|
690
|
+
export declare function useListboxSlot(listboxSlotFromProp: Slot<typeof Listbox> | undefined, ref: React_2.Ref<HTMLDivElement>, options: UseListboxSlotOptions): SlotComponentType<ExtractSlotProps<Slot<typeof Listbox>>> | undefined;
|
|
691
|
+
|
|
692
|
+
declare type UseListboxSlotOptions = {
|
|
693
|
+
state: UseListboxSlotState;
|
|
694
|
+
triggerRef: React_2.RefObject<HTMLInputElement | null> | React_2.RefObject<HTMLButtonElement | null> | React_2.RefObject<HTMLButtonElement | HTMLInputElement | null>;
|
|
695
|
+
defaultProps?: Partial<ListboxProps>;
|
|
696
|
+
};
|
|
697
|
+
|
|
698
|
+
declare type UseListboxSlotState = Pick<ComboboxBaseState, 'multiselect'>;
|
|
699
|
+
|
|
700
|
+
/**
|
|
701
|
+
* Apply styling to the Listbox slots based on the state
|
|
702
|
+
*/
|
|
703
|
+
export declare const useListboxStyles_unstable: (state: ListboxState) => ListboxState;
|
|
704
|
+
|
|
705
|
+
/**
|
|
706
|
+
* Create the state required to render Option.
|
|
707
|
+
*
|
|
708
|
+
* The returned state can be modified with hooks such as useOptionStyles_unstable,
|
|
709
|
+
* before being passed to renderOption_unstable.
|
|
710
|
+
*
|
|
711
|
+
* @param props - props from this instance of Option
|
|
712
|
+
* @param ref - reference to root HTMLElement of Option
|
|
713
|
+
*/
|
|
714
|
+
export declare const useOption_unstable: (props: OptionProps, ref: React_2.Ref<HTMLElement>) => OptionState;
|
|
715
|
+
|
|
716
|
+
/**
|
|
717
|
+
* Create the base state required to render Option.
|
|
718
|
+
*
|
|
719
|
+
* @param props - props from this instance of Option
|
|
720
|
+
* @param ref - reference to root HTMLElement of Option
|
|
721
|
+
*/
|
|
722
|
+
export declare const useOptionBase_unstable: (props: OptionProps, ref: React_2.Ref<HTMLElement>) => OptionState;
|
|
723
|
+
|
|
724
|
+
/**
|
|
725
|
+
* Create the state required to render OptionGroup.
|
|
726
|
+
*
|
|
727
|
+
* The returned state can be modified with hooks such as useOptionGroupStyles_unstable,
|
|
728
|
+
* before being passed to renderOptionGroup_unstable.
|
|
729
|
+
*
|
|
730
|
+
* @param props - props from this instance of OptionGroup
|
|
731
|
+
* @param ref - reference to root HTMLElement of OptionGroup
|
|
732
|
+
*/
|
|
733
|
+
export declare const useOptionGroup_unstable: (props: OptionGroupProps, ref: React_2.Ref<HTMLElement>) => OptionGroupState;
|
|
734
|
+
|
|
735
|
+
/**
|
|
736
|
+
* Apply styling to the OptionGroup slots based on the state
|
|
737
|
+
*/
|
|
738
|
+
export declare const useOptionGroupStyles_unstable: (state: OptionGroupState) => OptionGroupState;
|
|
739
|
+
|
|
740
|
+
/**
|
|
741
|
+
* Apply styling to the Option slots based on the state
|
|
742
|
+
*/
|
|
743
|
+
export declare const useOptionStyles_unstable: (state: OptionState) => OptionState;
|
|
744
|
+
|
|
745
|
+
declare type UseTriggerSlotState = Pick<ComboboxBaseState, 'open' | 'getOptionById' | 'selectOption' | 'setOpen' | 'multiselect' | 'setHasFocus'>;
|
|
746
|
+
|
|
747
|
+
export { }
|