@vonage/vivid 4.12.1 → 4.13.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/custom-elements.json +1388 -128
- package/lib/file-picker/file-picker.d.ts +6 -0
- package/lib/menu/menu.d.ts +16 -3
- package/lib/menu-item/menu-item.d.ts +10 -2
- package/lib/option/option.d.ts +27 -7
- package/lib/switch/switch.d.ts +5 -2
- package/lib/switch/switch.form-associated.d.ts +10 -0
- package/lib/tabs/tabs.d.ts +3 -2
- package/lib/text-area/text-area.d.ts +25 -3
- package/lib/text-area/text-field.form-associated.d.ts +10 -0
- package/lib/text-field/text-field.d.ts +28 -3
- package/lib/text-field/text-field.form-associated.d.ts +10 -0
- package/package.json +1 -1
- package/shared/definition11.cjs +1 -1
- package/shared/definition11.js +1 -1
- package/shared/definition17.cjs +1 -1
- package/shared/definition17.js +1 -1
- package/shared/definition20.cjs +2 -1
- package/shared/definition20.js +2 -1
- package/shared/definition21.cjs +1 -1
- package/shared/definition21.js +1 -1
- package/shared/definition24.cjs +1 -1
- package/shared/definition24.js +1 -1
- package/shared/definition25.cjs +24 -3
- package/shared/definition25.js +24 -3
- package/shared/definition29.cjs +358 -559
- package/shared/definition29.js +359 -560
- package/shared/definition30.cjs +2 -0
- package/shared/definition30.js +2 -0
- package/shared/definition35.cjs +222 -2
- package/shared/definition35.js +222 -2
- package/shared/definition36.cjs +149 -14
- package/shared/definition36.js +150 -15
- package/shared/definition46.cjs +1 -1
- package/shared/definition46.js +1 -1
- package/shared/definition47.cjs +5 -14
- package/shared/definition47.js +1 -10
- package/shared/definition49.cjs +65 -90
- package/shared/definition49.js +66 -91
- package/shared/definition51.cjs +1 -1
- package/shared/definition51.js +1 -1
- package/shared/definition52.cjs +15 -1
- package/shared/definition52.js +15 -1
- package/shared/definition55.cjs +160 -180
- package/shared/definition55.js +160 -180
- package/shared/definition56.cjs +3 -307
- package/shared/definition56.js +5 -309
- package/shared/definition57.cjs +8 -7
- package/shared/definition57.js +3 -2
- package/shared/definition64.cjs +18 -7
- package/shared/definition64.js +19 -8
- package/shared/listbox.cjs +198 -3
- package/shared/listbox.js +197 -2
- package/shared/{direction.cjs → localization.cjs} +12 -3
- package/shared/{direction.js → localization.js} +12 -3
- package/shared/presentationDate.cjs +8 -8
- package/shared/presentationDate.js +1 -1
- package/shared/text-field2.cjs +538 -194
- package/shared/text-field2.js +539 -195
- package/styles/core/all.css +21 -1
- package/styles/core/theme.css +21 -1
- package/styles/core/typography.css +1 -1
- package/styles/tokens/theme-dark.css +4 -4
- package/styles/tokens/theme-light.css +4 -4
- package/styles/tokens/vivid-2-compat.css +1 -1
- package/vivid.api.json +44 -0
- package/shared/Reflector.cjs +0 -71
- package/shared/Reflector.js +0 -69
- package/shared/listbox-option.cjs +0 -204
- package/shared/listbox-option.js +0 -201
package/shared/text-field2.js
CHANGED
|
@@ -1,225 +1,569 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as
|
|
1
|
+
import { O as Observable, D as DOM, F as FoundationElement, a as attr, n as nullableNumberConverter, o as observable } from './index.js';
|
|
2
|
+
import { a as applyMixinsWithObservables } from './applyMixinsWithObservables.js';
|
|
3
3
|
import { F as FormAssociated } from './form-associated.js';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { m as memoizeWith } from './icon.js';
|
|
5
|
+
import { A as ARIAGlobalStatesAndProperties } from './aria-global2.js';
|
|
6
|
+
import { e as errorText, f as formElements, F as FormElementSuccessText, a as FormElementHelperText, b as FormElementCharCount } from './form-elements.js';
|
|
7
|
+
import { a as applyMixins } from './apply-mixins.js';
|
|
8
|
+
import { A as AffixIcon } from './affix.js';
|
|
9
|
+
|
|
10
|
+
const byteToHex = [];
|
|
11
|
+
for (let i = 0; i < 256; ++i) {
|
|
12
|
+
byteToHex.push((i + 0x100).toString(16).slice(1));
|
|
13
|
+
}
|
|
14
|
+
function unsafeStringify(arr, offset = 0) {
|
|
15
|
+
return (byteToHex[arr[offset + 0]] +
|
|
16
|
+
byteToHex[arr[offset + 1]] +
|
|
17
|
+
byteToHex[arr[offset + 2]] +
|
|
18
|
+
byteToHex[arr[offset + 3]] +
|
|
19
|
+
'-' +
|
|
20
|
+
byteToHex[arr[offset + 4]] +
|
|
21
|
+
byteToHex[arr[offset + 5]] +
|
|
22
|
+
'-' +
|
|
23
|
+
byteToHex[arr[offset + 6]] +
|
|
24
|
+
byteToHex[arr[offset + 7]] +
|
|
25
|
+
'-' +
|
|
26
|
+
byteToHex[arr[offset + 8]] +
|
|
27
|
+
byteToHex[arr[offset + 9]] +
|
|
28
|
+
'-' +
|
|
29
|
+
byteToHex[arr[offset + 10]] +
|
|
30
|
+
byteToHex[arr[offset + 11]] +
|
|
31
|
+
byteToHex[arr[offset + 12]] +
|
|
32
|
+
byteToHex[arr[offset + 13]] +
|
|
33
|
+
byteToHex[arr[offset + 14]] +
|
|
34
|
+
byteToHex[arr[offset + 15]]).toLowerCase();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
let getRandomValues;
|
|
38
|
+
const rnds8 = new Uint8Array(16);
|
|
39
|
+
function rng() {
|
|
40
|
+
if (!getRandomValues) {
|
|
41
|
+
if (typeof crypto === 'undefined' || !crypto.getRandomValues) {
|
|
42
|
+
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
|
43
|
+
}
|
|
44
|
+
getRandomValues = crypto.getRandomValues.bind(crypto);
|
|
45
|
+
}
|
|
46
|
+
return getRandomValues(rnds8);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
50
|
+
const native = { randomUUID };
|
|
51
|
+
|
|
52
|
+
function v4(options, buf, offset) {
|
|
53
|
+
if (native.randomUUID && !buf && !options) {
|
|
54
|
+
return native.randomUUID();
|
|
55
|
+
}
|
|
56
|
+
options = options || {};
|
|
57
|
+
const rnds = options.random || (options.rng || rng)();
|
|
58
|
+
rnds[6] = (rnds[6] & 0x0f) | 0x40;
|
|
59
|
+
rnds[8] = (rnds[8] & 0x3f) | 0x80;
|
|
60
|
+
return unsafeStringify(rnds);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const generateRandomId = () => v4();
|
|
64
|
+
|
|
65
|
+
class Reflector {
|
|
66
|
+
#reflectedProperties = /* @__PURE__ */ new Map();
|
|
67
|
+
#source;
|
|
68
|
+
#target;
|
|
69
|
+
constructor(source, target) {
|
|
70
|
+
this.#source = source;
|
|
71
|
+
this.#target = target;
|
|
72
|
+
}
|
|
73
|
+
attribute(propertyName, attributeName) {
|
|
74
|
+
this.#addReflectedProperty(propertyName, {
|
|
75
|
+
type: "attribute",
|
|
76
|
+
destination: attributeName
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
booleanAttribute(propertyName, attributeName) {
|
|
80
|
+
this.#addReflectedProperty(propertyName, {
|
|
81
|
+
type: "boolean-attribute",
|
|
82
|
+
destination: attributeName
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
property(propertyName, targetProperty, skipIfEqual = false) {
|
|
86
|
+
this.#addReflectedProperty(propertyName, {
|
|
87
|
+
type: "property",
|
|
88
|
+
destination: targetProperty,
|
|
89
|
+
skipIfEqual
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
destroy() {
|
|
93
|
+
const notifier = Observable.getNotifier(this.#source);
|
|
94
|
+
for (const prop of this.#reflectedProperties.keys()) {
|
|
95
|
+
notifier.unsubscribe(this.#propertyChangeHandler, prop);
|
|
96
|
+
}
|
|
97
|
+
this.#reflectedProperties.clear();
|
|
98
|
+
}
|
|
99
|
+
#addReflectedProperty(name, reflected) {
|
|
100
|
+
this.#reflectedProperties.set(name, reflected);
|
|
101
|
+
const notifier = Observable.getNotifier(this.#source);
|
|
102
|
+
notifier.subscribe(this.#propertyChangeHandler, name);
|
|
103
|
+
this.#propertyChangeHandler.handleChange(this.#source, name);
|
|
104
|
+
}
|
|
105
|
+
#propertyChangeHandler = {
|
|
106
|
+
handleChange: (source, propertyName) => {
|
|
107
|
+
const reflectedProperty = this.#reflectedProperties.get(propertyName);
|
|
108
|
+
const value = source[propertyName];
|
|
109
|
+
switch (reflectedProperty.type) {
|
|
110
|
+
case "boolean-attribute":
|
|
111
|
+
DOM.setBooleanAttribute(
|
|
112
|
+
this.#target,
|
|
113
|
+
reflectedProperty.destination,
|
|
114
|
+
Boolean(value)
|
|
115
|
+
);
|
|
116
|
+
break;
|
|
117
|
+
case "attribute":
|
|
118
|
+
DOM.setAttribute(this.#target, reflectedProperty.destination, value);
|
|
119
|
+
break;
|
|
120
|
+
case "property":
|
|
121
|
+
if (reflectedProperty.skipIfEqual && this.#target[reflectedProperty.destination] === value) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
this.#target[reflectedProperty.destination] = value;
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
}
|
|
6
130
|
|
|
7
131
|
class _TextField extends FoundationElement {
|
|
8
132
|
}
|
|
9
|
-
/**
|
|
10
|
-
* A form-associated base class for the {@link @microsoft/fast-foundation#(TextField:class)} component.
|
|
11
|
-
*
|
|
12
|
-
* @internal
|
|
13
|
-
*/
|
|
14
133
|
class FormAssociatedTextField extends FormAssociated(_TextField) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
134
|
+
constructor() {
|
|
135
|
+
super(...arguments);
|
|
136
|
+
this.proxy = document.createElement("input");
|
|
137
|
+
}
|
|
19
138
|
}
|
|
20
139
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
140
|
+
var __defProp = Object.defineProperty;
|
|
141
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
142
|
+
var __typeError = (msg) => {
|
|
143
|
+
throw TypeError(msg);
|
|
144
|
+
};
|
|
145
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
146
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
147
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
148
|
+
if (decorator = decorators[i])
|
|
149
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
150
|
+
if (kind && result) __defProp(target, key, result);
|
|
151
|
+
return result;
|
|
152
|
+
};
|
|
153
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
154
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
155
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
156
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
|
|
157
|
+
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
158
|
+
var _TextField_instances, handleLabelChange_fn, _reflectToInput, _helperTextMirrorEl, _helperTextSlotMutationObserver, updateHelperTextMutationObserver_fn, updateMirroredHelperText_fn;
|
|
25
159
|
const TextFieldType = {
|
|
160
|
+
/**
|
|
161
|
+
* An email TextField
|
|
162
|
+
*/
|
|
163
|
+
email: "email",
|
|
164
|
+
/**
|
|
165
|
+
* A password TextField
|
|
166
|
+
*/
|
|
167
|
+
password: "password",
|
|
168
|
+
/**
|
|
169
|
+
* A telephone TextField
|
|
170
|
+
*/
|
|
171
|
+
tel: "tel",
|
|
172
|
+
/**
|
|
173
|
+
* A text TextField
|
|
174
|
+
*/
|
|
175
|
+
text: "text",
|
|
176
|
+
/**
|
|
177
|
+
* A URL TextField
|
|
178
|
+
*/
|
|
179
|
+
url: "url"
|
|
180
|
+
};
|
|
181
|
+
const safariWorkaroundClassName = "_vvd-3-text-field-safari-workaround";
|
|
182
|
+
const getSafariWorkaroundStyleSheet = memoizeWith(
|
|
183
|
+
() => "",
|
|
184
|
+
() => {
|
|
185
|
+
const styleSheet = new CSSStyleSheet();
|
|
186
|
+
const supportsReplaceSync = "replaceSync" in styleSheet;
|
|
187
|
+
if (supportsReplaceSync) {
|
|
188
|
+
styleSheet.replaceSync(`
|
|
189
|
+
.${safariWorkaroundClassName}::placeholder {
|
|
190
|
+
opacity: 1 !important;
|
|
191
|
+
-webkit-text-fill-color: var(--_low-ink-color) !important;
|
|
192
|
+
}`);
|
|
193
|
+
}
|
|
194
|
+
return styleSheet;
|
|
195
|
+
}
|
|
196
|
+
);
|
|
197
|
+
const installSafariWorkaroundStyle = (forElement) => {
|
|
198
|
+
const root = forElement.getRootNode();
|
|
199
|
+
const workaroundStyleSheet = getSafariWorkaroundStyleSheet();
|
|
200
|
+
const supportsAdoptedStyleSheets = "adoptedStyleSheets" in root;
|
|
201
|
+
if (!supportsAdoptedStyleSheets) {
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
if (!root.adoptedStyleSheets.includes(workaroundStyleSheet)) {
|
|
205
|
+
root.adoptedStyleSheets = [
|
|
206
|
+
...root.adoptedStyleSheets,
|
|
207
|
+
workaroundStyleSheet
|
|
208
|
+
];
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
let TextField = class extends FormAssociatedTextField {
|
|
212
|
+
constructor() {
|
|
213
|
+
super(...arguments);
|
|
214
|
+
__privateAdd(this, _TextField_instances);
|
|
215
|
+
// eslint-disable-next-line @nrwl/nx/workspace/no-attribute-default-value
|
|
216
|
+
this.type = TextFieldType.text;
|
|
26
217
|
/**
|
|
27
|
-
*
|
|
28
|
-
*/
|
|
29
|
-
email: "email",
|
|
30
|
-
/**
|
|
31
|
-
* A password TextField
|
|
32
|
-
*/
|
|
33
|
-
password: "password",
|
|
34
|
-
/**
|
|
35
|
-
* A telephone TextField
|
|
36
|
-
*/
|
|
37
|
-
tel: "tel",
|
|
38
|
-
/**
|
|
39
|
-
* A text TextField
|
|
40
|
-
*/
|
|
41
|
-
text: "text",
|
|
42
|
-
/**
|
|
43
|
-
* A URL TextField
|
|
218
|
+
* @internal
|
|
44
219
|
*/
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
* @csspart control - The text field element
|
|
58
|
-
* @fires change - Fires a custom 'change' event when the value has changed
|
|
59
|
-
*
|
|
60
|
-
* @public
|
|
61
|
-
*/
|
|
62
|
-
let TextField$1 = class TextField extends FormAssociatedTextField {
|
|
63
|
-
constructor() {
|
|
64
|
-
super(...arguments);
|
|
65
|
-
/**
|
|
66
|
-
* Allows setting a type or mode of text.
|
|
67
|
-
* @public
|
|
68
|
-
* @remarks
|
|
69
|
-
* HTML Attribute: type
|
|
70
|
-
*/
|
|
71
|
-
this.type = TextFieldType.text;
|
|
72
|
-
}
|
|
73
|
-
readOnlyChanged() {
|
|
74
|
-
if (this.proxy instanceof HTMLInputElement) {
|
|
75
|
-
this.proxy.readOnly = this.readOnly;
|
|
76
|
-
this.validate();
|
|
77
|
-
}
|
|
220
|
+
this._labelEl = null;
|
|
221
|
+
__privateAdd(this, _reflectToInput);
|
|
222
|
+
__privateAdd(this, _helperTextMirrorEl);
|
|
223
|
+
__privateAdd(this, _helperTextSlotMutationObserver);
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* @internal
|
|
227
|
+
*/
|
|
228
|
+
readOnlyChanged() {
|
|
229
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
230
|
+
this.proxy.readOnly = this.readOnly;
|
|
231
|
+
this.validate();
|
|
78
232
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* @internal
|
|
236
|
+
*/
|
|
237
|
+
autofocusChanged() {
|
|
238
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
239
|
+
this.proxy.autofocus = this.autofocus;
|
|
240
|
+
this.validate();
|
|
84
241
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* @internal
|
|
245
|
+
*/
|
|
246
|
+
placeholderChanged() {
|
|
247
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
248
|
+
this.proxy.placeholder = this.placeholder;
|
|
89
249
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* @internal
|
|
253
|
+
*/
|
|
254
|
+
typeChanged() {
|
|
255
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
256
|
+
this.proxy.type = this.type;
|
|
257
|
+
this.validate();
|
|
95
258
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* @internal
|
|
262
|
+
*/
|
|
263
|
+
listChanged() {
|
|
264
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
265
|
+
this.proxy.setAttribute("list", this.list);
|
|
266
|
+
this.validate();
|
|
101
267
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* @internal
|
|
271
|
+
*/
|
|
272
|
+
maxlengthChanged() {
|
|
273
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
274
|
+
this.proxy.maxLength = this.maxlength;
|
|
275
|
+
this.validate();
|
|
107
276
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* @internal
|
|
280
|
+
*/
|
|
281
|
+
minlengthChanged() {
|
|
282
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
283
|
+
this.proxy.minLength = this.minlength;
|
|
284
|
+
this.validate();
|
|
113
285
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* @internal
|
|
289
|
+
*/
|
|
290
|
+
patternChanged() {
|
|
291
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
292
|
+
this.proxy.pattern = this.pattern;
|
|
293
|
+
this.validate();
|
|
119
294
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* @internal
|
|
298
|
+
*/
|
|
299
|
+
sizeChanged() {
|
|
300
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
301
|
+
this.proxy.size = this.size;
|
|
124
302
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* @internal
|
|
306
|
+
*/
|
|
307
|
+
spellcheckChanged() {
|
|
308
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
309
|
+
this.proxy.spellcheck = this.spellcheck;
|
|
129
310
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Selects all the text in the text field
|
|
314
|
+
*
|
|
315
|
+
* @public
|
|
316
|
+
*/
|
|
317
|
+
select() {
|
|
318
|
+
this.control.select();
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Handles the internal control's `input` event
|
|
322
|
+
* @internal
|
|
323
|
+
*/
|
|
324
|
+
handleTextInput() {
|
|
325
|
+
this.value = this.control.value;
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Change event handler for inner control.
|
|
329
|
+
* @remarks
|
|
330
|
+
* "Change" events are not `composable` so they will not
|
|
331
|
+
* permeate the shadow DOM boundary. This fn effectively proxies
|
|
332
|
+
* the change event, emitting a `change` event whenever the internal
|
|
333
|
+
* control emits a `change` event
|
|
334
|
+
* @internal
|
|
335
|
+
*/
|
|
336
|
+
handleChange() {
|
|
337
|
+
this.$emit("change");
|
|
338
|
+
}
|
|
339
|
+
/** {@inheritDoc (FormAssociated:interface).validate} */
|
|
340
|
+
validate() {
|
|
341
|
+
super.validate(this.control);
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* @internal
|
|
345
|
+
*/
|
|
346
|
+
labelChanged() {
|
|
347
|
+
if (this._labelEl) {
|
|
348
|
+
__privateMethod(this, _TextField_instances, handleLabelChange_fn).call(this, this._labelEl);
|
|
142
349
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
* This fn effectively proxies the select event,
|
|
153
|
-
* emitting a `select` event whenever the internal
|
|
154
|
-
* control emits a `select` event
|
|
155
|
-
*/
|
|
156
|
-
this.$emit("select");
|
|
350
|
+
}
|
|
351
|
+
connectedCallback() {
|
|
352
|
+
super.connectedCallback();
|
|
353
|
+
this.proxy.setAttribute("type", this.type);
|
|
354
|
+
this.validate();
|
|
355
|
+
if (this.autofocus) {
|
|
356
|
+
DOM.queueUpdate(() => {
|
|
357
|
+
this.focus();
|
|
358
|
+
});
|
|
157
359
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
360
|
+
if (!this.control) {
|
|
361
|
+
const uniqueId = this.id || generateRandomId();
|
|
362
|
+
const controlId = `vvd-text-field-control-${uniqueId}`;
|
|
363
|
+
const helperTextId = `vvd-text-field-helper-text-${uniqueId}`;
|
|
364
|
+
const input = document.createElement("input");
|
|
365
|
+
input.slot = "_control";
|
|
366
|
+
input.id = controlId;
|
|
367
|
+
input.className = safariWorkaroundClassName;
|
|
368
|
+
this.control = input;
|
|
369
|
+
input.addEventListener("input", () => {
|
|
370
|
+
this.handleTextInput();
|
|
371
|
+
});
|
|
372
|
+
input.addEventListener("change", () => {
|
|
373
|
+
this.handleChange();
|
|
374
|
+
});
|
|
375
|
+
input.addEventListener("blur", () => {
|
|
376
|
+
this.$emit("blur", void 0, { bubbles: false });
|
|
377
|
+
});
|
|
378
|
+
input.addEventListener("focus", () => {
|
|
379
|
+
this.$emit("focus", void 0, { bubbles: false });
|
|
380
|
+
});
|
|
381
|
+
this.appendChild(input);
|
|
382
|
+
const label = document.createElement("label");
|
|
383
|
+
label.slot = "_label";
|
|
384
|
+
label.htmlFor = controlId;
|
|
385
|
+
this._labelEl = label;
|
|
386
|
+
__privateMethod(this, _TextField_instances, handleLabelChange_fn).call(this, label);
|
|
387
|
+
__privateSet(this, _helperTextMirrorEl, document.createElement("div"));
|
|
388
|
+
__privateGet(this, _helperTextMirrorEl).id = helperTextId;
|
|
389
|
+
__privateGet(this, _helperTextMirrorEl).slot = "_mirrored-helper-text";
|
|
390
|
+
__privateMethod(this, _TextField_instances, updateMirroredHelperText_fn).call(this);
|
|
391
|
+
this.appendChild(__privateGet(this, _helperTextMirrorEl));
|
|
392
|
+
installSafariWorkaroundStyle(this);
|
|
164
393
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
394
|
+
__privateSet(this, _reflectToInput, new Reflector(this, this.control));
|
|
395
|
+
__privateGet(this, _reflectToInput).booleanAttribute("autofocus", "autofocus");
|
|
396
|
+
__privateGet(this, _reflectToInput).booleanAttribute("disabled", "disabled");
|
|
397
|
+
__privateGet(this, _reflectToInput).booleanAttribute("readOnly", "readonly");
|
|
398
|
+
__privateGet(this, _reflectToInput).booleanAttribute("required", "required");
|
|
399
|
+
__privateGet(this, _reflectToInput).booleanAttribute("spellcheck", "spellcheck");
|
|
400
|
+
__privateGet(this, _reflectToInput).attribute("list", "list");
|
|
401
|
+
__privateGet(this, _reflectToInput).attribute("maxlength", "maxlength");
|
|
402
|
+
__privateGet(this, _reflectToInput).attribute("minlength", "minlength");
|
|
403
|
+
__privateGet(this, _reflectToInput).attribute("pattern", "pattern");
|
|
404
|
+
__privateGet(this, _reflectToInput).attribute("placeholder", "placeholder");
|
|
405
|
+
__privateGet(this, _reflectToInput).attribute("size", "size");
|
|
406
|
+
__privateGet(this, _reflectToInput).attribute("autoComplete", "autocomplete");
|
|
407
|
+
__privateGet(this, _reflectToInput).attribute("type", "type");
|
|
408
|
+
__privateGet(this, _reflectToInput).attribute("inputMode", "inputmode");
|
|
409
|
+
__privateGet(this, _reflectToInput).attribute("ariaAtomic", "aria-atomic");
|
|
410
|
+
__privateGet(this, _reflectToInput).attribute("ariaBusy", "aria-busy");
|
|
411
|
+
__privateGet(this, _reflectToInput).attribute("ariaCurrent", "aria-current");
|
|
412
|
+
__privateGet(this, _reflectToInput).attribute("ariaDetails", "aria-details");
|
|
413
|
+
__privateGet(this, _reflectToInput).attribute("ariaDisabled", "aria-disabled");
|
|
414
|
+
__privateGet(this, _reflectToInput).attribute("ariaHaspopup", "aria-haspopup");
|
|
415
|
+
__privateGet(this, _reflectToInput).attribute("ariaHidden", "aria-hidden");
|
|
416
|
+
__privateGet(this, _reflectToInput).attribute("ariaInvalid", "aria-invalid");
|
|
417
|
+
__privateGet(this, _reflectToInput).attribute("ariaKeyshortcuts", "aria-keyshortcuts");
|
|
418
|
+
__privateGet(this, _reflectToInput).attribute("ariaLabel", "aria-label");
|
|
419
|
+
__privateGet(this, _reflectToInput).attribute("ariaLive", "aria-live");
|
|
420
|
+
__privateGet(this, _reflectToInput).attribute("ariaRelevant", "aria-relevant");
|
|
421
|
+
__privateGet(this, _reflectToInput).attribute(
|
|
422
|
+
"ariaRoledescription",
|
|
423
|
+
"aria-roledescription"
|
|
424
|
+
);
|
|
425
|
+
__privateGet(this, _reflectToInput).property("value", "value", true);
|
|
426
|
+
__privateMethod(this, _TextField_instances, updateHelperTextMutationObserver_fn).call(this);
|
|
427
|
+
}
|
|
428
|
+
disconnectedCallback() {
|
|
429
|
+
super.disconnectedCallback();
|
|
430
|
+
__privateGet(this, _reflectToInput).destroy();
|
|
431
|
+
__privateSet(this, _reflectToInput, void 0);
|
|
432
|
+
__privateMethod(this, _TextField_instances, updateHelperTextMutationObserver_fn).call(this);
|
|
433
|
+
}
|
|
434
|
+
focus() {
|
|
435
|
+
this.control?.focus();
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* @internal
|
|
439
|
+
*/
|
|
440
|
+
helperTextChanged() {
|
|
441
|
+
__privateMethod(this, _TextField_instances, updateMirroredHelperText_fn).call(this);
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* @internal
|
|
445
|
+
*/
|
|
446
|
+
_helperTextSlottedContentChanged() {
|
|
447
|
+
__privateMethod(this, _TextField_instances, updateMirroredHelperText_fn).call(this);
|
|
448
|
+
__privateMethod(this, _TextField_instances, updateHelperTextMutationObserver_fn).call(this);
|
|
449
|
+
}
|
|
450
|
+
};
|
|
451
|
+
_TextField_instances = new WeakSet();
|
|
452
|
+
handleLabelChange_fn = function(labelEl) {
|
|
453
|
+
if (!this.label) {
|
|
454
|
+
labelEl.remove();
|
|
455
|
+
} else {
|
|
456
|
+
labelEl.textContent = this.label;
|
|
457
|
+
if (!labelEl.isConnected) {
|
|
458
|
+
this.appendChild(labelEl);
|
|
176
459
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
460
|
+
}
|
|
461
|
+
};
|
|
462
|
+
_reflectToInput = new WeakMap();
|
|
463
|
+
_helperTextMirrorEl = new WeakMap();
|
|
464
|
+
_helperTextSlotMutationObserver = new WeakMap();
|
|
465
|
+
updateHelperTextMutationObserver_fn = function() {
|
|
466
|
+
const usesHelperTextSlot = this._helperTextSlottedContent.length;
|
|
467
|
+
const shouldHaveMutationObserver = usesHelperTextSlot && this.isConnected;
|
|
468
|
+
if (shouldHaveMutationObserver && !__privateGet(this, _helperTextSlotMutationObserver)) {
|
|
469
|
+
__privateSet(this, _helperTextSlotMutationObserver, new MutationObserver((records) => {
|
|
470
|
+
if (records.some((record) => record.target !== __privateGet(this, _helperTextMirrorEl))) {
|
|
471
|
+
__privateMethod(this, _TextField_instances, updateMirroredHelperText_fn).call(this);
|
|
472
|
+
}
|
|
473
|
+
}));
|
|
474
|
+
__privateGet(this, _helperTextSlotMutationObserver).observe(this, {
|
|
475
|
+
subtree: true,
|
|
476
|
+
childList: true,
|
|
477
|
+
characterData: true
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
if (!shouldHaveMutationObserver && __privateGet(this, _helperTextSlotMutationObserver)) {
|
|
481
|
+
__privateGet(this, _helperTextSlotMutationObserver).disconnect();
|
|
482
|
+
__privateSet(this, _helperTextSlotMutationObserver, void 0);
|
|
483
|
+
}
|
|
484
|
+
};
|
|
485
|
+
updateMirroredHelperText_fn = function() {
|
|
486
|
+
let helperText = this.helperText ?? "";
|
|
487
|
+
if (this._helperTextSlottedContent?.length) {
|
|
488
|
+
helperText = this._helperTextSlottedContent.map((node) => node.innerText).join(" ");
|
|
489
|
+
}
|
|
490
|
+
if (__privateGet(this, _helperTextMirrorEl)) {
|
|
491
|
+
__privateGet(this, _helperTextMirrorEl).textContent = helperText;
|
|
492
|
+
if (helperText) {
|
|
493
|
+
this.control.setAttribute(
|
|
494
|
+
"aria-describedby",
|
|
495
|
+
__privateGet(this, _helperTextMirrorEl).id
|
|
496
|
+
);
|
|
497
|
+
} else {
|
|
498
|
+
this.control.removeAttribute("aria-describedby");
|
|
180
499
|
}
|
|
500
|
+
}
|
|
181
501
|
};
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
], TextField
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
], TextField
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
], TextField
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
], TextField
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
], TextField
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
], TextField
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
], TextField
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
], TextField
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
], TextField
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
], TextField
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
], TextField
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
502
|
+
__decorateClass([
|
|
503
|
+
attr({ attribute: "readonly", mode: "boolean" })
|
|
504
|
+
], TextField.prototype, "readOnly", 2);
|
|
505
|
+
__decorateClass([
|
|
506
|
+
attr({ mode: "boolean" })
|
|
507
|
+
], TextField.prototype, "autofocus", 2);
|
|
508
|
+
__decorateClass([
|
|
509
|
+
attr
|
|
510
|
+
], TextField.prototype, "placeholder", 2);
|
|
511
|
+
__decorateClass([
|
|
512
|
+
attr
|
|
513
|
+
], TextField.prototype, "type", 2);
|
|
514
|
+
__decorateClass([
|
|
515
|
+
attr
|
|
516
|
+
], TextField.prototype, "list", 2);
|
|
517
|
+
__decorateClass([
|
|
518
|
+
attr({ converter: nullableNumberConverter })
|
|
519
|
+
], TextField.prototype, "maxlength", 2);
|
|
520
|
+
__decorateClass([
|
|
521
|
+
attr({ converter: nullableNumberConverter })
|
|
522
|
+
], TextField.prototype, "minlength", 2);
|
|
523
|
+
__decorateClass([
|
|
524
|
+
attr
|
|
525
|
+
], TextField.prototype, "pattern", 2);
|
|
526
|
+
__decorateClass([
|
|
527
|
+
attr({ converter: nullableNumberConverter })
|
|
528
|
+
], TextField.prototype, "size", 2);
|
|
529
|
+
__decorateClass([
|
|
530
|
+
attr({ mode: "boolean" })
|
|
531
|
+
], TextField.prototype, "spellcheck", 2);
|
|
532
|
+
__decorateClass([
|
|
533
|
+
attr
|
|
534
|
+
], TextField.prototype, "appearance", 2);
|
|
535
|
+
__decorateClass([
|
|
536
|
+
attr
|
|
537
|
+
], TextField.prototype, "shape", 2);
|
|
538
|
+
__decorateClass([
|
|
539
|
+
attr
|
|
540
|
+
], TextField.prototype, "autoComplete", 2);
|
|
541
|
+
__decorateClass([
|
|
542
|
+
attr()
|
|
543
|
+
], TextField.prototype, "scale", 2);
|
|
544
|
+
__decorateClass([
|
|
545
|
+
attr({ attribute: "inputmode" })
|
|
546
|
+
], TextField.prototype, "inputMode", 2);
|
|
547
|
+
__decorateClass([
|
|
548
|
+
observable
|
|
549
|
+
], TextField.prototype, "actionItemsSlottedContent", 2);
|
|
550
|
+
__decorateClass([
|
|
551
|
+
observable
|
|
552
|
+
], TextField.prototype, "leadingActionItemsSlottedContent", 2);
|
|
553
|
+
TextField = __decorateClass([
|
|
554
|
+
errorText,
|
|
555
|
+
formElements
|
|
556
|
+
], TextField);
|
|
220
557
|
class DelegatesARIATextbox {
|
|
221
558
|
}
|
|
222
559
|
applyMixins(DelegatesARIATextbox, ARIAGlobalStatesAndProperties);
|
|
223
|
-
|
|
560
|
+
applyMixinsWithObservables(
|
|
561
|
+
TextField,
|
|
562
|
+
AffixIcon,
|
|
563
|
+
FormElementCharCount,
|
|
564
|
+
FormElementHelperText,
|
|
565
|
+
FormElementSuccessText,
|
|
566
|
+
DelegatesARIATextbox
|
|
567
|
+
);
|
|
224
568
|
|
|
225
|
-
export { DelegatesARIATextbox as D, TextField
|
|
569
|
+
export { DelegatesARIATextbox as D, Reflector as R, TextField as T };
|