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