@vonage/vivid 4.24.0 → 4.25.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 (392) hide show
  1. package/custom-elements.json +12314 -4711
  2. package/elevation/index.cjs +1 -1
  3. package/elevation/index.js +1 -1
  4. package/index.cjs +112 -150
  5. package/index.js +37 -35
  6. package/lib/accordion-item/accordion-item.d.ts +6 -0
  7. package/lib/action-group/action-group.d.ts +6 -0
  8. package/lib/alert/alert.d.ts +20 -0
  9. package/lib/audio-player/audio-player.d.ts +6 -0
  10. package/lib/badge/badge.d.ts +9 -1
  11. package/lib/banner/banner.d.ts +25 -0
  12. package/lib/breadcrumb/breadcrumb.d.ts +6 -0
  13. package/lib/breadcrumb-item/breadcrumb-item.d.ts +63 -7
  14. package/lib/button/button.d.ts +732 -7
  15. package/lib/button/locale.d.ts +3 -0
  16. package/lib/calendar-event/calendar-event.d.ts +6 -0
  17. package/lib/card/card.d.ts +394 -2
  18. package/lib/card/card.template.d.ts +2 -1
  19. package/lib/checkbox/checkbox.d.ts +1822 -5
  20. package/lib/combobox/combobox.d.ts +1827 -20
  21. package/lib/data-grid/data-grid-cell.d.ts +339 -1
  22. package/lib/data-grid/locale.d.ts +5 -0
  23. package/lib/date-picker/date-picker.d.ts +1676 -207
  24. package/lib/date-range-picker/date-range-picker.d.ts +840 -107
  25. package/lib/date-time-picker/date-time-picker.d.ts +1678 -209
  26. package/lib/dial-pad/dial-pad.d.ts +8 -0
  27. package/lib/dialog/dialog.d.ts +12 -0
  28. package/lib/divider/divider.d.ts +6 -0
  29. package/lib/fab/fab.d.ts +6 -0
  30. package/lib/file-picker/file-picker.d.ts +1508 -30
  31. package/lib/header/header.d.ts +6 -0
  32. package/lib/icon/icon.d.ts +1 -0
  33. package/lib/icon/icon.template.d.ts +2 -1
  34. package/lib/menu/menu.d.ts +16 -7
  35. package/lib/menu/name.d.ts +1 -0
  36. package/lib/menu-item/menu-item.d.ts +14 -2
  37. package/lib/nav/nav.d.ts +6 -0
  38. package/lib/nav-disclosure/nav-disclosure.d.ts +13 -0
  39. package/lib/nav-item/nav-item.d.ts +405 -3
  40. package/lib/note/note.d.ts +6 -0
  41. package/lib/number-field/number-field.d.ts +1857 -36
  42. package/lib/option/option.d.ts +12 -0
  43. package/lib/progress/progress.d.ts +6 -0
  44. package/lib/progress-ring/progress-ring.d.ts +6 -0
  45. package/lib/radio/radio.d.ts +1137 -4
  46. package/lib/radio-group/radio-group.d.ts +20 -2
  47. package/lib/range-slider/range-slider.d.ts +752 -5
  48. package/lib/rich-text-editor/definition.d.ts +2 -2
  49. package/lib/rich-text-editor/facades/vivid-prose-mirror.facade.d.ts +3 -1
  50. package/lib/rich-text-editor/locale.d.ts +1 -0
  51. package/lib/rich-text-editor/menubar/menubar.d.ts +6 -0
  52. package/lib/rich-text-editor/rich-text-editor.d.ts +352 -2
  53. package/lib/searchable-select/option-tag.d.ts +6 -0
  54. package/lib/searchable-select/searchable-select.d.ts +1857 -36
  55. package/lib/select/select.d.ts +1843 -28
  56. package/lib/selectable-box/selectable-box.d.ts +6 -0
  57. package/lib/slider/slider.d.ts +384 -2
  58. package/lib/split-button/split-button.d.ts +18 -0
  59. package/lib/switch/switch.d.ts +386 -3
  60. package/lib/tab/tab.d.ts +18 -1
  61. package/lib/tab-panel/tab-panel.d.ts +6 -0
  62. package/lib/tag/tag.d.ts +12 -0
  63. package/lib/tag-group/tag-group.d.ts +6 -0
  64. package/lib/text-area/text-area.d.ts +2174 -19
  65. package/lib/text-field/text-field.d.ts +2195 -31
  66. package/lib/time-picker/time-picker.d.ts +839 -106
  67. package/lib/toggletip/toggletip.d.ts +10 -4
  68. package/lib/tooltip/tooltip.d.ts +10 -4
  69. package/lib/tree-item/tree-item.d.ts +12 -0
  70. package/lib/tree-view/tree-view.d.ts +6 -0
  71. package/lib/video-player/video-player.d.ts +6 -0
  72. package/lib/visually-hidden/definition.d.ts +4 -0
  73. package/lib/visually-hidden/visually-hidden.d.ts +3 -0
  74. package/lib/visually-hidden/visually-hidden.template.d.ts +3 -0
  75. package/locales/de-DE.cjs +33 -1
  76. package/locales/de-DE.js +33 -1
  77. package/locales/en-GB.cjs +33 -1
  78. package/locales/en-GB.js +33 -1
  79. package/locales/en-US.cjs +33 -1
  80. package/locales/en-US.js +33 -1
  81. package/locales/ja-JP.cjs +33 -1
  82. package/locales/ja-JP.js +33 -1
  83. package/locales/zh-CN.cjs +33 -1
  84. package/locales/zh-CN.js +33 -1
  85. package/menu/index.cjs +1 -1
  86. package/menu/index.js +1 -1
  87. package/nav/index.cjs +1 -1
  88. package/nav/index.js +1 -1
  89. package/nav-disclosure/index.cjs +1 -1
  90. package/nav-disclosure/index.js +1 -1
  91. package/nav-item/index.cjs +1 -1
  92. package/nav-item/index.js +1 -1
  93. package/note/index.cjs +1 -1
  94. package/note/index.js +1 -1
  95. package/number-field/index.cjs +1 -1
  96. package/number-field/index.js +1 -1
  97. package/option/index.cjs +1 -1
  98. package/option/index.js +1 -1
  99. package/package.json +1 -1
  100. package/pagination/index.cjs +1 -1
  101. package/pagination/index.js +1 -1
  102. package/popup/index.cjs +1 -1
  103. package/popup/index.js +1 -1
  104. package/progress/index.cjs +1 -1
  105. package/progress/index.js +1 -1
  106. package/progress-ring/index.cjs +1 -1
  107. package/progress-ring/index.js +1 -1
  108. package/radio/index.cjs +1 -1
  109. package/radio/index.js +1 -1
  110. package/radio-group/index.cjs +1 -1
  111. package/radio-group/index.js +1 -1
  112. package/range-slider/index.cjs +1 -1
  113. package/range-slider/index.js +1 -1
  114. package/rich-text-editor/index.cjs +1 -1
  115. package/rich-text-editor/index.js +1 -1
  116. package/searchable-select/index.cjs +1 -1
  117. package/searchable-select/index.js +1 -1
  118. package/select/index.cjs +1 -1
  119. package/select/index.js +1 -1
  120. package/selectable-box/index.cjs +1 -1
  121. package/selectable-box/index.js +1 -1
  122. package/shared/affix.cjs +13 -7
  123. package/shared/affix.js +13 -8
  124. package/shared/aria/delegates-aria.d.ts +6 -0
  125. package/shared/aria/host-semantics.d.ts +6 -0
  126. package/shared/breadcrumb-item.cjs +2 -5
  127. package/shared/breadcrumb-item.js +2 -5
  128. package/shared/button.cjs +13 -11
  129. package/shared/button.js +13 -11
  130. package/shared/calendar-picker.template.cjs +3 -3
  131. package/shared/calendar-picker.template.js +1 -1
  132. package/shared/char-count.cjs +92 -0
  133. package/shared/char-count.js +90 -0
  134. package/shared/definition.js +1 -1
  135. package/shared/definition10.js +1 -1
  136. package/shared/definition11.cjs +27 -44
  137. package/shared/definition11.js +28 -45
  138. package/shared/definition12.js +1 -1
  139. package/shared/definition13.js +1 -1
  140. package/shared/definition14.cjs +53 -22
  141. package/shared/definition14.js +54 -23
  142. package/shared/definition15.cjs +31 -36
  143. package/shared/definition15.js +30 -36
  144. package/shared/definition16.cjs +43 -63
  145. package/shared/definition16.js +42 -63
  146. package/shared/definition17.cjs +8 -4
  147. package/shared/definition17.js +8 -4
  148. package/shared/definition18.cjs +10 -14
  149. package/shared/definition18.js +9 -14
  150. package/shared/definition19.cjs +85 -100
  151. package/shared/definition19.js +75 -91
  152. package/shared/definition2.js +1 -1
  153. package/shared/definition20.cjs +15 -20
  154. package/shared/definition20.js +14 -20
  155. package/shared/definition21.cjs +22 -3
  156. package/shared/definition21.js +23 -4
  157. package/shared/definition22.cjs +4 -4
  158. package/shared/definition22.js +5 -5
  159. package/shared/definition23.cjs +5 -38
  160. package/shared/definition23.js +5 -37
  161. package/shared/definition24.cjs +2 -7
  162. package/shared/definition24.js +3 -8
  163. package/shared/definition25.js +1 -1
  164. package/shared/definition26.cjs +157 -171
  165. package/shared/definition26.js +156 -171
  166. package/shared/definition27.cjs +1 -1
  167. package/shared/definition27.js +2 -2
  168. package/shared/definition28.cjs +32 -17
  169. package/shared/definition28.js +33 -18
  170. package/shared/definition29.js +1 -1
  171. package/shared/definition3.js +1 -1
  172. package/shared/definition30.cjs +96 -482
  173. package/shared/definition30.js +99 -482
  174. package/shared/definition31.cjs +334 -57
  175. package/shared/definition31.js +333 -56
  176. package/shared/definition32.cjs +104 -19
  177. package/shared/definition32.js +105 -20
  178. package/shared/definition33.cjs +67 -15
  179. package/shared/definition33.js +66 -14
  180. package/shared/definition34.cjs +15 -50
  181. package/shared/definition34.js +14 -49
  182. package/shared/definition35.cjs +28 -397
  183. package/shared/definition35.js +27 -397
  184. package/shared/definition36.cjs +404 -54
  185. package/shared/definition36.js +404 -55
  186. package/shared/definition37.cjs +57 -234
  187. package/shared/definition37.js +57 -233
  188. package/shared/definition38.cjs +221 -66
  189. package/shared/definition38.js +220 -65
  190. package/shared/definition39.cjs +52 -44
  191. package/shared/definition39.js +51 -43
  192. package/shared/definition4.cjs +31 -24
  193. package/shared/definition4.js +33 -26
  194. package/shared/definition40.cjs +56 -266
  195. package/shared/definition40.js +55 -265
  196. package/shared/definition41.cjs +285 -142
  197. package/shared/definition41.js +285 -142
  198. package/shared/definition42.cjs +156 -564
  199. package/shared/definition42.js +156 -565
  200. package/shared/definition43.cjs +554 -14378
  201. package/shared/definition43.js +553 -14377
  202. package/shared/definition44.cjs +14418 -1155
  203. package/shared/definition44.js +14417 -1156
  204. package/shared/definition45.cjs +1049 -677
  205. package/shared/definition45.js +1050 -678
  206. package/shared/definition46.cjs +848 -113
  207. package/shared/definition46.js +847 -112
  208. package/shared/definition47.cjs +125 -90
  209. package/shared/definition47.js +124 -89
  210. package/shared/definition48.cjs +88 -455
  211. package/shared/definition48.js +87 -454
  212. package/shared/definition49.cjs +466 -109
  213. package/shared/definition49.js +466 -109
  214. package/shared/definition5.cjs +8 -7
  215. package/shared/definition5.js +6 -5
  216. package/shared/definition50.cjs +106 -106
  217. package/shared/definition50.js +105 -105
  218. package/shared/definition51.cjs +136 -15
  219. package/shared/definition51.js +135 -14
  220. package/shared/definition52.cjs +16 -115
  221. package/shared/definition52.js +15 -114
  222. package/shared/definition53.cjs +78 -412
  223. package/shared/definition53.js +77 -410
  224. package/shared/definition54.cjs +445 -23
  225. package/shared/definition54.js +443 -22
  226. package/shared/definition55.cjs +22 -136
  227. package/shared/definition55.js +21 -135
  228. package/shared/definition56.cjs +95 -291
  229. package/shared/definition56.js +95 -292
  230. package/shared/definition57.cjs +192 -480
  231. package/shared/definition57.js +190 -479
  232. package/shared/definition58.cjs +411 -24
  233. package/shared/definition58.js +410 -24
  234. package/shared/definition59.cjs +27 -144
  235. package/shared/definition59.js +27 -143
  236. package/shared/definition6.js +1 -1
  237. package/shared/definition60.cjs +83 -54
  238. package/shared/definition60.js +82 -53
  239. package/shared/definition61.cjs +78 -166
  240. package/shared/definition61.js +77 -164
  241. package/shared/definition62.cjs +143 -232
  242. package/shared/definition62.js +141 -231
  243. package/shared/definition63.cjs +234 -69417
  244. package/shared/definition63.js +233 -69416
  245. package/shared/definition64.cjs +69454 -28
  246. package/shared/definition64.js +69453 -27
  247. package/shared/definition65.cjs +28 -2168
  248. package/shared/definition65.js +27 -2166
  249. package/shared/definition66.cjs +27 -0
  250. package/shared/definition66.js +23 -0
  251. package/shared/definition67.cjs +2195 -0
  252. package/shared/definition67.js +2190 -0
  253. package/shared/definition7.cjs +11 -2
  254. package/shared/definition7.js +12 -3
  255. package/shared/definition8.cjs +24 -11
  256. package/shared/definition8.js +26 -13
  257. package/shared/definition9.cjs +1 -2
  258. package/shared/definition9.js +2 -3
  259. package/shared/delegates-aria.js +1 -1
  260. package/shared/deprecation/replaced-props.d.ts +20 -0
  261. package/shared/divider.cjs +41 -0
  262. package/shared/divider.js +38 -0
  263. package/shared/feedback/feedback-message.d.ts +345 -0
  264. package/shared/feedback/locale.d.ts +4 -0
  265. package/{lib/text-anchor/text-anchor.d.ts → shared/feedback/mixins.d.ts} +62 -39
  266. package/shared/form-associated.cjs +124 -100
  267. package/shared/form-associated.js +125 -101
  268. package/shared/form-element.cjs +84 -0
  269. package/shared/form-element.js +82 -0
  270. package/shared/foundation/button/button.d.ts +378 -2
  271. package/shared/foundation/form-associated/form-associated.d.ts +753 -49
  272. package/shared/foundation/listbox/listbox.d.ts +1 -1
  273. package/shared/foundation/vivid-element/vivid-element.d.ts +14 -0
  274. package/shared/host-semantics.js +1 -1
  275. package/shared/key-codes.js +1 -1
  276. package/shared/linkable.cjs +70 -0
  277. package/shared/linkable.js +68 -0
  278. package/shared/localization/Locale.d.ts +14 -0
  279. package/shared/mixins.cjs +306 -0
  280. package/shared/mixins.js +300 -0
  281. package/shared/patterns/affix.d.ts +16 -1
  282. package/shared/patterns/anchored.d.ts +20 -8
  283. package/shared/patterns/char-count/char-count.d.ts +351 -0
  284. package/shared/patterns/char-count/index.d.ts +1 -0
  285. package/shared/patterns/char-count/locale.d.ts +4 -0
  286. package/shared/patterns/form-elements/form-element.d.ts +744 -0
  287. package/shared/patterns/form-elements/index.d.ts +3 -1
  288. package/shared/patterns/form-elements/with-error-text.d.ts +1122 -0
  289. package/shared/patterns/form-elements/with-success-text.d.ts +341 -0
  290. package/shared/patterns/index.d.ts +2 -0
  291. package/shared/patterns/linkable.d.ts +394 -0
  292. package/shared/patterns/localized.d.ts +6 -0
  293. package/shared/patterns/trapped-focus.d.ts +6 -0
  294. package/shared/picker-field/mixins/calendar-picker.d.ts +420 -52
  295. package/shared/picker-field/mixins/calendar-picker.template.d.ts +420 -52
  296. package/shared/picker-field/mixins/inline-time-picker/inline-time-picker.d.ts +6 -0
  297. package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +843 -107
  298. package/shared/picker-field/mixins/single-date-picker.d.ts +1259 -155
  299. package/shared/picker-field/mixins/single-value-picker.d.ts +417 -49
  300. package/shared/picker-field/mixins/time-selection-picker.d.ts +842 -106
  301. package/shared/picker-field/mixins/time-selection-picker.template.d.ts +839 -103
  302. package/shared/picker-field/picker-field.d.ts +1491 -15
  303. package/shared/picker-field.template.cjs +13 -22
  304. package/shared/picker-field.template.js +14 -23
  305. package/shared/repeat.js +1 -1
  306. package/shared/slider.template.cjs +1 -1
  307. package/shared/slider.template.js +1 -1
  308. package/shared/time-selection-picker.template.cjs +10 -15
  309. package/shared/time-selection-picker.template.js +10 -16
  310. package/shared/vivid-element.cjs +53 -4
  311. package/shared/vivid-element.js +53 -3
  312. package/shared/with-error-text.cjs +56 -0
  313. package/shared/with-error-text.js +54 -0
  314. package/shared/with-success-text.cjs +23 -0
  315. package/shared/with-success-text.js +21 -0
  316. package/side-drawer/index.cjs +1 -1
  317. package/side-drawer/index.js +1 -1
  318. package/slider/index.cjs +1 -1
  319. package/slider/index.js +1 -1
  320. package/split-button/index.cjs +1 -1
  321. package/split-button/index.js +1 -1
  322. package/styles/core/all.css +1 -1
  323. package/styles/core/theme.css +1 -1
  324. package/styles/core/typography.css +1 -1
  325. package/styles/tokens/theme-dark.css +4 -4
  326. package/styles/tokens/theme-light.css +4 -4
  327. package/styles/tokens/vivid-2-compat.css +1 -1
  328. package/switch/index.cjs +1 -1
  329. package/switch/index.js +1 -1
  330. package/tab/index.cjs +1 -1
  331. package/tab/index.js +1 -1
  332. package/tab-panel/index.cjs +1 -1
  333. package/tab-panel/index.js +1 -1
  334. package/tabs/index.cjs +1 -1
  335. package/tabs/index.js +1 -1
  336. package/tag/index.cjs +1 -1
  337. package/tag/index.js +1 -1
  338. package/tag-group/index.cjs +1 -1
  339. package/tag-group/index.js +1 -1
  340. package/text-area/index.cjs +1 -1
  341. package/text-area/index.js +1 -1
  342. package/text-field/index.cjs +1 -1
  343. package/text-field/index.js +1 -1
  344. package/time-picker/index.cjs +1 -1
  345. package/time-picker/index.js +1 -1
  346. package/toggletip/index.cjs +1 -1
  347. package/toggletip/index.js +1 -1
  348. package/tooltip/index.cjs +1 -1
  349. package/tooltip/index.js +1 -1
  350. package/tree-item/index.cjs +1 -1
  351. package/tree-item/index.js +1 -1
  352. package/tree-view/index.cjs +1 -1
  353. package/tree-view/index.js +1 -1
  354. package/video-player/index.cjs +1 -1
  355. package/video-player/index.js +1 -1
  356. package/visually-hidden/index.cjs +5 -0
  357. package/visually-hidden/index.js +3 -0
  358. package/vivid.api.json +744 -1490
  359. package/lib/checkbox/checkbox.form-associated.d.ts +0 -11
  360. package/lib/file-picker/file-picker.form-associated.d.ts +0 -11
  361. package/lib/number-field/number-field.form-associated.d.ts +0 -11
  362. package/lib/radio/radio.form-associated.d.ts +0 -13
  363. package/lib/range-slider/range-slider.form-associated.d.ts +0 -11
  364. package/lib/searchable-select/searchable-select.form-associated.d.ts +0 -11
  365. package/lib/select/select.form-associated.d.ts +0 -11
  366. package/lib/slider/slider.form-associated.d.ts +0 -11
  367. package/lib/switch/switch.form-associated.d.ts +0 -11
  368. package/lib/text-anchor/definition.d.ts +0 -2
  369. package/lib/text-anchor/text-anchor.template.d.ts +0 -3
  370. package/lib/text-area/text-area.form-associated.d.ts +0 -11
  371. package/lib/text-field/text-field.form-associated.d.ts +0 -11
  372. package/shared/anchor.cjs +0 -49
  373. package/shared/anchor.js +0 -47
  374. package/shared/apply-mixins.cjs +0 -23
  375. package/shared/apply-mixins.js +0 -21
  376. package/shared/applyMixinsWithObservables.cjs +0 -15
  377. package/shared/applyMixinsWithObservables.js +0 -13
  378. package/shared/direction.cjs +0 -17
  379. package/shared/direction.js +0 -15
  380. package/shared/form-elements.cjs +0 -209
  381. package/shared/form-elements.js +0 -202
  382. package/shared/foundation/anchor/anchor.d.ts +0 -11
  383. package/shared/foundation/utilities/apply-mixins.d.ts +0 -1
  384. package/shared/patterns/form-elements/form-elements.d.ts +0 -58
  385. package/shared/picker-field/picker-field.form-associated.d.ts +0 -11
  386. package/shared/text-anchor.cjs +0 -38
  387. package/shared/text-anchor.js +0 -36
  388. package/shared/text-anchor.template.cjs +0 -35
  389. package/shared/text-anchor.template.js +0 -33
  390. package/shared/utils/applyMixinsWithObservables.d.ts +0 -1
  391. package/text-anchor/index.cjs +0 -17
  392. package/text-anchor/index.js +0 -15
@@ -1,20 +1,13 @@
1
- import { P as Popup, p as popupDefinition } from './definition65.js';
2
1
  import { I as Icon, i as iconDefinition } from './definition28.js';
3
- import { D as DOM, V as VividElement, o as observable, a as attr, h as html, g as createRegisterFunction, i as defineVividComponent } from './vivid-element.js';
4
- import { g as keyHome, d as keyEnd, e as keyArrowUp, f as keyArrowDown, h as keyArrowLeft, i as keyArrowRight, a as keySpace, k as keyEnter } from './key-codes.js';
2
+ import { D as DOM, V as VividElement, a as attr, o as observable, r as replaces, h as html, d as createRegisterFunction, f as defineVividComponent } from './vivid-element.js';
3
+ import { i as keyArrowLeft, h as keyArrowRight, a as keySpace, k as keyEnter } from './key-codes.js';
5
4
  import { b as AffixIcon, a as affixIconTemplateFactory } from './affix.js';
6
- import { D as Direction, g as getDirection } from './direction.js';
7
5
  import { H as HostSemantics, a as applyHostSemantics } from './host-semantics.js';
8
- import { A as Anchored, a as anchorSlotTemplateFactory } from './anchored.js';
9
- import { D as DelegatesAria, d as delegateAria } from './delegates-aria.js';
10
- import { i as isHTMLElement } from './dom.js';
11
- import { h as handleEscapeKeyAndStopPropogation } from './index.js';
12
- import { r as ref } from './ref.js';
13
- import { c as classNames } from './class-names.js';
14
6
  import { s as slotted, e as elements } from './slotted.js';
7
+ import { c as classNames } from './class-names.js';
15
8
  import { w as when } from './when.js';
16
9
 
17
- const styles$1 = ":host(:focus-visible){outline:none}:host([disabled]){pointer-events:none}.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{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: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:0 0 0 4px color-mix(in srgb,var(--vvd-color-cta-500),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px));--focus-stroke-gap-color: transparent}.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)}.base.trailing .action,.base.has-meta .action{order:2}:host(:not([check-appearance],[aria-checked=true],[disabled])) .action{color:var(--vvd-color-neutral-500)}.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;font:var(--vvd-typography-base)}.text-primary{font:var(--vvd-typography-base);-webkit-line-clamp:var(--text-primary-line-clamp, 1)}.base:not(.disabled) .text-primary{color:var(--vvd-color-canvas-text)}.base.disabled .text-primary{color:var(--_appearance-color-text)}.base.two-lines .text-primary{font:var(--vvd-typography-base-bold)}.text-secondary{color:var(--vvd-color-neutral-800);font:var(--vvd-typography-base-condensed);-webkit-line-clamp:var(--text-secondary-line-clamp, 1)}.base.two-lines .text-secondary{color:var(--vvd-color-neutral-600)}.base.disabled .text-secondary{color:var(--_appearance-color-text)}.base.selected:not(.disabled) .text-secondary{color:var(--vvd-color-neutral-800)}:host([internal-part]) .text-primary{font:var(--_text-primary-custom-size, var--vvd-typography-base)}";
10
+ const styles = ":host(:focus-visible){outline:none}:host([disabled]){pointer-events:none}.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{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: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:0 0 0 4px color-mix(in srgb,var(--vvd-color-cta-500),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px));--focus-stroke-gap-color: transparent}.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)}.base.trailing .action,.base.has-meta .action{order:2}:host(:not([check-appearance],[checked],[disabled])) .action{color:var(--vvd-color-neutral-500)}.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;font:var(--vvd-typography-base)}.text-primary{font:var(--vvd-typography-base);-webkit-line-clamp:var(--text-primary-line-clamp, 1)}.base:not(.disabled) .text-primary{color:var(--vvd-color-canvas-text)}.base.disabled .text-primary{color:var(--_appearance-color-text)}.base.two-lines .text-primary{font:var(--vvd-typography-base-bold)}.text-secondary{color:var(--vvd-color-neutral-800);font:var(--vvd-typography-base-condensed);-webkit-line-clamp:var(--text-secondary-line-clamp, 1)}.base.two-lines .text-secondary{color:var(--vvd-color-neutral-600)}.base.disabled .text-secondary{color:var(--_appearance-color-text)}.base.selected:not(.disabled) .text-secondary{color:var(--vvd-color-neutral-800)}:host([internal-part]) .text-primary{font:var(--_text-primary-custom-size, var--vvd-typography-base)}";
18
11
 
19
12
  const MenuItemRole = {
20
13
  menuitem: "menuitem",
@@ -22,326 +15,6 @@ const MenuItemRole = {
22
15
  menuitemradio: "menuitemradio",
23
16
  presentation: "presentation"
24
17
  };
25
- const roleForMenuItem = {
26
- [MenuItemRole.menuitem]: "menuitem",
27
- [MenuItemRole.menuitemcheckbox]: "menuitemcheckbox",
28
- [MenuItemRole.menuitemradio]: "menuitemradio",
29
- [MenuItemRole.presentation]: "presentation"
30
- };
31
-
32
- var __defProp$1 = Object.defineProperty;
33
- var __decorateClass$1 = (decorators, target, key, kind) => {
34
- var result = void 0 ;
35
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
36
- if (decorator = decorators[i])
37
- result = (decorator(target, key, result) ) || result;
38
- if (result) __defProp$1(target, key, result);
39
- return result;
40
- };
41
- const _Menu = class _Menu extends Anchored(DelegatesAria(VividElement)) {
42
- constructor() {
43
- super(...arguments);
44
- this.expandedItem = null;
45
- /**
46
- * The index of the focusable element in the items array
47
- * defaults to -1
48
- */
49
- this.focusIndex = -1;
50
- /**
51
- * if focus is moving out of the menu, reset to a stable initial state
52
- * @internal
53
- */
54
- this.handleFocusOut = (e) => {
55
- if (!this.contains(e.relatedTarget) && this.menuItems !== void 0 && this.menuItems.length) {
56
- this.collapseExpandedItem();
57
- const focusIndex = this.menuItems.findIndex(
58
- this.isFocusableElement
59
- );
60
- this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
61
- this.menuItems[focusIndex].setAttribute("tabindex", "0");
62
- this.focusIndex = focusIndex;
63
- }
64
- };
65
- this.handleItemFocus = (e) => {
66
- const targetItem = e.target;
67
- if (this.menuItems !== void 0 && targetItem !== this.menuItems[this.focusIndex]) {
68
- this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
69
- this.focusIndex = this.menuItems.indexOf(targetItem);
70
- targetItem.setAttribute("tabindex", "0");
71
- }
72
- };
73
- this.handleExpandedChanged = (e) => {
74
- const changedItem = e.target;
75
- if (this.expandedItem !== null && changedItem === this.expandedItem && changedItem.expanded === false) {
76
- this.expandedItem = null;
77
- }
78
- if (changedItem.expanded) {
79
- this.expandedItem = changedItem;
80
- }
81
- };
82
- this.removeItemListeners = () => {
83
- if (this.menuItems !== void 0) {
84
- this.menuItems.forEach((item) => {
85
- item.removeEventListener("expanded-change", this.handleExpandedChanged);
86
- item.removeEventListener(
87
- "focus",
88
- this.handleItemFocus
89
- );
90
- });
91
- }
92
- };
93
- this.setItems = () => {
94
- const newItems = this.domChildren();
95
- this.removeItemListeners();
96
- this.menuItems = newItems.filter(this.isMenuItemElement);
97
- if (this.menuItems.length) {
98
- this.focusIndex = 0;
99
- }
100
- this.menuItems.forEach((item, index) => {
101
- item.setAttribute("tabindex", index === 0 ? "0" : "-1");
102
- item.addEventListener("expanded-change", this.handleExpandedChanged);
103
- item.addEventListener("focus", this.handleItemFocus);
104
- });
105
- };
106
- /**
107
- * check if the item is a menu item
108
- */
109
- this.isMenuItemElement = (el) => {
110
- return isHTMLElement(el) && Object.prototype.hasOwnProperty.call(
111
- _Menu.focusableElementRoles,
112
- el.getAttribute("role")
113
- );
114
- };
115
- /**
116
- * check if the item is focusable
117
- */
118
- this.isFocusableElement = (el) => {
119
- return this.isMenuItemElement(el);
120
- };
121
- this.placement = "bottom";
122
- this.autoDismiss = false;
123
- this.positionStrategy = "fixed";
124
- this.open = false;
125
- this.#onAnchorClick = () => {
126
- if (this.#triggerBehaviour === "off") {
127
- return;
128
- }
129
- if (this.#triggerBehaviour === "legacy" && this.open) {
130
- return;
131
- }
132
- const newValue = !this.open;
133
- DOM.queueUpdate(() => this.open = newValue);
134
- };
135
- this._onFocusout = (e) => {
136
- const focusTarget = e.relatedTarget;
137
- const focusMovedAway = !this.contains(focusTarget) && !this._anchorEl?.contains(focusTarget);
138
- if (this.autoDismiss && focusMovedAway) {
139
- this.open = false;
140
- }
141
- };
142
- }
143
- /**
144
- * @internal
145
- */
146
- itemsChanged() {
147
- if (this.$fastController.isConnected && this.menuItems !== void 0) {
148
- this.setItems();
149
- }
150
- }
151
- static {
152
- this.focusableElementRoles = roleForMenuItem;
153
- }
154
- /**
155
- * @internal
156
- */
157
- connectedCallback() {
158
- super.connectedCallback();
159
- DOM.queueUpdate(() => {
160
- this.setItems();
161
- });
162
- }
163
- /**
164
- * @internal
165
- */
166
- disconnectedCallback() {
167
- super.disconnectedCallback();
168
- this.removeItemListeners();
169
- this.menuItems = void 0;
170
- }
171
- /**
172
- * Moves focus into the menu. If there is a child with the `autofocus` attribute, it will be focused.
173
- * Otherwise, the first focusable child will be focused.
174
- *
175
- * @public
176
- */
177
- focus() {
178
- const autoFocusElement = this.querySelector(
179
- '[autofocus]:not([slot="anchor"])'
180
- );
181
- if (autoFocusElement instanceof HTMLElement) {
182
- autoFocusElement.focus();
183
- } else {
184
- this.setFocus(0);
185
- }
186
- }
187
- /**
188
- * Collapses any expanded Menu Items.
189
- *
190
- * @public
191
- */
192
- collapseExpandedItem() {
193
- if (this.expandedItem !== null) {
194
- this.expandedItem.expanded = false;
195
- this.expandedItem = null;
196
- }
197
- }
198
- /**
199
- * @internal
200
- */
201
- handleMenuKeyDown(e) {
202
- if (e.defaultPrevented || this.menuItems === void 0) {
203
- return;
204
- }
205
- switch (e.key) {
206
- case keyArrowDown:
207
- this.setFocus(this.focusIndex + 1);
208
- return;
209
- case keyArrowUp:
210
- this.setFocus(this.focusIndex - 1);
211
- return;
212
- case keyEnd:
213
- this.setFocus(this.menuItems.length - 1);
214
- return;
215
- case keyHome:
216
- this.setFocus(0);
217
- return;
218
- default:
219
- return true;
220
- }
221
- }
222
- /**
223
- * get an array of valid DOM children
224
- */
225
- domChildren() {
226
- return Array.from(this.children).filter((child) => !child.hasAttribute("hidden")).filter((child) => !child.hasAttribute("slot"));
227
- }
228
- setFocus(focusIndex) {
229
- if (this.menuItems === void 0) {
230
- return;
231
- }
232
- if (focusIndex >= 0 && focusIndex < this.menuItems.length) {
233
- const child = this.menuItems[focusIndex];
234
- if (this.focusIndex > -1 && this.menuItems.length >= this.focusIndex - 1) {
235
- this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
236
- }
237
- this.focusIndex = focusIndex;
238
- child.setAttribute("tabindex", "0");
239
- child.focus();
240
- }
241
- }
242
- get #triggerBehaviour() {
243
- return this.trigger ?? "legacy";
244
- }
245
- openChanged(_, newValue) {
246
- if (newValue) {
247
- this._popupEl?.show().then(() => this.focus());
248
- }
249
- newValue ? this.$emit("open", void 0, { bubbles: false }) : this.$emit("close", void 0, { bubbles: false });
250
- if (this._anchorEl) {
251
- this.#updateAnchor(this._anchorEl);
252
- }
253
- }
254
- /**
255
- * @internal
256
- */
257
- _anchorElChanged(oldValue, newValue) {
258
- if (oldValue) this.#cleanupAnchor(oldValue);
259
- if (newValue) this.#setupAnchor(newValue);
260
- }
261
- #setupAnchor(a) {
262
- a.addEventListener("click", this.#onAnchorClick, true);
263
- a.addEventListener("focusout", this._onFocusout);
264
- a.setAttribute("aria-haspopup", "menu");
265
- this.#updateAnchor(a);
266
- }
267
- #updateAnchor(a) {
268
- a.setAttribute("aria-expanded", this.open.toString());
269
- }
270
- #cleanupAnchor(a) {
271
- a.removeEventListener("click", this.#onAnchorClick, true);
272
- a.removeEventListener("focusout", this._onFocusout);
273
- a.removeAttribute("aria-haspopup");
274
- a.removeAttribute("aria-expanded");
275
- }
276
- #onAnchorClick;
277
- /**
278
- * @internal
279
- */
280
- _onChange(e) {
281
- if (this.menuItems === void 0) {
282
- return;
283
- }
284
- const clickedOnNonCheckboxMenuItem = e.target instanceof HTMLElement && (e.target.role === "menuitem" || e.target.role === "menuitemradio");
285
- if (this.#triggerBehaviour === "auto" && clickedOnNonCheckboxMenuItem) {
286
- this.open = false;
287
- }
288
- const domChildren = this.domChildren();
289
- const changedMenuItem = e.target;
290
- const changeItemIndex = domChildren.indexOf(changedMenuItem);
291
- if (changeItemIndex === -1) {
292
- return;
293
- }
294
- if (changedMenuItem.role === "menuitemradio" && changedMenuItem.checked) {
295
- for (let i = changeItemIndex - 1; i >= 0; --i) {
296
- const item = domChildren[i];
297
- const role = item.getAttribute("role");
298
- if (role === MenuItemRole.menuitemradio) {
299
- item.checked = false;
300
- }
301
- if (role === "separator") {
302
- break;
303
- }
304
- }
305
- const maxIndex = domChildren.length - 1;
306
- for (let i = changeItemIndex + 1; i <= maxIndex; ++i) {
307
- const item = domChildren[i];
308
- const role = item.getAttribute("role");
309
- if (role === MenuItemRole.menuitemradio) {
310
- item.checked = false;
311
- }
312
- if (role === "separator") {
313
- break;
314
- }
315
- }
316
- }
317
- return true;
318
- }
319
- };
320
- __decorateClass$1([
321
- observable
322
- ], _Menu.prototype, "items");
323
- __decorateClass$1([
324
- attr({ mode: "fromView" })
325
- ], _Menu.prototype, "placement");
326
- __decorateClass$1([
327
- attr
328
- ], _Menu.prototype, "trigger");
329
- __decorateClass$1([
330
- attr({ mode: "boolean", attribute: "auto-dismiss" })
331
- ], _Menu.prototype, "autoDismiss");
332
- __decorateClass$1([
333
- attr({ mode: "fromView", attribute: "position-strategy" })
334
- ], _Menu.prototype, "positionStrategy");
335
- __decorateClass$1([
336
- attr({ mode: "boolean" })
337
- ], _Menu.prototype, "open");
338
- __decorateClass$1([
339
- observable
340
- ], _Menu.prototype, "headerSlottedContent");
341
- __decorateClass$1([
342
- observable
343
- ], _Menu.prototype, "actionItemsSlottedContent");
344
- let Menu = _Menu;
345
18
 
346
19
  var __defProp = Object.defineProperty;
347
20
  var __decorateClass = (decorators, target, key, kind) => {
@@ -358,23 +31,21 @@ class MenuItem extends HostSemantics(AffixIcon(VividElement)) {
358
31
  // eslint-disable-next-line @nrwl/nx/workspace/no-attribute-default-value
359
32
  this.role = MenuItemRole.menuitem;
360
33
  this.checked = false;
361
- this.hasSubmenu = false;
362
- this.currentDirection = Direction.ltr;
363
34
  /**
364
35
  * @internal
365
36
  */
366
37
  this.handleMenuItemClick = (e) => {
367
- if (e.defaultPrevented || this.disabled) {
368
- return false;
38
+ if (this._isSyntheticClickEvent(e)) {
39
+ return true;
369
40
  }
370
41
  this.invoke();
371
- return false;
42
+ return Boolean(this._isPresentational);
372
43
  };
373
44
  /**
374
45
  * @internal
375
46
  */
376
47
  this.handleMouseOver = (_) => {
377
- if (this.disabled || !this.hasSubmenu || this.expanded) {
48
+ if (this.disabled || !this.submenu || this.expanded) {
378
49
  return false;
379
50
  }
380
51
  this.expanded = true;
@@ -391,30 +62,28 @@ class MenuItem extends HostSemantics(AffixIcon(VividElement)) {
391
62
  return false;
392
63
  };
393
64
  this.invoke = () => {
394
- if (this.disabled) {
65
+ if (this.disabled || this._isPresentational) {
395
66
  return;
396
67
  }
397
- switch (this.role) {
398
- case MenuItemRole.menuitemcheckbox:
68
+ switch (this.controlType) {
69
+ case "checkbox":
399
70
  this.checked = !this.checked;
400
71
  break;
401
- case MenuItemRole.menuitem:
402
- this.updateSubmenu();
403
- if (this.hasSubmenu) {
72
+ case "radio":
73
+ if (!this.checked) {
74
+ this.checked = true;
75
+ }
76
+ break;
77
+ default:
78
+ if (this.submenu) {
404
79
  this.expanded = true;
405
80
  } else {
406
81
  this.$emit("change");
407
82
  }
408
83
  break;
409
- case MenuItemRole.menuitemradio:
410
- if (!this.checked) {
411
- this.checked = true;
412
- }
413
- break;
414
84
  }
415
85
  };
416
86
  this.checkTrailing = false;
417
- this.#submenuArray = [];
418
87
  /**
419
88
  * @internal
420
89
  */
@@ -431,7 +100,7 @@ class MenuItem extends HostSemantics(AffixIcon(VividElement)) {
431
100
  }
432
101
  return false;
433
102
  case keyArrowRight:
434
- if (this.hasSubmenu) {
103
+ if (this.submenu) {
435
104
  this.expanded = true;
436
105
  this.#emitSyntheticClick();
437
106
  }
@@ -454,17 +123,29 @@ class MenuItem extends HostSemantics(AffixIcon(VividElement)) {
454
123
  */
455
124
  expandedChanged() {
456
125
  if (this.$fastController.isConnected) {
457
- if (this.submenu === void 0) {
458
- return;
459
- }
460
- if (this.expanded === false) {
126
+ if (this.submenu && !this.expanded) {
461
127
  this.submenu.collapseExpandedItem();
462
- } else {
463
- this.currentDirection = getDirection(this);
464
128
  }
465
129
  this.$emit("expanded-change", this, { bubbles: false });
466
130
  }
467
131
  }
132
+ #ensureRoleMatchesPresentational() {
133
+ if (this._isPresentational) {
134
+ if (this.role === "menuitem") {
135
+ this.role = "presentation";
136
+ }
137
+ } else if (this.role === "presentation") {
138
+ this.role = MenuItemRole.menuitem;
139
+ }
140
+ }
141
+ /**
142
+ * @internal
143
+ */
144
+ _isPresentationalChanged() {
145
+ if (this.$fastController.isConnected) {
146
+ this.#ensureRoleMatchesPresentational();
147
+ }
148
+ }
468
149
  /**
469
150
  * @internal
470
151
  */
@@ -479,44 +160,41 @@ class MenuItem extends HostSemantics(AffixIcon(VividElement)) {
479
160
  connectedCallback() {
480
161
  super.connectedCallback();
481
162
  DOM.queueUpdate(() => {
482
- this.updateSubmenu();
163
+ this._isPresentational = this._isPresentational ?? true;
164
+ this.#ensureRoleMatchesPresentational();
483
165
  });
484
- this.observer = new MutationObserver(this.updateSubmenu);
485
166
  }
486
167
  /**
487
168
  * @internal
488
169
  */
489
- disconnectedCallback() {
490
- super.disconnectedCallback();
491
- this.submenu = void 0;
492
- if (this.observer !== void 0) {
493
- this.observer.disconnect();
494
- this.observer = void 0;
170
+ slottedSubmenuChanged() {
171
+ if (this.submenu) {
172
+ this.submenu.anchor = this;
173
+ this.submenu.placement = "right-start";
174
+ this.submenu.collapseExpandedItem = () => this.#collapseExpandedItem();
495
175
  }
496
176
  }
497
- #submenuArray;
498
177
  /**
499
- *
500
- *
501
178
  * @internal
502
179
  */
503
- slottedSubmenuChanged(_oldValue, newValue) {
504
- this.#submenuArray = newValue;
505
- }
506
- updateSubmenu() {
507
- for (const submenu of this.#submenuArray) {
508
- this.submenu = submenu;
509
- this.submenu.anchor = this;
510
- this.submenu.placement = "right-start";
511
- this.submenu.collapseExpandedItem = () => this.#collapseExpandedItem();
180
+ get submenu() {
181
+ if (this.slottedSubmenu?.length) {
182
+ return this.slottedSubmenu[0];
183
+ } else {
184
+ return null;
512
185
  }
513
- this.hasSubmenu = this.submenu === void 0 ? false : true;
186
+ }
187
+ /**
188
+ * @internal
189
+ */
190
+ get hasSubmenu() {
191
+ return this.submenu !== null;
514
192
  }
515
193
  #collapseExpandedItem() {
516
194
  this.expanded = false;
517
195
  }
518
196
  #expandedChange() {
519
- if (this.hasSubmenu) {
197
+ if (this.submenu) {
520
198
  this.submenu.open = this.expanded;
521
199
  }
522
200
  }
@@ -545,18 +223,38 @@ __decorateClass([
545
223
  __decorateClass([
546
224
  attr
547
225
  ], MenuItem.prototype, "role");
548
- __decorateClass([
549
- attr({ mode: "boolean" })
550
- ], MenuItem.prototype, "checked");
551
226
  __decorateClass([
552
227
  observable
553
- ], MenuItem.prototype, "hasSubmenu");
228
+ ], MenuItem.prototype, "_isPresentational");
554
229
  __decorateClass([
555
- observable
556
- ], MenuItem.prototype, "currentDirection");
230
+ replaces({
231
+ deprecatedPropertyName: "role",
232
+ fromDeprecated: (role) => {
233
+ switch (role) {
234
+ case "menuitemcheckbox":
235
+ return "checkbox";
236
+ case "menuitemradio":
237
+ return "radio";
238
+ default:
239
+ return void 0;
240
+ }
241
+ },
242
+ toDeprecated: (controlType) => {
243
+ switch (controlType) {
244
+ case "checkbox":
245
+ return "menuitemcheckbox";
246
+ case "radio":
247
+ return "menuitemradio";
248
+ default:
249
+ return "menuitem";
250
+ }
251
+ }
252
+ }),
253
+ attr({ attribute: "control-type" })
254
+ ], MenuItem.prototype, "controlType");
557
255
  __decorateClass([
558
- observable
559
- ], MenuItem.prototype, "submenu");
256
+ attr({ mode: "boolean" })
257
+ ], MenuItem.prototype, "checked");
560
258
  __decorateClass([
561
259
  attr
562
260
  ], MenuItem.prototype, "text");
@@ -582,19 +280,21 @@ __decorateClass([
582
280
  observable
583
281
  ], MenuItem.prototype, "slottedSubmenu");
584
282
 
283
+ const menuName = "menu";
284
+
585
285
  const getIndicatorIcon = (x) => {
586
286
  if (x.checkedAppearance === "tick-only") {
587
287
  return x.checked ? "check-line" : "";
588
288
  }
589
- const iconType = x.role === MenuItemRole.menuitemcheckbox ? "checkbox" : "radio";
289
+ const iconType = x.controlType === "checkbox" ? "checkbox" : "radio";
590
290
  const iconStatus = x.checked ? "checked" : "unchecked";
591
291
  return `${iconType}-${iconStatus}-2-line`;
592
292
  };
593
- const getClasses$1 = ({
293
+ const getClasses = ({
594
294
  connotation,
595
295
  disabled,
596
296
  checked,
597
- role,
297
+ controlType,
598
298
  text: text2,
599
299
  textSecondary,
600
300
  icon,
@@ -604,27 +304,17 @@ const getClasses$1 = ({
604
304
  "base",
605
305
  [`connotation-${connotation}`, Boolean(connotation)],
606
306
  ["disabled", Boolean(disabled)],
607
- ["selected", role !== MenuItemRole.menuitem && Boolean(checked)],
608
- [
609
- "trailing",
610
- role !== MenuItemRole.menuitem && (checkTrailing || Boolean(icon))
611
- ],
612
- ["item-checkbox", role === MenuItemRole.menuitemcheckbox],
613
- ["item-radio", role === MenuItemRole.menuitemradio],
307
+ ["selected", Boolean(controlType && checked)],
308
+ ["trailing", Boolean(controlType && (checkTrailing || Boolean(icon)))],
309
+ ["item-checkbox", controlType === "checkbox"],
310
+ ["item-radio", controlType === "radio"],
614
311
  ["two-lines", Boolean(text2?.length) && Boolean(textSecondary?.length)],
615
312
  ["has-meta", Boolean(metaSlottedContent?.length)]
616
313
  );
617
- function handleClick(x, { event }) {
618
- if (x._isSyntheticClickEvent(event)) {
619
- return true;
620
- }
621
- x.handleMenuItemClick(event);
622
- return x.role === MenuItemRole.presentation;
623
- }
624
314
  function checkIndicator(context) {
625
315
  const iconTag = context.tagFor(Icon);
626
316
  return html`${when(
627
- (x) => x.role === MenuItemRole.menuitemcheckbox || x.role === MenuItemRole.menuitemradio,
317
+ (x) => Boolean(x.controlType),
628
318
  html`<span class="action"><${iconTag} class="icon" name="${(x) => getIndicatorIcon(x)}"></${iconTag}></span>`
629
319
  )}`;
630
320
  }
@@ -651,16 +341,16 @@ const MenuItemTemplate = (context) => {
651
341
  ${applyHostSemantics({
652
342
  role: MenuItemRole.menuitem,
653
343
  ariaHasPopup: (x) => x.hasSubmenu ? "menu" : void 0,
654
- ariaChecked: (x) => x.role !== MenuItemRole.menuitem ? x.checked : void 0,
344
+ ariaChecked: (x) => x.controlType ? x.checked : void 0,
655
345
  ariaDisabled: (x) => x.disabled,
656
346
  ariaExpanded: (x) => x.expanded
657
347
  })}
658
348
  @keydown="${(x, c) => x.handleMenuItemKeyDown(c.event)}"
659
- @click="${handleClick}"
349
+ @click="${(x, c) => x.handleMenuItemClick(c.event)}"
660
350
  @mouseover="${(x, c) => x.handleMouseOver(c.event)}"
661
351
  @mouseout="${(x, c) => x.handleMouseOut(c.event)}"
662
352
  >
663
- <div class="${getClasses$1}">
353
+ <div class="${getClasses}">
664
354
  <slot name="meta" ${slotted("metaSlottedContent")}></slot>
665
355
  ${checkIndicator(context)}
666
356
  ${when(
@@ -695,83 +385,10 @@ const menuItemDefinition = defineVividComponent(
695
385
  MenuItem,
696
386
  MenuItemTemplate,
697
387
  [iconDefinition],
698
- {
699
- styles: styles$1
700
- }
701
- );
702
- const registerMenuItem = createRegisterFunction(menuItemDefinition);
703
-
704
- 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);min-inline-size:var(--menu-min-inline-size);padding-block:8px}@media not all and (width >= 600px){.base{max-inline-size:var(--menu-max-inline-size, 300px)}}@media (width >= 600px){.base{max-inline-size:var(--menu-max-inline-size)}}::slotted(a){color:var(--vvd-color-canvas-text);text-decoration:none}::slotted(a[role=menuitem]:focus-visible){box-shadow:0 0 0 4px color-mix(in srgb,var(--vvd-color-cta-500),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px));--focus-stroke-gap-color: transparent;display:block}.header{padding-block-start:4px;padding-inline:12px}.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-block-end:4px;padding-inline:12px}.hide-actions .action-items{display:none}";
705
-
706
- const getClasses = ({
707
- headerSlottedContent,
708
- actionItemsSlottedContent,
709
- items
710
- }) => classNames(
711
- "base",
712
- ["hide-header", !headerSlottedContent?.length],
713
- ["hide-actions", !actionItemsSlottedContent?.length],
714
- ["hide-body", items && !items.length]
715
- );
716
- function handleEscapeKey(menu, event) {
717
- if (menu.open && handleEscapeKeyAndStopPropogation(event)) {
718
- menu.open = false;
719
- }
720
- return true;
721
- }
722
- const MenuTemplate = (context) => {
723
- const popupTag = context.tagFor(Popup);
724
- const anchorSlotTemplate = anchorSlotTemplateFactory();
725
- function handlePopupEvents(x, e, state) {
726
- e.stopPropagation();
727
- x.open = state;
728
- }
729
- return html`
730
- <template @change="${(x, c) => x._onChange(c.event)}"
731
- @focusout="${(x, c) => x._onFocusout(c.event)}">
732
- ${anchorSlotTemplate}
733
- <${popupTag}
734
- ${ref("_popupEl")}
735
- :placement=${(x) => x.placement}
736
- :open=${(x) => x.open}
737
- :anchor=${(x) => x._anchorEl}
738
- :strategy="${(x) => x.positionStrategy}"
739
- @keydown="${(x, c) => handleEscapeKey(x, c.event)}"
740
- @vwc-popup:open="${(x, c) => handlePopupEvents(x, c.event, true)}"
741
- @vwc-popup:close="${(x, c) => handlePopupEvents(x, c.event, false)}"
742
- >
743
- <div class="${getClasses}">
744
- <div class="header">
745
- <slot name="header" ${slotted("headerSlottedContent")}></slot>
746
- </div>
747
- <div
748
- class="body"
749
- ${delegateAria({
750
- role: "menu"
751
- })}
752
- @keydown="${(x, c) => x.handleMenuKeyDown(c.event)}"
753
- @focusout="${(x, c) => x.handleFocusOut(c.event)}"
754
- >
755
- <slot ${slotted("items")}></slot>
756
- </div>
757
- <footer class="action-items"><slot name="action-items" ${slotted(
758
- "actionItemsSlottedContent"
759
- )}></slot></footer>
760
- </div>
761
- </${popupTag}>
762
- </template>`;
763
- };
764
-
765
- const menuName = "menu";
766
- const menuDefinition = defineVividComponent(
767
- menuName,
768
- Menu,
769
- MenuTemplate,
770
- [popupDefinition, menuItemDefinition],
771
388
  {
772
389
  styles
773
390
  }
774
391
  );
775
- const registerMenu = createRegisterFunction(menuDefinition);
392
+ const registerMenuItem = createRegisterFunction(menuItemDefinition);
776
393
 
777
- export { MenuItem as M, MenuItemRole as a, menuName as b, menuDefinition as c, registerMenu as d, Menu as e, menuItemDefinition as m, registerMenuItem as r };
394
+ export { MenuItem as M, MenuItemRole as a, menuName as b, menuItemDefinition as m, registerMenuItem as r };