@lumx/core 4.27.1-alpha.1 → 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.
Files changed (32) hide show
  1. package/components-and-utils.css +83 -2
  2. package/js/components/Combobox/Tests.d.ts +9 -0
  3. package/js/components/Combobox/index.d.ts +1 -1
  4. package/js/components/Combobox/setupCombobox.d.ts +13 -11
  5. package/js/components/Combobox/setupComboboxButton.d.ts +2 -2
  6. package/js/components/Combobox/setupComboboxInput.d.ts +2 -2
  7. package/js/components/Combobox/types.d.ts +56 -17
  8. package/js/components/Composite/CompositeStatus.d.ts +8 -27
  9. package/js/components/Composite/types.d.ts +43 -9
  10. package/js/components/Composite/utils.d.ts +2 -0
  11. package/js/components/Listbox/index.d.ts +0 -2
  12. package/js/components/TreeList/Stories.d.ts +82 -0
  13. package/js/components/TreeList/TestStories.d.ts +88 -0
  14. package/js/components/TreeList/Tests.d.ts +51 -0
  15. package/js/components/TreeList/TreeList.d.ts +60 -0
  16. package/js/components/TreeList/TreeListItem.d.ts +84 -0
  17. package/js/components/TreeList/TreeListSection.d.ts +52 -0
  18. package/js/components/TreeList/dom.d.ts +61 -0
  19. package/js/components/TreeList/index.d.ts +11 -0
  20. package/js/components/TreeList/navigation.d.ts +15 -0
  21. package/js/components/TreeList/selection.d.ts +9 -0
  22. package/js/components/TreeList/setupTreeList.d.ts +18 -0
  23. package/js/components/TreeList/types.d.ts +65 -0
  24. package/js/components/TreeList/utils.d.ts +4 -0
  25. package/js/utils/string/includesIgnoreCase.d.ts +2 -0
  26. package/lumx.css +83 -2
  27. package/package.json +3 -4
  28. package/scss/_components_classes.scss +1 -0
  29. package/scss/components/combobox/_index.scss +1 -1
  30. package/scss/components/list/_mixins.scss +4 -3
  31. package/scss/components/tree-list/_index.scss +145 -0
  32. package/js/components/Listbox/subscribeListboxState.d.ts +0 -24
@@ -0,0 +1,145 @@
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: $lumx-expansion-panel-transition-duration;
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). The tree list has no theme: the light theme colors.
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: a margin (they have no full width background)
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 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`.
126
+ @supports (interpolate-size: allow-keywords) {
127
+ // stylelint-disable-next-line property-no-unknown -- (not in the stylelint 14 property list yet)
128
+ interpolate-size: allow-keywords;
129
+ overflow-y: clip;
130
+ transition:
131
+ height $lumx-tree-list-transition-duration,
132
+ content-visibility $lumx-tree-list-transition-duration allow-discrete;
133
+
134
+ @media (prefers-reduced-motion: reduce) {
135
+ transition: none;
136
+ }
137
+
138
+ &[hidden] {
139
+ display: block;
140
+ height: 0;
141
+ content-visibility: hidden;
142
+ }
143
+ }
144
+ }
145
+ }
@@ -1,24 +0,0 @@
1
- import type { CompositeHandle } from '../Composite/types';
2
- /** Setters invoked by `subscribeListboxState` when handle events fire. */
3
- export interface ListboxStateSetters {
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 options become visible, and `false` immediately when hidden. */
9
- setIsOpen: (value: boolean) => void;
10
- }
11
- /**
12
- * Subscribe to the listbox handle events needed by `CompositeStatus`.
13
- *
14
- * Manages three subscriptions:
15
- * - `loadingChange` → `setIsLoading` (+ synchronous initial read of the `loadingChange` snapshot)
16
- * - `loadingAnnouncement` → `setShouldAnnounce`
17
- * - `open` → `setIsOpen` (deferred by {@link OPEN_ANNOUNCEMENT_DELAY}ms when shown, immediate when hidden)
18
- * (a standalone listbox is always visible: `setIsOpen(true)` once, no subscription)
19
- *
20
- * @param list The listbox handle to subscribe to (`ComboboxHandle.list` inside a combobox).
21
- * @param setters Framework-specific state setters.
22
- * @returns A cleanup function that unsubscribes all events and clears timers.
23
- */
24
- export declare function subscribeListboxState(list: CompositeHandle, setters: ListboxStateSetters): () => void;