@lumx/core 4.26.0-next.1 → 4.26.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.
Files changed (36) hide show
  1. package/components-and-utils.css +39 -35
  2. package/js/components/Combobox/ComboboxOptionTests.d.ts +3 -3
  3. package/js/components/Combobox/ComboboxPopover.d.ts +1 -1
  4. package/js/components/Combobox/constants.d.ts +0 -4
  5. package/js/components/Combobox/index.d.ts +0 -16
  6. package/js/components/Combobox/setupCombobox.d.ts +2 -2
  7. package/js/components/Combobox/setupComboboxButton.d.ts +4 -3
  8. package/js/components/Combobox/setupComboboxInput.d.ts +1 -1
  9. package/js/components/Combobox/types.d.ts +14 -127
  10. package/js/components/{Combobox/ComboboxList.d.ts → Listbox/ListboxList.d.ts} +14 -8
  11. package/js/components/{Combobox/ComboboxOption.d.ts → Listbox/ListboxOption.d.ts} +17 -11
  12. package/js/components/{Combobox/ComboboxOptionAction.d.ts → Listbox/ListboxOptionAction.d.ts} +11 -5
  13. package/js/components/{Combobox/ComboboxOptionMoreInfo.d.ts → Listbox/ListboxOptionMoreInfo.d.ts} +14 -8
  14. package/js/components/{Combobox/ComboboxSelectionIcon.d.ts → Listbox/ListboxOptionSelectionIcon.d.ts} +2 -2
  15. package/js/components/{Combobox/ComboboxOptionSkeleton.d.ts → Listbox/ListboxOptionSkeleton.d.ts} +14 -8
  16. package/js/components/{Combobox/ComboboxSection.d.ts → Listbox/ListboxSection.d.ts} +17 -11
  17. package/js/components/{Combobox/ComboboxState.d.ts → Listbox/ListboxState.d.ts} +12 -6
  18. package/js/components/Listbox/Tests.d.ts +43 -0
  19. package/js/components/Listbox/constants.d.ts +4 -0
  20. package/js/components/Listbox/index.d.ts +18 -0
  21. package/js/components/Listbox/navigation.d.ts +40 -0
  22. package/js/components/Listbox/setupListbox.d.ts +17 -0
  23. package/js/components/Listbox/subscribeListboxState.d.ts +24 -0
  24. package/js/components/Listbox/types.d.ts +146 -0
  25. package/js/components/{Combobox → Listbox}/utils.d.ts +2 -2
  26. package/js/components/Popover/Stories.d.ts +2 -2
  27. package/js/components/TimePickerField/index.d.ts +4 -4
  28. package/js/utils/select/renderSelectOptions.d.ts +1 -1
  29. package/lumx.css +39 -35
  30. package/package.json +3 -4
  31. package/scss/_components_classes.scss +1 -0
  32. package/scss/components/combobox/_index.scss +5 -57
  33. package/scss/components/list/_mixins.scss +5 -4
  34. package/scss/components/list-box/_index.scss +69 -0
  35. package/js/components/Combobox/setupListbox.d.ts +0 -23
  36. package/js/components/Combobox/subscribeComboboxState.d.ts +0 -23
@@ -2,6 +2,8 @@
2
2
  Combobox
3
3
  ========================================================================== */
4
4
 
5
+ // NB: list, option, section and state styles live in `components/list-box`.
6
+
5
7
  // ---- Input -----------------------
6
8
  .#{$lumx-base-prefix}-combobox-input {
7
9
  .#{$lumx-base-prefix}-text-field__chips {
@@ -33,66 +35,12 @@
33
35
  scroll-snap-align: end;
34
36
  }
35
37
  }
36
- }
37
38
 
38
- // Hide popover and list when there is no option, no state, and no skeleton
39
- .#{$lumx-base-prefix}-combobox-popover,
40
- .#{$lumx-base-prefix}-combobox-list {
39
+ // Hide popover when there is no option, no state, and no skeleton
41
40
  &:empty,
42
- &:not(:has(.#{$lumx-base-prefix}-combobox-option)):not(:has(.#{$lumx-base-prefix}-combobox-state)):not(
43
- :has(.#{$lumx-base-prefix}-combobox-option-skeleton)
41
+ &:not(:has(.#{$lumx-base-prefix}-listbox-option)):not(:has(.#{$lumx-base-prefix}-listbox-state)):not(
42
+ :has(.#{$lumx-base-prefix}-listbox-option-skeleton)
44
43
  ) {
45
44
  display: none;
46
45
  }
47
46
  }
48
-
49
- // ---- State -----------------------
50
-
51
- .#{$lumx-base-prefix}-combobox-state {
52
- text-align: center;
53
- }
54
-
55
- // ---- Option -----------------------
56
-
57
- .#{$lumx-base-prefix}-combobox-option {
58
- // Skeleton option placeholders — width variation via :nth-child cycling
59
- &-skeleton {
60
- .#{$lumx-base-prefix}-skeleton-typography {
61
- width: min(65%, 200px);
62
- }
63
-
64
- &:nth-child(3n + 1) .#{$lumx-base-prefix}-skeleton-typography {
65
- width: min(70%, 230px);
66
- }
67
-
68
- &:nth-child(3n + 2) .#{$lumx-base-prefix}-skeleton-typography {
69
- width: min(55%, 170px);
70
- }
71
- }
72
-
73
- // Selection state icon (select options), centered in the `after` slot
74
- &__selection-icon {
75
- margin: auto;
76
- }
77
-
78
- // Allow flex items to shrink below their content width so `truncate` text shows an ellipsis
79
- .#{$lumx-base-prefix}-list-item__wrapper,
80
- .#{$lumx-base-prefix}-list-item__content {
81
- min-width: 0;
82
- }
83
-
84
- // Center option content
85
- .#{$lumx-base-prefix}-list-item__content {
86
- display: flex;
87
- flex-direction: column;
88
- justify-items: center;
89
- }
90
-
91
- // Option more info popover sizing
92
- &-more-info {
93
- &__popover {
94
- max-width: $lumx-size-xxl;
95
- padding: $lumx-spacing-unit-big;
96
- }
97
- }
98
- }
@@ -158,10 +158,11 @@
158
158
  }
159
159
  }
160
160
 
161
- // Insert a divider after each section that is not the last child
162
- // and not directly followed by an explicit divider or a hidden element
163
- // (when followed by a hidden element, the next visible section's ::before handles the divider).
164
- &:not(:last-child):not(:has(+ #{$divider})):not(:has(+ [hidden])) {
161
+ // Insert a divider after each section followed by visible content, i.e. a next sibling that is not:
162
+ // - an explicit divider
163
+ // - a hidden element (the next visible section's ::before handles the divider)
164
+ // - empty (like the infinite scroll sentinel)
165
+ &:has(+ :not(#{$divider}, [hidden], :empty)) {
165
166
  &::after {
166
167
  content: '';
167
168
  display: block;
@@ -0,0 +1,69 @@
1
+ /* ==========================================================================
2
+ Listbox
3
+ ========================================================================== */
4
+
5
+ // NB: elements also carry the legacy `lumx-combobox-*` class names for backward compatibility.
6
+ // Styles target the `lumx-listbox-*` class names only.
7
+
8
+ // ---- List -----------------------
9
+
10
+ // Hide list when there is no option, no state, and no skeleton
11
+ .#{$lumx-base-prefix}-listbox-list {
12
+ &:empty,
13
+ &:not(:has(.#{$lumx-base-prefix}-listbox-option)):not(:has(.#{$lumx-base-prefix}-listbox-state)):not(
14
+ :has(.#{$lumx-base-prefix}-listbox-option-skeleton)
15
+ ) {
16
+ display: none;
17
+ }
18
+ }
19
+
20
+ // ---- State -----------------------
21
+
22
+ .#{$lumx-base-prefix}-listbox-state {
23
+ text-align: center;
24
+ }
25
+
26
+ // ---- Option -----------------------
27
+
28
+ .#{$lumx-base-prefix}-listbox-option {
29
+ // Skeleton option placeholders — width variation via :nth-child cycling
30
+ &-skeleton {
31
+ .#{$lumx-base-prefix}-skeleton-typography {
32
+ width: min(65%, 200px);
33
+ }
34
+
35
+ &:nth-child(3n + 1) .#{$lumx-base-prefix}-skeleton-typography {
36
+ width: min(70%, 230px);
37
+ }
38
+
39
+ &:nth-child(3n + 2) .#{$lumx-base-prefix}-skeleton-typography {
40
+ width: min(55%, 170px);
41
+ }
42
+ }
43
+
44
+ // Selection state icon (select options), centered in the `after` slot
45
+ &__selection-icon {
46
+ margin: auto;
47
+ }
48
+
49
+ // Allow flex items to shrink below their content width so `truncate` text shows an ellipsis
50
+ .#{$lumx-base-prefix}-list-item__wrapper,
51
+ .#{$lumx-base-prefix}-list-item__content {
52
+ min-width: 0;
53
+ }
54
+
55
+ // Center option content
56
+ .#{$lumx-base-prefix}-list-item__content {
57
+ display: flex;
58
+ flex-direction: column;
59
+ justify-items: center;
60
+ }
61
+
62
+ // Option more info popover sizing
63
+ &-more-info {
64
+ &__popover {
65
+ max-width: $lumx-size-xxl;
66
+ padding: $lumx-spacing-unit-big;
67
+ }
68
+ }
69
+ }
@@ -1,23 +0,0 @@
1
- import { type FocusNavigationController } from '../../utils/focusNavigation';
2
- import type { ComboboxEventMap, ComboboxHandle } from './types';
3
- /**
4
- * Set up focus navigation and delegated event listeners on a listbox element.
5
- *
6
- * This merges two concerns:
7
- * 1. Creating the appropriate {@link FocusNavigationController} (grid or list mode)
8
- * with callbacks that manage `aria-activedescendant` and visual focus indicators.
9
- * 2. Attaching delegated `click` and `mousedown` listeners to the listbox for
10
- * option selection and blur prevention.
11
- *
12
- * The caller is responsible for guarding against duplicate calls (i.e., checking
13
- * that a focus navigation controller does not already exist before calling)
14
- * and ensuring `handle.trigger` and `handle.listbox` are non-null.
15
- *
16
- * @param handle The combobox handle (provides trigger, listbox, select, etc.).
17
- * @param signal Abort signal used to clean up all attached listeners.
18
- * @param notify Notify subscribers of combobox events.
19
- * @returns The created focus navigation controller.
20
- */
21
- export declare function setupListbox(handle: ComboboxHandle, signal: AbortSignal, notify: <K extends keyof ComboboxEventMap>(event: K, value: ComboboxEventMap[K]) => void, options?: {
22
- wrapNavigation?: boolean;
23
- }): FocusNavigationController;
@@ -1,23 +0,0 @@
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;