@vonage/vivid 4.5.0 → 4.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/custom-elements.json +1091 -187
- package/elevation/index.cjs +1 -1
- package/elevation/index.js +1 -1
- package/index.cjs +62 -56
- package/index.js +20 -19
- package/lib/components.d.ts +1 -0
- package/lib/menu/menu.d.ts +2 -1
- package/lib/number-field/number-field.d.ts +3 -1
- package/lib/searchable-select/definition.d.ts +4 -0
- package/lib/searchable-select/locale.d.ts +6 -0
- package/lib/searchable-select/option-tag.d.ts +14 -0
- package/lib/searchable-select/option-tag.template.d.ts +4 -0
- package/lib/searchable-select/searchable-select.d.ts +29 -0
- package/lib/searchable-select/searchable-select.form-associated.d.ts +10 -0
- package/lib/searchable-select/searchable-select.template.d.ts +4 -0
- package/lib/select/select.d.ts +3 -1
- package/lib/tab/locale.d.ts +3 -0
- package/lib/tab/tab.d.ts +5 -1
- package/lib/tag/definition.d.ts +1 -0
- package/lib/text-field/text-field.d.ts +3 -1
- package/locales/de-DE.cjs +12 -0
- package/locales/de-DE.js +12 -0
- package/locales/en-GB.cjs +12 -0
- package/locales/en-GB.js +12 -0
- package/locales/en-US.cjs +12 -0
- package/locales/en-US.js +12 -0
- package/locales/ja-JP.cjs +12 -0
- package/locales/ja-JP.js +12 -0
- package/locales/zh-CN.cjs +12 -0
- package/locales/zh-CN.js +12 -0
- package/package.json +1 -1
- package/popup/index.cjs +1 -1
- package/popup/index.js +1 -1
- package/searchable-select/index.cjs +5 -0
- package/searchable-select/index.js +3 -0
- 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/definition11.cjs +1 -1
- package/shared/definition11.js +1 -1
- package/shared/definition14.cjs +1 -1
- package/shared/definition14.js +1 -1
- package/shared/definition16.cjs +1 -1
- package/shared/definition16.js +1 -1
- package/shared/definition18.cjs +2 -2
- package/shared/definition18.js +2 -2
- package/shared/definition19.cjs +2 -2
- package/shared/definition19.js +2 -2
- package/shared/definition20.cjs +14 -34
- package/shared/definition20.js +14 -34
- package/shared/definition21.cjs +1 -1
- package/shared/definition21.js +1 -1
- package/shared/definition26.cjs +1 -1
- package/shared/definition26.js +1 -1
- package/shared/definition29.cjs +4 -0
- package/shared/definition29.js +4 -0
- package/shared/definition30.cjs +2 -1
- package/shared/definition30.js +2 -1
- package/shared/definition35.cjs +12 -7
- package/shared/definition35.js +12 -7
- package/shared/definition36.cjs +50 -207
- package/shared/definition36.js +51 -207
- package/shared/definition4.cjs +1 -1
- package/shared/definition4.js +1 -1
- package/shared/definition42.cjs +1 -1
- package/shared/definition42.js +1 -1
- package/shared/definition43.cjs +993 -645
- package/shared/definition43.js +989 -642
- package/shared/definition44.cjs +723 -112
- package/shared/definition44.js +722 -111
- package/shared/definition45.cjs +121 -80
- package/shared/definition45.js +119 -78
- package/shared/definition46.cjs +81 -614
- package/shared/definition46.js +80 -612
- package/shared/definition47.cjs +608 -114
- package/shared/definition47.js +606 -113
- package/shared/definition48.cjs +116 -134
- package/shared/definition48.js +115 -133
- package/shared/definition49.cjs +149 -19
- package/shared/definition49.js +148 -18
- package/shared/definition5.cjs +1 -1
- package/shared/definition5.js +1 -1
- package/shared/definition50.cjs +21 -82
- package/shared/definition50.js +20 -81
- package/shared/definition51.cjs +77 -539
- package/shared/definition51.js +76 -538
- package/shared/definition52.cjs +568 -28
- package/shared/definition52.js +567 -27
- package/shared/definition53.cjs +28 -123
- package/shared/definition53.js +26 -122
- package/shared/definition54.cjs +115 -295
- package/shared/definition54.js +114 -294
- package/shared/definition55.cjs +251 -311
- package/shared/definition55.js +251 -311
- package/shared/definition56.cjs +299 -780
- package/shared/definition56.js +298 -779
- package/shared/definition57.cjs +800 -102
- package/shared/definition57.js +799 -101
- package/shared/definition58.cjs +92 -63
- package/shared/definition58.js +91 -62
- package/shared/definition59.cjs +117 -75
- package/shared/definition59.js +116 -74
- package/shared/definition60.cjs +70 -285
- package/shared/definition60.js +71 -286
- package/shared/definition61.cjs +274 -66146
- package/shared/definition61.js +273 -66145
- package/shared/definition62.cjs +66160 -27
- package/shared/definition62.js +66158 -25
- package/shared/definition63.cjs +24 -1952
- package/shared/definition63.js +23 -1950
- package/shared/definition64.cjs +1976 -0
- package/shared/definition64.js +1971 -0
- package/shared/listbox-option.cjs +204 -0
- package/shared/listbox-option.js +201 -0
- package/shared/listbox.cjs +3 -3
- package/shared/listbox.js +1 -1
- package/shared/localization/Locale.d.ts +4 -0
- package/shared/presentationDate.cjs +2 -2
- package/shared/presentationDate.js +2 -2
- package/shared/scrollIntoView.cjs +51 -0
- package/shared/scrollIntoView.js +49 -0
- package/shared/slider.template.cjs +1 -1
- package/shared/slider.template.js +1 -1
- package/shared/text-field.cjs +1 -1
- package/shared/text-field.js +1 -1
- package/shared/utils/scrollIntoView.d.ts +1 -0
- 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-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 +295 -0
- package/api-extractor.json +0 -25
- package/tsdoc-metadata.json +0 -11
package/shared/definition56.cjs
CHANGED
|
@@ -1,220 +1,74 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const index = require('./index.cjs');
|
|
4
|
-
const definition
|
|
5
|
-
const
|
|
6
|
-
const definition$2 = require('./definition11.cjs');
|
|
4
|
+
const definition = require('./definition27.cjs');
|
|
5
|
+
const Reflector = require('./Reflector.cjs');
|
|
7
6
|
const applyMixinsWithObservables = require('./applyMixinsWithObservables.cjs');
|
|
8
|
-
const
|
|
9
|
-
const
|
|
7
|
+
const icon = require('./icon.cjs');
|
|
8
|
+
const textField = require('./text-field2.cjs');
|
|
10
9
|
const formElements = require('./form-elements.cjs');
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const ref = require('./ref.cjs');
|
|
14
|
-
const slotted = require('./slotted.cjs');
|
|
10
|
+
const affix = require('./affix.cjs');
|
|
11
|
+
const textField$1 = require('./text-field.cjs');
|
|
15
12
|
const when = require('./when.cjs');
|
|
16
|
-
const
|
|
13
|
+
const slotted = require('./slotted.cjs');
|
|
17
14
|
const classNames = require('./class-names.cjs');
|
|
18
15
|
|
|
19
|
-
|
|
16
|
+
// Unique ID creation requires a high quality random # generator. In the browser we therefore
|
|
17
|
+
// require the crypto API and do not support built-in fallback to lower quality random number
|
|
18
|
+
// generators (like Math.random()).
|
|
19
|
+
let getRandomValues;
|
|
20
|
+
const rnds8 = new Uint8Array(16);
|
|
21
|
+
function rng() {
|
|
22
|
+
// lazy load so that environments that need to polyfill have a chance to do so
|
|
23
|
+
if (!getRandomValues) {
|
|
24
|
+
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
|
|
25
|
+
getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
20
26
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
constructor() {
|
|
25
|
-
super(...arguments);
|
|
26
|
-
this.proxy = document.createElement("input");
|
|
27
|
+
if (!getRandomValues) {
|
|
28
|
+
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
|
29
|
+
}
|
|
27
30
|
}
|
|
31
|
+
|
|
32
|
+
return getRandomValues(rnds8);
|
|
28
33
|
}
|
|
29
34
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
const [hours, minutes, seconds] = parts;
|
|
36
|
-
if (hours.length !== 2 || minutes.length !== 2 || seconds.length !== 2) {
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
const hoursNum = parseInt(hours, 10);
|
|
40
|
-
const minutesNum = parseInt(minutes, 10);
|
|
41
|
-
const secondsNum = parseInt(seconds, 10);
|
|
42
|
-
if (isNaN(hoursNum) || isNaN(minutesNum) || isNaN(secondsNum)) {
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
if (hoursNum < 0 || hoursNum > 23) {
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
if (minutesNum < 0 || minutesNum > 59) {
|
|
49
|
-
return false;
|
|
50
|
-
}
|
|
51
|
-
if (secondsNum < 0 || secondsNum > 59) {
|
|
52
|
-
return false;
|
|
53
|
-
}
|
|
54
|
-
return true;
|
|
55
|
-
};
|
|
56
|
-
const parseTimePart = (partStr) => Number.parseInt(partStr, 10);
|
|
57
|
-
const formatTimePart = (part) => part.toString().padStart(2, "0");
|
|
58
|
-
const parseTimeStr = (timeStr) => {
|
|
59
|
-
const [hoursStr, minutesStr, secondsStr] = timeStr.split(":");
|
|
60
|
-
const hours = parseTimePart(hoursStr);
|
|
61
|
-
const minutes = parseTimePart(minutesStr);
|
|
62
|
-
const seconds = parseTimePart(secondsStr);
|
|
63
|
-
return {
|
|
64
|
-
hourStr: hoursStr,
|
|
65
|
-
hours,
|
|
66
|
-
minuteStr: minutesStr,
|
|
67
|
-
minutes,
|
|
68
|
-
secondStr: secondsStr,
|
|
69
|
-
seconds,
|
|
70
|
-
meridiem: hours < 12 ? "AM" : "PM"
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
|
-
const hoursAs12hClock = (hour) => hour % 12 || 12;
|
|
35
|
+
/**
|
|
36
|
+
* Convert array of 16 byte values to UUID string format of the form:
|
|
37
|
+
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
38
|
+
*/
|
|
74
39
|
|
|
75
|
-
const
|
|
76
|
-
const time = parseTimeStr(timeStr);
|
|
77
|
-
const hoursStr = formatTimePart(
|
|
78
|
-
use12HourClock ? hoursAs12hClock(time.hours) : time.hours
|
|
79
|
-
);
|
|
80
|
-
let result = `${hoursStr}:${time.minuteStr}`;
|
|
81
|
-
if (includeSeconds) {
|
|
82
|
-
result += `:${time.secondStr}`;
|
|
83
|
-
}
|
|
84
|
-
if (use12HourClock) {
|
|
85
|
-
result += ` ${time.meridiem}`;
|
|
86
|
-
}
|
|
87
|
-
return result;
|
|
88
|
-
};
|
|
89
|
-
const isDigit = (char) => char >= "0" && char <= "9";
|
|
90
|
-
const parsePresentationTime = (input, use12HourClock) => {
|
|
91
|
-
const cleanedInput = input.toLowerCase();
|
|
92
|
-
const numerals = [];
|
|
93
|
-
let meridiem;
|
|
94
|
-
for (let i = 0; i < cleanedInput.length; i++) {
|
|
95
|
-
const char = cleanedInput[i];
|
|
96
|
-
if (char === "a" && cleanedInput[i + 1] === "m") {
|
|
97
|
-
i++;
|
|
98
|
-
meridiem = "AM";
|
|
99
|
-
}
|
|
100
|
-
if (char === "p" && cleanedInput[i + 1] === "m") {
|
|
101
|
-
i++;
|
|
102
|
-
meridiem = "PM";
|
|
103
|
-
}
|
|
104
|
-
if (isDigit(char)) {
|
|
105
|
-
let numeral = char;
|
|
106
|
-
while (isDigit(cleanedInput[i + 1])) {
|
|
107
|
-
i++;
|
|
108
|
-
numeral += cleanedInput[i];
|
|
109
|
-
}
|
|
110
|
-
numerals.push(Number.parseInt(numeral, 10));
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
if (numerals.length === 0 || numerals.length > 3) {
|
|
114
|
-
throw new Error("Invalid time format");
|
|
115
|
-
}
|
|
116
|
-
if (meridiem && (numerals[0] < 1 || numerals[0] > 12)) {
|
|
117
|
-
throw new Error("Invalid time format");
|
|
118
|
-
}
|
|
119
|
-
if (meridiem || use12HourClock) {
|
|
120
|
-
if (numerals[0] === 12) {
|
|
121
|
-
numerals[0] = 0;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
if (meridiem === "PM") {
|
|
125
|
-
numerals[0] = numerals[0] + 12;
|
|
126
|
-
}
|
|
127
|
-
const [hours, minutes = 0, seconds = 0] = numerals;
|
|
128
|
-
if (hours > 23 || minutes > 59 || seconds > 59) {
|
|
129
|
-
throw new Error("Invalid value");
|
|
130
|
-
}
|
|
131
|
-
return [hours, minutes, seconds].map(formatTimePart).join(":");
|
|
132
|
-
};
|
|
40
|
+
const byteToHex = [];
|
|
133
41
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
return result;
|
|
149
|
-
};
|
|
150
|
-
const getMinutesOptions = (step, value, min, max) => {
|
|
151
|
-
const result = [];
|
|
152
|
-
let minMinute = 0;
|
|
153
|
-
let maxMinute = 59;
|
|
154
|
-
if (min) {
|
|
155
|
-
const { hourStr: minHourStr, minutes: minMinutes } = parseTimeStr(min);
|
|
156
|
-
if (value && parseTimeStr(value).hourStr === minHourStr) {
|
|
157
|
-
minMinute = minMinutes;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
if (max) {
|
|
161
|
-
const { hourStr: maxHourStr, minutes: maxMinutes } = parseTimeStr(max);
|
|
162
|
-
if (value && parseTimeStr(value).hourStr === maxHourStr) {
|
|
163
|
-
maxMinute = maxMinutes;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
for (let i = minMinute; i <= maxMinute; i += Math.max(1, step ?? 1)) {
|
|
167
|
-
const minutes = formatTimePart(i);
|
|
168
|
-
result.push({
|
|
169
|
-
value: minutes,
|
|
170
|
-
label: minutes
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
return result;
|
|
174
|
-
};
|
|
175
|
-
const getSecondsOptions = (step, value, min, max) => {
|
|
176
|
-
const result = [];
|
|
177
|
-
let minSecond = 0;
|
|
178
|
-
let maxSecond = 59;
|
|
179
|
-
if (min) {
|
|
180
|
-
const minTime = parseTimeStr(min);
|
|
181
|
-
if (value && (parseTimeStr(value).hourStr === minTime.hourStr && parseTimeStr(value).minuteStr) === minTime.minuteStr) {
|
|
182
|
-
minSecond = minTime.seconds;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
if (max) {
|
|
186
|
-
const maxTime = parseTimeStr(max);
|
|
187
|
-
if (value && (parseTimeStr(value).hourStr === maxTime.hourStr && parseTimeStr(value).minuteStr) === maxTime.minuteStr) {
|
|
188
|
-
maxSecond = maxTime.seconds;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
for (let i = minSecond; i <= maxSecond; i += Math.max(1, step)) {
|
|
192
|
-
const seconds = formatTimePart(i);
|
|
193
|
-
result.push({
|
|
194
|
-
value: seconds,
|
|
195
|
-
label: seconds
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
return result;
|
|
42
|
+
for (let i = 0; i < 256; ++i) {
|
|
43
|
+
byteToHex.push((i + 0x100).toString(16).slice(1));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function unsafeStringify(arr, offset = 0) {
|
|
47
|
+
// Note: Be careful editing this code! It's been tuned for performance
|
|
48
|
+
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
|
|
49
|
+
return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
53
|
+
const native = {
|
|
54
|
+
randomUUID
|
|
199
55
|
};
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
result.push({
|
|
205
|
-
value: "AM",
|
|
206
|
-
label: "AM"
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
const hidePM = max ? parseTimeStr(max).meridiem === "AM" : false;
|
|
210
|
-
if (!hidePM) {
|
|
211
|
-
result.push({
|
|
212
|
-
value: "PM",
|
|
213
|
-
label: "PM"
|
|
214
|
-
});
|
|
56
|
+
|
|
57
|
+
function v4(options, buf, offset) {
|
|
58
|
+
if (native.randomUUID && !buf && !options) {
|
|
59
|
+
return native.randomUUID();
|
|
215
60
|
}
|
|
216
|
-
|
|
217
|
-
};
|
|
61
|
+
|
|
62
|
+
options = options || {};
|
|
63
|
+
const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
64
|
+
|
|
65
|
+
rnds[6] = rnds[6] & 0x0f | 0x40;
|
|
66
|
+
rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
|
|
67
|
+
|
|
68
|
+
return unsafeStringify(rnds);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const generateRandomId = () => v4();
|
|
218
72
|
|
|
219
73
|
var __defProp = Object.defineProperty;
|
|
220
74
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -232,644 +86,309 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
232
86
|
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
233
87
|
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
234
88
|
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);
|
|
89
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
|
|
235
90
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
236
|
-
var
|
|
237
|
-
const
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
__privateAdd(this, _TimePicker_instances);
|
|
252
|
-
this.readOnly = false;
|
|
253
|
-
this.minutesStep = null;
|
|
254
|
-
this.secondsStep = null;
|
|
255
|
-
__privateAdd(this, _getFocusableEls, () => this.shadowRoot.querySelectorAll(`
|
|
256
|
-
.dialog [tabindex="0"],
|
|
257
|
-
.dialog .vwc-button:not(:disabled)
|
|
258
|
-
`));
|
|
259
|
-
__privateAdd(this, _onFocusIn, () => {
|
|
260
|
-
this.$emit("focus", void 0, { bubbles: false });
|
|
261
|
-
});
|
|
262
|
-
__privateAdd(this, _onFocusOut, () => {
|
|
263
|
-
this.$emit("blur", void 0, { bubbles: false });
|
|
264
|
-
});
|
|
265
|
-
this._popupOpen = false;
|
|
266
|
-
__privateAdd(this, _dismissOnClickOutside, (event) => {
|
|
267
|
-
if (!this._popupOpen) {
|
|
268
|
-
return;
|
|
269
|
-
}
|
|
270
|
-
const path = event.composedPath();
|
|
271
|
-
const elementsToIgnoreClicksOn = [this._dialogEl, this._clockButtonEl];
|
|
272
|
-
if (!elementsToIgnoreClicksOn.some((element) => path.includes(element))) {
|
|
273
|
-
this._closePopup(false);
|
|
274
|
-
}
|
|
275
|
-
});
|
|
276
|
-
this._presentationValue = "";
|
|
277
|
-
this.value = "";
|
|
278
|
-
this.min = "";
|
|
279
|
-
this.max = "";
|
|
280
|
-
this.proxy.type = "time";
|
|
281
|
-
this.proxy.step = "1";
|
|
282
|
-
}
|
|
283
|
-
/**
|
|
284
|
-
* @internal
|
|
285
|
-
*/
|
|
286
|
-
readOnlyChanged() {
|
|
287
|
-
if (this.proxy instanceof HTMLInputElement) {
|
|
288
|
-
this.proxy.readOnly = this.readOnly;
|
|
289
|
-
this.validate();
|
|
290
|
-
}
|
|
91
|
+
var _TextField_instances, handleLabelChange_fn, _reflectToInput, _helperTextMirrorEl, _helperTextSlotMutationObserver, updateHelperTextMutationObserver_fn, updateMirroredHelperText_fn;
|
|
92
|
+
const safariWorkaroundClassName = "_vvd-3-text-field-safari-workaround";
|
|
93
|
+
const getSafariWorkaroundStyleSheet = icon.memoizeWith(
|
|
94
|
+
() => "",
|
|
95
|
+
() => {
|
|
96
|
+
const styleSheet = new CSSStyleSheet();
|
|
97
|
+
const supportsReplaceSync = "replaceSync" in styleSheet;
|
|
98
|
+
if (supportsReplaceSync) {
|
|
99
|
+
styleSheet.replaceSync(`
|
|
100
|
+
.${safariWorkaroundClassName}::placeholder {
|
|
101
|
+
opacity: 1 !important;
|
|
102
|
+
-webkit-text-fill-color: var(--_low-ink-color) !important;
|
|
103
|
+
}`);
|
|
104
|
+
}
|
|
105
|
+
return styleSheet;
|
|
291
106
|
}
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
/**
|
|
302
|
-
* @internal
|
|
303
|
-
*/
|
|
304
|
-
maxChanged(_, newMax) {
|
|
305
|
-
if (this.proxy instanceof HTMLInputElement) {
|
|
306
|
-
this.proxy.max = newMax;
|
|
307
|
-
this.validate();
|
|
308
|
-
}
|
|
107
|
+
);
|
|
108
|
+
const installSafariWorkaroundStyle = (forElement) => {
|
|
109
|
+
const root = forElement.getRootNode();
|
|
110
|
+
const workaroundStyleSheet = getSafariWorkaroundStyleSheet();
|
|
111
|
+
const supportsAdoptedStyleSheets = "adoptedStyleSheets" in root;
|
|
112
|
+
if (!supportsAdoptedStyleSheets) {
|
|
113
|
+
return;
|
|
309
114
|
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
return this.secondsStep !== null;
|
|
115
|
+
if (!root.adoptedStyleSheets.includes(workaroundStyleSheet)) {
|
|
116
|
+
root.adoptedStyleSheets = [
|
|
117
|
+
...root.adoptedStyleSheets,
|
|
118
|
+
workaroundStyleSheet
|
|
119
|
+
];
|
|
316
120
|
}
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
121
|
+
};
|
|
122
|
+
exports.TextField = class TextField extends textField.TextField {
|
|
123
|
+
constructor() {
|
|
124
|
+
super(...arguments);
|
|
125
|
+
__privateAdd(this, _TextField_instances);
|
|
126
|
+
/**
|
|
127
|
+
* @internal
|
|
128
|
+
*/
|
|
129
|
+
this._labelEl = null;
|
|
130
|
+
__privateAdd(this, _reflectToInput);
|
|
131
|
+
__privateAdd(this, _helperTextMirrorEl);
|
|
132
|
+
__privateAdd(this, _helperTextSlotMutationObserver);
|
|
322
133
|
}
|
|
323
134
|
/**
|
|
324
135
|
* @internal
|
|
325
136
|
*/
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
if (!isValidTimeStr(this.value)) {
|
|
330
|
-
this.value = "";
|
|
331
|
-
return;
|
|
332
|
-
}
|
|
333
|
-
this._presentationValue = formatPresentationTime(
|
|
334
|
-
this.value,
|
|
335
|
-
this._displaySeconds,
|
|
336
|
-
this._use12hClock
|
|
337
|
-
);
|
|
338
|
-
} else {
|
|
339
|
-
this._presentationValue = "";
|
|
137
|
+
labelChanged() {
|
|
138
|
+
if (this._labelEl) {
|
|
139
|
+
__privateMethod(this, _TextField_instances, handleLabelChange_fn).call(this, this._labelEl);
|
|
340
140
|
}
|
|
341
141
|
}
|
|
342
142
|
connectedCallback() {
|
|
343
143
|
super.connectedCallback();
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
144
|
+
if (!this.control) {
|
|
145
|
+
const uniqueId = this.id || generateRandomId();
|
|
146
|
+
const controlId = `vvd-text-field-control-${uniqueId}`;
|
|
147
|
+
const helperTextId = `vvd-text-field-helper-text-${uniqueId}`;
|
|
148
|
+
const input = document.createElement("input");
|
|
149
|
+
input.slot = "_control";
|
|
150
|
+
input.id = controlId;
|
|
151
|
+
input.className = safariWorkaroundClassName;
|
|
152
|
+
this.control = input;
|
|
153
|
+
input.addEventListener("input", () => {
|
|
154
|
+
this.handleTextInput();
|
|
155
|
+
});
|
|
156
|
+
input.addEventListener("change", () => {
|
|
157
|
+
this.handleChange();
|
|
158
|
+
});
|
|
159
|
+
input.addEventListener("blur", () => {
|
|
160
|
+
this.$emit("blur", void 0, { bubbles: false });
|
|
161
|
+
});
|
|
162
|
+
input.addEventListener("focus", () => {
|
|
163
|
+
this.$emit("focus", void 0, { bubbles: false });
|
|
164
|
+
});
|
|
165
|
+
this.appendChild(input);
|
|
166
|
+
const label = document.createElement("label");
|
|
167
|
+
label.slot = "_label";
|
|
168
|
+
label.htmlFor = controlId;
|
|
169
|
+
this._labelEl = label;
|
|
170
|
+
__privateMethod(this, _TextField_instances, handleLabelChange_fn).call(this, label);
|
|
171
|
+
__privateSet(this, _helperTextMirrorEl, document.createElement("div"));
|
|
172
|
+
__privateGet(this, _helperTextMirrorEl).id = helperTextId;
|
|
173
|
+
__privateGet(this, _helperTextMirrorEl).slot = "_mirrored-helper-text";
|
|
174
|
+
__privateMethod(this, _TextField_instances, updateMirroredHelperText_fn).call(this);
|
|
175
|
+
this.appendChild(__privateGet(this, _helperTextMirrorEl));
|
|
176
|
+
installSafariWorkaroundStyle(this);
|
|
177
|
+
}
|
|
178
|
+
__privateSet(this, _reflectToInput, new Reflector.Reflector(this, this.control));
|
|
179
|
+
__privateGet(this, _reflectToInput).booleanAttribute("autofocus", "autofocus");
|
|
180
|
+
__privateGet(this, _reflectToInput).booleanAttribute("disabled", "disabled");
|
|
181
|
+
__privateGet(this, _reflectToInput).booleanAttribute("readOnly", "readonly");
|
|
182
|
+
__privateGet(this, _reflectToInput).booleanAttribute("required", "required");
|
|
183
|
+
__privateGet(this, _reflectToInput).booleanAttribute("spellcheck", "spellcheck");
|
|
184
|
+
__privateGet(this, _reflectToInput).attribute("list", "list");
|
|
185
|
+
__privateGet(this, _reflectToInput).attribute("maxlength", "maxlength");
|
|
186
|
+
__privateGet(this, _reflectToInput).attribute("minlength", "minlength");
|
|
187
|
+
__privateGet(this, _reflectToInput).attribute("pattern", "pattern");
|
|
188
|
+
__privateGet(this, _reflectToInput).attribute("placeholder", "placeholder");
|
|
189
|
+
__privateGet(this, _reflectToInput).attribute("size", "size");
|
|
190
|
+
__privateGet(this, _reflectToInput).attribute("autoComplete", "autocomplete");
|
|
191
|
+
__privateGet(this, _reflectToInput).attribute("type", "type");
|
|
192
|
+
__privateGet(this, _reflectToInput).attribute("ariaAtomic", "aria-atomic");
|
|
193
|
+
__privateGet(this, _reflectToInput).attribute("ariaBusy", "aria-busy");
|
|
194
|
+
__privateGet(this, _reflectToInput).attribute("ariaCurrent", "aria-current");
|
|
195
|
+
__privateGet(this, _reflectToInput).attribute("ariaDetails", "aria-details");
|
|
196
|
+
__privateGet(this, _reflectToInput).attribute("ariaDisabled", "aria-disabled");
|
|
197
|
+
__privateGet(this, _reflectToInput).attribute("ariaHaspopup", "aria-haspopup");
|
|
198
|
+
__privateGet(this, _reflectToInput).attribute("ariaHidden", "aria-hidden");
|
|
199
|
+
__privateGet(this, _reflectToInput).attribute("ariaInvalid", "aria-invalid");
|
|
200
|
+
__privateGet(this, _reflectToInput).attribute("ariaKeyshortcuts", "aria-keyshortcuts");
|
|
201
|
+
__privateGet(this, _reflectToInput).attribute("ariaLabel", "aria-label");
|
|
202
|
+
__privateGet(this, _reflectToInput).attribute("ariaLive", "aria-live");
|
|
203
|
+
__privateGet(this, _reflectToInput).attribute("ariaRelevant", "aria-relevant");
|
|
204
|
+
__privateGet(this, _reflectToInput).attribute(
|
|
205
|
+
"ariaRoledescription",
|
|
206
|
+
"aria-roledescription"
|
|
207
|
+
);
|
|
208
|
+
__privateGet(this, _reflectToInput).property("value", "value", true);
|
|
209
|
+
__privateMethod(this, _TextField_instances, updateHelperTextMutationObserver_fn).call(this);
|
|
347
210
|
}
|
|
348
211
|
disconnectedCallback() {
|
|
349
212
|
super.disconnectedCallback();
|
|
350
|
-
|
|
351
|
-
this
|
|
352
|
-
this
|
|
213
|
+
__privateGet(this, _reflectToInput).destroy();
|
|
214
|
+
__privateSet(this, _reflectToInput, void 0);
|
|
215
|
+
__privateMethod(this, _TextField_instances, updateHelperTextMutationObserver_fn).call(this);
|
|
353
216
|
}
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
*/
|
|
357
|
-
_closePopup(restoreFocusToTextField = true) {
|
|
358
|
-
this._popupOpen = false;
|
|
359
|
-
if (restoreFocusToTextField) {
|
|
360
|
-
this._textFieldEl.focus();
|
|
361
|
-
}
|
|
217
|
+
focus() {
|
|
218
|
+
this.control?.focus();
|
|
362
219
|
}
|
|
363
220
|
/**
|
|
364
|
-
* On keydown anywhere in the time picker.
|
|
365
221
|
* @internal
|
|
366
222
|
*/
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
this._closePopup();
|
|
370
|
-
return false;
|
|
371
|
-
}
|
|
372
|
-
if (this._trappedFocus(event, __privateGet(this, _getFocusableEls))) {
|
|
373
|
-
return false;
|
|
374
|
-
}
|
|
375
|
-
return true;
|
|
223
|
+
helperTextChanged() {
|
|
224
|
+
__privateMethod(this, _TextField_instances, updateMirroredHelperText_fn).call(this);
|
|
376
225
|
}
|
|
377
226
|
/**
|
|
378
227
|
* @internal
|
|
379
228
|
*/
|
|
380
|
-
|
|
381
|
-
this
|
|
382
|
-
this.
|
|
229
|
+
_helperTextSlottedContentChanged() {
|
|
230
|
+
__privateMethod(this, _TextField_instances, updateMirroredHelperText_fn).call(this);
|
|
231
|
+
__privateMethod(this, _TextField_instances, updateHelperTextMutationObserver_fn).call(this);
|
|
383
232
|
}
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
format += " aa";
|
|
394
|
-
}
|
|
395
|
-
return format;
|
|
396
|
-
}
|
|
397
|
-
/**
|
|
398
|
-
* @internal
|
|
399
|
-
*/
|
|
400
|
-
_onTextFieldInput(event) {
|
|
401
|
-
const textField = event.currentTarget;
|
|
402
|
-
this._presentationValue = textField.value;
|
|
403
|
-
}
|
|
404
|
-
/**
|
|
405
|
-
* @internal
|
|
406
|
-
*/
|
|
407
|
-
_onTextFieldChange() {
|
|
408
|
-
if (this._presentationValue === "") {
|
|
409
|
-
__privateMethod(this, _TimePicker_instances, updateValueDueToUserInteraction_fn).call(this, "");
|
|
410
|
-
return;
|
|
411
|
-
}
|
|
412
|
-
try {
|
|
413
|
-
__privateMethod(this, _TimePicker_instances, updateValueDueToUserInteraction_fn).call(this, parsePresentationTime(this._presentationValue, this._use12hClock));
|
|
414
|
-
} catch (_) {
|
|
415
|
-
return;
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
// --- Clock button ---
|
|
419
|
-
/**
|
|
420
|
-
* @internal
|
|
421
|
-
*/
|
|
422
|
-
get _clockButtonLabel() {
|
|
423
|
-
if (this.value) {
|
|
424
|
-
return this.locale.timePicker.changeTimeLabel(
|
|
425
|
-
formatPresentationTime(
|
|
426
|
-
this.value,
|
|
427
|
-
this._displaySeconds,
|
|
428
|
-
this._use12hClock
|
|
429
|
-
)
|
|
430
|
-
);
|
|
431
|
-
}
|
|
432
|
-
return this.locale.timePicker.chooseTimeLabel;
|
|
433
|
-
}
|
|
434
|
-
/**
|
|
435
|
-
* @internal
|
|
436
|
-
*/
|
|
437
|
-
_onClockButtonClick() {
|
|
438
|
-
if (this._popupOpen) {
|
|
439
|
-
this._closePopup();
|
|
440
|
-
} else {
|
|
441
|
-
__privateMethod(this, _TimePicker_instances, openPopupIfPossible_fn).call(this);
|
|
442
|
-
index.DOM.processUpdates();
|
|
443
|
-
if (this._selectedHour) {
|
|
444
|
-
__privateMethod(this, _TimePicker_instances, scrollToItem_fn).call(this, "hours", this._selectedHour, "start");
|
|
445
|
-
}
|
|
446
|
-
if (this._selectedMinute) {
|
|
447
|
-
__privateMethod(this, _TimePicker_instances, scrollToItem_fn).call(this, "minutes", this._selectedMinute, "start");
|
|
448
|
-
}
|
|
449
|
-
if (this._displaySeconds && this._selectedSecond) {
|
|
450
|
-
__privateMethod(this, _TimePicker_instances, scrollToItem_fn).call(this, "seconds", this._selectedSecond, "start");
|
|
451
|
-
}
|
|
452
|
-
if (this._use12hClock && this._selectedMeridiem) {
|
|
453
|
-
__privateMethod(this, _TimePicker_instances, scrollToItem_fn).call(this, "meridies", this._selectedMeridiem, "start");
|
|
454
|
-
}
|
|
455
|
-
__privateGet(this, _getFocusableEls).call(this)[0].focus();
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
// --- Pickers ---
|
|
459
|
-
/**
|
|
460
|
-
* @internal
|
|
461
|
-
*/
|
|
462
|
-
get _hours() {
|
|
463
|
-
return getHoursOptions(
|
|
464
|
-
this.min,
|
|
465
|
-
this.max,
|
|
466
|
-
this._use12hClock ? this._selectedMeridiem ?? this._meridies[0].value : void 0
|
|
467
|
-
);
|
|
468
|
-
}
|
|
469
|
-
/**
|
|
470
|
-
* @internal
|
|
471
|
-
*/
|
|
472
|
-
get _selectedHour() {
|
|
473
|
-
return this.value ? parseTimeStr(this.value).hourStr : void 0;
|
|
474
|
-
}
|
|
475
|
-
/**
|
|
476
|
-
* @internal
|
|
477
|
-
*/
|
|
478
|
-
set _selectedHour(value) {
|
|
479
|
-
if (this.value) {
|
|
480
|
-
const { minuteStr, secondStr } = parseTimeStr(this.value);
|
|
481
|
-
this.value = `${value}:${minuteStr}:${secondStr}`;
|
|
482
|
-
} else {
|
|
483
|
-
this.value = `${value}:00:00`;
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
/**
|
|
487
|
-
* @internal
|
|
488
|
-
*/
|
|
489
|
-
get _minutes() {
|
|
490
|
-
return getMinutesOptions(this.minutesStep, this.value, this.min, this.max);
|
|
491
|
-
}
|
|
492
|
-
/**
|
|
493
|
-
* @internal
|
|
494
|
-
*/
|
|
495
|
-
get _selectedMinute() {
|
|
496
|
-
return this.value ? parseTimeStr(this.value).minuteStr : void 0;
|
|
497
|
-
}
|
|
498
|
-
/**
|
|
499
|
-
* @internal
|
|
500
|
-
*/
|
|
501
|
-
set _selectedMinute(value) {
|
|
502
|
-
if (this.value) {
|
|
503
|
-
const { hourStr, secondStr } = parseTimeStr(this.value);
|
|
504
|
-
this.value = `${hourStr}:${value}:${secondStr}`;
|
|
505
|
-
} else {
|
|
506
|
-
this.value = `00:${value}:00`;
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
/**
|
|
510
|
-
* @internal
|
|
511
|
-
*/
|
|
512
|
-
get _seconds() {
|
|
513
|
-
return getSecondsOptions(this.secondsStep, this.value, this.min, this.max);
|
|
514
|
-
}
|
|
515
|
-
/**
|
|
516
|
-
* @internal
|
|
517
|
-
*/
|
|
518
|
-
get _selectedSecond() {
|
|
519
|
-
return this.value ? parseTimeStr(this.value).secondStr : void 0;
|
|
520
|
-
}
|
|
521
|
-
/**
|
|
522
|
-
* @internal
|
|
523
|
-
*/
|
|
524
|
-
set _selectedSecond(value) {
|
|
525
|
-
if (this.value) {
|
|
526
|
-
const { hourStr, minuteStr } = parseTimeStr(this.value);
|
|
527
|
-
this.value = `${hourStr}:${minuteStr}:${value}`;
|
|
528
|
-
} else {
|
|
529
|
-
this.value = `00:00:${value}`;
|
|
233
|
+
};
|
|
234
|
+
_TextField_instances = new WeakSet();
|
|
235
|
+
handleLabelChange_fn = function(labelEl) {
|
|
236
|
+
if (!this.label) {
|
|
237
|
+
labelEl.remove();
|
|
238
|
+
} else {
|
|
239
|
+
labelEl.textContent = this.label;
|
|
240
|
+
if (!labelEl.isConnected) {
|
|
241
|
+
this.appendChild(labelEl);
|
|
530
242
|
}
|
|
531
243
|
}
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
}
|
|
544
|
-
/**
|
|
545
|
-
* @internal
|
|
546
|
-
*/
|
|
547
|
-
set _selectedMeridiem(value) {
|
|
548
|
-
if (this.value) {
|
|
549
|
-
const { hours, minuteStr, secondStr } = parseTimeStr(this.value);
|
|
550
|
-
let adjustedHours = hours;
|
|
551
|
-
if (value === "AM" && hours >= 12) {
|
|
552
|
-
adjustedHours -= 12;
|
|
553
|
-
} else if (value === "PM" && hours < 12) {
|
|
554
|
-
adjustedHours += 12;
|
|
555
|
-
}
|
|
556
|
-
this.value = `${formatTimePart(adjustedHours)}:${minuteStr}:${secondStr}`;
|
|
557
|
-
} else {
|
|
558
|
-
if (value === "AM") {
|
|
559
|
-
this.value = "00:00:00";
|
|
560
|
-
} else {
|
|
561
|
-
this.value = "12:00:00";
|
|
244
|
+
};
|
|
245
|
+
_reflectToInput = new WeakMap();
|
|
246
|
+
_helperTextMirrorEl = new WeakMap();
|
|
247
|
+
_helperTextSlotMutationObserver = new WeakMap();
|
|
248
|
+
updateHelperTextMutationObserver_fn = function() {
|
|
249
|
+
const usesHelperTextSlot = this._helperTextSlottedContent.length;
|
|
250
|
+
const shouldHaveMutationObserver = usesHelperTextSlot && this.isConnected;
|
|
251
|
+
if (shouldHaveMutationObserver && !__privateGet(this, _helperTextSlotMutationObserver)) {
|
|
252
|
+
__privateSet(this, _helperTextSlotMutationObserver, new MutationObserver((records) => {
|
|
253
|
+
if (records.some((record) => record.target !== __privateGet(this, _helperTextMirrorEl))) {
|
|
254
|
+
__privateMethod(this, _TextField_instances, updateMirroredHelperText_fn).call(this);
|
|
562
255
|
}
|
|
563
|
-
}
|
|
256
|
+
}));
|
|
257
|
+
__privateGet(this, _helperTextSlotMutationObserver).observe(this, {
|
|
258
|
+
subtree: true,
|
|
259
|
+
childList: true,
|
|
260
|
+
characterData: true
|
|
261
|
+
});
|
|
564
262
|
}
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
_onPickerKeyDown(picker, options, selectedValue, setSelectedValue, event) {
|
|
569
|
-
const offset = {
|
|
570
|
-
ArrowUp: -1,
|
|
571
|
-
ArrowDown: 1
|
|
572
|
-
}[event.key];
|
|
573
|
-
if (offset) {
|
|
574
|
-
event.preventDefault();
|
|
575
|
-
const index = options.findIndex((h) => h.value === selectedValue);
|
|
576
|
-
const newRawIndex = index === -1 ? 0 : index + offset;
|
|
577
|
-
const newIndex = (newRawIndex + options.length) % options.length;
|
|
578
|
-
const newValue = options[newIndex].value;
|
|
579
|
-
setSelectedValue(newValue);
|
|
580
|
-
__privateMethod(this, _TimePicker_instances, scrollToItem_fn).call(this, picker, newValue, "nearest");
|
|
581
|
-
__privateMethod(this, _TimePicker_instances, updateValueDueToUserInteraction_fn).call(this, this.value);
|
|
582
|
-
}
|
|
583
|
-
return true;
|
|
263
|
+
if (!shouldHaveMutationObserver && __privateGet(this, _helperTextSlotMutationObserver)) {
|
|
264
|
+
__privateGet(this, _helperTextSlotMutationObserver).disconnect();
|
|
265
|
+
__privateSet(this, _helperTextSlotMutationObserver, void 0);
|
|
584
266
|
}
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
267
|
+
};
|
|
268
|
+
updateMirroredHelperText_fn = function() {
|
|
269
|
+
let helperText = this.helperText ?? "";
|
|
270
|
+
if (this._helperTextSlottedContent?.length) {
|
|
271
|
+
helperText = this._helperTextSlottedContent.map((node) => node.innerText).join(" ");
|
|
272
|
+
}
|
|
273
|
+
if (__privateGet(this, _helperTextMirrorEl)) {
|
|
274
|
+
__privateGet(this, _helperTextMirrorEl).textContent = helperText;
|
|
275
|
+
if (helperText) {
|
|
276
|
+
this.control.setAttribute(
|
|
277
|
+
"aria-describedby",
|
|
278
|
+
__privateGet(this, _helperTextMirrorEl).id
|
|
279
|
+
);
|
|
597
280
|
} else {
|
|
598
|
-
this.
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
// --- Dialog footer ---
|
|
602
|
-
/**
|
|
603
|
-
* @internal
|
|
604
|
-
*/
|
|
605
|
-
_onOkClick() {
|
|
606
|
-
this._closePopup();
|
|
607
|
-
}
|
|
608
|
-
/**
|
|
609
|
-
* @internal
|
|
610
|
-
*/
|
|
611
|
-
_onClearClick() {
|
|
612
|
-
__privateMethod(this, _TimePicker_instances, updateValueDueToUserInteraction_fn).call(this, "");
|
|
613
|
-
this._closePopup();
|
|
614
|
-
}
|
|
615
|
-
// --- Validation ---
|
|
616
|
-
/**
|
|
617
|
-
* @internal
|
|
618
|
-
*/
|
|
619
|
-
validate() {
|
|
620
|
-
if (this.proxy) {
|
|
621
|
-
this.proxy.setCustomValidity(this._getCustomValidationError() ?? "");
|
|
622
|
-
}
|
|
623
|
-
super.validate(this._textFieldEl?.querySelector("input") ?? void 0);
|
|
624
|
-
}
|
|
625
|
-
/**
|
|
626
|
-
* @internal
|
|
627
|
-
*/
|
|
628
|
-
_getCustomValidationError() {
|
|
629
|
-
if (this._isPresentationValueInvalid()) {
|
|
630
|
-
return this.locale.timePicker.invalidTimeError;
|
|
631
|
-
}
|
|
632
|
-
return null;
|
|
633
|
-
}
|
|
634
|
-
/**
|
|
635
|
-
* @internal
|
|
636
|
-
*/
|
|
637
|
-
_isPresentationValueInvalid() {
|
|
638
|
-
if (this._presentationValue === "") {
|
|
639
|
-
return false;
|
|
640
|
-
}
|
|
641
|
-
try {
|
|
642
|
-
parsePresentationTime(this._presentationValue, this._use12hClock);
|
|
643
|
-
return false;
|
|
644
|
-
} catch (_) {
|
|
645
|
-
return true;
|
|
281
|
+
this.control.removeAttribute("aria-describedby");
|
|
646
282
|
}
|
|
647
283
|
}
|
|
648
284
|
};
|
|
649
|
-
_getFocusableEls = new WeakMap();
|
|
650
|
-
_TimePicker_instances = new WeakSet();
|
|
651
|
-
updateValueDueToUserInteraction_fn = function(newValue) {
|
|
652
|
-
this.value = newValue;
|
|
653
|
-
this.$emit("change");
|
|
654
|
-
this.$emit("input");
|
|
655
|
-
};
|
|
656
|
-
_onFocusIn = new WeakMap();
|
|
657
|
-
_onFocusOut = new WeakMap();
|
|
658
|
-
_dismissOnClickOutside = new WeakMap();
|
|
659
|
-
openPopupIfPossible_fn = function() {
|
|
660
|
-
if (!this.readOnly) {
|
|
661
|
-
this._popupOpen = true;
|
|
662
|
-
}
|
|
663
|
-
};
|
|
664
|
-
scrollToItem_fn = function(picker, selectedValue, position) {
|
|
665
|
-
const element = this.shadowRoot.querySelector(
|
|
666
|
-
`#${picker}-${selectedValue}`
|
|
667
|
-
);
|
|
668
|
-
if (!element) {
|
|
669
|
-
return;
|
|
670
|
-
}
|
|
671
|
-
const parent = element.parentElement;
|
|
672
|
-
switch (position) {
|
|
673
|
-
case "start":
|
|
674
|
-
parent.scrollTop = element.offsetTop;
|
|
675
|
-
break;
|
|
676
|
-
case "nearest":
|
|
677
|
-
if (element.offsetTop < parent.scrollTop) {
|
|
678
|
-
parent.scrollTop = element.offsetTop;
|
|
679
|
-
}
|
|
680
|
-
if (element.offsetTop + element.offsetHeight > parent.scrollTop + parent.offsetHeight) {
|
|
681
|
-
parent.scrollTop = element.offsetTop + element.offsetHeight - parent.offsetHeight;
|
|
682
|
-
}
|
|
683
|
-
break;
|
|
684
|
-
}
|
|
685
|
-
};
|
|
686
|
-
__decorateClass([
|
|
687
|
-
index.attr({ attribute: "readonly", mode: "boolean" })
|
|
688
|
-
], TimePicker.prototype, "readOnly", 2);
|
|
689
285
|
__decorateClass([
|
|
690
|
-
index.attr
|
|
691
|
-
],
|
|
692
|
-
__decorateClass([
|
|
693
|
-
index.attr({ attribute: "seconds-step", converter: index.nullableNumberConverter })
|
|
694
|
-
], TimePicker.prototype, "secondsStep", 2);
|
|
286
|
+
index.attr
|
|
287
|
+
], exports.TextField.prototype, "appearance", 2);
|
|
695
288
|
__decorateClass([
|
|
696
289
|
index.attr
|
|
697
|
-
],
|
|
290
|
+
], exports.TextField.prototype, "shape", 2);
|
|
698
291
|
__decorateClass([
|
|
699
|
-
index.attr
|
|
700
|
-
],
|
|
292
|
+
index.attr
|
|
293
|
+
], exports.TextField.prototype, "autoComplete", 2);
|
|
701
294
|
__decorateClass([
|
|
702
|
-
index.attr(
|
|
703
|
-
],
|
|
295
|
+
index.attr()
|
|
296
|
+
], exports.TextField.prototype, "scale", 2);
|
|
704
297
|
__decorateClass([
|
|
705
298
|
index.observable
|
|
706
|
-
],
|
|
299
|
+
], exports.TextField.prototype, "actionItemsSlottedContent", 2);
|
|
707
300
|
__decorateClass([
|
|
708
301
|
index.observable
|
|
709
|
-
],
|
|
710
|
-
|
|
302
|
+
], exports.TextField.prototype, "leadingActionItemsSlottedContent", 2);
|
|
303
|
+
exports.TextField = __decorateClass([
|
|
711
304
|
formElements.errorText,
|
|
712
305
|
formElements.formElements
|
|
713
|
-
],
|
|
306
|
+
], exports.TextField);
|
|
714
307
|
applyMixinsWithObservables.applyMixinsWithObservables(
|
|
715
|
-
|
|
716
|
-
|
|
308
|
+
exports.TextField,
|
|
309
|
+
affix.AffixIcon,
|
|
310
|
+
formElements.FormElementCharCount,
|
|
717
311
|
formElements.FormElementHelperText,
|
|
718
|
-
|
|
312
|
+
formElements.FormElementSuccessText
|
|
719
313
|
);
|
|
720
314
|
|
|
721
|
-
const
|
|
315
|
+
const getStateClasses = ({
|
|
316
|
+
errorValidationMessage,
|
|
317
|
+
disabled,
|
|
318
|
+
value,
|
|
319
|
+
readOnly,
|
|
320
|
+
placeholder,
|
|
321
|
+
appearance,
|
|
322
|
+
shape,
|
|
323
|
+
label,
|
|
324
|
+
successText,
|
|
325
|
+
actionItemsSlottedContent,
|
|
326
|
+
leadingActionItemsSlottedContent,
|
|
327
|
+
icon,
|
|
328
|
+
scale
|
|
329
|
+
}) => classNames.classNames(
|
|
330
|
+
["error", Boolean(errorValidationMessage)],
|
|
331
|
+
["disabled", disabled],
|
|
332
|
+
["has-value", Boolean(value)],
|
|
333
|
+
["readonly", readOnly],
|
|
334
|
+
["placeholder", Boolean(placeholder)],
|
|
335
|
+
[`appearance-${appearance}`, Boolean(appearance)],
|
|
336
|
+
[`shape-${shape}`, Boolean(shape)],
|
|
337
|
+
["no-label", !label],
|
|
338
|
+
["has-icon", !!icon],
|
|
339
|
+
["success", Boolean(successText)],
|
|
340
|
+
["action-items", !!actionItemsSlottedContent?.length],
|
|
341
|
+
["leading-action-items", !!leadingActionItemsSlottedContent?.length],
|
|
342
|
+
["no-leading", !(leadingActionItemsSlottedContent?.length || icon)],
|
|
343
|
+
[`size-${scale}`, Boolean(scale)]
|
|
344
|
+
);
|
|
345
|
+
function renderCharCount() {
|
|
722
346
|
return index.html`
|
|
723
|
-
<
|
|
724
|
-
|
|
725
|
-
class="picker"
|
|
726
|
-
role="listbox"
|
|
727
|
-
tabindex="0"
|
|
728
|
-
aria-label="${getLabel}"
|
|
729
|
-
aria-activedescendant="${(x) => getSelected(x) ? `${id}-${getSelected(x)}` : void 0}"
|
|
730
|
-
@keydown="${(x, c) => x._onPickerKeyDown(
|
|
731
|
-
id,
|
|
732
|
-
getOptions(x),
|
|
733
|
-
getSelected(x),
|
|
734
|
-
setSelected(x),
|
|
735
|
-
c.event
|
|
736
|
-
)}"
|
|
347
|
+
<span class="char-count"
|
|
348
|
+
>${(x) => x.value ? x.value.length : 0} / ${(x) => x.maxlength}</span
|
|
737
349
|
>
|
|
738
|
-
${repeat.repeat(
|
|
739
|
-
getOptions,
|
|
740
|
-
index.html`
|
|
741
|
-
<li
|
|
742
|
-
id="${(x) => `${id}-${x.value}`}"
|
|
743
|
-
class="${(x, c) => classNames.classNames("item", [
|
|
744
|
-
"selected",
|
|
745
|
-
getSelected(c.parent) === x.value
|
|
746
|
-
])}"
|
|
747
|
-
role="option"
|
|
748
|
-
aria-selected="${(x, c) => getSelected(c.parent) === x.value}"
|
|
749
|
-
@click="${(x, c) => c.parent._onPickerItemClick(id, setSelected(c.parent), x.value)}"
|
|
750
|
-
>
|
|
751
|
-
${(x) => x.label}
|
|
752
|
-
</li>
|
|
753
|
-
`
|
|
754
|
-
)}
|
|
755
|
-
</ul>
|
|
756
350
|
`;
|
|
757
|
-
}
|
|
758
|
-
const
|
|
759
|
-
const
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
@change="${(x) => x._onTextFieldChange()}"
|
|
775
|
-
>
|
|
776
|
-
<slot
|
|
777
|
-
slot="${(x) => x._helperTextSlottedContent?.length ? "helper-text" : void 0}"
|
|
778
|
-
name="helper-text"
|
|
779
|
-
${slotted.slotted("_helperTextSlottedContent")}
|
|
780
|
-
></slot>
|
|
781
|
-
<${buttonTag}
|
|
782
|
-
id="clock-button"
|
|
783
|
-
${ref.ref("_clockButtonEl")}
|
|
784
|
-
slot="action-items"
|
|
785
|
-
size="condensed"
|
|
786
|
-
icon="clock-line"
|
|
787
|
-
appearance="ghost"
|
|
788
|
-
?disabled="${(x) => x.disabled || x.readOnly}"
|
|
789
|
-
aria-label="${(x) => x._clockButtonLabel}"
|
|
790
|
-
@click="${(x) => x._onClockButtonClick()}"
|
|
791
|
-
></${buttonTag}>
|
|
792
|
-
</${textFieldTag}>
|
|
793
|
-
<${popupTag}
|
|
794
|
-
?open="${(x) => x._popupOpen}"
|
|
795
|
-
:anchor="${(x) => x._textFieldEl}"
|
|
796
|
-
placement="bottom-start"
|
|
797
|
-
class="popup">
|
|
798
|
-
<div class="dialog" role="dialog" ${ref.ref(
|
|
799
|
-
"_dialogEl"
|
|
800
|
-
)} aria-modal="true" aria-label="${(x) => x.locale.timePicker.chooseTimeLabel}">
|
|
801
|
-
<div class="time-pickers">
|
|
802
|
-
${renderPicker(
|
|
803
|
-
"hours",
|
|
804
|
-
(x) => x.locale.timePicker.hoursLabel,
|
|
805
|
-
(x) => x._selectedHour,
|
|
806
|
-
(x) => (v) => x._selectedHour = v,
|
|
807
|
-
(x) => x._hours
|
|
808
|
-
)}
|
|
809
|
-
${renderPicker(
|
|
810
|
-
"minutes",
|
|
811
|
-
(x) => x.locale.timePicker.minutesLabel,
|
|
812
|
-
(x) => x._selectedMinute,
|
|
813
|
-
(x) => (v) => x._selectedMinute = v,
|
|
814
|
-
(x) => x._minutes
|
|
815
|
-
)}
|
|
816
|
-
${when.when(
|
|
817
|
-
(x) => x._displaySeconds,
|
|
818
|
-
renderPicker(
|
|
819
|
-
"seconds",
|
|
820
|
-
(x) => x.locale.timePicker.secondsLabel,
|
|
821
|
-
(x) => x._selectedSecond,
|
|
822
|
-
(x) => (v) => x._selectedSecond = v,
|
|
823
|
-
(x) => x._seconds
|
|
824
|
-
)
|
|
825
|
-
)}
|
|
826
|
-
${when.when(
|
|
827
|
-
(x) => x._use12hClock,
|
|
828
|
-
renderPicker(
|
|
829
|
-
"meridies",
|
|
830
|
-
(x) => x.locale.timePicker.meridiesLabel,
|
|
831
|
-
(x) => x._selectedMeridiem,
|
|
832
|
-
(x) => (v) => x._selectedMeridiem = v,
|
|
833
|
-
(x) => x._meridies
|
|
834
|
-
)
|
|
835
|
-
)}
|
|
351
|
+
}
|
|
352
|
+
const TextfieldTemplate = (context) => {
|
|
353
|
+
const affixIconTemplate = affix.affixIconTemplateFactory(context);
|
|
354
|
+
return index.html` <div class="base ${getStateClasses}">
|
|
355
|
+
${when.when((x) => x.charCount && x.maxlength, renderCharCount())}
|
|
356
|
+
<slot class="label" name="_label"></slot>
|
|
357
|
+
<div class="fieldset">
|
|
358
|
+
<div class="leading-items-wrapper">
|
|
359
|
+
<slot
|
|
360
|
+
name="leading-action-items"
|
|
361
|
+
${slotted.slotted("leadingActionItemsSlottedContent")}
|
|
362
|
+
></slot>
|
|
363
|
+
${(x) => affixIconTemplate(x.icon)}
|
|
364
|
+
</div>
|
|
365
|
+
|
|
366
|
+
<div class="wrapper">
|
|
367
|
+
<slot class="control" name="_control"></slot>
|
|
836
368
|
</div>
|
|
837
|
-
<div class="
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
@click="${(x) => x._onClearClick()}"
|
|
843
|
-
></${buttonTag}>
|
|
844
|
-
<${buttonTag}
|
|
845
|
-
class="vwc-button"
|
|
846
|
-
size="condensed"
|
|
847
|
-
appearance="filled"
|
|
848
|
-
label="${(x) => x.locale.timePicker.okLabel}"
|
|
849
|
-
@click="${(x) => x._onOkClick()}"
|
|
850
|
-
></${buttonTag}>
|
|
369
|
+
<div class="action-items-wrapper">
|
|
370
|
+
<slot
|
|
371
|
+
name="action-items"
|
|
372
|
+
${slotted.slotted("actionItemsSlottedContent")}
|
|
373
|
+
></slot>
|
|
851
374
|
</div>
|
|
852
375
|
</div>
|
|
853
|
-
|
|
854
|
-
|
|
376
|
+
${formElements.getFeedbackTemplate(context)}
|
|
377
|
+
</div>
|
|
378
|
+
<slot name="_mirrored-helper-text"></slot>`;
|
|
855
379
|
};
|
|
856
380
|
|
|
857
|
-
const
|
|
858
|
-
baseName: "
|
|
859
|
-
template:
|
|
860
|
-
styles,
|
|
381
|
+
const textFieldDefinition = exports.TextField.compose({
|
|
382
|
+
baseName: "text-field",
|
|
383
|
+
template: TextfieldTemplate,
|
|
384
|
+
styles: textField$1.styles,
|
|
861
385
|
shadowOptions: {
|
|
862
386
|
delegatesFocus: true
|
|
863
387
|
}
|
|
864
388
|
});
|
|
865
|
-
const
|
|
866
|
-
|
|
867
|
-
...definition$1.textFieldRegistries,
|
|
868
|
-
...definition.popupRegistries,
|
|
869
|
-
...definition$2.buttonRegistries
|
|
870
|
-
];
|
|
871
|
-
const registerTimePicker = index.registerFactory(timePickerRegistries);
|
|
389
|
+
const textFieldRegistries = [textFieldDefinition(), ...definition.iconRegistries];
|
|
390
|
+
const registerTextField = index.registerFactory(textFieldRegistries);
|
|
872
391
|
|
|
873
|
-
exports.
|
|
874
|
-
exports.
|
|
875
|
-
exports.
|
|
392
|
+
exports.registerTextField = registerTextField;
|
|
393
|
+
exports.textFieldDefinition = textFieldDefinition;
|
|
394
|
+
exports.textFieldRegistries = textFieldRegistries;
|