@vonage/vivid 4.17.0 → 4.18.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/custom-elements.json +3903 -3860
- package/date-time-picker/index.cjs +5 -0
- package/date-time-picker/index.js +3 -0
- package/dial-pad/index.cjs +1 -1
- package/dial-pad/index.js +1 -1
- package/dialog/index.cjs +1 -1
- package/dialog/index.js +1 -1
- package/divider/index.cjs +1 -1
- package/divider/index.js +1 -1
- package/elevation/index.cjs +1 -1
- package/elevation/index.js +1 -1
- package/empty-state/index.cjs +1 -1
- package/empty-state/index.js +1 -1
- package/fab/index.cjs +1 -1
- package/fab/index.js +1 -1
- package/file-picker/index.cjs +1 -1
- package/file-picker/index.js +1 -1
- package/header/index.cjs +1 -1
- package/header/index.js +1 -1
- package/icon/index.cjs +1 -1
- package/icon/index.js +1 -1
- package/index.cjs +136 -133
- package/index.js +45 -44
- package/layout/index.cjs +1 -1
- package/layout/index.js +1 -1
- package/lib/action-group/action-group.d.ts +449 -3
- package/lib/banner/banner.d.ts +449 -3
- package/lib/breadcrumb-item/breadcrumb-item.d.ts +449 -1
- package/lib/checkbox/checkbox.d.ts +449 -4
- package/lib/components.d.ts +1 -0
- package/lib/date-picker/date-picker.d.ts +2182 -4
- package/lib/date-picker/date-picker.template.d.ts +2 -0
- package/lib/date-range-picker/date-range-picker.d.ts +1110 -4
- package/lib/date-range-picker/date-range-picker.template.d.ts +2 -0
- package/lib/date-time-picker/date-time-picker.d.ts +2175 -0
- package/lib/date-time-picker/date-time-picker.template.d.ts +2 -0
- package/lib/date-time-picker/definition.d.ts +1 -0
- package/lib/date-time-picker/locale.d.ts +9 -0
- package/lib/dialog/dialog.d.ts +449 -2
- package/lib/divider/divider.d.ts +448 -1
- package/lib/menu/menu.d.ts +446 -1
- package/lib/nav-disclosure/nav-disclosure.d.ts +449 -2
- package/lib/number-field/number-field.d.ts +450 -3
- package/lib/option/option.d.ts +1 -11
- package/lib/progress/progress.d.ts +449 -2
- package/lib/progress-ring/progress-ring.d.ts +449 -2
- package/lib/rich-text-editor/facades/vivid-prose-mirror.facade.d.ts +1 -0
- package/lib/rich-text-editor/rich-text-editor.d.ts +7 -4
- package/lib/select/select.d.ts +1 -5
- package/lib/selectable-box/selectable-box.d.ts +449 -2
- package/lib/slider/slider.d.ts +449 -3
- package/lib/split-button/split-button.d.ts +449 -3
- package/lib/switch/switch.d.ts +449 -2
- package/lib/tag-group/tag-group.d.ts +449 -2
- package/lib/text-anchor/text-anchor.d.ts +449 -1
- package/lib/text-area/text-area.d.ts +450 -3
- package/lib/text-field/text-field.d.ts +450 -7
- package/lib/time-picker/locale.d.ts +0 -2
- package/lib/time-picker/time-picker.d.ts +1053 -9
- package/lib/time-picker/time-picker.template.d.ts +2 -1
- package/locales/de-DE.cjs +29 -5
- package/locales/de-DE.js +29 -5
- package/locales/en-GB.cjs +29 -5
- package/locales/en-GB.js +29 -5
- package/locales/en-US.cjs +29 -5
- package/locales/en-US.js +29 -5
- package/locales/ja-JP.cjs +29 -5
- package/locales/ja-JP.js +29 -5
- package/locales/zh-CN.cjs +29 -5
- package/locales/zh-CN.js +29 -5
- package/menu/index.cjs +1 -1
- package/menu/index.js +1 -1
- package/menu-item/index.cjs +1 -1
- package/menu-item/index.js +1 -1
- package/nav/index.cjs +1 -1
- package/nav/index.js +1 -1
- package/nav-disclosure/index.cjs +1 -1
- package/nav-disclosure/index.js +1 -1
- package/nav-item/index.cjs +1 -1
- package/nav-item/index.js +1 -1
- package/note/index.cjs +1 -1
- package/note/index.js +1 -1
- package/number-field/index.cjs +1 -1
- package/number-field/index.js +1 -1
- package/option/index.cjs +1 -1
- package/option/index.js +1 -1
- package/package.json +1 -1
- package/pagination/index.cjs +1 -1
- package/pagination/index.js +1 -1
- package/popup/index.cjs +1 -1
- package/popup/index.js +1 -1
- package/progress/index.cjs +1 -1
- package/progress/index.js +1 -1
- package/progress-ring/index.cjs +1 -1
- package/progress-ring/index.js +1 -1
- package/radio/index.cjs +1 -1
- package/radio/index.js +1 -1
- package/radio-group/index.cjs +1 -1
- package/radio-group/index.js +1 -1
- package/range-slider/index.cjs +1 -1
- package/range-slider/index.js +1 -1
- package/rich-text-editor/index.cjs +1 -1
- package/rich-text-editor/index.js +1 -1
- package/searchable-select/index.cjs +1 -1
- package/searchable-select/index.js +1 -1
- package/select/index.cjs +1 -1
- package/select/index.js +1 -1
- package/selectable-box/index.cjs +1 -1
- package/selectable-box/index.js +1 -1
- package/shared/Reflector.cjs +71 -0
- package/shared/Reflector.js +69 -0
- package/shared/affix.cjs +1 -1
- package/shared/affix.js +1 -1
- package/shared/anchor.cjs +0 -10
- package/shared/anchor.js +0 -10
- package/shared/aria/delegates-aria.d.ts +454 -0
- package/shared/base-progress.js +1 -1
- package/shared/breadcrumb-item.cjs +2 -1
- package/shared/breadcrumb-item.js +2 -1
- package/shared/button.cjs +2 -13
- package/shared/button.js +2 -13
- package/shared/{presentationDate.cjs → calendar-picker.template.cjs} +730 -900
- package/shared/{presentationDate.js → calendar-picker.template.js} +672 -845
- package/shared/datetime/dateTimeStr.d.ts +6 -0
- package/shared/datetime/presentationDate.d.ts +4 -0
- package/shared/{date-picker/calendar → datetime}/presentationDateRange.d.ts +3 -3
- package/shared/datetime/presentationDateTime.d.ts +4 -0
- package/{lib/time-picker/time → shared/datetime}/time.d.ts +1 -0
- package/shared/definition.cjs +1 -1
- package/shared/definition.js +1 -1
- package/shared/definition11.cjs +8 -11
- package/shared/definition11.js +8 -11
- package/shared/definition14.cjs +2 -2
- package/shared/definition14.js +2 -2
- package/shared/definition15.cjs +3 -10
- package/shared/definition15.js +3 -10
- package/shared/definition16.cjs +29 -33
- package/shared/definition16.js +29 -33
- package/shared/definition17.cjs +1 -1
- package/shared/definition17.js +1 -1
- package/shared/definition18.cjs +56 -91
- package/shared/definition18.js +56 -91
- package/shared/definition19.cjs +68 -32
- package/shared/definition19.js +58 -22
- package/shared/definition20.cjs +253 -220
- package/shared/definition20.js +254 -220
- package/shared/definition21.cjs +200 -286
- package/shared/definition21.js +198 -284
- package/shared/definition22.cjs +302 -31
- package/shared/definition22.js +301 -30
- package/shared/definition23.cjs +37 -58
- package/shared/definition23.js +36 -57
- package/shared/definition24.cjs +50 -70
- package/shared/definition24.js +49 -69
- package/shared/definition25.cjs +75 -2475
- package/shared/definition25.js +74 -2475
- package/shared/definition26.cjs +2480 -50
- package/shared/definition26.js +2479 -48
- package/shared/definition27.cjs +53 -271
- package/shared/definition27.js +52 -269
- package/shared/definition28.cjs +271 -48
- package/shared/definition28.js +269 -47
- package/shared/definition29.cjs +37 -764
- package/shared/definition29.js +36 -758
- package/shared/definition3.cjs +2 -9
- package/shared/definition3.js +2 -9
- package/shared/definition30.cjs +739 -57
- package/shared/definition30.js +733 -56
- package/shared/definition31.cjs +93 -22
- package/shared/definition31.js +92 -21
- package/shared/definition32.cjs +28 -10
- package/shared/definition32.js +27 -9
- package/shared/definition33.cjs +10 -52
- package/shared/definition33.js +9 -51
- package/shared/definition34.cjs +30 -411
- package/shared/definition34.js +30 -412
- package/shared/definition35.cjs +422 -52
- package/shared/definition35.js +423 -53
- package/shared/definition36.cjs +53 -216
- package/shared/definition36.js +53 -215
- package/shared/definition37.cjs +201 -71
- package/shared/definition37.js +200 -70
- package/shared/definition38.cjs +53 -48
- package/shared/definition38.js +51 -46
- package/shared/definition39.cjs +57 -263
- package/shared/definition39.js +56 -262
- package/shared/definition4.cjs +2 -2
- package/shared/definition4.js +2 -2
- package/shared/definition40.cjs +220 -148
- package/shared/definition40.js +220 -148
- package/shared/definition41.cjs +143 -567
- package/shared/definition41.js +143 -568
- package/shared/definition42.cjs +596 -12573
- package/shared/definition42.js +596 -12573
- package/shared/definition43.cjs +13489 -1058
- package/shared/definition43.js +13489 -1059
- package/shared/definition44.cjs +936 -698
- package/shared/definition44.js +937 -698
- package/shared/definition45.cjs +850 -105
- package/shared/definition45.js +850 -104
- package/shared/definition46.cjs +110 -90
- package/shared/definition46.js +108 -88
- package/shared/definition47.cjs +88 -464
- package/shared/definition47.js +87 -463
- package/shared/definition48.cjs +457 -111
- package/shared/definition48.js +456 -110
- package/shared/definition49.cjs +103 -109
- package/shared/definition49.js +102 -108
- package/shared/definition5.cjs +3 -3
- package/shared/definition5.js +3 -3
- package/shared/definition50.cjs +136 -14
- package/shared/definition50.js +135 -13
- package/shared/definition51.cjs +16 -115
- package/shared/definition51.js +15 -114
- package/shared/definition52.cjs +79 -486
- package/shared/definition52.js +78 -485
- package/shared/definition53.cjs +503 -24
- package/shared/definition53.js +502 -23
- package/shared/definition54.cjs +23 -137
- package/shared/definition54.js +22 -136
- package/shared/definition55.cjs +96 -241
- package/shared/definition55.js +95 -241
- package/shared/definition56.cjs +261 -61
- package/shared/definition56.js +260 -60
- package/shared/definition57.cjs +419 -788
- package/shared/definition57.js +420 -789
- package/shared/definition58.cjs +27 -144
- package/shared/definition58.js +27 -143
- package/shared/definition59.cjs +83 -54
- package/shared/definition59.js +82 -53
- package/shared/definition6.cjs +1 -1
- package/shared/definition6.js +1 -1
- package/shared/definition60.cjs +80 -165
- package/shared/definition60.js +79 -163
- package/shared/definition61.cjs +143 -230
- package/shared/definition61.js +141 -229
- package/shared/definition62.cjs +233 -69344
- package/shared/definition62.js +232 -69343
- package/shared/definition63.cjs +69381 -28
- package/shared/definition63.js +69379 -26
- package/shared/definition64.cjs +28 -2168
- package/shared/definition64.js +27 -2166
- package/shared/definition65.cjs +2195 -0
- package/shared/definition65.js +2190 -0
- package/shared/definition7.cjs +1 -1
- package/shared/definition7.js +1 -1
- package/shared/definition8.cjs +3 -9
- package/shared/definition8.js +3 -9
- package/shared/definition9.cjs +1 -1
- package/shared/definition9.js +1 -1
- package/shared/delegates-aria.cjs +69 -0
- package/shared/delegates-aria.js +67 -0
- package/shared/form-associated.js +1 -1
- package/shared/form-elements.cjs +1 -1
- package/shared/form-elements.js +1 -1
- package/shared/foundation/anchor/anchor.d.ts +0 -8
- package/shared/foundation/button/button.d.ts +449 -7
- package/shared/foundation/listbox/listbox.d.ts +0 -9
- package/shared/listbox.cjs +4 -30
- package/shared/listbox.js +4 -30
- package/shared/localization/Locale.d.ts +6 -2
- package/shared/option.cjs +1 -38
- package/shared/option.js +1 -38
- package/shared/picker-field/locale.d.ts +4 -0
- package/shared/picker-field/mixins/calendar-picker.d.ts +558 -0
- package/shared/{date-picker/locale.d.ts → picker-field/mixins/calendar-picker.locale.d.ts} +1 -3
- package/shared/picker-field/mixins/calendar-picker.template.d.ts +555 -0
- package/shared/picker-field/mixins/calendar-segments/calendarGrid.d.ts +17 -0
- package/shared/{date-picker/calendar → picker-field/mixins/calendar-segments}/monthPickerGrid.d.ts +3 -3
- package/{lib/time-picker → shared/picker-field/mixins}/inline-time-picker/columns.d.ts +1 -1
- package/{lib/time-picker → shared/picker-field/mixins}/inline-time-picker/inline-time-picker.d.ts +2 -2
- package/{lib/time-picker/time/picker.d.ts → shared/picker-field/mixins/inline-time-picker/picker-option.d.ts} +1 -1
- package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +1110 -0
- package/shared/picker-field/mixins/single-date-picker.d.ts +1626 -0
- package/shared/picker-field/mixins/single-value-picker.d.ts +518 -0
- package/shared/picker-field/mixins/time-selection-picker.d.ts +1053 -0
- package/shared/picker-field/mixins/time-selection-picker.template.d.ts +1050 -0
- package/shared/picker-field/picker-field.d.ts +11 -0
- package/shared/picker-field/picker-field.form-associated.d.ts +11 -0
- package/shared/picker-field/picker-field.template.d.ts +7 -0
- package/shared/picker-field.template.cjs +315 -0
- package/shared/picker-field.template.js +310 -0
- package/shared/single-date-picker.cjs +46 -0
- package/shared/single-date-picker.js +44 -0
- package/shared/single-value-picker.cjs +77 -0
- package/shared/single-value-picker.js +75 -0
- package/shared/slider.template.cjs +3 -3
- package/shared/slider.template.js +3 -3
- package/shared/text-anchor.cjs +2 -1
- package/shared/text-anchor.js +2 -1
- package/shared/text-anchor.template.cjs +3 -5
- package/shared/text-anchor.template.js +3 -5
- package/shared/text-field.cjs +2 -555
- package/shared/text-field.js +2 -554
- package/shared/time-selection-picker.template.cjs +776 -0
- package/shared/time-selection-picker.template.js +767 -0
- package/shared/vivid-element.cjs +1 -1
- package/shared/vivid-element.js +1 -1
- package/side-drawer/index.cjs +1 -1
- package/side-drawer/index.js +1 -1
- package/slider/index.cjs +1 -1
- package/slider/index.js +1 -1
- package/split-button/index.cjs +1 -1
- package/split-button/index.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/switch/index.cjs +1 -1
- package/switch/index.js +1 -1
- package/tab/index.cjs +1 -1
- package/tab/index.js +1 -1
- package/tab-panel/index.cjs +1 -1
- package/tab-panel/index.js +1 -1
- package/tabs/index.cjs +1 -1
- package/tabs/index.js +1 -1
- package/tag/index.cjs +1 -1
- package/tag/index.js +1 -1
- package/tag-group/index.cjs +1 -1
- package/tag-group/index.js +1 -1
- package/text-anchor/index.cjs +1 -1
- package/text-anchor/index.js +1 -1
- package/text-area/index.cjs +1 -1
- package/text-area/index.js +1 -1
- package/text-field/index.cjs +1 -1
- package/text-field/index.js +1 -1
- package/time-picker/index.cjs +1 -1
- package/time-picker/index.js +1 -1
- package/toggletip/index.cjs +1 -1
- package/toggletip/index.js +1 -1
- package/tooltip/index.cjs +1 -1
- package/tooltip/index.js +1 -1
- package/tree-item/index.cjs +1 -1
- package/tree-item/index.js +1 -1
- package/tree-view/index.cjs +1 -1
- package/tree-view/index.js +1 -1
- package/video-player/index.cjs +1 -1
- package/video-player/index.js +1 -1
- package/vivid.api.json +105 -1152
- package/lib/time-picker/time-picker.form-associated.d.ts +0 -11
- package/shared/aria-global.cjs +0 -93
- package/shared/aria-global.js +0 -91
- package/shared/date-picker/calendar/calendarGrid.d.ts +0 -17
- package/shared/date-picker/calendar/presentationDate.d.ts +0 -4
- package/shared/date-picker/date-picker-base.d.ts +0 -21
- package/shared/date-picker/date-picker-base.form-associated.d.ts +0 -11
- package/shared/date-picker/date-picker-base.template.d.ts +0 -3
- package/shared/foundation/patterns/aria-global.d.ts +0 -21
- package/shared/foundation/patterns/index.d.ts +0 -1
- package/shared/text-field2.cjs +0 -5
- package/shared/text-field2.js +0 -3
- package/shared/trapped-focus.cjs +0 -35
- package/shared/trapped-focus.js +0 -33
- /package/shared/{date-picker/calendar → datetime}/dateRange.d.ts +0 -0
- /package/shared/{date-picker/calendar → datetime}/dateStr.d.ts +0 -0
- /package/shared/{date-picker/calendar → datetime}/month.d.ts +0 -0
- /package/{lib/time-picker/time → shared/datetime}/presentationTime.d.ts +0 -0
- /package/shared/{date-picker/calendar → datetime}/year.d.ts +0 -0
- /package/shared/{date-picker/calendar → picker-field/mixins/calendar-segments}/segment.d.ts +0 -0
- /package/{lib/time-picker → shared/picker-field/mixins}/inline-time-picker/definition.d.ts +0 -0
- /package/{lib/time-picker → shared/picker-field/mixins}/inline-time-picker/inline-time-picker.template.d.ts +0 -0
package/shared/definition57.cjs
CHANGED
|
@@ -1,149 +1,96 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const definition
|
|
4
|
-
const definition = require('./definition64.cjs');
|
|
5
|
-
const definition$1 = require('./definition11.cjs');
|
|
3
|
+
const definition = require('./definition28.cjs');
|
|
6
4
|
const vividElement = require('./vivid-element.cjs');
|
|
5
|
+
const Reflector = require('./Reflector.cjs');
|
|
7
6
|
const applyMixinsWithObservables = require('./applyMixinsWithObservables.cjs');
|
|
8
|
-
const
|
|
7
|
+
const delegatesAria = require('./delegates-aria.cjs');
|
|
9
8
|
const formAssociated = require('./form-associated.cjs');
|
|
10
|
-
const trappedFocus = require('./trapped-focus.cjs');
|
|
11
9
|
const formElements = require('./form-elements.cjs');
|
|
12
|
-
const
|
|
10
|
+
const affix = require('./affix.cjs');
|
|
13
11
|
const textField = require('./text-field.cjs');
|
|
14
|
-
const scrollIntoView = require('./scrollIntoView.cjs');
|
|
15
|
-
const when = require('./when.cjs');
|
|
16
|
-
const repeat = require('./repeat.cjs');
|
|
17
12
|
const classNames = require('./class-names.cjs');
|
|
18
|
-
const
|
|
13
|
+
const when = require('./when.cjs');
|
|
19
14
|
const slotted = require('./slotted.cjs');
|
|
20
15
|
|
|
21
|
-
const
|
|
16
|
+
const byteToHex = [];
|
|
17
|
+
for (let i = 0; i < 256; ++i) {
|
|
18
|
+
byteToHex.push((i + 0x100).toString(16).slice(1));
|
|
19
|
+
}
|
|
20
|
+
function unsafeStringify(arr, offset = 0) {
|
|
21
|
+
return (byteToHex[arr[offset + 0]] +
|
|
22
|
+
byteToHex[arr[offset + 1]] +
|
|
23
|
+
byteToHex[arr[offset + 2]] +
|
|
24
|
+
byteToHex[arr[offset + 3]] +
|
|
25
|
+
'-' +
|
|
26
|
+
byteToHex[arr[offset + 4]] +
|
|
27
|
+
byteToHex[arr[offset + 5]] +
|
|
28
|
+
'-' +
|
|
29
|
+
byteToHex[arr[offset + 6]] +
|
|
30
|
+
byteToHex[arr[offset + 7]] +
|
|
31
|
+
'-' +
|
|
32
|
+
byteToHex[arr[offset + 8]] +
|
|
33
|
+
byteToHex[arr[offset + 9]] +
|
|
34
|
+
'-' +
|
|
35
|
+
byteToHex[arr[offset + 10]] +
|
|
36
|
+
byteToHex[arr[offset + 11]] +
|
|
37
|
+
byteToHex[arr[offset + 12]] +
|
|
38
|
+
byteToHex[arr[offset + 13]] +
|
|
39
|
+
byteToHex[arr[offset + 14]] +
|
|
40
|
+
byteToHex[arr[offset + 15]]).toLowerCase();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
let getRandomValues;
|
|
44
|
+
const rnds8 = new Uint8Array(16);
|
|
45
|
+
function rng() {
|
|
46
|
+
if (!getRandomValues) {
|
|
47
|
+
if (typeof crypto === 'undefined' || !crypto.getRandomValues) {
|
|
48
|
+
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
|
49
|
+
}
|
|
50
|
+
getRandomValues = crypto.getRandomValues.bind(crypto);
|
|
51
|
+
}
|
|
52
|
+
return getRandomValues(rnds8);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
56
|
+
const native = { randomUUID };
|
|
57
|
+
|
|
58
|
+
function v4(options, buf, offset) {
|
|
59
|
+
if (native.randomUUID && true && !options) {
|
|
60
|
+
return native.randomUUID();
|
|
61
|
+
}
|
|
62
|
+
options = options || {};
|
|
63
|
+
const rnds = options.random ?? options.rng?.() ?? rng();
|
|
64
|
+
if (rnds.length < 16) {
|
|
65
|
+
throw new Error('Random bytes length must be >= 16');
|
|
66
|
+
}
|
|
67
|
+
rnds[6] = (rnds[6] & 0x0f) | 0x40;
|
|
68
|
+
rnds[8] = (rnds[8] & 0x3f) | 0x80;
|
|
69
|
+
return unsafeStringify(rnds);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const generateRandomId = () => v4();
|
|
22
73
|
|
|
23
|
-
class
|
|
74
|
+
class _TextField extends vividElement.VividElement {
|
|
24
75
|
}
|
|
25
|
-
class
|
|
76
|
+
class FormAssociatedTextField extends formAssociated.FormAssociated(_TextField) {
|
|
26
77
|
constructor() {
|
|
27
78
|
super(...arguments);
|
|
28
79
|
this.proxy = document.createElement("input");
|
|
29
80
|
}
|
|
30
81
|
}
|
|
31
82
|
|
|
32
|
-
|
|
33
|
-
const parts = timeStr.split(":");
|
|
34
|
-
if (parts.length !== 3) {
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
const [hours, minutes, seconds] = parts;
|
|
38
|
-
if (hours.length !== 2 || minutes.length !== 2 || seconds.length !== 2) {
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
const hoursNum = parseInt(hours, 10);
|
|
42
|
-
const minutesNum = parseInt(minutes, 10);
|
|
43
|
-
const secondsNum = parseInt(seconds, 10);
|
|
44
|
-
if (isNaN(hoursNum) || isNaN(minutesNum) || isNaN(secondsNum)) {
|
|
45
|
-
return false;
|
|
46
|
-
}
|
|
47
|
-
if (hoursNum < 0 || hoursNum > 23) {
|
|
48
|
-
return false;
|
|
49
|
-
}
|
|
50
|
-
if (minutesNum < 0 || minutesNum > 59) {
|
|
51
|
-
return false;
|
|
52
|
-
}
|
|
53
|
-
if (secondsNum < 0 || secondsNum > 59) {
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
return true;
|
|
57
|
-
};
|
|
58
|
-
const parseTimePart = (partStr) => Number.parseInt(partStr, 10);
|
|
59
|
-
const formatTimePart = (part) => part.toString().padStart(2, "0");
|
|
60
|
-
const parseTimeStr = (timeStr) => {
|
|
61
|
-
const [hoursStr, minutesStr, secondsStr] = timeStr.split(":");
|
|
62
|
-
const hours = parseTimePart(hoursStr);
|
|
63
|
-
const minutes = parseTimePart(minutesStr);
|
|
64
|
-
const seconds = parseTimePart(secondsStr);
|
|
65
|
-
return {
|
|
66
|
-
hourStr: hoursStr,
|
|
67
|
-
hours,
|
|
68
|
-
minuteStr: minutesStr,
|
|
69
|
-
minutes,
|
|
70
|
-
secondStr: secondsStr,
|
|
71
|
-
seconds,
|
|
72
|
-
meridiem: hours < 12 ? "AM" : "PM"
|
|
73
|
-
};
|
|
74
|
-
};
|
|
75
|
-
const hoursAs12hClock = (hour) => hour % 12 || 12;
|
|
76
|
-
|
|
77
|
-
const formatPresentationTime = (timeStr, includeSeconds, use12HourClock) => {
|
|
78
|
-
const time = parseTimeStr(timeStr);
|
|
79
|
-
const hoursStr = formatTimePart(
|
|
80
|
-
use12HourClock ? hoursAs12hClock(time.hours) : time.hours
|
|
81
|
-
);
|
|
82
|
-
let result = `${hoursStr}:${time.minuteStr}`;
|
|
83
|
-
if (includeSeconds) {
|
|
84
|
-
result += `:${time.secondStr}`;
|
|
85
|
-
}
|
|
86
|
-
if (use12HourClock) {
|
|
87
|
-
result += ` ${time.meridiem}`;
|
|
88
|
-
}
|
|
89
|
-
return result;
|
|
90
|
-
};
|
|
91
|
-
const isDigit = (char) => char >= "0" && char <= "9";
|
|
92
|
-
const parsePresentationTime = (input, use12HourClock) => {
|
|
93
|
-
const cleanedInput = input.toLowerCase();
|
|
94
|
-
const numerals = [];
|
|
95
|
-
let meridiem;
|
|
96
|
-
for (let i = 0; i < cleanedInput.length; i++) {
|
|
97
|
-
const char = cleanedInput[i];
|
|
98
|
-
if (char === "a" && cleanedInput[i + 1] === "m") {
|
|
99
|
-
i++;
|
|
100
|
-
meridiem = "AM";
|
|
101
|
-
}
|
|
102
|
-
if (char === "p" && cleanedInput[i + 1] === "m") {
|
|
103
|
-
i++;
|
|
104
|
-
meridiem = "PM";
|
|
105
|
-
}
|
|
106
|
-
if (isDigit(char)) {
|
|
107
|
-
let numeral = char;
|
|
108
|
-
while (isDigit(cleanedInput[i + 1])) {
|
|
109
|
-
i++;
|
|
110
|
-
numeral += cleanedInput[i];
|
|
111
|
-
}
|
|
112
|
-
numerals.push(Number.parseInt(numeral, 10));
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
if (numerals.length === 0 || numerals.length > 3) {
|
|
116
|
-
throw new Error("Invalid time format");
|
|
117
|
-
}
|
|
118
|
-
if (meridiem && (numerals[0] < 1 || numerals[0] > 12)) {
|
|
119
|
-
throw new Error("Invalid time format");
|
|
120
|
-
}
|
|
121
|
-
if (meridiem || use12HourClock) {
|
|
122
|
-
if (numerals[0] === 12) {
|
|
123
|
-
numerals[0] = 0;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
if (meridiem === "PM") {
|
|
127
|
-
numerals[0] = numerals[0] + 12;
|
|
128
|
-
}
|
|
129
|
-
const [hours, minutes = 0, seconds = 0] = numerals;
|
|
130
|
-
if (hours > 23 || minutes > 59 || seconds > 59) {
|
|
131
|
-
throw new Error("Invalid value");
|
|
132
|
-
}
|
|
133
|
-
return [hours, minutes, seconds].map(formatTimePart).join(":");
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
var __defProp$1 = Object.defineProperty;
|
|
83
|
+
var __defProp = Object.defineProperty;
|
|
137
84
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
138
85
|
var __typeError = (msg) => {
|
|
139
86
|
throw TypeError(msg);
|
|
140
87
|
};
|
|
141
|
-
var __decorateClass
|
|
88
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
142
89
|
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
143
90
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
144
91
|
if (decorator = decorators[i])
|
|
145
92
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
146
|
-
if (kind && result) __defProp
|
|
93
|
+
if (kind && result) __defProp(target, key, result);
|
|
147
94
|
return result;
|
|
148
95
|
};
|
|
149
96
|
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
@@ -151,65 +98,55 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
|
|
|
151
98
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
152
99
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
|
|
153
100
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
154
|
-
var
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
101
|
+
var _TextField_instances, handleLabelChange_fn, _reflectToInput, _helperTextMirrorEl, _helperTextSlotMutationObserver, updateHelperTextMutationObserver_fn, updateMirroredHelperText_fn;
|
|
102
|
+
const TextFieldType = {
|
|
103
|
+
/**
|
|
104
|
+
* A text TextField
|
|
105
|
+
*/
|
|
106
|
+
text: "text"};
|
|
107
|
+
const safariWorkaroundClassName = "_vvd-3-text-field-safari-workaround";
|
|
108
|
+
const getSafariWorkaroundStyleSheet = definition.memoizeWith(
|
|
109
|
+
() => "",
|
|
110
|
+
() => {
|
|
111
|
+
const styleSheet = new CSSStyleSheet();
|
|
112
|
+
const supportsReplaceSync = "replaceSync" in styleSheet;
|
|
113
|
+
if (supportsReplaceSync) {
|
|
114
|
+
styleSheet.replaceSync(`
|
|
115
|
+
.${safariWorkaroundClassName}::placeholder {
|
|
116
|
+
opacity: 1 !important;
|
|
117
|
+
-webkit-text-fill-color: var(--_low-ink-color) !important;
|
|
118
|
+
}`);
|
|
119
|
+
}
|
|
120
|
+
return styleSheet;
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
const installSafariWorkaroundStyle = (forElement) => {
|
|
124
|
+
const root = forElement.getRootNode();
|
|
125
|
+
const workaroundStyleSheet = getSafariWorkaroundStyleSheet();
|
|
126
|
+
const supportsAdoptedStyleSheets = "adoptedStyleSheets" in root;
|
|
127
|
+
if (!supportsAdoptedStyleSheets) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
if (!root.adoptedStyleSheets.includes(workaroundStyleSheet)) {
|
|
131
|
+
root.adoptedStyleSheets = [
|
|
132
|
+
...root.adoptedStyleSheets,
|
|
133
|
+
workaroundStyleSheet
|
|
134
|
+
];
|
|
164
135
|
}
|
|
165
136
|
};
|
|
166
|
-
exports.
|
|
137
|
+
exports.TextField = class TextField extends delegatesAria.DelegatesAria(FormAssociatedTextField) {
|
|
167
138
|
constructor() {
|
|
168
|
-
super();
|
|
169
|
-
__privateAdd(this,
|
|
170
|
-
|
|
171
|
-
this.
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
this._displaySeconds,
|
|
180
|
-
this._use12hClock
|
|
181
|
-
);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
});
|
|
185
|
-
__privateAdd(this, _clockChangeObserver);
|
|
186
|
-
__privateAdd(this, _getFocusableEls, () => this.shadowRoot.querySelectorAll(`
|
|
187
|
-
#inline-time-picker,
|
|
188
|
-
.dialog .vwc-button:not(:disabled)
|
|
189
|
-
`));
|
|
190
|
-
__privateAdd(this, _onFocusIn, () => {
|
|
191
|
-
this.$emit("focus", void 0, { bubbles: false });
|
|
192
|
-
});
|
|
193
|
-
__privateAdd(this, _onFocusOut, () => {
|
|
194
|
-
this.$emit("blur", void 0, { bubbles: false });
|
|
195
|
-
});
|
|
196
|
-
this._popupOpen = false;
|
|
197
|
-
__privateAdd(this, _dismissOnClickOutside, (event) => {
|
|
198
|
-
if (!this._popupOpen) {
|
|
199
|
-
return;
|
|
200
|
-
}
|
|
201
|
-
const path = event.composedPath();
|
|
202
|
-
const elementsToIgnoreClicksOn = [this._dialogEl, this._clockButtonEl];
|
|
203
|
-
if (!elementsToIgnoreClicksOn.some((element) => path.includes(element))) {
|
|
204
|
-
this._closePopup(false);
|
|
205
|
-
}
|
|
206
|
-
});
|
|
207
|
-
this._presentationValue = "";
|
|
208
|
-
this.value = "";
|
|
209
|
-
this.min = "";
|
|
210
|
-
this.max = "";
|
|
211
|
-
this.proxy.type = "time";
|
|
212
|
-
this.proxy.step = "1";
|
|
139
|
+
super(...arguments);
|
|
140
|
+
__privateAdd(this, _TextField_instances);
|
|
141
|
+
// eslint-disable-next-line @nrwl/nx/workspace/no-attribute-default-value
|
|
142
|
+
this.type = TextFieldType.text;
|
|
143
|
+
/**
|
|
144
|
+
* @internal
|
|
145
|
+
*/
|
|
146
|
+
this._labelEl = null;
|
|
147
|
+
__privateAdd(this, _reflectToInput);
|
|
148
|
+
__privateAdd(this, _helperTextMirrorEl);
|
|
149
|
+
__privateAdd(this, _helperTextSlotMutationObserver);
|
|
213
150
|
}
|
|
214
151
|
/**
|
|
215
152
|
* @internal
|
|
@@ -223,718 +160,412 @@ exports.TimePicker = class TimePicker extends FormAssociatedTimePicker {
|
|
|
223
160
|
/**
|
|
224
161
|
* @internal
|
|
225
162
|
*/
|
|
226
|
-
|
|
163
|
+
autofocusChanged() {
|
|
227
164
|
if (this.proxy instanceof HTMLInputElement) {
|
|
228
|
-
this.proxy.
|
|
165
|
+
this.proxy.autofocus = this.autofocus;
|
|
229
166
|
this.validate();
|
|
230
167
|
}
|
|
231
168
|
}
|
|
232
169
|
/**
|
|
233
170
|
* @internal
|
|
234
171
|
*/
|
|
235
|
-
|
|
172
|
+
placeholderChanged() {
|
|
236
173
|
if (this.proxy instanceof HTMLInputElement) {
|
|
237
|
-
this.proxy.
|
|
238
|
-
this.validate();
|
|
174
|
+
this.proxy.placeholder = this.placeholder;
|
|
239
175
|
}
|
|
240
176
|
}
|
|
241
|
-
// --- Core ---
|
|
242
|
-
/**
|
|
243
|
-
* @internal
|
|
244
|
-
*/
|
|
245
|
-
get _displaySeconds() {
|
|
246
|
-
return this.secondsStep !== null;
|
|
247
|
-
}
|
|
248
|
-
get _use12hClock() {
|
|
249
|
-
return this.clock ? this.clock === "12h" : this.locale.timePicker.defaultTo12HourClock;
|
|
250
|
-
}
|
|
251
177
|
/**
|
|
252
178
|
* @internal
|
|
253
179
|
*/
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
this.value = "";
|
|
259
|
-
return;
|
|
260
|
-
}
|
|
261
|
-
this._presentationValue = formatPresentationTime(
|
|
262
|
-
this.value,
|
|
263
|
-
this._displaySeconds,
|
|
264
|
-
this._use12hClock
|
|
265
|
-
);
|
|
266
|
-
} else {
|
|
267
|
-
this._presentationValue = "";
|
|
180
|
+
typeChanged() {
|
|
181
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
182
|
+
this.proxy.type = this.type;
|
|
183
|
+
this.validate();
|
|
268
184
|
}
|
|
269
185
|
}
|
|
270
|
-
connectedCallback() {
|
|
271
|
-
super.connectedCallback();
|
|
272
|
-
document.addEventListener("click", __privateGet(this, _dismissOnClickOutside));
|
|
273
|
-
this.addEventListener("focusin", __privateGet(this, _onFocusIn));
|
|
274
|
-
this.addEventListener("focusout", __privateGet(this, _onFocusOut));
|
|
275
|
-
__privateSet(this, _clockChangeObserver, vividElement.Observable.binding(
|
|
276
|
-
() => this._use12hClock,
|
|
277
|
-
__privateGet(this, _clockChangeHandler)
|
|
278
|
-
));
|
|
279
|
-
__privateGet(this, _clockChangeObserver).observe(this, vividElement.defaultExecutionContext);
|
|
280
|
-
}
|
|
281
|
-
disconnectedCallback() {
|
|
282
|
-
super.disconnectedCallback();
|
|
283
|
-
document.removeEventListener("click", __privateGet(this, _dismissOnClickOutside));
|
|
284
|
-
this.removeEventListener("focusin", __privateGet(this, _onFocusIn));
|
|
285
|
-
this.removeEventListener("focusout", __privateGet(this, _onFocusOut));
|
|
286
|
-
__privateGet(this, _clockChangeObserver).disconnect();
|
|
287
|
-
}
|
|
288
186
|
/**
|
|
289
187
|
* @internal
|
|
290
188
|
*/
|
|
291
|
-
|
|
292
|
-
this.
|
|
293
|
-
|
|
294
|
-
this.
|
|
189
|
+
listChanged() {
|
|
190
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
191
|
+
this.proxy.setAttribute("list", this.list);
|
|
192
|
+
this.validate();
|
|
295
193
|
}
|
|
296
194
|
}
|
|
297
195
|
/**
|
|
298
|
-
* On keydown anywhere in the time picker.
|
|
299
196
|
* @internal
|
|
300
197
|
*/
|
|
301
|
-
|
|
302
|
-
if (this.
|
|
303
|
-
this.
|
|
304
|
-
|
|
305
|
-
}
|
|
306
|
-
if (this._trappedFocus(event, __privateGet(this, _getFocusableEls))) {
|
|
307
|
-
return false;
|
|
198
|
+
maxlengthChanged() {
|
|
199
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
200
|
+
this.proxy.maxLength = this.maxlength;
|
|
201
|
+
this.validate();
|
|
308
202
|
}
|
|
309
|
-
return true;
|
|
310
203
|
}
|
|
311
204
|
/**
|
|
312
205
|
* @internal
|
|
313
206
|
*/
|
|
314
|
-
|
|
315
|
-
this.
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
/**
|
|
319
|
-
* @internal
|
|
320
|
-
*/
|
|
321
|
-
get _textFieldPlaceholder() {
|
|
322
|
-
let format = "hh:mm";
|
|
323
|
-
if (this._displaySeconds) {
|
|
324
|
-
format += ":ss";
|
|
325
|
-
}
|
|
326
|
-
if (this._use12hClock) {
|
|
327
|
-
format += " aa";
|
|
207
|
+
minlengthChanged() {
|
|
208
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
209
|
+
this.proxy.minLength = this.minlength;
|
|
210
|
+
this.validate();
|
|
328
211
|
}
|
|
329
|
-
return format;
|
|
330
212
|
}
|
|
331
213
|
/**
|
|
332
214
|
* @internal
|
|
333
215
|
*/
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
/**
|
|
339
|
-
* @internal
|
|
340
|
-
*/
|
|
341
|
-
_onTextFieldChange() {
|
|
342
|
-
if (this._presentationValue === "") {
|
|
343
|
-
__privateMethod(this, _TimePicker_instances, updateValueDueToUserInteraction_fn).call(this, "");
|
|
344
|
-
return;
|
|
345
|
-
}
|
|
346
|
-
try {
|
|
347
|
-
__privateMethod(this, _TimePicker_instances, updateValueDueToUserInteraction_fn).call(this, parsePresentationTime(this._presentationValue, this._use12hClock));
|
|
348
|
-
} catch (_) {
|
|
349
|
-
return;
|
|
216
|
+
patternChanged() {
|
|
217
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
218
|
+
this.proxy.pattern = this.pattern;
|
|
219
|
+
this.validate();
|
|
350
220
|
}
|
|
351
221
|
}
|
|
352
|
-
// --- Clock button ---
|
|
353
222
|
/**
|
|
354
223
|
* @internal
|
|
355
224
|
*/
|
|
356
|
-
|
|
357
|
-
if (this.
|
|
358
|
-
|
|
359
|
-
formatPresentationTime(
|
|
360
|
-
this.value,
|
|
361
|
-
this._displaySeconds,
|
|
362
|
-
this._use12hClock
|
|
363
|
-
)
|
|
364
|
-
);
|
|
225
|
+
sizeChanged() {
|
|
226
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
227
|
+
this.proxy.size = this.size;
|
|
365
228
|
}
|
|
366
|
-
return this.locale.timePicker.chooseTimeLabel;
|
|
367
229
|
}
|
|
368
230
|
/**
|
|
369
231
|
* @internal
|
|
370
232
|
*/
|
|
371
|
-
|
|
372
|
-
if (this.
|
|
373
|
-
this.
|
|
374
|
-
} else {
|
|
375
|
-
__privateMethod(this, _TimePicker_instances, openPopupIfPossible_fn).call(this);
|
|
376
|
-
vividElement.DOM.processUpdates();
|
|
377
|
-
this._inlineTimePickerEl.scrollSelectedOptionsToTop();
|
|
378
|
-
__privateGet(this, _getFocusableEls).call(this)[0].focus();
|
|
233
|
+
spellcheckChanged() {
|
|
234
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
235
|
+
this.proxy.spellcheck = this.spellcheck;
|
|
379
236
|
}
|
|
380
237
|
}
|
|
381
|
-
// --- Inline time picker ---
|
|
382
238
|
/**
|
|
383
|
-
*
|
|
239
|
+
* Selects all the text in the text field
|
|
240
|
+
*
|
|
241
|
+
* @public
|
|
384
242
|
*/
|
|
385
|
-
|
|
386
|
-
|
|
243
|
+
select() {
|
|
244
|
+
this.control.select();
|
|
387
245
|
}
|
|
388
246
|
/**
|
|
247
|
+
* Handles the internal control's `input` event
|
|
389
248
|
* @internal
|
|
390
249
|
*/
|
|
391
|
-
|
|
392
|
-
this.
|
|
250
|
+
handleTextInput() {
|
|
251
|
+
this.value = this.control.value;
|
|
393
252
|
}
|
|
394
|
-
// --- Dialog footer ---
|
|
395
253
|
/**
|
|
254
|
+
* Change event handler for inner control.
|
|
255
|
+
* @remarks
|
|
256
|
+
* "Change" events are not `composable` so they will not
|
|
257
|
+
* permeate the shadow DOM boundary. This fn effectively proxies
|
|
258
|
+
* the change event, emitting a `change` event whenever the internal
|
|
259
|
+
* control emits a `change` event
|
|
396
260
|
* @internal
|
|
397
261
|
*/
|
|
398
|
-
|
|
399
|
-
this
|
|
262
|
+
handleChange() {
|
|
263
|
+
this.$emit("change");
|
|
400
264
|
}
|
|
401
|
-
/**
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
_onClearClick() {
|
|
405
|
-
__privateMethod(this, _TimePicker_instances, updateValueDueToUserInteraction_fn).call(this, "");
|
|
406
|
-
this._closePopup();
|
|
265
|
+
/** {@inheritDoc (FormAssociated:interface).validate} */
|
|
266
|
+
validate() {
|
|
267
|
+
super.validate(this.control);
|
|
407
268
|
}
|
|
408
|
-
// --- Validation ---
|
|
409
269
|
/**
|
|
410
270
|
* @internal
|
|
411
271
|
*/
|
|
412
|
-
|
|
413
|
-
if (this.
|
|
414
|
-
this.
|
|
272
|
+
labelChanged() {
|
|
273
|
+
if (this._labelEl) {
|
|
274
|
+
__privateMethod(this, _TextField_instances, handleLabelChange_fn).call(this, this._labelEl);
|
|
415
275
|
}
|
|
416
|
-
|
|
276
|
+
}
|
|
277
|
+
connectedCallback() {
|
|
278
|
+
super.connectedCallback();
|
|
279
|
+
this.proxy.setAttribute("type", this.type);
|
|
280
|
+
this.validate();
|
|
281
|
+
if (this.autofocus) {
|
|
282
|
+
vividElement.DOM.queueUpdate(() => {
|
|
283
|
+
this.focus();
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
if (!this.control) {
|
|
287
|
+
const uniqueId = this.id || generateRandomId();
|
|
288
|
+
const controlId = `vvd-text-field-control-${uniqueId}`;
|
|
289
|
+
const helperTextId = `vvd-text-field-helper-text-${uniqueId}`;
|
|
290
|
+
const input = document.createElement("input");
|
|
291
|
+
input.slot = "_control";
|
|
292
|
+
input.id = controlId;
|
|
293
|
+
input.className = safariWorkaroundClassName;
|
|
294
|
+
this.control = input;
|
|
295
|
+
input.addEventListener("input", () => {
|
|
296
|
+
this.handleTextInput();
|
|
297
|
+
});
|
|
298
|
+
input.addEventListener("change", () => {
|
|
299
|
+
this.handleChange();
|
|
300
|
+
});
|
|
301
|
+
input.addEventListener("blur", () => {
|
|
302
|
+
this.$emit("blur", void 0, { bubbles: false });
|
|
303
|
+
});
|
|
304
|
+
input.addEventListener("focus", () => {
|
|
305
|
+
this.$emit("focus", void 0, { bubbles: false });
|
|
306
|
+
});
|
|
307
|
+
this.appendChild(input);
|
|
308
|
+
const label = document.createElement("label");
|
|
309
|
+
label.slot = "_label";
|
|
310
|
+
label.htmlFor = controlId;
|
|
311
|
+
this._labelEl = label;
|
|
312
|
+
__privateMethod(this, _TextField_instances, handleLabelChange_fn).call(this, label);
|
|
313
|
+
__privateSet(this, _helperTextMirrorEl, document.createElement("div"));
|
|
314
|
+
__privateGet(this, _helperTextMirrorEl).id = helperTextId;
|
|
315
|
+
__privateGet(this, _helperTextMirrorEl).slot = "_mirrored-helper-text";
|
|
316
|
+
__privateMethod(this, _TextField_instances, updateMirroredHelperText_fn).call(this);
|
|
317
|
+
this.appendChild(__privateGet(this, _helperTextMirrorEl));
|
|
318
|
+
installSafariWorkaroundStyle(this);
|
|
319
|
+
}
|
|
320
|
+
__privateSet(this, _reflectToInput, new Reflector.Reflector(this, this.control));
|
|
321
|
+
__privateGet(this, _reflectToInput).booleanAttribute("autofocus", "autofocus");
|
|
322
|
+
__privateGet(this, _reflectToInput).booleanAttribute("disabled", "disabled");
|
|
323
|
+
__privateGet(this, _reflectToInput).booleanAttribute("readOnly", "readonly");
|
|
324
|
+
__privateGet(this, _reflectToInput).booleanAttribute("required", "required");
|
|
325
|
+
__privateGet(this, _reflectToInput).booleanAttribute("spellcheck", "spellcheck");
|
|
326
|
+
__privateGet(this, _reflectToInput).attribute("list", "list");
|
|
327
|
+
__privateGet(this, _reflectToInput).attribute("maxlength", "maxlength");
|
|
328
|
+
__privateGet(this, _reflectToInput).attribute("minlength", "minlength");
|
|
329
|
+
__privateGet(this, _reflectToInput).attribute("pattern", "pattern");
|
|
330
|
+
__privateGet(this, _reflectToInput).attribute("placeholder", "placeholder");
|
|
331
|
+
__privateGet(this, _reflectToInput).attribute("size", "size");
|
|
332
|
+
__privateGet(this, _reflectToInput).attribute("autoComplete", "autocomplete");
|
|
333
|
+
__privateGet(this, _reflectToInput).attribute("type", "type");
|
|
334
|
+
__privateGet(this, _reflectToInput).attribute("inputMode", "inputmode");
|
|
335
|
+
__privateGet(this, _reflectToInput).attribute("ariaAtomic", "aria-atomic");
|
|
336
|
+
__privateGet(this, _reflectToInput).attribute("ariaBusy", "aria-busy");
|
|
337
|
+
__privateGet(this, _reflectToInput).attribute("ariaCurrent", "aria-current");
|
|
338
|
+
__privateGet(this, _reflectToInput).attribute("ariaDisabled", "aria-disabled");
|
|
339
|
+
__privateGet(this, _reflectToInput).attribute("ariaHasPopup", "aria-haspopup");
|
|
340
|
+
__privateGet(this, _reflectToInput).attribute("ariaHidden", "aria-hidden");
|
|
341
|
+
__privateGet(this, _reflectToInput).attribute("ariaInvalid", "aria-invalid");
|
|
342
|
+
__privateGet(this, _reflectToInput).attribute("ariaKeyShortcuts", "aria-keyshortcuts");
|
|
343
|
+
__privateGet(this, _reflectToInput).attribute("ariaLabel", "aria-label");
|
|
344
|
+
__privateGet(this, _reflectToInput).attribute("ariaLive", "aria-live");
|
|
345
|
+
__privateGet(this, _reflectToInput).attribute("ariaRelevant", "aria-relevant");
|
|
346
|
+
__privateGet(this, _reflectToInput).attribute(
|
|
347
|
+
"ariaRoleDescription",
|
|
348
|
+
"aria-roledescription"
|
|
349
|
+
);
|
|
350
|
+
__privateGet(this, _reflectToInput).property("value", "value", true);
|
|
351
|
+
__privateMethod(this, _TextField_instances, updateHelperTextMutationObserver_fn).call(this);
|
|
352
|
+
}
|
|
353
|
+
disconnectedCallback() {
|
|
354
|
+
super.disconnectedCallback();
|
|
355
|
+
__privateGet(this, _reflectToInput).destroy();
|
|
356
|
+
__privateSet(this, _reflectToInput, void 0);
|
|
357
|
+
__privateMethod(this, _TextField_instances, updateHelperTextMutationObserver_fn).call(this);
|
|
358
|
+
}
|
|
359
|
+
focus() {
|
|
360
|
+
this.control?.focus();
|
|
417
361
|
}
|
|
418
362
|
/**
|
|
419
363
|
* @internal
|
|
420
364
|
*/
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
return this.locale.timePicker.invalidTimeError;
|
|
424
|
-
}
|
|
425
|
-
return null;
|
|
365
|
+
helperTextChanged() {
|
|
366
|
+
__privateMethod(this, _TextField_instances, updateMirroredHelperText_fn).call(this);
|
|
426
367
|
}
|
|
427
368
|
/**
|
|
428
369
|
* @internal
|
|
429
370
|
*/
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
}
|
|
434
|
-
try {
|
|
435
|
-
parsePresentationTime(this._presentationValue, this._use12hClock);
|
|
436
|
-
return false;
|
|
437
|
-
} catch (_) {
|
|
438
|
-
return true;
|
|
439
|
-
}
|
|
371
|
+
_helperTextSlottedContentChanged() {
|
|
372
|
+
__privateMethod(this, _TextField_instances, updateMirroredHelperText_fn).call(this);
|
|
373
|
+
__privateMethod(this, _TextField_instances, updateHelperTextMutationObserver_fn).call(this);
|
|
440
374
|
}
|
|
441
375
|
};
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
};
|
|
451
|
-
_onFocusIn = new WeakMap();
|
|
452
|
-
_onFocusOut = new WeakMap();
|
|
453
|
-
_dismissOnClickOutside = new WeakMap();
|
|
454
|
-
openPopupIfPossible_fn = function() {
|
|
455
|
-
if (!this.readOnly) {
|
|
456
|
-
this._popupOpen = true;
|
|
457
|
-
}
|
|
458
|
-
};
|
|
459
|
-
__decorateClass$1([
|
|
460
|
-
vividElement.attr({ attribute: "readonly", mode: "boolean" })
|
|
461
|
-
], exports.TimePicker.prototype, "readOnly", 2);
|
|
462
|
-
__decorateClass$1([
|
|
463
|
-
vividElement.attr({ attribute: "minutes-step", converter: vividElement.nullableNumberConverter })
|
|
464
|
-
], exports.TimePicker.prototype, "minutesStep", 2);
|
|
465
|
-
__decorateClass$1([
|
|
466
|
-
vividElement.attr({ attribute: "seconds-step", converter: vividElement.nullableNumberConverter })
|
|
467
|
-
], exports.TimePicker.prototype, "secondsStep", 2);
|
|
468
|
-
__decorateClass$1([
|
|
469
|
-
vividElement.attr
|
|
470
|
-
], exports.TimePicker.prototype, "clock", 2);
|
|
471
|
-
__decorateClass$1([
|
|
472
|
-
vividElement.attr({ converter: ValidTimeFilter })
|
|
473
|
-
], exports.TimePicker.prototype, "min", 2);
|
|
474
|
-
__decorateClass$1([
|
|
475
|
-
vividElement.attr({ converter: ValidTimeFilter })
|
|
476
|
-
], exports.TimePicker.prototype, "max", 2);
|
|
477
|
-
__decorateClass$1([
|
|
478
|
-
vividElement.volatile
|
|
479
|
-
], exports.TimePicker.prototype, "_use12hClock", 1);
|
|
480
|
-
__decorateClass$1([
|
|
481
|
-
vividElement.observable
|
|
482
|
-
], exports.TimePicker.prototype, "_popupOpen", 2);
|
|
483
|
-
__decorateClass$1([
|
|
484
|
-
vividElement.observable
|
|
485
|
-
], exports.TimePicker.prototype, "_presentationValue", 2);
|
|
486
|
-
exports.TimePicker = __decorateClass$1([
|
|
487
|
-
formElements.errorText,
|
|
488
|
-
formElements.formElements
|
|
489
|
-
], exports.TimePicker);
|
|
490
|
-
applyMixinsWithObservables.applyMixinsWithObservables(
|
|
491
|
-
exports.TimePicker,
|
|
492
|
-
localized.Localized,
|
|
493
|
-
formElements.FormElementHelperText,
|
|
494
|
-
trappedFocus.TrappedFocus
|
|
495
|
-
);
|
|
496
|
-
|
|
497
|
-
const fallsIntoMeridiem = (meridiem, hour) => meridiem === "AM" && hour < 12 || meridiem === "PM" && hour >= 12;
|
|
498
|
-
const getHoursOptions = (min, max, forMeridiem) => {
|
|
499
|
-
const result = [];
|
|
500
|
-
const minHour = min ? parseTimeStr(min).hours : 0;
|
|
501
|
-
const maxHour = max ? parseTimeStr(max).hours : 23;
|
|
502
|
-
for (let i = minHour; i <= maxHour; i++) {
|
|
503
|
-
if (forMeridiem && !fallsIntoMeridiem(forMeridiem, i)) {
|
|
504
|
-
continue;
|
|
505
|
-
}
|
|
506
|
-
result.push({
|
|
507
|
-
value: formatTimePart(i),
|
|
508
|
-
label: formatTimePart(forMeridiem ? hoursAs12hClock(i) : i)
|
|
509
|
-
});
|
|
510
|
-
}
|
|
511
|
-
return result;
|
|
512
|
-
};
|
|
513
|
-
const getMinutesOptions = (step, value, min, max) => {
|
|
514
|
-
const result = [];
|
|
515
|
-
let minMinute = 0;
|
|
516
|
-
let maxMinute = 59;
|
|
517
|
-
if (min) {
|
|
518
|
-
const { hourStr: minHourStr, minutes: minMinutes } = parseTimeStr(min);
|
|
519
|
-
if (value && parseTimeStr(value).hourStr === minHourStr) {
|
|
520
|
-
minMinute = minMinutes;
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
if (max) {
|
|
524
|
-
const { hourStr: maxHourStr, minutes: maxMinutes } = parseTimeStr(max);
|
|
525
|
-
if (value && parseTimeStr(value).hourStr === maxHourStr) {
|
|
526
|
-
maxMinute = maxMinutes;
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
for (let i = minMinute; i <= maxMinute; i += Math.max(1, step ?? 1)) {
|
|
530
|
-
const minutes = formatTimePart(i);
|
|
531
|
-
result.push({
|
|
532
|
-
value: minutes,
|
|
533
|
-
label: minutes
|
|
534
|
-
});
|
|
535
|
-
}
|
|
536
|
-
return result;
|
|
537
|
-
};
|
|
538
|
-
const getSecondsOptions = (step, value, min, max) => {
|
|
539
|
-
const result = [];
|
|
540
|
-
let minSecond = 0;
|
|
541
|
-
let maxSecond = 59;
|
|
542
|
-
if (min) {
|
|
543
|
-
const minTime = parseTimeStr(min);
|
|
544
|
-
if (value && (parseTimeStr(value).hourStr === minTime.hourStr && parseTimeStr(value).minuteStr) === minTime.minuteStr) {
|
|
545
|
-
minSecond = minTime.seconds;
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
if (max) {
|
|
549
|
-
const maxTime = parseTimeStr(max);
|
|
550
|
-
if (value && (parseTimeStr(value).hourStr === maxTime.hourStr && parseTimeStr(value).minuteStr) === maxTime.minuteStr) {
|
|
551
|
-
maxSecond = maxTime.seconds;
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
for (let i = minSecond; i <= maxSecond; i += Math.max(1, step)) {
|
|
555
|
-
const seconds = formatTimePart(i);
|
|
556
|
-
result.push({
|
|
557
|
-
value: seconds,
|
|
558
|
-
label: seconds
|
|
559
|
-
});
|
|
560
|
-
}
|
|
561
|
-
return result;
|
|
562
|
-
};
|
|
563
|
-
const getMeridiesOptions = (min, max) => {
|
|
564
|
-
const result = [];
|
|
565
|
-
const hideAM = min ? parseTimeStr(min).meridiem === "PM" : false;
|
|
566
|
-
if (!hideAM) {
|
|
567
|
-
result.push({
|
|
568
|
-
value: "AM",
|
|
569
|
-
label: "AM"
|
|
570
|
-
});
|
|
571
|
-
}
|
|
572
|
-
const hidePM = max ? parseTimeStr(max).meridiem === "AM" : false;
|
|
573
|
-
if (!hidePM) {
|
|
574
|
-
result.push({
|
|
575
|
-
value: "PM",
|
|
576
|
-
label: "PM"
|
|
577
|
-
});
|
|
578
|
-
}
|
|
579
|
-
return result;
|
|
580
|
-
};
|
|
581
|
-
|
|
582
|
-
const HoursColumn = {
|
|
583
|
-
id: "hours",
|
|
584
|
-
getLabel: (x) => x.locale.timePicker.hoursLabel,
|
|
585
|
-
getOptions: (x) => getHoursOptions(
|
|
586
|
-
x.min,
|
|
587
|
-
x.max,
|
|
588
|
-
x.clock === "12h" ? MeridiesColumn.getSelectedOptionValue(x) ?? MeridiesColumn.getOptions(x)[0].value : void 0
|
|
589
|
-
),
|
|
590
|
-
getSelectedOptionValue: (x) => x.value ? parseTimeStr(x.value).hourStr : void 0,
|
|
591
|
-
updatedValue: (x, optionValue) => {
|
|
592
|
-
if (x.value) {
|
|
593
|
-
const { minuteStr, secondStr } = parseTimeStr(x.value);
|
|
594
|
-
return `${optionValue}:${minuteStr}:${secondStr}`;
|
|
595
|
-
} else {
|
|
596
|
-
return `${optionValue}:00:00`;
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
};
|
|
600
|
-
const MinutesColumn = {
|
|
601
|
-
id: "minutes",
|
|
602
|
-
getLabel: (x) => x.locale.timePicker.minutesLabel,
|
|
603
|
-
getOptions: (x) => getMinutesOptions(x.minutesStep, x.value, x.min, x.max),
|
|
604
|
-
getSelectedOptionValue: (x) => x.value ? parseTimeStr(x.value).minuteStr : void 0,
|
|
605
|
-
updatedValue: (x, optionValue) => {
|
|
606
|
-
if (x.value) {
|
|
607
|
-
const { hourStr, secondStr } = parseTimeStr(x.value);
|
|
608
|
-
return `${hourStr}:${optionValue}:${secondStr}`;
|
|
609
|
-
} else {
|
|
610
|
-
return `00:${optionValue}:00`;
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
};
|
|
614
|
-
const SecondsColumn = {
|
|
615
|
-
id: "seconds",
|
|
616
|
-
getLabel: (x) => x.locale.timePicker.secondsLabel,
|
|
617
|
-
getOptions: (x) => getSecondsOptions(x.secondsStep, x.value, x.min, x.max),
|
|
618
|
-
getSelectedOptionValue: (x) => x.value ? parseTimeStr(x.value).secondStr : void 0,
|
|
619
|
-
updatedValue: (x, optionValue) => {
|
|
620
|
-
if (x.value) {
|
|
621
|
-
const { hourStr, minuteStr } = parseTimeStr(x.value);
|
|
622
|
-
return `${hourStr}:${minuteStr}:${optionValue}`;
|
|
623
|
-
} else {
|
|
624
|
-
return `00:00:${optionValue}`;
|
|
376
|
+
_TextField_instances = new WeakSet();
|
|
377
|
+
handleLabelChange_fn = function(labelEl) {
|
|
378
|
+
if (!this.label) {
|
|
379
|
+
labelEl.remove();
|
|
380
|
+
} else {
|
|
381
|
+
labelEl.textContent = this.label;
|
|
382
|
+
if (!labelEl.isConnected) {
|
|
383
|
+
this.appendChild(labelEl);
|
|
625
384
|
}
|
|
626
385
|
}
|
|
627
386
|
};
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
adjustedHours -= 12;
|
|
639
|
-
} else if (optionValue === "PM" && hours < 12) {
|
|
640
|
-
adjustedHours += 12;
|
|
641
|
-
}
|
|
642
|
-
return `${formatTimePart(adjustedHours)}:${minuteStr}:${secondStr}`;
|
|
643
|
-
} else {
|
|
644
|
-
if (optionValue === "AM") {
|
|
645
|
-
return "00:00:00";
|
|
646
|
-
} else {
|
|
647
|
-
return "12:00:00";
|
|
387
|
+
_reflectToInput = new WeakMap();
|
|
388
|
+
_helperTextMirrorEl = new WeakMap();
|
|
389
|
+
_helperTextSlotMutationObserver = new WeakMap();
|
|
390
|
+
updateHelperTextMutationObserver_fn = function() {
|
|
391
|
+
const usesHelperTextSlot = this._helperTextSlottedContent.length;
|
|
392
|
+
const shouldHaveMutationObserver = usesHelperTextSlot && this.isConnected;
|
|
393
|
+
if (shouldHaveMutationObserver && !__privateGet(this, _helperTextSlotMutationObserver)) {
|
|
394
|
+
__privateSet(this, _helperTextSlotMutationObserver, new MutationObserver((records) => {
|
|
395
|
+
if (records.some((record) => record.target !== __privateGet(this, _helperTextMirrorEl))) {
|
|
396
|
+
__privateMethod(this, _TextField_instances, updateMirroredHelperText_fn).call(this);
|
|
648
397
|
}
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
const shouldDisplay12hClock = (x) => x.clock === "12h";
|
|
655
|
-
const onPickerOptionClick = (x, column, optionValue) => {
|
|
656
|
-
emitChange(x, column.updatedValue(x, optionValue));
|
|
657
|
-
scrollToOption(x, column.id, optionValue, "start");
|
|
658
|
-
const nextPickerEl = x.shadowRoot.querySelector(
|
|
659
|
-
`#${column.id} + .picker`
|
|
660
|
-
);
|
|
661
|
-
if (nextPickerEl) {
|
|
662
|
-
nextPickerEl.focus();
|
|
663
|
-
} else {
|
|
664
|
-
x.$emit("last-column-selected", void 0, {
|
|
665
|
-
bubbles: false
|
|
398
|
+
}));
|
|
399
|
+
__privateGet(this, _helperTextSlotMutationObserver).observe(this, {
|
|
400
|
+
subtree: true,
|
|
401
|
+
childList: true,
|
|
402
|
+
characterData: true
|
|
666
403
|
});
|
|
667
404
|
}
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
const selectedValue = column.getSelectedOptionValue(x);
|
|
672
|
-
const offset = {
|
|
673
|
-
ArrowUp: -1,
|
|
674
|
-
ArrowDown: 1
|
|
675
|
-
}[event.key];
|
|
676
|
-
if (offset) {
|
|
677
|
-
event.preventDefault();
|
|
678
|
-
const index = options.findIndex((h) => h.value === selectedValue);
|
|
679
|
-
const newRawIndex = index === -1 ? 0 : index + offset;
|
|
680
|
-
const newIndex = (newRawIndex + options.length) % options.length;
|
|
681
|
-
const newValue = options[newIndex].value;
|
|
682
|
-
emitChange(x, column.updatedValue(x, newValue));
|
|
683
|
-
scrollToOption(x, column.id, newValue, "nearest");
|
|
684
|
-
}
|
|
685
|
-
return true;
|
|
686
|
-
};
|
|
687
|
-
const scrollToOption = (x, picker, optionValue, position) => {
|
|
688
|
-
const element = x.shadowRoot.querySelector(
|
|
689
|
-
`#${picker}-${optionValue}`
|
|
690
|
-
);
|
|
691
|
-
if (!element) {
|
|
692
|
-
return;
|
|
405
|
+
if (!shouldHaveMutationObserver && __privateGet(this, _helperTextSlotMutationObserver)) {
|
|
406
|
+
__privateGet(this, _helperTextSlotMutationObserver).disconnect();
|
|
407
|
+
__privateSet(this, _helperTextSlotMutationObserver, void 0);
|
|
693
408
|
}
|
|
694
|
-
scrollIntoView.scrollIntoView(element, element.parentElement, position);
|
|
695
409
|
};
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
x.$emit("change", time, { bubbles: false, composed: false });
|
|
708
|
-
};
|
|
709
|
-
const renderPicker = (column) => {
|
|
710
|
-
return vividElement.html`<ul
|
|
711
|
-
id="${column.id}"
|
|
712
|
-
class="picker"
|
|
713
|
-
role="listbox"
|
|
714
|
-
tabindex="0"
|
|
715
|
-
aria-label="${column.getLabel}"
|
|
716
|
-
aria-activedescendant="${(x) => column.getSelectedOptionValue(x) ? `${column.id}-${column.getSelectedOptionValue(x)}` : void 0}"
|
|
717
|
-
@keydown="${(x, c) => onPickerKeyDown(x, column, c.event)}"
|
|
718
|
-
>
|
|
719
|
-
${repeat.repeat(
|
|
720
|
-
(x) => column.getOptions(x),
|
|
721
|
-
vividElement.html`<li
|
|
722
|
-
id="${(x) => `${column.id}-${x.value}`}"
|
|
723
|
-
class="${(x, c) => classNames.classNames("option", [
|
|
724
|
-
"selected",
|
|
725
|
-
column.getSelectedOptionValue(c.parent) === x.value
|
|
726
|
-
])}"
|
|
727
|
-
aria-selected="${(x, c) => column.getSelectedOptionValue(c.parent) === x.value}"
|
|
728
|
-
role="option"
|
|
729
|
-
@click="${(x, c) => onPickerOptionClick(c.parent, column, x.value)}"
|
|
730
|
-
>
|
|
731
|
-
${(x) => x.label}
|
|
732
|
-
</li>`
|
|
733
|
-
)}
|
|
734
|
-
</ul>`;
|
|
735
|
-
};
|
|
736
|
-
const InlineTimePickerTemplate = () => {
|
|
737
|
-
return vividElement.html`<div
|
|
738
|
-
class="time-pickers"
|
|
739
|
-
@keydown="${(x, { event }) => onBaseKeyDown(x, event)}"
|
|
740
|
-
>
|
|
741
|
-
${renderPicker(HoursColumn)} ${renderPicker(MinutesColumn)}
|
|
742
|
-
${when.when(shouldDisplaySecondsPicker, renderPicker(SecondsColumn))}
|
|
743
|
-
${when.when(shouldDisplay12hClock, renderPicker(MeridiesColumn))}
|
|
744
|
-
</div>`;
|
|
745
|
-
};
|
|
746
|
-
|
|
747
|
-
var __defProp = Object.defineProperty;
|
|
748
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
749
|
-
var result = void 0 ;
|
|
750
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
751
|
-
if (decorator = decorators[i])
|
|
752
|
-
result = (decorator(target, key, result) ) || result;
|
|
753
|
-
if (result) __defProp(target, key, result);
|
|
754
|
-
return result;
|
|
755
|
-
};
|
|
756
|
-
class InlineTimePicker extends vividElement.VividElement {
|
|
757
|
-
constructor() {
|
|
758
|
-
super(...arguments);
|
|
759
|
-
this.minutesStep = 1;
|
|
760
|
-
this.clock = "24h";
|
|
761
|
-
}
|
|
762
|
-
valueChanged(_, newValue) {
|
|
763
|
-
if (newValue !== void 0 && !isValidTimeStr(newValue)) {
|
|
764
|
-
this.value = void 0;
|
|
765
|
-
}
|
|
766
|
-
}
|
|
767
|
-
scrollSelectedOptionsToTop() {
|
|
768
|
-
if (HoursColumn.getSelectedOptionValue(this)) {
|
|
769
|
-
scrollToOption(
|
|
770
|
-
this,
|
|
771
|
-
"hours",
|
|
772
|
-
HoursColumn.getSelectedOptionValue(this),
|
|
773
|
-
"start"
|
|
774
|
-
);
|
|
775
|
-
}
|
|
776
|
-
if (MinutesColumn.getSelectedOptionValue(this)) {
|
|
777
|
-
scrollToOption(
|
|
778
|
-
this,
|
|
779
|
-
"minutes",
|
|
780
|
-
MinutesColumn.getSelectedOptionValue(this),
|
|
781
|
-
"start"
|
|
782
|
-
);
|
|
783
|
-
}
|
|
784
|
-
if (shouldDisplaySecondsPicker(this) && SecondsColumn.getSelectedOptionValue(this)) {
|
|
785
|
-
scrollToOption(
|
|
786
|
-
this,
|
|
787
|
-
"seconds",
|
|
788
|
-
SecondsColumn.getSelectedOptionValue(this),
|
|
789
|
-
"start"
|
|
790
|
-
);
|
|
791
|
-
}
|
|
792
|
-
if (shouldDisplay12hClock(this) && MeridiesColumn.getSelectedOptionValue(this)) {
|
|
793
|
-
scrollToOption(
|
|
794
|
-
this,
|
|
795
|
-
"meridies",
|
|
796
|
-
MeridiesColumn.getSelectedOptionValue(this),
|
|
797
|
-
"start"
|
|
410
|
+
updateMirroredHelperText_fn = function() {
|
|
411
|
+
let helperText = this.helperText ?? "";
|
|
412
|
+
if (this._helperTextSlottedContent?.length) {
|
|
413
|
+
helperText = this._helperTextSlottedContent.map((node) => node.innerText).join(" ");
|
|
414
|
+
}
|
|
415
|
+
if (__privateGet(this, _helperTextMirrorEl)) {
|
|
416
|
+
__privateGet(this, _helperTextMirrorEl).textContent = helperText;
|
|
417
|
+
if (helperText) {
|
|
418
|
+
this.control.setAttribute(
|
|
419
|
+
"aria-describedby",
|
|
420
|
+
__privateGet(this, _helperTextMirrorEl).id
|
|
798
421
|
);
|
|
422
|
+
} else {
|
|
423
|
+
this.control.removeAttribute("aria-describedby");
|
|
799
424
|
}
|
|
800
425
|
}
|
|
801
|
-
|
|
802
|
-
const firstFocusableElement = this.shadowRoot.querySelector(
|
|
803
|
-
".picker"
|
|
804
|
-
);
|
|
805
|
-
firstFocusableElement.focus(options);
|
|
806
|
-
}
|
|
807
|
-
}
|
|
426
|
+
};
|
|
808
427
|
__decorateClass([
|
|
809
|
-
vividElement.
|
|
810
|
-
],
|
|
428
|
+
vividElement.attr({ attribute: "readonly", mode: "boolean" })
|
|
429
|
+
], exports.TextField.prototype, "readOnly", 2);
|
|
811
430
|
__decorateClass([
|
|
812
|
-
vividElement.
|
|
813
|
-
],
|
|
431
|
+
vividElement.attr({ mode: "boolean" })
|
|
432
|
+
], exports.TextField.prototype, "autofocus", 2);
|
|
814
433
|
__decorateClass([
|
|
815
|
-
vividElement.
|
|
816
|
-
],
|
|
434
|
+
vividElement.attr
|
|
435
|
+
], exports.TextField.prototype, "placeholder", 2);
|
|
817
436
|
__decorateClass([
|
|
818
|
-
vividElement.
|
|
819
|
-
],
|
|
437
|
+
vividElement.attr
|
|
438
|
+
], exports.TextField.prototype, "type", 2);
|
|
439
|
+
__decorateClass([
|
|
440
|
+
vividElement.attr
|
|
441
|
+
], exports.TextField.prototype, "list", 2);
|
|
442
|
+
__decorateClass([
|
|
443
|
+
vividElement.attr({ converter: vividElement.nullableNumberConverter })
|
|
444
|
+
], exports.TextField.prototype, "maxlength", 2);
|
|
445
|
+
__decorateClass([
|
|
446
|
+
vividElement.attr({ converter: vividElement.nullableNumberConverter })
|
|
447
|
+
], exports.TextField.prototype, "minlength", 2);
|
|
448
|
+
__decorateClass([
|
|
449
|
+
vividElement.attr
|
|
450
|
+
], exports.TextField.prototype, "pattern", 2);
|
|
451
|
+
__decorateClass([
|
|
452
|
+
vividElement.attr({ converter: vividElement.nullableNumberConverter })
|
|
453
|
+
], exports.TextField.prototype, "size", 2);
|
|
454
|
+
__decorateClass([
|
|
455
|
+
vividElement.attr({ mode: "boolean" })
|
|
456
|
+
], exports.TextField.prototype, "spellcheck", 2);
|
|
457
|
+
__decorateClass([
|
|
458
|
+
vividElement.attr
|
|
459
|
+
], exports.TextField.prototype, "appearance", 2);
|
|
460
|
+
__decorateClass([
|
|
461
|
+
vividElement.attr
|
|
462
|
+
], exports.TextField.prototype, "shape", 2);
|
|
463
|
+
__decorateClass([
|
|
464
|
+
vividElement.attr
|
|
465
|
+
], exports.TextField.prototype, "autoComplete", 2);
|
|
466
|
+
__decorateClass([
|
|
467
|
+
vividElement.attr()
|
|
468
|
+
], exports.TextField.prototype, "scale", 2);
|
|
469
|
+
__decorateClass([
|
|
470
|
+
vividElement.attr({ attribute: "inputmode" })
|
|
471
|
+
], exports.TextField.prototype, "inputMode", 2);
|
|
820
472
|
__decorateClass([
|
|
821
473
|
vividElement.observable
|
|
822
|
-
],
|
|
474
|
+
], exports.TextField.prototype, "actionItemsSlottedContent", 2);
|
|
823
475
|
__decorateClass([
|
|
824
476
|
vividElement.observable
|
|
825
|
-
],
|
|
826
|
-
|
|
477
|
+
], exports.TextField.prototype, "leadingActionItemsSlottedContent", 2);
|
|
478
|
+
exports.TextField = __decorateClass([
|
|
479
|
+
formElements.errorText,
|
|
480
|
+
formElements.formElements
|
|
481
|
+
], exports.TextField);
|
|
482
|
+
applyMixinsWithObservables.applyMixinsWithObservables(
|
|
483
|
+
exports.TextField,
|
|
484
|
+
affix.AffixIcon,
|
|
485
|
+
formElements.FormElementCharCount,
|
|
486
|
+
formElements.FormElementHelperText,
|
|
487
|
+
formElements.FormElementSuccessText
|
|
488
|
+
);
|
|
827
489
|
|
|
828
|
-
const
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
490
|
+
const getStateClasses = ({
|
|
491
|
+
errorValidationMessage,
|
|
492
|
+
disabled,
|
|
493
|
+
value,
|
|
494
|
+
readOnly,
|
|
495
|
+
placeholder,
|
|
496
|
+
appearance,
|
|
497
|
+
shape,
|
|
498
|
+
label,
|
|
499
|
+
successText,
|
|
500
|
+
actionItemsSlottedContent,
|
|
501
|
+
leadingActionItemsSlottedContent,
|
|
502
|
+
icon,
|
|
503
|
+
scale
|
|
504
|
+
}) => classNames.classNames(
|
|
505
|
+
["error", Boolean(errorValidationMessage)],
|
|
506
|
+
["disabled", disabled],
|
|
507
|
+
["has-value", Boolean(value)],
|
|
508
|
+
["readonly", readOnly],
|
|
509
|
+
["placeholder", Boolean(placeholder)],
|
|
510
|
+
[`appearance-${appearance}`, Boolean(appearance)],
|
|
511
|
+
[`shape-${shape}`, Boolean(shape)],
|
|
512
|
+
["no-label", !label],
|
|
513
|
+
["has-icon", !!icon],
|
|
514
|
+
["success", Boolean(successText)],
|
|
515
|
+
["action-items", !!actionItemsSlottedContent?.length],
|
|
516
|
+
["leading-action-items", !!leadingActionItemsSlottedContent?.length],
|
|
517
|
+
["no-leading", !(leadingActionItemsSlottedContent?.length || icon)],
|
|
518
|
+
[`size-${scale}`, Boolean(scale)]
|
|
519
|
+
);
|
|
520
|
+
function renderCharCount() {
|
|
521
|
+
return vividElement.html`
|
|
522
|
+
<span class="char-count"
|
|
523
|
+
>${(x) => x.value ? x.value.length : 0} / ${(x) => x.maxlength}</span
|
|
846
524
|
>
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
)} aria-modal="true" aria-label="${(x) => x.locale.timePicker.chooseTimeLabel}">
|
|
872
|
-
<${inlineTimePickerTag}
|
|
873
|
-
id="inline-time-picker"
|
|
874
|
-
${ref.ref("_inlineTimePickerEl")}
|
|
875
|
-
:value="${(x) => x.value || void 0}"
|
|
876
|
-
:clock="${(x) => x._use12hClock ? "12h" : "24h"}"
|
|
877
|
-
:min="${(x) => x.min || void 0}"
|
|
878
|
-
:max="${(x) => x.max || void 0}"
|
|
879
|
-
:minutesStep="${(x) => x.minutesStep ?? 1}"
|
|
880
|
-
:secondsStep="${(x) => x.secondsStep ?? void 0}"
|
|
881
|
-
@change="${(x, c) => x._onInlineTimePickerChange(c.event)}"
|
|
882
|
-
@last-column-selected="${(x) => x._onInlineTimePickerLastColumnSelected()}"
|
|
883
|
-
>
|
|
884
|
-
</${inlineTimePickerTag}>
|
|
885
|
-
<div class="footer">
|
|
886
|
-
<${buttonTag}
|
|
887
|
-
class="vwc-button"
|
|
888
|
-
size="condensed"
|
|
889
|
-
label="${(x) => x.locale.timePicker.clearLabel}"
|
|
890
|
-
@click="${(x) => x._onClearClick()}"
|
|
891
|
-
></${buttonTag}>
|
|
892
|
-
<${buttonTag}
|
|
893
|
-
class="vwc-button"
|
|
894
|
-
size="condensed"
|
|
895
|
-
appearance="filled"
|
|
896
|
-
label="${(x) => x.locale.timePicker.okLabel}"
|
|
897
|
-
@click="${(x) => x._onOkClick()}"
|
|
898
|
-
></${buttonTag}>
|
|
525
|
+
`;
|
|
526
|
+
}
|
|
527
|
+
const TextfieldTemplate = (context) => {
|
|
528
|
+
const affixIconTemplate = affix.affixIconTemplateFactory(context);
|
|
529
|
+
return vividElement.html` <div class="base ${getStateClasses}">
|
|
530
|
+
${when.when((x) => x.charCount && x.maxlength, renderCharCount())}
|
|
531
|
+
<slot class="label" name="_label"></slot>
|
|
532
|
+
<div class="fieldset">
|
|
533
|
+
<div class="leading-items-wrapper">
|
|
534
|
+
<slot
|
|
535
|
+
name="leading-action-items"
|
|
536
|
+
${slotted.slotted("leadingActionItemsSlottedContent")}
|
|
537
|
+
></slot>
|
|
538
|
+
${(x) => affixIconTemplate(x.icon)}
|
|
539
|
+
</div>
|
|
540
|
+
|
|
541
|
+
<div class="wrapper">
|
|
542
|
+
<slot class="control" name="_control"></slot>
|
|
543
|
+
</div>
|
|
544
|
+
<div class="action-items-wrapper">
|
|
545
|
+
<slot
|
|
546
|
+
name="action-items"
|
|
547
|
+
${slotted.slotted("actionItemsSlottedContent")}
|
|
548
|
+
></slot>
|
|
899
549
|
</div>
|
|
900
550
|
</div>
|
|
901
|
-
|
|
902
|
-
|
|
551
|
+
${formElements.getFeedbackTemplate(context)}
|
|
552
|
+
</div>
|
|
553
|
+
<slot name="_mirrored-helper-text"></slot>`;
|
|
903
554
|
};
|
|
904
555
|
|
|
905
|
-
const
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
InlineTimePickerTemplate,
|
|
911
|
-
[],
|
|
912
|
-
{
|
|
913
|
-
styles,
|
|
914
|
-
shadowOptions: {
|
|
915
|
-
delegatesFocus: true
|
|
916
|
-
}
|
|
917
|
-
}
|
|
918
|
-
);
|
|
919
|
-
|
|
920
|
-
const timePickerDefinition = vividElement.defineVividComponent(
|
|
921
|
-
"time-picker",
|
|
922
|
-
exports.TimePicker,
|
|
923
|
-
TimePickerTemplate,
|
|
924
|
-
[
|
|
925
|
-
definition$2.textFieldDefinition,
|
|
926
|
-
definition.popupDefinition,
|
|
927
|
-
definition$1.buttonDefinition,
|
|
928
|
-
inlineTimePickerDefinition
|
|
929
|
-
],
|
|
556
|
+
const textFieldDefinition = vividElement.defineVividComponent(
|
|
557
|
+
"text-field",
|
|
558
|
+
exports.TextField,
|
|
559
|
+
TextfieldTemplate,
|
|
560
|
+
[definition.iconDefinition],
|
|
930
561
|
{
|
|
931
|
-
styles: styles
|
|
562
|
+
styles: textField.styles,
|
|
932
563
|
shadowOptions: {
|
|
933
564
|
delegatesFocus: true
|
|
934
565
|
}
|
|
935
566
|
}
|
|
936
567
|
);
|
|
937
|
-
const
|
|
568
|
+
const registerTextField = vividElement.createRegisterFunction(textFieldDefinition);
|
|
938
569
|
|
|
939
|
-
exports.
|
|
940
|
-
exports.
|
|
570
|
+
exports.registerTextField = registerTextField;
|
|
571
|
+
exports.textFieldDefinition = textFieldDefinition;
|