@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
@@ -7,201 +7,161 @@ const numbers = require('./numbers.cjs');
7
7
  const slotted = require('./slotted.cjs');
8
8
  const classNames = require('./class-names.cjs');
9
9
 
10
- /**
11
- * Expand mode for {@link Accordion}
12
- * @public
13
- */
10
+ const styles = ".base{display:flex;box-sizing:border-box;flex-direction:column}::slotted(:not(:only-of-type)){border-bottom:1px solid var(--vvd-color-neutral-200)}";
11
+
12
+ var __defProp = Object.defineProperty;
13
+ var __decorateClass = (decorators, target, key, kind) => {
14
+ var result = void 0 ;
15
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
16
+ if (decorator = decorators[i])
17
+ result = (decorator(target, key, result) ) || result;
18
+ if (result) __defProp(target, key, result);
19
+ return result;
20
+ };
14
21
  const AccordionExpandMode = {
15
- /**
16
- * Designates only a single {@link @microsoft/fast-foundation#(AccordionItem:class) } can be open a time.
17
- */
18
- single: "single",
19
- /**
20
- * Designates multiple {@link @microsoft/fast-foundation#(AccordionItem:class) | AccordionItems} can be open simultaneously.
21
- */
22
- multi: "multi",
22
+ /**
23
+ * Designates only a single {@link @microsoft/fast-foundation#(AccordionItem:class) } can be open a time.
24
+ */
25
+ single: "single",
26
+ /**
27
+ * Designates multiple {@link @microsoft/fast-foundation#(AccordionItem:class) | AccordionItems} can be open simultaneously.
28
+ */
29
+ multi: "multi"
23
30
  };
24
- /**
25
- * An Accordion Custom HTML Element
26
- * Implements {@link https://www.w3.org/TR/wai-aria-practices-1.1/#accordion | ARIA Accordion}.
27
- *
28
- * @fires change - Fires a custom 'change' event when the active item changes
29
- * @csspart item - The slot for the accordion items
30
- * @public
31
- *
32
- * @remarks
33
- * Designed to be used with {@link @microsoft/fast-foundation#accordionTemplate} and {@link @microsoft/fast-foundation#(AccordionItem:class)}.
34
- */
35
- let Accordion$1 = class Accordion extends index.FoundationElement {
36
- constructor() {
37
- super(...arguments);
38
- /**
39
- * Controls the expand mode of the Accordion, either allowing
40
- * single or multiple item expansion.
41
- * @public
42
- *
43
- * @remarks
44
- * HTML attribute: expand-mode
45
- */
46
- this.expandmode = AccordionExpandMode.multi;
47
- this.activeItemIndex = 0;
48
- this.change = () => {
49
- this.$emit("change", this.activeid);
50
- };
51
- this.setItems = () => {
52
- var _a;
53
- if (this.accordionItems.length === 0) {
54
- return;
55
- }
56
- this.accordionIds = this.getItemIds();
57
- this.accordionItems.forEach((item, index) => {
58
- if (item instanceof definition.AccordionItem) {
59
- item.addEventListener("change", this.activeItemChange);
60
- if (this.isSingleExpandMode()) {
61
- this.activeItemIndex !== index
62
- ? (item.expanded = false)
63
- : (item.expanded = true);
64
- }
65
- }
66
- const itemId = this.accordionIds[index];
67
- item.setAttribute("id", typeof itemId !== "string" ? `accordion-${index + 1}` : itemId);
68
- this.activeid = this.accordionIds[this.activeItemIndex];
69
- item.addEventListener("keydown", this.handleItemKeyDown);
70
- item.addEventListener("focus", this.handleItemFocus);
71
- });
72
- if (this.isSingleExpandMode()) {
73
- const expandedItem = (_a = this.findExpandedItem()) !== null && _a !== void 0 ? _a : this.accordionItems[0];
74
- expandedItem.setAttribute("aria-disabled", "true");
75
- }
76
- };
77
- this.removeItemListeners = (oldValue) => {
78
- oldValue.forEach((item, index) => {
79
- item.removeEventListener("change", this.activeItemChange);
80
- item.removeEventListener("keydown", this.handleItemKeyDown);
81
- item.removeEventListener("focus", this.handleItemFocus);
82
- });
83
- };
84
- this.activeItemChange = (event) => {
85
- if (event.defaultPrevented || event.target !== event.currentTarget) {
86
- return;
87
- }
88
- event.preventDefault();
89
- const selectedItem = event.target;
90
- this.activeid = selectedItem.getAttribute("id");
91
- if (this.isSingleExpandMode()) {
92
- this.resetItems();
93
- selectedItem.expanded = true;
94
- selectedItem.setAttribute("aria-disabled", "true");
95
- this.accordionItems.forEach((item) => {
96
- if (!item.hasAttribute("disabled") && item.id !== this.activeid) {
97
- item.removeAttribute("aria-disabled");
98
- }
99
- });
100
- }
101
- this.activeItemIndex = Array.from(this.accordionItems).indexOf(selectedItem);
102
- this.change();
103
- };
104
- this.handleItemKeyDown = (event) => {
105
- // only handle the keydown if the event target is the accordion item
106
- // prevents arrow keys from moving focus to accordion headers when focus is on accordion item panel content
107
- if (event.target !== event.currentTarget) {
108
- return;
109
- }
110
- this.accordionIds = this.getItemIds();
111
- switch (event.key) {
112
- case keyCodes.keyArrowUp:
113
- event.preventDefault();
114
- this.adjust(-1);
115
- break;
116
- case keyCodes.keyArrowDown:
117
- event.preventDefault();
118
- this.adjust(1);
119
- break;
120
- case keyCodes.keyHome:
121
- this.activeItemIndex = 0;
122
- this.focusItem();
123
- break;
124
- case keyCodes.keyEnd:
125
- this.activeItemIndex = this.accordionItems.length - 1;
126
- this.focusItem();
127
- break;
128
- }
129
- };
130
- this.handleItemFocus = (event) => {
131
- // update the active item index if the focus moves to an accordion item via a different method other than the up and down arrow key actions
132
- // only do so if the focus is actually on the accordion item and not on any of its children
133
- if (event.target === event.currentTarget) {
134
- const focusedItem = event.target;
135
- const focusedIndex = (this.activeItemIndex = Array.from(this.accordionItems).indexOf(focusedItem));
136
- if (this.activeItemIndex !== focusedIndex && focusedIndex !== -1) {
137
- this.activeItemIndex = focusedIndex;
138
- this.activeid = this.accordionIds[this.activeItemIndex];
139
- }
140
- }
141
- };
142
- }
143
- /**
144
- * @internal
145
- */
146
- accordionItemsChanged(oldValue, newValue) {
147
- if (this.$fastController.isConnected) {
148
- this.removeItemListeners(oldValue);
149
- this.setItems();
150
- }
151
- }
152
- findExpandedItem() {
153
- for (let item = 0; item < this.accordionItems.length; item++) {
154
- if (this.accordionItems[item].getAttribute("expanded") === "true") {
155
- return this.accordionItems[item];
31
+ class Accordion extends index.FoundationElement {
32
+ constructor() {
33
+ super(...arguments);
34
+ /* eslint-disable-next-line @nrwl/nx/workspace/no-attribute-default-value */
35
+ this.expandmode = AccordionExpandMode.single;
36
+ this.activeItemIndex = 0;
37
+ this.change = () => {
38
+ this.$emit("change", this.activeid);
39
+ };
40
+ this.setItems = () => {
41
+ if (this.accordionItems.length === 0) {
42
+ return;
43
+ }
44
+ this.accordionIds = this.getItemIds();
45
+ this.activeid = this.accordionIds[this.activeItemIndex];
46
+ this.accordionItems.forEach((item, index) => {
47
+ if (item instanceof definition.AccordionItem) {
48
+ item.addEventListener("change", this.activeItemChange);
49
+ if (this.isSingleExpandMode()) {
50
+ const expandedItem = this.findExpandedItem();
51
+ if (expandedItem === null && index === 0) {
52
+ item.expanded = true;
53
+ } else {
54
+ item !== this.findExpandedItem() ? item.expanded = false : item.expanded = true;
156
55
  }
56
+ }
157
57
  }
158
- return null;
159
- }
160
- resetItems() {
161
- this.accordionItems.forEach((item, index) => {
162
- item.expanded = false;
163
- });
164
- }
165
- getItemIds() {
166
- return this.accordionItems.map((accordionItem) => {
167
- return accordionItem.getAttribute("id");
58
+ const itemId = this.accordionIds[index];
59
+ item.setAttribute(
60
+ "id",
61
+ typeof itemId !== "string" ? `accordion-${index + 1}` : itemId
62
+ );
63
+ item.addEventListener("keydown", this.handleItemKeyDown);
64
+ });
65
+ if (this.isSingleExpandMode()) {
66
+ const expandedItem = this.findExpandedItem() ?? this.accordionItems[0];
67
+ expandedItem.setAttribute("aria-disabled", "true");
68
+ }
69
+ };
70
+ this.removeItemListeners = (oldValue) => {
71
+ oldValue.forEach((item) => {
72
+ item.removeEventListener("change", this.activeItemChange);
73
+ item.removeEventListener("keydown", this.handleItemKeyDown);
74
+ });
75
+ };
76
+ this.activeItemChange = (event) => {
77
+ if (event.defaultPrevented || event.target !== event.currentTarget) {
78
+ return;
79
+ }
80
+ event.preventDefault();
81
+ const selectedItem = event.target;
82
+ this.activeid = selectedItem.getAttribute("id");
83
+ if (this.isSingleExpandMode()) {
84
+ this.resetItems();
85
+ selectedItem.expanded = true;
86
+ selectedItem.setAttribute("aria-disabled", "true");
87
+ this.accordionItems.forEach((item) => {
88
+ if (!item.hasAttribute("disabled") && item.id !== this.activeid) {
89
+ item.removeAttribute("aria-disabled");
90
+ }
168
91
  });
92
+ }
93
+ this.activeItemIndex = Array.from(this.accordionItems).indexOf(
94
+ selectedItem
95
+ );
96
+ this.change();
97
+ };
98
+ this.handleItemKeyDown = (event) => {
99
+ if (event.target !== event.currentTarget) {
100
+ return;
101
+ }
102
+ this.accordionIds = this.getItemIds();
103
+ switch (event.key) {
104
+ case keyCodes.keyArrowUp:
105
+ event.preventDefault();
106
+ this.adjust(event.target, -1);
107
+ break;
108
+ case keyCodes.keyArrowDown:
109
+ event.preventDefault();
110
+ this.adjust(event.target, 1);
111
+ break;
112
+ case keyCodes.keyHome:
113
+ this.focusItem(0);
114
+ break;
115
+ case keyCodes.keyEnd:
116
+ this.focusItem(this.accordionItems.length - 1);
117
+ break;
118
+ }
119
+ };
120
+ }
121
+ /**
122
+ * @internal
123
+ */
124
+ accordionItemsChanged(oldValue) {
125
+ if (this.$fastController.isConnected) {
126
+ this.removeItemListeners(oldValue);
127
+ this.setItems();
169
128
  }
170
- isSingleExpandMode() {
171
- return this.expandmode === AccordionExpandMode.single;
172
- }
173
- adjust(adjustment) {
174
- this.activeItemIndex = numbers.wrapInBounds(0, this.accordionItems.length - 1, this.activeItemIndex + adjustment);
175
- this.focusItem();
129
+ }
130
+ findExpandedItem() {
131
+ for (let item = 0; item < this.accordionItems.length; item++) {
132
+ if (this.accordionItems[item].hasAttribute("expanded") === true) {
133
+ return this.accordionItems[item];
134
+ }
176
135
  }
177
- focusItem() {
178
- const element = this.accordionItems[this.activeItemIndex];
179
- if (element instanceof definition.AccordionItem) {
180
- element.expandbutton.focus();
181
- }
136
+ return null;
137
+ }
138
+ resetItems() {
139
+ this.accordionItems.forEach((item) => {
140
+ item.expanded = false;
141
+ });
142
+ }
143
+ getItemIds() {
144
+ return this.accordionItems.map((accordionItem) => {
145
+ return accordionItem.getAttribute("id");
146
+ });
147
+ }
148
+ isSingleExpandMode() {
149
+ return this.expandmode !== AccordionExpandMode.multi;
150
+ }
151
+ adjust(item, adjustment) {
152
+ this.focusItem(
153
+ numbers.wrapInBounds(
154
+ 0,
155
+ this.accordionItems.length - 1,
156
+ this.accordionItems.indexOf(item) + adjustment
157
+ )
158
+ );
159
+ }
160
+ focusItem(index) {
161
+ const element = this.accordionItems[index];
162
+ if (element instanceof definition.AccordionItem) {
163
+ element.expandbutton.focus();
182
164
  }
183
- };
184
- index.__decorate([
185
- index.attr({ attribute: "expand-mode" })
186
- ], Accordion$1.prototype, "expandmode", void 0);
187
- index.__decorate([
188
- index.observable
189
- ], Accordion$1.prototype, "accordionItems", void 0);
190
-
191
- const styles = ".base{display:flex;box-sizing:border-box;flex-direction:column}::slotted(:not(:only-of-type)){border-bottom:1px solid var(--vvd-color-neutral-200)}";
192
-
193
- class Accordion extends Accordion$1 {
194
- constructor() {
195
- super(...arguments);
196
- /**
197
- * Controls the expand mode of the Accordion, either allowing
198
- * single or multiple item expansion.
199
- * @public
200
- *
201
- * @remarks
202
- * HTML attribute: expand-mode
203
- */
204
- this.expandmode = AccordionExpandMode.single;
205
165
  }
206
166
  closeAll() {
207
167
  if (this.expandmode === AccordionExpandMode.multi) {
@@ -211,6 +171,13 @@ class Accordion extends Accordion$1 {
211
171
  }
212
172
  }
213
173
  }
174
+ __decorateClass([
175
+ index.attr({ attribute: "expand-mode" })
176
+ ], Accordion.prototype, "expandmode");
177
+ // @ts-expect-error Type is incorrectly non-optional
178
+ __decorateClass([
179
+ index.observable
180
+ ], Accordion.prototype, "accordionItems");
214
181
 
215
182
  const getClasses = (_) => classNames.classNames("base");
216
183
  const AccordionTemplate = () => index.html`