@vonage/vivid 3.0.0-next.16 → 3.0.0-next.19

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.
@@ -0,0 +1,367 @@
1
+ import '../icon/index.js';
2
+ import '../focus/index.js';
3
+ 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, d as designSystem } from '../shared/index.js';
4
+ import '../shared/web.dom-collections.iterator.js';
5
+ import { b as AffixIcon, a as affixIconTemplateFactory } from '../shared/affix.js';
6
+ import '../shared/focus.js';
7
+ import { a as applyMixins } from '../shared/apply-mixins.js';
8
+ import { F as FormAssociated, f as focusTemplateFactory } from '../shared/focus2.js';
9
+ import { A as ARIAGlobalStatesAndProperties, S as StartEnd, r as ref } from '../shared/aria-global.js';
10
+ import { s as styleInject } from '../shared/style-inject.es.js';
11
+ import { w as when } from '../shared/when.js';
12
+ import { c as classNames } from '../shared/class-names.js';
13
+ import '../shared/icon.js';
14
+ import '../shared/object-set-prototype-of.js';
15
+ import '../shared/_has.js';
16
+
17
+ class _TextField extends FoundationElement {
18
+ }
19
+ /**
20
+ * A form-associated base class for the {@link @microsoft/fast-foundation#(TextField:class)} component.
21
+ *
22
+ * @internal
23
+ */
24
+ class FormAssociatedTextField extends FormAssociated(_TextField) {
25
+ constructor() {
26
+ super(...arguments);
27
+ this.proxy = document.createElement("input");
28
+ }
29
+ }
30
+
31
+ /**
32
+ * Text field sub-types
33
+ * @public
34
+ */
35
+ var TextFieldType;
36
+ (function (TextFieldType) {
37
+ /**
38
+ * An email TextField
39
+ */
40
+ TextFieldType["email"] = "email";
41
+ /**
42
+ * A password TextField
43
+ */
44
+ TextFieldType["password"] = "password";
45
+ /**
46
+ * A telephone TextField
47
+ */
48
+ TextFieldType["tel"] = "tel";
49
+ /**
50
+ * A text TextField
51
+ */
52
+ TextFieldType["text"] = "text";
53
+ /**
54
+ * A URL TextField
55
+ */
56
+ TextFieldType["url"] = "url";
57
+ })(TextFieldType || (TextFieldType = {}));
58
+
59
+ /**
60
+ * A Text Field Custom HTML Element.
61
+ * Based largely on the {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/text | <input type="text" /> element }.
62
+ *
63
+ * @public
64
+ */
65
+ class TextField$1 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
+ * Handles the internal control's `input` event
148
+ * @internal
149
+ */
150
+ handleTextInput() {
151
+ this.value = this.control.value;
152
+ }
153
+ /**
154
+ * Change event handler for inner control.
155
+ * @remarks
156
+ * "Change" events are not `composable` so they will not
157
+ * permeate the shadow DOM boundary. This fn effectively proxies
158
+ * the change event, emitting a `change` event whenever the internal
159
+ * control emits a `change` event
160
+ * @internal
161
+ */
162
+ handleChange() {
163
+ this.$emit("change");
164
+ }
165
+ }
166
+ __decorate([
167
+ attr({ attribute: "readonly", mode: "boolean" })
168
+ ], TextField$1.prototype, "readOnly", void 0);
169
+ __decorate([
170
+ attr({ mode: "boolean" })
171
+ ], TextField$1.prototype, "autofocus", void 0);
172
+ __decorate([
173
+ attr
174
+ ], TextField$1.prototype, "placeholder", void 0);
175
+ __decorate([
176
+ attr
177
+ ], TextField$1.prototype, "type", void 0);
178
+ __decorate([
179
+ attr
180
+ ], TextField$1.prototype, "list", void 0);
181
+ __decorate([
182
+ attr({ converter: nullableNumberConverter })
183
+ ], TextField$1.prototype, "maxlength", void 0);
184
+ __decorate([
185
+ attr({ converter: nullableNumberConverter })
186
+ ], TextField$1.prototype, "minlength", void 0);
187
+ __decorate([
188
+ attr
189
+ ], TextField$1.prototype, "pattern", void 0);
190
+ __decorate([
191
+ attr({ converter: nullableNumberConverter })
192
+ ], TextField$1.prototype, "size", void 0);
193
+ __decorate([
194
+ attr({ mode: "boolean" })
195
+ ], TextField$1.prototype, "spellcheck", void 0);
196
+ __decorate([
197
+ observable
198
+ ], TextField$1.prototype, "defaultSlottedNodes", void 0);
199
+ /**
200
+ * Includes ARIA states and properties relating to the ARIA textbox role
201
+ *
202
+ * @public
203
+ */
204
+ class DelegatesARIATextbox {
205
+ }
206
+ applyMixins(DelegatesARIATextbox, ARIAGlobalStatesAndProperties);
207
+ applyMixins(TextField$1, StartEnd, DelegatesARIATextbox);
208
+
209
+ class TextField extends TextField$1 {
210
+ constructor() {
211
+ super(...arguments);
212
+ this.charCount = false;
213
+ this.userValid = true;
214
+ }
215
+
216
+ get errorValidationMessage() {
217
+ return this.userValid ? '' : this.validationMessage;
218
+ }
219
+
220
+ validate() {
221
+ super.validate();
222
+
223
+ if (this.proxy instanceof HTMLElement) {
224
+ this.userValid = this.dirtyValue ? !this.validationMessage : true;
225
+ }
226
+ }
227
+
228
+ }
229
+
230
+ __decorate([attr, __metadata("design:type", String)], TextField.prototype, "label", void 0);
231
+
232
+ __decorate([attr({
233
+ attribute: 'helper-text'
234
+ }), __metadata("design:type", String)], TextField.prototype, "helperText", void 0);
235
+
236
+ __decorate([attr({
237
+ attribute: 'char-count',
238
+ mode: 'boolean'
239
+ }), __metadata("design:type", Object)], TextField.prototype, "charCount", void 0);
240
+
241
+ __decorate([attr, __metadata("design:type", String)], TextField.prototype, "density", void 0);
242
+
243
+ __decorate([attr, __metadata("design:type", String)], TextField.prototype, "appearance", void 0);
244
+
245
+ __decorate([attr, __metadata("design:type", String)], TextField.prototype, "shape", void 0);
246
+
247
+ __decorate([observable, __metadata("design:type", Object)], TextField.prototype, "userValid", void 0);
248
+
249
+ __decorate([volatile, __metadata("design:type", Object), __metadata("design:paramtypes", [])], TextField.prototype, "errorValidationMessage", null);
250
+
251
+ applyMixins(TextField, AffixIcon);
252
+
253
+ var css_248z = "/*\n Do not edit directly\n Generated on Wed, 27 Apr 2022 11:58:36 GMT\n*/\n.base {\n display: grid;\n gap: 4px;\n grid-template-columns: min-content 1fr max-content;\n}\n.base {\n --connotation: var(--vvd-color-primary);\n --on-connotation: var(--vvd-color-on-primary);\n}\n.base {\n --_appearance-color-text: var(--vvd-color-on-canvas);\n --_appearance-color-fill: var(--vvd-color-canvas);\n --_appearance-color-outline: var(--vvd-color-neutral-50);\n}\n.base.appearance-ghost {\n --_appearance-color-text: var(--connotation);\n --_appearance-color-fill: transaprent;\n --_appearance-color-outline: transaprent;\n}\n.base:where(:hover, .hover):where(:not(:disabled, .disabled)) {\n --_appearance-color-text: var(--vvd-color-on-canvas);\n --_appearance-color-fill: var(--vvd-color-canvas);\n --_appearance-color-outline: var(--vvd-color-on-canvas);\n}\n.base:where(:hover, .hover):where(:not(:disabled, .disabled)).appearance-ghost {\n --_appearance-color-text: var(--connotation);\n --_appearance-color-fill: var(--connotation-pale);\n --_appearance-color-outline: transaprent;\n}\n.base:where(:disabled, .disabled) {\n --_appearance-color-text: var(--vvd-color-neutral-50);\n --_appearance-color-fill: var(--vvd-color-neutral-20);\n --_appearance-color-outline: var(--vvd-color-neutral-50);\n}\n.base:where(:disabled, .disabled).appearance-ghost {\n --_appearance-color-text: var(--vvd-color-neutral-50);\n --_appearance-color-fill: transaprent;\n --_appearance-color-outline: transaprent;\n}\n.base:where(:readonly, .readonly):where(:not(:disabled, .disabled, :hover, .hover, :active, .active)) {\n --_appearance-color-text: var(--vvd-color-on-canvas);\n --_appearance-color-fill: var(--vvd-color-neutral-20);\n --_appearance-color-outline: var(--vvd-color-neutral-50);\n}\n.base:where(:readonly, .readonly):where(:not(:disabled, .disabled, :hover, .hover, :active, .active)).appearance-ghost {\n --_appearance-color-text: var(--vvd-color-neutral-50);\n --_appearance-color-fill: transaprent;\n --_appearance-color-outline: transaprent;\n}\n.base:where(.error):where(:not(:disabled, .disabled)) {\n --_appearance-color-text: var(--vvd-color-alert);\n --_appearance-color-fill: var(--vvd-color-alert-20);\n --_appearance-color-outline: var(--vvd-color-alert);\n}\n.base:where(.error):where(:not(:disabled, .disabled)).appearance-ghost {\n --_appearance-color-text: transparent;\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.base:not(.disabled) {\n --_low-ink-color: var(--vvd-color-neutral-70);\n}\n.base.disabled {\n --_low-ink-color: var(--vvd-color-neutral-50);\n}\n\n.label {\n font: 400 ultra-condensed 14px / 20px SpeziaWebVariable;\n letter-spacing: 0px;\n text-decoration: none;\n text-transform: none;\n grid-column: 1/4;\n grid-row: 1;\n}\n.char-count + .label {\n grid-column: 1/3;\n}\n.base:not(.disabled) .label {\n color: var(--vvd-color-on-canvas);\n}\n.base.disabled .label {\n color: var(--vvd-color-neutral-50);\n}\n\n.char-count {\n font: 400 ultra-condensed 14px / 20px SpeziaWebVariable;\n letter-spacing: 0px;\n text-decoration: none;\n text-transform: none;\n color: var(--_low-ink-color);\n grid-column: 3/4;\n}\n\n.fieldset {\n position: relative;\n display: flex;\n align-items: center;\n background-color: var(--_appearance-color-fill);\n box-shadow: inset 0 0 0 1px var(--_appearance-color-outline);\n color: var(--_appearance-color-text);\n contain: strict;\n grid-column: 1/4;\n padding-inline: 16px;\n transition: color 0.2s, box-shadow 0.2s, background-color 0.2s;\n /* Size */\n /* Shape */\n}\n.base:not(.density-extended) > .fieldset {\n block-size: 40px;\n}\n.base.density-extended > .fieldset {\n block-size: 48px;\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 font: 400 ultra-condensed 14px / 20px SpeziaWebVariable;\n letter-spacing: 0px;\n text-decoration: none;\n text-transform: none;\n position: absolute;\n padding: 1px;\n border: 0 none;\n background-color: unset;\n border-radius: inherit;\n color: inherit;\n inset: 0;\n outline: 0 none;\n padding-inline-start: 16px;\n}\n.control::placeholder {\n color: var(--_low-ink-color);\n}\n\n.icon {\n position: relative;\n z-index: 1;\n color: var(--_low-ink-color);\n}\n.icon + .control {\n padding-inline-start: 44px;\n}\n\n.helper-text {\n font: 400 ultra-condensed 12px / 16px SpeziaWebVariable;\n letter-spacing: 0px;\n text-decoration: none;\n text-transform: none;\n color: var(--_low-ink-color);\n grid-column: 1/4;\n margin-inline-start: 16px;\n}\n\n.error-message {\n font: 400 ultra-condensed 12px / 16px SpeziaWebVariable;\n letter-spacing: 0px;\n text-decoration: none;\n text-transform: none;\n display: flex;\n color: var(--vvd-color-on-canvas);\n grid-column: 2/4;\n}\n.error-message-icon {\n color: var(--vvd-color-alert);\n font-size: 16px;\n grid-column: 1/2;\n}\n\n.focus-indicator {\n --focus-stroke-gap-color: transparent;\n pointer-events: none;\n}\n.fieldset:not(:focus-within) > .focus-indicator {\n display: none;\n}";
254
+ styleInject(css_248z);
255
+
256
+ let _ = t => t,
257
+ _t,
258
+ _t2,
259
+ _t3,
260
+ _t4,
261
+ _t5;
262
+
263
+ const getStateClasses = ({
264
+ errorValidationMessage,
265
+ disabled,
266
+ value,
267
+ readOnly,
268
+ placeholder,
269
+ density,
270
+ appearance,
271
+ shape,
272
+ label
273
+ }) => classNames(['error', Boolean(errorValidationMessage)], ['disabled', disabled], ['has-value', Boolean(value)], ['readonly', readOnly], ['placeholder', Boolean(placeholder)], [`density-${density}`, Boolean(density)], [`appearance-${appearance}`, Boolean(appearance)], [`shape-${shape}`, Boolean(shape)], ['no-label', !label]);
274
+
275
+ function renderLabel() {
276
+ return html(_t || (_t = _`
277
+ <label for="control" class="label">
278
+ ${0}
279
+ </label>`), x => x.label);
280
+ }
281
+
282
+ function renderHelperText() {
283
+ return html(_t2 || (_t2 = _`<span class="helper-text">${0}</span>`), x => x.helperText);
284
+ }
285
+
286
+ function renderCharCount() {
287
+ return html(_t3 || (_t3 = _`
288
+ <span class="char-count">${0} / ${0}</span>
289
+ `), x => x.value ? x.value.length : 0, x => x.maxlength);
290
+ }
291
+
292
+ function renderErrorMessage() {
293
+ return html(_t4 || (_t4 = _`
294
+ <vwc-icon class="error-message-icon" type="info-negative"></vwc-icon>
295
+ <span class="error-message">${0}</span>
296
+ `), x => x.errorValidationMessage);
297
+ }
298
+
299
+ const TextfieldTemplate = context => {
300
+ const affixIconTemplate = affixIconTemplateFactory(context);
301
+ const focusTemplate = focusTemplateFactory(context);
302
+ return html(_t5 || (_t5 = _`
303
+ <div class="base ${0}">
304
+ ${0}
305
+ ${0}
306
+ <div class="fieldset">
307
+ ${0}
308
+ <input class="control"
309
+ id="control"
310
+ @input="${0}"
311
+ @change="${0}"
312
+ ?autofocus="${0}"
313
+ ?disabled="${0}"
314
+ list="${0}"
315
+ maxlength="${0}"
316
+ minlength="${0}"
317
+ pattern="${0}"
318
+ placeholder="${0}"
319
+ ?readonly="${0}"
320
+ ?required="${0}"
321
+ size="${0}"
322
+ ?spellcheck="${0}"
323
+ :value="${0}"
324
+ type="${0}"
325
+ aria-atomic="${0}"
326
+ aria-busy="${0}"
327
+ aria-controls="${0}"
328
+ aria-current="${0}"
329
+ aria-describedby="${0}"
330
+ aria-details="${0}"
331
+ aria-disabled="${0}"
332
+ aria-errormessage="${0}"
333
+ aria-flowto="${0}"
334
+ aria-haspopup="${0}"
335
+ aria-hidden="${0}"
336
+ aria-invalid="${0}"
337
+ aria-keyshortcuts="${0}"
338
+ aria-label="${0}"
339
+ aria-labelledby="${0}"
340
+ aria-live="${0}"
341
+ aria-owns="${0}"
342
+ aria-relevant="${0}"
343
+ aria-roledescription="${0}"
344
+ ${0}
345
+ />
346
+ ${0}
347
+ </div>
348
+ ${0}
349
+ ${0}
350
+ </div>`), getStateClasses, when(x => x.charCount && x.maxlength, renderCharCount()), when(x => x.label, renderLabel()), x => affixIconTemplate(x.icon), x => x.handleTextInput(), x => x.handleChange(), x => x.autofocus, x => x.disabled, x => x.list, x => x.maxlength, x => x.minlength, x => x.pattern, x => x.placeholder, x => x.readOnly, x => x.required, x => x.size, x => x.spellcheck, x => x.value, x => x.type, 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, when(x => {
351
+ var _a;
352
+
353
+ return !x.errorValidationMessage && ((_a = x.helperText) === null || _a === void 0 ? void 0 : _a.length);
354
+ }, renderHelperText()), when(x => x.errorValidationMessage, renderErrorMessage()));
355
+ };
356
+
357
+ const vividTextfield = TextField.compose({
358
+ baseName: 'text-field',
359
+ template: TextfieldTemplate,
360
+ styles: css_248z,
361
+ shadowOptions: {
362
+ delegatesFocus: true
363
+ }
364
+ });
365
+ designSystem.register(vividTextfield());
366
+
367
+ export { vividTextfield };
package/tooltip/index.js CHANGED
@@ -11,10 +11,11 @@ import '../shared/object-set-prototype-of.js';
11
11
  import '../shared/_has.js';
12
12
  import '../shared/when.js';
13
13
  import '../focus/index.js';
14
- import '../shared/focus2.js';
15
- import '../shared/affix.js';
16
14
  import '../shared/focus.js';
15
+ import '../shared/affix.js';
16
+ import '../shared/button.js';
17
17
  import '../shared/apply-mixins.js';
18
+ import '../shared/focus2.js';
18
19
  import '../shared/aria-global.js';
19
20
  import '../shared/es.object.assign.js';
20
21