@vonage/vivid 3.0.0-next.10 → 3.0.0-next.101

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