@vonage/vivid 4.12.0 → 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 (124) hide show
  1. package/custom-elements.json +2339 -288
  2. package/lib/accordion/accordion.d.ts +21 -2
  3. package/lib/accordion-item/accordion-item.d.ts +6 -2
  4. package/lib/calendar/calendar.d.ts +1 -1
  5. package/lib/date-picker/date-picker.d.ts +1 -0
  6. package/lib/file-picker/file-picker.d.ts +6 -0
  7. package/lib/menu/menu.d.ts +16 -3
  8. package/lib/menu-item/menu-item.d.ts +10 -2
  9. package/lib/option/option.d.ts +27 -7
  10. package/lib/radio/radio.d.ts +12 -2
  11. package/lib/radio/radio.form-associated.d.ts +10 -0
  12. package/lib/radio-group/radio-group.d.ts +20 -2
  13. package/lib/switch/switch.d.ts +5 -2
  14. package/lib/switch/switch.form-associated.d.ts +10 -0
  15. package/lib/tab/tab.d.ts +3 -2
  16. package/lib/tab-panel/tab-panel.d.ts +2 -2
  17. package/lib/tabs/tabs.d.ts +33 -11
  18. package/lib/text-area/text-area.d.ts +25 -3
  19. package/lib/text-area/text-field.form-associated.d.ts +10 -0
  20. package/lib/text-field/text-field.d.ts +28 -3
  21. package/lib/text-field/text-field.form-associated.d.ts +10 -0
  22. package/package.json +1 -1
  23. package/shared/date-picker/date-picker-base.d.ts +1 -0
  24. package/shared/definition.cjs +29 -72
  25. package/shared/definition.js +30 -73
  26. package/shared/definition11.cjs +1 -1
  27. package/shared/definition11.js +1 -1
  28. package/shared/definition16.cjs +1 -2
  29. package/shared/definition16.js +1 -2
  30. package/shared/definition17.cjs +3 -3
  31. package/shared/definition17.js +3 -3
  32. package/shared/definition18.cjs +6 -1
  33. package/shared/definition18.js +6 -1
  34. package/shared/definition19.cjs +17 -8
  35. package/shared/definition19.js +17 -8
  36. package/shared/definition2.cjs +154 -187
  37. package/shared/definition2.js +157 -190
  38. package/shared/definition20.cjs +3 -2
  39. package/shared/definition20.js +3 -2
  40. package/shared/definition21.cjs +1 -1
  41. package/shared/definition21.js +1 -1
  42. package/shared/definition24.cjs +1 -1
  43. package/shared/definition24.js +1 -1
  44. package/shared/definition25.cjs +24 -3
  45. package/shared/definition25.js +24 -3
  46. package/shared/definition29.cjs +358 -559
  47. package/shared/definition29.js +359 -560
  48. package/shared/definition30.cjs +2 -0
  49. package/shared/definition30.js +2 -0
  50. package/shared/definition35.cjs +223 -3
  51. package/shared/definition35.js +223 -3
  52. package/shared/definition36.cjs +149 -14
  53. package/shared/definition36.js +150 -15
  54. package/shared/definition40.cjs +226 -399
  55. package/shared/definition40.js +229 -402
  56. package/shared/definition42.cjs +3 -2
  57. package/shared/definition42.js +3 -2
  58. package/shared/definition43.cjs +1 -0
  59. package/shared/definition43.js +1 -0
  60. package/shared/definition44.cjs +1 -1
  61. package/shared/definition44.js +1 -1
  62. package/shared/definition46.cjs +1 -1
  63. package/shared/definition46.js +1 -1
  64. package/shared/definition47.cjs +8 -16
  65. package/shared/definition47.js +4 -12
  66. package/shared/definition49.cjs +64 -89
  67. package/shared/definition49.js +66 -91
  68. package/shared/definition5.cjs +1 -1
  69. package/shared/definition5.js +1 -1
  70. package/shared/definition50.cjs +1 -11
  71. package/shared/definition50.js +1 -11
  72. package/shared/definition51.cjs +5 -15
  73. package/shared/definition51.js +6 -16
  74. package/shared/definition52.cjs +284 -20
  75. package/shared/definition52.js +288 -24
  76. package/shared/definition55.cjs +160 -180
  77. package/shared/definition55.js +160 -180
  78. package/shared/definition56.cjs +3 -307
  79. package/shared/definition56.js +5 -309
  80. package/shared/definition57.cjs +34 -11
  81. package/shared/definition57.js +30 -7
  82. package/shared/definition61.cjs +1 -1
  83. package/shared/definition61.js +1 -1
  84. package/shared/definition62.cjs +17 -8
  85. package/shared/definition62.js +17 -8
  86. package/shared/definition64.cjs +18 -7
  87. package/shared/definition64.js +19 -8
  88. package/shared/form-associated.cjs +1 -1
  89. package/shared/form-associated.js +1 -1
  90. package/shared/icon.cjs +1 -1
  91. package/shared/icon.js +1 -1
  92. package/shared/index.cjs +1 -0
  93. package/shared/index.js +1 -1
  94. package/shared/key-codes.cjs +1 -94
  95. package/shared/key-codes.js +2 -89
  96. package/shared/key-codes2.cjs +87 -1
  97. package/shared/key-codes2.js +83 -2
  98. package/shared/listbox.cjs +204 -10
  99. package/shared/listbox.js +200 -6
  100. package/shared/{direction.cjs → localization.cjs} +12 -3
  101. package/shared/{direction.js → localization.js} +12 -3
  102. package/shared/numbers.cjs +0 -12
  103. package/shared/numbers.js +1 -12
  104. package/shared/presentationDate.cjs +22 -8
  105. package/shared/presentationDate.js +16 -2
  106. package/shared/radio.cjs +92 -117
  107. package/shared/radio.js +93 -118
  108. package/shared/slider.template.cjs +2 -15
  109. package/shared/slider.template.js +2 -14
  110. package/shared/strings.cjs +26 -0
  111. package/shared/strings.js +25 -1
  112. package/shared/text-field2.cjs +538 -194
  113. package/shared/text-field2.js +539 -195
  114. package/styles/core/all.css +21 -1
  115. package/styles/core/theme.css +21 -1
  116. package/styles/core/typography.css +1 -1
  117. package/styles/tokens/theme-dark.css +4 -4
  118. package/styles/tokens/theme-light.css +4 -4
  119. package/styles/tokens/vivid-2-compat.css +1 -1
  120. package/vivid.api.json +44 -0
  121. package/shared/Reflector.cjs +0 -71
  122. package/shared/Reflector.js +0 -69
  123. package/shared/listbox-option.cjs +0 -204
  124. package/shared/listbox-option.js +0 -201
@@ -3,7 +3,7 @@
3
3
  const index = require('./index.cjs');
4
4
  const definition = require('./definition27.cjs');
5
5
  const affix = require('./affix.cjs');
6
- const listboxOption = require('./listbox-option.cjs');
6
+ const ariaGlobal = require('./aria-global2.cjs');
7
7
  const applyMixins = require('./apply-mixins.cjs');
8
8
  const icon = require('./icon.cjs');
9
9
  const when = require('./when.cjs');
@@ -18,19 +18,93 @@ var __decorateClass = (decorators, target, key, kind) => {
18
18
  if (result) __defProp(target, key, result);
19
19
  return result;
20
20
  };
21
- class ListboxOption extends listboxOption.ListboxOption {
22
- constructor() {
23
- super(...arguments);
21
+ class ListboxOption extends index.FoundationElement {
22
+ constructor(text, value, defaultSelected, selected) {
23
+ super();
24
+ this.defaultSelected = false;
25
+ /**
26
+ * Tracks whether the "selected" property has been changed.
27
+ * @internal
28
+ */
29
+ this.dirtySelected = false;
30
+ this.selected = this.defaultSelected;
31
+ /**
32
+ * Track whether the value has been changed from the initial value
33
+ */
34
+ this.dirtyValue = false;
24
35
  this._highlighted = false;
25
36
  this._displayCheckmark = false;
26
37
  this._matchedRange = null;
38
+ if (text) {
39
+ this.text = text;
40
+ }
41
+ if (value) {
42
+ this.initialValue = value;
43
+ }
44
+ if (defaultSelected) {
45
+ this.defaultSelected = defaultSelected;
46
+ }
47
+ if (selected) {
48
+ this.selected = selected;
49
+ }
50
+ this.proxy = new Option(
51
+ this.text,
52
+ // @ts-expect-error Propery is used before it is assigned
53
+ this.initialValue,
54
+ this.defaultSelected,
55
+ this.selected
56
+ );
57
+ this.proxy.disabled = this.disabled;
27
58
  }
28
- // #region overrides base class accessor
29
- set text(value) {
30
- this._text = value;
59
+ /**
60
+ * Updates the ariaChecked property when the checked property changes.
61
+ *
62
+ * @param _ - the previous checked value
63
+ * @param next - the current checked value
64
+ *
65
+ * @public
66
+ */
67
+ checkedChanged(_, next) {
68
+ if (typeof next === "boolean") {
69
+ this.ariaChecked = next ? "true" : "false";
70
+ return;
71
+ }
72
+ this.ariaChecked = null;
31
73
  }
32
- get text() {
33
- return this._text ?? "";
74
+ defaultSelectedChanged() {
75
+ if (!this.dirtySelected) {
76
+ this.selected = this.defaultSelected;
77
+ if (this.proxy instanceof HTMLOptionElement) {
78
+ this.proxy.selected = this.defaultSelected;
79
+ }
80
+ }
81
+ }
82
+ disabledChanged() {
83
+ this.ariaDisabled = this.disabled ? "true" : "false";
84
+ if (this.proxy instanceof HTMLOptionElement) {
85
+ this.proxy.disabled = this.disabled;
86
+ }
87
+ }
88
+ selectedAttributeChanged() {
89
+ this.defaultSelected = this.selectedAttribute;
90
+ if (this.proxy instanceof HTMLOptionElement) {
91
+ this.proxy.defaultSelected = this.defaultSelected;
92
+ }
93
+ }
94
+ selectedChanged() {
95
+ this.ariaSelected = this.selected ? "true" : "false";
96
+ if (!this.dirtySelected) {
97
+ this.dirtySelected = true;
98
+ }
99
+ if (this.proxy instanceof HTMLOptionElement) {
100
+ this.proxy.selected = this.selected;
101
+ }
102
+ }
103
+ initialValueChanged() {
104
+ if (!this.dirtyValue) {
105
+ this.value = this.initialValue;
106
+ this.dirtyValue = false;
107
+ }
34
108
  }
35
109
  get label() {
36
110
  return this._label ?? this.text;
@@ -38,6 +112,28 @@ class ListboxOption extends listboxOption.ListboxOption {
38
112
  set label(value) {
39
113
  this._label = value;
40
114
  }
115
+ set text(value) {
116
+ this._text = value;
117
+ }
118
+ get text() {
119
+ return this._text ?? "";
120
+ }
121
+ set value(next) {
122
+ const newValue = `${next ?? ""}`;
123
+ this._value = newValue;
124
+ this.dirtyValue = true;
125
+ if (this.proxy instanceof HTMLOptionElement) {
126
+ this.proxy.value = newValue;
127
+ }
128
+ index.Observable.notify(this, "value");
129
+ }
130
+ get value() {
131
+ index.Observable.track(this, "value");
132
+ return this._value ?? this.text;
133
+ }
134
+ get form() {
135
+ return null;
136
+ }
41
137
  /**
42
138
  * @internal
43
139
  */
@@ -46,15 +142,35 @@ class ListboxOption extends listboxOption.ListboxOption {
46
142
  }
47
143
  }
48
144
  __decorateClass([
49
- index.attr({
50
- attribute: "text"
51
- })
52
- ], ListboxOption.prototype, "_text");
145
+ index.observable
146
+ ], ListboxOption.prototype, "checked");
147
+ __decorateClass([
148
+ index.observable
149
+ ], ListboxOption.prototype, "defaultSelected");
150
+ // @ts-expect-error Type is incorrectly non-optional
151
+ __decorateClass([
152
+ index.attr({ mode: "boolean" })
153
+ ], ListboxOption.prototype, "disabled");
154
+ // @ts-expect-error Type is incorrectly non-optional
155
+ __decorateClass([
156
+ index.attr({ attribute: "selected", mode: "boolean" })
157
+ ], ListboxOption.prototype, "selectedAttribute");
158
+ __decorateClass([
159
+ index.observable
160
+ ], ListboxOption.prototype, "selected");
161
+ __decorateClass([
162
+ index.attr({ attribute: "value", mode: "fromView" })
163
+ ], ListboxOption.prototype, "initialValue");
53
164
  __decorateClass([
54
165
  index.attr({
55
166
  attribute: "label"
56
167
  })
57
168
  ], ListboxOption.prototype, "_label");
169
+ __decorateClass([
170
+ index.attr({
171
+ attribute: "text"
172
+ })
173
+ ], ListboxOption.prototype, "_text");
58
174
  __decorateClass([
59
175
  index.observable
60
176
  ], ListboxOption.prototype, "_highlighted");
@@ -64,7 +180,26 @@ __decorateClass([
64
180
  __decorateClass([
65
181
  index.observable
66
182
  ], ListboxOption.prototype, "_matchedRange");
67
- applyMixins.applyMixins(ListboxOption, affix.AffixIconWithTrailing);
183
+ class DelegatesARIAListboxOption {
184
+ }
185
+ // @ts-expect-error Type is incorrectly non-optional
186
+ __decorateClass([
187
+ index.observable
188
+ ], DelegatesARIAListboxOption.prototype, "ariaChecked");
189
+ // @ts-expect-error Type is incorrectly non-optional
190
+ __decorateClass([
191
+ index.observable
192
+ ], DelegatesARIAListboxOption.prototype, "ariaPosInSet");
193
+ // @ts-expect-error Type is incorrectly non-optional
194
+ __decorateClass([
195
+ index.observable
196
+ ], DelegatesARIAListboxOption.prototype, "ariaSelected");
197
+ // @ts-expect-error Type is incorrectly non-optional
198
+ __decorateClass([
199
+ index.observable
200
+ ], DelegatesARIAListboxOption.prototype, "ariaSetSize");
201
+ applyMixins.applyMixins(DelegatesARIAListboxOption, ariaGlobal.ARIAGlobalStatesAndProperties);
202
+ applyMixins.applyMixins(ListboxOption, affix.AffixIconWithTrailing, DelegatesARIAListboxOption);
68
203
 
69
204
  const getClasses = (x) => classNames.classNames(
70
205
  "base",
@@ -1,7 +1,7 @@
1
- import { a as attr, o as observable, h as html, r as registerFactory } from './index.js';
1
+ import { F as FoundationElement, O as Observable, o as observable, a as attr, h as html, r as registerFactory } from './index.js';
2
2
  import { a as iconRegistries } from './definition27.js';
3
3
  import { b as AffixIconWithTrailing, a as affixIconTemplateFactory, I as IconWrapper } from './affix.js';
4
- import { L as ListboxOption$1 } from './listbox-option.js';
4
+ import { A as ARIAGlobalStatesAndProperties } from './aria-global2.js';
5
5
  import { a as applyMixins } from './apply-mixins.js';
6
6
  import { I as Icon } from './icon.js';
7
7
  import { w as when } from './when.js';
@@ -16,19 +16,93 @@ var __decorateClass = (decorators, target, key, kind) => {
16
16
  if (result) __defProp(target, key, result);
17
17
  return result;
18
18
  };
19
- class ListboxOption extends ListboxOption$1 {
20
- constructor() {
21
- super(...arguments);
19
+ class ListboxOption extends FoundationElement {
20
+ constructor(text, value, defaultSelected, selected) {
21
+ super();
22
+ this.defaultSelected = false;
23
+ /**
24
+ * Tracks whether the "selected" property has been changed.
25
+ * @internal
26
+ */
27
+ this.dirtySelected = false;
28
+ this.selected = this.defaultSelected;
29
+ /**
30
+ * Track whether the value has been changed from the initial value
31
+ */
32
+ this.dirtyValue = false;
22
33
  this._highlighted = false;
23
34
  this._displayCheckmark = false;
24
35
  this._matchedRange = null;
36
+ if (text) {
37
+ this.text = text;
38
+ }
39
+ if (value) {
40
+ this.initialValue = value;
41
+ }
42
+ if (defaultSelected) {
43
+ this.defaultSelected = defaultSelected;
44
+ }
45
+ if (selected) {
46
+ this.selected = selected;
47
+ }
48
+ this.proxy = new Option(
49
+ this.text,
50
+ // @ts-expect-error Propery is used before it is assigned
51
+ this.initialValue,
52
+ this.defaultSelected,
53
+ this.selected
54
+ );
55
+ this.proxy.disabled = this.disabled;
25
56
  }
26
- // #region overrides base class accessor
27
- set text(value) {
28
- this._text = value;
57
+ /**
58
+ * Updates the ariaChecked property when the checked property changes.
59
+ *
60
+ * @param _ - the previous checked value
61
+ * @param next - the current checked value
62
+ *
63
+ * @public
64
+ */
65
+ checkedChanged(_, next) {
66
+ if (typeof next === "boolean") {
67
+ this.ariaChecked = next ? "true" : "false";
68
+ return;
69
+ }
70
+ this.ariaChecked = null;
29
71
  }
30
- get text() {
31
- return this._text ?? "";
72
+ defaultSelectedChanged() {
73
+ if (!this.dirtySelected) {
74
+ this.selected = this.defaultSelected;
75
+ if (this.proxy instanceof HTMLOptionElement) {
76
+ this.proxy.selected = this.defaultSelected;
77
+ }
78
+ }
79
+ }
80
+ disabledChanged() {
81
+ this.ariaDisabled = this.disabled ? "true" : "false";
82
+ if (this.proxy instanceof HTMLOptionElement) {
83
+ this.proxy.disabled = this.disabled;
84
+ }
85
+ }
86
+ selectedAttributeChanged() {
87
+ this.defaultSelected = this.selectedAttribute;
88
+ if (this.proxy instanceof HTMLOptionElement) {
89
+ this.proxy.defaultSelected = this.defaultSelected;
90
+ }
91
+ }
92
+ selectedChanged() {
93
+ this.ariaSelected = this.selected ? "true" : "false";
94
+ if (!this.dirtySelected) {
95
+ this.dirtySelected = true;
96
+ }
97
+ if (this.proxy instanceof HTMLOptionElement) {
98
+ this.proxy.selected = this.selected;
99
+ }
100
+ }
101
+ initialValueChanged() {
102
+ if (!this.dirtyValue) {
103
+ this.value = this.initialValue;
104
+ this.dirtyValue = false;
105
+ }
32
106
  }
33
107
  get label() {
34
108
  return this._label ?? this.text;
@@ -36,6 +110,28 @@ class ListboxOption extends ListboxOption$1 {
36
110
  set label(value) {
37
111
  this._label = value;
38
112
  }
113
+ set text(value) {
114
+ this._text = value;
115
+ }
116
+ get text() {
117
+ return this._text ?? "";
118
+ }
119
+ set value(next) {
120
+ const newValue = `${next ?? ""}`;
121
+ this._value = newValue;
122
+ this.dirtyValue = true;
123
+ if (this.proxy instanceof HTMLOptionElement) {
124
+ this.proxy.value = newValue;
125
+ }
126
+ Observable.notify(this, "value");
127
+ }
128
+ get value() {
129
+ Observable.track(this, "value");
130
+ return this._value ?? this.text;
131
+ }
132
+ get form() {
133
+ return null;
134
+ }
39
135
  /**
40
136
  * @internal
41
137
  */
@@ -44,15 +140,35 @@ class ListboxOption extends ListboxOption$1 {
44
140
  }
45
141
  }
46
142
  __decorateClass([
47
- attr({
48
- attribute: "text"
49
- })
50
- ], ListboxOption.prototype, "_text");
143
+ observable
144
+ ], ListboxOption.prototype, "checked");
145
+ __decorateClass([
146
+ observable
147
+ ], ListboxOption.prototype, "defaultSelected");
148
+ // @ts-expect-error Type is incorrectly non-optional
149
+ __decorateClass([
150
+ attr({ mode: "boolean" })
151
+ ], ListboxOption.prototype, "disabled");
152
+ // @ts-expect-error Type is incorrectly non-optional
153
+ __decorateClass([
154
+ attr({ attribute: "selected", mode: "boolean" })
155
+ ], ListboxOption.prototype, "selectedAttribute");
156
+ __decorateClass([
157
+ observable
158
+ ], ListboxOption.prototype, "selected");
159
+ __decorateClass([
160
+ attr({ attribute: "value", mode: "fromView" })
161
+ ], ListboxOption.prototype, "initialValue");
51
162
  __decorateClass([
52
163
  attr({
53
164
  attribute: "label"
54
165
  })
55
166
  ], ListboxOption.prototype, "_label");
167
+ __decorateClass([
168
+ attr({
169
+ attribute: "text"
170
+ })
171
+ ], ListboxOption.prototype, "_text");
56
172
  __decorateClass([
57
173
  observable
58
174
  ], ListboxOption.prototype, "_highlighted");
@@ -62,7 +178,26 @@ __decorateClass([
62
178
  __decorateClass([
63
179
  observable
64
180
  ], ListboxOption.prototype, "_matchedRange");
65
- applyMixins(ListboxOption, AffixIconWithTrailing);
181
+ class DelegatesARIAListboxOption {
182
+ }
183
+ // @ts-expect-error Type is incorrectly non-optional
184
+ __decorateClass([
185
+ observable
186
+ ], DelegatesARIAListboxOption.prototype, "ariaChecked");
187
+ // @ts-expect-error Type is incorrectly non-optional
188
+ __decorateClass([
189
+ observable
190
+ ], DelegatesARIAListboxOption.prototype, "ariaPosInSet");
191
+ // @ts-expect-error Type is incorrectly non-optional
192
+ __decorateClass([
193
+ observable
194
+ ], DelegatesARIAListboxOption.prototype, "ariaSelected");
195
+ // @ts-expect-error Type is incorrectly non-optional
196
+ __decorateClass([
197
+ observable
198
+ ], DelegatesARIAListboxOption.prototype, "ariaSetSize");
199
+ applyMixins(DelegatesARIAListboxOption, ARIAGlobalStatesAndProperties);
200
+ applyMixins(ListboxOption, AffixIconWithTrailing, DelegatesARIAListboxOption);
66
201
 
67
202
  const getClasses = (x) => classNames(
68
203
  "base",