@vonage/vivid 5.4.0 → 5.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/bundled/base-color-picker.cjs +18 -13
- package/bundled/base-color-picker.js +98 -81
- package/bundled/calendar-picker.template.cjs +1 -1
- package/bundled/calendar-picker.template.js +2 -2
- package/bundled/char-count.cjs +1 -1
- package/bundled/char-count.js +1 -1
- package/bundled/definition10.cjs +1 -1
- package/bundled/definition10.js +2 -2
- package/bundled/definition11.cjs +12 -19
- package/bundled/definition11.js +73 -204
- package/bundled/definition12.cjs +19 -10
- package/bundled/definition12.js +217 -36
- package/bundled/definition13.cjs +10 -1
- package/bundled/definition13.js +38 -14
- package/bundled/definition14.cjs +1 -5
- package/bundled/definition14.js +15 -24
- package/bundled/definition15.cjs +5 -30
- package/bundled/definition15.js +22 -73
- package/bundled/definition16.cjs +30 -19
- package/bundled/definition16.js +74 -97
- package/bundled/definition17.cjs +19 -13
- package/bundled/definition17.js +83 -117
- package/bundled/definition18.cjs +13 -12
- package/bundled/definition18.js +114 -71
- package/bundled/definition19.cjs +16 -16
- package/bundled/definition19.js +87 -84
- package/bundled/definition2.cjs +9 -9
- package/bundled/definition2.js +84 -129
- package/bundled/definition3.cjs +1 -1
- package/bundled/definition3.js +1 -1
- package/bundled/listbox.cjs +1 -1
- package/bundled/listbox.js +1 -1
- package/bundled/localized.cjs +1 -1
- package/bundled/localized.js +48 -35
- package/bundled/mixins.cjs +1 -1
- package/bundled/mixins.js +1 -1
- package/bundled/picker-field.template.cjs +14 -14
- package/bundled/picker-field.template.js +35 -56
- package/bundled/time-selection-picker.template.cjs +12 -12
- package/bundled/time-selection-picker.template.js +13 -12
- package/bundled/trapped-focus.cjs +1 -0
- package/bundled/trapped-focus.js +26 -0
- package/bundled/vivid-element.cjs +1 -1
- package/bundled/vivid-element.js +1 -1
- package/calendar/index.cjs +13 -13
- package/calendar/index.js +172 -144
- package/color-picker/definition.cjs +208 -112
- package/color-picker/definition.js +208 -112
- package/color-picker/index.cjs +104 -75
- package/color-picker/index.js +412 -326
- package/combobox/index.cjs +1 -1
- package/combobox/index.js +1 -1
- package/contextual-help/index.cjs +1 -1
- package/contextual-help/index.js +1 -1
- package/custom-elements.json +49 -0
- package/data-grid/index.cjs +1 -1
- package/data-grid/index.js +1 -1
- package/date-picker/index.cjs +1 -1
- package/date-picker/index.js +2 -2
- package/date-range-picker/index.cjs +1 -1
- package/date-range-picker/index.js +2 -2
- package/date-time-picker/index.cjs +1 -1
- package/date-time-picker/index.js +2 -2
- package/dial-pad/definition.cjs +139 -0
- package/dial-pad/definition.js +139 -0
- package/dial-pad/index.cjs +27 -20
- package/dial-pad/index.js +177 -100
- package/divider/index.cjs +1 -1
- package/divider/index.js +1 -1
- package/icon/definition.cjs +56 -22
- package/icon/definition.js +56 -22
- package/lib/color-picker/color-picker.d.ts +390 -12
- package/lib/color-picker/locale.d.ts +4 -0
- package/lib/date-picker/date-picker.d.ts +38 -38
- package/lib/date-range-picker/date-range-picker.d.ts +20 -20
- package/lib/date-time-picker/date-time-picker.d.ts +40 -40
- package/lib/dial-pad/dial-pad.d.ts +1 -0
- package/lib/icon/icon.d.ts +1 -0
- package/lib/simple-color-picker/simple-color-picker.d.ts +2 -1
- package/lib/time-picker/time-picker.d.ts +20 -20
- package/locales/de-DE.cjs +16 -3
- package/locales/de-DE.js +16 -3
- package/locales/en-GB.cjs +17 -4
- package/locales/en-GB.js +17 -4
- package/locales/en-US.cjs +17 -4
- package/locales/en-US.js +17 -4
- package/locales/ja-JP.cjs +16 -3
- package/locales/ja-JP.js +16 -3
- package/locales/zh-CN.cjs +15 -2
- package/locales/zh-CN.js +15 -2
- package/number-field/index.cjs +1 -1
- package/number-field/index.js +3 -3
- package/option/index.cjs +1 -1
- package/option/index.js +1 -1
- package/package.json +1 -1
- package/progress-ring/index.cjs +1 -1
- package/progress-ring/index.js +1 -1
- package/radio/index.cjs +1 -1
- package/radio/index.js +1 -1
- package/radio-group/index.cjs +1 -1
- package/radio-group/index.js +1 -1
- package/rich-text-editor/index.cjs +1 -1
- package/rich-text-editor/index.js +3 -3
- package/searchable-select/index.cjs +1 -1
- package/searchable-select/index.js +3 -3
- package/select/definition.cjs +6 -3
- package/select/definition.js +6 -3
- package/selectable-box/index.cjs +1 -1
- package/selectable-box/index.js +1 -1
- package/shared/color-picker/base-color-picker.d.ts +2 -1
- package/shared/picker-field/mixins/calendar-picker.d.ts +10 -10
- package/shared/picker-field/mixins/calendar-picker.template.d.ts +10 -10
- package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +20 -20
- package/shared/picker-field/mixins/single-date-picker.d.ts +28 -28
- package/shared/picker-field/mixins/single-value-picker.d.ts +8 -8
- package/shared/picker-field/mixins/time-selection-picker.d.ts +20 -20
- package/shared/picker-field/mixins/time-selection-picker.template.d.ts +20 -20
- package/simple-color-picker/definition.cjs +8 -6
- package/simple-color-picker/definition.js +8 -6
- package/simple-color-picker/index.cjs +6 -6
- package/simple-color-picker/index.js +41 -39
- 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/tag/definition.cjs +34 -14
- package/tag/definition.js +34 -14
- package/tag/index.cjs +25 -12
- package/tag/index.js +64 -47
- package/tag-group/definition.cjs +1 -2
- package/tag-group/definition.js +1 -2
- package/tag-group/index.cjs +1 -1
- package/tag-group/index.js +11 -12
- package/text-area/index.cjs +1 -1
- package/text-area/index.js +2 -2
- package/time-picker/index.cjs +1 -1
- package/time-picker/index.js +1 -1
- package/toggletip/index.cjs +1 -1
- package/toggletip/index.js +1 -1
- package/tooltip/definition.cjs +2 -2
- package/tooltip/definition.js +2 -2
- package/tooltip/index.cjs +1 -1
- package/tooltip/index.js +1 -1
- package/unbundled/base-color-picker.cjs +36 -18
- package/unbundled/base-color-picker.js +36 -18
- package/unbundled/calendar-picker.template.cjs +1 -1
- package/unbundled/calendar-picker.template.js +1 -1
- package/unbundled/picker-field.template.cjs +2 -35
- package/unbundled/picker-field.template.js +2 -34
- package/unbundled/time-selection-picker.template.cjs +2 -1
- package/unbundled/time-selection-picker.template.js +2 -1
- package/unbundled/trapped-focus.cjs +37 -0
- package/unbundled/trapped-focus.js +34 -0
- package/unbundled/vivid-element.cjs +1 -1
- package/unbundled/vivid-element.js +1 -1
- package/visually-hidden/index.cjs +1 -1
- package/visually-hidden/index.js +1 -1
- package/bundled/_has.cjs +0 -1
- package/bundled/_has.js +0 -34
package/dial-pad/definition.js
CHANGED
|
@@ -33,6 +33,21 @@ class DialPad extends Localized(VividElement) {
|
|
|
33
33
|
this.endCallButtonLabel = null;
|
|
34
34
|
this.callButtonLabel = null;
|
|
35
35
|
this.deleteAriaLabel = null;
|
|
36
|
+
/**
|
|
37
|
+
* Long-press handling for digit '0' to insert '+'
|
|
38
|
+
* @internal
|
|
39
|
+
*/
|
|
40
|
+
this._longPressTimeoutId = null;
|
|
41
|
+
/**
|
|
42
|
+
* Suppresses the next click handler after a long press has already handled input
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
45
|
+
this._suppressNextClick = false;
|
|
46
|
+
/**
|
|
47
|
+
* Tracks if long press completed for keyboard events
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
50
|
+
this._keyboardLongPressCompleted = false;
|
|
36
51
|
/**
|
|
37
52
|
*
|
|
38
53
|
* @internal
|
|
@@ -61,6 +76,70 @@ class DialPad extends Localized(VividElement) {
|
|
|
61
76
|
this._textFieldEl.reportValidity();
|
|
62
77
|
}
|
|
63
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* @internal
|
|
81
|
+
*/
|
|
82
|
+
_startLongPress(digit, event) {
|
|
83
|
+
if (this.disabled || this.callActive || digit !== "0") return;
|
|
84
|
+
this._clearLongPressTimer();
|
|
85
|
+
const target = event.currentTarget;
|
|
86
|
+
this._longPressTimeoutId = window.setTimeout(() => {
|
|
87
|
+
this._suppressNextClick = true;
|
|
88
|
+
this.value += "+";
|
|
89
|
+
this.$emit("keypad-click", target);
|
|
90
|
+
this.$emit("input");
|
|
91
|
+
this.$emit("change");
|
|
92
|
+
}, 600);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* @internal
|
|
96
|
+
*/
|
|
97
|
+
_startKeyboardLongPress() {
|
|
98
|
+
if (this.disabled || this.callActive) return;
|
|
99
|
+
if (this._longPressTimeoutId !== null) return;
|
|
100
|
+
this._keyboardLongPressCompleted = false;
|
|
101
|
+
this._longPressTimeoutId = window.setTimeout(() => {
|
|
102
|
+
this._keyboardLongPressCompleted = true;
|
|
103
|
+
this.value += "+";
|
|
104
|
+
this.$emit("input");
|
|
105
|
+
this.$emit("change");
|
|
106
|
+
}, 650);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* @internal
|
|
110
|
+
*/
|
|
111
|
+
_endLongPress() {
|
|
112
|
+
this._clearLongPressTimer();
|
|
113
|
+
window.setTimeout(() => {
|
|
114
|
+
if (this._suppressNextClick) {
|
|
115
|
+
this._suppressNextClick = false;
|
|
116
|
+
}
|
|
117
|
+
}, 0);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* @internal
|
|
121
|
+
* @returns true if long press completed (timer fired), false otherwise
|
|
122
|
+
*/
|
|
123
|
+
_endKeyboardLongPress() {
|
|
124
|
+
const wasLongPress = this._keyboardLongPressCompleted;
|
|
125
|
+
this._clearLongPressTimer();
|
|
126
|
+
window.setTimeout(() => {
|
|
127
|
+
this._keyboardLongPressCompleted = false;
|
|
128
|
+
}, 0);
|
|
129
|
+
return wasLongPress;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* @internal
|
|
133
|
+
*/
|
|
134
|
+
_cancelLongPress() {
|
|
135
|
+
this._clearLongPressTimer();
|
|
136
|
+
}
|
|
137
|
+
_clearLongPressTimer() {
|
|
138
|
+
if (this._longPressTimeoutId !== null) {
|
|
139
|
+
clearTimeout(this._longPressTimeoutId);
|
|
140
|
+
this._longPressTimeoutId = null;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
64
143
|
/**
|
|
65
144
|
* Moves focus into the diapl-pad.
|
|
66
145
|
*
|
|
@@ -175,6 +254,13 @@ const getClasses = ({ noInput }) => classNames("base", ["no-input", Boolean(noIn
|
|
|
175
254
|
function handleKeyDown(x, e) {
|
|
176
255
|
if (e.key === keyEnter && !x.pending && !x.disabled && !x.callActive && !x.noCall && x.value.length > 0 && e.target instanceof HTMLInputElement) {
|
|
177
256
|
x._onDial();
|
|
257
|
+
} else if (e.key === " " || e.key === "Space") {
|
|
258
|
+
if (e.target instanceof HTMLInputElement) {
|
|
259
|
+
e.preventDefault();
|
|
260
|
+
if (!e.repeat) {
|
|
261
|
+
x._startKeyboardLongPress();
|
|
262
|
+
}
|
|
263
|
+
}
|
|
178
264
|
} else {
|
|
179
265
|
const elementIndex = DIAL_PAD_BUTTONS.findIndex((x2) => x2.value === e.key);
|
|
180
266
|
if (elementIndex > -1) {
|
|
@@ -189,6 +275,42 @@ function handleKeyDown(x, e) {
|
|
|
189
275
|
}
|
|
190
276
|
return true;
|
|
191
277
|
}
|
|
278
|
+
function handleKeyUp(x, e) {
|
|
279
|
+
if (e.key === " " || e.key === "Space") {
|
|
280
|
+
if (e.target instanceof HTMLInputElement) {
|
|
281
|
+
e.preventDefault();
|
|
282
|
+
const wasLongPress = x._endKeyboardLongPress();
|
|
283
|
+
if (!wasLongPress && !x.disabled && !x.callActive) {
|
|
284
|
+
x.value += " ";
|
|
285
|
+
x.$emit("input");
|
|
286
|
+
x.$emit("change");
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
return true;
|
|
291
|
+
}
|
|
292
|
+
function handleButtonKeyDown(digit, { parent: dialPad, event }) {
|
|
293
|
+
if ((event.key === " " || event.key === "Space") && digit.value === "0") {
|
|
294
|
+
event.preventDefault();
|
|
295
|
+
if (!event.repeat) {
|
|
296
|
+
dialPad._startKeyboardLongPress();
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
return true;
|
|
300
|
+
}
|
|
301
|
+
function handleButtonKeyUp(digit, { parent: dialPad, event }) {
|
|
302
|
+
if ((event.key === " " || event.key === "Space") && digit.value === "0") {
|
|
303
|
+
event.preventDefault();
|
|
304
|
+
const wasLongPress = dialPad._endKeyboardLongPress();
|
|
305
|
+
if (!wasLongPress && !dialPad.disabled && !dialPad.callActive) {
|
|
306
|
+
onDigitClick(digit, {
|
|
307
|
+
parent: dialPad,
|
|
308
|
+
event: new MouseEvent("click", { bubbles: true })
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
return true;
|
|
313
|
+
}
|
|
192
314
|
function syncFieldAndPadValues(x) {
|
|
193
315
|
x.value = x._textFieldEl.value;
|
|
194
316
|
}
|
|
@@ -211,6 +333,7 @@ function renderTextField(textFieldTag, buttonTag) {
|
|
|
211
333
|
?disabled="${(x) => x.disabled}" helper-text="${(x) => x.helperText}" pattern="${(x) => x.pattern}"
|
|
212
334
|
aria-label="${(x) => x.locale.dialPad.inputLabel}"
|
|
213
335
|
@keydown="${(x, c) => handleKeyDown(x, c.event)}"
|
|
336
|
+
@keyup="${(x, c) => handleKeyUp(x, c.event)}"
|
|
214
337
|
@input="${syncFieldAndPadValues}"
|
|
215
338
|
@change="${syncFieldAndPadValues}"
|
|
216
339
|
@focus="${stopPropagation}"
|
|
@@ -232,6 +355,10 @@ function renderTextField(textFieldTag, buttonTag) {
|
|
|
232
355
|
</${textFieldTag}>`;
|
|
233
356
|
}
|
|
234
357
|
function onDigitClick(digit, { parent: dialPad, event }) {
|
|
358
|
+
if (dialPad._suppressNextClick) {
|
|
359
|
+
dialPad._suppressNextClick = false;
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
235
362
|
dialPad.value += digit.value;
|
|
236
363
|
dialPad.$emit("keypad-click", event.currentTarget);
|
|
237
364
|
dialPad.$emit("input");
|
|
@@ -254,6 +381,18 @@ function renderDigits(buttonTag, iconTag) {
|
|
|
254
381
|
?autofocus="${(_, c) => c.parent.autofocus && c.parent.noInput && c.index === 0}"
|
|
255
382
|
aria-label="${(x, c) => c.parent.locale.dialPad[x.ariaLabel]}"
|
|
256
383
|
?disabled="${(_, c) => c.parent.disabled}"
|
|
384
|
+
@pointerdown="${(x, c) => c.parent._startLongPress(x.value, c.event)}"
|
|
385
|
+
@pointerup="${(_, c) => c.parent._endLongPress()}"
|
|
386
|
+
@pointercancel="${(_, c) => c.parent._cancelLongPress()}"
|
|
387
|
+
@pointerleave="${(_, c) => c.parent._cancelLongPress()}"
|
|
388
|
+
@keydown="${(x, c) => handleButtonKeyDown(x, {
|
|
389
|
+
parent: c.parent,
|
|
390
|
+
event: c.event
|
|
391
|
+
})}"
|
|
392
|
+
@keyup="${(x, c) => handleButtonKeyUp(x, {
|
|
393
|
+
parent: c.parent,
|
|
394
|
+
event: c.event
|
|
395
|
+
})}"
|
|
257
396
|
@click="${onDigitClick}">
|
|
258
397
|
<${iconTag} slot="icon"
|
|
259
398
|
name="${(x) => x.icon}"
|
package/dial-pad/index.cjs
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
"use strict";const b=require("../bundled/definition3.cjs"),
|
|
1
|
+
"use strict";const b=require("../bundled/definition3.cjs"),h=require("../bundled/definition10.cjs"),o=require("../bundled/vivid-element.cjs"),f=require("../bundled/definition2.cjs"),g=require("../bundled/definition14.cjs"),$=require("../bundled/localized.cjs"),d=require("../bundled/when.cjs"),L=require("../bundled/repeat.cjs"),y=require("../bundled/ref.cjs"),w=require("../bundled/class-names.cjs"),k=require("../bundled/key-codes.cjs"),P=":host{display:inline-block;margin:16px;inline-size:230px}.base{display:grid;box-sizing:border-box;grid-template-rows:80px 1fr auto}.base.no-input{grid-template-rows:1fr auto}.digits{display:grid;gap:16px;grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(4,1fr);inline-size:100%}.phone-field{align-self:flex-start;grid-column:1/-1}.digit-btn{--_appearance-color-text: var(--_connotation-color-firm-all);--_appearance-color-fill: transparent;--_appearance-color-outline: var(--_connotation-color-pale)}@media (hover: hover){.digit-btn:hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm-all);--_appearance-color-fill: transparent;--_appearance-color-outline: var(--_connotation-color-firm-all)}}.digit-btn.hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm-all);--_appearance-color-fill: transparent;--_appearance-color-outline: var(--_connotation-color-firm-all)}.digit-btn:disabled{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: transparent;--_appearance-color-outline: var(--vvd-color-neutral-100)}.digit-btn.disabled{--_appearance-color-text: var(--vvd-color-neutral-300);--_appearance-color-fill: transparent;--_appearance-color-outline: var(--vvd-color-neutral-100)}.digit-btn{--_connotation-color-contrast: var(--vvd-dial-pad-accent-contrast, var(--vvd-color-neutral-800));--_connotation-color-soft: var(--vvd-dial-pad-accent-soft, var(--vvd-color-neutral-100));--_connotation-color-pale: var(--vvd-dial-pad-accent-pale, var(--vvd-color-neutral-300));--_connotation-color-fierce: var(--vvd-dial-pad-accent-fierce, var(--vvd-color-neutral-700));--_connotation-color-firm-all: var(--vvd-dial-pad-accent-firm-all, var(--vvd-color-neutral-600));--_connotation-color-faint: var(--vvd-dial-pad-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-dim: var(--vvd-dial-pad-accent-dim, var(--vvd-color-neutral-200))}.digit-btn{--vvd-button-accent-firm: var(--_appearance-color-text);display:flex;overflow:hidden;flex-direction:column;border-radius:16px;box-shadow:0 0 0 1px var(--_appearance-color-outline);inline-size:100%}.digit-btn:not(.disabled) .digit-btn-num{color:var(--vvd-color-canvas-text)}.digit-btn:focus-within{--focus-stroke-gap-color: transparent;box-shadow:0 0 0 4px color-mix(in srgb,var(--vvd-color-cta-500),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px))}.call-btn{margin-top:32px;grid-column:1/-1}";var A=Object.defineProperty,i=(n,t,e,a)=>{for(var s=void 0,c=n.length-1,u;c>=0;c--)(u=n[c])&&(s=u(t,e,s)||s);return s&&A(t,e,s),s};class l extends $.Localized(o.VividElement){constructor(){super(...arguments),this.helperText=null,this.placeholder=null,this.value="",this.pattern="^[0-9#*]*$",this.disabled=!1,this.pending=!1,this.callActive=!1,this.noCall=!1,this.noInput=!1,this.endCallButtonLabel=null,this.callButtonLabel=null,this.deleteAriaLabel=null,this._longPressTimeoutId=null,this._suppressNextClick=!1,this._keyboardLongPressCompleted=!1,this._onDial=()=>{!this._textFieldEl.checkValidity()?this._announceValidationError(this._textFieldEl.errorValidationMessage??""):this._clearErrorAnnouncement(),this.callActive?this.$emit("end-call"):this.$emit("dial")},this.autofocus=!1,this._errorAnnouncement="",this._forceAnnouncementToggle=!1}valueChanged(t,e){e!=null&&this._textFieldEl&&e!==this._textFieldEl.value&&(this._textFieldEl.value=e,this._textFieldEl.reportValidity())}_startLongPress(t,e){if(this.disabled||this.callActive||t!=="0")return;this._clearLongPressTimer();const a=e.currentTarget;this._longPressTimeoutId=window.setTimeout(()=>{this._suppressNextClick=!0,this.value+="+",this.$emit("keypad-click",a),this.$emit("input"),this.$emit("change")},600)}_startKeyboardLongPress(){this.disabled||this.callActive||this._longPressTimeoutId===null&&(this._keyboardLongPressCompleted=!1,this._longPressTimeoutId=window.setTimeout(()=>{this._keyboardLongPressCompleted=!0,this.value+="+",this.$emit("input"),this.$emit("change")},650))}_endLongPress(){this._clearLongPressTimer(),window.setTimeout(()=>{this._suppressNextClick&&(this._suppressNextClick=!1)},0)}_endKeyboardLongPress(){const t=this._keyboardLongPressCompleted;return this._clearLongPressTimer(),window.setTimeout(()=>{this._keyboardLongPressCompleted=!1},0),t}_cancelLongPress(){this._clearLongPressTimer()}_clearLongPressTimer(){this._longPressTimeoutId!==null&&(clearTimeout(this._longPressTimeoutId),this._longPressTimeoutId=null)}focus(){const t=this.shadowRoot?.querySelectorAll(".digits .digit-btn");(this._textFieldEl||t?.[0])?.focus()}_announceValidationError(t){this._errorAnnouncement="",window.queueMicrotask(()=>{t?(this._forceAnnouncementToggle=!this._forceAnnouncementToggle,this._errorAnnouncement=`${t}${this._forceAnnouncementToggle?"":""}`):this._clearErrorAnnouncement()})}_clearErrorAnnouncement(){this._errorAnnouncement="",this._forceAnnouncementToggle=!1}}i([o.attr({attribute:"helper-text"})],l.prototype,"helperText");i([o.attr],l.prototype,"placeholder");i([o.attr({mode:"fromView"})],l.prototype,"value");i([o.attr({mode:"fromView"})],l.prototype,"pattern");i([o.attr({mode:"boolean"})],l.prototype,"disabled");i([o.attr({mode:"boolean"})],l.prototype,"pending");i([o.attr({attribute:"call-active",mode:"boolean"})],l.prototype,"callActive");i([o.attr({mode:"boolean",attribute:"no-call"})],l.prototype,"noCall");i([o.attr({mode:"boolean",attribute:"no-input"})],l.prototype,"noInput");i([o.attr({attribute:"end-call-button-label"})],l.prototype,"endCallButtonLabel");i([o.attr({attribute:"call-button-label"})],l.prototype,"callButtonLabel");i([o.attr({attribute:"delete-aria-label"})],l.prototype,"deleteAriaLabel");i([o.attr({mode:"boolean"})],l.prototype,"autofocus");i([o.observable],l.prototype,"_errorAnnouncement");class r{constructor(t,e,a,s,c){this.value=t,this.label=e,this.ariaLabel=a,this.icon=s,this.id=c}}const _=[new r("1"," ","digitOneLabel","one-solid","btn1"),new r("2","ABC","digitTwoLabel","two-solid","btn2"),new r("3","DEF","digitThreeLabel","three-solid","btn3"),new r("4","GHI","digitFourLabel","four-solid","btn4"),new r("5","JKL","digitFiveLabel","five-solid","btn5"),new r("6","MNO","digitSixLabel","six-solid","btn6"),new r("7","PQRS","digitSevenLabel","seven-solid","btn7"),new r("8","TUV","digitEightLabel","eight-solid","btn8"),new r("9","WXYZ","digitNineLabel","nine-solid","btn9"),new r("*",null,"digitAsteriskLabel","asterisk-2-solid","btnAsterisk"),new r("0","+","digitZeroLabel","zero-solid","btn0"),new r("#",null,"digitHashtagLabel","hashtag-solid","btnHashtag")],T=({noInput:n})=>w.classNames("base",["no-input",!!n]);function x(n,t){if(t.key===k.keyEnter&&!n.pending&&!n.disabled&&!n.callActive&&!n.noCall&&n.value.length>0&&t.target instanceof HTMLInputElement)n._onDial();else if(t.key===" "||t.key==="Space")t.target instanceof HTMLInputElement&&(t.preventDefault(),t.repeat||n._startKeyboardLongPress());else{const e=_.findIndex(a=>a.value===t.key);if(e>-1){const a=n.shadowRoot.querySelector(".digits").children[e];a&&(a.active=!0,setTimeout(()=>{a.active=!1},200))}}return!0}function C(n,t){return(t.key===" "||t.key==="Space")&&t.target instanceof HTMLInputElement&&(t.preventDefault(),!n._endKeyboardLongPress()&&!n.disabled&&!n.callActive&&(n.value+=" ",n.$emit("input"),n.$emit("change"))),!0}function E(n,{parent:t,event:e}){return(e.key===" "||e.key==="Space")&&n.value==="0"&&(e.preventDefault(),e.repeat||t._startKeyboardLongPress()),!0}function D(n,{parent:t,event:e}){return(e.key===" "||e.key==="Space")&&n.value==="0"&&(e.preventDefault(),!t._endKeyboardLongPress()&&!t.disabled&&!t.callActive&&m(n,{parent:t,event:new MouseEvent("click",{bubbles:!0})})),!0}function p(n){n.value=n._textFieldEl.value}function v(n,{event:t}){t.stopImmediatePropagation()}function F(n){n.value=n.value.slice(0,-1),n.$emit("input"),n.$emit("change"),n.value===""&&n._textFieldEl?.focus()}function I(n,t){return o.html`<${n} ${y.ref("_textFieldEl")} class="phone-field" internal-part type="tel"
|
|
2
2
|
value="${e=>e.value}" placeholder="${e=>e.placeholder}"
|
|
3
3
|
?disabled="${e=>e.disabled}" helper-text="${e=>e.helperText}" pattern="${e=>e.pattern}"
|
|
4
4
|
aria-label="${e=>e.locale.dialPad.inputLabel}"
|
|
5
|
-
@keydown="${(e,
|
|
5
|
+
@keydown="${(e,a)=>x(e,a.event)}"
|
|
6
|
+
@keyup="${(e,a)=>C(e,a.event)}"
|
|
6
7
|
@input="${p}"
|
|
7
8
|
@change="${p}"
|
|
8
9
|
@focus="${v}"
|
|
9
10
|
@blur="${v}"
|
|
10
11
|
?autofocus="${e=>e.autofocus}"
|
|
11
12
|
>
|
|
12
|
-
${d.when(e=>e.value&&e.value.length&&e.value.length>0,
|
|
13
|
+
${d.when(e=>e.value&&e.value.length&&e.value.length>0,o.html`<${t}
|
|
13
14
|
slot="action-items"
|
|
14
15
|
size='super-condensed'
|
|
15
16
|
icon="backspace-line"
|
|
16
17
|
aria-label="${e=>e.deleteAriaLabel||e.locale.dialPad.deleteButtonLabel}"
|
|
17
18
|
appearance='ghost'
|
|
18
19
|
?disabled="${e=>e.disabled||e.callActive}"
|
|
19
|
-
@click="${e=>
|
|
20
|
+
@click="${e=>F(e)}">
|
|
20
21
|
</${t}>`)}
|
|
21
|
-
</${
|
|
22
|
-
${
|
|
23
|
-
<${
|
|
22
|
+
</${n}>`}function m(n,{parent:t,event:e}){if(t._suppressNextClick){t._suppressNextClick=!1;return}t.value+=n.value,t.$emit("keypad-click",e.currentTarget),t.$emit("input"),t.$emit("change")}function B(n,t){return o.html`
|
|
23
|
+
${L.repeat(e=>_,o.html`
|
|
24
|
+
<${n}
|
|
24
25
|
id="${e=>e.id}"
|
|
25
26
|
value="${e=>e.value}"
|
|
26
27
|
stacked
|
|
@@ -29,16 +30,22 @@
|
|
|
29
30
|
label="${e=>e.label===" "?" ":e.label}"
|
|
30
31
|
size='condensed'
|
|
31
32
|
class="digit-btn"
|
|
32
|
-
?autofocus="${(e,
|
|
33
|
-
aria-label="${(e,
|
|
34
|
-
?disabled="${(e,
|
|
35
|
-
@
|
|
33
|
+
?autofocus="${(e,a)=>a.parent.autofocus&&a.parent.noInput&&a.index===0}"
|
|
34
|
+
aria-label="${(e,a)=>a.parent.locale.dialPad[e.ariaLabel]}"
|
|
35
|
+
?disabled="${(e,a)=>a.parent.disabled}"
|
|
36
|
+
@pointerdown="${(e,a)=>a.parent._startLongPress(e.value,a.event)}"
|
|
37
|
+
@pointerup="${(e,a)=>a.parent._endLongPress()}"
|
|
38
|
+
@pointercancel="${(e,a)=>a.parent._cancelLongPress()}"
|
|
39
|
+
@pointerleave="${(e,a)=>a.parent._cancelLongPress()}"
|
|
40
|
+
@keydown="${(e,a)=>E(e,{parent:a.parent,event:a.event})}"
|
|
41
|
+
@keyup="${(e,a)=>D(e,{parent:a.parent,event:a.event})}"
|
|
42
|
+
@click="${m}">
|
|
36
43
|
<${t} slot="icon"
|
|
37
44
|
name="${e=>e.icon}"
|
|
38
45
|
class="digit-btn-num"></${t}>
|
|
39
|
-
</${
|
|
46
|
+
</${n}>
|
|
40
47
|
`,{positioning:!0})}
|
|
41
|
-
`}function
|
|
48
|
+
`}function q(n){return o.html`<${n} class="call-btn"
|
|
42
49
|
size="expanded"
|
|
43
50
|
appearance="filled"
|
|
44
51
|
icon="${t=>t.callActive?"disable-call-line":"call-line"}"
|
|
@@ -47,11 +54,11 @@
|
|
|
47
54
|
?pending="${t=>t.pending}"
|
|
48
55
|
@click="${t=>t._onDial()}"
|
|
49
56
|
label="${t=>t.callActive?t.endCallButtonLabel||t.locale.dialPad.endCallButtonLabel:t.callButtonLabel||t.locale.dialPad.callButtonLabel}">
|
|
50
|
-
</${
|
|
57
|
+
</${n}>`}function K(n){return o.html`<${n} role="alert" aria-atomic="true">
|
|
51
58
|
${t=>`${t.locale.dialPad.errorLabel} ${t._errorAnnouncement}`}
|
|
52
|
-
</${
|
|
53
|
-
${d.when(
|
|
54
|
-
<div class="digits">${
|
|
55
|
-
${d.when(
|
|
56
|
-
${
|
|
57
|
-
</div>`},z=
|
|
59
|
+
</${n}>`}const N=n=>{const t=n.tagFor(b.Button),e=n.tagFor(f.Icon),a=n.tagFor(h.TextField),s=n.tagFor(g.VisuallyHidden);return o.html` <div class="${T}">
|
|
60
|
+
${d.when(c=>!c.noInput,I(a,t))}
|
|
61
|
+
<div class="digits">${B(t,e)}</div>
|
|
62
|
+
${d.when(c=>!c.noCall,q(t))}
|
|
63
|
+
${K(s)}
|
|
64
|
+
</div>`},z=o.defineVividComponent("dial-pad",l,N,[b.buttonDefinition,h.textFieldDefinition,f.iconDefinition,g.visuallyHiddenDefinition],{styles:P}),S=o.createRegisterFunction(z);S();
|