@vonage/vivid 3.52.0 → 3.53.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 (289) hide show
  1. package/README.md +1 -1
  2. package/accordion/index.cjs +1 -1
  3. package/accordion/index.js +1 -1
  4. package/accordion-item/index.cjs +1 -1
  5. package/accordion-item/index.js +1 -1
  6. package/alert/index.cjs +3 -3
  7. package/alert/index.js +3 -3
  8. package/audio-player/index.cjs +3 -3
  9. package/audio-player/index.js +3 -3
  10. package/avatar/index.cjs +1 -1
  11. package/avatar/index.js +1 -1
  12. package/badge/index.cjs +1 -1
  13. package/badge/index.js +1 -1
  14. package/banner/index.cjs +2 -2
  15. package/banner/index.js +2 -2
  16. package/breadcrumb-item/index.cjs +1 -1
  17. package/breadcrumb-item/index.js +1 -1
  18. package/button/index.cjs +2 -2
  19. package/button/index.js +2 -2
  20. package/card/index.cjs +2 -2
  21. package/card/index.js +2 -2
  22. package/checkbox/index.cjs +3 -2
  23. package/checkbox/index.js +3 -2
  24. package/combobox/index.cjs +5 -5
  25. package/combobox/index.js +5 -5
  26. package/custom-elements.json +717 -4
  27. package/data-grid/index.cjs +1 -1
  28. package/data-grid/index.js +1 -1
  29. package/date-picker/index.cjs +7 -6
  30. package/date-picker/index.js +7 -6
  31. package/date-range-picker/index.cjs +7 -6
  32. package/date-range-picker/index.js +7 -6
  33. package/dial-pad/index.cjs +33 -0
  34. package/dial-pad/index.js +31 -0
  35. package/dialog/index.cjs +4 -4
  36. package/dialog/index.js +4 -4
  37. package/divider/index.cjs +1 -1
  38. package/divider/index.js +1 -1
  39. package/elevation/index.cjs +1 -1
  40. package/elevation/index.js +1 -1
  41. package/empty-state/index.cjs +2 -2
  42. package/empty-state/index.js +2 -2
  43. package/fab/index.cjs +2 -2
  44. package/fab/index.js +2 -2
  45. package/file-picker/index.cjs +4 -3
  46. package/file-picker/index.js +4 -3
  47. package/header/index.cjs +2 -2
  48. package/header/index.js +2 -2
  49. package/icon/index.cjs +1 -1
  50. package/icon/index.js +1 -1
  51. package/index.cjs +132 -122
  52. package/index.js +46 -43
  53. package/layout/index.cjs +1 -1
  54. package/layout/index.js +1 -1
  55. package/lib/components.d.ts +2 -0
  56. package/lib/dial-pad/definition.d.ts +3 -0
  57. package/lib/dial-pad/dial-pad.d.ts +14 -0
  58. package/lib/dial-pad/dial-pad.template.d.ts +4 -0
  59. package/lib/dial-pad/locale.d.ts +18 -0
  60. package/lib/enums.d.ts +6 -0
  61. package/lib/text-anchor/definition.d.ts +1 -0
  62. package/lib/text-anchor/text-anchor.d.ts +5 -0
  63. package/lib/video-player/definition.d.ts +3 -0
  64. package/lib/video-player/locale.d.ts +1 -0
  65. package/lib/video-player/video-player.d.ts +17 -0
  66. package/lib/video-player/video-player.template.d.ts +4 -0
  67. package/listbox/index.cjs +2 -2
  68. package/listbox/index.js +2 -2
  69. package/locales/en-GB.cjs +30 -0
  70. package/locales/en-GB.js +30 -0
  71. package/locales/en-US.cjs +198 -0
  72. package/locales/en-US.js +198 -0
  73. package/locales/ja-JP.cjs +197 -0
  74. package/locales/ja-JP.js +197 -0
  75. package/locales/zh-CN.cjs +199 -0
  76. package/locales/zh-CN.js +199 -0
  77. package/menu/index.cjs +6 -6
  78. package/menu/index.js +6 -6
  79. package/menu-item/index.cjs +2 -2
  80. package/menu-item/index.js +2 -2
  81. package/nav/index.cjs +1 -1
  82. package/nav/index.js +1 -1
  83. package/nav-disclosure/index.cjs +2 -2
  84. package/nav-disclosure/index.js +2 -2
  85. package/nav-item/index.cjs +2 -2
  86. package/nav-item/index.js +2 -2
  87. package/note/index.cjs +2 -2
  88. package/note/index.js +2 -2
  89. package/number-field/index.cjs +5 -4
  90. package/number-field/index.js +5 -4
  91. package/option/index.cjs +2 -2
  92. package/option/index.js +2 -2
  93. package/package.json +1 -1
  94. package/pagination/index.cjs +3 -3
  95. package/pagination/index.js +3 -3
  96. package/popup/index.cjs +4 -4
  97. package/popup/index.js +4 -4
  98. package/progress/index.cjs +1 -1
  99. package/progress/index.js +1 -1
  100. package/progress-ring/index.cjs +1 -1
  101. package/progress-ring/index.js +1 -1
  102. package/radio/index.cjs +1 -1
  103. package/radio/index.js +1 -1
  104. package/radio-group/index.cjs +1 -1
  105. package/radio-group/index.js +1 -1
  106. package/range-slider/index.cjs +2 -2
  107. package/range-slider/index.js +2 -2
  108. package/select/index.cjs +7 -6
  109. package/select/index.js +7 -6
  110. package/selectable-box/index.cjs +5 -4
  111. package/selectable-box/index.js +5 -4
  112. package/shared/applyMixinsWithObservables.cjs +15 -0
  113. package/shared/applyMixinsWithObservables.js +13 -0
  114. package/shared/definition.cjs +1 -1
  115. package/shared/definition.js +1 -1
  116. package/shared/definition11.cjs +3 -3
  117. package/shared/definition11.js +3 -3
  118. package/shared/definition14.cjs +2 -2
  119. package/shared/definition14.js +2 -2
  120. package/shared/definition15.cjs +8 -9
  121. package/shared/definition15.js +8 -9
  122. package/shared/definition16.cjs +3 -3
  123. package/shared/definition16.js +3 -3
  124. package/shared/definition17.cjs +2 -2
  125. package/shared/definition17.js +3 -3
  126. package/shared/definition18.cjs +3 -3
  127. package/shared/definition18.js +3 -3
  128. package/shared/definition19.cjs +3 -3
  129. package/shared/definition19.js +3 -3
  130. package/shared/definition20.cjs +186 -227
  131. package/shared/definition20.js +181 -222
  132. package/shared/definition21.cjs +264 -67
  133. package/shared/definition21.js +263 -65
  134. package/shared/definition22.cjs +66 -57
  135. package/shared/definition22.js +64 -56
  136. package/shared/definition23.cjs +42 -76
  137. package/shared/definition23.js +41 -75
  138. package/shared/definition24.cjs +70 -2402
  139. package/shared/definition24.js +69 -2401
  140. package/shared/definition25.cjs +2402 -46
  141. package/shared/definition25.js +2401 -45
  142. package/shared/definition26.cjs +63 -30
  143. package/shared/definition26.js +62 -29
  144. package/shared/definition27.cjs +28 -56
  145. package/shared/definition27.js +27 -55
  146. package/shared/definition28.cjs +35 -881
  147. package/shared/definition28.js +34 -879
  148. package/shared/definition29.cjs +893 -60
  149. package/shared/definition29.js +893 -61
  150. package/shared/definition30.cjs +68 -86
  151. package/shared/definition30.js +67 -85
  152. package/shared/definition31.cjs +86 -21
  153. package/shared/definition31.js +86 -21
  154. package/shared/definition32.cjs +24 -12
  155. package/shared/definition32.js +23 -11
  156. package/shared/definition33.cjs +11 -50
  157. package/shared/definition33.js +10 -49
  158. package/shared/definition34.cjs +26 -515
  159. package/shared/definition34.js +26 -515
  160. package/shared/definition35.cjs +448 -194
  161. package/shared/definition35.js +448 -192
  162. package/shared/definition36.cjs +256 -202
  163. package/shared/definition36.js +253 -201
  164. package/shared/definition37.cjs +204 -65
  165. package/shared/definition37.js +203 -63
  166. package/shared/definition38.cjs +63 -57
  167. package/shared/definition38.js +60 -55
  168. package/shared/definition39.cjs +65 -432
  169. package/shared/definition39.js +64 -431
  170. package/shared/definition4.cjs +2 -2
  171. package/shared/definition4.js +2 -2
  172. package/shared/definition40.cjs +441 -34
  173. package/shared/definition40.js +438 -31
  174. package/shared/definition41.cjs +34 -576
  175. package/shared/definition41.js +33 -575
  176. package/shared/definition42.cjs +531 -654
  177. package/shared/definition42.js +531 -654
  178. package/shared/definition43.cjs +690 -114
  179. package/shared/definition43.js +689 -113
  180. package/shared/definition44.cjs +124 -79
  181. package/shared/definition44.js +122 -77
  182. package/shared/definition45.cjs +78 -520
  183. package/shared/definition45.js +77 -518
  184. package/shared/definition46.cjs +520 -119
  185. package/shared/definition46.js +518 -118
  186. package/shared/definition47.cjs +118 -135
  187. package/shared/definition47.js +117 -134
  188. package/shared/definition48.cjs +151 -19
  189. package/shared/definition48.js +150 -18
  190. package/shared/definition49.cjs +21 -84
  191. package/shared/definition49.js +20 -83
  192. package/shared/definition5.cjs +1 -1
  193. package/shared/definition5.js +1 -1
  194. package/shared/definition50.cjs +52 -505
  195. package/shared/definition50.js +51 -504
  196. package/shared/definition51.cjs +526 -28
  197. package/shared/definition51.js +525 -27
  198. package/shared/definition52.cjs +28 -123
  199. package/shared/definition52.js +26 -122
  200. package/shared/definition53.cjs +110 -309
  201. package/shared/definition53.js +110 -308
  202. package/shared/definition54.cjs +255 -271
  203. package/shared/definition54.js +255 -271
  204. package/shared/definition55.cjs +262 -791
  205. package/shared/definition55.js +261 -790
  206. package/shared/definition56.cjs +818 -107
  207. package/shared/definition56.js +817 -106
  208. package/shared/definition57.cjs +85 -55
  209. package/shared/definition57.js +84 -54
  210. package/shared/definition58.cjs +125 -72
  211. package/shared/definition58.js +124 -71
  212. package/shared/definition59.cjs +72 -285
  213. package/shared/definition59.js +73 -286
  214. package/shared/definition6.cjs +1 -1
  215. package/shared/definition6.js +1 -1
  216. package/shared/definition60.cjs +298 -39
  217. package/shared/definition60.js +297 -38
  218. package/shared/definition61.cjs +65739 -1688
  219. package/shared/definition61.js +65738 -1687
  220. package/shared/definition62.cjs +50 -0
  221. package/shared/definition62.js +46 -0
  222. package/shared/definition63.cjs +1828 -0
  223. package/shared/definition63.js +1824 -0
  224. package/shared/definition7.cjs +2 -2
  225. package/shared/definition7.js +2 -2
  226. package/shared/definition8.cjs +2 -2
  227. package/shared/definition8.js +2 -2
  228. package/shared/definition9.cjs +1 -1
  229. package/shared/definition9.js +1 -1
  230. package/shared/enums.cjs +8 -0
  231. package/shared/enums.js +8 -1
  232. package/shared/index2.cjs +66 -37
  233. package/shared/index2.js +66 -37
  234. package/shared/key-codes2.js +1 -1
  235. package/shared/listbox.cjs +1 -1
  236. package/shared/listbox.js +1 -1
  237. package/shared/localization/Locale.d.ts +4 -0
  238. package/shared/patterns/form-elements/form-elements.d.ts +2 -3
  239. package/shared/presentationDate.cjs +16 -5
  240. package/shared/presentationDate.js +16 -5
  241. package/shared/text-anchor.cjs +6 -0
  242. package/shared/text-anchor.js +6 -0
  243. package/shared/text-anchor.template.cjs +6 -1
  244. package/shared/text-anchor.template.js +6 -1
  245. package/shared/text-field.cjs +1 -1
  246. package/shared/text-field.js +1 -1
  247. package/shared/utils/applyMixinsWithObservables.d.ts +1 -0
  248. package/side-drawer/index.cjs +1 -1
  249. package/side-drawer/index.js +1 -1
  250. package/slider/index.cjs +1 -1
  251. package/slider/index.js +1 -1
  252. package/split-button/index.cjs +2 -2
  253. package/split-button/index.js +2 -2
  254. package/style.css +1 -0
  255. package/styles/core/all.css +1 -1
  256. package/styles/core/theme.css +1 -1
  257. package/styles/core/typography.css +1 -1
  258. package/styles/tokens/theme-dark.css +4 -4
  259. package/styles/tokens/theme-light.css +4 -4
  260. package/styles/tokens/vivid-2-compat.css +1 -1
  261. package/switch/index.cjs +2 -2
  262. package/switch/index.js +2 -2
  263. package/tab/index.cjs +2 -2
  264. package/tab/index.js +2 -2
  265. package/tab-panel/index.cjs +1 -1
  266. package/tab-panel/index.js +1 -1
  267. package/tabs/index.cjs +4 -4
  268. package/tabs/index.js +4 -4
  269. package/tag/index.cjs +2 -2
  270. package/tag/index.js +2 -2
  271. package/tag-group/index.cjs +1 -1
  272. package/tag-group/index.js +1 -1
  273. package/text-area/index.cjs +4 -3
  274. package/text-area/index.js +4 -3
  275. package/text-field/index.cjs +4 -3
  276. package/text-field/index.js +4 -3
  277. package/time-picker/index.cjs +8 -7
  278. package/time-picker/index.js +8 -7
  279. package/toggletip/index.cjs +5 -5
  280. package/toggletip/index.js +5 -5
  281. package/tooltip/index.cjs +5 -5
  282. package/tooltip/index.js +5 -5
  283. package/tree-item/index.cjs +2 -2
  284. package/tree-item/index.js +2 -2
  285. package/tree-view/index.cjs +1 -1
  286. package/tree-view/index.js +1 -1
  287. package/video-player/index.cjs +17 -0
  288. package/video-player/index.js +15 -0
  289. package/vivid.api.json +311 -0
@@ -1,77 +1,909 @@
1
- import { h as html, r as registerFactory } from './index.js';
2
- import { P as Popup, p as popupRegistries } from './definition61.js';
3
- import { b as Menu, a as menuItemRegistries } from './definition28.js';
4
- import { a as anchorSlotTemplateFactory } from './anchored.js';
5
- import { s as slotted } from './slotted.js';
1
+ import { F as FoundationElement, D as DOM, _ as __decorate, a as attr, o as observable, h as html, r as registerFactory } from './index.js';
2
+ import { a as iconRegistries } from './definition27.js';
3
+ import { A as AffixIcon, a as affixIconTemplateFactory } from './affix.js';
4
+ import { b as anchored } from './anchored.js';
5
+ import { S as StartEnd } from './start-end.js';
6
+ import { D as Direction, g as getDirection } from './direction.js';
7
+ import { a as applyMixins } from './apply-mixins.js';
8
+ import { i as keyArrowLeft, h as keyArrowRight, a as keySpace, k as keyEnter, g as keyHome, d as keyEnd, e as keyArrowUp, f as keyArrowDown } from './key-codes.js';
9
+ import { i as isHTMLElement } from './dom.js';
10
+ import { I as Icon } from './icon.js';
11
+ import { s as slotted, e as elements } from './slotted.js';
12
+ import { w as when } from './when.js';
6
13
  import { c as classNames } from './class-names.js';
7
14
 
8
- const styles = ":host{display:var(--_popup-display, inline)}:host([slotted-anchor]){--_popup-display: contents}.base{display:flex;overflow:hidden auto;box-sizing:border-box;flex-direction:column;gap:8px;inline-size:max-content;max-block-size:var(--menu-block-size, 408px);max-inline-size:var(--menu-max-inline-size);min-inline-size:var(--menu-min-inline-size);padding-block:8px}::slotted(a){color:var(--vvd-color-canvas-text);text-decoration:none}::slotted(a[role=menuitem]:focus-visible){box-shadow:inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));outline-offset:calc(-2px - var(--focus-inset, 0px));--focus-stroke-gap-color: transparent;display:block;border-radius:8px}.header{padding-block-start:8px;padding-inline:16px}.hide-header .header{display:none}.body{display:flex;flex-direction:column;row-gap:1px}.hide-body .body{display:none}.action-items{display:flex;justify-content:flex-end;gap:8px;padding-inline:8px}.hide-actions .action-items{display:none}\n";
15
+ /**
16
+ * Menu items roles.
17
+ * @public
18
+ */
19
+ const MenuItemRole$1 = {
20
+ /**
21
+ * The menu item has a "menuitem" role
22
+ */
23
+ menuitem: "menuitem",
24
+ /**
25
+ * The menu item has a "menuitemcheckbox" role
26
+ */
27
+ menuitemcheckbox: "menuitemcheckbox",
28
+ /**
29
+ * The menu item has a "menuitemradio" role
30
+ */
31
+ menuitemradio: "menuitemradio",
32
+ };
33
+ /**
34
+ * @internal
35
+ */
36
+ const roleForMenuItem = {
37
+ [MenuItemRole$1.menuitem]: "menuitem",
38
+ [MenuItemRole$1.menuitemcheckbox]: "menuitemcheckbox",
39
+ [MenuItemRole$1.menuitemradio]: "menuitemradio",
40
+ };
41
+
42
+ /**
43
+ * A Switch Custom HTML Element.
44
+ * 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 }.
45
+ *
46
+ * @slot checked-indicator - The checked indicator
47
+ * @slot radio-indicator - The radio indicator
48
+ * @slot start - Content which can be provided before the menu item content
49
+ * @slot end - Content which can be provided after the menu item content
50
+ * @slot - The default slot for menu item content
51
+ * @slot expand-collapse-indicator - The expand/collapse indicator
52
+ * @slot submenu - Used to nest menu's within menu items
53
+ * @csspart input-container - The element representing the visual checked or radio indicator
54
+ * @csspart checkbox - The element wrapping the `menuitemcheckbox` indicator
55
+ * @csspart radio - The element wrapping the `menuitemradio` indicator
56
+ * @csspart content - The element wrapping the menu item content
57
+ * @csspart expand-collapse-glyph-container - The element wrapping the expand collapse element
58
+ * @csspart expand-collapse - The expand/collapse element
59
+ * @csspart submenu-region - The container for the submenu, used for positioning
60
+ * @fires expanded-change - Fires a custom 'expanded-change' event when the expanded state changes
61
+ * @fires change - Fires a custom 'change' event when a non-submenu item with a role of `menuitemcheckbox`, `menuitemradio`, or `menuitem` is invoked
62
+ *
63
+ * @public
64
+ */
65
+ let MenuItem$1 = class MenuItem extends FoundationElement {
66
+ constructor() {
67
+ super(...arguments);
68
+ /**
69
+ * The role of the element.
70
+ *
71
+ * @public
72
+ * @remarks
73
+ * HTML Attribute: role
74
+ */
75
+ this.role = MenuItemRole$1.menuitem;
76
+ /**
77
+ * @internal
78
+ */
79
+ this.hasSubmenu = false;
80
+ /**
81
+ * Track current direction to pass to the anchored region
82
+ *
83
+ * @internal
84
+ */
85
+ this.currentDirection = Direction.ltr;
86
+ this.focusSubmenuOnLoad = false;
87
+ /**
88
+ * @internal
89
+ */
90
+ this.handleMenuItemKeyDown = (e) => {
91
+ if (e.defaultPrevented) {
92
+ return false;
93
+ }
94
+ switch (e.key) {
95
+ case keyEnter:
96
+ case keySpace:
97
+ this.invoke();
98
+ return false;
99
+ case keyArrowRight:
100
+ //open/focus on submenu
101
+ this.expandAndFocus();
102
+ return false;
103
+ case keyArrowLeft:
104
+ //close submenu
105
+ if (this.expanded) {
106
+ this.expanded = false;
107
+ this.focus();
108
+ return false;
109
+ }
110
+ }
111
+ return true;
112
+ };
113
+ /**
114
+ * @internal
115
+ */
116
+ this.handleMenuItemClick = (e) => {
117
+ if (e.defaultPrevented || this.disabled) {
118
+ return false;
119
+ }
120
+ this.invoke();
121
+ return false;
122
+ };
123
+ /**
124
+ * @internal
125
+ */
126
+ this.submenuLoaded = () => {
127
+ if (!this.focusSubmenuOnLoad) {
128
+ return;
129
+ }
130
+ this.focusSubmenuOnLoad = false;
131
+ if (this.hasSubmenu) {
132
+ this.submenu.focus();
133
+ this.setAttribute("tabindex", "-1");
134
+ }
135
+ };
136
+ /**
137
+ * @internal
138
+ */
139
+ this.handleMouseOver = (e) => {
140
+ if (this.disabled || !this.hasSubmenu || this.expanded) {
141
+ return false;
142
+ }
143
+ this.expanded = true;
144
+ return false;
145
+ };
146
+ /**
147
+ * @internal
148
+ */
149
+ this.handleMouseOut = (e) => {
150
+ if (!this.expanded || this.contains(document.activeElement)) {
151
+ return false;
152
+ }
153
+ this.expanded = false;
154
+ return false;
155
+ };
156
+ /**
157
+ * @internal
158
+ */
159
+ this.expandAndFocus = () => {
160
+ if (!this.hasSubmenu) {
161
+ return;
162
+ }
163
+ this.focusSubmenuOnLoad = true;
164
+ this.expanded = true;
165
+ };
166
+ /**
167
+ * @internal
168
+ */
169
+ this.invoke = () => {
170
+ if (this.disabled) {
171
+ return;
172
+ }
173
+ switch (this.role) {
174
+ case MenuItemRole$1.menuitemcheckbox:
175
+ this.checked = !this.checked;
176
+ break;
177
+ case MenuItemRole$1.menuitem:
178
+ // update submenu
179
+ this.updateSubmenu();
180
+ if (this.hasSubmenu) {
181
+ this.expandAndFocus();
182
+ }
183
+ else {
184
+ this.$emit("change");
185
+ }
186
+ break;
187
+ case MenuItemRole$1.menuitemradio:
188
+ if (!this.checked) {
189
+ this.checked = true;
190
+ }
191
+ break;
192
+ }
193
+ };
194
+ /**
195
+ * Gets the submenu element if any
196
+ *
197
+ * @internal
198
+ */
199
+ this.updateSubmenu = () => {
200
+ this.submenu = this.domChildren().find((element) => {
201
+ return element.getAttribute("role") === "menu";
202
+ });
203
+ this.hasSubmenu = this.submenu === undefined ? false : true;
204
+ };
205
+ }
206
+ expandedChanged(oldValue) {
207
+ if (this.$fastController.isConnected) {
208
+ if (this.submenu === undefined) {
209
+ return;
210
+ }
211
+ if (this.expanded === false) {
212
+ this.submenu.collapseExpandedItem();
213
+ }
214
+ else {
215
+ this.currentDirection = getDirection(this);
216
+ }
217
+ this.$emit("expanded-change", this, { bubbles: false });
218
+ }
219
+ }
220
+ checkedChanged(oldValue, newValue) {
221
+ if (this.$fastController.isConnected) {
222
+ this.$emit("change");
223
+ }
224
+ }
225
+ /**
226
+ * @internal
227
+ */
228
+ connectedCallback() {
229
+ super.connectedCallback();
230
+ DOM.queueUpdate(() => {
231
+ this.updateSubmenu();
232
+ });
233
+ if (!this.startColumnCount) {
234
+ this.startColumnCount = 1;
235
+ }
236
+ this.observer = new MutationObserver(this.updateSubmenu);
237
+ }
238
+ /**
239
+ * @internal
240
+ */
241
+ disconnectedCallback() {
242
+ super.disconnectedCallback();
243
+ this.submenu = undefined;
244
+ if (this.observer !== undefined) {
245
+ this.observer.disconnect();
246
+ this.observer = undefined;
247
+ }
248
+ }
249
+ /**
250
+ * get an array of valid DOM children
251
+ */
252
+ domChildren() {
253
+ return Array.from(this.children).filter(child => !child.hasAttribute("hidden"));
254
+ }
255
+ };
256
+ __decorate([
257
+ attr({ mode: "boolean" })
258
+ ], MenuItem$1.prototype, "disabled", void 0);
259
+ __decorate([
260
+ attr({ mode: "boolean" })
261
+ ], MenuItem$1.prototype, "expanded", void 0);
262
+ __decorate([
263
+ observable
264
+ ], MenuItem$1.prototype, "startColumnCount", void 0);
265
+ __decorate([
266
+ attr
267
+ ], MenuItem$1.prototype, "role", void 0);
268
+ __decorate([
269
+ attr({ mode: "boolean" })
270
+ ], MenuItem$1.prototype, "checked", void 0);
271
+ __decorate([
272
+ observable
273
+ ], MenuItem$1.prototype, "submenuRegion", void 0);
274
+ __decorate([
275
+ observable
276
+ ], MenuItem$1.prototype, "hasSubmenu", void 0);
277
+ __decorate([
278
+ observable
279
+ ], MenuItem$1.prototype, "currentDirection", void 0);
280
+ __decorate([
281
+ observable
282
+ ], MenuItem$1.prototype, "submenu", void 0);
283
+ applyMixins(MenuItem$1, StartEnd);
284
+
285
+ /**
286
+ * A Menu Custom HTML Element.
287
+ * Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#menu | ARIA menu }.
288
+ *
289
+ * @slot - The default slot for the menu items
290
+ *
291
+ * @public
292
+ */
293
+ let Menu$1 = class Menu extends FoundationElement {
294
+ constructor() {
295
+ super(...arguments);
296
+ this.expandedItem = null;
297
+ /**
298
+ * The index of the focusable element in the items array
299
+ * defaults to -1
300
+ */
301
+ this.focusIndex = -1;
302
+ /**
303
+ * @internal
304
+ */
305
+ this.isNestedMenu = () => {
306
+ return (this.parentElement !== null &&
307
+ isHTMLElement(this.parentElement) &&
308
+ this.parentElement.getAttribute("role") === "menuitem");
309
+ };
310
+ /**
311
+ * if focus is moving out of the menu, reset to a stable initial state
312
+ * @internal
313
+ */
314
+ this.handleFocusOut = (e) => {
315
+ if (!this.contains(e.relatedTarget) && this.menuItems !== undefined) {
316
+ this.collapseExpandedItem();
317
+ // find our first focusable element
318
+ const focusIndex = this.menuItems.findIndex(this.isFocusableElement);
319
+ // set the current focus index's tabindex to -1
320
+ this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
321
+ // set the first focusable element tabindex to 0
322
+ this.menuItems[focusIndex].setAttribute("tabindex", "0");
323
+ // set the focus index
324
+ this.focusIndex = focusIndex;
325
+ }
326
+ };
327
+ this.handleItemFocus = (e) => {
328
+ const targetItem = e.target;
329
+ if (this.menuItems !== undefined &&
330
+ targetItem !== this.menuItems[this.focusIndex]) {
331
+ this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
332
+ this.focusIndex = this.menuItems.indexOf(targetItem);
333
+ targetItem.setAttribute("tabindex", "0");
334
+ }
335
+ };
336
+ this.handleExpandedChanged = (e) => {
337
+ if (e.defaultPrevented ||
338
+ e.target === null ||
339
+ this.menuItems === undefined ||
340
+ this.menuItems.indexOf(e.target) < 0) {
341
+ return;
342
+ }
343
+ e.preventDefault();
344
+ const changedItem = e.target;
345
+ // closing an expanded item without opening another
346
+ if (this.expandedItem !== null &&
347
+ changedItem === this.expandedItem &&
348
+ changedItem.expanded === false) {
349
+ this.expandedItem = null;
350
+ return;
351
+ }
352
+ if (changedItem.expanded) {
353
+ if (this.expandedItem !== null && this.expandedItem !== changedItem) {
354
+ this.expandedItem.expanded = false;
355
+ }
356
+ this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
357
+ this.expandedItem = changedItem;
358
+ this.focusIndex = this.menuItems.indexOf(changedItem);
359
+ changedItem.setAttribute("tabindex", "0");
360
+ }
361
+ };
362
+ this.removeItemListeners = () => {
363
+ if (this.menuItems !== undefined) {
364
+ this.menuItems.forEach((item) => {
365
+ item.removeEventListener("expanded-change", this.handleExpandedChanged);
366
+ item.removeEventListener("focus", this.handleItemFocus);
367
+ });
368
+ }
369
+ };
370
+ this.setItems = () => {
371
+ const newItems = this.domChildren();
372
+ this.removeItemListeners();
373
+ this.menuItems = newItems;
374
+ const menuItems = this.menuItems.filter(this.isMenuItemElement);
375
+ // if our focus index is not -1 we have items
376
+ if (menuItems.length) {
377
+ this.focusIndex = 0;
378
+ }
379
+ function elementIndent(el) {
380
+ const role = el.getAttribute("role");
381
+ const startSlot = el.querySelector("[slot=start]");
382
+ if (role !== MenuItemRole$1.menuitem && startSlot === null) {
383
+ return 1;
384
+ }
385
+ else if (role === MenuItemRole$1.menuitem && startSlot !== null) {
386
+ return 1;
387
+ }
388
+ else if (role !== MenuItemRole$1.menuitem && startSlot !== null) {
389
+ return 2;
390
+ }
391
+ else {
392
+ return 0;
393
+ }
394
+ }
395
+ const indent = menuItems.reduce((accum, current) => {
396
+ const elementValue = elementIndent(current);
397
+ return accum > elementValue ? accum : elementValue;
398
+ }, 0);
399
+ menuItems.forEach((item, index) => {
400
+ item.setAttribute("tabindex", index === 0 ? "0" : "-1");
401
+ item.addEventListener("expanded-change", this.handleExpandedChanged);
402
+ item.addEventListener("focus", this.handleItemFocus);
403
+ if (item instanceof MenuItem$1) {
404
+ item.startColumnCount = indent;
405
+ }
406
+ });
407
+ };
408
+ /**
409
+ * handle change from child element
410
+ */
411
+ this.changeHandler = (e) => {
412
+ if (this.menuItems === undefined) {
413
+ return;
414
+ }
415
+ const changedMenuItem = e.target;
416
+ const changeItemIndex = this.menuItems.indexOf(changedMenuItem);
417
+ if (changeItemIndex === -1) {
418
+ return;
419
+ }
420
+ if (changedMenuItem.role === "menuitemradio" &&
421
+ changedMenuItem.checked === true) {
422
+ for (let i = changeItemIndex - 1; i >= 0; --i) {
423
+ const item = this.menuItems[i];
424
+ const role = item.getAttribute("role");
425
+ if (role === MenuItemRole$1.menuitemradio) {
426
+ item.checked = false;
427
+ }
428
+ if (role === "separator") {
429
+ break;
430
+ }
431
+ }
432
+ const maxIndex = this.menuItems.length - 1;
433
+ for (let i = changeItemIndex + 1; i <= maxIndex; ++i) {
434
+ const item = this.menuItems[i];
435
+ const role = item.getAttribute("role");
436
+ if (role === MenuItemRole$1.menuitemradio) {
437
+ item.checked = false;
438
+ }
439
+ if (role === "separator") {
440
+ break;
441
+ }
442
+ }
443
+ }
444
+ };
445
+ /**
446
+ * check if the item is a menu item
447
+ */
448
+ this.isMenuItemElement = (el) => {
449
+ return (isHTMLElement(el) &&
450
+ Menu.focusableElementRoles.hasOwnProperty(el.getAttribute("role")));
451
+ };
452
+ /**
453
+ * check if the item is focusable
454
+ */
455
+ this.isFocusableElement = (el) => {
456
+ return this.isMenuItemElement(el);
457
+ };
458
+ }
459
+ itemsChanged(oldValue, newValue) {
460
+ // only update children after the component is connected and
461
+ // the setItems has run on connectedCallback
462
+ // (menuItems is undefined until then)
463
+ if (this.$fastController.isConnected && this.menuItems !== undefined) {
464
+ this.setItems();
465
+ }
466
+ }
467
+ /**
468
+ * @internal
469
+ */
470
+ connectedCallback() {
471
+ super.connectedCallback();
472
+ DOM.queueUpdate(() => {
473
+ // wait until children have had a chance to
474
+ // connect before setting/checking their props/attributes
475
+ this.setItems();
476
+ });
477
+ this.addEventListener("change", this.changeHandler);
478
+ }
479
+ /**
480
+ * @internal
481
+ */
482
+ disconnectedCallback() {
483
+ super.disconnectedCallback();
484
+ this.removeItemListeners();
485
+ this.menuItems = undefined;
486
+ this.removeEventListener("change", this.changeHandler);
487
+ }
488
+ /**
489
+ * Focuses the first item in the menu.
490
+ *
491
+ * @public
492
+ */
493
+ focus() {
494
+ this.setFocus(0, 1);
495
+ }
496
+ /**
497
+ * Collapses any expanded menu items.
498
+ *
499
+ * @public
500
+ */
501
+ collapseExpandedItem() {
502
+ if (this.expandedItem !== null) {
503
+ this.expandedItem.expanded = false;
504
+ this.expandedItem = null;
505
+ }
506
+ }
507
+ /**
508
+ * @internal
509
+ */
510
+ handleMenuKeyDown(e) {
511
+ if (e.defaultPrevented || this.menuItems === undefined) {
512
+ return;
513
+ }
514
+ switch (e.key) {
515
+ case keyArrowDown:
516
+ // go forward one index
517
+ this.setFocus(this.focusIndex + 1, 1);
518
+ return;
519
+ case keyArrowUp:
520
+ // go back one index
521
+ this.setFocus(this.focusIndex - 1, -1);
522
+ return;
523
+ case keyEnd:
524
+ // set focus on last item
525
+ this.setFocus(this.menuItems.length - 1, -1);
526
+ return;
527
+ case keyHome:
528
+ // set focus on first item
529
+ this.setFocus(0, 1);
530
+ return;
531
+ default:
532
+ // if we are not handling the event, do not prevent default
533
+ return true;
534
+ }
535
+ }
536
+ /**
537
+ * get an array of valid DOM children
538
+ */
539
+ domChildren() {
540
+ return Array.from(this.children).filter(child => !child.hasAttribute("hidden"));
541
+ }
542
+ setFocus(focusIndex, adjustment) {
543
+ if (this.menuItems === undefined) {
544
+ return;
545
+ }
546
+ while (focusIndex >= 0 && focusIndex < this.menuItems.length) {
547
+ const child = this.menuItems[focusIndex];
548
+ if (this.isFocusableElement(child)) {
549
+ // change the previous index to -1
550
+ if (this.focusIndex > -1 &&
551
+ this.menuItems.length >= this.focusIndex - 1) {
552
+ this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
553
+ }
554
+ // update the focus index
555
+ this.focusIndex = focusIndex;
556
+ // update the tabindex of next focusable element
557
+ child.setAttribute("tabindex", "0");
558
+ // focus the element
559
+ child.focus();
560
+ break;
561
+ }
562
+ focusIndex += adjustment;
563
+ }
564
+ }
565
+ };
566
+ Menu$1.focusableElementRoles = roleForMenuItem;
567
+ __decorate([
568
+ observable
569
+ ], Menu$1.prototype, "items", void 0);
570
+
571
+ const styles = ":host(:focus-visible){outline:none}:host([disabled]){pointer-events:none}.base{display:flex;box-sizing:border-box;align-items:center;background-color:var(--_appearance-color-fill);box-shadow:inset 0 0 0 1px var(--_appearance-color-outline);inline-size:100%}.base{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.base:where(.disabled,:disabled){--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base:where(.active,:active):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.base:where(.selected):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.base:where(.selected):where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-dim);--_appearance-color-outline: transparent}.base.connotation-cta{--_connotation-color-primary: var(--vvd-menu-item-cta-primary, var(--vvd-color-cta-500));--_connotation-color-primary-text: var(--vvd-menu-item-cta-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-menu-item-cta-primary-increment, var(--vvd-color-cta-600));--_connotation-color-firm: var(--vvd-menu-item-cta-firm, var(--vvd-color-cta-600));--_connotation-color-faint: var(--vvd-menu-item-cta-faint, var(--vvd-color-cta-50));--_connotation-color-soft: var(--vvd-menu-item-cta-soft, var(--vvd-color-cta-100));--_connotation-color-pale: var(--vvd-menu-item-cta-pale, var(--vvd-color-cta-300));--_connotation-color-dim: var(--vvd-menu-item-cta-dim, var(--vvd-color-cta-200))}.base:not(.connotation-cta){--_connotation-color-primary: var(--vvd-menu-item-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-text: var(--vvd-menu-item-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-menu-item-accent-primary-increment, var(--vvd-color-neutral-800));--_connotation-color-firm: var(--vvd-menu-item-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-faint: var(--vvd-menu-item-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-menu-item-accent-soft, var(--vvd-color-neutral-100));--_connotation-color-pale: var(--vvd-menu-item-accent-pale, var(--vvd-color-neutral-300));--_connotation-color-dim: var(--vvd-menu-item-accent-dim, var(--vvd-color-neutral-200))}.base:not(.two-lines){gap:12px;min-block-size:calc(1px*(40 + 4*clamp(-1,var(--vvd-size-density, 0),2)));padding-block:8px;padding-inline:12px}.base.two-lines{padding:12px;gap:16px;min-block-size:calc(1px*(40 + 4*clamp(-1,var(--vvd-size-density, 0),2)) + 1px*(24 + 4*clamp(-1,var(--vvd-size-density, 0),2)))}@supports (user-select: none){.base{user-select:none}}.base:not(.disabled){cursor:pointer}:host(:not([role=presentation]):focus-visible) .base{box-shadow:inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));outline-offset:calc(-2px - var(--focus-inset, 0px));--focus-stroke-gap-color: transparent;border-radius:8px}.icon{flex-shrink:0;font-size:calc(1px*(40 + 4*clamp(-1,var(--vvd-size-density, 0),2))/2);line-height:1}.action,.decorative{display:flex;place-content:center}.action{color:var(--_appearance-color-text)}:host(:not([check-appearance],[aria-checked=true])) .action{color:var(--vvd-color-neutral-500)}.base.trailing .action,.base.has-meta .action{order:2}.base:not(.disabled) .decorative{color:var(--vvd-color-neutral-600)}.base.disabled .decorative{color:var(--vvd-color-neutral-200)}.base.has-meta .decorative{order:1}.chevron{order:3}.text{display:flex;overflow:hidden;flex-direction:column;gap:4px;margin-inline-end:auto}.text-primary,.text-secondary{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base)}.text-primary{font:var(--vvd-typography-base);-webkit-line-clamp:var(--text-primary-line-clamp, 1)}.base.two-lines .text-primary{font:var(--vvd-typography-base-bold)}.text-secondary{font:var(--vvd-typography-base-condensed);-webkit-line-clamp:var(--text-secondary-line-clamp, 1)}.base.two-lines:not(.disabled) .text-secondary{color:var(--vvd-color-neutral-600)}.base.two-lines:not(.disabled).selected .text-secondary{color:var(--vvd-color-neutral-800)}\n";
572
+
573
+ var __defProp$1 = Object.defineProperty;
574
+ var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
575
+ var __decorateClass$1 = (decorators, target, key, kind) => {
576
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
577
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
578
+ if (decorator = decorators[i])
579
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
580
+ if (kind && result)
581
+ __defProp$1(target, key, result);
582
+ return result;
583
+ };
584
+ var __accessCheck = (obj, member, msg) => {
585
+ if (!member.has(obj))
586
+ throw TypeError("Cannot " + msg);
587
+ };
588
+ var __privateGet = (obj, member, getter) => {
589
+ __accessCheck(obj, member, "read from private field");
590
+ return getter ? getter.call(obj) : member.get(obj);
591
+ };
592
+ var __privateAdd = (obj, member, value) => {
593
+ if (member.has(obj))
594
+ throw TypeError("Cannot add the same private member more than once");
595
+ member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
596
+ };
597
+ var __privateMethod = (obj, member, method) => {
598
+ __accessCheck(obj, member, "access private method");
599
+ return method;
600
+ };
601
+ var _setupAnchor, setupAnchor_fn, _updateAnchor, updateAnchor_fn, _cleanupAnchor, cleanupAnchor_fn, _openIfClosed, _updateClickOutsideListeners, _wasOpenBeforeClick, _onClickOutsideCapture, _onClickOutside;
602
+ let Menu = class extends Menu$1 {
603
+ constructor() {
604
+ super();
605
+ __privateAdd(this, _setupAnchor);
606
+ __privateAdd(this, _updateAnchor);
607
+ __privateAdd(this, _cleanupAnchor);
608
+ this.ariaLabel = null;
609
+ this.placement = "bottom";
610
+ this.autoDismiss = false;
611
+ this.open = false;
612
+ __privateAdd(this, _openIfClosed, () => {
613
+ if (!this.open)
614
+ DOM.queueUpdate(() => this.open = true);
615
+ });
616
+ __privateAdd(this, _updateClickOutsideListeners, () => {
617
+ document.removeEventListener("click", __privateGet(this, _onClickOutsideCapture), true);
618
+ document.removeEventListener("click", __privateGet(this, _onClickOutside));
619
+ if (this.autoDismiss && this.isConnected) {
620
+ document.addEventListener("click", __privateGet(this, _onClickOutsideCapture), true);
621
+ document.addEventListener("click", __privateGet(this, _onClickOutside));
622
+ }
623
+ });
624
+ __privateAdd(this, _wasOpenBeforeClick, /* @__PURE__ */ new WeakMap());
625
+ __privateAdd(this, _onClickOutsideCapture, (e) => {
626
+ __privateGet(this, _wasOpenBeforeClick).set(e, this.open);
627
+ });
628
+ __privateAdd(this, _onClickOutside, (e) => {
629
+ if (!this.contains(e.target) && __privateGet(this, _wasOpenBeforeClick).get(e)) {
630
+ this.open = false;
631
+ }
632
+ });
633
+ const handleFocusOut = this.handleFocusOut;
634
+ this.handleFocusOut = (e) => {
635
+ const privates = this;
636
+ const isSafeToCallSuper = privates.menuItems.some(
637
+ privates.isFocusableElement
638
+ );
639
+ if (!isSafeToCallSuper) {
640
+ return;
641
+ }
642
+ handleFocusOut(e);
643
+ };
644
+ }
645
+ autoDismissChanged(oldValue) {
646
+ if (oldValue === void 0)
647
+ return;
648
+ __privateGet(this, _updateClickOutsideListeners).call(this);
649
+ }
650
+ openChanged(_, newValue) {
651
+ newValue ? this.$emit("open", void 0, { bubbles: false }) : this.$emit("close", void 0, { bubbles: false });
652
+ if (this._anchorEl) {
653
+ __privateMethod(this, _updateAnchor, updateAnchor_fn).call(this, this._anchorEl);
654
+ }
655
+ }
656
+ connectedCallback() {
657
+ super.connectedCallback();
658
+ __privateGet(this, _updateClickOutsideListeners).call(this);
659
+ }
660
+ disconnectedCallback() {
661
+ super.disconnectedCallback();
662
+ __privateGet(this, _updateClickOutsideListeners).call(this);
663
+ }
664
+ /**
665
+ * @internal
666
+ */
667
+ _anchorElChanged(oldValue, newValue) {
668
+ if (oldValue)
669
+ __privateMethod(this, _cleanupAnchor, cleanupAnchor_fn).call(this, oldValue);
670
+ if (newValue)
671
+ __privateMethod(this, _setupAnchor, setupAnchor_fn).call(this, newValue);
672
+ }
673
+ };
674
+ _setupAnchor = new WeakSet();
675
+ setupAnchor_fn = function(a) {
676
+ a.addEventListener("click", __privateGet(this, _openIfClosed), true);
677
+ a.setAttribute("aria-haspopup", "menu");
678
+ __privateMethod(this, _updateAnchor, updateAnchor_fn).call(this, a);
679
+ };
680
+ _updateAnchor = new WeakSet();
681
+ updateAnchor_fn = function(a) {
682
+ a.setAttribute("aria-expanded", this.open.toString());
683
+ };
684
+ _cleanupAnchor = new WeakSet();
685
+ cleanupAnchor_fn = function(a) {
686
+ a.removeEventListener("click", __privateGet(this, _openIfClosed), true);
687
+ a.removeAttribute("aria-hasPopup");
688
+ a.removeAttribute("aria-expanded");
689
+ };
690
+ _openIfClosed = new WeakMap();
691
+ _updateClickOutsideListeners = new WeakMap();
692
+ _wasOpenBeforeClick = new WeakMap();
693
+ _onClickOutsideCapture = new WeakMap();
694
+ _onClickOutside = new WeakMap();
695
+ __decorateClass$1([
696
+ attr({ attribute: "aria-label" })
697
+ ], Menu.prototype, "ariaLabel", 2);
698
+ __decorateClass$1([
699
+ attr({ mode: "fromView" })
700
+ ], Menu.prototype, "placement", 2);
701
+ __decorateClass$1([
702
+ attr({ mode: "boolean", attribute: "auto-dismiss" })
703
+ ], Menu.prototype, "autoDismiss", 2);
704
+ __decorateClass$1([
705
+ attr({ mode: "boolean" })
706
+ ], Menu.prototype, "open", 2);
707
+ __decorateClass$1([
708
+ observable
709
+ ], Menu.prototype, "headerSlottedContent", 2);
710
+ __decorateClass$1([
711
+ observable
712
+ ], Menu.prototype, "actionItemsSlottedContent", 2);
713
+ Menu = __decorateClass$1([
714
+ anchored
715
+ ], Menu);
9
716
 
717
+ var __defProp = Object.defineProperty;
718
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
719
+ var __decorateClass = (decorators, target, key, kind) => {
720
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
721
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
722
+ if (decorator = decorators[i])
723
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
724
+ if (kind && result)
725
+ __defProp(target, key, result);
726
+ return result;
727
+ };
728
+ const MenuItemRole = {
729
+ ...MenuItemRole$1,
730
+ presentation: "presentation"
731
+ };
732
+ var CheckAppearance = /* @__PURE__ */ ((CheckAppearance2) => {
733
+ CheckAppearance2["Normal"] = "normal";
734
+ CheckAppearance2["TickOnly"] = "tick-only";
735
+ return CheckAppearance2;
736
+ })(CheckAppearance || {});
737
+ class MenuItem extends MenuItem$1 {
738
+ constructor() {
739
+ super();
740
+ this.checkTrailing = false;
741
+ this.#submenuArray = [];
742
+ this.updateSubmenu = () => this.#updateSubmenu();
743
+ this.addEventListener("expanded-change", this.#expandedChange);
744
+ }
745
+ #submenuArray;
746
+ /**
747
+ *
748
+ *
749
+ * @internal
750
+ */
751
+ slottedSubmenuChanged(_oldValue, newValue) {
752
+ this.#submenuArray = newValue;
753
+ }
754
+ #updateSubmenu() {
755
+ for (const submenu of this.#submenuArray) {
756
+ this.submenu = submenu;
757
+ this.submenu.anchor = this;
758
+ this.submenu.placement = "right-start";
759
+ this.submenu.collapseExpandedItem = () => this.#collapseExpandedItem();
760
+ }
761
+ this.hasSubmenu = this.submenu === void 0 ? false : true;
762
+ }
763
+ #collapseExpandedItem() {
764
+ this.expanded = false;
765
+ }
766
+ #expandedChange() {
767
+ if (this.hasSubmenu) {
768
+ this.submenu.open = this.expanded;
769
+ }
770
+ }
771
+ }
772
+ __decorateClass([
773
+ attr
774
+ ], MenuItem.prototype, "text", 2);
775
+ __decorateClass([
776
+ attr({ attribute: "text-secondary" })
777
+ ], MenuItem.prototype, "textSecondary", 2);
778
+ __decorateClass([
779
+ attr
780
+ ], MenuItem.prototype, "connotation", 2);
781
+ __decorateClass([
782
+ attr({ mode: "boolean", attribute: "check-trailing" })
783
+ ], MenuItem.prototype, "checkTrailing", 2);
784
+ __decorateClass([
785
+ attr({ attribute: "check-appearance" })
786
+ ], MenuItem.prototype, "checkedAppearance", 2);
787
+ __decorateClass([
788
+ observable
789
+ ], MenuItem.prototype, "metaSlottedContent", 2);
790
+ __decorateClass([
791
+ observable
792
+ ], MenuItem.prototype, "trailingMetaSlottedContent", 2);
793
+ __decorateClass([
794
+ observable
795
+ ], MenuItem.prototype, "slottedSubmenu", 2);
796
+ applyMixins(MenuItem, AffixIcon);
797
+
798
+ const getIndicatorIcon = (x) => {
799
+ if (x.checkedAppearance === CheckAppearance.TickOnly) {
800
+ return x.checked ? "check-line" : "";
801
+ }
802
+ const iconType = x.role === MenuItemRole.menuitemcheckbox ? "checkbox" : "radio";
803
+ const iconStatus = x.checked ? "checked" : "unchecked";
804
+ return `${iconType}-${iconStatus}-2-line`;
805
+ };
10
806
  const getClasses = ({
11
- headerSlottedContent,
12
- actionItemsSlottedContent,
13
- items
807
+ connotation,
808
+ disabled,
809
+ checked,
810
+ role,
811
+ text: text2,
812
+ textSecondary,
813
+ icon,
814
+ metaSlottedContent,
815
+ checkTrailing
14
816
  }) => classNames(
15
817
  "base",
16
- ["hide-header", !headerSlottedContent?.length],
17
- ["hide-actions", !actionItemsSlottedContent?.length],
18
- ["hide-body", items && !items.length]
818
+ [`connotation-${connotation}`, Boolean(connotation)],
819
+ ["disabled", Boolean(disabled)],
820
+ ["selected", role !== MenuItemRole.menuitem && Boolean(checked)],
821
+ [
822
+ "trailing",
823
+ role !== MenuItemRole.menuitem && (checkTrailing || Boolean(icon))
824
+ ],
825
+ ["item-checkbox", role === MenuItemRole.menuitemcheckbox],
826
+ ["item-radio", role === MenuItemRole.menuitemradio],
827
+ ["two-lines", Boolean(text2?.length) && Boolean(textSecondary?.length)],
828
+ ["has-meta", Boolean(metaSlottedContent?.length)]
19
829
  );
20
- function handleEscapeKey(menu, event) {
21
- if (event.key === "Escape" && menu.open) {
22
- menu.open = false;
23
- }
24
- return true;
830
+ function handleClick(x, { event }) {
831
+ x.handleMenuItemClick(event);
832
+ return x.role === MenuItemRole.presentation;
25
833
  }
26
- const MenuTemplate = (context) => {
27
- const popupTag = context.tagFor(Popup);
28
- const anchorSlotTemplate = anchorSlotTemplateFactory();
29
- function handlePopupEvents(x, e, state) {
30
- e.stopPropagation();
31
- x.open = state;
32
- }
834
+ function checkIndicator(context) {
835
+ const iconTag = context.tagFor(Icon);
836
+ return html`${when(
837
+ (x) => x.role === MenuItemRole.menuitemcheckbox || x.role === MenuItemRole.menuitemradio,
838
+ html`<span class="action"><${iconTag} class="icon" name="${(x) => getIndicatorIcon(x)}"></${iconTag}></span>`
839
+ )}`;
840
+ }
841
+ function text() {
842
+ return html`${when(
843
+ (x) => x.text || x.textSecondary,
844
+ html`<span class="text">
845
+ ${when(
846
+ (x) => x.text,
847
+ html`<span class="text-primary">${(x) => x.text}</span>`
848
+ )}
849
+ ${when(
850
+ (x) => x.textSecondary,
851
+ html`<span class="text-secondary">${(x) => x.textSecondary}</span>`
852
+ )}
853
+ </span>`
854
+ )}`;
855
+ }
856
+ const MenuItemTemplate = (context) => {
857
+ const affixIconTemplate = affixIconTemplateFactory(context);
858
+ const iconTag = context.tagFor(Icon);
33
859
  return html`
34
- <template role="presentation">
35
- ${anchorSlotTemplate}
36
- <${popupTag}
37
- :placement=${(x) => x.placement}
38
- :open=${(x) => x.open}
39
- :anchor=${(x) => x._anchorEl}
40
- @keydown="${(x, c) => handleEscapeKey(x, c.event)}"
41
- @vwc-popup:open="${(x, c) => handlePopupEvents(x, c.event, true)}"
42
- @vwc-popup:close="${(x, c) => handlePopupEvents(x, c.event, false)}"
43
- >
860
+ <template
861
+ role="${(x) => x.role ? x.role : MenuItemRole.menuitem}"
862
+ aria-haspopup="${(x) => x.hasSubmenu ? "menu" : void 0}"
863
+ aria-checked="${(x) => x.role !== MenuItemRole.menuitem ? x.checked : void 0}"
864
+ aria-disabled="${(x) => x.disabled}"
865
+ aria-expanded="${(x) => x.expanded}"
866
+ @keydown="${(x, c) => x.handleMenuItemKeyDown(c.event)}"
867
+ @click="${handleClick}"
868
+ @mouseover="${(x, c) => x.handleMouseOver(c.event)}"
869
+ @mouseout="${(x, c) => x.handleMouseOut(c.event)}"
870
+ >
44
871
  <div class="${getClasses}">
45
- <div class="header">
46
- <slot name="header" ${slotted("headerSlottedContent")}></slot>
47
- </div>
48
- <div
49
- class="body"
50
- role="menu"
51
- aria-label="${(x) => x.ariaLabel}"
52
- @keydown="${(x, c) => x.handleMenuKeyDown(c.event)}"
53
- @focusout="${(x, c) => x.handleFocusOut(c.event)}"
54
- >
55
- <slot ${slotted("items")}></slot>
56
- </div>
57
- <footer class="action-items"><slot name="action-items" ${slotted(
58
- "actionItemsSlottedContent"
59
- )}></slot></footer>
872
+ <slot name="meta" ${slotted("metaSlottedContent")}></slot>
873
+ ${checkIndicator(context)}
874
+ ${when(
875
+ (x) => x.icon,
876
+ html`<span class="decorative"
877
+ >${(x) => affixIconTemplate(x.icon)}</span
878
+ >`
879
+ )}
880
+ ${text()}
881
+ <slot
882
+ name="trailing-meta"
883
+ ${slotted("trailingMetaSlottedContent")}
884
+ ></slot>
885
+ ${when(
886
+ (x) => x.hasSubmenu,
887
+ html`<${iconTag} class="chevron" name="chevron-right-line"></${iconTag}>`
888
+ )}
60
889
  </div>
61
- </${popupTag}>
62
- </template>`;
890
+ <slot
891
+ name="submenu"
892
+ ${slotted({
893
+ property: "slottedSubmenu",
894
+ filter: elements(context.tagFor(Menu))
895
+ })}
896
+ ></slot>
897
+ </template>
898
+ `;
63
899
  };
64
900
 
65
- const menuDefinition = Menu.compose({
66
- baseName: "menu",
67
- template: MenuTemplate,
901
+ const menuItemDefinition = MenuItem.compose({
902
+ baseName: "menu-item",
903
+ template: MenuItemTemplate,
68
904
  styles
69
905
  });
70
- const menuRegistries = [
71
- menuDefinition(),
72
- ...popupRegistries,
73
- ...menuItemRegistries
74
- ];
75
- const registerMenu = registerFactory(menuRegistries);
906
+ const menuItemRegistries = [menuItemDefinition(), ...iconRegistries];
907
+ const registerMenuItem = registerFactory(menuItemRegistries);
76
908
 
77
- export { menuRegistries as a, menuDefinition as m, registerMenu as r };
909
+ export { MenuItemRole as M, menuItemRegistries as a, Menu as b, menuItemDefinition as m, registerMenuItem as r };