@vonage/vivid 3.0.0-next.9 → 3.0.0-next.90

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 (190) hide show
  1. package/README.md +141 -4
  2. package/accordion/index.js +3 -12
  3. package/accordion-item/index.js +30 -38
  4. package/action-group/index.js +41 -0
  5. package/avatar/index.js +60 -0
  6. package/badge/index.js +16 -30
  7. package/banner/index.js +25 -111
  8. package/breadcrumb/index.js +21 -18
  9. package/breadcrumb-item/index.js +23 -20
  10. package/button/index.js +19 -757
  11. package/calendar/index.js +72 -67
  12. package/calendar-event/index.js +112 -0
  13. package/card/index.js +113 -0
  14. package/checkbox/index.js +176 -0
  15. package/dialog/index.js +229 -0
  16. package/divider/index.js +4 -0
  17. package/elevation/index.js +3 -31
  18. package/fab/index.js +99 -0
  19. package/focus/index.js +18 -3
  20. package/header/index.js +61 -0
  21. package/icon/index.js +10 -9
  22. package/index.js +57 -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 +6 -5
  41. package/lib/button/index.d.ts +2 -19
  42. package/lib/calendar/calendar.d.ts +3 -1
  43. package/lib/calendar/index.d.ts +0 -1
  44. package/lib/calendar-event/calendar-event.d.ts +14 -0
  45. package/lib/calendar-event/calendar-event.template.d.ts +4 -0
  46. package/lib/calendar-event/index.d.ts +2 -0
  47. package/lib/card/card.d.ts +10 -0
  48. package/lib/{text/text.template.d.ts → card/card.template.d.ts} +2 -2
  49. package/lib/card/index.d.ts +4 -0
  50. package/lib/checkbox/checkbox.d.ts +5 -0
  51. package/lib/checkbox/checkbox.template.d.ts +4 -0
  52. package/lib/checkbox/index.d.ts +4 -0
  53. package/lib/components.d.ts +29 -10
  54. package/lib/dialog/dialog.d.ts +20 -0
  55. package/lib/dialog/dialog.template.d.ts +4 -0
  56. package/lib/dialog/index.d.ts +5 -0
  57. package/lib/divider/divider.d.ts +3 -0
  58. package/lib/divider/divider.template.d.ts +4 -0
  59. package/lib/divider/index.d.ts +2 -0
  60. package/lib/elevation/elevation.d.ts +1 -0
  61. package/lib/elevation/index.d.ts +1 -1
  62. package/lib/enums.d.ts +11 -6
  63. package/lib/fab/fab.d.ts +13 -0
  64. package/lib/fab/fab.template.d.ts +4 -0
  65. package/lib/fab/index.d.ts +4 -0
  66. package/lib/focus/index.d.ts +1 -1
  67. package/lib/header/header.d.ts +5 -0
  68. package/lib/header/header.template.d.ts +4 -0
  69. package/lib/header/index.d.ts +3 -0
  70. package/lib/icon/icon.d.ts +4 -3
  71. package/lib/layout/index.d.ts +1 -1
  72. package/lib/layout/layout.d.ts +3 -3
  73. package/lib/listbox-option/index.d.ts +4 -0
  74. package/lib/listbox-option/listbox-option.d.ts +7 -0
  75. package/lib/listbox-option/listbox-option.template.d.ts +4 -0
  76. package/lib/menu/index.d.ts +12 -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 +3 -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 +4 -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 +4 -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/{text → note}/index.d.ts +1 -1
  92. package/lib/note/note.d.ts +10 -0
  93. package/lib/note/note.template.d.ts +5 -0
  94. package/lib/number-field/index.d.ts +4 -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/popup/index.d.ts +1 -1
  98. package/lib/popup/popup.d.ts +2 -1
  99. package/lib/progress/progress.d.ts +1 -1
  100. package/lib/progress-ring/progress-ring.d.ts +2 -1
  101. package/lib/radio/index.d.ts +3 -0
  102. package/lib/radio/radio.d.ts +4 -0
  103. package/lib/radio/radio.template.d.ts +4 -0
  104. package/lib/radio-group/index.d.ts +10 -0
  105. package/lib/radio-group/radio-group.d.ts +4 -0
  106. package/lib/radio-group/radio-group.template.d.ts +4 -0
  107. package/lib/side-drawer/index.d.ts +1 -1
  108. package/lib/side-drawer/side-drawer.d.ts +3 -2
  109. package/lib/text-anchor/text-anchor.d.ts +1 -1
  110. package/lib/text-area/index.d.ts +4 -0
  111. package/lib/text-area/text-area.d.ts +9 -0
  112. package/lib/text-area/text-area.template.d.ts +4 -0
  113. package/lib/text-field/index.d.ts +4 -0
  114. package/lib/text-field/text-field.d.ts +14 -0
  115. package/lib/text-field/text-field.template.d.ts +5 -0
  116. package/lib/tooltip/tooltip.d.ts +2 -2
  117. package/listbox-option/index.js +248 -0
  118. package/menu/index.js +376 -0
  119. package/menu-item/index.js +20 -0
  120. package/nav/index.js +17 -0
  121. package/nav-disclosure/index.js +81 -0
  122. package/nav-item/index.js +45 -0
  123. package/note/index.js +58 -0
  124. package/number-field/index.js +516 -0
  125. package/package.json +58 -10
  126. package/popup/index.js +22 -2061
  127. package/progress/index.js +35 -36
  128. package/progress-ring/index.js +11 -11
  129. package/radio/index.js +50 -0
  130. package/radio-group/index.js +435 -0
  131. package/shared/affix.js +1 -6
  132. package/shared/anchor.js +10 -2
  133. package/shared/apply-mixins.js +5 -4
  134. package/shared/aria-global.js +2 -86
  135. package/shared/aria.js +9 -0
  136. package/shared/base-progress.js +5 -0
  137. package/shared/breadcrumb-item.js +1 -1
  138. package/shared/button.js +200 -0
  139. package/shared/calendar-event.js +19 -0
  140. package/shared/dialog-polyfill.esm.js +858 -0
  141. package/shared/direction.js +20 -0
  142. package/shared/enums.js +62 -0
  143. package/shared/es.object.assign.js +3 -2
  144. package/shared/export.js +1017 -0
  145. package/shared/focus.js +5 -0
  146. package/shared/focus2.js +11 -0
  147. package/shared/form-associated.js +466 -0
  148. package/shared/form-elements.js +331 -0
  149. package/shared/icon.js +534 -531
  150. package/shared/index.js +108 -79
  151. package/shared/index2.js +100 -14
  152. package/shared/index3.js +31 -0
  153. package/shared/index4.js +77 -0
  154. package/shared/index5.js +1525 -0
  155. package/shared/index6.js +349 -0
  156. package/shared/iterators.js +61 -0
  157. package/shared/key-codes.js +96 -0
  158. package/shared/object-keys.js +13 -0
  159. package/shared/patterns/focus.d.ts +3 -0
  160. package/shared/patterns/form-elements/form-elements.d.ts +28 -0
  161. package/shared/patterns/form-elements/index.d.ts +1 -0
  162. package/shared/patterns/index.d.ts +2 -0
  163. package/shared/radio.js +127 -0
  164. package/shared/ref.js +41 -0
  165. package/shared/slotted.js +1 -1
  166. package/shared/start-end.js +50 -0
  167. package/shared/text-anchor.js +2 -13
  168. package/shared/text-anchor.template.js +6 -5
  169. package/shared/to-string.js +51 -0
  170. package/shared/web.dom-collections.iterator.js +74 -1081
  171. package/side-drawer/index.js +41 -33
  172. package/styles/core/all.css +75 -0
  173. package/styles/core/theme.css +11 -0
  174. package/styles/core/typography.css +69 -0
  175. package/styles/fonts/SpeziaCompleteVariableItalicWeb.woff2 +0 -0
  176. package/styles/fonts/SpeziaCompleteVariableUprightWeb.woff2 +0 -0
  177. package/styles/fonts/SpeziaMonoCompleteVariableWeb.woff2 +0 -0
  178. package/styles/fonts/spezia.css +9 -12
  179. package/styles/tokens/theme-dark.css +230 -0
  180. package/styles/tokens/theme-light.css +230 -0
  181. package/text-anchor/index.js +9 -1
  182. package/text-area/index.js +288 -0
  183. package/text-field/index.js +129 -0
  184. package/tooltip/index.js +23 -24
  185. package/lib/text/text.d.ts +0 -10
  186. package/shared/style-inject.es.js +0 -28
  187. package/sidenav-item/index.js +0 -38
  188. package/styles/themes/dark.css +0 -205
  189. package/styles/themes/light.css +0 -205
  190. package/text/index.js +0 -45
@@ -0,0 +1,331 @@
1
+ import { F as FoundationElement, D as DOM, _ as __decorate, a as attr, n as nullableNumberConverter, o as observable, b as __metadata, v as volatile, h as html, c as __classPrivateFieldGet, j as __classPrivateFieldSet } from './index.js';
2
+ import { a as applyMixins } from './apply-mixins.js';
3
+ import { F as FormAssociated } from './form-associated.js';
4
+ import { A as ARIAGlobalStatesAndProperties } from './aria-global.js';
5
+ import { S as StartEnd } from './start-end.js';
6
+ import './web.dom-collections.iterator.js';
7
+ import { I as Icon } from './icon.js';
8
+ import { w as when } from './when.js';
9
+
10
+ class _TextField extends FoundationElement {
11
+ }
12
+ /**
13
+ * A form-associated base class for the {@link @microsoft/fast-foundation#(TextField:class)} component.
14
+ *
15
+ * @internal
16
+ */
17
+ class FormAssociatedTextField extends FormAssociated(_TextField) {
18
+ constructor() {
19
+ super(...arguments);
20
+ this.proxy = document.createElement("input");
21
+ }
22
+ }
23
+
24
+ /**
25
+ * Text field sub-types
26
+ * @public
27
+ */
28
+ const TextFieldType = {
29
+ /**
30
+ * An email TextField
31
+ */
32
+ email: "email",
33
+ /**
34
+ * A password TextField
35
+ */
36
+ password: "password",
37
+ /**
38
+ * A telephone TextField
39
+ */
40
+ tel: "tel",
41
+ /**
42
+ * A text TextField
43
+ */
44
+ text: "text",
45
+ /**
46
+ * A URL TextField
47
+ */
48
+ url: "url",
49
+ };
50
+
51
+ /**
52
+ * A Text Field Custom HTML Element.
53
+ * Based largely on the {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/text | <input type="text" /> element }.
54
+ *
55
+ * @slot start - Content which can be provided before the number field input
56
+ * @slot end - Content which can be provided after the number field input
57
+ * @slot - The default slot for the label
58
+ * @csspart label - The label
59
+ * @csspart root - The element wrapping the control, including start and end slots
60
+ * @csspart control - The text field element
61
+ * @fires change - Fires a custom 'change' event when the value has changed
62
+ *
63
+ * @public
64
+ */
65
+ class TextField extends FormAssociatedTextField {
66
+ constructor() {
67
+ super(...arguments);
68
+ /**
69
+ * Allows setting a type or mode of text.
70
+ * @public
71
+ * @remarks
72
+ * HTML Attribute: type
73
+ */
74
+ this.type = TextFieldType.text;
75
+ }
76
+ readOnlyChanged() {
77
+ if (this.proxy instanceof HTMLInputElement) {
78
+ this.proxy.readOnly = this.readOnly;
79
+ this.validate();
80
+ }
81
+ }
82
+ autofocusChanged() {
83
+ if (this.proxy instanceof HTMLInputElement) {
84
+ this.proxy.autofocus = this.autofocus;
85
+ this.validate();
86
+ }
87
+ }
88
+ placeholderChanged() {
89
+ if (this.proxy instanceof HTMLInputElement) {
90
+ this.proxy.placeholder = this.placeholder;
91
+ }
92
+ }
93
+ typeChanged() {
94
+ if (this.proxy instanceof HTMLInputElement) {
95
+ this.proxy.type = this.type;
96
+ this.validate();
97
+ }
98
+ }
99
+ listChanged() {
100
+ if (this.proxy instanceof HTMLInputElement) {
101
+ this.proxy.setAttribute("list", this.list);
102
+ this.validate();
103
+ }
104
+ }
105
+ maxlengthChanged() {
106
+ if (this.proxy instanceof HTMLInputElement) {
107
+ this.proxy.maxLength = this.maxlength;
108
+ this.validate();
109
+ }
110
+ }
111
+ minlengthChanged() {
112
+ if (this.proxy instanceof HTMLInputElement) {
113
+ this.proxy.minLength = this.minlength;
114
+ this.validate();
115
+ }
116
+ }
117
+ patternChanged() {
118
+ if (this.proxy instanceof HTMLInputElement) {
119
+ this.proxy.pattern = this.pattern;
120
+ this.validate();
121
+ }
122
+ }
123
+ sizeChanged() {
124
+ if (this.proxy instanceof HTMLInputElement) {
125
+ this.proxy.size = this.size;
126
+ }
127
+ }
128
+ spellcheckChanged() {
129
+ if (this.proxy instanceof HTMLInputElement) {
130
+ this.proxy.spellcheck = this.spellcheck;
131
+ }
132
+ }
133
+ /**
134
+ * @internal
135
+ */
136
+ connectedCallback() {
137
+ super.connectedCallback();
138
+ this.proxy.setAttribute("type", this.type);
139
+ this.validate();
140
+ if (this.autofocus) {
141
+ DOM.queueUpdate(() => {
142
+ this.focus();
143
+ });
144
+ }
145
+ }
146
+ /**
147
+ * Selects all the text in the text field
148
+ *
149
+ * @public
150
+ */
151
+ select() {
152
+ this.control.select();
153
+ /**
154
+ * The select event does not permeate the shadow DOM boundary.
155
+ * This fn effectively proxies the select event,
156
+ * emitting a `select` event whenever the internal
157
+ * control emits a `select` event
158
+ */
159
+ this.$emit("select");
160
+ }
161
+ /**
162
+ * Handles the internal control's `input` event
163
+ * @internal
164
+ */
165
+ handleTextInput() {
166
+ this.value = this.control.value;
167
+ }
168
+ /**
169
+ * Change event handler for inner control.
170
+ * @remarks
171
+ * "Change" events are not `composable` so they will not
172
+ * permeate the shadow DOM boundary. This fn effectively proxies
173
+ * the change event, emitting a `change` event whenever the internal
174
+ * control emits a `change` event
175
+ * @internal
176
+ */
177
+ handleChange() {
178
+ this.$emit("change");
179
+ }
180
+ /** {@inheritDoc (FormAssociated:interface).validate} */
181
+ validate() {
182
+ super.validate(this.control);
183
+ }
184
+ }
185
+ __decorate([
186
+ attr({ attribute: "readonly", mode: "boolean" })
187
+ ], TextField.prototype, "readOnly", void 0);
188
+ __decorate([
189
+ attr({ mode: "boolean" })
190
+ ], TextField.prototype, "autofocus", void 0);
191
+ __decorate([
192
+ attr
193
+ ], TextField.prototype, "placeholder", void 0);
194
+ __decorate([
195
+ attr
196
+ ], TextField.prototype, "type", void 0);
197
+ __decorate([
198
+ attr
199
+ ], TextField.prototype, "list", void 0);
200
+ __decorate([
201
+ attr({ converter: nullableNumberConverter })
202
+ ], TextField.prototype, "maxlength", void 0);
203
+ __decorate([
204
+ attr({ converter: nullableNumberConverter })
205
+ ], TextField.prototype, "minlength", void 0);
206
+ __decorate([
207
+ attr
208
+ ], TextField.prototype, "pattern", void 0);
209
+ __decorate([
210
+ attr({ converter: nullableNumberConverter })
211
+ ], TextField.prototype, "size", void 0);
212
+ __decorate([
213
+ attr({ mode: "boolean" })
214
+ ], TextField.prototype, "spellcheck", void 0);
215
+ __decorate([
216
+ observable
217
+ ], TextField.prototype, "defaultSlottedNodes", void 0);
218
+ /**
219
+ * Includes ARIA states and properties relating to the ARIA textbox role
220
+ *
221
+ * @public
222
+ */
223
+ class DelegatesARIATextbox {
224
+ }
225
+ applyMixins(DelegatesARIATextbox, ARIAGlobalStatesAndProperties);
226
+ applyMixins(TextField, StartEnd, DelegatesARIATextbox);
227
+
228
+ var css_248z = "/**\n * Do not edit directly\n * Generated on Thu, 03 Nov 2022 17:18:46 GMT\n */\n.message {\n display: flex;\n contain: inline-size;\n font: var(--vvd-typography-base-condensed);\n gap: 4px;\n grid-column: 1/-1;\n}\n.message-text {\n color: var(--vvd-color-canvas-text);\n}\n.helper-message .message-text {\n color: var(--_low-ink-color);\n}\n.message-icon {\n font-size: 16px;\n}\n.success-message .message-icon {\n color: var(--vvd-color-success-500);\n}\n.error-message .message-icon {\n color: var(--vvd-color-alert-500);\n}";
229
+
230
+ let _ = t => t,
231
+ _t,
232
+ _t2,
233
+ _t3;
234
+ const ElementInternalsKey = 'ElementInternals';
235
+ const supportsElementInternals = () => ElementInternalsKey in window && 'setFormValue' in window[ElementInternalsKey].prototype;
236
+ function formElements(constructor) {
237
+ var _Decorated_blurred;
238
+ class Decorated extends constructor {
239
+ constructor(...args) {
240
+ super(...args);
241
+ this.charCount = false;
242
+ this.userValid = true;
243
+ _Decorated_blurred.set(this, false);
244
+ this.validate = () => {
245
+ if (supportsElementInternals() && this.proxy instanceof HTMLElement) {
246
+ this.setValidity(this.proxy.validity, this.proxy.validationMessage, this.control);
247
+ } else {
248
+ super.validate();
249
+ }
250
+ this.userValid = !this.userValid;
251
+ if (this.proxy instanceof HTMLElement) {
252
+ this.userValid = __classPrivateFieldGet(this, _Decorated_blurred, "f") && this.dirtyValue ? !this.validationMessage : true;
253
+ }
254
+ };
255
+ this.addEventListener('blur', () => {
256
+ __classPrivateFieldSet(this, _Decorated_blurred, true, "f");
257
+ this.validate();
258
+ });
259
+ this.addEventListener('focus', () => {
260
+ __classPrivateFieldSet(this, _Decorated_blurred, false, "f");
261
+ });
262
+ this.addEventListener('invalid', () => {
263
+ if (__classPrivateFieldGet(this, _Decorated_blurred, "f") && this.dirtyValue) return;
264
+ __classPrivateFieldSet(this, _Decorated_blurred, true, "f");
265
+ this.dirtyValue = true;
266
+ this.validate();
267
+ });
268
+ }
269
+ get errorValidationMessage() {
270
+ return this.userValid ? '' : this.validationMessage;
271
+ }
272
+ }
273
+ _Decorated_blurred = new WeakMap();
274
+ __decorate([attr, __metadata("design:type", String)], Decorated.prototype, "label", void 0);
275
+ __decorate([attr({
276
+ attribute: 'helper-text'
277
+ }), __metadata("design:type", String)], Decorated.prototype, "helperText", void 0);
278
+ __decorate([attr({
279
+ attribute: 'success-text'
280
+ }), __metadata("design:type", String)], Decorated.prototype, "successText", void 0);
281
+ __decorate([attr({
282
+ attribute: 'char-count',
283
+ mode: 'boolean'
284
+ }), __metadata("design:type", Object)], Decorated.prototype, "charCount", void 0);
285
+ __decorate([observable, __metadata("design:type", Object)], Decorated.prototype, "userValid", void 0);
286
+ __decorate([volatile, __metadata("design:type", Object), __metadata("design:paramtypes", [])], Decorated.prototype, "errorValidationMessage", null);
287
+ return Decorated;
288
+ }
289
+ function getFeedbackTemplate(messageType, context) {
290
+ const MessageTypeMap = {
291
+ 'helper': {
292
+ 'messageProperty': 'helperText',
293
+ 'className': 'helper',
294
+ 'iconType': ''
295
+ },
296
+ 'error': {
297
+ 'messageProperty': 'errorValidationMessage',
298
+ 'className': 'error',
299
+ 'iconType': 'info-negative'
300
+ },
301
+ 'success': {
302
+ 'messageProperty': 'successText',
303
+ 'className': 'success',
304
+ 'iconType': 'check-circle-solid'
305
+ }
306
+ };
307
+ const iconTag = context.tagFor(Icon);
308
+ const messageTypeConfig = MessageTypeMap[messageType];
309
+ const iconType = messageTypeConfig.iconType;
310
+ return html(_t || (_t = _`
311
+ <style>
312
+ ${0}
313
+
314
+ </style>
315
+ <div class="message ${0}-message">
316
+ ${0}
317
+ ${0}
318
+ </div>`), css_248z, MessageTypeMap[messageType].className, when(() => iconType, html(_t2 || (_t2 = _`
319
+ <${0} class="message-icon" type="${0}"></${0}>`), iconTag, iconType, iconTag)), feedbackMessage({
320
+ messageProperty: MessageTypeMap[messageType].messageProperty
321
+ }));
322
+ }
323
+ function feedbackMessage({
324
+ messageProperty
325
+ }) {
326
+ return html(_t3 || (_t3 = _`
327
+ <span class="message-text">${0}</span>
328
+ `), x => x[messageProperty]);
329
+ }
330
+
331
+ export { DelegatesARIATextbox as D, TextField as T, formElements as f, getFeedbackTemplate as g };