@vonage/vivid 5.3.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/accordion-item/definition.js +1 -1
- package/alert/definition.cjs +1 -1
- package/alert/definition.js +2 -2
- package/badge/definition.js +1 -1
- package/banner/definition.js +1 -1
- package/bundled/base-color-picker.cjs +18 -13
- package/bundled/base-color-picker.js +98 -81
- package/bundled/calendar-picker.template.cjs +7 -7
- package/bundled/calendar-picker.template.js +102 -102
- 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 +87 -66
- 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 +26 -27
- package/bundled/definition19.js +171 -180
- 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/definition6.cjs +3 -3
- package/bundled/definition6.js +19 -19
- package/bundled/definition9.cjs +5 -5
- package/bundled/definition9.js +394 -392
- package/bundled/listbox.cjs +1 -1
- package/bundled/listbox.js +82 -102
- package/bundled/localized.cjs +1 -1
- package/bundled/localized.js +48 -31
- 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 +5 -1
- package/bundled/vivid-element.js +401 -358
- package/calendar/index.cjs +13 -13
- package/calendar/index.js +171 -143
- package/card/definition.cjs +1 -1
- package/card/definition.js +1 -1
- package/color-picker/definition.cjs +209 -113
- package/color-picker/definition.js +209 -113
- package/color-picker/index.cjs +104 -75
- package/color-picker/index.js +412 -326
- package/combobox/definition.cjs +7 -27
- package/combobox/definition.js +8 -28
- package/combobox/index.cjs +6 -6
- package/combobox/index.js +57 -71
- package/contextual-help/index.cjs +1 -1
- package/contextual-help/index.js +1 -1
- package/custom-elements.json +354 -2
- package/data-grid/index.cjs +1 -1
- package/data-grid/index.js +1 -1
- package/date-picker/definition.cjs +1 -1
- package/date-picker/definition.js +1 -1
- package/date-picker/index.cjs +1 -1
- package/date-picker/index.js +2 -2
- package/date-range-picker/definition.cjs +1 -1
- package/date-range-picker/definition.js +1 -1
- package/date-range-picker/index.cjs +1 -1
- package/date-range-picker/index.js +2 -2
- package/date-time-picker/definition.cjs +1 -1
- package/date-time-picker/definition.js +1 -1
- 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/dialog/definition.cjs +2 -2
- package/dialog/definition.js +2 -2
- package/dialog/index.cjs +7 -7
- package/dialog/index.js +6 -6
- package/divider/index.cjs +1 -1
- package/divider/index.js +1 -1
- package/elevation/definition.cjs +1 -1
- package/elevation/definition.js +1 -1
- package/fab/definition.js +1 -1
- package/header/definition.cjs +1 -1
- package/header/definition.js +1 -1
- package/icon/definition.cjs +56 -22
- package/icon/definition.js +56 -22
- package/index.cjs +3 -4
- package/index.js +2 -3
- package/lib/accordion/accordion.d.ts +1 -1
- package/lib/accordion/definition.d.ts +1 -1
- package/lib/audio-player/audio-player.d.ts +1 -1
- package/lib/color-picker/color-picker.d.ts +390 -12
- package/lib/color-picker/locale.d.ts +4 -0
- package/lib/combobox/combobox.d.ts +1 -0
- package/lib/combobox/combobox.options.d.ts +1 -1
- 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/divider/divider.d.ts +1 -1
- package/lib/icon/icon.d.ts +1 -0
- package/lib/menu-item/menu-item-role.d.ts +1 -1
- package/lib/popup/popup.d.ts +1 -1
- package/lib/searchable-select/locale.d.ts +4 -0
- package/lib/searchable-select/searchable-select.d.ts +3 -0
- package/lib/select/select.d.ts +3 -1
- package/lib/simple-color-picker/simple-color-picker.d.ts +2 -1
- package/lib/slider/slider.d.ts +1 -1
- package/lib/tabs/tabs.d.ts +2 -2
- package/lib/text-area/text-area.d.ts +1 -1
- package/lib/text-field/text-field.d.ts +1 -1
- package/lib/time-picker/time-picker.d.ts +20 -20
- package/locales/de-DE.cjs +20 -3
- package/locales/de-DE.js +20 -3
- package/locales/en-GB.cjs +21 -4
- package/locales/en-GB.js +21 -4
- package/locales/en-US.cjs +21 -4
- package/locales/en-US.js +21 -4
- package/locales/ja-JP.cjs +20 -3
- package/locales/ja-JP.js +20 -3
- package/locales/zh-CN.cjs +19 -2
- package/locales/zh-CN.js +19 -2
- package/menu/definition.cjs +4 -4
- package/menu/definition.js +4 -4
- package/nav-disclosure/definition.js +1 -1
- package/nav-item/definition.js +1 -1
- package/note/definition.js +1 -1
- package/number-field/definition.js +1 -1
- package/number-field/index.cjs +1 -1
- package/number-field/index.js +3 -3
- package/option/definition.cjs +6 -77
- package/option/definition.js +3 -78
- package/option/index.cjs +1 -1
- package/option/index.js +1 -1
- package/package.json +31 -5
- package/popup/definition.cjs +2 -2
- package/popup/definition.js +2 -2
- 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/range-slider/definition.cjs +1 -1
- package/range-slider/definition.js +1 -1
- package/rich-text-editor/definition.cjs +2 -3
- package/rich-text-editor/definition.js +1 -2
- package/rich-text-editor/index.cjs +27 -27
- package/rich-text-editor/index.js +1209 -1199
- package/searchable-select/definition.cjs +103 -11
- package/searchable-select/definition.js +103 -11
- package/searchable-select/index.cjs +81 -69
- package/searchable-select/index.js +359 -273
- package/select/definition.cjs +30 -44
- package/select/definition.js +30 -44
- package/selectable-box/definition.cjs +1 -1
- package/selectable-box/definition.js +1 -1
- package/selectable-box/index.cjs +1 -1
- package/selectable-box/index.js +2 -2
- package/shared/aria/aria-mixin.d.ts +1 -1
- package/shared/color-picker/base-color-picker.d.ts +2 -1
- package/shared/foundation/listbox/listbox.d.ts +4 -0
- 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 +9 -7
- package/simple-color-picker/definition.js +9 -7
- package/simple-color-picker/index.cjs +6 -6
- package/simple-color-picker/index.js +41 -39
- package/slider/definition.cjs +1 -1
- package/slider/definition.js +1 -1
- package/split-button/definition.js +1 -1
- 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/tab/definition.js +1 -1
- package/tag/definition.cjs +34 -14
- package/tag/definition.js +35 -15
- 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/text-field/definition.js +1 -1
- package/time-picker/definition.cjs +1 -1
- package/time-picker/definition.js +1 -1
- package/time-picker/index.cjs +1 -1
- package/time-picker/index.js +1 -1
- package/toggletip/definition.cjs +1 -1
- package/toggletip/definition.js +1 -1
- package/toggletip/index.cjs +1 -1
- package/toggletip/index.js +1 -1
- package/tooltip/definition.cjs +3 -3
- package/tooltip/definition.js +3 -3
- package/tooltip/index.cjs +1 -1
- package/tooltip/index.js +1 -1
- package/tree-item/definition.cjs +1 -1
- package/tree-item/definition.js +1 -1
- package/tree-view/definition.cjs +1 -1
- package/tree-view/definition.js +1 -1
- package/unbundled/affix.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 +2 -2
- package/unbundled/calendar-picker.template.js +2 -2
- package/unbundled/definition.js +1 -1
- package/unbundled/definition2.js +1 -1
- package/unbundled/definition3.cjs +222 -141
- package/unbundled/definition3.js +220 -139
- package/unbundled/definition4.cjs +145 -235
- package/unbundled/definition4.js +143 -233
- package/unbundled/definition5.cjs +269 -27
- package/unbundled/definition5.js +267 -26
- package/unbundled/definition6.cjs +56 -0
- package/unbundled/definition6.js +52 -0
- package/unbundled/listbox.cjs +41 -63
- package/unbundled/listbox.js +39 -61
- package/unbundled/picker-field.template.cjs +3 -36
- package/unbundled/picker-field.template.js +3 -35
- package/unbundled/slider.template.cjs +1 -1
- package/unbundled/slider.template.js +1 -1
- 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/video-player/definition.cjs +56 -16
- package/video-player/definition.js +56 -16
- package/video-player/index.cjs +36 -36
- package/video-player/index.js +2461 -2445
- package/visually-hidden/index.cjs +1 -1
- package/visually-hidden/index.js +1 -1
- package/vivid.api.json +285 -38
- package/bundled/_has.cjs +0 -1
- package/bundled/_has.js +0 -34
- package/bundled/option.cjs +0 -1
- package/bundled/option.js +0 -158
- package/unbundled/option.cjs +0 -217
- package/unbundled/option.js +0 -214
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const P=require("../bundled/definition9.cjs"),D=require("../bundled/definition3.cjs"),k=require("../bundled/definition10.cjs"),v=require("../bundled/
|
|
1
|
+
"use strict";const P=require("../bundled/definition9.cjs"),D=require("../bundled/definition3.cjs"),k=require("../bundled/definition10.cjs"),v=require("../bundled/definition15.cjs"),p=require("../bundled/picker-field.template.cjs"),i=require("../bundled/calendar-picker.template.cjs"),s=require("../bundled/vivid-element.cjs"),r=require("../bundled/time-selection-picker.template.cjs"),f=require("../bundled/definition14.cjs"),x=require("../bundled/single-value-picker.cjs"),V=require("../bundled/single-date-picker.cjs"),S=".date-time-picker{display:flex;gap:28px;padding-inline-start:12px}.time-picker{padding-block:4px 12px}",c=e=>e.split("T")[0]||"",u=e=>e.split("T")[1]||"",T=e=>{const[t="",n=""]=e.split("T");return i.isValidDateStr(t)&&r.isValidTimeStr(n)},g=(e,t,n,d)=>{const[a,l]=e.split("T");return`${i.formatPresentationDate(a,t)} ${r.formatPresentationTime(l,n,d)}`},M=(e,t,n)=>{const[d,...a]=e.split(" "),l=i.parsePresentationDate(d,t),h=r.parsePresentationTime(a.join(" "),n);return`${l}T${h}`};var y=Object.defineProperty,m=(e,t,n,d)=>{for(var a=void 0,l=e.length-1,h;l>=0;l--)(h=e[l])&&(a=h(t,n,a)||a);return a&&y(t,n,a),a};const _={fromView:e=>e&&T(e)?e:"",toView(e){return e}};class o extends r.TimeSelectionPicker(V.SingleDatePickerMixin(x.SingleValuePicker(i.CalendarPicker(p.PickerField)))){constructor(){super(),this._isValidValue=T,this._textFieldSize="30",this.proxy.type="datetime-local",this.proxy.step="1",this.min="",this.minDate="",this.minTime="",this.max="",this.maxDate="",this.maxTime=""}get _resolvedMinDate(){return this.minDate||c(this.min)}get _resolvedMaxDate(){return this.maxDate||c(this.max)}get _resolvedMinTime(){return this.minTime||this.min&&c(this.min)===this._dateValue()&&u(this.min)||""}get _resolvedMaxTime(){return this.maxTime||this.max&&c(this.max)===this._dateValue()&&u(this.max)||""}_toPresentationValue(t){return g(t,this.locale.calendarPicker,this._displaySeconds,this._use12hClock)}_parsePresentationValue(t){return M(t,this.locale.calendarPicker,this._use12hClock)}_dateValue(){return c(this.value)}_withUpdatedDate(t){return`${t}T${u(this.value)||"00:00:00"}`}get _timeValue(){return u(this.value)}_withUpdatedTime(t){return`${c(this.value)||i.currentDateStr()}T${t}`}_getCustomValidationError(){return this._isPresentationValueInvalid()?this.locale.dateTimePicker.invalidDateTimeError:this._dateValue()&&this._resolvedMinDate&&i.compareDateStr(this._dateValue(),this._resolvedMinDate)<0?this.locale.dateTimePicker.dateBeforeMinDateError(i.formatPresentationDate(this._resolvedMinDate,this.locale.calendarPicker)):this._dateValue()&&this._resolvedMaxDate&&i.compareDateStr(this._dateValue(),this._resolvedMaxDate)>0?this.locale.dateTimePicker.dateAfterMaxDateError(i.formatPresentationDate(this._resolvedMaxDate,this.locale.calendarPicker)):this._timeValue&&this._resolvedMinTime&&r.compareTimeStr(this._timeValue,this._resolvedMinTime)<0?this.locale.dateTimePicker.timeBeforeMinTimeError(r.formatPresentationTime(this._resolvedMinTime,this._displaySeconds,this._use12hClock)):this._timeValue&&this._resolvedMaxTime&&r.compareTimeStr(this._timeValue,this._resolvedMaxTime)>0?this.locale.dateTimePicker.timeAfterMaxTimeError(r.formatPresentationTime(this._resolvedMaxTime,this._displaySeconds,this._use12hClock)):null}get _textFieldPlaceholder(){return`${this.locale.calendarPicker.dateFormatPlaceholder} ${this._timePlaceholder}`}get _pickerButtonLabel(){return this.value?this.locale.dateTimePicker.changeDateTimeLabel(this._toPresentationValue(this.value)):this.locale.dateTimePicker.chooseDateTimeLabel}_focusableElsWithinDialog(){return this._dialogEl.querySelectorAll("#inline-time-picker, button, .vwc-button")}get _pickerButtonIcon(){return"calendar-clock-line"}get _dialogLabel(){return this.locale.dateTimePicker.chooseDateTimeLabel}}m([s.attr({converter:_})],o.prototype,"min");m([s.attr({converter:r.ValidTimeFilter,attribute:"min-time"})],o.prototype,"minTime");m([s.attr({converter:i.ValidDateFilter,attribute:"min-date"})],o.prototype,"minDate");m([s.attr({converter:_})],o.prototype,"max");m([s.attr({converter:r.ValidTimeFilter,attribute:"max-time"})],o.prototype,"maxTime");m([s.attr({converter:i.ValidDateFilter,attribute:"max-date"})],o.prototype,"maxDate");const $=e=>p.PickerFieldTemplate(e,s.html`
|
|
2
2
|
<div class="date-time-picker">
|
|
3
3
|
${()=>i.CalendarPickerTemplate(e)}
|
|
4
4
|
<div class="time-picker">
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { p as v } from "../bundled/definition9.js";
|
|
2
2
|
import { b as k } from "../bundled/definition3.js";
|
|
3
3
|
import { t as x } from "../bundled/definition10.js";
|
|
4
|
-
import { d as V } from "../bundled/
|
|
4
|
+
import { d as V } from "../bundled/definition15.js";
|
|
5
5
|
import { P as S, a as g, p as M } from "../bundled/picker-field.template.js";
|
|
6
6
|
import { i as y, f as h, p as b, C as F, d as $, b as u, V as _, a as C, c as E } from "../bundled/calendar-picker.template.js";
|
|
7
7
|
import { a as l, h as w, c as L, d as B } from "../bundled/vivid-element.js";
|
|
8
8
|
import { i as A, f as p, p as j, T as I, c as T, V as P, a as O, b as U } from "../bundled/time-selection-picker.template.js";
|
|
9
|
-
import { v as q } from "../bundled/
|
|
9
|
+
import { v as q } from "../bundled/definition14.js";
|
|
10
10
|
import { S as z } from "../bundled/single-value-picker.js";
|
|
11
11
|
import { S as H } from "../bundled/single-date-picker.js";
|
|
12
12
|
const R = ".date-time-picker{display:flex;gap:28px;padding-inline-start:12px}.time-picker{padding-block:4px 12px}", o = (e) => e.split("T")[0] || "", d = (e) => e.split("T")[1] || "", f = (e) => {
|
package/dial-pad/definition.cjs
CHANGED
|
@@ -37,6 +37,21 @@ class DialPad extends localized.Localized(vividElement.VividElement) {
|
|
|
37
37
|
this.endCallButtonLabel = null;
|
|
38
38
|
this.callButtonLabel = null;
|
|
39
39
|
this.deleteAriaLabel = null;
|
|
40
|
+
/**
|
|
41
|
+
* Long-press handling for digit '0' to insert '+'
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
44
|
+
this._longPressTimeoutId = null;
|
|
45
|
+
/**
|
|
46
|
+
* Suppresses the next click handler after a long press has already handled input
|
|
47
|
+
* @internal
|
|
48
|
+
*/
|
|
49
|
+
this._suppressNextClick = false;
|
|
50
|
+
/**
|
|
51
|
+
* Tracks if long press completed for keyboard events
|
|
52
|
+
* @internal
|
|
53
|
+
*/
|
|
54
|
+
this._keyboardLongPressCompleted = false;
|
|
40
55
|
/**
|
|
41
56
|
*
|
|
42
57
|
* @internal
|
|
@@ -65,6 +80,70 @@ class DialPad extends localized.Localized(vividElement.VividElement) {
|
|
|
65
80
|
this._textFieldEl.reportValidity();
|
|
66
81
|
}
|
|
67
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* @internal
|
|
85
|
+
*/
|
|
86
|
+
_startLongPress(digit, event) {
|
|
87
|
+
if (this.disabled || this.callActive || digit !== "0") return;
|
|
88
|
+
this._clearLongPressTimer();
|
|
89
|
+
const target = event.currentTarget;
|
|
90
|
+
this._longPressTimeoutId = window.setTimeout(() => {
|
|
91
|
+
this._suppressNextClick = true;
|
|
92
|
+
this.value += "+";
|
|
93
|
+
this.$emit("keypad-click", target);
|
|
94
|
+
this.$emit("input");
|
|
95
|
+
this.$emit("change");
|
|
96
|
+
}, 600);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* @internal
|
|
100
|
+
*/
|
|
101
|
+
_startKeyboardLongPress() {
|
|
102
|
+
if (this.disabled || this.callActive) return;
|
|
103
|
+
if (this._longPressTimeoutId !== null) return;
|
|
104
|
+
this._keyboardLongPressCompleted = false;
|
|
105
|
+
this._longPressTimeoutId = window.setTimeout(() => {
|
|
106
|
+
this._keyboardLongPressCompleted = true;
|
|
107
|
+
this.value += "+";
|
|
108
|
+
this.$emit("input");
|
|
109
|
+
this.$emit("change");
|
|
110
|
+
}, 650);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* @internal
|
|
114
|
+
*/
|
|
115
|
+
_endLongPress() {
|
|
116
|
+
this._clearLongPressTimer();
|
|
117
|
+
window.setTimeout(() => {
|
|
118
|
+
if (this._suppressNextClick) {
|
|
119
|
+
this._suppressNextClick = false;
|
|
120
|
+
}
|
|
121
|
+
}, 0);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* @internal
|
|
125
|
+
* @returns true if long press completed (timer fired), false otherwise
|
|
126
|
+
*/
|
|
127
|
+
_endKeyboardLongPress() {
|
|
128
|
+
const wasLongPress = this._keyboardLongPressCompleted;
|
|
129
|
+
this._clearLongPressTimer();
|
|
130
|
+
window.setTimeout(() => {
|
|
131
|
+
this._keyboardLongPressCompleted = false;
|
|
132
|
+
}, 0);
|
|
133
|
+
return wasLongPress;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* @internal
|
|
137
|
+
*/
|
|
138
|
+
_cancelLongPress() {
|
|
139
|
+
this._clearLongPressTimer();
|
|
140
|
+
}
|
|
141
|
+
_clearLongPressTimer() {
|
|
142
|
+
if (this._longPressTimeoutId !== null) {
|
|
143
|
+
clearTimeout(this._longPressTimeoutId);
|
|
144
|
+
this._longPressTimeoutId = null;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
68
147
|
/**
|
|
69
148
|
* Moves focus into the diapl-pad.
|
|
70
149
|
*
|
|
@@ -179,6 +258,13 @@ const getClasses = ({ noInput }) => fastWebUtilities.classNames("base", ["no-inp
|
|
|
179
258
|
function handleKeyDown(x, e) {
|
|
180
259
|
if (e.key === fastWebUtilities.keyEnter && !x.pending && !x.disabled && !x.callActive && !x.noCall && x.value.length > 0 && e.target instanceof HTMLInputElement) {
|
|
181
260
|
x._onDial();
|
|
261
|
+
} else if (e.key === " " || e.key === "Space") {
|
|
262
|
+
if (e.target instanceof HTMLInputElement) {
|
|
263
|
+
e.preventDefault();
|
|
264
|
+
if (!e.repeat) {
|
|
265
|
+
x._startKeyboardLongPress();
|
|
266
|
+
}
|
|
267
|
+
}
|
|
182
268
|
} else {
|
|
183
269
|
const elementIndex = DIAL_PAD_BUTTONS.findIndex((x2) => x2.value === e.key);
|
|
184
270
|
if (elementIndex > -1) {
|
|
@@ -193,6 +279,42 @@ function handleKeyDown(x, e) {
|
|
|
193
279
|
}
|
|
194
280
|
return true;
|
|
195
281
|
}
|
|
282
|
+
function handleKeyUp(x, e) {
|
|
283
|
+
if (e.key === " " || e.key === "Space") {
|
|
284
|
+
if (e.target instanceof HTMLInputElement) {
|
|
285
|
+
e.preventDefault();
|
|
286
|
+
const wasLongPress = x._endKeyboardLongPress();
|
|
287
|
+
if (!wasLongPress && !x.disabled && !x.callActive) {
|
|
288
|
+
x.value += " ";
|
|
289
|
+
x.$emit("input");
|
|
290
|
+
x.$emit("change");
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
return true;
|
|
295
|
+
}
|
|
296
|
+
function handleButtonKeyDown(digit, { parent: dialPad, event }) {
|
|
297
|
+
if ((event.key === " " || event.key === "Space") && digit.value === "0") {
|
|
298
|
+
event.preventDefault();
|
|
299
|
+
if (!event.repeat) {
|
|
300
|
+
dialPad._startKeyboardLongPress();
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
return true;
|
|
304
|
+
}
|
|
305
|
+
function handleButtonKeyUp(digit, { parent: dialPad, event }) {
|
|
306
|
+
if ((event.key === " " || event.key === "Space") && digit.value === "0") {
|
|
307
|
+
event.preventDefault();
|
|
308
|
+
const wasLongPress = dialPad._endKeyboardLongPress();
|
|
309
|
+
if (!wasLongPress && !dialPad.disabled && !dialPad.callActive) {
|
|
310
|
+
onDigitClick(digit, {
|
|
311
|
+
parent: dialPad,
|
|
312
|
+
event: new MouseEvent("click", { bubbles: true })
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
return true;
|
|
317
|
+
}
|
|
196
318
|
function syncFieldAndPadValues(x) {
|
|
197
319
|
x.value = x._textFieldEl.value;
|
|
198
320
|
}
|
|
@@ -215,6 +337,7 @@ function renderTextField(textFieldTag, buttonTag) {
|
|
|
215
337
|
?disabled="${(x) => x.disabled}" helper-text="${(x) => x.helperText}" pattern="${(x) => x.pattern}"
|
|
216
338
|
aria-label="${(x) => x.locale.dialPad.inputLabel}"
|
|
217
339
|
@keydown="${(x, c) => handleKeyDown(x, c.event)}"
|
|
340
|
+
@keyup="${(x, c) => handleKeyUp(x, c.event)}"
|
|
218
341
|
@input="${syncFieldAndPadValues}"
|
|
219
342
|
@change="${syncFieldAndPadValues}"
|
|
220
343
|
@focus="${stopPropagation}"
|
|
@@ -236,6 +359,10 @@ function renderTextField(textFieldTag, buttonTag) {
|
|
|
236
359
|
</${textFieldTag}>`;
|
|
237
360
|
}
|
|
238
361
|
function onDigitClick(digit, { parent: dialPad, event }) {
|
|
362
|
+
if (dialPad._suppressNextClick) {
|
|
363
|
+
dialPad._suppressNextClick = false;
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
239
366
|
dialPad.value += digit.value;
|
|
240
367
|
dialPad.$emit("keypad-click", event.currentTarget);
|
|
241
368
|
dialPad.$emit("input");
|
|
@@ -258,6 +385,18 @@ function renderDigits(buttonTag, iconTag) {
|
|
|
258
385
|
?autofocus="${(_, c) => c.parent.autofocus && c.parent.noInput && c.index === 0}"
|
|
259
386
|
aria-label="${(x, c) => c.parent.locale.dialPad[x.ariaLabel]}"
|
|
260
387
|
?disabled="${(_, c) => c.parent.disabled}"
|
|
388
|
+
@pointerdown="${(x, c) => c.parent._startLongPress(x.value, c.event)}"
|
|
389
|
+
@pointerup="${(_, c) => c.parent._endLongPress()}"
|
|
390
|
+
@pointercancel="${(_, c) => c.parent._cancelLongPress()}"
|
|
391
|
+
@pointerleave="${(_, c) => c.parent._cancelLongPress()}"
|
|
392
|
+
@keydown="${(x, c) => handleButtonKeyDown(x, {
|
|
393
|
+
parent: c.parent,
|
|
394
|
+
event: c.event
|
|
395
|
+
})}"
|
|
396
|
+
@keyup="${(x, c) => handleButtonKeyUp(x, {
|
|
397
|
+
parent: c.parent,
|
|
398
|
+
event: c.event
|
|
399
|
+
})}"
|
|
261
400
|
@click="${onDigitClick}">
|
|
262
401
|
<${iconTag} slot="icon"
|
|
263
402
|
name="${(x) => x.icon}"
|
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();
|