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