@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.
Files changed (70) hide show
  1. package/custom-elements.json +1388 -128
  2. package/lib/file-picker/file-picker.d.ts +6 -0
  3. package/lib/menu/menu.d.ts +16 -3
  4. package/lib/menu-item/menu-item.d.ts +10 -2
  5. package/lib/option/option.d.ts +27 -7
  6. package/lib/switch/switch.d.ts +5 -2
  7. package/lib/switch/switch.form-associated.d.ts +10 -0
  8. package/lib/tabs/tabs.d.ts +3 -2
  9. package/lib/text-area/text-area.d.ts +25 -3
  10. package/lib/text-area/text-field.form-associated.d.ts +10 -0
  11. package/lib/text-field/text-field.d.ts +28 -3
  12. package/lib/text-field/text-field.form-associated.d.ts +10 -0
  13. package/package.json +1 -1
  14. package/shared/definition11.cjs +1 -1
  15. package/shared/definition11.js +1 -1
  16. package/shared/definition17.cjs +1 -1
  17. package/shared/definition17.js +1 -1
  18. package/shared/definition20.cjs +2 -1
  19. package/shared/definition20.js +2 -1
  20. package/shared/definition21.cjs +1 -1
  21. package/shared/definition21.js +1 -1
  22. package/shared/definition24.cjs +1 -1
  23. package/shared/definition24.js +1 -1
  24. package/shared/definition25.cjs +24 -3
  25. package/shared/definition25.js +24 -3
  26. package/shared/definition29.cjs +358 -559
  27. package/shared/definition29.js +359 -560
  28. package/shared/definition30.cjs +2 -0
  29. package/shared/definition30.js +2 -0
  30. package/shared/definition35.cjs +222 -2
  31. package/shared/definition35.js +222 -2
  32. package/shared/definition36.cjs +149 -14
  33. package/shared/definition36.js +150 -15
  34. package/shared/definition46.cjs +1 -1
  35. package/shared/definition46.js +1 -1
  36. package/shared/definition47.cjs +5 -14
  37. package/shared/definition47.js +1 -10
  38. package/shared/definition49.cjs +65 -90
  39. package/shared/definition49.js +66 -91
  40. package/shared/definition51.cjs +1 -1
  41. package/shared/definition51.js +1 -1
  42. package/shared/definition52.cjs +15 -1
  43. package/shared/definition52.js +15 -1
  44. package/shared/definition55.cjs +160 -180
  45. package/shared/definition55.js +160 -180
  46. package/shared/definition56.cjs +3 -307
  47. package/shared/definition56.js +5 -309
  48. package/shared/definition57.cjs +8 -7
  49. package/shared/definition57.js +3 -2
  50. package/shared/definition64.cjs +18 -7
  51. package/shared/definition64.js +19 -8
  52. package/shared/listbox.cjs +198 -3
  53. package/shared/listbox.js +197 -2
  54. package/shared/{direction.cjs → localization.cjs} +12 -3
  55. package/shared/{direction.js → localization.js} +12 -3
  56. package/shared/presentationDate.cjs +8 -8
  57. package/shared/presentationDate.js +1 -1
  58. package/shared/text-field2.cjs +538 -194
  59. package/shared/text-field2.js +539 -195
  60. package/styles/core/all.css +21 -1
  61. package/styles/core/theme.css +21 -1
  62. package/styles/core/typography.css +1 -1
  63. package/styles/tokens/theme-dark.css +4 -4
  64. package/styles/tokens/theme-light.css +4 -4
  65. package/styles/tokens/vivid-2-compat.css +1 -1
  66. package/vivid.api.json +44 -0
  67. package/shared/Reflector.cjs +0 -71
  68. package/shared/Reflector.js +0 -69
  69. package/shared/listbox-option.cjs +0 -204
  70. package/shared/listbox-option.js +0 -201
package/shared/listbox.js CHANGED
@@ -1,8 +1,9 @@
1
1
  import { e as keyArrowLeft, f as keyArrowRight } from './key-codes.js';
2
- import { F as FoundationElement, O as Observable, _ as __decorate, a as attr, o as observable, D as DOM, n as nullableNumberConverter } from './index.js';
3
- import { i as isListboxOption } from './listbox-option.js';
2
+ import { _ as __decorate, o as observable, a as attr, F as FoundationElement, O as Observable, D as DOM, n as nullableNumberConverter } from './index.js';
4
3
  import { A as ARIAGlobalStatesAndProperties } from './aria-global.js';
4
+ import { S as StartEnd } from './start-end.js';
5
5
  import { a as applyMixins } from './apply-mixins.js';
6
+ import { i as isHTMLElement } from './dom.js';
6
7
  import { a as keySpace, b as keyEscape, k as keyEnter, c as keyTab, d as keyEnd, e as keyArrowUp, f as keyArrowDown, g as keyHome } from './key-codes2.js';
7
8
  import { u as uniqueId, i as inRange } from './strings.js';
8
9
 
@@ -22,6 +23,200 @@ function findLastIndex(array, predicate) {
22
23
  return -1;
23
24
  }
24
25
 
26
+ /**
27
+ * Determines if the element is a {@link (ListboxOption:class)}
28
+ *
29
+ * @param element - the element to test.
30
+ * @public
31
+ */
32
+ function isListboxOption(el) {
33
+ return (isHTMLElement(el) &&
34
+ (el.getAttribute("role") === "option" ||
35
+ el instanceof HTMLOptionElement));
36
+ }
37
+ /**
38
+ * An Option Custom HTML Element.
39
+ * Implements {@link https://www.w3.org/TR/wai-aria-1.1/#option | ARIA option }.
40
+ *
41
+ * @slot start - Content which can be provided before the listbox option content
42
+ * @slot end - Content which can be provided after the listbox option content
43
+ * @slot - The default slot for listbox option content
44
+ * @csspart content - Wraps the listbox option content
45
+ *
46
+ * @public
47
+ */
48
+ class ListboxOption extends FoundationElement {
49
+ constructor(text, value, defaultSelected, selected) {
50
+ super();
51
+ /**
52
+ * The defaultSelected state of the option.
53
+ * @public
54
+ */
55
+ this.defaultSelected = false;
56
+ /**
57
+ * Tracks whether the "selected" property has been changed.
58
+ * @internal
59
+ */
60
+ this.dirtySelected = false;
61
+ /**
62
+ * The checked state of the control.
63
+ *
64
+ * @public
65
+ */
66
+ this.selected = this.defaultSelected;
67
+ /**
68
+ * Track whether the value has been changed from the initial value
69
+ */
70
+ this.dirtyValue = false;
71
+ if (text) {
72
+ this.textContent = text;
73
+ }
74
+ if (value) {
75
+ this.initialValue = value;
76
+ }
77
+ if (defaultSelected) {
78
+ this.defaultSelected = defaultSelected;
79
+ }
80
+ if (selected) {
81
+ this.selected = selected;
82
+ }
83
+ this.proxy = new Option(`${this.textContent}`, this.initialValue, this.defaultSelected, this.selected);
84
+ this.proxy.disabled = this.disabled;
85
+ }
86
+ /**
87
+ * Updates the ariaChecked property when the checked property changes.
88
+ *
89
+ * @param prev - the previous checked value
90
+ * @param next - the current checked value
91
+ *
92
+ * @public
93
+ */
94
+ checkedChanged(prev, next) {
95
+ if (typeof next === "boolean") {
96
+ this.ariaChecked = next ? "true" : "false";
97
+ return;
98
+ }
99
+ this.ariaChecked = null;
100
+ }
101
+ /**
102
+ * Updates the proxy's text content when the default slot changes.
103
+ * @param prev - the previous content value
104
+ * @param next - the current content value
105
+ *
106
+ * @internal
107
+ */
108
+ contentChanged(prev, next) {
109
+ if (this.proxy instanceof HTMLOptionElement) {
110
+ this.proxy.textContent = this.textContent;
111
+ }
112
+ this.$emit("contentchange", null, { bubbles: true });
113
+ }
114
+ defaultSelectedChanged() {
115
+ if (!this.dirtySelected) {
116
+ this.selected = this.defaultSelected;
117
+ if (this.proxy instanceof HTMLOptionElement) {
118
+ this.proxy.selected = this.defaultSelected;
119
+ }
120
+ }
121
+ }
122
+ disabledChanged(prev, next) {
123
+ this.ariaDisabled = this.disabled ? "true" : "false";
124
+ if (this.proxy instanceof HTMLOptionElement) {
125
+ this.proxy.disabled = this.disabled;
126
+ }
127
+ }
128
+ selectedAttributeChanged() {
129
+ this.defaultSelected = this.selectedAttribute;
130
+ if (this.proxy instanceof HTMLOptionElement) {
131
+ this.proxy.defaultSelected = this.defaultSelected;
132
+ }
133
+ }
134
+ selectedChanged() {
135
+ this.ariaSelected = this.selected ? "true" : "false";
136
+ if (!this.dirtySelected) {
137
+ this.dirtySelected = true;
138
+ }
139
+ if (this.proxy instanceof HTMLOptionElement) {
140
+ this.proxy.selected = this.selected;
141
+ }
142
+ }
143
+ initialValueChanged(previous, next) {
144
+ // If the value is clean and the component is connected to the DOM
145
+ // then set value equal to the attribute value.
146
+ if (!this.dirtyValue) {
147
+ this.value = this.initialValue;
148
+ this.dirtyValue = false;
149
+ }
150
+ }
151
+ get label() {
152
+ var _a;
153
+ return (_a = this.value) !== null && _a !== void 0 ? _a : this.text;
154
+ }
155
+ get text() {
156
+ var _a, _b;
157
+ return (_b = (_a = this.textContent) === null || _a === void 0 ? void 0 : _a.replace(/\s+/g, " ").trim()) !== null && _b !== void 0 ? _b : "";
158
+ }
159
+ set value(next) {
160
+ const newValue = `${next !== null && next !== void 0 ? next : ""}`;
161
+ this._value = newValue;
162
+ this.dirtyValue = true;
163
+ if (this.proxy instanceof HTMLOptionElement) {
164
+ this.proxy.value = newValue;
165
+ }
166
+ Observable.notify(this, "value");
167
+ }
168
+ get value() {
169
+ var _a;
170
+ Observable.track(this, "value");
171
+ return (_a = this._value) !== null && _a !== void 0 ? _a : this.text;
172
+ }
173
+ get form() {
174
+ return this.proxy ? this.proxy.form : null;
175
+ }
176
+ }
177
+ __decorate([
178
+ observable
179
+ ], ListboxOption.prototype, "checked", void 0);
180
+ __decorate([
181
+ observable
182
+ ], ListboxOption.prototype, "content", void 0);
183
+ __decorate([
184
+ observable
185
+ ], ListboxOption.prototype, "defaultSelected", void 0);
186
+ __decorate([
187
+ attr({ mode: "boolean" })
188
+ ], ListboxOption.prototype, "disabled", void 0);
189
+ __decorate([
190
+ attr({ attribute: "selected", mode: "boolean" })
191
+ ], ListboxOption.prototype, "selectedAttribute", void 0);
192
+ __decorate([
193
+ observable
194
+ ], ListboxOption.prototype, "selected", void 0);
195
+ __decorate([
196
+ attr({ attribute: "value", mode: "fromView" })
197
+ ], ListboxOption.prototype, "initialValue", void 0);
198
+ /**
199
+ * States and properties relating to the ARIA `option` role.
200
+ *
201
+ * @public
202
+ */
203
+ class DelegatesARIAListboxOption {
204
+ }
205
+ __decorate([
206
+ observable
207
+ ], DelegatesARIAListboxOption.prototype, "ariaChecked", void 0);
208
+ __decorate([
209
+ observable
210
+ ], DelegatesARIAListboxOption.prototype, "ariaPosInSet", void 0);
211
+ __decorate([
212
+ observable
213
+ ], DelegatesARIAListboxOption.prototype, "ariaSelected", void 0);
214
+ __decorate([
215
+ observable
216
+ ], DelegatesARIAListboxOption.prototype, "ariaSetSize", void 0);
217
+ applyMixins(DelegatesARIAListboxOption, ARIAGlobalStatesAndProperties);
218
+ applyMixins(ListboxOption, StartEnd, DelegatesARIAListboxOption);
219
+
25
220
  /**
26
221
  * A Listbox Custom HTML Element.
27
222
  * Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#listbox | ARIA listbox }.
@@ -3,11 +3,11 @@
3
3
  /**
4
4
  * Expose ltr and rtl strings
5
5
  */
6
- exports.Direction = void 0;
6
+ var Direction;
7
7
  (function (Direction) {
8
8
  Direction["ltr"] = "ltr";
9
9
  Direction["rtl"] = "rtl";
10
- })(exports.Direction || (exports.Direction = {}));
10
+ })(Direction || (Direction = {}));
11
11
 
12
12
  /**
13
13
  * a method to determine the current localization direction of the view
@@ -16,7 +16,16 @@ exports.Direction = void 0;
16
16
  */
17
17
  const getDirection = (rootNode) => {
18
18
  const dirNode = rootNode.closest("[dir]");
19
- return dirNode !== null && dirNode.dir === "rtl" ? exports.Direction.rtl : exports.Direction.ltr;
19
+ return dirNode !== null && dirNode.dir === "rtl" ? Direction.rtl : Direction.ltr;
20
20
  };
21
21
 
22
+ /**
23
+ * Expose ltr and rtl strings
24
+ */
25
+ exports.Direction = void 0;
26
+ (function (Direction) {
27
+ Direction["ltr"] = "ltr";
28
+ Direction["rtl"] = "rtl";
29
+ })(exports.Direction || (exports.Direction = {}));
30
+
22
31
  exports.getDirection = getDirection;
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * Expose ltr and rtl strings
3
3
  */
4
- var Direction;
4
+ var Direction$1;
5
5
  (function (Direction) {
6
6
  Direction["ltr"] = "ltr";
7
7
  Direction["rtl"] = "rtl";
8
- })(Direction || (Direction = {}));
8
+ })(Direction$1 || (Direction$1 = {}));
9
9
 
10
10
  /**
11
11
  * a method to determine the current localization direction of the view
@@ -14,7 +14,16 @@ var Direction;
14
14
  */
15
15
  const getDirection = (rootNode) => {
16
16
  const dirNode = rootNode.closest("[dir]");
17
- return dirNode !== null && dirNode.dir === "rtl" ? Direction.rtl : Direction.ltr;
17
+ return dirNode !== null && dirNode.dir === "rtl" ? Direction$1.rtl : Direction$1.ltr;
18
18
  };
19
19
 
20
+ /**
21
+ * Expose ltr and rtl strings
22
+ */
23
+ var Direction;
24
+ (function (Direction) {
25
+ Direction["ltr"] = "ltr";
26
+ Direction["rtl"] = "rtl";
27
+ })(Direction || (Direction = {}));
28
+
20
29
  export { Direction as D, getDirection as g };
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- const definition$2 = require('./definition11.cjs');
3
+ const definition$1 = require('./definition11.cjs');
4
4
  const definition = require('./definition64.cjs');
5
- const definition$1 = require('./definition56.cjs');
6
- const definition$3 = require('./definition22.cjs');
5
+ const textField = require('./text-field2.cjs');
6
+ const definition$2 = require('./definition22.cjs');
7
7
  const index = require('./index.cjs');
8
8
  const ref = require('./ref.cjs');
9
9
  const slotted = require('./slotted.cjs');
@@ -5525,7 +5525,7 @@ const areMonthsEqual = (a, b) => compareMonths(a, b) === 0;
5525
5525
  const monthToStr = ({ month, year }) => `${year.toString().padStart(4, "0")}-${(month + 1).toString().padStart(2, "0")}`;
5526
5526
 
5527
5527
  function renderDialogHeader(context) {
5528
- const buttonTag = context.tagFor(definition$2.Button$1);
5528
+ const buttonTag = context.tagFor(definition$1.Button$1);
5529
5529
  return index.html`<div class="header">
5530
5530
  ${when.when(
5531
5531
  (x) => x.prevYearButton,
@@ -5615,7 +5615,7 @@ function renderDialogHeader(context) {
5615
5615
  </div>`;
5616
5616
  }
5617
5617
  function renderCalendarGrid(context) {
5618
- const dividerTag = context.tagFor(definition$3.Divider);
5618
+ const dividerTag = context.tagFor(definition$2.Divider);
5619
5619
  return index.html`<div
5620
5620
  class="calendar"
5621
5621
  role="grid"
@@ -5705,7 +5705,7 @@ function renderCalendarGrid(context) {
5705
5705
  )}`;
5706
5706
  }
5707
5707
  function renderMonthPickerGrid(context) {
5708
- const dividerTag = context.tagFor(definition$3.Divider);
5708
+ const dividerTag = context.tagFor(definition$2.Divider);
5709
5709
  return index.html`
5710
5710
  <${dividerTag}
5711
5711
  class="months-separator"
@@ -5779,8 +5779,8 @@ function renderMonthPickerGrid(context) {
5779
5779
  }
5780
5780
  const DatePickerBaseTemplate = (context, _) => {
5781
5781
  const popupTag = context.tagFor(definition.Popup);
5782
- const textFieldTag = context.tagFor(definition$1.TextField);
5783
- const buttonTag = context.tagFor(definition$2.Button$1);
5782
+ const textFieldTag = context.tagFor(textField.TextField);
5783
+ const buttonTag = context.tagFor(definition$1.Button$1);
5784
5784
  return index.html`<div class="base" @keydown="${(x, { event }) => x._onBaseKeyDown(event)}">
5785
5785
  <${textFieldTag} id="text-field"
5786
5786
  ${ref.ref("_textFieldEl")}
@@ -1,6 +1,6 @@
1
1
  import { c as Button } from './definition11.js';
2
2
  import { P as Popup } from './definition64.js';
3
- import { T as TextField } from './definition56.js';
3
+ import { T as TextField } from './text-field2.js';
4
4
  import { D as Divider } from './definition22.js';
5
5
  import { h as html, F as FoundationElement, O as Observable, g as defaultExecutionContext, D as DOM, a as attr, o as observable, v as volatile } from './index.js';
6
6
  import { r as ref } from './ref.js';