@lmvz-ds/components 0.36.0 → 0.37.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.
- package/CHANGELOG.md +10 -0
- package/cjs/aria.constants-DPK5mQEL.js +65 -0
- package/cjs/{stencil.util-TjS8_DoU.js → async.util-Dnl6c82X.js} +1 -13
- package/cjs/{directional-focus-controller-3uDoin45.js → directional-focus-controller-8Xd_7MHT.js} +1 -1
- package/cjs/{element-activation-controller-BWtUKzu2.js → element-activation-controller-DzTUocEO.js} +1 -1
- package/cjs/{element.util-CctmBvUY.js → element.util-BlhcwmfR.js} +2 -62
- package/cjs/lmvz-action-list.cjs.entry.js +4 -3
- package/cjs/lmvz-button-group.cjs.entry.js +2 -1
- package/cjs/lmvz-button_2.cjs.entry.js +4 -3
- package/cjs/lmvz-card.cjs.entry.js +1 -1
- package/cjs/lmvz-checkbox.cjs.entry.js +38 -4
- package/cjs/lmvz-components.cjs.js +1 -1
- package/cjs/lmvz-datepicker.cjs.entry.js +10 -3
- package/cjs/lmvz-header_2.cjs.entry.js +4 -3
- package/cjs/lmvz-input.cjs.entry.js +242 -0
- package/cjs/lmvz-menuitem.cjs.entry.js +3 -2
- package/cjs/lmvz-modal.cjs.entry.js +3 -2
- package/cjs/{lmvz-input_2.cjs.entry.js → lmvz-popover.cjs.entry.js} +24 -228
- package/cjs/lmvz-radio.cjs.entry.js +61 -3
- package/cjs/lmvz-select.cjs.entry.js +423 -16
- package/cjs/lmvz-snackbar.cjs.entry.js +1 -1
- package/cjs/lmvz-spinner.cjs.entry.js +1 -1
- package/cjs/lmvz-tab.cjs.entry.js +2 -2
- package/cjs/lmvz-tabs.cjs.entry.js +5 -4
- package/cjs/lmvz-toggle.cjs.entry.js +7 -3
- package/cjs/loader.cjs.js +1 -1
- package/cjs/stencil.util-CBrPLd-F.js +17 -0
- package/collection/components/lmvz-action-list/lmvz-action-list.css +11 -0
- package/collection/components/lmvz-button/lmvz-button.css +11 -0
- package/collection/components/lmvz-card/lmvz-card.css +11 -0
- package/collection/components/lmvz-checkbox/lmvz-checkbox.css +4 -2
- package/collection/components/lmvz-checkbox/lmvz-checkbox.js +68 -8
- package/collection/components/lmvz-datepicker/lmvz-datepicker.css +0 -5
- package/collection/components/lmvz-datepicker/lmvz-datepicker.js +17 -3
- package/collection/components/lmvz-input/lmvz-input.css +1 -1
- package/collection/components/lmvz-input/lmvz-input.js +47 -12
- package/collection/components/lmvz-modal/lmvz-modal.css +11 -0
- package/collection/components/lmvz-popover/lmvz-popover.css +1 -1
- package/collection/components/lmvz-popover/lmvz-popover.js +45 -5
- package/collection/components/lmvz-radio/lmvz-radio.js +77 -9
- package/collection/components/lmvz-select/lmvz-select.css +96 -34
- package/collection/components/lmvz-select/lmvz-select.js +412 -21
- package/collection/components/lmvz-snackbar/lmvz-snackbar.js +1 -1
- package/collection/components/lmvz-spinner/lmvz-spinner.js +1 -1
- package/collection/components/lmvz-tab/lmvz-tab.css +11 -0
- package/collection/components/lmvz-tab/lmvz-tab.js +1 -1
- package/collection/components/lmvz-tabs/lmvz-tabs.css +11 -0
- package/collection/components/lmvz-tabs/lmvz-tabs.js +1 -1
- package/collection/components/lmvz-toggle/lmvz-toggle.js +21 -1
- package/collection/integration/header-integration/header-integration.js +1 -1
- package/collection/styles/fragments/_focus-within.css +2 -2
- package/collection/utils/aria/listbox-controller.js +154 -0
- package/collection/utils/radio/radio-group-controller.js +17 -0
- package/components/lmvz-action-list.js +1 -1
- package/components/lmvz-button.js +1 -1
- package/components/lmvz-card.js +1 -1
- package/components/lmvz-checkbox.js +1 -1
- package/components/lmvz-datepicker.js +1 -1
- package/components/lmvz-input.js +1 -1
- package/components/lmvz-message.js +1 -1
- package/components/lmvz-modal.js +1 -1
- package/components/lmvz-popover.js +1 -1
- package/components/lmvz-radio.js +1 -1
- package/components/lmvz-select.js +1 -1
- package/components/lmvz-snackbar.js +1 -1
- package/components/lmvz-spinner.js +1 -1
- package/components/lmvz-tab.js +1 -1
- package/components/lmvz-tabs.js +1 -1
- package/components/lmvz-toggle.js +1 -1
- package/components/p-BApwCp0R.js +1 -0
- package/components/p-C5gRiLRR.js +1 -0
- package/components/p-DiRcp9V6.js +1 -0
- package/esm/aria.constants-DIyiticz.js +62 -0
- package/esm/{stencil.util-C3QOYC8E.js → async.util-DZj20TV1.js} +1 -13
- package/esm/{directional-focus-controller-Bhu7RqYE.js → directional-focus-controller-QukTTWBE.js} +1 -1
- package/esm/{element-activation-controller-BuwyVq4A.js → element-activation-controller-dxJZKMag.js} +1 -1
- package/esm/{element.util-Bd9JyKJZ.js → element.util-3ydVsxUW.js} +2 -61
- package/esm/lmvz-action-list.entry.js +4 -3
- package/esm/lmvz-button-group.entry.js +2 -1
- package/esm/lmvz-button_2.entry.js +4 -3
- package/esm/lmvz-card.entry.js +1 -1
- package/esm/lmvz-checkbox.entry.js +38 -4
- package/esm/lmvz-components.js +1 -1
- package/esm/lmvz-datepicker.entry.js +10 -3
- package/esm/lmvz-header_2.entry.js +4 -3
- package/esm/lmvz-input.entry.js +240 -0
- package/esm/lmvz-menuitem.entry.js +3 -2
- package/esm/lmvz-modal.entry.js +3 -2
- package/esm/{lmvz-input_2.entry.js → lmvz-popover.entry.js} +23 -226
- package/esm/lmvz-radio.entry.js +61 -3
- package/esm/lmvz-select.entry.js +423 -16
- package/esm/lmvz-snackbar.entry.js +1 -1
- package/esm/lmvz-spinner.entry.js +1 -1
- package/esm/lmvz-tab.entry.js +2 -2
- package/esm/lmvz-tabs.entry.js +5 -4
- package/esm/lmvz-toggle.entry.js +7 -3
- package/esm/loader.js +1 -1
- package/esm/stencil.util-D2-5rsN3.js +15 -0
- package/hydrate/index.js +631 -74
- package/hydrate/index.mjs +631 -74
- package/lmvz-components/lmvz-components.esm.js +1 -1
- package/lmvz-components/p-00489151.entry.js +1 -0
- package/lmvz-components/{p-544e3ccb.entry.js → p-0f65d001.entry.js} +1 -1
- package/lmvz-components/p-137b1fe1.entry.js +1 -0
- package/lmvz-components/p-26dd9684.entry.js +1 -0
- package/lmvz-components/p-398b5cf4.entry.js +1 -0
- package/lmvz-components/p-40716828.entry.js +1 -0
- package/lmvz-components/p-4deaa010.entry.js +1 -0
- package/lmvz-components/p-57a366e6.entry.js +1 -0
- package/lmvz-components/p-70f1e31a.entry.js +1 -0
- package/lmvz-components/p-7872a6b4.entry.js +1 -0
- package/lmvz-components/{p-d280d21a.entry.js → p-88661c50.entry.js} +1 -1
- package/lmvz-components/p-91eb71bb.entry.js +1 -0
- package/lmvz-components/p-BA3wizqg.js +1 -0
- package/lmvz-components/{p-GGkwaiT6.js → p-CHxiS3ja.js} +1 -1
- package/lmvz-components/{p-UhNgD4L3.js → p-CPSyM_e-.js} +1 -1
- package/lmvz-components/p-DIyiticz.js +1 -0
- package/lmvz-components/p-DZj20TV1.js +1 -0
- package/lmvz-components/p-a680a7b2.entry.js +1 -0
- package/lmvz-components/{p-d48203f9.entry.js → p-a6fe9b61.entry.js} +1 -1
- package/lmvz-components/p-bh9cItsP.js +1 -0
- package/lmvz-components/p-e14058e1.entry.js +1 -0
- package/lmvz-components/p-eabbf901.entry.js +1 -0
- package/lmvz-components/p-f3f0ed49.entry.js +1 -0
- package/lmvz-components/p-f516a949.entry.js +1 -0
- package/manifest.json +366 -30
- package/package.json +1 -1
- package/types/api/ds.types.d.ts +1 -0
- package/types/components/lmvz-checkbox/lmvz-checkbox.d.ts +9 -1
- package/types/components/lmvz-datepicker/lmvz-datepicker.d.ts +2 -0
- package/types/components/lmvz-input/lmvz-input.d.ts +3 -0
- package/types/components/lmvz-popover/lmvz-popover.d.ts +2 -0
- package/types/components/lmvz-radio/lmvz-radio.d.ts +12 -2
- package/types/components/lmvz-select/lmvz-select.d.ts +53 -4
- package/types/components/lmvz-toggle/lmvz-toggle.d.ts +1 -0
- package/types/components.d.ts +96 -12
- package/types/utils/aria/listbox-controller.d.ts +42 -0
- package/types/utils/radio/radio-group-controller.d.ts +3 -0
- package/components/p-Bnri3fEI.js +0 -1
- package/components/p-CPuI0_r_.js +0 -1
- package/components/p-CWpl0WaZ.js +0 -1
- package/lmvz-components/p-63f6a596.entry.js +0 -1
- package/lmvz-components/p-7a7aa922.entry.js +0 -1
- package/lmvz-components/p-8022c6dc.entry.js +0 -1
- package/lmvz-components/p-Bd9JyKJZ.js +0 -1
- package/lmvz-components/p-C3QOYC8E.js +0 -1
- package/lmvz-components/p-a611c110.entry.js +0 -1
- package/lmvz-components/p-b1bb4393.entry.js +0 -1
- package/lmvz-components/p-b50b1cb5.entry.js +0 -1
- package/lmvz-components/p-b932cf91.entry.js +0 -1
- package/lmvz-components/p-bff115d4.entry.js +0 -1
- package/lmvz-components/p-d9aede81.entry.js +0 -1
- package/lmvz-components/p-dbfbcb74.entry.js +0 -1
- package/lmvz-components/p-f0e28f3a.entry.js +0 -1
- package/lmvz-components/p-f853faae.entry.js +0 -1
- package/lmvz-components/p-fa2efc42.entry.js +0 -1
- package/lmvz-components/p-fe6f5bdc.entry.js +0 -1
|
@@ -5,7 +5,162 @@ var ariaValidationController = require('./aria-validation-controller-Do0uEK4t.js
|
|
|
5
5
|
var reactiveControllerHost = require('./reactive-controller-host-Bc6B_T45.js');
|
|
6
6
|
require('./aria-loader-DWUVcapD.js');
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const defaultConfig = {
|
|
9
|
+
wrap: true,
|
|
10
|
+
typeaheadTimeoutMs: 500,
|
|
11
|
+
};
|
|
12
|
+
class ListboxController {
|
|
13
|
+
options = [];
|
|
14
|
+
_activeId;
|
|
15
|
+
_selectedId;
|
|
16
|
+
config;
|
|
17
|
+
typeaheadBuffer = '';
|
|
18
|
+
typeaheadTimer;
|
|
19
|
+
constructor(config = {}) {
|
|
20
|
+
this.config = { ...defaultConfig, ...config };
|
|
21
|
+
}
|
|
22
|
+
hostDisconnected() {
|
|
23
|
+
this.clearTypeaheadTimer();
|
|
24
|
+
}
|
|
25
|
+
get activeId() {
|
|
26
|
+
return this._activeId;
|
|
27
|
+
}
|
|
28
|
+
get activeDescendantId() {
|
|
29
|
+
return this._activeId;
|
|
30
|
+
}
|
|
31
|
+
get selectedId() {
|
|
32
|
+
return this._selectedId;
|
|
33
|
+
}
|
|
34
|
+
setOptions(options) {
|
|
35
|
+
this.options = options;
|
|
36
|
+
if (this._activeId && this.findEnabledIndex(this._activeId) !== -1)
|
|
37
|
+
return;
|
|
38
|
+
const fallback = (this._selectedId && this.findEnabledIndex(this._selectedId) !== -1 ? this._selectedId : undefined) ?? this.firstEnabledOption()?.id;
|
|
39
|
+
this.setActiveId(fallback);
|
|
40
|
+
}
|
|
41
|
+
setActiveId(id) {
|
|
42
|
+
if (id !== undefined && !this.isEnabledId(id))
|
|
43
|
+
return;
|
|
44
|
+
if (id === this._activeId)
|
|
45
|
+
return;
|
|
46
|
+
this._activeId = id;
|
|
47
|
+
this.config.onActiveChange?.(id);
|
|
48
|
+
}
|
|
49
|
+
setSelectedId(id) {
|
|
50
|
+
this._selectedId = id;
|
|
51
|
+
}
|
|
52
|
+
selectOption(id) {
|
|
53
|
+
if (!this.isEnabledId(id))
|
|
54
|
+
return;
|
|
55
|
+
this._selectedId = id;
|
|
56
|
+
this.config.onSelect?.(id);
|
|
57
|
+
}
|
|
58
|
+
selectActive() {
|
|
59
|
+
if (this._activeId)
|
|
60
|
+
this.selectOption(this._activeId);
|
|
61
|
+
}
|
|
62
|
+
handleKeydown(event) {
|
|
63
|
+
switch (event.key) {
|
|
64
|
+
case 'ArrowDown':
|
|
65
|
+
event.preventDefault();
|
|
66
|
+
this.moveActive('next');
|
|
67
|
+
return true;
|
|
68
|
+
case 'ArrowUp':
|
|
69
|
+
event.preventDefault();
|
|
70
|
+
this.moveActive('previous');
|
|
71
|
+
return true;
|
|
72
|
+
case 'Home':
|
|
73
|
+
event.preventDefault();
|
|
74
|
+
this.setActiveId(this.firstEnabledOption()?.id);
|
|
75
|
+
return true;
|
|
76
|
+
case 'End':
|
|
77
|
+
event.preventDefault();
|
|
78
|
+
this.setActiveId(this.lastEnabledOption()?.id);
|
|
79
|
+
return true;
|
|
80
|
+
case 'Enter':
|
|
81
|
+
case ' ':
|
|
82
|
+
event.preventDefault();
|
|
83
|
+
this.selectActive();
|
|
84
|
+
return true;
|
|
85
|
+
case 'Escape':
|
|
86
|
+
event.preventDefault();
|
|
87
|
+
this.config.onClose?.();
|
|
88
|
+
return true;
|
|
89
|
+
default:
|
|
90
|
+
return this.handleTypeahead(event);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
clearTypeahead() {
|
|
94
|
+
this.typeaheadBuffer = '';
|
|
95
|
+
this.clearTypeaheadTimer();
|
|
96
|
+
}
|
|
97
|
+
moveActive(direction) {
|
|
98
|
+
const enabledOptions = this.enabledOptions();
|
|
99
|
+
if (!enabledOptions.length)
|
|
100
|
+
return;
|
|
101
|
+
const currentIndex = this._activeId ? enabledOptions.findIndex((option) => option.id === this._activeId) : -1;
|
|
102
|
+
if (currentIndex === -1) {
|
|
103
|
+
this.setActiveId((direction === 'next' ? enabledOptions[0] : enabledOptions[enabledOptions.length - 1])?.id);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
const step = direction === 'next' ? 1 : -1;
|
|
107
|
+
const rawIndex = currentIndex + step;
|
|
108
|
+
if (rawIndex < 0 || rawIndex >= enabledOptions.length) {
|
|
109
|
+
if (!this.config.wrap)
|
|
110
|
+
return;
|
|
111
|
+
const wrappedIndex = (rawIndex + enabledOptions.length) % enabledOptions.length;
|
|
112
|
+
this.setActiveId(enabledOptions[wrappedIndex]?.id);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
this.setActiveId(enabledOptions[rawIndex]?.id);
|
|
116
|
+
}
|
|
117
|
+
handleTypeahead(event) {
|
|
118
|
+
if (event.key.length !== 1 || event.ctrlKey || event.metaKey || event.altKey)
|
|
119
|
+
return false;
|
|
120
|
+
event.preventDefault();
|
|
121
|
+
this.typeaheadBuffer += event.key.toLowerCase();
|
|
122
|
+
this.restartTypeaheadTimer();
|
|
123
|
+
const enabledOptions = this.enabledOptions();
|
|
124
|
+
if (!enabledOptions.length)
|
|
125
|
+
return true;
|
|
126
|
+
const currentIndex = this._activeId ? enabledOptions.findIndex((option) => option.id === this._activeId) : -1;
|
|
127
|
+
const orderedFromCurrent = [...enabledOptions.slice(currentIndex + 1), ...enabledOptions.slice(0, currentIndex + 1)];
|
|
128
|
+
const match = orderedFromCurrent.find((option) => option.label.toLowerCase().startsWith(this.typeaheadBuffer));
|
|
129
|
+
if (match)
|
|
130
|
+
this.setActiveId(match.id);
|
|
131
|
+
return true;
|
|
132
|
+
}
|
|
133
|
+
restartTypeaheadTimer() {
|
|
134
|
+
this.clearTypeaheadTimer();
|
|
135
|
+
this.typeaheadTimer = setTimeout(() => {
|
|
136
|
+
this.typeaheadBuffer = '';
|
|
137
|
+
}, this.config.typeaheadTimeoutMs);
|
|
138
|
+
}
|
|
139
|
+
clearTypeaheadTimer() {
|
|
140
|
+
if (this.typeaheadTimer !== undefined) {
|
|
141
|
+
clearTimeout(this.typeaheadTimer);
|
|
142
|
+
this.typeaheadTimer = undefined;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
enabledOptions() {
|
|
146
|
+
return this.options.filter((option) => !option.disabled);
|
|
147
|
+
}
|
|
148
|
+
firstEnabledOption() {
|
|
149
|
+
return this.enabledOptions()[0];
|
|
150
|
+
}
|
|
151
|
+
lastEnabledOption() {
|
|
152
|
+
const enabledOptions = this.enabledOptions();
|
|
153
|
+
return enabledOptions[enabledOptions.length - 1];
|
|
154
|
+
}
|
|
155
|
+
isEnabledId(id) {
|
|
156
|
+
return this.findEnabledIndex(id) !== -1;
|
|
157
|
+
}
|
|
158
|
+
findEnabledIndex(id) {
|
|
159
|
+
return this.enabledOptions().findIndex((option) => option.id === id);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
const lmvzSelectCss = () => `@layer lmvz-ds.reset, lmvz-ds.theme, lmvz-ds.components, lmvz-ds.overrides; @layer lmvz-ds.theme { @font-face { font-family: Router; src: local('RouterBook-Regular'), local('Router-Book'), url('/assets/fonts/Router-Book.woff') format('woff'); font-weight: 400; } @font-face { font-family: Router; src: local('RouterMedium-Regular'), local('Router-Medium'), url('/assets/fonts/Router-Medium.woff') format('woff'); font-weight: 500; } @font-face { font-family: Router; src: local('RouterBold-Regular'), local('Router-Bold'), url('/assets/fonts/Router-Bold.woff') format('woff'); font-weight: 700; } } .sc-lmvz-select-h { display: block; font-family: var(--lmvz-global-font-family-default, Router); --lmvz-internal-select-floating-label-top-offset: 0.375rem; --lmvz-select-radius: var(--lmvz-component-input-radius-default, 999px); --lmvz-select-bg: var(--lmvz-semantic-color-surface-input-primary, #ffffff); --lmvz-select-border-color: var(--lmvz-semantic-color-border-alternate, #c7c7c7); --lmvz-select-border-color-hover: var(--lmvz-semantic-color-border-hover, #a1a1a1); --lmvz-select-border-width: var(--lmvz-semantic-border-width-default, 1px); --lmvz-select-text-color: var(--lmvz-semantic-color-on-surface-input-primary, #000000); --lmvz-select-label-color: var(--lmvz-semantic-color-on-surface-input-primary, #000000); --lmvz-select-padding-x: var(--lmvz-component-input-padding-md, clamp(0.88rem, 0.84rem + 0.13vw, 1rem)); --lmvz-select-gap: var(--lmvz-component-input-gap-md, clamp(0.5rem, 0.44rem + 0.26vw, 0.75rem)); --lmvz-select-height: var(--lmvz-component-input-size-md, clamp(2.5rem, 2.44rem + 0.26vw, 2.75rem)); --lmvz-select-label-font-size: var(--lmvz-component-body-xs-font-size, clamp(0.63rem, 0.59rem + 0.13vw, 0.75rem)); --lmvz-select-label-top-offset: calc(var(--lmvz-internal-select-floating-label-top-offset) * -1); --lmvz-select-label-minimized-padding-x: 4px; --lmvz-select-disabled-opacity: var(--lmvz-component-input-disabled-opacity, 40%); --lmvz-select-helper-color: var(--lmvz-semantic-color-on-surface-input-secondary, #545454); --lmvz-select-focus-color: var(--lmvz-semantic-color-status-on-active, #0e7ab4); --lmvz-select-error-color: var(--lmvz-semantic-color-status-on-danger, #a31419); padding-top: var(--lmvz-internal-select-floating-label-top-offset); } .select-wrapper.sc-lmvz-select { position: relative; height: var(--lmvz-select-height); } label.sc-lmvz-select { position: absolute; top: 50%; left: var(--lmvz-select-padding-x); font-size: var(--lmvz-select-label-font-size); color: var(--lmvz-select-label-color); line-height: normal; white-space: nowrap; pointer-events: none; z-index: 2; transform: translateY(-50%); transform-origin: left top; transition: top 0.2s ease-out, transform 0.2s ease-out, opacity 0.2s ease-out, padding 0.2s ease-out; } label.assistive-label.sc-lmvz-select { opacity: 0; padding: 0; } label.floating-label.sc-lmvz-select { top: var(--lmvz-select-label-top-offset); transform: translateY(0) scale(0.85); left: calc(var(--lmvz-select-padding-x) - 2px); background-color: var(--lmvz-select-bg); padding: 0 var(--lmvz-select-label-minimized-padding-x); opacity: 1; font-weight: 500; } label.sc-lmvz-select > span[aria-hidden='true'].sc-lmvz-select, .select-trigger.sc-lmvz-select > span.sc-lmvz-select:first-child > span[aria-hidden='true'].sc-lmvz-select { color: var(--lmvz-select-error-color); margin-left: 2px; display: inline-block; line-height: 0; vertical-align: middle; } .select-trigger.sc-lmvz-select { display: flex; align-items: center; gap: var(--lmvz-select-gap); height: 100%; width: 100%; padding: 0 var(--lmvz-select-padding-x); border-radius: var(--lmvz-select-radius); background-color: var(--lmvz-select-bg); border: var(--lmvz-select-border-width) solid var(--lmvz-select-border-color); box-sizing: border-box; cursor: pointer; position: relative; z-index: 1; transition: border-color 0.15s ease; } .sc-lmvz-select-h:not([disabled] .select-wrapper.sc-lmvz-select:hover .select-trigger.sc-lmvz-select, [highlighted].sc-lmvz-select-h .select-wrapper.sc-lmvz-select:hover .select-trigger.sc-lmvz-select, [error]).sc-lmvz-select-h .select-wrapper.sc-lmvz-select:hover .select-trigger.sc-lmvz-select { border-color: var(--lmvz-select-border-color-hover); } [error].sc-lmvz-select-h .select-trigger.sc-lmvz-select { border-color: var(--lmvz-select-error-color); } [highlighted].sc-lmvz-select-h .select-trigger.sc-lmvz-select { background-color: var(--lmvz-semantic-color-status-active-alternate, #0f8acc); border-color: var(--lmvz-semantic-color-border-active, #0f8acc); color: var(--lmvz-semantic-color-status-on-active-alternate, #ffffff); } [highlighted].sc-lmvz-select-h .select-trigger.sc-lmvz-select > span.sc-lmvz-select:first-child { color: var(--lmvz-semantic-color-status-on-active-alternate, #ffffff); } [highlighted].sc-lmvz-select-h label.floating-label.sc-lmvz-select { background-color: var(--lmvz-semantic-color-status-active-alternate, #0f8acc); color: var(--lmvz-semantic-color-status-on-active-alternate, #ffffff); } .sc-lmvz-select-h:has(:focus-visible) .select-trigger.sc-lmvz-select { outline: var(--lmvz-ds-outline, 1px solid #0e7ab4); outline-offset: var(--lmvz-ds-outline-offset, clamp(0.25rem, 0.19rem + 0.26vw, 0.5rem)); } .select-trigger.sc-lmvz-select > span.sc-lmvz-select:first-child { flex: 1 0 0; font: var(--lmvz-typography-body-md-strong, 500 clamp(0.88rem, 0.84rem + 0.13vw, 1rem) / 1.5 Router); color: var(--lmvz-select-text-color); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; } .sc-lmvz-select-h:not([highlighted]) .select-wrapper.has-value.sc-lmvz-select .select-trigger.sc-lmvz-select > span.sc-lmvz-select:first-child { color: var(--lmvz-semantic-color-int-on-secondary-active, #000000); } .select-trigger.sc-lmvz-select > span.sc-lmvz-select:last-child { flex-shrink: 0; display: flex; align-items: center; justify-content: center; } .select-trigger.sc-lmvz-select svg.sc-lmvz-select { width: var(--lmvz-component-icon-size-2xs, clamp(0.63rem, 0.59rem + 0.13vw, 0.75rem)); height: var(--lmvz-component-icon-size-2xs, clamp(0.63rem, 0.59rem + 0.13vw, 0.75rem)); flex-shrink: 0; } .lmvz-select-native-options.sc-lmvz-select { display: none; } [disabled].sc-lmvz-select-h .select-wrapper.sc-lmvz-select { opacity: var(--lmvz-select-disabled-opacity); pointer-events: none; cursor: not-allowed; } [role='status'].sc-lmvz-select { padding-top: var(--lmvz-dimension-8-6, clamp(0.38rem, 0.34rem + 0.13vw, 0.5rem)); padding-left: var(--lmvz-select-padding-x); font-size: var(--lmvz-select-label-font-size); color: var(--lmvz-select-helper-color); line-height: normal; } [role='alert'].sc-lmvz-select { padding-top: var(--lmvz-dimension-8-6, clamp(0.38rem, 0.34rem + 0.13vw, 0.5rem)); padding-left: var(--lmvz-select-padding-x); font-size: var(--lmvz-component-body-sm-font-size, clamp(0.75rem, 0.72rem + 0.13vw, 0.88rem)); color: var(--lmvz-select-error-color); line-height: normal; } [size='small'].sc-lmvz-select-h { --lmvz-select-height: var(--lmvz-component-input-size-sm, clamp(2rem, 1.94rem + 0.26vw, 2.25rem)); --lmvz-select-padding-x: var(--lmvz-component-input-padding-sm, clamp(0.75rem, 0.72rem + 0.13vw, 0.88rem)); --lmvz-select-gap: var(--lmvz-component-input-gap-sm, clamp(0.38rem, 0.31rem + 0.26vw, 0.63rem)); --lmvz-select-label-font-size: var(--lmvz-component-body-2xs-font-size, clamp(0.5rem, 0.47rem + 0.13vw, 0.63rem)); } [size='small'].sc-lmvz-select-h .select-trigger.sc-lmvz-select > span.sc-lmvz-select:first-child { font-size: var(--lmvz-component-body-sm-font-size, clamp(0.75rem, 0.72rem + 0.13vw, 0.88rem)); } [size='small'].sc-lmvz-select-h .select-trigger.sc-lmvz-select svg.sc-lmvz-select { width: var(--lmvz-component-icon-size-4xs, clamp(0.5rem, 0.47rem + 0.13vw, 0.63rem)); height: var(--lmvz-component-icon-size-4xs, clamp(0.5rem, 0.47rem + 0.13vw, 0.63rem)); } [size='large'].sc-lmvz-select-h { --lmvz-select-height: var(--lmvz-component-input-size-lg, clamp(2.75rem, 2.69rem + 0.26vw, 3rem)); --lmvz-select-padding-x: var(--lmvz-component-input-padding-lg, clamp(1rem, 0.94rem + 0.26vw, 1.25rem)); --lmvz-select-gap: var(--lmvz-component-input-gap-lg, clamp(0.75rem, 0.69rem + 0.26vw, 1rem)); --lmvz-select-label-font-size: var(--lmvz-component-body-sm-font-size, clamp(0.75rem, 0.72rem + 0.13vw, 0.88rem)); } [size='large'].sc-lmvz-select-h .select-trigger.sc-lmvz-select > span.sc-lmvz-select:first-child { font-size: var(--lmvz-component-body-lg-font-size, clamp(1rem, 0.97rem + 0.13vw, 1.13rem)); } [size='large'].sc-lmvz-select-h .select-trigger.sc-lmvz-select svg.sc-lmvz-select { width: var(--lmvz-component-icon-size-xs, clamp(0.75rem, 0.72rem + 0.13vw, 0.88rem)); height: var(--lmvz-component-icon-size-xs, clamp(0.75rem, 0.72rem + 0.13vw, 0.88rem)); } .lmvz-select-option.sc-lmvz-select { --lmvz-select-option-background: var(--lmvz-semantic-color-int-tertiary, #ffffff); --lmvz-select-option-color: var(--lmvz-semantic-color-int-on-tertiary, #000000); display: flex; align-items: center; gap: var(--lmvz-select-gap); padding: var(--lmvz-component-input-padding-sm, clamp(0.75rem, 0.72rem + 0.13vw, 0.88rem)); border-radius: var(--lmvz-semantic-border-radius-md, 6px); background-color: var(--lmvz-select-option-background); color: var(--lmvz-select-option-color); cursor: pointer; font: var(--lmvz-typography-body-md-strong, 500 clamp(0.88rem, 0.84rem + 0.13vw, 1rem) / 1.5 Router); transition: background-color 0.15s ease, color 0.15s ease; } .lmvz-select-option.sc-lmvz-select:not([aria-disabled='true']):hover { --lmvz-select-option-background: var(--lmvz-semantic-color-int-tertiary-hover, #f0f0f0); --lmvz-select-option-color: var(--lmvz-semantic-color-int-on-tertiary-hover, #000000); } .lmvz-select-option.sc-lmvz-select:not([aria-disabled='true']):active { --lmvz-select-option-background: var(--lmvz-semantic-color-int-tertiary-active, #e0e0e0); --lmvz-select-option-color: var(--lmvz-semantic-color-int-on-tertiary-active, #000000); } .lmvz-select-option.sc-lmvz-select:focus-visible { outline: var(--lmvz-ds-outline, 1px solid #0e7ab4); outline-offset: var(--lmvz-ds-outline-offset, clamp(0.25rem, 0.19rem + 0.26vw, 0.5rem)); position: relative; z-index: 1; } .lmvz-select-option[data-active='true'].sc-lmvz-select:not([aria-disabled='true']) { --lmvz-select-option-background: var(--lmvz-semantic-color-int-tertiary-hover, #f0f0f0); --lmvz-select-option-color: var(--lmvz-semantic-color-int-on-tertiary-hover, #000000); } .lmvz-select-option[aria-selected='true'].sc-lmvz-select { --lmvz-select-option-background: var(--lmvz-semantic-color-status-active-alternate, #0f8acc); --lmvz-select-option-color: var(--lmvz-semantic-color-status-on-active-alternate, #ffffff); } .lmvz-select-option[aria-disabled='true'].sc-lmvz-select { cursor: not-allowed; pointer-events: none; opacity: var(--lmvz-component-input-disabled-opacity, 40%); }`;
|
|
9
164
|
|
|
10
165
|
let selectIdCounter = 0;
|
|
11
166
|
const LmvzSelect = class extends reactiveControllerHost.ReactiveControllerHost {
|
|
@@ -13,60 +168,312 @@ const LmvzSelect = class extends reactiveControllerHost.ReactiveControllerHost {
|
|
|
13
168
|
get validationEl() {
|
|
14
169
|
return this.el;
|
|
15
170
|
}
|
|
171
|
+
internals;
|
|
16
172
|
selectId = `lmvz-select-${selectIdCounter++}`;
|
|
17
|
-
|
|
173
|
+
triggerId = `${this.selectId}-trigger`;
|
|
174
|
+
popoverId = `${this.selectId}-listbox`;
|
|
175
|
+
triggerEl;
|
|
176
|
+
optionsSourceEl;
|
|
177
|
+
optionsMutationObserver;
|
|
178
|
+
initialValue;
|
|
179
|
+
initialValueCaptured = false;
|
|
180
|
+
flatOptions = [];
|
|
181
|
+
optionsById = new Map();
|
|
182
|
+
listboxController = new ListboxController({
|
|
183
|
+
onActiveChange: (id) => {
|
|
184
|
+
this.activeId = id;
|
|
185
|
+
},
|
|
186
|
+
onSelect: (id) => this.handleOptionSelect(id),
|
|
187
|
+
onClose: () => this.closePopover(),
|
|
188
|
+
});
|
|
189
|
+
get helperId() {
|
|
190
|
+
return this.helperText ? `${this.selectId}-helper` : undefined;
|
|
191
|
+
}
|
|
192
|
+
get showErrorMessage() {
|
|
193
|
+
return this.error && Boolean(this.errorMessage);
|
|
194
|
+
}
|
|
195
|
+
get errorId() {
|
|
196
|
+
return `${this.selectId}-error`;
|
|
197
|
+
}
|
|
198
|
+
get describedBy() {
|
|
199
|
+
const ids = [];
|
|
200
|
+
if (this.helperId)
|
|
201
|
+
ids.push(this.helperId);
|
|
202
|
+
if (this.showErrorMessage)
|
|
203
|
+
ids.push(this.errorId);
|
|
204
|
+
return ids.length > 0 ? ids.join(' ') : undefined;
|
|
205
|
+
}
|
|
18
206
|
constructor(hostRef) {
|
|
19
207
|
super();
|
|
20
208
|
index.registerInstance(this, hostRef);
|
|
21
209
|
this.lmvzChange = index.createEvent(this, "lmvzChange", 7);
|
|
210
|
+
if (hostRef.$hostElement$["s-ei"]) {
|
|
211
|
+
this.internals = hostRef.$hostElement$["s-ei"];
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
this.internals = hostRef.$hostElement$.attachInternals();
|
|
215
|
+
hostRef.$hostElement$["s-ei"] = this.internals;
|
|
216
|
+
}
|
|
22
217
|
this.addController(new ariaValidationController.AriaValidationController(this));
|
|
218
|
+
this.addController(this.listboxController);
|
|
23
219
|
}
|
|
24
220
|
lmvzChange;
|
|
25
221
|
value;
|
|
26
222
|
label;
|
|
27
223
|
helperText;
|
|
224
|
+
nativeError = false;
|
|
225
|
+
errorFromProp = false;
|
|
226
|
+
get error() {
|
|
227
|
+
return this.errorFromProp || this.nativeError;
|
|
228
|
+
}
|
|
229
|
+
set error(value) {
|
|
230
|
+
this.errorFromProp = value;
|
|
231
|
+
}
|
|
232
|
+
errorMessage;
|
|
28
233
|
disabled = false;
|
|
29
234
|
required = false;
|
|
30
235
|
name;
|
|
31
236
|
size = 'default';
|
|
32
237
|
highlighted = false;
|
|
33
238
|
selectedLabel = '';
|
|
239
|
+
selectedId;
|
|
240
|
+
activeId;
|
|
241
|
+
isOpen = false;
|
|
242
|
+
optionGroups = [];
|
|
34
243
|
get hasValue() {
|
|
35
244
|
return Boolean(this.value);
|
|
36
245
|
}
|
|
246
|
+
componentWillLoad() {
|
|
247
|
+
this.updateValidity();
|
|
248
|
+
super.componentWillLoad();
|
|
249
|
+
}
|
|
37
250
|
componentDidLoad() {
|
|
38
|
-
this.
|
|
251
|
+
this.handleSlotChange();
|
|
252
|
+
this.observeSlottedOptionMutations();
|
|
253
|
+
this.updateValidity();
|
|
39
254
|
super.componentDidLoad();
|
|
40
255
|
}
|
|
256
|
+
disconnectedCallback() {
|
|
257
|
+
this.optionsMutationObserver?.disconnect();
|
|
258
|
+
super.disconnectedCallback();
|
|
259
|
+
}
|
|
260
|
+
observeSlottedOptionMutations() {
|
|
261
|
+
if (typeof MutationObserver === 'undefined')
|
|
262
|
+
return;
|
|
263
|
+
this.optionsMutationObserver?.disconnect();
|
|
264
|
+
this.optionsMutationObserver = new MutationObserver(this.handleSlotChange);
|
|
265
|
+
this.optionsMutationObserver.observe(this.el, {
|
|
266
|
+
attributes: true,
|
|
267
|
+
attributeFilter: ['disabled', 'selected', 'value', 'label'],
|
|
268
|
+
characterData: true,
|
|
269
|
+
childList: true,
|
|
270
|
+
subtree: true,
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
async focusTrigger() {
|
|
274
|
+
this.triggerEl?.focus();
|
|
275
|
+
}
|
|
276
|
+
async blurTrigger() {
|
|
277
|
+
this.triggerEl?.blur();
|
|
278
|
+
}
|
|
279
|
+
async checkValidity() {
|
|
280
|
+
return this.internals.checkValidity?.() ?? true;
|
|
281
|
+
}
|
|
282
|
+
async reportValidity() {
|
|
283
|
+
return this.internals.reportValidity?.() ?? true;
|
|
284
|
+
}
|
|
285
|
+
async getValidationMessage() {
|
|
286
|
+
return this.internals.validationMessage ?? '';
|
|
287
|
+
}
|
|
288
|
+
formAssociatedCallback(form) {
|
|
289
|
+
if (!form)
|
|
290
|
+
return;
|
|
291
|
+
this.internals.setFormValue?.(this.value ?? '');
|
|
292
|
+
}
|
|
293
|
+
formResetCallback() {
|
|
294
|
+
this.internals.setValidity?.({});
|
|
295
|
+
this.value = this.initialValue;
|
|
296
|
+
this.updateValidity();
|
|
297
|
+
}
|
|
298
|
+
formStateRestoreCallback(state) {
|
|
299
|
+
this.value = state;
|
|
300
|
+
}
|
|
41
301
|
handleValueChange(newValue) {
|
|
42
|
-
|
|
43
|
-
|
|
302
|
+
this.applySelectionFromValue();
|
|
303
|
+
if (this.selectedId && !this.isOpen) {
|
|
304
|
+
this.listboxController.setActiveId(this.selectedId);
|
|
44
305
|
}
|
|
45
|
-
this.
|
|
306
|
+
this.internals.setFormValue?.(newValue ?? '');
|
|
307
|
+
this.updateValidity();
|
|
46
308
|
}
|
|
47
|
-
|
|
48
|
-
|
|
309
|
+
handleRequiredChange() {
|
|
310
|
+
this.updateValidity();
|
|
311
|
+
}
|
|
312
|
+
handleDisabledChange(disabled) {
|
|
313
|
+
if (!disabled)
|
|
49
314
|
return;
|
|
50
|
-
|
|
51
|
-
this.
|
|
315
|
+
this.closePopover();
|
|
316
|
+
this.triggerEl?.blur();
|
|
52
317
|
}
|
|
53
|
-
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
this.
|
|
318
|
+
handleSlotChange = () => {
|
|
319
|
+
const container = this.optionsSourceEl;
|
|
320
|
+
if (!container)
|
|
321
|
+
return;
|
|
322
|
+
const { flat, groups } = parseOptionElements(container, this.selectId);
|
|
323
|
+
this.flatOptions = flat;
|
|
324
|
+
this.optionsById = new Map(flat.map((option) => [option.id, option]));
|
|
325
|
+
this.optionGroups = groups;
|
|
326
|
+
if (!this.value) {
|
|
327
|
+
const preselected = flat.find((option) => option.selected && !option.disabled);
|
|
328
|
+
if (preselected) {
|
|
329
|
+
this.value = preselected.value;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
this.applySelectionFromValue();
|
|
333
|
+
this.listboxController.setOptions(flat.map(({ id, label, disabled }) => ({ id, label, disabled })));
|
|
334
|
+
if (!this.initialValueCaptured) {
|
|
335
|
+
this.initialValue = this.value;
|
|
336
|
+
this.initialValueCaptured = true;
|
|
337
|
+
}
|
|
338
|
+
};
|
|
339
|
+
applySelectionFromValue() {
|
|
340
|
+
const match = this.value ? this.flatOptions.find((option) => option.value === this.value) : undefined;
|
|
341
|
+
this.selectedId = match?.id;
|
|
342
|
+
this.selectedLabel = match?.label ?? '';
|
|
343
|
+
this.listboxController.setSelectedId(match?.id);
|
|
344
|
+
}
|
|
345
|
+
updateValidity() {
|
|
346
|
+
if (this.required && !this.value) {
|
|
347
|
+
this.internals.setValidity?.({ valueMissing: true }, 'Please select a value.', this.triggerEl);
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
this.internals.setValidity?.({});
|
|
351
|
+
this.nativeError = false;
|
|
352
|
+
}
|
|
353
|
+
handleInvalid() {
|
|
354
|
+
this.nativeError = true;
|
|
355
|
+
}
|
|
356
|
+
handleOptionSelect(id) {
|
|
357
|
+
const option = this.optionsById.get(id);
|
|
358
|
+
if (!option)
|
|
359
|
+
return;
|
|
360
|
+
const isNewValue = option.value !== this.value;
|
|
361
|
+
this.value = option.value;
|
|
362
|
+
if (isNewValue) {
|
|
363
|
+
this.lmvzChange.emit(option.value);
|
|
364
|
+
}
|
|
365
|
+
this.closePopover();
|
|
366
|
+
}
|
|
367
|
+
handleOptionClick = (option) => {
|
|
368
|
+
if (option.disabled || this.disabled)
|
|
369
|
+
return;
|
|
370
|
+
this.listboxController.selectOption(option.id);
|
|
58
371
|
};
|
|
372
|
+
handleLabelClick = () => {
|
|
373
|
+
if (this.disabled)
|
|
374
|
+
return;
|
|
375
|
+
this.triggerEl?.focus();
|
|
376
|
+
this.openPopover();
|
|
377
|
+
};
|
|
378
|
+
handleTriggerClick = () => {
|
|
379
|
+
if (this.disabled)
|
|
380
|
+
return;
|
|
381
|
+
if (this.isOpen) {
|
|
382
|
+
this.closePopover();
|
|
383
|
+
}
|
|
384
|
+
else {
|
|
385
|
+
this.openPopover();
|
|
386
|
+
}
|
|
387
|
+
};
|
|
388
|
+
handleTriggerKeydown = (event) => {
|
|
389
|
+
if (this.disabled)
|
|
390
|
+
return;
|
|
391
|
+
if (!this.isOpen) {
|
|
392
|
+
if (event.key === 'ArrowDown' || event.key === 'ArrowUp' || event.key === 'Enter' || event.key === ' ') {
|
|
393
|
+
event.preventDefault();
|
|
394
|
+
this.openPopover();
|
|
395
|
+
}
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
this.listboxController.handleKeydown(event);
|
|
399
|
+
};
|
|
400
|
+
handleTriggerBlur = () => {
|
|
401
|
+
this.closePopover();
|
|
402
|
+
};
|
|
403
|
+
handlePopoverClose = () => {
|
|
404
|
+
this.isOpen = false;
|
|
405
|
+
this.listboxController.clearTypeahead();
|
|
406
|
+
};
|
|
407
|
+
openPopover() {
|
|
408
|
+
if (this.isOpen || this.disabled)
|
|
409
|
+
return;
|
|
410
|
+
this.isOpen = true;
|
|
411
|
+
}
|
|
412
|
+
closePopover() {
|
|
413
|
+
if (!this.isOpen)
|
|
414
|
+
return;
|
|
415
|
+
this.isOpen = false;
|
|
416
|
+
this.listboxController.clearTypeahead();
|
|
417
|
+
}
|
|
418
|
+
renderOptionGroups() {
|
|
419
|
+
return this.optionGroups.map((group, groupIndex) => group.label ? (index.h("div", { role: "group", "aria-label": group.label, key: `lmvz-select-group-${groupIndex}` }, group.options.map((option) => this.renderOption(option)))) : (group.options.map((option) => this.renderOption(option))));
|
|
420
|
+
}
|
|
421
|
+
renderOption(option) {
|
|
422
|
+
return (index.h("div", { id: option.id, key: option.id, role: "option", class: "lmvz-select-option", "aria-selected": option.id === this.selectedId ? 'true' : 'false', "aria-disabled": option.disabled ? 'true' : undefined, "data-active": option.id === this.activeId ? 'true' : undefined, onMouseDown: (event) => event.preventDefault(), onClick: () => this.handleOptionClick(option) }, option.label));
|
|
423
|
+
}
|
|
59
424
|
render() {
|
|
60
425
|
const hasValue = this.hasValue;
|
|
61
426
|
const shouldShowLabel = hasValue;
|
|
62
|
-
return (index.h(index.Host, { key: '
|
|
427
|
+
return (index.h(index.Host, { key: '0bcc303a802db20a6be6558b8add53d0fa398493', "data-highlighted": String(this.highlighted) }, index.h("div", { key: 'e248f8277b4786b34dfd064cb9c7b70302cf018a', class: hasValue ? 'select-wrapper has-value' : 'select-wrapper' }, index.h("label", { key: '1c97c830d5782cadad98fb895d70c438031d3457', htmlFor: this.triggerId, class: shouldShowLabel ? 'floating-label' : 'assistive-label', onMouseDown: (event) => event.preventDefault(), onClick: this.handleLabelClick }, this.label, this.required && shouldShowLabel && index.h("span", { key: '16157962846bffc111f5c672852f7b23e9ed2b73', "aria-hidden": "true" }, " *")), index.h("div", { key: 'bc5e3e6b335723cfd9872ff955a1e8d664d4eeb8', id: this.triggerId, ref: (el) => (this.triggerEl = el), class: "select-trigger", role: "combobox", tabIndex: this.disabled ? -1 : 0, "aria-haspopup": "listbox", "aria-expanded": String(this.isOpen), "aria-controls": this.popoverId, "aria-activedescendant": this.isOpen ? this.activeId : undefined, "aria-label": hasValue ? `${this.label}, ${this.selectedLabel}` : this.label, "aria-disabled": this.disabled ? 'true' : undefined, "aria-required": this.required ? 'true' : 'false', "aria-invalid": this.error ? 'true' : 'false', "aria-errormessage": this.showErrorMessage ? this.errorId : undefined, "aria-describedby": this.describedBy, onClick: this.handleTriggerClick, onKeyDown: this.handleTriggerKeydown, onBlur: this.handleTriggerBlur }, index.h("span", { key: '620c6108f679c8e5563c0e21d7b89d71434c01a2' }, hasValue ? this.selectedLabel : this.label, this.required && !hasValue && index.h("span", { key: 'a2183941c7843bae3e9989f8e8b26be28fbbf6d7', "aria-hidden": "true" }, " *")), index.h("span", { key: 'b57e14bda44dc0de5a35623a5cb203b7f570c802', "aria-hidden": "true" }, index.h("svg", { key: '71ac319e398f07f7e65fe1f73f6d2a7c08b631a8', width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { key: '80b4a978471251ee8d2cce2d74a48fad750db125', d: "M20.3334 8.66663L12.0001 17L3.66675 8.66663", stroke: "currentColor", "stroke-width": "1.75", "stroke-linecap": "round", "stroke-linejoin": "round" })))), index.h("lmvz-popover", { key: '15528c9a3f1404c385f4eb865cf78ef5891dcb32', id: this.popoverId, anchor: this.triggerId, open: this.isOpen, containerRole: "listbox", autoFocus: false, label: this.label, onLmvzClose: this.handlePopoverClose, size: "sm" }, this.renderOptionGroups()), index.h("div", { key: 'f1b833973497e6dfd2013522e067382c73baa7a1', class: "lmvz-select-native-options", hidden: true, "aria-hidden": "true", ref: (el) => (this.optionsSourceEl = el) }, index.h("slot", { key: '670bf62c50cbdd965342279b99e303614771ffa1', onSlotchange: this.handleSlotChange }))), this.helperText && (index.h("div", { key: '849e35da09bff25896b08f275c265baa0ee12960', id: this.helperId, role: "status" }, this.helperText)), this.showErrorMessage && (index.h("div", { key: 'd01c2dca8767aa815d08d895f308c42150cc3263', id: this.errorId, role: "alert" }, this.errorMessage))));
|
|
63
428
|
}
|
|
429
|
+
static get formAssociated() { return true; }
|
|
64
430
|
static get watchers() { return {
|
|
65
431
|
"value": [{
|
|
66
432
|
"handleValueChange": 0
|
|
433
|
+
}],
|
|
434
|
+
"required": [{
|
|
435
|
+
"handleRequiredChange": 0
|
|
436
|
+
}],
|
|
437
|
+
"disabled": [{
|
|
438
|
+
"handleDisabledChange": 0
|
|
67
439
|
}]
|
|
68
440
|
}; }
|
|
69
441
|
};
|
|
442
|
+
function parseOptionElements(container, idPrefix) {
|
|
443
|
+
const flat = [];
|
|
444
|
+
const groups = [];
|
|
445
|
+
let looseGroup;
|
|
446
|
+
let optionIndex = 0;
|
|
447
|
+
const toOptionData = (optionEl, disabledOverride = false) => {
|
|
448
|
+
const option = optionEl;
|
|
449
|
+
const data = {
|
|
450
|
+
id: `${idPrefix}-option-${optionIndex++}`,
|
|
451
|
+
value: option.value,
|
|
452
|
+
label: (option.textContent ?? '').trim(),
|
|
453
|
+
disabled: disabledOverride || option.disabled,
|
|
454
|
+
selected: option.selected,
|
|
455
|
+
};
|
|
456
|
+
flat.push(data);
|
|
457
|
+
return data;
|
|
458
|
+
};
|
|
459
|
+
Array.from(container.children).forEach((child) => {
|
|
460
|
+
if (child.tagName === 'OPTGROUP') {
|
|
461
|
+
looseGroup = undefined;
|
|
462
|
+
const optgroup = child;
|
|
463
|
+
const options = Array.from(optgroup.querySelectorAll('option')).map((option) => toOptionData(option, optgroup.disabled));
|
|
464
|
+
groups.push({ label: optgroup.label || undefined, options });
|
|
465
|
+
return;
|
|
466
|
+
}
|
|
467
|
+
if (child.tagName === 'OPTION') {
|
|
468
|
+
if (!looseGroup) {
|
|
469
|
+
looseGroup = { label: undefined, options: [] };
|
|
470
|
+
groups.push(looseGroup);
|
|
471
|
+
}
|
|
472
|
+
looseGroup.options.push(toOptionData(child));
|
|
473
|
+
}
|
|
474
|
+
});
|
|
475
|
+
return { flat, groups };
|
|
476
|
+
}
|
|
70
477
|
LmvzSelect.style = lmvzSelectCss();
|
|
71
478
|
|
|
72
479
|
exports.lmvz_select = LmvzSelect;
|
|
@@ -67,7 +67,7 @@ const LmvzSnackbar = class {
|
|
|
67
67
|
this.el.dispatchEvent(new CustomEvent('lmvzAction', { bubbles: false, composed: false }));
|
|
68
68
|
};
|
|
69
69
|
render() {
|
|
70
|
-
return (index.h(index.Host, { key: '
|
|
70
|
+
return (index.h(index.Host, { key: 'f58c7657bf5511c72930dfc54ace4af1ff7f3554', class: this.animationClass }, index.h("lmvz-icon", { key: '8632b42b9b246bf58480fb17ca336ce5f0883845', icon: STATUS_SVG[this.status], size: "md", weight: "bold" }), index.h("span", { key: '4ca56d2cdf29415c6d21cc50399dc28aebb8de99', class: "message" }, this.message), this.actionLabel && (index.h("lmvz-button", { key: 'd09043056b968421143aa180f464effcd7b781fe', variant: "tertiary", scale: "small", onLmvzActivation: this.handleActionClick }, this.actionLabel))));
|
|
71
71
|
}
|
|
72
72
|
static get watchers() { return {
|
|
73
73
|
"status": [{
|
|
@@ -12,7 +12,7 @@ const LmvzSpinner = class {
|
|
|
12
12
|
ariaLabel;
|
|
13
13
|
render() {
|
|
14
14
|
const hasLabel = !!this.ariaLabel?.trim();
|
|
15
|
-
return (index.h(index.Host, { key: '
|
|
15
|
+
return (index.h(index.Host, { key: 'cf60fcf652f377a66596cc51138bb73f7465a4e7', role: hasLabel ? 'status' : undefined, "aria-label": hasLabel ? this.ariaLabel : undefined, "aria-hidden": hasLabel ? undefined : 'true' }, index.h("svg", { key: '121ab46a591242fbc0f1c3540e8f2a7b72c9582a', part: "indicator", viewBox: "0 0 16 16", "aria-hidden": "true" }, index.h("circle", { key: 'fe649394c9bd6e7a06113e9a50b595bb890a6fac', pathLength: "100", cx: "8", cy: "8", r: "6" }))));
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
18
|
LmvzSpinner.style = lmvzSpinnerCss();
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var index = require('./index-BgvZ4y-3.js');
|
|
4
4
|
|
|
5
|
-
const lmvzTabCss = () => ` @layer lmvz-ds.reset, lmvz-ds.theme, lmvz-ds.components, lmvz-ds.overrides; @layer lmvz-ds.reset { body { margin: 0; } h1, h2, h3, h4, h5, h6 { margin: 0; } *[hidden] { display: none !important; } hr { height: 0; border: none; margin: var(--lmvz-dimension-8-4, clamp(0.25rem, 0.19rem + 0.26vw, 0.5rem)) 0; border-top: var(--lmvz-semantic-border-width-default, 1px) solid var(--lmvz-semantic-color-border-subtle, #f0f0f0); } } :host { display: inline-block; flex: none; } :host([disabled]) { cursor: not-allowed; pointer-events: none; } button { --lmvz-tab-color: var(--lmvz-semantic-color-int-on-secondary, #000000); --lmvz-tab-background: var(--lmvz-semantic-color-int-secondary, #f0f0f0); position: relative; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--lmvz-component-component-spacing-0-default, 4px); padding-top: var(--lmvz-dimension-12-8, clamp(0.5rem, 0.44rem + 0.26vw, 0.75rem)); padding-bottom: var(--lmvz-dimension-14-8, clamp(0.5rem, 0.41rem + 0.39vw, 0.88rem)); padding-inline: var(--lmvz-dimension-24-16, clamp(1rem, 0.88rem + 0.52vw, 1.5rem)); border: none; border-radius: var(--lmvz-semantic-border-radius-round, 999px); background: var(--lmvz-tab-background); color: var(--lmvz-tab-color); font: var(--lmvz-typography-body-md-strong, 500 clamp(0.88rem, 0.84rem + 0.13vw, 1rem) / 1.5 Router); cursor: pointer; white-space: nowrap; transition: background-color 0.15s ease, color 0.15s ease; } button:focus-visible { outline: var(--lmvz-ds-outline, 1px solid #0e7ab4); outline-offset: var(--lmvz-ds-outline-offset, clamp(0.25rem, 0.19rem + 0.26vw, 0.5rem)); z-index: 1; } button:disabled { opacity: var(--lmvz-component-input-disabled-opacity, 40%); pointer-events: none; cursor: not-allowed; } button:hover { --lmvz-tab-background: var(--lmvz-semantic-color-int-tertiary-hover, #f0f0f0); --lmvz-tab-color: var(--lmvz-semantic-color-int-on-secondary-hover, #000000); } button:active { --lmvz-tab-background: var(--lmvz-semantic-color-int-tertiary-active, #e0e0e0); --lmvz-tab-color: var(--lmvz-semantic-color-int-on-secondary-active, #000000); } :host([has-media]) { --lmvz-tab-color: var(--lmvz-semantic-color-int-on-tertiary, #000000); --lmvz-tab-background: var(--lmvz-semantic-color-int-tertiary, #ffffff); } :host([has-media]) button { padding-top: var(--lmvz-dimension-18-16, clamp(1rem, 0.97rem + 0.13vw, 1.13rem)); padding-bottom: var(--lmvz-dimension-14-12, clamp(0.75rem, 0.72rem + 0.13vw, 0.88rem)); padding-inline: var(--lmvz-dimension-48-40, clamp(2.5rem, 2.38rem + 0.52vw, 3rem)); border-radius: var(--lmvz-semantic-border-radius-lg, 14px); } :host([has-media]) button:hover { --lmvz-tab-color: var(--lmvz-semantic-color-int-on-tertiary-hover, #000000); } :host([has-media]) button:active { --lmvz-tab-color: var(--lmvz-semantic-color-int-on-tertiary-active, #000000); } :host([selected]) button { --lmvz-tab-color: var(--lmvz-semantic-color-status-on-active, #0e7ab4); --lmvz-tab-background: var(--lmvz-semantic-color-status-active, #f6fbfe); } :host([selected][has-media]) button:hover, :host([selected][has-media]) button:active { --lmvz-tab-color: var(--lmvz-semantic-color-status-on-active, #0e7ab4); } .indicator { --lmvz-tab-indicator-size: 4px; position: absolute; background: linear-gradient(to right, var(--lmvz-semantic-color-gradient-main-1, #0e7ab4), var(--lmvz-semantic-color-gradient-main-2, #0e7ab4)); opacity: 0; transition: opacity 0.15s ease; inset-block-end: 0; inset-inline: 0; block-size: var(--lmvz-tab-indicator-size); border-start-start-radius: 0; border-start-end-radius: 0; border-end-start-radius: var(--lmvz-tab-indicator-size); border-end-end-radius: var(--lmvz-tab-indicator-size); } :host([selected][has-media]) .indicator { opacity: 1; } :host([vertical]) button { border-radius: var(--lmvz-semantic-border-radius-round, 999px); } :host([vertical]) .indicator { inset-block: 0; inset-inline: 0 auto; inline-size: var(--lmvz-tab-indicator-size); block-size: auto; border-radius: 0 var(--lmvz-tab-indicator-size) var(--lmvz-tab-indicator-size) 0; background: linear-gradient(to bottom, var(--lmvz-semantic-color-gradient-main-1, #0e7ab4), var(--lmvz-semantic-color-gradient-main-2, #0e7ab4)); } ::slotted(*) { --lmvz-component-color: var(--lmvz-tab-color); } ::slotted(lmvz-icon) { --lmvz-component-size: var(--lmvz-dimension-18-16, clamp(1rem, 0.97rem + 0.13vw, 1.13rem)); } :host([has-media]) ::slotted(lmvz-icon) { --lmvz-component-size: var(--lmvz-component-icon-size-lg, clamp(1.25rem, 1.19rem + 0.26vw, 1.5rem)); } .label { display: contents; } `;
|
|
5
|
+
const lmvzTabCss = () => ` @layer lmvz-ds.reset, lmvz-ds.theme, lmvz-ds.components, lmvz-ds.overrides; @layer lmvz-ds.reset { body { margin: 0; } h1, h2, h3, h4, h5, h6 { margin: 0; } *[hidden] { display: none !important; } hr { height: 0; border: none; margin: var(--lmvz-dimension-8-4, clamp(0.25rem, 0.19rem + 0.26vw, 0.5rem)) 0; border-top: var(--lmvz-semantic-border-width-default, 1px) solid var(--lmvz-semantic-color-border-subtle, #f0f0f0); } fieldset { border: none; margin: 0; padding: 0; } legend { padding: 0; display: block; } } :host { display: inline-block; flex: none; } :host([disabled]) { cursor: not-allowed; pointer-events: none; } button { --lmvz-tab-color: var(--lmvz-semantic-color-int-on-secondary, #000000); --lmvz-tab-background: var(--lmvz-semantic-color-int-secondary, #f0f0f0); position: relative; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--lmvz-component-component-spacing-0-default, 4px); padding-top: var(--lmvz-dimension-12-8, clamp(0.5rem, 0.44rem + 0.26vw, 0.75rem)); padding-bottom: var(--lmvz-dimension-14-8, clamp(0.5rem, 0.41rem + 0.39vw, 0.88rem)); padding-inline: var(--lmvz-dimension-24-16, clamp(1rem, 0.88rem + 0.52vw, 1.5rem)); border: none; border-radius: var(--lmvz-semantic-border-radius-round, 999px); background: var(--lmvz-tab-background); color: var(--lmvz-tab-color); font: var(--lmvz-typography-body-md-strong, 500 clamp(0.88rem, 0.84rem + 0.13vw, 1rem) / 1.5 Router); cursor: pointer; white-space: nowrap; transition: background-color 0.15s ease, color 0.15s ease; } button:focus-visible { outline: var(--lmvz-ds-outline, 1px solid #0e7ab4); outline-offset: var(--lmvz-ds-outline-offset, clamp(0.25rem, 0.19rem + 0.26vw, 0.5rem)); z-index: 1; } button:disabled { opacity: var(--lmvz-component-input-disabled-opacity, 40%); pointer-events: none; cursor: not-allowed; } button:hover { --lmvz-tab-background: var(--lmvz-semantic-color-int-tertiary-hover, #f0f0f0); --lmvz-tab-color: var(--lmvz-semantic-color-int-on-secondary-hover, #000000); } button:active { --lmvz-tab-background: var(--lmvz-semantic-color-int-tertiary-active, #e0e0e0); --lmvz-tab-color: var(--lmvz-semantic-color-int-on-secondary-active, #000000); } :host([has-media]) { --lmvz-tab-color: var(--lmvz-semantic-color-int-on-tertiary, #000000); --lmvz-tab-background: var(--lmvz-semantic-color-int-tertiary, #ffffff); } :host([has-media]) button { padding-top: var(--lmvz-dimension-18-16, clamp(1rem, 0.97rem + 0.13vw, 1.13rem)); padding-bottom: var(--lmvz-dimension-14-12, clamp(0.75rem, 0.72rem + 0.13vw, 0.88rem)); padding-inline: var(--lmvz-dimension-48-40, clamp(2.5rem, 2.38rem + 0.52vw, 3rem)); border-radius: var(--lmvz-semantic-border-radius-lg, 14px); } :host([has-media]) button:hover { --lmvz-tab-color: var(--lmvz-semantic-color-int-on-tertiary-hover, #000000); } :host([has-media]) button:active { --lmvz-tab-color: var(--lmvz-semantic-color-int-on-tertiary-active, #000000); } :host([selected]) button { --lmvz-tab-color: var(--lmvz-semantic-color-status-on-active, #0e7ab4); --lmvz-tab-background: var(--lmvz-semantic-color-status-active, #f6fbfe); } :host([selected][has-media]) button:hover, :host([selected][has-media]) button:active { --lmvz-tab-color: var(--lmvz-semantic-color-status-on-active, #0e7ab4); } .indicator { --lmvz-tab-indicator-size: 4px; position: absolute; background: linear-gradient(to right, var(--lmvz-semantic-color-gradient-main-1, #0e7ab4), var(--lmvz-semantic-color-gradient-main-2, #0e7ab4)); opacity: 0; transition: opacity 0.15s ease; inset-block-end: 0; inset-inline: 0; block-size: var(--lmvz-tab-indicator-size); border-start-start-radius: 0; border-start-end-radius: 0; border-end-start-radius: var(--lmvz-tab-indicator-size); border-end-end-radius: var(--lmvz-tab-indicator-size); } :host([selected][has-media]) .indicator { opacity: 1; } :host([vertical]) button { border-radius: var(--lmvz-semantic-border-radius-round, 999px); } :host([vertical]) .indicator { inset-block: 0; inset-inline: 0 auto; inline-size: var(--lmvz-tab-indicator-size); block-size: auto; border-radius: 0 var(--lmvz-tab-indicator-size) var(--lmvz-tab-indicator-size) 0; background: linear-gradient(to bottom, var(--lmvz-semantic-color-gradient-main-1, #0e7ab4), var(--lmvz-semantic-color-gradient-main-2, #0e7ab4)); } ::slotted(*) { --lmvz-component-color: var(--lmvz-tab-color); } ::slotted(lmvz-icon) { --lmvz-component-size: var(--lmvz-dimension-18-16, clamp(1rem, 0.97rem + 0.13vw, 1.13rem)); } :host([has-media]) ::slotted(lmvz-icon) { --lmvz-component-size: var(--lmvz-component-icon-size-lg, clamp(1.25rem, 1.19rem + 0.26vw, 1.5rem)); } .label { display: contents; } `;
|
|
6
6
|
|
|
7
7
|
const LmvzTab = class {
|
|
8
8
|
constructor(hostRef) {
|
|
@@ -22,7 +22,7 @@ const LmvzTab = class {
|
|
|
22
22
|
this.el.dispatchEvent(new CustomEvent('lmvzTabReady', { bubbles: true, composed: false }));
|
|
23
23
|
}
|
|
24
24
|
render() {
|
|
25
|
-
return (index.h(index.Host, { key: '
|
|
25
|
+
return (index.h(index.Host, { key: '4380fe35cacb11bc7114664c126504e8f4fb09a0' }, index.h("button", { key: 'ac77443cbba5c94f864820088f60c0bac23d0775', part: "button", role: "tab", disabled: this.disabled, "aria-selected": String(this.selected), "aria-disabled": this.disabled ? 'true' : undefined, tabIndex: 0 }, index.h("slot", { key: '9988497505ca3effa6c41011ac408a5d25629ca1', name: "media", ref: (el) => (this.mediaSlotEl = el), onSlotchange: this.handleMediaSlotChange }), index.h("span", { key: '70566c46fba36b8717aa82917e45abd39cd7a2ea', class: "label" }, index.h("slot", { key: 'a595738c387ee2f4f77f6ccdfdfb0589751ce999' })), index.h("span", { key: '933758dc965d1151ca6a96367ea40290189384ad', "aria-hidden": "true", part: "indicator", class: "indicator" }))));
|
|
26
26
|
}
|
|
27
27
|
static get delegatesFocus() { return true; }
|
|
28
28
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-BgvZ4y-3.js');
|
|
4
|
-
var directionalFocusController = require('./directional-focus-controller-
|
|
4
|
+
var directionalFocusController = require('./directional-focus-controller-8Xd_7MHT.js');
|
|
5
5
|
var reactiveControllerHost = require('./reactive-controller-host-Bc6B_T45.js');
|
|
6
|
-
require('./element.util-
|
|
6
|
+
require('./element.util-BlhcwmfR.js');
|
|
7
|
+
require('./aria.constants-DPK5mQEL.js');
|
|
7
8
|
|
|
8
|
-
const lmvzTabsCss = () => ` @layer lmvz-ds.reset, lmvz-ds.theme, lmvz-ds.components, lmvz-ds.overrides; @layer lmvz-ds.reset { body { margin: 0; } h1, h2, h3, h4, h5, h6 { margin: 0; } *[hidden] { display: none !important; } hr { height: 0; border: none; margin: var(--lmvz-dimension-8-4, clamp(0.25rem, 0.19rem + 0.26vw, 0.5rem)) 0; border-top: var(--lmvz-semantic-border-width-default, 1px) solid var(--lmvz-semantic-color-border-subtle, #f0f0f0); } } :host { display: inline-block; } .tablist { display: inline-flex; flex-direction: row; background: var(--lmvz-semantic-color-int-secondary, #f0f0f0); border-radius: var(--lmvz-semantic-border-radius-round, 999px); overflow: auto hidden; scrollbar-width: none; } .tablist::-webkit-scrollbar { display: none; } :host([has-icon-tabs]) .tablist { gap: var(--lmvz-dimension-8-6, clamp(0.38rem, 0.34rem + 0.13vw, 0.5rem)); background: none; border-radius: 0; } :host([orientation='vertical']) .tablist { flex-direction: column; overflow: visible auto; } ::slotted([role='tabpanel']) { display: block; } ::slotted([role='tabpanel'][hidden]) { display: none; } `;
|
|
9
|
+
const lmvzTabsCss = () => ` @layer lmvz-ds.reset, lmvz-ds.theme, lmvz-ds.components, lmvz-ds.overrides; @layer lmvz-ds.reset { body { margin: 0; } h1, h2, h3, h4, h5, h6 { margin: 0; } *[hidden] { display: none !important; } hr { height: 0; border: none; margin: var(--lmvz-dimension-8-4, clamp(0.25rem, 0.19rem + 0.26vw, 0.5rem)) 0; border-top: var(--lmvz-semantic-border-width-default, 1px) solid var(--lmvz-semantic-color-border-subtle, #f0f0f0); } fieldset { border: none; margin: 0; padding: 0; } legend { padding: 0; display: block; } } :host { display: inline-block; } .tablist { display: inline-flex; flex-direction: row; background: var(--lmvz-semantic-color-int-secondary, #f0f0f0); border-radius: var(--lmvz-semantic-border-radius-round, 999px); overflow: auto hidden; scrollbar-width: none; } .tablist::-webkit-scrollbar { display: none; } :host([has-icon-tabs]) .tablist { gap: var(--lmvz-dimension-8-6, clamp(0.38rem, 0.34rem + 0.13vw, 0.5rem)); background: none; border-radius: 0; } :host([orientation='vertical']) .tablist { flex-direction: column; overflow: visible auto; } ::slotted([role='tabpanel']) { display: block; } ::slotted([role='tabpanel'][hidden]) { display: none; } `;
|
|
9
10
|
|
|
10
11
|
let tabsIdCounter = 0;
|
|
11
12
|
const LmvzTabs = class extends reactiveControllerHost.ReactiveControllerHost {
|
|
@@ -243,7 +244,7 @@ const LmvzTabs = class extends reactiveControllerHost.ReactiveControllerHost {
|
|
|
243
244
|
this.selectTab(value);
|
|
244
245
|
};
|
|
245
246
|
render() {
|
|
246
|
-
return (index.h(index.Host, { key: '
|
|
247
|
+
return (index.h(index.Host, { key: '33205038c047420618800be3ef755e1d13a0127c', onClick: this.handleTabClick, onKeydown: this.handleKeydown }, index.h("div", { key: 'e803f772c5b187326fc80cfa2d3b9d74f6ee1df8', role: "tablist", "aria-orientation": this.orientation, class: "tablist" }, index.h("slot", { key: '6871a7b6b26c6251ceb544c03b245450aa53373d', ref: (el) => (this.tabSlotEl = el) })), index.h("div", { key: '17721962da2ecf107a5b878dea996812c61be998', part: "panels-container", class: "panels-container" }, index.h("slot", { key: '485de66efc7812ecb2368a6b01b0d8ab63971497', name: "panels", ref: (el) => (this.panelSlotEl = el) }))));
|
|
247
248
|
}
|
|
248
249
|
static get watchers() { return {
|
|
249
250
|
"value": [{
|