@vonage/vivid 4.22.0 → 4.23.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.
Files changed (213) hide show
  1. package/custom-elements.json +1987 -631
  2. package/lib/accordion-item/accordion-item.d.ts +11 -5
  3. package/lib/action-group/action-group.d.ts +8 -6
  4. package/lib/alert/alert.d.ts +21 -9
  5. package/lib/audio-player/audio-player.d.ts +11 -5
  6. package/lib/badge/badge.d.ts +11 -5
  7. package/lib/banner/banner.d.ts +26 -12
  8. package/lib/breadcrumb/breadcrumb.d.ts +333 -1
  9. package/lib/breadcrumb/breadcrumb.template.d.ts +2 -3
  10. package/lib/breadcrumb-item/breadcrumb-item.d.ts +8 -6
  11. package/lib/button/button.d.ts +11 -5
  12. package/lib/calendar-event/calendar-event.d.ts +333 -1
  13. package/lib/checkbox/checkbox.d.ts +8 -6
  14. package/lib/combobox/combobox.d.ts +11 -5
  15. package/lib/date-picker/date-picker.d.ts +74 -50
  16. package/lib/date-range-picker/date-range-picker.d.ts +38 -26
  17. package/lib/date-time-picker/date-time-picker.d.ts +76 -52
  18. package/lib/dial-pad/dial-pad.d.ts +11 -5
  19. package/lib/dialog/dialog.d.ts +16 -8
  20. package/lib/divider/divider.d.ts +8 -6
  21. package/lib/fab/fab.d.ts +11 -5
  22. package/lib/file-picker/file-picker.d.ts +339 -3
  23. package/lib/header/header.d.ts +333 -1
  24. package/lib/menu/menu.d.ts +16 -8
  25. package/lib/menu-item/menu-item.d.ts +338 -2
  26. package/lib/nav/nav.d.ts +333 -1
  27. package/lib/nav-disclosure/nav-disclosure.d.ts +16 -8
  28. package/lib/nav-item/nav-item.d.ts +11 -5
  29. package/lib/note/note.d.ts +11 -5
  30. package/lib/number-field/number-field.d.ts +26 -12
  31. package/lib/option/option.d.ts +339 -3
  32. package/lib/progress/progress.d.ts +8 -6
  33. package/lib/progress-ring/progress-ring.d.ts +8 -6
  34. package/lib/radio-group/radio-group.d.ts +333 -1
  35. package/lib/range-slider/range-slider.d.ts +11 -5
  36. package/lib/rich-text-editor/facades/prose-mirror-vivid.schema.d.ts +1 -1
  37. package/lib/rich-text-editor/facades/vivid-prose-mirror.facade.d.ts +7 -1
  38. package/lib/rich-text-editor/menubar/consts.d.ts +18 -0
  39. package/lib/rich-text-editor/menubar/menubar.d.ts +3 -0
  40. package/lib/rich-text-editor/rich-text-editor.d.ts +10 -0
  41. package/lib/searchable-select/option-tag.d.ts +11 -5
  42. package/lib/searchable-select/searchable-select.d.ts +349 -7
  43. package/lib/select/select.d.ts +339 -3
  44. package/lib/selectable-box/selectable-box.d.ts +8 -6
  45. package/lib/slider/slider.d.ts +16 -8
  46. package/lib/split-button/split-button.d.ts +26 -12
  47. package/lib/switch/switch.d.ts +8 -6
  48. package/lib/tab/tab.d.ts +349 -7
  49. package/lib/tab-panel/tab-panel.d.ts +333 -1
  50. package/lib/tag/tag.d.ts +338 -2
  51. package/lib/tag-group/tag-group.d.ts +8 -6
  52. package/lib/text-anchor/text-anchor.d.ts +16 -8
  53. package/lib/text-area/text-area.d.ts +8 -6
  54. package/lib/text-field/text-field.d.ts +16 -8
  55. package/lib/time-picker/time-picker.d.ts +38 -26
  56. package/lib/toggletip/toggletip.d.ts +9 -3
  57. package/lib/tooltip/tooltip.d.ts +9 -3
  58. package/lib/tree-item/tree-item.d.ts +338 -2
  59. package/lib/tree-view/tree-view.d.ts +333 -1
  60. package/lib/video-player/video-player.d.ts +11 -5
  61. package/package.json +1 -1
  62. package/shared/affix.js +1 -1
  63. package/shared/aria/aria-change-subscription.d.ts +6 -0
  64. package/shared/aria/aria-mixin.d.ts +338 -0
  65. package/shared/aria/delegate-aria-behavior.d.ts +31 -0
  66. package/shared/aria/delegates-aria.d.ts +14 -9
  67. package/shared/aria/host-semantics-behavior.d.ts +22 -0
  68. package/shared/aria/host-semantics.d.ts +337 -0
  69. package/shared/attribute-binding-behaviour.cjs +41 -0
  70. package/shared/attribute-binding-behaviour.js +39 -0
  71. package/shared/calendar-event.cjs +2 -1
  72. package/shared/calendar-event.js +2 -1
  73. package/shared/definition.js +1 -1
  74. package/shared/definition10.cjs +8 -2
  75. package/shared/definition10.js +9 -3
  76. package/shared/definition11.cjs +4 -28
  77. package/shared/definition11.js +5 -29
  78. package/shared/definition12.cjs +4 -1
  79. package/shared/definition12.js +5 -2
  80. package/shared/definition13.js +1 -1
  81. package/shared/definition14.js +1 -1
  82. package/shared/definition15.cjs +8 -7
  83. package/shared/definition15.js +10 -9
  84. package/shared/definition16.js +1 -1
  85. package/shared/definition17.js +1 -1
  86. package/shared/definition18.js +1 -1
  87. package/shared/definition19.js +1 -1
  88. package/shared/definition2.js +1 -1
  89. package/shared/definition20.js +1 -1
  90. package/shared/definition21.js +1 -1
  91. package/shared/definition22.cjs +3 -2
  92. package/shared/definition22.js +5 -4
  93. package/shared/definition23.cjs +4 -2
  94. package/shared/definition23.js +6 -4
  95. package/shared/definition24.js +1 -1
  96. package/shared/definition25.cjs +2 -14
  97. package/shared/definition25.js +3 -15
  98. package/shared/definition26.cjs +7 -2
  99. package/shared/definition26.js +8 -3
  100. package/shared/definition27.cjs +3 -2
  101. package/shared/definition27.js +4 -3
  102. package/shared/definition28.js +1 -1
  103. package/shared/definition29.js +1 -1
  104. package/shared/definition3.cjs +3 -2
  105. package/shared/definition3.js +5 -4
  106. package/shared/definition30.cjs +33 -34
  107. package/shared/definition30.js +35 -36
  108. package/shared/definition31.cjs +6 -4
  109. package/shared/definition31.js +8 -6
  110. package/shared/definition32.js +1 -1
  111. package/shared/definition33.cjs +7 -2
  112. package/shared/definition33.js +8 -3
  113. package/shared/definition34.js +1 -1
  114. package/shared/definition35.cjs +2 -13
  115. package/shared/definition35.js +4 -15
  116. package/shared/definition36.cjs +8 -5
  117. package/shared/definition36.js +9 -6
  118. package/shared/definition37.js +1 -1
  119. package/shared/definition38.cjs +7 -8
  120. package/shared/definition38.js +9 -10
  121. package/shared/definition39.cjs +7 -8
  122. package/shared/definition39.js +9 -10
  123. package/shared/definition4.js +1 -1
  124. package/shared/definition40.cjs +8 -5
  125. package/shared/definition40.js +9 -6
  126. package/shared/definition41.js +1 -1
  127. package/shared/definition42.js +1 -1
  128. package/shared/definition43.cjs +465 -105
  129. package/shared/definition43.js +457 -97
  130. package/shared/definition44.cjs +9 -6
  131. package/shared/definition44.js +10 -7
  132. package/shared/definition45.cjs +13 -7
  133. package/shared/definition45.js +14 -8
  134. package/shared/definition46.cjs +18 -6
  135. package/shared/definition46.js +20 -8
  136. package/shared/definition47.js +1 -1
  137. package/shared/definition48.js +1 -1
  138. package/shared/definition49.cjs +10 -3
  139. package/shared/definition49.js +12 -5
  140. package/shared/definition5.cjs +7 -2
  141. package/shared/definition5.js +8 -3
  142. package/shared/definition50.cjs +7 -6
  143. package/shared/definition50.js +9 -8
  144. package/shared/definition51.cjs +3 -2
  145. package/shared/definition51.js +4 -3
  146. package/shared/definition52.cjs +8 -4
  147. package/shared/definition52.js +9 -5
  148. package/shared/definition53.js +1 -1
  149. package/shared/definition54.cjs +4 -3
  150. package/shared/definition54.js +6 -5
  151. package/shared/definition55.cjs +7 -4
  152. package/shared/definition55.js +8 -5
  153. package/shared/definition56.cjs +68 -14
  154. package/shared/definition56.js +69 -15
  155. package/shared/definition57.cjs +163 -112
  156. package/shared/definition57.js +165 -114
  157. package/shared/definition58.js +1 -1
  158. package/shared/definition59.js +1 -1
  159. package/shared/definition6.js +1 -1
  160. package/shared/definition60.js +1 -1
  161. package/shared/definition61.cjs +8 -5
  162. package/shared/definition61.js +9 -6
  163. package/shared/definition62.cjs +5 -2
  164. package/shared/definition62.js +6 -3
  165. package/shared/definition63.js +1 -1
  166. package/shared/definition64.js +1 -1
  167. package/shared/definition65.js +1 -1
  168. package/shared/definition7.js +1 -1
  169. package/shared/definition8.cjs +4 -2
  170. package/shared/definition8.js +6 -4
  171. package/shared/definition9.js +1 -1
  172. package/shared/delegates-aria.cjs +106 -56
  173. package/shared/delegates-aria.js +107 -58
  174. package/shared/foundation/button/button.d.ts +8 -6
  175. package/shared/foundation/vivid-element/vivid-element.d.ts +339 -1
  176. package/shared/host-semantics.cjs +65 -0
  177. package/shared/host-semantics.js +62 -0
  178. package/shared/option.cjs +4 -1
  179. package/shared/option.js +4 -1
  180. package/shared/patterns/affix.d.ts +22 -10
  181. package/shared/patterns/anchored.d.ts +18 -6
  182. package/shared/patterns/localized.d.ts +11 -5
  183. package/shared/patterns/trapped-focus.d.ts +11 -5
  184. package/shared/picker-field/mixins/calendar-picker.d.ts +19 -13
  185. package/shared/picker-field/mixins/calendar-picker.template.d.ts +19 -13
  186. package/shared/picker-field/mixins/inline-time-picker/inline-time-picker.d.ts +11 -5
  187. package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +38 -26
  188. package/shared/picker-field/mixins/single-date-picker.d.ts +55 -37
  189. package/shared/picker-field/mixins/single-value-picker.d.ts +17 -11
  190. package/shared/picker-field/mixins/time-selection-picker.d.ts +38 -26
  191. package/shared/picker-field/mixins/time-selection-picker.template.d.ts +38 -26
  192. package/shared/picker-field/picker-field.d.ts +21 -9
  193. package/shared/picker-field.template.js +1 -1
  194. package/shared/repeat.js +1 -1
  195. package/shared/slider.template.cjs +10 -9
  196. package/shared/slider.template.js +10 -9
  197. package/shared/templating/attribute-binding-behaviour.d.ts +15 -0
  198. package/shared/templating/render-in-light-dom.d.ts +22 -0
  199. package/shared/text-anchor.template.cjs +2 -13
  200. package/shared/text-anchor.template.js +2 -13
  201. package/shared/time-selection-picker.template.js +1 -1
  202. package/shared/vivid-element.cjs +96 -2
  203. package/shared/vivid-element.js +93 -3
  204. package/styles/core/all.css +1 -1
  205. package/styles/core/theme.css +1 -1
  206. package/styles/core/typography.css +1 -1
  207. package/styles/tokens/theme-dark.css +4 -4
  208. package/styles/tokens/theme-light.css +4 -4
  209. package/styles/tokens/vivid-2-compat.css +1 -1
  210. package/text-anchor/index.js +1 -1
  211. package/vivid.api.json +155 -14
  212. package/shared/Reflector.cjs +0 -71
  213. package/shared/Reflector.js +0 -69
@@ -1,8 +1,7 @@
1
1
  import { m as memoizeWith, i as iconDefinition } from './definition28.js';
2
- import { V as VividElement, D as DOM, a as attr, n as nullableNumberConverter, o as observable, h as html, d as createRegisterFunction, f as defineVividComponent } from './vivid-element.js';
3
- import { R as Reflector } from './Reflector.js';
2
+ import { V as VividElement, D as DOM, a as attr, n as nullableNumberConverter, o as observable, H as HTMLDirective, O as Observable, h as html, g as createRegisterFunction, i as defineVividComponent } from './vivid-element.js';
4
3
  import { a as applyMixinsWithObservables } from './applyMixinsWithObservables.js';
5
- import { D as DelegatesAria } from './delegates-aria.js';
4
+ import { D as DelegatesAria, d as delegateAria } from './delegates-aria.js';
6
5
  import { F as FormAssociated } from './form-associated.js';
7
6
  import { F as FormElementSuccessText, a as FormElementHelperText, b as FormElementCharCount, e as errorText, f as formElements, g as getFeedbackTemplate } from './form-elements.js';
8
7
  import { b as AffixIcon, a as affixIconTemplateFactory } from './affix.js';
@@ -10,6 +9,7 @@ import { s as styles } from './text-field.js';
10
9
  import { c as classNames } from './class-names.js';
11
10
  import { w as when } from './when.js';
12
11
  import { s as slotted } from './slotted.js';
12
+ import { r as ref } from './ref.js';
13
13
 
14
14
  const byteToHex = [];
15
15
  for (let i = 0; i < 256; ++i) {
@@ -96,7 +96,7 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
96
96
  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);
97
97
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
98
98
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
99
- var _TextField_instances, handleLabelChange_fn, _reflectToInput, _helperTextMirrorEl, _helperTextSlotMutationObserver, updateHelperTextMutationObserver_fn, updateMirroredHelperText_fn;
99
+ var _randomId, _helperTextSlotMutationObserver, _TextField_instances, updateHelperTextMutationObserver_fn, updateMirroredHelperText_fn;
100
100
  const TextFieldType = {
101
101
  /**
102
102
  * A text TextField
@@ -118,7 +118,11 @@ const getSafariWorkaroundStyleSheet = memoizeWith(
118
118
  return styleSheet;
119
119
  }
120
120
  );
121
- const installSafariWorkaroundStyle = (forElement) => {
121
+ const installSafariWorkaroundStyleIfNeeded = (forElement) => {
122
+ if (forElement._isSafariWorkaroundInstalled) {
123
+ return;
124
+ }
125
+ forElement._isSafariWorkaroundInstalled = true;
122
126
  const root = forElement.getRootNode();
123
127
  const workaroundStyleSheet = getSafariWorkaroundStyleSheet();
124
128
  const supportsAdoptedStyleSheets = "adoptedStyleSheets" in root;
@@ -140,12 +144,8 @@ let TextField = class extends AffixIcon(
140
144
  __privateAdd(this, _TextField_instances);
141
145
  // eslint-disable-next-line @nrwl/nx/workspace/no-attribute-default-value
142
146
  this.type = TextFieldType.text;
143
- /**
144
- * @internal
145
- */
146
- this._labelEl = null;
147
- __privateAdd(this, _reflectToInput);
148
- __privateAdd(this, _helperTextMirrorEl);
147
+ __privateAdd(this, _randomId, generateRandomId());
148
+ this._mirroredHelperText = "";
149
149
  __privateAdd(this, _helperTextSlotMutationObserver);
150
150
  }
151
151
  /**
@@ -235,6 +235,24 @@ let TextField = class extends AffixIcon(
235
235
  this.proxy.spellcheck = this.spellcheck;
236
236
  }
237
237
  }
238
+ /**
239
+ * @internal
240
+ */
241
+ valueChanged(previous, next) {
242
+ super.valueChanged(previous, next);
243
+ this._updateControlValueIfNeeded();
244
+ }
245
+ /**
246
+ * Update the controls value only if it is actually different from the actual value.
247
+ * This is important as to not reset the browser's "dirtiness" flag on the input, which is used for min/maxlength
248
+ * constraints.
249
+ * @internal
250
+ */
251
+ _updateControlValueIfNeeded() {
252
+ if (this.control && this.control.value !== this.value) {
253
+ this.control.value = this.value;
254
+ }
255
+ }
238
256
  /**
239
257
  * Selects all the text in the text field
240
258
  *
@@ -266,14 +284,6 @@ let TextField = class extends AffixIcon(
266
284
  validate() {
267
285
  super.validate(this.control);
268
286
  }
269
- /**
270
- * @internal
271
- */
272
- labelChanged() {
273
- if (this._labelEl) {
274
- __privateMethod(this, _TextField_instances, handleLabelChange_fn).call(this, this._labelEl);
275
- }
276
- }
277
287
  connectedCallback() {
278
288
  super.connectedCallback();
279
289
  this.proxy.setAttribute("type", this.type);
@@ -283,82 +293,23 @@ let TextField = class extends AffixIcon(
283
293
  this.focus();
284
294
  });
285
295
  }
286
- if (!this.control) {
287
- const uniqueId = this.id || generateRandomId();
288
- const controlId = `vvd-text-field-control-${uniqueId}`;
289
- const helperTextId = `vvd-text-field-helper-text-${uniqueId}`;
290
- const input = document.createElement("input");
291
- input.slot = "_control";
292
- input.id = controlId;
293
- input.className = safariWorkaroundClassName;
294
- this.control = input;
295
- input.addEventListener("input", () => {
296
- this.handleTextInput();
297
- });
298
- input.addEventListener("change", () => {
299
- this.handleChange();
300
- });
301
- input.addEventListener("blur", () => {
302
- this.$emit("blur", void 0, { bubbles: false });
303
- });
304
- input.addEventListener("focus", () => {
305
- this.$emit("focus", void 0, { bubbles: false });
306
- });
307
- this.appendChild(input);
308
- const label = document.createElement("label");
309
- label.slot = "_label";
310
- label.htmlFor = controlId;
311
- this._labelEl = label;
312
- __privateMethod(this, _TextField_instances, handleLabelChange_fn).call(this, label);
313
- __privateSet(this, _helperTextMirrorEl, document.createElement("div"));
314
- __privateGet(this, _helperTextMirrorEl).id = helperTextId;
315
- __privateGet(this, _helperTextMirrorEl).slot = "_mirrored-helper-text";
316
- __privateMethod(this, _TextField_instances, updateMirroredHelperText_fn).call(this);
317
- this.appendChild(__privateGet(this, _helperTextMirrorEl));
318
- installSafariWorkaroundStyle(this);
319
- }
320
- __privateSet(this, _reflectToInput, new Reflector(this, this.control));
321
- __privateGet(this, _reflectToInput).booleanAttribute("autofocus", "autofocus");
322
- __privateGet(this, _reflectToInput).booleanAttribute("disabled", "disabled");
323
- __privateGet(this, _reflectToInput).booleanAttribute("readOnly", "readonly");
324
- __privateGet(this, _reflectToInput).booleanAttribute("required", "required");
325
- __privateGet(this, _reflectToInput).booleanAttribute("spellcheck", "spellcheck");
326
- __privateGet(this, _reflectToInput).attribute("list", "list");
327
- __privateGet(this, _reflectToInput).attribute("maxlength", "maxlength");
328
- __privateGet(this, _reflectToInput).attribute("minlength", "minlength");
329
- __privateGet(this, _reflectToInput).attribute("pattern", "pattern");
330
- __privateGet(this, _reflectToInput).attribute("placeholder", "placeholder");
331
- __privateGet(this, _reflectToInput).attribute("size", "size");
332
- __privateGet(this, _reflectToInput).attribute("autoComplete", "autocomplete");
333
- __privateGet(this, _reflectToInput).attribute("type", "type");
334
- __privateGet(this, _reflectToInput).attribute("inputMode", "inputmode");
335
- __privateGet(this, _reflectToInput).attribute("ariaAtomic", "aria-atomic");
336
- __privateGet(this, _reflectToInput).attribute("ariaBusy", "aria-busy");
337
- __privateGet(this, _reflectToInput).attribute("ariaCurrent", "aria-current");
338
- __privateGet(this, _reflectToInput).attribute("ariaDisabled", "aria-disabled");
339
- __privateGet(this, _reflectToInput).attribute("ariaHasPopup", "aria-haspopup");
340
- __privateGet(this, _reflectToInput).attribute("ariaHidden", "aria-hidden");
341
- __privateGet(this, _reflectToInput).attribute("ariaInvalid", "aria-invalid");
342
- __privateGet(this, _reflectToInput).attribute("ariaKeyShortcuts", "aria-keyshortcuts");
343
- __privateGet(this, _reflectToInput).attribute("ariaLabel", "aria-label");
344
- __privateGet(this, _reflectToInput).attribute("ariaLive", "aria-live");
345
- __privateGet(this, _reflectToInput).attribute("ariaRelevant", "aria-relevant");
346
- __privateGet(this, _reflectToInput).attribute(
347
- "ariaRoleDescription",
348
- "aria-roledescription"
349
- );
350
- __privateGet(this, _reflectToInput).property("value", "value", true);
296
+ this._updateControlValueIfNeeded();
351
297
  __privateMethod(this, _TextField_instances, updateHelperTextMutationObserver_fn).call(this);
298
+ installSafariWorkaroundStyleIfNeeded(this);
352
299
  }
353
300
  disconnectedCallback() {
354
301
  super.disconnectedCallback();
355
- __privateGet(this, _reflectToInput).destroy();
356
- __privateSet(this, _reflectToInput, void 0);
357
302
  __privateMethod(this, _TextField_instances, updateHelperTextMutationObserver_fn).call(this);
358
303
  }
359
304
  focus() {
360
305
  this.control?.focus();
361
306
  }
307
+ /**
308
+ * @internal
309
+ */
310
+ get _uniqueId() {
311
+ return this.id || __privateGet(this, _randomId);
312
+ }
362
313
  /**
363
314
  * @internal
364
315
  */
@@ -373,26 +324,20 @@ let TextField = class extends AffixIcon(
373
324
  __privateMethod(this, _TextField_instances, updateHelperTextMutationObserver_fn).call(this);
374
325
  }
375
326
  };
376
- _TextField_instances = new WeakSet();
377
- handleLabelChange_fn = function(labelEl) {
378
- if (!this.label) {
379
- labelEl.remove();
380
- } else {
381
- labelEl.textContent = this.label;
382
- if (!labelEl.isConnected) {
383
- this.appendChild(labelEl);
384
- }
385
- }
386
- };
387
- _reflectToInput = new WeakMap();
388
- _helperTextMirrorEl = new WeakMap();
327
+ _randomId = new WeakMap();
389
328
  _helperTextSlotMutationObserver = new WeakMap();
329
+ _TextField_instances = new WeakSet();
390
330
  updateHelperTextMutationObserver_fn = function() {
391
331
  const usesHelperTextSlot = this._helperTextSlottedContent.length;
392
332
  const shouldHaveMutationObserver = usesHelperTextSlot && this.isConnected;
393
333
  if (shouldHaveMutationObserver && !__privateGet(this, _helperTextSlotMutationObserver)) {
394
334
  __privateSet(this, _helperTextSlotMutationObserver, new MutationObserver((records) => {
395
- if (records.some((record) => record.target !== __privateGet(this, _helperTextMirrorEl))) {
335
+ if (
336
+ // Ignore updates to the mirrored helper text itself
337
+ records.some(
338
+ (record) => record.target instanceof HTMLElement && record.target.slot !== "_mirrored-helper-text"
339
+ )
340
+ ) {
396
341
  __privateMethod(this, _TextField_instances, updateMirroredHelperText_fn).call(this);
397
342
  }
398
343
  }));
@@ -412,17 +357,7 @@ updateMirroredHelperText_fn = function() {
412
357
  if (this._helperTextSlottedContent?.length) {
413
358
  helperText = this._helperTextSlottedContent.map((node) => node.innerText).join(" ");
414
359
  }
415
- if (__privateGet(this, _helperTextMirrorEl)) {
416
- __privateGet(this, _helperTextMirrorEl).textContent = helperText;
417
- if (helperText) {
418
- this.control.setAttribute(
419
- "aria-describedby",
420
- __privateGet(this, _helperTextMirrorEl).id
421
- );
422
- } else {
423
- this.control.removeAttribute("aria-describedby");
424
- }
425
- }
360
+ this._mirroredHelperText = helperText;
426
361
  };
427
362
  __decorateClass([
428
363
  attr({ attribute: "readonly", mode: "boolean" })
@@ -475,6 +410,9 @@ __decorateClass([
475
410
  __decorateClass([
476
411
  observable
477
412
  ], TextField.prototype, "leadingActionItemsSlottedContent", 2);
413
+ __decorateClass([
414
+ observable
415
+ ], TextField.prototype, "_mirroredHelperText", 2);
478
416
  TextField = __decorateClass([
479
417
  errorText,
480
418
  formElements
@@ -486,6 +424,67 @@ applyMixinsWithObservables(
486
424
  FormElementSuccessText
487
425
  );
488
426
 
427
+ class RenderInLightDomBehaviour {
428
+ constructor(templateBinding, isTemplateBindingVolatile) {
429
+ this.source = null;
430
+ this.templateBindingObserver = Observable.binding(
431
+ templateBinding,
432
+ this,
433
+ isTemplateBindingVolatile
434
+ );
435
+ }
436
+ bind(source, context) {
437
+ this.source = source;
438
+ this.context = context;
439
+ if (!this.insertionPoint) {
440
+ this.insertionPoint = document.createComment("");
441
+ source.appendChild(this.insertionPoint);
442
+ }
443
+ this.handleChange();
444
+ }
445
+ unbind() {
446
+ this.source = null;
447
+ this.view.unbind();
448
+ this.templateBindingObserver.disconnect();
449
+ }
450
+ /**
451
+ * Handles change of the template itself.
452
+ */
453
+ handleChange() {
454
+ this.instantiateTemplate(
455
+ this.templateBindingObserver.observe(this.source, this.context)
456
+ );
457
+ }
458
+ instantiateTemplate(template) {
459
+ if (this.view) {
460
+ this.view.dispose();
461
+ }
462
+ this.view = template.create();
463
+ this.view.bind(this.source, this.context);
464
+ this.view.insertBefore(this.insertionPoint);
465
+ }
466
+ }
467
+ class RenderInLightDomDirective extends HTMLDirective {
468
+ constructor(templateBinding) {
469
+ super();
470
+ this.templateBinding = templateBinding;
471
+ this.createPlaceholder = DOM.createBlockPlaceholder;
472
+ this.isTemplateBindingVolatile = Observable.isVolatileBinding(templateBinding);
473
+ }
474
+ createBehavior() {
475
+ return new RenderInLightDomBehaviour(
476
+ this.templateBinding,
477
+ this.isTemplateBindingVolatile
478
+ );
479
+ }
480
+ }
481
+ function renderInLightDOM(templateOrTemplateBinding) {
482
+ const templateBinding = typeof templateOrTemplateBinding === "function" ? templateOrTemplateBinding : () => templateOrTemplateBinding;
483
+ return new RenderInLightDomDirective(templateBinding);
484
+ }
485
+
486
+ const getControlId = (id) => `vvd-text-field-control-${id}`;
487
+ const getHelperTextId = (id) => `vvd-text-field-helper-text-${id}`;
489
488
  const getStateClasses = ({
490
489
  errorValidationMessage,
491
490
  disabled,
@@ -525,9 +524,20 @@ function renderCharCount() {
525
524
  }
526
525
  const TextfieldTemplate = (context) => {
527
526
  const affixIconTemplate = affixIconTemplateFactory(context);
528
- return html` <div class="base ${getStateClasses}">
527
+ return html`
528
+ <div class="base ${getStateClasses}">
529
529
  ${when((x) => x.charCount && x.maxlength, renderCharCount())}
530
530
  <slot class="label" name="_label"></slot>
531
+ ${renderInLightDOM(html`
532
+ ${when(
533
+ (x) => x.label,
534
+ html`
535
+ <label slot="_label" for="${(x) => getControlId(x._uniqueId)}">
536
+ ${(x) => x.label}
537
+ </label>
538
+ `
539
+ )}
540
+ `)}
531
541
  <div class="fieldset">
532
542
  <div class="leading-items-wrapper">
533
543
  <slot
@@ -536,9 +546,41 @@ const TextfieldTemplate = (context) => {
536
546
  ></slot>
537
547
  ${(x) => affixIconTemplate(x.icon)}
538
548
  </div>
539
-
540
549
  <div class="wrapper">
541
550
  <slot class="control" name="_control"></slot>
551
+ ${renderInLightDOM(
552
+ html`<input
553
+ slot="_control"
554
+ id="${(x) => getControlId(x._uniqueId)}"
555
+ class="_vvd-3-text-field-safari-workaround"
556
+ @input="${(x) => x.handleTextInput()}"
557
+ @change="${(x) => x.handleChange()}"
558
+ @blur="${(x) => {
559
+ x.$emit("blur", void 0, { bubbles: false });
560
+ }}"
561
+ @focus="${(x) => {
562
+ x.$emit("focus", void 0, { bubbles: false });
563
+ }}"
564
+ ?autofocus="${(x) => x.autofocus}"
565
+ ?disabled="${(x) => x.disabled}"
566
+ ?readonly="${(x) => x.readOnly}"
567
+ ?required="${(x) => x.required}"
568
+ ?spellcheck="${(x) => x.spellcheck}"
569
+ list="${(x) => x.list}"
570
+ maxlength="${(x) => x.maxlength}"
571
+ minlength="${(x) => x.minlength}"
572
+ pattern="${(x) => x.pattern}"
573
+ placeholder="${(x) => x.placeholder}"
574
+ size="${(x) => x.size}"
575
+ autocomplete="${(x) => x.autoComplete}"
576
+ type="${(x) => x.type}"
577
+ inputmode="${(x) => x.inputMode}"
578
+ aria-describedby="${(x) => x._mirroredHelperText ? getHelperTextId(x._uniqueId) : null}"
579
+ value="${(x) => x.initialValue}"
580
+ ${delegateAria()}
581
+ ${ref("control")}
582
+ />`
583
+ )}
542
584
  </div>
543
585
  <div class="action-items-wrapper">
544
586
  <slot
@@ -549,7 +591,16 @@ const TextfieldTemplate = (context) => {
549
591
  </div>
550
592
  ${getFeedbackTemplate(context)}
551
593
  </div>
552
- <slot name="_mirrored-helper-text"></slot>`;
594
+ <slot name="_mirrored-helper-text"></slot>
595
+ ${renderInLightDOM(html`
596
+ <div
597
+ id="${(x) => getHelperTextId(x._uniqueId)}"
598
+ slot="_mirrored-helper-text"
599
+ >
600
+ ${(x) => x._mirroredHelperText}
601
+ </div>
602
+ `)}
603
+ `;
553
604
  };
554
605
 
555
606
  const textFieldDefinition = defineVividComponent(
@@ -1,7 +1,7 @@
1
1
  import { t as textFieldDefinition } from './definition57.js';
2
2
  import { p as popupDefinition } from './definition65.js';
3
3
  import { b as buttonDefinition } from './definition11.js';
4
- import { d as createRegisterFunction, f as defineVividComponent } from './vivid-element.js';
4
+ import { g as createRegisterFunction, i as defineVividComponent } from './vivid-element.js';
5
5
  import { P as PickerFieldTemplate, p as pickerFieldStyles } from './picker-field.template.js';
6
6
  import { a as TimeSelectionPickerTemplate, i as inlineTimePickerDefinition, T as TimePicker } from './time-selection-picker.template.js';
7
7
 
@@ -1,5 +1,5 @@
1
1
  import { P as Popup, p as popupDefinition } from './definition65.js';
2
- import { D as DOM, V as VividElement, a as attr, h as html, d as createRegisterFunction, f as defineVividComponent } from './vivid-element.js';
2
+ import { D as DOM, V as VividElement, a as attr, h as html, g as createRegisterFunction, i as defineVividComponent } from './vivid-element.js';
3
3
  import { A as Anchored, a as anchorSlotTemplateFactory } from './anchored.js';
4
4
  import { h as handleEscapeKeyAndStopPropogation } from './index.js';
5
5
  import { c as classNames } from './class-names.js';
@@ -1,5 +1,5 @@
1
1
  import { I as Icon, i as iconDefinition } from './definition28.js';
2
- import { V as VividElement, a as attr, h as html, d as createRegisterFunction, f as defineVividComponent } from './vivid-element.js';
2
+ import { V as VividElement, a as attr, h as html, g as createRegisterFunction, i as defineVividComponent } from './vivid-element.js';
3
3
  import { c as classNames } from './class-names.js';
4
4
  import { w as when } from './when.js';
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { P as Popup, p as popupDefinition } from './definition65.js';
2
- import { V as VividElement, a as attr, h as html, d as createRegisterFunction, f as defineVividComponent } from './vivid-element.js';
2
+ import { V as VividElement, a as attr, h as html, g as createRegisterFunction, i as defineVividComponent } from './vivid-element.js';
3
3
  import { A as Anchored, a as anchorSlotTemplateFactory } from './anchored.js';
4
4
  import { h as handleEscapeKeyAndStopPropogation } from './index.js';
5
5
  import { c as classNames } from './class-names.js';
@@ -3,6 +3,7 @@
3
3
  const definition = require('./definition28.cjs');
4
4
  const vividElement = require('./vivid-element.cjs');
5
5
  const affix = require('./affix.cjs');
6
+ const hostSemantics = require('./host-semantics.cjs');
6
7
  const dom = require('./dom.cjs');
7
8
  const slotted = require('./slotted.cjs');
8
9
  const children = require('./children.cjs');
@@ -24,7 +25,7 @@ var __decorateClass = (decorators, target, key, kind) => {
24
25
  function isTreeItemElement(el) {
25
26
  return dom.isHTMLElement(el) && el.getAttribute("role") === "treeitem";
26
27
  }
27
- class TreeItem extends affix.AffixIcon(vividElement.VividElement) {
28
+ class TreeItem extends hostSemantics.HostSemantics(affix.AffixIcon(vividElement.VividElement)) {
28
29
  constructor() {
29
30
  super(...arguments);
30
31
  this.expanded = false;
@@ -161,12 +162,14 @@ const expandCollapseButton = (context) => {
161
162
  const TreeItemTemplate = (context) => {
162
163
  const affixIconTemplate = affix.affixIconTemplateFactory(context);
163
164
  return vividElement.html` <template
164
- role="treeitem"
165
165
  slot="${(x) => x.isNestedItem() ? "item" : void 0}"
166
166
  tabindex="-1"
167
- aria-expanded="${(x) => x.childItems && x.childItems.length > 0 ? x.expanded : void 0}"
168
- aria-selected="${(x) => x.selected}"
169
- aria-disabled="${(x) => x.disabled}"
167
+ ${hostSemantics.applyHostSemantics({
168
+ role: "treeitem",
169
+ ariaExpanded: (x) => x.childItems && x.childItems.length > 0 ? x.expanded : void 0,
170
+ ariaSelected: (x) => x.selected,
171
+ ariaDisabled: (x) => x.disabled
172
+ })}
170
173
  @focusin="${(x, c) => x.handleFocus(c.event)}"
171
174
  @focusout="${(x, c) => x.handleBlur(c.event)}"
172
175
  ${children.children({
@@ -1,6 +1,7 @@
1
1
  import { I as Icon, i as iconDefinition } from './definition28.js';
2
- import { V as VividElement, a as attr, o as observable, h as html, d as createRegisterFunction, f as defineVividComponent } from './vivid-element.js';
2
+ import { V as VividElement, a as attr, o as observable, h as html, g as createRegisterFunction, i as defineVividComponent } from './vivid-element.js';
3
3
  import { b as AffixIcon, a as affixIconTemplateFactory, I as IconWrapper } from './affix.js';
4
+ import { H as HostSemantics, a as applyHostSemantics } from './host-semantics.js';
4
5
  import { i as isHTMLElement } from './dom.js';
5
6
  import { e as elements, s as slotted } from './slotted.js';
6
7
  import { c as children } from './children.js';
@@ -22,7 +23,7 @@ var __decorateClass = (decorators, target, key, kind) => {
22
23
  function isTreeItemElement(el) {
23
24
  return isHTMLElement(el) && el.getAttribute("role") === "treeitem";
24
25
  }
25
- class TreeItem extends AffixIcon(VividElement) {
26
+ class TreeItem extends HostSemantics(AffixIcon(VividElement)) {
26
27
  constructor() {
27
28
  super(...arguments);
28
29
  this.expanded = false;
@@ -159,12 +160,14 @@ const expandCollapseButton = (context) => {
159
160
  const TreeItemTemplate = (context) => {
160
161
  const affixIconTemplate = affixIconTemplateFactory(context);
161
162
  return html` <template
162
- role="treeitem"
163
163
  slot="${(x) => x.isNestedItem() ? "item" : void 0}"
164
164
  tabindex="-1"
165
- aria-expanded="${(x) => x.childItems && x.childItems.length > 0 ? x.expanded : void 0}"
166
- aria-selected="${(x) => x.selected}"
167
- aria-disabled="${(x) => x.disabled}"
165
+ ${applyHostSemantics({
166
+ role: "treeitem",
167
+ ariaExpanded: (x) => x.childItems && x.childItems.length > 0 ? x.expanded : void 0,
168
+ ariaSelected: (x) => x.selected,
169
+ ariaDisabled: (x) => x.disabled
170
+ })}
168
171
  @focusin="${(x, c) => x.handleFocus(c.event)}"
169
172
  @focusout="${(x, c) => x.handleBlur(c.event)}"
170
173
  ${children({
@@ -2,6 +2,7 @@
2
2
 
3
3
  const vividElement = require('./vivid-element.cjs');
4
4
  const definition = require('./definition61.cjs');
5
+ const hostSemantics = require('./host-semantics.cjs');
5
6
  const keyCodes = require('./key-codes.cjs');
6
7
  const dom = require('./dom.cjs');
7
8
  const ref = require('./ref.cjs');
@@ -37,7 +38,7 @@ function getDisplayedNodes(rootNode, selector) {
37
38
  }
38
39
  return [];
39
40
  }
40
- class TreeView extends vividElement.VividElement {
41
+ class TreeView extends hostSemantics.HostSemantics(vividElement.VividElement) {
41
42
  constructor() {
42
43
  super(...arguments);
43
44
  /**
@@ -268,8 +269,10 @@ __decorateClass([
268
269
 
269
270
  const getClasses = (_) => classNames.classNames("control");
270
271
  const TreeViewTemplate = vividElement.html` <template
271
- role="tree"
272
272
  ${ref.ref("treeView")}
273
+ ${hostSemantics.applyHostSemantics({
274
+ role: "tree"
275
+ })}
273
276
  @keydown="${(x, c) => x.handleKeyDown(c.event)}"
274
277
  @focusin="${(x, c) => x.handleFocus(c.event)}"
275
278
  @focusout="${(x, c) => x.handleBlur(c.event)}"
@@ -1,5 +1,6 @@
1
- import { V as VividElement, D as DOM, a as attr, o as observable, h as html, d as createRegisterFunction, f as defineVividComponent } from './vivid-element.js';
1
+ import { D as DOM, V as VividElement, a as attr, o as observable, h as html, g as createRegisterFunction, i as defineVividComponent } from './vivid-element.js';
2
2
  import { T as TreeItem, i as isTreeItemElement, t as treeItemDefinition } from './definition61.js';
3
+ import { H as HostSemantics, a as applyHostSemantics } from './host-semantics.js';
3
4
  import { k as keyEnter, e as keyArrowUp, f as keyArrowDown, i as keyArrowRight, h as keyArrowLeft, d as keyEnd, g as keyHome } from './key-codes.js';
4
5
  import { i as isHTMLElement } from './dom.js';
5
6
  import { r as ref } from './ref.js';
@@ -35,7 +36,7 @@ function getDisplayedNodes(rootNode, selector) {
35
36
  }
36
37
  return [];
37
38
  }
38
- class TreeView extends VividElement {
39
+ class TreeView extends HostSemantics(VividElement) {
39
40
  constructor() {
40
41
  super(...arguments);
41
42
  /**
@@ -266,8 +267,10 @@ __decorateClass([
266
267
 
267
268
  const getClasses = (_) => classNames("control");
268
269
  const TreeViewTemplate = html` <template
269
- role="tree"
270
270
  ${ref("treeView")}
271
+ ${applyHostSemantics({
272
+ role: "tree"
273
+ })}
271
274
  @keydown="${(x, c) => x.handleKeyDown(c.event)}"
272
275
  @focusin="${(x, c) => x.handleFocus(c.event)}"
273
276
  @focusout="${(x, c) => x.handleBlur(c.event)}"
@@ -1,4 +1,4 @@
1
- import { V as VividElement, a as attr, h as html, d as createRegisterFunction, f as defineVividComponent } from './vivid-element.js';
1
+ import { V as VividElement, a as attr, h as html, g as createRegisterFunction, i as defineVividComponent } from './vivid-element.js';
2
2
  import { M as MediaSkipBy } from './enums.js';
3
3
  import { g as getPlaybackRatesArray } from './playbackRates.js';
4
4
  import { L as Localized } from './localized.js';
@@ -1,4 +1,4 @@
1
- import { V as VividElement, a as attr, h as html, d as createRegisterFunction, f as defineVividComponent } from './vivid-element.js';
1
+ import { V as VividElement, a as attr, h as html, g as createRegisterFunction, i as defineVividComponent } from './vivid-element.js';
2
2
  import { c as classNames } from './class-names.js';
3
3
 
4
4
  var __defProp = Object.defineProperty;
@@ -1,6 +1,6 @@
1
1
  import { B as Button, b as buttonDefinition } from './definition11.js';
2
2
  import { E as Elevation, e as elevationDefinition } from './definition64.js';
3
- import { V as VividElement, a as attr, o as observable, h as html, d as createRegisterFunction, f as defineVividComponent } from './vivid-element.js';
3
+ import { V as VividElement, a as attr, o as observable, h as html, g as createRegisterFunction, i as defineVividComponent } from './vivid-element.js';
4
4
  import { r as ref } from './ref.js';
5
5
  import { c as classNames } from './class-names.js';
6
6
  import { w as when } from './when.js';
@@ -1,4 +1,4 @@
1
- import { V as VividElement, a as attr, h as html, d as createRegisterFunction, f as defineVividComponent } from './vivid-element.js';
1
+ import { V as VividElement, a as attr, h as html, g as createRegisterFunction, i as defineVividComponent } from './vivid-element.js';
2
2
  import { i as iconDefinition } from './definition28.js';
3
3
  import { A as AffixIconWithTrailing, a as affixIconTemplateFactory, I as IconWrapper } from './affix.js';
4
4
  import { c as classNames } from './class-names.js';
@@ -112,8 +112,10 @@ const BannerTemplate = (context) => {
112
112
  ${(x) => affixIconTemplate(x.conditionedIcon, affix.IconWrapper.Slot)}
113
113
  <div
114
114
  class="banner-message"
115
- role="${(x) => x.role ? x.role : "status"}"
116
- aria-live="${(x) => x.ariaLive ? x.ariaLive : "polite"}"
115
+ ${delegatesAria.delegateAria({
116
+ role: (x) => x.role ? x.role : "status",
117
+ ariaLive: (x) => x.ariaLive ? x.ariaLive : "polite"
118
+ })}
117
119
  >
118
120
  ${(x) => x.text}
119
121
  </div>
@@ -1,8 +1,8 @@
1
1
  import { B as Button, b as buttonDefinition } from './definition11.js';
2
2
  import { i as iconDefinition } from './definition28.js';
3
- import { V as VividElement, a as attr, o as observable, h as html, d as createRegisterFunction, f as defineVividComponent } from './vivid-element.js';
3
+ import { V as VividElement, a as attr, o as observable, h as html, g as createRegisterFunction, i as defineVividComponent } from './vivid-element.js';
4
4
  import { C as Connotation } from './enums.js';
5
- import { D as DelegatesAria } from './delegates-aria.js';
5
+ import { D as DelegatesAria, d as delegateAria } from './delegates-aria.js';
6
6
  import { b as AffixIcon, a as affixIconTemplateFactory, I as IconWrapper } from './affix.js';
7
7
  import { L as Localized } from './localized.js';
8
8
  import { c as classNames } from './class-names.js';
@@ -110,8 +110,10 @@ const BannerTemplate = (context) => {
110
110
  ${(x) => affixIconTemplate(x.conditionedIcon, IconWrapper.Slot)}
111
111
  <div
112
112
  class="banner-message"
113
- role="${(x) => x.role ? x.role : "status"}"
114
- aria-live="${(x) => x.ariaLive ? x.ariaLive : "polite"}"
113
+ ${delegateAria({
114
+ role: (x) => x.role ? x.role : "status",
115
+ ariaLive: (x) => x.ariaLive ? x.ariaLive : "polite"
116
+ })}
115
117
  >
116
118
  ${(x) => x.text}
117
119
  </div>
@@ -1,5 +1,5 @@
1
1
  import { I as Icon, i as iconDefinition } from './definition28.js';
2
- import { h as html, d as createRegisterFunction, f as defineVividComponent } from './vivid-element.js';
2
+ import { h as html, g as createRegisterFunction, i as defineVividComponent } from './vivid-element.js';
3
3
  import { B as BreadcrumbItem } from './breadcrumb-item.js';
4
4
  import { t as textAnchorTemplate } from './text-anchor.template.js';
5
5
  import { c as classNames } from './class-names.js';