@vonage/vivid 5.4.0 → 5.6.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/LICENSE.md +201 -0
- package/accordion/definition.cjs +5 -0
- package/accordion/definition.js +5 -0
- package/accordion/index.cjs +1 -1
- package/accordion/index.js +14 -3
- package/alert/definition.cjs +4 -12
- package/alert/definition.js +5 -13
- package/alert/index.cjs +11 -11
- package/alert/index.js +33 -37
- package/audio-player/definition.cjs +4 -0
- package/audio-player/definition.js +4 -0
- package/audio-player/index.cjs +1 -1
- package/audio-player/index.js +8 -2
- package/banner/definition.cjs +2 -4
- package/banner/definition.js +2 -4
- package/banner/index.cjs +2 -2
- package/banner/index.js +1 -1
- package/breadcrumb/definition.cjs +1 -0
- package/breadcrumb/definition.js +1 -0
- package/breadcrumb/index.cjs +1 -1
- package/breadcrumb/index.js +1 -0
- package/bundled/affix.js +1 -1
- package/bundled/anchored.cjs +1 -1
- package/bundled/anchored.js +6 -6
- package/bundled/attribute-binding-behaviour.cjs +1 -1
- package/bundled/attribute-binding-behaviour.js +3 -1
- package/bundled/base-color-picker.cjs +18 -13
- package/bundled/base-color-picker.js +107 -84
- package/bundled/base-progress.cjs +1 -1
- package/bundled/base-progress.js +3 -0
- package/bundled/button.cjs +1 -1
- package/bundled/button.js +14 -10
- package/bundled/calendar-picker.template.cjs +1 -1
- package/bundled/calendar-picker.template.js +4 -2
- package/bundled/char-count.cjs +1 -1
- package/bundled/char-count.js +1 -1
- package/bundled/definition10.cjs +7 -7
- package/bundled/definition10.js +29 -19
- package/bundled/definition11.cjs +12 -19
- package/bundled/definition11.js +73 -204
- package/bundled/definition12.cjs +19 -10
- package/bundled/definition12.js +218 -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 +86 -117
- package/bundled/definition18.cjs +13 -12
- package/bundled/definition18.js +125 -71
- package/bundled/definition19.cjs +16 -16
- package/bundled/definition19.js +132 -94
- package/bundled/definition2.cjs +8 -9
- package/bundled/definition2.js +89 -142
- package/bundled/definition22.cjs +1 -1
- package/bundled/definition22.js +1 -0
- package/bundled/definition3.cjs +1 -1
- package/bundled/definition3.js +2 -1
- package/bundled/definition5.cjs +1 -1
- package/bundled/definition5.js +9 -3
- package/bundled/definition6.cjs +1 -1
- package/bundled/definition6.js +1 -0
- package/bundled/definition7.cjs +1 -1
- package/bundled/definition7.js +7 -4
- package/bundled/definition8.cjs +1 -1
- package/bundled/definition8.js +1 -0
- package/bundled/definition9.cjs +6 -6
- package/bundled/definition9.js +545 -488
- package/bundled/delegates-aria.cjs +1 -1
- package/bundled/delegates-aria.js +3 -1
- package/bundled/form-associated.cjs +1 -1
- package/bundled/form-associated.js +11 -3
- package/bundled/host-semantics.js +4 -4
- package/bundled/listbox.cjs +1 -1
- package/bundled/listbox.js +22 -4
- package/bundled/localized.cjs +1 -1
- package/bundled/localized.js +149 -66
- package/bundled/mixins.cjs +4 -4
- package/bundled/mixins.js +11 -8
- package/bundled/picker-field.template.cjs +14 -14
- package/bundled/picker-field.template.js +36 -56
- package/bundled/scrollIntoView.cjs +1 -1
- package/bundled/scrollIntoView.js +4 -1
- package/bundled/text-field.cjs +1 -1
- package/bundled/text-field.js +1 -1
- package/bundled/time-selection-picker.template.cjs +12 -12
- package/bundled/time-selection-picker.template.js +16 -12
- package/bundled/trapped-focus.cjs +1 -0
- package/bundled/trapped-focus.js +26 -0
- package/bundled/vivid-element.cjs +4 -4
- package/bundled/vivid-element.js +529 -492
- package/calendar/definition.cjs +2 -0
- package/calendar/definition.js +2 -0
- package/calendar/index.cjs +13 -13
- package/calendar/index.js +174 -144
- package/checkbox/definition.cjs +1 -0
- package/checkbox/definition.js +1 -0
- package/color-picker/definition.cjs +213 -112
- package/color-picker/definition.js +213 -112
- package/color-picker/index.cjs +104 -75
- package/color-picker/index.js +417 -326
- package/combobox/definition.cjs +17 -6
- package/combobox/definition.js +17 -6
- package/combobox/index.cjs +14 -9
- package/combobox/index.js +54 -42
- package/contextual-help/index.cjs +1 -1
- package/contextual-help/index.js +1 -1
- package/custom-elements.json +6976 -484
- package/data-grid/definition.cjs +105 -7
- package/data-grid/definition.js +105 -7
- package/data-grid/index.cjs +52 -38
- package/data-grid/index.js +313 -242
- package/date-picker/index.cjs +1 -1
- package/date-picker/index.js +2 -2
- package/date-range-picker/definition.cjs +2 -0
- package/date-range-picker/definition.js +2 -0
- package/date-range-picker/index.cjs +1 -1
- package/date-range-picker/index.js +7 -3
- package/date-time-picker/index.cjs +1 -1
- package/date-time-picker/index.js +2 -2
- package/dial-pad/definition.cjs +148 -0
- package/dial-pad/definition.js +148 -0
- package/dial-pad/index.cjs +27 -20
- package/dial-pad/index.js +202 -101
- package/dialog/definition.cjs +1 -0
- package/dialog/definition.js +1 -0
- package/dialog/index.cjs +1 -1
- package/dialog/index.js +1 -0
- package/divider/index.cjs +1 -1
- package/divider/index.js +1 -1
- package/fab/definition.cjs +1 -0
- package/fab/definition.js +1 -0
- package/fab/index.cjs +1 -1
- package/fab/index.js +1 -0
- package/file-picker/definition.cjs +7 -2
- package/file-picker/definition.js +7 -2
- package/file-picker/index.cjs +6 -6
- package/file-picker/index.js +82 -73
- package/icon/definition.cjs +66 -41
- package/icon/definition.js +67 -42
- package/index.cjs +21 -0
- package/index.js +1 -1
- package/lib/color-picker/color-picker.d.ts +390 -12
- package/lib/color-picker/locale.d.ts +4 -0
- package/lib/data-grid/locale.d.ts +5 -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 -1
- package/lib/menu/menu.d.ts +4 -4
- package/lib/rich-text-editor/definition.d.ts +3 -2
- package/lib/rich-text-editor/locale.d.ts +29 -3
- package/lib/rich-text-editor/popover.d.ts +19 -0
- package/lib/rich-text-editor/rich-text-editor.d.ts +16 -45
- package/lib/rich-text-editor/rich-text-editor.template.d.ts +2 -2
- package/lib/rich-text-editor/rte/config.d.ts +18 -0
- package/lib/rich-text-editor/rte/document.d.ts +28 -0
- package/lib/rich-text-editor/rte/exports.d.ts +23 -0
- package/lib/rich-text-editor/rte/feature.d.ts +46 -0
- package/lib/rich-text-editor/rte/features/internal/basic-text-blocks.d.ts +33 -0
- package/lib/rich-text-editor/rte/features/internal/foreign-html.d.ts +11 -0
- package/lib/rich-text-editor/rte/features/internal/history.d.ts +10 -0
- package/lib/rich-text-editor/rte/features/internal/text-style.d.ts +18 -0
- package/lib/rich-text-editor/rte/html-parser.d.ts +24 -0
- package/lib/rich-text-editor/rte/html-serializer.d.ts +30 -0
- package/lib/rich-text-editor/rte/instance.d.ts +57 -0
- package/lib/rich-text-editor/rte/utils/default-textblock.d.ts +2 -0
- package/lib/rich-text-editor/rte/utils/impl.d.ts +1 -0
- package/lib/rich-text-editor/rte/utils/textblock-attrs.d.ts +29 -0
- package/lib/rich-text-editor/rte/utils/textblock-marks.d.ts +10 -0
- package/lib/rich-text-editor/rte/utils/ui.d.ts +109 -0
- package/lib/simple-color-picker/simple-color-picker.d.ts +6 -5
- 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/lib/toggletip/toggletip.d.ts +4 -4
- package/lib/tooltip/tooltip.d.ts +4 -4
- package/locales/de-DE.cjs +58 -7
- package/locales/de-DE.js +58 -7
- package/locales/en-GB.cjs +60 -9
- package/locales/en-GB.js +60 -9
- package/locales/en-US.cjs +60 -9
- package/locales/en-US.js +60 -9
- package/locales/ja-JP.cjs +59 -8
- package/locales/ja-JP.js +59 -8
- package/locales/zh-CN.cjs +58 -7
- package/locales/zh-CN.js +58 -7
- package/menu/definition.cjs +1 -0
- package/menu/definition.js +1 -0
- package/number-field/definition.cjs +5 -3
- package/number-field/definition.js +5 -3
- package/number-field/index.cjs +5 -3
- package/number-field/index.js +34 -32
- package/option/index.cjs +1 -1
- package/option/index.js +1 -1
- package/package.json +76 -62
- package/pagination/definition.cjs +2 -0
- package/pagination/definition.js +2 -0
- package/pagination/index.cjs +1 -1
- package/pagination/index.js +2 -0
- package/progress-ring/index.cjs +1 -1
- package/progress-ring/index.js +1 -1
- package/radio/definition.cjs +4 -0
- package/radio/definition.js +4 -0
- 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 +2 -1
- package/range-slider/definition.js +2 -1
- package/range-slider/index.cjs +1 -1
- package/range-slider/index.js +3 -1
- package/rich-text-editor/definition.cjs +17942 -1074
- package/rich-text-editor/definition.js +17926 -1079
- package/rich-text-editor/index.cjs +29 -130
- package/rich-text-editor/index.js +5565 -2474
- package/searchable-select/definition.cjs +6 -2
- package/searchable-select/definition.js +6 -2
- package/searchable-select/index.cjs +1 -1
- package/searchable-select/index.js +14 -10
- package/select/definition.cjs +22 -4
- package/select/definition.js +22 -4
- 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/patterns/anchored.d.ts +8 -8
- package/shared/patterns/char-count/char-count.d.ts +1 -1
- package/shared/patterns/localized.d.ts +386 -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/shared/utils/promise.d.ts +7 -0
- package/simple-color-picker/definition.cjs +11 -6
- package/simple-color-picker/definition.js +11 -6
- package/simple-color-picker/index.cjs +6 -6
- package/simple-color-picker/index.js +44 -39
- package/slider/definition.cjs +7 -1
- package/slider/definition.js +7 -1
- package/styles/core/all.css +5 -1
- package/styles/core/theme.css +5 -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/switch/definition.cjs +1 -0
- package/switch/definition.js +1 -0
- package/switch/index.cjs +1 -1
- package/switch/index.js +1 -0
- package/tabs/definition.cjs +2 -0
- package/tabs/definition.js +2 -0
- package/tabs/index.cjs +1 -1
- package/tabs/index.js +2 -0
- 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/definition.cjs +13 -7
- package/text-area/definition.js +13 -7
- package/text-area/index.cjs +6 -6
- package/text-area/index.js +20 -14
- package/text-field/definition.cjs +16 -6
- package/text-field/definition.js +16 -6
- package/time-picker/index.cjs +1 -1
- package/time-picker/index.js +1 -1
- package/toggletip/definition.cjs +5 -1
- package/toggletip/definition.js +5 -1
- package/toggletip/index.cjs +1 -1
- package/toggletip/index.js +1 -1
- package/tooltip/definition.cjs +6 -3
- package/tooltip/definition.js +6 -3
- package/tooltip/index.cjs +1 -1
- package/tooltip/index.js +1 -1
- package/tree-view/definition.cjs +28 -6
- package/tree-view/definition.js +28 -6
- package/tree-view/index.cjs +1 -1
- package/tree-view/index.js +28 -6
- package/unbundled/_commonjsHelpers.cjs +0 -26
- package/unbundled/_commonjsHelpers.js +1 -26
- package/unbundled/attribute-binding-behaviour.cjs +1 -0
- package/unbundled/attribute-binding-behaviour.js +1 -0
- package/unbundled/base-color-picker.cjs +45 -21
- package/unbundled/base-color-picker.js +45 -21
- package/unbundled/base-progress.cjs +3 -0
- package/unbundled/base-progress.js +3 -0
- package/unbundled/button.cjs +14 -10
- package/unbundled/button.js +14 -10
- package/unbundled/calendar-picker.template.cjs +3 -1
- package/unbundled/calendar-picker.template.js +3 -1
- package/unbundled/definition.cjs +1 -0
- package/unbundled/definition.js +1 -0
- package/unbundled/definition2.cjs +4 -1
- package/unbundled/definition2.js +4 -1
- package/unbundled/definition3.cjs +1 -0
- package/unbundled/definition3.js +1 -0
- package/unbundled/definition4.cjs +1 -0
- package/unbundled/definition4.js +1 -0
- package/unbundled/definition5.cjs +3 -2
- package/unbundled/definition5.js +4 -3
- package/unbundled/delegates-aria.cjs +1 -0
- package/unbundled/delegates-aria.js +1 -0
- package/unbundled/form-associated.cjs +4 -0
- package/unbundled/form-associated.js +4 -0
- package/unbundled/listbox.cjs +16 -1
- package/unbundled/listbox.js +16 -1
- package/unbundled/localized.cjs +36 -0
- package/unbundled/localized.js +37 -2
- package/unbundled/mixins.cjs +2 -0
- package/unbundled/mixins.js +2 -0
- package/unbundled/picker-field.template.cjs +3 -35
- package/unbundled/picker-field.template.js +3 -34
- package/unbundled/scrollIntoView.cjs +1 -0
- package/unbundled/scrollIntoView.js +1 -0
- package/unbundled/text-field.cjs +1 -1
- package/unbundled/text-field.js +1 -1
- package/unbundled/time-selection-picker.template.cjs +5 -1
- package/unbundled/time-selection-picker.template.js +5 -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 +54 -44
- package/video-player/definition.js +50 -40
- package/video-player/index.cjs +28 -28
- package/video-player/index.js +1448 -1442
- package/visually-hidden/index.cjs +1 -1
- package/visually-hidden/index.js +1 -1
- package/vivid.api.json +6463 -6099
- package/bundled/_has.cjs +0 -1
- package/bundled/_has.js +0 -34
- package/lib/rich-text-editor/facades/prose-mirror-vivid.schema.d.ts +0 -4
- package/lib/rich-text-editor/facades/vivid-prose-mirror.facade.d.ts +0 -18
- package/lib/rich-text-editor/image-placeholder/definition.d.ts +0 -2
- package/lib/rich-text-editor/image-placeholder/image-placeholder.d.ts +0 -7
- package/lib/rich-text-editor/image-placeholder/image-placeholder.template.d.ts +0 -4
- package/lib/rich-text-editor/menubar/consts.d.ts +0 -18
- package/lib/rich-text-editor/menubar/definition.d.ts +0 -2
- package/lib/rich-text-editor/menubar/menubar.d.ts +0 -386
- package/lib/rich-text-editor/menubar/menubar.template.d.ts +0 -4
package/date-picker/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const u=require("../bundled/definition9.cjs"),d=require("../bundled/definition3.cjs"),p=require("../bundled/definition10.cjs"),P=require("../bundled/
|
|
1
|
+
"use strict";const u=require("../bundled/definition9.cjs"),d=require("../bundled/definition3.cjs"),p=require("../bundled/definition10.cjs"),P=require("../bundled/definition15.cjs"),l=require("../bundled/picker-field.template.cjs"),t=require("../bundled/calendar-picker.template.cjs"),o=require("../bundled/vivid-element.cjs"),k=require("../bundled/definition14.cjs"),h=require("../bundled/single-value-picker.cjs"),_=require("../bundled/single-date-picker.cjs");var D=Object.defineProperty,f=Object.getOwnPropertyDescriptor,g=(i,e,a,q)=>{for(var r=f(e,a),n=i.length-1,c;n>=0;n--)(c=i[n])&&(r=c(e,a,r)||r);return r&&D(e,a,r),r};class s extends _.SingleDatePickerMixin(h.SingleValuePicker(t.MinMaxCalendarPicker(t.CalendarPicker(l.PickerField)))){constructor(){super(),this._isValidValue=t.isValidDateStr,this._textFieldSize="20",this.proxy.type="date"}_toPresentationValue(e){return t.formatPresentationDate(e,this.locale.calendarPicker)}_parsePresentationValue(e){return t.parsePresentationDate(e,this.locale.calendarPicker)}_dateValue(){return this.value}_withUpdatedDate(e){return e}get _pickerButtonLabel(){return this.value?this.locale.calendarPicker.changeDateLabel(this._toPresentationValue(this.value)):this.locale.calendarPicker.chooseDateLabel}get _dialogLabel(){return this.locale.calendarPicker.chooseDateLabel}get _textFieldPlaceholder(){return this.locale.calendarPicker.dateFormatPlaceholder}_onDateClick(e){super._onDateClick(e),this._closePopup()}_getCustomValidationError(){return this._isPresentationValueInvalid()?this.locale.calendarPicker.invalidDateError:null}_focusableElsWithinDialog(){return this._dialogEl.querySelectorAll("button, .vwc-button")}get _pickerButtonIcon(){return"calendar-line"}}g([o.volatile],s.prototype,"_pickerButtonLabel");const v=i=>l.PickerFieldTemplate(i,t.CalendarPickerTemplate(i),{withSeparator:!1,padded:!0}),b=o.defineVividComponent("date-picker",s,v,[d.buttonDefinition,u.popupDefinition,p.textFieldDefinition,P.dividerDefinition,k.visuallyHiddenDefinition],{styles:[l.pickerFieldStyles,t.calendarStyles],shadowOptions:{delegatesFocus:!0}}),V=o.createRegisterFunction(b);V();
|
package/date-picker/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { p as n } from "../bundled/definition9.js";
|
|
2
2
|
import { b as s } from "../bundled/definition3.js";
|
|
3
3
|
import { t as c } from "../bundled/definition10.js";
|
|
4
|
-
import { d } from "../bundled/
|
|
4
|
+
import { d } from "../bundled/definition15.js";
|
|
5
5
|
import { P as u, a as p, p as P } from "../bundled/picker-field.template.js";
|
|
6
6
|
import { M as f, C as h, i as m, f as _, p as k, a as D, c as v } from "../bundled/calendar-picker.template.js";
|
|
7
7
|
import { v as g, c as b, d as V } from "../bundled/vivid-element.js";
|
|
8
|
-
import { v as S } from "../bundled/
|
|
8
|
+
import { v as S } from "../bundled/definition14.js";
|
|
9
9
|
import { S as C } from "../bundled/single-value-picker.js";
|
|
10
10
|
import { S as F } from "../bundled/single-date-picker.js";
|
|
11
11
|
var y = Object.defineProperty, w = Object.getOwnPropertyDescriptor, x = (t, e, r, M) => {
|
|
@@ -204,9 +204,11 @@ class DateRangePicker extends calendarPicker_template.MinMaxCalendarPicker(
|
|
|
204
204
|
*/
|
|
205
205
|
connectedCallback() {
|
|
206
206
|
super.connectedCallback();
|
|
207
|
+
/* v8 ignore else -- @preserve */
|
|
207
208
|
if (!this.start) {
|
|
208
209
|
this.start = this.initialStart;
|
|
209
210
|
}
|
|
211
|
+
/* v8 ignore else -- @preserve */
|
|
210
212
|
if (!this.end) {
|
|
211
213
|
this.end = this.initialEnd;
|
|
212
214
|
}
|
|
@@ -200,9 +200,11 @@ class DateRangePicker extends MinMaxCalendarPicker(
|
|
|
200
200
|
*/
|
|
201
201
|
connectedCallback() {
|
|
202
202
|
super.connectedCallback();
|
|
203
|
+
/* v8 ignore else -- @preserve */
|
|
203
204
|
if (!this.start) {
|
|
204
205
|
this.start = this.initialStart;
|
|
205
206
|
}
|
|
207
|
+
/* v8 ignore else -- @preserve */
|
|
206
208
|
if (!this.end) {
|
|
207
209
|
this.end = this.initialEnd;
|
|
208
210
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const m=require("../bundled/definition3.cjs"),_=require("../bundled/definition9.cjs"),D=require("../bundled/definition10.cjs"),P=require("../bundled/
|
|
1
|
+
"use strict";const m=require("../bundled/definition3.cjs"),_=require("../bundled/definition9.cjs"),D=require("../bundled/definition10.cjs"),P=require("../bundled/definition15.cjs"),n=require("../bundled/vivid-element.cjs"),u=require("../bundled/picker-field.template.cjs"),r=require("../bundled/calendar-picker.template.cjs"),g=require("../bundled/definition14.cjs"),c=(i,t)=>`${i} – ${t}`,p=(i,t)=>c(r.formatPresentationDate(i.start,t),r.formatPresentationDate(i.end,t)),f=(i,t)=>{const e=i.trim().split(/[\s—–-]+/);if(e.length!==2)throw new Error(`Invalid date range: ${i}`);const[a,s]=e.map(h=>r.parsePresentationDate(h,t));return{start:a,end:s}};var V=Object.defineProperty,k=Object.getOwnPropertyDescriptor,o=(i,t,e,a)=>{for(var s=a>1?void 0:a?k(t,e):t,h=i.length-1,d;h>=0;h--)(d=i[h])&&(s=(a?d(t,e,s):d(s))||s);return a&&s&&V(t,e,s),s};const v=i=>typeof i=="string";function b(i){return!!i}class l extends r.MinMaxCalendarPicker(r.CalendarPicker(u.PickerField)){constructor(){super(...arguments),this.initialStart="",this.initialEnd="",this.#e=!1,this.start="",this.end="",this.setFormValue=(t,e)=>{v(t)||super.setFormValue(t,e)},this._numCalendars=2,this._hideDatesOutsideMonth=!0,this._textFieldSize="30"}initialStartChanged(){this.dirtyValue||(this.start=this.initialStart,this.dirtyValue=!1)}initialEndChanged(){this.dirtyValue||(this.end=this.initialEnd,this.dirtyValue=!1)}#e;startChanged(){if(this.start&&!r.isValidDateStr(this.start)){this.start="";return}this.currentStart=this.start,this.dirtyValue=!0,this.#e||this.#i()}endChanged(){if(this.end&&!r.isValidDateStr(this.end)){this.end="";return}this.currentEnd=this.end,this.dirtyValue=!0,this.#e||this.#i()}currentStartChanged(){this.start=this.currentStart}currentEndChanged(){this.end=this.currentEnd}#t(t){this.#e=!0,t.start!==void 0&&(this.start=t.start,this.$emit("input:start")),t.end!==void 0&&(this.end=t.end,this.$emit("input:end")),this.#e=!1,this.$emit("input"),this.$emit("change"),this.#i()}#i(){if(this.start&&this.end){if(r.compareDateStr(this.start,this.end)>0){this.#t({start:this.end,end:this.start});return}this.value=c(this.start,this.end)}else this.value="";this._updatePresentationValue();const t=this.start||this.end;t&&this._adjustSelectedMonthToEnsureVisibilityOf(t),this.#a()}_updatePresentationValue(){this.start&&this.end?this._presentationValue=p({start:this.start,end:this.end},this.locale.calendarPicker):this._presentationValue=""}nameChanged(t,e){super.nameChanged(t,e),this.#a()}#a(){if(!this.name||!this.start||!this.end)this.setFormValue(null);else{const t=new FormData;t.append(this.name,this.start),t.append(this.name,this.end),this.setFormValue(t)}}connectedCallback(){super.connectedCallback();/* v8 ignore else -- @preserve */this.start||(this.start=this.initialStart);/* v8 ignore else -- @preserve */this.end||(this.end=this.initialEnd)}#r(){const t=[this.start,this.end].filter(b),e=t.length===1;this._hoverDate&&e&&t.push(this._hoverDate);const[a,s]=t.sort(r.compareDateStr);return{start:a,end:s}}_isDateAriaSelected(t){return this._isDateInSelectedRange(t)}_isDateInSelectedRange(t){const{start:e,end:a}=this.#r();return e&&a?r.compareDateStr(t,e)>=0&&r.compareDateStr(t,a)<=0:!1}_isDateRangeStart(t){return t===this.#r().start}_isDateRangeEnd(t){return t===this.#r().end}_getSelectedDates(){const t=[];return this.start&&t.push(this.start),this.end&&t.push(this.end),t}_onDateClick(t){this.start&&this.end?this.#t({start:t,end:""}):this.start?(this.#t({end:t}),this._closePopup()):this.end?(this.#t({start:t}),this._closePopup()):this.#t({start:t})}get _textFieldPlaceholder(){return c(this.locale.calendarPicker.dateFormatPlaceholder,this.locale.calendarPicker.dateFormatPlaceholder)}_onTextFieldChange(){if(this._presentationValue===""){this.#t({start:"",end:""});return}try{const{start:t,end:e}=f(this._presentationValue,this.locale.calendarPicker);this.#t({start:t,end:e})}catch{const e=this._presentationValue;this.#t({start:"",end:""}),this._presentationValue=e;return}}_onDateMouseEnter(t){this._hoverDate=t}_onDateMouseLeave(){this._hoverDate=void 0}_getCustomValidationError(){return this._isPresentationValueInvalid()?this.locale.calendarPicker.invalidDateRangeError:this.min&&this.start&&r.compareDateStr(this.start,this.min)<0?this.locale.calendarPicker.startDateAfterMinDateError(r.formatPresentationDate(this.min,this.locale.calendarPicker)):this.max&&this.end&&r.compareDateStr(this.end,this.max)>0?this.locale.calendarPicker.endDateBeforeMaxDateError(r.formatPresentationDate(this.max,this.locale.calendarPicker)):null}_isPresentationValueInvalid(){if(this._presentationValue==="")return!1;try{return f(this._presentationValue,this.locale.calendarPicker),!1}catch{return!0}}_onClearClick(){this.#t({start:"",end:""}),super._onClearClick()}formResetCallback(){this.#t({start:this.initialStart,end:this.initialEnd}),super.formResetCallback()}get _pickerButtonLabel(){return this.start&&this.end?this.locale.calendarPicker.changeDatesLabel(p({start:this.start,end:this.end},this.locale.calendarPicker)):this.locale.calendarPicker.chooseDatesLabel}get _dialogLabel(){return this.locale.calendarPicker.chooseDatesLabel}_focusableElsWithinDialog(){return this._dialogEl.querySelectorAll("button, .vwc-button")}get _pickerButtonIcon(){return"calendar-line"}}o([n.attr({mode:"fromView",attribute:"start"})],l.prototype,"initialStart",2);o([n.attr({mode:"fromView",attribute:"end"})],l.prototype,"initialEnd",2);o([n.observable],l.prototype,"start",2);o([n.observable],l.prototype,"end",2);o([n.attr({attribute:"current-start"})],l.prototype,"currentStart",2);o([n.attr({attribute:"current-end"})],l.prototype,"currentEnd",2);o([n.observable],l.prototype,"_numCalendars",2);o([n.observable],l.prototype,"_hoverDate",2);o([n.volatile],l.prototype,"_pickerButtonLabel",1);const S=i=>u.PickerFieldTemplate(i,r.CalendarPickerTemplate(i),{withSeparator:!1,padded:!0}),C=n.defineVividComponent("date-range-picker",l,S,[m.buttonDefinition,_.popupDefinition,D.textFieldDefinition,P.dividerDefinition,g.visuallyHiddenDefinition],{styles:[u.pickerFieldStyles,r.calendarStyles],shadowOptions:{delegatesFocus:!0}}),y=n.createRegisterFunction(C);y();
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { b as D } from "../bundled/definition3.js";
|
|
2
2
|
import { p as P } from "../bundled/definition9.js";
|
|
3
3
|
import { t as g } from "../bundled/definition10.js";
|
|
4
|
-
import { d as V } from "../bundled/
|
|
4
|
+
import { d as V } from "../bundled/definition15.js";
|
|
5
5
|
import { a as d, o as c, v as k, c as v, d as C } from "../bundled/vivid-element.js";
|
|
6
6
|
import { P as b, a as y, p as S } from "../bundled/picker-field.template.js";
|
|
7
7
|
import { f as o, p as E, M as F, C as R, i as f, b as h, a as w, c as x } from "../bundled/calendar-picker.template.js";
|
|
8
|
-
import { v as M } from "../bundled/
|
|
8
|
+
import { v as M } from "../bundled/definition14.js";
|
|
9
9
|
const p = (i, t) => `${i} – ${t}`, m = (i, t) => p(
|
|
10
10
|
o(i.start, t),
|
|
11
11
|
o(i.end, t)
|
|
@@ -126,7 +126,11 @@ class r extends F(
|
|
|
126
126
|
* @internal
|
|
127
127
|
*/
|
|
128
128
|
connectedCallback() {
|
|
129
|
-
super.connectedCallback()
|
|
129
|
+
super.connectedCallback();
|
|
130
|
+
/* v8 ignore else -- @preserve */
|
|
131
|
+
this.start || (this.start = this.initialStart);
|
|
132
|
+
/* v8 ignore else -- @preserve */
|
|
133
|
+
this.end || (this.end = this.initialEnd);
|
|
130
134
|
}
|
|
131
135
|
#a() {
|
|
132
136
|
const t = [this.start, this.end].filter(L), e = t.length === 1;
|
|
@@ -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,10 +258,20 @@ 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
|
+
/* v8 ignore else -- @preserve */
|
|
263
|
+
if (e.target instanceof HTMLInputElement) {
|
|
264
|
+
e.preventDefault();
|
|
265
|
+
/* v8 ignore else -- @preserve */
|
|
266
|
+
if (!e.repeat) {
|
|
267
|
+
x._startKeyboardLongPress();
|
|
268
|
+
}
|
|
269
|
+
}
|
|
182
270
|
} else {
|
|
183
271
|
const elementIndex = DIAL_PAD_BUTTONS.findIndex((x2) => x2.value === e.key);
|
|
184
272
|
if (elementIndex > -1) {
|
|
185
273
|
const digit = x.shadowRoot.querySelector(".digits").children[elementIndex];
|
|
274
|
+
/* v8 ignore else -- @preserve */
|
|
186
275
|
if (digit) {
|
|
187
276
|
digit.active = true;
|
|
188
277
|
setTimeout(() => {
|
|
@@ -193,6 +282,48 @@ function handleKeyDown(x, e) {
|
|
|
193
282
|
}
|
|
194
283
|
return true;
|
|
195
284
|
}
|
|
285
|
+
function handleKeyUp(x, e) {
|
|
286
|
+
/* v8 ignore else -- @preserve */
|
|
287
|
+
if (e.key === " " || e.key === "Space") {
|
|
288
|
+
/* v8 ignore else -- @preserve */
|
|
289
|
+
if (e.target instanceof HTMLInputElement) {
|
|
290
|
+
e.preventDefault();
|
|
291
|
+
const wasLongPress = x._endKeyboardLongPress();
|
|
292
|
+
if (!wasLongPress && !x.disabled && !x.callActive) {
|
|
293
|
+
x.value += " ";
|
|
294
|
+
x.$emit("input");
|
|
295
|
+
x.$emit("change");
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
return true;
|
|
300
|
+
}
|
|
301
|
+
function handleButtonKeyDown(digit, { parent: dialPad, event }) {
|
|
302
|
+
/* v8 ignore else -- @preserve */
|
|
303
|
+
if ((event.key === " " || event.key === "Space") && digit.value === "0") {
|
|
304
|
+
event.preventDefault();
|
|
305
|
+
/* v8 ignore else -- @preserve */
|
|
306
|
+
if (!event.repeat) {
|
|
307
|
+
dialPad._startKeyboardLongPress();
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
return true;
|
|
311
|
+
}
|
|
312
|
+
function handleButtonKeyUp(digit, { parent: dialPad, event }) {
|
|
313
|
+
/* v8 ignore else -- @preserve */
|
|
314
|
+
if ((event.key === " " || event.key === "Space") && digit.value === "0") {
|
|
315
|
+
event.preventDefault();
|
|
316
|
+
const wasLongPress = dialPad._endKeyboardLongPress();
|
|
317
|
+
/* v8 ignore else -- @preserve */
|
|
318
|
+
if (!wasLongPress && !dialPad.disabled && !dialPad.callActive) {
|
|
319
|
+
onDigitClick(digit, {
|
|
320
|
+
parent: dialPad,
|
|
321
|
+
event: new MouseEvent("click", { bubbles: true })
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
return true;
|
|
326
|
+
}
|
|
196
327
|
function syncFieldAndPadValues(x) {
|
|
197
328
|
x.value = x._textFieldEl.value;
|
|
198
329
|
}
|
|
@@ -215,6 +346,7 @@ function renderTextField(textFieldTag, buttonTag) {
|
|
|
215
346
|
?disabled="${(x) => x.disabled}" helper-text="${(x) => x.helperText}" pattern="${(x) => x.pattern}"
|
|
216
347
|
aria-label="${(x) => x.locale.dialPad.inputLabel}"
|
|
217
348
|
@keydown="${(x, c) => handleKeyDown(x, c.event)}"
|
|
349
|
+
@keyup="${(x, c) => handleKeyUp(x, c.event)}"
|
|
218
350
|
@input="${syncFieldAndPadValues}"
|
|
219
351
|
@change="${syncFieldAndPadValues}"
|
|
220
352
|
@focus="${stopPropagation}"
|
|
@@ -236,6 +368,10 @@ function renderTextField(textFieldTag, buttonTag) {
|
|
|
236
368
|
</${textFieldTag}>`;
|
|
237
369
|
}
|
|
238
370
|
function onDigitClick(digit, { parent: dialPad, event }) {
|
|
371
|
+
if (dialPad._suppressNextClick) {
|
|
372
|
+
dialPad._suppressNextClick = false;
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
239
375
|
dialPad.value += digit.value;
|
|
240
376
|
dialPad.$emit("keypad-click", event.currentTarget);
|
|
241
377
|
dialPad.$emit("input");
|
|
@@ -258,6 +394,18 @@ function renderDigits(buttonTag, iconTag) {
|
|
|
258
394
|
?autofocus="${(_, c) => c.parent.autofocus && c.parent.noInput && c.index === 0}"
|
|
259
395
|
aria-label="${(x, c) => c.parent.locale.dialPad[x.ariaLabel]}"
|
|
260
396
|
?disabled="${(_, c) => c.parent.disabled}"
|
|
397
|
+
@pointerdown="${(x, c) => c.parent._startLongPress(x.value, c.event)}"
|
|
398
|
+
@pointerup="${(_, c) => c.parent._endLongPress()}"
|
|
399
|
+
@pointercancel="${(_, c) => c.parent._cancelLongPress()}"
|
|
400
|
+
@pointerleave="${(_, c) => c.parent._cancelLongPress()}"
|
|
401
|
+
@keydown="${(x, c) => handleButtonKeyDown(x, {
|
|
402
|
+
parent: c.parent,
|
|
403
|
+
event: c.event
|
|
404
|
+
})}"
|
|
405
|
+
@keyup="${(x, c) => handleButtonKeyUp(x, {
|
|
406
|
+
parent: c.parent,
|
|
407
|
+
event: c.event
|
|
408
|
+
})}"
|
|
261
409
|
@click="${onDigitClick}">
|
|
262
410
|
<${iconTag} slot="icon"
|
|
263
411
|
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,10 +254,20 @@ 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
|
+
/* v8 ignore else -- @preserve */
|
|
259
|
+
if (e.target instanceof HTMLInputElement) {
|
|
260
|
+
e.preventDefault();
|
|
261
|
+
/* v8 ignore else -- @preserve */
|
|
262
|
+
if (!e.repeat) {
|
|
263
|
+
x._startKeyboardLongPress();
|
|
264
|
+
}
|
|
265
|
+
}
|
|
178
266
|
} else {
|
|
179
267
|
const elementIndex = DIAL_PAD_BUTTONS.findIndex((x2) => x2.value === e.key);
|
|
180
268
|
if (elementIndex > -1) {
|
|
181
269
|
const digit = x.shadowRoot.querySelector(".digits").children[elementIndex];
|
|
270
|
+
/* v8 ignore else -- @preserve */
|
|
182
271
|
if (digit) {
|
|
183
272
|
digit.active = true;
|
|
184
273
|
setTimeout(() => {
|
|
@@ -189,6 +278,48 @@ function handleKeyDown(x, e) {
|
|
|
189
278
|
}
|
|
190
279
|
return true;
|
|
191
280
|
}
|
|
281
|
+
function handleKeyUp(x, e) {
|
|
282
|
+
/* v8 ignore else -- @preserve */
|
|
283
|
+
if (e.key === " " || e.key === "Space") {
|
|
284
|
+
/* v8 ignore else -- @preserve */
|
|
285
|
+
if (e.target instanceof HTMLInputElement) {
|
|
286
|
+
e.preventDefault();
|
|
287
|
+
const wasLongPress = x._endKeyboardLongPress();
|
|
288
|
+
if (!wasLongPress && !x.disabled && !x.callActive) {
|
|
289
|
+
x.value += " ";
|
|
290
|
+
x.$emit("input");
|
|
291
|
+
x.$emit("change");
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
return true;
|
|
296
|
+
}
|
|
297
|
+
function handleButtonKeyDown(digit, { parent: dialPad, event }) {
|
|
298
|
+
/* v8 ignore else -- @preserve */
|
|
299
|
+
if ((event.key === " " || event.key === "Space") && digit.value === "0") {
|
|
300
|
+
event.preventDefault();
|
|
301
|
+
/* v8 ignore else -- @preserve */
|
|
302
|
+
if (!event.repeat) {
|
|
303
|
+
dialPad._startKeyboardLongPress();
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
return true;
|
|
307
|
+
}
|
|
308
|
+
function handleButtonKeyUp(digit, { parent: dialPad, event }) {
|
|
309
|
+
/* v8 ignore else -- @preserve */
|
|
310
|
+
if ((event.key === " " || event.key === "Space") && digit.value === "0") {
|
|
311
|
+
event.preventDefault();
|
|
312
|
+
const wasLongPress = dialPad._endKeyboardLongPress();
|
|
313
|
+
/* v8 ignore else -- @preserve */
|
|
314
|
+
if (!wasLongPress && !dialPad.disabled && !dialPad.callActive) {
|
|
315
|
+
onDigitClick(digit, {
|
|
316
|
+
parent: dialPad,
|
|
317
|
+
event: new MouseEvent("click", { bubbles: true })
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
return true;
|
|
322
|
+
}
|
|
192
323
|
function syncFieldAndPadValues(x) {
|
|
193
324
|
x.value = x._textFieldEl.value;
|
|
194
325
|
}
|
|
@@ -211,6 +342,7 @@ function renderTextField(textFieldTag, buttonTag) {
|
|
|
211
342
|
?disabled="${(x) => x.disabled}" helper-text="${(x) => x.helperText}" pattern="${(x) => x.pattern}"
|
|
212
343
|
aria-label="${(x) => x.locale.dialPad.inputLabel}"
|
|
213
344
|
@keydown="${(x, c) => handleKeyDown(x, c.event)}"
|
|
345
|
+
@keyup="${(x, c) => handleKeyUp(x, c.event)}"
|
|
214
346
|
@input="${syncFieldAndPadValues}"
|
|
215
347
|
@change="${syncFieldAndPadValues}"
|
|
216
348
|
@focus="${stopPropagation}"
|
|
@@ -232,6 +364,10 @@ function renderTextField(textFieldTag, buttonTag) {
|
|
|
232
364
|
</${textFieldTag}>`;
|
|
233
365
|
}
|
|
234
366
|
function onDigitClick(digit, { parent: dialPad, event }) {
|
|
367
|
+
if (dialPad._suppressNextClick) {
|
|
368
|
+
dialPad._suppressNextClick = false;
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
235
371
|
dialPad.value += digit.value;
|
|
236
372
|
dialPad.$emit("keypad-click", event.currentTarget);
|
|
237
373
|
dialPad.$emit("input");
|
|
@@ -254,6 +390,18 @@ function renderDigits(buttonTag, iconTag) {
|
|
|
254
390
|
?autofocus="${(_, c) => c.parent.autofocus && c.parent.noInput && c.index === 0}"
|
|
255
391
|
aria-label="${(x, c) => c.parent.locale.dialPad[x.ariaLabel]}"
|
|
256
392
|
?disabled="${(_, c) => c.parent.disabled}"
|
|
393
|
+
@pointerdown="${(x, c) => c.parent._startLongPress(x.value, c.event)}"
|
|
394
|
+
@pointerup="${(_, c) => c.parent._endLongPress()}"
|
|
395
|
+
@pointercancel="${(_, c) => c.parent._cancelLongPress()}"
|
|
396
|
+
@pointerleave="${(_, c) => c.parent._cancelLongPress()}"
|
|
397
|
+
@keydown="${(x, c) => handleButtonKeyDown(x, {
|
|
398
|
+
parent: c.parent,
|
|
399
|
+
event: c.event
|
|
400
|
+
})}"
|
|
401
|
+
@keyup="${(x, c) => handleButtonKeyUp(x, {
|
|
402
|
+
parent: c.parent,
|
|
403
|
+
event: c.event
|
|
404
|
+
})}"
|
|
257
405
|
@click="${onDigitClick}">
|
|
258
406
|
<${iconTag} slot="icon"
|
|
259
407
|
name="${(x) => x.icon}"
|