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