@vonage/vivid 3.32.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 (218) 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 +6 -6
  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 +5 -3
  15. package/combobox/index.js +8 -8
  16. package/custom-elements.json +246 -16
  17. package/data-grid/index.js +2 -2
  18. package/date-picker/index.js +9 -9
  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 +5 -5
  25. package/focus/index.js +1 -1
  26. package/header/index.js +2 -2
  27. package/icon/index.js +1 -1
  28. package/index.js +59 -59
  29. package/layout/index.js +1 -1
  30. package/lib/calendar/calendar.d.ts +1 -1
  31. package/lib/date-picker/calendar/dateStr.d.ts +1 -0
  32. package/lib/date-picker/calendar/month.d.ts +1 -0
  33. package/lib/date-picker/calendar/year.d.ts +2 -0
  34. package/lib/date-picker/date-picker.d.ts +2 -0
  35. package/lib/icon/icon.d.ts +0 -1
  36. package/lib/listbox/listbox.d.ts +9 -1
  37. package/lib/text-field/text-field.d.ts +1 -0
  38. package/listbox/index.js +20 -16
  39. package/locales/en-GB.js +48 -14
  40. package/locales/en-US.js +48 -14
  41. package/locales/ja-JP.js +48 -14
  42. package/locales/zh-CN.js +48 -14
  43. package/menu/index.js +8 -8
  44. package/menu-item/index.js +4 -4
  45. package/nav/index.js +1 -1
  46. package/nav-disclosure/index.js +3 -3
  47. package/nav-item/index.js +3 -3
  48. package/note/index.js +2 -3
  49. package/number-field/index.js +6 -6
  50. package/option/index.js +3 -3
  51. package/package.json +2 -16
  52. package/pagination/index.js +5 -5
  53. package/popup/index.js +6 -6
  54. package/progress/index.js +1 -1
  55. package/progress-ring/index.js +1 -1
  56. package/radio/index.js +2 -2
  57. package/radio-group/index.js +1 -1
  58. package/select/index.js +8 -8
  59. package/shared/affix.js +25 -9
  60. package/shared/apply-mixins.js +1 -1
  61. package/shared/breadcrumb-item.js +5 -5
  62. package/shared/button.js +13 -13
  63. package/shared/calendar-event.js +36 -16
  64. package/shared/definition.js +133 -194
  65. package/shared/definition10.js +225 -40
  66. package/shared/definition11.js +36 -32
  67. package/shared/definition12.js +763 -98
  68. package/shared/definition13.js +125 -89
  69. package/shared/definition14.js +207 -27
  70. package/shared/definition15.js +710 -731
  71. package/shared/definition16.js +1289 -47
  72. package/shared/definition17.js +6113 -93
  73. package/shared/definition18.js +242 -164
  74. package/shared/definition19.js +47 -692
  75. package/shared/definition2.js +199 -117
  76. package/shared/definition20.js +59 -1671
  77. package/shared/definition21.js +95 -255
  78. package/shared/definition22.js +2218 -1167
  79. package/shared/definition23.js +61 -5784
  80. package/shared/definition24.js +28 -117
  81. package/shared/definition25.js +52 -66
  82. package/shared/definition26.js +391 -214
  83. package/shared/definition27.js +441 -34
  84. package/shared/definition28.js +85 -73
  85. package/shared/definition29.js +21 -2283
  86. package/shared/definition3.js +61 -24
  87. package/shared/definition30.js +13 -49
  88. package/shared/definition31.js +54 -39
  89. package/shared/definition32.js +413 -375
  90. package/shared/definition33.js +223 -304
  91. package/shared/definition34.js +197 -13
  92. package/shared/definition35.js +88 -73
  93. package/shared/definition36.js +75 -25
  94. package/shared/definition37.js +434 -34
  95. package/shared/definition38.js +32 -432
  96. package/shared/definition39.js +677 -187
  97. package/shared/definition4.js +157 -12
  98. package/shared/definition40.js +95 -48
  99. package/shared/definition41.js +577 -31
  100. package/shared/definition42.js +126 -424
  101. package/shared/definition43.js +114 -618
  102. package/shared/definition44.js +24 -80
  103. package/shared/definition45.js +71 -543
  104. package/shared/definition46.js +499 -92
  105. package/shared/definition47.js +19 -133
  106. package/shared/definition48.js +129 -52
  107. package/shared/definition49.js +281 -17
  108. package/shared/definition5.js +71 -36
  109. package/shared/definition50.js +153 -484
  110. package/shared/definition51.js +131 -98
  111. package/shared/definition52.js +131 -16
  112. package/shared/definition53.js +80 -264
  113. package/shared/definition54.js +293 -118
  114. package/shared/definition55.js +12 -117
  115. package/shared/definition56.js +39 -68
  116. package/shared/definition57.js +166 -288
  117. package/shared/definition6.js +56 -111
  118. package/shared/definition7.js +120 -195
  119. package/shared/definition8.js +58 -23
  120. package/shared/definition9.js +92 -66
  121. package/shared/focus.js +2 -1
  122. package/shared/focus2.js +1 -1
  123. package/shared/form-associated.js +2 -2
  124. package/shared/icon.js +48 -27
  125. package/shared/index.js +7 -27
  126. package/shared/index2.js +108 -80
  127. package/shared/key-codes.js +1 -1
  128. package/shared/listbox.js +88 -11
  129. package/shared/patterns/form-elements/form-elements.d.ts +4 -4
  130. package/shared/radio.js +23 -7
  131. package/shared/repeat.js +1 -1
  132. package/shared/text-anchor.js +21 -4
  133. package/shared/text-anchor.template.js +37 -40
  134. package/shared/text-field.js +2 -2
  135. package/shared/text-field2.js +15 -15
  136. package/shared/tree-item.js +12 -12
  137. package/side-drawer/index.js +1 -1
  138. package/slider/index.js +2 -2
  139. package/split-button/index.js +3 -3
  140. package/style.css +6097 -0
  141. package/styles/core/all.css +1 -1
  142. package/styles/core/theme.css +1 -1
  143. package/styles/core/typography.css +1 -1
  144. package/styles/tokens/theme-dark.css +4 -4
  145. package/styles/tokens/theme-light.css +4 -4
  146. package/styles/tokens/vivid-2-compat.css +1 -1
  147. package/switch/index.js +3 -3
  148. package/tab/index.js +3 -3
  149. package/tab-panel/index.js +1 -1
  150. package/tabs/index.js +5 -5
  151. package/tag/index.js +3 -3
  152. package/tag-group/index.js +1 -1
  153. package/text-anchor/index.js +1 -1
  154. package/text-area/index.js +3 -3
  155. package/text-field/index.js +3 -3
  156. package/toggletip/index.js +7 -7
  157. package/tooltip/index.js +7 -7
  158. package/tree-item/index.js +3 -3
  159. package/tree-view/index.js +1 -1
  160. package/lib/accordion/index.d.ts +0 -1
  161. package/lib/accordion-item/index.d.ts +0 -1
  162. package/lib/action-group/index.d.ts +0 -1
  163. package/lib/alert/index.d.ts +0 -1
  164. package/lib/avatar/index.d.ts +0 -1
  165. package/lib/badge/index.d.ts +0 -1
  166. package/lib/banner/index.d.ts +0 -1
  167. package/lib/breadcrumb/index.d.ts +0 -1
  168. package/lib/breadcrumb-item/index.d.ts +0 -1
  169. package/lib/button/index.d.ts +0 -1
  170. package/lib/calendar/index.d.ts +0 -1
  171. package/lib/calendar-event/index.d.ts +0 -1
  172. package/lib/card/index.d.ts +0 -1
  173. package/lib/checkbox/index.d.ts +0 -1
  174. package/lib/combobox/index.d.ts +0 -1
  175. package/lib/data-grid/index.d.ts +0 -1
  176. package/lib/date-picker/index.d.ts +0 -1
  177. package/lib/dialog/index.d.ts +0 -1
  178. package/lib/divider/index.d.ts +0 -1
  179. package/lib/elevation/index.d.ts +0 -1
  180. package/lib/empty-state/index.d.ts +0 -1
  181. package/lib/fab/index.d.ts +0 -1
  182. package/lib/file-picker/index.d.ts +0 -1
  183. package/lib/focus/index.d.ts +0 -1
  184. package/lib/header/index.d.ts +0 -1
  185. package/lib/icon/index.d.ts +0 -1
  186. package/lib/layout/index.d.ts +0 -1
  187. package/lib/listbox/index.d.ts +0 -1
  188. package/lib/menu/index.d.ts +0 -1
  189. package/lib/menu-item/index.d.ts +0 -1
  190. package/lib/nav/index.d.ts +0 -1
  191. package/lib/nav-disclosure/index.d.ts +0 -1
  192. package/lib/nav-item/index.d.ts +0 -1
  193. package/lib/note/index.d.ts +0 -1
  194. package/lib/number-field/index.d.ts +0 -1
  195. package/lib/option/index.d.ts +0 -1
  196. package/lib/pagination/index.d.ts +0 -1
  197. package/lib/popup/index.d.ts +0 -1
  198. package/lib/progress/index.d.ts +0 -1
  199. package/lib/progress-ring/index.d.ts +0 -1
  200. package/lib/radio/index.d.ts +0 -1
  201. package/lib/radio-group/index.d.ts +0 -1
  202. package/lib/select/index.d.ts +0 -1
  203. package/lib/side-drawer/index.d.ts +0 -1
  204. package/lib/slider/index.d.ts +0 -1
  205. package/lib/split-button/index.d.ts +0 -1
  206. package/lib/switch/index.d.ts +0 -1
  207. package/lib/tab/index.d.ts +0 -1
  208. package/lib/tab-panel/index.d.ts +0 -1
  209. package/lib/tabs/index.d.ts +0 -1
  210. package/lib/tag/index.d.ts +0 -1
  211. package/lib/tag-group/index.d.ts +0 -1
  212. package/lib/text-anchor/index.d.ts +0 -1
  213. package/lib/text-area/index.d.ts +0 -1
  214. package/lib/text-field/index.d.ts +0 -1
  215. package/lib/toggletip/index.d.ts +0 -1
  216. package/lib/tooltip/index.d.ts +0 -1
  217. package/lib/tree-item/index.d.ts +0 -1
  218. package/lib/tree-view/index.d.ts +0 -1
@@ -1,372 +1,291 @@
1
- import { F as FoundationElement, D as DOM, _ as __decorate, a as attr, o as observable, b as __metadata, h as html, r as registerFactory } from './index.js';
2
- import { i as iconRegistries } from './definition3.js';
3
- import { f as focusRegistries } from './definition4.js';
4
- import { b as AffixIcon, a as affixIconTemplateFactory } from './affix.js';
1
+ import { F as FoundationElement, O as Observable, _ as __decorate, o as observable, a as attr, 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 ARIAGlobalStatesAndProperties } from './aria-global.js';
5
6
  import { S as StartEnd } from './start-end.js';
6
- import { D as Direction, g as getDirection } from './direction.js';
7
7
  import { a as applyMixins } from './apply-mixins.js';
8
- import { i as keyArrowLeft, h as keyArrowRight, e as keySpace, d as keyEnter } from './key-codes.js';
8
+ import { i as isHTMLElement } from './dom.js';
9
9
  import { f as focusTemplateFactory } from './focus2.js';
10
+ import './index2.js';
10
11
  import { w as when } from './when.js';
11
- import { s as slotted } from './slotted.js';
12
12
  import { c as classNames } from './class-names.js';
13
13
 
14
14
  /**
15
- * Menu items roles.
15
+ * Determines if the element is a {@link (ListboxOption:class)}
16
+ *
17
+ * @param element - the element to test.
16
18
  * @public
17
19
  */
18
- const MenuItemRole$1 = {
19
- /**
20
- * The menu item has a "menuitem" role
21
- */
22
- menuitem: "menuitem",
23
- /**
24
- * The menu item has a "menuitemcheckbox" role
25
- */
26
- menuitemcheckbox: "menuitemcheckbox",
27
- /**
28
- * The menu item has a "menuitemradio" role
29
- */
30
- menuitemradio: "menuitemradio",
31
- };
32
- /**
33
- * @internal
34
- */
35
- const roleForMenuItem = {
36
- [MenuItemRole$1.menuitem]: "menuitem",
37
- [MenuItemRole$1.menuitemcheckbox]: "menuitemcheckbox",
38
- [MenuItemRole$1.menuitemradio]: "menuitemradio",
39
- };
40
-
20
+ function isListboxOption(el) {
21
+ return (isHTMLElement(el) &&
22
+ (el.getAttribute("role") === "option" ||
23
+ el instanceof HTMLOptionElement));
24
+ }
41
25
  /**
42
- * A Switch Custom HTML Element.
43
- * Implements {@link https://www.w3.org/TR/wai-aria-1.1/#menuitem | ARIA menuitem }, {@link https://www.w3.org/TR/wai-aria-1.1/#menuitemcheckbox | ARIA menuitemcheckbox}, or {@link https://www.w3.org/TR/wai-aria-1.1/#menuitemradio | ARIA menuitemradio }.
26
+ * An Option Custom HTML Element.
27
+ * Implements {@link https://www.w3.org/TR/wai-aria-1.1/#option | ARIA option }.
44
28
  *
45
- * @slot checked-indicator - The checked indicator
46
- * @slot radio-indicator - The radio indicator
47
- * @slot start - Content which can be provided before the menu item content
48
- * @slot end - Content which can be provided after the menu item content
49
- * @slot - The default slot for menu item content
50
- * @slot expand-collapse-indicator - The expand/collapse indicator
51
- * @slot submenu - Used to nest menu's within menu items
52
- * @csspart input-container - The element representing the visual checked or radio indicator
53
- * @csspart checkbox - The element wrapping the `menuitemcheckbox` indicator
54
- * @csspart radio - The element wrapping the `menuitemradio` indicator
55
- * @csspart content - The element wrapping the menu item content
56
- * @csspart expand-collapse-glyph-container - The element wrapping the expand collapse element
57
- * @csspart expand-collapse - The expand/collapse element
58
- * @csspart submenu-region - The container for the submenu, used for positioning
59
- * @fires expanded-change - Fires a custom 'expanded-change' event when the expanded state changes
60
- * @fires change - Fires a custom 'change' event when a non-submenu item with a role of `menuitemcheckbox`, `menuitemradio`, or `menuitem` is invoked
29
+ * @slot start - Content which can be provided before the listbox option content
30
+ * @slot end - Content which can be provided after the listbox option content
31
+ * @slot - The default slot for listbox option content
32
+ * @csspart content - Wraps the listbox option content
61
33
  *
62
34
  * @public
63
35
  */
64
- class MenuItem$1 extends FoundationElement {
65
- constructor() {
66
- super(...arguments);
36
+ let ListboxOption$1 = class ListboxOption extends FoundationElement {
37
+ constructor(text, value, defaultSelected, selected) {
38
+ super();
67
39
  /**
68
- * The role of the element.
69
- *
40
+ * The defaultSelected state of the option.
70
41
  * @public
71
- * @remarks
72
- * HTML Attribute: role
73
42
  */
74
- this.role = MenuItemRole$1.menuitem;
43
+ this.defaultSelected = false;
75
44
  /**
45
+ * Tracks whether the "selected" property has been changed.
76
46
  * @internal
77
47
  */
78
- this.hasSubmenu = false;
48
+ this.dirtySelected = false;
79
49
  /**
80
- * Track current direction to pass to the anchored region
50
+ * The checked state of the control.
81
51
  *
82
- * @internal
83
- */
84
- this.currentDirection = Direction.ltr;
85
- this.focusSubmenuOnLoad = false;
86
- /**
87
- * @internal
88
- */
89
- this.handleMenuItemKeyDown = (e) => {
90
- if (e.defaultPrevented) {
91
- return false;
92
- }
93
- switch (e.key) {
94
- case keyEnter:
95
- case keySpace:
96
- this.invoke();
97
- return false;
98
- case keyArrowRight:
99
- //open/focus on submenu
100
- this.expandAndFocus();
101
- return false;
102
- case keyArrowLeft:
103
- //close submenu
104
- if (this.expanded) {
105
- this.expanded = false;
106
- this.focus();
107
- return false;
108
- }
109
- }
110
- return true;
111
- };
112
- /**
113
- * @internal
114
- */
115
- this.handleMenuItemClick = (e) => {
116
- if (e.defaultPrevented || this.disabled) {
117
- return false;
118
- }
119
- this.invoke();
120
- return false;
121
- };
122
- /**
123
- * @internal
124
- */
125
- this.submenuLoaded = () => {
126
- if (!this.focusSubmenuOnLoad) {
127
- return;
128
- }
129
- this.focusSubmenuOnLoad = false;
130
- if (this.hasSubmenu) {
131
- this.submenu.focus();
132
- this.setAttribute("tabindex", "-1");
133
- }
134
- };
135
- /**
136
- * @internal
137
- */
138
- this.handleMouseOver = (e) => {
139
- if (this.disabled || !this.hasSubmenu || this.expanded) {
140
- return false;
141
- }
142
- this.expanded = true;
143
- return false;
144
- };
145
- /**
146
- * @internal
147
- */
148
- this.handleMouseOut = (e) => {
149
- if (!this.expanded || this.contains(document.activeElement)) {
150
- return false;
151
- }
152
- this.expanded = false;
153
- return false;
154
- };
155
- /**
156
- * @internal
157
- */
158
- this.expandAndFocus = () => {
159
- if (!this.hasSubmenu) {
160
- return;
161
- }
162
- this.focusSubmenuOnLoad = true;
163
- this.expanded = true;
164
- };
165
- /**
166
- * @internal
52
+ * @public
167
53
  */
168
- this.invoke = () => {
169
- if (this.disabled) {
170
- return;
171
- }
172
- switch (this.role) {
173
- case MenuItemRole$1.menuitemcheckbox:
174
- this.checked = !this.checked;
175
- break;
176
- case MenuItemRole$1.menuitem:
177
- // update submenu
178
- this.updateSubmenu();
179
- if (this.hasSubmenu) {
180
- this.expandAndFocus();
181
- }
182
- else {
183
- this.$emit("change");
184
- }
185
- break;
186
- case MenuItemRole$1.menuitemradio:
187
- if (!this.checked) {
188
- this.checked = true;
189
- }
190
- break;
191
- }
192
- };
54
+ this.selected = this.defaultSelected;
193
55
  /**
194
- * Gets the submenu element if any
195
- *
196
- * @internal
56
+ * Track whether the value has been changed from the initial value
197
57
  */
198
- this.updateSubmenu = () => {
199
- this.submenu = this.domChildren().find((element) => {
200
- return element.getAttribute("role") === "menu";
201
- });
202
- this.hasSubmenu = this.submenu === undefined ? false : true;
203
- };
204
- }
205
- expandedChanged(oldValue) {
206
- if (this.$fastController.isConnected) {
207
- if (this.submenu === undefined) {
208
- return;
209
- }
210
- if (this.expanded === false) {
211
- this.submenu.collapseExpandedItem();
212
- }
213
- else {
214
- this.currentDirection = getDirection(this);
215
- }
216
- this.$emit("expanded-change", this, { bubbles: false });
58
+ this.dirtyValue = false;
59
+ if (text) {
60
+ this.textContent = text;
217
61
  }
218
- }
219
- checkedChanged(oldValue, newValue) {
220
- if (this.$fastController.isConnected) {
221
- this.$emit("change");
62
+ if (value) {
63
+ this.initialValue = value;
222
64
  }
65
+ if (defaultSelected) {
66
+ this.defaultSelected = defaultSelected;
67
+ }
68
+ if (selected) {
69
+ this.selected = selected;
70
+ }
71
+ this.proxy = new Option(`${this.textContent}`, this.initialValue, this.defaultSelected, this.selected);
72
+ this.proxy.disabled = this.disabled;
223
73
  }
224
74
  /**
225
- * @internal
75
+ * Updates the ariaChecked property when the checked property changes.
76
+ *
77
+ * @param prev - the previous checked value
78
+ * @param next - the current checked value
79
+ *
80
+ * @public
226
81
  */
227
- connectedCallback() {
228
- super.connectedCallback();
229
- DOM.queueUpdate(() => {
230
- this.updateSubmenu();
231
- });
232
- if (!this.startColumnCount) {
233
- this.startColumnCount = 1;
82
+ checkedChanged(prev, next) {
83
+ if (typeof next === "boolean") {
84
+ this.ariaChecked = next ? "true" : "false";
85
+ return;
234
86
  }
235
- this.observer = new MutationObserver(this.updateSubmenu);
87
+ this.ariaChecked = null;
236
88
  }
237
89
  /**
90
+ * Updates the proxy's text content when the default slot changes.
91
+ * @param prev - the previous content value
92
+ * @param next - the current content value
93
+ *
238
94
  * @internal
239
95
  */
240
- disconnectedCallback() {
241
- super.disconnectedCallback();
242
- this.submenu = undefined;
243
- if (this.observer !== undefined) {
244
- this.observer.disconnect();
245
- this.observer = undefined;
96
+ contentChanged(prev, next) {
97
+ if (this.proxy instanceof HTMLOptionElement) {
98
+ this.proxy.textContent = this.textContent;
246
99
  }
100
+ this.$emit("contentchange", null, { bubbles: true });
247
101
  }
248
- /**
249
- * get an array of valid DOM children
250
- */
251
- domChildren() {
252
- return Array.from(this.children).filter(child => !child.hasAttribute("hidden"));
102
+ defaultSelectedChanged() {
103
+ if (!this.dirtySelected) {
104
+ this.selected = this.defaultSelected;
105
+ if (this.proxy instanceof HTMLOptionElement) {
106
+ this.proxy.selected = this.defaultSelected;
107
+ }
108
+ }
253
109
  }
254
- }
255
- __decorate([
256
- attr({ mode: "boolean" })
257
- ], MenuItem$1.prototype, "disabled", void 0);
110
+ disabledChanged(prev, next) {
111
+ this.ariaDisabled = this.disabled ? "true" : "false";
112
+ if (this.proxy instanceof HTMLOptionElement) {
113
+ this.proxy.disabled = this.disabled;
114
+ }
115
+ }
116
+ selectedAttributeChanged() {
117
+ this.defaultSelected = this.selectedAttribute;
118
+ if (this.proxy instanceof HTMLOptionElement) {
119
+ this.proxy.defaultSelected = this.defaultSelected;
120
+ }
121
+ }
122
+ selectedChanged() {
123
+ this.ariaSelected = this.selected ? "true" : "false";
124
+ if (!this.dirtySelected) {
125
+ this.dirtySelected = true;
126
+ }
127
+ if (this.proxy instanceof HTMLOptionElement) {
128
+ this.proxy.selected = this.selected;
129
+ }
130
+ }
131
+ initialValueChanged(previous, next) {
132
+ // If the value is clean and the component is connected to the DOM
133
+ // then set value equal to the attribute value.
134
+ if (!this.dirtyValue) {
135
+ this.value = this.initialValue;
136
+ this.dirtyValue = false;
137
+ }
138
+ }
139
+ get label() {
140
+ var _a;
141
+ return (_a = this.value) !== null && _a !== void 0 ? _a : this.text;
142
+ }
143
+ get text() {
144
+ var _a, _b;
145
+ return (_b = (_a = this.textContent) === null || _a === void 0 ? void 0 : _a.replace(/\s+/g, " ").trim()) !== null && _b !== void 0 ? _b : "";
146
+ }
147
+ set value(next) {
148
+ const newValue = `${next !== null && next !== void 0 ? next : ""}`;
149
+ this._value = newValue;
150
+ this.dirtyValue = true;
151
+ if (this.proxy instanceof HTMLOptionElement) {
152
+ this.proxy.value = newValue;
153
+ }
154
+ Observable.notify(this, "value");
155
+ }
156
+ get value() {
157
+ var _a;
158
+ Observable.track(this, "value");
159
+ return (_a = this._value) !== null && _a !== void 0 ? _a : this.text;
160
+ }
161
+ get form() {
162
+ return this.proxy ? this.proxy.form : null;
163
+ }
164
+ };
258
165
  __decorate([
259
- attr({ mode: "boolean" })
260
- ], MenuItem$1.prototype, "expanded", void 0);
166
+ observable
167
+ ], ListboxOption$1.prototype, "checked", void 0);
261
168
  __decorate([
262
169
  observable
263
- ], MenuItem$1.prototype, "startColumnCount", void 0);
170
+ ], ListboxOption$1.prototype, "content", void 0);
264
171
  __decorate([
265
- attr
266
- ], MenuItem$1.prototype, "role", void 0);
172
+ observable
173
+ ], ListboxOption$1.prototype, "defaultSelected", void 0);
267
174
  __decorate([
268
175
  attr({ mode: "boolean" })
269
- ], MenuItem$1.prototype, "checked", void 0);
176
+ ], ListboxOption$1.prototype, "disabled", void 0);
177
+ __decorate([
178
+ attr({ attribute: "selected", mode: "boolean" })
179
+ ], ListboxOption$1.prototype, "selectedAttribute", void 0);
180
+ __decorate([
181
+ observable
182
+ ], ListboxOption$1.prototype, "selected", void 0);
183
+ __decorate([
184
+ attr({ attribute: "value", mode: "fromView" })
185
+ ], ListboxOption$1.prototype, "initialValue", void 0);
186
+ /**
187
+ * States and properties relating to the ARIA `option` role.
188
+ *
189
+ * @public
190
+ */
191
+ class DelegatesARIAListboxOption {
192
+ }
270
193
  __decorate([
271
194
  observable
272
- ], MenuItem$1.prototype, "submenuRegion", void 0);
195
+ ], DelegatesARIAListboxOption.prototype, "ariaChecked", void 0);
273
196
  __decorate([
274
197
  observable
275
- ], MenuItem$1.prototype, "hasSubmenu", void 0);
198
+ ], DelegatesARIAListboxOption.prototype, "ariaPosInSet", void 0);
276
199
  __decorate([
277
200
  observable
278
- ], MenuItem$1.prototype, "currentDirection", void 0);
201
+ ], DelegatesARIAListboxOption.prototype, "ariaSelected", void 0);
279
202
  __decorate([
280
203
  observable
281
- ], MenuItem$1.prototype, "submenu", void 0);
282
- applyMixins(MenuItem$1, StartEnd);
283
-
284
- var css_248z = "/**\n * Do not edit directly\n * Generated on Tue, 22 Aug 2023 13:37:39 GMT\n */\n@supports selector(:focus-visible) {\n :host(:focus-visible) {\n outline: none;\n }\n}\n.base {\n position: relative;\n display: flex;\n box-sizing: border-box;\n align-items: center;\n background-color: var(--_appearance-color-fill);\n box-shadow: inset 0 0 0 1px var(--_appearance-color-outline);\n gap: 12px;\n inline-size: 100%;\n padding-block: 2px;\n padding-inline: 16px;\n}\n.base {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.base: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.base:where(:disabled, .disabled) {\n --_appearance-color-text: var(--vvd-color-neutral-300);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.base: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.base:where(.selected, [aria-current]):where(:not(:disabled, .disabled, :hover, .hover)) {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: var(--_connotation-color-dim);\n --_appearance-color-outline: transparent;\n}\n.base:where(.selected, [aria-current]):where(:hover, .hover) {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: var(--_connotation-color-pale);\n --_appearance-color-outline: transparent;\n}\n.base {\n /* @cssprop [--vvd-menu-item-accent-primary=var(--vvd-color-canvas-text)] */\n --_connotation-color-primary: var(--vvd-menu-item-accent-primary, var(--vvd-color-canvas-text));\n /* @cssprop [--vvd-menu-item-accent-primary-text=var(--vvd-color-canvas)] */\n --_connotation-color-primary-text: var(--vvd-menu-item-accent-primary-text, var(--vvd-color-canvas));\n /* @cssprop [--vvd-menu-item-accent-primary-increment=var(--vvd-color-neutral-800)] */\n --_connotation-color-primary-increment: var(--vvd-menu-item-accent-primary-increment, var(--vvd-color-neutral-800));\n /* @cssprop [--vvd-menu-item-accent-faint=var(--vvd-color-neutral-50)] */\n --_connotation-color-faint: var(--vvd-menu-item-accent-faint, var(--vvd-color-neutral-50));\n /* @cssprop [--vvd-menu-item-accent-soft=var(--vvd-color-neutral-100)] */\n --_connotation-color-soft: var(--vvd-menu-item-accent-soft, var(--vvd-color-neutral-100));\n /* @cssprop [--vvd-menu-item-accent-pale=var(--vvd-color-neutral-300)] */\n --_connotation-color-pale: var(--vvd-menu-item-accent-pale, var(--vvd-color-neutral-300));\n /* @cssprop [--vvd-menu-item-accent-dim=var(--vvd-color-neutral-200)] */\n --_connotation-color-dim: var(--vvd-menu-item-accent-dim, var(--vvd-color-neutral-200));\n}\n.base:not(.two-lines) {\n min-block-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2)));\n}\n.base.two-lines {\n min-block-size: calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2))) + calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 16)));\n}\n@supports (user-select: none) {\n .base {\n user-select: none;\n }\n}\n.base:not(.disabled) {\n cursor: pointer;\n}\n.base.disabled {\n cursor: not-allowed;\n pointer-events: none;\n}\n\n.focus-indicator {\n border-radius: 6px;\n}\n:host(:not(:focus-visible)) .focus-indicator {\n display: none;\n}\n\n.icon {\n flex-shrink: 0;\n font-size: calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2))) / 2);\n line-height: 1;\n}\n\n.action,\n.decorative {\n display: flex;\n place-content: center;\n}\n\n.action {\n color: var(--_appearance-color-text);\n}\n.base.trailing .action {\n order: 1;\n margin-inline-start: auto;\n}\n.base.has-meta .action {\n order: 1;\n margin-inline-start: auto;\n}\n\n.base:not(.disabled) .decorative {\n color: var(--vvd-color-neutral-600);\n}\n.base.disabled .decorative {\n color: var(--vvd-color-neutral-200);\n}\n.base.has-meta .decorative {\n order: 1;\n margin-inline-start: auto;\n}\n\n.text {\n display: flex;\n overflow: hidden;\n flex-direction: column;\n}\n\n.text-primary,\n.text-secondary {\n /* stylelint-disable value-no-vendor-prefix */\n display: -webkit-box;\n /* stylelint-enable value-no-vendor-prefix */\n overflow: hidden;\n -webkit-box-orient: vertical;\n color: var(--_appearance-color-text);\n font: var(--vvd-typography-base);\n}\n\n.text-primary {\n -webkit-line-clamp: var(--text-primary-line-clamp, 1);\n}\n.base.two-lines .text-primary {\n font: var(--vvd-typography-base-bold);\n}\n\n.text-secondary {\n -webkit-line-clamp: var(--text-secondary-line-clamp, 1);\n}\n.base.two-lines .text-secondary {\n color: var(--vvd-color-neutral-600);\n}";
285
-
286
- const MenuItemRole = Object.assign(Object.assign({}, MenuItemRole$1), {
287
- presentation: 'presentation'
288
- });
289
- class MenuItem extends MenuItem$1 {}
290
- __decorate([attr, __metadata("design:type", String)], MenuItem.prototype, "text", void 0);
291
- __decorate([attr({
292
- attribute: 'text-secondary'
293
- }), __metadata("design:type", String)], MenuItem.prototype, "textSecondary", void 0);
294
- __decorate([observable, __metadata("design:type", Array)], MenuItem.prototype, "metaSlottedContent", void 0);
295
- applyMixins(MenuItem, AffixIcon);
204
+ ], DelegatesARIAListboxOption.prototype, "ariaSetSize", void 0);
205
+ applyMixins(DelegatesARIAListboxOption, ARIAGlobalStatesAndProperties);
206
+ applyMixins(ListboxOption$1, StartEnd, DelegatesARIAListboxOption);
296
207
 
297
- const getCheckIcon = (affixIconTemplate, x, iconType) => {
298
- const iconStatus = x.checked ? 'checked' : 'unchecked';
299
- const icon = `${iconType}-${iconStatus}-line`;
300
- return affixIconTemplate(icon);
208
+ var __defProp = Object.defineProperty;
209
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
210
+ var __decorateClass = (decorators, target, key, kind) => {
211
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
212
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
213
+ if (decorator = decorators[i])
214
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
215
+ if (kind && result)
216
+ __defProp(target, key, result);
217
+ return result;
301
218
  };
219
+ class ListboxOption extends ListboxOption$1 {
220
+ // #region overrides base class accessor
221
+ set text(value) {
222
+ this._text = value;
223
+ }
224
+ get text() {
225
+ return this._text ?? "";
226
+ }
227
+ get label() {
228
+ return this._label ?? this.text;
229
+ }
230
+ set label(value) {
231
+ this._label = value;
232
+ }
233
+ // #endregion overrides
234
+ }
235
+ __decorateClass([
236
+ attr({
237
+ attribute: "text"
238
+ })
239
+ ], ListboxOption.prototype, "_text", 2);
240
+ __decorateClass([
241
+ attr({
242
+ attribute: "label"
243
+ })
244
+ ], ListboxOption.prototype, "_label", 2);
245
+ applyMixins(ListboxOption, AffixIconWithTrailing);
246
+
302
247
  const getClasses = ({
303
- disabled,
304
- checked,
305
- expanded,
306
- role,
307
- text,
308
- textSecondary,
309
248
  icon,
310
- metaSlottedContent
311
- }) => classNames('base', ['disabled', Boolean(disabled)], ['selected', role !== MenuItemRole.menuitem && Boolean(checked)], ['trailing', role !== MenuItemRole.menuitem && Boolean(icon)], ['expanded', Boolean(expanded)], ['item-checkbox', role === MenuItemRole.menuitemcheckbox], ['item-radio', role === MenuItemRole.menuitemradio], ['two-lines', Boolean(text === null || text === void 0 ? void 0 : text.length) && Boolean(textSecondary === null || textSecondary === void 0 ? void 0 : textSecondary.length)], ['has-meta', Boolean(metaSlottedContent === null || metaSlottedContent === void 0 ? void 0 : metaSlottedContent.length)]);
312
- function handleClick(x, {
313
- event
314
- }) {
315
- x.handleMenuItemClick(event);
316
- return x.role === MenuItemRole.presentation;
317
- }
318
- const MenuItemTemplate = (context, definition) => {
319
- const affixIconTemplate = affixIconTemplateFactory(context);
249
+ disabled,
250
+ selected,
251
+ checked
252
+ }) => classNames(
253
+ "base",
254
+ ["disabled", disabled],
255
+ ["selected", Boolean(selected)],
256
+ ["active", Boolean(checked)],
257
+ ["icon", Boolean(icon)]
258
+ );
259
+ const ListboxOptionTemplate = (context) => {
260
+ const affixIconTemplate = affixIconTemplateFactory(context, false);
320
261
  const focusTemplate = focusTemplateFactory(context);
321
262
  return html`
322
263
  <template
323
- aria-checked="${x => x.role !== MenuItemRole.menuitem ? x.checked : void 0}"
324
- aria-disabled="${x => x.disabled}"
325
- aria-expanded="${x => x.expanded}"
326
- @keydown="${(x, c) => x.handleMenuItemKeyDown(c.event)}"
327
- @click="${handleClick}"
328
- @mouseover="${(x, c) => x.handleMouseOver(c.event)}"
329
- @mouseout="${(x, c) => x.handleMouseOut(c.event)}"
330
- >
264
+ aria-checked="${(x) => x.ariaChecked}"
265
+ aria-disabled="${(x) => x.ariaDisabled}"
266
+ aria-posinset="${(x) => x.ariaPosInSet}"
267
+ aria-selected="${(x) => x.ariaSelected}"
268
+ aria-setsize="${(x) => x.ariaSetSize}"
269
+ role="option">
331
270
  <div class="${getClasses}">
332
-
333
- ${when(x => x.hasSubmenu, html`
334
- <div
335
- class="expand-collapse-glyph-container"
336
- >
337
- <span class="expand-collapse">
338
- <slot name="expand-collapse-indicator">
339
- ${definition.expandCollapseGlyph || ''}
340
- </slot>
341
- </span>
342
- </div>
343
- `)}
344
271
  ${() => focusTemplate}
345
- <slot name="meta" ${slotted('metaSlottedContent')}></slot>
346
- ${when(x => x.role === MenuItemRole.menuitemcheckbox, html`<span class="action">${x => getCheckIcon(affixIconTemplate, x, 'checkbox')}</span>`)}
347
-
348
- ${when(x => x.role === MenuItemRole.menuitemradio, html`<span class="action">${x => getCheckIcon(affixIconTemplate, x, 'radio')}</span>`)}
349
-
350
- ${when(x => x.icon, html`<span class="decorative">${x => affixIconTemplate(x.icon)}</span>`)}
351
-
352
- ${when(x => x.text || x.textSecondary, html`<span class="text">
353
- ${when(x => x.text, html`<span class="text-primary">${x => x.text}</span>`)}
354
- ${when(x => x.textSecondary, html`<span class="text-secondary">${x => x.textSecondary}</span>`)}
355
- </span>`)}
356
-
357
-
358
-
272
+ <slot name="icon">
273
+ ${when((x) => x.icon, html`${(x) => affixIconTemplate(x.icon)}`)}
274
+ </slot>
275
+ ${when((x) => x.text, html`<div class="text">${(x) => x.text}</div>`)}
359
276
  </div>
360
277
  </template>
361
278
  `;
362
279
  };
363
280
 
364
- const menuItemDefinition = MenuItem.compose({
365
- baseName: 'menu-item',
366
- template: MenuItemTemplate,
367
- styles: css_248z
281
+ const styles = "/**\n * Do not edit directly\n * Generated on Mon, 04 Sep 2023 12:44:18 GMT\n */\n.base {\n position: relative; /* this is needed for the focus */\n display: flex;\n box-sizing: border-box;\n align-items: center;\n background-color: var(--_appearance-color-fill);\n border-radius: 6px;\n box-shadow: inset 0 0 0 1px var(--_appearance-color-outline);\n color: var(--_option-appearance-color-text, var(--_appearance-color-text));\n font: var(--vvd-typography-base);\n gap: 12px;\n hyphens: auto;\n inline-size: 100%;\n min-block-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2)));\n padding-inline: 16px;\n vertical-align: middle;\n word-break: break-word;\n}\n.base {\n /* @cssprop [--vvd-option-accent-primary=var(--vvd-color-canvas-text)] */\n --_connotation-color-primary: var(--vvd-option-accent-primary, var(--vvd-color-canvas-text));\n /* @cssprop [--vvd-option-accent-primary-text=var(--vvd-color-canvas)] */\n --_connotation-color-primary-text: var(--vvd-option-accent-primary-text, var(--vvd-color-canvas));\n /* @cssprop [--vvd-option-accent-primary-increment=var(--vvd-color-neutral-800)] */\n --_connotation-color-primary-increment: var(--vvd-option-accent-primary-increment, var(--vvd-color-neutral-800));\n /* @cssprop [--vvd-option-accent-faint=var(--vvd-color-neutral-50)] */\n --_connotation-color-faint: var(--vvd-option-accent-faint, var(--vvd-color-neutral-50));\n /* @cssprop [--vvd-option-accent-soft=var(--vvd-color-neutral-100)] */\n --_connotation-color-soft: var(--vvd-option-accent-soft, var(--vvd-color-neutral-100));\n /* @cssprop [--vvd-option-accent-pale=var(--vvd-color-neutral-300)] */\n --_connotation-color-pale: var(--vvd-option-accent-pale, var(--vvd-color-neutral-300));\n /* @cssprop [--vvd-option-accent-dim=var(--vvd-color-neutral-200)] */\n --_connotation-color-dim: var(--vvd-option-accent-dim, var(--vvd-color-neutral-200));\n}\n.base {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.base: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.base:where(:disabled, .disabled) {\n --_appearance-color-text: var(--vvd-color-neutral-300);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.base: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.base:where(.selected, [aria-current]):where(:not(:disabled, .disabled, :hover, .hover)) {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: var(--_connotation-color-dim);\n --_appearance-color-outline: transparent;\n}\n.base:where(.selected, [aria-current]):where(:hover, .hover) {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: var(--_connotation-color-pale);\n --_appearance-color-outline: transparent;\n}\n@supports (user-select: none) {\n .base {\n user-select: none;\n }\n}\n.base:not(.disabled) {\n cursor: pointer;\n}\n.base.disabled {\n cursor: not-allowed;\n pointer-events: none;\n}\n.base .text {\n font: var(--vvd-typography-base);\n}\n\nslot[name=icon] {\n font-size: 20px;\n line-height: 1;\n}\n.base:not(.disabled, .selected) slot[name=icon] {\n color: var(--vvd-color-neutral-600);\n}\n\n.focus-indicator {\n --focus-stroke-color: var(--vvd-color-neutral-500);\n --focus-stroke-gap-color: transparent;\n}\n:host(:not([aria-checked=true])) .focus-indicator {\n display: none;\n}";
282
+
283
+ const listboxOptionDefinition = ListboxOption.compose({
284
+ baseName: "option",
285
+ template: ListboxOptionTemplate,
286
+ styles
368
287
  });
369
- const menuItemRegistries = [menuItemDefinition(), ...iconRegistries, ...focusRegistries];
370
- const registerMenuItem = registerFactory(menuItemRegistries);
288
+ const listboxOptionRegistries = [listboxOptionDefinition(), ...iconRegistries, ...focusRegistries];
289
+ const registerOption = registerFactory(listboxOptionRegistries);
371
290
 
372
- export { MenuItem$1 as M, MenuItemRole$1 as a, registerMenuItem as b, menuItemDefinition as c, menuItemRegistries as m, roleForMenuItem as r };
291
+ export { ListboxOption as L, listboxOptionRegistries as a, isListboxOption as i, listboxOptionDefinition as l, registerOption as r };