@vonage/vivid 3.32.0 → 3.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (218) hide show
  1. package/accordion/index.js +5 -5
  2. package/accordion-item/index.js +4 -4
  3. package/action-group/index.js +1 -1
  4. package/alert/index.js +6 -6
  5. package/avatar/index.js +2 -2
  6. package/badge/index.js +2 -2
  7. package/banner/index.js +5 -5
  8. package/breadcrumb/index.js +1 -1
  9. package/breadcrumb-item/index.js +3 -3
  10. package/button/index.js +4 -4
  11. package/calendar/index.js +1 -1
  12. package/calendar-event/index.js +1 -1
  13. package/card/index.js +3 -3
  14. package/checkbox/index.js +5 -3
  15. package/combobox/index.js +8 -8
  16. package/custom-elements.json +246 -16
  17. package/data-grid/index.js +2 -2
  18. package/date-picker/index.js +9 -9
  19. package/dialog/index.js +6 -6
  20. package/divider/index.js +1 -1
  21. package/elevation/index.js +1 -1
  22. package/empty-state/index.js +2 -2
  23. package/fab/index.js +4 -4
  24. package/file-picker/index.js +5 -5
  25. package/focus/index.js +1 -1
  26. package/header/index.js +2 -2
  27. package/icon/index.js +1 -1
  28. package/index.js +59 -59
  29. package/layout/index.js +1 -1
  30. package/lib/calendar/calendar.d.ts +1 -1
  31. package/lib/date-picker/calendar/dateStr.d.ts +1 -0
  32. package/lib/date-picker/calendar/month.d.ts +1 -0
  33. package/lib/date-picker/calendar/year.d.ts +2 -0
  34. package/lib/date-picker/date-picker.d.ts +2 -0
  35. package/lib/icon/icon.d.ts +0 -1
  36. package/lib/listbox/listbox.d.ts +9 -1
  37. package/lib/text-field/text-field.d.ts +1 -0
  38. package/listbox/index.js +20 -16
  39. package/locales/en-GB.js +48 -14
  40. package/locales/en-US.js +48 -14
  41. package/locales/ja-JP.js +48 -14
  42. package/locales/zh-CN.js +48 -14
  43. package/menu/index.js +8 -8
  44. package/menu-item/index.js +4 -4
  45. package/nav/index.js +1 -1
  46. package/nav-disclosure/index.js +3 -3
  47. package/nav-item/index.js +3 -3
  48. package/note/index.js +2 -3
  49. package/number-field/index.js +6 -6
  50. package/option/index.js +3 -3
  51. package/package.json +2 -16
  52. package/pagination/index.js +5 -5
  53. package/popup/index.js +6 -6
  54. package/progress/index.js +1 -1
  55. package/progress-ring/index.js +1 -1
  56. package/radio/index.js +2 -2
  57. package/radio-group/index.js +1 -1
  58. package/select/index.js +8 -8
  59. package/shared/affix.js +25 -9
  60. package/shared/apply-mixins.js +1 -1
  61. package/shared/breadcrumb-item.js +5 -5
  62. package/shared/button.js +13 -13
  63. package/shared/calendar-event.js +36 -16
  64. package/shared/definition.js +133 -194
  65. package/shared/definition10.js +225 -40
  66. package/shared/definition11.js +36 -32
  67. package/shared/definition12.js +763 -98
  68. package/shared/definition13.js +125 -89
  69. package/shared/definition14.js +207 -27
  70. package/shared/definition15.js +710 -731
  71. package/shared/definition16.js +1289 -47
  72. package/shared/definition17.js +6113 -93
  73. package/shared/definition18.js +242 -164
  74. package/shared/definition19.js +47 -692
  75. package/shared/definition2.js +199 -117
  76. package/shared/definition20.js +59 -1671
  77. package/shared/definition21.js +95 -255
  78. package/shared/definition22.js +2218 -1167
  79. package/shared/definition23.js +61 -5784
  80. package/shared/definition24.js +28 -117
  81. package/shared/definition25.js +52 -66
  82. package/shared/definition26.js +391 -214
  83. package/shared/definition27.js +441 -34
  84. package/shared/definition28.js +85 -73
  85. package/shared/definition29.js +21 -2283
  86. package/shared/definition3.js +61 -24
  87. package/shared/definition30.js +13 -49
  88. package/shared/definition31.js +54 -39
  89. package/shared/definition32.js +413 -375
  90. package/shared/definition33.js +223 -304
  91. package/shared/definition34.js +197 -13
  92. package/shared/definition35.js +88 -73
  93. package/shared/definition36.js +75 -25
  94. package/shared/definition37.js +434 -34
  95. package/shared/definition38.js +32 -432
  96. package/shared/definition39.js +677 -187
  97. package/shared/definition4.js +157 -12
  98. package/shared/definition40.js +95 -48
  99. package/shared/definition41.js +577 -31
  100. package/shared/definition42.js +126 -424
  101. package/shared/definition43.js +114 -618
  102. package/shared/definition44.js +24 -80
  103. package/shared/definition45.js +71 -543
  104. package/shared/definition46.js +499 -92
  105. package/shared/definition47.js +19 -133
  106. package/shared/definition48.js +129 -52
  107. package/shared/definition49.js +281 -17
  108. package/shared/definition5.js +71 -36
  109. package/shared/definition50.js +153 -484
  110. package/shared/definition51.js +131 -98
  111. package/shared/definition52.js +131 -16
  112. package/shared/definition53.js +80 -264
  113. package/shared/definition54.js +293 -118
  114. package/shared/definition55.js +12 -117
  115. package/shared/definition56.js +39 -68
  116. package/shared/definition57.js +166 -288
  117. package/shared/definition6.js +56 -111
  118. package/shared/definition7.js +120 -195
  119. package/shared/definition8.js +58 -23
  120. package/shared/definition9.js +92 -66
  121. package/shared/focus.js +2 -1
  122. package/shared/focus2.js +1 -1
  123. package/shared/form-associated.js +2 -2
  124. package/shared/icon.js +48 -27
  125. package/shared/index.js +7 -27
  126. package/shared/index2.js +108 -80
  127. package/shared/key-codes.js +1 -1
  128. package/shared/listbox.js +88 -11
  129. package/shared/patterns/form-elements/form-elements.d.ts +4 -4
  130. package/shared/radio.js +23 -7
  131. package/shared/repeat.js +1 -1
  132. package/shared/text-anchor.js +21 -4
  133. package/shared/text-anchor.template.js +37 -40
  134. package/shared/text-field.js +2 -2
  135. package/shared/text-field2.js +15 -15
  136. package/shared/tree-item.js +12 -12
  137. package/side-drawer/index.js +1 -1
  138. package/slider/index.js +2 -2
  139. package/split-button/index.js +3 -3
  140. package/style.css +6097 -0
  141. package/styles/core/all.css +1 -1
  142. package/styles/core/theme.css +1 -1
  143. package/styles/core/typography.css +1 -1
  144. package/styles/tokens/theme-dark.css +4 -4
  145. package/styles/tokens/theme-light.css +4 -4
  146. package/styles/tokens/vivid-2-compat.css +1 -1
  147. package/switch/index.js +3 -3
  148. package/tab/index.js +3 -3
  149. package/tab-panel/index.js +1 -1
  150. package/tabs/index.js +5 -5
  151. package/tag/index.js +3 -3
  152. package/tag-group/index.js +1 -1
  153. package/text-anchor/index.js +1 -1
  154. package/text-area/index.js +3 -3
  155. package/text-field/index.js +3 -3
  156. package/toggletip/index.js +7 -7
  157. package/tooltip/index.js +7 -7
  158. package/tree-item/index.js +3 -3
  159. package/tree-view/index.js +1 -1
  160. package/lib/accordion/index.d.ts +0 -1
  161. package/lib/accordion-item/index.d.ts +0 -1
  162. package/lib/action-group/index.d.ts +0 -1
  163. package/lib/alert/index.d.ts +0 -1
  164. package/lib/avatar/index.d.ts +0 -1
  165. package/lib/badge/index.d.ts +0 -1
  166. package/lib/banner/index.d.ts +0 -1
  167. package/lib/breadcrumb/index.d.ts +0 -1
  168. package/lib/breadcrumb-item/index.d.ts +0 -1
  169. package/lib/button/index.d.ts +0 -1
  170. package/lib/calendar/index.d.ts +0 -1
  171. package/lib/calendar-event/index.d.ts +0 -1
  172. package/lib/card/index.d.ts +0 -1
  173. package/lib/checkbox/index.d.ts +0 -1
  174. package/lib/combobox/index.d.ts +0 -1
  175. package/lib/data-grid/index.d.ts +0 -1
  176. package/lib/date-picker/index.d.ts +0 -1
  177. package/lib/dialog/index.d.ts +0 -1
  178. package/lib/divider/index.d.ts +0 -1
  179. package/lib/elevation/index.d.ts +0 -1
  180. package/lib/empty-state/index.d.ts +0 -1
  181. package/lib/fab/index.d.ts +0 -1
  182. package/lib/file-picker/index.d.ts +0 -1
  183. package/lib/focus/index.d.ts +0 -1
  184. package/lib/header/index.d.ts +0 -1
  185. package/lib/icon/index.d.ts +0 -1
  186. package/lib/layout/index.d.ts +0 -1
  187. package/lib/listbox/index.d.ts +0 -1
  188. package/lib/menu/index.d.ts +0 -1
  189. package/lib/menu-item/index.d.ts +0 -1
  190. package/lib/nav/index.d.ts +0 -1
  191. package/lib/nav-disclosure/index.d.ts +0 -1
  192. package/lib/nav-item/index.d.ts +0 -1
  193. package/lib/note/index.d.ts +0 -1
  194. package/lib/number-field/index.d.ts +0 -1
  195. package/lib/option/index.d.ts +0 -1
  196. package/lib/pagination/index.d.ts +0 -1
  197. package/lib/popup/index.d.ts +0 -1
  198. package/lib/progress/index.d.ts +0 -1
  199. package/lib/progress-ring/index.d.ts +0 -1
  200. package/lib/radio/index.d.ts +0 -1
  201. package/lib/radio-group/index.d.ts +0 -1
  202. package/lib/select/index.d.ts +0 -1
  203. package/lib/side-drawer/index.d.ts +0 -1
  204. package/lib/slider/index.d.ts +0 -1
  205. package/lib/split-button/index.d.ts +0 -1
  206. package/lib/switch/index.d.ts +0 -1
  207. package/lib/tab/index.d.ts +0 -1
  208. package/lib/tab-panel/index.d.ts +0 -1
  209. package/lib/tabs/index.d.ts +0 -1
  210. package/lib/tag/index.d.ts +0 -1
  211. package/lib/tag-group/index.d.ts +0 -1
  212. package/lib/text-anchor/index.d.ts +0 -1
  213. package/lib/text-area/index.d.ts +0 -1
  214. package/lib/text-field/index.d.ts +0 -1
  215. package/lib/toggletip/index.d.ts +0 -1
  216. package/lib/tooltip/index.d.ts +0 -1
  217. package/lib/tree-item/index.d.ts +0 -1
  218. package/lib/tree-view/index.d.ts +0 -1
@@ -1,233 +1,410 @@
1
- import { F as FoundationElement, d as __classPrivateFieldGet, _ as __decorate, a as attr, b as __metadata, o as observable, f as __classPrivateFieldSet, h as html, r as registerFactory } from './index.js';
2
- import { i as iconRegistries } from './definition3.js';
3
- import { B as Button, b as buttonRegistries } from './definition7.js';
4
- import { E as Elevation, e as elevationRegistries } from './definition8.js';
5
- import { I as Icon } from './icon.js';
1
+ import { F as FoundationElement, D as DOM, _ as __decorate, a as attr, o as observable, h as html, r as registerFactory } from './index.js';
2
+ import { a as iconRegistries } from './definition24.js';
3
+ import { f as focusRegistries } from './definition55.js';
4
+ import { A as AffixIcon, a as affixIconTemplateFactory } from './affix.js';
5
+ import { a as applyMixins } from './apply-mixins.js';
6
+ import { S as StartEnd } from './start-end.js';
7
+ import { D as Direction, g as getDirection } from './direction.js';
8
+ import { i as keyArrowLeft, h as keyArrowRight, a as keySpace, k as keyEnter } from './key-codes.js';
9
+ import { f as focusTemplateFactory } from './focus2.js';
6
10
  import { w as when } from './when.js';
7
11
  import { s as slotted } from './slotted.js';
8
12
  import { c as classNames } from './class-names.js';
9
13
 
10
- var css_248z$1 = "dialog {\n position: absolute;\n left: 0; right: 0;\n width: -moz-fit-content;\n width: -webkit-fit-content;\n width: fit-content;\n height: -moz-fit-content;\n height: -webkit-fit-content;\n height: fit-content;\n margin: auto;\n border: solid;\n padding: 1em;\n background: white;\n color: black;\n display: block;\n}\n\ndialog:not([open]) {\n display: none;\n}\n\ndialog + .backdrop {\n position: fixed;\n top: 0; right: 0; bottom: 0; left: 0;\n background: rgba(0,0,0,0.1);\n}\n\n._dialog_overlay {\n position: fixed;\n top: 0; right: 0; bottom: 0; left: 0;\n}\n\ndialog.fixed {\n position: fixed;\n top: 50%;\n transform: translate(0, -50%);\n}";
11
-
12
- var css_248z = "/**\n * Do not edit directly\n * Generated on Tue, 22 Aug 2023 13:37:39 GMT\n */\n.base {\n box-sizing: border-box;\n padding: 0;\n border: none;\n background-color: transparent;\n border-radius: 6px;\n color: var(--vvd-color-canvas-text);\n max-block-size: var(--dialog-max-block-size, calc(100vh - 64px));\n max-inline-size: var(--dialog-max-inline-size, var(--_dialog-default-max-inline-size));\n min-inline-size: var(--dialog-min-inline-size, 280px);\n}\n@media not all and (min-width: 600px) {\n .base {\n --_dialog-default-max-inline-size: 90vw;\n }\n}\n@media (min-width: 600px) {\n .base {\n --_dialog-default-max-inline-size: 560px;\n }\n}\n.base:not(.modal) {\n z-index: var(--dialog-z-index, 1);\n}\n.base.modal {\n position: fixed;\n box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);\n}\n.base.modal::backdrop {\n background-color: var(--vvd-color-canvas-text, currentColor);\n opacity: 0.5;\n}\n\n.main-wrapper {\n display: flex;\n box-sizing: border-box;\n flex-direction: column;\n gap: 24px;\n padding-block: 24px;\n}\n.main-wrapper > * {\n box-sizing: border-box;\n}\n\n.header {\n display: grid;\n align-items: flex-start;\n justify-content: space-between;\n inline-size: 100%;\n padding-inline: 24px;\n}\n.base:not(.icon-placement-side) .header {\n grid-template-columns: 1fr auto;\n grid-template-rows: auto auto auto;\n}\n.base:not(.icon-placement-side) .header .icon {\n font-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 8));\n grid-column: 1/2;\n grid-row: 1/2;\n line-height: 1;\n margin-block-end: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 16));\n}\n.base.icon-placement-side .header {\n grid-template-columns: auto 1fr auto;\n grid-template-rows: auto auto;\n}\n.base.icon-placement-side .header .icon {\n font-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 12));\n}\n.base.icon-placement-side .header ::slotted(*),\n.base.icon-placement-side .header .icon {\n grid-column: 1/2;\n grid-row: 1/-1;\n margin-inline-end: calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 8)) / 2);\n}\n.header.border {\n position: relative;\n}\n.header.border::after {\n position: absolute;\n bottom: -24px;\n left: 0;\n background-color: var(--vvd-color-neutral-200);\n block-size: 1px;\n content: \"\";\n inline-size: 100%;\n}\n.base.hide-body .header.border::after {\n content: none;\n}\n\n.body:not(.full-width) {\n padding-inline: 24px;\n}\n.hide-body .body {\n display: none;\n}\n\n.footer {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 24px;\n padding-inline: 24px;\n}\n.hide-footer .footer {\n display: none;\n}\n.footer .actions {\n display: flex;\n align-self: flex-end;\n gap: 8px;\n}\n\n.dismiss-button {\n flex-shrink: 0;\n grid-column: -2/-1;\n grid-row: 1/-1;\n margin-block-start: -8px;\n margin-inline-end: -8px;\n margin-inline-start: 4px;\n}\n\n.headline {\n font: var(--vvd-typography-heading-4);\n}\n\n.subtitle {\n font: var(--vvd-typography-base);\n}\n\nslot[name=main] {\n display: block;\n overflow: hidden auto;\n max-width: inherit;\n max-height: inherit;\n border-radius: inherit;\n}";
14
+ /**
15
+ * Menu items roles.
16
+ * @public
17
+ */
18
+ const MenuItemRole$1 = {
19
+ /**
20
+ * The menu item has a "menuitem" role
21
+ */
22
+ menuitem: "menuitem",
23
+ /**
24
+ * The menu item has a "menuitemcheckbox" role
25
+ */
26
+ menuitemcheckbox: "menuitemcheckbox",
27
+ /**
28
+ * The menu item has a "menuitemradio" role
29
+ */
30
+ menuitemradio: "menuitemradio",
31
+ };
32
+ /**
33
+ * @internal
34
+ */
35
+ const roleForMenuItem = {
36
+ [MenuItemRole$1.menuitem]: "menuitem",
37
+ [MenuItemRole$1.menuitemcheckbox]: "menuitemcheckbox",
38
+ [MenuItemRole$1.menuitemradio]: "menuitemradio",
39
+ };
13
40
 
14
- var _Dialog_instances, _Dialog_modal, _Dialog_dialogElement, _Dialog_dialog_get, _Dialog_handleScrimClick, _Dialog_handleInternalFormSubmit, _Dialog_handleModal;
15
- const isDialogSupported = Boolean(HTMLDialogElement && HTMLDialogElement.prototype.showModal);
16
- let dialogPolyfill;
17
- (async () => {
18
- if (!isDialogSupported) {
19
- delete window.HTMLDialogElement;
20
- dialogPolyfill = await import('./dialog-polyfill.esm.js');
21
- }
22
- })();
23
- class Dialog extends FoundationElement {
24
- constructor() {
25
- super(...arguments);
26
- _Dialog_instances.add(this);
27
- this.open = false;
28
- this.fullWidthBody = false;
29
- this.ariaLabelledBy = null;
30
- this.ariaLabel = null;
31
- this.ariaDescribedBy = null;
32
- _Dialog_modal.set(this, false);
33
- _Dialog_dialogElement.set(this, void 0);
34
- _Dialog_handleScrimClick.set(this, event => {
35
- if (event.target !== __classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get)) {
36
- return;
37
- }
38
- const rect = __classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get).getBoundingClientRect();
39
- const clickedInDialog = rect.top <= event.clientY && event.clientY <= rect.top + rect.height && rect.left <= event.clientX && event.clientX <= rect.left + rect.width;
40
- this.open = clickedInDialog;
41
- });
42
- _Dialog_handleInternalFormSubmit.set(this, event => {
43
- if (event.target.method !== 'dialog') {
44
- return;
45
- }
46
- this.open = false;
47
- });
48
- }
49
- set returnValue(value) {
50
- __classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get).returnValue = value;
51
- }
52
- get returnValue() {
53
- var _a;
54
- return (_a = __classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get)) === null || _a === void 0 ? void 0 : _a.returnValue;
55
- }
56
- get modal() {
57
- return __classPrivateFieldGet(this, _Dialog_modal, "f");
58
- }
59
- openChanged(oldValue, newValue) {
60
- if (oldValue === undefined) {
61
- return;
41
+ /**
42
+ * A Switch Custom HTML Element.
43
+ * Implements {@link https://www.w3.org/TR/wai-aria-1.1/#menuitem | ARIA menuitem }, {@link https://www.w3.org/TR/wai-aria-1.1/#menuitemcheckbox | ARIA menuitemcheckbox}, or {@link https://www.w3.org/TR/wai-aria-1.1/#menuitemradio | ARIA menuitemradio }.
44
+ *
45
+ * @slot checked-indicator - The checked indicator
46
+ * @slot radio-indicator - The radio indicator
47
+ * @slot start - Content which can be provided before the menu item content
48
+ * @slot end - Content which can be provided after the menu item content
49
+ * @slot - The default slot for menu item content
50
+ * @slot expand-collapse-indicator - The expand/collapse indicator
51
+ * @slot submenu - Used to nest menu's within menu items
52
+ * @csspart input-container - The element representing the visual checked or radio indicator
53
+ * @csspart checkbox - The element wrapping the `menuitemcheckbox` indicator
54
+ * @csspart radio - The element wrapping the `menuitemradio` indicator
55
+ * @csspart content - The element wrapping the menu item content
56
+ * @csspart expand-collapse-glyph-container - The element wrapping the expand collapse element
57
+ * @csspart expand-collapse - The expand/collapse element
58
+ * @csspart submenu-region - The container for the submenu, used for positioning
59
+ * @fires expanded-change - Fires a custom 'expanded-change' event when the expanded state changes
60
+ * @fires change - Fires a custom 'change' event when a non-submenu item with a role of `menuitemcheckbox`, `menuitemradio`, or `menuitem` is invoked
61
+ *
62
+ * @public
63
+ */
64
+ let MenuItem$1 = class MenuItem extends FoundationElement {
65
+ constructor() {
66
+ super(...arguments);
67
+ /**
68
+ * The role of the element.
69
+ *
70
+ * @public
71
+ * @remarks
72
+ * HTML Attribute: role
73
+ */
74
+ this.role = MenuItemRole$1.menuitem;
75
+ /**
76
+ * @internal
77
+ */
78
+ this.hasSubmenu = false;
79
+ /**
80
+ * Track current direction to pass to the anchored region
81
+ *
82
+ * @internal
83
+ */
84
+ this.currentDirection = Direction.ltr;
85
+ this.focusSubmenuOnLoad = false;
86
+ /**
87
+ * @internal
88
+ */
89
+ this.handleMenuItemKeyDown = (e) => {
90
+ if (e.defaultPrevented) {
91
+ return false;
92
+ }
93
+ switch (e.key) {
94
+ case keyEnter:
95
+ case keySpace:
96
+ this.invoke();
97
+ return false;
98
+ case keyArrowRight:
99
+ //open/focus on submenu
100
+ this.expandAndFocus();
101
+ return false;
102
+ case keyArrowLeft:
103
+ //close submenu
104
+ if (this.expanded) {
105
+ this.expanded = false;
106
+ this.focus();
107
+ return false;
108
+ }
109
+ }
110
+ return true;
111
+ };
112
+ /**
113
+ * @internal
114
+ */
115
+ this.handleMenuItemClick = (e) => {
116
+ if (e.defaultPrevented || this.disabled) {
117
+ return false;
118
+ }
119
+ this.invoke();
120
+ return false;
121
+ };
122
+ /**
123
+ * @internal
124
+ */
125
+ this.submenuLoaded = () => {
126
+ if (!this.focusSubmenuOnLoad) {
127
+ return;
128
+ }
129
+ this.focusSubmenuOnLoad = false;
130
+ if (this.hasSubmenu) {
131
+ this.submenu.focus();
132
+ this.setAttribute("tabindex", "-1");
133
+ }
134
+ };
135
+ /**
136
+ * @internal
137
+ */
138
+ this.handleMouseOver = (e) => {
139
+ if (this.disabled || !this.hasSubmenu || this.expanded) {
140
+ return false;
141
+ }
142
+ this.expanded = true;
143
+ return false;
144
+ };
145
+ /**
146
+ * @internal
147
+ */
148
+ this.handleMouseOut = (e) => {
149
+ if (!this.expanded || this.contains(document.activeElement)) {
150
+ return false;
151
+ }
152
+ this.expanded = false;
153
+ return false;
154
+ };
155
+ /**
156
+ * @internal
157
+ */
158
+ this.expandAndFocus = () => {
159
+ if (!this.hasSubmenu) {
160
+ return;
161
+ }
162
+ this.focusSubmenuOnLoad = true;
163
+ this.expanded = true;
164
+ };
165
+ /**
166
+ * @internal
167
+ */
168
+ this.invoke = () => {
169
+ if (this.disabled) {
170
+ return;
171
+ }
172
+ switch (this.role) {
173
+ case MenuItemRole$1.menuitemcheckbox:
174
+ this.checked = !this.checked;
175
+ break;
176
+ case MenuItemRole$1.menuitem:
177
+ // update submenu
178
+ this.updateSubmenu();
179
+ if (this.hasSubmenu) {
180
+ this.expandAndFocus();
181
+ }
182
+ else {
183
+ this.$emit("change");
184
+ }
185
+ break;
186
+ case MenuItemRole$1.menuitemradio:
187
+ if (!this.checked) {
188
+ this.checked = true;
189
+ }
190
+ break;
191
+ }
192
+ };
193
+ /**
194
+ * Gets the submenu element if any
195
+ *
196
+ * @internal
197
+ */
198
+ this.updateSubmenu = () => {
199
+ this.submenu = this.domChildren().find((element) => {
200
+ return element.getAttribute("role") === "menu";
201
+ });
202
+ this.hasSubmenu = this.submenu === undefined ? false : true;
203
+ };
62
204
  }
63
- if (!newValue) {
64
- this.close();
65
- } else {
66
- if (__classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get)) {
67
- __classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get).open = true;
68
- }
205
+ expandedChanged(oldValue) {
206
+ if (this.$fastController.isConnected) {
207
+ if (this.submenu === undefined) {
208
+ return;
209
+ }
210
+ if (this.expanded === false) {
211
+ this.submenu.collapseExpandedItem();
212
+ }
213
+ else {
214
+ this.currentDirection = getDirection(this);
215
+ }
216
+ this.$emit("expanded-change", this, { bubbles: false });
217
+ }
69
218
  }
70
- }
71
- close() {
72
- if (__classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get).open) {
73
- __classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get).close();
74
- this.$emit('close', this.returnValue, {
75
- bubbles: false
76
- });
219
+ checkedChanged(oldValue, newValue) {
220
+ if (this.$fastController.isConnected) {
221
+ this.$emit("change");
222
+ }
77
223
  }
78
- this.open = false;
79
- __classPrivateFieldGet(this, _Dialog_instances, "m", _Dialog_handleModal).call(this, false);
80
- }
81
- show() {
82
- __classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get).show();
83
- this.open = true;
84
- }
85
- showModal() {
86
- __classPrivateFieldGet(this, _Dialog_instances, "m", _Dialog_handleModal).call(this, true);
87
- __classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get).showModal();
88
- this.open = true;
89
- }
90
- connectedCallback() {
91
- super.connectedCallback();
92
- __classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get).addEventListener('click', __classPrivateFieldGet(this, _Dialog_handleScrimClick, "f"));
93
- __classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get).addEventListener('submit', __classPrivateFieldGet(this, _Dialog_handleInternalFormSubmit, "f"));
94
- }
95
- disconnectedCallback() {
96
- super.disconnectedCallback();
97
- __classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get).removeEventListener('click', __classPrivateFieldGet(this, _Dialog_handleScrimClick, "f"));
98
- __classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get).removeEventListener('submit', __classPrivateFieldGet(this, _Dialog_handleInternalFormSubmit, "f"));
99
- }
100
- }
101
- _Dialog_modal = new WeakMap(), _Dialog_dialogElement = new WeakMap(), _Dialog_handleScrimClick = new WeakMap(), _Dialog_handleInternalFormSubmit = new WeakMap(), _Dialog_instances = new WeakSet(), _Dialog_dialog_get = function _Dialog_dialog_get() {
102
- if (!__classPrivateFieldGet(this, _Dialog_dialogElement, "f")) {
103
- __classPrivateFieldSet(this, _Dialog_dialogElement, this.shadowRoot.querySelector('dialog'), "f");
104
- if (__classPrivateFieldGet(this, _Dialog_dialogElement, "f")) {
105
- __classPrivateFieldGet(this, _Dialog_dialogElement, "f").open = this.open;
106
- if (dialogPolyfill) {
107
- dialogPolyfill.registerDialog(__classPrivateFieldGet(this, _Dialog_dialogElement, "f"));
108
- }
224
+ /**
225
+ * @internal
226
+ */
227
+ connectedCallback() {
228
+ super.connectedCallback();
229
+ DOM.queueUpdate(() => {
230
+ this.updateSubmenu();
231
+ });
232
+ if (!this.startColumnCount) {
233
+ this.startColumnCount = 1;
234
+ }
235
+ this.observer = new MutationObserver(this.updateSubmenu);
236
+ }
237
+ /**
238
+ * @internal
239
+ */
240
+ disconnectedCallback() {
241
+ super.disconnectedCallback();
242
+ this.submenu = undefined;
243
+ if (this.observer !== undefined) {
244
+ this.observer.disconnect();
245
+ this.observer = undefined;
246
+ }
247
+ }
248
+ /**
249
+ * get an array of valid DOM children
250
+ */
251
+ domChildren() {
252
+ return Array.from(this.children).filter(child => !child.hasAttribute("hidden"));
109
253
  }
110
- }
111
- return __classPrivateFieldGet(this, _Dialog_dialogElement, "f");
112
- }, _Dialog_handleModal = function _Dialog_handleModal(show) {
113
- __classPrivateFieldSet(this, _Dialog_modal, show, "f");
114
- __classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get).toggleAttribute('aria-modal', show);
115
- __classPrivateFieldGet(this, _Dialog_instances, "a", _Dialog_dialog_get).classList.toggle('modal', show);
116
254
  };
117
- __decorate([attr({
118
- mode: 'boolean'
119
- }), __metadata("design:type", Object)], Dialog.prototype, "open", void 0);
120
- __decorate([attr, __metadata("design:type", String)], Dialog.prototype, "icon", void 0);
121
- __decorate([attr({
122
- attribute: 'icon-placement'
123
- }), __metadata("design:type", String)], Dialog.prototype, "iconPlacement", void 0);
124
- __decorate([attr, __metadata("design:type", String)], Dialog.prototype, "subtitle", void 0);
125
- __decorate([attr, __metadata("design:type", String)], Dialog.prototype, "headline", void 0);
126
- __decorate([attr({
127
- attribute: 'full-width-body',
128
- mode: 'boolean'
129
- }), __metadata("design:type", Object)], Dialog.prototype, "fullWidthBody", void 0);
130
- __decorate([attr({
131
- attribute: 'aria-labelledby'
132
- }), __metadata("design:type", Object)], Dialog.prototype, "ariaLabelledBy", void 0);
133
- __decorate([attr({
134
- attribute: 'aria-label'
135
- }), __metadata("design:type", Object)], Dialog.prototype, "ariaLabel", void 0);
136
- __decorate([attr({
137
- attribute: 'aria-describedby'
138
- }), __metadata("design:type", Object)], Dialog.prototype, "ariaDescribedBy", void 0);
139
- __decorate([observable, __metadata("design:type", Array)], Dialog.prototype, "bodySlottedContent", void 0);
140
- __decorate([observable, __metadata("design:type", Array)], Dialog.prototype, "footerSlottedContent", void 0);
141
- __decorate([observable, __metadata("design:type", Array)], Dialog.prototype, "actionItemsSlottedContent", void 0);
255
+ __decorate([
256
+ attr({ mode: "boolean" })
257
+ ], MenuItem$1.prototype, "disabled", void 0);
258
+ __decorate([
259
+ attr({ mode: "boolean" })
260
+ ], MenuItem$1.prototype, "expanded", void 0);
261
+ __decorate([
262
+ observable
263
+ ], MenuItem$1.prototype, "startColumnCount", void 0);
264
+ __decorate([
265
+ attr
266
+ ], MenuItem$1.prototype, "role", void 0);
267
+ __decorate([
268
+ attr({ mode: "boolean" })
269
+ ], MenuItem$1.prototype, "checked", void 0);
270
+ __decorate([
271
+ observable
272
+ ], MenuItem$1.prototype, "submenuRegion", void 0);
273
+ __decorate([
274
+ observable
275
+ ], MenuItem$1.prototype, "hasSubmenu", void 0);
276
+ __decorate([
277
+ observable
278
+ ], MenuItem$1.prototype, "currentDirection", void 0);
279
+ __decorate([
280
+ observable
281
+ ], MenuItem$1.prototype, "submenu", void 0);
282
+ applyMixins(MenuItem$1, StartEnd);
142
283
 
143
- const getClasses = ({
144
- iconPlacement,
145
- bodySlottedContent,
146
- footerSlottedContent,
147
- actionItemsSlottedContent
148
- }) => classNames('base', [`icon-placement-${iconPlacement}`, Boolean(iconPlacement)], ['hide-body', !(bodySlottedContent === null || bodySlottedContent === void 0 ? void 0 : bodySlottedContent.length)], ['hide-footer', !((footerSlottedContent === null || footerSlottedContent === void 0 ? void 0 : footerSlottedContent.length) || (actionItemsSlottedContent === null || actionItemsSlottedContent === void 0 ? void 0 : actionItemsSlottedContent.length))]);
149
- function icon(iconTag) {
150
- return html`
151
- <${iconTag} class="icon" name="${x => x.icon}"></${iconTag}>
152
- `;
284
+ const styles = "/**\n * Do not edit directly\n * Generated on Mon, 04 Sep 2023 12:44:18 GMT\n */\n@supports selector(:focus-visible) {\n :host(:focus-visible) {\n outline: none;\n }\n}\n.base {\n position: relative;\n display: flex;\n box-sizing: border-box;\n align-items: center;\n background-color: var(--_appearance-color-fill);\n box-shadow: inset 0 0 0 1px var(--_appearance-color-outline);\n gap: 12px;\n inline-size: 100%;\n padding-block: 2px;\n padding-inline: 16px;\n}\n.base {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.base:where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)) {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: var(--_connotation-color-faint);\n --_appearance-color-outline: transparent;\n}\n.base:where(:disabled, .disabled) {\n --_appearance-color-text: var(--vvd-color-neutral-300);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.base:where(:active, .active):where(:not(:disabled, .disabled)) {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: var(--_connotation-color-soft);\n --_appearance-color-outline: transparent;\n}\n.base:where(.selected, [aria-current]):where(:not(:disabled, .disabled, :hover, .hover)) {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: var(--_connotation-color-dim);\n --_appearance-color-outline: transparent;\n}\n.base:where(.selected, [aria-current]):where(:hover, .hover) {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: var(--_connotation-color-pale);\n --_appearance-color-outline: transparent;\n}\n.base {\n /* @cssprop [--vvd-menu-item-accent-primary=var(--vvd-color-canvas-text)] */\n --_connotation-color-primary: var(--vvd-menu-item-accent-primary, var(--vvd-color-canvas-text));\n /* @cssprop [--vvd-menu-item-accent-primary-text=var(--vvd-color-canvas)] */\n --_connotation-color-primary-text: var(--vvd-menu-item-accent-primary-text, var(--vvd-color-canvas));\n /* @cssprop [--vvd-menu-item-accent-primary-increment=var(--vvd-color-neutral-800)] */\n --_connotation-color-primary-increment: var(--vvd-menu-item-accent-primary-increment, var(--vvd-color-neutral-800));\n /* @cssprop [--vvd-menu-item-accent-faint=var(--vvd-color-neutral-50)] */\n --_connotation-color-faint: var(--vvd-menu-item-accent-faint, var(--vvd-color-neutral-50));\n /* @cssprop [--vvd-menu-item-accent-soft=var(--vvd-color-neutral-100)] */\n --_connotation-color-soft: var(--vvd-menu-item-accent-soft, var(--vvd-color-neutral-100));\n /* @cssprop [--vvd-menu-item-accent-pale=var(--vvd-color-neutral-300)] */\n --_connotation-color-pale: var(--vvd-menu-item-accent-pale, var(--vvd-color-neutral-300));\n /* @cssprop [--vvd-menu-item-accent-dim=var(--vvd-color-neutral-200)] */\n --_connotation-color-dim: var(--vvd-menu-item-accent-dim, var(--vvd-color-neutral-200));\n}\n.base:not(.two-lines) {\n min-block-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2)));\n}\n.base.two-lines {\n min-block-size: calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2))) + calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 16)));\n}\n@supports (user-select: none) {\n .base {\n user-select: none;\n }\n}\n.base:not(.disabled) {\n cursor: pointer;\n}\n.base.disabled {\n cursor: not-allowed;\n pointer-events: none;\n}\n\n.focus-indicator {\n border-radius: 6px;\n}\n:host(:not(:focus-visible)) .focus-indicator {\n display: none;\n}\n\n.icon {\n flex-shrink: 0;\n font-size: calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2))) / 2);\n line-height: 1;\n}\n\n.action,\n.decorative {\n display: flex;\n place-content: center;\n}\n\n.action {\n color: var(--_appearance-color-text);\n}\n.base.trailing .action {\n order: 1;\n margin-inline-start: auto;\n}\n.base.has-meta .action {\n order: 1;\n margin-inline-start: auto;\n}\n\n.base:not(.disabled) .decorative {\n color: var(--vvd-color-neutral-600);\n}\n.base.disabled .decorative {\n color: var(--vvd-color-neutral-200);\n}\n.base.has-meta .decorative {\n order: 1;\n margin-inline-start: auto;\n}\n\n.text {\n display: flex;\n overflow: hidden;\n flex-direction: column;\n}\n\n.text-primary,\n.text-secondary {\n /* stylelint-disable value-no-vendor-prefix */\n display: -webkit-box;\n /* stylelint-enable value-no-vendor-prefix */\n overflow: hidden;\n -webkit-box-orient: vertical;\n color: var(--_appearance-color-text);\n font: var(--vvd-typography-base);\n}\n\n.text-primary {\n -webkit-line-clamp: var(--text-primary-line-clamp, 1);\n}\n.base.two-lines .text-primary {\n font: var(--vvd-typography-base-bold);\n}\n\n.text-secondary {\n -webkit-line-clamp: var(--text-secondary-line-clamp, 1);\n}\n.base.two-lines .text-secondary {\n color: var(--vvd-color-neutral-600);\n}";
285
+
286
+ var __defProp = Object.defineProperty;
287
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
288
+ var __decorateClass = (decorators, target, key, kind) => {
289
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
290
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
291
+ if (decorator = decorators[i])
292
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
293
+ if (kind && result)
294
+ __defProp(target, key, result);
295
+ return result;
296
+ };
297
+ const MenuItemRole = {
298
+ ...MenuItemRole$1,
299
+ presentation: "presentation"
300
+ };
301
+ class MenuItem extends MenuItem$1 {
153
302
  }
154
- function headline() {
155
- return html`
156
- <div class="headline">
157
- ${x => x.headline}
158
- </div>
159
- `;
303
+ __decorateClass([
304
+ attr
305
+ ], MenuItem.prototype, "text", 2);
306
+ __decorateClass([
307
+ attr({ attribute: "text-secondary" })
308
+ ], MenuItem.prototype, "textSecondary", 2);
309
+ __decorateClass([
310
+ observable
311
+ ], MenuItem.prototype, "metaSlottedContent", 2);
312
+ applyMixins(MenuItem, AffixIcon);
313
+
314
+ const getCheckIcon = (affixIconTemplate, x, iconType) => {
315
+ const iconStatus = x.checked ? "checked" : "unchecked";
316
+ const icon = `${iconType}-${iconStatus}-line`;
317
+ return affixIconTemplate(icon);
318
+ };
319
+ const getClasses = ({
320
+ disabled,
321
+ checked,
322
+ expanded,
323
+ role,
324
+ text,
325
+ textSecondary,
326
+ icon,
327
+ metaSlottedContent
328
+ }) => classNames(
329
+ "base",
330
+ ["disabled", Boolean(disabled)],
331
+ ["selected", role !== MenuItemRole.menuitem && Boolean(checked)],
332
+ ["trailing", role !== MenuItemRole.menuitem && Boolean(icon)],
333
+ ["expanded", Boolean(expanded)],
334
+ ["item-checkbox", role === MenuItemRole.menuitemcheckbox],
335
+ ["item-radio", role === MenuItemRole.menuitemradio],
336
+ ["two-lines", Boolean(text?.length) && Boolean(textSecondary?.length)],
337
+ ["has-meta", Boolean(metaSlottedContent?.length)]
338
+ );
339
+ function handleClick(x, { event }) {
340
+ x.handleMenuItemClick(event);
341
+ return x.role === MenuItemRole.presentation;
160
342
  }
161
- function subtitle() {
343
+ const MenuItemTemplate = (context, definition) => {
344
+ const affixIconTemplate = affixIconTemplateFactory(context);
345
+ const focusTemplate = focusTemplateFactory(context);
162
346
  return html`
163
- <div class="subtitle">
164
- ${x => x.subtitle}
165
- </div>
347
+ <template
348
+ role="${(x) => x.role ? x.role : MenuItemRole.menuitem}"
349
+ aria-checked="${(x) => x.role !== MenuItemRole.menuitem ? x.checked : void 0}"
350
+ aria-disabled="${(x) => x.disabled}"
351
+ aria-expanded="${(x) => x.expanded}"
352
+ @keydown="${(x, c) => x.handleMenuItemKeyDown(c.event)}"
353
+ @click="${handleClick}"
354
+ @mouseover="${(x, c) => x.handleMouseOver(c.event)}"
355
+ @mouseout="${(x, c) => x.handleMouseOut(c.event)}"
356
+ >
357
+ <div class="${getClasses}">
358
+
359
+ ${when(
360
+ (x) => x.hasSubmenu,
361
+ html`
362
+ <div
363
+ class="expand-collapse-glyph-container"
364
+ >
365
+ <span class="expand-collapse">
366
+ <slot name="expand-collapse-indicator">
367
+ ${definition.expandCollapseGlyph || ""}
368
+ </slot>
369
+ </span>
370
+ </div>
371
+ `
372
+ )}
373
+ ${() => focusTemplate}
374
+ <slot name="meta" ${slotted("metaSlottedContent")}></slot>
375
+ ${when(
376
+ (x) => x.role === MenuItemRole.menuitemcheckbox,
377
+ html`<span class="action">${(x) => getCheckIcon(affixIconTemplate, x, "checkbox")}</span>`
378
+ )}
379
+
380
+ ${when(
381
+ (x) => x.role === MenuItemRole.menuitemradio,
382
+ html`<span class="action">${(x) => getCheckIcon(affixIconTemplate, x, "radio")}</span>`
383
+ )}
384
+
385
+ ${when(
386
+ (x) => x.icon,
387
+ html`<span class="decorative">${(x) => affixIconTemplate(x.icon)}</span>`
388
+ )}
389
+
390
+ ${when((x) => x.text || x.textSecondary, html`<span class="text">
391
+ ${when((x) => x.text, html`<span class="text-primary">${(x) => x.text}</span>`)}
392
+ ${when((x) => x.textSecondary, html`<span class="text-secondary">${(x) => x.textSecondary}</span>`)}
393
+ </span>`)}
394
+
395
+
396
+
397
+ </div>
398
+ </template>
166
399
  `;
167
- }
168
- function renderDismissButton(buttonTag) {
169
- return html`
170
- <${buttonTag}
171
- size="condensed"
172
- class="dismiss-button"
173
- icon="close-line"
174
- @click="${x => {
175
- x.open = false;
176
- }}">
177
- </${buttonTag}>`;
178
- }
179
- function handleEscapeKey(dialog, event) {
180
- if (event.key === 'Escape' && dialog.modal) {
181
- dialog.open = false;
182
- }
183
- return true;
184
- }
185
- const DialogTemplate = context => {
186
- const elevationTag = context.tagFor(Elevation);
187
- const iconTag = context.tagFor(Icon);
188
- const buttonTag = context.tagFor(Button);
189
- return html`
190
- <${elevationTag} dp="8">
191
- <dialog class="${getClasses}"
192
- @keydown="${(x, c) => handleEscapeKey(x, c.event)}"
193
- returnValue="${x => x.returnValue}"
194
- aria-labelledby="${x => x.ariaLabelledBy}"
195
- aria-label="${x => x.ariaLabel}"
196
- aria-describedby="${x => x.ariaDescribedBy}"
197
- >
198
- <slot name="main">
199
- <div class="main-wrapper">
200
- <div class="header ${x => x.subtitle ? 'border' : ''}">
201
- <slot name="graphic">
202
- ${when(x => x.icon, icon(iconTag))}
203
- </slot>
204
- ${when(x => x.headline, headline())}
205
- ${when(x => x.subtitle, subtitle())}
206
- ${renderDismissButton(buttonTag)}
207
- </div>
208
- <div class="body ${x => x.fullWidthBody ? 'full-width' : ''}" >
209
- <slot name="body" ${slotted('bodySlottedContent')}></slot>
210
- </div>
211
- <div class="footer">
212
- <div>
213
- <slot name="footer" ${slotted('footerSlottedContent')}></slot>
214
- </div>
215
- <div class="actions">
216
- <slot name="action-items" ${slotted('actionItemsSlottedContent')}></slot>
217
- </div>
218
- </div>
219
- </div>
220
- </slot>
221
- </dialog>
222
- </${elevationTag}>`;
223
400
  };
224
401
 
225
- const dialogDefinition = Dialog.compose({
226
- baseName: 'dialog',
227
- template: DialogTemplate,
228
- styles: isDialogSupported ? [css_248z] : [css_248z, css_248z$1]
402
+ const menuItemDefinition = MenuItem.compose({
403
+ baseName: "menu-item",
404
+ template: MenuItemTemplate,
405
+ styles
229
406
  });
230
- const dialogRegistries = [dialogDefinition(), ...iconRegistries, ...buttonRegistries, ...elevationRegistries];
231
- const registerDialog = registerFactory(dialogRegistries);
407
+ const menuItemRegistries = [menuItemDefinition(), ...iconRegistries, ...focusRegistries];
408
+ const registerMenuItem = registerFactory(menuItemRegistries);
232
409
 
233
- export { dialogRegistries as a, dialogDefinition as d, registerDialog as r };
410
+ export { MenuItem$1 as M, menuItemRegistries as a, MenuItemRole$1 as b, roleForMenuItem as c, menuItemDefinition as m, registerMenuItem as r };