@lumx/react 4.12.0-next.6 → 4.12.1-next.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.
- package/index.d.ts +108 -69
- package/index.js +10 -9
- package/index.js.map +1 -1
- package/package.json +4 -4
package/index.d.ts
CHANGED
|
@@ -1776,22 +1776,119 @@ interface ComboboxOptionProps extends GenericProps$1, ReactToJSX<ComboboxOptionP
|
|
|
1776
1776
|
* - `'grid'`: Grid mode with `role="grid"` and `role="gridcell"` items, enabling 2D keyboard navigation.
|
|
1777
1777
|
*/
|
|
1778
1778
|
type ComboboxListType = 'listbox' | 'grid';
|
|
1779
|
-
|
|
1780
1779
|
/**
|
|
1781
|
-
*
|
|
1782
|
-
* Note: role, id are set internally and cannot be overridden.
|
|
1780
|
+
* Defines the props for the core ComboboxList template.
|
|
1783
1781
|
*/
|
|
1784
|
-
interface ComboboxListProps extends
|
|
1782
|
+
interface ComboboxListProps$1 extends HasClassName {
|
|
1785
1783
|
/** Accessible label for the listbox (required for accessibility). */
|
|
1786
|
-
'aria-label'
|
|
1784
|
+
'aria-label'?: string;
|
|
1785
|
+
/**
|
|
1786
|
+
* Indicates that the listbox content is incomplete (loading).
|
|
1787
|
+
* Set to `true` when skeleton placeholders are present and no real options have loaded yet.
|
|
1788
|
+
* Omit (or set to `undefined`) when not loading — the attribute is not rendered as `"false"`.
|
|
1789
|
+
*/
|
|
1790
|
+
'aria-busy'?: boolean;
|
|
1791
|
+
/** Content (should be ComboboxOption elements). */
|
|
1792
|
+
children?: JSXElement;
|
|
1793
|
+
/** The ID of the listbox element. */
|
|
1794
|
+
id?: string;
|
|
1795
|
+
/** ref to the root element */
|
|
1796
|
+
ref?: CommonRef;
|
|
1787
1797
|
/**
|
|
1788
|
-
* The popup type. Set to "grid" when options have action buttons
|
|
1789
|
-
* Enables 2D keyboard navigation and switches ARIA roles from listbox/option to grid/gridcell.
|
|
1798
|
+
* The popup type. Set to "grid" when options have action buttons.
|
|
1790
1799
|
* @default 'listbox'
|
|
1791
1800
|
*/
|
|
1792
1801
|
type?: ComboboxListType;
|
|
1793
1802
|
}
|
|
1794
1803
|
|
|
1804
|
+
/** Props for Combobox.List component. */
|
|
1805
|
+
interface ComboboxListProps extends ReactToJSX<ComboboxListProps$1, 'aria-busy'> {
|
|
1806
|
+
}
|
|
1807
|
+
|
|
1808
|
+
/** Map of combobox event names to their payload types. */
|
|
1809
|
+
interface ComboboxEventMap {
|
|
1810
|
+
/** Fired when the combobox open state changes. Payload: whether the combobox is open. */
|
|
1811
|
+
open: boolean;
|
|
1812
|
+
/** Fired when the active descendant changes (visual focus). Payload: the option id or null. */
|
|
1813
|
+
activeDescendantChange: string | null;
|
|
1814
|
+
/**
|
|
1815
|
+
* Fired when the visible option count changes.
|
|
1816
|
+
* Payload: the number of visible options plus the current input value.
|
|
1817
|
+
*/
|
|
1818
|
+
optionsChange: {
|
|
1819
|
+
optionsLength: number;
|
|
1820
|
+
inputValue?: string;
|
|
1821
|
+
} | undefined;
|
|
1822
|
+
/**
|
|
1823
|
+
* Fired immediately when the aggregate loading state changes (skeleton count transitions
|
|
1824
|
+
* between 0 and >0). Used for empty suppression in ComboboxState and for aria-busy on the listbox.
|
|
1825
|
+
*/
|
|
1826
|
+
loadingChange: boolean;
|
|
1827
|
+
/**
|
|
1828
|
+
* Fired after a 500ms debounce when loading persists, or immediately when loading ends.
|
|
1829
|
+
* Used to control the loading message text in the live region (ComboboxState).
|
|
1830
|
+
*/
|
|
1831
|
+
loadingAnnouncement: boolean;
|
|
1832
|
+
}
|
|
1833
|
+
/** Callbacks provided by the consumer (React/Vue) to react to combobox state changes. */
|
|
1834
|
+
interface ComboboxCallbacks {
|
|
1835
|
+
/** Called when an option is selected (click or keyboard). */
|
|
1836
|
+
onSelect?(option: {
|
|
1837
|
+
value: string;
|
|
1838
|
+
}): void;
|
|
1839
|
+
}
|
|
1840
|
+
/**
|
|
1841
|
+
* Behavioral options for input-mode combobox (autocomplete/filter pattern).
|
|
1842
|
+
* Shared between the core JSX template props (`ComboboxInputProps`) and the
|
|
1843
|
+
* runtime controller options (`SetupComboboxInputOptions`).
|
|
1844
|
+
*/
|
|
1845
|
+
interface ComboboxInputOptions {
|
|
1846
|
+
/**
|
|
1847
|
+
* Controls how the combobox filters options as the user types.
|
|
1848
|
+
*
|
|
1849
|
+
* - `'auto'` (default) — Options are automatically filtered client-side.
|
|
1850
|
+
* - `'manual'` — Filtering is the consumer's responsibility.
|
|
1851
|
+
* - `'off'` — Like `'manual'`, but the input is rendered as `readOnly`
|
|
1852
|
+
* and `openOnFocus` defaults to `true`.
|
|
1853
|
+
*/
|
|
1854
|
+
filter?: 'auto' | 'manual' | 'off';
|
|
1855
|
+
/**
|
|
1856
|
+
* When true, the combobox opens automatically when the input receives focus.
|
|
1857
|
+
* When false (default, unless `filter` is `'off'`), the combobox only opens
|
|
1858
|
+
* on click, typing, or keyboard navigation.
|
|
1859
|
+
*
|
|
1860
|
+
* @default false (true when filter is 'off')
|
|
1861
|
+
*/
|
|
1862
|
+
openOnFocus?: boolean;
|
|
1863
|
+
}
|
|
1864
|
+
|
|
1865
|
+
/**
|
|
1866
|
+
* Defines the props for the core ComboboxInput template.
|
|
1867
|
+
*/
|
|
1868
|
+
interface ComboboxInputProps$1 extends HasClassName, HasTheme, ComboboxCallbacks, ComboboxInputOptions {
|
|
1869
|
+
/** The ID of the listbox element (for aria-controls). */
|
|
1870
|
+
listboxId?: string;
|
|
1871
|
+
/** Whether the combobox is open. */
|
|
1872
|
+
isOpen?: boolean;
|
|
1873
|
+
/** ref to the root element. */
|
|
1874
|
+
ref?: CommonRef;
|
|
1875
|
+
/** Reference to the input element. */
|
|
1876
|
+
inputRef?: CommonRef;
|
|
1877
|
+
/** Reference to the text field wrapper element. */
|
|
1878
|
+
textFieldRef?: CommonRef;
|
|
1879
|
+
/** Props for the toggle button (when provided, a chevron button is rendered). */
|
|
1880
|
+
toggleButtonProps?: Record<string, any>;
|
|
1881
|
+
/** Toggle callback for the chevron button. */
|
|
1882
|
+
handleToggle?(): void;
|
|
1883
|
+
}
|
|
1884
|
+
/**
|
|
1885
|
+
* Props from the core `ComboboxInputProps` that framework wrappers (React/Vue)
|
|
1886
|
+
* are expected to provide internally or re-type with framework-specific equivalents
|
|
1887
|
+
* (e.g. React refs, framework-specific button props). Wrappers should omit these
|
|
1888
|
+
* keys when exposing the core props to consumers.
|
|
1889
|
+
*/
|
|
1890
|
+
type ComboboxInputPropsToOverride = 'listboxId' | 'isOpen' | 'inputRef' | 'textFieldRef' | 'toggleButtonProps' | 'handleToggle';
|
|
1891
|
+
|
|
1795
1892
|
interface InputLabelProps$1 extends HasClassName, HasTheme {
|
|
1796
1893
|
/** Typography variant. */
|
|
1797
1894
|
typography?: Typography;
|
|
@@ -1969,36 +2066,13 @@ declare const RawInputTextarea: Comp<Omit<RawInputTextareaProps, "type">, HTMLTe
|
|
|
1969
2066
|
* Props for Combobox.Input component.
|
|
1970
2067
|
* Note: role, aria-autocomplete, aria-controls, aria-expanded are set internally and cannot be overridden.
|
|
1971
2068
|
*/
|
|
1972
|
-
interface ComboboxInputProps extends TextFieldProps {
|
|
1973
|
-
/** Reference to the input element. */
|
|
1974
|
-
inputRef?: Ref<HTMLInputElement>;
|
|
2069
|
+
interface ComboboxInputProps extends TextFieldProps, ReactToJSX<ComboboxInputProps$1, ComboboxInputPropsToOverride> {
|
|
1975
2070
|
/**
|
|
1976
2071
|
* Props for the toggle button.
|
|
1977
2072
|
* When provided, a chevron button will be rendered in the text field's afterElement
|
|
1978
2073
|
* to toggle the listbox visibility.
|
|
1979
2074
|
*/
|
|
1980
2075
|
toggleButtonProps?: Pick<IconButtonProps, 'label'> & Partial<Omit<IconButtonProps, 'label'>>;
|
|
1981
|
-
/** Called when an option is selected. */
|
|
1982
|
-
onSelect?: (option: {
|
|
1983
|
-
value: string;
|
|
1984
|
-
}) => void;
|
|
1985
|
-
/**
|
|
1986
|
-
* Controls how the combobox filters options as the user types.
|
|
1987
|
-
*
|
|
1988
|
-
* - `'auto'` (default) — Options are automatically filtered client-side.
|
|
1989
|
-
* - `'manual'` — Filtering is the consumer's responsibility.
|
|
1990
|
-
* - `'off'` — Like `'manual'`, but the input is rendered as `readOnly`
|
|
1991
|
-
* and `openOnFocus` defaults to `true`.
|
|
1992
|
-
*/
|
|
1993
|
-
filter?: 'auto' | 'manual' | 'off';
|
|
1994
|
-
/**
|
|
1995
|
-
* When true, the combobox opens automatically when the input receives focus.
|
|
1996
|
-
* When false (default, unless `filter` is `'off'`), the combobox only opens
|
|
1997
|
-
* on click, typing, or keyboard navigation.
|
|
1998
|
-
*
|
|
1999
|
-
* @default false (true when filter is 'off')
|
|
2000
|
-
*/
|
|
2001
|
-
openOnFocus?: boolean;
|
|
2002
2076
|
}
|
|
2003
2077
|
|
|
2004
2078
|
/**
|
|
@@ -2011,7 +2085,7 @@ type ComboboxButtonLabelDisplayMode = 'show-selection' | 'show-label' | 'show-to
|
|
|
2011
2085
|
/**
|
|
2012
2086
|
* Defines the props for the core ComboboxButton template.
|
|
2013
2087
|
*/
|
|
2014
|
-
interface ComboboxButtonProps$1 extends HasClassName {
|
|
2088
|
+
interface ComboboxButtonProps$1 extends HasClassName, ComboboxCallbacks {
|
|
2015
2089
|
/** The label for the button (used for ARIA and tooltip). */
|
|
2016
2090
|
label: string;
|
|
2017
2091
|
/** The currently selected value to display. */
|
|
@@ -2049,32 +2123,6 @@ declare namespace ComboboxProvider {
|
|
|
2049
2123
|
var displayName: string;
|
|
2050
2124
|
}
|
|
2051
2125
|
|
|
2052
|
-
/** Map of combobox event names to their payload types. */
|
|
2053
|
-
interface ComboboxEventMap {
|
|
2054
|
-
/** Fired when the combobox open state changes. Payload: whether the combobox is open. */
|
|
2055
|
-
open: boolean;
|
|
2056
|
-
/** Fired when the active descendant changes (visual focus). Payload: the option id or null. */
|
|
2057
|
-
activeDescendantChange: string | null;
|
|
2058
|
-
/**
|
|
2059
|
-
* Fired when the visible option count changes.
|
|
2060
|
-
* Payload: the number of visible options plus the current input value.
|
|
2061
|
-
*/
|
|
2062
|
-
optionsChange: {
|
|
2063
|
-
optionsLength: number;
|
|
2064
|
-
inputValue?: string;
|
|
2065
|
-
} | undefined;
|
|
2066
|
-
/**
|
|
2067
|
-
* Fired immediately when the aggregate loading state changes (skeleton count transitions
|
|
2068
|
-
* between 0 and >0). Used for empty suppression in ComboboxState and for aria-busy on the listbox.
|
|
2069
|
-
*/
|
|
2070
|
-
loadingChange: boolean;
|
|
2071
|
-
/**
|
|
2072
|
-
* Fired after a 500ms debounce when loading persists, or immediately when loading ends.
|
|
2073
|
-
* Used to control the loading message text in the live region (ComboboxState).
|
|
2074
|
-
*/
|
|
2075
|
-
loadingAnnouncement: boolean;
|
|
2076
|
-
}
|
|
2077
|
-
|
|
2078
2126
|
/**
|
|
2079
2127
|
* Hook to subscribe to a combobox event via the handle's subscriber system.
|
|
2080
2128
|
* Re-subscribes when the handle changes (e.g. trigger mount/unmount).
|
|
@@ -2087,12 +2135,7 @@ declare function useComboboxEvent<K extends keyof ComboboxEventMap>(event: K, in
|
|
|
2087
2135
|
* Polymorphic component — use `as` to render the trigger as a different element or component
|
|
2088
2136
|
* (e.g., `as="a"`, `as={RouterLink}`). Defaults to the LumX `Button` component.
|
|
2089
2137
|
*/
|
|
2090
|
-
type ComboboxButtonProps<E extends ElementType$1 = typeof Button> = Omit<HasPolymorphicAs$1<E>, 'children' | 'role' | 'aria-controls' | 'aria-haspopup' | 'aria-expanded' | 'aria-activedescendant'> & HasRequiredLinkHref$1<E> & ReactToJSX<ComboboxButtonProps$1
|
|
2091
|
-
/** Called when an option is selected. */
|
|
2092
|
-
onSelect?: (option: {
|
|
2093
|
-
value: string;
|
|
2094
|
-
}) => void;
|
|
2095
|
-
};
|
|
2138
|
+
type ComboboxButtonProps<E extends ElementType$1 = typeof Button> = Omit<HasPolymorphicAs$1<E>, 'children' | 'role' | 'aria-controls' | 'aria-haspopup' | 'aria-expanded' | 'aria-activedescendant'> & HasRequiredLinkHref$1<E> & ReactToJSX<ComboboxButtonProps$1>;
|
|
2096
2139
|
|
|
2097
2140
|
/**
|
|
2098
2141
|
* Combobox.OptionAction props.
|
|
@@ -2116,11 +2159,7 @@ declare const Combobox: {
|
|
|
2116
2159
|
/** Provides shared combobox context (handle, listbox ID, anchor ref) to all sub-components. */
|
|
2117
2160
|
Provider: typeof ComboboxProvider;
|
|
2118
2161
|
/** Button trigger for select-only combobox mode with keyboard navigation and typeahead. */
|
|
2119
|
-
Button: (<E extends React$1.ElementType = Comp<ButtonProps, HTMLButtonElement | HTMLAnchorElement>>(props: Omit<HasPolymorphicAs$1<E>, "children" | "aria-expanded" | "aria-haspopup" | "role" | "aria-controls" | "aria-activedescendant"> & _lumx_core_js_types.HasRequiredLinkHref<E> & ReactToJSX<ComboboxButtonProps$1> & {
|
|
2120
|
-
onSelect?: (option: {
|
|
2121
|
-
value: string;
|
|
2122
|
-
}) => void;
|
|
2123
|
-
} & React$1.ComponentProps<E> & {
|
|
2162
|
+
Button: (<E extends React$1.ElementType = Comp<ButtonProps, HTMLButtonElement | HTMLAnchorElement>>(props: Omit<HasPolymorphicAs$1<E>, "children" | "aria-expanded" | "aria-haspopup" | "role" | "aria-controls" | "aria-activedescendant"> & _lumx_core_js_types.HasRequiredLinkHref<E> & ReactToJSX<ComboboxButtonProps$1> & React$1.ComponentProps<E> & {
|
|
2124
2163
|
ref?: ComponentRef<E> | undefined;
|
|
2125
2164
|
}) => React.JSX.Element) & {
|
|
2126
2165
|
displayName: string;
|
package/index.js
CHANGED
|
@@ -6770,9 +6770,9 @@ function setupCombobox(callbacks, options, onTriggerAttach) {
|
|
|
6770
6770
|
}
|
|
6771
6771
|
},
|
|
6772
6772
|
select(option) {
|
|
6773
|
-
callbacks.onSelect({
|
|
6773
|
+
callbacks.onSelect?.({
|
|
6774
6774
|
value: option ? getOptionValue(option) : ''
|
|
6775
|
-
}
|
|
6775
|
+
});
|
|
6776
6776
|
},
|
|
6777
6777
|
registerOption(element, callback) {
|
|
6778
6778
|
const filterLower = filterValue.toLowerCase();
|
|
@@ -7334,6 +7334,7 @@ const ComboboxButton = Object.assign(forwardRefPolymorphic((props, ref) => {
|
|
|
7334
7334
|
* @returns A ComboboxHandle for interacting with the combobox.
|
|
7335
7335
|
*/
|
|
7336
7336
|
function setupComboboxInput(input, options) {
|
|
7337
|
+
let handle;
|
|
7337
7338
|
const {
|
|
7338
7339
|
filter = 'auto',
|
|
7339
7340
|
onSelect: optionOnSelect
|
|
@@ -7355,21 +7356,21 @@ function setupComboboxInput(input, options) {
|
|
|
7355
7356
|
* Wraps the consumer's onSelect to perform input-mode side effects after selection:
|
|
7356
7357
|
* clears the active descendant, resets the filter, and re-opens the popup.
|
|
7357
7358
|
*/
|
|
7358
|
-
const onSelect =
|
|
7359
|
-
optionOnSelect(option
|
|
7359
|
+
const onSelect = option => {
|
|
7360
|
+
optionOnSelect?.(option);
|
|
7360
7361
|
|
|
7361
7362
|
// Clear the active item. In multi-select, keep visual focus so the
|
|
7362
7363
|
// user can continue navigating after selection.
|
|
7363
|
-
if (!
|
|
7364
|
-
|
|
7364
|
+
if (!handle.isMultiSelect) {
|
|
7365
|
+
handle.focusNav?.clear();
|
|
7365
7366
|
}
|
|
7366
7367
|
userHasTyped = false;
|
|
7367
|
-
|
|
7368
|
+
handle.setIsOpen(true);
|
|
7368
7369
|
if (autoFilter) {
|
|
7369
|
-
|
|
7370
|
+
handle.setFilter('');
|
|
7370
7371
|
}
|
|
7371
7372
|
};
|
|
7372
|
-
|
|
7373
|
+
handle = setupCombobox({
|
|
7373
7374
|
onSelect
|
|
7374
7375
|
}, {
|
|
7375
7376
|
wrapNavigation: true
|