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