@vonage/vivid 3.31.0 → 3.34.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 (237) hide show
  1. package/accordion/index.js +5 -5
  2. package/accordion-item/index.js +4 -4
  3. package/action-group/index.js +1 -1
  4. package/alert/index.js +8 -7
  5. package/avatar/index.js +2 -2
  6. package/badge/index.js +2 -2
  7. package/banner/index.js +5 -5
  8. package/breadcrumb/index.js +1 -1
  9. package/breadcrumb-item/index.js +3 -3
  10. package/button/index.js +4 -4
  11. package/calendar/index.js +1 -1
  12. package/calendar-event/index.js +1 -1
  13. package/card/index.js +3 -3
  14. package/checkbox/index.js +7 -4
  15. package/combobox/index.js +10 -9
  16. package/custom-elements.json +996 -29
  17. package/data-grid/index.js +2 -2
  18. package/date-picker/index.js +35 -0
  19. package/dialog/index.js +6 -6
  20. package/divider/index.js +1 -1
  21. package/elevation/index.js +1 -1
  22. package/empty-state/index.js +2 -2
  23. package/fab/index.js +4 -4
  24. package/file-picker/index.js +7 -6
  25. package/focus/index.js +1 -1
  26. package/header/index.js +2 -2
  27. package/icon/index.js +1 -1
  28. package/index.d.ts +1 -0
  29. package/index.js +68 -66
  30. package/layout/index.js +1 -1
  31. package/lib/button/button.d.ts +2 -0
  32. package/lib/calendar/calendar.d.ts +1 -1
  33. package/lib/components.d.ts +20 -19
  34. package/lib/date-picker/calendar/calendarGrid.d.ts +17 -0
  35. package/lib/date-picker/calendar/dateStr.d.ts +7 -0
  36. package/lib/date-picker/calendar/month.d.ts +12 -0
  37. package/lib/date-picker/calendar/monthPickerGrid.d.ts +10 -0
  38. package/lib/date-picker/calendar/presentationDate.d.ts +4 -0
  39. package/lib/date-picker/calendar/year.d.ts +2 -0
  40. package/lib/date-picker/date-picker.d.ts +18 -0
  41. package/lib/date-picker/date-picker.template.d.ts +4 -0
  42. package/lib/date-picker/definition.d.ts +3 -0
  43. package/lib/date-picker/locale.d.ts +21 -0
  44. package/lib/icon/icon.d.ts +0 -1
  45. package/lib/listbox/listbox.d.ts +9 -1
  46. package/lib/select/select.d.ts +4 -2
  47. package/lib/text-field/text-field.d.ts +1 -0
  48. package/listbox/index.js +22 -17
  49. package/locales/en-GB.d.ts +3 -0
  50. package/locales/en-GB.js +59 -0
  51. package/locales/en-US.d.ts +3 -0
  52. package/locales/en-US.js +59 -0
  53. package/locales/ja-JP.d.ts +3 -0
  54. package/locales/ja-JP.js +59 -0
  55. package/locales/zh-CN.d.ts +3 -0
  56. package/locales/zh-CN.js +59 -0
  57. package/menu/index.js +8 -8
  58. package/menu-item/index.js +4 -4
  59. package/nav/index.js +1 -1
  60. package/nav-disclosure/index.js +3 -3
  61. package/nav-item/index.js +3 -3
  62. package/note/index.js +4 -4
  63. package/number-field/index.js +8 -7
  64. package/option/index.js +5 -4
  65. package/package.json +2 -15
  66. package/pagination/index.js +5 -5
  67. package/popup/index.js +6 -6
  68. package/progress/index.js +1 -1
  69. package/progress-ring/index.js +1 -1
  70. package/radio/index.js +2 -2
  71. package/radio-group/index.js +1 -1
  72. package/select/index.js +10 -9
  73. package/shared/affix.js +25 -9
  74. package/shared/apply-mixins.js +1 -1
  75. package/shared/breadcrumb-item.js +5 -5
  76. package/shared/button.js +13 -13
  77. package/shared/calendar-event.js +36 -16
  78. package/shared/definition.js +133 -194
  79. package/shared/definition10.js +225 -40
  80. package/shared/definition11.js +36 -32
  81. package/shared/definition12.js +763 -98
  82. package/shared/definition13.js +125 -89
  83. package/shared/definition14.js +207 -27
  84. package/shared/definition15.js +710 -731
  85. package/shared/definition16.js +1289 -47
  86. package/shared/definition17.js +6113 -93
  87. package/shared/definition18.js +242 -164
  88. package/shared/definition19.js +47 -692
  89. package/shared/definition2.js +199 -117
  90. package/shared/definition20.js +59 -1671
  91. package/shared/definition21.js +95 -255
  92. package/shared/definition22.js +2218 -1167
  93. package/shared/definition23.js +57 -219
  94. package/shared/definition24.js +27 -68
  95. package/shared/definition25.js +54 -38
  96. package/shared/definition26.js +395 -70
  97. package/shared/definition27.js +381 -2223
  98. package/shared/definition28.js +85 -44
  99. package/shared/definition29.js +27 -40
  100. package/shared/definition3.js +61 -24
  101. package/shared/definition30.js +13 -427
  102. package/shared/definition31.js +49 -360
  103. package/shared/definition32.js +466 -13
  104. package/shared/definition33.js +273 -63
  105. package/shared/definition34.js +195 -25
  106. package/shared/definition35.js +86 -35
  107. package/shared/definition36.js +66 -427
  108. package/shared/definition37.js +430 -190
  109. package/shared/definition38.js +34 -52
  110. package/shared/definition39.js +683 -31
  111. package/shared/definition4.js +157 -12
  112. package/shared/definition40.js +97 -422
  113. package/shared/definition41.js +473 -543
  114. package/shared/definition42.js +122 -73
  115. package/shared/definition43.js +103 -502
  116. package/shared/definition44.js +23 -101
  117. package/shared/definition45.js +76 -126
  118. package/shared/definition46.js +494 -48
  119. package/shared/definition47.js +23 -23
  120. package/shared/definition48.js +126 -476
  121. package/shared/definition49.js +275 -98
  122. package/shared/definition5.js +71 -36
  123. package/shared/definition50.js +157 -16
  124. package/shared/definition51.js +133 -263
  125. package/shared/definition52.js +131 -115
  126. package/shared/definition53.js +85 -120
  127. package/shared/definition54.js +295 -111
  128. package/shared/definition55.js +12 -71
  129. package/shared/definition56.js +39 -295
  130. package/shared/definition57.js +181 -0
  131. package/shared/definition6.js +56 -111
  132. package/shared/definition7.js +119 -187
  133. package/shared/definition8.js +58 -23
  134. package/shared/definition9.js +92 -66
  135. package/shared/focus.js +2 -1
  136. package/shared/focus2.js +1 -1
  137. package/shared/form-associated.js +2 -2
  138. package/shared/icon.js +48 -27
  139. package/shared/index.js +7 -27
  140. package/shared/index2.js +202 -0
  141. package/shared/key-codes.js +1 -1
  142. package/shared/listbox.js +88 -11
  143. package/shared/localization/Locale.d.ts +4 -0
  144. package/shared/localization/index.d.ts +7 -0
  145. package/shared/patterns/form-elements/form-elements.d.ts +4 -4
  146. package/shared/patterns/index.d.ts +1 -0
  147. package/shared/patterns/localized.d.ts +4 -0
  148. package/shared/radio.js +23 -7
  149. package/shared/repeat.js +1 -1
  150. package/shared/text-anchor.js +21 -4
  151. package/shared/text-anchor.template.js +37 -40
  152. package/shared/text-field.js +2 -2
  153. package/shared/text-field2.js +15 -15
  154. package/shared/tree-item.js +12 -12
  155. package/side-drawer/index.js +1 -1
  156. package/slider/index.js +2 -2
  157. package/split-button/index.js +3 -3
  158. package/style.css +6097 -0
  159. package/styles/core/all.css +25 -3
  160. package/styles/core/theme.css +1 -1
  161. package/styles/core/typography.css +25 -3
  162. package/styles/tokens/theme-dark.css +4 -4
  163. package/styles/tokens/theme-light.css +4 -4
  164. package/styles/tokens/vivid-2-compat.css +2 -2
  165. package/switch/index.js +5 -4
  166. package/tab/index.js +3 -3
  167. package/tab-panel/index.js +1 -1
  168. package/tabs/index.js +5 -5
  169. package/tag/index.js +3 -3
  170. package/tag-group/index.js +1 -1
  171. package/text-anchor/index.js +1 -1
  172. package/text-area/index.js +5 -4
  173. package/text-field/index.js +5 -4
  174. package/toggletip/index.js +7 -7
  175. package/tooltip/index.js +7 -7
  176. package/tree-item/index.js +3 -3
  177. package/tree-view/index.js +1 -1
  178. package/vivid.api.json +137 -0
  179. package/lib/accordion/index.d.ts +0 -1
  180. package/lib/accordion-item/index.d.ts +0 -1
  181. package/lib/action-group/index.d.ts +0 -1
  182. package/lib/alert/index.d.ts +0 -1
  183. package/lib/avatar/index.d.ts +0 -1
  184. package/lib/badge/index.d.ts +0 -1
  185. package/lib/banner/index.d.ts +0 -1
  186. package/lib/breadcrumb/index.d.ts +0 -1
  187. package/lib/breadcrumb-item/index.d.ts +0 -1
  188. package/lib/button/index.d.ts +0 -1
  189. package/lib/calendar/index.d.ts +0 -1
  190. package/lib/calendar-event/index.d.ts +0 -1
  191. package/lib/card/index.d.ts +0 -1
  192. package/lib/checkbox/index.d.ts +0 -1
  193. package/lib/combobox/index.d.ts +0 -1
  194. package/lib/data-grid/index.d.ts +0 -1
  195. package/lib/dialog/index.d.ts +0 -1
  196. package/lib/divider/index.d.ts +0 -1
  197. package/lib/elevation/index.d.ts +0 -1
  198. package/lib/empty-state/index.d.ts +0 -1
  199. package/lib/fab/index.d.ts +0 -1
  200. package/lib/file-picker/index.d.ts +0 -1
  201. package/lib/focus/index.d.ts +0 -1
  202. package/lib/header/index.d.ts +0 -1
  203. package/lib/icon/index.d.ts +0 -1
  204. package/lib/layout/index.d.ts +0 -1
  205. package/lib/listbox/index.d.ts +0 -1
  206. package/lib/menu/index.d.ts +0 -1
  207. package/lib/menu-item/index.d.ts +0 -1
  208. package/lib/nav/index.d.ts +0 -1
  209. package/lib/nav-disclosure/index.d.ts +0 -1
  210. package/lib/nav-item/index.d.ts +0 -1
  211. package/lib/note/index.d.ts +0 -1
  212. package/lib/number-field/index.d.ts +0 -1
  213. package/lib/option/index.d.ts +0 -1
  214. package/lib/pagination/index.d.ts +0 -1
  215. package/lib/popup/index.d.ts +0 -1
  216. package/lib/progress/index.d.ts +0 -1
  217. package/lib/progress-ring/index.d.ts +0 -1
  218. package/lib/radio/index.d.ts +0 -1
  219. package/lib/radio-group/index.d.ts +0 -1
  220. package/lib/select/index.d.ts +0 -1
  221. package/lib/side-drawer/index.d.ts +0 -1
  222. package/lib/slider/index.d.ts +0 -1
  223. package/lib/split-button/index.d.ts +0 -1
  224. package/lib/switch/index.d.ts +0 -1
  225. package/lib/tab/index.d.ts +0 -1
  226. package/lib/tab-panel/index.d.ts +0 -1
  227. package/lib/tabs/index.d.ts +0 -1
  228. package/lib/tag/index.d.ts +0 -1
  229. package/lib/tag-group/index.d.ts +0 -1
  230. package/lib/text-anchor/index.d.ts +0 -1
  231. package/lib/text-area/index.d.ts +0 -1
  232. package/lib/text-field/index.d.ts +0 -1
  233. package/lib/toggletip/index.d.ts +0 -1
  234. package/lib/tooltip/index.d.ts +0 -1
  235. package/lib/tree-item/index.d.ts +0 -1
  236. package/lib/tree-view/index.d.ts +0 -1
  237. package/shared/form-elements.js +0 -162
@@ -1,4 +1,4 @@
1
- import { r as registerRadioGroup } from '../shared/definition40.js';
1
+ import { b as registerRadioGroup } from '../shared/definition37.js';
2
2
  import '../shared/index.js';
3
3
  import '../shared/direction.js';
4
4
  import '../shared/key-codes.js';
package/select/index.js CHANGED
@@ -1,15 +1,15 @@
1
- import { r as registerSelect } from '../shared/definition41.js';
1
+ import { r as registerSelect } from '../shared/definition39.js';
2
2
  import '../shared/index.js';
3
- import '../shared/definition4.js';
3
+ import '../shared/definition55.js';
4
4
  import '../shared/focus.js';
5
- import '../shared/definition20.js';
6
- import '../shared/definition7.js';
7
- import '../shared/definition3.js';
5
+ import '../shared/definition57.js';
6
+ import '../shared/definition10.js';
7
+ import '../shared/definition24.js';
8
8
  import '../shared/icon.js';
9
9
  import '../shared/_has.js';
10
10
  import '../shared/class-names.js';
11
11
  import '../shared/when.js';
12
- import '../shared/definition9.js';
12
+ import '../shared/definition35.js';
13
13
  import '../shared/base-progress.js';
14
14
  import '../shared/affix.js';
15
15
  import '../shared/button.js';
@@ -20,10 +20,11 @@ import '../shared/aria-global.js';
20
20
  import '../shared/start-end.js';
21
21
  import '../shared/ref.js';
22
22
  import '../shared/focus2.js';
23
- import '../shared/definition8.js';
24
- import '../shared/definition21.js';
23
+ import '../shared/definition56.js';
24
+ import '../shared/definition33.js';
25
25
  import '../shared/dom.js';
26
- import '../shared/form-elements.js';
26
+ import '../shared/index2.js';
27
+ import '../locales/en-US.js';
27
28
  import '../shared/listbox.js';
28
29
  import '../shared/strings.js';
29
30
  import '../shared/numbers.js';
package/shared/affix.js CHANGED
@@ -1,21 +1,37 @@
1
- import { _ as __decorate, a as attr, b as __metadata, h as html } from './index.js';
2
1
  import { I as Icon } from './icon.js';
2
+ import { a as attr, h as html } from './index.js';
3
3
 
4
- class AffixIcon {}
5
- __decorate([attr, __metadata("design:type", String)], AffixIcon.prototype, "icon", void 0);
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __decorateClass = (decorators, target, key, kind) => {
7
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
8
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
9
+ if (decorator = decorators[i])
10
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11
+ if (kind && result)
12
+ __defProp(target, key, result);
13
+ return result;
14
+ };
15
+ class AffixIcon {
16
+ }
17
+ __decorateClass([
18
+ attr
19
+ ], AffixIcon.prototype, "icon", 2);
6
20
  class AffixIconWithTrailing extends AffixIcon {
7
21
  constructor() {
8
22
  super(...arguments);
9
23
  this.iconTrailing = false;
10
24
  }
11
25
  }
12
- __decorate([attr({
13
- mode: 'boolean',
14
- attribute: 'icon-trailing'
15
- }), __metadata("design:type", Object)], AffixIconWithTrailing.prototype, "iconTrailing", void 0);
26
+ __decorateClass([
27
+ attr({
28
+ mode: "boolean",
29
+ attribute: "icon-trailing"
30
+ })
31
+ ], AffixIconWithTrailing.prototype, "iconTrailing", 2);
16
32
  const affixIconTemplateFactory = (context, withWrapper = true) => {
17
33
  const iconTag = context.tagFor(Icon);
18
- return icon => {
34
+ return (icon) => {
19
35
  if (!icon) {
20
36
  return null;
21
37
  }
@@ -24,4 +40,4 @@ const affixIconTemplateFactory = (context, withWrapper = true) => {
24
40
  };
25
41
  };
26
42
 
27
- export { AffixIconWithTrailing as A, affixIconTemplateFactory as a, AffixIcon as b };
43
+ export { AffixIcon as A, affixIconTemplateFactory as a, AffixIconWithTrailing as b };
@@ -1,4 +1,4 @@
1
- import { c as AttributeConfiguration } from './index.js';
1
+ import { b as AttributeConfiguration } from './index.js';
2
2
 
3
3
  /**
4
4
  * Apply mixins to a constructor.
@@ -8,7 +8,7 @@ import { S as StartEnd } from './start-end.js';
8
8
  *
9
9
  * @public
10
10
  */
11
- class BreadcrumbItem extends Anchor {
11
+ let BreadcrumbItem$1 = class BreadcrumbItem extends Anchor {
12
12
  constructor() {
13
13
  super(...arguments);
14
14
  /**
@@ -16,10 +16,10 @@ class BreadcrumbItem extends Anchor {
16
16
  */
17
17
  this.separator = true;
18
18
  }
19
- }
19
+ };
20
20
  __decorate([
21
21
  observable
22
- ], BreadcrumbItem.prototype, "separator", void 0);
23
- applyMixins(BreadcrumbItem, StartEnd, DelegatesARIALink);
22
+ ], BreadcrumbItem$1.prototype, "separator", void 0);
23
+ applyMixins(BreadcrumbItem$1, StartEnd, DelegatesARIALink);
24
24
 
25
- export { BreadcrumbItem as B };
25
+ export { BreadcrumbItem$1 as B };
package/shared/button.js CHANGED
@@ -30,7 +30,7 @@ class FormAssociatedButton extends FormAssociated(_Button) {
30
30
  *
31
31
  * @public
32
32
  */
33
- class Button extends FormAssociatedButton {
33
+ let Button$1 = class Button extends FormAssociatedButton {
34
34
  constructor() {
35
35
  super(...arguments);
36
36
  /**
@@ -153,34 +153,34 @@ class Button extends FormAssociatedButton {
153
153
  });
154
154
  }
155
155
  }
156
- }
156
+ };
157
157
  __decorate([
158
158
  attr({ mode: "boolean" })
159
- ], Button.prototype, "autofocus", void 0);
159
+ ], Button$1.prototype, "autofocus", void 0);
160
160
  __decorate([
161
161
  attr({ attribute: "form" })
162
- ], Button.prototype, "formId", void 0);
162
+ ], Button$1.prototype, "formId", void 0);
163
163
  __decorate([
164
164
  attr
165
- ], Button.prototype, "formaction", void 0);
165
+ ], Button$1.prototype, "formaction", void 0);
166
166
  __decorate([
167
167
  attr
168
- ], Button.prototype, "formenctype", void 0);
168
+ ], Button$1.prototype, "formenctype", void 0);
169
169
  __decorate([
170
170
  attr
171
- ], Button.prototype, "formmethod", void 0);
171
+ ], Button$1.prototype, "formmethod", void 0);
172
172
  __decorate([
173
173
  attr({ mode: "boolean" })
174
- ], Button.prototype, "formnovalidate", void 0);
174
+ ], Button$1.prototype, "formnovalidate", void 0);
175
175
  __decorate([
176
176
  attr
177
- ], Button.prototype, "formtarget", void 0);
177
+ ], Button$1.prototype, "formtarget", void 0);
178
178
  __decorate([
179
179
  attr
180
- ], Button.prototype, "type", void 0);
180
+ ], Button$1.prototype, "type", void 0);
181
181
  __decorate([
182
182
  observable
183
- ], Button.prototype, "defaultSlottedContent", void 0);
183
+ ], Button$1.prototype, "defaultSlottedContent", void 0);
184
184
  /**
185
185
  * Includes ARIA states and properties relating to the ARIA button role
186
186
  *
@@ -195,6 +195,6 @@ __decorate([
195
195
  attr({ attribute: "aria-pressed" })
196
196
  ], DelegatesARIAButton.prototype, "ariaPressed", void 0);
197
197
  applyMixins(DelegatesARIAButton, ARIAGlobalStatesAndProperties);
198
- applyMixins(Button, StartEnd, DelegatesARIAButton);
198
+ applyMixins(Button$1, StartEnd, DelegatesARIAButton);
199
199
 
200
- export { Button as B };
200
+ export { Button$1 as B };
@@ -1,19 +1,39 @@
1
- import { F as FoundationElement, _ as __decorate, a as attr, b as __metadata, n as nullableNumberConverter } from './index.js';
1
+ import { a as attr, F as FoundationElement, n as nullableNumberConverter } from './index.js';
2
2
 
3
- class CalendarEvent extends FoundationElement {}
4
- __decorate([attr, __metadata("design:type", String)], CalendarEvent.prototype, "heading", void 0);
5
- __decorate([attr, __metadata("design:type", String)], CalendarEvent.prototype, "description", void 0);
6
- __decorate([attr, __metadata("design:type", String)], CalendarEvent.prototype, "connotation", void 0);
7
- __decorate([attr, __metadata("design:type", String)], CalendarEvent.prototype, "appearance", void 0);
8
- __decorate([attr({
9
- converter: nullableNumberConverter,
10
- attribute: 'overlap-count'
11
- }), __metadata("design:type", Number)], CalendarEvent.prototype, "overlapCount", void 0);
12
- __decorate([attr({
13
- converter: nullableNumberConverter
14
- }), __metadata("design:type", Number)], CalendarEvent.prototype, "start", void 0);
15
- __decorate([attr({
16
- converter: nullableNumberConverter
17
- }), __metadata("design:type", Number)], CalendarEvent.prototype, "duration", void 0);
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __decorateClass = (decorators, target, key, kind) => {
6
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
7
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
8
+ if (decorator = decorators[i])
9
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
10
+ if (kind && result)
11
+ __defProp(target, key, result);
12
+ return result;
13
+ };
14
+ class CalendarEvent extends FoundationElement {
15
+ // TODO should be converted to allowed range
16
+ }
17
+ __decorateClass([
18
+ attr
19
+ ], CalendarEvent.prototype, "heading", 2);
20
+ __decorateClass([
21
+ attr
22
+ ], CalendarEvent.prototype, "description", 2);
23
+ __decorateClass([
24
+ attr
25
+ ], CalendarEvent.prototype, "connotation", 2);
26
+ __decorateClass([
27
+ attr
28
+ ], CalendarEvent.prototype, "appearance", 2);
29
+ __decorateClass([
30
+ attr({ converter: nullableNumberConverter, attribute: "overlap-count" })
31
+ ], CalendarEvent.prototype, "overlapCount", 2);
32
+ __decorateClass([
33
+ attr({ converter: nullableNumberConverter })
34
+ ], CalendarEvent.prototype, "start", 2);
35
+ __decorateClass([
36
+ attr({ converter: nullableNumberConverter })
37
+ ], CalendarEvent.prototype, "duration", 2);
18
38
 
19
39
  export { CalendarEvent as C };
@@ -1,224 +1,163 @@
1
- import { F as FoundationElement, _ as __decorate, a as attr, o as observable, h as html, r as registerFactory } from './index.js';
2
- import { A as AccordionItem, a as accordionItemRegistries } from './definition2.js';
3
- import { k as keyEnd, a as keyHome, b as keyArrowDown, c as keyArrowUp } from './key-codes.js';
4
- import { w as wrapInBounds } from './numbers.js';
5
- import { e as elements } from './node-observation.js';
6
- import { s as slotted } from './slotted.js';
7
- import { c as classNames } from './class-names.js';
1
+ import { F as FoundationElement, _ as __decorate, a as attr, n as nullableNumberConverter, h as html, r as registerFactory } from './index.js';
2
+ import { a as iconRegistries } from './definition24.js';
3
+ import { f as focusRegistries } from './definition55.js';
4
+ import { b as AffixIconWithTrailing, a as affixIconTemplateFactory } from './affix.js';
5
+ import { a as applyMixins } from './apply-mixins.js';
6
+ import { S as StartEnd } from './start-end.js';
7
+ import { f as focusTemplateFactory } from './focus2.js';
8
+ import { r as ref } from './ref.js';
9
+ import { w as when } from './when.js';
8
10
 
9
11
  /**
10
- * Expand mode for {@link Accordion}
11
- * @public
12
- */
13
- const AccordionExpandMode = {
14
- /**
15
- * Designates only a single {@link @microsoft/fast-foundation#(AccordionItem:class) } can be open a time.
16
- */
17
- single: "single",
18
- /**
19
- * Designates multiple {@link @microsoft/fast-foundation#(AccordionItem:class) | AccordionItems} can be open simultaneously.
20
- */
21
- multi: "multi",
22
- };
23
- /**
24
- * An Accordion Custom HTML Element
25
- * Implements {@link https://www.w3.org/TR/wai-aria-practices-1.1/#accordion | ARIA Accordion}.
12
+ * An individual item in an {@link @microsoft/fast-foundation#(Accordion:class) }.
26
13
  *
27
- * @fires change - Fires a custom 'change' event when the active item changes
28
- * @csspart item - The slot for the accordion items
29
- * @public
14
+ * @slot start - Content which can be provided between the heading and the icon
15
+ * @slot end - Content which can be provided between the start slot and icon
16
+ * @slot heading - Content which serves as the accordion item heading and text of the expand button
17
+ * @slot - The default slot for accordion item content
18
+ * @slot expanded-icon - The expanded icon
19
+ * @slot collapsed-icon - The collapsed icon
20
+ * @fires change - Fires a custom 'change' event when the button is invoked
21
+ * @csspart heading - Wraps the button
22
+ * @csspart button - The button which serves to invoke the item
23
+ * @csspart heading-content - Wraps the slot for the heading content within the button
24
+ * @csspart icon - The icon container
25
+ * @csspart expanded-icon - The expanded icon slot
26
+ * @csspart collapsed-icon - The collapsed icon
27
+ * @csspart region - The wrapper for the accordion item content
30
28
  *
31
- * @remarks
32
- * Designed to be used with {@link @microsoft/fast-foundation#accordionTemplate} and {@link @microsoft/fast-foundation#(AccordionItem:class)}.
29
+ * @public
33
30
  */
34
- class Accordion$1 extends FoundationElement {
31
+ let AccordionItem$1 = class AccordionItem extends FoundationElement {
35
32
  constructor() {
36
33
  super(...arguments);
37
34
  /**
38
- * Controls the expand mode of the Accordion, either allowing
39
- * single or multiple item expansion.
35
+ * Configures the {@link https://www.w3.org/TR/wai-aria-1.1/#aria-level | level} of the
36
+ * heading element.
37
+ *
38
+ * @defaultValue 2
40
39
  * @public
40
+ * @remarks
41
+ * HTML attribute: heading-level
42
+ */
43
+ this.headinglevel = 2;
44
+ /**
45
+ * Expands or collapses the item.
41
46
  *
47
+ * @public
42
48
  * @remarks
43
- * HTML attribute: expand-mode
49
+ * HTML attribute: expanded
44
50
  */
45
- this.expandmode = AccordionExpandMode.multi;
46
- this.activeItemIndex = 0;
47
- this.change = () => {
48
- this.$emit("change", this.activeid);
49
- };
50
- this.setItems = () => {
51
- var _a;
52
- if (this.accordionItems.length === 0) {
53
- return;
54
- }
55
- this.accordionIds = this.getItemIds();
56
- this.accordionItems.forEach((item, index) => {
57
- if (item instanceof AccordionItem) {
58
- item.addEventListener("change", this.activeItemChange);
59
- if (this.isSingleExpandMode()) {
60
- this.activeItemIndex !== index
61
- ? (item.expanded = false)
62
- : (item.expanded = true);
63
- }
64
- }
65
- const itemId = this.accordionIds[index];
66
- item.setAttribute("id", typeof itemId !== "string" ? `accordion-${index + 1}` : itemId);
67
- this.activeid = this.accordionIds[this.activeItemIndex];
68
- item.addEventListener("keydown", this.handleItemKeyDown);
69
- item.addEventListener("focus", this.handleItemFocus);
70
- });
71
- if (this.isSingleExpandMode()) {
72
- const expandedItem = (_a = this.findExpandedItem()) !== null && _a !== void 0 ? _a : this.accordionItems[0];
73
- expandedItem.setAttribute("aria-disabled", "true");
74
- }
75
- };
76
- this.removeItemListeners = (oldValue) => {
77
- oldValue.forEach((item, index) => {
78
- item.removeEventListener("change", this.activeItemChange);
79
- item.removeEventListener("keydown", this.handleItemKeyDown);
80
- item.removeEventListener("focus", this.handleItemFocus);
81
- });
82
- };
83
- this.activeItemChange = (event) => {
84
- if (event.defaultPrevented || event.target !== event.currentTarget) {
85
- return;
86
- }
87
- event.preventDefault();
88
- const selectedItem = event.target;
89
- this.activeid = selectedItem.getAttribute("id");
90
- if (this.isSingleExpandMode()) {
91
- this.resetItems();
92
- selectedItem.expanded = true;
93
- selectedItem.setAttribute("aria-disabled", "true");
94
- this.accordionItems.forEach((item) => {
95
- if (!item.hasAttribute("disabled") && item.id !== this.activeid) {
96
- item.removeAttribute("aria-disabled");
97
- }
98
- });
99
- }
100
- this.activeItemIndex = Array.from(this.accordionItems).indexOf(selectedItem);
51
+ this.expanded = false;
52
+ /**
53
+ * @internal
54
+ */
55
+ this.clickHandler = (e) => {
56
+ this.expanded = !this.expanded;
101
57
  this.change();
102
58
  };
103
- this.handleItemKeyDown = (event) => {
104
- // only handle the keydown if the event target is the accordion item
105
- // prevents arrow keys from moving focus to accordion headers when focus is on accordion item panel content
106
- if (event.target !== event.currentTarget) {
107
- return;
108
- }
109
- this.accordionIds = this.getItemIds();
110
- switch (event.key) {
111
- case keyArrowUp:
112
- event.preventDefault();
113
- this.adjust(-1);
114
- break;
115
- case keyArrowDown:
116
- event.preventDefault();
117
- this.adjust(1);
118
- break;
119
- case keyHome:
120
- this.activeItemIndex = 0;
121
- this.focusItem();
122
- break;
123
- case keyEnd:
124
- this.activeItemIndex = this.accordionItems.length - 1;
125
- this.focusItem();
126
- break;
127
- }
128
- };
129
- this.handleItemFocus = (event) => {
130
- // 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
131
- // only do so if the focus is actually on the accordion item and not on any of its children
132
- if (event.target === event.currentTarget) {
133
- const focusedItem = event.target;
134
- const focusedIndex = (this.activeItemIndex = Array.from(this.accordionItems).indexOf(focusedItem));
135
- if (this.activeItemIndex !== focusedIndex && focusedIndex !== -1) {
136
- this.activeItemIndex = focusedIndex;
137
- this.activeid = this.accordionIds[this.activeItemIndex];
138
- }
139
- }
59
+ this.change = () => {
60
+ this.$emit("change");
140
61
  };
141
62
  }
142
- /**
143
- * @internal
144
- */
145
- accordionItemsChanged(oldValue, newValue) {
146
- if (this.$fastController.isConnected) {
147
- this.removeItemListeners(oldValue);
148
- this.setItems();
149
- }
150
- }
151
- findExpandedItem() {
152
- for (let item = 0; item < this.accordionItems.length; item++) {
153
- if (this.accordionItems[item].getAttribute("expanded") === "true") {
154
- return this.accordionItems[item];
155
- }
156
- }
157
- return null;
158
- }
159
- resetItems() {
160
- this.accordionItems.forEach((item, index) => {
161
- item.expanded = false;
162
- });
163
- }
164
- getItemIds() {
165
- return this.accordionItems.map((accordionItem) => {
166
- return accordionItem.getAttribute("id");
167
- });
168
- }
169
- isSingleExpandMode() {
170
- return this.expandmode === AccordionExpandMode.single;
171
- }
172
- adjust(adjustment) {
173
- this.activeItemIndex = wrapInBounds(0, this.accordionItems.length - 1, this.activeItemIndex + adjustment);
174
- this.focusItem();
175
- }
176
- focusItem() {
177
- const element = this.accordionItems[this.activeItemIndex];
178
- if (element instanceof AccordionItem) {
179
- element.expandbutton.focus();
180
- }
181
- }
182
- }
63
+ };
183
64
  __decorate([
184
- attr({ attribute: "expand-mode" })
185
- ], Accordion$1.prototype, "expandmode", void 0);
65
+ attr({
66
+ attribute: "heading-level",
67
+ mode: "fromView",
68
+ converter: nullableNumberConverter,
69
+ })
70
+ ], AccordionItem$1.prototype, "headinglevel", void 0);
186
71
  __decorate([
187
- observable
188
- ], Accordion$1.prototype, "accordionItems", void 0);
72
+ attr({ mode: "boolean" })
73
+ ], AccordionItem$1.prototype, "expanded", void 0);
74
+ __decorate([
75
+ attr
76
+ ], AccordionItem$1.prototype, "id", void 0);
77
+ applyMixins(AccordionItem$1, StartEnd);
189
78
 
190
- var css_248z = "/**\n * Do not edit directly\n * Generated on Thu, 17 Aug 2023 11:13:18 GMT\n */\n.base {\n display: flex;\n box-sizing: border-box;\n flex-direction: column;\n}\n\n::slotted(:not(:only-of-type)) {\n border-bottom: 1px solid var(--vvd-color-neutral-200);\n}";
79
+ const styles = "/**\n * Do not edit directly\n * Generated on Mon, 04 Sep 2023 12:44:18 GMT\n */\n:host {\n display: flex;\n box-sizing: border-box;\n flex-direction: column;\n}\n\n.heading-container {\n margin: 0;\n}\n\n.heading-button {\n position: relative;\n display: flex;\n width: 100%;\n align-items: center;\n padding: 16px;\n border: none;\n background-color: var(--_appearance-color-fill);\n color: var(--_appearance-color-text);\n cursor: pointer;\n text-align: left;\n}\n.heading-button {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.heading-button:where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)) {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: var(--_connotation-color-faint);\n --_appearance-color-outline: transparent;\n}\n.heading-button:where(:active, .active):where(:not(:disabled, .disabled)) {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: var(--_connotation-color-soft);\n --_appearance-color-outline: transparent;\n}\n.heading-button {\n /* @cssprop [--vvd-accordion-item-accent-primary=var(--vvd-color-canvas-text)] */\n --_connotation-color-primary: var(--vvd-accordion-item-accent-primary, var(--vvd-color-canvas-text));\n /* @cssprop [--vvd-accordion-item-accent-faint=var(--vvd-color-neutral-50)] */\n --_connotation-color-faint: var(--vvd-accordion-item-accent-faint, var(--vvd-color-neutral-50));\n /* @cssprop [--vvd-accordion-item-accent-soft=var(--vvd-color-neutral-100)] */\n --_connotation-color-soft: var(--vvd-accordion-item-accent-soft, var(--vvd-color-neutral-100));\n}\n@supports selector(:focus-visible) {\n .heading-button:focus-visible {\n outline: none;\n }\n}\n.heading-button.size-condensed {\n font: var(--vvd-typography-base-bold);\n gap: 12px;\n}\n.heading-button:not(.size-condensed) {\n font: var(--vvd-typography-heading-4);\n gap: 16px;\n}\n\n.heading-content {\n flex: auto;\n}\n\n.meta {\n overflow: hidden;\n max-width: 20%;\n flex-shrink: 0;\n color: var(--vvd-color-neutral-600);\n text-align: end;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.heading-button:not(.size-condensed) .meta {\n font: var(--vvd-typography-base-bold);\n}\n.heading-button.size-condensed .meta {\n font: var(--vvd-typography-base-condensed-bold);\n}\n\n.region {\n display: none;\n padding: 8px 32px 24px 16px;\n}\n.region:not(.size-condensed).padded {\n padding-inline-start: 52px;\n}\n:host([expanded]) .region {\n display: block;\n}\n.region.size-condensed.padded {\n padding-inline-start: 44px;\n}\n\n.icon {\n color: var(--vvd-color-neutral-600);\n}\n.heading-button:not(.size-condensed) .icon {\n font: inherit;\n}\n.heading-button.size-condensed .icon {\n font: var(--vvd-typography-base-extended);\n}\n:host(:not([icon-trailing])) .icon:last-of-type {\n color: var(--_appearance-color-text);\n}\n\n.focus-indicator {\n --focus-stroke-gap-color: transparent;\n}\nbutton:not(:focus-visible) > .focus-indicator {\n display: none;\n}";
191
80
 
192
- class Accordion extends Accordion$1 {
81
+ var __defProp = Object.defineProperty;
82
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
83
+ var __decorateClass = (decorators, target, key, kind) => {
84
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
85
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
86
+ if (decorator = decorators[i])
87
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
88
+ if (kind && result)
89
+ __defProp(target, key, result);
90
+ return result;
91
+ };
92
+ class AccordionItem extends AccordionItem$1 {
193
93
  constructor() {
194
94
  super(...arguments);
195
- this.expandmode = AccordionExpandMode.single;
196
- }
197
- closeAll() {
198
- if (this.expandmode === AccordionExpandMode.multi) {
199
- this.accordionItems.forEach(item => {
200
- item.expanded = false;
201
- });
202
- }
95
+ this.noIndicator = false;
203
96
  }
204
97
  }
98
+ __decorateClass([
99
+ attr
100
+ ], AccordionItem.prototype, "heading", 2);
101
+ __decorateClass([
102
+ attr({ mode: "boolean", attribute: "no-indicator" })
103
+ ], AccordionItem.prototype, "noIndicator", 2);
104
+ __decorateClass([
105
+ attr
106
+ ], AccordionItem.prototype, "meta", 2);
107
+ __decorateClass([
108
+ attr
109
+ ], AccordionItem.prototype, "size", 2);
110
+ applyMixins(AccordionItem, AffixIconWithTrailing);
111
+
112
+ const header = (context, hTag) => {
113
+ const affixIconTemplate = affixIconTemplateFactory(context);
114
+ const focusTemplate = focusTemplateFactory(context);
115
+ return html`
116
+ <${hTag} class="heading-container">
117
+ <button
118
+ class="heading-button ${(x) => x.size ? `size-${x.size}` : ""}"
119
+ id="${(x) => x.id}"
120
+ aria-expanded="${(x) => x.expanded}"
121
+ aria-controls="${(x) => x.id}-panel"
122
+ @click="${(x, c) => x.clickHandler(c.event)}"
123
+ ${ref("expandbutton")}
124
+ >
125
+ ${() => focusTemplate}
126
+
127
+ ${(x) => x.icon && !x.iconTrailing ? affixIconTemplate(x.icon) : null}
128
+
129
+ <span class="heading-content">${(x) => x.heading}</span>
205
130
 
206
- const getClasses = _ => classNames('base');
207
- const AccordionTemplate = () => html`
208
- <div class="${getClasses}">
209
- <slot ${slotted({
210
- property: 'accordionItems',
211
- filter: elements()
212
- })}></slot>
131
+ ${when((x) => x.meta, html`<span class="meta">${(x) => x.meta}</span>`)}
132
+
133
+ ${(x) => x.icon && x.iconTrailing ? affixIconTemplate(x.icon) : null}
134
+ ${(x) => !(x.icon && x.iconTrailing) && !x.noIndicator ? affixIconTemplate(x.expanded ? "chevron-up-solid" : "chevron-down-solid") : null}
135
+
136
+ </button>
137
+ </${hTag}>
138
+ `;
139
+ };
140
+ const AccordionItemTemplate = (context) => html`
141
+ ${(x) => header(context, "h" + x.headinglevel)}
142
+ <div
143
+ id="${(x) => x.id}-panel"
144
+ aria-labelledby="${(x) => x.id}"
145
+ role="region"
146
+ class="region ${(x) => x.icon && !x.iconTrailing ? "padded" : ""} ${(x) => x.size ? `size-${x.size}` : ""}"
147
+ >
148
+ <slot></slot>
213
149
  </div>
214
150
  `;
215
151
 
216
- const accordionDefinition = Accordion.compose({
217
- baseName: 'accordion',
218
- template: AccordionTemplate,
219
- styles: css_248z
152
+ const accordionItemDefinition = AccordionItem.compose({
153
+ baseName: "accordion-item",
154
+ template: AccordionItemTemplate,
155
+ styles,
156
+ shadowOptions: {
157
+ delegatesFocus: true
158
+ }
220
159
  });
221
- const accordionRegistries = [accordionDefinition(), ...accordionItemRegistries];
222
- const registerAccordion = registerFactory(accordionRegistries);
160
+ const accordionItemRegistries = [accordionItemDefinition(), ...iconRegistries, ...focusRegistries];
161
+ const registerAccordionItem = registerFactory(accordionItemRegistries);
223
162
 
224
- export { accordionDefinition as a, accordionRegistries as b, registerAccordion as r };
163
+ export { AccordionItem$1 as A, accordionItemDefinition as a, accordionItemRegistries as b, registerAccordionItem as r };