@lumx/core 4.27.1-alpha.2 → 4.27.1-alpha.3
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 +3 -3
- package/js/components/Combobox/Tests.d.ts +4 -0
- package/js/components/Combobox/types.d.ts +1 -1
- package/js/components/TreeList/Stories.d.ts +11 -1
- package/js/components/TreeList/Tests.d.ts +3 -1
- package/js/components/TreeList/TreeList.d.ts +1 -1
- package/js/components/TreeList/TreeListItem.d.ts +1 -1
- package/js/components/TreeList/TreeListSection.d.ts +52 -0
- package/js/components/TreeList/index.d.ts +3 -1
- package/js/components/TreeList/types.d.ts +10 -0
- package/lumx.css +3 -3
- package/package.json +3 -4
- package/scss/components/list/_mixins.scss +4 -3
- package/scss/components/tree-list/_index.scss +8 -7
package/components-and-utils.css
CHANGED
|
@@ -8340,7 +8340,7 @@ table {
|
|
|
8340
8340
|
|
|
8341
8341
|
/* Section
|
|
8342
8342
|
========================================================================== */
|
|
8343
|
-
.lumx-list-
|
|
8343
|
+
:not(.lumx-list-divider, [hidden], :empty) ~ .lumx-list-section:not(.lumx-list-section:not([hidden]) + .lumx-list-section):not(.lumx-list-divider + .lumx-list-section)::before {
|
|
8344
8344
|
content: "";
|
|
8345
8345
|
display: block;
|
|
8346
8346
|
height: 1px;
|
|
@@ -12373,7 +12373,7 @@ table {
|
|
|
12373
12373
|
.lumx-tree-list-item__group {
|
|
12374
12374
|
interpolate-size: allow-keywords;
|
|
12375
12375
|
overflow-y: clip;
|
|
12376
|
-
transition: height 400ms, visibility 400ms;
|
|
12376
|
+
transition: height 400ms, content-visibility 400ms allow-discrete;
|
|
12377
12377
|
}
|
|
12378
12378
|
@media (prefers-reduced-motion: reduce) {
|
|
12379
12379
|
.lumx-tree-list-item__group {
|
|
@@ -12383,7 +12383,7 @@ table {
|
|
|
12383
12383
|
.lumx-tree-list-item__group[hidden] {
|
|
12384
12384
|
display: block;
|
|
12385
12385
|
height: 0;
|
|
12386
|
-
visibility: hidden;
|
|
12386
|
+
content-visibility: hidden;
|
|
12387
12387
|
}
|
|
12388
12388
|
}
|
|
12389
12389
|
|
|
@@ -52,6 +52,10 @@ export declare function createTemplates(Combobox: ComboboxNamespace, IconButton:
|
|
|
52
52
|
onChange: (v: string) => void;
|
|
53
53
|
onOpen?: (isOpen: boolean) => void;
|
|
54
54
|
}) => import("react").JSX.Element;
|
|
55
|
+
autoFilterListChangeTemplate: ({ value, onChange }: {
|
|
56
|
+
value: string;
|
|
57
|
+
onChange: (v: string) => void;
|
|
58
|
+
}) => import("react").JSX.Element;
|
|
55
59
|
inlineTemplate: ({ value, onChange, onSelect, alwaysOpen, }: {
|
|
56
60
|
value: string;
|
|
57
61
|
onChange: (v: string) => void;
|
|
@@ -18,7 +18,7 @@ export interface ComboboxInputOptions {
|
|
|
18
18
|
* - `'auto'` (default) — Options are automatically filtered client-side.
|
|
19
19
|
* - `'manual'` — Filtering is the consumer's responsibility. The list still gets the filter text
|
|
20
20
|
* (a tree list opens its parent items with rendered sub-items while the text is not empty).
|
|
21
|
-
* - `'off'` — Like `'manual'`, but the input is rendered as `readOnly`
|
|
21
|
+
* - `'off'` — Like `'manual'`, but the list gets no filter text, the input is rendered as `readOnly`
|
|
22
22
|
* and `openOnFocus` defaults to `true`.
|
|
23
23
|
*/
|
|
24
24
|
filter?: 'auto' | 'manual' | 'off';
|
|
@@ -4,7 +4,7 @@ import type { TreeListComponents } from './Tests';
|
|
|
4
4
|
* Setup the TreeList demo stories for a specific framework (React or Vue): a standalone tree, or a tree in a
|
|
5
5
|
* combobox. Framework-specific components and decorators are injected via options.
|
|
6
6
|
*/
|
|
7
|
-
export declare function setup({ components: { TreeList, TreeListItem, Combobox }, decorators: { withValueOnChange }, }: SetupStoriesOptions<{
|
|
7
|
+
export declare function setup({ components: { TreeList, TreeListItem, TreeListSection, Combobox }, decorators: { withValueOnChange }, }: SetupStoriesOptions<{
|
|
8
8
|
components: TreeListComponents;
|
|
9
9
|
decorators: 'withValueOnChange';
|
|
10
10
|
}>): {
|
|
@@ -69,4 +69,14 @@ export declare function setup({ components: { TreeList, TreeListItem, Combobox }
|
|
|
69
69
|
decorators: ((story: any, context: any) => any)[];
|
|
70
70
|
render: ({ snacks, onSnacksChange }: any) => import("react").JSX.Element;
|
|
71
71
|
};
|
|
72
|
+
WithSections: {
|
|
73
|
+
args: {
|
|
74
|
+
value: {
|
|
75
|
+
text: string;
|
|
76
|
+
selected: string;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
decorators: ((story: any, context: any) => any)[];
|
|
80
|
+
render: ({ value, onUpdate }: any) => import("react").JSX.Element;
|
|
81
|
+
};
|
|
72
82
|
};
|
|
@@ -14,6 +14,7 @@ export interface TreeListComponents {
|
|
|
14
14
|
/** The tree (standalone, or in a combobox). */
|
|
15
15
|
TreeList: any;
|
|
16
16
|
TreeListItem: any;
|
|
17
|
+
TreeListSection: any;
|
|
17
18
|
Combobox: TreeListComboboxNamespace;
|
|
18
19
|
}
|
|
19
20
|
type RenderResult = {
|
|
@@ -39,11 +40,12 @@ export interface TreeListTestSetup {
|
|
|
39
40
|
* Create framework-agnostic JSX templates for the tree tests (the reference tree of the spec).
|
|
40
41
|
* Exported so the test stories can reuse the same tree.
|
|
41
42
|
*/
|
|
42
|
-
export declare function createTreeTemplates({ TreeList, TreeListItem, Combobox }: TreeListComponents): {
|
|
43
|
+
export declare function createTreeTemplates({ TreeList, TreeListItem, TreeListSection, Combobox }: TreeListComponents): {
|
|
43
44
|
inputTemplate: ({ value, onUpdate, onSelect, treeOnSelect, filter, selectionType, onOpenChange, onClick, nbOptionMessage, withoutState, snacks, }: any) => import("react").JSX.Element;
|
|
44
45
|
buttonTemplate: ({ value, onSelect, onOpenChange }: any) => import("react").JSX.Element;
|
|
45
46
|
lazyTemplate: ({ value, onChange, onOpenChange, load }: any) => import("react").JSX.Element;
|
|
46
47
|
standaloneTemplate: ({ value, onUpdate, onSelect, onOpenChange, onClick, selectionType }: any) => import("react").JSX.Element;
|
|
48
|
+
sectionTemplate: ({ value, onChange }: any) => import("react").JSX.Element;
|
|
47
49
|
};
|
|
48
50
|
export default function treeListTests({ components, renderWithState }: TreeListTestSetup): void;
|
|
49
51
|
export {};
|
|
@@ -17,7 +17,7 @@ export interface TreeListProps extends HasClassName {
|
|
|
17
17
|
* Selection type: one selected tree item, or several (`aria-multiselectable`).
|
|
18
18
|
*/
|
|
19
19
|
selectionType?: TreeListSelectionType;
|
|
20
|
-
/** Content (`TreeListItem
|
|
20
|
+
/** Content (`TreeListItem` or `ListboxOptionSkeleton` elements). Render the states outside the tree. */
|
|
21
21
|
children?: JSXElement;
|
|
22
22
|
/** The ID of the tree element. */
|
|
23
23
|
id?: string;
|
|
@@ -12,7 +12,7 @@ export interface TreeListItemComponents {
|
|
|
12
12
|
export interface TreeListItemProps extends HasClassName {
|
|
13
13
|
/** Content of the row (the tree item label). */
|
|
14
14
|
label?: JSXElement;
|
|
15
|
-
/** The sub-items (`TreeListItem
|
|
15
|
+
/** The sub-items (`TreeListItem` or `ListboxOptionSkeleton` elements). */
|
|
16
16
|
children?: JSXElement;
|
|
17
17
|
/** A component to be rendered before the label (e.g. an icon or avatar). */
|
|
18
18
|
before?: JSXElement;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { CommonRef, HasClassName, JSXElement, LumxClassName } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Defines the props for the core TreeListSection template.
|
|
4
|
+
*/
|
|
5
|
+
export interface TreeListSectionProps extends HasClassName {
|
|
6
|
+
/** Section label, shown as the section title (visual only). Without a label, the section is a plain group. */
|
|
7
|
+
label?: string | JSXElement;
|
|
8
|
+
/** Section icon (shown before the label). */
|
|
9
|
+
icon?: string;
|
|
10
|
+
/** Section content (`TreeListItem` elements). */
|
|
11
|
+
children?: JSXElement;
|
|
12
|
+
/** Whether the filter hides every tree item of the section (internal). */
|
|
13
|
+
hidden?: boolean;
|
|
14
|
+
/** ref to the root `<li>` element. */
|
|
15
|
+
ref?: CommonRef;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Props that React/Vue wrappers need to re-declare with framework-specific types.
|
|
19
|
+
*/
|
|
20
|
+
export type TreeListSectionPropsToOverride = 'label' | 'children';
|
|
21
|
+
/**
|
|
22
|
+
* Injected framework-specific components for TreeListSection rendering.
|
|
23
|
+
*/
|
|
24
|
+
export interface TreeListSectionComponents {
|
|
25
|
+
/** ListSection component (framework-specific). */
|
|
26
|
+
ListSection: any;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Component display name.
|
|
30
|
+
*/
|
|
31
|
+
export declare const COMPONENT_NAME = "TreeListSection";
|
|
32
|
+
/**
|
|
33
|
+
* Component default class name and class prefix.
|
|
34
|
+
*/
|
|
35
|
+
export declare const CLASSNAME: LumxClassName<typeof COMPONENT_NAME>;
|
|
36
|
+
/**
|
|
37
|
+
* TreeListSection core template: a section of root tree items in a `TreeList`, with an optional label. The
|
|
38
|
+
* list sections get a divider between them (and between them and the standalone tree items).
|
|
39
|
+
*
|
|
40
|
+
* The section has no ARIA semantics (`role="none"` on the `<li>` and on the `<ul>`): in a tree, a
|
|
41
|
+
* `role="group"` is the group of sub-items of a tree item, and it changes the level of its tree items. The
|
|
42
|
+
* tree items of a section stay root tree items (`aria-level` 1).
|
|
43
|
+
*
|
|
44
|
+
* @param props Component props.
|
|
45
|
+
* @param components Injected framework-specific components.
|
|
46
|
+
* @return JSX element.
|
|
47
|
+
*/
|
|
48
|
+
export declare const TreeListSection: {
|
|
49
|
+
(props: TreeListSectionProps, { ListSection }: TreeListSectionComponents): import("react").JSX.Element;
|
|
50
|
+
displayName: string;
|
|
51
|
+
className: "lumx-tree-list-section";
|
|
52
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { setupTreeList } from './setupTreeList';
|
|
2
|
-
export type { TreeListHandle, TreeListOptions, TreeListItemController, TreeListItemOptions, TreeListItemState, } from './types';
|
|
2
|
+
export type { TreeListHandle, TreeListOptions, TreeListItemController, TreeListItemOptions, TreeListItemState, TreeListSectionState, } from './types';
|
|
3
3
|
export { isTreeListHandle } from './utils';
|
|
4
4
|
export { isTreeValueSelected, toggleTreeValue } from './selection';
|
|
5
5
|
export type { TreeListSelectionType } from './selection';
|
|
@@ -7,3 +7,5 @@ export { TreeList } from './TreeList';
|
|
|
7
7
|
export type { TreeListProps } from './TreeList';
|
|
8
8
|
export { TreeListItem } from './TreeListItem';
|
|
9
9
|
export type { TreeListItemProps, TreeListItemPropsToOverride, TreeListItemComponents } from './TreeListItem';
|
|
10
|
+
export { TreeListSection } from './TreeListSection';
|
|
11
|
+
export type { TreeListSectionProps, TreeListSectionPropsToOverride, TreeListSectionComponents, } from './TreeListSection';
|
|
@@ -20,6 +20,11 @@ export interface TreeListItemOptions {
|
|
|
20
20
|
/** Called when the state changes. */
|
|
21
21
|
onChange(state: TreeListItemState): void;
|
|
22
22
|
}
|
|
23
|
+
/** State of a section, rendered by the section components. */
|
|
24
|
+
export interface TreeListSectionState {
|
|
25
|
+
/** Whether the filter hides every tree item of the section (a section with no tree item stays visible). */
|
|
26
|
+
hidden: boolean;
|
|
27
|
+
}
|
|
23
28
|
/** Controller of a registered tree item (see {@link TreeListHandle.registerTreeItem}). */
|
|
24
29
|
export interface TreeListItemController {
|
|
25
30
|
/** The current state. */
|
|
@@ -52,4 +57,9 @@ export interface TreeListHandle extends CompositeHandle {
|
|
|
52
57
|
* The registry also sets `aria-busy` on the group while it holds only skeletons.
|
|
53
58
|
*/
|
|
54
59
|
registerTreeItem(element: HTMLElement, options: TreeListItemOptions): TreeListItemController;
|
|
60
|
+
/**
|
|
61
|
+
* Register a section root `<li>` element (what the React and Vue section components do on mount). `onChange`
|
|
62
|
+
* is called at once with the current state, then on each change. Returns the function that unregisters it.
|
|
63
|
+
*/
|
|
64
|
+
registerSection(element: HTMLElement, onChange: (state: TreeListSectionState) => void): () => void;
|
|
55
65
|
}
|
package/lumx.css
CHANGED
|
@@ -9021,7 +9021,7 @@ table {
|
|
|
9021
9021
|
|
|
9022
9022
|
/* Section
|
|
9023
9023
|
========================================================================== */
|
|
9024
|
-
.lumx-list-
|
|
9024
|
+
:not(.lumx-list-divider, [hidden], :empty) ~ .lumx-list-section:not(.lumx-list-section:not([hidden]) + .lumx-list-section):not(.lumx-list-divider + .lumx-list-section)::before {
|
|
9025
9025
|
content: "";
|
|
9026
9026
|
display: block;
|
|
9027
9027
|
height: 1px;
|
|
@@ -13054,7 +13054,7 @@ table {
|
|
|
13054
13054
|
.lumx-tree-list-item__group {
|
|
13055
13055
|
interpolate-size: allow-keywords;
|
|
13056
13056
|
overflow-y: clip;
|
|
13057
|
-
transition: height 400ms, visibility 400ms;
|
|
13057
|
+
transition: height 400ms, content-visibility 400ms allow-discrete;
|
|
13058
13058
|
}
|
|
13059
13059
|
@media (prefers-reduced-motion: reduce) {
|
|
13060
13060
|
.lumx-tree-list-item__group {
|
|
@@ -13064,7 +13064,7 @@ table {
|
|
|
13064
13064
|
.lumx-tree-list-item__group[hidden] {
|
|
13065
13065
|
display: block;
|
|
13066
13066
|
height: 0;
|
|
13067
|
-
visibility: hidden;
|
|
13067
|
+
content-visibility: hidden;
|
|
13068
13068
|
}
|
|
13069
13069
|
}
|
|
13070
13070
|
|
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.
|
|
10
|
+
"@lumx/icons": "^4.27.1-alpha.3",
|
|
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.
|
|
69
|
+
"version": "4.27.1-alpha.3",
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
72
72
|
"@testing-library/dom": "^10.4.1",
|
|
@@ -89,6 +89,5 @@
|
|
|
89
89
|
"vite": "^7.3.7",
|
|
90
90
|
"vite-tsconfig-paths": "^5.1.4",
|
|
91
91
|
"vitest": "^4.1.11"
|
|
92
|
-
}
|
|
93
|
-
"stableVersion": "4.27.0"
|
|
92
|
+
}
|
|
94
93
|
}
|
|
@@ -148,9 +148,10 @@
|
|
|
148
148
|
// Insert a divider before each section that:
|
|
149
149
|
// 1. Is not directly following another visible section (avoids double dividers)
|
|
150
150
|
// 2. Is not directly following an explicit divider
|
|
151
|
-
// 3. Has
|
|
152
|
-
//
|
|
153
|
-
|
|
151
|
+
// 3. Has visible content before it: a preceding sibling that is not an explicit divider, hidden or
|
|
152
|
+
// empty (uses `~` general sibling combinator so that a section with only hidden content before it
|
|
153
|
+
// does not get a top divider)
|
|
154
|
+
:not(#{$divider}, [hidden], :empty) ~ &:not(#{$section}:not([hidden]) + &):not(#{$divider} + &) {
|
|
154
155
|
&::before {
|
|
155
156
|
content: '';
|
|
156
157
|
display: block;
|
|
@@ -13,7 +13,7 @@ $lumx-tree-list-indent: calc(var(--lumx-tree-list-level, 0) * #{$lumx-spacing-un
|
|
|
13
13
|
$lumx-tree-list-toggle-size: calc(var(--lumx-button-height) / 1.5);
|
|
14
14
|
|
|
15
15
|
// Duration of the group open and close animation (the same as the expansion panel).
|
|
16
|
-
$lumx-tree-list-transition-duration:
|
|
16
|
+
$lumx-tree-list-transition-duration: $lumx-expansion-panel-transition-duration;
|
|
17
17
|
|
|
18
18
|
// ---- Tree -----------------------
|
|
19
19
|
|
|
@@ -102,7 +102,7 @@ $lumx-tree-list-transition-duration: 400ms;
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
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).
|
|
105
|
+
// not select it). The tree list has no theme: the light theme colors.
|
|
106
106
|
&__row:has(&__action--passive[data-focus-visible-added]) &__toggle--main {
|
|
107
107
|
color: var(--lumx-button-emphasis-low-state-hover-theme-light-color);
|
|
108
108
|
background-color: var(--lumx-button-emphasis-low-state-hover-theme-light-background-color);
|
|
@@ -114,21 +114,22 @@ $lumx-tree-list-transition-duration: 400ms;
|
|
|
114
114
|
margin: 0;
|
|
115
115
|
list-style: none;
|
|
116
116
|
|
|
117
|
-
// Skeletons
|
|
117
|
+
// Skeletons: a margin (they have no full width background)
|
|
118
118
|
> :not(.#{$lumx-base-prefix}-tree-list-item) {
|
|
119
119
|
margin-left: $lumx-tree-list-indent;
|
|
120
120
|
}
|
|
121
121
|
|
|
122
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
|
|
124
|
-
// the end of the close), so that it can
|
|
123
|
+
// a closed group (`hidden`) stays in the layout with no height, and its content is skipped
|
|
124
|
+
// (`content-visibility: hidden`: no layout and no paint; it changes at the end of the close), so that it can
|
|
125
|
+
// animate. Elsewhere, a closed group has `display: none`.
|
|
125
126
|
@supports (interpolate-size: allow-keywords) {
|
|
126
127
|
// stylelint-disable-next-line property-no-unknown -- (not in the stylelint 14 property list yet)
|
|
127
128
|
interpolate-size: allow-keywords;
|
|
128
129
|
overflow-y: clip;
|
|
129
130
|
transition:
|
|
130
131
|
height $lumx-tree-list-transition-duration,
|
|
131
|
-
visibility $lumx-tree-list-transition-duration;
|
|
132
|
+
content-visibility $lumx-tree-list-transition-duration allow-discrete;
|
|
132
133
|
|
|
133
134
|
@media (prefers-reduced-motion: reduce) {
|
|
134
135
|
transition: none;
|
|
@@ -137,7 +138,7 @@ $lumx-tree-list-transition-duration: 400ms;
|
|
|
137
138
|
&[hidden] {
|
|
138
139
|
display: block;
|
|
139
140
|
height: 0;
|
|
140
|
-
visibility: hidden;
|
|
141
|
+
content-visibility: hidden;
|
|
141
142
|
}
|
|
142
143
|
}
|
|
143
144
|
}
|