@lumx/core 4.27.1-alpha.2 → 4.28.0-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.
@@ -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], [role=tree]):not([hidden]), .lumx-composite-status)) {
5043
+ .lumx-combobox-popover:not(:has(:is([role=listbox], [role=grid]):not([hidden]), .lumx-composite-status)) {
5044
5044
  display: none;
5045
5045
  }
5046
5046
 
@@ -12306,87 +12306,6 @@ 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
-
12390
12309
  /* ==========================================================================
12391
12310
  Uploader
12392
12311
  ========================================================================== */
@@ -47,11 +47,6 @@ 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;
55
50
  inlineTemplate: ({ value, onChange, onSelect, alwaysOpen, }: {
56
51
  value: string;
57
52
  onChange: (v: string) => void;
@@ -1,6 +1,6 @@
1
1
  export { setupComboboxInput } from './setupComboboxInput';
2
2
  export { setupComboboxButton } from './setupComboboxButton';
3
- export type { ComboboxCallbacks, ComboboxEventMap, ComboboxHandle } from './types';
3
+ export type { ComboboxCallbacks, ComboboxHandle } from './types';
4
4
  export { ComboboxPopover } from './ComboboxPopover';
5
5
  export type { ComboboxPopoverProps, ComboboxPopoverComponents } from './ComboboxPopover';
6
6
  export { ComboboxButton } from './ComboboxButton';
@@ -1,26 +1,24 @@
1
1
  import type { ComboboxCallbacks, ComboboxHandle, OnTriggerAttach } from './types';
2
- /** Options of {@link setupCombobox}: the callbacks, and the shared combobox behavior options. */
3
- interface SetupComboboxOptions extends ComboboxCallbacks {
2
+ /** Options for configuring the shared combobox behavior. */
3
+ interface ListboxOptions {
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;
11
6
  }
12
7
  /**
13
- * Set up combobox behavior (WAI-ARIA combobox pattern) on a trigger + list pair.
8
+ * Set up combobox behavior (WAI-ARIA combobox pattern) on a trigger + listbox pair.
14
9
  *
15
- * The trigger and the list are registered separately via the returned handle,
10
+ * The trigger and listbox are registered separately via the returned handle,
16
11
  * allowing framework components to register them on mount. The behavior is
17
- * fully attached once both are registered. The list is late-bound: the list component attaches its
18
- * composite handle with `handle.attachList`.
12
+ * fully attached once both are registered.
19
13
  *
20
14
  * @see https://www.w3.org/WAI/ARIA/apg/patterns/combobox/
21
15
  *
22
- * @param options The callbacks (e.g. option selection) and the shared combobox behavior options.
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.
23
21
  * @returns A ComboboxHandle for interacting with the combobox.
24
22
  */
25
- export declare function setupCombobox(options?: SetupComboboxOptions): ComboboxHandle;
23
+ export declare function setupCombobox(callbacks: ComboboxCallbacks, options?: ListboxOptions, onTriggerAttach?: OnTriggerAttach): ComboboxHandle;
26
24
  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 attach the list
7
- * with `handle.attachList(setupListbox)`.
6
+ * wired in and the trigger registered. The consumer only needs to call
7
+ * `handle.list.mount(listbox)`.
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 attach the list
24
- * with `handle.attachList(setupListbox)`.
23
+ * wired in and the trigger registered. The consumer only needs to call
24
+ * `handle.list.mount(listbox)`.
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 { CompositeEventMap, CompositeEventSource, CompositeHandle, CompositeOptions } from '../Composite/types';
1
+ import type { ListboxHandle } from '../Listbox/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,8 +16,7 @@ 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. 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).
19
+ * - `'manual'` — Filtering is the consumer's responsibility.
21
20
  * - `'off'` — Like `'manual'`, but the input is rendered as `readOnly`
22
21
  * and `openOnFocus` defaults to `true`.
23
22
  */
@@ -44,74 +43,36 @@ export interface ComboboxInputOptions {
44
43
  */
45
44
  selectionMode?: 'fill' | 'keep' | 'clear';
46
45
  }
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
- }
72
46
  /**
73
47
  * Handle returned by `setupCombobox`. Used by framework wrappers and mode controllers.
74
48
  *
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.
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.
78
53
  */
79
- export interface ComboboxHandle extends CompositeEventSource<ComboboxEventMap> {
54
+ export interface ComboboxHandle {
80
55
  /** Register the trigger element. Returns a cleanup function. */
81
56
  registerTrigger(trigger: HTMLInputElement | HTMLButtonElement): () => void;
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). */
57
+ /** Tear down all listeners and state. */
97
58
  destroy(): void;
98
59
  /** The current trigger element (may be null before registration). */
99
60
  readonly trigger: HTMLInputElement | HTMLButtonElement | null;
100
- /** The attached list handle (null until a list attaches). */
101
- readonly list: CompositeHandle | null;
102
- /** Whether the popup is open. */
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`). */
103
64
  readonly isOpen: boolean;
104
- /** Whether the list is always open (see {@link ComboboxHandle.setAlwaysOpen}). */
65
+ /** Whether the listbox is always open (see {@link ComboboxHandle.setAlwaysOpen}). */
105
66
  readonly alwaysOpen: boolean;
106
67
  /**
107
- * Set the open state and update ARIA. Subscribe to `open` to observe it.
68
+ * Set the open state and update ARIA. Subscribe to `list` `open` to observe it.
108
69
  * When always open, a close request only clears the active option.
109
70
  */
110
71
  setIsOpen(isOpen: boolean): void;
111
72
  /**
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
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
115
76
  * `Combobox.Popover`.
116
77
  */
117
78
  setAlwaysOpen(alwaysOpen: boolean | undefined): void;
@@ -72,8 +72,7 @@ export interface CompositeStatusComponents {
72
72
  * - Error state: active when `errorMessage` is provided (presence-based).
73
73
  * - Empty state: active when the item count (`optionsLength`) is 0 and `emptyMessage` is provided, and there is
74
74
  * no 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).
75
+ * - Item count: active when `nbOptionMessage` is provided, the composite is not empty, not loading, and not in error.
77
76
  *
78
77
  * @param props Component props.
79
78
  * @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'`, `'grid'` or `'tree'`): each composite
3
+ * Pattern of a mounted composite element (from its role, e.g. `'listbox'` or `'grid'`): each composite
4
4
  * specialization (see {@link setupComposite}) defines its own patterns.
5
5
  */
6
6
  export type CompositeType = string;
@@ -129,18 +129,8 @@ export interface CompositeNavigation {
129
129
  readonly focusNav: FocusNavigationController;
130
130
  /** Selector of the elements that can become active (options, grid cells, …). */
131
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;
137
132
  /** Whether a clicked cell selects its item (e.g. false for grid action cells). */
138
133
  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;
144
134
  /** Scroll the active item into view. */
145
135
  scrollIntoView(item: HTMLElement): void;
146
136
  /**
@@ -234,7 +224,7 @@ export interface CompositeHandle extends CompositeEventSource {
234
224
  flushPendingNavigation(): void;
235
225
  /** Clear the active item and discard the pending navigation intent. No-op while not mounted. */
236
226
  clearActiveItem(): void;
237
- /** Make an item active (e.g. a parent tree item when its group closes). No-op while not mounted. */
227
+ /** Make an item active. No-op while not mounted. */
238
228
  setActiveItem(item: HTMLElement): void;
239
229
  /**
240
230
  * Make the first selected item active, or else the first (`'first'`) or the last (`'last'`) item.
@@ -14,6 +14,4 @@ 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\"]";
19
17
  export declare const isSelected: (el: Element) => boolean;
package/lumx.css CHANGED
@@ -5721,7 +5721,7 @@ table {
5721
5721
  .lumx-combobox-popover__scroll {
5722
5722
  overflow-y: auto;
5723
5723
  }
5724
- .lumx-combobox-popover:not(:has(:is([role=listbox], [role=grid], [role=tree]):not([hidden]), .lumx-composite-status)) {
5724
+ .lumx-combobox-popover:not(:has(:is([role=listbox], [role=grid]):not([hidden]), .lumx-composite-status)) {
5725
5725
  display: none;
5726
5726
  }
5727
5727
 
@@ -12987,87 +12987,6 @@ table {
12987
12987
  user-select: none;
12988
12988
  }
12989
12989
 
12990
- /* ==========================================================================
12991
- Tree list
12992
- ========================================================================== */
12993
- .lumx-tree-list:empty {
12994
- display: none;
12995
- }
12996
-
12997
- .lumx-tree-list-item__row {
12998
- padding-left: calc(var(--lumx-tree-list-level, 0) * 16px);
12999
- }
13000
- .lumx-tree-list-item__row > .lumx-list-item__wrapper > .lumx-list-item__content {
13001
- min-width: 0;
13002
- }
13003
- .lumx-tree-list-item__row > .lumx-list-item__wrapper > .lumx-list-item__before {
13004
- justify-content: flex-start;
13005
- width: auto;
13006
- }
13007
- .lumx-tree-list-item__row .lumx-tree-list-item__action {
13008
- display: block;
13009
- width: 100%;
13010
- }
13011
- .lumx-tree-list-item__action--passive {
13012
- pointer-events: none;
13013
- }
13014
- .lumx-tree-list-item__toggle, .lumx-tree-list-item__spacer {
13015
- flex-shrink: 0;
13016
- }
13017
- .lumx-tree-list-item__spacer {
13018
- width: calc(var(--lumx-button-height) / 1.5);
13019
- }
13020
- .lumx-tree-list-item__toggle {
13021
- margin-block: calc((20px - calc(var(--lumx-button-height) / 1.5)) / 2);
13022
- }
13023
- .lumx-tree-list-item__toggle.lumx-button--size-s.lumx-button--variant-icon > i {
13024
- width: 20px;
13025
- height: 20px;
13026
- font-size: 20px;
13027
- line-height: 20px;
13028
- }
13029
- .lumx-tree-list-item__row .lumx-tree-list-item__toggle--main {
13030
- position: static;
13031
- }
13032
- .lumx-tree-list-item__row .lumx-tree-list-item__toggle--main.lumx-button.lumx-action-area__action::before {
13033
- pointer-events: auto;
13034
- border-radius: 0;
13035
- }
13036
- .lumx-tree-list-item__row:has(.lumx-tree-list-item__action--passive[data-focus-visible-added]) .lumx-tree-list-item__toggle--main::before {
13037
- background-color: var(--lumx-color-dark-L5);
13038
- outline-style: solid;
13039
- outline-offset: -2px;
13040
- }
13041
- .lumx-tree-list-item__row:has(.lumx-tree-list-item__action--passive[data-focus-visible-added]) .lumx-tree-list-item__toggle--main {
13042
- color: var(--lumx-button-emphasis-low-state-hover-theme-light-color);
13043
- background-color: var(--lumx-button-emphasis-low-state-hover-theme-light-background-color);
13044
- }
13045
- .lumx-tree-list-item__group {
13046
- padding: 0;
13047
- margin: 0;
13048
- list-style: none;
13049
- }
13050
- .lumx-tree-list-item__group > :not(.lumx-tree-list-item) {
13051
- margin-left: calc(var(--lumx-tree-list-level, 0) * 16px);
13052
- }
13053
- @supports (interpolate-size: allow-keywords) {
13054
- .lumx-tree-list-item__group {
13055
- interpolate-size: allow-keywords;
13056
- overflow-y: clip;
13057
- transition: height 400ms, visibility 400ms;
13058
- }
13059
- @media (prefers-reduced-motion: reduce) {
13060
- .lumx-tree-list-item__group {
13061
- transition: none;
13062
- }
13063
- }
13064
- .lumx-tree-list-item__group[hidden] {
13065
- display: block;
13066
- height: 0;
13067
- visibility: hidden;
13068
- }
13069
- }
13070
-
13071
12990
  /* ==========================================================================
13072
12991
  Uploader
13073
12992
  ========================================================================== */
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  },
8
8
  "dependencies": {
9
9
  "@floating-ui/dom": "^1.7.5",
10
- "@lumx/icons": "^4.27.1-alpha.2",
10
+ "@lumx/icons": "^4.28.0-next.0",
11
11
  "classnames": "^2.3.2",
12
12
  "focus-visible": "^5.0.2",
13
13
  "lodash": "4.18.1",
@@ -66,7 +66,7 @@
66
66
  "update-version-changelog": "yarn version-changelog ../../CHANGELOG.md"
67
67
  },
68
68
  "sideEffects": false,
69
- "version": "4.27.1-alpha.2",
69
+ "version": "4.28.0-next.0",
70
70
  "devDependencies": {
71
71
  "@rollup/plugin-typescript": "^12.3.0",
72
72
  "@testing-library/dom": "^10.4.1",
@@ -55,6 +55,5 @@
55
55
  @import "./components/thumbnail/index";
56
56
  @import "./components/toolbar/index";
57
57
  @import "./components/tooltip/index";
58
- @import "./components/tree-list/index";
59
58
  @import "./components/uploader/index";
60
59
  @import "./components/user-block/index";
@@ -23,7 +23,7 @@
23
23
 
24
24
  // Hide the popover when it holds no visible list (the composite sets `hidden` on a list without visible
25
25
  // content) and no state
26
- $visible-list: ':is([role="listbox"], [role="grid"], [role="tree"]):not([hidden])';
26
+ $visible-list: ':is([role="listbox"], [role="grid"]):not([hidden])';
27
27
 
28
28
  &:not(:has(#{$visible-list}, .#{$lumx-base-prefix}-composite-status)) {
29
29
  display: none;
@@ -1,72 +0,0 @@
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
- };
@@ -1,88 +0,0 @@
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
- };
@@ -1,49 +0,0 @@
1
- /** Combobox components used by the tree tests (the shared list sub-components work in a tree too). */
2
- export interface TreeListComboboxNamespace {
3
- Provider: any;
4
- Input: any;
5
- Button: any;
6
- Popover: any;
7
- OptionSkeleton: any;
8
- State: any;
9
- List: any;
10
- Option: any;
11
- }
12
- /** Components used by the tree tests and stories. */
13
- export interface TreeListComponents {
14
- /** The tree (standalone, or in a combobox). */
15
- TreeList: any;
16
- TreeListItem: any;
17
- Combobox: TreeListComboboxNamespace;
18
- }
19
- type RenderResult = {
20
- unmount: () => void;
21
- container: HTMLElement;
22
- };
23
- /**
24
- * Options to set up the tree list test suite.
25
- * Injected by the framework-specific test file (React or Vue).
26
- */
27
- export interface TreeListTestSetup {
28
- components: TreeListComponents;
29
- /**
30
- * Render a template with controlled state management (one `value` state, set by the
31
- * `onChangeProp` callback). Mirrors the withValueOnChange Storybook decorator.
32
- */
33
- renderWithState: (template: (props: any) => any, initialArgs?: Record<string, any>, options?: {
34
- onChangeProp?: string;
35
- valueExtract?: (v: any) => any;
36
- }) => RenderResult;
37
- }
38
- /**
39
- * Create framework-agnostic JSX templates for the tree tests (the reference tree of the spec).
40
- * Exported so the test stories can reuse the same tree.
41
- */
42
- export declare function createTreeTemplates({ TreeList, TreeListItem, Combobox }: TreeListComponents): {
43
- inputTemplate: ({ value, onUpdate, onSelect, treeOnSelect, filter, selectionType, onOpenChange, onClick, nbOptionMessage, withoutState, snacks, }: any) => import("react").JSX.Element;
44
- buttonTemplate: ({ value, onSelect, onOpenChange }: any) => import("react").JSX.Element;
45
- lazyTemplate: ({ value, onChange, onOpenChange, load }: any) => import("react").JSX.Element;
46
- standaloneTemplate: ({ value, onUpdate, onSelect, onOpenChange, onClick, selectionType }: any) => import("react").JSX.Element;
47
- };
48
- export default function treeListTests({ components, renderWithState }: TreeListTestSetup): void;
49
- export {};
@@ -1,60 +0,0 @@
1
- import type { CommonRef, HasClassName, JSXElement, LumxClassName } from '../../types';
2
- import type { TreeListSelectionType } from './selection';
3
- /**
4
- * Defines the props for the core TreeList template.
5
- */
6
- export interface TreeListProps extends HasClassName {
7
- /** Accessible label of the tree (one of `aria-label` or `aria-labelledby` is required). */
8
- 'aria-label'?: string;
9
- /** ID of the element that labels the tree. */
10
- 'aria-labelledby'?: string;
11
- /**
12
- * Indicates that the tree content is incomplete (root skeletons, the first load of the tree). Not rendered
13
- * when false.
14
- */
15
- 'aria-busy'?: boolean;
16
- /**
17
- * Selection type: one selected tree item, or several (`aria-multiselectable`).
18
- */
19
- selectionType?: TreeListSelectionType;
20
- /** Content (`TreeListItem`, `ListboxOptionSkeleton` or `CompositeStatus` elements). */
21
- children?: JSXElement;
22
- /** The ID of the tree element. */
23
- id?: string;
24
- /** Tab index (`0` on a standalone list, which owns focus). */
25
- tabIndex?: number;
26
- /** ref to the root element */
27
- ref?: CommonRef;
28
- }
29
- /**
30
- * Component display name.
31
- */
32
- export declare const COMPONENT_NAME = "TreeList";
33
- /**
34
- * Component default class name and class prefix.
35
- */
36
- export declare const CLASSNAME: LumxClassName<typeof COMPONENT_NAME>;
37
- /**
38
- * Component default props.
39
- */
40
- export declare const DEFAULT_PROPS: {
41
- readonly selectionType: "single";
42
- };
43
- /**
44
- * TreeList core template: a list in the tree pattern (`<ul role="tree">`), with `TreeListItem` items.
45
- * Nothing in the markup refers to a combobox: the framework wrapper links the tree to a combobox trigger,
46
- * or makes it its own focus owner (standalone: `tabIndex={0}`).
47
- *
48
- * @see https://www.w3.org/WAI/ARIA/apg/patterns/treeview/
49
- *
50
- * @param props Component props.
51
- * @return JSX element.
52
- */
53
- export declare const TreeList: {
54
- (props: TreeListProps): import("react").JSX.Element;
55
- displayName: string;
56
- className: "lumx-tree-list";
57
- defaultProps: {
58
- readonly selectionType: "single";
59
- };
60
- };
@@ -1,84 +0,0 @@
1
- import type { CommonRef, HasClassName, JSXElement, LumxClassName } from '../../types';
2
- /**
3
- * Injected framework-specific components for TreeListItem rendering.
4
- */
5
- export interface TreeListItemComponents {
6
- /** Tooltip wrapper component (optional). Used when `tooltipProps` is provided. */
7
- Tooltip?: any;
8
- }
9
- /**
10
- * Defines the props for the core TreeListItem template.
11
- */
12
- export interface TreeListItemProps extends HasClassName {
13
- /** Content of the row (the tree item label). */
14
- label?: JSXElement;
15
- /** The sub-items (`TreeListItem`, `ListboxOptionSkeleton` or `CompositeStatus` elements). */
16
- children?: JSXElement;
17
- /** A component to be rendered before the label (e.g. an icon or avatar). */
18
- before?: JSXElement;
19
- /** A component to be rendered after the label. */
20
- after?: JSXElement;
21
- /** Helper description (part of the filter match text). */
22
- description?: string;
23
- /** The value of the tree item. With a value, the tree item is selectable; without, it is not. */
24
- value?: string;
25
- /** Whether the tree item is selected (internal: from the tree `value`; no effect on a non-selectable tree item). */
26
- isSelected?: boolean;
27
- /** Props forwarded to a Tooltip wrapping the `role="treeitem"` element. */
28
- tooltipProps?: Record<string, any>;
29
- /** Extra props forwarded to the inner `role="treeitem"` element. */
30
- actionProps?: Record<string, any>;
31
- /** ref to the root `<li>` element. */
32
- ref?: CommonRef;
33
- /**
34
- * Unique ID for the tree item element (internal). The IDs of the label, the description and the group are
35
- * `<id>-label`, `<id>-description` and `<id>-group`.
36
- */
37
- id?: string;
38
- /** Whether the tree item is a parent item (internal: it has sub-items, or it loads them on open). */
39
- isParent?: boolean;
40
- /** Whether the parent item is open (internal). */
41
- isOpen?: boolean;
42
- /** Whether the filter hides the tree item (internal). */
43
- hidden?: boolean;
44
- /** Nesting level of the tree item (internal, 0 at the root). Its group sets the level of the sub-items. */
45
- level?: number;
46
- /** On click on the tree item (and on Enter). */
47
- handleClick?(): void;
48
- /** On click on the expand toggle. */
49
- handleToggleClick?(): void;
50
- }
51
- /**
52
- * Props that React/Vue wrappers need to re-declare with framework-specific types.
53
- */
54
- export type TreeListItemPropsToOverride = 'label' | 'before' | 'after' | 'children' | 'tooltipProps' | 'actionProps';
55
- /**
56
- * Component display name.
57
- */
58
- export declare const COMPONENT_NAME = "TreeListItem";
59
- /**
60
- * Component default class name and class prefix.
61
- */
62
- export declare const CLASSNAME: LumxClassName<typeof COMPONENT_NAME>;
63
- /**
64
- * TreeListItem core template: one tree item of a `TreeList`, with its sub-items in a group.
65
- *
66
- * - The `role="treeitem"` element is the row button. It holds the label and carries `aria-expanded`,
67
- * `aria-selected` (only on a selectable tree item) and `aria-owns` (its group is a sibling, not a child).
68
- * It is labelled by its label only (`aria-labelledby`), never by the text of the owned group.
69
- * - The expand toggle is a sibling of the row button, hidden from assistive technologies. On a
70
- * non-selectable parent item, it is the main action of the row (its overlay covers the row).
71
- * - A closed group stays in the DOM, with `hidden`.
72
- * - Each group sets the level of its sub-items (`--lumx-tree-list-level`): the rows read it as a left
73
- * padding, so the hover and selected backgrounds stay full width at every depth.
74
- * - The browser computes `aria-level`, `aria-setsize` and `aria-posinset` from the DOM.
75
- *
76
- * @param props Component props.
77
- * @param components Injected framework-specific components.
78
- * @return JSX element.
79
- */
80
- export declare const TreeListItem: {
81
- (props: TreeListItemProps, { Tooltip }?: TreeListItemComponents): import("react").JSX.Element;
82
- displayName: string;
83
- className: "lumx-tree-list-item";
84
- };
@@ -1,61 +0,0 @@
1
- /**
2
- * Tree items that can become active: not inside a hidden ancestor (a closed group, or a tree item
3
- * hidden by the filter). The selector tree walker does not skip hidden subtrees, so the selector does.
4
- */
5
- export declare const TREE_ITEM_SELECTOR = "[role=\"treeitem\"]:not([hidden] *)";
6
- /** Attribute of the elements that hold the own text of a tree item (its label and description). */
7
- export declare const TREE_LABEL_ATTRIBUTE = "data-tree-label";
8
- /** Attribute of the expand toggles: `TREE_MAIN_TOGGLE_VALUE` when the toggle is the main action of the row, else empty. */
9
- export declare const TREE_TOGGLE_ATTRIBUTE = "data-tree-toggle";
10
- /** Value of `TREE_TOGGLE_ATTRIBUTE` on the expand toggle that is the main action of the row. */
11
- export declare const TREE_MAIN_TOGGLE_VALUE = "main";
12
- /** The expand toggles (their mousedown must not move DOM focus). */
13
- export declare const TREE_TOGGLE_SELECTOR = "[data-tree-toggle]";
14
- /**
15
- * The expand toggle of a non-selectable parent item: the main action of the row (its overlay covers the row
16
- * and catches the clicks on the tree item).
17
- */
18
- export declare const TREE_MAIN_TOGGLE_SELECTOR = "[data-tree-toggle=\"main\"]";
19
- /** Get the ID of the group of sub-items of a tree item. */
20
- export declare const getTreeListItemGroupId: (id: string) => string;
21
- /** Get the ID of the label of a tree item. */
22
- export declare const getTreeListItemLabelId: (id: string) => string;
23
- /** Get the ID of the description of a tree item. */
24
- export declare const getTreeListItemDescriptionId: (id: string) => string;
25
- /** CSS custom property set on each group: the nesting level of its sub-items (the indent). */
26
- export declare const TREE_LEVEL_PROPERTY = "--lumx-tree-list-level";
27
- /** The root of the tree item that contains an element (a tree item element, an expand toggle, a group…). */
28
- export declare const getTreeItemRoot: (target: Element) => HTMLElement | null;
29
- /** The tree item element of a tree item root (the row comes before the group: it is the first one). */
30
- export declare const getTreeItemOfRoot: (root: HTMLElement) => HTMLElement | null;
31
- /** The group of a tree item root (null on a leaf item). */
32
- export declare const getGroupOfRoot: (root: HTMLElement) => HTMLElement | null;
33
- /** The root of the parent item of a tree item root (null for a root tree item). */
34
- export declare function getParentRoot(root: HTMLElement): HTMLElement | null;
35
- /** Find the parent item of a tree item element, inside the tree element. Returns null for a root tree item. */
36
- export declare function getParentTreeItem(container: HTMLElement, item: HTMLElement): HTMLElement | null;
37
- /** The first sub-item of a tree item element that can become active (null on a leaf item or a closed group). */
38
- export declare function getFirstSubItem(item: HTMLElement): HTMLElement | null;
39
- /**
40
- * The open state of a tree item element in the DOM: undefined on a leaf item (no `aria-expanded`). (The tree
41
- * item registry holds the open state: this is the fallback for a tree item that is not registered.)
42
- */
43
- export declare function isTreeItemOpen(item: HTMLElement): boolean | undefined;
44
- /**
45
- * Write the open state of a parent item to the DOM, before the framework renders it: Up/Down select the tree
46
- * items that can become active from the DOM (not in a `hidden` group), and they can run before the next render.
47
- */
48
- export declare function writeTreeItemOpen(root: HTMLElement, isOpen: boolean): void;
49
- /**
50
- * The own text of a tree item root: its label and description, never the text of its sub-items. Only the row is
51
- * read (the children of the root other than the group), so the cost does not depend on the number of sub-items.
52
- */
53
- export declare function getTreeItemText(root: HTMLElement): string;
54
- /** Whether a sub-item at any depth of a tree item root is selected. */
55
- export declare const hasSelectedSubItem: (root: HTMLElement) => boolean;
56
- /**
57
- * Keep `aria-busy` on the group of a tree item root while the group holds skeletons and no sub-item.
58
- * Observes the direct children only: the root (the group appears or goes) and the group (the skeletons and the
59
- * sub-item roots, inserted with their content). Returns the function that stops the observation.
60
- */
61
- export declare function observeGroupBusy(root: HTMLElement): () => void;
@@ -1,9 +0,0 @@
1
- export { setupTreeList } from './setupTreeList';
2
- export type { TreeListHandle, TreeListOptions, TreeListItemController, TreeListItemOptions, TreeListItemState, } from './types';
3
- export { isTreeListHandle } from './utils';
4
- export { isTreeValueSelected, toggleTreeValue } from './selection';
5
- export type { TreeListSelectionType } from './selection';
6
- export { TreeList } from './TreeList';
7
- export type { TreeListProps } from './TreeList';
8
- export { TreeListItem } from './TreeListItem';
9
- export type { TreeListItemProps, TreeListItemPropsToOverride, TreeListItemComponents } from './TreeListItem';
@@ -1,15 +0,0 @@
1
- import type { CompositeNavigation, CompositeNavigationOptions } from '../Composite/types';
2
- /** What the tree navigation reads and requests through the tree item registry. */
3
- export interface TreeNavigationRegistry {
4
- /** The open state of a tree item element (undefined on a leaf item). */
5
- getOpenState(item: HTMLElement): boolean | undefined;
6
- /** Open or close the parent item of a tree item element. */
7
- openTreeItem(item: HTMLElement, isOpen: boolean): void;
8
- }
9
- /**
10
- * Navigation module for the tree pattern (`role="tree"` with `role="treeitem"` items, sub-items in `role="group"`).
11
- * Up/Down move over the visible tree items (the ones inside a closed parent item are skipped).
12
- * Right/Left open and close the parent items (through the tree item registry, which holds the open state), or
13
- * move to the first sub-item and to the parent item.
14
- */
15
- export declare function createTreeNavigation(options: CompositeNavigationOptions, { getOpenState, openTreeItem }: TreeNavigationRegistry): CompositeNavigation;
@@ -1,9 +0,0 @@
1
- /** Selection type of a tree list: one selected value, or several. */
2
- export type TreeListSelectionType = 'single' | 'multiple';
3
- /** Whether a tree item value is selected (in the tree value, or equal to it). */
4
- export declare function isTreeValueSelected(value: string | string[] | undefined, itemValue: string): boolean;
5
- /**
6
- * Next value of a multiple selection tree after the user selects a tree item: the item value is removed
7
- * when it is selected, else added. Pure function: never mutates `value`.
8
- */
9
- export declare function toggleTreeValue(value: string[] | undefined, itemValue: string): string[];
@@ -1,18 +0,0 @@
1
- import type { TreeListHandle, TreeListOptions } from './types';
2
- /**
3
- * Set up tree list behavior (WAI-ARIA tree pattern) independent of any DOM element.
4
- *
5
- * Built on the composite base (see {@link setupComposite}: focus owner, focus navigation, keyboard,
6
- * selection, open state, skeletons, loading announcement and events). The tree list adds the tree item
7
- * registry (the open state and the filter state of each tree item, see
8
- * {@link TreeListHandle.registerTreeItem}), the tree filter and the tree navigation (Right and Left open
9
- * and close the parent items through the registry).
10
- *
11
- * - Standalone (no `focusOwner` option): the tree element owns DOM focus and `aria-activedescendant`,
12
- * and handles its own keyboard navigation. It has no filter.
13
- * - Linked (`focusOwner` option, e.g. a combobox trigger): the parent owns focus and the keyboard; the
14
- * tree writes `aria-activedescendant` on the parent focus owner. The trigger input sets the filter.
15
- *
16
- * @see https://www.w3.org/WAI/ARIA/apg/patterns/treeview/
17
- */
18
- export declare function setupTreeList(options?: TreeListOptions): TreeListHandle;
@@ -1,55 +0,0 @@
1
- import type { CompositeHandle, CompositeOptions } from '../Composite/types';
2
- /**
3
- * Options of {@link setupTreeList} (the composite options).
4
- * Without `focusOwner`, the tree is standalone: it owns focus and it has no filter.
5
- */
6
- export type TreeListOptions = CompositeOptions;
7
- /** State of a tree item, rendered by the tree item components. */
8
- export interface TreeListItemState {
9
- /** Whether the parent item is open (always false on a leaf item). */
10
- isOpen: boolean;
11
- /** Whether the filter hides the tree item. */
12
- hidden: boolean;
13
- }
14
- /** Options of {@link TreeListHandle.registerTreeItem}. */
15
- export interface TreeListItemOptions {
16
- /** Whether the tree item is a parent item (it has sub-items, or it loads them on open). */
17
- isParent(): boolean;
18
- /** Called on every open and close by the user (never for the initial state or for the filter). */
19
- onOpenChange?(isOpen: boolean): void;
20
- /** Called when the state changes. */
21
- onChange(state: TreeListItemState): void;
22
- }
23
- /** Controller of a registered tree item (see {@link TreeListHandle.registerTreeItem}). */
24
- export interface TreeListItemController {
25
- /** The current state. */
26
- readonly state: TreeListItemState;
27
- /** Open or close the parent item (a user action: fires `onOpenChange`). Does nothing on a leaf item. */
28
- setOpen(isOpen: boolean): void;
29
- /** Toggle the parent item (a user action). */
30
- toggle(): void;
31
- /** Unregister the tree item and remove the listeners. */
32
- destroy(): void;
33
- }
34
- /**
35
- * Handle returned by {@link setupTreeList}: the composite handle (WAI-ARIA tree pattern), plus the
36
- * tree item registry.
37
- */
38
- export interface TreeListHandle extends CompositeHandle {
39
- /**
40
- * Register a tree item root `<li>` element (what the React and Vue tree item components do on mount), and
41
- * get the controller of its open state. The tree item matches the filter on its own text (its
42
- * `[data-tree-label]` elements), never on its sub-items.
43
- *
44
- * The open state is internal to the controller:
45
- * - Initial state: open when a sub-item at any depth is selected (the closed groups stay mounted).
46
- * - Without a filter: the user state (toggle, Right, Left, a click on a non-selectable parent item…).
47
- * - During a filter: the parent items with a match below open. A user action lasts until the next
48
- * change of the filter text. On clear, each parent item goes back to its state from before the
49
- * filter, and the ancestors of the selected items stay open.
50
- * - On close, an active item inside the group moves to this tree item.
51
- *
52
- * The registry also sets `aria-busy` on the group while it holds only skeletons.
53
- */
54
- registerTreeItem(element: HTMLElement, options: TreeListItemOptions): TreeListItemController;
55
- }
@@ -1,4 +0,0 @@
1
- import type { CompositeHandle } from '../Composite/types';
2
- import type { TreeListHandle } from './types';
3
- /** Whether a composite handle is a tree list handle (it has the tree item registry). */
4
- export declare function isTreeListHandle(handle: CompositeHandle | null | undefined): handle is TreeListHandle;
@@ -1,2 +0,0 @@
1
- /** Whether a text contains a search text, with no regard to the letter case (an empty search text always matches). */
2
- export declare function includesIgnoreCase(text: string, search: string): boolean;
@@ -1,144 +0,0 @@
1
- /* ==========================================================================
2
- Tree list
3
- ========================================================================== */
4
-
5
- // The row reuses the list item structure (`lumx-list-item`, size tiny) and the list item action styles
6
- // (hover, active, selected), at every depth.
7
-
8
- // Indent: each group sets `--lumx-tree-list-level` (the level of its sub-items, unset at the root).
9
- // The rows (and the skeletons or states in a group) get one big spacing unit of indent per level.
10
- $lumx-tree-list-indent: calc(var(--lumx-tree-list-level, 0) * #{$lumx-spacing-unit-big});
11
-
12
- // Size of the expand toggle (a size `s` icon button), also the width of the spacer on a leaf item.
13
- $lumx-tree-list-toggle-size: calc(var(--lumx-button-height) / 1.5);
14
-
15
- // Duration of the group open and close animation (the same as the expansion panel).
16
- $lumx-tree-list-transition-duration: 400ms;
17
-
18
- // ---- Tree -----------------------
19
-
20
- // The composite sets `hidden` on the tree when it has no visible content (see `setupComposite`).
21
- // Before the composite mounts: hide an empty tree.
22
- .#{$lumx-base-prefix}-tree-list:empty {
23
- display: none;
24
- }
25
-
26
- // ---- Tree item -----------------------
27
-
28
- .#{$lumx-base-prefix}-tree-list-item {
29
- &__row {
30
- padding-left: $lumx-tree-list-indent;
31
- }
32
-
33
- // Allow the content to shrink below its text width so that a `truncate` label shows an ellipsis
34
- &__row > .#{$lumx-base-prefix}-list-item__wrapper > .#{$lumx-base-prefix}-list-item__content {
35
- min-width: 0;
36
- }
37
-
38
- // The `before` slot holds the expand toggle (or the spacer) and the `before` content: no fixed width
39
- &__row > .#{$lumx-base-prefix}-list-item__wrapper > .#{$lumx-base-prefix}-list-item__before {
40
- justify-content: flex-start;
41
- width: auto;
42
- }
43
-
44
- // The row action is a full width block, so that a `truncate` label gets the content width (a block button
45
- // gets the width of its text). (One class more than the `all: unset` of the action area action.)
46
- &__row &__action {
47
- display: block;
48
- width: 100%;
49
- }
50
-
51
- // Non-selectable parent item: the expand toggle is the main action of the row. The row action (a `span`)
52
- // lets the pointer through to the toggle overlay (it stays the `role="treeitem"`).
53
- &__action--passive {
54
- pointer-events: none;
55
- }
56
-
57
- // Expand toggle, or the spacer of the same width on a leaf item
58
- &__toggle,
59
- &__spacer {
60
- flex-shrink: 0;
61
- }
62
-
63
- &__spacer {
64
- width: $lumx-tree-list-toggle-size;
65
- }
66
-
67
- // Negative vertical margins: the toggle fits in the line height (size `xs`), so that a parent item row
68
- // keeps the height of a list item of size `tiny`.
69
- &__toggle {
70
- margin-block: calc((#{$lumx-size-xs} - #{$lumx-tree-list-toggle-size}) / 2);
71
-
72
- // A bigger chevron than the default icon of a size `s` icon button
73
- // (the icon size rule of the button, with the toggle class).
74
- &.#{$lumx-base-prefix}-button--size-s.#{$lumx-base-prefix}-button--variant-icon > i {
75
- width: $lumx-size-xs;
76
- height: $lumx-size-xs;
77
- font-size: $lumx-size-xs;
78
- line-height: $lumx-size-xs;
79
- }
80
- }
81
-
82
- // Main toggle: its overlay (`::before`) covers the whole row (the row is the positioning context, not the
83
- // toggle). (One class more than the `position: relative` of the button.)
84
- // A pointer anywhere on the row is on the toggle: the toggle shows its own hover and active states on top of
85
- // the row ones, to show that a click opens or closes the item (it does not select it).
86
- &__row &__toggle--main {
87
- position: static;
88
- }
89
-
90
- // The button styles disable the pointer on `::before` and round it: the overlay catches the clicks
91
- // on the row, with square corners (one class more than the button `::before` rules).
92
- &__row &__toggle--main.#{$lumx-base-prefix}-button.#{$lumx-base-prefix}-action-area__action::before {
93
- pointer-events: auto;
94
- border-radius: 0;
95
- }
96
-
97
- // Keyboard: the active item is the row action, show its highlight on the toggle overlay (the focus style of
98
- // an action overlay).
99
- &__row:has(&__action--passive[data-focus-visible-added]) &__toggle--main::before {
100
- @include lumx-action-area-overlay-hover("dark");
101
- @include lumx-action-area-focus-inset;
102
- }
103
-
104
- // Keyboard: the toggle also shows its hover state, as with the pointer (Enter opens or closes the item, it does
105
- // not select it).
106
- &__row:has(&__action--passive[data-focus-visible-added]) &__toggle--main {
107
- color: var(--lumx-button-emphasis-low-state-hover-theme-light-color);
108
- background-color: var(--lumx-button-emphasis-low-state-hover-theme-light-background-color);
109
- }
110
-
111
- // Sub-items (the indent is on their rows)
112
- &__group {
113
- padding: 0;
114
- margin: 0;
115
- list-style: none;
116
-
117
- // Skeletons and states: a margin (they have no full width background, and a state has a fixed padding)
118
- > :not(.#{$lumx-base-prefix}-tree-list-item) {
119
- margin-left: $lumx-tree-list-indent;
120
- }
121
-
122
- // Open and close animation: the height goes to and from `auto` (`interpolate-size`). Where it is supported,
123
- // a closed group (`hidden`) stays in the layout with no height and hidden content (`visibility` changes at
124
- // the end of the close), so that it can animate. Elsewhere, a closed group has `display: none`.
125
- @supports (interpolate-size: allow-keywords) {
126
- // stylelint-disable-next-line property-no-unknown -- (not in the stylelint 14 property list yet)
127
- interpolate-size: allow-keywords;
128
- overflow-y: clip;
129
- transition:
130
- height $lumx-tree-list-transition-duration,
131
- visibility $lumx-tree-list-transition-duration;
132
-
133
- @media (prefers-reduced-motion: reduce) {
134
- transition: none;
135
- }
136
-
137
- &[hidden] {
138
- display: block;
139
- height: 0;
140
- visibility: hidden;
141
- }
142
- }
143
- }
144
- }