@lumx/core 4.12.0 → 4.12.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/js/components/Chip/SelectionChipGroupTests.d.ts +7 -2
- package/js/components/Combobox/ComboboxButton.d.ts +2 -1
- package/js/components/Combobox/ComboboxInput.d.ts +9 -6
- package/js/components/Combobox/setupComboboxInput.d.ts +2 -19
- package/js/components/Combobox/types.d.ts +27 -3
- package/js/utils/focus/constants.d.ts +8 -2
- package/js/utils/focus/index.d.ts +1 -0
- package/js/utils/focus/setupFocusTrap.d.ts +28 -0
- package/package.json +4 -3
|
@@ -10,9 +10,14 @@ export declare const setup: (propsOverride: any | undefined, { render, ...option
|
|
|
10
10
|
interface CoreTestOptions extends SetupOptions<any> {
|
|
11
11
|
/**
|
|
12
12
|
* Render a stateful SelectionChipGroup that updates its own value on change.
|
|
13
|
-
*
|
|
13
|
+
* Should also render a sibling `<input>` element wired via `inputRef` so the
|
|
14
|
+
* keyboard navigation tests can assert focus fallback to the input.
|
|
15
|
+
*
|
|
16
|
+
* When provided, enables roving tabindex recovery and keyboard navigation tests.
|
|
17
|
+
*
|
|
18
|
+
* @param initialValue Optional initial value (defaults to all 3 testOptions).
|
|
14
19
|
*/
|
|
15
|
-
renderStateful?: () => void;
|
|
20
|
+
renderStateful?: (initialValue?: any[]) => void;
|
|
16
21
|
}
|
|
17
22
|
declare const _default: (renderOptions: CoreTestOptions) => void;
|
|
18
23
|
export default _default;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CommonRef, HasClassName, LumxClassName } from '../../types';
|
|
2
|
+
import type { ComboboxCallbacks } from './types';
|
|
2
3
|
/**
|
|
3
4
|
* Label display mode for the ComboboxButton.
|
|
4
5
|
* - `'show-selection'`: Show the selected value if available, otherwise the label.
|
|
@@ -9,7 +10,7 @@ export type ComboboxButtonLabelDisplayMode = 'show-selection' | 'show-label' | '
|
|
|
9
10
|
/**
|
|
10
11
|
* Defines the props for the core ComboboxButton template.
|
|
11
12
|
*/
|
|
12
|
-
export interface ComboboxButtonProps extends HasClassName {
|
|
13
|
+
export interface ComboboxButtonProps extends HasClassName, ComboboxCallbacks {
|
|
13
14
|
/** The label for the button (used for ARIA and tooltip). */
|
|
14
15
|
label: string;
|
|
15
16
|
/** The currently selected value to display. */
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { CommonRef, HasClassName, HasTheme, LumxClassName } from '../../types';
|
|
2
|
+
import type { ComboboxCallbacks, ComboboxInputOptions } from './types';
|
|
2
3
|
/**
|
|
3
4
|
* Defines the props for the core ComboboxInput template.
|
|
4
5
|
*/
|
|
5
|
-
export interface ComboboxInputProps extends HasClassName, HasTheme {
|
|
6
|
+
export interface ComboboxInputProps extends HasClassName, HasTheme, ComboboxCallbacks, ComboboxInputOptions {
|
|
6
7
|
/** The ID of the listbox element (for aria-controls). */
|
|
7
8
|
listboxId?: string;
|
|
8
9
|
/** Whether the combobox is open. */
|
|
@@ -17,12 +18,14 @@ export interface ComboboxInputProps extends HasClassName, HasTheme {
|
|
|
17
18
|
toggleButtonProps?: Record<string, any>;
|
|
18
19
|
/** Toggle callback for the chevron button. */
|
|
19
20
|
handleToggle?(): void;
|
|
20
|
-
/**
|
|
21
|
-
* Controls how the combobox filters options as the user types.
|
|
22
|
-
* When `'off'`, the input is rendered as `readOnly`.
|
|
23
|
-
*/
|
|
24
|
-
filter?: 'auto' | 'manual' | 'off';
|
|
25
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Props from the core `ComboboxInputProps` that framework wrappers (React/Vue)
|
|
24
|
+
* are expected to provide internally or re-type with framework-specific equivalents
|
|
25
|
+
* (e.g. React refs, framework-specific button props). Wrappers should omit these
|
|
26
|
+
* keys when exposing the core props to consumers.
|
|
27
|
+
*/
|
|
28
|
+
export type ComboboxInputPropsToOverride = 'listboxId' | 'isOpen' | 'inputRef' | 'textFieldRef' | 'toggleButtonProps' | 'handleToggle';
|
|
26
29
|
/**
|
|
27
30
|
* Injected framework-specific components for ComboboxInput rendering.
|
|
28
31
|
*/
|
|
@@ -1,23 +1,6 @@
|
|
|
1
|
-
import type { ComboboxCallbacks, ComboboxHandle } from './types';
|
|
1
|
+
import type { ComboboxCallbacks, ComboboxHandle, ComboboxInputOptions } from './types';
|
|
2
2
|
/** Options for configuring the input-mode combobox controller. */
|
|
3
|
-
export interface SetupComboboxInputOptions extends ComboboxCallbacks {
|
|
4
|
-
/**
|
|
5
|
-
* Controls how the combobox filters options as the user types.
|
|
6
|
-
*
|
|
7
|
-
* - `'auto'` (default) — Options are automatically filtered client-side.
|
|
8
|
-
* - `'manual'` — Filtering is the consumer's responsibility.
|
|
9
|
-
* - `'off'` — Like `'manual'`, and `openOnFocus` defaults to `true`.
|
|
10
|
-
* The core template renders the input as `readOnly`.
|
|
11
|
-
*/
|
|
12
|
-
filter?: 'auto' | 'manual' | 'off';
|
|
13
|
-
/**
|
|
14
|
-
* When true, the combobox opens automatically when the input receives focus.
|
|
15
|
-
* When false (default, unless `filter` is `'off'`), the combobox only opens
|
|
16
|
-
* on click, typing, or keyboard navigation.
|
|
17
|
-
*
|
|
18
|
-
* @default false (true when filter is 'off')
|
|
19
|
-
*/
|
|
20
|
-
openOnFocus?: boolean;
|
|
3
|
+
export interface SetupComboboxInputOptions extends ComboboxCallbacks, ComboboxInputOptions {
|
|
21
4
|
}
|
|
22
5
|
/**
|
|
23
6
|
* Set up a combobox with an input trigger (autocomplete/filter pattern).
|
|
@@ -41,10 +41,34 @@ export interface ComboboxEventMap {
|
|
|
41
41
|
}
|
|
42
42
|
/** Callbacks provided by the consumer (React/Vue) to react to combobox state changes. */
|
|
43
43
|
export interface ComboboxCallbacks {
|
|
44
|
-
/** Called when an option is selected (click or keyboard).
|
|
45
|
-
onSelect(option: {
|
|
44
|
+
/** Called when an option is selected (click or keyboard). */
|
|
45
|
+
onSelect?(option: {
|
|
46
46
|
value: string;
|
|
47
|
-
}
|
|
47
|
+
}): void;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Behavioral options for input-mode combobox (autocomplete/filter pattern).
|
|
51
|
+
* Shared between the core JSX template props (`ComboboxInputProps`) and the
|
|
52
|
+
* runtime controller options (`SetupComboboxInputOptions`).
|
|
53
|
+
*/
|
|
54
|
+
export interface ComboboxInputOptions {
|
|
55
|
+
/**
|
|
56
|
+
* Controls how the combobox filters options as the user types.
|
|
57
|
+
*
|
|
58
|
+
* - `'auto'` (default) — Options are automatically filtered client-side.
|
|
59
|
+
* - `'manual'` — Filtering is the consumer's responsibility.
|
|
60
|
+
* - `'off'` — Like `'manual'`, but the input is rendered as `readOnly`
|
|
61
|
+
* and `openOnFocus` defaults to `true`.
|
|
62
|
+
*/
|
|
63
|
+
filter?: 'auto' | 'manual' | 'off';
|
|
64
|
+
/**
|
|
65
|
+
* When true, the combobox opens automatically when the input receives focus.
|
|
66
|
+
* When false (default, unless `filter` is `'off'`), the combobox only opens
|
|
67
|
+
* on click, typing, or keyboard navigation.
|
|
68
|
+
*
|
|
69
|
+
* @default false (true when filter is 'off')
|
|
70
|
+
*/
|
|
71
|
+
openOnFocus?: boolean;
|
|
48
72
|
}
|
|
49
73
|
/** Handle returned by `setupCombobox`. Used by framework wrappers and mode controllers. */
|
|
50
74
|
export interface ComboboxHandle {
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
/** CSS selector listing all tabbable elements. */
|
|
2
2
|
export declare const TABBABLE_ELEMENTS_SELECTOR = "a[href], button, textarea, input:not([type=\"hidden\"]):not([hidden]), [tabindex]";
|
|
3
|
-
/**
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* CSS selector matching elements that should be excluded from focus traversal.
|
|
5
|
+
*
|
|
6
|
+
* Note: `aria-disabled` is intentionally NOT in this list — per ARIA semantics, an `aria-disabled` element
|
|
7
|
+
* remains focusable (and discoverable by assistive tech). To remove an element from the tab order, use
|
|
8
|
+
* `tabindex="-1"` instead.
|
|
9
|
+
*/
|
|
10
|
+
export declare const DISABLED_SELECTOR = "[hidden], [tabindex=\"-1\"], [disabled]:not([disabled=\"false\"])";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { getFirstAndLastFocusable } from './getFirstAndLastFocusable';
|
|
2
2
|
export { getFocusableElements } from './getFocusableElements';
|
|
3
|
+
export { setupFocusTrap, type SetupFocusTrapOptions } from './setupFocusTrap';
|
|
3
4
|
export { TABBABLE_ELEMENTS_SELECTOR, DISABLED_SELECTOR } from './constants';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface SetupFocusTrapOptions {
|
|
2
|
+
/** The element in which to trap the focus. */
|
|
3
|
+
focusZoneElement: HTMLElement;
|
|
4
|
+
/**
|
|
5
|
+
* The element to focus when the trap is activated.
|
|
6
|
+
* Falls back to the first focusable element inside the zone, then to the zone element itself.
|
|
7
|
+
*/
|
|
8
|
+
focusElement?: HTMLElement | null;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Trap 'Tab' focus switch inside the `focusZoneElement`.
|
|
12
|
+
*
|
|
13
|
+
* Setup behavior:
|
|
14
|
+
* 1. Focus `focusElement` if provided and contained in the zone.
|
|
15
|
+
* 2. Otherwise focus the first focusable descendant.
|
|
16
|
+
* 3. Otherwise focus the zone element itself (falling back to setting `tabindex="-1"` if needed) so that
|
|
17
|
+
* keyboard users (especially screen reader users) land inside the trapped region (e.g. an empty dialog).
|
|
18
|
+
*
|
|
19
|
+
* Tab key behavior:
|
|
20
|
+
* - With at least one focusable descendant: focus cycles between the first and last focusable in the zone.
|
|
21
|
+
* - With no focusable descendant: Tab is swallowed and focus is restored to the zone element itself.
|
|
22
|
+
*
|
|
23
|
+
* Multiple traps stack — only the latest one is active; previous traps re-enable when the latest is torn down.
|
|
24
|
+
*
|
|
25
|
+
* @param options Trap configuration.
|
|
26
|
+
* @param signal AbortSignal used to tear down the trap.
|
|
27
|
+
*/
|
|
28
|
+
export declare function setupFocusTrap(options: SetupFocusTrapOptions, signal: AbortSignal): void;
|
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.12.0",
|
|
10
|
+
"@lumx/icons": "^4.12.1-alpha.0",
|
|
11
11
|
"classnames": "^2.3.2",
|
|
12
12
|
"focus-visible": "^5.0.2",
|
|
13
13
|
"lodash": "4.18.1",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"update-version-changelog": "yarn version-changelog ../../CHANGELOG.md"
|
|
70
70
|
},
|
|
71
71
|
"sideEffects": false,
|
|
72
|
-
"version": "4.12.0",
|
|
72
|
+
"version": "4.12.1-alpha.0",
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
75
75
|
"@testing-library/dom": "^10.4.1",
|
|
@@ -92,5 +92,6 @@
|
|
|
92
92
|
"vite": "^7.3.2",
|
|
93
93
|
"vite-tsconfig-paths": "^5.1.4",
|
|
94
94
|
"vitest": "^4.0.18"
|
|
95
|
-
}
|
|
95
|
+
},
|
|
96
|
+
"stableVersion": "4.12.0"
|
|
96
97
|
}
|