@lumx/core 4.25.1-alpha.3 → 4.25.1-alpha.4

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 (38) hide show
  1. package/components-and-utils.css +42 -34
  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/Stories.d.ts +32 -1
  5. package/js/components/Combobox/constants.d.ts +0 -4
  6. package/js/components/Combobox/index.d.ts +0 -16
  7. package/js/components/Combobox/setupCombobox.d.ts +2 -2
  8. package/js/components/Combobox/setupComboboxButton.d.ts +4 -3
  9. package/js/components/Combobox/setupComboboxInput.d.ts +1 -1
  10. package/js/components/Combobox/types.d.ts +14 -127
  11. package/js/components/{Combobox/ComboboxList.d.ts → Listbox/ListboxList.d.ts} +14 -8
  12. package/js/components/{Combobox/ComboboxOption.d.ts → Listbox/ListboxOption.d.ts} +17 -11
  13. package/js/components/{Combobox/ComboboxOptionAction.d.ts → Listbox/ListboxOptionAction.d.ts} +11 -5
  14. package/js/components/{Combobox/ComboboxOptionMoreInfo.d.ts → Listbox/ListboxOptionMoreInfo.d.ts} +14 -8
  15. package/js/components/{Combobox/ComboboxSelectionIcon.d.ts → Listbox/ListboxOptionSelectionIcon.d.ts} +2 -2
  16. package/js/components/{Combobox/ComboboxOptionSkeleton.d.ts → Listbox/ListboxOptionSkeleton.d.ts} +14 -8
  17. package/js/components/{Combobox/ComboboxSection.d.ts → Listbox/ListboxSection.d.ts} +17 -11
  18. package/js/components/{Combobox/ComboboxState.d.ts → Listbox/ListboxState.d.ts} +12 -6
  19. package/js/components/Listbox/Tests.d.ts +43 -0
  20. package/js/components/Listbox/constants.d.ts +4 -0
  21. package/js/components/Listbox/index.d.ts +18 -0
  22. package/js/components/Listbox/navigation.d.ts +40 -0
  23. package/js/components/Listbox/setupListbox.d.ts +17 -0
  24. package/js/components/Listbox/subscribeListboxState.d.ts +24 -0
  25. package/js/components/Listbox/types.d.ts +146 -0
  26. package/js/components/{Combobox → Listbox}/utils.d.ts +2 -2
  27. package/js/components/Popover/Stories.d.ts +2 -2
  28. package/js/components/TimePickerField/index.d.ts +4 -4
  29. package/js/utils/select/renderSelectOptions.d.ts +1 -1
  30. package/js/utils/select/types.d.ts +3 -0
  31. package/lumx.css +42 -34
  32. package/package.json +2 -2
  33. package/scss/_components_classes.scss +1 -0
  34. package/scss/components/combobox/_index.scss +5 -51
  35. package/scss/components/list/_index.scss +3 -1
  36. package/scss/components/list-box/_index.scss +69 -0
  37. package/js/components/Combobox/setupListbox.d.ts +0 -23
  38. package/js/components/Combobox/subscribeComboboxState.d.ts +0 -23
package/lumx.css CHANGED
@@ -5737,39 +5737,10 @@ table {
5737
5737
  display: block;
5738
5738
  scroll-snap-align: end;
5739
5739
  }
5740
-
5741
- .lumx-combobox-popover:empty, .lumx-combobox-popover:not(:has(.lumx-combobox-option)):not(:has(.lumx-combobox-state)):not(:has(.lumx-combobox-option-skeleton)),
5742
- .lumx-combobox-list:empty,
5743
- .lumx-combobox-list:not(:has(.lumx-combobox-option)):not(:has(.lumx-combobox-state)):not(:has(.lumx-combobox-option-skeleton)) {
5740
+ .lumx-combobox-popover:empty, .lumx-combobox-popover:not(:has(.lumx-listbox-option)):not(:has(.lumx-listbox-state)):not(:has(.lumx-listbox-option-skeleton)) {
5744
5741
  display: none;
5745
5742
  }
5746
5743
 
5747
- .lumx-combobox-state {
5748
- text-align: center;
5749
- }
5750
-
5751
- .lumx-combobox-option-skeleton .lumx-skeleton-typography {
5752
- width: min(65%, 200px);
5753
- }
5754
- .lumx-combobox-option-skeleton:nth-child(3n+1) .lumx-skeleton-typography {
5755
- width: min(70%, 230px);
5756
- }
5757
- .lumx-combobox-option-skeleton:nth-child(3n+2) .lumx-skeleton-typography {
5758
- width: min(55%, 170px);
5759
- }
5760
- .lumx-combobox-option__selection-icon {
5761
- margin: auto;
5762
- }
5763
- .lumx-combobox-option .lumx-list-item__content {
5764
- display: flex;
5765
- flex-direction: column;
5766
- justify-items: center;
5767
- }
5768
- .lumx-combobox-option-more-info__popover {
5769
- max-width: 256px;
5770
- padding: 16px;
5771
- }
5772
-
5773
5744
  /* ==========================================================================
5774
5745
  Comment block
5775
5746
  ========================================================================== */
@@ -8139,6 +8110,43 @@ table {
8139
8110
  opacity: 1;
8140
8111
  }
8141
8112
  }
8113
+ /* ==========================================================================
8114
+ Listbox
8115
+ ========================================================================== */
8116
+ .lumx-listbox-list:empty, .lumx-listbox-list:not(:has(.lumx-listbox-option)):not(:has(.lumx-listbox-state)):not(:has(.lumx-listbox-option-skeleton)) {
8117
+ display: none;
8118
+ }
8119
+
8120
+ .lumx-listbox-state {
8121
+ text-align: center;
8122
+ }
8123
+
8124
+ .lumx-listbox-option-skeleton .lumx-skeleton-typography {
8125
+ width: min(65%, 200px);
8126
+ }
8127
+ .lumx-listbox-option-skeleton:nth-child(3n+1) .lumx-skeleton-typography {
8128
+ width: min(70%, 230px);
8129
+ }
8130
+ .lumx-listbox-option-skeleton:nth-child(3n+2) .lumx-skeleton-typography {
8131
+ width: min(55%, 170px);
8132
+ }
8133
+ .lumx-listbox-option__selection-icon {
8134
+ margin: auto;
8135
+ }
8136
+ .lumx-listbox-option .lumx-list-item__wrapper,
8137
+ .lumx-listbox-option .lumx-list-item__content {
8138
+ min-width: 0;
8139
+ }
8140
+ .lumx-listbox-option .lumx-list-item__content {
8141
+ display: flex;
8142
+ flex-direction: column;
8143
+ justify-items: center;
8144
+ }
8145
+ .lumx-listbox-option-more-info__popover {
8146
+ max-width: 256px;
8147
+ padding: 16px;
8148
+ }
8149
+
8142
8150
  /* ==========================================================================
8143
8151
  Index
8144
8152
  ========================================================================== */
@@ -8947,17 +8955,17 @@ table {
8947
8955
  .lumx-list-item__link--is-selected:active, .lumx-list-item__link--is-selected[data-lumx-active] {
8948
8956
  background-color: var(--lumx-color-primary-L3);
8949
8957
  }
8950
- .lumx-list-item .lumx-action-area__action[aria-selected=true]::before, .lumx-list-item__wrapper--is-selected .lumx-action-area__action::before {
8958
+ .lumx-list-item .lumx-action-area__action[aria-selected=true]::before, .lumx-list-item .lumx-action-area__action[aria-current]:not([aria-current=false]):not([aria-current=""])::before, .lumx-list-item__wrapper--is-selected .lumx-action-area__action::before {
8951
8959
  background-color: var(--lumx-color-primary-L5);
8952
8960
  }
8953
- .lumx-list-item .lumx-action-area__action[aria-selected=true][data-lumx-hover]::before, .lumx-list-item .lumx-action-area__action[aria-selected=true][data-focus-visible-added]::before, .lumx-list-item__wrapper--is-selected .lumx-action-area__action[data-lumx-hover]::before, .lumx-list-item__wrapper--is-selected .lumx-action-area__action[data-focus-visible-added]::before {
8961
+ .lumx-list-item .lumx-action-area__action[aria-selected=true][data-lumx-hover]::before, .lumx-list-item .lumx-action-area__action[aria-selected=true][data-focus-visible-added]::before, .lumx-list-item .lumx-action-area__action[aria-current]:not([aria-current=false]):not([aria-current=""])[data-lumx-hover]::before, .lumx-list-item .lumx-action-area__action[aria-current]:not([aria-current=false]):not([aria-current=""])[data-focus-visible-added]::before, .lumx-list-item__wrapper--is-selected .lumx-action-area__action[data-lumx-hover]::before, .lumx-list-item__wrapper--is-selected .lumx-action-area__action[data-focus-visible-added]::before {
8954
8962
  background-color: var(--lumx-color-primary-L4);
8955
8963
  }
8956
8964
  @media (hover: hover) {
8957
- .lumx-list-item .lumx-action-area__action[aria-selected=true]:hover::before, .lumx-list-item__wrapper--is-selected .lumx-action-area__action:hover::before {
8965
+ .lumx-list-item .lumx-action-area__action[aria-selected=true]:hover::before, .lumx-list-item .lumx-action-area__action[aria-current]:not([aria-current=false]):not([aria-current=""]):hover::before, .lumx-list-item__wrapper--is-selected .lumx-action-area__action:hover::before {
8958
8966
  background-color: var(--lumx-color-primary-L4);
8959
8967
  }}
8960
- .lumx-list-item .lumx-action-area__action[aria-selected=true]:active::before, .lumx-list-item .lumx-action-area__action[aria-selected=true][data-lumx-active]::before, .lumx-list-item__wrapper--is-selected .lumx-action-area__action:active::before, .lumx-list-item__wrapper--is-selected .lumx-action-area__action[data-lumx-active]::before {
8968
+ .lumx-list-item .lumx-action-area__action[aria-selected=true]:active::before, .lumx-list-item .lumx-action-area__action[aria-selected=true][data-lumx-active]::before, .lumx-list-item .lumx-action-area__action[aria-current]:not([aria-current=false]):not([aria-current=""]):active::before, .lumx-list-item .lumx-action-area__action[aria-current]:not([aria-current=false]):not([aria-current=""])[data-lumx-active]::before, .lumx-list-item__wrapper--is-selected .lumx-action-area__action:active::before, .lumx-list-item__wrapper--is-selected .lumx-action-area__action[data-lumx-active]::before {
8961
8969
  background-color: var(--lumx-color-primary-L3);
8962
8970
  }
8963
8971
  .lumx-list-item__link--is-disabled, .lumx-list-item__link[aria-disabled=true], .lumx-list-item:has(.lumx-action-area__action[aria-disabled=true]) {
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.25.1-alpha.3",
10
+ "@lumx/icons": "^4.25.1-alpha.4",
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.25.1-alpha.3",
69
+ "version": "4.25.1-alpha.4",
70
70
  "devDependencies": {
71
71
  "@rollup/plugin-typescript": "^12.3.0",
72
72
  "@testing-library/dom": "^10.4.1",
@@ -25,6 +25,7 @@
25
25
  @import "./components/input-label/index";
26
26
  @import "./components/input-required-legend/index";
27
27
  @import "./components/lightbox/index";
28
+ @import "./components/list-box/index";
28
29
  @import "./components/link/index";
29
30
  @import "./components/link-preview/index";
30
31
  @import "./components/list/index";
@@ -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,60 +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
- // Center option content
79
- .#{$lumx-base-prefix}-list-item__content {
80
- display: flex;
81
- flex-direction: column;
82
- justify-items: center;
83
- }
84
-
85
- // Option more info popover sizing
86
- &-more-info {
87
- &__popover {
88
- max-width: $lumx-size-xxl;
89
- padding: $lumx-spacing-unit-big;
90
- }
91
- }
92
- }
@@ -45,9 +45,11 @@
45
45
  @include lumx-list-item-selected;
46
46
  }
47
47
 
48
- // Selected action: from `aria-selected` on the action (ex: combobox option) or from `isSelected` on the list item.
48
+ // Selected action: from `aria-selected` (ex: combobox option) or `aria-current` (ex: nav link) on the action,
49
+ // or from `isSelected` on the list item.
49
50
  // (the background is on the action overlay `::before`, so the state selectors must come before `::before`)
50
51
  & .#{$lumx-base-prefix}-action-area__action[aria-selected="true"],
52
+ & .#{$lumx-base-prefix}-action-area__action[aria-current]:not([aria-current="false"]):not([aria-current=""]),
51
53
  &__wrapper--is-selected .#{$lumx-base-prefix}-action-area__action {
52
54
  &::before {
53
55
  background-color: lumx-color-variant("primary", "L5");
@@ -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;