@lumx/core 4.27.1-alpha.0 → 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.
- package/components-and-utils.css +93 -8
- package/js/components/Combobox/Tests.d.ts +5 -0
- package/js/components/Combobox/index.d.ts +1 -1
- package/js/components/Combobox/setupCombobox.d.ts +13 -11
- package/js/components/Combobox/setupComboboxButton.d.ts +2 -2
- package/js/components/Combobox/setupComboboxInput.d.ts +2 -2
- package/js/components/Combobox/types.d.ts +55 -17
- package/js/components/Composite/CompositeItemDescription.d.ts +17 -0
- package/js/components/Composite/CompositeSelectionIcon.d.ts +20 -0
- package/js/components/Composite/CompositeStatus.d.ts +82 -0
- package/js/components/{Listbox → Composite}/constants.d.ts +3 -1
- package/js/components/Composite/index.d.ts +7 -0
- package/js/components/Composite/setupComposite.d.ts +28 -0
- package/js/components/Composite/types.d.ts +260 -0
- package/js/components/Composite/utils.d.ts +19 -0
- package/js/components/Listbox/ListboxSection.d.ts +1 -1
- package/js/components/Listbox/index.d.ts +2 -5
- package/js/components/Listbox/navigation.d.ts +3 -38
- package/js/components/Listbox/setupListbox.d.ts +6 -4
- package/js/components/Listbox/types.d.ts +6 -125
- package/js/components/Listbox/utils.d.ts +4 -28
- package/js/components/TreeList/Stories.d.ts +72 -0
- package/js/components/TreeList/TestStories.d.ts +88 -0
- package/js/components/TreeList/Tests.d.ts +49 -0
- package/js/components/TreeList/TreeList.d.ts +60 -0
- package/js/components/TreeList/TreeListItem.d.ts +84 -0
- package/js/components/TreeList/dom.d.ts +61 -0
- package/js/components/TreeList/index.d.ts +9 -0
- package/js/components/TreeList/navigation.d.ts +15 -0
- package/js/components/TreeList/selection.d.ts +9 -0
- package/js/components/TreeList/setupTreeList.d.ts +18 -0
- package/js/components/TreeList/types.d.ts +55 -0
- package/js/components/TreeList/utils.d.ts +4 -0
- package/js/utils/string/includesIgnoreCase.d.ts +2 -0
- package/lumx.css +93 -8
- package/package.json +2 -2
- package/scss/_components_classes.scss +2 -0
- package/scss/components/combobox/_index.scss +4 -4
- package/scss/components/composite/_index.scss +20 -0
- package/scss/components/list-box/_index.scss +2 -13
- package/scss/components/tree-list/_index.scss +144 -0
- package/scss/core/action-area/_index.scss +3 -4
- package/scss/core/action-area/_mixins.scss +11 -0
- package/js/components/Listbox/ListboxOptionSelectionIcon.d.ts +0 -13
- package/js/components/Listbox/ListboxState.d.ts +0 -105
- package/js/components/Listbox/subscribeListboxState.d.ts +0 -24
package/components-and-utils.css
CHANGED
|
@@ -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-
|
|
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
|
|
|
@@ -5232,6 +5232,17 @@ table {
|
|
|
5232
5232
|
margin-left: 52px;
|
|
5233
5233
|
}
|
|
5234
5234
|
|
|
5235
|
+
/* ==========================================================================
|
|
5236
|
+
Composite
|
|
5237
|
+
========================================================================== */
|
|
5238
|
+
.lumx-composite-status {
|
|
5239
|
+
text-align: center;
|
|
5240
|
+
}
|
|
5241
|
+
|
|
5242
|
+
.lumx-composite-item__selection-icon {
|
|
5243
|
+
margin: auto;
|
|
5244
|
+
}
|
|
5245
|
+
|
|
5235
5246
|
/* ==========================================================================
|
|
5236
5247
|
Date picker
|
|
5237
5248
|
========================================================================== */
|
|
@@ -7420,10 +7431,6 @@ table {
|
|
|
7420
7431
|
display: none;
|
|
7421
7432
|
}
|
|
7422
7433
|
|
|
7423
|
-
.lumx-listbox-state {
|
|
7424
|
-
text-align: center;
|
|
7425
|
-
}
|
|
7426
|
-
|
|
7427
7434
|
.lumx-listbox-option-skeleton .lumx-skeleton-typography {
|
|
7428
7435
|
width: min(65%, 200px);
|
|
7429
7436
|
}
|
|
@@ -7433,9 +7440,6 @@ table {
|
|
|
7433
7440
|
.lumx-listbox-option-skeleton:nth-child(3n+2) .lumx-skeleton-typography {
|
|
7434
7441
|
width: min(55%, 170px);
|
|
7435
7442
|
}
|
|
7436
|
-
.lumx-listbox-option__selection-icon {
|
|
7437
|
-
margin: auto;
|
|
7438
|
-
}
|
|
7439
7443
|
.lumx-listbox-option .lumx-list-item__wrapper,
|
|
7440
7444
|
.lumx-listbox-option .lumx-list-item__content {
|
|
7441
7445
|
min-width: 0;
|
|
@@ -12302,6 +12306,87 @@ table {
|
|
|
12302
12306
|
user-select: none;
|
|
12303
12307
|
}
|
|
12304
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
|
+
|
|
12305
12390
|
/* ==========================================================================
|
|
12306
12391
|
Uploader
|
|
12307
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
|
|
3
|
-
interface
|
|
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 +
|
|
13
|
+
* Set up combobox behavior (WAI-ARIA combobox pattern) on a trigger + list pair.
|
|
9
14
|
*
|
|
10
|
-
* The trigger and
|
|
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
|
|
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(
|
|
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
|
|
7
|
-
* `handle.
|
|
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
|
|
24
|
-
* `handle.
|
|
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,5 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export type { SectionState, SectionRegistration, OptionRegistration, OptionActiveEvent } from '../Listbox/types';
|
|
1
|
+
import type { CompositeEventMap, CompositeEventSource, CompositeHandle, CompositeOptions } from '../Composite/types';
|
|
3
2
|
/** Callbacks provided by the consumer (React/Vue) to react to combobox state changes. */
|
|
4
3
|
export interface ComboboxCallbacks {
|
|
5
4
|
/** Called when an option is selected (click or keyboard). */
|
|
@@ -17,7 +16,8 @@ export interface ComboboxInputOptions {
|
|
|
17
16
|
* Controls how the combobox filters options as the user types.
|
|
18
17
|
*
|
|
19
18
|
* - `'auto'` (default) — Options are automatically filtered client-side.
|
|
20
|
-
* - `'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).
|
|
21
21
|
* - `'off'` — Like `'manual'`, but the input is rendered as `readOnly`
|
|
22
22
|
* and `openOnFocus` defaults to `true`.
|
|
23
23
|
*/
|
|
@@ -44,36 +44,74 @@ export interface ComboboxInputOptions {
|
|
|
44
44
|
*/
|
|
45
45
|
selectionMode?: 'fill' | 'keep' | 'clear';
|
|
46
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
|
+
}
|
|
47
72
|
/**
|
|
48
73
|
* Handle returned by `setupCombobox`. Used by framework wrappers and mode controllers.
|
|
49
74
|
*
|
|
50
|
-
* The combobox owns the trigger
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* 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.
|
|
54
78
|
*/
|
|
55
|
-
export interface ComboboxHandle {
|
|
79
|
+
export interface ComboboxHandle extends CompositeEventSource<ComboboxEventMap> {
|
|
56
80
|
/** Register the trigger element. Returns a cleanup function. */
|
|
57
81
|
registerTrigger(trigger: HTMLInputElement | HTMLButtonElement): () => void;
|
|
58
|
-
/**
|
|
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). */
|
|
59
97
|
destroy(): void;
|
|
60
98
|
/** The current trigger element (may be null before registration). */
|
|
61
99
|
readonly trigger: HTMLInputElement | HTMLButtonElement | null;
|
|
62
|
-
/** The
|
|
63
|
-
readonly list:
|
|
64
|
-
/** Whether the popup is open
|
|
100
|
+
/** The attached list handle (null until a list attaches). */
|
|
101
|
+
readonly list: CompositeHandle | null;
|
|
102
|
+
/** Whether the popup is open. */
|
|
65
103
|
readonly isOpen: boolean;
|
|
66
|
-
/** Whether the
|
|
104
|
+
/** Whether the list is always open (see {@link ComboboxHandle.setAlwaysOpen}). */
|
|
67
105
|
readonly alwaysOpen: boolean;
|
|
68
106
|
/**
|
|
69
|
-
* Set the open state and update ARIA. Subscribe to `
|
|
107
|
+
* Set the open state and update ARIA. Subscribe to `open` to observe it.
|
|
70
108
|
* When always open, a close request only clears the active option.
|
|
71
109
|
*/
|
|
72
110
|
setIsOpen(isOpen: boolean): void;
|
|
73
111
|
/**
|
|
74
|
-
* Force the
|
|
75
|
-
* open/close behavior (the
|
|
76
|
-
* close the
|
|
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
|
|
77
115
|
* `Combobox.Popover`.
|
|
78
116
|
*/
|
|
79
117
|
setAlwaysOpen(alwaysOpen: boolean | undefined): void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { HasClassName, JSXElement } from '../../types';
|
|
2
|
+
/** Props of the {@link CompositeItemDescription} template. */
|
|
3
|
+
export interface CompositeItemDescriptionProps extends HasClassName {
|
|
4
|
+
/** ID of the description (the item action refers to it with `aria-describedby`). */
|
|
5
|
+
id?: string;
|
|
6
|
+
/** The description text. */
|
|
7
|
+
children?: JSXElement;
|
|
8
|
+
/** Extra attributes (e.g. the filter match text marker of a tree item). */
|
|
9
|
+
[attribute: `data-${string}`]: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Helper description of a composite item (an option or a tree item), rendered after the item action.
|
|
13
|
+
*
|
|
14
|
+
* @param props Component props.
|
|
15
|
+
* @return JSX element.
|
|
16
|
+
*/
|
|
17
|
+
export declare const CompositeItemDescription: ({ id, className, children, ...attributes }: CompositeItemDescriptionProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { HasClassName } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Component default class name.
|
|
4
|
+
*/
|
|
5
|
+
export declare const CLASSNAME: "lumx-composite-item__selection-icon";
|
|
6
|
+
/** Class names of the previous versions on a listbox option, kept for compatibility (set by the option icon). */
|
|
7
|
+
export declare const LEGACY_OPTION_CLASSNAME = "lumx-listbox-option__selection-icon lumx-combobox-option__selection-icon";
|
|
8
|
+
export interface CompositeSelectionIconProps extends HasClassName {
|
|
9
|
+
/** Selection type of the select (`undefined` renders nothing). */
|
|
10
|
+
selectionType: 'single' | 'multiple' | undefined;
|
|
11
|
+
/** Whether the item is selected. */
|
|
12
|
+
isSelected: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Selection state icon of a composite item (an option or a tree item). The icon is always rendered after the label.
|
|
16
|
+
*
|
|
17
|
+
* - `single`: a check circle icon when selected, a blank radio icon otherwise.
|
|
18
|
+
* - `multiple`: a checkbox icon, marked or blank.
|
|
19
|
+
*/
|
|
20
|
+
export declare const CompositeSelectionIcon: ({ selectionType, isSelected, className }: CompositeSelectionIconProps) => import("react").JSX.Element | null;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { HasClassName, LumxClassName } from '../../types';
|
|
2
|
+
import type { CompositeState } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Component display name.
|
|
5
|
+
*/
|
|
6
|
+
export declare const COMPONENT_NAME = "CompositeStatus";
|
|
7
|
+
/**
|
|
8
|
+
* Component default class name and class prefix.
|
|
9
|
+
*/
|
|
10
|
+
export declare const CLASSNAME: LumxClassName<typeof COMPONENT_NAME>;
|
|
11
|
+
/** Class names of the previous versions (`Combobox.State` was the listbox state), kept for compatibility. */
|
|
12
|
+
export declare const LEGACY_CLASSNAME = "lumx-listbox-state lumx-combobox-state";
|
|
13
|
+
/**
|
|
14
|
+
* Defines the props for the core CompositeStatus template.
|
|
15
|
+
*/
|
|
16
|
+
export interface CompositeStatusProps extends HasClassName {
|
|
17
|
+
/**
|
|
18
|
+
* Message to display when the composite has no visible items.
|
|
19
|
+
* Can be a plain string or a function receiving the current input value (for dynamic messages).
|
|
20
|
+
* When omitted, the empty state is not shown.
|
|
21
|
+
*/
|
|
22
|
+
emptyMessage?: string | ((inputValue: string) => string);
|
|
23
|
+
/**
|
|
24
|
+
* Message callback to display the number of available items.
|
|
25
|
+
* Called with the current visible item count and should return a human-readable string
|
|
26
|
+
* (e.g. `(n) => \`${n} result(s) available\``).
|
|
27
|
+
* Displayed when the composite is open, not empty, not loading, and not in error.
|
|
28
|
+
* When omitted, no item count message is shown.
|
|
29
|
+
*/
|
|
30
|
+
nbOptionMessage?: (optionsLength: number) => string;
|
|
31
|
+
/**
|
|
32
|
+
* Error state title message.
|
|
33
|
+
* When provided, the error state is active (takes priority over the empty state).
|
|
34
|
+
* When omitted, the error state is not shown.
|
|
35
|
+
*/
|
|
36
|
+
errorMessage?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Secondary error message (e.g. "Please try again").
|
|
39
|
+
* Only rendered when `errorMessage` is provided.
|
|
40
|
+
*/
|
|
41
|
+
errorTryReloadMessage?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Message to announce when loading persists (after a 500ms debounce).
|
|
44
|
+
* When omitted, no loading announcement is made.
|
|
45
|
+
*/
|
|
46
|
+
loadingMessage?: string;
|
|
47
|
+
/**
|
|
48
|
+
* The live region state of the composite (the `stateChange` snapshot, see `CompositeState`).
|
|
49
|
+
* Without it (no composite handle yet), nothing renders.
|
|
50
|
+
*/
|
|
51
|
+
state?: CompositeState;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Components injected by the framework wrapper (dependency injection).
|
|
55
|
+
*/
|
|
56
|
+
export interface CompositeStatusComponents {
|
|
57
|
+
/**
|
|
58
|
+
* GenericBlock component (framework-specific, e.g. React GenericBlock with FlexBox handling).
|
|
59
|
+
*/
|
|
60
|
+
GenericBlock: any;
|
|
61
|
+
/**
|
|
62
|
+
* Text component (framework-specific, e.g. React Text or Vue Text).
|
|
63
|
+
*/
|
|
64
|
+
Text: any;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* CompositeStatus core template: the live region of a composite (listbox, grid or tree).
|
|
68
|
+
* Renders the empty, loading, error and item count messages (e.g. in the combobox popover).
|
|
69
|
+
* The block itself acts as a screen reader live region (`role="status" aria-live="polite"`).
|
|
70
|
+
*
|
|
71
|
+
* Activation rules:
|
|
72
|
+
* - Error state: active when `errorMessage` is provided (presence-based).
|
|
73
|
+
* - Empty state: active when the item count (`optionsLength`) is 0 and `emptyMessage` is provided, and there is
|
|
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).
|
|
77
|
+
*
|
|
78
|
+
* @param props Component props.
|
|
79
|
+
* @param components Injected framework-specific components.
|
|
80
|
+
* @return JSX element or null when no state is active.
|
|
81
|
+
*/
|
|
82
|
+
export declare const CompositeStatus: (props: CompositeStatusProps, { GenericBlock, Text }: CompositeStatusComponents) => import("react").JSX.Element;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { OptionActiveEvent } from './types';
|
|
2
|
-
|
|
2
|
+
/** The active state event of one item (see {@link OptionActiveEvent}). */
|
|
3
3
|
export declare const optionActiveEvent: (optionId: string) => OptionActiveEvent;
|
|
4
4
|
export declare const isOptionActiveEvent: (event: string) => event is OptionActiveEvent;
|
|
5
|
+
/** The item id of an active state event. */
|
|
6
|
+
export declare const getOptionActiveId: (event: OptionActiveEvent) => string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { setupComposite } from './setupComposite';
|
|
2
|
+
export type { CompositeSetup } from './setupComposite';
|
|
3
|
+
export { CompositeSelectionIcon } from './CompositeSelectionIcon';
|
|
4
|
+
export type { CompositeSelectionIconProps } from './CompositeSelectionIcon';
|
|
5
|
+
export { CompositeStatus } from './CompositeStatus';
|
|
6
|
+
export type { CompositeStatusProps, CompositeStatusComponents } from './CompositeStatus';
|
|
7
|
+
export type { CompositeEventMap, CompositeEventSource, CompositeFilterMode, CompositeFocusOwnerLink, CompositeHandle, CompositeNavigation, CompositeNavigationOptions, CompositeOptions, CompositeSpecialization, CompositeType, OptionActiveEvent, } from './types';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { CompositeFilter, CompositeHandle, CompositeOptions, CompositeSpecialization } from './types';
|
|
2
|
+
/** Result of {@link setupComposite}: the handle, and the hooks the specialization calls. */
|
|
3
|
+
export interface CompositeSetup {
|
|
4
|
+
/** The composite handle (the specialization adds its own methods to it). */
|
|
5
|
+
handle: CompositeHandle;
|
|
6
|
+
/**
|
|
7
|
+
* Fire `optionsChange` when the visible count (or the hidden count state) changed, or when the
|
|
8
|
+
* input value changed while empty. The specialization calls it when its items change.
|
|
9
|
+
*/
|
|
10
|
+
notifyOptionsChange(): void;
|
|
11
|
+
/** The current filter (set with {@link CompositeHandle.setFilter}, reset on destroy). */
|
|
12
|
+
getFilter(): CompositeFilter;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Set up the behavior shared by the composite widgets (one active item among many: WAI-ARIA listbox,
|
|
16
|
+
* grid, …) independent of any DOM element.
|
|
17
|
+
*
|
|
18
|
+
* The composite owns the focus owner link, the focus navigation (once an element is mounted, with the
|
|
19
|
+
* navigation module of the specialization), the keyboard handling, the selection, the open state, the
|
|
20
|
+
* filter, the skeleton registry, the loading announcement and the events. The specialization owns its item
|
|
21
|
+
* registry, how it applies the filter and its navigation modules (see {@link CompositeSpecialization}).
|
|
22
|
+
*
|
|
23
|
+
* - Standalone (no `focusOwner` option): the composite element owns DOM focus and
|
|
24
|
+
* `aria-activedescendant`, and handles its own keyboard navigation.
|
|
25
|
+
* - Linked (`focusOwner` option, e.g. a combobox trigger): the parent owns focus and the keyboard;
|
|
26
|
+
* the composite writes `aria-activedescendant` on the parent focus owner.
|
|
27
|
+
*/
|
|
28
|
+
export declare function setupComposite(options: CompositeOptions, specialization: CompositeSpecialization): CompositeSetup;
|