@lumx/core 4.27.1-alpha.1 → 4.27.1-alpha.2

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.
Files changed (30) hide show
  1. package/components-and-utils.css +82 -1
  2. package/js/components/Combobox/Tests.d.ts +5 -0
  3. package/js/components/Combobox/index.d.ts +1 -1
  4. package/js/components/Combobox/setupCombobox.d.ts +13 -11
  5. package/js/components/Combobox/setupComboboxButton.d.ts +2 -2
  6. package/js/components/Combobox/setupComboboxInput.d.ts +2 -2
  7. package/js/components/Combobox/types.d.ts +55 -16
  8. package/js/components/Composite/CompositeStatus.d.ts +8 -27
  9. package/js/components/Composite/types.d.ts +43 -9
  10. package/js/components/Composite/utils.d.ts +2 -0
  11. package/js/components/Listbox/index.d.ts +0 -2
  12. package/js/components/TreeList/Stories.d.ts +72 -0
  13. package/js/components/TreeList/TestStories.d.ts +88 -0
  14. package/js/components/TreeList/Tests.d.ts +49 -0
  15. package/js/components/TreeList/TreeList.d.ts +60 -0
  16. package/js/components/TreeList/TreeListItem.d.ts +84 -0
  17. package/js/components/TreeList/dom.d.ts +61 -0
  18. package/js/components/TreeList/index.d.ts +9 -0
  19. package/js/components/TreeList/navigation.d.ts +15 -0
  20. package/js/components/TreeList/selection.d.ts +9 -0
  21. package/js/components/TreeList/setupTreeList.d.ts +18 -0
  22. package/js/components/TreeList/types.d.ts +55 -0
  23. package/js/components/TreeList/utils.d.ts +4 -0
  24. package/js/utils/string/includesIgnoreCase.d.ts +2 -0
  25. package/lumx.css +82 -1
  26. package/package.json +2 -2
  27. package/scss/_components_classes.scss +1 -0
  28. package/scss/components/combobox/_index.scss +1 -1
  29. package/scss/components/tree-list/_index.scss +144 -0
  30. package/js/components/Listbox/subscribeListboxState.d.ts +0 -24
@@ -5040,7 +5040,7 @@ table {
5040
5040
  .lumx-combobox-popover__scroll {
5041
5041
  overflow-y: auto;
5042
5042
  }
5043
- .lumx-combobox-popover:not(:has(:is([role=listbox], [role=grid]):not([hidden]), .lumx-composite-status)) {
5043
+ .lumx-combobox-popover:not(:has(:is([role=listbox], [role=grid], [role=tree]):not([hidden]), .lumx-composite-status)) {
5044
5044
  display: none;
5045
5045
  }
5046
5046
 
@@ -12306,6 +12306,87 @@ table {
12306
12306
  user-select: none;
12307
12307
  }
12308
12308
 
12309
+ /* ==========================================================================
12310
+ Tree list
12311
+ ========================================================================== */
12312
+ .lumx-tree-list:empty {
12313
+ display: none;
12314
+ }
12315
+
12316
+ .lumx-tree-list-item__row {
12317
+ padding-left: calc(var(--lumx-tree-list-level, 0) * 16px);
12318
+ }
12319
+ .lumx-tree-list-item__row > .lumx-list-item__wrapper > .lumx-list-item__content {
12320
+ min-width: 0;
12321
+ }
12322
+ .lumx-tree-list-item__row > .lumx-list-item__wrapper > .lumx-list-item__before {
12323
+ justify-content: flex-start;
12324
+ width: auto;
12325
+ }
12326
+ .lumx-tree-list-item__row .lumx-tree-list-item__action {
12327
+ display: block;
12328
+ width: 100%;
12329
+ }
12330
+ .lumx-tree-list-item__action--passive {
12331
+ pointer-events: none;
12332
+ }
12333
+ .lumx-tree-list-item__toggle, .lumx-tree-list-item__spacer {
12334
+ flex-shrink: 0;
12335
+ }
12336
+ .lumx-tree-list-item__spacer {
12337
+ width: calc(var(--lumx-button-height) / 1.5);
12338
+ }
12339
+ .lumx-tree-list-item__toggle {
12340
+ margin-block: calc((20px - calc(var(--lumx-button-height) / 1.5)) / 2);
12341
+ }
12342
+ .lumx-tree-list-item__toggle.lumx-button--size-s.lumx-button--variant-icon > i {
12343
+ width: 20px;
12344
+ height: 20px;
12345
+ font-size: 20px;
12346
+ line-height: 20px;
12347
+ }
12348
+ .lumx-tree-list-item__row .lumx-tree-list-item__toggle--main {
12349
+ position: static;
12350
+ }
12351
+ .lumx-tree-list-item__row .lumx-tree-list-item__toggle--main.lumx-button.lumx-action-area__action::before {
12352
+ pointer-events: auto;
12353
+ border-radius: 0;
12354
+ }
12355
+ .lumx-tree-list-item__row:has(.lumx-tree-list-item__action--passive[data-focus-visible-added]) .lumx-tree-list-item__toggle--main::before {
12356
+ background-color: var(--lumx-color-dark-L5);
12357
+ outline-style: solid;
12358
+ outline-offset: -2px;
12359
+ }
12360
+ .lumx-tree-list-item__row:has(.lumx-tree-list-item__action--passive[data-focus-visible-added]) .lumx-tree-list-item__toggle--main {
12361
+ color: var(--lumx-button-emphasis-low-state-hover-theme-light-color);
12362
+ background-color: var(--lumx-button-emphasis-low-state-hover-theme-light-background-color);
12363
+ }
12364
+ .lumx-tree-list-item__group {
12365
+ padding: 0;
12366
+ margin: 0;
12367
+ list-style: none;
12368
+ }
12369
+ .lumx-tree-list-item__group > :not(.lumx-tree-list-item) {
12370
+ margin-left: calc(var(--lumx-tree-list-level, 0) * 16px);
12371
+ }
12372
+ @supports (interpolate-size: allow-keywords) {
12373
+ .lumx-tree-list-item__group {
12374
+ interpolate-size: allow-keywords;
12375
+ overflow-y: clip;
12376
+ transition: height 400ms, visibility 400ms;
12377
+ }
12378
+ @media (prefers-reduced-motion: reduce) {
12379
+ .lumx-tree-list-item__group {
12380
+ transition: none;
12381
+ }
12382
+ }
12383
+ .lumx-tree-list-item__group[hidden] {
12384
+ display: block;
12385
+ height: 0;
12386
+ visibility: hidden;
12387
+ }
12388
+ }
12389
+
12309
12390
  /* ==========================================================================
12310
12391
  Uploader
12311
12392
  ========================================================================== */
@@ -47,6 +47,11 @@ export declare function getActiveOption(): HTMLElement | null;
47
47
  * Exported so TestStories.tsx can reuse the same templates for browser-only tests.
48
48
  */
49
49
  export declare function createTemplates(Combobox: ComboboxNamespace, IconButton: any): {
50
+ listChangeTemplate: ({ value, onChange, onOpen, }: {
51
+ value: string;
52
+ onChange: (v: string) => void;
53
+ onOpen?: (isOpen: boolean) => void;
54
+ }) => import("react").JSX.Element;
50
55
  inlineTemplate: ({ value, onChange, onSelect, alwaysOpen, }: {
51
56
  value: string;
52
57
  onChange: (v: string) => void;
@@ -1,6 +1,6 @@
1
1
  export { setupComboboxInput } from './setupComboboxInput';
2
2
  export { setupComboboxButton } from './setupComboboxButton';
3
- export type { ComboboxCallbacks, ComboboxHandle } from './types';
3
+ export type { ComboboxCallbacks, ComboboxEventMap, ComboboxHandle } from './types';
4
4
  export { ComboboxPopover } from './ComboboxPopover';
5
5
  export type { ComboboxPopoverProps, ComboboxPopoverComponents } from './ComboboxPopover';
6
6
  export { ComboboxButton } from './ComboboxButton';
@@ -1,24 +1,26 @@
1
1
  import type { ComboboxCallbacks, ComboboxHandle, OnTriggerAttach } from './types';
2
- /** Options for configuring the shared combobox behavior. */
3
- interface ListboxOptions {
2
+ /** Options of {@link setupCombobox}: the callbacks, and the shared combobox behavior options. */
3
+ interface SetupComboboxOptions extends ComboboxCallbacks {
4
4
  /** When true, ArrowDown/ArrowUp wrap around in listbox mode (input pattern). Default: false. */
5
5
  wrapNavigation?: boolean;
6
+ /**
7
+ * Called when the trigger is registered and the signal is ready. Used by the mode-specific wrappers
8
+ * (setupComboboxInput/Button) to attach the controller of their mode.
9
+ */
10
+ onTriggerAttach?: OnTriggerAttach;
6
11
  }
7
12
  /**
8
- * Set up combobox behavior (WAI-ARIA combobox pattern) on a trigger + listbox pair.
13
+ * Set up combobox behavior (WAI-ARIA combobox pattern) on a trigger + list pair.
9
14
  *
10
- * The trigger and listbox are registered separately via the returned handle,
15
+ * The trigger and the list are registered separately via the returned handle,
11
16
  * allowing framework components to register them on mount. The behavior is
12
- * fully attached once both are registered.
17
+ * fully attached once both are registered. The list is late-bound: the list component attaches its
18
+ * composite handle with `handle.attachList`.
13
19
  *
14
20
  * @see https://www.w3.org/WAI/ARIA/apg/patterns/combobox/
15
21
  *
16
- * @param callbacks Callbacks invoked on combobox events (e.g. option selection).
17
- * @param options Options for configuring the shared combobox behavior.
18
- * @param onTriggerAttach Optional callback invoked when the trigger is registered and the signal is ready.
19
- * Used by mode-specific wrappers (setupComboboxInput/Button) to automatically
20
- * attach the appropriate controller.
22
+ * @param options The callbacks (e.g. option selection) and the shared combobox behavior options.
21
23
  * @returns A ComboboxHandle for interacting with the combobox.
22
24
  */
23
- export declare function setupCombobox(callbacks: ComboboxCallbacks, options?: ListboxOptions, onTriggerAttach?: OnTriggerAttach): ComboboxHandle;
25
+ export declare function setupCombobox(options?: SetupComboboxOptions): ComboboxHandle;
24
26
  export {};
@@ -3,8 +3,8 @@ import type { ComboboxCallbacks, ComboboxHandle } from './types';
3
3
  * Set up a combobox with a button trigger (select-only pattern).
4
4
  *
5
5
  * Creates a full combobox handle with the button-mode controller automatically
6
- * wired in and the trigger registered. The consumer only needs to call
7
- * `handle.list.mount(listbox)`.
6
+ * wired in and the trigger registered. The consumer only needs to attach the list
7
+ * with `handle.attachList(setupListbox)`.
8
8
  *
9
9
  * Handles what is button-specific: click (toggle), Space (open), Tab and Alt+ArrowUp (select),
10
10
  * and "open first" for Home/End, ArrowLeft/Right and typeahead. The navigation itself is
@@ -20,8 +20,8 @@ export interface SetupComboboxInputOptions extends ComboboxCallbacks, ComboboxIn
20
20
  * Set up a combobox with an input trigger (autocomplete/filter pattern).
21
21
  *
22
22
  * Creates a full combobox handle with the input-mode controller automatically
23
- * wired in and the trigger registered. The consumer only needs to call
24
- * `handle.list.mount(listbox)`.
23
+ * wired in and the trigger registered. The consumer only needs to attach the list
24
+ * with `handle.attachList(setupListbox)`.
25
25
  *
26
26
  * Handles: Home/End (text cursor), ArrowLeft/Right (clear active descendant),
27
27
  * filtering (on input and on open), and focus behavior.
@@ -1,4 +1,4 @@
1
- import type { ListboxHandle } from '../Listbox/types';
1
+ import type { CompositeEventMap, CompositeEventSource, CompositeHandle, CompositeOptions } from '../Composite/types';
2
2
  /** Callbacks provided by the consumer (React/Vue) to react to combobox state changes. */
3
3
  export interface ComboboxCallbacks {
4
4
  /** Called when an option is selected (click or keyboard). */
@@ -16,7 +16,8 @@ export interface ComboboxInputOptions {
16
16
  * Controls how the combobox filters options as the user types.
17
17
  *
18
18
  * - `'auto'` (default) — Options are automatically filtered client-side.
19
- * - `'manual'` — Filtering is the consumer's responsibility.
19
+ * - `'manual'` — Filtering is the consumer's responsibility. The list still gets the filter text
20
+ * (a tree list opens its parent items with rendered sub-items while the text is not empty).
20
21
  * - `'off'` — Like `'manual'`, but the input is rendered as `readOnly`
21
22
  * and `openOnFocus` defaults to `true`.
22
23
  */
@@ -43,36 +44,74 @@ export interface ComboboxInputOptions {
43
44
  */
44
45
  selectionMode?: 'fill' | 'keep' | 'clear';
45
46
  }
47
+ /**
48
+ * Map of combobox event names to their payload types.
49
+ *
50
+ * The combobox owns `open`, `expanded` and `composite`. The other events are the ones of the attached list (see
51
+ * {@link CompositeEventMap}): the combobox forwards them from the current list, re-subscribes when the list
52
+ * changes, and then dispatches the snapshot of the new list (`undefined` when no list is attached).
53
+ */
54
+ export interface ComboboxEventMap extends CompositeEventMap {
55
+ /**
56
+ * Fired when the popup opens or closes (see {@link ComboboxHandle.setIsOpen}).
57
+ * Owned by the combobox (it exists before any list registers) and forwarded to the registered list.
58
+ * Replayed on subscribe while open.
59
+ */
60
+ open: boolean;
61
+ /**
62
+ * Fired when the trigger `aria-expanded` changes: the popup is open and the list has something to show
63
+ * (visible items or root skeletons, see {@link CompositeHandle.hasVisibleContent}).
64
+ */
65
+ expanded: boolean;
66
+ /**
67
+ * Fired when a composite (listbox, grid, tree, …) attaches as the list of the combobox, or detaches (see
68
+ * {@link ComboboxHandle.attachList}). Payload: the composite handle, or null.
69
+ */
70
+ composite: CompositeHandle | null;
71
+ }
46
72
  /**
47
73
  * Handle returned by `setupCombobox`. Used by framework wrappers and mode controllers.
48
74
  *
49
- * The combobox owns the trigger. Everything else (the open state, the option registry, the filter,
50
- * the focus navigation, the selection, the loading state and all the events) is on the
51
- * {@link ListboxHandle} exposed as `list`: the listbox element is mounted with `list.mount(element)`.
52
- * The combobox open state is the listbox `open` event.
75
+ * The combobox owns the trigger and the popup open state. The list is late-bound: the list component
76
+ * attaches its own composite handle (e.g. `setupListbox`) with {@link ComboboxHandle.attachList}. The list
77
+ * owns the item registry, the filter, the focus navigation, the selection, the loading state and the list events.
53
78
  */
54
- export interface ComboboxHandle {
79
+ export interface ComboboxHandle extends CompositeEventSource<ComboboxEventMap> {
55
80
  /** Register the trigger element. Returns a cleanup function. */
56
81
  registerTrigger(trigger: HTMLInputElement | HTMLButtonElement): () => void;
57
- /** Tear down all listeners and state. */
82
+ /**
83
+ * Create the list handle with the combobox list options, and register it: the current open state is
84
+ * forwarded to it. Attaching another list replaces the previous one.
85
+ *
86
+ * The list options link the list to the combobox: the trigger is the focus owner (`aria-activedescendant`,
87
+ * `aria-haspopup` and the inline detection on mount), a single selection closes the popup, and the input
88
+ * trigger wraps the navigation.
89
+ *
90
+ * Returns the list and `detach`, which unregisters the list (if it is still the current one), then destroys it.
91
+ */
92
+ attachList<H extends CompositeHandle>(createList: (options: CompositeOptions) => H): {
93
+ list: H;
94
+ detach(): void;
95
+ };
96
+ /** Tear down all listeners and state (the attached list is unregistered, not destroyed: its `detach` destroys it). */
58
97
  destroy(): void;
59
98
  /** The current trigger element (may be null before registration). */
60
99
  readonly trigger: HTMLInputElement | HTMLButtonElement | null;
61
- /** The listbox handle (option registry, filter, focus navigation, selection, listbox events). */
62
- readonly list: ListboxHandle;
63
- /** Whether the popup is open (same as `list.isOpen`). */
100
+ /** The attached list handle (null until a list attaches). */
101
+ readonly list: CompositeHandle | null;
102
+ /** Whether the popup is open. */
64
103
  readonly isOpen: boolean;
65
- /** Whether the listbox is always open (see {@link ComboboxHandle.setAlwaysOpen}). */
104
+ /** Whether the list is always open (see {@link ComboboxHandle.setAlwaysOpen}). */
66
105
  readonly alwaysOpen: boolean;
67
106
  /**
68
- * Set the open state and update ARIA. Subscribe to `list` `open` to observe it.
107
+ * Set the open state and update ARIA. Subscribe to `open` to observe it.
69
108
  * When always open, a close request only clears the active option.
70
109
  */
71
110
  setIsOpen(isOpen: boolean): void;
72
111
  /**
73
- * Force the listbox always open (inline listbox, not in a popup) or not. With `false`, the listbox uses the
74
- * open/close behavior (the listbox closes). When always open, focus out, selection and Escape do not
75
- * close the listbox. With `undefined` (default), the listbox is always open when it is mounted outside of a
112
+ * Force the list always open (inline list, not in a popup) or not. With `false`, the list uses the
113
+ * open/close behavior (the list closes). When always open, focus out, selection and Escape do not
114
+ * close the list. With `undefined` (default), the list is always open when it is mounted outside of a
76
115
  * `Combobox.Popover`.
77
116
  */
78
117
  setAlwaysOpen(alwaysOpen: boolean | undefined): void;
@@ -1,4 +1,5 @@
1
- import type { LumxClassName } from '../../types';
1
+ import type { HasClassName, LumxClassName } from '../../types';
2
+ import type { CompositeState } from './types';
2
3
  /**
3
4
  * Component display name.
4
5
  */
@@ -12,7 +13,7 @@ export declare const LEGACY_CLASSNAME = "lumx-listbox-state lumx-combobox-state"
12
13
  /**
13
14
  * Defines the props for the core CompositeStatus template.
14
15
  */
15
- export interface CompositeStatusProps {
16
+ export interface CompositeStatusProps extends HasClassName {
16
17
  /**
17
18
  * Message to display when the composite has no visible items.
18
19
  * Can be a plain string or a function receiving the current input value (for dynamic messages).
@@ -44,31 +45,10 @@ export interface CompositeStatusProps {
44
45
  */
45
46
  loadingMessage?: string;
46
47
  /**
47
- * Composite state
48
+ * The live region state of the composite (the `stateChange` snapshot, see `CompositeState`).
49
+ * Without it (no composite handle yet), nothing renders.
48
50
  */
49
- state?: {
50
- /**
51
- * The number of currently visible items.
52
- * Driven by the framework wrapper via the composite handle's `optionsChange` event.
53
- */
54
- optionsLength?: number;
55
- /**
56
- * The current value of the combobox input.
57
- * Passed to `emptyMessage` when it is a function.
58
- */
59
- inputValue?: string;
60
- /**
61
- * Whether loading is active (immediate, from `loadingChange` event).
62
- * Used to suppress false "empty" state while data is loading.
63
- */
64
- isLoading?: boolean;
65
- /**
66
- * Whether the combobox popover is open.
67
- * Used to gate live region content so screen readers announce messages
68
- * when the popover opens (content insertion triggers `aria-live` announcement).
69
- */
70
- isOpen?: boolean;
71
- };
51
+ state?: CompositeState;
72
52
  }
73
53
  /**
74
54
  * Components injected by the framework wrapper (dependency injection).
@@ -92,7 +72,8 @@ export interface CompositeStatusComponents {
92
72
  * - Error state: active when `errorMessage` is provided (presence-based).
93
73
  * - Empty state: active when the item count (`optionsLength`) is 0 and `emptyMessage` is provided, and there is
94
74
  * no error.
95
- * - Item count: active when `nbOptionMessage` is provided, the composite is not empty, not loading, and not in error.
75
+ * - Item count: active when `nbOptionMessage` is provided, the composite is not empty, not loading, not in error, and
76
+ * the count is not hidden (`isCountHidden`, e.g. a tree without a filter).
96
77
  *
97
78
  * @param props Component props.
98
79
  * @param components Injected framework-specific components.
@@ -1,6 +1,6 @@
1
1
  import type { FocusNavigationCallbacks, FocusNavigationController } from '../../utils/focusNavigation';
2
2
  /**
3
- * Pattern of a mounted composite element (from its role, e.g. `'listbox'` or `'grid'`): each composite
3
+ * Pattern of a mounted composite element (from its role, e.g. `'listbox'`, `'grid'` or `'tree'`): each composite
4
4
  * specialization (see {@link setupComposite}) defines its own patterns.
5
5
  */
6
6
  export type CompositeType = string;
@@ -15,6 +15,28 @@ export interface CompositeFilter {
15
15
  }
16
16
  /** Event name for the active state of one item. */
17
17
  export type OptionActiveEvent = `optionActive:${string}`;
18
+ /**
19
+ * State of a composite for its live region (see `CompositeStatus`): the item count, the loading state and the
20
+ * open state, as one snapshot (see {@link CompositeEventMap.stateChange}).
21
+ */
22
+ export interface CompositeState {
23
+ /** The number of visible items. */
24
+ optionsLength: number;
25
+ /** The current input value (combobox only, empty string otherwise). */
26
+ inputValue: string;
27
+ /** Whether the item count must not be announced (set by the composite specialization). */
28
+ isCountHidden: boolean;
29
+ /** Whether root skeletons are registered (loading), at once. */
30
+ isLoading: boolean;
31
+ /** Whether the loading lasted long enough to be announced (500ms after skeletons mount while open). */
32
+ isLoadingAnnounced: boolean;
33
+ /**
34
+ * Whether the items are open for the live region: set 100ms after the composite opens (the popover must
35
+ * be in the accessibility tree before the live region content changes), cleared at once when it closes.
36
+ * A standalone composite is always open.
37
+ */
38
+ isOpenForAnnouncement: boolean;
39
+ }
18
40
  /** Map of composite event names to their payload types. */
19
41
  export interface CompositeEventMap {
20
42
  /** Fired when the active descendant changes (visual focus). Payload: the active item id or null. */
@@ -31,20 +53,22 @@ export interface CompositeEventMap {
31
53
  } | undefined;
32
54
  /**
33
55
  * Fired immediately when the aggregate loading state changes (root skeleton count transitions
34
- * between 0 and >0). Used for empty suppression in the status and for `aria-busy` on the list.
56
+ * between 0 and >0). Used for `aria-busy` on the list. The live region reads the loading state and
57
+ * the loading announcement from {@link stateChange}.
35
58
  */
36
59
  loadingChange: boolean;
37
- /**
38
- * Fired after a 500ms debounce when loading persists while the items are visible,
39
- * or immediately when loading ends. Used to control the loading message text in the live region.
40
- */
41
- loadingAnnouncement: boolean;
42
60
  /**
43
61
  * Fired when the items become visible or hidden (see {@link CompositeHandle.setOpen}).
44
62
  * Inside a combobox, this is the combobox open state. A standalone composite is open from
45
63
  * creation and never closes.
46
64
  */
47
65
  open: boolean;
66
+ /**
67
+ * Fired when any field of the live region state changes (see {@link CompositeState}): the visible count,
68
+ * the loading state, the loading announcement, and the delayed open state. Has a value from creation
69
+ * (`undefined` only as the initial value of the framework hooks, without a handle).
70
+ */
71
+ stateChange: CompositeState | undefined;
48
72
  /**
49
73
  * Fired only when this item becomes the active descendant (true)
50
74
  * or stops being the active descendant (false).
@@ -56,7 +80,7 @@ export interface CompositeEventMap {
56
80
  * Link to a parent widget that owns focus (e.g. a combobox trigger).
57
81
  * Without it, the composite is standalone and owns focus itself.
58
82
  * The parent sets the open state ({@link CompositeHandle.setOpen}) and observes the composite through its
59
- * events (e.g. `optionsChange`).
83
+ * events (e.g. `stateChange`).
60
84
  */
61
85
  export interface CompositeFocusOwnerLink {
62
86
  /** The element that holds DOM focus and `aria-activedescendant`. */
@@ -105,8 +129,18 @@ export interface CompositeNavigation {
105
129
  readonly focusNav: FocusNavigationController;
106
130
  /** Selector of the elements that can become active (options, grid cells, …). */
107
131
  readonly cellSelector: string;
132
+ /**
133
+ * Selector of other elements (not cells) whose mousedown must not move DOM focus away from the
134
+ * focus owner (e.g. an expand toggle next to a tree item).
135
+ */
136
+ readonly keepFocusSelector?: string;
108
137
  /** Whether a clicked cell selects its item (e.g. false for grid action cells). */
109
138
  isOptionCell(cell: HTMLElement): boolean;
139
+ /**
140
+ * Find the cell of a pressed or clicked element (e.g. the tree item of an expand toggle that covers its row).
141
+ * Default: the closest element that matches {@link cellSelector}.
142
+ */
143
+ getCellFromTarget?(target: HTMLElement): HTMLElement | null;
110
144
  /** Scroll the active item into view. */
111
145
  scrollIntoView(item: HTMLElement): void;
112
146
  /**
@@ -200,7 +234,7 @@ export interface CompositeHandle extends CompositeEventSource {
200
234
  flushPendingNavigation(): void;
201
235
  /** Clear the active item and discard the pending navigation intent. No-op while not mounted. */
202
236
  clearActiveItem(): void;
203
- /** Make an item active. No-op while not mounted. */
237
+ /** Make an item active (e.g. a parent tree item when its group closes). No-op while not mounted. */
204
238
  setActiveItem(item: HTMLElement): void;
205
239
  /**
206
240
  * Make the first selected item active, or else the first (`'first'`) or the last (`'last'`) item.
@@ -14,4 +14,6 @@ export declare function getOptionLabel(option: HTMLElement): string;
14
14
  export declare function getOptionValue(option: HTMLElement): string;
15
15
  /** Returns true when an item carries aria-disabled="true". */
16
16
  export declare function isOptionDisabled(option: HTMLElement): boolean;
17
+ /** Selector of a selected item (`aria-selected="true"`). */
18
+ export declare const SELECTED_SELECTOR = "[aria-selected=\"true\"]";
17
19
  export declare const isSelected: (el: Element) => boolean;
@@ -13,5 +13,3 @@ export { ListboxOptionMoreInfo } from './ListboxOptionMoreInfo';
13
13
  export type { ListboxOptionMoreInfoProps, ListboxOptionMoreInfoPropsToOverride, ListboxOptionMoreInfoComponents, } from './ListboxOptionMoreInfo';
14
14
  export { ListboxSection } from './ListboxSection';
15
15
  export type { ListboxSectionProps, ListboxSectionPropsToOverride, ListboxSectionComponents } from './ListboxSection';
16
- export { subscribeListboxState } from './subscribeListboxState';
17
- export type { ListboxStateSetters } from './subscribeListboxState';
@@ -0,0 +1,72 @@
1
+ import type { SetupStoriesOptions } from '@lumx/core/stories/types';
2
+ import type { TreeListComponents } from './Tests';
3
+ /**
4
+ * Setup the TreeList demo stories for a specific framework (React or Vue): a standalone tree, or a tree in a
5
+ * combobox. Framework-specific components and decorators are injected via options.
6
+ */
7
+ export declare function setup({ components: { TreeList, TreeListItem, Combobox }, decorators: { withValueOnChange }, }: SetupStoriesOptions<{
8
+ components: TreeListComponents;
9
+ decorators: 'withValueOnChange';
10
+ }>): {
11
+ meta: {
12
+ component: any;
13
+ };
14
+ Standalone: {
15
+ args: {
16
+ value: string;
17
+ };
18
+ decorators: ((story: any, context: any) => any)[];
19
+ render: ({ value, onChange }: any) => import("react").JSX.Element;
20
+ };
21
+ StandaloneMultipleSelection: {
22
+ args: {
23
+ value: string[];
24
+ };
25
+ decorators: ((story: any, context: any) => any)[];
26
+ render: ({ value, onChange }: any) => import("react").JSX.Element;
27
+ };
28
+ InComboboxInput: {
29
+ args: {
30
+ value: {
31
+ text: string;
32
+ selected: string;
33
+ };
34
+ };
35
+ decorators: ((story: any, context: any) => any)[];
36
+ render: ({ value, onUpdate }: any) => import("react").JSX.Element;
37
+ };
38
+ InComboboxInline: {
39
+ args: {
40
+ value: {
41
+ text: string;
42
+ selected: string;
43
+ };
44
+ };
45
+ decorators: ((story: any, context: any) => any)[];
46
+ render: ({ value, onUpdate }: any) => import("react").JSX.Element;
47
+ };
48
+ InComboboxButton: {
49
+ args: {
50
+ value: string;
51
+ };
52
+ decorators: ((story: any, context: any) => any)[];
53
+ render: ({ value, onChange }: any) => import("react").JSX.Element;
54
+ };
55
+ InComboboxMultipleSelection: {
56
+ args: {
57
+ value: {
58
+ text: string;
59
+ selected: string[];
60
+ };
61
+ };
62
+ decorators: ((story: any, context: any) => any)[];
63
+ render: ({ value, onUpdate }: any) => import("react").JSX.Element;
64
+ };
65
+ LazyParentItem: {
66
+ args: {
67
+ snacks: string;
68
+ };
69
+ decorators: ((story: any, context: any) => any)[];
70
+ render: ({ snacks, onSnacksChange }: any) => import("react").JSX.Element;
71
+ };
72
+ };
@@ -0,0 +1,88 @@
1
+ import type { SetupStoriesOptions } from '@lumx/core/stories/types';
2
+ import { type TreeListComponents } from './Tests';
3
+ export declare function setup({ components, decorators: { withValueOnChange }, }: SetupStoriesOptions<{
4
+ components: TreeListComponents;
5
+ decorators: 'withValueOnChange';
6
+ }>): {
7
+ meta: {
8
+ component: any;
9
+ };
10
+ TreeItemRowLayout: {
11
+ render: ({ value, onUpdate, onSelect, treeOnSelect, filter, selectionType, onOpenChange, onClick, nbOptionMessage, withoutState, snacks, }: any) => import("react").JSX.Element;
12
+ play(): Promise<void>;
13
+ args: {
14
+ value: {
15
+ text: string;
16
+ selected: string;
17
+ };
18
+ };
19
+ decorators: ((story: any, context: any) => any)[];
20
+ };
21
+ ClickNonSelectableParentItemRow: {
22
+ render: ({ value, onUpdate, onSelect, treeOnSelect, filter, selectionType, onOpenChange, onClick, nbOptionMessage, withoutState, snacks, }: any) => import("react").JSX.Element;
23
+ play(): Promise<void>;
24
+ args: {
25
+ value: {
26
+ text: string;
27
+ selected: string;
28
+ };
29
+ };
30
+ decorators: ((story: any, context: any) => any)[];
31
+ };
32
+ FilterNoMatchHidesPopover: {
33
+ args: {
34
+ withoutState: boolean;
35
+ snacks: string;
36
+ value: {
37
+ text: string;
38
+ selected: string;
39
+ };
40
+ };
41
+ render: ({ value, onUpdate, onSelect, treeOnSelect, filter, selectionType, onOpenChange, onClick, nbOptionMessage, withoutState, snacks, }: any) => import("react").JSX.Element;
42
+ play(): Promise<void>;
43
+ decorators: ((story: any, context: any) => any)[];
44
+ };
45
+ AccessibilityOpenTree: {
46
+ parameters: {
47
+ a11y: {
48
+ test: string;
49
+ };
50
+ };
51
+ render: ({ value, onUpdate, onSelect, treeOnSelect, filter, selectionType, onOpenChange, onClick, nbOptionMessage, withoutState, snacks, }: any) => import("react").JSX.Element;
52
+ play(): Promise<void>;
53
+ args: {
54
+ value: {
55
+ text: string;
56
+ selected: string;
57
+ };
58
+ };
59
+ decorators: ((story: any, context: any) => any)[];
60
+ };
61
+ AccessibilityLoadingGroup: {
62
+ args: {
63
+ value: string;
64
+ load: Promise<unknown>;
65
+ };
66
+ decorators: ((story: any, context: any) => any)[];
67
+ parameters: {
68
+ a11y: {
69
+ test: string;
70
+ };
71
+ };
72
+ render: ({ value, onChange, onOpenChange, load }: any) => import("react").JSX.Element;
73
+ play(): Promise<void>;
74
+ };
75
+ AccessibilityStandaloneTree: {
76
+ args: {
77
+ value: string;
78
+ };
79
+ decorators: ((story: any, context: any) => any)[];
80
+ parameters: {
81
+ a11y: {
82
+ test: string;
83
+ };
84
+ };
85
+ render: ({ value, onUpdate, onSelect, onOpenChange, onClick, selectionType }: any) => import("react").JSX.Element;
86
+ play(): Promise<void>;
87
+ };
88
+ };