@vonage/vivid 4.4.0 → 4.5.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/api-extractor.json +25 -0
- package/custom-elements.json +20 -619
- package/index.cjs +18 -18
- package/index.js +3 -3
- package/lib/fab/fab.d.ts +1 -1
- package/lib/icon/icon.d.ts +1 -1
- package/lib/select/select.d.ts +1 -0
- package/lib/tabs/tabs.d.ts +2 -0
- package/lib/video-player/video-player.d.ts +0 -1
- package/listbox/index.cjs +1 -1
- package/listbox/index.js +1 -1
- package/package.json +6 -1
- package/shared/anchored.js +1 -1
- package/shared/calendar-event.js +1 -1
- package/shared/definition.cjs +2 -2
- package/shared/definition.js +2 -2
- package/shared/definition11.cjs +1 -1
- package/shared/definition11.js +1 -1
- package/shared/definition12.cjs +1 -1
- package/shared/definition12.js +1 -1
- package/shared/definition13.js +1 -1
- package/shared/definition15.cjs +7 -8
- package/shared/definition15.js +2 -3
- package/shared/definition16.cjs +10 -6
- package/shared/definition16.js +9 -5
- package/shared/definition17.cjs +2 -2
- package/shared/definition17.js +2 -2
- package/shared/definition18.cjs +3 -4
- package/shared/definition18.js +1 -2
- package/shared/definition19.cjs +3 -4
- package/shared/definition19.js +1 -2
- package/shared/definition20.cjs +2 -4
- package/shared/definition20.js +3 -5
- package/shared/definition21.cjs +6 -5
- package/shared/definition21.js +7 -6
- package/shared/definition23.cjs +1 -1
- package/shared/definition23.js +2 -2
- package/shared/definition24.cjs +2 -2
- package/shared/definition24.js +2 -2
- package/shared/definition25.cjs +6 -7
- package/shared/definition25.js +2 -3
- package/shared/definition26.js +1 -1
- package/shared/definition27.cjs +1 -1
- package/shared/definition27.js +1 -1
- package/shared/definition28.js +1 -1
- package/shared/definition29.cjs +4 -4
- package/shared/definition29.js +4 -4
- package/shared/definition3.cjs +1 -1
- package/shared/definition3.js +2 -2
- package/shared/definition30.cjs +2 -1
- package/shared/definition30.js +2 -1
- package/shared/definition31.cjs +1 -1
- package/shared/definition31.js +2 -2
- package/shared/definition32.cjs +1 -1
- package/shared/definition32.js +1 -1
- package/shared/definition34.cjs +2 -3
- package/shared/definition34.js +2 -3
- package/shared/definition35.cjs +10 -10
- package/shared/definition35.js +5 -5
- package/shared/definition36.cjs +1 -1
- package/shared/definition36.js +1 -1
- package/shared/definition37.js +1 -1
- package/shared/definition38.cjs +1 -1
- package/shared/definition38.js +1 -1
- package/shared/definition4.cjs +5 -3
- package/shared/definition4.js +6 -4
- package/shared/definition41.cjs +1 -1
- package/shared/definition41.js +1 -1
- package/shared/definition42.cjs +5 -6
- package/shared/definition42.js +5 -6
- package/shared/definition43.cjs +18 -11
- package/shared/definition43.js +13 -6
- package/shared/definition44.cjs +1 -1
- package/shared/definition44.js +2 -2
- package/shared/definition45.cjs +3 -2
- package/shared/definition45.js +4 -3
- package/shared/definition46.cjs +2 -4
- package/shared/definition46.js +2 -4
- package/shared/definition47.cjs +2 -3
- package/shared/definition47.js +3 -4
- package/shared/definition48.cjs +1 -1
- package/shared/definition48.js +1 -1
- package/shared/definition5.cjs +4 -5
- package/shared/definition5.js +4 -5
- package/shared/definition50.cjs +1 -1
- package/shared/definition50.js +1 -1
- package/shared/definition51.cjs +56 -10
- package/shared/definition51.js +56 -10
- package/shared/definition52.js +1 -1
- package/shared/definition53.cjs +1 -1
- package/shared/definition53.js +2 -2
- package/shared/definition54.cjs +8 -9
- package/shared/definition54.js +2 -3
- package/shared/definition55.cjs +8 -8
- package/shared/definition55.js +2 -2
- package/shared/definition56.cjs +9 -9
- package/shared/definition56.js +7 -7
- package/shared/definition57.cjs +10 -1
- package/shared/definition57.js +11 -2
- package/shared/definition58.cjs +7 -1
- package/shared/definition58.js +8 -2
- package/shared/definition59.cjs +1 -1
- package/shared/definition59.js +1 -1
- package/shared/definition6.cjs +1 -1
- package/shared/definition6.js +1 -1
- package/shared/definition61.cjs +65845 -2
- package/shared/definition61.js +65845 -2
- package/shared/definition62.js +1 -1
- package/shared/definition63.js +1 -1
- package/shared/definition7.cjs +1 -1
- package/shared/definition7.js +1 -1
- package/shared/definition8.cjs +2 -3
- package/shared/definition8.js +3 -4
- package/shared/definition9.cjs +1 -1
- package/shared/definition9.js +1 -1
- package/shared/dialog/index.d.ts +1 -0
- package/shared/form-elements.cjs +236 -0
- package/shared/form-elements.js +229 -0
- package/shared/icon.js +1 -1
- package/shared/index2.cjs +6 -256
- package/shared/index2.js +6 -249
- package/shared/localized.cjs +26 -2
- package/shared/localized.js +25 -2
- package/shared/playbackRates.cjs +13 -0
- package/shared/playbackRates.js +11 -0
- package/shared/presentationDate.cjs +9 -9
- package/shared/presentationDate.js +9 -9
- package/shared/text-anchor.cjs +1 -1
- package/shared/text-anchor.js +1 -1
- package/shared/text-field.cjs +1 -1
- package/shared/text-field.js +1 -1
- package/shared/utils/playbackRates.d.ts +1 -0
- package/styles/core/all.css +1 -1
- package/styles/core/theme.css +1 -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/tsdoc-metadata.json +11 -0
- package/vivid.api.json +17 -8
- package/appearance-ui/index.cjs +0 -102
- package/appearance-ui/index.js +0 -100
- package/lib/appearance-ui/appearance-ui.d.ts +0 -12
- package/lib/appearance-ui/appearance-ui.template.d.ts +0 -4
- package/lib/appearance-ui/definition.d.ts +0 -3
- package/shared/video-player.cjs +0 -65860
- package/shared/video-player.js +0 -65857
package/shared/index2.cjs
CHANGED
|
@@ -1,261 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const when = require('./when.cjs');
|
|
8
|
-
const locales_enUS = require('../locales/en-US.cjs');
|
|
9
|
-
|
|
10
|
-
const messageStyles = ".sr-only{position:absolute;overflow:hidden;width:1px;height:1px;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap}.message{display:none;contain:inline-size;font:var(--vvd-typography-base-condensed);gap:4px;grid-column:1/-1}.message--visible{display:flex}.message-text{color:var(--vvd-color-canvas-text)}.helper-message .message-text{color:var(--_low-ink-color)}.message-icon{font-size:16px}.success-message .message-icon{color:var(--vvd-color-success-500)}.error-message .message-icon{color:var(--vvd-color-alert-500)}";
|
|
11
|
-
|
|
12
|
-
var __defProp$1 = Object.defineProperty;
|
|
13
|
-
var __decorateClass$1 = (decorators, target, key, kind) => {
|
|
14
|
-
var result = void 0 ;
|
|
15
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
16
|
-
if (decorator = decorators[i])
|
|
17
|
-
result = (decorator(target, key, result) ) || result;
|
|
18
|
-
if (result) __defProp$1(target, key, result);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
class FormElementHelperText {
|
|
22
|
-
}
|
|
23
|
-
__decorateClass$1([
|
|
24
|
-
index.attr({ attribute: "helper-text" })
|
|
25
|
-
], FormElementHelperText.prototype, "helperText");
|
|
26
|
-
__decorateClass$1([
|
|
27
|
-
index.observable
|
|
28
|
-
], FormElementHelperText.prototype, "_helperTextSlottedContent");
|
|
29
|
-
class FormElementSuccessText {
|
|
30
|
-
}
|
|
31
|
-
__decorateClass$1([
|
|
32
|
-
index.attr({ attribute: "success-text" })
|
|
33
|
-
], FormElementSuccessText.prototype, "successText");
|
|
34
|
-
class FormElementCharCount {
|
|
35
|
-
constructor() {
|
|
36
|
-
this.charCount = false;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
__decorateClass$1([
|
|
40
|
-
index.attr({
|
|
41
|
-
attribute: "char-count",
|
|
42
|
-
mode: "boolean"
|
|
43
|
-
})
|
|
44
|
-
], FormElementCharCount.prototype, "charCount");
|
|
45
|
-
function formElements(constructor) {
|
|
46
|
-
let currentPrototype = constructor.prototype;
|
|
47
|
-
while (currentPrototype) {
|
|
48
|
-
const parentPrototype = Object.getPrototypeOf(currentPrototype);
|
|
49
|
-
if (currentPrototype.validate && !parentPrototype.validate) {
|
|
50
|
-
currentPrototype.validate = function(anchor) {
|
|
51
|
-
if (this.proxy instanceof HTMLElement && this.elementInternals) {
|
|
52
|
-
const isValid = this.proxy.validity.valid;
|
|
53
|
-
const controlIsInvalidDueToMinOrMaxLength = this.control && this.control.validity && !this.control.validity.valid && (this.control.validity.tooShort || this.control.validity.tooLong);
|
|
54
|
-
if (isValid && controlIsInvalidDueToMinOrMaxLength) {
|
|
55
|
-
this.setValidity(
|
|
56
|
-
this.control.validity,
|
|
57
|
-
this.control.validationMessage,
|
|
58
|
-
anchor
|
|
59
|
-
);
|
|
60
|
-
} else {
|
|
61
|
-
this.setValidity(
|
|
62
|
-
this.proxy.validity,
|
|
63
|
-
this.proxy.validationMessage,
|
|
64
|
-
anchor
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
break;
|
|
70
|
-
}
|
|
71
|
-
currentPrototype = parentPrototype;
|
|
72
|
-
}
|
|
73
|
-
class Decorated extends constructor {
|
|
74
|
-
constructor(...args) {
|
|
75
|
-
super(...args);
|
|
76
|
-
this.errorValidationMessage = "";
|
|
77
|
-
this.#forceErrorDisplay = false;
|
|
78
|
-
this.#hasBeenTouched = false;
|
|
79
|
-
this.#handleInvalidEvent = () => {
|
|
80
|
-
this.#forceErrorDisplay = true;
|
|
81
|
-
this.validate();
|
|
82
|
-
};
|
|
83
|
-
this.validate = () => {
|
|
84
|
-
super.validate();
|
|
85
|
-
const shouldShowValidationError = this.#forceErrorDisplay || this.#hasBeenTouched && this.dirtyValue;
|
|
86
|
-
this.errorValidationMessage = shouldShowValidationError ? this.validationMessage : "";
|
|
87
|
-
};
|
|
88
|
-
this.addEventListener("blur", () => {
|
|
89
|
-
this.#hasBeenTouched = true;
|
|
90
|
-
this.#forceErrorDisplay = false;
|
|
91
|
-
this.validate();
|
|
92
|
-
});
|
|
93
|
-
this.addEventListener("focus", () => {
|
|
94
|
-
this.#hasBeenTouched = false;
|
|
95
|
-
});
|
|
96
|
-
this.addEventListener("invalid", () => {
|
|
97
|
-
this.proxy.dispatchEvent(new Event("invalid"));
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
#forceErrorDisplay;
|
|
101
|
-
#hasBeenTouched;
|
|
102
|
-
connectedCallback() {
|
|
103
|
-
super.connectedCallback();
|
|
104
|
-
this.proxy.addEventListener("invalid", this.#handleInvalidEvent);
|
|
105
|
-
}
|
|
106
|
-
#handleInvalidEvent;
|
|
107
|
-
disconnectedCallback() {
|
|
108
|
-
super.disconnectedCallback();
|
|
109
|
-
this.proxy.removeEventListener("invalid", this.#handleInvalidEvent);
|
|
110
|
-
}
|
|
111
|
-
formResetCallback() {
|
|
112
|
-
this.#forceErrorDisplay = false;
|
|
113
|
-
super.formResetCallback();
|
|
114
|
-
this.validate();
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
__decorateClass$1([
|
|
118
|
-
index.attr
|
|
119
|
-
], Decorated.prototype, "label");
|
|
120
|
-
__decorateClass$1([
|
|
121
|
-
index.observable
|
|
122
|
-
], Decorated.prototype, "errorValidationMessage");
|
|
123
|
-
return Decorated;
|
|
124
|
-
}
|
|
125
|
-
const feedback = {
|
|
126
|
-
helper: {
|
|
127
|
-
messageProperty: "helperText",
|
|
128
|
-
className: "helper",
|
|
129
|
-
slot: {
|
|
130
|
-
name: "helper-text",
|
|
131
|
-
slottedContentProperty: "_helperTextSlottedContent"
|
|
132
|
-
},
|
|
133
|
-
role: "none"
|
|
134
|
-
},
|
|
135
|
-
error: {
|
|
136
|
-
messageProperty: "errorValidationMessage",
|
|
137
|
-
className: "error",
|
|
138
|
-
iconType: "info-line",
|
|
139
|
-
role: "status"
|
|
140
|
-
},
|
|
141
|
-
success: {
|
|
142
|
-
messageProperty: "successText",
|
|
143
|
-
className: "success",
|
|
144
|
-
iconType: "check-circle-line",
|
|
145
|
-
role: "none"
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
const isFeedbackAvailable = (config, x) => Boolean(
|
|
149
|
-
x[config.messageProperty] || config.slot && x[config.slot.slottedContentProperty]?.length
|
|
150
|
-
);
|
|
151
|
-
function getFeedbackTemplate(context) {
|
|
152
|
-
return index.html`
|
|
153
|
-
<style>
|
|
154
|
-
${messageStyles}
|
|
155
|
-
</style>
|
|
156
|
-
${getFeedbackTypeTemplate(
|
|
157
|
-
context,
|
|
158
|
-
feedback.helper,
|
|
159
|
-
(x) => isFeedbackAvailable(feedback.helper, x) && !isFeedbackAvailable(feedback.error, x) && !isFeedbackAvailable(feedback.success, x)
|
|
160
|
-
)}
|
|
161
|
-
${getFeedbackTypeTemplate(
|
|
162
|
-
context,
|
|
163
|
-
feedback.error,
|
|
164
|
-
(x) => isFeedbackAvailable(feedback.error, x) && !isFeedbackAvailable(feedback.success, x)
|
|
165
|
-
)}
|
|
166
|
-
${getFeedbackTypeTemplate(
|
|
167
|
-
context,
|
|
168
|
-
feedback.success,
|
|
169
|
-
(x) => isFeedbackAvailable(feedback.success, x)
|
|
170
|
-
)}
|
|
171
|
-
`;
|
|
172
|
-
}
|
|
173
|
-
function getFeedbackTypeTemplate(context, config, shouldShow) {
|
|
174
|
-
const iconTag = context.tagFor(icon.Icon);
|
|
175
|
-
const messageTemplate = index.html`${(x) => x[config.messageProperty]}`;
|
|
176
|
-
const innerTemplate = config.slot ? index.html`<slot
|
|
177
|
-
name="${config.slot.name}"
|
|
178
|
-
${slotted.slotted(config.slot.slottedContentProperty)}
|
|
179
|
-
>${messageTemplate}</slot
|
|
180
|
-
>` : messageTemplate;
|
|
181
|
-
return index.html`<div
|
|
182
|
-
class="${(x) => classNames.classNames(
|
|
183
|
-
"message",
|
|
184
|
-
`${config.className}-message`,
|
|
185
|
-
["message--visible", config.role === "status" || shouldShow(x)],
|
|
186
|
-
["sr-only", !shouldShow(x)]
|
|
187
|
-
)}"
|
|
188
|
-
role="${config.role}"
|
|
189
|
-
aria-atomic="false"
|
|
190
|
-
>
|
|
191
|
-
${when.when(
|
|
192
|
-
(x) => shouldShow(x) && config.iconType,
|
|
193
|
-
index.html`<${iconTag} class="message-icon" name="${config.iconType}"></${iconTag}>`
|
|
194
|
-
)}
|
|
195
|
-
<span class="message-text">${innerTemplate}</span>
|
|
196
|
-
</div>`;
|
|
197
|
-
}
|
|
198
|
-
function errorText(constructor) {
|
|
199
|
-
class Decorated extends constructor {
|
|
200
|
-
#blockValidateCalls = false;
|
|
201
|
-
constructor(...args) {
|
|
202
|
-
super(...args);
|
|
203
|
-
this._validate = this.validate;
|
|
204
|
-
this.validate = () => {
|
|
205
|
-
if (!this.#blockValidateCalls) this._validate();
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
|
-
errorTextChanged(_, newErrorText) {
|
|
209
|
-
if (newErrorText) {
|
|
210
|
-
this.#forceCustomError(newErrorText);
|
|
211
|
-
} else {
|
|
212
|
-
this.#clearCustomErrorAndRevalidate();
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
#forceCustomError(errorMessage) {
|
|
216
|
-
this.setValidity({ customError: true }, errorMessage, this.control);
|
|
217
|
-
this.errorValidationMessage = errorMessage;
|
|
218
|
-
this.#blockValidateCalls = true;
|
|
219
|
-
}
|
|
220
|
-
#clearCustomErrorAndRevalidate() {
|
|
221
|
-
this.setValidity({}, "", this.control);
|
|
222
|
-
this.#blockValidateCalls = false;
|
|
223
|
-
this.validate();
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
__decorateClass$1([
|
|
227
|
-
index.attr({ attribute: "error-text" })
|
|
228
|
-
], Decorated.prototype, "errorText");
|
|
229
|
-
return Decorated;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
var __defProp = Object.defineProperty;
|
|
233
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
234
|
-
var result = void 0 ;
|
|
235
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
236
|
-
if (decorator = decorators[i])
|
|
237
|
-
result = (decorator(target, key, result) ) || result;
|
|
238
|
-
if (result) __defProp(target, key, result);
|
|
239
|
-
return result;
|
|
240
|
-
};
|
|
241
|
-
class CurrentLocale {
|
|
242
|
-
constructor() {
|
|
243
|
-
this.locale = locales_enUS;
|
|
3
|
+
function handleEscapeKeyAndStopPropogation(event) {
|
|
4
|
+
if (event.key === "Escape") {
|
|
5
|
+
event.stopPropagation();
|
|
6
|
+
return true;
|
|
244
7
|
}
|
|
8
|
+
return false;
|
|
245
9
|
}
|
|
246
|
-
__decorateClass([
|
|
247
|
-
index.observable
|
|
248
|
-
], CurrentLocale.prototype, "locale");
|
|
249
|
-
const currentLocale = new CurrentLocale();
|
|
250
|
-
const setLocale = (locale) => {
|
|
251
|
-
currentLocale.locale = locale;
|
|
252
|
-
};
|
|
253
10
|
|
|
254
|
-
exports.
|
|
255
|
-
exports.FormElementHelperText = FormElementHelperText;
|
|
256
|
-
exports.FormElementSuccessText = FormElementSuccessText;
|
|
257
|
-
exports.currentLocale = currentLocale;
|
|
258
|
-
exports.errorText = errorText;
|
|
259
|
-
exports.formElements = formElements;
|
|
260
|
-
exports.getFeedbackTemplate = getFeedbackTemplate;
|
|
261
|
-
exports.setLocale = setLocale;
|
|
11
|
+
exports.handleEscapeKeyAndStopPropogation = handleEscapeKeyAndStopPropogation;
|
package/shared/index2.js
CHANGED
|
@@ -1,252 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import { w as when } from './when.js';
|
|
6
|
-
import enUS from '../locales/en-US.js';
|
|
7
|
-
|
|
8
|
-
const messageStyles = ".sr-only{position:absolute;overflow:hidden;width:1px;height:1px;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap}.message{display:none;contain:inline-size;font:var(--vvd-typography-base-condensed);gap:4px;grid-column:1/-1}.message--visible{display:flex}.message-text{color:var(--vvd-color-canvas-text)}.helper-message .message-text{color:var(--_low-ink-color)}.message-icon{font-size:16px}.success-message .message-icon{color:var(--vvd-color-success-500)}.error-message .message-icon{color:var(--vvd-color-alert-500)}";
|
|
9
|
-
|
|
10
|
-
var __defProp$1 = Object.defineProperty;
|
|
11
|
-
var __decorateClass$1 = (decorators, target, key, kind) => {
|
|
12
|
-
var result = void 0 ;
|
|
13
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
14
|
-
if (decorator = decorators[i])
|
|
15
|
-
result = (decorator(target, key, result) ) || result;
|
|
16
|
-
if (result) __defProp$1(target, key, result);
|
|
17
|
-
return result;
|
|
18
|
-
};
|
|
19
|
-
class FormElementHelperText {
|
|
20
|
-
}
|
|
21
|
-
__decorateClass$1([
|
|
22
|
-
attr({ attribute: "helper-text" })
|
|
23
|
-
], FormElementHelperText.prototype, "helperText");
|
|
24
|
-
__decorateClass$1([
|
|
25
|
-
observable
|
|
26
|
-
], FormElementHelperText.prototype, "_helperTextSlottedContent");
|
|
27
|
-
class FormElementSuccessText {
|
|
28
|
-
}
|
|
29
|
-
__decorateClass$1([
|
|
30
|
-
attr({ attribute: "success-text" })
|
|
31
|
-
], FormElementSuccessText.prototype, "successText");
|
|
32
|
-
class FormElementCharCount {
|
|
33
|
-
constructor() {
|
|
34
|
-
this.charCount = false;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
__decorateClass$1([
|
|
38
|
-
attr({
|
|
39
|
-
attribute: "char-count",
|
|
40
|
-
mode: "boolean"
|
|
41
|
-
})
|
|
42
|
-
], FormElementCharCount.prototype, "charCount");
|
|
43
|
-
function formElements(constructor) {
|
|
44
|
-
let currentPrototype = constructor.prototype;
|
|
45
|
-
while (currentPrototype) {
|
|
46
|
-
const parentPrototype = Object.getPrototypeOf(currentPrototype);
|
|
47
|
-
if (currentPrototype.validate && !parentPrototype.validate) {
|
|
48
|
-
currentPrototype.validate = function(anchor) {
|
|
49
|
-
if (this.proxy instanceof HTMLElement && this.elementInternals) {
|
|
50
|
-
const isValid = this.proxy.validity.valid;
|
|
51
|
-
const controlIsInvalidDueToMinOrMaxLength = this.control && this.control.validity && !this.control.validity.valid && (this.control.validity.tooShort || this.control.validity.tooLong);
|
|
52
|
-
if (isValid && controlIsInvalidDueToMinOrMaxLength) {
|
|
53
|
-
this.setValidity(
|
|
54
|
-
this.control.validity,
|
|
55
|
-
this.control.validationMessage,
|
|
56
|
-
anchor
|
|
57
|
-
);
|
|
58
|
-
} else {
|
|
59
|
-
this.setValidity(
|
|
60
|
-
this.proxy.validity,
|
|
61
|
-
this.proxy.validationMessage,
|
|
62
|
-
anchor
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
break;
|
|
68
|
-
}
|
|
69
|
-
currentPrototype = parentPrototype;
|
|
70
|
-
}
|
|
71
|
-
class Decorated extends constructor {
|
|
72
|
-
constructor(...args) {
|
|
73
|
-
super(...args);
|
|
74
|
-
this.errorValidationMessage = "";
|
|
75
|
-
this.#forceErrorDisplay = false;
|
|
76
|
-
this.#hasBeenTouched = false;
|
|
77
|
-
this.#handleInvalidEvent = () => {
|
|
78
|
-
this.#forceErrorDisplay = true;
|
|
79
|
-
this.validate();
|
|
80
|
-
};
|
|
81
|
-
this.validate = () => {
|
|
82
|
-
super.validate();
|
|
83
|
-
const shouldShowValidationError = this.#forceErrorDisplay || this.#hasBeenTouched && this.dirtyValue;
|
|
84
|
-
this.errorValidationMessage = shouldShowValidationError ? this.validationMessage : "";
|
|
85
|
-
};
|
|
86
|
-
this.addEventListener("blur", () => {
|
|
87
|
-
this.#hasBeenTouched = true;
|
|
88
|
-
this.#forceErrorDisplay = false;
|
|
89
|
-
this.validate();
|
|
90
|
-
});
|
|
91
|
-
this.addEventListener("focus", () => {
|
|
92
|
-
this.#hasBeenTouched = false;
|
|
93
|
-
});
|
|
94
|
-
this.addEventListener("invalid", () => {
|
|
95
|
-
this.proxy.dispatchEvent(new Event("invalid"));
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
#forceErrorDisplay;
|
|
99
|
-
#hasBeenTouched;
|
|
100
|
-
connectedCallback() {
|
|
101
|
-
super.connectedCallback();
|
|
102
|
-
this.proxy.addEventListener("invalid", this.#handleInvalidEvent);
|
|
103
|
-
}
|
|
104
|
-
#handleInvalidEvent;
|
|
105
|
-
disconnectedCallback() {
|
|
106
|
-
super.disconnectedCallback();
|
|
107
|
-
this.proxy.removeEventListener("invalid", this.#handleInvalidEvent);
|
|
108
|
-
}
|
|
109
|
-
formResetCallback() {
|
|
110
|
-
this.#forceErrorDisplay = false;
|
|
111
|
-
super.formResetCallback();
|
|
112
|
-
this.validate();
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
__decorateClass$1([
|
|
116
|
-
attr
|
|
117
|
-
], Decorated.prototype, "label");
|
|
118
|
-
__decorateClass$1([
|
|
119
|
-
observable
|
|
120
|
-
], Decorated.prototype, "errorValidationMessage");
|
|
121
|
-
return Decorated;
|
|
122
|
-
}
|
|
123
|
-
const feedback = {
|
|
124
|
-
helper: {
|
|
125
|
-
messageProperty: "helperText",
|
|
126
|
-
className: "helper",
|
|
127
|
-
slot: {
|
|
128
|
-
name: "helper-text",
|
|
129
|
-
slottedContentProperty: "_helperTextSlottedContent"
|
|
130
|
-
},
|
|
131
|
-
role: "none"
|
|
132
|
-
},
|
|
133
|
-
error: {
|
|
134
|
-
messageProperty: "errorValidationMessage",
|
|
135
|
-
className: "error",
|
|
136
|
-
iconType: "info-line",
|
|
137
|
-
role: "status"
|
|
138
|
-
},
|
|
139
|
-
success: {
|
|
140
|
-
messageProperty: "successText",
|
|
141
|
-
className: "success",
|
|
142
|
-
iconType: "check-circle-line",
|
|
143
|
-
role: "none"
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
const isFeedbackAvailable = (config, x) => Boolean(
|
|
147
|
-
x[config.messageProperty] || config.slot && x[config.slot.slottedContentProperty]?.length
|
|
148
|
-
);
|
|
149
|
-
function getFeedbackTemplate(context) {
|
|
150
|
-
return html`
|
|
151
|
-
<style>
|
|
152
|
-
${messageStyles}
|
|
153
|
-
</style>
|
|
154
|
-
${getFeedbackTypeTemplate(
|
|
155
|
-
context,
|
|
156
|
-
feedback.helper,
|
|
157
|
-
(x) => isFeedbackAvailable(feedback.helper, x) && !isFeedbackAvailable(feedback.error, x) && !isFeedbackAvailable(feedback.success, x)
|
|
158
|
-
)}
|
|
159
|
-
${getFeedbackTypeTemplate(
|
|
160
|
-
context,
|
|
161
|
-
feedback.error,
|
|
162
|
-
(x) => isFeedbackAvailable(feedback.error, x) && !isFeedbackAvailable(feedback.success, x)
|
|
163
|
-
)}
|
|
164
|
-
${getFeedbackTypeTemplate(
|
|
165
|
-
context,
|
|
166
|
-
feedback.success,
|
|
167
|
-
(x) => isFeedbackAvailable(feedback.success, x)
|
|
168
|
-
)}
|
|
169
|
-
`;
|
|
170
|
-
}
|
|
171
|
-
function getFeedbackTypeTemplate(context, config, shouldShow) {
|
|
172
|
-
const iconTag = context.tagFor(Icon);
|
|
173
|
-
const messageTemplate = html`${(x) => x[config.messageProperty]}`;
|
|
174
|
-
const innerTemplate = config.slot ? html`<slot
|
|
175
|
-
name="${config.slot.name}"
|
|
176
|
-
${slotted(config.slot.slottedContentProperty)}
|
|
177
|
-
>${messageTemplate}</slot
|
|
178
|
-
>` : messageTemplate;
|
|
179
|
-
return html`<div
|
|
180
|
-
class="${(x) => classNames(
|
|
181
|
-
"message",
|
|
182
|
-
`${config.className}-message`,
|
|
183
|
-
["message--visible", config.role === "status" || shouldShow(x)],
|
|
184
|
-
["sr-only", !shouldShow(x)]
|
|
185
|
-
)}"
|
|
186
|
-
role="${config.role}"
|
|
187
|
-
aria-atomic="false"
|
|
188
|
-
>
|
|
189
|
-
${when(
|
|
190
|
-
(x) => shouldShow(x) && config.iconType,
|
|
191
|
-
html`<${iconTag} class="message-icon" name="${config.iconType}"></${iconTag}>`
|
|
192
|
-
)}
|
|
193
|
-
<span class="message-text">${innerTemplate}</span>
|
|
194
|
-
</div>`;
|
|
195
|
-
}
|
|
196
|
-
function errorText(constructor) {
|
|
197
|
-
class Decorated extends constructor {
|
|
198
|
-
#blockValidateCalls = false;
|
|
199
|
-
constructor(...args) {
|
|
200
|
-
super(...args);
|
|
201
|
-
this._validate = this.validate;
|
|
202
|
-
this.validate = () => {
|
|
203
|
-
if (!this.#blockValidateCalls) this._validate();
|
|
204
|
-
};
|
|
205
|
-
}
|
|
206
|
-
errorTextChanged(_, newErrorText) {
|
|
207
|
-
if (newErrorText) {
|
|
208
|
-
this.#forceCustomError(newErrorText);
|
|
209
|
-
} else {
|
|
210
|
-
this.#clearCustomErrorAndRevalidate();
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
#forceCustomError(errorMessage) {
|
|
214
|
-
this.setValidity({ customError: true }, errorMessage, this.control);
|
|
215
|
-
this.errorValidationMessage = errorMessage;
|
|
216
|
-
this.#blockValidateCalls = true;
|
|
217
|
-
}
|
|
218
|
-
#clearCustomErrorAndRevalidate() {
|
|
219
|
-
this.setValidity({}, "", this.control);
|
|
220
|
-
this.#blockValidateCalls = false;
|
|
221
|
-
this.validate();
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
__decorateClass$1([
|
|
225
|
-
attr({ attribute: "error-text" })
|
|
226
|
-
], Decorated.prototype, "errorText");
|
|
227
|
-
return Decorated;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
var __defProp = Object.defineProperty;
|
|
231
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
232
|
-
var result = void 0 ;
|
|
233
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
234
|
-
if (decorator = decorators[i])
|
|
235
|
-
result = (decorator(target, key, result) ) || result;
|
|
236
|
-
if (result) __defProp(target, key, result);
|
|
237
|
-
return result;
|
|
238
|
-
};
|
|
239
|
-
class CurrentLocale {
|
|
240
|
-
constructor() {
|
|
241
|
-
this.locale = enUS;
|
|
1
|
+
function handleEscapeKeyAndStopPropogation(event) {
|
|
2
|
+
if (event.key === "Escape") {
|
|
3
|
+
event.stopPropagation();
|
|
4
|
+
return true;
|
|
242
5
|
}
|
|
6
|
+
return false;
|
|
243
7
|
}
|
|
244
|
-
__decorateClass([
|
|
245
|
-
observable
|
|
246
|
-
], CurrentLocale.prototype, "locale");
|
|
247
|
-
const currentLocale = new CurrentLocale();
|
|
248
|
-
const setLocale = (locale) => {
|
|
249
|
-
currentLocale.locale = locale;
|
|
250
|
-
};
|
|
251
8
|
|
|
252
|
-
export {
|
|
9
|
+
export { handleEscapeKeyAndStopPropogation as h };
|
package/shared/localized.cjs
CHANGED
|
@@ -1,11 +1,35 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const locales_enUS = require('../locales/en-US.cjs');
|
|
4
|
+
const index = require('./index.cjs');
|
|
5
|
+
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
7
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
8
|
+
var result = void 0 ;
|
|
9
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
10
|
+
if (decorator = decorators[i])
|
|
11
|
+
result = (decorator(target, key, result) ) || result;
|
|
12
|
+
if (result) __defProp(target, key, result);
|
|
13
|
+
return result;
|
|
14
|
+
};
|
|
15
|
+
class CurrentLocale {
|
|
16
|
+
constructor() {
|
|
17
|
+
this.locale = locales_enUS;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
__decorateClass([
|
|
21
|
+
index.observable
|
|
22
|
+
], CurrentLocale.prototype, "locale");
|
|
23
|
+
const currentLocale = new CurrentLocale();
|
|
24
|
+
const setLocale = (locale) => {
|
|
25
|
+
currentLocale.locale = locale;
|
|
26
|
+
};
|
|
4
27
|
|
|
5
28
|
class Localized {
|
|
6
29
|
get locale() {
|
|
7
|
-
return
|
|
30
|
+
return currentLocale.locale;
|
|
8
31
|
}
|
|
9
32
|
}
|
|
10
33
|
|
|
11
34
|
exports.Localized = Localized;
|
|
35
|
+
exports.setLocale = setLocale;
|
package/shared/localized.js
CHANGED
|
@@ -1,4 +1,27 @@
|
|
|
1
|
-
import
|
|
1
|
+
import enUS from '../locales/en-US.js';
|
|
2
|
+
import { o as observable } from './index.js';
|
|
3
|
+
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
6
|
+
var result = void 0 ;
|
|
7
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
8
|
+
if (decorator = decorators[i])
|
|
9
|
+
result = (decorator(target, key, result) ) || result;
|
|
10
|
+
if (result) __defProp(target, key, result);
|
|
11
|
+
return result;
|
|
12
|
+
};
|
|
13
|
+
class CurrentLocale {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.locale = enUS;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
__decorateClass([
|
|
19
|
+
observable
|
|
20
|
+
], CurrentLocale.prototype, "locale");
|
|
21
|
+
const currentLocale = new CurrentLocale();
|
|
22
|
+
const setLocale = (locale) => {
|
|
23
|
+
currentLocale.locale = locale;
|
|
24
|
+
};
|
|
2
25
|
|
|
3
26
|
class Localized {
|
|
4
27
|
get locale() {
|
|
@@ -6,4 +29,4 @@ class Localized {
|
|
|
6
29
|
}
|
|
7
30
|
}
|
|
8
31
|
|
|
9
|
-
export { Localized as L };
|
|
32
|
+
export { Localized as L, setLocale as s };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function getPlaybackRatesArray(playbackRates) {
|
|
4
|
+
if (playbackRates === "") return [];
|
|
5
|
+
const ratesArray = [];
|
|
6
|
+
playbackRates.split(",").forEach((numStr) => {
|
|
7
|
+
const num = Number(numStr);
|
|
8
|
+
if (!isNaN(num)) ratesArray.push(num);
|
|
9
|
+
});
|
|
10
|
+
return ratesArray;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
exports.getPlaybackRatesArray = getPlaybackRatesArray;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
function getPlaybackRatesArray(playbackRates) {
|
|
2
|
+
if (playbackRates === "") return [];
|
|
3
|
+
const ratesArray = [];
|
|
4
|
+
playbackRates.split(",").forEach((numStr) => {
|
|
5
|
+
const num = Number(numStr);
|
|
6
|
+
if (!isNaN(num)) ratesArray.push(num);
|
|
7
|
+
});
|
|
8
|
+
return ratesArray;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { getPlaybackRatesArray as g };
|