@lumx/core 4.9.0-next.8 → 4.9.0-next.9
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 +1 -1
- package/js/components/Combobox/ComboboxInput.d.ts +2 -2
- package/js/components/Combobox/ComboboxOption.d.ts +3 -1
- package/js/components/Combobox/ComboboxOptionMoreInfo.d.ts +2 -0
- package/js/components/Combobox/ComboboxSection.d.ts +2 -2
- package/js/components/Combobox/ComboboxState.d.ts +6 -0
- package/js/components/Combobox/index.d.ts +2 -0
- package/js/components/Combobox/setupCombobox.d.ts +1 -1
- package/js/components/Combobox/setupComboboxInput.d.ts +4 -5
- package/js/components/Combobox/subscribeComboboxState.d.ts +23 -0
- package/js/components/Combobox/types.d.ts +2 -2
- package/lumx.css +1 -1
- package/package.json +2 -2
- package/scss/components/list/_mixins.scss +6 -4
package/components-and-utils.css
CHANGED
|
@@ -8233,7 +8233,7 @@ table {
|
|
|
8233
8233
|
|
|
8234
8234
|
/* Section
|
|
8235
8235
|
========================================================================== */
|
|
8236
|
-
.lumx-list-section:not(
|
|
8236
|
+
.lumx-list-section:not([hidden]) ~ .lumx-list-section:not(.lumx-list-section:not([hidden]) + .lumx-list-section):not(.lumx-list-divider + .lumx-list-section)::before {
|
|
8237
8237
|
content: "";
|
|
8238
8238
|
display: block;
|
|
8239
8239
|
height: 1px;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { CommonRef, HasClassName, LumxClassName } from '../../types';
|
|
1
|
+
import type { CommonRef, HasClassName, HasTheme, LumxClassName } from '../../types';
|
|
2
2
|
/**
|
|
3
3
|
* Defines the props for the core ComboboxInput template.
|
|
4
4
|
*/
|
|
5
|
-
export interface ComboboxInputProps extends HasClassName {
|
|
5
|
+
export interface ComboboxInputProps extends HasClassName, HasTheme {
|
|
6
6
|
/** The ID of the listbox element (for aria-controls). */
|
|
7
7
|
listboxId?: string;
|
|
8
8
|
/** Whether the combobox is open. */
|
|
@@ -41,6 +41,8 @@ export interface ComboboxOptionProps extends HasClassName {
|
|
|
41
41
|
hidden?: boolean;
|
|
42
42
|
/** On click callback. */
|
|
43
43
|
handleClick?(): void;
|
|
44
|
+
/** Extra props forwarded to the inner action element (e.g. link props when as="a"). */
|
|
45
|
+
actionProps?: Record<string, any>;
|
|
44
46
|
/** ref to the root <li> element. */
|
|
45
47
|
ref?: CommonRef;
|
|
46
48
|
/** The value for this option (used for selection). */
|
|
@@ -50,7 +52,7 @@ export interface ComboboxOptionProps extends HasClassName {
|
|
|
50
52
|
* Props that React/Vue wrappers need to re-declare with framework-specific types.
|
|
51
53
|
* Used by `ReactToJSX<ComboboxOptionProps, ComboboxOptionPropsToOverride>`.
|
|
52
54
|
*/
|
|
53
|
-
export type ComboboxOptionPropsToOverride = 'before' | 'after' | 'children' | 'tooltipProps';
|
|
55
|
+
export type ComboboxOptionPropsToOverride = 'before' | 'after' | 'children' | 'tooltipProps' | 'actionProps';
|
|
54
56
|
/**
|
|
55
57
|
* Component display name.
|
|
56
58
|
*/
|
|
@@ -15,6 +15,8 @@ export interface ComboboxOptionMoreInfoProps extends HasClassName {
|
|
|
15
15
|
onMouseEnter?(): void;
|
|
16
16
|
/** Mouse leave callback. */
|
|
17
17
|
onMouseLeave?(): void;
|
|
18
|
+
/** Props forwarded to the IconButton. */
|
|
19
|
+
buttonProps?: Record<string, any>;
|
|
18
20
|
}
|
|
19
21
|
/**
|
|
20
22
|
* Props that React/Vue wrappers need to re-declare with framework-specific types.
|
|
@@ -3,8 +3,8 @@ import type { CommonRef, HasClassName, JSXElement, LumxClassName } from '../../t
|
|
|
3
3
|
* Defines the props for the core ComboboxSection template.
|
|
4
4
|
*/
|
|
5
5
|
export interface ComboboxSectionProps extends HasClassName {
|
|
6
|
-
/** Section label displayed as the group title. */
|
|
7
|
-
label?: string;
|
|
6
|
+
/** Section label displayed as the group title. Accepts a plain string or custom JSX content. */
|
|
7
|
+
label?: string | JSXElement;
|
|
8
8
|
/** Section icon */
|
|
9
9
|
icon?: string;
|
|
10
10
|
/** Section content (should be ComboboxOption elements). */
|
|
@@ -53,6 +53,12 @@ export interface ComboboxStateProps {
|
|
|
53
53
|
* Used to suppress false "empty" state while data is loading.
|
|
54
54
|
*/
|
|
55
55
|
isLoading?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Whether the combobox popover is open.
|
|
58
|
+
* Used to gate live region content so screen readers announce messages
|
|
59
|
+
* when the popover opens (content insertion triggers `aria-live` announcement).
|
|
60
|
+
*/
|
|
61
|
+
isOpen?: boolean;
|
|
56
62
|
};
|
|
57
63
|
}
|
|
58
64
|
/**
|
|
@@ -21,3 +21,5 @@ export { ComboboxSection } from './ComboboxSection';
|
|
|
21
21
|
export type { ComboboxSectionProps, ComboboxSectionPropsToOverride, ComboboxSectionComponents, } from './ComboboxSection';
|
|
22
22
|
export { ComboboxState } from './ComboboxState';
|
|
23
23
|
export type { ComboboxStateProps } from './ComboboxState';
|
|
24
|
+
export { subscribeComboboxState } from './subscribeComboboxState';
|
|
25
|
+
export type { ComboboxStateSetters } from './subscribeComboboxState';
|
|
@@ -13,7 +13,7 @@ interface ComboboxOptions {
|
|
|
13
13
|
*
|
|
14
14
|
* @see https://www.w3.org/WAI/ARIA/apg/patterns/combobox/
|
|
15
15
|
*
|
|
16
|
-
* @param callbacks Callbacks
|
|
16
|
+
* @param callbacks Callbacks invoked on combobox events (e.g. option selection).
|
|
17
17
|
* @param options Options for configuring the shared combobox behavior.
|
|
18
18
|
* @param onTriggerAttach Optional callback invoked when the trigger is registered and the signal is ready.
|
|
19
19
|
* Used by mode-specific wrappers (setupComboboxInput/Button) to automatically
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ComboboxCallbacks, ComboboxHandle } from './types';
|
|
2
2
|
/** Options for configuring the input-mode combobox controller. */
|
|
3
|
-
export interface SetupComboboxInputOptions {
|
|
3
|
+
export interface SetupComboboxInputOptions extends ComboboxCallbacks {
|
|
4
4
|
/**
|
|
5
5
|
* When true (default), the combobox automatically filters options as the user types.
|
|
6
6
|
* Each registered `Combobox.Option` receives filter state updates and hides itself
|
|
@@ -21,9 +21,8 @@ export interface SetupComboboxInputOptions {
|
|
|
21
21
|
* Handles: Home/End (text cursor), ArrowLeft/Right (clear active descendant),
|
|
22
22
|
* filtering (on input and on open), and focus behavior.
|
|
23
23
|
*
|
|
24
|
-
* @param input
|
|
25
|
-
* @param callbacks
|
|
26
|
-
* @param options Options for configuring the input-mode controller.
|
|
24
|
+
* @param input The input element to use as the combobox trigger.
|
|
25
|
+
* @param options Options and callbacks for configuring the input-mode controller.
|
|
27
26
|
* @returns A ComboboxHandle for interacting with the combobox.
|
|
28
27
|
*/
|
|
29
|
-
export declare function setupComboboxInput(input: HTMLInputElement,
|
|
28
|
+
export declare function setupComboboxInput(input: HTMLInputElement, options: SetupComboboxInputOptions): ComboboxHandle;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ComboboxHandle } from './types';
|
|
2
|
+
/** Setters invoked by `subscribeComboboxState` when handle events fire. */
|
|
3
|
+
export interface ComboboxStateSetters {
|
|
4
|
+
/** Called immediately with the current loading state, then on every `loadingChange` event. */
|
|
5
|
+
setIsLoading: (value: boolean) => void;
|
|
6
|
+
/** Called on every `loadingAnnouncement` event (debounced 500ms after skeletons mount). */
|
|
7
|
+
setShouldAnnounce: (value: boolean) => void;
|
|
8
|
+
/** Called with `true` after a short delay when the combobox opens, and `false` immediately on close. */
|
|
9
|
+
setIsOpen: (value: boolean) => void;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Subscribe to the combobox handle events needed by `ComboboxState`.
|
|
13
|
+
*
|
|
14
|
+
* Manages three subscriptions:
|
|
15
|
+
* - `loadingChange` → `setIsLoading` (+ synchronous initial read of `handle.isLoading`)
|
|
16
|
+
* - `loadingAnnouncement` → `setShouldAnnounce`
|
|
17
|
+
* - `open` → `setIsOpen` (deferred by {@link OPEN_ANNOUNCEMENT_DELAY}ms on open, immediate on close)
|
|
18
|
+
*
|
|
19
|
+
* @param handle The combobox handle to subscribe to.
|
|
20
|
+
* @param setters Framework-specific state setters.
|
|
21
|
+
* @returns A cleanup function that unsubscribes all events and clears timers.
|
|
22
|
+
*/
|
|
23
|
+
export declare function subscribeComboboxState(handle: ComboboxHandle, setters: ComboboxStateSetters): () => void;
|
|
@@ -41,10 +41,10 @@ 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). */
|
|
44
|
+
/** Called when an option is selected (click or keyboard). Receives the combobox handle for post-selection side effects. */
|
|
45
45
|
onSelect(option: {
|
|
46
46
|
value: string;
|
|
47
|
-
}): void;
|
|
47
|
+
}, handle: ComboboxHandle): void;
|
|
48
48
|
}
|
|
49
49
|
/** Handle returned by `setupCombobox`. Used by framework wrappers and mode controllers. */
|
|
50
50
|
export interface ComboboxHandle {
|
package/lumx.css
CHANGED
|
@@ -8914,7 +8914,7 @@ table {
|
|
|
8914
8914
|
|
|
8915
8915
|
/* Section
|
|
8916
8916
|
========================================================================== */
|
|
8917
|
-
.lumx-list-section:not(
|
|
8917
|
+
.lumx-list-section:not([hidden]) ~ .lumx-list-section:not(.lumx-list-section:not([hidden]) + .lumx-list-section):not(.lumx-list-divider + .lumx-list-section)::before {
|
|
8918
8918
|
content: "";
|
|
8919
8919
|
display: block;
|
|
8920
8920
|
height: 1px;
|
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.9.0-next.
|
|
10
|
+
"@lumx/icons": "^4.9.0-next.9",
|
|
11
11
|
"classnames": "^2.3.2",
|
|
12
12
|
"focus-visible": "^5.0.2",
|
|
13
13
|
"lodash": "4.17.23",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"update-version-changelog": "yarn version-changelog ../../CHANGELOG.md"
|
|
70
70
|
},
|
|
71
71
|
"sideEffects": false,
|
|
72
|
-
"version": "4.9.0-next.
|
|
72
|
+
"version": "4.9.0-next.9",
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
75
75
|
"@testing-library/dom": "^10.4.1",
|
|
@@ -144,10 +144,12 @@
|
|
|
144
144
|
$divider: '.#{$lumx-base-prefix}-list-divider';
|
|
145
145
|
$section: &;
|
|
146
146
|
|
|
147
|
-
// Insert a divider before each section
|
|
148
|
-
//
|
|
149
|
-
//
|
|
150
|
-
|
|
147
|
+
// Insert a divider before each section that:
|
|
148
|
+
// 1. Is not directly following another visible section (avoids double dividers)
|
|
149
|
+
// 2. Is not directly following an explicit divider
|
|
150
|
+
// 3. Has at least one preceding visible section (uses `~` general sibling combinator
|
|
151
|
+
// so hidden-first-sections don't get a spurious top divider)
|
|
152
|
+
#{$section}:not([hidden]) ~ &:not(#{$section}:not([hidden]) + &):not(#{$divider} + &) {
|
|
151
153
|
&::before {
|
|
152
154
|
content: '';
|
|
153
155
|
display: block;
|