@vonage/vivid 3.0.0-next.11 → 3.0.0-next.110

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 (209) hide show
  1. package/README.md +165 -4
  2. package/accordion/index.js +5 -14
  3. package/accordion-item/index.js +34 -41
  4. package/action-group/index.js +37 -0
  5. package/avatar/index.js +61 -0
  6. package/badge/index.js +23 -35
  7. package/banner/index.js +20 -115
  8. package/breadcrumb/index.js +22 -19
  9. package/breadcrumb-item/index.js +28 -25
  10. package/button/index.js +29 -690
  11. package/calendar/index.js +70 -69
  12. package/calendar-event/index.js +109 -0
  13. package/card/index.js +112 -0
  14. package/checkbox/index.js +178 -0
  15. package/custom-elements.json +3941 -0
  16. package/dialog/index.js +214 -0
  17. package/divider/index.js +27 -0
  18. package/elevation/index.js +10 -16
  19. package/fab/index.js +98 -0
  20. package/focus/index.js +18 -3
  21. package/header/index.js +63 -0
  22. package/icon/index.js +9 -12
  23. package/index.js +68 -22
  24. package/layout/index.js +6 -16
  25. package/lib/accordion-item/accordion-item.d.ts +2 -2
  26. package/lib/accordion-item/index.d.ts +0 -1
  27. package/lib/action-group/action-group.d.ts +10 -0
  28. package/lib/{sidenav-item/sidenav-item.template.d.ts → action-group/action-group.template.d.ts} +2 -2
  29. package/lib/{sidenav-item → action-group}/index.d.ts +1 -2
  30. package/lib/avatar/avatar.d.ts +15 -0
  31. package/lib/avatar/avatar.template.d.ts +4 -0
  32. package/lib/avatar/index.d.ts +2 -0
  33. package/lib/badge/badge.d.ts +3 -5
  34. package/lib/badge/index.d.ts +1 -2
  35. package/lib/banner/banner.d.ts +1 -1
  36. package/lib/banner/banner.template.d.ts +0 -2
  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 +0 -1
  40. package/lib/button/button.d.ts +4 -3
  41. package/lib/button/index.d.ts +1 -21
  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/{text → card}/index.d.ts +1 -1
  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 +2 -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 +2 -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 +2 -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 +2 -0
  70. package/lib/icon/icon.d.ts +5 -6
  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 +1 -0
  74. package/lib/listbox/listbox.d.ts +9 -0
  75. package/lib/listbox/listbox.template.d.ts +4 -0
  76. package/lib/menu/index.d.ts +10 -0
  77. package/lib/menu/menu.d.ts +10 -0
  78. package/lib/menu/menu.template.d.ts +3 -0
  79. package/lib/menu-item/index.d.ts +2 -0
  80. package/lib/menu-item/menu-item.d.ts +7 -0
  81. package/lib/menu-item/menu-item.template.d.ts +5 -0
  82. package/lib/nav/index.d.ts +2 -0
  83. package/lib/nav/nav.d.ts +3 -0
  84. package/lib/nav/nav.template.d.ts +4 -0
  85. package/lib/nav-disclosure/index.d.ts +2 -0
  86. package/lib/nav-disclosure/nav-disclosure.d.ts +10 -0
  87. package/lib/nav-disclosure/nav-disclosure.template.d.ts +4 -0
  88. package/lib/nav-item/index.d.ts +2 -0
  89. package/lib/{sidenav-item/sidenav-item.d.ts → nav-item/nav-item.d.ts} +2 -2
  90. package/lib/nav-item/nav-item.template.d.ts +4 -0
  91. package/lib/note/index.d.ts +2 -0
  92. package/lib/note/note.d.ts +10 -0
  93. package/lib/note/note.template.d.ts +4 -0
  94. package/lib/number-field/index.d.ts +2 -0
  95. package/lib/number-field/number-field.d.ts +14 -0
  96. package/lib/number-field/number-field.template.d.ts +4 -0
  97. package/lib/option/index.d.ts +2 -0
  98. package/lib/option/option.d.ts +9 -0
  99. package/lib/option/option.template.d.ts +4 -0
  100. package/lib/popup/index.d.ts +1 -3
  101. package/lib/popup/popup.d.ts +3 -2
  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 +2 -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 +2 -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 +2 -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 +2 -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 +2 -0
  123. package/lib/text-field/text-field.d.ts +14 -0
  124. package/lib/text-field/text-field.template.d.ts +4 -0
  125. package/lib/tooltip/index.d.ts +0 -1
  126. package/lib/tooltip/tooltip.d.ts +7 -7
  127. package/listbox/index.js +1086 -0
  128. package/menu/index.js +357 -0
  129. package/menu-item/index.js +90 -0
  130. package/nav/index.js +17 -0
  131. package/nav-disclosure/index.js +80 -0
  132. package/nav-item/index.js +44 -0
  133. package/note/index.js +59 -0
  134. package/number-field/index.js +460 -0
  135. package/option/index.js +75 -0
  136. package/package.json +62 -10
  137. package/popup/index.js +35 -2036
  138. package/progress/index.js +33 -38
  139. package/progress-ring/index.js +13 -13
  140. package/radio/index.js +52 -0
  141. package/radio-group/index.js +435 -0
  142. package/shared/affix.js +2 -8
  143. package/shared/anchor.js +11 -3
  144. package/shared/apply-mixins.js +5 -4
  145. package/shared/aria-global.js +2 -86
  146. package/shared/aria.js +9 -0
  147. package/shared/base-progress.js +6 -1
  148. package/shared/breadcrumb-item.js +2 -2
  149. package/shared/button.js +23 -0
  150. package/shared/button2.js +200 -0
  151. package/shared/calendar-event.js +19 -0
  152. package/shared/design-system/index.d.ts +1 -1
  153. package/shared/dialog-polyfill.esm.js +858 -0
  154. package/shared/direction.js +20 -0
  155. package/shared/divider.js +55 -0
  156. package/shared/dom.js +8 -0
  157. package/shared/elevation.js +10 -0
  158. package/shared/enums.js +70 -0
  159. package/shared/es.object.assign.js +2 -59
  160. package/shared/es.promise.resolve.js +944 -0
  161. package/shared/es.regexp.to-string.js +58 -0
  162. package/shared/focus.js +11 -0
  163. package/shared/focus2.js +5 -0
  164. package/shared/form-associated.js +466 -0
  165. package/shared/form-elements.js +343 -0
  166. package/shared/icon.js +32 -1153
  167. package/shared/index.js +3780 -83
  168. package/shared/index2.js +7 -19
  169. package/shared/key-codes.js +97 -0
  170. package/shared/listbox-option.js +201 -0
  171. package/shared/menu-item.js +277 -0
  172. package/shared/numbers.js +25 -0
  173. package/shared/patterns/focus.d.ts +3 -0
  174. package/shared/patterns/form-elements/form-elements.d.ts +31 -0
  175. package/shared/patterns/form-elements/index.d.ts +1 -0
  176. package/shared/patterns/index.d.ts +2 -0
  177. package/shared/popup.js +1484 -0
  178. package/shared/radio.js +127 -0
  179. package/shared/ref.js +41 -0
  180. package/shared/slotted.js +1 -1
  181. package/shared/start-end.js +50 -0
  182. package/shared/string-trim.js +39 -0
  183. package/shared/text-anchor.js +2 -13
  184. package/shared/text-anchor.template.js +6 -5
  185. package/shared/utils/index.d.ts +1 -0
  186. package/side-drawer/index.js +38 -34
  187. package/slider/index.js +596 -0
  188. package/styles/core/all.css +86 -0
  189. package/styles/core/theme.css +11 -0
  190. package/styles/core/typography.css +80 -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 +8 -3
  199. package/text-area/index.js +288 -0
  200. package/text-field/index.js +129 -0
  201. package/tooltip/index.js +59 -43
  202. package/vivid.api.json +2979 -0
  203. package/lib/text/text.d.ts +0 -10
  204. package/shared/style-inject.es.js +0 -28
  205. package/shared/web.dom-collections.iterator.js +0 -1479
  206. package/sidenav-item/index.js +0 -38
  207. package/styles/themes/dark.css +0 -205
  208. package/styles/themes/light.css +0 -205
  209. package/text/index.js +0 -45
@@ -0,0 +1,460 @@
1
+ import '../shared/es.promise.resolve.js';
2
+ import { F as FoundationElement, a2 as DOM, _ as __decorate, a as attr, a6 as nullableNumberConverter, V as observable, b as __metadata, h as html, g as getPrefix, d as designSystem } from '../shared/index.js';
3
+ import { l as loadComponentsModules } from '../shared/index2.js';
4
+ import { b as AffixIcon } from '../shared/affix.js';
5
+ import '../shared/focus2.js';
6
+ import { D as DelegatesARIATextbox, f as formElements, g as getFeedbackTemplate } from '../shared/form-elements.js';
7
+ import { S as StartEnd } from '../shared/start-end.js';
8
+ import { a as applyMixins } from '../shared/apply-mixins.js';
9
+ import { F as FormAssociated } from '../shared/form-associated.js';
10
+ import { f as keyArrowDown, e as keyArrowUp } from '../shared/key-codes.js';
11
+ import '../shared/es.regexp.to-string.js';
12
+ import { S as Shape } from '../shared/enums.js';
13
+ import { f as focusTemplateFactory } from '../shared/focus.js';
14
+ import { B as Button } from '../shared/button.js';
15
+ import { D as Divider } from '../shared/divider.js';
16
+ import { w as when } from '../shared/when.js';
17
+ import { r as ref } from '../shared/ref.js';
18
+ import { c as classNames } from '../shared/class-names.js';
19
+ import '../shared/icon.js';
20
+ import '../shared/string-trim.js';
21
+ import '../shared/_has.js';
22
+ import '../shared/aria-global.js';
23
+ import '../shared/button2.js';
24
+ import '../shared/aria.js';
25
+
26
+ class _NumberField extends FoundationElement {
27
+ }
28
+ /**
29
+ * A form-associated base class for the {@link @microsoft/fast-foundation#(NumberField:class)} component.
30
+ *
31
+ * @internal
32
+ */
33
+ class FormAssociatedNumberField extends FormAssociated(_NumberField) {
34
+ constructor() {
35
+ super(...arguments);
36
+ this.proxy = document.createElement("input");
37
+ }
38
+ }
39
+
40
+ /**
41
+ * A Number Field Custom HTML Element.
42
+ * Based largely on the {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/number | <input type="number" /> element }.
43
+ *
44
+ * @slot start - Content which can be provided before the number field input
45
+ * @slot end - Content which can be provided after the number field input
46
+ * @slot - The default slot for the label
47
+ * @slot step-up-glyph - The glyph for the step up control
48
+ * @slot step-down-glyph - The glyph for the step down control
49
+ * @csspart label - The label
50
+ * @csspart root - The element wrapping the control, including start and end slots
51
+ * @csspart control - The element representing the input
52
+ * @csspart controls - The step up and step down controls
53
+ * @csspart step-up - The step up control
54
+ * @csspart step-down - The step down control
55
+ * @fires input - Fires a custom 'input' event when the value has changed
56
+ * @fires change - Fires a custom 'change' event when the value has changed
57
+ *
58
+ * @public
59
+ */
60
+ class NumberField$1 extends FormAssociatedNumberField {
61
+ constructor() {
62
+ super(...arguments);
63
+ /**
64
+ * When true, spin buttons will not be rendered
65
+ * @public
66
+ * @remarks
67
+ * HTML Attribute: autofocus
68
+ */
69
+ this.hideStep = false;
70
+ /**
71
+ * Amount to increment or decrement the value by
72
+ * @public
73
+ * @remarks
74
+ * HTMLAttribute: step
75
+ */
76
+ this.step = 1;
77
+ /**
78
+ * Flag to indicate that the value change is from the user input
79
+ * @internal
80
+ */
81
+ this.isUserInput = false;
82
+ }
83
+ /**
84
+ * Ensures that the max is greater than the min and that the value
85
+ * is less than the max
86
+ * @param previous - the previous max value
87
+ * @param next - updated max value
88
+ *
89
+ * @internal
90
+ */
91
+ maxChanged(previous, next) {
92
+ var _a;
93
+ this.max = Math.max(next, (_a = this.min) !== null && _a !== void 0 ? _a : next);
94
+ const min = Math.min(this.min, this.max);
95
+ if (this.min !== undefined && this.min !== min) {
96
+ this.min = min;
97
+ }
98
+ this.value = this.getValidValue(this.value);
99
+ }
100
+ /**
101
+ * Ensures that the min is less than the max and that the value
102
+ * is greater than the min
103
+ * @param previous - previous min value
104
+ * @param next - updated min value
105
+ *
106
+ * @internal
107
+ */
108
+ minChanged(previous, next) {
109
+ var _a;
110
+ this.min = Math.min(next, (_a = this.max) !== null && _a !== void 0 ? _a : next);
111
+ const max = Math.max(this.min, this.max);
112
+ if (this.max !== undefined && this.max !== max) {
113
+ this.max = max;
114
+ }
115
+ this.value = this.getValidValue(this.value);
116
+ }
117
+ /**
118
+ * The value property, typed as a number.
119
+ *
120
+ * @public
121
+ */
122
+ get valueAsNumber() {
123
+ return parseFloat(super.value);
124
+ }
125
+ set valueAsNumber(next) {
126
+ this.value = next.toString();
127
+ }
128
+ /**
129
+ * Validates that the value is a number between the min and max
130
+ * @param previous - previous stored value
131
+ * @param next - value being updated
132
+ * @param updateControl - should the text field be updated with value, defaults to true
133
+ * @internal
134
+ */
135
+ valueChanged(previous, next) {
136
+ this.value = this.getValidValue(next);
137
+ if (next !== this.value) {
138
+ return;
139
+ }
140
+ if (this.control && !this.isUserInput) {
141
+ this.control.value = this.value;
142
+ }
143
+ super.valueChanged(previous, this.value);
144
+ if (previous !== undefined && !this.isUserInput) {
145
+ this.$emit("input");
146
+ this.$emit("change");
147
+ }
148
+ this.isUserInput = false;
149
+ }
150
+ /** {@inheritDoc (FormAssociated:interface).validate} */
151
+ validate() {
152
+ super.validate(this.control);
153
+ }
154
+ /**
155
+ * Sets the internal value to a valid number between the min and max properties
156
+ * @param value - user input
157
+ *
158
+ * @internal
159
+ */
160
+ getValidValue(value) {
161
+ var _a, _b;
162
+ let validValue = parseFloat(parseFloat(value).toPrecision(12));
163
+ if (isNaN(validValue)) {
164
+ validValue = "";
165
+ }
166
+ else {
167
+ validValue = Math.min(validValue, (_a = this.max) !== null && _a !== void 0 ? _a : validValue);
168
+ validValue = Math.max(validValue, (_b = this.min) !== null && _b !== void 0 ? _b : validValue).toString();
169
+ }
170
+ return validValue;
171
+ }
172
+ /**
173
+ * Increments the value using the step value
174
+ *
175
+ * @public
176
+ */
177
+ stepUp() {
178
+ const value = parseFloat(this.value);
179
+ const stepUpValue = !isNaN(value)
180
+ ? value + this.step
181
+ : this.min > 0
182
+ ? this.min
183
+ : this.max < 0
184
+ ? this.max
185
+ : !this.min
186
+ ? this.step
187
+ : 0;
188
+ this.value = stepUpValue.toString();
189
+ }
190
+ /**
191
+ * Decrements the value using the step value
192
+ *
193
+ * @public
194
+ */
195
+ stepDown() {
196
+ const value = parseFloat(this.value);
197
+ const stepDownValue = !isNaN(value)
198
+ ? value - this.step
199
+ : this.min > 0
200
+ ? this.min
201
+ : this.max < 0
202
+ ? this.max
203
+ : !this.min
204
+ ? 0 - this.step
205
+ : 0;
206
+ this.value = stepDownValue.toString();
207
+ }
208
+ /**
209
+ * Sets up the initial state of the number field
210
+ * @internal
211
+ */
212
+ connectedCallback() {
213
+ super.connectedCallback();
214
+ this.proxy.setAttribute("type", "number");
215
+ this.validate();
216
+ this.control.value = this.value;
217
+ if (this.autofocus) {
218
+ DOM.queueUpdate(() => {
219
+ this.focus();
220
+ });
221
+ }
222
+ }
223
+ /**
224
+ * Selects all the text in the number field
225
+ *
226
+ * @public
227
+ */
228
+ select() {
229
+ this.control.select();
230
+ /**
231
+ * The select event does not permeate the shadow DOM boundary.
232
+ * This fn effectively proxies the select event,
233
+ * emitting a `select` event whenever the internal
234
+ * control emits a `select` event
235
+ */
236
+ this.$emit("select");
237
+ }
238
+ /**
239
+ * Handles the internal control's `input` event
240
+ * @internal
241
+ */
242
+ handleTextInput() {
243
+ this.control.value = this.control.value.replace(/[^0-9\-+e.]/g, "");
244
+ this.isUserInput = true;
245
+ this.value = this.control.value;
246
+ }
247
+ /**
248
+ * Change event handler for inner control.
249
+ * @remarks
250
+ * "Change" events are not `composable` so they will not
251
+ * permeate the shadow DOM boundary. This fn effectively proxies
252
+ * the change event, emitting a `change` event whenever the internal
253
+ * control emits a `change` event
254
+ * @internal
255
+ */
256
+ handleChange() {
257
+ this.$emit("change");
258
+ }
259
+ /**
260
+ * Handles the internal control's `keydown` event
261
+ * @internal
262
+ */
263
+ handleKeyDown(e) {
264
+ const key = e.key;
265
+ switch (key) {
266
+ case keyArrowUp:
267
+ this.stepUp();
268
+ return false;
269
+ case keyArrowDown:
270
+ this.stepDown();
271
+ return false;
272
+ }
273
+ return true;
274
+ }
275
+ /**
276
+ * Handles populating the input field with a validated value when
277
+ * leaving the input field.
278
+ * @internal
279
+ */
280
+ handleBlur() {
281
+ this.control.value = this.value;
282
+ }
283
+ }
284
+ __decorate([
285
+ attr({ attribute: "readonly", mode: "boolean" })
286
+ ], NumberField$1.prototype, "readOnly", void 0);
287
+ __decorate([
288
+ attr({ mode: "boolean" })
289
+ ], NumberField$1.prototype, "autofocus", void 0);
290
+ __decorate([
291
+ attr({ attribute: "hide-step", mode: "boolean" })
292
+ ], NumberField$1.prototype, "hideStep", void 0);
293
+ __decorate([
294
+ attr
295
+ ], NumberField$1.prototype, "placeholder", void 0);
296
+ __decorate([
297
+ attr
298
+ ], NumberField$1.prototype, "list", void 0);
299
+ __decorate([
300
+ attr({ converter: nullableNumberConverter })
301
+ ], NumberField$1.prototype, "maxlength", void 0);
302
+ __decorate([
303
+ attr({ converter: nullableNumberConverter })
304
+ ], NumberField$1.prototype, "minlength", void 0);
305
+ __decorate([
306
+ attr({ converter: nullableNumberConverter })
307
+ ], NumberField$1.prototype, "size", void 0);
308
+ __decorate([
309
+ attr({ converter: nullableNumberConverter })
310
+ ], NumberField$1.prototype, "step", void 0);
311
+ __decorate([
312
+ attr({ converter: nullableNumberConverter })
313
+ ], NumberField$1.prototype, "max", void 0);
314
+ __decorate([
315
+ attr({ converter: nullableNumberConverter })
316
+ ], NumberField$1.prototype, "min", void 0);
317
+ __decorate([
318
+ observable
319
+ ], NumberField$1.prototype, "defaultSlottedNodes", void 0);
320
+ applyMixins(NumberField$1, StartEnd, DelegatesARIATextbox);
321
+
322
+ var css_248z = "/**\n * Do not edit directly\n * Generated on Sun, 04 Dec 2022 15:37:45 GMT\n */\n:host {\n display: inline-block;\n}\n\n.base {\n display: inline-grid;\n width: 100%;\n gap: 4px;\n grid-template-columns: min-content 1fr max-content;\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.base.appearance-ghost {\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(--vvd-color-canvas-text);\n --_appearance-color-fill: var(--_connotation-color-backdrop);\n --_appearance-color-outline: var(--_connotation-color-firm);\n}\n.base:where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)).appearance-ghost {\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-400);\n --_appearance-color-fill: var(--vvd-color-neutral-200);\n --_appearance-color-outline: var(--vvd-color-neutral-400);\n}\n.base:where(:disabled, .disabled).appearance-ghost {\n --_appearance-color-text: var(--vvd-color-neutral-400);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.base:where(.readonly):where(:not(:disabled, .disabled)) {\n --_appearance-color-text: var(--vvd-color-neutral-800);\n --_appearance-color-fill: var(--vvd-color-neutral-200);\n --_appearance-color-outline: var(--vvd-color-neutral-500);\n}\n.base:where(.readonly):where(:not(:disabled, .disabled)).appearance-ghost {\n --_appearance-color-text: var(--vvd-color-neutral-400);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.base.connotation-success {\n --_connotation-color-primary: var(--vvd-color-success-500);\n --_connotation-color-backdrop: var(--vvd-color-success-50);\n --_connotation-color-intermediate: var(--vvd-color-success-500);\n --_connotation-color-firm: var(--vvd-color-success-600);\n}\n.base.connotation-alert {\n --_connotation-color-primary: var(--vvd-color-alert-500);\n --_connotation-color-backdrop: var(--vvd-color-alert-50);\n --_connotation-color-intermediate: var(--vvd-color-alert-500);\n --_connotation-color-firm: var(--vvd-color-alert-600);\n}\n.base:not(.connotation-success, .connotation-alert) {\n --_connotation-color-primary: var(--vvd-color-canvas-text);\n --_connotation-color-backdrop: var(--vvd-color-canvas);\n --_connotation-color-intermediate: var(--vvd-color-neutral-500);\n --_connotation-color-firm: var(--vvd-color-canvas-text);\n}\n@supports (user-select: none) {\n .base {\n user-select: none;\n }\n}\n.base:not(.disabled) {\n --_low-ink-color: var(--vvd-color-neutral-600);\n}\n.base.disabled {\n --_low-ink-color: var(--_appearance-color-text);\n}\n\n.label {\n color: var(--vvd-color-canvas-text);\n contain: inline-size;\n font: var(--vvd-typography-base);\n grid-column: 1/4;\n grid-row: 1;\n}\n.char-count + .label {\n grid-column: 1/3;\n}\n\n.char-count {\n color: var(--_low-ink-color);\n font: var(--vvd-typography-base);\n grid-column: 3/4;\n}\n\n.fieldset {\n position: relative;\n display: flex;\n align-items: center;\n grid-column: 1/4;\n transition: color 0.2s;\n /* Shape */\n}\n.base > .fieldset {\n block-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2)));\n}\n.base:not(.shape-pill) .fieldset {\n border-radius: 6px;\n}\n.base.shape-pill .fieldset {\n border-radius: 24px;\n}\n\n.control {\n width: 100%;\n border: 0 none;\n background-color: var(--_appearance-color-fill);\n block-size: 100%;\n border-radius: inherit;\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 padding-inline-end: 16px;\n padding-inline-start: 16px;\n transition: box-shadow 0.2s, background-color 0.2s;\n}\n.control:disabled {\n cursor: not-allowed;\n opacity: 1; /* 2. correct opacity on iOS */\n -webkit-text-fill-color: var(--_appearance-color-text); /* 1. sets text fill to current `color` for safari */\n}\n.control::placeholder, .control:disabled::placeholder {\n opacity: 1; /* 2. correct opacity on iOS */\n -webkit-text-fill-color: var(--_low-ink-color); /* 1. sets text fill to current `color` for safari */\n}\n@supports selector(:focus-visible) {\n .control:focus {\n outline: none;\n }\n}\n\n.icon {\n position: absolute;\n z-index: 1;\n color: var(--_low-ink-color);\n font-size: 20px;\n inset-inline-start: 16px;\n}\n.icon + .control {\n padding-inline-start: 44px;\n}\n\n.focus-indicator {\n --focus-stroke-gap-color: transparent;\n pointer-events: none;\n}\n.fieldset:not(:focus-visible, :focus-within) > .focus-indicator {\n display: none;\n}\n\n.control {\n padding-inline-end: 70px;\n}\n.control::-webkit-outer-spin-button, .control::-webkit-inner-spin-button {\n appearance: none;\n}\n.control-buttons {\n position: absolute;\n z-index: 1;\n right: 3px;\n display: flex;\n}\n.readonly .control-buttons, .disabled .control-buttons {\n pointer-events: none;\n}\n.control-buttons .divider {\n margin-block: 8px;\n}\n.control-buttons > * {\n flex-shrink: 0;\n}\n\n.disabled .focus-indicator {\n display: none;\n pointer-events: none;\n}";
323
+
324
+ let NumberField = class NumberField extends NumberField$1 {};
325
+ __decorate([attr, __metadata("design:type", String)], NumberField.prototype, "appearance", void 0);
326
+ __decorate([attr, __metadata("design:type", String)], NumberField.prototype, "shape", void 0);
327
+ __decorate([attr, __metadata("design:type", String)], NumberField.prototype, "autoComplete", void 0);
328
+ NumberField = __decorate([formElements], NumberField);
329
+ applyMixins(NumberField, AffixIcon);
330
+
331
+ let _ = t => t,
332
+ _t,
333
+ _t2,
334
+ _t3;
335
+ const ADD = 1;
336
+ const SUBTRACT = -1;
337
+ const getStateClasses = ({
338
+ errorValidationMessage,
339
+ disabled,
340
+ value,
341
+ readOnly,
342
+ placeholder,
343
+ appearance,
344
+ shape,
345
+ label,
346
+ successText
347
+ }) => classNames(['error connotation-alert', Boolean(errorValidationMessage)], ['disabled', disabled], ['has-value', Boolean(value)], ['readonly', readOnly], ['placeholder', Boolean(placeholder)], [`appearance-${appearance}`, Boolean(appearance)], [`shape-${shape}`, Boolean(shape)], ['no-label', !label], ['success connotation-success', !!successText]);
348
+ function renderLabel() {
349
+ return html(_t || (_t = _`
350
+ <label for="control" class="label">
351
+ ${0}
352
+ </label>`), x => x.label);
353
+ }
354
+ function adjustValueByStep(numberField, direction = ADD) {
355
+ numberField.value = (Number(numberField.value) + direction * (numberField.step ? numberField.step : 1)).toString();
356
+ }
357
+ function setControlButtonShape(numberField) {
358
+ return numberField.shape === Shape.Pill ? Shape.Pill : null;
359
+ }
360
+ function getTabIndex(numberField) {
361
+ return numberField.disabled || numberField.readOnly ? '-1' : null;
362
+ }
363
+ function numberControlButtons(context) {
364
+ const buttonTag = context.tagFor(Button);
365
+ const dividerTag = context.tagFor(Divider);
366
+ return html(_t2 || (_t2 = _`
367
+ <div class="control-buttons"
368
+ ?inert="${0}">
369
+ <${0} id="subtract" icon="minus-line"
370
+ aria-controls="control"
371
+ shape="${0}"
372
+ size="condensed"
373
+ tabindex="${0}"
374
+ @click="${0}"></${0}>
375
+ <${0} class="divider" orientation="vertical"></${0}>
376
+ <${0} id="add" icon="plus-line"
377
+ aria-controls="control"
378
+ shape="${0}"
379
+ size="condensed"
380
+ tabindex="${0}"
381
+ @click="${0}"></${0}>
382
+ </div>
383
+ `), x => x.disabled || x.readOnly, buttonTag, setControlButtonShape, getTabIndex, x => adjustValueByStep(x, SUBTRACT), buttonTag, dividerTag, dividerTag, buttonTag, setControlButtonShape, getTabIndex, x => adjustValueByStep(x), buttonTag);
384
+ }
385
+ const NumberFieldTemplate = context => {
386
+ const focusTemplate = focusTemplateFactory(context);
387
+ return html(_t3 || (_t3 = _`
388
+ <div class="base ${0}">
389
+ ${0}
390
+ <div class="fieldset">
391
+ <input class="control"
392
+ id="control"
393
+ @input="${0}"
394
+ @change="${0}"
395
+ ?autofocus="${0}"
396
+ ?disabled="${0}"
397
+ list="${0}"
398
+ step="${0}"
399
+ max="${0}"
400
+ min="${0}"
401
+ maxlength="${0}"
402
+ minlength="${0}"
403
+ placeholder="${0}"
404
+ ?readonly="${0}"
405
+ ?required="${0}"
406
+ size="${0}"
407
+ autocomplete="${0}"
408
+ name="${0}"
409
+ ?spellcheck="${0}"
410
+ :value="${0}"
411
+ type="text"
412
+ aria-atomic="${0}"
413
+ aria-busy="${0}"
414
+ aria-controls="${0}"
415
+ aria-current="${0}"
416
+ aria-describedby="${0}"
417
+ aria-details="${0}"
418
+ aria-disabled="${0}"
419
+ aria-errormessage="${0}"
420
+ aria-flowto="${0}"
421
+ aria-haspopup="${0}"
422
+ aria-hidden="${0}"
423
+ aria-invalid="${0}"
424
+ aria-keyshortcuts="${0}"
425
+ aria-label="${0}"
426
+ aria-labelledby="${0}"
427
+ aria-live="${0}"
428
+ aria-owns="${0}"
429
+ aria-relevant="${0}"
430
+ aria-roledescription="${0}"
431
+ ${0}
432
+ />
433
+ ${0}
434
+ ${0}
435
+ </div>
436
+ ${0}
437
+ ${0}
438
+ ${0}
439
+ </div>
440
+ `), getStateClasses, when(x => x.label, renderLabel()), x => x.handleTextInput(), x => x.handleChange(), x => x.autofocus, x => x.disabled, x => x.list, x => x.step ? x.step : null, x => x.max, x => x.min, x => x.maxlength, x => x.minlength, x => x.placeholder, x => x.readOnly, x => x.required, x => x.size, x => x.autoComplete, x => x.name, x => x.spellcheck, x => x.value, x => x.ariaAtomic, x => x.ariaBusy, x => x.ariaControls, x => x.ariaCurrent, x => x.ariaDescribedby, x => x.ariaDetails, x => x.ariaDisabled, x => x.ariaErrormessage, x => x.ariaFlowto, x => x.ariaHaspopup, x => x.ariaHidden, x => x.ariaInvalid, x => x.ariaKeyshortcuts, x => x.ariaLabel, x => x.ariaLabelledby, x => x.ariaLive, x => x.ariaOwns, x => x.ariaRelevant, x => x.ariaRoledescription, ref('control'), () => focusTemplate, () => numberControlButtons(context), when(x => {
441
+ var _a;
442
+ return !x.successText && !x.errorValidationMessage && ((_a = x.helperText) === null || _a === void 0 ? void 0 : _a.length);
443
+ }, getFeedbackTemplate('helper', context)), when(x => !x.successText && x.errorValidationMessage, getFeedbackTemplate('error', context)), when(x => x.successText, getFeedbackTemplate('success', context)));
444
+ };
445
+
446
+ const prefix = getPrefix(import.meta.url);
447
+ const vividNumberField = NumberField.compose({
448
+ baseName: 'number-field',
449
+ template: NumberFieldTemplate,
450
+ styles: css_248z,
451
+ shadowOptions: {
452
+ delegatesFocus: true
453
+ }
454
+ });
455
+ (async () => {
456
+ await loadComponentsModules(['button', 'divider'], prefix);
457
+ designSystem.withPrefix(prefix).register(vividNumberField());
458
+ })();
459
+
460
+ export { vividNumberField };
@@ -0,0 +1,75 @@
1
+ import '../shared/es.promise.resolve.js';
2
+ import { _ as __decorate, a as attr, b as __metadata, h as html, g as getPrefix, d as designSystem } from '../shared/index.js';
3
+ import { l as loadComponentsModules } from '../shared/index2.js';
4
+ import { A as AffixIconWithTrailing, a as affixIconTemplateFactory } from '../shared/affix.js';
5
+ import { L as ListboxOption$1 } from '../shared/listbox-option.js';
6
+ import { a as applyMixins } from '../shared/apply-mixins.js';
7
+ import { f as focusTemplateFactory } from '../shared/focus.js';
8
+ import '../shared/icon.js';
9
+ import { w as when } from '../shared/when.js';
10
+ import { c as classNames } from '../shared/class-names.js';
11
+ import '../shared/aria-global.js';
12
+ import '../shared/start-end.js';
13
+ import '../shared/ref.js';
14
+ import '../shared/dom.js';
15
+ import '../shared/focus2.js';
16
+ import '../shared/string-trim.js';
17
+ import '../shared/_has.js';
18
+
19
+ class ListboxOption extends ListboxOption$1 {
20
+ set text(value) {
21
+ this._text = value;
22
+ }
23
+ get text() {
24
+ var _a;
25
+ return (_a = this._text) !== null && _a !== void 0 ? _a : '';
26
+ }
27
+ }
28
+ __decorate([attr({
29
+ attribute: 'text'
30
+ }), __metadata("design:type", String)], ListboxOption.prototype, "_text", void 0);
31
+ applyMixins(ListboxOption, AffixIconWithTrailing);
32
+
33
+ let _ = t => t,
34
+ _t,
35
+ _t2;
36
+ const getClasses = ({
37
+ icon,
38
+ disabled,
39
+ selected,
40
+ checked
41
+ }) => classNames('base', ['disabled', disabled], ['selected', Boolean(selected)], ['active', Boolean(checked)], ['icon', Boolean(icon)]);
42
+ const ListboxOptionTemplate = context => {
43
+ const affixIconTemplate = affixIconTemplateFactory(context);
44
+ const focusTemplate = focusTemplateFactory(context);
45
+ return html(_t || (_t = _`
46
+ <template
47
+ aria-checked="${0}"
48
+ aria-disabled="${0}"
49
+ aria-posinset="${0}"
50
+ aria-selected="${0}"
51
+ aria-setsize="${0}"
52
+ role="option">
53
+ <div class="${0}">
54
+ ${0}
55
+ ${0}
56
+ ${0}
57
+ </div>
58
+ </template>
59
+ `), x => x.ariaChecked, x => x.ariaDisabled, x => x.ariaPosInSet, x => x.ariaSelected, x => x.ariaSetSize, getClasses, () => focusTemplate, x => affixIconTemplate(x.icon), when(x => x.text, html(_t2 || (_t2 = _`<div class="text">${0}</div>`), x => x.text)));
60
+ };
61
+
62
+ var css_248z = "/**\n * Do not edit directly\n * Generated on Sun, 04 Dec 2022 15:37:45 GMT\n */\n.base {\n position: relative; /* this is needed for the focus */\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 font: var(--vvd-typography-base);\n gap: 12px;\n hyphens: auto;\n inline-size: 100%;\n min-block-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2)));\n padding-block: 10px;\n padding-inline: 16px;\n vertical-align: middle;\n word-break: break-word;\n}\n.base {\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.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-400);\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-text);\n --_appearance-color-fill: var(--_connotation-color-primary);\n --_appearance-color-outline: transparent;\n}\n.base: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@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}\n.base .text {\n font: var(--vvd-typography-base);\n}\n\n.icon {\n font-size: 20px;\n}\n.base:not(.disabled, .selected) .icon {\n color: var(--vvd-color-neutral-600);\n}\n\n.focus-indicator {\n --focus-stroke-color: var(--vvd-color-neutral-500);\n --focus-stroke-gap-color: transparent;\n}\n:host(:not([aria-checked=true])) .focus-indicator {\n display: none;\n}";
63
+
64
+ const prefix = getPrefix(import.meta.url);
65
+ const vividListboxOption = ListboxOption.compose({
66
+ baseName: 'option',
67
+ template: ListboxOptionTemplate,
68
+ styles: css_248z
69
+ });
70
+ (async () => {
71
+ await loadComponentsModules(['icon', 'focus'], prefix);
72
+ designSystem.withPrefix(prefix).register(vividListboxOption());
73
+ })();
74
+
75
+ export { vividListboxOption };
package/package.json CHANGED
@@ -1,19 +1,71 @@
1
1
  {
2
2
  "name": "@vonage/vivid",
3
- "version": "3.0.0-next.11",
3
+ "version": "3.0.0-next.110",
4
4
  "type": "module",
5
- "module": "./index.esm.js",
6
- "main": "index.js",
5
+ "module": "./index.js",
6
+ "main": "./index.js",
7
+ "customElements": "./custom-elements.json",
8
+ "homepage": "https://vivid.deno.dev",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/vonage/vivid-3",
12
+ "directory": "libs/components"
13
+ },
14
+ "bugs": {
15
+ "url": "https://github.com/Vonage/vivid-3/issues"
16
+ },
17
+ "license": "Apache-2.0",
7
18
  "exports": {
8
- "import": "./index.js"
19
+ "./accordion": "./accordion",
20
+ "./accordion-item": "./accordion-item",
21
+ "./action-group": "./action-group",
22
+ "./avatar": "./avatar",
23
+ "./badge": "./badge",
24
+ "./banner": "./banner",
25
+ "./breadcrumb": "./breadcrumb",
26
+ "./breadcrumb-item": "./breadcrumb-item",
27
+ "./button": "./button",
28
+ "./calendar": "./calendar",
29
+ "./calendar-event": "./calendar-event",
30
+ "./card": "./card",
31
+ "./checkbox": "./checkbox",
32
+ "./elevation": "./elevation",
33
+ "./dialog": "./dialog",
34
+ "./divider": "./divider",
35
+ "./fab": "./fab",
36
+ "./icon": "./icon",
37
+ "./layout": "./layout",
38
+ "./listbox": "./listbox",
39
+ "./menu": "./menu",
40
+ "./menu-item": "./menu-item",
41
+ "./nav": "./nav",
42
+ "./nav-disclosure": "./nav-disclosure",
43
+ "./nav-item": "./nav-item",
44
+ "./number-field": "./number-field",
45
+ "./note": "./note",
46
+ "./option": "./option",
47
+ "./popup": "./popup",
48
+ "./progress": "./progress",
49
+ "./progress-ring": "./progress-ring",
50
+ "./radio": "./radio",
51
+ "./radio-group": "./radio-group",
52
+ "./side-drawer": "./side-drawer",
53
+ "./slider": "./slider",
54
+ "./switch": "./switch",
55
+ "./text-field": "./text-field",
56
+ "./text-area": "./text-area",
57
+ "./tooltip": "./tooltip"
9
58
  },
10
- "typings": "./index.d.ts",
59
+ "types": "./index.d.ts",
11
60
  "dependencies": {
12
- "@microsoft/fast-element": "^1.9.0",
13
- "@microsoft/fast-foundation": "^2.41.1",
14
- "@microsoft/fast-web-utilities": "^5.2.0",
15
- "ramda": "^0.27.2",
16
- "@floating-ui/dom": "^0.4.0"
61
+ "rollup-plugin-postcss": "4.0.2",
62
+ "@jest/globals": "28.1.3",
63
+ "@microsoft/fast-element": "1.11.0",
64
+ "@microsoft/fast-foundation": "2.47.0",
65
+ "@microsoft/fast-web-utilities": "5.4.1",
66
+ "ramda": "0.27.2",
67
+ "dialog-polyfill": "0.5.6",
68
+ "@floating-ui/dom": "0.5.4"
17
69
  },
18
70
  "peerDependencies": {}
19
71
  }