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

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