@lmvz-ds/components 0.36.0 → 0.36.1
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 +8 -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 +3 -2
- package/cjs/lmvz-button-group.cjs.entry.js +2 -1
- package/cjs/lmvz-button_2.cjs.entry.js +3 -2
- 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 +2 -1
- 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 +1 -1
- package/cjs/lmvz-tabs.cjs.entry.js +4 -3
- 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-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-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.js +1 -1
- 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-checkbox.js +1 -1
- package/components/lmvz-datepicker.js +1 -1
- package/components/lmvz-input.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/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 +3 -2
- package/esm/lmvz-button-group.entry.js +2 -1
- package/esm/lmvz-button_2.entry.js +3 -2
- 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 +2 -1
- 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 +1 -1
- package/esm/lmvz-tabs.entry.js +4 -3
- 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 +625 -68
- package/hydrate/index.mjs +625 -68
- package/lmvz-components/lmvz-components.esm.js +1 -1
- 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-36f44108.entry.js +1 -0
- package/lmvz-components/p-398b5cf4.entry.js +1 -0
- package/lmvz-components/p-3a396fc8.entry.js +1 -0
- package/lmvz-components/p-40716828.entry.js +1 -0
- package/lmvz-components/p-70f1e31a.entry.js +1 -0
- package/lmvz-components/p-71d06d1d.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-dbfbcb74.entry.js → p-a99acb02.entry.js} +1 -1
- package/lmvz-components/p-bh9cItsP.js +1 -0
- package/lmvz-components/p-f16a19fc.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-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-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-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
|
@@ -1,224 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { c as classNames } from './index-BfTCfPZ1.js';
|
|
3
|
-
import { A as AriaValidationController } from './aria-validation-controller-Cp6pofER.js';
|
|
4
|
-
import { m as ariaHostMirrorAttributes, f as isActionButton, g as getDeepActiveElement, n as isHtmlElement, w as walkShadowDOMUntil, c as isInteractiveElement, k as canReceiveFocus } from './element.util-Bd9JyKJZ.js';
|
|
5
|
-
import { R as ReactiveControllerHost } from './reactive-controller-host-CICeIanv.js';
|
|
6
|
-
import { c as componentOnReady, w as wait, a as waitFrame } from './stencil.util-C3QOYC8E.js';
|
|
1
|
+
import { r as registerInstance, c as createEvent, g as getElement, h, H as Host } from './index-BOXP1Vx0.js';
|
|
7
2
|
import { i as isAriaValidationEnabled } from './aria-loader-BfH06m7H.js';
|
|
8
|
-
import { i as isFocusControllerHost } from './directional-focus-controller-
|
|
9
|
-
import { a as addElementActivationListener } from './element-activation-controller-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const LmvzInput = class extends ReactiveControllerHost {
|
|
15
|
-
get el() { return getElement(this); }
|
|
16
|
-
get validationEl() {
|
|
17
|
-
return this.el;
|
|
18
|
-
}
|
|
19
|
-
lmvzInput;
|
|
20
|
-
internals;
|
|
21
|
-
nativeInputElement;
|
|
22
|
-
inputId = `lmvz-input-${inputIdCounter++}`;
|
|
23
|
-
initialValue = '';
|
|
24
|
-
ariaHostMirrorObserver;
|
|
25
|
-
nativeError = false;
|
|
26
|
-
errorFromProp = false;
|
|
27
|
-
get helperId() {
|
|
28
|
-
return this.helperText ? `${this.inputId}-helper` : undefined;
|
|
29
|
-
}
|
|
30
|
-
get showErrorMessage() {
|
|
31
|
-
return this.error && Boolean(this.errorMessage);
|
|
32
|
-
}
|
|
33
|
-
get errorId() {
|
|
34
|
-
return `${this.inputId}-error`;
|
|
35
|
-
}
|
|
36
|
-
get describedBy() {
|
|
37
|
-
const ids = [];
|
|
38
|
-
if (this.helperId)
|
|
39
|
-
ids.push(this.helperId);
|
|
40
|
-
if (this.showErrorMessage)
|
|
41
|
-
ids.push(this.errorId);
|
|
42
|
-
return ids.length > 0 ? ids.join(' ') : undefined;
|
|
43
|
-
}
|
|
44
|
-
value;
|
|
45
|
-
label;
|
|
46
|
-
helperText;
|
|
47
|
-
placeholder;
|
|
48
|
-
disabled = false;
|
|
49
|
-
readonly = false;
|
|
50
|
-
required = false;
|
|
51
|
-
name;
|
|
52
|
-
type = 'text';
|
|
53
|
-
errorMessage;
|
|
54
|
-
autocomplete;
|
|
55
|
-
inputmode;
|
|
56
|
-
autocorrect;
|
|
57
|
-
autocapitalize;
|
|
58
|
-
spellcheck;
|
|
59
|
-
autofocus = false;
|
|
60
|
-
minlength;
|
|
61
|
-
maxlength;
|
|
62
|
-
pattern;
|
|
63
|
-
min;
|
|
64
|
-
max;
|
|
65
|
-
step;
|
|
66
|
-
form;
|
|
67
|
-
size = 'md';
|
|
68
|
-
get error() {
|
|
69
|
-
return this.errorFromProp || this.nativeError;
|
|
70
|
-
}
|
|
71
|
-
set error(value) {
|
|
72
|
-
this.errorFromProp = value;
|
|
73
|
-
}
|
|
74
|
-
async setValue(newValue) {
|
|
75
|
-
const input = this.nativeInputElement;
|
|
76
|
-
const val = newValue ?? '';
|
|
77
|
-
if (input) {
|
|
78
|
-
input.value = val;
|
|
79
|
-
}
|
|
80
|
-
this.value = val;
|
|
81
|
-
this.internals.setFormValue?.(val);
|
|
82
|
-
this.lmvzInput.emit(val);
|
|
83
|
-
}
|
|
84
|
-
async focusInput() {
|
|
85
|
-
this.nativeInputElement?.focus();
|
|
86
|
-
}
|
|
87
|
-
async blurInput() {
|
|
88
|
-
this.nativeInputElement?.blur();
|
|
89
|
-
}
|
|
90
|
-
async select() {
|
|
91
|
-
this.nativeInputElement?.select();
|
|
92
|
-
}
|
|
93
|
-
async checkValidity() {
|
|
94
|
-
return this.nativeInputElement?.checkValidity?.() ?? false;
|
|
95
|
-
}
|
|
96
|
-
async reportValidity() {
|
|
97
|
-
return this.nativeInputElement?.reportValidity?.() ?? false;
|
|
98
|
-
}
|
|
99
|
-
async getInputElement() {
|
|
100
|
-
if (!this.nativeInputElement) {
|
|
101
|
-
await new Promise((resolve) => componentOnReady(this.el, resolve));
|
|
102
|
-
}
|
|
103
|
-
return Promise.resolve(this.nativeInputElement);
|
|
104
|
-
}
|
|
105
|
-
constructor(hostRef) {
|
|
106
|
-
super();
|
|
107
|
-
registerInstance(this, hostRef);
|
|
108
|
-
this.lmvzInput = createEvent(this, "lmvzInput", 7);
|
|
109
|
-
if (hostRef.$hostElement$["s-ei"]) {
|
|
110
|
-
this.internals = hostRef.$hostElement$["s-ei"];
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
this.internals = hostRef.$hostElement$.attachInternals();
|
|
114
|
-
hostRef.$hostElement$["s-ei"] = this.internals;
|
|
115
|
-
}
|
|
116
|
-
this.addController(new AriaValidationController(this, {
|
|
117
|
-
reValidateOnPropChanges: true,
|
|
118
|
-
}));
|
|
119
|
-
}
|
|
120
|
-
componentWillLoad() {
|
|
121
|
-
this.initialValue = this.value ?? '';
|
|
122
|
-
super.componentWillLoad();
|
|
123
|
-
}
|
|
124
|
-
connectedCallback() {
|
|
125
|
-
super.connectedCallback();
|
|
126
|
-
this.ariaHostMirrorObserver = new MutationObserver((mutations) => {
|
|
127
|
-
for (const mutation of mutations) {
|
|
128
|
-
this.mirrorHostAriaAttribute(mutation.attributeName);
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
this.ariaHostMirrorObserver.observe(this.el, {
|
|
132
|
-
attributes: true,
|
|
133
|
-
attributeFilter: [...ariaHostMirrorAttributes],
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
disconnectedCallback() {
|
|
137
|
-
super.disconnectedCallback();
|
|
138
|
-
this.ariaHostMirrorObserver?.disconnect();
|
|
139
|
-
this.ariaHostMirrorObserver = undefined;
|
|
140
|
-
}
|
|
141
|
-
componentDidLoad() {
|
|
142
|
-
super.componentDidLoad();
|
|
143
|
-
for (const attr of ariaHostMirrorAttributes) {
|
|
144
|
-
this.mirrorHostAriaAttribute(attr);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
mirrorHostAriaAttribute(attr) {
|
|
148
|
-
if (!attr || !this.nativeInputElement)
|
|
149
|
-
return;
|
|
150
|
-
if (this.el.hasAttribute(attr)) {
|
|
151
|
-
const value = this.el.getAttribute(attr);
|
|
152
|
-
if (value !== null) {
|
|
153
|
-
this.nativeInputElement.setAttribute(attr, value);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
this.nativeInputElement.removeAttribute(attr);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
formAssociatedCallback(form) {
|
|
161
|
-
if (!form)
|
|
162
|
-
return;
|
|
163
|
-
this.internals.setFormValue?.(this.value ?? '');
|
|
164
|
-
}
|
|
165
|
-
formResetCallback() {
|
|
166
|
-
this.internals.setValidity({});
|
|
167
|
-
this.setValue(this.initialValue);
|
|
168
|
-
}
|
|
169
|
-
formStateRestoreCallback(state) {
|
|
170
|
-
this.setValue(state);
|
|
171
|
-
}
|
|
172
|
-
handleValueChange(newValue) {
|
|
173
|
-
if (!this.nativeInputElement)
|
|
174
|
-
return;
|
|
175
|
-
const isInternalChange = this.nativeInputElement.value === newValue;
|
|
176
|
-
if (isInternalChange)
|
|
177
|
-
return;
|
|
178
|
-
this.setValue(newValue);
|
|
179
|
-
}
|
|
180
|
-
handleDisabledChange(disabled) {
|
|
181
|
-
if (disabled && this.nativeInputElement) {
|
|
182
|
-
this.nativeInputElement.blur();
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
handleInput = (event) => {
|
|
186
|
-
const input = event.target;
|
|
187
|
-
this.setValue(input.value);
|
|
188
|
-
};
|
|
189
|
-
handleChange = (event) => {
|
|
190
|
-
const input = event.target ?? this.nativeInputElement;
|
|
191
|
-
this.updateNativeError(input);
|
|
192
|
-
};
|
|
193
|
-
handleFocus = () => { };
|
|
194
|
-
handleBlur = (event) => {
|
|
195
|
-
const input = event.target;
|
|
196
|
-
input.checkValidity?.();
|
|
197
|
-
};
|
|
198
|
-
updateNativeError(fromEvent) {
|
|
199
|
-
const input = fromEvent ?? this.nativeInputElement;
|
|
200
|
-
if (!input)
|
|
201
|
-
return;
|
|
202
|
-
this.nativeError = !(input.checkValidity?.() ?? true);
|
|
203
|
-
}
|
|
204
|
-
render() {
|
|
205
|
-
const hasValue = Boolean(this.value);
|
|
206
|
-
const shouldFloatLabel = hasValue || Boolean(this.placeholder);
|
|
207
|
-
return (h("div", { key: 'b7e432c7dbc598189d85040252455c5163fe6395', class: classNames('input-container', {
|
|
208
|
-
'interaction-filled': hasValue,
|
|
209
|
-
}) }, h("div", { key: 'a912a49f4372423d06c7a4856fb5101cb0afd0c5', class: "input-wrapper" }, h("slot", { key: '88e4ee4518de0bfeef9e30a254e0d2ec6693048c', name: "before-input" }), h("div", { key: 'a413a7b7e8f6510f1c09fd0052889c8fad1653f1', class: "label-input-group" }, h("label", { key: '9639713adff74afcf4fb1eab0e74b7447d02b986', htmlFor: this.inputId, class: classNames({ floating: shouldFloatLabel }) }, this.label, this.required && (h("span", { key: '28c1069908a2f1905008f1decce9077e9ef1538a', class: "required-indicator", "aria-hidden": "true" }, ' ', "*"))), h("input", { key: '421fd9bb50de8ba189a59578373060593e1a9aab', id: this.inputId, ref: (el) => (this.nativeInputElement = el), type: this.type, min: this.min, max: this.max, step: this.step, value: this.value, name: this.name, placeholder: this.placeholder, disabled: this.disabled, readOnly: this.readonly, required: this.required, form: this.form, autocomplete: this.autocomplete, inputmode: this.inputmode, autocorrect: this.autocorrect, autocapitalize: this.autocapitalize, spellcheck: this.spellcheck, autofocus: this.autofocus, minlength: this.minlength, maxlength: this.maxlength, pattern: this.pattern, "aria-invalid": this.error ? 'true' : 'false', "aria-required": this.required ? 'true' : 'false', "aria-describedby": this.describedBy, "aria-errormessage": this.errorId, onInput: this.handleInput, onChange: this.handleChange, onFocus: this.handleFocus, onBlur: this.handleBlur })), h("slot", { key: '09557e1d84bb4ab2456caf391a177c8f80063ab9', name: "after-input" })), h("div", { key: '34162f744f8584991e4493ebcdb6a2f75a1f8990', id: this.helperId, role: "status" }, this.helperText || null), h("div", { key: 'a3c3bffbb439f9127278cedbfefa5e1986e68f23', id: this.errorId, role: "alert" }, (this.showErrorMessage && this.errorMessage) || null)));
|
|
210
|
-
}
|
|
211
|
-
static get formAssociated() { return true; }
|
|
212
|
-
static get watchers() { return {
|
|
213
|
-
"value": [{
|
|
214
|
-
"handleValueChange": 0
|
|
215
|
-
}],
|
|
216
|
-
"disabled": [{
|
|
217
|
-
"handleDisabledChange": 0
|
|
218
|
-
}]
|
|
219
|
-
}; }
|
|
220
|
-
};
|
|
221
|
-
LmvzInput.style = lmvzInputCss();
|
|
3
|
+
import { i as isFocusControllerHost } from './directional-focus-controller-QukTTWBE.js';
|
|
4
|
+
import { a as addElementActivationListener } from './element-activation-controller-dxJZKMag.js';
|
|
5
|
+
import { w as wait, a as waitFrame } from './async.util-DZj20TV1.js';
|
|
6
|
+
import { f as isActionButton, g as getDeepActiveElement, m as isHtmlElement, w as walkShadowDOMUntil, c as isInteractiveElement, k as canReceiveFocus } from './element.util-3ydVsxUW.js';
|
|
7
|
+
import './reactive-controller-host-CICeIanv.js';
|
|
8
|
+
import './aria.constants-DIyiticz.js';
|
|
222
9
|
|
|
223
10
|
/**
|
|
224
11
|
* Custom positioning reference element.
|
|
@@ -1577,7 +1364,7 @@ const computePosition = (reference, floating, options) => {
|
|
|
1577
1364
|
});
|
|
1578
1365
|
};
|
|
1579
1366
|
|
|
1580
|
-
const lmvzPopoverCss = () => `@layer lmvz-ds.reset,lmvz-ds.theme,lmvz-ds.components,lmvz-ds.overrides; @layer lmvz-ds.components{.lmvz-wrapper-card-sm,.lmvz-wrapper-card-md,.lmvz-wrapper-card-lg{background:var(--lmvz-semantic-color-surface-primary, #ffffff);box-shadow:var(--lmvz-ds-shadow-l3-default-strong, 0 2px 32px 0 rgba(120, 120, 128, 0.11))}.lmvz-wrapper-card-sm{padding:var(--lmvz-component-wrapper-sm-padding-y, clamp(0.75rem, 0.69rem + 0.26vw, 1rem)) var(--lmvz-component-wrapper-sm-padding-x, clamp(0.75rem, 0.69rem + 0.26vw, 1rem));border-radius:var(--lmvz-component-wrapper-sm-border-radius, 14px)}.lmvz-wrapper-card-md{padding:var(--lmvz-component-wrapper-md-padding-y, clamp(1rem, 0.88rem + 0.52vw, 1.5rem)) var(--lmvz-component-wrapper-md-padding-x, clamp(1rem, 0.88rem + 0.52vw, 1.5rem));border-radius:var(--lmvz-component-wrapper-md-border-radius, 18px)}.lmvz-wrapper-card-lg{padding:var(--lmvz-component-wrapper-lg-padding-y, clamp(2.25rem, 2.19rem + 0.26vw, 2.5rem)) var(--lmvz-component-wrapper-lg-padding-x, clamp(1.5rem, 1.14rem + 1.55vw, 3rem));border-radius:var(--lmvz-component-wrapper-lg-border-radius, 18px)}}:host{--lmvz-popover-z-index-internal:var(--lmvz-popover-z-index,
|
|
1367
|
+
const lmvzPopoverCss = () => `@layer lmvz-ds.reset,lmvz-ds.theme,lmvz-ds.components,lmvz-ds.overrides; @layer lmvz-ds.components{.lmvz-wrapper-card-sm,.lmvz-wrapper-card-md,.lmvz-wrapper-card-lg{background:var(--lmvz-semantic-color-surface-primary, #ffffff);box-shadow:var(--lmvz-ds-shadow-l3-default-strong, 0 2px 32px 0 rgba(120, 120, 128, 0.11))}.lmvz-wrapper-card-sm{padding:var(--lmvz-component-wrapper-sm-padding-y, clamp(0.75rem, 0.69rem + 0.26vw, 1rem)) var(--lmvz-component-wrapper-sm-padding-x, clamp(0.75rem, 0.69rem + 0.26vw, 1rem));border-radius:var(--lmvz-component-wrapper-sm-border-radius, 14px)}.lmvz-wrapper-card-md{padding:var(--lmvz-component-wrapper-md-padding-y, clamp(1rem, 0.88rem + 0.52vw, 1.5rem)) var(--lmvz-component-wrapper-md-padding-x, clamp(1rem, 0.88rem + 0.52vw, 1.5rem));border-radius:var(--lmvz-component-wrapper-md-border-radius, 18px)}.lmvz-wrapper-card-lg{padding:var(--lmvz-component-wrapper-lg-padding-y, clamp(2.25rem, 2.19rem + 0.26vw, 2.5rem)) var(--lmvz-component-wrapper-lg-padding-x, clamp(1.5rem, 1.14rem + 1.55vw, 3rem));border-radius:var(--lmvz-component-wrapper-lg-border-radius, 18px)}}:host{--lmvz-popover-z-index-internal:var(--lmvz-popover-z-index, 100);display:contents;.container{position:absolute;top:-9999999999px;left:-9999999999px;max-width:var(--lmvz-popover-max-width, none);max-height:var(--lmvz-popover-max-height, none);z-index:var(--lmvz-popover-z-index-internal);overflow:auto;box-sizing:border-box}}:host(:not([open])) .container{display:none}`;
|
|
1581
1368
|
|
|
1582
1369
|
const LmvzPopover = class {
|
|
1583
1370
|
constructor(hostRef) {
|
|
@@ -1598,6 +1385,7 @@ const LmvzPopover = class {
|
|
|
1598
1385
|
placement = 'bottom-start';
|
|
1599
1386
|
size = 'sm';
|
|
1600
1387
|
autoFocus = true;
|
|
1388
|
+
containerRole = 'dialog';
|
|
1601
1389
|
label;
|
|
1602
1390
|
lmvzOpen;
|
|
1603
1391
|
lmvzClose;
|
|
@@ -1618,6 +1406,7 @@ const LmvzPopover = class {
|
|
|
1618
1406
|
}
|
|
1619
1407
|
componentDidLoad() {
|
|
1620
1408
|
autoAssignId(this.el);
|
|
1409
|
+
this.syncContainerId();
|
|
1621
1410
|
}
|
|
1622
1411
|
handleOpenChange(isOpen) {
|
|
1623
1412
|
if (isOpen) {
|
|
@@ -1644,16 +1433,23 @@ const LmvzPopover = class {
|
|
|
1644
1433
|
this.removeCloseHandlers();
|
|
1645
1434
|
this.extEventController.abort();
|
|
1646
1435
|
}
|
|
1436
|
+
syncContainerId() {
|
|
1437
|
+
const hostId = this.el.getAttribute('id');
|
|
1438
|
+
if (!hostId || !this.containerEl)
|
|
1439
|
+
return;
|
|
1440
|
+
this.containerEl.id = hostId;
|
|
1441
|
+
}
|
|
1647
1442
|
setupAnchorEl() {
|
|
1648
1443
|
const { anchorEl } = this;
|
|
1649
1444
|
if (!anchorEl) {
|
|
1650
1445
|
console.warn('no anchor element set for', this);
|
|
1651
1446
|
return;
|
|
1652
1447
|
}
|
|
1448
|
+
this.syncContainerId();
|
|
1653
1449
|
if (!anchorEl.hasAttribute('aria-haspopup')) {
|
|
1654
|
-
anchorEl.setAttribute('aria-haspopup', 'dialog');
|
|
1450
|
+
anchorEl.setAttribute('aria-haspopup', this.containerRole === 'dialog' ? 'dialog' : this.containerRole);
|
|
1655
1451
|
}
|
|
1656
|
-
anchorEl.setAttribute('aria-controls', this.el.getAttribute('id'));
|
|
1452
|
+
anchorEl.setAttribute('aria-controls', this.containerEl?.id || this.el.getAttribute('id'));
|
|
1657
1453
|
if (!anchorEl.hasAttribute('aria-expanded')) {
|
|
1658
1454
|
anchorEl.setAttribute('aria-expanded', this.open ? 'true' : 'false');
|
|
1659
1455
|
}
|
|
@@ -1681,10 +1477,11 @@ const LmvzPopover = class {
|
|
|
1681
1477
|
await waitFrame();
|
|
1682
1478
|
await this.updatePosition();
|
|
1683
1479
|
autoAssignId(this.el);
|
|
1480
|
+
this.syncContainerId();
|
|
1684
1481
|
this.applyAnchorAriaOpen();
|
|
1685
1482
|
this.lmvzOpen.emit();
|
|
1686
1483
|
await waitFrame();
|
|
1687
|
-
if (this.autoFocus) {
|
|
1484
|
+
if (this.autoFocus && this.containerRole === 'dialog') {
|
|
1688
1485
|
this.focusFirst();
|
|
1689
1486
|
}
|
|
1690
1487
|
}
|
|
@@ -1759,7 +1556,7 @@ const LmvzPopover = class {
|
|
|
1759
1556
|
this.closureController?.abort();
|
|
1760
1557
|
}
|
|
1761
1558
|
render() {
|
|
1762
|
-
return (h(Host, { key: '
|
|
1559
|
+
return (h(Host, { key: '8dadcc766deebc03ea744fd1002078b382bfd48d' }, h("div", { key: 'd332714964212db6f5446afb1b8f38ff031a87b9', role: this.containerRole, part: "container", class: `container lmvz-wrapper-card-${this.size}`, "aria-label": this.label || undefined, ref: (el) => (this.containerEl = el) }, h("slot", { key: '0fa1d214c8c48942751cbd4759ebc992eacc8f72', ref: (el) => (this.slotEl = el) }))));
|
|
1763
1560
|
}
|
|
1764
1561
|
static get watchers() { return {
|
|
1765
1562
|
"open": [{
|
|
@@ -1803,4 +1600,4 @@ function validatePopoverAria(hostEl, label, anchorProp, anchorEl) {
|
|
|
1803
1600
|
}
|
|
1804
1601
|
LmvzPopover.style = lmvzPopoverCss();
|
|
1805
1602
|
|
|
1806
|
-
export {
|
|
1603
|
+
export { LmvzPopover as lmvz_popover };
|
package/esm/lmvz-radio.entry.js
CHANGED
|
@@ -34,6 +34,7 @@ class RadioGroup {
|
|
|
34
34
|
if (wasEmpty) {
|
|
35
35
|
document.addEventListener('focusin', this._focusinHandler, true);
|
|
36
36
|
}
|
|
37
|
+
this.refreshValidity();
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
40
|
unregister(host) {
|
|
@@ -44,10 +45,19 @@ class RadioGroup {
|
|
|
44
45
|
if (this.hosts.length === 0) {
|
|
45
46
|
document.removeEventListener('focusin', this._focusinHandler, true);
|
|
46
47
|
}
|
|
48
|
+
this.refreshValidity();
|
|
47
49
|
}
|
|
48
50
|
get sortedEnabled() {
|
|
49
51
|
return this.hosts.filter((h) => !h.disabled);
|
|
50
52
|
}
|
|
53
|
+
isAnyChecked() {
|
|
54
|
+
return this.hosts.some((host) => host.checked);
|
|
55
|
+
}
|
|
56
|
+
refreshValidity() {
|
|
57
|
+
for (const host of this.hosts) {
|
|
58
|
+
host.updateValidity();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
51
61
|
setFocused(host) {
|
|
52
62
|
this._focusedHost = host;
|
|
53
63
|
this.updateTabindex();
|
|
@@ -63,6 +73,7 @@ class RadioGroup {
|
|
|
63
73
|
host.checked = host === selectedHost;
|
|
64
74
|
}
|
|
65
75
|
this.updateTabindex();
|
|
76
|
+
this.refreshValidity();
|
|
66
77
|
}
|
|
67
78
|
updateTabindex() {
|
|
68
79
|
const enabled = this.sortedEnabled;
|
|
@@ -124,6 +135,12 @@ class RadioGroupController {
|
|
|
124
135
|
select(selectedHost) {
|
|
125
136
|
this.group?.select(selectedHost);
|
|
126
137
|
}
|
|
138
|
+
isAnyChecked() {
|
|
139
|
+
return this.group?.isAnyChecked() ?? false;
|
|
140
|
+
}
|
|
141
|
+
refreshValidity() {
|
|
142
|
+
this.group?.refreshValidity();
|
|
143
|
+
}
|
|
127
144
|
setFocused(host) {
|
|
128
145
|
this.group?.setFocused(host);
|
|
129
146
|
}
|
|
@@ -166,7 +183,7 @@ class RadioGroupController {
|
|
|
166
183
|
|
|
167
184
|
const lmvzRadioCss = () => `@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-radio-h { display: inline-block; --radio-circle-size: var(--lmvz-global-s18, 18px); --radio-dot-size: 0.5rem; --radio-bg: var(--lmvz-semantic-color-surface-input-primary, #ffffff); --radio-border-color: var(--lmvz-semantic-color-border-default, #e0e0e0); --radio-border-color-hover: var(--lmvz-semantic-color-border-hover, #a1a1a1); --radio-border-color-checked: var(--lmvz-semantic-color-border-active, #0f8acc); --radio-border-color-error: var(--lmvz-semantic-color-status-on-danger, #a31419); --radio-dot-color: var(--lmvz-semantic-color-border-active, #0f8acc); --radio-wrapper-bg-hover: var(--lmvz-semantic-color-int-tertiary-hover, #f0f0f0); --radio-wrapper-bg-active: var(--lmvz-semantic-color-int-tertiary-active, #e0e0e0); --radio-label-color: var(--lmvz-semantic-color-on-surface-primary, #000000); --radio-label-color-checked: var(--lmvz-semantic-color-status-on-active, #0e7ab4); --radio-helper-color: var(--lmvz-semantic-color-on-surface-secondary, #545454); --radio-easing: var(--lmvz-global-easing-default, ease); --radio-duration: 0.2s; display: flex; align-items: center; gap: var(--lmvz-component-input-gap-md, clamp(0.5rem, 0.44rem + 0.26vw, 0.75rem)); padding-block: var(--lmvz-dimension-8-2, clamp(0.13rem, 0.03rem + 0.39vw, 0.5rem)); padding-inline: var(--lmvz-dimension-12-8, clamp(0.5rem, 0.44rem + 0.26vw, 0.75rem)); border-radius: var(--lmvz-semantic-border-radius-round, 999px); overflow: clip; cursor: pointer; background-color: transparent; position: relative; transition: background-color var(--radio-duration) var(--radio-easing); } input.sc-lmvz-radio { position: absolute; inset-block-start: var(--lmvz-dimension-8-2, clamp(0.13rem, 0.03rem + 0.39vw, 0.5rem)); inset-inline-start: var(--lmvz-dimension-10-4, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); opacity: 0; width: var(--radio-circle-size); height: var(--radio-circle-size); margin: 0; cursor: pointer; z-index: 1; } .circle.sc-lmvz-radio { width: var(--radio-circle-size); height: var(--radio-circle-size); border-radius: 50%; border: var(--lmvz-semantic-border-width-default, 1px) solid var(--radio-border-color); background-color: var(--radio-bg); pointer-events: none; flex-shrink: 0; display: flex; align-items: center; justify-content: center; box-sizing: border-box; transition: border-color var(--radio-duration) var(--radio-easing); } .dot.sc-lmvz-radio { width: var(--radio-dot-size); height: var(--radio-dot-size); border-radius: 50%; background-color: var(--radio-dot-color); } .content.sc-lmvz-radio { display: flex; flex-direction: column; overflow-wrap: break-word; min-width: 0; } label.sc-lmvz-radio { font: var(--lmvz-typography-body-md, 400 clamp(0.88rem, 0.84rem + 0.13vw, 1rem) / 1.5 Router); color: var(--radio-label-color); cursor: pointer; transition: color var(--radio-duration) var(--radio-easing); } .helper-text.sc-lmvz-radio { display: block; font: var(--lmvz-typography-body-sm, 400 clamp(0.75rem, 0.72rem + 0.13vw, 0.88rem) / 1.5 Router); color: var(--radio-helper-color); margin-block-start: 2px; } .helper-text.sc-lmvz-radio:empty { display: none; } @media (hover: hover) { .sc-lmvz-radio-h:hover .circle.sc-lmvz-radio { border-color: var(--radio-border-color-hover); } .sc-lmvz-radio-h:hover { background-color: var(--radio-wrapper-bg-hover); } } .sc-lmvz-radio-h:active { background-color: var(--radio-wrapper-bg-active); } [checked].sc-lmvz-radio-h .circle.sc-lmvz-radio { border-color: var(--radio-border-color-checked); } [checked].sc-lmvz-radio-h label.sc-lmvz-radio { color: var(--radio-label-color-checked); } [error].sc-lmvz-radio-h .circle.sc-lmvz-radio { border-color: var(--radio-border-color-error); } [error].sc-lmvz-radio-h .helper-text.sc-lmvz-radio { color: var(--lmvz-semantic-color-status-on-danger, #a31419); } [disabled].sc-lmvz-radio-h { opacity: var(--lmvz-component-input-disabled-opacity, 40%); pointer-events: none; cursor: not-allowed; } @media (forced-colors: active) { .circle.sc-lmvz-radio { forced-color-adjust: auto; border-color: ButtonText; background-color: Field; } [checked].sc-lmvz-radio-h .circle.sc-lmvz-radio { border-color: Highlight; } .dot.sc-lmvz-radio { background-color: ButtonText; } [checked].sc-lmvz-radio-h .dot.sc-lmvz-radio { background-color: HighlightText; } }`;
|
|
168
185
|
|
|
169
|
-
const focusWithinCss = () => `.sc-lmvz-radio-h:focus-
|
|
186
|
+
const focusWithinCss = () => `.sc-lmvz-radio-h:has(: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))}@media (forced-colors: active){.sc-lmvz-radio-h:has(:focus-visible){outline-color:Highlight;box-shadow:none}}`;
|
|
170
187
|
|
|
171
188
|
let radioIdCounter = 0;
|
|
172
189
|
const LmvzRadio = class extends ReactiveControllerHost {
|
|
@@ -188,7 +205,14 @@ const LmvzRadio = class extends ReactiveControllerHost {
|
|
|
188
205
|
name;
|
|
189
206
|
disabled = false;
|
|
190
207
|
required = false;
|
|
191
|
-
|
|
208
|
+
nativeError = false;
|
|
209
|
+
errorFromProp = false;
|
|
210
|
+
get error() {
|
|
211
|
+
return this.errorFromProp || this.nativeError;
|
|
212
|
+
}
|
|
213
|
+
set error(value) {
|
|
214
|
+
this.errorFromProp = value;
|
|
215
|
+
}
|
|
192
216
|
helperText;
|
|
193
217
|
form;
|
|
194
218
|
autofocus = false;
|
|
@@ -196,6 +220,7 @@ const LmvzRadio = class extends ReactiveControllerHost {
|
|
|
196
220
|
_handlingFormReset = false;
|
|
197
221
|
handleCheckedChange(newVal, oldVal) {
|
|
198
222
|
this.internals.setFormValue?.(newVal ? this.value : null);
|
|
223
|
+
this.updateValidity();
|
|
199
224
|
if (!newVal && oldVal && !this._handlingNativeChange && !this._handlingFormReset) {
|
|
200
225
|
this.lmvzChange.emit(false);
|
|
201
226
|
}
|
|
@@ -203,6 +228,9 @@ const LmvzRadio = class extends ReactiveControllerHost {
|
|
|
203
228
|
this.lmvzChange.emit(true);
|
|
204
229
|
}
|
|
205
230
|
}
|
|
231
|
+
handleRequiredChange() {
|
|
232
|
+
this.updateValidity();
|
|
233
|
+
}
|
|
206
234
|
handleValueChange(newVal) {
|
|
207
235
|
if (this.checked) {
|
|
208
236
|
this.internals.setFormValue?.(newVal);
|
|
@@ -224,6 +252,9 @@ const LmvzRadio = class extends ReactiveControllerHost {
|
|
|
224
252
|
async reportValidity() {
|
|
225
253
|
return this.internals?.reportValidity() ?? true;
|
|
226
254
|
}
|
|
255
|
+
async getValidationMessage() {
|
|
256
|
+
return this.internals?.validationMessage ?? '';
|
|
257
|
+
}
|
|
227
258
|
constructor(hostRef) {
|
|
228
259
|
super();
|
|
229
260
|
registerInstance(this, hostRef);
|
|
@@ -245,8 +276,13 @@ const LmvzRadio = class extends ReactiveControllerHost {
|
|
|
245
276
|
componentWillLoad() {
|
|
246
277
|
this.initialChecked = this.checked;
|
|
247
278
|
this.internals.setFormValue?.(this.checked ? this.value : null);
|
|
279
|
+
this.updateValidity();
|
|
248
280
|
super.componentWillLoad();
|
|
249
281
|
}
|
|
282
|
+
componentDidLoad() {
|
|
283
|
+
this.updateValidity();
|
|
284
|
+
super.componentDidLoad();
|
|
285
|
+
}
|
|
250
286
|
formAssociatedCallback() {
|
|
251
287
|
this.internals.setFormValue?.(this.checked ? this.value : null);
|
|
252
288
|
}
|
|
@@ -258,6 +294,8 @@ const LmvzRadio = class extends ReactiveControllerHost {
|
|
|
258
294
|
finally {
|
|
259
295
|
this._handlingFormReset = false;
|
|
260
296
|
}
|
|
297
|
+
this.updateValidity();
|
|
298
|
+
this.radioGroupController.refreshValidity();
|
|
261
299
|
}
|
|
262
300
|
formStateRestoreCallback(state) {
|
|
263
301
|
if (typeof state !== 'string')
|
|
@@ -270,6 +308,20 @@ const LmvzRadio = class extends ReactiveControllerHost {
|
|
|
270
308
|
this._handlingFormReset = false;
|
|
271
309
|
}
|
|
272
310
|
}
|
|
311
|
+
isAnyInGroupChecked() {
|
|
312
|
+
return this.radioGroupController.isAnyChecked();
|
|
313
|
+
}
|
|
314
|
+
updateValidity() {
|
|
315
|
+
if (this.required && !this.isAnyInGroupChecked()) {
|
|
316
|
+
this.internals.setValidity?.({ valueMissing: true }, 'Please select an option.', this.nativeInput);
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
this.internals.setValidity?.({});
|
|
320
|
+
this.nativeError = false;
|
|
321
|
+
}
|
|
322
|
+
handleInvalid() {
|
|
323
|
+
this.nativeError = true;
|
|
324
|
+
}
|
|
273
325
|
handleChange = (event) => {
|
|
274
326
|
this._handlingNativeChange = true;
|
|
275
327
|
try {
|
|
@@ -312,14 +364,20 @@ const LmvzRadio = class extends ReactiveControllerHost {
|
|
|
312
364
|
return;
|
|
313
365
|
this.radioGroupController.setFocused(target);
|
|
314
366
|
}
|
|
367
|
+
retargetInnerClicks() {
|
|
368
|
+
this.nativeInput?.click();
|
|
369
|
+
}
|
|
315
370
|
render() {
|
|
316
|
-
return (h(Host, { key: '
|
|
371
|
+
return (h(Host, { key: 'f1fdc1167c4e59c2524e1e545c3382ca32853788' }, h("input", { key: 'c1b711444475ed401766cc5827eeaec0c46b62cf', type: "radio", id: this.radioId, value: this.value, checked: this.checked, disabled: this.disabled, autoFocus: this.autofocus, "aria-required": this.required ? 'true' : 'false', "aria-invalid": this.error ? 'true' : undefined, "aria-describedby": this.helperId, ref: (el) => (this.nativeInput = el), onChange: this.handleChange }), h("span", { key: 'b25e623269df05bdf8159e72da4df2e0bfb5d7bc', class: "circle", "aria-hidden": "true" }, this.checked && h("span", { key: '93d12890c7ba0abe203c63953ea1115aee37d7a0', class: "dot" })), h("span", { key: '44dcfdc4e7ee3820624b0d02a438139f45bb8733', class: "content" }, h("label", { key: 'd0547cd5e79642b298da155c9937715224b52cae', htmlFor: this.radioId }, this.label), h("span", { key: 'a9df5dd8a775a2f7422d5bac296869f88553e33f', onClick: this.retargetInnerClicks.bind(this), "aria-live": "polite", class: "helper-text", id: this.helperId }, this.helperText))));
|
|
317
372
|
}
|
|
318
373
|
static get formAssociated() { return true; }
|
|
319
374
|
static get watchers() { return {
|
|
320
375
|
"checked": [{
|
|
321
376
|
"handleCheckedChange": 0
|
|
322
377
|
}],
|
|
378
|
+
"required": [{
|
|
379
|
+
"handleRequiredChange": 0
|
|
380
|
+
}],
|
|
323
381
|
"value": [{
|
|
324
382
|
"handleValueChange": 0
|
|
325
383
|
}],
|