@vonage/vivid 3.0.0-next.20 → 3.0.0-next.23
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 +2 -2
- package/accordion-item/index.js +13 -5
- package/action-group/index.js +19 -4
- package/badge/index.js +4 -1
- package/banner/index.js +10 -9
- package/breadcrumb/index.js +1 -0
- package/breadcrumb-item/index.js +14 -4
- package/button/index.js +8 -3
- package/calendar/index.js +33 -9
- package/calendar-event/index.js +117 -0
- package/card/index.js +12 -17
- package/fab/index.js +8 -3
- package/focus/index.js +1 -1
- package/icon/index.js +3 -1
- package/index.js +15 -9
- package/lib/accordion-item/index.d.ts +2 -0
- package/lib/action-group/action-group.d.ts +1 -0
- package/lib/banner/banner.template.d.ts +0 -2
- package/lib/banner/index.d.ts +1 -0
- package/lib/breadcrumb-item/index.d.ts +1 -0
- package/lib/calendar/calendar.d.ts +3 -1
- package/lib/calendar/index.d.ts +0 -1
- 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/index.d.ts +2 -0
- package/lib/card/index.d.ts +0 -1
- package/lib/components.d.ts +1 -0
- package/lib/side-drawer/side-drawer.d.ts +8 -1
- package/lib/sidenav-item/index.d.ts +1 -0
- package/lib/text-field/text-field.d.ts +1 -0
- package/note/index.js +4 -1
- package/package.json +6 -2
- package/popup/index.js +10 -5
- package/progress/index.js +31 -23
- package/shared/aria-global.js +3 -40
- package/shared/button.js +1 -1
- package/shared/calendar-event.js +26 -0
- package/shared/es.object.assign.js +2 -2
- package/shared/{object-set-prototype-of.js → export.js} +472 -530
- package/shared/focus2.js +2 -459
- package/shared/form-associated.js +460 -0
- package/shared/icon.js +23 -69
- package/shared/iterators.js +61 -0
- package/shared/object-keys.js +13 -0
- package/shared/ref.js +41 -0
- package/shared/text-anchor.template.js +5 -2
- package/shared/to-string.js +51 -0
- package/shared/web.dom-collections.iterator.js +5 -13
- package/side-drawer/index.js +8588 -10
- package/sidenav-item/index.js +10 -6
- package/text/index.js +3 -1
- package/text-anchor/index.js +7 -1
- package/text-field/index.js +14 -5
- package/tooltip/index.js +7 -2
|
@@ -0,0 +1,460 @@
|
|
|
1
|
+
import { e as emptyArray, D as DOM, a as attr, o as observable } from './index.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Key Code values
|
|
5
|
+
* @deprecated - KeyCodes are deprecated, use individual string key exports
|
|
6
|
+
*/
|
|
7
|
+
var KeyCodes;
|
|
8
|
+
(function (KeyCodes) {
|
|
9
|
+
KeyCodes[KeyCodes["alt"] = 18] = "alt";
|
|
10
|
+
KeyCodes[KeyCodes["arrowDown"] = 40] = "arrowDown";
|
|
11
|
+
KeyCodes[KeyCodes["arrowLeft"] = 37] = "arrowLeft";
|
|
12
|
+
KeyCodes[KeyCodes["arrowRight"] = 39] = "arrowRight";
|
|
13
|
+
KeyCodes[KeyCodes["arrowUp"] = 38] = "arrowUp";
|
|
14
|
+
KeyCodes[KeyCodes["back"] = 8] = "back";
|
|
15
|
+
KeyCodes[KeyCodes["backSlash"] = 220] = "backSlash";
|
|
16
|
+
KeyCodes[KeyCodes["break"] = 19] = "break";
|
|
17
|
+
KeyCodes[KeyCodes["capsLock"] = 20] = "capsLock";
|
|
18
|
+
KeyCodes[KeyCodes["closeBracket"] = 221] = "closeBracket";
|
|
19
|
+
KeyCodes[KeyCodes["colon"] = 186] = "colon";
|
|
20
|
+
KeyCodes[KeyCodes["colon2"] = 59] = "colon2";
|
|
21
|
+
KeyCodes[KeyCodes["comma"] = 188] = "comma";
|
|
22
|
+
KeyCodes[KeyCodes["ctrl"] = 17] = "ctrl";
|
|
23
|
+
KeyCodes[KeyCodes["delete"] = 46] = "delete";
|
|
24
|
+
KeyCodes[KeyCodes["end"] = 35] = "end";
|
|
25
|
+
KeyCodes[KeyCodes["enter"] = 13] = "enter";
|
|
26
|
+
KeyCodes[KeyCodes["equals"] = 187] = "equals";
|
|
27
|
+
KeyCodes[KeyCodes["equals2"] = 61] = "equals2";
|
|
28
|
+
KeyCodes[KeyCodes["equals3"] = 107] = "equals3";
|
|
29
|
+
KeyCodes[KeyCodes["escape"] = 27] = "escape";
|
|
30
|
+
KeyCodes[KeyCodes["forwardSlash"] = 191] = "forwardSlash";
|
|
31
|
+
KeyCodes[KeyCodes["function1"] = 112] = "function1";
|
|
32
|
+
KeyCodes[KeyCodes["function10"] = 121] = "function10";
|
|
33
|
+
KeyCodes[KeyCodes["function11"] = 122] = "function11";
|
|
34
|
+
KeyCodes[KeyCodes["function12"] = 123] = "function12";
|
|
35
|
+
KeyCodes[KeyCodes["function2"] = 113] = "function2";
|
|
36
|
+
KeyCodes[KeyCodes["function3"] = 114] = "function3";
|
|
37
|
+
KeyCodes[KeyCodes["function4"] = 115] = "function4";
|
|
38
|
+
KeyCodes[KeyCodes["function5"] = 116] = "function5";
|
|
39
|
+
KeyCodes[KeyCodes["function6"] = 117] = "function6";
|
|
40
|
+
KeyCodes[KeyCodes["function7"] = 118] = "function7";
|
|
41
|
+
KeyCodes[KeyCodes["function8"] = 119] = "function8";
|
|
42
|
+
KeyCodes[KeyCodes["function9"] = 120] = "function9";
|
|
43
|
+
KeyCodes[KeyCodes["home"] = 36] = "home";
|
|
44
|
+
KeyCodes[KeyCodes["insert"] = 45] = "insert";
|
|
45
|
+
KeyCodes[KeyCodes["menu"] = 93] = "menu";
|
|
46
|
+
KeyCodes[KeyCodes["minus"] = 189] = "minus";
|
|
47
|
+
KeyCodes[KeyCodes["minus2"] = 109] = "minus2";
|
|
48
|
+
KeyCodes[KeyCodes["numLock"] = 144] = "numLock";
|
|
49
|
+
KeyCodes[KeyCodes["numPad0"] = 96] = "numPad0";
|
|
50
|
+
KeyCodes[KeyCodes["numPad1"] = 97] = "numPad1";
|
|
51
|
+
KeyCodes[KeyCodes["numPad2"] = 98] = "numPad2";
|
|
52
|
+
KeyCodes[KeyCodes["numPad3"] = 99] = "numPad3";
|
|
53
|
+
KeyCodes[KeyCodes["numPad4"] = 100] = "numPad4";
|
|
54
|
+
KeyCodes[KeyCodes["numPad5"] = 101] = "numPad5";
|
|
55
|
+
KeyCodes[KeyCodes["numPad6"] = 102] = "numPad6";
|
|
56
|
+
KeyCodes[KeyCodes["numPad7"] = 103] = "numPad7";
|
|
57
|
+
KeyCodes[KeyCodes["numPad8"] = 104] = "numPad8";
|
|
58
|
+
KeyCodes[KeyCodes["numPad9"] = 105] = "numPad9";
|
|
59
|
+
KeyCodes[KeyCodes["numPadDivide"] = 111] = "numPadDivide";
|
|
60
|
+
KeyCodes[KeyCodes["numPadDot"] = 110] = "numPadDot";
|
|
61
|
+
KeyCodes[KeyCodes["numPadMinus"] = 109] = "numPadMinus";
|
|
62
|
+
KeyCodes[KeyCodes["numPadMultiply"] = 106] = "numPadMultiply";
|
|
63
|
+
KeyCodes[KeyCodes["numPadPlus"] = 107] = "numPadPlus";
|
|
64
|
+
KeyCodes[KeyCodes["openBracket"] = 219] = "openBracket";
|
|
65
|
+
KeyCodes[KeyCodes["pageDown"] = 34] = "pageDown";
|
|
66
|
+
KeyCodes[KeyCodes["pageUp"] = 33] = "pageUp";
|
|
67
|
+
KeyCodes[KeyCodes["period"] = 190] = "period";
|
|
68
|
+
KeyCodes[KeyCodes["print"] = 44] = "print";
|
|
69
|
+
KeyCodes[KeyCodes["quote"] = 222] = "quote";
|
|
70
|
+
KeyCodes[KeyCodes["scrollLock"] = 145] = "scrollLock";
|
|
71
|
+
KeyCodes[KeyCodes["shift"] = 16] = "shift";
|
|
72
|
+
KeyCodes[KeyCodes["space"] = 32] = "space";
|
|
73
|
+
KeyCodes[KeyCodes["tab"] = 9] = "tab";
|
|
74
|
+
KeyCodes[KeyCodes["tilde"] = 192] = "tilde";
|
|
75
|
+
KeyCodes[KeyCodes["windowsLeft"] = 91] = "windowsLeft";
|
|
76
|
+
KeyCodes[KeyCodes["windowsOpera"] = 219] = "windowsOpera";
|
|
77
|
+
KeyCodes[KeyCodes["windowsRight"] = 92] = "windowsRight";
|
|
78
|
+
})(KeyCodes || (KeyCodes = {}));
|
|
79
|
+
const keyEnter = "Enter";
|
|
80
|
+
|
|
81
|
+
const proxySlotName = "form-associated-proxy";
|
|
82
|
+
const ElementInternalsKey = "ElementInternals";
|
|
83
|
+
/**
|
|
84
|
+
* @alpha
|
|
85
|
+
*/
|
|
86
|
+
const supportsElementInternals = ElementInternalsKey in window &&
|
|
87
|
+
"setFormValue" in window[ElementInternalsKey].prototype;
|
|
88
|
+
const InternalsMap = new WeakMap();
|
|
89
|
+
/**
|
|
90
|
+
* Base function for providing Custom Element Form Association.
|
|
91
|
+
*
|
|
92
|
+
* @alpha
|
|
93
|
+
*/
|
|
94
|
+
function FormAssociated(BaseCtor) {
|
|
95
|
+
const C = class extends BaseCtor {
|
|
96
|
+
constructor(...args) {
|
|
97
|
+
super(...args);
|
|
98
|
+
/**
|
|
99
|
+
* Track whether the value has been changed from the initial value
|
|
100
|
+
*/
|
|
101
|
+
this.dirtyValue = false;
|
|
102
|
+
/**
|
|
103
|
+
* Sets the element's disabled state. A disabled element will not be included during form submission.
|
|
104
|
+
*
|
|
105
|
+
* @remarks
|
|
106
|
+
* HTML Attribute: disabled
|
|
107
|
+
*/
|
|
108
|
+
this.disabled = false;
|
|
109
|
+
/**
|
|
110
|
+
* These are events that are still fired by the proxy
|
|
111
|
+
* element based on user / programmatic interaction.
|
|
112
|
+
*
|
|
113
|
+
* The proxy implementation should be transparent to
|
|
114
|
+
* the app author, so block these events from emitting.
|
|
115
|
+
*/
|
|
116
|
+
this.proxyEventsToBlock = ["change", "click"];
|
|
117
|
+
this.proxyInitialized = false;
|
|
118
|
+
this.required = false;
|
|
119
|
+
this.initialValue = this.initialValue || "";
|
|
120
|
+
if (!this.elementInternals) {
|
|
121
|
+
// When elementInternals is not supported, formResetCallback is
|
|
122
|
+
// bound to an event listener, so ensure the handler's `this`
|
|
123
|
+
// context is correct.
|
|
124
|
+
this.formResetCallback = this.formResetCallback.bind(this);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Must evaluate to true to enable elementInternals.
|
|
129
|
+
* Feature detects API support and resolve respectively
|
|
130
|
+
*
|
|
131
|
+
* @internal
|
|
132
|
+
*/
|
|
133
|
+
static get formAssociated() {
|
|
134
|
+
return supportsElementInternals;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Returns the validity state of the element
|
|
138
|
+
*
|
|
139
|
+
* @alpha
|
|
140
|
+
*/
|
|
141
|
+
get validity() {
|
|
142
|
+
return this.elementInternals
|
|
143
|
+
? this.elementInternals.validity
|
|
144
|
+
: this.proxy.validity;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Retrieve a reference to the associated form.
|
|
148
|
+
* Returns null if not associated to any form.
|
|
149
|
+
*
|
|
150
|
+
* @alpha
|
|
151
|
+
*/
|
|
152
|
+
get form() {
|
|
153
|
+
return this.elementInternals ? this.elementInternals.form : this.proxy.form;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Retrieve the localized validation message,
|
|
157
|
+
* or custom validation message if set.
|
|
158
|
+
*
|
|
159
|
+
* @alpha
|
|
160
|
+
*/
|
|
161
|
+
get validationMessage() {
|
|
162
|
+
return this.elementInternals
|
|
163
|
+
? this.elementInternals.validationMessage
|
|
164
|
+
: this.proxy.validationMessage;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Whether the element will be validated when the
|
|
168
|
+
* form is submitted
|
|
169
|
+
*/
|
|
170
|
+
get willValidate() {
|
|
171
|
+
return this.elementInternals
|
|
172
|
+
? this.elementInternals.willValidate
|
|
173
|
+
: this.proxy.willValidate;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* A reference to all associated label elements
|
|
177
|
+
*/
|
|
178
|
+
get labels() {
|
|
179
|
+
if (this.elementInternals) {
|
|
180
|
+
return Object.freeze(Array.from(this.elementInternals.labels));
|
|
181
|
+
}
|
|
182
|
+
else if (this.proxy instanceof HTMLElement &&
|
|
183
|
+
this.proxy.ownerDocument &&
|
|
184
|
+
this.id) {
|
|
185
|
+
// Labels associated by wrapping the element: <label><custom-element></custom-element></label>
|
|
186
|
+
const parentLabels = this.proxy.labels;
|
|
187
|
+
// Labels associated using the `for` attribute
|
|
188
|
+
const forLabels = Array.from(this.proxy.getRootNode().querySelectorAll(`[for='${this.id}']`));
|
|
189
|
+
const labels = parentLabels
|
|
190
|
+
? forLabels.concat(Array.from(parentLabels))
|
|
191
|
+
: forLabels;
|
|
192
|
+
return Object.freeze(labels);
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
return emptyArray;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Invoked when the `value` property changes
|
|
200
|
+
* @param previous - the previous value
|
|
201
|
+
* @param next - the new value
|
|
202
|
+
*
|
|
203
|
+
* @remarks
|
|
204
|
+
* If elements extending `FormAssociated` implement a `valueChanged` method
|
|
205
|
+
* They must be sure to invoke `super.valueChanged(previous, next)` to ensure
|
|
206
|
+
* proper functioning of `FormAssociated`
|
|
207
|
+
*/
|
|
208
|
+
valueChanged(previous, next) {
|
|
209
|
+
this.dirtyValue = true;
|
|
210
|
+
if (this.proxy instanceof HTMLElement) {
|
|
211
|
+
this.proxy.value = this.value;
|
|
212
|
+
}
|
|
213
|
+
this.currentValue = this.value;
|
|
214
|
+
this.setFormValue(this.value);
|
|
215
|
+
this.validate();
|
|
216
|
+
}
|
|
217
|
+
currentValueChanged() {
|
|
218
|
+
this.value = this.currentValue;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Invoked when the `initialValue` property changes
|
|
222
|
+
*
|
|
223
|
+
* @param previous - the previous value
|
|
224
|
+
* @param next - the new value
|
|
225
|
+
*
|
|
226
|
+
* @remarks
|
|
227
|
+
* If elements extending `FormAssociated` implement a `initialValueChanged` method
|
|
228
|
+
* They must be sure to invoke `super.initialValueChanged(previous, next)` to ensure
|
|
229
|
+
* proper functioning of `FormAssociated`
|
|
230
|
+
*/
|
|
231
|
+
initialValueChanged(previous, next) {
|
|
232
|
+
// If the value is clean and the component is connected to the DOM
|
|
233
|
+
// then set value equal to the attribute value.
|
|
234
|
+
if (!this.dirtyValue) {
|
|
235
|
+
this.value = this.initialValue;
|
|
236
|
+
this.dirtyValue = false;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Invoked when the `disabled` property changes
|
|
241
|
+
*
|
|
242
|
+
* @param previous - the previous value
|
|
243
|
+
* @param next - the new value
|
|
244
|
+
*
|
|
245
|
+
* @remarks
|
|
246
|
+
* If elements extending `FormAssociated` implement a `disabledChanged` method
|
|
247
|
+
* They must be sure to invoke `super.disabledChanged(previous, next)` to ensure
|
|
248
|
+
* proper functioning of `FormAssociated`
|
|
249
|
+
*/
|
|
250
|
+
disabledChanged(previous, next) {
|
|
251
|
+
if (this.proxy instanceof HTMLElement) {
|
|
252
|
+
this.proxy.disabled = this.disabled;
|
|
253
|
+
}
|
|
254
|
+
DOM.queueUpdate(() => this.classList.toggle("disabled", this.disabled));
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Invoked when the `name` property changes
|
|
258
|
+
*
|
|
259
|
+
* @param previous - the previous value
|
|
260
|
+
* @param next - the new value
|
|
261
|
+
*
|
|
262
|
+
* @remarks
|
|
263
|
+
* If elements extending `FormAssociated` implement a `nameChanged` method
|
|
264
|
+
* They must be sure to invoke `super.nameChanged(previous, next)` to ensure
|
|
265
|
+
* proper functioning of `FormAssociated`
|
|
266
|
+
*/
|
|
267
|
+
nameChanged(previous, next) {
|
|
268
|
+
if (this.proxy instanceof HTMLElement) {
|
|
269
|
+
this.proxy.name = this.name;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Invoked when the `required` property changes
|
|
274
|
+
*
|
|
275
|
+
* @param previous - the previous value
|
|
276
|
+
* @param next - the new value
|
|
277
|
+
*
|
|
278
|
+
* @remarks
|
|
279
|
+
* If elements extending `FormAssociated` implement a `requiredChanged` method
|
|
280
|
+
* They must be sure to invoke `super.requiredChanged(previous, next)` to ensure
|
|
281
|
+
* proper functioning of `FormAssociated`
|
|
282
|
+
*/
|
|
283
|
+
requiredChanged(prev, next) {
|
|
284
|
+
if (this.proxy instanceof HTMLElement) {
|
|
285
|
+
this.proxy.required = this.required;
|
|
286
|
+
}
|
|
287
|
+
DOM.queueUpdate(() => this.classList.toggle("required", this.required));
|
|
288
|
+
this.validate();
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* The element internals object. Will only exist
|
|
292
|
+
* in browsers supporting the attachInternals API
|
|
293
|
+
*/
|
|
294
|
+
get elementInternals() {
|
|
295
|
+
if (!supportsElementInternals) {
|
|
296
|
+
return null;
|
|
297
|
+
}
|
|
298
|
+
let internals = InternalsMap.get(this);
|
|
299
|
+
if (!internals) {
|
|
300
|
+
internals = this.attachInternals();
|
|
301
|
+
InternalsMap.set(this, internals);
|
|
302
|
+
}
|
|
303
|
+
return internals;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* @internal
|
|
307
|
+
*/
|
|
308
|
+
connectedCallback() {
|
|
309
|
+
super.connectedCallback();
|
|
310
|
+
this.addEventListener("keypress", this._keypressHandler);
|
|
311
|
+
if (!this.value) {
|
|
312
|
+
this.value = this.initialValue;
|
|
313
|
+
this.dirtyValue = false;
|
|
314
|
+
}
|
|
315
|
+
if (!this.elementInternals) {
|
|
316
|
+
this.attachProxy();
|
|
317
|
+
if (this.form) {
|
|
318
|
+
this.form.addEventListener("reset", this.formResetCallback);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* @internal
|
|
324
|
+
*/
|
|
325
|
+
disconnectedCallback() {
|
|
326
|
+
this.proxyEventsToBlock.forEach(name => this.proxy.removeEventListener(name, this.stopPropagation));
|
|
327
|
+
if (!this.elementInternals && this.form) {
|
|
328
|
+
this.form.removeEventListener("reset", this.formResetCallback);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Return the current validity of the element.
|
|
333
|
+
*/
|
|
334
|
+
checkValidity() {
|
|
335
|
+
return this.elementInternals
|
|
336
|
+
? this.elementInternals.checkValidity()
|
|
337
|
+
: this.proxy.checkValidity();
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Return the current validity of the element.
|
|
341
|
+
* If false, fires an invalid event at the element.
|
|
342
|
+
*/
|
|
343
|
+
reportValidity() {
|
|
344
|
+
return this.elementInternals
|
|
345
|
+
? this.elementInternals.reportValidity()
|
|
346
|
+
: this.proxy.reportValidity();
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Set the validity of the control. In cases when the elementInternals object is not
|
|
350
|
+
* available (and the proxy element is used to report validity), this function will
|
|
351
|
+
* do nothing unless a message is provided, at which point the setCustomValidity method
|
|
352
|
+
* of the proxy element will be invoked with the provided message.
|
|
353
|
+
* @param flags - Validity flags
|
|
354
|
+
* @param message - Optional message to supply
|
|
355
|
+
* @param anchor - Optional element used by UA to display an interactive validation UI
|
|
356
|
+
*/
|
|
357
|
+
setValidity(flags, message, anchor) {
|
|
358
|
+
if (this.elementInternals) {
|
|
359
|
+
this.elementInternals.setValidity(flags, message, anchor);
|
|
360
|
+
}
|
|
361
|
+
else if (typeof message === "string") {
|
|
362
|
+
this.proxy.setCustomValidity(message);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Invoked when a connected component's form or fieldset has its disabled
|
|
367
|
+
* state changed.
|
|
368
|
+
* @param disabled - the disabled value of the form / fieldset
|
|
369
|
+
*/
|
|
370
|
+
formDisabledCallback(disabled) {
|
|
371
|
+
this.disabled = disabled;
|
|
372
|
+
}
|
|
373
|
+
formResetCallback() {
|
|
374
|
+
this.value = this.initialValue;
|
|
375
|
+
this.dirtyValue = false;
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Attach the proxy element to the DOM
|
|
379
|
+
*/
|
|
380
|
+
attachProxy() {
|
|
381
|
+
var _a;
|
|
382
|
+
if (!this.proxyInitialized) {
|
|
383
|
+
this.proxyInitialized = true;
|
|
384
|
+
this.proxy.style.display = "none";
|
|
385
|
+
this.proxyEventsToBlock.forEach(name => this.proxy.addEventListener(name, this.stopPropagation));
|
|
386
|
+
// These are typically mapped to the proxy during
|
|
387
|
+
// property change callbacks, but during initialization
|
|
388
|
+
// on the initial call of the callback, the proxy is
|
|
389
|
+
// still undefined. We should find a better way to address this.
|
|
390
|
+
this.proxy.disabled = this.disabled;
|
|
391
|
+
this.proxy.required = this.required;
|
|
392
|
+
if (typeof this.name === "string") {
|
|
393
|
+
this.proxy.name = this.name;
|
|
394
|
+
}
|
|
395
|
+
if (typeof this.value === "string") {
|
|
396
|
+
this.proxy.value = this.value;
|
|
397
|
+
}
|
|
398
|
+
this.proxy.setAttribute("slot", proxySlotName);
|
|
399
|
+
this.proxySlot = document.createElement("slot");
|
|
400
|
+
this.proxySlot.setAttribute("name", proxySlotName);
|
|
401
|
+
}
|
|
402
|
+
(_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.appendChild(this.proxySlot);
|
|
403
|
+
this.appendChild(this.proxy);
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Detach the proxy element from the DOM
|
|
407
|
+
*/
|
|
408
|
+
detachProxy() {
|
|
409
|
+
var _a;
|
|
410
|
+
this.removeChild(this.proxy);
|
|
411
|
+
(_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.removeChild(this.proxySlot);
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Sets the validity of the custom element. By default this uses the proxy element to determine
|
|
415
|
+
* validity, but this can be extended or replaced in implementation.
|
|
416
|
+
*/
|
|
417
|
+
validate() {
|
|
418
|
+
if (this.proxy instanceof HTMLElement) {
|
|
419
|
+
this.setValidity(this.proxy.validity, this.proxy.validationMessage);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Associates the provided value (and optional state) with the parent form.
|
|
424
|
+
* @param value - The value to set
|
|
425
|
+
* @param state - The state object provided to during session restores and when autofilling.
|
|
426
|
+
*/
|
|
427
|
+
setFormValue(value, state) {
|
|
428
|
+
if (this.elementInternals) {
|
|
429
|
+
this.elementInternals.setFormValue(value, state || value);
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
_keypressHandler(e) {
|
|
433
|
+
switch (e.key) {
|
|
434
|
+
case keyEnter:
|
|
435
|
+
if (this.form instanceof HTMLFormElement) {
|
|
436
|
+
// Implicit submission
|
|
437
|
+
const defaultButton = this.form.querySelector("[type=submit]");
|
|
438
|
+
defaultButton === null || defaultButton === void 0 ? void 0 : defaultButton.click();
|
|
439
|
+
}
|
|
440
|
+
break;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Used to stop propagation of proxy element events
|
|
445
|
+
* @param e - Event object
|
|
446
|
+
*/
|
|
447
|
+
stopPropagation(e) {
|
|
448
|
+
e.stopPropagation();
|
|
449
|
+
}
|
|
450
|
+
};
|
|
451
|
+
attr({ mode: "boolean" })(C.prototype, "disabled");
|
|
452
|
+
attr({ mode: "fromView", attribute: "value" })(C.prototype, "initialValue");
|
|
453
|
+
attr({ attribute: "current-value" })(C.prototype, "currentValue");
|
|
454
|
+
attr(C.prototype, "name");
|
|
455
|
+
attr({ mode: "boolean" })(C.prototype, "required");
|
|
456
|
+
observable(C.prototype, "value");
|
|
457
|
+
return C;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
export { FormAssociated as F };
|
package/shared/icon.js
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as classofRaw, g as global$8, w as wellKnownSymbol$6, a as getBuiltIn$5, o as objectDefineProperty, d as descriptors, b as objectIsPrototypeOf, f as functionUncurryThis, e as fails$4, i as isCallable$6, h as inspectSource$2, t as tryToString$3, j as anObject$5, k as functionBindNative, l as aCallable$6, m as engineUserAgent, n as documentCreateElement, p as hasOwnProperty_1, q as objectGetOwnPropertyDescriptor, r as isForced_1, s as engineV8Version, _ as _export, u as defineBuiltIn$3, v as functionCall, x as isObject$2, y as internalState, z as getMethod$2, A as lengthOfArrayLike$1, B as requireObjectCoercible$1, C as functionName } from './export.js';
|
|
2
|
+
import { h as html$1, o as objectSetPrototypeOf, s as setToStringTag$1, i as iterators } from './iterators.js';
|
|
3
|
+
import { c as classof$3, t as toString$1 } from './to-string.js';
|
|
2
4
|
import { F as FoundationElement, _ as __decorate, a as attr, b as __metadata, o as observable } from './index.js';
|
|
3
5
|
import { _ as _curry1, a as _curry2, b as _has } from './_has.js';
|
|
4
6
|
|
|
5
|
-
var classof$
|
|
7
|
+
var classof$2 = classofRaw;
|
|
6
8
|
var global$7 = global$8;
|
|
7
9
|
|
|
8
|
-
var engineIsNode = classof$
|
|
10
|
+
var engineIsNode = classof$2(global$7.process) == 'process';
|
|
9
11
|
|
|
10
12
|
var getBuiltIn$4 = getBuiltIn$5;
|
|
11
13
|
var definePropertyModule = objectDefineProperty;
|
|
12
|
-
var wellKnownSymbol$
|
|
14
|
+
var wellKnownSymbol$5 = wellKnownSymbol$6;
|
|
13
15
|
var DESCRIPTORS = descriptors;
|
|
14
16
|
|
|
15
|
-
var SPECIES$2 = wellKnownSymbol$
|
|
17
|
+
var SPECIES$2 = wellKnownSymbol$5('species');
|
|
16
18
|
|
|
17
19
|
var setSpecies$1 = function (CONSTRUCTOR_NAME) {
|
|
18
20
|
var Constructor = getBuiltIn$4(CONSTRUCTOR_NAME);
|
|
@@ -35,49 +37,10 @@ var anInstance$1 = function (it, Prototype) {
|
|
|
35
37
|
throw $TypeError$4('Incorrect invocation');
|
|
36
38
|
};
|
|
37
39
|
|
|
38
|
-
var wellKnownSymbol$6 = wellKnownSymbol$8;
|
|
39
|
-
|
|
40
|
-
var TO_STRING_TAG$1 = wellKnownSymbol$6('toStringTag');
|
|
41
|
-
var test = {};
|
|
42
|
-
|
|
43
|
-
test[TO_STRING_TAG$1] = 'z';
|
|
44
|
-
|
|
45
|
-
var toStringTagSupport = String(test) === '[object z]';
|
|
46
|
-
|
|
47
|
-
var TO_STRING_TAG_SUPPORT = toStringTagSupport;
|
|
48
|
-
var isCallable$6 = isCallable$7;
|
|
49
|
-
var classofRaw = classofRaw$1;
|
|
50
|
-
var wellKnownSymbol$5 = wellKnownSymbol$8;
|
|
51
|
-
|
|
52
|
-
var TO_STRING_TAG = wellKnownSymbol$5('toStringTag');
|
|
53
|
-
var $Object = Object;
|
|
54
|
-
|
|
55
|
-
// ES3 wrong here
|
|
56
|
-
var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
|
|
57
|
-
|
|
58
|
-
// fallback for IE11 Script Access Denied error
|
|
59
|
-
var tryGet = function (it, key) {
|
|
60
|
-
try {
|
|
61
|
-
return it[key];
|
|
62
|
-
} catch (error) { /* empty */ }
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
// getting tag from ES6+ `Object.prototype.toString`
|
|
66
|
-
var classof$3 = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
|
|
67
|
-
var O, tag, result;
|
|
68
|
-
return it === undefined ? 'Undefined' : it === null ? 'Null'
|
|
69
|
-
// @@toStringTag case
|
|
70
|
-
: typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag
|
|
71
|
-
// builtinTag case
|
|
72
|
-
: CORRECT_ARGUMENTS ? classofRaw(O)
|
|
73
|
-
// ES3 arguments fallback
|
|
74
|
-
: (result = classofRaw(O)) == 'Object' && isCallable$6(O.callee) ? 'Arguments' : result;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
40
|
var uncurryThis$3 = functionUncurryThis;
|
|
78
41
|
var fails$3 = fails$4;
|
|
79
|
-
var isCallable$5 = isCallable$
|
|
80
|
-
var classof$
|
|
42
|
+
var isCallable$5 = isCallable$6;
|
|
43
|
+
var classof$1 = classof$3;
|
|
81
44
|
var getBuiltIn$3 = getBuiltIn$5;
|
|
82
45
|
var inspectSource$1 = inspectSource$2;
|
|
83
46
|
|
|
@@ -100,7 +63,7 @@ var isConstructorModern = function isConstructor(argument) {
|
|
|
100
63
|
|
|
101
64
|
var isConstructorLegacy = function isConstructor(argument) {
|
|
102
65
|
if (!isCallable$5(argument)) return false;
|
|
103
|
-
switch (classof$
|
|
66
|
+
switch (classof$1(argument)) {
|
|
104
67
|
case 'AsyncFunction':
|
|
105
68
|
case 'GeneratorFunction':
|
|
106
69
|
case 'AsyncGeneratorFunction': return false;
|
|
@@ -140,7 +103,7 @@ var aConstructor$1 = function (argument) {
|
|
|
140
103
|
|
|
141
104
|
var anObject$4 = anObject$5;
|
|
142
105
|
var aConstructor = aConstructor$1;
|
|
143
|
-
var wellKnownSymbol$4 = wellKnownSymbol$
|
|
106
|
+
var wellKnownSymbol$4 = wellKnownSymbol$6;
|
|
144
107
|
|
|
145
108
|
var SPECIES$1 = wellKnownSymbol$4('species');
|
|
146
109
|
|
|
@@ -195,7 +158,7 @@ var engineIsIos = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent$2);
|
|
|
195
158
|
var global$6 = global$8;
|
|
196
159
|
var apply = functionApply;
|
|
197
160
|
var bind$3 = functionBindContext;
|
|
198
|
-
var isCallable$4 = isCallable$
|
|
161
|
+
var isCallable$4 = isCallable$6;
|
|
199
162
|
var hasOwn = hasOwnProperty_1;
|
|
200
163
|
var fails$2 = fails$4;
|
|
201
164
|
var html = html$1;
|
|
@@ -453,10 +416,10 @@ var engineIsBrowser = typeof window == 'object' && typeof Deno != 'object';
|
|
|
453
416
|
|
|
454
417
|
var global$1 = global$8;
|
|
455
418
|
var NativePromiseConstructor$4 = promiseNativeConstructor;
|
|
456
|
-
var isCallable$3 = isCallable$
|
|
419
|
+
var isCallable$3 = isCallable$6;
|
|
457
420
|
var isForced = isForced_1;
|
|
458
421
|
var inspectSource = inspectSource$2;
|
|
459
|
-
var wellKnownSymbol$3 = wellKnownSymbol$
|
|
422
|
+
var wellKnownSymbol$3 = wellKnownSymbol$6;
|
|
460
423
|
var IS_BROWSER = engineIsBrowser;
|
|
461
424
|
var V8_VERSION = engineV8Version;
|
|
462
425
|
|
|
@@ -525,7 +488,7 @@ var setPrototypeOf = objectSetPrototypeOf;
|
|
|
525
488
|
var setToStringTag = setToStringTag$1;
|
|
526
489
|
var setSpecies = setSpecies$1;
|
|
527
490
|
var aCallable$3 = aCallable$6;
|
|
528
|
-
var isCallable$2 = isCallable$
|
|
491
|
+
var isCallable$2 = isCallable$6;
|
|
529
492
|
var isObject$1 = isObject$2;
|
|
530
493
|
var anInstance = anInstance$1;
|
|
531
494
|
var speciesConstructor$1 = speciesConstructor$2;
|
|
@@ -803,7 +766,7 @@ $$7({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTR
|
|
|
803
766
|
setToStringTag(PromiseConstructor, PROMISE, false);
|
|
804
767
|
setSpecies(PROMISE);
|
|
805
768
|
|
|
806
|
-
var wellKnownSymbol$2 = wellKnownSymbol$
|
|
769
|
+
var wellKnownSymbol$2 = wellKnownSymbol$6;
|
|
807
770
|
var Iterators$1 = iterators;
|
|
808
771
|
|
|
809
772
|
var ITERATOR$2 = wellKnownSymbol$2('iterator');
|
|
@@ -814,17 +777,17 @@ var isArrayIteratorMethod$1 = function (it) {
|
|
|
814
777
|
return it !== undefined && (Iterators$1.Array === it || ArrayPrototype[ITERATOR$2] === it);
|
|
815
778
|
};
|
|
816
779
|
|
|
817
|
-
var classof
|
|
780
|
+
var classof = classof$3;
|
|
818
781
|
var getMethod$1 = getMethod$2;
|
|
819
782
|
var Iterators = iterators;
|
|
820
|
-
var wellKnownSymbol$1 = wellKnownSymbol$
|
|
783
|
+
var wellKnownSymbol$1 = wellKnownSymbol$6;
|
|
821
784
|
|
|
822
785
|
var ITERATOR$1 = wellKnownSymbol$1('iterator');
|
|
823
786
|
|
|
824
787
|
var getIteratorMethod$2 = function (it) {
|
|
825
788
|
if (it != undefined) return getMethod$1(it, ITERATOR$1)
|
|
826
789
|
|| getMethod$1(it, '@@iterator')
|
|
827
|
-
|| Iterators[classof
|
|
790
|
+
|| Iterators[classof(it)];
|
|
828
791
|
};
|
|
829
792
|
|
|
830
793
|
var call$5 = functionCall;
|
|
@@ -931,7 +894,7 @@ var iterate$2 = function (iterable, unboundFunction, options) {
|
|
|
931
894
|
} return new Result(false);
|
|
932
895
|
};
|
|
933
896
|
|
|
934
|
-
var wellKnownSymbol = wellKnownSymbol$
|
|
897
|
+
var wellKnownSymbol = wellKnownSymbol$6;
|
|
935
898
|
|
|
936
899
|
var ITERATOR = wellKnownSymbol('iterator');
|
|
937
900
|
var SAFE_CLOSING = false;
|
|
@@ -1021,7 +984,7 @@ var $$5 = _export;
|
|
|
1021
984
|
var FORCED_PROMISE_CONSTRUCTOR$2 = promiseConstructorDetection.CONSTRUCTOR;
|
|
1022
985
|
var NativePromiseConstructor$1 = promiseNativeConstructor;
|
|
1023
986
|
var getBuiltIn$2 = getBuiltIn$5;
|
|
1024
|
-
var isCallable$1 = isCallable$
|
|
987
|
+
var isCallable$1 = isCallable$6;
|
|
1025
988
|
var defineBuiltIn$1 = defineBuiltIn$3;
|
|
1026
989
|
|
|
1027
990
|
var NativePromisePrototype$1 = NativePromiseConstructor$1 && NativePromiseConstructor$1.prototype;
|
|
@@ -1111,15 +1074,6 @@ $$2({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
|
|
|
1111
1074
|
}
|
|
1112
1075
|
});
|
|
1113
1076
|
|
|
1114
|
-
var classof = classof$3;
|
|
1115
|
-
|
|
1116
|
-
var $String = String;
|
|
1117
|
-
|
|
1118
|
-
var toString$1 = function (argument) {
|
|
1119
|
-
if (classof(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
|
|
1120
|
-
return $String(argument);
|
|
1121
|
-
};
|
|
1122
|
-
|
|
1123
1077
|
// a string of all valid unicode whitespaces
|
|
1124
1078
|
var whitespaces$2 = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
|
|
1125
1079
|
'\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
|
|
@@ -1188,7 +1142,7 @@ var $ = _export;
|
|
|
1188
1142
|
var NativePromiseConstructor = promiseNativeConstructor;
|
|
1189
1143
|
var fails = fails$4;
|
|
1190
1144
|
var getBuiltIn = getBuiltIn$5;
|
|
1191
|
-
var isCallable = isCallable$
|
|
1145
|
+
var isCallable = isCallable$6;
|
|
1192
1146
|
var speciesConstructor = speciesConstructor$2;
|
|
1193
1147
|
var promiseResolve = promiseResolve$2;
|
|
1194
1148
|
var defineBuiltIn = defineBuiltIn$3;
|
|
@@ -1432,4 +1386,4 @@ __decorate([observable, __metadata("design:type", String)], Icon.prototype, "svg
|
|
|
1432
1386
|
|
|
1433
1387
|
__decorate([attr, __metadata("design:type", String)], Icon.prototype, "type", void 0);
|
|
1434
1388
|
|
|
1435
|
-
export { Icon as I, functionApply as f, speciesConstructor$2 as s
|
|
1389
|
+
export { Icon as I, functionApply as f, speciesConstructor$2 as s };
|