@lumx/react 4.28.0-next.0 → 4.28.0-next.1
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 +124 -3
- package/index.js +3398 -3191
- package/index.js.map +1 -1
- package/package.json +3 -3
package/index.d.ts
CHANGED
|
@@ -1543,6 +1543,13 @@ interface ComboboxPopoverComponentProps extends ComboboxPopoverProps {
|
|
|
1543
1543
|
children: ReactNode;
|
|
1544
1544
|
}
|
|
1545
1545
|
|
|
1546
|
+
/**
|
|
1547
|
+
* Pattern of a mounted composite element (from its role, e.g. `'listbox'` or `'grid'`): each composite
|
|
1548
|
+
* specialization (see {@link setupComposite}) defines its own patterns.
|
|
1549
|
+
*/
|
|
1550
|
+
type CompositeType = string;
|
|
1551
|
+
/** Mode of the filter (see {@link CompositeHandle.setFilter}). */
|
|
1552
|
+
type CompositeFilterMode = 'auto' | 'manual';
|
|
1546
1553
|
/**
|
|
1547
1554
|
* State of a composite for its live region (see `CompositeStatus`): the item count, the loading state and the
|
|
1548
1555
|
* open state, as one snapshot (see {@link CompositeEventMap.stateChange}).
|
|
@@ -1604,6 +1611,91 @@ interface CompositeEventMap {
|
|
|
1604
1611
|
*/
|
|
1605
1612
|
[event: OptionActiveEvent]: boolean;
|
|
1606
1613
|
}
|
|
1614
|
+
/** Read-only event source of a composite handle (`subscribe` + `getSnapshot`). */
|
|
1615
|
+
interface CompositeEventSource<M = CompositeEventMap> {
|
|
1616
|
+
/** Subscribe to an event. Returns an unsubscribe function. */
|
|
1617
|
+
subscribe<K extends keyof M>(event: K, callback: (value: M[K]) => void): () => void;
|
|
1618
|
+
/** Read the last dispatched value of an event (for pull-based subscribers). */
|
|
1619
|
+
getSnapshot<K extends keyof M>(event: K): M[K] | undefined;
|
|
1620
|
+
}
|
|
1621
|
+
/**
|
|
1622
|
+
* Handle returned by {@link setupComposite}: the behavior shared by the composite widgets
|
|
1623
|
+
* (one active item among many: listbox, grid, …).
|
|
1624
|
+
*/
|
|
1625
|
+
interface CompositeHandle extends CompositeEventSource {
|
|
1626
|
+
/**
|
|
1627
|
+
* Mount the composite element: create the focus navigation and the delegated click/mousedown
|
|
1628
|
+
* listeners. In standalone mode, also attach the keyboard and focus listeners.
|
|
1629
|
+
* Returns a cleanup function that unmounts it. Mounting another element unmounts the previous one.
|
|
1630
|
+
*/
|
|
1631
|
+
mount(element: HTMLElement): () => void;
|
|
1632
|
+
/** Tear down all listeners and state. */
|
|
1633
|
+
destroy(): void;
|
|
1634
|
+
/** The mounted composite element. */
|
|
1635
|
+
readonly element: HTMLElement | null;
|
|
1636
|
+
/** Pattern of the mounted element (null while not mounted). */
|
|
1637
|
+
readonly type: CompositeType | null;
|
|
1638
|
+
/** The active item (null while there is none, or while not mounted). */
|
|
1639
|
+
readonly activeItem: HTMLElement | null;
|
|
1640
|
+
/** Whether the composite owns focus itself (no `focusOwner` link). */
|
|
1641
|
+
readonly isStandalone: boolean;
|
|
1642
|
+
/** Whether the items are visible (standalone: always; combobox: the open state). */
|
|
1643
|
+
readonly isOpen: boolean;
|
|
1644
|
+
/** Whether the composite is in multi-select mode (`aria-multiselectable="true"`). */
|
|
1645
|
+
readonly isMultiSelect: boolean;
|
|
1646
|
+
/**
|
|
1647
|
+
* Whether the composite has visible items or root skeletons. Without them, the mounted element gets
|
|
1648
|
+
* `hidden` (unless it holds a status: the live region, e.g. a `Combobox.State` inside the list).
|
|
1649
|
+
*/
|
|
1650
|
+
readonly hasVisibleContent: boolean;
|
|
1651
|
+
/**
|
|
1652
|
+
* Set whether the items are visible (standalone: always visible; combobox: open state).
|
|
1653
|
+
* The loading announcement only fires while the items are visible.
|
|
1654
|
+
*/
|
|
1655
|
+
setOpen(isOpen: boolean): void;
|
|
1656
|
+
/**
|
|
1657
|
+
* Select an item and fire `onSelect` with its value.
|
|
1658
|
+
* With `null`, clear the selection: `onSelect` receives an empty string value and a null element.
|
|
1659
|
+
*/
|
|
1660
|
+
select(option: HTMLElement | null): void;
|
|
1661
|
+
/**
|
|
1662
|
+
* Handle the navigation keys: arrows, Home/End, PageUp/PageDown, Enter, Space,
|
|
1663
|
+
* ArrowLeft/ArrowRight (delegated to the navigation module) and typeahead. The only navigation
|
|
1664
|
+
* implementation: a standalone composite calls it from its own keydown, a combobox calls it from
|
|
1665
|
+
* the trigger keydown.
|
|
1666
|
+
* Returns true when the key was handled: ArrowDown/ArrowUp/Home/End always; Enter/Space and
|
|
1667
|
+
* PageUp/PageDown with an active item; ArrowLeft/ArrowRight always in a standalone composite, and in a
|
|
1668
|
+
* linked one only when the navigation module handled them.
|
|
1669
|
+
*/
|
|
1670
|
+
handleKeydown(event: KeyboardEvent): boolean;
|
|
1671
|
+
/** Replay the pending navigation intent (see {@link activateDefaultItem}). */
|
|
1672
|
+
flushPendingNavigation(): void;
|
|
1673
|
+
/** Clear the active item and discard the pending navigation intent. No-op while not mounted. */
|
|
1674
|
+
clearActiveItem(): void;
|
|
1675
|
+
/** Make an item active. No-op while not mounted. */
|
|
1676
|
+
setActiveItem(item: HTMLElement): void;
|
|
1677
|
+
/**
|
|
1678
|
+
* Make the first selected item active, or else the first (`'first'`) or the last (`'last'`) item.
|
|
1679
|
+
* When no item can become active yet (e.g. the combobox popup is opening and its items are not
|
|
1680
|
+
* rendered), keep the intent until {@link flushPendingNavigation}. No-op while not mounted.
|
|
1681
|
+
*/
|
|
1682
|
+
activateDefaultItem(edge: 'first' | 'last'): void;
|
|
1683
|
+
/**
|
|
1684
|
+
* Set the filter value. The specialization applies it:
|
|
1685
|
+
* - `'auto'` (default): hide the items that do not match.
|
|
1686
|
+
* - `'manual'`: the consumer renders the result (the specialization hides nothing).
|
|
1687
|
+
*/
|
|
1688
|
+
setFilter(filterValue: string, mode?: CompositeFilterMode): void;
|
|
1689
|
+
/**
|
|
1690
|
+
* Register a skeleton placeholder. Returns a cleanup function (a second call does nothing).
|
|
1691
|
+
* A root skeleton makes the composite busy (`loadingChange`). A nested skeleton
|
|
1692
|
+
* (`isNested`, inside a nested level of items) does not make it busy, but it starts the loading
|
|
1693
|
+
* announcement.
|
|
1694
|
+
*/
|
|
1695
|
+
registerSkeleton(options?: {
|
|
1696
|
+
isNested?: boolean;
|
|
1697
|
+
}): () => void;
|
|
1698
|
+
}
|
|
1607
1699
|
|
|
1608
1700
|
/** Callbacks provided by the consumer (React/Vue) to react to combobox state changes. */
|
|
1609
1701
|
interface ComboboxCallbacks {
|
|
@@ -1649,6 +1741,31 @@ interface ComboboxInputOptions {
|
|
|
1649
1741
|
*/
|
|
1650
1742
|
selectionMode?: 'fill' | 'keep' | 'clear';
|
|
1651
1743
|
}
|
|
1744
|
+
/**
|
|
1745
|
+
* Map of combobox event names to their payload types.
|
|
1746
|
+
*
|
|
1747
|
+
* The combobox owns `open`, `expanded` and `composite`. The other events are the ones of the attached list (see
|
|
1748
|
+
* {@link CompositeEventMap}): the combobox forwards them from the current list, re-subscribes when the list
|
|
1749
|
+
* changes, and then dispatches the snapshot of the new list (`undefined` when no list is attached).
|
|
1750
|
+
*/
|
|
1751
|
+
interface ComboboxEventMap extends CompositeEventMap {
|
|
1752
|
+
/**
|
|
1753
|
+
* Fired when the popup opens or closes (see {@link ComboboxHandle.setIsOpen}).
|
|
1754
|
+
* Owned by the combobox (it exists before any list registers) and forwarded to the registered list.
|
|
1755
|
+
* Replayed on subscribe while open.
|
|
1756
|
+
*/
|
|
1757
|
+
open: boolean;
|
|
1758
|
+
/**
|
|
1759
|
+
* Fired when the trigger `aria-expanded` changes: the popup is open and the list has something to show
|
|
1760
|
+
* (visible items or root skeletons, see {@link CompositeHandle.hasVisibleContent}).
|
|
1761
|
+
*/
|
|
1762
|
+
expanded: boolean;
|
|
1763
|
+
/**
|
|
1764
|
+
* Fired when a composite (listbox, grid, tree, …) attaches as the list of the combobox, or detaches (see
|
|
1765
|
+
* {@link ComboboxHandle.attachList}). Payload: the composite handle, or null.
|
|
1766
|
+
*/
|
|
1767
|
+
composite: CompositeHandle | null;
|
|
1768
|
+
}
|
|
1652
1769
|
|
|
1653
1770
|
/**
|
|
1654
1771
|
* Defines the props for the core ComboboxInput template.
|
|
@@ -1921,6 +2038,8 @@ interface ComboboxProviderProps {
|
|
|
1921
2038
|
*
|
|
1922
2039
|
* Provides shared context to sub-components. The vanilla JS combobox handle is
|
|
1923
2040
|
* created by the trigger sub-component (Combobox.Input or Combobox.Button) on mount.
|
|
2041
|
+
* The list handle is created by the list component, which registers it on the combobox handle:
|
|
2042
|
+
* the provider shares the registered list with the sub-components (composite context).
|
|
1924
2043
|
*
|
|
1925
2044
|
* @param props Component props.
|
|
1926
2045
|
* @return React element.
|
|
@@ -1931,12 +2050,14 @@ declare namespace ComboboxProvider {
|
|
|
1931
2050
|
}
|
|
1932
2051
|
|
|
1933
2052
|
/**
|
|
1934
|
-
* Hook to subscribe to a combobox event (`open`, `optionsChange`, `loadingChange`,
|
|
2053
|
+
* Hook to subscribe to a combobox event (`open`, `expanded`, `optionsChange`, `loadingChange`,
|
|
1935
2054
|
* `activeDescendantChange`, …). Must be used within a `Combobox.Provider`.
|
|
1936
2055
|
*
|
|
1937
|
-
* The
|
|
2056
|
+
* The combobox handle owns the `open` and `expanded` events (even before a list registers) and forwards the other events
|
|
2057
|
+
* from the registered list: it re-subscribes when the registered list changes and dispatches the snapshot of
|
|
2058
|
+
* the new list (see `ComboboxEventMap`).
|
|
1938
2059
|
*/
|
|
1939
|
-
declare function useComboboxEvent<K extends keyof
|
|
2060
|
+
declare function useComboboxEvent<K extends keyof ComboboxEventMap>(event: K, initialValue: ComboboxEventMap[K]): ComboboxEventMap[K];
|
|
1940
2061
|
|
|
1941
2062
|
/**
|
|
1942
2063
|
* Props for Combobox.Button component.
|