@vonage/vivid 3.0.0-next.8 → 3.0.0-next.80

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 (176) hide show
  1. package/README.md +141 -4
  2. package/accordion/index.js +2 -4
  3. package/accordion-item/index.js +26 -20
  4. package/action-group/index.js +47 -0
  5. package/avatar/index.js +70 -0
  6. package/badge/index.js +17 -21
  7. package/banner/index.js +23 -87
  8. package/breadcrumb/index.js +21 -18
  9. package/breadcrumb-item/index.js +19 -12
  10. package/button/index.js +19 -757
  11. package/calendar/index.js +67 -25
  12. package/calendar-event/index.js +115 -0
  13. package/card/index.js +132 -0
  14. package/checkbox/index.js +184 -0
  15. package/dialog/index.js +281 -0
  16. package/divider/index.js +3 -0
  17. package/elevation/index.js +3 -31
  18. package/fab/index.js +105 -0
  19. package/focus/index.js +18 -3
  20. package/header/index.js +66 -0
  21. package/icon/index.js +9 -5
  22. package/index.js +53 -20
  23. package/layout/index.js +4 -6
  24. package/lib/accordion-item/accordion-item.d.ts +2 -2
  25. package/lib/accordion-item/index.d.ts +2 -1
  26. package/lib/action-group/action-group.d.ts +10 -0
  27. package/lib/{sidenav-item/sidenav-item.template.d.ts → action-group/action-group.template.d.ts} +2 -2
  28. package/lib/{sidenav-item → action-group}/index.d.ts +1 -2
  29. package/lib/avatar/avatar.d.ts +15 -0
  30. package/lib/avatar/avatar.template.d.ts +4 -0
  31. package/lib/avatar/index.d.ts +3 -0
  32. package/lib/badge/badge.d.ts +5 -5
  33. package/lib/badge/index.d.ts +1 -1
  34. package/lib/banner/banner.d.ts +1 -1
  35. package/lib/banner/banner.template.d.ts +0 -2
  36. package/lib/banner/index.d.ts +1 -0
  37. package/lib/breadcrumb/breadcrumb.template.d.ts +4 -0
  38. package/lib/breadcrumb-item/breadcrumb-item.d.ts +1 -1
  39. package/lib/breadcrumb-item/index.d.ts +1 -0
  40. package/lib/button/button.d.ts +6 -5
  41. package/lib/button/index.d.ts +2 -19
  42. package/lib/calendar/calendar.d.ts +3 -1
  43. package/lib/calendar/index.d.ts +0 -1
  44. package/lib/calendar-event/calendar-event.d.ts +14 -0
  45. package/lib/calendar-event/calendar-event.template.d.ts +4 -0
  46. package/lib/calendar-event/index.d.ts +2 -0
  47. package/lib/card/card.d.ts +10 -0
  48. package/lib/{text/text.template.d.ts → card/card.template.d.ts} +2 -2
  49. package/lib/card/index.d.ts +4 -0
  50. package/lib/checkbox/checkbox.d.ts +5 -0
  51. package/lib/checkbox/checkbox.template.d.ts +4 -0
  52. package/lib/checkbox/index.d.ts +4 -0
  53. package/lib/components.d.ts +27 -10
  54. package/lib/dialog/dialog.d.ts +20 -0
  55. package/lib/dialog/dialog.template.d.ts +4 -0
  56. package/lib/dialog/index.d.ts +5 -0
  57. package/lib/divider/divider.d.ts +3 -0
  58. package/lib/divider/divider.template.d.ts +4 -0
  59. package/lib/divider/index.d.ts +2 -0
  60. package/lib/elevation/elevation.d.ts +1 -0
  61. package/lib/elevation/index.d.ts +1 -1
  62. package/lib/enums.d.ts +11 -6
  63. package/lib/fab/fab.d.ts +13 -0
  64. package/lib/fab/fab.template.d.ts +4 -0
  65. package/lib/fab/index.d.ts +4 -0
  66. package/lib/focus/index.d.ts +1 -1
  67. package/lib/header/header.d.ts +5 -0
  68. package/lib/header/header.template.d.ts +4 -0
  69. package/lib/header/index.d.ts +3 -0
  70. package/lib/icon/icon.d.ts +4 -3
  71. package/lib/layout/index.d.ts +1 -1
  72. package/lib/layout/layout.d.ts +3 -3
  73. package/lib/menu/index.d.ts +12 -0
  74. package/lib/menu/menu.d.ts +10 -0
  75. package/lib/menu/menu.template.d.ts +3 -0
  76. package/lib/menu-item/index.d.ts +3 -0
  77. package/lib/menu-item/menu-item.d.ts +7 -0
  78. package/lib/menu-item/menu-item.template.d.ts +5 -0
  79. package/lib/nav/index.d.ts +2 -0
  80. package/lib/nav/nav.d.ts +3 -0
  81. package/lib/nav/nav.template.d.ts +4 -0
  82. package/lib/nav-disclosure/index.d.ts +4 -0
  83. package/lib/nav-disclosure/nav-disclosure.d.ts +10 -0
  84. package/lib/nav-disclosure/nav-disclosure.template.d.ts +4 -0
  85. package/lib/nav-item/index.d.ts +4 -0
  86. package/lib/{sidenav-item/sidenav-item.d.ts → nav-item/nav-item.d.ts} +2 -2
  87. package/lib/nav-item/nav-item.template.d.ts +4 -0
  88. package/lib/{text → note}/index.d.ts +1 -1
  89. package/lib/note/note.d.ts +10 -0
  90. package/lib/note/note.template.d.ts +5 -0
  91. package/lib/number-field/index.d.ts +4 -0
  92. package/lib/number-field/number-field.d.ts +16 -0
  93. package/lib/number-field/number-field.template.d.ts +4 -0
  94. package/lib/popup/index.d.ts +1 -1
  95. package/lib/popup/popup.d.ts +2 -1
  96. package/lib/progress/progress.d.ts +1 -1
  97. package/lib/progress-ring/progress-ring.d.ts +2 -1
  98. package/lib/radio/index.d.ts +3 -0
  99. package/lib/radio/radio.d.ts +4 -0
  100. package/lib/radio/radio.template.d.ts +4 -0
  101. package/lib/side-drawer/index.d.ts +1 -1
  102. package/lib/side-drawer/side-drawer.d.ts +3 -2
  103. package/lib/text-anchor/text-anchor.d.ts +1 -1
  104. package/lib/text-area/index.d.ts +3 -0
  105. package/lib/text-area/text-area.d.ts +9 -0
  106. package/lib/text-area/text-area.template.d.ts +4 -0
  107. package/lib/text-field/index.d.ts +4 -0
  108. package/lib/text-field/text-field.d.ts +16 -0
  109. package/lib/text-field/text-field.template.d.ts +5 -0
  110. package/lib/tooltip/tooltip.d.ts +2 -2
  111. package/menu/index.js +381 -0
  112. package/menu-item/index.js +19 -0
  113. package/nav/index.js +17 -0
  114. package/nav-disclosure/index.js +88 -0
  115. package/nav-item/index.js +45 -0
  116. package/note/index.js +66 -0
  117. package/number-field/index.js +529 -0
  118. package/package.json +51 -7
  119. package/popup/index.js +23 -2061
  120. package/progress/index.js +35 -28
  121. package/progress-ring/index.js +9 -5
  122. package/radio/index.js +174 -0
  123. package/shared/anchor.js +10 -2
  124. package/shared/aria-global.js +2 -86
  125. package/shared/base-progress.js +5 -0
  126. package/shared/breadcrumb-item.js +1 -1
  127. package/shared/button.js +200 -0
  128. package/shared/calendar-event.js +26 -0
  129. package/shared/dialog-polyfill.esm.js +858 -0
  130. package/shared/enums.js +79 -0
  131. package/shared/es.object.assign.js +7 -6
  132. package/shared/export.js +995 -0
  133. package/shared/focus.js +5 -0
  134. package/shared/focus2.js +11 -0
  135. package/shared/form-associated.js +466 -0
  136. package/shared/form-elements.js +299 -0
  137. package/shared/icon.js +533 -520
  138. package/shared/index.js +71 -55
  139. package/shared/index2.js +110 -13
  140. package/shared/index3.js +35 -0
  141. package/shared/index4.js +86 -0
  142. package/shared/index5.js +2100 -0
  143. package/shared/index6.js +371 -0
  144. package/shared/iterators.js +61 -0
  145. package/shared/key-codes.js +90 -0
  146. package/shared/object-keys.js +13 -0
  147. package/shared/patterns/focus.d.ts +3 -0
  148. package/shared/patterns/form-elements.d.ts +22 -0
  149. package/shared/patterns/index.d.ts +1 -0
  150. package/shared/ref.js +41 -0
  151. package/shared/regexp-flags.js +21 -0
  152. package/shared/start-end.js +50 -0
  153. package/shared/text-anchor.js +2 -11
  154. package/shared/text-anchor.template.js +5 -2
  155. package/shared/to-string.js +51 -0
  156. package/shared/web.dom-collections.iterator.js +78 -1083
  157. package/side-drawer/index.js +44 -23
  158. package/styles/core/all.css +75 -0
  159. package/styles/core/theme.css +11 -0
  160. package/styles/core/typography.css +69 -0
  161. package/styles/fonts/SpeziaCompleteVariableItalicWeb.woff2 +0 -0
  162. package/styles/fonts/SpeziaCompleteVariableUprightWeb.woff2 +0 -0
  163. package/styles/fonts/SpeziaMonoCompleteVariableWeb.woff2 +0 -0
  164. package/styles/fonts/spezia.css +9 -12
  165. package/styles/tokens/theme-dark.css +211 -0
  166. package/styles/tokens/theme-light.css +211 -0
  167. package/text-anchor/index.js +9 -1
  168. package/text-area/index.js +304 -0
  169. package/text-field/index.js +152 -0
  170. package/tooltip/index.js +23 -16
  171. package/lib/text/text.d.ts +0 -10
  172. package/shared/style-inject.es.js +0 -28
  173. package/sidenav-item/index.js +0 -38
  174. package/styles/themes/dark.css +0 -205
  175. package/styles/themes/light.css +0 -205
  176. package/text/index.js +0 -45
package/menu/index.js ADDED
@@ -0,0 +1,381 @@
1
+ import { P as Popup } from '../shared/index5.js';
2
+ import { M as MenuItem, a as MenuItemRole, r as roleForMenuItem } from '../shared/index6.js';
3
+ import { F as FoundationElement, D as DOM, _ as __decorate, o as observable, a as attr, b as __metadata, h as html, d as designSystem } from '../shared/index.js';
4
+ import '../shared/web.dom-collections.iterator.js';
5
+ import { b as keyHome, c as keyEnd, d as keyArrowUp, e as keyArrowDown } from '../shared/key-codes.js';
6
+ import { s as slotted } from '../shared/slotted.js';
7
+ import { r as ref } from '../shared/ref.js';
8
+ import '../shared/index3.js';
9
+ import '../shared/class-names.js';
10
+ import '../shared/index2.js';
11
+ import '../icon/index.js';
12
+ import '../shared/icon.js';
13
+ import '../shared/export.js';
14
+ import '../shared/iterators.js';
15
+ import '../shared/to-string.js';
16
+ import '../shared/_has.js';
17
+ import '../shared/when.js';
18
+ import '../focus/index.js';
19
+ import '../shared/focus.js';
20
+ import '../shared/affix.js';
21
+ import '../shared/button.js';
22
+ import '../shared/apply-mixins.js';
23
+ import '../shared/form-associated.js';
24
+ import '../shared/aria-global.js';
25
+ import '../shared/start-end.js';
26
+ import '../shared/focus2.js';
27
+ import '../shared/es.object.assign.js';
28
+ import '../shared/object-keys.js';
29
+ import '../shared/regexp-flags.js';
30
+
31
+ /**
32
+ * A test that ensures that all arguments are HTML Elements
33
+ */
34
+ function isHTMLElement(...args) {
35
+ return args.every((arg) => arg instanceof HTMLElement);
36
+ }
37
+
38
+ /**
39
+ * A Menu Custom HTML Element.
40
+ * Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#menu | ARIA menu }.
41
+ *
42
+ * @slot - The default slot for the menu items
43
+ *
44
+ * @public
45
+ */
46
+ class Menu$1 extends FoundationElement {
47
+ constructor() {
48
+ super(...arguments);
49
+ this.expandedItem = null;
50
+ /**
51
+ * The index of the focusable element in the items array
52
+ * defaults to -1
53
+ */
54
+ this.focusIndex = -1;
55
+ /**
56
+ * @internal
57
+ */
58
+ this.isNestedMenu = () => {
59
+ return (this.parentElement !== null &&
60
+ isHTMLElement(this.parentElement) &&
61
+ this.parentElement.getAttribute("role") === "menuitem");
62
+ };
63
+ /**
64
+ * if focus is moving out of the menu, reset to a stable initial state
65
+ * @internal
66
+ */
67
+ this.handleFocusOut = (e) => {
68
+ if (!this.contains(e.relatedTarget) && this.menuItems !== undefined) {
69
+ this.collapseExpandedItem();
70
+ // find our first focusable element
71
+ const focusIndex = this.menuItems.findIndex(this.isFocusableElement);
72
+ // set the current focus index's tabindex to -1
73
+ this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
74
+ // set the first focusable element tabindex to 0
75
+ this.menuItems[focusIndex].setAttribute("tabindex", "0");
76
+ // set the focus index
77
+ this.focusIndex = focusIndex;
78
+ }
79
+ };
80
+ this.handleItemFocus = (e) => {
81
+ const targetItem = e.target;
82
+ if (this.menuItems !== undefined &&
83
+ targetItem !== this.menuItems[this.focusIndex]) {
84
+ this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
85
+ this.focusIndex = this.menuItems.indexOf(targetItem);
86
+ targetItem.setAttribute("tabindex", "0");
87
+ }
88
+ };
89
+ this.handleExpandedChanged = (e) => {
90
+ if (e.defaultPrevented ||
91
+ e.target === null ||
92
+ this.menuItems === undefined ||
93
+ this.menuItems.indexOf(e.target) < 0) {
94
+ return;
95
+ }
96
+ e.preventDefault();
97
+ const changedItem = e.target;
98
+ // closing an expanded item without opening another
99
+ if (this.expandedItem !== null &&
100
+ changedItem === this.expandedItem &&
101
+ changedItem.expanded === false) {
102
+ this.expandedItem = null;
103
+ return;
104
+ }
105
+ if (changedItem.expanded) {
106
+ if (this.expandedItem !== null && this.expandedItem !== changedItem) {
107
+ this.expandedItem.expanded = false;
108
+ }
109
+ this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
110
+ this.expandedItem = changedItem;
111
+ this.focusIndex = this.menuItems.indexOf(changedItem);
112
+ changedItem.setAttribute("tabindex", "0");
113
+ }
114
+ };
115
+ this.removeItemListeners = () => {
116
+ if (this.menuItems !== undefined) {
117
+ this.menuItems.forEach((item) => {
118
+ item.removeEventListener("expanded-change", this.handleExpandedChanged);
119
+ item.removeEventListener("focus", this.handleItemFocus);
120
+ });
121
+ }
122
+ };
123
+ this.setItems = () => {
124
+ const newItems = this.domChildren();
125
+ this.removeItemListeners();
126
+ this.menuItems = newItems;
127
+ const menuItems = this.menuItems.filter(this.isMenuItemElement);
128
+ // if our focus index is not -1 we have items
129
+ if (menuItems.length) {
130
+ this.focusIndex = 0;
131
+ }
132
+ function elementIndent(el) {
133
+ const role = el.getAttribute("role");
134
+ const startSlot = el.querySelector("[slot=start]");
135
+ if (role !== MenuItemRole.menuitem && startSlot === null) {
136
+ return 1;
137
+ }
138
+ else if (role === MenuItemRole.menuitem && startSlot !== null) {
139
+ return 1;
140
+ }
141
+ else if (role !== MenuItemRole.menuitem && startSlot !== null) {
142
+ return 2;
143
+ }
144
+ else {
145
+ return 0;
146
+ }
147
+ }
148
+ const indent = menuItems.reduce((accum, current) => {
149
+ const elementValue = elementIndent(current);
150
+ return accum > elementValue ? accum : elementValue;
151
+ }, 0);
152
+ menuItems.forEach((item, index) => {
153
+ item.setAttribute("tabindex", index === 0 ? "0" : "-1");
154
+ item.addEventListener("expanded-change", this.handleExpandedChanged);
155
+ item.addEventListener("focus", this.handleItemFocus);
156
+ if (item instanceof MenuItem) {
157
+ item.startColumnCount = indent;
158
+ }
159
+ });
160
+ };
161
+ /**
162
+ * handle change from child element
163
+ */
164
+ this.changeHandler = (e) => {
165
+ if (this.menuItems === undefined) {
166
+ return;
167
+ }
168
+ const changedMenuItem = e.target;
169
+ const changeItemIndex = this.menuItems.indexOf(changedMenuItem);
170
+ if (changeItemIndex === -1) {
171
+ return;
172
+ }
173
+ if (changedMenuItem.role === "menuitemradio" &&
174
+ changedMenuItem.checked === true) {
175
+ for (let i = changeItemIndex - 1; i >= 0; --i) {
176
+ const item = this.menuItems[i];
177
+ const role = item.getAttribute("role");
178
+ if (role === MenuItemRole.menuitemradio) {
179
+ item.checked = false;
180
+ }
181
+ if (role === "separator") {
182
+ break;
183
+ }
184
+ }
185
+ const maxIndex = this.menuItems.length - 1;
186
+ for (let i = changeItemIndex + 1; i <= maxIndex; ++i) {
187
+ const item = this.menuItems[i];
188
+ const role = item.getAttribute("role");
189
+ if (role === MenuItemRole.menuitemradio) {
190
+ item.checked = false;
191
+ }
192
+ if (role === "separator") {
193
+ break;
194
+ }
195
+ }
196
+ }
197
+ };
198
+ /**
199
+ * check if the item is a menu item
200
+ */
201
+ this.isMenuItemElement = (el) => {
202
+ return (isHTMLElement(el) &&
203
+ Menu$1.focusableElementRoles.hasOwnProperty(el.getAttribute("role")));
204
+ };
205
+ /**
206
+ * check if the item is focusable
207
+ */
208
+ this.isFocusableElement = (el) => {
209
+ return this.isMenuItemElement(el);
210
+ };
211
+ }
212
+ itemsChanged(oldValue, newValue) {
213
+ // only update children after the component is connected and
214
+ // the setItems has run on connectedCallback
215
+ // (menuItems is undefined until then)
216
+ if (this.$fastController.isConnected && this.menuItems !== undefined) {
217
+ this.setItems();
218
+ }
219
+ }
220
+ /**
221
+ * @internal
222
+ */
223
+ connectedCallback() {
224
+ super.connectedCallback();
225
+ DOM.queueUpdate(() => {
226
+ // wait until children have had a chance to
227
+ // connect before setting/checking their props/attributes
228
+ this.setItems();
229
+ });
230
+ this.addEventListener("change", this.changeHandler);
231
+ }
232
+ /**
233
+ * @internal
234
+ */
235
+ disconnectedCallback() {
236
+ super.disconnectedCallback();
237
+ this.removeItemListeners();
238
+ this.menuItems = undefined;
239
+ this.removeEventListener("change", this.changeHandler);
240
+ }
241
+ /**
242
+ * Focuses the first item in the menu.
243
+ *
244
+ * @public
245
+ */
246
+ focus() {
247
+ this.setFocus(0, 1);
248
+ }
249
+ /**
250
+ * Collapses any expanded menu items.
251
+ *
252
+ * @public
253
+ */
254
+ collapseExpandedItem() {
255
+ if (this.expandedItem !== null) {
256
+ this.expandedItem.expanded = false;
257
+ this.expandedItem = null;
258
+ }
259
+ }
260
+ /**
261
+ * @internal
262
+ */
263
+ handleMenuKeyDown(e) {
264
+ if (e.defaultPrevented || this.menuItems === undefined) {
265
+ return;
266
+ }
267
+ switch (e.key) {
268
+ case keyArrowDown:
269
+ // go forward one index
270
+ this.setFocus(this.focusIndex + 1, 1);
271
+ return;
272
+ case keyArrowUp:
273
+ // go back one index
274
+ this.setFocus(this.focusIndex - 1, -1);
275
+ return;
276
+ case keyEnd:
277
+ // set focus on last item
278
+ this.setFocus(this.menuItems.length - 1, -1);
279
+ return;
280
+ case keyHome:
281
+ // set focus on first item
282
+ this.setFocus(0, 1);
283
+ return;
284
+ default:
285
+ // if we are not handling the event, do not prevent default
286
+ return true;
287
+ }
288
+ }
289
+ /**
290
+ * get an array of valid DOM children
291
+ */
292
+ domChildren() {
293
+ return Array.from(this.children).filter(child => !child.hasAttribute("hidden"));
294
+ }
295
+ setFocus(focusIndex, adjustment) {
296
+ if (this.menuItems === undefined) {
297
+ return;
298
+ }
299
+ while (focusIndex >= 0 && focusIndex < this.menuItems.length) {
300
+ const child = this.menuItems[focusIndex];
301
+ if (this.isFocusableElement(child)) {
302
+ // change the previous index to -1
303
+ if (this.focusIndex > -1 &&
304
+ this.menuItems.length >= this.focusIndex - 1) {
305
+ this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
306
+ }
307
+ // update the focus index
308
+ this.focusIndex = focusIndex;
309
+ // update the tabindex of next focusable element
310
+ child.setAttribute("tabindex", "0");
311
+ // focus the element
312
+ child.focus();
313
+ break;
314
+ }
315
+ focusIndex += adjustment;
316
+ }
317
+ }
318
+ }
319
+ Menu$1.focusableElementRoles = roleForMenuItem;
320
+ __decorate([
321
+ observable
322
+ ], Menu$1.prototype, "items", void 0);
323
+
324
+ var css_248z = ".base {\n max-inline-size: var(--menu-max-inline-size, 100%);\n min-inline-size: var(--menu-max-inline-size);\n padding-block: 8px;\n}";
325
+
326
+ class Menu extends Menu$1 {
327
+ constructor() {
328
+ super(...arguments);
329
+ this.open = false;
330
+
331
+ this.popupOpenChanged = () => {
332
+ this.open = this._popup.open;
333
+ };
334
+ }
335
+
336
+ }
337
+
338
+ __decorate([attr({
339
+ mode: 'boolean'
340
+ }), __metadata("design:type", Object)], Menu.prototype, "open", void 0);
341
+
342
+ __decorate([attr, __metadata("design:type", String)], Menu.prototype, "placement", void 0);
343
+
344
+ __decorate([attr, __metadata("design:type", String)], Menu.prototype, "anchor", void 0);
345
+
346
+ let _ = t => t,
347
+ _t;
348
+ const MenuTemplate = context => {
349
+ const popupTag = context.tagFor(Popup);
350
+ return html(_t || (_t = _`
351
+ <template
352
+ slot="${0}"
353
+ >
354
+ <${0}
355
+ :placement=${0}
356
+ :open=${0}
357
+ :anchor=${0}
358
+ @open="${0}"
359
+ @close="${0}"
360
+ ${0}
361
+ >
362
+ <div
363
+ class="base"
364
+ role="menu"
365
+ @keydown="${0}"
366
+ @focusout="${0}"
367
+ >
368
+ <slot ${0}></slot>
369
+ </div>
370
+ </${0}>
371
+ </template>`), x => x.slot || x.isNestedMenu() ? 'submenu' : void 0, popupTag, x => x.placement, x => x.open, x => x.anchor, x => x.popupOpenChanged(), x => x.popupOpenChanged(), ref('_popup'), (x, c) => x.handleMenuKeyDown(c.event), (x, c) => x.handleFocusOut(c.event), slotted('items'), popupTag);
372
+ };
373
+
374
+ const vividMenu = Menu.compose({
375
+ baseName: 'menu',
376
+ template: MenuTemplate,
377
+ styles: css_248z
378
+ });
379
+ designSystem.register(vividMenu());
380
+
381
+ export { vividMenu };
@@ -0,0 +1,19 @@
1
+ import '../icon/index.js';
2
+ import '../shared/index.js';
3
+ export { v as vividMenuItem } from '../shared/index6.js';
4
+ import '../shared/icon.js';
5
+ import '../shared/export.js';
6
+ import '../shared/iterators.js';
7
+ import '../shared/to-string.js';
8
+ import '../shared/_has.js';
9
+ import '../shared/when.js';
10
+ import '../shared/class-names.js';
11
+ import '../shared/affix.js';
12
+ import '../shared/web.dom-collections.iterator.js';
13
+ import '../shared/object-keys.js';
14
+ import '../shared/start-end.js';
15
+ import '../shared/ref.js';
16
+ import '../shared/apply-mixins.js';
17
+ import '../shared/key-codes.js';
18
+ import '../shared/focus2.js';
19
+ import '../shared/focus.js';
package/nav/index.js ADDED
@@ -0,0 +1,17 @@
1
+ import { F as FoundationElement, h as html, d as designSystem } from '../shared/index.js';
2
+
3
+ class Nav extends FoundationElement {}
4
+
5
+ let _ = t => t,
6
+ _t;
7
+ const NavTemplate = () => html(_t || (_t = _`
8
+ <nav><slot></slot></nav>
9
+ `));
10
+
11
+ const vividNav = Nav.compose({
12
+ baseName: 'nav',
13
+ template: NavTemplate
14
+ });
15
+ designSystem.register(vividNav());
16
+
17
+ export { vividNav };
@@ -0,0 +1,88 @@
1
+ import '../icon/index.js';
2
+ import '../focus/index.js';
3
+ import { F as FoundationElement, c as __classPrivateFieldGet, _ as __decorate, a as attr, b as __metadata, h as html, d as designSystem } from '../shared/index.js';
4
+ import '../shared/web.dom-collections.iterator.js';
5
+ import { b as AffixIcon, a as affixIconTemplateFactory } from '../shared/affix.js';
6
+ import { a as applyMixins } from '../shared/apply-mixins.js';
7
+ import { f as focusTemplateFactory } from '../shared/focus2.js';
8
+ import { w as when } from '../shared/when.js';
9
+ import { r as ref } from '../shared/ref.js';
10
+ import '../shared/icon.js';
11
+ import '../shared/export.js';
12
+ import '../shared/iterators.js';
13
+ import '../shared/to-string.js';
14
+ import '../shared/_has.js';
15
+ import '../shared/class-names.js';
16
+ import '../shared/focus.js';
17
+ import '../shared/object-keys.js';
18
+
19
+ var css_248z = "/**\n * Do not edit directly\n * Generated on Wed, 19 Oct 2022 08:48:31 GMT\n */\n.control {\n position: relative;\n display: flex;\n box-sizing: border-box;\n align-items: center;\n background-color: var(--_appearance-color-fill);\n border-radius: 6px;\n box-shadow: inset 0 0 0 1px var(--_appearance-color-outline);\n color: var(--_appearance-color-text);\n cursor: pointer;\n font: var(--vvd-font-base);\n gap: 8px;\n hyphens: auto;\n inline-size: 100%;\n min-block-size: 40px;\n padding-inline: 8px;\n text-decoration: none;\n vertical-align: middle;\n word-break: break-word;\n}\n.control {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.control:where(:hover, .hover):where(:not(:disabled, .disabled)) {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: var(--_connotation-color-faint);\n --_appearance-color-outline: transparent;\n}\n.control: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.control:where(.selected, [aria-current]):where(:not(:disabled, .disabled, :hover, .hover, :active, .active)) {\n --_appearance-color-text: var(--_connotation-color-primary-text);\n --_appearance-color-fill: var(--_connotation-color-primary);\n --_appearance-color-outline: transparent;\n}\n.control {\n --_connotation-color-primary: var(--vvd-color-canvas-text);\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n --_connotation-color-faint: var(--vvd-color-neutral-50);\n --_connotation-color-soft: var(--vvd-color-neutral-100);\n}\n@supports selector(:focus-visible) {\n .control:focus {\n outline: none;\n }\n}\n@supports (user-select: none) {\n .control {\n user-select: none;\n }\n}\n.control .toggleIcon {\n margin-inline-start: auto;\n}\n\n.control:not(:focus-visible) .focus-indicator {\n display: none;\n}\n\n.icon {\n font-size: 20px;\n}\n\n.content {\n border-inline-start: 1px solid var(--vvd-color-neutral-200);\n margin-inline-start: 20px;\n padding-inline-start: 12px;\n}\n\ndetails > summary {\n list-style: none;\n}\n\ndetails > summary::-webkit-details-marker {\n display: none;\n}";
20
+
21
+ var _NavDisclosure_onToggle;
22
+ class NavDisclosure extends FoundationElement {
23
+ constructor() {
24
+ super(...arguments);
25
+ this.open = false;
26
+
27
+ _NavDisclosure_onToggle.set(this, () => {
28
+ this.open = this.details.open;
29
+ this.$emit('toggle');
30
+ });
31
+ }
32
+
33
+ connectedCallback() {
34
+ super.connectedCallback();
35
+ this.details.addEventListener('toggle', __classPrivateFieldGet(this, _NavDisclosure_onToggle, "f"));
36
+ this.details.open = this.open;
37
+ }
38
+
39
+ disconnectedCallback() {
40
+ super.disconnectedCallback();
41
+ this.details.removeEventListener('toggle', __classPrivateFieldGet(this, _NavDisclosure_onToggle, "f"));
42
+ }
43
+
44
+ }
45
+ _NavDisclosure_onToggle = new WeakMap();
46
+
47
+ __decorate([attr, __metadata("design:type", String)], NavDisclosure.prototype, "label", void 0);
48
+
49
+ __decorate([attr({
50
+ mode: 'boolean'
51
+ }), __metadata("design:type", Object)], NavDisclosure.prototype, "open", void 0);
52
+
53
+ applyMixins(NavDisclosure, AffixIcon);
54
+
55
+ let _ = t => t,
56
+ _t,
57
+ _t2,
58
+ _t3;
59
+ const NavDisclosureTemplate = context => {
60
+ const affixIconTemplate = affixIconTemplateFactory(context);
61
+ const focusTemplate = focusTemplateFactory(context);
62
+ return html(_t || (_t = _`<details class="base" ${0} ?open=${0}>
63
+ <summary class="control"
64
+ role="button"
65
+ aria-controls="disclosure-content"
66
+ aria-expanded="${0}"
67
+ >
68
+ ${0}
69
+ ${0}
70
+ ${0}
71
+ ${0}
72
+ ${0}
73
+ </summary>
74
+ <div class="content" id="disclosure-content">
75
+ <slot></slot>
76
+ </div>
77
+ </details>
78
+ `), ref('details'), x => x.open, x => x.open, x => affixIconTemplate(x.icon), x => x.label, when(x => x.open, html(_t2 || (_t2 = _`<vwc-icon class="toggleIcon" type='chevron-up-solid'></vwc-icon>`))), when(x => !x.open, html(_t3 || (_t3 = _`<vwc-icon class="toggleIcon" type='chevron-down-solid'></vwc-icon>`))), () => focusTemplate);
79
+ };
80
+
81
+ const vividNavDisclosure = NavDisclosure.compose({
82
+ baseName: 'nav-disclosure',
83
+ template: NavDisclosureTemplate,
84
+ styles: css_248z
85
+ });
86
+ designSystem.register(vividNavDisclosure());
87
+
88
+ export { vividNavDisclosure };
@@ -0,0 +1,45 @@
1
+ import '../icon/index.js';
2
+ import '../focus/index.js';
3
+ import { h as html, d as designSystem } from '../shared/index.js';
4
+ import { b as AffixIcon } from '../shared/affix.js';
5
+ import { T as TextAnchor } from '../shared/text-anchor.js';
6
+ import { a as applyMixins } from '../shared/apply-mixins.js';
7
+ import { t as textAnchorTemplate } from '../shared/text-anchor.template.js';
8
+ import '../shared/icon.js';
9
+ import '../shared/export.js';
10
+ import '../shared/iterators.js';
11
+ import '../shared/to-string.js';
12
+ import '../shared/_has.js';
13
+ import '../shared/when.js';
14
+ import '../shared/class-names.js';
15
+ import '../shared/focus.js';
16
+ import '../shared/web.dom-collections.iterator.js';
17
+ import '../shared/object-keys.js';
18
+ import '../shared/anchor.js';
19
+ import '../shared/aria-global.js';
20
+ import '../shared/start-end.js';
21
+ import '../shared/ref.js';
22
+ import '../shared/focus2.js';
23
+
24
+ var css_248z = "/**\n * Do not edit directly\n * Generated on Wed, 19 Oct 2022 08:48:31 GMT\n */\n.control {\n position: relative;\n display: inline-flex;\n box-sizing: border-box;\n align-items: center;\n background-color: var(--_appearance-color-fill);\n border-radius: 6px;\n box-shadow: inset 0 0 0 1px var(--_appearance-color-outline);\n color: var(--_appearance-color-text);\n font: var(--vvd-font-base);\n gap: 8px;\n hyphens: auto;\n inline-size: 100%;\n min-block-size: 40px;\n padding-block: 10px;\n padding-inline: 8px;\n text-decoration: none;\n vertical-align: middle;\n word-break: break-word;\n}\n.control {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.control:where(:hover, .hover):where(:not(:disabled, .disabled)) {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: var(--_connotation-color-faint);\n --_appearance-color-outline: transparent;\n}\n.control: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.control:where(.selected, [aria-current]):where(:not(:disabled, .disabled, :hover, .hover, :active, .active)) {\n --_appearance-color-text: var(--_connotation-color-primary-text);\n --_appearance-color-fill: var(--_connotation-color-primary);\n --_appearance-color-outline: transparent;\n}\n.control {\n --_connotation-color-primary: var(--vvd-color-canvas-text);\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n --_connotation-color-faint: var(--vvd-color-neutral-50);\n --_connotation-color-soft: var(--vvd-color-neutral-100);\n}\n@supports selector(:focus-visible) {\n .control:focus {\n outline: none;\n }\n}\n.control.icon-only {\n display: flex;\n block-size: 40px;\n inline-size: 40px;\n place-content: center;\n}\n\n.control:not(:focus-visible) .focus-indicator {\n display: none;\n}\n\n.icon {\n font-size: 20px;\n}";
25
+
26
+ class NavItem extends TextAnchor {}
27
+ applyMixins(NavItem, AffixIcon);
28
+
29
+ let _ = t => t,
30
+ _t;
31
+ const NavItemTemplate = (context, definition) => html(_t || (_t = _`
32
+ ${0}
33
+ `), textAnchorTemplate(context));
34
+
35
+ const vividNavItem = NavItem.compose({
36
+ baseName: 'nav-item',
37
+ template: NavItemTemplate,
38
+ styles: css_248z,
39
+ shadowOptions: {
40
+ delegatesFocus: true
41
+ }
42
+ });
43
+ designSystem.register(vividNavItem());
44
+
45
+ export { vividNavItem };
package/note/index.js ADDED
@@ -0,0 +1,66 @@
1
+ import { F as FoundationElement, _ as __decorate, a as attr, b as __metadata, h as html, d as designSystem } from '../shared/index.js';
2
+ import { b as AffixIcon } from '../shared/affix.js';
3
+ import '../shared/focus.js';
4
+ import { a as applyMixins } from '../shared/apply-mixins.js';
5
+ import '../shared/web.dom-collections.iterator.js';
6
+ import '../icon/index.js';
7
+ import { C as Connotation } from '../shared/enums.js';
8
+ import { w as when } from '../shared/when.js';
9
+ import { c as classNames } from '../shared/class-names.js';
10
+ import '../shared/icon.js';
11
+ import '../shared/export.js';
12
+ import '../shared/iterators.js';
13
+ import '../shared/to-string.js';
14
+ import '../shared/_has.js';
15
+ import '../shared/object-keys.js';
16
+
17
+ var css_248z = "/**\n * Do not edit directly\n * Generated on Wed, 19 Oct 2022 08:48:31 GMT\n */\n.base {\n display: flex;\n align-items: stretch;\n padding: 20px;\n border-left: 8px solid var(--_connotation-color-primary);\n background-color: var(--vvd-color-canvas);\n border-radius: 6px;\n box-shadow: inset 0 1px 0 0 var(--vvd-color-neutral-300), inset -1px 0 0 0 var(--vvd-color-neutral-300), inset 0 -1px 0 0 var(--vvd-color-neutral-300);\n color: var(--vvd-color-canvas-text);\n}\n.base.connotation-success {\n --_connotation-color-primary: var(--vvd-color-success-500);\n}\n.base.connotation-information {\n --_connotation-color-primary: var(--vvd-color-information-500);\n}\n.base.connotation-alert {\n --_connotation-color-primary: var(--vvd-color-alert-500);\n}\n.base.connotation-warning {\n --_connotation-color-primary: var(--vvd-color-warning-500);\n}\n.base:not(.connotation-success, .connotation-information, .connotation-alert, .connotation-warning) {\n --_connotation-color-primary: var(--vvd-color-announcement-500);\n}\n@supports (contain: content) {\n .base {\n contain: content;\n }\n}\n@supports not (contain: content) {\n .base {\n overflow: hidden;\n }\n}\n\n.icon {\n align-self: flex-start;\n font-size: 24px;\n margin-inline-end: 16px;\n}\n\n.text {\n display: flex;\n min-height: 24px;\n flex: 1;\n flex-direction: column;\n justify-content: center;\n gap: 4px;\n text-align: start;\n}\n.text .headline {\n font: var(--vvd-font-base-bold);\n}\n.text .message {\n font: var(--vvd-font-base);\n}";
18
+
19
+ class Note extends FoundationElement {}
20
+
21
+ __decorate([attr, __metadata("design:type", String)], Note.prototype, "headline", void 0);
22
+
23
+ __decorate([attr, __metadata("design:type", String)], Note.prototype, "connotation", void 0);
24
+
25
+ applyMixins(Note, AffixIcon);
26
+
27
+ let _ = t => t,
28
+ _t,
29
+ _t2,
30
+ _t3;
31
+ const connotationIconMap = new Map([[Connotation.Information, 'info-solid'], [Connotation.Announcement, 'megaphone-solid'], [Connotation.Success, 'check-circle-solid'], [Connotation.Warning, 'warning-solid'], [Connotation.Alert, 'error-solid']]);
32
+
33
+ const getClasses = ({
34
+ connotation
35
+ }) => classNames('base', `connotation-${connotation}`);
36
+
37
+ function getHeaderTemplate() {
38
+ return html(_t || (_t = _`<div class="headline">${0}</div>`), x => x.headline);
39
+ }
40
+
41
+ function getIconType(note) {
42
+ return note.icon ? note.icon : note.connotation ? connotationIconMap.get(note.connotation) : 'megaphone-solid';
43
+ }
44
+
45
+ function getIconTemplate() {
46
+ return html(_t2 || (_t2 = _`<vwc-icon class="icon" type="${0}"></vwc-icon>`), getIconType);
47
+ }
48
+
49
+ const NoteTemplate = () => html(_t3 || (_t3 = _`
50
+ <div class="${0}">
51
+ ${0}
52
+ <div class="text">
53
+ ${0}
54
+ <slot class="message"></slot>
55
+ </div>
56
+ </div>
57
+ `), getClasses, getIconTemplate(), when(x => x.headline, getHeaderTemplate()));
58
+
59
+ const vividNote = Note.compose({
60
+ baseName: 'note',
61
+ template: NoteTemplate,
62
+ styles: css_248z
63
+ });
64
+ designSystem.register(vividNote());
65
+
66
+ export { vividNote };