@vonage/vivid 4.12.1 → 4.13.0
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/custom-elements.json +1388 -128
- package/lib/file-picker/file-picker.d.ts +6 -0
- package/lib/menu/menu.d.ts +16 -3
- package/lib/menu-item/menu-item.d.ts +10 -2
- package/lib/option/option.d.ts +27 -7
- package/lib/switch/switch.d.ts +5 -2
- package/lib/switch/switch.form-associated.d.ts +10 -0
- package/lib/tabs/tabs.d.ts +3 -2
- package/lib/text-area/text-area.d.ts +25 -3
- package/lib/text-area/text-field.form-associated.d.ts +10 -0
- package/lib/text-field/text-field.d.ts +28 -3
- package/lib/text-field/text-field.form-associated.d.ts +10 -0
- package/package.json +1 -1
- package/shared/definition11.cjs +1 -1
- package/shared/definition11.js +1 -1
- package/shared/definition17.cjs +1 -1
- package/shared/definition17.js +1 -1
- package/shared/definition20.cjs +2 -1
- package/shared/definition20.js +2 -1
- package/shared/definition21.cjs +1 -1
- package/shared/definition21.js +1 -1
- package/shared/definition24.cjs +1 -1
- package/shared/definition24.js +1 -1
- package/shared/definition25.cjs +24 -3
- package/shared/definition25.js +24 -3
- package/shared/definition29.cjs +358 -559
- package/shared/definition29.js +359 -560
- package/shared/definition30.cjs +2 -0
- package/shared/definition30.js +2 -0
- package/shared/definition35.cjs +222 -2
- package/shared/definition35.js +222 -2
- package/shared/definition36.cjs +149 -14
- package/shared/definition36.js +150 -15
- package/shared/definition46.cjs +1 -1
- package/shared/definition46.js +1 -1
- package/shared/definition47.cjs +5 -14
- package/shared/definition47.js +1 -10
- package/shared/definition49.cjs +65 -90
- package/shared/definition49.js +66 -91
- package/shared/definition51.cjs +1 -1
- package/shared/definition51.js +1 -1
- package/shared/definition52.cjs +15 -1
- package/shared/definition52.js +15 -1
- package/shared/definition55.cjs +160 -180
- package/shared/definition55.js +160 -180
- package/shared/definition56.cjs +3 -307
- package/shared/definition56.js +5 -309
- package/shared/definition57.cjs +8 -7
- package/shared/definition57.js +3 -2
- package/shared/definition64.cjs +18 -7
- package/shared/definition64.js +19 -8
- package/shared/listbox.cjs +198 -3
- package/shared/listbox.js +197 -2
- package/shared/{direction.cjs → localization.cjs} +12 -3
- package/shared/{direction.js → localization.js} +12 -3
- package/shared/presentationDate.cjs +8 -8
- package/shared/presentationDate.js +1 -1
- package/shared/text-field2.cjs +538 -194
- package/shared/text-field2.js +539 -195
- package/styles/core/all.css +21 -1
- package/styles/core/theme.css +21 -1
- package/styles/core/typography.css +1 -1
- package/styles/tokens/theme-dark.css +4 -4
- package/styles/tokens/theme-light.css +4 -4
- package/styles/tokens/vivid-2-compat.css +1 -1
- package/vivid.api.json +44 -0
- package/shared/Reflector.cjs +0 -71
- package/shared/Reflector.js +0 -69
- package/shared/listbox-option.cjs +0 -204
- package/shared/listbox-option.js +0 -201
package/shared/definition30.cjs
CHANGED
|
@@ -5,6 +5,7 @@ const definition = require('./definition64.cjs');
|
|
|
5
5
|
const definition$1 = require('./definition29.cjs');
|
|
6
6
|
const anchored = require('./anchored.cjs');
|
|
7
7
|
const index$1 = require('./index2.cjs');
|
|
8
|
+
const ref = require('./ref.cjs');
|
|
8
9
|
const slotted = require('./slotted.cjs');
|
|
9
10
|
const classNames = require('./class-names.cjs');
|
|
10
11
|
|
|
@@ -39,6 +40,7 @@ const MenuTemplate = (context) => {
|
|
|
39
40
|
@focusout="${(x, c) => x._onFocusout(c.event)}">
|
|
40
41
|
${anchorSlotTemplate}
|
|
41
42
|
<${popupTag}
|
|
43
|
+
${ref.ref("_popupEl")}
|
|
42
44
|
:placement=${(x) => x.placement}
|
|
43
45
|
:open=${(x) => x.open}
|
|
44
46
|
:anchor=${(x) => x._anchorEl}
|
package/shared/definition30.js
CHANGED
|
@@ -3,6 +3,7 @@ import { P as Popup, p as popupRegistries } from './definition64.js';
|
|
|
3
3
|
import { b as Menu, a as menuItemRegistries } from './definition29.js';
|
|
4
4
|
import { a as anchorSlotTemplateFactory } from './anchored.js';
|
|
5
5
|
import { h as handleEscapeKeyAndStopPropogation } from './index2.js';
|
|
6
|
+
import { r as ref } from './ref.js';
|
|
6
7
|
import { s as slotted } from './slotted.js';
|
|
7
8
|
import { c as classNames } from './class-names.js';
|
|
8
9
|
|
|
@@ -37,6 +38,7 @@ const MenuTemplate = (context) => {
|
|
|
37
38
|
@focusout="${(x, c) => x._onFocusout(c.event)}">
|
|
38
39
|
${anchorSlotTemplate}
|
|
39
40
|
<${popupTag}
|
|
41
|
+
${ref("_popupEl")}
|
|
40
42
|
:placement=${(x) => x.placement}
|
|
41
43
|
:open=${(x) => x.open}
|
|
42
44
|
:anchor=${(x) => x._anchorEl}
|
package/shared/definition35.cjs
CHANGED
|
@@ -5,7 +5,9 @@ const definition = require('./definition11.cjs');
|
|
|
5
5
|
const definition$1 = require('./definition22.cjs');
|
|
6
6
|
const applyMixinsWithObservables = require('./applyMixinsWithObservables.cjs');
|
|
7
7
|
const formAssociated = require('./form-associated.cjs');
|
|
8
|
-
const
|
|
8
|
+
const applyMixins = require('./apply-mixins.cjs');
|
|
9
|
+
const ariaGlobal = require('./aria-global.cjs');
|
|
10
|
+
const startEnd = require('./start-end.cjs');
|
|
9
11
|
const keyCodes = require('./key-codes.cjs');
|
|
10
12
|
const formElements = require('./form-elements.cjs');
|
|
11
13
|
const affix = require('./affix.cjs');
|
|
@@ -15,6 +17,224 @@ const when = require('./when.cjs');
|
|
|
15
17
|
const ref = require('./ref.cjs');
|
|
16
18
|
const classNames = require('./class-names.cjs');
|
|
17
19
|
|
|
20
|
+
class _TextField extends index.FoundationElement {
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A form-associated base class for the {@link @microsoft/fast-foundation#(TextField:class)} component.
|
|
24
|
+
*
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
class FormAssociatedTextField extends formAssociated.FormAssociated(_TextField) {
|
|
28
|
+
constructor() {
|
|
29
|
+
super(...arguments);
|
|
30
|
+
this.proxy = document.createElement("input");
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Text field sub-types
|
|
36
|
+
* @public
|
|
37
|
+
*/
|
|
38
|
+
const TextFieldType = {
|
|
39
|
+
/**
|
|
40
|
+
* An email TextField
|
|
41
|
+
*/
|
|
42
|
+
email: "email",
|
|
43
|
+
/**
|
|
44
|
+
* A password TextField
|
|
45
|
+
*/
|
|
46
|
+
password: "password",
|
|
47
|
+
/**
|
|
48
|
+
* A telephone TextField
|
|
49
|
+
*/
|
|
50
|
+
tel: "tel",
|
|
51
|
+
/**
|
|
52
|
+
* A text TextField
|
|
53
|
+
*/
|
|
54
|
+
text: "text",
|
|
55
|
+
/**
|
|
56
|
+
* A URL TextField
|
|
57
|
+
*/
|
|
58
|
+
url: "url",
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* A Text Field Custom HTML Element.
|
|
63
|
+
* Based largely on the {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/text | <input type="text" /> element }.
|
|
64
|
+
*
|
|
65
|
+
* @slot start - Content which can be provided before the number field input
|
|
66
|
+
* @slot end - Content which can be provided after the number field input
|
|
67
|
+
* @slot - The default slot for the label
|
|
68
|
+
* @csspart label - The label
|
|
69
|
+
* @csspart root - The element wrapping the control, including start and end slots
|
|
70
|
+
* @csspart control - The text field element
|
|
71
|
+
* @fires change - Fires a custom 'change' event when the value has changed
|
|
72
|
+
*
|
|
73
|
+
* @public
|
|
74
|
+
*/
|
|
75
|
+
class TextField extends FormAssociatedTextField {
|
|
76
|
+
constructor() {
|
|
77
|
+
super(...arguments);
|
|
78
|
+
/**
|
|
79
|
+
* Allows setting a type or mode of text.
|
|
80
|
+
* @public
|
|
81
|
+
* @remarks
|
|
82
|
+
* HTML Attribute: type
|
|
83
|
+
*/
|
|
84
|
+
this.type = TextFieldType.text;
|
|
85
|
+
}
|
|
86
|
+
readOnlyChanged() {
|
|
87
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
88
|
+
this.proxy.readOnly = this.readOnly;
|
|
89
|
+
this.validate();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
autofocusChanged() {
|
|
93
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
94
|
+
this.proxy.autofocus = this.autofocus;
|
|
95
|
+
this.validate();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
placeholderChanged() {
|
|
99
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
100
|
+
this.proxy.placeholder = this.placeholder;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
typeChanged() {
|
|
104
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
105
|
+
this.proxy.type = this.type;
|
|
106
|
+
this.validate();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
listChanged() {
|
|
110
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
111
|
+
this.proxy.setAttribute("list", this.list);
|
|
112
|
+
this.validate();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
maxlengthChanged() {
|
|
116
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
117
|
+
this.proxy.maxLength = this.maxlength;
|
|
118
|
+
this.validate();
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
minlengthChanged() {
|
|
122
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
123
|
+
this.proxy.minLength = this.minlength;
|
|
124
|
+
this.validate();
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
patternChanged() {
|
|
128
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
129
|
+
this.proxy.pattern = this.pattern;
|
|
130
|
+
this.validate();
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
sizeChanged() {
|
|
134
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
135
|
+
this.proxy.size = this.size;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
spellcheckChanged() {
|
|
139
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
140
|
+
this.proxy.spellcheck = this.spellcheck;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* @internal
|
|
145
|
+
*/
|
|
146
|
+
connectedCallback() {
|
|
147
|
+
super.connectedCallback();
|
|
148
|
+
this.proxy.setAttribute("type", this.type);
|
|
149
|
+
this.validate();
|
|
150
|
+
if (this.autofocus) {
|
|
151
|
+
index.DOM.queueUpdate(() => {
|
|
152
|
+
this.focus();
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Selects all the text in the text field
|
|
158
|
+
*
|
|
159
|
+
* @public
|
|
160
|
+
*/
|
|
161
|
+
select() {
|
|
162
|
+
this.control.select();
|
|
163
|
+
/**
|
|
164
|
+
* The select event does not permeate the shadow DOM boundary.
|
|
165
|
+
* This fn effectively proxies the select event,
|
|
166
|
+
* emitting a `select` event whenever the internal
|
|
167
|
+
* control emits a `select` event
|
|
168
|
+
*/
|
|
169
|
+
this.$emit("select");
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Handles the internal control's `input` event
|
|
173
|
+
* @internal
|
|
174
|
+
*/
|
|
175
|
+
handleTextInput() {
|
|
176
|
+
this.value = this.control.value;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Change event handler for inner control.
|
|
180
|
+
* @remarks
|
|
181
|
+
* "Change" events are not `composable` so they will not
|
|
182
|
+
* permeate the shadow DOM boundary. This fn effectively proxies
|
|
183
|
+
* the change event, emitting a `change` event whenever the internal
|
|
184
|
+
* control emits a `change` event
|
|
185
|
+
* @internal
|
|
186
|
+
*/
|
|
187
|
+
handleChange() {
|
|
188
|
+
this.$emit("change");
|
|
189
|
+
}
|
|
190
|
+
/** {@inheritDoc (FormAssociated:interface).validate} */
|
|
191
|
+
validate() {
|
|
192
|
+
super.validate(this.control);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
index.__decorate([
|
|
196
|
+
index.attr({ attribute: "readonly", mode: "boolean" })
|
|
197
|
+
], TextField.prototype, "readOnly", void 0);
|
|
198
|
+
index.__decorate([
|
|
199
|
+
index.attr({ mode: "boolean" })
|
|
200
|
+
], TextField.prototype, "autofocus", void 0);
|
|
201
|
+
index.__decorate([
|
|
202
|
+
index.attr
|
|
203
|
+
], TextField.prototype, "placeholder", void 0);
|
|
204
|
+
index.__decorate([
|
|
205
|
+
index.attr
|
|
206
|
+
], TextField.prototype, "type", void 0);
|
|
207
|
+
index.__decorate([
|
|
208
|
+
index.attr
|
|
209
|
+
], TextField.prototype, "list", void 0);
|
|
210
|
+
index.__decorate([
|
|
211
|
+
index.attr({ converter: index.nullableNumberConverter })
|
|
212
|
+
], TextField.prototype, "maxlength", void 0);
|
|
213
|
+
index.__decorate([
|
|
214
|
+
index.attr({ converter: index.nullableNumberConverter })
|
|
215
|
+
], TextField.prototype, "minlength", void 0);
|
|
216
|
+
index.__decorate([
|
|
217
|
+
index.attr
|
|
218
|
+
], TextField.prototype, "pattern", void 0);
|
|
219
|
+
index.__decorate([
|
|
220
|
+
index.attr({ converter: index.nullableNumberConverter })
|
|
221
|
+
], TextField.prototype, "size", void 0);
|
|
222
|
+
index.__decorate([
|
|
223
|
+
index.attr({ mode: "boolean" })
|
|
224
|
+
], TextField.prototype, "spellcheck", void 0);
|
|
225
|
+
index.__decorate([
|
|
226
|
+
index.observable
|
|
227
|
+
], TextField.prototype, "defaultSlottedNodes", void 0);
|
|
228
|
+
/**
|
|
229
|
+
* Includes ARIA states and properties relating to the ARIA textbox role
|
|
230
|
+
*
|
|
231
|
+
* @public
|
|
232
|
+
*/
|
|
233
|
+
class DelegatesARIATextbox {
|
|
234
|
+
}
|
|
235
|
+
applyMixins.applyMixins(DelegatesARIATextbox, ariaGlobal.ARIAGlobalStatesAndProperties);
|
|
236
|
+
applyMixins.applyMixins(TextField, startEnd.StartEnd, DelegatesARIATextbox);
|
|
237
|
+
|
|
18
238
|
const styles = ":host{display:inline-block}.base{--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-canvas);--_appearance-color-outline: var(--_connotation-color-intermediate)}.base.appearance-ghost{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-canvas);--_appearance-color-outline: var(--_connotation-color-fierce)}.base:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)).appearance-ghost{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.base:where(.disabled,:disabled){--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: var(--vvd-color-neutral-100);--_appearance-color-outline: var(--vvd-color-neutral-300)}.base:where(.disabled,:disabled).appearance-ghost{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base:where(.readonly):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-neutral-200);--_appearance-color-outline: var(--vvd-color-neutral-400)}.base:where(.readonly):where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: var(--vvd-color-neutral-600);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base:where(.error):where(:not(.disabled,:disabled)){--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-alert-50);--_appearance-color-outline: var(--vvd-color-alert-500)}.base:where(.error):where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-alert-50);--_appearance-color-outline: transparent}.base:where(.success):where(:not(.disabled,:disabled)){--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-success-50);--_appearance-color-outline: var(--vvd-color-success-500)}.base:where(.success):where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-success-50);--_appearance-color-outline: transparent}.base{--_connotation-color-primary: var(--vvd-text-field-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-text: var(--vvd-text-field-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-text-field-accent-primary-increment, var(--vvd-color-neutral-800));--_connotation-color-intermediate: var(--vvd-text-field-accent-intermediate, var(--vvd-color-neutral-500));--_connotation-color-firm: var(--vvd-text-field-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-fierce: var(--vvd-text-field-accent-fierce, var(--vvd-color-neutral-700));--_connotation-color-faint: var(--vvd-text-field-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-text-field-accent-soft, var(--vvd-color-neutral-100))}.base{--_text-field-gutter-start: calc(1px*(40 + 4*clamp(-1, var(--vvd-size-density, 0), 2))*.4) ;--_text-field-gutter-end: calc(1px*(40 + 4*clamp(-1, var(--vvd-size-density, 0), 2))*.4) ;--_text-field-icon-size: calc(1px*(40 + 4*clamp(-1, var(--vvd-size-density, 0), 2))/2) ;--_text-field-block-size: calc(1px*(40 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) ;--_text-field-border-radius: 8px;--_text-field-pill-border-radius: 24px;display:inline-grid;width:100%;gap:4px;grid-template-columns:min-content 1fr max-content}.base.size-condensed{--_text-field-gutter-start: calc(1px*(24 + 4*clamp(-1, var(--vvd-size-density, 0), 2))/2) ;--_text-field-gutter-end: calc(1px*(24 + 4*clamp(-1, var(--vvd-size-density, 0), 2))/2) ;--_text-field-icon-size: calc(1px*(32 + 4*clamp(-1, var(--vvd-size-density, 0), 2))/2) ;--_text-field-block-size: calc(1px*(32 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) ;--_text-field-border-radius: 4px}@supports (user-select: none){.base{user-select:none}}.base:not(.disabled){--_low-ink-color: var(--vvd-color-neutral-600)}.base.disabled{--_low-ink-color: var(--_appearance-color-text)}.label:not(slot),.label::slotted(label){box-sizing:initial!important;padding:initial!important;margin:initial!important;color:var(--vvd-color-canvas-text)!important;contain:inline-size!important;font:var(--vvd-typography-base);grid-column:1/4;grid-row:1}.char-count+.label:not(slot),.char-count+.label::slotted(label){grid-column:1/3}.char-count{color:var(--_low-ink-color);font:var(--vvd-typography-base);grid-column:3/4}.fieldset{position:relative;display:flex;align-items:center;background-color:var(--_appearance-color-fill);font:var(--vvd-typography-base);grid-column:1/4;padding-block:0;transition:color .2s,background-color .2s}.fieldset:after{position:absolute;display:block;border-radius:inherit;block-size:100%;box-shadow:inset 0 0 0 1px var(--_appearance-color-outline);content:\"\";inline-size:100%;pointer-events:none;transition:box-shadow .2s}.fieldset:focus-visible{outline:none}.base>.fieldset{block-size:var(--_text-field-block-size)}.base:not(.shape-pill) .fieldset{border-radius:var(--_text-field-border-radius)}.base.shape-pill .fieldset{border-radius:var(--_text-field-pill-border-radius)}.wrapper{border-radius:inherit;block-size:100%;inline-size:100%}.control{border-radius:inherit;text-align:start}.control:not(slot),.control::slotted(input){width:100%!important;box-sizing:border-box!important;border:0 none!important;border-radius:inherit!important;margin:initial!important;appearance:none!important;background-color:transparent!important;block-size:100%!important;color:inherit!important;font:inherit;outline:transparent;padding-block:0!important;padding-inline:var(--_text-field-gutter-start) var(--_text-field-gutter-end)!important;text-align:inherit}.control:not(slot):disabled,.control::slotted(input:disabled){cursor:not-allowed!important;opacity:1!important;-webkit-text-fill-color:var(--_appearance-color-text)!important}.control:not(slot)::placeholder{opacity:1!important;-webkit-text-fill-color:var(--_low-ink-color)!important}.control::slotted(input:-webkit-autofill),.control:not(slot):-webkit-autofill{-webkit-box-shadow:0 0 0 1000px var(--_appearance-color-fill) inset;-webkit-text-fill-color:var(--_appearance-color-text)!important}.has-icon .control:not(slot),.has-icon .control::slotted(input){padding-inline-start:calc(var(--_text-field-icon-size) + var(--_text-field-gutter-start) * 2)!important}.icon{position:absolute;z-index:1;color:var(--_low-ink-color);font-size:var(--_text-field-icon-size);inset-block-start:50%;inset-inline-start:calc(100% + var(--_text-field-gutter-start));line-height:1;transform:translateY(-50%)}.leading-items-wrapper{position:relative}.base.no-leading .leading-items-wrapper{display:none}.action-items-wrapper{margin-inline-end:4px}.base:not(.action-items) .action-items-wrapper{display:none}@supports selector(:has(*)){.fieldset:has(.wrapper .control:focus-within):after{--focus-stroke-gap-color: transparent;box-shadow:inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));outline-offset:calc(-2px - var(--focus-inset, 0px))}}@supports not selector(:has(*)){.wrapper:focus-within:after{box-shadow:inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));outline-offset:calc(-2px - var(--focus-inset, 0px));--focus-stroke-gap-color: transparent;position:absolute;z-index:1;display:block;border-radius:inherit;content:\"\";inset:0;pointer-events:none}}:host([internal-part]) .fieldset{background-color:transparent;font:var(--vvd-typography-heading-4);line-height:1.1}:host([internal-part]) .fieldset:not(:focus-within):after{block-size:1px;inset-block-end:0}@supports selector(:has(*)){:host([internal-part]) .fieldset:has(.action-items-wrapper:focus-within):after{block-size:1px;inset-block-end:0}}:host([internal-part]) .control{text-align:center}slot[name=_mirrored-helper-text]{display:none}.base{--_text-field-gutter-end: 70px}.control::-webkit-outer-spin-button,.control::-webkit-inner-spin-button{appearance:none}.control-buttons{position:absolute;z-index:1;right:3px;display:flex}.readonly .control-buttons,.disabled .control-buttons{pointer-events:none}.control-buttons .divider{margin-block:8px}.control-buttons>*{flex-shrink:0}";
|
|
19
239
|
|
|
20
240
|
class _NumberField extends index.FoundationElement {
|
|
@@ -308,7 +528,7 @@ applyMixinsWithObservables.applyMixinsWithObservables(
|
|
|
308
528
|
formElements.FormElementCharCount,
|
|
309
529
|
formElements.FormElementHelperText,
|
|
310
530
|
formElements.FormElementSuccessText,
|
|
311
|
-
|
|
531
|
+
DelegatesARIATextbox
|
|
312
532
|
);
|
|
313
533
|
|
|
314
534
|
const getStateClasses = ({
|
package/shared/definition35.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { F as FoundationElement,
|
|
1
|
+
import { F as FoundationElement, _ as __decorate, a as attr, n as nullableNumberConverter, o as observable, D as DOM, h as html, r as registerFactory } from './index.js';
|
|
2
2
|
import { c as Button, a as buttonRegistries } from './definition11.js';
|
|
3
3
|
import { D as Divider, a as dividerRegistries } from './definition22.js';
|
|
4
4
|
import { a as applyMixinsWithObservables } from './applyMixinsWithObservables.js';
|
|
5
5
|
import { F as FormAssociated } from './form-associated.js';
|
|
6
|
-
import {
|
|
6
|
+
import { a as applyMixins } from './apply-mixins.js';
|
|
7
|
+
import { A as ARIAGlobalStatesAndProperties } from './aria-global.js';
|
|
8
|
+
import { S as StartEnd } from './start-end.js';
|
|
7
9
|
import { c as keyArrowDown, d as keyArrowUp } from './key-codes.js';
|
|
8
10
|
import { e as errorText, f as formElements, F as FormElementSuccessText, a as FormElementHelperText, b as FormElementCharCount, g as getFeedbackTemplate } from './form-elements.js';
|
|
9
11
|
import { A as AffixIcon } from './affix.js';
|
|
@@ -13,6 +15,224 @@ import { w as when } from './when.js';
|
|
|
13
15
|
import { r as ref } from './ref.js';
|
|
14
16
|
import { c as classNames } from './class-names.js';
|
|
15
17
|
|
|
18
|
+
class _TextField extends FoundationElement {
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A form-associated base class for the {@link @microsoft/fast-foundation#(TextField:class)} component.
|
|
22
|
+
*
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
class FormAssociatedTextField extends FormAssociated(_TextField) {
|
|
26
|
+
constructor() {
|
|
27
|
+
super(...arguments);
|
|
28
|
+
this.proxy = document.createElement("input");
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Text field sub-types
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
36
|
+
const TextFieldType = {
|
|
37
|
+
/**
|
|
38
|
+
* An email TextField
|
|
39
|
+
*/
|
|
40
|
+
email: "email",
|
|
41
|
+
/**
|
|
42
|
+
* A password TextField
|
|
43
|
+
*/
|
|
44
|
+
password: "password",
|
|
45
|
+
/**
|
|
46
|
+
* A telephone TextField
|
|
47
|
+
*/
|
|
48
|
+
tel: "tel",
|
|
49
|
+
/**
|
|
50
|
+
* A text TextField
|
|
51
|
+
*/
|
|
52
|
+
text: "text",
|
|
53
|
+
/**
|
|
54
|
+
* A URL TextField
|
|
55
|
+
*/
|
|
56
|
+
url: "url",
|
|
57
|
+
};
|
|
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
|
+
* @slot start - Content which can be provided before the number field input
|
|
64
|
+
* @slot end - Content which can be provided after the number field input
|
|
65
|
+
* @slot - The default slot for the label
|
|
66
|
+
* @csspart label - The label
|
|
67
|
+
* @csspart root - The element wrapping the control, including start and end slots
|
|
68
|
+
* @csspart control - The text field element
|
|
69
|
+
* @fires change - Fires a custom 'change' event when the value has changed
|
|
70
|
+
*
|
|
71
|
+
* @public
|
|
72
|
+
*/
|
|
73
|
+
class TextField extends FormAssociatedTextField {
|
|
74
|
+
constructor() {
|
|
75
|
+
super(...arguments);
|
|
76
|
+
/**
|
|
77
|
+
* Allows setting a type or mode of text.
|
|
78
|
+
* @public
|
|
79
|
+
* @remarks
|
|
80
|
+
* HTML Attribute: type
|
|
81
|
+
*/
|
|
82
|
+
this.type = TextFieldType.text;
|
|
83
|
+
}
|
|
84
|
+
readOnlyChanged() {
|
|
85
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
86
|
+
this.proxy.readOnly = this.readOnly;
|
|
87
|
+
this.validate();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
autofocusChanged() {
|
|
91
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
92
|
+
this.proxy.autofocus = this.autofocus;
|
|
93
|
+
this.validate();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
placeholderChanged() {
|
|
97
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
98
|
+
this.proxy.placeholder = this.placeholder;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
typeChanged() {
|
|
102
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
103
|
+
this.proxy.type = this.type;
|
|
104
|
+
this.validate();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
listChanged() {
|
|
108
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
109
|
+
this.proxy.setAttribute("list", this.list);
|
|
110
|
+
this.validate();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
maxlengthChanged() {
|
|
114
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
115
|
+
this.proxy.maxLength = this.maxlength;
|
|
116
|
+
this.validate();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
minlengthChanged() {
|
|
120
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
121
|
+
this.proxy.minLength = this.minlength;
|
|
122
|
+
this.validate();
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
patternChanged() {
|
|
126
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
127
|
+
this.proxy.pattern = this.pattern;
|
|
128
|
+
this.validate();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
sizeChanged() {
|
|
132
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
133
|
+
this.proxy.size = this.size;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
spellcheckChanged() {
|
|
137
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
138
|
+
this.proxy.spellcheck = this.spellcheck;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* @internal
|
|
143
|
+
*/
|
|
144
|
+
connectedCallback() {
|
|
145
|
+
super.connectedCallback();
|
|
146
|
+
this.proxy.setAttribute("type", this.type);
|
|
147
|
+
this.validate();
|
|
148
|
+
if (this.autofocus) {
|
|
149
|
+
DOM.queueUpdate(() => {
|
|
150
|
+
this.focus();
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Selects all the text in the text field
|
|
156
|
+
*
|
|
157
|
+
* @public
|
|
158
|
+
*/
|
|
159
|
+
select() {
|
|
160
|
+
this.control.select();
|
|
161
|
+
/**
|
|
162
|
+
* The select event does not permeate the shadow DOM boundary.
|
|
163
|
+
* This fn effectively proxies the select event,
|
|
164
|
+
* emitting a `select` event whenever the internal
|
|
165
|
+
* control emits a `select` event
|
|
166
|
+
*/
|
|
167
|
+
this.$emit("select");
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Handles the internal control's `input` event
|
|
171
|
+
* @internal
|
|
172
|
+
*/
|
|
173
|
+
handleTextInput() {
|
|
174
|
+
this.value = this.control.value;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Change event handler for inner control.
|
|
178
|
+
* @remarks
|
|
179
|
+
* "Change" events are not `composable` so they will not
|
|
180
|
+
* permeate the shadow DOM boundary. This fn effectively proxies
|
|
181
|
+
* the change event, emitting a `change` event whenever the internal
|
|
182
|
+
* control emits a `change` event
|
|
183
|
+
* @internal
|
|
184
|
+
*/
|
|
185
|
+
handleChange() {
|
|
186
|
+
this.$emit("change");
|
|
187
|
+
}
|
|
188
|
+
/** {@inheritDoc (FormAssociated:interface).validate} */
|
|
189
|
+
validate() {
|
|
190
|
+
super.validate(this.control);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
__decorate([
|
|
194
|
+
attr({ attribute: "readonly", mode: "boolean" })
|
|
195
|
+
], TextField.prototype, "readOnly", void 0);
|
|
196
|
+
__decorate([
|
|
197
|
+
attr({ mode: "boolean" })
|
|
198
|
+
], TextField.prototype, "autofocus", void 0);
|
|
199
|
+
__decorate([
|
|
200
|
+
attr
|
|
201
|
+
], TextField.prototype, "placeholder", void 0);
|
|
202
|
+
__decorate([
|
|
203
|
+
attr
|
|
204
|
+
], TextField.prototype, "type", void 0);
|
|
205
|
+
__decorate([
|
|
206
|
+
attr
|
|
207
|
+
], TextField.prototype, "list", void 0);
|
|
208
|
+
__decorate([
|
|
209
|
+
attr({ converter: nullableNumberConverter })
|
|
210
|
+
], TextField.prototype, "maxlength", void 0);
|
|
211
|
+
__decorate([
|
|
212
|
+
attr({ converter: nullableNumberConverter })
|
|
213
|
+
], TextField.prototype, "minlength", void 0);
|
|
214
|
+
__decorate([
|
|
215
|
+
attr
|
|
216
|
+
], TextField.prototype, "pattern", void 0);
|
|
217
|
+
__decorate([
|
|
218
|
+
attr({ converter: nullableNumberConverter })
|
|
219
|
+
], TextField.prototype, "size", void 0);
|
|
220
|
+
__decorate([
|
|
221
|
+
attr({ mode: "boolean" })
|
|
222
|
+
], TextField.prototype, "spellcheck", void 0);
|
|
223
|
+
__decorate([
|
|
224
|
+
observable
|
|
225
|
+
], TextField.prototype, "defaultSlottedNodes", void 0);
|
|
226
|
+
/**
|
|
227
|
+
* Includes ARIA states and properties relating to the ARIA textbox role
|
|
228
|
+
*
|
|
229
|
+
* @public
|
|
230
|
+
*/
|
|
231
|
+
class DelegatesARIATextbox {
|
|
232
|
+
}
|
|
233
|
+
applyMixins(DelegatesARIATextbox, ARIAGlobalStatesAndProperties);
|
|
234
|
+
applyMixins(TextField, StartEnd, DelegatesARIATextbox);
|
|
235
|
+
|
|
16
236
|
const styles = ":host{display:inline-block}.base{--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-canvas);--_appearance-color-outline: var(--_connotation-color-intermediate)}.base.appearance-ghost{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-canvas);--_appearance-color-outline: var(--_connotation-color-fierce)}.base:where(.hover,:hover):where(:not(.disabled,:disabled,.readonly)).appearance-ghost{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.base:where(.disabled,:disabled){--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: var(--vvd-color-neutral-100);--_appearance-color-outline: var(--vvd-color-neutral-300)}.base:where(.disabled,:disabled).appearance-ghost{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base:where(.readonly):where(:not(.disabled,:disabled)){--_appearance-color-text: var(--vvd-color-canvas-text);--_appearance-color-fill: var(--vvd-color-neutral-200);--_appearance-color-outline: var(--vvd-color-neutral-400)}.base:where(.readonly):where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: var(--vvd-color-neutral-600);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.base:where(.error):where(:not(.disabled,:disabled)){--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-alert-50);--_appearance-color-outline: var(--vvd-color-alert-500)}.base:where(.error):where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-alert-50);--_appearance-color-outline: transparent}.base:where(.success):where(:not(.disabled,:disabled)){--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-success-50);--_appearance-color-outline: var(--vvd-color-success-500)}.base:where(.success):where(:not(.disabled,:disabled)).appearance-ghost{--_appearance-color-text: notSet;--_appearance-color-fill: var(--vvd-color-success-50);--_appearance-color-outline: transparent}.base{--_connotation-color-primary: var(--vvd-text-field-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-text: var(--vvd-text-field-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-text-field-accent-primary-increment, var(--vvd-color-neutral-800));--_connotation-color-intermediate: var(--vvd-text-field-accent-intermediate, var(--vvd-color-neutral-500));--_connotation-color-firm: var(--vvd-text-field-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-fierce: var(--vvd-text-field-accent-fierce, var(--vvd-color-neutral-700));--_connotation-color-faint: var(--vvd-text-field-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-text-field-accent-soft, var(--vvd-color-neutral-100))}.base{--_text-field-gutter-start: calc(1px*(40 + 4*clamp(-1, var(--vvd-size-density, 0), 2))*.4) ;--_text-field-gutter-end: calc(1px*(40 + 4*clamp(-1, var(--vvd-size-density, 0), 2))*.4) ;--_text-field-icon-size: calc(1px*(40 + 4*clamp(-1, var(--vvd-size-density, 0), 2))/2) ;--_text-field-block-size: calc(1px*(40 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) ;--_text-field-border-radius: 8px;--_text-field-pill-border-radius: 24px;display:inline-grid;width:100%;gap:4px;grid-template-columns:min-content 1fr max-content}.base.size-condensed{--_text-field-gutter-start: calc(1px*(24 + 4*clamp(-1, var(--vvd-size-density, 0), 2))/2) ;--_text-field-gutter-end: calc(1px*(24 + 4*clamp(-1, var(--vvd-size-density, 0), 2))/2) ;--_text-field-icon-size: calc(1px*(32 + 4*clamp(-1, var(--vvd-size-density, 0), 2))/2) ;--_text-field-block-size: calc(1px*(32 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) ;--_text-field-border-radius: 4px}@supports (user-select: none){.base{user-select:none}}.base:not(.disabled){--_low-ink-color: var(--vvd-color-neutral-600)}.base.disabled{--_low-ink-color: var(--_appearance-color-text)}.label:not(slot),.label::slotted(label){box-sizing:initial!important;padding:initial!important;margin:initial!important;color:var(--vvd-color-canvas-text)!important;contain:inline-size!important;font:var(--vvd-typography-base);grid-column:1/4;grid-row:1}.char-count+.label:not(slot),.char-count+.label::slotted(label){grid-column:1/3}.char-count{color:var(--_low-ink-color);font:var(--vvd-typography-base);grid-column:3/4}.fieldset{position:relative;display:flex;align-items:center;background-color:var(--_appearance-color-fill);font:var(--vvd-typography-base);grid-column:1/4;padding-block:0;transition:color .2s,background-color .2s}.fieldset:after{position:absolute;display:block;border-radius:inherit;block-size:100%;box-shadow:inset 0 0 0 1px var(--_appearance-color-outline);content:\"\";inline-size:100%;pointer-events:none;transition:box-shadow .2s}.fieldset:focus-visible{outline:none}.base>.fieldset{block-size:var(--_text-field-block-size)}.base:not(.shape-pill) .fieldset{border-radius:var(--_text-field-border-radius)}.base.shape-pill .fieldset{border-radius:var(--_text-field-pill-border-radius)}.wrapper{border-radius:inherit;block-size:100%;inline-size:100%}.control{border-radius:inherit;text-align:start}.control:not(slot),.control::slotted(input){width:100%!important;box-sizing:border-box!important;border:0 none!important;border-radius:inherit!important;margin:initial!important;appearance:none!important;background-color:transparent!important;block-size:100%!important;color:inherit!important;font:inherit;outline:transparent;padding-block:0!important;padding-inline:var(--_text-field-gutter-start) var(--_text-field-gutter-end)!important;text-align:inherit}.control:not(slot):disabled,.control::slotted(input:disabled){cursor:not-allowed!important;opacity:1!important;-webkit-text-fill-color:var(--_appearance-color-text)!important}.control:not(slot)::placeholder{opacity:1!important;-webkit-text-fill-color:var(--_low-ink-color)!important}.control::slotted(input:-webkit-autofill),.control:not(slot):-webkit-autofill{-webkit-box-shadow:0 0 0 1000px var(--_appearance-color-fill) inset;-webkit-text-fill-color:var(--_appearance-color-text)!important}.has-icon .control:not(slot),.has-icon .control::slotted(input){padding-inline-start:calc(var(--_text-field-icon-size) + var(--_text-field-gutter-start) * 2)!important}.icon{position:absolute;z-index:1;color:var(--_low-ink-color);font-size:var(--_text-field-icon-size);inset-block-start:50%;inset-inline-start:calc(100% + var(--_text-field-gutter-start));line-height:1;transform:translateY(-50%)}.leading-items-wrapper{position:relative}.base.no-leading .leading-items-wrapper{display:none}.action-items-wrapper{margin-inline-end:4px}.base:not(.action-items) .action-items-wrapper{display:none}@supports selector(:has(*)){.fieldset:has(.wrapper .control:focus-within):after{--focus-stroke-gap-color: transparent;box-shadow:inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));outline-offset:calc(-2px - var(--focus-inset, 0px))}}@supports not selector(:has(*)){.wrapper:focus-within:after{box-shadow:inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));outline-offset:calc(-2px - var(--focus-inset, 0px));--focus-stroke-gap-color: transparent;position:absolute;z-index:1;display:block;border-radius:inherit;content:\"\";inset:0;pointer-events:none}}:host([internal-part]) .fieldset{background-color:transparent;font:var(--vvd-typography-heading-4);line-height:1.1}:host([internal-part]) .fieldset:not(:focus-within):after{block-size:1px;inset-block-end:0}@supports selector(:has(*)){:host([internal-part]) .fieldset:has(.action-items-wrapper:focus-within):after{block-size:1px;inset-block-end:0}}:host([internal-part]) .control{text-align:center}slot[name=_mirrored-helper-text]{display:none}.base{--_text-field-gutter-end: 70px}.control::-webkit-outer-spin-button,.control::-webkit-inner-spin-button{appearance:none}.control-buttons{position:absolute;z-index:1;right:3px;display:flex}.readonly .control-buttons,.disabled .control-buttons{pointer-events:none}.control-buttons .divider{margin-block:8px}.control-buttons>*{flex-shrink:0}";
|
|
17
237
|
|
|
18
238
|
class _NumberField extends FoundationElement {
|