courthive-components 3.1.0 → 3.3.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/dist/components/ladderChart/index.d.ts +2 -0
- package/dist/components/ladderChart/ladderChart.d.ts +2 -0
- package/dist/components/ladderChart/types.d.ts +72 -0
- package/dist/components/policy-catalog/engine/policyCatalogStore.d.ts +11 -0
- package/dist/components/policy-catalog/types.d.ts +13 -1
- package/dist/components/policy-catalog/ui/editorShell.d.ts +1 -0
- package/dist/components/tournament-card/styles.d.ts +1 -0
- package/dist/components/tournament-card/types.d.ts +26 -1
- package/dist/courthive-components.css +1 -1
- package/dist/courthive-components.es.js +4381 -3243
- package/dist/courthive-components.umd.js +44 -44
- package/dist/{dist-CwJOJWf0.mjs → dist-DiYU0jFr.mjs} +529 -487
- package/dist/index.d.ts +2 -0
- package/dist/{range-CBX41Ttl.mjs → range-CRxwaxeo.mjs} +125 -58
- package/dist/types.d.ts +14 -2
- package/package.json +6 -6
|
@@ -1,250 +1,189 @@
|
|
|
1
|
-
//#region node_modules/.pnpm/timepicker-ui@4.
|
|
1
|
+
//#region node_modules/.pnpm/timepicker-ui@4.4.0/node_modules/timepicker-ui/dist/index.js
|
|
2
2
|
var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
3
|
-
|
|
3
|
+
_degreesHours = null;
|
|
4
|
+
_degreesMinutes = null;
|
|
5
|
+
_options;
|
|
6
|
+
_isMobileView = !1;
|
|
7
|
+
_isTouchMouseMove = !1;
|
|
8
|
+
_disabledTime = null;
|
|
9
|
+
_cloned = null;
|
|
10
|
+
_isModalRemove = !0;
|
|
11
|
+
_isOpen = !1;
|
|
12
|
+
_isInitialized = !1;
|
|
13
|
+
_eventHandlersRegistered = !1;
|
|
14
|
+
_isDestroyed = !1;
|
|
15
|
+
element;
|
|
16
|
+
instanceId;
|
|
17
|
+
customId;
|
|
4
18
|
constructor(e, t, n, r) {
|
|
5
|
-
this.
|
|
6
|
-
degreesHours: null,
|
|
7
|
-
degreesMinutes: null,
|
|
8
|
-
options: t,
|
|
9
|
-
element: e,
|
|
10
|
-
instanceId: n,
|
|
11
|
-
isMobileView: !1,
|
|
12
|
-
isTouchMouseMove: !1,
|
|
13
|
-
disabledTime: null,
|
|
14
|
-
cloned: null,
|
|
15
|
-
isModalRemove: !0,
|
|
16
|
-
isOpen: !1,
|
|
17
|
-
isInitialized: !1,
|
|
18
|
-
customId: r,
|
|
19
|
-
eventHandlersRegistered: !1,
|
|
20
|
-
isDestroyed: !1
|
|
21
|
-
};
|
|
19
|
+
this.element = e, this.instanceId = n, this.customId = r, this._options = t;
|
|
22
20
|
}
|
|
23
21
|
get degreesHours() {
|
|
24
|
-
return this.
|
|
22
|
+
return this._degreesHours;
|
|
25
23
|
}
|
|
26
24
|
get degreesMinutes() {
|
|
27
|
-
return this.
|
|
25
|
+
return this._degreesMinutes;
|
|
28
26
|
}
|
|
29
27
|
get options() {
|
|
30
|
-
return this.
|
|
31
|
-
}
|
|
32
|
-
get element() {
|
|
33
|
-
return this.state.element;
|
|
34
|
-
}
|
|
35
|
-
get instanceId() {
|
|
36
|
-
return this.state.instanceId;
|
|
28
|
+
return this._options;
|
|
37
29
|
}
|
|
38
30
|
get isMobileView() {
|
|
39
|
-
return this.
|
|
31
|
+
return this._isMobileView;
|
|
40
32
|
}
|
|
41
33
|
get isTouchMouseMove() {
|
|
42
|
-
return this.
|
|
34
|
+
return this._isTouchMouseMove;
|
|
43
35
|
}
|
|
44
36
|
get disabledTime() {
|
|
45
|
-
return this.
|
|
37
|
+
return this._disabledTime;
|
|
46
38
|
}
|
|
47
39
|
get cloned() {
|
|
48
|
-
return this.
|
|
40
|
+
return this._cloned;
|
|
49
41
|
}
|
|
50
42
|
get isModalRemove() {
|
|
51
|
-
return this.
|
|
43
|
+
return this._isModalRemove;
|
|
52
44
|
}
|
|
53
45
|
get isOpen() {
|
|
54
|
-
return this.
|
|
46
|
+
return this._isOpen;
|
|
55
47
|
}
|
|
56
48
|
get isInitialized() {
|
|
57
|
-
return this.
|
|
58
|
-
}
|
|
59
|
-
get customId() {
|
|
60
|
-
return this.state.customId;
|
|
49
|
+
return this._isInitialized;
|
|
61
50
|
}
|
|
62
51
|
get eventHandlersRegistered() {
|
|
63
|
-
return this.
|
|
52
|
+
return this._eventHandlersRegistered;
|
|
64
53
|
}
|
|
65
54
|
get isDestroyed() {
|
|
66
|
-
return this.
|
|
55
|
+
return this._isDestroyed;
|
|
67
56
|
}
|
|
68
57
|
setDegreesHours(e) {
|
|
69
|
-
this.
|
|
70
|
-
...this.state,
|
|
71
|
-
degreesHours: e
|
|
72
|
-
};
|
|
58
|
+
this._degreesHours = e;
|
|
73
59
|
}
|
|
74
60
|
setDegreesMinutes(e) {
|
|
75
|
-
this.
|
|
76
|
-
...this.state,
|
|
77
|
-
degreesMinutes: e
|
|
78
|
-
};
|
|
61
|
+
this._degreesMinutes = e;
|
|
79
62
|
}
|
|
80
63
|
setOptions(e) {
|
|
81
|
-
this.
|
|
82
|
-
...this.state,
|
|
83
|
-
options: e
|
|
84
|
-
};
|
|
64
|
+
this._options = e;
|
|
85
65
|
}
|
|
86
66
|
setIsMobileView(e) {
|
|
87
|
-
this.
|
|
88
|
-
...this.state,
|
|
89
|
-
isMobileView: e
|
|
90
|
-
};
|
|
67
|
+
this._isMobileView = e;
|
|
91
68
|
}
|
|
92
69
|
setIsTouchMouseMove(e) {
|
|
93
|
-
this.
|
|
94
|
-
...this.state,
|
|
95
|
-
isTouchMouseMove: e
|
|
96
|
-
};
|
|
70
|
+
this._isTouchMouseMove = e;
|
|
97
71
|
}
|
|
98
72
|
setDisabledTime(e) {
|
|
99
|
-
this.
|
|
100
|
-
...this.state,
|
|
101
|
-
disabledTime: e
|
|
102
|
-
};
|
|
73
|
+
this._disabledTime = e;
|
|
103
74
|
}
|
|
104
75
|
setCloned(e) {
|
|
105
|
-
this.
|
|
106
|
-
...this.state,
|
|
107
|
-
cloned: e
|
|
108
|
-
};
|
|
76
|
+
this._cloned = e;
|
|
109
77
|
}
|
|
110
78
|
setIsModalRemove(e) {
|
|
111
|
-
this.
|
|
112
|
-
...this.state,
|
|
113
|
-
isModalRemove: e
|
|
114
|
-
};
|
|
79
|
+
this._isModalRemove = e;
|
|
115
80
|
}
|
|
116
81
|
setIsOpen(e) {
|
|
117
|
-
this.
|
|
118
|
-
...this.state,
|
|
119
|
-
isOpen: e
|
|
120
|
-
};
|
|
82
|
+
this._isOpen = e;
|
|
121
83
|
}
|
|
122
84
|
setIsInitialized(e) {
|
|
123
|
-
this.
|
|
124
|
-
...this.state,
|
|
125
|
-
isInitialized: e
|
|
126
|
-
};
|
|
85
|
+
this._isInitialized = e;
|
|
127
86
|
}
|
|
128
87
|
setEventHandlersRegistered(e) {
|
|
129
|
-
this.
|
|
130
|
-
...this.state,
|
|
131
|
-
eventHandlersRegistered: e
|
|
132
|
-
};
|
|
88
|
+
this._eventHandlersRegistered = e;
|
|
133
89
|
}
|
|
134
90
|
setIsDestroyed(e) {
|
|
135
|
-
this.
|
|
136
|
-
...this.state,
|
|
137
|
-
isDestroyed: e
|
|
138
|
-
};
|
|
91
|
+
this._isDestroyed = e;
|
|
139
92
|
}
|
|
140
93
|
updateOptions(e) {
|
|
141
|
-
this.
|
|
142
|
-
...this.
|
|
143
|
-
|
|
144
|
-
...this.
|
|
145
|
-
clock
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
ui
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
labels
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
behavior
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
callbacks
|
|
162
|
-
...this.state.options.callbacks,
|
|
163
|
-
...e.callbacks || {}
|
|
164
|
-
}
|
|
94
|
+
this._options = {
|
|
95
|
+
...this._options,
|
|
96
|
+
clock: {
|
|
97
|
+
...this._options.clock,
|
|
98
|
+
...e.clock || {}
|
|
99
|
+
},
|
|
100
|
+
ui: {
|
|
101
|
+
...this._options.ui,
|
|
102
|
+
...e.ui || {}
|
|
103
|
+
},
|
|
104
|
+
labels: {
|
|
105
|
+
...this._options.labels,
|
|
106
|
+
...e.labels || {}
|
|
107
|
+
},
|
|
108
|
+
behavior: {
|
|
109
|
+
...this._options.behavior,
|
|
110
|
+
...e.behavior || {}
|
|
111
|
+
},
|
|
112
|
+
callbacks: {
|
|
113
|
+
...this._options.callbacks,
|
|
114
|
+
...e.callbacks || {}
|
|
165
115
|
}
|
|
166
116
|
};
|
|
167
117
|
}
|
|
168
118
|
reset() {
|
|
169
|
-
this.
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
isModalRemove: !0,
|
|
177
|
-
isOpen: !1,
|
|
178
|
-
isInitialized: !1,
|
|
179
|
-
isDestroyed: !0,
|
|
180
|
-
eventHandlersRegistered: !1
|
|
181
|
-
};
|
|
119
|
+
this._degreesHours = null, this._degreesMinutes = null, this._isTouchMouseMove = !1, this._disabledTime = null, this._cloned = null, this._isModalRemove = !0, this._isOpen = !1, this._isInitialized = !1, this._isDestroyed = !0, this._eventHandlersRegistered = !1;
|
|
120
|
+
}
|
|
121
|
+
q(e) {
|
|
122
|
+
return this.getModalElement()?.querySelector(e) ?? null;
|
|
123
|
+
}
|
|
124
|
+
qMobile(e, t) {
|
|
125
|
+
return this._isMobileView ? this.q(e) : this.q(t);
|
|
182
126
|
}
|
|
183
127
|
getModalElement() {
|
|
184
|
-
return t() === !1 ? null : document.querySelector(`[data-owner-id="${this.
|
|
128
|
+
return t() === !1 ? null : document.querySelector(`[data-owner-id="${this.instanceId}"]`);
|
|
185
129
|
}
|
|
186
130
|
getInput() {
|
|
187
|
-
return this.
|
|
131
|
+
return this.element?.querySelector("input");
|
|
188
132
|
}
|
|
189
133
|
getClockFace() {
|
|
190
|
-
|
|
191
|
-
return e ? this.state.isMobileView ? e.querySelector(".tp-ui-clock-face.mobile") : e.querySelector(".tp-ui-clock-face:not(.mobile)") : null;
|
|
134
|
+
return this.qMobile(".tp-ui-clock-face.mobile", ".tp-ui-clock-face:not(.mobile)");
|
|
192
135
|
}
|
|
193
136
|
getClockHand() {
|
|
194
|
-
|
|
195
|
-
return e ? this.state.isMobileView ? e.querySelector(".tp-ui-mobile-clock-wrapper .tp-ui-clock-hand") : e.querySelector(".tp-ui-clock-hand:not(.mobile)") : null;
|
|
137
|
+
return this.qMobile(".tp-ui-mobile-clock-wrapper .tp-ui-clock-hand", ".tp-ui-clock-hand:not(.mobile)");
|
|
196
138
|
}
|
|
197
139
|
getCircle() {
|
|
198
|
-
|
|
199
|
-
return e ? this.state.isMobileView ? e.querySelector(".tp-ui-mobile-clock-wrapper .tp-ui-circle-hand") : e.querySelector(".tp-ui-circle-hand:not(.mobile)") : null;
|
|
140
|
+
return this.qMobile(".tp-ui-mobile-clock-wrapper .tp-ui-circle-hand", ".tp-ui-circle-hand:not(.mobile)");
|
|
200
141
|
}
|
|
201
142
|
getTipsWrapper() {
|
|
202
|
-
|
|
203
|
-
return e ? this.state.isMobileView ? e.querySelector(".tp-ui-mobile-clock-wrapper .tp-ui-tips-wrapper") : e.querySelector(".tp-ui-tips-wrapper:not(.mobile)") : null;
|
|
143
|
+
return this.qMobile(".tp-ui-mobile-clock-wrapper .tp-ui-tips-wrapper", ".tp-ui-tips-wrapper:not(.mobile)");
|
|
204
144
|
}
|
|
205
145
|
getTipsWrapperFor24h() {
|
|
206
|
-
|
|
207
|
-
return e ? this.state.isMobileView ? e.querySelector(".tp-ui-mobile-clock-wrapper .tp-ui-tips-wrapper-24h") : e.querySelector(".tp-ui-tips-wrapper-24h:not(.mobile)") : null;
|
|
146
|
+
return this.qMobile(".tp-ui-mobile-clock-wrapper .tp-ui-tips-wrapper-24h", ".tp-ui-tips-wrapper-24h:not(.mobile)");
|
|
208
147
|
}
|
|
209
148
|
getMinutes() {
|
|
210
|
-
return this.
|
|
149
|
+
return this.q(".tp-ui-minutes");
|
|
211
150
|
}
|
|
212
151
|
getHour() {
|
|
213
|
-
return this.
|
|
152
|
+
return this.q(".tp-ui-hour");
|
|
214
153
|
}
|
|
215
154
|
getAM() {
|
|
216
|
-
return this.
|
|
155
|
+
return this.q(".tp-ui-am");
|
|
217
156
|
}
|
|
218
157
|
getPM() {
|
|
219
|
-
return this.
|
|
158
|
+
return this.q(".tp-ui-pm");
|
|
220
159
|
}
|
|
221
160
|
getHourText() {
|
|
222
|
-
return this.
|
|
161
|
+
return this.q(".tp-ui-hour-text");
|
|
223
162
|
}
|
|
224
163
|
getMinutesText() {
|
|
225
|
-
return this.
|
|
164
|
+
return this.q(".tp-ui-minute-text");
|
|
226
165
|
}
|
|
227
166
|
getHeader() {
|
|
228
|
-
return this.
|
|
167
|
+
return this.q(".tp-ui-header");
|
|
229
168
|
}
|
|
230
169
|
getInputWrappers() {
|
|
231
170
|
return this.getModalElement()?.querySelectorAll(".tp-ui-input-wrapper") || null;
|
|
232
171
|
}
|
|
233
172
|
getDots() {
|
|
234
|
-
return this.
|
|
173
|
+
return this.q(".tp-ui-dots");
|
|
235
174
|
}
|
|
236
175
|
getMinutesTips() {
|
|
237
|
-
return this.
|
|
176
|
+
return this.q(".tp-ui-minutes-time");
|
|
238
177
|
}
|
|
239
178
|
getHourTips() {
|
|
240
|
-
return this.
|
|
179
|
+
return this.q(".tp-ui-hour-time-12");
|
|
241
180
|
}
|
|
242
181
|
getAllValueTips() {
|
|
243
182
|
let e = this.getModalElement();
|
|
244
183
|
return e ? [...e.querySelectorAll(".tp-ui-value-tips"), ...e.querySelectorAll(".tp-ui-value-tips-24h")] : [];
|
|
245
184
|
}
|
|
246
185
|
getOpenElementData() {
|
|
247
|
-
let e = this.
|
|
186
|
+
let e = this.element?.querySelectorAll("[data-open]");
|
|
248
187
|
if (e?.length > 0) {
|
|
249
188
|
let t = [];
|
|
250
189
|
return e.forEach(({ dataset: e }) => t.push(e.open ?? "")), [...new Set(t)];
|
|
@@ -253,25 +192,25 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
253
192
|
}
|
|
254
193
|
getOpenElement() {
|
|
255
194
|
let e = this.getInput(), t = this.getOpenElementData();
|
|
256
|
-
return t === null ? (e?.setAttribute("data-open", "tp-ui-input"), [e]) : t.map((e) => this.
|
|
195
|
+
return t === null ? (e?.setAttribute("data-open", "tp-ui-input"), [e]) : t.map((e) => this.element?.querySelectorAll(`[data-open='${e}']`))[0] ?? "";
|
|
257
196
|
}
|
|
258
197
|
getCancelButton() {
|
|
259
|
-
return this.
|
|
198
|
+
return this.q(".tp-ui-cancel-btn");
|
|
260
199
|
}
|
|
261
200
|
getOkButton() {
|
|
262
|
-
return this.
|
|
201
|
+
return this.q(".tp-ui-ok-btn");
|
|
263
202
|
}
|
|
264
203
|
getActiveTypeMode() {
|
|
265
|
-
return this.
|
|
204
|
+
return this.q(".tp-ui-type-mode.active");
|
|
266
205
|
}
|
|
267
206
|
getKeyboardClockIcon() {
|
|
268
|
-
return this.
|
|
207
|
+
return this.q(".tp-ui-keyboard-icon-wrapper");
|
|
269
208
|
}
|
|
270
209
|
getFooter() {
|
|
271
|
-
return this.
|
|
210
|
+
return this.q(".tp-ui-footer");
|
|
272
211
|
}
|
|
273
212
|
getWrapper() {
|
|
274
|
-
return this.
|
|
213
|
+
return this.q(".tp-ui-wrapper");
|
|
275
214
|
}
|
|
276
215
|
}, r = {
|
|
277
216
|
DEFAULT_DELAY: 300,
|
|
@@ -444,24 +383,25 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
444
383
|
</div>
|
|
445
384
|
</div>`;
|
|
446
385
|
}, b = (e) => {
|
|
447
|
-
let { range: { enabled: t, fromLabel: n, toLabel: r } } = e;
|
|
448
|
-
return !t || !h.has("range") ? "" : `<div class="tp-ui-range-header" role="tablist" aria-label="
|
|
386
|
+
let { range: { enabled: t, fromLabel: n, toLabel: r }, labels: { rangeSelectionLabel: i } } = e;
|
|
387
|
+
return !t || !h.has("range") ? "" : `<div class="tp-ui-range-header" role="tablist" aria-label="${i}"><button type="button" class="tp-ui-range-tab tp-ui-range-from active" role="tab" tabindex="0" aria-selected="true"><span class="tp-ui-range-tab-label">${n}</span><span class="tp-ui-range-tab-value tp-ui-range-from-time">--:--</span></button><button type="button" class="tp-ui-range-tab tp-ui-range-to" role="tab" tabindex="-1" aria-selected="false"><span class="tp-ui-range-tab-label">${r}</span><span class="tp-ui-range-tab-value tp-ui-range-to-time">--:--</span></button></div>`;
|
|
449
388
|
}, x = (e, t) => {
|
|
450
389
|
let { ui: { clearButton: n }, labels: { clear: r } } = e;
|
|
451
|
-
return n ? `<div class="tp-ui-clear-btn ${t} disabled" data-md3-ripple tabindex="0" role="button" aria-
|
|
390
|
+
return n ? `<div class="tp-ui-clear-btn ${t} disabled" data-md3-ripple tabindex="0" role="button" aria-label="${r}" aria-disabled="true">${r}</div>` : "";
|
|
452
391
|
}, ee = (e, t, n) => {
|
|
453
392
|
if (e.isWheelMode) {
|
|
454
393
|
let t = h.getTemplateProvider("wheel");
|
|
455
394
|
return t ? `<div class="tp-ui-mobile-clock-wrapper ${e.mobileClass}">${t(n, e.instanceId)}</div>` : `<div class="tp-ui-mobile-clock-wrapper ${e.mobileClass}"></div>`;
|
|
456
395
|
}
|
|
457
|
-
|
|
396
|
+
let { labels: { clockLabel: r } } = n;
|
|
397
|
+
return `<div class="tp-ui-mobile-clock-wrapper ${e.mobileClass}"><div class="tp-ui-body ${e.mobileClass}"><div class="tp-ui-clock-face ${e.mobileClass}" role="group" aria-label="${r}"><div class="tp-ui-dot ${e.mobileClass}" aria-hidden="true"></div><div class="tp-ui-clock-hand ${e.mobileClass}" aria-hidden="true"><div class="tp-ui-circle-hand ${e.mobileClass}"></div></div><div class="tp-ui-tips-wrapper ${e.mobileClass}" aria-hidden="true"></div>${e.clockType === "24h" ? `<div class="tp-ui-tips-wrapper-24h ${e.mobileClass}" aria-hidden="true"></div>` : ""}</div></div></div>`;
|
|
458
398
|
}, te = (e, t) => {
|
|
459
|
-
let { labels: { time: n, mobileTime: r,
|
|
460
|
-
return `<div class="tp-ui-select-time ${
|
|
399
|
+
let { labels: { time: n, mobileTime: r, timeLabel: i, am: a, pm: o, mobileMinute: s, mobileHour: c, hourLabel: l, minuteLabel: u, periodLabel: d }, ui: { editable: f } } = e, { mobileClass: p, clockType: m, instanceId: h } = t, g = p ? r : n, _ = m === "12h", v = _ ? "1" : "0", y = _ ? "12" : "23", b = _ ? "12" : "0", x = m === "24h" ? "" : `<div class="tp-ui-wrapper-type-time ${p}" role="group" aria-label="${d}"><div class="tp-ui-type-mode tp-ui-am ${p ? "mobile" : "tp-ui-ripple"}" data-md3-ripple tabindex="0" role="button" aria-label="${a}" aria-pressed="false" data-type="AM">${a}</div><div class="tp-ui-type-mode tp-ui-pm ${p ? "mobile" : "tp-ui-ripple"}" data-md3-ripple tabindex="0" role="button" aria-label="${o}" aria-pressed="false" data-type="PM">${o}</div></div>`;
|
|
400
|
+
return `<div class="tp-ui-select-time ${p}" id="tp-ui-label-${h}">${g}</div><div class="tp-ui-header ${p}"><div class="tp-ui-wrapper-time ${p} ${m === "24h" ? "tp-ui-wrapper-time-24h" : ""}" role="group" aria-label="${i}"><div class="tp-ui-input-wrapper ${p}"><div class="tp-ui-input-ripple-wrapper ${p}" data-md3-ripple><input name="hour" ${!f && !p ? "readonly" : ""} class="tp-ui-hour ${p}" tabindex="0" type="number" min="${v}" max="${y}" aria-label="${p ? c : l}" role="spinbutton" aria-valuemin="${v}" aria-valuemax="${y}" aria-valuenow="${b}" aria-valuetext="${b}"></div><div class="tp-ui-hour-text ${p}">${c}</div></div><div class="tp-ui-dots ${p}" aria-hidden="true"><span></span><span></span></div><div class="tp-ui-input-wrapper ${p}"><div class="tp-ui-input-ripple-wrapper ${p}" data-md3-ripple><input name="minutes" ${!f && !p ? "readonly" : ""} class="tp-ui-minutes ${p}" tabindex="0" type="number" min="0" max="59" aria-label="${p ? s : u}" role="spinbutton" aria-valuemin="0" aria-valuemax="59" aria-valuenow="0" aria-valuetext="00"></div><div class="tp-ui-minute-text ${p}">${s}</div></div></div>${x}</div>`;
|
|
461
401
|
}, ne = (e, t) => {
|
|
462
|
-
let { ui: { enableSwitchIcon: n, iconTemplate: r, iconTemplateMobile: i }, labels: { cancel: a, ok: o } } = e,
|
|
463
|
-
return `<div class="tp-ui-footer ${t}" ${t ? "data-view=\"mobile\"" : ""}>${
|
|
464
|
-
},
|
|
402
|
+
let { ui: { enableSwitchIcon: n, iconTemplate: r, iconTemplateMobile: i }, labels: { cancel: a, ok: o, switchToKeyboardLabel: s, switchToClockLabel: c, toggleLabel: l } } = e, u = `<button aria-label="${s}" type="button" class="tp-ui-keyboard-icon">${r || p}</button>`, d = i || `<button aria-label="${c}" type="button" class="tp-ui-keyboard-icon">${i || m}</button>`, f = n ? `<div class="tp-ui-keyboard-icon-wrapper ${t}" tabindex="0" role="button" aria-pressed="false" aria-label="${l}" data-view="desktop">${t ? d : u}</div>` : "", h = x(e, t);
|
|
403
|
+
return `<div class="tp-ui-footer ${t}" ${t ? "data-view=\"mobile\"" : ""}>${f}<div class="tp-ui-wrapper-btn ${t}">${h}<div class="tp-ui-cancel-btn ${t}" data-md3-ripple tabindex="0" role="button" aria-label="${a}">${a}</div><div class="tp-ui-ok-btn ${t}" data-md3-ripple tabindex="0" role="button" aria-label="${o}">${o}</div></div></div>`;
|
|
404
|
+
}, re = (e, t) => {
|
|
465
405
|
let { ui: { mode: n, animation: r, theme: i, mobile: a }, clock: { incrementMinutes: o } } = e, s = a ? "mobile" : "", c = n === "compact-wheel" && h.has("wheel"), l = (n === "wheel" || c) && h.has("wheel"), u = !!e.range?.enabled && h.has("range"), d = !!e.timezone?.enabled && h.has("timezone"), f = {
|
|
466
406
|
mobileClass: s,
|
|
467
407
|
clockType: e.clock.type || "12h",
|
|
@@ -471,12 +411,18 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
471
411
|
isRangeMode: u
|
|
472
412
|
}, p = b(e), m = y(e, s, t), g = c ? "" : te(e, f), _ = ee(f, o ?? 1, e), v = c && e.wheel?.hideFooter === !0 ? "" : ne(e, s), x;
|
|
473
413
|
return x = c ? " tp-ui-compact-wheel-mode" : l ? " tp-ui-wheel-mode" : "", `<div class="tp-ui-modal normalize ${s}${u ? " tp-ui-range-mode" : ""}${d ? " tp-ui-tz-mode" : ""}${x}" data-theme="${i}" role="dialog" aria-modal="true" aria-labelledby="tp-ui-label-${t}" data-owner-id="${t}" style='transition:${r ? "opacity 0.15s linear" : "none"}'><div class="tp-ui-wrapper ${s}" tabindex="0">${p}${g}${m}${_}${v}</div><div class="timepicker-announcer sr-only" role="status" aria-live="polite" aria-atomic="true"></div></div>`;
|
|
474
|
-
},
|
|
414
|
+
}, S = 0, C = "", w = "";
|
|
415
|
+
function ie() {
|
|
416
|
+
S === 0 && (C = document.body.style.overflowY, w = document.body.style.paddingRight, document.body.style.paddingRight = `${a()}px`, document.body.style.overflowY = "hidden"), S += 1;
|
|
417
|
+
}
|
|
418
|
+
function ae() {
|
|
419
|
+
S !== 0 && (--S, S === 0 && (document.body.style.overflowY = C, document.body.style.paddingRight = w, C = "", w = ""));
|
|
420
|
+
}
|
|
421
|
+
var oe = class {
|
|
475
422
|
core;
|
|
476
423
|
emitter;
|
|
477
424
|
timeouts = [];
|
|
478
|
-
|
|
479
|
-
originalPaddingRight;
|
|
425
|
+
scrollLocked = !1;
|
|
480
426
|
constructor(e, t) {
|
|
481
427
|
this.core = e, this.emitter = t;
|
|
482
428
|
}
|
|
@@ -498,7 +444,7 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
498
444
|
setModalTemplate() {
|
|
499
445
|
if (t() === !1) return;
|
|
500
446
|
this.clearExistingModal();
|
|
501
|
-
let e =
|
|
447
|
+
let e = re(this.core.options, this.core.instanceId);
|
|
502
448
|
if (this.core.options.ui.inline?.enabled) {
|
|
503
449
|
let t = document.getElementById(this.core.options.ui.inline.containerId);
|
|
504
450
|
if (!t) return;
|
|
@@ -514,12 +460,18 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
514
460
|
let { appendModalSelector: n } = this.core.options.ui;
|
|
515
461
|
n ? document.querySelector(n)?.insertAdjacentHTML("beforeend", e) : document.body.insertAdjacentHTML("beforeend", e);
|
|
516
462
|
}
|
|
463
|
+
lockScroll() {
|
|
464
|
+
t() !== !1 && (this.core.options.ui.inline?.enabled || this.isPopoverMode() || this.core.options.ui.enableScrollbar || this.scrollLocked || (this.scrollLocked = !0, ie()));
|
|
465
|
+
}
|
|
466
|
+
unlockScroll() {
|
|
467
|
+
t() !== !1 && this.scrollLocked && (this.scrollLocked = !1, ae());
|
|
468
|
+
}
|
|
517
469
|
setScrollbarOrNot() {
|
|
518
470
|
t() !== !1 && (this.core.options.ui.inline?.enabled || this.isPopoverMode() || (this.core.options.ui.enableScrollbar ? this.runWithTimeout(() => {
|
|
519
471
|
e() || this.runWithTimeout(() => {
|
|
520
|
-
|
|
472
|
+
this.unlockScroll();
|
|
521
473
|
}, r.SCROLLBAR_RESTORE);
|
|
522
|
-
}, 400) :
|
|
474
|
+
}, 400) : this.lockScroll()));
|
|
523
475
|
}
|
|
524
476
|
removeBackdrop() {
|
|
525
477
|
if (this.core.options.ui.inline?.enabled || this.core.options.ui.backdrop) return;
|
|
@@ -551,9 +503,9 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
551
503
|
!this.core.options.ui.enableSwitchIcon && e && (e.style.justifyContent = "flex-end");
|
|
552
504
|
}
|
|
553
505
|
destroy() {
|
|
554
|
-
this.clearAllTimeouts(),
|
|
506
|
+
this.clearAllTimeouts(), this.unlockScroll(), this.clearExistingModal();
|
|
555
507
|
}
|
|
556
|
-
},
|
|
508
|
+
}, T = (e, t, n, r) => {
|
|
557
509
|
let i = {
|
|
558
510
|
hour: "12",
|
|
559
511
|
minutes: "00",
|
|
@@ -652,7 +604,7 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
652
604
|
currentMin: m
|
|
653
605
|
};
|
|
654
606
|
return f;
|
|
655
|
-
},
|
|
607
|
+
}, E = (e, t, n) => {
|
|
656
608
|
let r = Number(e);
|
|
657
609
|
if (Number.isNaN(r)) return !1;
|
|
658
610
|
switch (t) {
|
|
@@ -660,7 +612,7 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
660
612
|
case "minutes": return r >= 0 && r <= 59;
|
|
661
613
|
default: return;
|
|
662
614
|
}
|
|
663
|
-
},
|
|
615
|
+
}, D = "tp-ui", se = "mousedown mouseup mousemove mouseleave mouseover touchstart touchmove touchend", O = "active", ce = class {
|
|
664
616
|
core;
|
|
665
617
|
emitter;
|
|
666
618
|
constructor(e, t) {
|
|
@@ -677,20 +629,20 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
677
629
|
let { currentTime: t, clockType: n } = {
|
|
678
630
|
currentTime: this.core.options.clock.currentTime,
|
|
679
631
|
clockType: this.core.options.clock.type
|
|
680
|
-
}, { type: r } =
|
|
632
|
+
}, { type: r } = T(e, n, t, !0);
|
|
681
633
|
this.core.updateOptions({ clock: { type: r ? "12h" : "24h" } });
|
|
682
634
|
}
|
|
683
635
|
updateInputValueWithCurrentTimeOnStart() {
|
|
684
636
|
if (!this.isCurrentTimeEnabled("updateInput")) return;
|
|
685
637
|
let e = this.core.getInput();
|
|
686
638
|
if (!e) return;
|
|
687
|
-
let { hour: t, minutes: n, type: r } =
|
|
639
|
+
let { hour: t, minutes: n, type: r } = T(e, this.core.options.clock.type, this.core.options.clock.currentTime);
|
|
688
640
|
e.value = r ? `${t}:${n} ${r}` : `${t}:${n}`;
|
|
689
641
|
}
|
|
690
642
|
getInputValueOnOpenAndSet() {
|
|
691
643
|
let e = this.core.getInput();
|
|
692
644
|
if (!e) return;
|
|
693
|
-
let t =
|
|
645
|
+
let t = T(e, this.core.options.clock.type, this.core.options.clock.currentTime), n = this.core.getHour(), r = this.core.getMinutes(), i = this.core.getActiveTypeMode(), a = this.core.getAM();
|
|
694
646
|
if (t === void 0) {
|
|
695
647
|
n && (n.value = "12"), r && (r.value = "00");
|
|
696
648
|
let e = {
|
|
@@ -702,13 +654,13 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
702
654
|
};
|
|
703
655
|
this.emitter.emit("open", e);
|
|
704
656
|
let t = this.core.options.range?.enabled === !0;
|
|
705
|
-
this.core.options.clock.type !== "24h" && a && !t && a.classList.add(
|
|
657
|
+
this.core.options.clock.type !== "24h" && a && !t && a.classList.add(O);
|
|
706
658
|
return;
|
|
707
659
|
}
|
|
708
660
|
let [o, s, c] = e.value.split(":").join(" ").split(" ");
|
|
709
661
|
e.value.length === 0 && (o = t.hour, s = t.minutes, c = t.type), this.core.options.clock.type !== "24h" && !c && (c = t.type || "AM"), n && (n.value = o.padStart(2, "0")), r && (r.value = s.padStart(2, "0"));
|
|
710
662
|
let l = this.core.getModalElement()?.querySelector(`[data-type='${c}']`);
|
|
711
|
-
this.core.options.clock.type !== "24h" && l && l.classList.add(
|
|
663
|
+
this.core.options.clock.type !== "24h" && l && l.classList.add(O);
|
|
712
664
|
let u = {
|
|
713
665
|
...t,
|
|
714
666
|
type: i?.dataset.type,
|
|
@@ -718,10 +670,10 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
718
670
|
this.emitter.emit("open", u);
|
|
719
671
|
}
|
|
720
672
|
getInputValue(e, t, n) {
|
|
721
|
-
return
|
|
673
|
+
return T(e, t, n);
|
|
722
674
|
}
|
|
723
675
|
destroy() {}
|
|
724
|
-
},
|
|
676
|
+
}, le = class {
|
|
725
677
|
core;
|
|
726
678
|
emitter;
|
|
727
679
|
isAnimating = !1;
|
|
@@ -814,7 +766,7 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
814
766
|
return e?.classList.contains("tp-ui-tz-mode") ? "326px" : e?.classList.contains("tp-ui-range-mode") ? "287px" : "258px";
|
|
815
767
|
}
|
|
816
768
|
destroy() {}
|
|
817
|
-
},
|
|
769
|
+
}, ue = (e) => {
|
|
818
770
|
if (!e) return;
|
|
819
771
|
let { disabledTime: t, type: n } = e.clock;
|
|
820
772
|
if (!t || !Object.keys(t).length) return;
|
|
@@ -824,7 +776,7 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
824
776
|
let e = Array.isArray(a) ? a : [a];
|
|
825
777
|
if (!n) throw Error("clockType required for interval");
|
|
826
778
|
return d(e, n), { value: e.map((e) => {
|
|
827
|
-
let [t, r] = e.trim().split("-"), { hour: i, minutes: a, type: o } =
|
|
779
|
+
let [t, r] = e.trim().split("-"), { hour: i, minutes: a, type: o } = T({ value: t.trim() }, n), { hour: l, minutes: u, type: d } = T({ value: r.trim() }, n), f = s(i, l).map((e) => Number(e) === 0 ? "00" : String(Number(e))), p = [], m = Number(a), h = Number(u);
|
|
828
780
|
if (d === o) return m > 0 && h <= 0 ? (p.push(f[0], f[f.length - 1]), f = f.slice(1, -1)) : h < 59 && h > 0 && m <= 0 ? (p.push(void 0, f[f.length - 1]), f = f.slice(0, -1)) : h > 0 && m > 0 ? (p.push(f[0], f[f.length - 1]), f = f.slice(1, -1)) : h === 0 && m === 0 && (p.push(void 0, f[f.length - 1]), f.pop()), {
|
|
829
781
|
removedStartedHour: p[0] !== void 0 && Number(p[0]) <= 9 ? `0${p[0]}` : p[0],
|
|
830
782
|
removedEndHour: p[1] !== void 0 && Number(p[1]) <= 9 ? `0${p[1]}` : p[1],
|
|
@@ -866,29 +818,29 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
866
818
|
} };
|
|
867
819
|
}, k = (e, t, n, r) => {
|
|
868
820
|
if (e) {
|
|
869
|
-
if (Array.isArray(e) && e.length > 0) return !e.map((e) =>
|
|
821
|
+
if (Array.isArray(e) && e.length > 0) return !e.map((e) => E(e, t, n)).some((e) => e === !1);
|
|
870
822
|
if (typeof e == "string" || typeof e == "number") {
|
|
871
|
-
let i =
|
|
823
|
+
let i = E(e, t, n), a = r?.map(Number).includes(Number(e));
|
|
872
824
|
return !!(i && !a);
|
|
873
825
|
}
|
|
874
826
|
}
|
|
875
|
-
},
|
|
827
|
+
}, de = class {
|
|
876
828
|
core;
|
|
877
829
|
constructor(e) {
|
|
878
830
|
this.core = e;
|
|
879
831
|
}
|
|
880
832
|
getDisableTime() {
|
|
881
|
-
let e =
|
|
833
|
+
let e = ue(this.core.options);
|
|
882
834
|
this.core.setDisabledTime(e || null);
|
|
883
835
|
}
|
|
884
836
|
destroy() {}
|
|
885
|
-
},
|
|
837
|
+
}, fe = class {
|
|
886
838
|
inputValueHandler;
|
|
887
839
|
mobileViewHandler;
|
|
888
840
|
disabledTimeHandler;
|
|
889
841
|
core;
|
|
890
842
|
constructor(e, t) {
|
|
891
|
-
this.core = e, this.inputValueHandler = new
|
|
843
|
+
this.core = e, this.inputValueHandler = new ce(e, t), this.mobileViewHandler = new le(e, t), this.disabledTimeHandler = new de(e);
|
|
892
844
|
}
|
|
893
845
|
preventClockTypeByCurrentTime() {
|
|
894
846
|
this.inputValueHandler.preventClockTypeByCurrentTime();
|
|
@@ -917,7 +869,7 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
917
869
|
destroy() {
|
|
918
870
|
this.inputValueHandler.destroy(), this.mobileViewHandler.destroy(), this.disabledTimeHandler.destroy();
|
|
919
871
|
}
|
|
920
|
-
},
|
|
872
|
+
}, pe = class {
|
|
921
873
|
core;
|
|
922
874
|
emitter;
|
|
923
875
|
constructor(e, t) {
|
|
@@ -944,9 +896,9 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
944
896
|
setTimepickerClassToElement() {
|
|
945
897
|
let e = this.core.element;
|
|
946
898
|
if (!e) return;
|
|
947
|
-
e.classList.add(
|
|
899
|
+
e.classList.add(D);
|
|
948
900
|
let t = this.core.options.ui.cssClass;
|
|
949
|
-
t && t !==
|
|
901
|
+
t && t !== D && e.classList.add(t);
|
|
950
902
|
}
|
|
951
903
|
destroy() {
|
|
952
904
|
let e = this.core.getModalElement();
|
|
@@ -966,7 +918,25 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
966
918
|
INLINE_CONFIG_ERROR: "INLINE_CONFIG_ERROR",
|
|
967
919
|
CONTAINER_NOT_FOUND: "CONTAINER_NOT_FOUND",
|
|
968
920
|
SSR_ENVIRONMENT: "SSR_ENVIRONMENT"
|
|
969
|
-
},
|
|
921
|
+
}, M = (e, t) => {
|
|
922
|
+
if (!e) return;
|
|
923
|
+
let n = e.querySelector(".timepicker-announcer");
|
|
924
|
+
n && (n.textContent = "", setTimeout(() => {
|
|
925
|
+
n.textContent = t;
|
|
926
|
+
}, 100));
|
|
927
|
+
}, N = (e, t) => {
|
|
928
|
+
e && e.setAttribute("aria-pressed", String(t));
|
|
929
|
+
}, P = (e) => e.getAttribute("aria-disabled") === "true" || e.classList.contains("disabled"), F = (e, t) => {
|
|
930
|
+
if (!e) return () => {};
|
|
931
|
+
let n = (n) => {
|
|
932
|
+
P(e) || t(n);
|
|
933
|
+
}, r = (n) => {
|
|
934
|
+
n.key !== "Enter" && n.key !== " " && n.key !== "Spacebar" || ((n.key === " " || n.key === "Spacebar") && n.preventDefault(), !P(e) && t(n));
|
|
935
|
+
};
|
|
936
|
+
return e.addEventListener("click", n), e.addEventListener("keydown", r), () => {
|
|
937
|
+
e.removeEventListener("click", n), e.removeEventListener("keydown", r);
|
|
938
|
+
};
|
|
939
|
+
}, me = () => typeof window > "u" || typeof window.matchMedia != "function" ? !1 : window.matchMedia("(prefers-reduced-motion: reduce)").matches, he = class {
|
|
970
940
|
core;
|
|
971
941
|
emitter;
|
|
972
942
|
constructor(e, t) {
|
|
@@ -975,12 +945,14 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
975
945
|
setErrorHandler() {
|
|
976
946
|
let e = this.core.getInput();
|
|
977
947
|
if (!e) return !0;
|
|
978
|
-
let { error: n, currentHour: r, currentMin: i, currentType: a, currentLength: o } =
|
|
948
|
+
let { error: n, currentHour: r, currentMin: i, currentType: a, currentLength: o } = T(e, this.core.options.clock.type);
|
|
979
949
|
if (this.removeErrorHandler(), n) {
|
|
980
950
|
if (t() === !1) return !1;
|
|
981
|
-
let s = document.createElement("div");
|
|
982
|
-
|
|
983
|
-
let
|
|
951
|
+
let s = this.core.options.labels.invalidTimeFormat ?? "Invalid time format", c = document.createElement("div");
|
|
952
|
+
c.classList.add("tp-ui-invalid-text"), c.setAttribute("role", "alert");
|
|
953
|
+
let l = document.createElement("b");
|
|
954
|
+
l.textContent = s, c.appendChild(l), e.classList.add("tp-ui-invalid-format"), e.nextElementSibling?.classList.contains("tp-ui-invalid-text") || e.after(c), M(this.core.getModalElement(), s);
|
|
955
|
+
let u = {
|
|
984
956
|
error: n,
|
|
985
957
|
rejectedHour: void 0,
|
|
986
958
|
rejectedMinute: void 0,
|
|
@@ -989,7 +961,7 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
989
961
|
inputType: a,
|
|
990
962
|
inputLength: o
|
|
991
963
|
};
|
|
992
|
-
return this.emitter.emit("error",
|
|
964
|
+
return this.emitter.emit("error", u), !1;
|
|
993
965
|
}
|
|
994
966
|
return !0;
|
|
995
967
|
}
|
|
@@ -1019,15 +991,7 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
1019
991
|
destroy() {
|
|
1020
992
|
this.removeErrorHandler();
|
|
1021
993
|
}
|
|
1022
|
-
},
|
|
1023
|
-
if (!e) return;
|
|
1024
|
-
let n = e.querySelector(".timepicker-announcer");
|
|
1025
|
-
n && (n.textContent = "", setTimeout(() => {
|
|
1026
|
-
n.textContent = t;
|
|
1027
|
-
}, 100));
|
|
1028
|
-
}, N = (e, t) => {
|
|
1029
|
-
e && e.setAttribute("aria-pressed", String(t));
|
|
1030
|
-
}, ue = class {
|
|
994
|
+
}, ge = class {
|
|
1031
995
|
core;
|
|
1032
996
|
emitter;
|
|
1033
997
|
cleanupHandlers = [];
|
|
@@ -1037,100 +1001,90 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
1037
1001
|
handleOpenOnClick() {
|
|
1038
1002
|
let e = this.core.getOpenElement();
|
|
1039
1003
|
if (!e) return;
|
|
1040
|
-
let t = (
|
|
1041
|
-
this.core.isDestroyed ||
|
|
1004
|
+
let t = () => {
|
|
1005
|
+
this.core.isDestroyed || this.emitter.emit("show", {});
|
|
1042
1006
|
};
|
|
1043
1007
|
e.forEach((e) => {
|
|
1044
|
-
|
|
1008
|
+
this.cleanupHandlers.push(F(e, t));
|
|
1045
1009
|
});
|
|
1046
1010
|
}
|
|
1047
1011
|
handleCancelButton() {
|
|
1048
1012
|
let e = this.core.getCancelButton();
|
|
1049
|
-
|
|
1050
|
-
let t = () => {
|
|
1013
|
+
e && this.cleanupHandlers.push(F(e, () => {
|
|
1051
1014
|
this.core.isDestroyed || this.emitter.emit("cancel", {});
|
|
1052
|
-
};
|
|
1053
|
-
e.addEventListener("click", t), this.cleanupHandlers.push(() => e.removeEventListener("click", t));
|
|
1015
|
+
}));
|
|
1054
1016
|
}
|
|
1055
1017
|
handleOkButton() {
|
|
1056
1018
|
let e = this.core.getOkButton();
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
let n = this.core.getActiveTypeMode();
|
|
1019
|
+
e && this.cleanupHandlers.push(F(e, () => {
|
|
1020
|
+
if (this.core.isDestroyed || e.getAttribute("aria-disabled") === "true") return;
|
|
1021
|
+
let t = this.core.getHour(), n = this.core.getMinutes();
|
|
1022
|
+
if (t && n) {
|
|
1023
|
+
let e = this.core.getActiveTypeMode();
|
|
1063
1024
|
this.emitter.emit("confirm", {
|
|
1064
|
-
hour:
|
|
1065
|
-
minutes:
|
|
1066
|
-
type:
|
|
1025
|
+
hour: t.value,
|
|
1026
|
+
minutes: n.value,
|
|
1027
|
+
type: e?.textContent || void 0
|
|
1067
1028
|
});
|
|
1068
1029
|
return;
|
|
1069
1030
|
}
|
|
1070
|
-
let
|
|
1071
|
-
if (
|
|
1072
|
-
let e =
|
|
1031
|
+
let r = this.core.getModalElement();
|
|
1032
|
+
if (r) {
|
|
1033
|
+
let e = r.querySelector(".tp-ui-wheel-hours .tp-ui-wheel-item.is-center"), t = r.querySelector(".tp-ui-wheel-minutes .tp-ui-wheel-item.is-center"), n = r.querySelector(".tp-ui-wheel-ampm .tp-ui-wheel-item.is-center");
|
|
1073
1034
|
this.emitter.emit("confirm", {
|
|
1074
1035
|
hour: e?.getAttribute("data-value") ?? void 0,
|
|
1075
1036
|
minutes: t?.getAttribute("data-value") ?? void 0,
|
|
1076
|
-
type:
|
|
1037
|
+
type: n?.getAttribute("data-value") ?? void 0
|
|
1077
1038
|
});
|
|
1078
1039
|
}
|
|
1079
|
-
};
|
|
1080
|
-
e.addEventListener("click", t), this.cleanupHandlers.push(() => e.removeEventListener("click", t));
|
|
1040
|
+
}));
|
|
1081
1041
|
}
|
|
1082
1042
|
handleAmClick() {
|
|
1083
1043
|
let e = this.core.getAM();
|
|
1084
|
-
|
|
1085
|
-
let t = () => {
|
|
1044
|
+
e && this.cleanupHandlers.push(F(e, () => {
|
|
1086
1045
|
if (this.core.isDestroyed) return;
|
|
1087
1046
|
let t = this.core.getPM();
|
|
1088
|
-
e.classList.add("active"), t?.classList.remove("active"), N(e, !0), N(t, !1), M(this.core.getModalElement(), "AM selected"), this.emitter.emit("select:am", {});
|
|
1047
|
+
e.classList.add("active"), t?.classList.remove("active"), N(e, !0), N(t, !1), M(this.core.getModalElement(), this.core.options.labels.announceAmSelected ?? "AM selected"), this.emitter.emit("select:am", {});
|
|
1089
1048
|
let n = this.core.getHour(), r = this.core.getMinutes();
|
|
1090
1049
|
this.emitter.emit("update", {
|
|
1091
1050
|
hour: n?.value,
|
|
1092
1051
|
minutes: r?.value,
|
|
1093
1052
|
type: "AM"
|
|
1094
1053
|
});
|
|
1095
|
-
};
|
|
1096
|
-
e.addEventListener("click", t), this.cleanupHandlers.push(() => e.removeEventListener("click", t));
|
|
1054
|
+
}));
|
|
1097
1055
|
}
|
|
1098
1056
|
handlePmClick() {
|
|
1099
1057
|
let e = this.core.getPM();
|
|
1100
|
-
|
|
1101
|
-
let t = () => {
|
|
1058
|
+
e && this.cleanupHandlers.push(F(e, () => {
|
|
1102
1059
|
if (this.core.isDestroyed) return;
|
|
1103
1060
|
let t = this.core.getAM();
|
|
1104
|
-
e.classList.add("active"), t?.classList.remove("active"), N(e, !0), N(t, !1), M(this.core.getModalElement(), "PM selected"), this.emitter.emit("select:pm", {});
|
|
1061
|
+
e.classList.add("active"), t?.classList.remove("active"), N(e, !0), N(t, !1), M(this.core.getModalElement(), this.core.options.labels.announcePmSelected ?? "PM selected"), this.emitter.emit("select:pm", {});
|
|
1105
1062
|
let n = this.core.getHour(), r = this.core.getMinutes();
|
|
1106
1063
|
this.emitter.emit("update", {
|
|
1107
1064
|
hour: n?.value,
|
|
1108
1065
|
minutes: r?.value,
|
|
1109
1066
|
type: "PM"
|
|
1110
1067
|
});
|
|
1111
|
-
};
|
|
1112
|
-
e.addEventListener("click", t), this.cleanupHandlers.push(() => e.removeEventListener("click", t));
|
|
1068
|
+
}));
|
|
1113
1069
|
}
|
|
1114
1070
|
handleSwitchViewButton() {
|
|
1115
1071
|
let e = this.core.getKeyboardClockIcon();
|
|
1116
|
-
|
|
1117
|
-
let t = () => {
|
|
1072
|
+
e && this.cleanupHandlers.push(F(e, () => {
|
|
1118
1073
|
this.core.isDestroyed || this.emitter.emit("switch:view", {});
|
|
1119
|
-
};
|
|
1120
|
-
e.addEventListener("click", t), this.cleanupHandlers.push(() => e.removeEventListener("click", t));
|
|
1074
|
+
}));
|
|
1121
1075
|
}
|
|
1122
1076
|
destroy() {
|
|
1123
1077
|
this.cleanupHandlers.forEach((e) => e()), this.cleanupHandlers = [];
|
|
1124
1078
|
}
|
|
1125
|
-
},
|
|
1079
|
+
}, I = (e, t, n) => Math.max(t, Math.min(n, e)), _e = (e, t) => {
|
|
1126
1080
|
if (e === "") return "";
|
|
1127
1081
|
let n = parseInt(e, 10);
|
|
1128
|
-
return Number.isNaN(n) ? "" :
|
|
1129
|
-
},
|
|
1082
|
+
return Number.isNaN(n) ? "" : I(n, +!!t, t ? 12 : 23).toString().padStart(2, "0");
|
|
1083
|
+
}, ve = (e) => {
|
|
1130
1084
|
if (e === "") return "";
|
|
1131
1085
|
let t = parseInt(e, 10);
|
|
1132
|
-
return Number.isNaN(t) ? "" :
|
|
1133
|
-
},
|
|
1086
|
+
return Number.isNaN(t) ? "" : I(t, 0, 59).toString().padStart(2, "0");
|
|
1087
|
+
}, ye = class {
|
|
1134
1088
|
core;
|
|
1135
1089
|
emitter;
|
|
1136
1090
|
cleanupHandlers = [];
|
|
@@ -1155,7 +1109,7 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
1155
1109
|
e.addEventListener("click", t), this.cleanupHandlers.push(() => e.removeEventListener("click", t));
|
|
1156
1110
|
let n = e.value, r = () => {
|
|
1157
1111
|
if (this.core.isDestroyed || e.hasAttribute("readonly")) return;
|
|
1158
|
-
let t = this.core.options.clock.type === "12h", r =
|
|
1112
|
+
let t = this.core.options.clock.type === "12h", r = _e(e.value, t);
|
|
1159
1113
|
if (e.value = r, e.setAttribute("aria-valuenow", r), e.value !== n) {
|
|
1160
1114
|
n = e.value, this.emitter.emit("animation:clock", {}), this.emitter.emit("select:hour", { hour: e.value });
|
|
1161
1115
|
let t = this.core.getMinutes(), r = this.core.getActiveTypeMode();
|
|
@@ -1186,7 +1140,7 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
1186
1140
|
e.addEventListener("click", t), this.cleanupHandlers.push(() => e.removeEventListener("click", t));
|
|
1187
1141
|
let n = e.value, r = () => {
|
|
1188
1142
|
if (this.core.isDestroyed || e.hasAttribute("readonly")) return;
|
|
1189
|
-
let t =
|
|
1143
|
+
let t = ve(e.value);
|
|
1190
1144
|
if (e.value = t, e.setAttribute("aria-valuenow", t), e.value !== n) {
|
|
1191
1145
|
n = e.value, this.emitter.emit("animation:clock", {}), this.emitter.emit("select:minute", { minutes: e.value });
|
|
1192
1146
|
let t = this.core.getHour(), r = this.core.getActiveTypeMode();
|
|
@@ -1202,7 +1156,7 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
1202
1156
|
destroy() {
|
|
1203
1157
|
this.cleanupHandlers.forEach((e) => e()), this.cleanupHandlers = [];
|
|
1204
1158
|
}
|
|
1205
|
-
},
|
|
1159
|
+
}, be = class {
|
|
1206
1160
|
core;
|
|
1207
1161
|
emitter;
|
|
1208
1162
|
cleanupHandlers = [];
|
|
@@ -1220,18 +1174,25 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
1220
1174
|
handleEscClick() {
|
|
1221
1175
|
if (t() === !1) return;
|
|
1222
1176
|
let e = (e) => {
|
|
1223
|
-
this.core.isDestroyed || e.key === "Escape" && this.emitter.emit("cancel", {});
|
|
1177
|
+
this.core.isDestroyed || this.core.isOpen && e.key === "Escape" && this.emitter.emit("cancel", {});
|
|
1224
1178
|
};
|
|
1225
1179
|
document.addEventListener("keydown", e), this.cleanupHandlers.push(() => document.removeEventListener("keydown", e));
|
|
1226
1180
|
}
|
|
1227
1181
|
handleKeyboardInput() {
|
|
1228
|
-
let e = this.core.getHour(), t = this.core.getMinutes()
|
|
1182
|
+
let e = this.core.getHour(), t = this.core.getMinutes(), n = [
|
|
1183
|
+
"ArrowUp",
|
|
1184
|
+
"ArrowDown",
|
|
1185
|
+
"Home",
|
|
1186
|
+
"End",
|
|
1187
|
+
"PageUp",
|
|
1188
|
+
"PageDown"
|
|
1189
|
+
];
|
|
1229
1190
|
if (e) {
|
|
1230
1191
|
let t = (t) => {
|
|
1231
|
-
if (this.core.isDestroyed ||
|
|
1192
|
+
if (this.core.isDestroyed || !n.includes(t.key)) return;
|
|
1232
1193
|
t.preventDefault();
|
|
1233
|
-
let
|
|
1234
|
-
|
|
1194
|
+
let r = parseInt(e.value) || 0, i = parseInt(e.getAttribute("max") || "23"), a = +(this.core.options.clock.type === "12h");
|
|
1195
|
+
e.value = this.computeSpinValue(t.key, r, a, i, 3).toString().padStart(2, "0"), e.setAttribute("aria-valuenow", e.value), e.setAttribute("aria-valuetext", e.value), M(this.core.getModalElement(), `${this.core.options.labels.announceHour ?? "Hour"}: ${e.value}`), this.emitter.emit("animation:clock", {}), this.emitter.emit("select:hour", { hour: e.value });
|
|
1235
1196
|
let o = this.core.getMinutes(), s = this.core.getActiveTypeMode();
|
|
1236
1197
|
this.emitter.emit("update", {
|
|
1237
1198
|
hour: e.value,
|
|
@@ -1243,10 +1204,10 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
1243
1204
|
}
|
|
1244
1205
|
if (t) {
|
|
1245
1206
|
let e = (e) => {
|
|
1246
|
-
if (this.core.isDestroyed ||
|
|
1207
|
+
if (this.core.isDestroyed || !n.includes(e.key)) return;
|
|
1247
1208
|
e.preventDefault();
|
|
1248
|
-
let
|
|
1249
|
-
|
|
1209
|
+
let r = parseInt(t.value) || 0;
|
|
1210
|
+
t.value = this.computeSpinValue(e.key, r, 0, 59, 5).toString().padStart(2, "0"), t.setAttribute("aria-valuenow", t.value), t.setAttribute("aria-valuetext", t.value), M(this.core.getModalElement(), `${this.core.options.labels.announceMinute ?? "Minutes"}: ${t.value}`), this.emitter.emit("animation:clock", {}), this.emitter.emit("select:minute", { minutes: t.value });
|
|
1250
1211
|
let i = this.core.getHour(), a = this.core.getActiveTypeMode();
|
|
1251
1212
|
this.emitter.emit("update", {
|
|
1252
1213
|
hour: i?.value,
|
|
@@ -1257,21 +1218,36 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
1257
1218
|
t.addEventListener("keydown", e), this.cleanupHandlers.push(() => t.removeEventListener("keydown", e));
|
|
1258
1219
|
}
|
|
1259
1220
|
}
|
|
1221
|
+
computeSpinValue(e, t, n, r, i) {
|
|
1222
|
+
switch (e) {
|
|
1223
|
+
case "ArrowUp": return t >= r ? n : t + 1;
|
|
1224
|
+
case "ArrowDown": return t <= n ? r : t - 1;
|
|
1225
|
+
case "Home": return n;
|
|
1226
|
+
case "End": return r;
|
|
1227
|
+
case "PageUp": return Math.min(r, t + i);
|
|
1228
|
+
case "PageDown": return Math.max(n, t - i);
|
|
1229
|
+
default: return t;
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1260
1232
|
focusTrapHandler() {
|
|
1261
1233
|
if (t() === !1) return;
|
|
1262
1234
|
let e = this.core.getWrapper();
|
|
1263
1235
|
if (!e) return;
|
|
1264
1236
|
let n = (t) => {
|
|
1265
1237
|
if (this.core.isDestroyed || t.key !== "Tab") return;
|
|
1266
|
-
let n = e.querySelectorAll("button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])"), r =
|
|
1267
|
-
|
|
1238
|
+
let n = e.querySelectorAll("button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])"), r = [];
|
|
1239
|
+
if (n.forEach((e) => {
|
|
1240
|
+
e.getAttribute("aria-disabled") !== "true" && (e.hasAttribute("disabled") || e.hidden || e.getAttribute("aria-hidden") !== "true" && (e.offsetParent === null && e.getClientRects().length === 0 || r.push(e)));
|
|
1241
|
+
}), r.length === 0) return;
|
|
1242
|
+
let i = r[0], a = r[r.length - 1];
|
|
1243
|
+
t.shiftKey && document.activeElement === i ? (a?.focus(), t.preventDefault()) : !t.shiftKey && document.activeElement === a && (i?.focus(), t.preventDefault());
|
|
1268
1244
|
};
|
|
1269
1245
|
e.addEventListener("keydown", n), this.cleanupHandlers.push(() => e.removeEventListener("keydown", n));
|
|
1270
1246
|
}
|
|
1271
1247
|
destroy() {
|
|
1272
1248
|
this.cleanupHandlers.forEach((e) => e()), this.cleanupHandlers = [];
|
|
1273
1249
|
}
|
|
1274
|
-
},
|
|
1250
|
+
}, xe = class {
|
|
1275
1251
|
core;
|
|
1276
1252
|
emitter;
|
|
1277
1253
|
cleanupHandlers = [];
|
|
@@ -1298,13 +1274,13 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
1298
1274
|
destroy() {
|
|
1299
1275
|
this.cleanupHandlers.forEach((e) => e()), this.cleanupHandlers = [];
|
|
1300
1276
|
}
|
|
1301
|
-
},
|
|
1277
|
+
}, Se = class {
|
|
1302
1278
|
buttonHandlers;
|
|
1303
1279
|
inputHandlers;
|
|
1304
1280
|
keyboardHandlers;
|
|
1305
1281
|
modalHandlers;
|
|
1306
1282
|
constructor(e, t) {
|
|
1307
|
-
this.buttonHandlers = new
|
|
1283
|
+
this.buttonHandlers = new ge(e, t), this.inputHandlers = new ye(e, t), this.keyboardHandlers = new be(e, t), this.modalHandlers = new xe(e, t);
|
|
1308
1284
|
}
|
|
1309
1285
|
handleOpenOnClick() {
|
|
1310
1286
|
this.buttonHandlers.handleOpenOnClick();
|
|
@@ -1351,7 +1327,7 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
1351
1327
|
destroy() {
|
|
1352
1328
|
this.buttonHandlers.destroy(), this.inputHandlers.destroy(), this.keyboardHandlers.destroy(), this.modalHandlers.destroy();
|
|
1353
1329
|
}
|
|
1354
|
-
},
|
|
1330
|
+
}, Ce = class {
|
|
1355
1331
|
emitter;
|
|
1356
1332
|
getClockSystem;
|
|
1357
1333
|
setHoursToClock;
|
|
@@ -1394,7 +1370,47 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
1394
1370
|
}
|
|
1395
1371
|
t.updateDisabledTime(r);
|
|
1396
1372
|
}
|
|
1397
|
-
},
|
|
1373
|
+
}, we = /^(1[0-2]|[1-9]):([0-5][0-9])\s*(AM|PM)$/i, Te = /^([0-1]?[0-9]|2[0-3]):([0-5][0-9])$/;
|
|
1374
|
+
function Ee(e) {
|
|
1375
|
+
let t = e.match(we);
|
|
1376
|
+
return t ? {
|
|
1377
|
+
hour: t[1],
|
|
1378
|
+
minutes: t[2],
|
|
1379
|
+
type: t[3].toUpperCase()
|
|
1380
|
+
} : null;
|
|
1381
|
+
}
|
|
1382
|
+
function De(e) {
|
|
1383
|
+
let t = e.match(Te);
|
|
1384
|
+
return t ? {
|
|
1385
|
+
hour: t[1],
|
|
1386
|
+
minutes: t[2]
|
|
1387
|
+
} : null;
|
|
1388
|
+
}
|
|
1389
|
+
function L(e, t) {
|
|
1390
|
+
let n = parseInt(e.hour, 10), r = parseInt(e.minutes, 10);
|
|
1391
|
+
if (Number.isNaN(n) || Number.isNaN(r)) return 0;
|
|
1392
|
+
if (t === "12h" && e.type) {
|
|
1393
|
+
let t = e.type.toUpperCase();
|
|
1394
|
+
t === "PM" && n !== 12 && (n += 12), t === "AM" && n === 12 && (n = 0);
|
|
1395
|
+
}
|
|
1396
|
+
return n * 60 + r;
|
|
1397
|
+
}
|
|
1398
|
+
function R(e, t) {
|
|
1399
|
+
if (t === "12h") {
|
|
1400
|
+
let t = e.match(/(\d{1,2}):(\d{2})\s*(AM|PM)/i);
|
|
1401
|
+
return t ? L({
|
|
1402
|
+
hour: t[1],
|
|
1403
|
+
minutes: t[2],
|
|
1404
|
+
type: t[3]
|
|
1405
|
+
}, "12h") : 0;
|
|
1406
|
+
}
|
|
1407
|
+
let [n, r] = e.split(":");
|
|
1408
|
+
return L({
|
|
1409
|
+
hour: n ?? "0",
|
|
1410
|
+
minutes: r ?? "0"
|
|
1411
|
+
}, "24h");
|
|
1412
|
+
}
|
|
1413
|
+
var z = class {
|
|
1398
1414
|
static angleToIndex(e, t, n) {
|
|
1399
1415
|
let r = Math.round(e / 30) % 12;
|
|
1400
1416
|
if (t === "24h") if (n) {
|
|
@@ -1427,28 +1443,13 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
1427
1443
|
return !0;
|
|
1428
1444
|
}
|
|
1429
1445
|
static isTimeInIntervals(e, t, n, r, i) {
|
|
1430
|
-
let a = i === "12h" ? `${e}:${t} ${n}` : `${e}:${t}
|
|
1446
|
+
let a = R(i === "12h" ? `${e}:${t} ${n}` : `${e}:${t}`, i);
|
|
1431
1447
|
for (let e of r) {
|
|
1432
|
-
let [t, n] = e.split("-").map((e) => e.trim());
|
|
1433
|
-
if (
|
|
1448
|
+
let [t, n] = e.split("-").map((e) => e.trim()), r = R(t, i), o = R(n, i);
|
|
1449
|
+
if (a >= r && a <= o) return !0;
|
|
1434
1450
|
}
|
|
1435
1451
|
return !1;
|
|
1436
1452
|
}
|
|
1437
|
-
static isTimeBetween(e, t, n, r) {
|
|
1438
|
-
let i = this.timeToMinutes(e, r), a = this.timeToMinutes(t, r), o = this.timeToMinutes(n, r);
|
|
1439
|
-
return i >= a && i <= o;
|
|
1440
|
-
}
|
|
1441
|
-
static timeToMinutes(e, t) {
|
|
1442
|
-
if (t === "12h") {
|
|
1443
|
-
let t = e.match(/(\d{1,2}):(\d{2})\s*(AM|PM)/i);
|
|
1444
|
-
if (!t) return 0;
|
|
1445
|
-
let n = parseInt(t[1]), r = parseInt(t[2]), i = t[3].toUpperCase();
|
|
1446
|
-
return i === "PM" && n !== 12 && (n += 12), i === "AM" && n === 12 && (n = 0), n * 60 + r;
|
|
1447
|
-
} else {
|
|
1448
|
-
let [t, n] = e.split(":").map(Number);
|
|
1449
|
-
return t * 60 + n;
|
|
1450
|
-
}
|
|
1451
|
-
}
|
|
1452
1453
|
static findNearestValid(e, t, n, r) {
|
|
1453
1454
|
let i = t === "24h" ? 23 : 12;
|
|
1454
1455
|
for (let a = 0; a <= i; a++) {
|
|
@@ -1462,7 +1463,7 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
1462
1463
|
}
|
|
1463
1464
|
return e;
|
|
1464
1465
|
}
|
|
1465
|
-
},
|
|
1466
|
+
}, B = class {
|
|
1466
1467
|
static angleToIndex(e) {
|
|
1467
1468
|
return Math.round(e / 6) % 60;
|
|
1468
1469
|
}
|
|
@@ -1483,28 +1484,13 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
1483
1484
|
}
|
|
1484
1485
|
static isDisabledByInterval(e, t, n, r, i) {
|
|
1485
1486
|
if (!r.intervals) return !1;
|
|
1486
|
-
let a = i === "12h" ? `${t}:${e} ${n}` : `${t}:${e}
|
|
1487
|
+
let a = R(i === "12h" ? `${t}:${e} ${n}` : `${t}:${e}`, i);
|
|
1487
1488
|
for (let e of r.intervals) {
|
|
1488
|
-
let [t, n] = e.split("-").map((e) => e.trim());
|
|
1489
|
-
if (
|
|
1489
|
+
let [t, n] = e.split("-").map((e) => e.trim()), r = R(t, i), o = R(n, i);
|
|
1490
|
+
if (a >= r && a <= o) return !0;
|
|
1490
1491
|
}
|
|
1491
1492
|
return !1;
|
|
1492
1493
|
}
|
|
1493
|
-
static isTimeBetween(e, t, n, r) {
|
|
1494
|
-
let i = this.timeToMinutes(e, r), a = this.timeToMinutes(t, r), o = this.timeToMinutes(n, r);
|
|
1495
|
-
return i >= a && i <= o;
|
|
1496
|
-
}
|
|
1497
|
-
static timeToMinutes(e, t) {
|
|
1498
|
-
if (t === "12h") {
|
|
1499
|
-
let t = e.match(/(\d{1,2}):(\d{2})\s*(AM|PM)/i);
|
|
1500
|
-
if (!t) return 0;
|
|
1501
|
-
let n = parseInt(t[1]), r = parseInt(t[2]), i = t[3].toUpperCase();
|
|
1502
|
-
return i === "PM" && n !== 12 && (n += 12), i === "AM" && n === 12 && (n = 0), n * 60 + r;
|
|
1503
|
-
} else {
|
|
1504
|
-
let [t, n] = e.split(":").map(Number);
|
|
1505
|
-
return t * 60 + n;
|
|
1506
|
-
}
|
|
1507
|
-
}
|
|
1508
1494
|
static findNearestValid(e, t, n, r, i) {
|
|
1509
1495
|
for (let a = 0; a < 60; a++) {
|
|
1510
1496
|
let o = a === 0 ? [e] : [e + a, e - a];
|
|
@@ -1517,7 +1503,7 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
1517
1503
|
}
|
|
1518
1504
|
return e;
|
|
1519
1505
|
}
|
|
1520
|
-
},
|
|
1506
|
+
}, V = class {
|
|
1521
1507
|
static normalizeAngle(e) {
|
|
1522
1508
|
let t = e % 360;
|
|
1523
1509
|
return t < 0 && (t += 360), t;
|
|
@@ -1541,7 +1527,7 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
1541
1527
|
let n = this.normalizeAngle(e), r = this.normalizeAngle(t) - n, i = r >= 0 ? r : r + 360, a = r <= 0 ? r : r - 360;
|
|
1542
1528
|
return e + (Math.abs(i) < Math.abs(a) ? i : a);
|
|
1543
1529
|
}
|
|
1544
|
-
},
|
|
1530
|
+
}, Oe = class {
|
|
1545
1531
|
config;
|
|
1546
1532
|
currentAngle = 0;
|
|
1547
1533
|
tipsCache = /* @__PURE__ */ new Map();
|
|
@@ -1562,12 +1548,16 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
1562
1548
|
return t;
|
|
1563
1549
|
}
|
|
1564
1550
|
setHandAngle(e) {
|
|
1565
|
-
let t =
|
|
1551
|
+
let t = V.calculateShortestPath(this.currentAngle, e);
|
|
1566
1552
|
Math.abs(this.currentAngle - t) < .01 || (this.currentAngle = t, this.config.clockHand.style.transform = `rotateZ(${t}deg)`);
|
|
1567
1553
|
}
|
|
1568
1554
|
animateToAngle(e) {
|
|
1569
|
-
let t =
|
|
1570
|
-
this.currentAngle = t,
|
|
1555
|
+
let t = V.calculateShortestPath(this.currentAngle, e);
|
|
1556
|
+
if (this.currentAngle = t, me()) {
|
|
1557
|
+
this.config.clockHand.style.transform = `rotateZ(${t}deg)`;
|
|
1558
|
+
return;
|
|
1559
|
+
}
|
|
1560
|
+
this.config.tipsWrapper.classList.add("tp-ui-tips-animation"), this.config.clockHand.style.transform = `rotateZ(${t}deg)`, setTimeout(() => {
|
|
1571
1561
|
this.config.tipsWrapper.classList.remove("tp-ui-tips-animation");
|
|
1572
1562
|
}, 401);
|
|
1573
1563
|
}
|
|
@@ -1576,7 +1566,7 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
1576
1566
|
this.config.tipsWrapperFor24h && t.push(this.config.tipsWrapperFor24h), t.forEach((t) => {
|
|
1577
1567
|
t.querySelectorAll(".tp-ui-value-tips, .tp-ui-value-tips-24h").forEach((t) => {
|
|
1578
1568
|
let n = t;
|
|
1579
|
-
n.textContent === e || Number(n.textContent) === Number(e) ?
|
|
1569
|
+
n.textContent === e || Number(n.textContent) === Number(e) ? n.classList.add("active") : n.classList.remove("active");
|
|
1580
1570
|
});
|
|
1581
1571
|
});
|
|
1582
1572
|
}
|
|
@@ -1603,18 +1593,18 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
1603
1593
|
};
|
|
1604
1594
|
}
|
|
1605
1595
|
let i = document.createElement("span"), a = document.createElement("span");
|
|
1606
|
-
a.textContent = e, a.
|
|
1596
|
+
a.textContent = e, a.tabIndex = -1;
|
|
1607
1597
|
let o = r === "24h" && n.includes("24") ? "tp-ui-value-tips-24h" : "tp-ui-value-tips";
|
|
1608
|
-
return a.classList.add(o), i.classList.add(n),
|
|
1598
|
+
return a.classList.add(o), i.classList.add(n), i.appendChild(a), {
|
|
1609
1599
|
wrapper: i,
|
|
1610
1600
|
tip: a
|
|
1611
1601
|
};
|
|
1612
1602
|
}
|
|
1613
1603
|
updateTipState(e, t, n, r, i, a, o, s) {
|
|
1614
|
-
e.classList.remove("tp-ui-tips-disabled"), t.classList.remove("tp-ui-tips-disabled"), t.
|
|
1604
|
+
e.classList.remove("tp-ui-tips-disabled"), t.classList.remove("tp-ui-tips-disabled"), t.tabIndex = -1, this.checkIfDisabled(n, r, i, a, o, s) && (e.classList.add("tp-ui-tips-disabled"), t.classList.add("tp-ui-tips-disabled"));
|
|
1615
1605
|
}
|
|
1616
1606
|
checkIfDisabled(e, t, n, r, i, a) {
|
|
1617
|
-
return n ? t === "hours" ?
|
|
1607
|
+
return n ? t === "hours" ? z.isDisabled(e, i, n) : t === "minutes" ? B.isDisabled(e, a, i, n, r) : !1 : !1;
|
|
1618
1608
|
}
|
|
1619
1609
|
setCircleSize(e) {
|
|
1620
1610
|
e ? this.config.circle.classList.remove("small-circle") : this.config.circle.classList.add("small-circle");
|
|
@@ -1625,9 +1615,9 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
1625
1615
|
destroy() {
|
|
1626
1616
|
this.tipsCache.clear(), this.cachedDimensions.clear(), this.config.tipsWrapper.innerHTML = "";
|
|
1627
1617
|
}
|
|
1628
|
-
},
|
|
1618
|
+
}, H = class {
|
|
1629
1619
|
static processPointerInput(e) {
|
|
1630
|
-
let t =
|
|
1620
|
+
let t = V.calculateRawAngle(e.pointerPosition, e.clockCenter);
|
|
1631
1621
|
return e.mode === "hours" ? this.processHours(t, e) : this.processMinutes(t, e);
|
|
1632
1622
|
}
|
|
1633
1623
|
static processHours(e, t) {
|
|
@@ -1635,12 +1625,12 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
1635
1625
|
if (n) r = e;
|
|
1636
1626
|
else {
|
|
1637
1627
|
let n = t.incrementHours * 30;
|
|
1638
|
-
r =
|
|
1628
|
+
r = V.snapToIncrement(e, n);
|
|
1639
1629
|
}
|
|
1640
|
-
let i =
|
|
1641
|
-
c && (o =
|
|
1642
|
-
let l =
|
|
1643
|
-
return u = n ? e :
|
|
1630
|
+
let i = V.calculateDistance(t.pointerPosition, t.clockCenter), a = t.clockType === "24h" && V.isInnerCircle(i, t.clockRadius), o = z.angleToIndex(r, t.clockType, a), s = z.indexToValue(o, t.clockType), c = z.isDisabled(s, t.amPm, t.disabledTime);
|
|
1631
|
+
c && (o = z.findNearestValid(o, t.clockType, t.amPm, t.disabledTime));
|
|
1632
|
+
let l = z.indexToValue(o, t.clockType), u;
|
|
1633
|
+
return u = n ? e : z.indexToAngle(o, t.clockType), {
|
|
1644
1634
|
angle: u,
|
|
1645
1635
|
value: l,
|
|
1646
1636
|
index: o,
|
|
@@ -1649,11 +1639,11 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
1649
1639
|
};
|
|
1650
1640
|
}
|
|
1651
1641
|
static processMinutes(e, t) {
|
|
1652
|
-
let n = t.incrementMinutes * 6, r =
|
|
1653
|
-
s && (i =
|
|
1654
|
-
let c =
|
|
1642
|
+
let n = t.incrementMinutes * 6, r = V.snapToIncrement(e, n), i = B.angleToIndex(r), a = B.indexToValue(i), o = t.currentHour || "00", s = B.isDisabled(a, o, t.amPm, t.disabledTime, t.clockType);
|
|
1643
|
+
s && (i = B.findNearestValid(i, o, t.amPm, t.disabledTime, t.clockType));
|
|
1644
|
+
let c = B.indexToValue(i);
|
|
1655
1645
|
return {
|
|
1656
|
-
angle:
|
|
1646
|
+
angle: B.indexToAngle(i),
|
|
1657
1647
|
value: c,
|
|
1658
1648
|
index: i,
|
|
1659
1649
|
isValid: !s
|
|
@@ -1661,9 +1651,9 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
1661
1651
|
}
|
|
1662
1652
|
static valueToAngle(e, t, n) {
|
|
1663
1653
|
let r = parseInt(e, 10);
|
|
1664
|
-
return t === "hours" ?
|
|
1654
|
+
return t === "hours" ? z.indexToAngle(r, n) : B.indexToAngle(r);
|
|
1665
1655
|
}
|
|
1666
|
-
},
|
|
1656
|
+
}, ke = class {
|
|
1667
1657
|
state;
|
|
1668
1658
|
renderer;
|
|
1669
1659
|
clockType;
|
|
@@ -1693,7 +1683,7 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
1693
1683
|
incrementMinutes: this.incrementMinutes,
|
|
1694
1684
|
smoothHourSnap: this.smoothHourSnap,
|
|
1695
1685
|
currentHour: this.state.hour
|
|
1696
|
-
}, i =
|
|
1686
|
+
}, i = H.processPointerInput(r);
|
|
1697
1687
|
if (i.isValid) {
|
|
1698
1688
|
if (this.state.mode === "hours") {
|
|
1699
1689
|
let e = this.state.hour;
|
|
@@ -1710,7 +1700,7 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
1710
1700
|
}
|
|
1711
1701
|
snapToNearestHour() {
|
|
1712
1702
|
if (this.state.mode !== "hours") return;
|
|
1713
|
-
let e =
|
|
1703
|
+
let e = H.valueToAngle(this.state.hour, "hours", this.clockType);
|
|
1714
1704
|
this.state.hourAngle = e, this.renderer.animateToAngle(e);
|
|
1715
1705
|
}
|
|
1716
1706
|
switchMode(e) {
|
|
@@ -1723,7 +1713,7 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
1723
1713
|
this.renderer.setHandAngle(t), this.renderer.setActiveValue(n);
|
|
1724
1714
|
}
|
|
1725
1715
|
setValue(e, t) {
|
|
1726
|
-
let n =
|
|
1716
|
+
let n = H.valueToAngle(t, e, this.clockType);
|
|
1727
1717
|
if (e === "hours") if (this.state.hour = t, this.state.hourAngle = n, this.clockType === "24h") {
|
|
1728
1718
|
let e = parseInt(t, 10), n = e === 0 || e >= 13;
|
|
1729
1719
|
this.renderer.setCircleSize(!0), this.renderer.setCircle24hMode(n);
|
|
@@ -1752,7 +1742,7 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
1752
1742
|
destroy() {
|
|
1753
1743
|
this.renderer.destroy();
|
|
1754
1744
|
}
|
|
1755
|
-
},
|
|
1745
|
+
}, Ae = class {
|
|
1756
1746
|
controller;
|
|
1757
1747
|
clockFace;
|
|
1758
1748
|
isActive = !1;
|
|
@@ -1832,7 +1822,7 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
1832
1822
|
removeGlobalListeners() {
|
|
1833
1823
|
t() !== !1 && (document.removeEventListener("mousemove", this.handlePointerMove), document.removeEventListener("touchmove", this.handlePointerMove), document.removeEventListener("mouseup", this.handlePointerUp), document.removeEventListener("touchend", this.handlePointerUp));
|
|
1834
1824
|
}
|
|
1835
|
-
},
|
|
1825
|
+
}, je = class {
|
|
1836
1826
|
renderer;
|
|
1837
1827
|
controller;
|
|
1838
1828
|
dragHandlers;
|
|
@@ -1850,7 +1840,7 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
1850
1840
|
circle: e.circle,
|
|
1851
1841
|
theme: e.theme
|
|
1852
1842
|
};
|
|
1853
|
-
this.renderer = new
|
|
1843
|
+
this.renderer = new Oe(t);
|
|
1854
1844
|
let n = {
|
|
1855
1845
|
hour: e.initialHour,
|
|
1856
1846
|
minute: e.initialMinute,
|
|
@@ -1862,7 +1852,7 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
1862
1852
|
onHourChange: e.onHourChange,
|
|
1863
1853
|
onMinuteChange: e.onMinuteChange
|
|
1864
1854
|
};
|
|
1865
|
-
this.controller = new
|
|
1855
|
+
this.controller = new ke(this.renderer, n, e.clockType, e.disabledTime, e.incrementHours || 1, e.incrementMinutes || 1, e.smoothHourSnap ?? !0, r), this.dragHandlers = new Ae(this.controller, e.clockFace, e.dragConfig || {});
|
|
1866
1856
|
}
|
|
1867
1857
|
initialize() {
|
|
1868
1858
|
this.dragHandlers.attach(), this.switchToHours();
|
|
@@ -1921,7 +1911,7 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
1921
1911
|
unblockInteractions() {
|
|
1922
1912
|
this.dragHandlers.unblock();
|
|
1923
1913
|
}
|
|
1924
|
-
},
|
|
1914
|
+
}, Me = class {
|
|
1925
1915
|
core;
|
|
1926
1916
|
emitter;
|
|
1927
1917
|
clockSystem = null;
|
|
@@ -1988,7 +1978,7 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
1988
1978
|
});
|
|
1989
1979
|
}
|
|
1990
1980
|
};
|
|
1991
|
-
this.clockSystem = new
|
|
1981
|
+
this.clockSystem = new je(s), this.clockSystem.initialize();
|
|
1992
1982
|
}
|
|
1993
1983
|
convertDisabledTime() {
|
|
1994
1984
|
let e = this.core.disabledTime?.value;
|
|
@@ -2015,7 +2005,7 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
2015
2005
|
destroy() {
|
|
2016
2006
|
this.clockSystem &&= (this.clockSystem.destroy(), null);
|
|
2017
2007
|
}
|
|
2018
|
-
},
|
|
2008
|
+
}, Ne = class {
|
|
2019
2009
|
core;
|
|
2020
2010
|
constructor(e) {
|
|
2021
2011
|
this.core = e;
|
|
@@ -2048,7 +2038,7 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
2048
2038
|
!e || !t || e.value && v.includes(e.value) || (t.style.backgroundColor = "", t.classList.add("small-circle"));
|
|
2049
2039
|
}
|
|
2050
2040
|
setClassActiveToHourOnOpen() {
|
|
2051
|
-
this.core.options.ui.mobile || this.core.isMobileView || this.core.getHour()?.classList.add(
|
|
2041
|
+
this.core.options.ui.mobile || this.core.isMobileView || this.core.getHour()?.classList.add(O);
|
|
2052
2042
|
}
|
|
2053
2043
|
toggleClassActiveToValueTips(e, t) {
|
|
2054
2044
|
if (e) return;
|
|
@@ -2056,10 +2046,10 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
2056
2046
|
if (!n) return;
|
|
2057
2047
|
let r = n.find((e) => Number(e.innerText) === Number(t));
|
|
2058
2048
|
n.forEach((e) => {
|
|
2059
|
-
e.classList.remove(
|
|
2060
|
-
}), r !== void 0 && (r.classList.add(
|
|
2049
|
+
e.classList.remove(O), e.setAttribute("aria-selected", "false");
|
|
2050
|
+
}), r !== void 0 && (r.classList.add(O), r.setAttribute("aria-selected", "true"));
|
|
2061
2051
|
}
|
|
2062
|
-
},
|
|
2052
|
+
}, Pe = class {
|
|
2063
2053
|
getClockSystem;
|
|
2064
2054
|
styleHandler;
|
|
2065
2055
|
getAmPmValue;
|
|
@@ -2089,15 +2079,15 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
2089
2079
|
let t = this.getAmPmValue();
|
|
2090
2080
|
t !== "" && e.setAmPm(t);
|
|
2091
2081
|
}
|
|
2092
|
-
},
|
|
2082
|
+
}, Fe = class {
|
|
2093
2083
|
systemInitializer;
|
|
2094
2084
|
styleHandler;
|
|
2095
2085
|
timeHandler;
|
|
2096
2086
|
eventHandler;
|
|
2097
2087
|
constructor(e, t) {
|
|
2098
|
-
this.systemInitializer = new
|
|
2088
|
+
this.systemInitializer = new Me(e, t), this.styleHandler = new Ne(e);
|
|
2099
2089
|
let n = e.options.clock.type || "12h";
|
|
2100
|
-
this.timeHandler = new
|
|
2090
|
+
this.timeHandler = new Pe(() => this.systemInitializer.getClockSystem(), this.styleHandler, () => this.systemInitializer.getAmPmValue(), n), this.eventHandler = new Ce(t, () => this.systemInitializer.getClockSystem(), (e) => this.timeHandler.setHoursToClock(e), (e) => this.timeHandler.setMinutesToClock(e), () => this.timeHandler.updateAmPm(), () => this.systemInitializer.convertDisabledTime()), this.eventHandler.setup();
|
|
2101
2091
|
}
|
|
2102
2092
|
initializeClockSystem() {
|
|
2103
2093
|
this.systemInitializer.initialize();
|
|
@@ -2145,7 +2135,11 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
2145
2135
|
destroy() {
|
|
2146
2136
|
this.destroyClockSystem();
|
|
2147
2137
|
}
|
|
2148
|
-
}
|
|
2138
|
+
};
|
|
2139
|
+
function U(e, t, n, r) {
|
|
2140
|
+
e.on(n, r), t.push(() => e.off(n, r));
|
|
2141
|
+
}
|
|
2142
|
+
var Ie = class {
|
|
2149
2143
|
core;
|
|
2150
2144
|
emitter;
|
|
2151
2145
|
cleanupHandlers = [];
|
|
@@ -2156,20 +2150,18 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
2156
2150
|
init() {
|
|
2157
2151
|
if (!this.core.options.ui.clearButton) return;
|
|
2158
2152
|
let e = this.getClearButton();
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
};
|
|
2163
|
-
e.addEventListener("click", t), this.cleanupHandlers.push(() => e.removeEventListener("click", t)), this.setupInternalEventListeners();
|
|
2153
|
+
e && (this.cleanupHandlers.push(F(e, () => {
|
|
2154
|
+
this.core.isDestroyed || this.handleClearClick();
|
|
2155
|
+
})), this.setupInternalEventListeners());
|
|
2164
2156
|
}
|
|
2165
2157
|
setupInternalEventListeners() {
|
|
2166
|
-
this.emitter.
|
|
2158
|
+
U(this.emitter, this.cleanupHandlers, "update", () => {
|
|
2167
2159
|
this.updateClearButtonState();
|
|
2168
|
-
}), this.emitter.
|
|
2160
|
+
}), U(this.emitter, this.cleanupHandlers, "open", () => {
|
|
2169
2161
|
this.updateClearButtonState();
|
|
2170
|
-
}), this.emitter.
|
|
2162
|
+
}), U(this.emitter, this.cleanupHandlers, "select:hour", () => {
|
|
2171
2163
|
this.updateClearButtonState(), this.reenableConfirmIfCleared();
|
|
2172
|
-
}), this.emitter.
|
|
2164
|
+
}), U(this.emitter, this.cleanupHandlers, "select:minute", () => {
|
|
2173
2165
|
this.updateClearButtonState(), this.reenableConfirmIfCleared();
|
|
2174
2166
|
});
|
|
2175
2167
|
}
|
|
@@ -2235,7 +2227,7 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
2235
2227
|
destroy() {
|
|
2236
2228
|
this.cleanupHandlers.forEach((e) => e()), this.cleanupHandlers = [];
|
|
2237
2229
|
}
|
|
2238
|
-
},
|
|
2230
|
+
}, Le = class {
|
|
2239
2231
|
animation;
|
|
2240
2232
|
modal;
|
|
2241
2233
|
config;
|
|
@@ -2246,7 +2238,7 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
2246
2238
|
clearButton;
|
|
2247
2239
|
plugins = /* @__PURE__ */ new Map();
|
|
2248
2240
|
constructor(e, t) {
|
|
2249
|
-
this.animation = new i(e, t), this.modal = new
|
|
2241
|
+
this.animation = new i(e, t), this.modal = new oe(e, t), this.config = new fe(e, t), this.theme = new pe(e, t), this.validation = new he(e, t), this.events = new Se(e, t), this.clock = new Fe(e, t), this.clearButton = new Ie(e, t), h.getAll().forEach((n) => {
|
|
2250
2242
|
let r = n.factory(e, t);
|
|
2251
2243
|
this.plugins.set(n.name, r);
|
|
2252
2244
|
});
|
|
@@ -2257,46 +2249,98 @@ var e = () => typeof window > "u", t = () => typeof document < "u", n = class {
|
|
|
2257
2249
|
destroy() {
|
|
2258
2250
|
this.animation.destroy(), this.modal.destroy(), this.config.destroy(), this.theme.destroy(), this.validation.destroy(), this.events.destroy(), this.clock.destroy(), this.clearButton.destroy(), this.plugins.forEach((e) => e.destroy()), this.plugins.clear();
|
|
2259
2251
|
}
|
|
2260
|
-
},
|
|
2261
|
-
function
|
|
2252
|
+
}, W = "is-rippling", G = "ripple-hold", K = null;
|
|
2253
|
+
function Re(e) {
|
|
2262
2254
|
let t = e.target, n = t.hasAttribute("data-md3-ripple") ? t : t.closest("[data-md3-ripple]");
|
|
2263
2255
|
if (!n || e.button !== 0 && e.pointerType === "mouse") return;
|
|
2264
2256
|
let r = n.getBoundingClientRect(), i = Math.max(r.width, r.height) * 2, a = e.clientX - r.left, o = e.clientY - r.top;
|
|
2265
|
-
n.style.setProperty("--ripple-size", `${i}px`), n.style.setProperty("--ripple-x", `${a}px`), n.style.setProperty("--ripple-y", `${o}px`), n.classList.remove(
|
|
2257
|
+
n.style.setProperty("--ripple-size", `${i}px`), n.style.setProperty("--ripple-x", `${a}px`), n.style.setProperty("--ripple-y", `${o}px`), n.classList.remove(W, G), n.offsetWidth, n.classList.add(W, G), n._rippleHold = !0, K = n;
|
|
2266
2258
|
}
|
|
2267
|
-
function
|
|
2268
|
-
let t = e.target, n = (t.hasAttribute("data-md3-ripple") ? t : t.closest("[data-md3-ripple]")) ||
|
|
2269
|
-
n && (n._rippleHold = !1, n.classList.remove(
|
|
2270
|
-
n.classList.remove(
|
|
2259
|
+
function q(e) {
|
|
2260
|
+
let t = e.target, n = (t.hasAttribute("data-md3-ripple") ? t : t.closest("[data-md3-ripple]")) || K;
|
|
2261
|
+
n && (n._rippleHold = !1, n.classList.remove(G), setTimeout(() => {
|
|
2262
|
+
n.classList.remove(W), K === n && (K = null);
|
|
2271
2263
|
}, 1e3));
|
|
2272
2264
|
}
|
|
2273
|
-
function
|
|
2265
|
+
function ze(e) {
|
|
2274
2266
|
let t = e.currentTarget;
|
|
2275
|
-
!t || !t._rippleHold || (t._rippleHold = !1, t.classList.remove(
|
|
2276
|
-
t.classList.remove(
|
|
2267
|
+
!t || !t._rippleHold || (t._rippleHold = !1, t.classList.remove(G), setTimeout(() => {
|
|
2268
|
+
t.classList.remove(W), K === t && (K = null);
|
|
2277
2269
|
}, 1e3));
|
|
2278
2270
|
}
|
|
2279
|
-
function
|
|
2271
|
+
function Be(e) {
|
|
2280
2272
|
if (t() === !1) return;
|
|
2281
2273
|
let n = e || document;
|
|
2282
|
-
n.addEventListener("pointerdown",
|
|
2283
|
-
e.addEventListener("mouseleave",
|
|
2274
|
+
n.addEventListener("pointerdown", Re), n.addEventListener("pointerup", q), n.addEventListener("pointercancel", q), n.querySelectorAll("[data-md3-ripple]").forEach((e) => {
|
|
2275
|
+
e.addEventListener("mouseleave", ze);
|
|
2284
2276
|
});
|
|
2285
2277
|
}
|
|
2286
|
-
var
|
|
2278
|
+
var Ve = (e, t) => {
|
|
2287
2279
|
let n;
|
|
2288
2280
|
return (...r) => {
|
|
2289
2281
|
clearTimeout(n), n = setTimeout(() => {
|
|
2290
2282
|
e(...r);
|
|
2291
2283
|
}, t);
|
|
2292
2284
|
};
|
|
2293
|
-
}
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
"
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2285
|
+
};
|
|
2286
|
+
function J(e) {
|
|
2287
|
+
let t = e.ui.mode;
|
|
2288
|
+
return t === "wheel" || t === "compact-wheel";
|
|
2289
|
+
}
|
|
2290
|
+
function Y(e) {
|
|
2291
|
+
return e.ui.mode === "compact-wheel";
|
|
2292
|
+
}
|
|
2293
|
+
function X(e) {
|
|
2294
|
+
return Y(e) && !!e.wheel?.placement;
|
|
2295
|
+
}
|
|
2296
|
+
var He = [
|
|
2297
|
+
["onOpen", "open"],
|
|
2298
|
+
["onCancel", "cancel"],
|
|
2299
|
+
["onConfirm", "confirm"],
|
|
2300
|
+
["onUpdate", "update"],
|
|
2301
|
+
["onSelectHour", "select:hour"],
|
|
2302
|
+
["onSelectMinute", "select:minute"],
|
|
2303
|
+
["onSelectAM", "select:am"],
|
|
2304
|
+
["onSelectPM", "select:pm"],
|
|
2305
|
+
["onError", "error"],
|
|
2306
|
+
["onTimezoneChange", "timezone:change"],
|
|
2307
|
+
["onRangeConfirm", "range:confirm"],
|
|
2308
|
+
["onRangeSwitch", "range:switch"],
|
|
2309
|
+
["onRangeValidation", "range:validation"],
|
|
2310
|
+
["onClear", "clear"]
|
|
2311
|
+
], Ue = [
|
|
2312
|
+
{
|
|
2313
|
+
needed: (e) => e.ui.mode === "wheel" || e.ui.mode === "compact-wheel",
|
|
2314
|
+
name: "wheel",
|
|
2315
|
+
message: "WheelPlugin is not registered. Import and register it: PluginRegistry.register(WheelPlugin)"
|
|
2316
|
+
},
|
|
2317
|
+
{
|
|
2318
|
+
needed: (e) => !!e.range?.enabled,
|
|
2319
|
+
name: "range",
|
|
2320
|
+
message: "RangePlugin is not registered. Import and register it: PluginRegistry.register(RangePlugin)"
|
|
2321
|
+
},
|
|
2322
|
+
{
|
|
2323
|
+
needed: (e) => !!e.timezone?.enabled,
|
|
2324
|
+
name: "timezone",
|
|
2325
|
+
message: "TimezonePlugin is not registered. Import and register it: PluginRegistry.register(TimezonePlugin)"
|
|
2326
|
+
}
|
|
2327
|
+
];
|
|
2328
|
+
function We(e, t) {
|
|
2329
|
+
let { callbacks: n } = e.options;
|
|
2330
|
+
for (let [e, r] of He) {
|
|
2331
|
+
let i = n[e];
|
|
2332
|
+
i && t.on(r, i);
|
|
2333
|
+
}
|
|
2334
|
+
}
|
|
2335
|
+
function Ge(e, t) {
|
|
2336
|
+
for (let n of Ue) n.needed(e.options) && !h.has(n.name) && t.emit("error", { error: n.message });
|
|
2337
|
+
}
|
|
2338
|
+
var Ke = class e {
|
|
2339
|
+
static EXPANDED_EXCLUDED = [
|
|
2340
|
+
"tp-ui-select-time",
|
|
2341
|
+
"tp-ui-mobile-clock-wrapper",
|
|
2342
|
+
"tp-ui-wrapper"
|
|
2343
|
+
];
|
|
2300
2344
|
core;
|
|
2301
2345
|
managers;
|
|
2302
2346
|
emitter;
|
|
@@ -2314,99 +2358,75 @@ var X = (e, t) => {
|
|
|
2314
2358
|
this.core.setIsDestroyed(!0);
|
|
2315
2359
|
return;
|
|
2316
2360
|
}
|
|
2317
|
-
this.managers.theme.setTimepickerClassToElement(), this.managers.theme.setInputClassToInputElement(), this.managers.theme.setDataOpenToInputIfDoesntExistInWrapper(), this.managers.theme.setClassTopOpenElement(), this.managers.config.getDisableTime(), this.core.options.ui.inline?.enabled || this.managers.events.handleOpenOnClick(), this.managers.events.handleOpenOnEnterFocus(), this.
|
|
2361
|
+
this.managers.theme.setTimepickerClassToElement(), this.managers.theme.setInputClassToInputElement(), this.managers.theme.setDataOpenToInputIfDoesntExistInWrapper(), this.managers.theme.setClassTopOpenElement(), this.managers.config.getDisableTime(), this.core.options.ui.inline?.enabled || this.managers.events.handleOpenOnClick(), this.managers.events.handleOpenOnEnterFocus(), We(this.core, this.emitter), this.core.setIsInitialized(!0);
|
|
2318
2362
|
}
|
|
2319
2363
|
}
|
|
2320
|
-
setupCallbackBridge() {
|
|
2321
|
-
let { callbacks: e } = this.core.options;
|
|
2322
|
-
e.onOpen && this.emitter.on("open", e.onOpen), e.onCancel && this.emitter.on("cancel", e.onCancel), e.onConfirm && this.emitter.on("confirm", e.onConfirm), e.onUpdate && this.emitter.on("update", e.onUpdate), e.onSelectHour && this.emitter.on("select:hour", e.onSelectHour), e.onSelectMinute && this.emitter.on("select:minute", e.onSelectMinute), e.onSelectAM && this.emitter.on("select:am", e.onSelectAM), e.onSelectPM && this.emitter.on("select:pm", e.onSelectPM), e.onError && this.emitter.on("error", e.onError), e.onTimezoneChange && this.emitter.on("timezone:change", e.onTimezoneChange), e.onRangeConfirm && this.emitter.on("range:confirm", e.onRangeConfirm), e.onRangeSwitch && this.emitter.on("range:switch", e.onRangeSwitch), e.onRangeValidation && this.emitter.on("range:validation", e.onRangeValidation), e.onClear && this.emitter.on("clear", e.onClear);
|
|
2323
|
-
}
|
|
2324
2364
|
mount() {
|
|
2325
2365
|
this.core.isDestroyed || this.core.isOpen || (this.core.isInitialized || this.init(), this.eventsBundle());
|
|
2326
2366
|
}
|
|
2327
2367
|
unmount(e) {
|
|
2328
|
-
let
|
|
2368
|
+
let t = Ve((...e) => {
|
|
2329
2369
|
if (e.length > 2) return;
|
|
2330
|
-
let [
|
|
2370
|
+
let [t] = e.filter((e) => typeof e == "boolean"), [n] = e.filter((e) => typeof e == "function");
|
|
2331
2371
|
this.core.setIsMobileView(!!this.core.options.ui.mobile);
|
|
2332
|
-
let
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
}
|
|
2337
|
-
a && this.managers.animation.removeAnimationToClose(), this.core.getOpenElement().forEach((e) => e?.classList.remove("disabled"));
|
|
2338
|
-
let o = setTimeout(() => {
|
|
2339
|
-
t() && (document.body.style.overflowY = "", document.body.style.paddingRight = "");
|
|
2372
|
+
let i = this.core.getModalElement();
|
|
2373
|
+
t && i && this.core.getOkButton()?.click(), this.core.setIsTouchMouseMove(!1), this.core.setIsOpen(!1), this.removeEventListeners(), X(this.core.options) && this.managers.getPlugin("wheel")?.detachPopover?.(), i && this.managers.animation.removeAnimationToClose(), this.core.getOpenElement().forEach((e) => e?.classList.remove("disabled"));
|
|
2374
|
+
let a = setTimeout(() => {
|
|
2375
|
+
this.managers.modal.unlockScroll();
|
|
2340
2376
|
}, r.SCROLLBAR_RESTORE);
|
|
2341
|
-
this.unmountTimeouts.push(
|
|
2342
|
-
let
|
|
2377
|
+
this.unmountTimeouts.push(a);
|
|
2378
|
+
let o = setTimeout(() => {
|
|
2343
2379
|
let e = this.core.getInput();
|
|
2344
2380
|
this.core.options.behavior.focusInputAfterClose && e?.focus();
|
|
2345
2381
|
let t = this.core.getModalElement();
|
|
2346
2382
|
t && t.remove(), this.core.setIsModalRemove(!0);
|
|
2347
2383
|
}, r.MODAL_REMOVE);
|
|
2348
|
-
this.unmountTimeouts.push(
|
|
2384
|
+
this.unmountTimeouts.push(o), n && n();
|
|
2349
2385
|
}, this.core.options.behavior.delayHandler || r.DEFAULT_DELAY);
|
|
2350
|
-
e ?
|
|
2386
|
+
e ? t(e) : t();
|
|
2351
2387
|
}
|
|
2352
|
-
destroy(
|
|
2388
|
+
destroy(e) {
|
|
2353
2389
|
if (this.core.isDestroyed) return;
|
|
2354
2390
|
this.clearUnmountTimeouts();
|
|
2355
|
-
let { keepInputValue:
|
|
2391
|
+
let { keepInputValue: t = !1, callback: n } = typeof e == "function" ? { callback: e } : e || {}, r = this.core.getInput(), i = t ? r?.value : null;
|
|
2356
2392
|
this.removeEventListeners(), this.core.getModalElement()?.remove(), this.core.getOpenElement()?.forEach((e) => {
|
|
2357
|
-
e &&
|
|
2358
|
-
}),
|
|
2359
|
-
let
|
|
2360
|
-
|
|
2393
|
+
e && e.classList.remove("disabled", "active", "tp-ui-open-element");
|
|
2394
|
+
}), r && (r.classList.remove("tp-ui-invalid-format", "invalid-value", "error", "active", "tp-ui-input"), r.removeAttribute("data-open"), r.removeAttribute("data-owner-id"), t && i && (r.value = i));
|
|
2395
|
+
let a = this.core.element;
|
|
2396
|
+
a && (a.classList.remove("error", "active", "disabled"), a.removeAttribute("data-owner-id"), a.removeAttribute("data-open"), this.core.options.ui.cssClass && a.classList.remove(this.core.options.ui.cssClass)), a?.querySelectorAll(".tp-ui-invalid-text")?.forEach((e) => e.remove()), this.mutliEventsMoveHandler = () => {}, this.eventsClickMobileHandler = () => {}, this.core.reset(), this.managers.destroy(), this.emitter.clear(), this.managers.modal.unlockScroll(), n && n();
|
|
2361
2397
|
}
|
|
2362
2398
|
eventsBundle() {
|
|
2363
2399
|
if (this.core.isDestroyed || !this.core.isModalRemove) return;
|
|
2364
2400
|
this.clearUnmountTimeouts(), this.core.setIsOpen(!0), this.core.setIsModalRemove(!1), this.setupValidation(), this.disableOpenElements(), this.setupModal(), this.applyExpandedState(), this.managers.modal.setFlexEndToFooterIfNoKeyboardIcon(), this.applyThemeDeferred(), this.managers.animation.setAnimationToOpen(), this.managers.config.getInputValueOnOpenAndSet();
|
|
2365
|
-
let e = this.
|
|
2366
|
-
|
|
2367
|
-
let e = this.managers.getPlugin("wheel");
|
|
2368
|
-
e && "attachPopover" in e && e.attachPopover();
|
|
2369
|
-
}
|
|
2370
|
-
this.managers.modal.setShowClassToBackdrop();
|
|
2401
|
+
let e = J(this.core.options) && h.has("wheel");
|
|
2402
|
+
Ge(this.core, this.emitter), this.initClockOrWheel(e), this.initOptionalPlugins(e), this.bindEventHandlers(e), this.finalizeModal(e), X(this.core.options) && this.managers.getPlugin("wheel")?.attachPopover?.(), this.managers.modal.setShowClassToBackdrop();
|
|
2371
2403
|
}
|
|
2372
2404
|
setupValidation() {
|
|
2373
2405
|
this.managers.validation.setErrorHandler(), this.managers.validation.removeErrorHandler();
|
|
2374
2406
|
}
|
|
2375
2407
|
disableOpenElements() {
|
|
2376
|
-
this.core.options.ui.inline?.enabled || (this.core.getOpenElement().forEach((e) => e?.classList.add("disabled")), this.
|
|
2408
|
+
this.core.options.ui.inline?.enabled || (this.core.getOpenElement().forEach((e) => e?.classList.add("disabled")), X(this.core.options) || this.core.getInput()?.blur());
|
|
2377
2409
|
}
|
|
2378
2410
|
setupModal() {
|
|
2379
2411
|
this.managers.modal.setScrollbarOrNot(), this.managers.modal.setModalTemplate(), this.managers.modal.setNormalizeClass(), this.managers.modal.removeBackdrop();
|
|
2380
2412
|
}
|
|
2381
2413
|
applyExpandedState() {
|
|
2382
|
-
if (this.core.isMobileView)
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
t?.classList.add("expanded"), n?.classList.add("expanded"), r?.forEach((e) => {
|
|
2386
|
-
!e.classList.contains("tp-ui-select-time") && !e.classList.contains("tp-ui-mobile-clock-wrapper") && !e.classList.contains("tp-ui-wrapper") && e.classList.add("expanded");
|
|
2387
|
-
});
|
|
2414
|
+
if (this.core.isMobileView) {
|
|
2415
|
+
this.managers.config.updateClockFaceAccessibility(!0);
|
|
2416
|
+
return;
|
|
2388
2417
|
}
|
|
2418
|
+
let t = this.core.getModalElement();
|
|
2419
|
+
t && (t.querySelector(".tp-ui-mobile-clock-wrapper")?.classList.add("expanded"), t.querySelector(".tp-ui-wrapper")?.classList.add("expanded"), t.querySelectorAll("*").forEach((t) => {
|
|
2420
|
+
e.EXPANDED_EXCLUDED.some((e) => t.classList.contains(e)) || t.classList.add("expanded");
|
|
2421
|
+
}));
|
|
2389
2422
|
}
|
|
2390
2423
|
applyThemeDeferred() {
|
|
2391
|
-
setTimeout(() => {
|
|
2424
|
+
let e = setTimeout(() => {
|
|
2392
2425
|
this.managers.theme.setTheme();
|
|
2393
2426
|
let e = this.core.getWrapper();
|
|
2394
2427
|
e && this.core.options.ui.cssClass && e.classList.add(this.core.options.ui.cssClass);
|
|
2395
2428
|
}, 0);
|
|
2396
|
-
|
|
2397
|
-
isCompactWheelMode() {
|
|
2398
|
-
return this.core.options.ui.mode === "compact-wheel";
|
|
2399
|
-
}
|
|
2400
|
-
isPopoverMode() {
|
|
2401
|
-
return this.isCompactWheelMode() && !!this.core.options.wheel?.placement;
|
|
2402
|
-
}
|
|
2403
|
-
resolveWheelMode() {
|
|
2404
|
-
let e = this.core.options.ui.mode;
|
|
2405
|
-
return (e === "wheel" || e === "compact-wheel") && h.has("wheel");
|
|
2406
|
-
}
|
|
2407
|
-
emitMissingPluginErrors() {
|
|
2408
|
-
let e = this.core.options.ui.mode;
|
|
2409
|
-
(e === "wheel" || e === "compact-wheel") && !h.has("wheel") && this.emitter.emit("error", { error: "WheelPlugin is not registered. Import and register it: PluginRegistry.register(WheelPlugin)" }), this.core.options.range?.enabled && !h.has("range") && this.emitter.emit("error", { error: "RangePlugin is not registered. Import and register it: PluginRegistry.register(RangePlugin)" }), this.core.options.timezone?.enabled && !h.has("timezone") && this.emitter.emit("error", { error: "TimezonePlugin is not registered. Import and register it: PluginRegistry.register(TimezonePlugin)" });
|
|
2429
|
+
this.unmountTimeouts.push(e);
|
|
2410
2430
|
}
|
|
2411
2431
|
initClockOrWheel(e) {
|
|
2412
2432
|
if (e) {
|
|
@@ -2421,11 +2441,11 @@ var X = (e, t) => {
|
|
|
2421
2441
|
n && !e && n.init();
|
|
2422
2442
|
}
|
|
2423
2443
|
bindEventHandlers(e) {
|
|
2424
|
-
this.managers.events.handleCancelButton(), this.managers.events.handleOkButton(), this.managers.clearButton.init(), e || (this.managers.events.handleHourEvents(), this.managers.events.handleMinutesEvents()), this.managers.events.handleKeyboardInput(), this.core.options.ui.enableSwitchIcon && !e && this.managers.events.handleSwitchViewButton(), this.core.options.clock.type !== "24h" && !this.
|
|
2444
|
+
this.managers.events.handleCancelButton(), this.managers.events.handleOkButton(), this.managers.clearButton.init(), e || (this.managers.events.handleHourEvents(), this.managers.events.handleMinutesEvents()), this.managers.events.handleKeyboardInput(), this.core.options.ui.enableSwitchIcon && !e && this.managers.events.handleSwitchViewButton(), this.core.options.clock.type !== "24h" && !Y(this.core.options) && (this.managers.events.handleAmClick(), this.managers.events.handlePmClick()), this.core.options.behavior.focusTrap && this.managers.events.focusTrapHandler(), this.core.options.ui.inline?.enabled || (this.managers.events.handleEscClick(), X(this.core.options) || e && this.core.options.wheel?.ignoreOutsideClick || this.managers.events.handleBackdropClick());
|
|
2425
2445
|
}
|
|
2426
2446
|
finalizeModal(e) {
|
|
2427
2447
|
let t = this.core.getModalElement();
|
|
2428
|
-
if (t &&
|
|
2448
|
+
if (t && Be(t), !e) {
|
|
2429
2449
|
let e = this.core.getClockFace();
|
|
2430
2450
|
e && typeof requestAnimationFrame < "u" && requestAnimationFrame(() => {
|
|
2431
2451
|
requestAnimationFrame(() => {
|
|
@@ -2438,26 +2458,34 @@ var X = (e, t) => {
|
|
|
2438
2458
|
this.unmountTimeouts.forEach(clearTimeout), this.unmountTimeouts = [];
|
|
2439
2459
|
}
|
|
2440
2460
|
removeEventListeners() {
|
|
2441
|
-
t() !== !1 && (
|
|
2461
|
+
t() !== !1 && (se.split(" ").forEach((e) => {
|
|
2442
2462
|
document.removeEventListener(e, this.mutliEventsMoveHandler, !1);
|
|
2443
2463
|
}), document.removeEventListener("mousedown", this.eventsClickMobileHandler));
|
|
2444
2464
|
}
|
|
2445
|
-
},
|
|
2465
|
+
}, Z = class {
|
|
2446
2466
|
events = /* @__PURE__ */ new Map();
|
|
2447
2467
|
on(e, t) {
|
|
2448
2468
|
this.events.has(e) || this.events.set(e, /* @__PURE__ */ new Set()), this.events.get(e).add(t);
|
|
2449
2469
|
}
|
|
2450
2470
|
once(e, t) {
|
|
2451
2471
|
let n = (r) => {
|
|
2452
|
-
t(r), this.
|
|
2472
|
+
t(r), this.events.get(e)?.delete(n);
|
|
2453
2473
|
};
|
|
2454
|
-
this.on(e, n);
|
|
2474
|
+
n.__originalHandler = t, this.on(e, n);
|
|
2455
2475
|
}
|
|
2456
2476
|
off(e, t) {
|
|
2457
|
-
|
|
2477
|
+
if (!t) {
|
|
2478
|
+
this.events.delete(e);
|
|
2479
|
+
return;
|
|
2480
|
+
}
|
|
2481
|
+
let n = this.events.get(e);
|
|
2482
|
+
n && n.forEach((e) => {
|
|
2483
|
+
(e === t || e.__originalHandler === t) && n.delete(e);
|
|
2484
|
+
});
|
|
2458
2485
|
}
|
|
2459
2486
|
emit(e, t) {
|
|
2460
|
-
this.events.get(e)
|
|
2487
|
+
let n = this.events.get(e);
|
|
2488
|
+
n && [...n].forEach((e) => {
|
|
2461
2489
|
e(t);
|
|
2462
2490
|
});
|
|
2463
2491
|
}
|
|
@@ -2501,7 +2529,23 @@ var X = (e, t) => {
|
|
|
2501
2529
|
mobileTime: "Enter Time",
|
|
2502
2530
|
mobileHour: "Hour",
|
|
2503
2531
|
mobileMinute: "Minute",
|
|
2504
|
-
clear: "Clear"
|
|
2532
|
+
clear: "Clear",
|
|
2533
|
+
hourLabel: "Hour",
|
|
2534
|
+
minuteLabel: "Minute",
|
|
2535
|
+
clockLabel: "Clock",
|
|
2536
|
+
periodLabel: "Period",
|
|
2537
|
+
timeLabel: "Time",
|
|
2538
|
+
format24Label: "24-hour",
|
|
2539
|
+
rangeSelectionLabel: "Range selection",
|
|
2540
|
+
switchToKeyboardLabel: "Switch to keyboard input",
|
|
2541
|
+
switchToClockLabel: "Switch to clock",
|
|
2542
|
+
toggleLabel: "Toggle",
|
|
2543
|
+
timezoneSelectorLabel: "Timezone",
|
|
2544
|
+
announceHour: "Hour",
|
|
2545
|
+
announceMinute: "Minutes",
|
|
2546
|
+
announceAmSelected: "AM selected",
|
|
2547
|
+
announcePmSelected: "PM selected",
|
|
2548
|
+
invalidTimeFormat: "Invalid time format"
|
|
2505
2549
|
},
|
|
2506
2550
|
behavior: {
|
|
2507
2551
|
focusInputAfterClose: !1,
|
|
@@ -2547,7 +2591,7 @@ var X = (e, t) => {
|
|
|
2547
2591
|
},
|
|
2548
2592
|
clearBehavior: { clearInput: !0 }
|
|
2549
2593
|
};
|
|
2550
|
-
function
|
|
2594
|
+
function qe(e = {}) {
|
|
2551
2595
|
let t = {
|
|
2552
2596
|
clock: {
|
|
2553
2597
|
...Q.clock,
|
|
@@ -2594,7 +2638,42 @@ function Ee(e = {}) {
|
|
|
2594
2638
|
...t.wheel
|
|
2595
2639
|
}), t;
|
|
2596
2640
|
}
|
|
2597
|
-
var
|
|
2641
|
+
var Je = (e) => e.replace(/[^0-9:APMapm\s]/g, "");
|
|
2642
|
+
function Ye(e, t) {
|
|
2643
|
+
if (e.options.clock.type === "24h") {
|
|
2644
|
+
let e = De(t);
|
|
2645
|
+
if (!e) throw Error("Invalid 24h format. Expected HH:MM");
|
|
2646
|
+
return {
|
|
2647
|
+
hourValue: e.hour.padStart(2, "0"),
|
|
2648
|
+
minutesValue: e.minutes,
|
|
2649
|
+
typeValue: "AM"
|
|
2650
|
+
};
|
|
2651
|
+
}
|
|
2652
|
+
let n = Ee(t);
|
|
2653
|
+
if (!n) throw Error("Invalid 12h format. Expected HH:MM AM/PM");
|
|
2654
|
+
return {
|
|
2655
|
+
hourValue: n.hour,
|
|
2656
|
+
minutesValue: n.minutes,
|
|
2657
|
+
typeValue: n.type
|
|
2658
|
+
};
|
|
2659
|
+
}
|
|
2660
|
+
function Xe(e, t) {
|
|
2661
|
+
let n = e.getHour(), r = e.getMinutes();
|
|
2662
|
+
n && (n.value = t.hourValue, n.setAttribute("aria-valuenow", t.hourValue), e.setDegreesHours(Number(t.hourValue) * 30)), r && (r.value = t.minutesValue, r.setAttribute("aria-valuenow", t.minutesValue), e.setDegreesMinutes(Number(t.minutesValue) * 6));
|
|
2663
|
+
}
|
|
2664
|
+
function Ze(e, t) {
|
|
2665
|
+
if (e.options.clock.type === "24h") return;
|
|
2666
|
+
let n = e.getAM(), r = e.getPM();
|
|
2667
|
+
!n || !r || (t === "AM" ? (n.classList.add("active"), r.classList.remove("active")) : (r.classList.add("active"), n.classList.remove("active")));
|
|
2668
|
+
}
|
|
2669
|
+
function Qe(e, t, n) {
|
|
2670
|
+
if (J(e.options)) t.getPlugin("wheel")?.scrollToValue?.(n.hourValue, n.minutesValue, n.typeValue);
|
|
2671
|
+
else {
|
|
2672
|
+
let t = e.getClockHand();
|
|
2673
|
+
t && (t.style.transform = `rotateZ(${e.degreesHours || 0}deg)`);
|
|
2674
|
+
}
|
|
2675
|
+
}
|
|
2676
|
+
var $ = /* @__PURE__ */ new Map(), $e = class {
|
|
2598
2677
|
core;
|
|
2599
2678
|
managers;
|
|
2600
2679
|
lifecycle;
|
|
@@ -2603,18 +2682,18 @@ var De = (e) => e.replace(/[^0-9:APMapm\s]/g, ""), $ = /* @__PURE__ */ new Map()
|
|
|
2603
2682
|
if (e()) throw Error("TimepickerUI requires browser environment");
|
|
2604
2683
|
let i = this.resolveInputElement(t);
|
|
2605
2684
|
if (!i) throw Error("Input element not found");
|
|
2606
|
-
let a = r?.behavior?.id, o = a || `tp-ui-${f()}`, s = this.createWrapperElement(i), c =
|
|
2685
|
+
let a = r?.behavior?.id, o = a || `tp-ui-${f()}`, s = this.createWrapperElement(i), c = qe(r || {});
|
|
2607
2686
|
if (c.ui.inline?.enabled && typeof r?.behavior?.focusTrap > "u" && (c.behavior.focusTrap = !1), c.ui.inline?.enabled) {
|
|
2608
2687
|
if (!c.ui.inline.containerId) throw Error("inline.containerId is required when inline mode is enabled");
|
|
2609
2688
|
if (!e() && !document.getElementById(c.ui.inline.containerId)) throw Error(`Container element with id "${c.ui.inline.containerId}" not found`);
|
|
2610
2689
|
}
|
|
2611
|
-
this.emitter = new
|
|
2690
|
+
this.emitter = new Z(), this.core = new n(s, c, o, a);
|
|
2612
2691
|
let l = this.core.getInput();
|
|
2613
2692
|
if (l) {
|
|
2614
|
-
let e =
|
|
2693
|
+
let e = T(l, c.clock.type), t = Number(e.hour) * 30, n = Number(e.minutes) * 6;
|
|
2615
2694
|
this.core.setDegreesHours(t), this.core.setDegreesMinutes(n);
|
|
2616
2695
|
}
|
|
2617
|
-
this.managers = new
|
|
2696
|
+
this.managers = new Le(this.core, this.emitter), this.lifecycle = new Ke(this.core, this.managers, this.emitter), this.managers.config.checkMobileOption(), this.managers.config.preventClockTypeByCurrentTime(), this.setupInternalEventListeners(), $.set(this.core.instanceId, this);
|
|
2618
2697
|
}
|
|
2619
2698
|
setupInternalEventListeners() {
|
|
2620
2699
|
this.emitter.on("show", () => {
|
|
@@ -2666,7 +2745,7 @@ var De = (e) => e.replace(/[^0-9:APMapm\s]/g, ""), $ = /* @__PURE__ */ new Map()
|
|
|
2666
2745
|
let e = this.core.getHour(), t = this.core.getMinutes(), s = this.core.getActiveTypeMode();
|
|
2667
2746
|
n = e?.value || "12", r = t?.value || "00", i = this.core.options.clock.type === "24h" ? void 0 : s?.textContent || "AM", a = this.core.degreesHours, o = this.core.degreesMinutes;
|
|
2668
2747
|
} else if (t) {
|
|
2669
|
-
let e =
|
|
2748
|
+
let e = T(t, this.core.options.clock.type);
|
|
2670
2749
|
n = e.hour, r = e.minutes, i = e.type, a = Number(n) * 30, o = Number(r) * 6;
|
|
2671
2750
|
}
|
|
2672
2751
|
let s = "";
|
|
@@ -2682,55 +2761,18 @@ var De = (e) => e.replace(/[^0-9:APMapm\s]/g, ""), $ = /* @__PURE__ */ new Map()
|
|
|
2682
2761
|
setValue(e, t = !0) {
|
|
2683
2762
|
if (this.core.isDestroyed || !e || typeof e != "string") return;
|
|
2684
2763
|
this.core.isInitialized || this.create();
|
|
2685
|
-
let n =
|
|
2764
|
+
let n = Je(e.trim());
|
|
2686
2765
|
try {
|
|
2687
|
-
let e = this.
|
|
2688
|
-
if (this.
|
|
2766
|
+
let e = Ye(this.core, n);
|
|
2767
|
+
if (Xe(this.core, e), Ze(this.core, e.typeValue), t) {
|
|
2689
2768
|
let e = this.core.getInput();
|
|
2690
2769
|
e && (e.value = n);
|
|
2691
2770
|
}
|
|
2692
|
-
this.
|
|
2771
|
+
Qe(this.core, this.managers, e);
|
|
2693
2772
|
} catch {
|
|
2694
2773
|
return;
|
|
2695
2774
|
}
|
|
2696
2775
|
}
|
|
2697
|
-
parseTimeString(e) {
|
|
2698
|
-
if (this.core.options.clock.type === "24h") {
|
|
2699
|
-
let t = e.match(/^([0-1]?[0-9]|2[0-3]):([0-5][0-9])$/);
|
|
2700
|
-
if (!t) throw Error("Invalid 24h format. Expected HH:MM");
|
|
2701
|
-
return {
|
|
2702
|
-
hourValue: t[1].padStart(2, "0"),
|
|
2703
|
-
minutesValue: t[2],
|
|
2704
|
-
typeValue: "AM"
|
|
2705
|
-
};
|
|
2706
|
-
}
|
|
2707
|
-
let t = e.match(/^(1[0-2]|[1-9]):([0-5][0-9])\s*(AM|PM)$/i);
|
|
2708
|
-
if (!t) throw Error("Invalid 12h format. Expected HH:MM AM/PM");
|
|
2709
|
-
return {
|
|
2710
|
-
hourValue: t[1],
|
|
2711
|
-
minutesValue: t[2],
|
|
2712
|
-
typeValue: t[3].toUpperCase()
|
|
2713
|
-
};
|
|
2714
|
-
}
|
|
2715
|
-
applyParsedTime(e) {
|
|
2716
|
-
let t = this.core.getHour(), n = this.core.getMinutes();
|
|
2717
|
-
t && (t.value = e.hourValue, t.setAttribute("aria-valuenow", e.hourValue), this.core.setDegreesHours(Number(e.hourValue) * 30)), n && (n.value = e.minutesValue, n.setAttribute("aria-valuenow", e.minutesValue), this.core.setDegreesMinutes(Number(e.minutesValue) * 6));
|
|
2718
|
-
}
|
|
2719
|
-
syncPeriodIndicator(e) {
|
|
2720
|
-
if (this.core.options.clock.type === "24h") return;
|
|
2721
|
-
let t = this.core.getAM(), n = this.core.getPM();
|
|
2722
|
-
!t || !n || (e === "AM" ? (t.classList.add("active"), n.classList.remove("active")) : (n.classList.add("active"), t.classList.remove("active")));
|
|
2723
|
-
}
|
|
2724
|
-
syncClockVisual(e) {
|
|
2725
|
-
let t = this.core.options.ui.mode;
|
|
2726
|
-
if (t === "wheel" || t === "compact-wheel") {
|
|
2727
|
-
let t = this.managers.getPlugin("wheel");
|
|
2728
|
-
t && "scrollToValue" in t && t.scrollToValue(e.hourValue, e.minutesValue, e.typeValue);
|
|
2729
|
-
} else {
|
|
2730
|
-
let e = this.core.getClockHand();
|
|
2731
|
-
e && (e.style.transform = `rotateZ(${this.core.degreesHours || 0}deg)`);
|
|
2732
|
-
}
|
|
2733
|
-
}
|
|
2734
2776
|
getElement() {
|
|
2735
2777
|
return this.core.element;
|
|
2736
2778
|
}
|
|
@@ -2802,4 +2844,4 @@ var De = (e) => e.replace(/[^0-9:APMapm\s]/g, ""), $ = /* @__PURE__ */ new Map()
|
|
|
2802
2844
|
}
|
|
2803
2845
|
};
|
|
2804
2846
|
//#endregion
|
|
2805
|
-
export { h as PluginRegistry,
|
|
2847
|
+
export { h as PluginRegistry, $e as TimepickerUI };
|