@vonage/vivid 4.22.0 → 4.24.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 +1658 -370
- package/lib/accordion-item/accordion-item.d.ts +11 -5
- package/lib/action-group/action-group.d.ts +8 -6
- package/lib/alert/alert.d.ts +21 -9
- package/lib/audio-player/audio-player.d.ts +11 -5
- package/lib/badge/badge.d.ts +11 -5
- package/lib/banner/banner.d.ts +26 -12
- package/lib/breadcrumb/breadcrumb.d.ts +333 -1
- package/lib/breadcrumb/breadcrumb.template.d.ts +2 -3
- package/lib/breadcrumb-item/breadcrumb-item.d.ts +8 -6
- package/lib/button/button.d.ts +11 -5
- package/lib/calendar-event/calendar-event.d.ts +333 -1
- package/lib/checkbox/checkbox.d.ts +8 -6
- package/lib/combobox/combobox.d.ts +11 -5
- package/lib/date-picker/date-picker.d.ts +74 -50
- package/lib/date-range-picker/date-range-picker.d.ts +38 -26
- package/lib/date-time-picker/date-time-picker.d.ts +76 -52
- package/lib/dial-pad/dial-pad.d.ts +11 -5
- package/lib/dialog/dialog.d.ts +16 -8
- package/lib/divider/divider.d.ts +8 -6
- package/lib/fab/fab.d.ts +11 -5
- package/lib/file-picker/file-picker.d.ts +337 -1
- package/lib/file-picker/locale.d.ts +1 -0
- package/lib/header/header.d.ts +333 -1
- package/lib/menu/menu.d.ts +16 -8
- package/lib/menu-item/menu-item.d.ts +338 -2
- package/lib/nav/nav.d.ts +333 -1
- package/lib/nav-disclosure/nav-disclosure.d.ts +16 -8
- package/lib/nav-item/nav-item.d.ts +11 -5
- package/lib/note/note.d.ts +11 -5
- package/lib/number-field/number-field.d.ts +26 -12
- package/lib/option/option.d.ts +339 -3
- package/lib/progress/progress.d.ts +8 -6
- package/lib/progress-ring/progress-ring.d.ts +8 -6
- package/lib/radio-group/radio-group.d.ts +333 -1
- package/lib/range-slider/range-slider.d.ts +11 -5
- package/lib/rich-text-editor/facades/prose-mirror-vivid.schema.d.ts +1 -1
- package/lib/rich-text-editor/facades/vivid-prose-mirror.facade.d.ts +7 -1
- package/lib/rich-text-editor/locale.d.ts +9 -0
- package/lib/rich-text-editor/menubar/consts.d.ts +18 -0
- package/lib/rich-text-editor/menubar/menubar.d.ts +337 -1
- package/lib/rich-text-editor/rich-text-editor.d.ts +10 -0
- package/lib/searchable-select/locale.d.ts +1 -0
- package/lib/searchable-select/option-tag.d.ts +11 -5
- package/lib/searchable-select/searchable-select.d.ts +350 -7
- package/lib/select/select.d.ts +339 -3
- package/lib/selectable-box/selectable-box.d.ts +8 -6
- package/lib/slider/slider.d.ts +16 -8
- package/lib/split-button/split-button.d.ts +26 -12
- package/lib/switch/switch.d.ts +8 -6
- package/lib/tab/tab.d.ts +349 -7
- package/lib/tab-panel/tab-panel.d.ts +333 -1
- package/lib/tabs/tabs.d.ts +5 -21
- package/lib/tag/tag.d.ts +338 -2
- package/lib/tag-group/tag-group.d.ts +8 -6
- package/lib/text-anchor/text-anchor.d.ts +16 -8
- package/lib/text-area/text-area.d.ts +8 -6
- package/lib/text-field/text-field.d.ts +16 -8
- package/lib/time-picker/time-picker.d.ts +38 -26
- package/lib/toggletip/toggletip.d.ts +9 -3
- package/lib/tooltip/tooltip.d.ts +9 -3
- package/lib/tree-item/tree-item.d.ts +338 -2
- package/lib/tree-view/tree-view.d.ts +333 -1
- package/lib/video-player/video-player.d.ts +11 -5
- package/locales/de-DE.cjs +15 -1
- package/locales/de-DE.js +15 -1
- package/locales/en-GB.cjs +15 -1
- package/locales/en-GB.js +15 -1
- package/locales/en-US.cjs +15 -1
- package/locales/en-US.js +15 -1
- package/locales/ja-JP.cjs +15 -1
- package/locales/ja-JP.js +15 -1
- package/locales/zh-CN.cjs +15 -1
- package/locales/zh-CN.js +15 -1
- package/package.json +1 -1
- package/shared/affix.js +1 -1
- package/shared/aria/aria-change-subscription.d.ts +6 -0
- package/shared/aria/aria-mixin.d.ts +338 -0
- package/shared/aria/delegate-aria-behavior.d.ts +31 -0
- package/shared/aria/delegates-aria.d.ts +14 -9
- package/shared/aria/host-semantics-behavior.d.ts +22 -0
- package/shared/aria/host-semantics.d.ts +337 -0
- package/shared/attribute-binding-behaviour.cjs +41 -0
- package/shared/attribute-binding-behaviour.js +39 -0
- package/shared/button.cjs +6 -3
- package/shared/button.js +6 -3
- package/shared/calendar-event.cjs +2 -1
- package/shared/calendar-event.js +2 -1
- package/shared/definition.js +1 -1
- package/shared/definition10.cjs +8 -2
- package/shared/definition10.js +9 -3
- package/shared/definition11.cjs +4 -28
- package/shared/definition11.js +5 -29
- package/shared/definition12.cjs +5 -2
- package/shared/definition12.js +6 -3
- package/shared/definition13.js +1 -1
- package/shared/definition14.js +1 -1
- package/shared/definition15.cjs +8 -7
- package/shared/definition15.js +10 -9
- package/shared/definition16.js +1 -1
- package/shared/definition17.cjs +4 -1
- package/shared/definition17.js +5 -2
- package/shared/definition18.js +1 -1
- package/shared/definition19.js +1 -1
- package/shared/definition2.js +1 -1
- package/shared/definition20.js +1 -1
- package/shared/definition21.js +1 -1
- package/shared/definition22.cjs +11 -4
- package/shared/definition22.js +13 -6
- package/shared/definition23.cjs +4 -2
- package/shared/definition23.js +6 -4
- package/shared/definition24.js +1 -1
- package/shared/definition25.cjs +2 -14
- package/shared/definition25.js +3 -15
- package/shared/definition26.cjs +19 -3
- package/shared/definition26.js +20 -4
- package/shared/definition27.cjs +3 -2
- package/shared/definition27.js +4 -3
- package/shared/definition28.js +1 -1
- package/shared/definition29.js +1 -1
- package/shared/definition3.cjs +3 -2
- package/shared/definition3.js +5 -4
- package/shared/definition30.cjs +33 -34
- package/shared/definition30.js +35 -36
- package/shared/definition31.cjs +6 -4
- package/shared/definition31.js +8 -6
- package/shared/definition32.js +1 -1
- package/shared/definition33.cjs +7 -2
- package/shared/definition33.js +8 -3
- package/shared/definition34.js +1 -1
- package/shared/definition35.cjs +2 -13
- package/shared/definition35.js +4 -15
- package/shared/definition36.cjs +8 -5
- package/shared/definition36.js +9 -6
- package/shared/definition37.js +1 -1
- package/shared/definition38.cjs +7 -8
- package/shared/definition38.js +9 -10
- package/shared/definition39.cjs +7 -8
- package/shared/definition39.js +9 -10
- package/shared/definition4.js +1 -1
- package/shared/definition40.cjs +8 -5
- package/shared/definition40.js +9 -6
- package/shared/definition41.js +1 -1
- package/shared/definition42.js +1 -1
- package/shared/definition43.cjs +558 -134
- package/shared/definition43.js +550 -126
- package/shared/definition44.cjs +83 -10
- package/shared/definition44.js +84 -11
- package/shared/definition45.cjs +20 -8
- package/shared/definition45.js +21 -9
- package/shared/definition46.cjs +18 -6
- package/shared/definition46.js +20 -8
- package/shared/definition47.js +1 -1
- package/shared/definition48.js +1 -1
- package/shared/definition49.cjs +10 -3
- package/shared/definition49.js +12 -5
- package/shared/definition5.cjs +7 -2
- package/shared/definition5.js +8 -3
- package/shared/definition50.cjs +8 -7
- package/shared/definition50.js +10 -9
- package/shared/definition51.cjs +3 -2
- package/shared/definition51.js +4 -3
- package/shared/definition52.cjs +8 -4
- package/shared/definition52.js +9 -5
- package/shared/definition53.cjs +219 -297
- package/shared/definition53.js +221 -299
- package/shared/definition54.cjs +4 -3
- package/shared/definition54.js +6 -5
- package/shared/definition55.cjs +7 -4
- package/shared/definition55.js +8 -5
- package/shared/definition56.cjs +68 -14
- package/shared/definition56.js +69 -15
- package/shared/definition57.cjs +163 -112
- package/shared/definition57.js +165 -114
- package/shared/definition58.js +1 -1
- package/shared/definition59.js +1 -1
- package/shared/definition6.js +1 -1
- package/shared/definition60.js +1 -1
- package/shared/definition61.cjs +8 -5
- package/shared/definition61.js +9 -6
- package/shared/definition62.cjs +5 -2
- package/shared/definition62.js +6 -3
- package/shared/definition63.js +1 -1
- package/shared/definition64.js +1 -1
- package/shared/definition65.js +1 -1
- package/shared/definition7.js +1 -1
- package/shared/definition8.cjs +4 -2
- package/shared/definition8.js +6 -4
- package/shared/definition9.js +1 -1
- package/shared/delegates-aria.cjs +106 -56
- package/shared/delegates-aria.js +107 -58
- package/shared/foundation/button/button.d.ts +8 -6
- package/shared/foundation/vivid-element/vivid-element.d.ts +339 -1
- package/shared/host-semantics.cjs +65 -0
- package/shared/host-semantics.js +62 -0
- package/shared/localization/Locale.d.ts +2 -0
- package/shared/option.cjs +4 -1
- package/shared/option.js +4 -1
- package/shared/patterns/affix.d.ts +22 -10
- package/shared/patterns/anchored.d.ts +18 -6
- package/shared/patterns/localized.d.ts +11 -5
- package/shared/patterns/trapped-focus.d.ts +11 -5
- package/shared/picker-field/mixins/calendar-picker.d.ts +19 -13
- package/shared/picker-field/mixins/calendar-picker.template.d.ts +19 -13
- package/shared/picker-field/mixins/inline-time-picker/inline-time-picker.d.ts +11 -5
- package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +38 -26
- package/shared/picker-field/mixins/single-date-picker.d.ts +55 -37
- package/shared/picker-field/mixins/single-value-picker.d.ts +17 -11
- package/shared/picker-field/mixins/time-selection-picker.d.ts +38 -26
- package/shared/picker-field/mixins/time-selection-picker.template.d.ts +38 -26
- package/shared/picker-field/picker-field.d.ts +21 -9
- package/shared/picker-field.template.js +1 -1
- package/shared/repeat.js +1 -1
- package/shared/slider.template.cjs +10 -9
- package/shared/slider.template.js +10 -9
- package/shared/templating/attribute-binding-behaviour.d.ts +15 -0
- package/shared/templating/render-in-light-dom.d.ts +22 -0
- package/shared/text-anchor.template.cjs +2 -13
- package/shared/text-anchor.template.js +2 -13
- package/shared/time-selection-picker.template.js +1 -1
- package/shared/vivid-element.cjs +96 -2
- package/shared/vivid-element.js +93 -3
- package/styles/core/all.css +1 -1
- package/styles/core/theme.css +1 -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/text-anchor/index.js +1 -1
- package/vivid.api.json +188 -17
- package/shared/Reflector.cjs +0 -71
- package/shared/Reflector.js +0 -69
package/shared/definition57.cjs
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
const definition = require('./definition28.cjs');
|
|
4
4
|
const vividElement = require('./vivid-element.cjs');
|
|
5
|
-
const Reflector = require('./Reflector.cjs');
|
|
6
5
|
const applyMixinsWithObservables = require('./applyMixinsWithObservables.cjs');
|
|
7
6
|
const delegatesAria = require('./delegates-aria.cjs');
|
|
8
7
|
const formAssociated = require('./form-associated.cjs');
|
|
@@ -12,6 +11,7 @@ const textField = require('./text-field.cjs');
|
|
|
12
11
|
const classNames = require('./class-names.cjs');
|
|
13
12
|
const when = require('./when.cjs');
|
|
14
13
|
const slotted = require('./slotted.cjs');
|
|
14
|
+
const ref = require('./ref.cjs');
|
|
15
15
|
|
|
16
16
|
const byteToHex = [];
|
|
17
17
|
for (let i = 0; i < 256; ++i) {
|
|
@@ -98,7 +98,7 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
|
|
|
98
98
|
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);
|
|
99
99
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
|
|
100
100
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
101
|
-
var
|
|
101
|
+
var _randomId, _helperTextSlotMutationObserver, _TextField_instances, updateHelperTextMutationObserver_fn, updateMirroredHelperText_fn;
|
|
102
102
|
const TextFieldType = {
|
|
103
103
|
/**
|
|
104
104
|
* A text TextField
|
|
@@ -120,7 +120,11 @@ const getSafariWorkaroundStyleSheet = definition.memoizeWith(
|
|
|
120
120
|
return styleSheet;
|
|
121
121
|
}
|
|
122
122
|
);
|
|
123
|
-
const
|
|
123
|
+
const installSafariWorkaroundStyleIfNeeded = (forElement) => {
|
|
124
|
+
if (forElement._isSafariWorkaroundInstalled) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
forElement._isSafariWorkaroundInstalled = true;
|
|
124
128
|
const root = forElement.getRootNode();
|
|
125
129
|
const workaroundStyleSheet = getSafariWorkaroundStyleSheet();
|
|
126
130
|
const supportsAdoptedStyleSheets = "adoptedStyleSheets" in root;
|
|
@@ -142,12 +146,8 @@ exports.TextField = class TextField extends affix.AffixIcon(
|
|
|
142
146
|
__privateAdd(this, _TextField_instances);
|
|
143
147
|
// eslint-disable-next-line @nrwl/nx/workspace/no-attribute-default-value
|
|
144
148
|
this.type = TextFieldType.text;
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
*/
|
|
148
|
-
this._labelEl = null;
|
|
149
|
-
__privateAdd(this, _reflectToInput);
|
|
150
|
-
__privateAdd(this, _helperTextMirrorEl);
|
|
149
|
+
__privateAdd(this, _randomId, generateRandomId());
|
|
150
|
+
this._mirroredHelperText = "";
|
|
151
151
|
__privateAdd(this, _helperTextSlotMutationObserver);
|
|
152
152
|
}
|
|
153
153
|
/**
|
|
@@ -237,6 +237,24 @@ exports.TextField = class TextField extends affix.AffixIcon(
|
|
|
237
237
|
this.proxy.spellcheck = this.spellcheck;
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
|
+
/**
|
|
241
|
+
* @internal
|
|
242
|
+
*/
|
|
243
|
+
valueChanged(previous, next) {
|
|
244
|
+
super.valueChanged(previous, next);
|
|
245
|
+
this._updateControlValueIfNeeded();
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Update the controls value only if it is actually different from the actual value.
|
|
249
|
+
* This is important as to not reset the browser's "dirtiness" flag on the input, which is used for min/maxlength
|
|
250
|
+
* constraints.
|
|
251
|
+
* @internal
|
|
252
|
+
*/
|
|
253
|
+
_updateControlValueIfNeeded() {
|
|
254
|
+
if (this.control && this.control.value !== this.value) {
|
|
255
|
+
this.control.value = this.value;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
240
258
|
/**
|
|
241
259
|
* Selects all the text in the text field
|
|
242
260
|
*
|
|
@@ -268,14 +286,6 @@ exports.TextField = class TextField extends affix.AffixIcon(
|
|
|
268
286
|
validate() {
|
|
269
287
|
super.validate(this.control);
|
|
270
288
|
}
|
|
271
|
-
/**
|
|
272
|
-
* @internal
|
|
273
|
-
*/
|
|
274
|
-
labelChanged() {
|
|
275
|
-
if (this._labelEl) {
|
|
276
|
-
__privateMethod(this, _TextField_instances, handleLabelChange_fn).call(this, this._labelEl);
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
289
|
connectedCallback() {
|
|
280
290
|
super.connectedCallback();
|
|
281
291
|
this.proxy.setAttribute("type", this.type);
|
|
@@ -285,82 +295,23 @@ exports.TextField = class TextField extends affix.AffixIcon(
|
|
|
285
295
|
this.focus();
|
|
286
296
|
});
|
|
287
297
|
}
|
|
288
|
-
|
|
289
|
-
const uniqueId = this.id || generateRandomId();
|
|
290
|
-
const controlId = `vvd-text-field-control-${uniqueId}`;
|
|
291
|
-
const helperTextId = `vvd-text-field-helper-text-${uniqueId}`;
|
|
292
|
-
const input = document.createElement("input");
|
|
293
|
-
input.slot = "_control";
|
|
294
|
-
input.id = controlId;
|
|
295
|
-
input.className = safariWorkaroundClassName;
|
|
296
|
-
this.control = input;
|
|
297
|
-
input.addEventListener("input", () => {
|
|
298
|
-
this.handleTextInput();
|
|
299
|
-
});
|
|
300
|
-
input.addEventListener("change", () => {
|
|
301
|
-
this.handleChange();
|
|
302
|
-
});
|
|
303
|
-
input.addEventListener("blur", () => {
|
|
304
|
-
this.$emit("blur", void 0, { bubbles: false });
|
|
305
|
-
});
|
|
306
|
-
input.addEventListener("focus", () => {
|
|
307
|
-
this.$emit("focus", void 0, { bubbles: false });
|
|
308
|
-
});
|
|
309
|
-
this.appendChild(input);
|
|
310
|
-
const label = document.createElement("label");
|
|
311
|
-
label.slot = "_label";
|
|
312
|
-
label.htmlFor = controlId;
|
|
313
|
-
this._labelEl = label;
|
|
314
|
-
__privateMethod(this, _TextField_instances, handleLabelChange_fn).call(this, label);
|
|
315
|
-
__privateSet(this, _helperTextMirrorEl, document.createElement("div"));
|
|
316
|
-
__privateGet(this, _helperTextMirrorEl).id = helperTextId;
|
|
317
|
-
__privateGet(this, _helperTextMirrorEl).slot = "_mirrored-helper-text";
|
|
318
|
-
__privateMethod(this, _TextField_instances, updateMirroredHelperText_fn).call(this);
|
|
319
|
-
this.appendChild(__privateGet(this, _helperTextMirrorEl));
|
|
320
|
-
installSafariWorkaroundStyle(this);
|
|
321
|
-
}
|
|
322
|
-
__privateSet(this, _reflectToInput, new Reflector.Reflector(this, this.control));
|
|
323
|
-
__privateGet(this, _reflectToInput).booleanAttribute("autofocus", "autofocus");
|
|
324
|
-
__privateGet(this, _reflectToInput).booleanAttribute("disabled", "disabled");
|
|
325
|
-
__privateGet(this, _reflectToInput).booleanAttribute("readOnly", "readonly");
|
|
326
|
-
__privateGet(this, _reflectToInput).booleanAttribute("required", "required");
|
|
327
|
-
__privateGet(this, _reflectToInput).booleanAttribute("spellcheck", "spellcheck");
|
|
328
|
-
__privateGet(this, _reflectToInput).attribute("list", "list");
|
|
329
|
-
__privateGet(this, _reflectToInput).attribute("maxlength", "maxlength");
|
|
330
|
-
__privateGet(this, _reflectToInput).attribute("minlength", "minlength");
|
|
331
|
-
__privateGet(this, _reflectToInput).attribute("pattern", "pattern");
|
|
332
|
-
__privateGet(this, _reflectToInput).attribute("placeholder", "placeholder");
|
|
333
|
-
__privateGet(this, _reflectToInput).attribute("size", "size");
|
|
334
|
-
__privateGet(this, _reflectToInput).attribute("autoComplete", "autocomplete");
|
|
335
|
-
__privateGet(this, _reflectToInput).attribute("type", "type");
|
|
336
|
-
__privateGet(this, _reflectToInput).attribute("inputMode", "inputmode");
|
|
337
|
-
__privateGet(this, _reflectToInput).attribute("ariaAtomic", "aria-atomic");
|
|
338
|
-
__privateGet(this, _reflectToInput).attribute("ariaBusy", "aria-busy");
|
|
339
|
-
__privateGet(this, _reflectToInput).attribute("ariaCurrent", "aria-current");
|
|
340
|
-
__privateGet(this, _reflectToInput).attribute("ariaDisabled", "aria-disabled");
|
|
341
|
-
__privateGet(this, _reflectToInput).attribute("ariaHasPopup", "aria-haspopup");
|
|
342
|
-
__privateGet(this, _reflectToInput).attribute("ariaHidden", "aria-hidden");
|
|
343
|
-
__privateGet(this, _reflectToInput).attribute("ariaInvalid", "aria-invalid");
|
|
344
|
-
__privateGet(this, _reflectToInput).attribute("ariaKeyShortcuts", "aria-keyshortcuts");
|
|
345
|
-
__privateGet(this, _reflectToInput).attribute("ariaLabel", "aria-label");
|
|
346
|
-
__privateGet(this, _reflectToInput).attribute("ariaLive", "aria-live");
|
|
347
|
-
__privateGet(this, _reflectToInput).attribute("ariaRelevant", "aria-relevant");
|
|
348
|
-
__privateGet(this, _reflectToInput).attribute(
|
|
349
|
-
"ariaRoleDescription",
|
|
350
|
-
"aria-roledescription"
|
|
351
|
-
);
|
|
352
|
-
__privateGet(this, _reflectToInput).property("value", "value", true);
|
|
298
|
+
this._updateControlValueIfNeeded();
|
|
353
299
|
__privateMethod(this, _TextField_instances, updateHelperTextMutationObserver_fn).call(this);
|
|
300
|
+
installSafariWorkaroundStyleIfNeeded(this);
|
|
354
301
|
}
|
|
355
302
|
disconnectedCallback() {
|
|
356
303
|
super.disconnectedCallback();
|
|
357
|
-
__privateGet(this, _reflectToInput).destroy();
|
|
358
|
-
__privateSet(this, _reflectToInput, void 0);
|
|
359
304
|
__privateMethod(this, _TextField_instances, updateHelperTextMutationObserver_fn).call(this);
|
|
360
305
|
}
|
|
361
306
|
focus() {
|
|
362
307
|
this.control?.focus();
|
|
363
308
|
}
|
|
309
|
+
/**
|
|
310
|
+
* @internal
|
|
311
|
+
*/
|
|
312
|
+
get _uniqueId() {
|
|
313
|
+
return this.id || __privateGet(this, _randomId);
|
|
314
|
+
}
|
|
364
315
|
/**
|
|
365
316
|
* @internal
|
|
366
317
|
*/
|
|
@@ -375,26 +326,20 @@ exports.TextField = class TextField extends affix.AffixIcon(
|
|
|
375
326
|
__privateMethod(this, _TextField_instances, updateHelperTextMutationObserver_fn).call(this);
|
|
376
327
|
}
|
|
377
328
|
};
|
|
378
|
-
|
|
379
|
-
handleLabelChange_fn = function(labelEl) {
|
|
380
|
-
if (!this.label) {
|
|
381
|
-
labelEl.remove();
|
|
382
|
-
} else {
|
|
383
|
-
labelEl.textContent = this.label;
|
|
384
|
-
if (!labelEl.isConnected) {
|
|
385
|
-
this.appendChild(labelEl);
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
};
|
|
389
|
-
_reflectToInput = new WeakMap();
|
|
390
|
-
_helperTextMirrorEl = new WeakMap();
|
|
329
|
+
_randomId = new WeakMap();
|
|
391
330
|
_helperTextSlotMutationObserver = new WeakMap();
|
|
331
|
+
_TextField_instances = new WeakSet();
|
|
392
332
|
updateHelperTextMutationObserver_fn = function() {
|
|
393
333
|
const usesHelperTextSlot = this._helperTextSlottedContent.length;
|
|
394
334
|
const shouldHaveMutationObserver = usesHelperTextSlot && this.isConnected;
|
|
395
335
|
if (shouldHaveMutationObserver && !__privateGet(this, _helperTextSlotMutationObserver)) {
|
|
396
336
|
__privateSet(this, _helperTextSlotMutationObserver, new MutationObserver((records) => {
|
|
397
|
-
if (
|
|
337
|
+
if (
|
|
338
|
+
// Ignore updates to the mirrored helper text itself
|
|
339
|
+
records.some(
|
|
340
|
+
(record) => record.target instanceof HTMLElement && record.target.slot !== "_mirrored-helper-text"
|
|
341
|
+
)
|
|
342
|
+
) {
|
|
398
343
|
__privateMethod(this, _TextField_instances, updateMirroredHelperText_fn).call(this);
|
|
399
344
|
}
|
|
400
345
|
}));
|
|
@@ -414,17 +359,7 @@ updateMirroredHelperText_fn = function() {
|
|
|
414
359
|
if (this._helperTextSlottedContent?.length) {
|
|
415
360
|
helperText = this._helperTextSlottedContent.map((node) => node.innerText).join(" ");
|
|
416
361
|
}
|
|
417
|
-
|
|
418
|
-
__privateGet(this, _helperTextMirrorEl).textContent = helperText;
|
|
419
|
-
if (helperText) {
|
|
420
|
-
this.control.setAttribute(
|
|
421
|
-
"aria-describedby",
|
|
422
|
-
__privateGet(this, _helperTextMirrorEl).id
|
|
423
|
-
);
|
|
424
|
-
} else {
|
|
425
|
-
this.control.removeAttribute("aria-describedby");
|
|
426
|
-
}
|
|
427
|
-
}
|
|
362
|
+
this._mirroredHelperText = helperText;
|
|
428
363
|
};
|
|
429
364
|
__decorateClass([
|
|
430
365
|
vividElement.attr({ attribute: "readonly", mode: "boolean" })
|
|
@@ -477,6 +412,9 @@ __decorateClass([
|
|
|
477
412
|
__decorateClass([
|
|
478
413
|
vividElement.observable
|
|
479
414
|
], exports.TextField.prototype, "leadingActionItemsSlottedContent", 2);
|
|
415
|
+
__decorateClass([
|
|
416
|
+
vividElement.observable
|
|
417
|
+
], exports.TextField.prototype, "_mirroredHelperText", 2);
|
|
480
418
|
exports.TextField = __decorateClass([
|
|
481
419
|
formElements.errorText,
|
|
482
420
|
formElements.formElements
|
|
@@ -488,6 +426,67 @@ applyMixinsWithObservables.applyMixinsWithObservables(
|
|
|
488
426
|
formElements.FormElementSuccessText
|
|
489
427
|
);
|
|
490
428
|
|
|
429
|
+
class RenderInLightDomBehaviour {
|
|
430
|
+
constructor(templateBinding, isTemplateBindingVolatile) {
|
|
431
|
+
this.source = null;
|
|
432
|
+
this.templateBindingObserver = vividElement.Observable.binding(
|
|
433
|
+
templateBinding,
|
|
434
|
+
this,
|
|
435
|
+
isTemplateBindingVolatile
|
|
436
|
+
);
|
|
437
|
+
}
|
|
438
|
+
bind(source, context) {
|
|
439
|
+
this.source = source;
|
|
440
|
+
this.context = context;
|
|
441
|
+
if (!this.insertionPoint) {
|
|
442
|
+
this.insertionPoint = document.createComment("");
|
|
443
|
+
source.appendChild(this.insertionPoint);
|
|
444
|
+
}
|
|
445
|
+
this.handleChange();
|
|
446
|
+
}
|
|
447
|
+
unbind() {
|
|
448
|
+
this.source = null;
|
|
449
|
+
this.view.unbind();
|
|
450
|
+
this.templateBindingObserver.disconnect();
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Handles change of the template itself.
|
|
454
|
+
*/
|
|
455
|
+
handleChange() {
|
|
456
|
+
this.instantiateTemplate(
|
|
457
|
+
this.templateBindingObserver.observe(this.source, this.context)
|
|
458
|
+
);
|
|
459
|
+
}
|
|
460
|
+
instantiateTemplate(template) {
|
|
461
|
+
if (this.view) {
|
|
462
|
+
this.view.dispose();
|
|
463
|
+
}
|
|
464
|
+
this.view = template.create();
|
|
465
|
+
this.view.bind(this.source, this.context);
|
|
466
|
+
this.view.insertBefore(this.insertionPoint);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
class RenderInLightDomDirective extends vividElement.HTMLDirective {
|
|
470
|
+
constructor(templateBinding) {
|
|
471
|
+
super();
|
|
472
|
+
this.templateBinding = templateBinding;
|
|
473
|
+
this.createPlaceholder = vividElement.DOM.createBlockPlaceholder;
|
|
474
|
+
this.isTemplateBindingVolatile = vividElement.Observable.isVolatileBinding(templateBinding);
|
|
475
|
+
}
|
|
476
|
+
createBehavior() {
|
|
477
|
+
return new RenderInLightDomBehaviour(
|
|
478
|
+
this.templateBinding,
|
|
479
|
+
this.isTemplateBindingVolatile
|
|
480
|
+
);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
function renderInLightDOM(templateOrTemplateBinding) {
|
|
484
|
+
const templateBinding = typeof templateOrTemplateBinding === "function" ? templateOrTemplateBinding : () => templateOrTemplateBinding;
|
|
485
|
+
return new RenderInLightDomDirective(templateBinding);
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
const getControlId = (id) => `vvd-text-field-control-${id}`;
|
|
489
|
+
const getHelperTextId = (id) => `vvd-text-field-helper-text-${id}`;
|
|
491
490
|
const getStateClasses = ({
|
|
492
491
|
errorValidationMessage,
|
|
493
492
|
disabled,
|
|
@@ -527,9 +526,20 @@ function renderCharCount() {
|
|
|
527
526
|
}
|
|
528
527
|
const TextfieldTemplate = (context) => {
|
|
529
528
|
const affixIconTemplate = affix.affixIconTemplateFactory(context);
|
|
530
|
-
return vividElement.html`
|
|
529
|
+
return vividElement.html`
|
|
530
|
+
<div class="base ${getStateClasses}">
|
|
531
531
|
${when.when((x) => x.charCount && x.maxlength, renderCharCount())}
|
|
532
532
|
<slot class="label" name="_label"></slot>
|
|
533
|
+
${renderInLightDOM(vividElement.html`
|
|
534
|
+
${when.when(
|
|
535
|
+
(x) => x.label,
|
|
536
|
+
vividElement.html`
|
|
537
|
+
<label slot="_label" for="${(x) => getControlId(x._uniqueId)}">
|
|
538
|
+
${(x) => x.label}
|
|
539
|
+
</label>
|
|
540
|
+
`
|
|
541
|
+
)}
|
|
542
|
+
`)}
|
|
533
543
|
<div class="fieldset">
|
|
534
544
|
<div class="leading-items-wrapper">
|
|
535
545
|
<slot
|
|
@@ -538,9 +548,41 @@ const TextfieldTemplate = (context) => {
|
|
|
538
548
|
></slot>
|
|
539
549
|
${(x) => affixIconTemplate(x.icon)}
|
|
540
550
|
</div>
|
|
541
|
-
|
|
542
551
|
<div class="wrapper">
|
|
543
552
|
<slot class="control" name="_control"></slot>
|
|
553
|
+
${renderInLightDOM(
|
|
554
|
+
vividElement.html`<input
|
|
555
|
+
slot="_control"
|
|
556
|
+
id="${(x) => getControlId(x._uniqueId)}"
|
|
557
|
+
class="_vvd-3-text-field-safari-workaround"
|
|
558
|
+
@input="${(x) => x.handleTextInput()}"
|
|
559
|
+
@change="${(x) => x.handleChange()}"
|
|
560
|
+
@blur="${(x) => {
|
|
561
|
+
x.$emit("blur", void 0, { bubbles: false });
|
|
562
|
+
}}"
|
|
563
|
+
@focus="${(x) => {
|
|
564
|
+
x.$emit("focus", void 0, { bubbles: false });
|
|
565
|
+
}}"
|
|
566
|
+
?autofocus="${(x) => x.autofocus}"
|
|
567
|
+
?disabled="${(x) => x.disabled}"
|
|
568
|
+
?readonly="${(x) => x.readOnly}"
|
|
569
|
+
?required="${(x) => x.required}"
|
|
570
|
+
?spellcheck="${(x) => x.spellcheck}"
|
|
571
|
+
list="${(x) => x.list}"
|
|
572
|
+
maxlength="${(x) => x.maxlength}"
|
|
573
|
+
minlength="${(x) => x.minlength}"
|
|
574
|
+
pattern="${(x) => x.pattern}"
|
|
575
|
+
placeholder="${(x) => x.placeholder}"
|
|
576
|
+
size="${(x) => x.size}"
|
|
577
|
+
autocomplete="${(x) => x.autoComplete}"
|
|
578
|
+
type="${(x) => x.type}"
|
|
579
|
+
inputmode="${(x) => x.inputMode}"
|
|
580
|
+
aria-describedby="${(x) => x._mirroredHelperText ? getHelperTextId(x._uniqueId) : null}"
|
|
581
|
+
value="${(x) => x.initialValue}"
|
|
582
|
+
${delegatesAria.delegateAria()}
|
|
583
|
+
${ref.ref("control")}
|
|
584
|
+
/>`
|
|
585
|
+
)}
|
|
544
586
|
</div>
|
|
545
587
|
<div class="action-items-wrapper">
|
|
546
588
|
<slot
|
|
@@ -551,7 +593,16 @@ const TextfieldTemplate = (context) => {
|
|
|
551
593
|
</div>
|
|
552
594
|
${formElements.getFeedbackTemplate(context)}
|
|
553
595
|
</div>
|
|
554
|
-
<slot name="_mirrored-helper-text"></slot
|
|
596
|
+
<slot name="_mirrored-helper-text"></slot>
|
|
597
|
+
${renderInLightDOM(vividElement.html`
|
|
598
|
+
<div
|
|
599
|
+
id="${(x) => getHelperTextId(x._uniqueId)}"
|
|
600
|
+
slot="_mirrored-helper-text"
|
|
601
|
+
>
|
|
602
|
+
${(x) => x._mirroredHelperText}
|
|
603
|
+
</div>
|
|
604
|
+
`)}
|
|
605
|
+
`;
|
|
555
606
|
};
|
|
556
607
|
|
|
557
608
|
const textFieldDefinition = vividElement.defineVividComponent(
|