@ac-design/design-system 2.3.0 → 2.4.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/lib/compat.css +211 -0
- package/dist/lib/components/AcAppSwitcher.vue.d.ts +1 -1
- package/dist/lib/components/AcAppSwitcher.vue_vue_type_script_setup_true_lang.js +23 -23
- package/dist/lib/components/AcAreaChart.vue.d.ts +1 -1
- package/dist/lib/components/AcBarChart.vue.d.ts +1 -1
- package/dist/lib/components/AcButton.vue.d.ts +7 -1
- package/dist/lib/components/AcButton.vue_vue_type_script_setup_true_lang.js +90 -69
- package/dist/lib/components/AcCellValue.vue.d.ts +3 -3
- package/dist/lib/components/AcCellValue.vue_vue_type_script_setup_true_lang.js +20 -20
- package/dist/lib/components/AcCheckBox.vue.d.ts +4 -1
- package/dist/lib/components/AcCheckBox.vue_vue_type_script_setup_true_lang.js +50 -50
- package/dist/lib/components/AcCircularProgress.vue.d.ts +1 -1
- package/dist/lib/components/AcCodeEditor.vue.d.ts +12 -0
- package/dist/lib/components/AcCodeEditor.vue_vue_type_script_setup_true_lang.js +240 -207
- package/dist/lib/components/AcColorInput.vue.d.ts +3 -3
- package/dist/lib/components/AcColorInput.vue_vue_type_script_setup_true_lang.js +72 -66
- package/dist/lib/components/AcCostSummary.vue.d.ts +1 -1
- package/dist/lib/components/AcDatePicker.vue.d.ts +14 -7
- package/dist/lib/components/AcDatePicker.vue_vue_type_script_setup_true_lang.js +417 -372
- package/dist/lib/components/AcDeleteModal.vue.d.ts +1 -1
- package/dist/lib/components/AcDonutChart.vue.d.ts +2 -2
- package/dist/lib/components/AcDropdown.vue.d.ts +1 -1
- package/dist/lib/components/AcDropdown.vue_vue_type_script_setup_true_lang.js +8 -8
- package/dist/lib/components/AcFormFooter.vue_vue_type_script_setup_true_lang.js +8 -8
- package/dist/lib/components/AcGraphChart.vue.d.ts +2 -2
- package/dist/lib/components/AcInput.vue.d.ts +75 -54
- package/dist/lib/components/AcInput.vue_vue_type_script_setup_true_lang.js +253 -89
- package/dist/lib/components/AcKeyValueInput.vue.d.ts +34 -54
- package/dist/lib/components/AcKeyValueInput.vue_vue_type_script_setup_true_lang.js +134 -106
- package/dist/lib/components/AcLineChart.vue.d.ts +1 -1
- package/dist/lib/components/AcMapChart.vue.d.ts +2 -2
- package/dist/lib/components/AcModal.vue.d.ts +1 -1
- package/dist/lib/components/AcNotificationMenu.vue.d.ts +1 -1
- package/dist/lib/components/AcNotificationMenu.vue_vue_type_script_setup_true_lang.js +24 -24
- package/dist/lib/components/AcNumberInput.vue.d.ts +55 -45
- package/dist/lib/components/AcNumberInput.vue_vue_type_script_setup_true_lang.js +159 -99
- package/dist/lib/components/AcRadioCard.vue.d.ts +2 -2
- package/dist/lib/components/AcRadioCard.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/lib/components/AcSelect.vue.d.ts +35 -6
- package/dist/lib/components/AcSelect.vue_vue_type_script_setup_true_lang.js +272 -176
- package/dist/lib/components/AcSidePanel.vue.d.ts +1 -1
- package/dist/lib/components/AcSlider.vue.d.ts +2 -2
- package/dist/lib/components/AcSwitch.vue_vue_type_script_setup_true_lang.js +23 -23
- package/dist/lib/components/AcTable.vue.d.ts +37 -4
- package/dist/lib/components/AcTable.vue_vue_type_script_setup_true_lang.js +239 -131
- package/dist/lib/components/AcTagInput.vue.d.ts +22 -3
- package/dist/lib/components/AcTagInput.vue_vue_type_script_setup_true_lang.js +126 -114
- package/dist/lib/components/AcTaintInput.js +5 -0
- package/dist/lib/components/AcTaintInput.vue.d.ts +44 -0
- package/dist/lib/components/AcTaintInput.vue_vue_type_script_setup_true_lang.js +208 -0
- package/dist/lib/components/AcTextarea.vue.d.ts +38 -4
- package/dist/lib/components/AcTextarea.vue_vue_type_script_setup_true_lang.js +113 -53
- package/dist/lib/components/AcTimePicker.vue.d.ts +15 -8
- package/dist/lib/components/AcTimePicker.vue_vue_type_script_setup_true_lang.js +102 -70
- package/dist/lib/components/AcTooltip.vue.d.ts +3 -3
- package/dist/lib/components/index.d.ts +1 -0
- package/dist/lib/composables/useToast.d.ts +2 -2
- package/dist/lib/index.d.ts +2 -1
- package/dist/lib/index.js +31 -30
- package/package.json +1 -1
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import e from "./
|
|
2
|
-
import
|
|
3
|
-
import { Fragment as n, Teleport as r, Transition as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, createVNode as
|
|
4
|
-
import { Calendar as
|
|
1
|
+
import { fixedFrame as e } from "./fixedFrame.js";
|
|
2
|
+
import t from "./AcButton.js";
|
|
3
|
+
import { Fragment as n, Teleport as r, Transition as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, createVNode as ee, defineComponent as d, mergeModels as te, mergeProps as ne, nextTick as f, normalizeClass as p, onBeforeUnmount as re, onMounted as ie, openBlock as m, reactive as ae, ref as h, renderList as g, renderSlot as oe, resolveDynamicComponent as se, toDisplayString as _, unref as v, useAttrs as ce, useId as le, useModel as ue, watch as de, withCtx as fe } from "vue";
|
|
4
|
+
import { Calendar as pe, CalendarRange as me, ChevronLeft as he, ChevronRight as ge, Clock as _e, Timer as ve, X as ye } from "@lucide/vue";
|
|
5
5
|
//#region src/lib/components/AcDatePicker.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
-
var
|
|
6
|
+
var be = ["for"], xe = { key: 0 }, Se = {
|
|
7
7
|
key: 1,
|
|
8
8
|
class: "text-danger",
|
|
9
9
|
"aria-hidden": "true"
|
|
10
|
-
}, Se = {
|
|
11
|
-
key: 2,
|
|
12
|
-
class: "relative"
|
|
13
10
|
}, Ce = [
|
|
14
11
|
"id",
|
|
15
12
|
"disabled",
|
|
@@ -110,10 +107,10 @@ var ye = ["for"], be = { key: 0 }, xe = {
|
|
|
110
107
|
key: 1,
|
|
111
108
|
class: "basis-full text-xs text-danger-strong",
|
|
112
109
|
role: "alert"
|
|
113
|
-
}, st = ["name", "value"],
|
|
110
|
+
}, st = ["name", "value"], y = /*@__PURE__*/ d({
|
|
114
111
|
inheritAttrs: !1,
|
|
115
112
|
__name: "AcDatePicker",
|
|
116
|
-
props: /*@__PURE__*/
|
|
113
|
+
props: /*@__PURE__*/ te({
|
|
117
114
|
label: { default: "" },
|
|
118
115
|
placeholder: { default: "" },
|
|
119
116
|
mode: { default: "date" },
|
|
@@ -163,6 +160,17 @@ var ye = ["for"], be = { key: 0 }, xe = {
|
|
|
163
160
|
showTimeZone: {
|
|
164
161
|
type: Boolean,
|
|
165
162
|
default: !0
|
|
163
|
+
},
|
|
164
|
+
valueType: { default: "string" },
|
|
165
|
+
fieldClass: {
|
|
166
|
+
type: [
|
|
167
|
+
Boolean,
|
|
168
|
+
null,
|
|
169
|
+
String,
|
|
170
|
+
Object,
|
|
171
|
+
Array
|
|
172
|
+
],
|
|
173
|
+
default: void 0
|
|
166
174
|
}
|
|
167
175
|
}, {
|
|
168
176
|
modelValue: { default: null },
|
|
@@ -174,8 +182,8 @@ var ye = ["for"], be = { key: 0 }, xe = {
|
|
|
174
182
|
openModifiers: {}
|
|
175
183
|
}),
|
|
176
184
|
emits: ["update:modelValue", "update:open"],
|
|
177
|
-
setup(
|
|
178
|
-
let
|
|
185
|
+
setup(d, { expose: te }) {
|
|
186
|
+
let y = d, ct = ue(d, "modelValue"), b = ue(d, "open"), lt = /^\d{4}-\d{2}-\d{2}$/, ut = /^(\d{4}-\d{2}-\d{2})T(\d{2}):(\d{2})(?::(\d{2}))?$/, dt = {
|
|
179
187
|
w: 604800,
|
|
180
188
|
d: 86400,
|
|
181
189
|
h: 3600,
|
|
@@ -193,66 +201,66 @@ var ye = ["for"], be = { key: 0 }, xe = {
|
|
|
193
201
|
}, mt = [{
|
|
194
202
|
key: "date",
|
|
195
203
|
label: "Date",
|
|
196
|
-
icon:
|
|
204
|
+
icon: pe
|
|
197
205
|
}, {
|
|
198
206
|
key: "time",
|
|
199
207
|
label: "Time",
|
|
200
|
-
icon:
|
|
201
|
-
}],
|
|
208
|
+
icon: _e
|
|
209
|
+
}], x = le(), ht = ce(), gt = a(() => ({
|
|
202
210
|
class: ht.class,
|
|
203
211
|
style: ht.style
|
|
204
212
|
})), _t = a(() => {
|
|
205
213
|
let { class: e, style: t, ...n } = ht;
|
|
206
214
|
return n;
|
|
207
|
-
}), vt = `${
|
|
215
|
+
}), vt = `${x}-label`, yt = `${x}-value`, bt = `${x}-month`, xt = `${x}-msg`, St = `${x}-hint`, Ct = /* @__PURE__ */ new Map(), wt = h(null), Tt = h(null), S = h(null), C = h({
|
|
208
216
|
left: 0,
|
|
209
217
|
maxHeight: 480,
|
|
210
218
|
minWidth: 0
|
|
211
|
-
}),
|
|
219
|
+
}), w = h("2026-01-01"), T = h("days"), E = h(2020), D = h(0), O = h("date"), k = h("2026-01-01"), Et = h(null), A = h(null), j = h(null), M = ae({
|
|
212
220
|
h: 0,
|
|
213
221
|
m: 0,
|
|
214
222
|
s: 0
|
|
215
|
-
}), Dt =
|
|
223
|
+
}), Dt = ae({
|
|
216
224
|
h: 23,
|
|
217
225
|
m: 59,
|
|
218
226
|
s: 59
|
|
219
|
-
}),
|
|
227
|
+
}), N = ae({
|
|
220
228
|
d: 0,
|
|
221
229
|
h: 0,
|
|
222
230
|
m: 0
|
|
223
|
-
}),
|
|
231
|
+
}), P = a(() => y.timeZone || Intl.DateTimeFormat().resolvedOptions().timeZone), F = a(() => y.range && y.mode !== "duration"), I = a(() => y.mode === "datetime"), Ot = a(() => y.weekStartsOn ?? gn()), kt = a(() => new Intl.DateTimeFormat(y.locale, {
|
|
224
232
|
year: "numeric",
|
|
225
233
|
month: "short",
|
|
226
234
|
day: "numeric",
|
|
227
235
|
timeZone: "UTC"
|
|
228
|
-
})), At = a(() => new Intl.DateTimeFormat(
|
|
236
|
+
})), At = a(() => new Intl.DateTimeFormat(y.locale, {
|
|
229
237
|
year: "numeric",
|
|
230
238
|
month: "short",
|
|
231
239
|
day: "numeric",
|
|
232
240
|
hour: "2-digit",
|
|
233
241
|
minute: "2-digit",
|
|
234
|
-
second:
|
|
235
|
-
hourCycle:
|
|
236
|
-
timeZone:
|
|
237
|
-
timeZoneName:
|
|
238
|
-
})), jt = a(() => new Intl.DateTimeFormat(
|
|
242
|
+
second: y.showSeconds ? "2-digit" : void 0,
|
|
243
|
+
hourCycle: y.hourCycle === 12 ? "h12" : "h23",
|
|
244
|
+
timeZone: P.value,
|
|
245
|
+
timeZoneName: y.showTimeZone ? "short" : void 0
|
|
246
|
+
})), jt = a(() => new Intl.DateTimeFormat(y.locale, {
|
|
239
247
|
month: "long",
|
|
240
248
|
year: "numeric",
|
|
241
249
|
timeZone: "UTC"
|
|
242
|
-
})), Mt = a(() => new Intl.DateTimeFormat(
|
|
250
|
+
})), Mt = a(() => new Intl.DateTimeFormat(y.locale, {
|
|
243
251
|
weekday: "long",
|
|
244
252
|
year: "numeric",
|
|
245
253
|
month: "long",
|
|
246
254
|
day: "numeric",
|
|
247
255
|
timeZone: "UTC"
|
|
248
|
-
})), Nt = a(() => new Intl.DateTimeFormat(
|
|
256
|
+
})), Nt = a(() => new Intl.DateTimeFormat(y.locale, {
|
|
249
257
|
day: "numeric",
|
|
250
258
|
timeZone: "UTC"
|
|
251
259
|
})), Pt = a(() => {
|
|
252
|
-
let e = new Intl.DateTimeFormat(
|
|
260
|
+
let e = new Intl.DateTimeFormat(y.locale, {
|
|
253
261
|
weekday: "short",
|
|
254
262
|
timeZone: "UTC"
|
|
255
|
-
}), t = new Intl.DateTimeFormat(
|
|
263
|
+
}), t = new Intl.DateTimeFormat(y.locale, {
|
|
256
264
|
weekday: "long",
|
|
257
265
|
timeZone: "UTC"
|
|
258
266
|
});
|
|
@@ -263,97 +271,131 @@ var ye = ["for"], be = { key: 0 }, xe = {
|
|
|
263
271
|
long: t.format(i)
|
|
264
272
|
};
|
|
265
273
|
});
|
|
266
|
-
}), Ft = a(() => new Intl.DateTimeFormat(
|
|
267
|
-
timeZone:
|
|
274
|
+
}), Ft = a(() => new Intl.DateTimeFormat(y.locale, {
|
|
275
|
+
timeZone: P.value,
|
|
268
276
|
timeZoneName: "short"
|
|
269
|
-
}).formatToParts(Date.now()).find((e) => e.type === "timeZoneName")?.value ??
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
277
|
+
}).formatToParts(Date.now()).find((e) => e.type === "timeZoneName")?.value ?? P.value), It = a(() => Y(Date.now()).day), L = a(() => y.minDate ? yn(y.minDate) : null), R = a(() => y.maxDate ? yn(y.maxDate) : null), Lt = a(() => y.minDate ? X(y.minDate) : null), Rt = a(() => y.maxDate ? lt.test(y.maxDate) ? vn(q(y.maxDate, 1), 0, 0, 0) - 1e3 : X(y.maxDate) : null), zt = a({
|
|
278
|
+
get() {
|
|
279
|
+
let e = ct.value;
|
|
280
|
+
if (y.range || y.mode === "duration" || Array.isArray(e)) return e ?? null;
|
|
281
|
+
if (y.valueType === "string" && !(e instanceof Date)) return e || null;
|
|
282
|
+
let t = Bt(e);
|
|
283
|
+
return t ? y.mode === "date" ? `${t.getFullYear()}-${U(t.getMonth() + 1)}-${U(t.getDate())}` : t.toISOString().replace(/\.\d{3}Z$/, "Z") : null;
|
|
284
|
+
},
|
|
285
|
+
set(e) {
|
|
286
|
+
if (y.range || y.mode === "duration" || Array.isArray(e) || y.valueType === "string" && !(ct.value instanceof Date)) {
|
|
287
|
+
ct.value = e;
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
if (!e) {
|
|
291
|
+
ct.value = y.valueType === "local" ? "" : null;
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
let t;
|
|
295
|
+
if (y.mode === "date") {
|
|
296
|
+
t = Bt(ct.value) ?? /* @__PURE__ */ new Date();
|
|
297
|
+
let [n, r, i] = e.split("-").map(Number);
|
|
298
|
+
t.setFullYear(n, r - 1, i);
|
|
299
|
+
} else t = new Date(e);
|
|
300
|
+
ct.value = y.valueType === "local" ? Vt(t) : t;
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
function Bt(e) {
|
|
304
|
+
if (!e) return null;
|
|
305
|
+
let t = e instanceof Date ? new Date(e) : new Date(String(e));
|
|
306
|
+
return Number.isNaN(t.getTime()) ? null : t;
|
|
307
|
+
}
|
|
308
|
+
function Vt(e) {
|
|
309
|
+
return `${e.getFullYear()}-${U(e.getMonth() + 1)}-${U(e.getDate())}T${U(e.getHours())}:${U(e.getMinutes())}`;
|
|
310
|
+
}
|
|
311
|
+
let z = a(() => {
|
|
312
|
+
let e = zt.value;
|
|
313
|
+
return F.value ? Array.isArray(e) ? [e[0] || null, e[1] || null] : [null, null] : [typeof e == "string" && e ? e : null];
|
|
314
|
+
}), Ht = a(() => z.value.some(Boolean)), Ut = a(() => {
|
|
315
|
+
let [e, t] = z.value;
|
|
274
316
|
if (!e) return "";
|
|
275
|
-
if (
|
|
276
|
-
let t =
|
|
277
|
-
return t === null ? e :
|
|
317
|
+
if (y.mode === "duration") {
|
|
318
|
+
let t = bn(e);
|
|
319
|
+
return t === null ? e : Sn(t);
|
|
278
320
|
}
|
|
279
|
-
if (
|
|
280
|
-
let n =
|
|
281
|
-
return n ?
|
|
321
|
+
if (y.mode === "date") {
|
|
322
|
+
let n = yn(e), r = t ? yn(t) : null;
|
|
323
|
+
return n ? F.value ? r ? kt.value.formatRange(K(n), K(r)) : `${kt.value.format(K(n))} –` : kt.value.format(K(n)) : e;
|
|
282
324
|
}
|
|
283
325
|
let n = X(e), r = t ? X(t) : null;
|
|
284
|
-
return n === null ? e :
|
|
285
|
-
}),
|
|
286
|
-
let e = (
|
|
326
|
+
return n === null ? e : F.value ? r === null ? `${At.value.format(n)} –` : At.value.formatRange(n, r) : At.value.format(n);
|
|
327
|
+
}), Wt = a(() => z.value.filter(Boolean).join("/")), Gt = a(() => {
|
|
328
|
+
let e = (hn(w.value) - Ot.value + 7) % 7, t = q(w.value, -e), n = Math.ceil((e + mn(w.value)) / 7);
|
|
287
329
|
return Array.from({ length: n }, (e, n) => Array.from({ length: 7 }, (e, r) => q(t, n * 7 + r)));
|
|
288
|
-
}),
|
|
289
|
-
let e = new Intl.DateTimeFormat(
|
|
330
|
+
}), B = a(() => G(w.value).y), Kt = a(() => G(w.value).m - 1), qt = a(() => {
|
|
331
|
+
let e = new Intl.DateTimeFormat(y.locale, {
|
|
290
332
|
month: "short",
|
|
291
333
|
timeZone: "UTC"
|
|
292
|
-
}), t = new Intl.DateTimeFormat(
|
|
334
|
+
}), t = new Intl.DateTimeFormat(y.locale, {
|
|
293
335
|
month: "long",
|
|
294
336
|
year: "numeric",
|
|
295
337
|
timeZone: "UTC"
|
|
296
338
|
});
|
|
297
339
|
return Array.from({ length: 12 }, (n, r) => {
|
|
298
|
-
let i = W(
|
|
340
|
+
let i = W(B.value, r + 1, 1);
|
|
299
341
|
return {
|
|
300
342
|
value: r,
|
|
301
343
|
text: e.format(K(i)),
|
|
302
344
|
label: t.format(K(i)),
|
|
303
|
-
disabled:
|
|
304
|
-
selected: r ===
|
|
345
|
+
disabled: wn(i, W(B.value, r + 2, 0)),
|
|
346
|
+
selected: r === Kt.value
|
|
305
347
|
};
|
|
306
348
|
});
|
|
307
|
-
}),
|
|
308
|
-
let n =
|
|
349
|
+
}), Jt = a(() => Array.from({ length: 12 }, (e, t) => {
|
|
350
|
+
let n = E.value + t;
|
|
309
351
|
return {
|
|
310
352
|
value: n,
|
|
311
353
|
text: String(n),
|
|
312
354
|
label: String(n),
|
|
313
|
-
disabled:
|
|
314
|
-
selected: n ===
|
|
355
|
+
disabled: wn(W(n, 1, 1), W(n, 12, 31)),
|
|
356
|
+
selected: n === B.value
|
|
315
357
|
};
|
|
316
|
-
})),
|
|
358
|
+
})), Yt = a(() => T.value === "months" ? qt.value : Jt.value), Xt = a(() => [
|
|
317
359
|
0,
|
|
318
360
|
4,
|
|
319
361
|
8
|
|
320
|
-
].map((e) =>
|
|
321
|
-
if (!
|
|
322
|
-
let e =
|
|
362
|
+
].map((e) => Yt.value.slice(e, e + 4))), Zt = a(() => Yt.value.some((e) => e.value === D.value) ? D.value : Yt.value[0].value), V = a(() => T.value === "days" ? jt.value.format(K(w.value)) : T.value === "months" ? String(B.value) : `${E.value}–${E.value + 9}`), Qt = a(() => T.value === "days" ? ["Previous month", "Next month"] : T.value === "months" ? ["Previous year", "Next year"] : ["Previous years", "Next years"]), $t = a(() => !F.value || !A.value ? null : j.value ?? Et.value ?? null), H = a(() => A.value ? vn(A.value, M.h, M.m, M.s) : null), en = a(() => j.value ? vn(j.value, Dt.h, Dt.m, Dt.s) : null), tn = a(() => {
|
|
363
|
+
if (!I.value) return "";
|
|
364
|
+
let e = F.value ? [H.value, en.value] : [H.value];
|
|
323
365
|
for (let t of e) if (t !== null) {
|
|
324
366
|
if (Lt.value !== null && t < Lt.value) return `Choose a time from ${At.value.format(Lt.value)}`;
|
|
325
367
|
if (Rt.value !== null && t > Rt.value) return `Choose a time up to ${At.value.format(Rt.value)}`;
|
|
326
368
|
}
|
|
327
|
-
return
|
|
328
|
-
}),
|
|
369
|
+
return F.value && H.value !== null && en.value !== null && en.value < H.value ? "The end must be after the start" : "";
|
|
370
|
+
}), nn = a(() => y.mode === "duration" ? !0 : y.inline && !I.value ? !1 : !F.value || I.value && (!y.autoApply || !!tn.value)), rn = a(() => y.mode === "duration" ? !0 : !A.value || F.value && !j.value ? !1 : !tn.value), an = a(() => N.d * 86400 + N.h * 3600 + N.m * 60), on = a(() => {
|
|
329
371
|
let e = [{
|
|
330
372
|
key: "start",
|
|
331
|
-
label:
|
|
332
|
-
clock:
|
|
373
|
+
label: F.value ? "Start" : "Time",
|
|
374
|
+
clock: M
|
|
333
375
|
}];
|
|
334
|
-
return
|
|
376
|
+
return F.value && e.push({
|
|
335
377
|
key: "end",
|
|
336
378
|
label: "End",
|
|
337
379
|
clock: Dt
|
|
338
380
|
}), e.map((e) => ({
|
|
339
381
|
...e,
|
|
340
|
-
spinners:
|
|
382
|
+
spinners: On(e.clock, e.label)
|
|
341
383
|
}));
|
|
342
|
-
}),
|
|
343
|
-
Q("d", "Days", 0, 999, !1, !1, () =>
|
|
344
|
-
Q("h", "Hours", 0, 23, !1, !1, () =>
|
|
345
|
-
Q("m", "Minutes", 0, 59, !1, !1, () =>
|
|
346
|
-
]),
|
|
347
|
-
if (
|
|
348
|
-
let e =
|
|
349
|
-
return
|
|
350
|
-
}),
|
|
351
|
-
function
|
|
384
|
+
}), sn = a(() => [
|
|
385
|
+
Q("d", "Days", 0, 999, !1, !1, () => N.d, (e) => N.d = e),
|
|
386
|
+
Q("h", "Hours", 0, 23, !1, !1, () => N.h, (e) => N.h = e),
|
|
387
|
+
Q("m", "Minutes", 0, 59, !1, !1, () => N.m, (e) => N.m = e)
|
|
388
|
+
]), cn = h(!1), ln = a(() => b.value || cn.value), un = a(() => [y.hint && St, y.errorMsg && xt].filter(Boolean).join(" ") || void 0), dn = a(() => {
|
|
389
|
+
if (y.mode === "duration") return y.label || "Choose duration";
|
|
390
|
+
let e = F.value ? "date range" : I.value ? "date and time" : "date";
|
|
391
|
+
return y.label ? `${y.label}: choose ${e}` : `Choose ${e}`;
|
|
392
|
+
}), fn = a(() => y.mode === "duration" ? ve : F.value ? me : pe);
|
|
393
|
+
function U(e) {
|
|
352
394
|
return String(e).padStart(2, "0");
|
|
353
395
|
}
|
|
354
396
|
function W(e, t, n) {
|
|
355
397
|
let r = new Date(Date.UTC(e, t - 1, n));
|
|
356
|
-
return `${r.getUTCFullYear()}-${
|
|
398
|
+
return `${r.getUTCFullYear()}-${U(r.getUTCMonth() + 1)}-${U(r.getUTCDate())}`;
|
|
357
399
|
}
|
|
358
400
|
function G(e) {
|
|
359
401
|
let [t, n, r] = e.split("-").map(Number);
|
|
@@ -371,31 +413,31 @@ var ye = ["for"], be = { key: 0 }, xe = {
|
|
|
371
413
|
let { y: n, m: r, d: i } = G(e);
|
|
372
414
|
return W(n, r, i + t);
|
|
373
415
|
}
|
|
374
|
-
function
|
|
416
|
+
function pn(e, t) {
|
|
375
417
|
let { y: n, m: r, d: i } = G(e), a = new Date(Date.UTC(n, r - 1 + t + 1, 0)).getUTCDate();
|
|
376
418
|
return W(n, r + t, Math.min(i, a));
|
|
377
419
|
}
|
|
378
420
|
function J(e) {
|
|
379
421
|
return `${e.slice(0, 7)}-01`;
|
|
380
422
|
}
|
|
381
|
-
function
|
|
423
|
+
function mn(e) {
|
|
382
424
|
let { y: t, m: n } = G(e);
|
|
383
425
|
return new Date(Date.UTC(t, n, 0)).getUTCDate();
|
|
384
426
|
}
|
|
385
|
-
function
|
|
427
|
+
function hn(e) {
|
|
386
428
|
return K(e).getUTCDay();
|
|
387
429
|
}
|
|
388
|
-
function
|
|
430
|
+
function gn() {
|
|
389
431
|
try {
|
|
390
|
-
let e = new Intl.Locale(
|
|
432
|
+
let e = new Intl.Locale(y.locale ?? navigator.language), t = (e.getWeekInfo?.() ?? e.weekInfo)?.firstDay;
|
|
391
433
|
if (t) return t % 7;
|
|
392
434
|
} catch {}
|
|
393
435
|
return 0;
|
|
394
436
|
}
|
|
395
437
|
function Y(e) {
|
|
396
|
-
let t = Ct.get(
|
|
438
|
+
let t = Ct.get(P.value);
|
|
397
439
|
t || (t = new Intl.DateTimeFormat("en-US", {
|
|
398
|
-
timeZone:
|
|
440
|
+
timeZone: P.value,
|
|
399
441
|
hourCycle: "h23",
|
|
400
442
|
year: "numeric",
|
|
401
443
|
month: "2-digit",
|
|
@@ -403,7 +445,7 @@ var ye = ["for"], be = { key: 0 }, xe = {
|
|
|
403
445
|
hour: "2-digit",
|
|
404
446
|
minute: "2-digit",
|
|
405
447
|
second: "2-digit"
|
|
406
|
-
}), Ct.set(
|
|
448
|
+
}), Ct.set(P.value, t));
|
|
407
449
|
let n = {};
|
|
408
450
|
for (let { type: r, value: i } of t.formatToParts(e)) r !== "literal" && (n[r] = Number(i));
|
|
409
451
|
return {
|
|
@@ -413,22 +455,22 @@ var ye = ["for"], be = { key: 0 }, xe = {
|
|
|
413
455
|
s: n.second
|
|
414
456
|
};
|
|
415
457
|
}
|
|
416
|
-
function
|
|
458
|
+
function _n(e) {
|
|
417
459
|
let t = Y(e), { y: n, m: r, d: i } = G(t.day);
|
|
418
460
|
return Date.UTC(n, r - 1, i, t.h, t.m, t.s) - Math.floor(e / 1e3) * 1e3;
|
|
419
461
|
}
|
|
420
|
-
function
|
|
421
|
-
let { y: i, m: a, d: o } = G(e), s = Date.UTC(i, a - 1, o, t, n, r), c =
|
|
462
|
+
function vn(e, t, n, r) {
|
|
463
|
+
let { y: i, m: a, d: o } = G(e), s = Date.UTC(i, a - 1, o, t, n, r), c = _n(s), l = s - c, u = _n(l);
|
|
422
464
|
return u === c ? l : s - u;
|
|
423
465
|
}
|
|
424
466
|
function X(e) {
|
|
425
467
|
let t = ut.exec(e);
|
|
426
|
-
if (t) return
|
|
427
|
-
if (lt.test(e)) return
|
|
468
|
+
if (t) return vn(t[1], Number(t[2]), Number(t[3]), Number(t[4] ?? 0));
|
|
469
|
+
if (lt.test(e)) return vn(e, 0, 0, 0);
|
|
428
470
|
let n = Date.parse(e);
|
|
429
471
|
return Number.isNaN(n) ? null : n;
|
|
430
472
|
}
|
|
431
|
-
function
|
|
473
|
+
function yn(e) {
|
|
432
474
|
if (lt.test(e)) return e;
|
|
433
475
|
let t = X(e);
|
|
434
476
|
return t === null ? null : Y(t).day;
|
|
@@ -436,7 +478,7 @@ var ye = ["for"], be = { key: 0 }, xe = {
|
|
|
436
478
|
function Z(e) {
|
|
437
479
|
return new Date(e).toISOString().replace(/\.000Z$/, "Z");
|
|
438
480
|
}
|
|
439
|
-
function
|
|
481
|
+
function bn(e) {
|
|
440
482
|
let t = e.replace(/\s+/g, "");
|
|
441
483
|
if (!t) return null;
|
|
442
484
|
if (t === "0") return 0;
|
|
@@ -444,12 +486,12 @@ var ye = ["for"], be = { key: 0 }, xe = {
|
|
|
444
486
|
for (; a = n.exec(t);) r += Number(a[1]) * dt[a[2]], i = n.lastIndex;
|
|
445
487
|
return i === t.length ? r : null;
|
|
446
488
|
}
|
|
447
|
-
function
|
|
489
|
+
function xn(e) {
|
|
448
490
|
if (e <= 0) return null;
|
|
449
491
|
let t = Math.floor(e / 3600), n = Math.floor(e % 3600 / 60), r = Math.round(e % 60);
|
|
450
492
|
return `${t ? `${t}h` : ""}${n ? `${n}m` : ""}${r ? `${r}s` : ""}` || null;
|
|
451
493
|
}
|
|
452
|
-
function
|
|
494
|
+
function Sn(e) {
|
|
453
495
|
let t = Math.floor(e / 86400), n = Math.floor(e % 86400 / 3600), r = Math.floor(e % 3600 / 60), i = Math.round(e % 60);
|
|
454
496
|
return [
|
|
455
497
|
t && `${t}d`,
|
|
@@ -458,23 +500,23 @@ var ye = ["for"], be = { key: 0 }, xe = {
|
|
|
458
500
|
i && `${i}s`
|
|
459
501
|
].filter(Boolean).join(" ") || "0m";
|
|
460
502
|
}
|
|
461
|
-
function
|
|
462
|
-
return
|
|
503
|
+
function Cn(e) {
|
|
504
|
+
return L.value && e < L.value || R.value && e > R.value ? !0 : y.isDateDisabled?.(e) ?? !1;
|
|
463
505
|
}
|
|
464
|
-
function
|
|
465
|
-
return !!
|
|
506
|
+
function wn(e, t) {
|
|
507
|
+
return !!L.value && t < L.value || !!R.value && e > R.value;
|
|
466
508
|
}
|
|
467
|
-
function
|
|
468
|
-
return e ===
|
|
509
|
+
function Tn(e) {
|
|
510
|
+
return e === A.value || F.value && e === (j.value ?? $t.value);
|
|
469
511
|
}
|
|
470
|
-
function
|
|
471
|
-
let t =
|
|
512
|
+
function En(e) {
|
|
513
|
+
let t = A.value, n = $t.value;
|
|
472
514
|
if (!t || !n) return !1;
|
|
473
515
|
let [r, i] = t <= n ? [t, n] : [n, t];
|
|
474
516
|
return e >= r && e <= i;
|
|
475
517
|
}
|
|
476
|
-
function
|
|
477
|
-
let t =
|
|
518
|
+
function Dn(e) {
|
|
519
|
+
let t = A.value, n = $t.value, [r, i] = t <= n ? [t, n] : [n, t];
|
|
478
520
|
return [e === r && "rounded-l-8", e === i && "rounded-r-8"];
|
|
479
521
|
}
|
|
480
522
|
function Q(e, t, n, r, i, a, o, s) {
|
|
@@ -489,61 +531,61 @@ var ye = ["for"], be = { key: 0 }, xe = {
|
|
|
489
531
|
set: s
|
|
490
532
|
};
|
|
491
533
|
}
|
|
492
|
-
function
|
|
493
|
-
let n =
|
|
534
|
+
function On(e, t) {
|
|
535
|
+
let n = y.hourCycle === 12, r = [n ? {
|
|
494
536
|
...Q("h", `${t} hours`, 0, 11, !0, !0, () => e.h % 12, (t) => e.h = t + (e.h >= 12 ? 12 : 0)),
|
|
495
|
-
text: (e) =>
|
|
537
|
+
text: (e) => U(e || 12)
|
|
496
538
|
} : Q("h", `${t} hours`, 0, 23, !0, !0, () => e.h, (t) => e.h = t), Q("m", `${t} minutes`, 0, 59, !0, !0, () => e.m, (t) => e.m = t)];
|
|
497
|
-
return
|
|
539
|
+
return y.showSeconds && r.push(Q("s", `${t} seconds`, 0, 59, !0, !0, () => e.s, (t) => e.s = t)), n && r.push({
|
|
498
540
|
...Q("p", `${t} AM or PM`, 0, 12, !1, !1, () => e.h >= 12 ? 12 : 0, (t) => e.h = e.h % 12 + t),
|
|
499
541
|
values: [0, 12],
|
|
500
542
|
text: (e) => e ? "PM" : "AM"
|
|
501
543
|
}), r;
|
|
502
544
|
}
|
|
503
|
-
function
|
|
504
|
-
return e.padded ?
|
|
545
|
+
function kn(e) {
|
|
546
|
+
return e.padded ? U(e.get()) : String(e.get());
|
|
505
547
|
}
|
|
506
|
-
function
|
|
548
|
+
function An(e, t) {
|
|
507
549
|
let n = t.get(), r = t.max - t.min + 1, i = null;
|
|
508
|
-
e.key === "ArrowUp" ? i = n + 1 : e.key === "ArrowDown" ? i = n - 1 : e.key === "PageUp" ? i = n + 10 : e.key === "PageDown" ? i = n - 10 : e.key === "Home" ? i = t.min : e.key === "End" && (i = t.max), i !== null && (e.preventDefault(), i = t.wrap ? ((i - t.min) % r + r) % r + t.min : Math.min(t.max, Math.max(t.min, i)), t.set(i), e.target.value =
|
|
550
|
+
e.key === "ArrowUp" ? i = n + 1 : e.key === "ArrowDown" ? i = n - 1 : e.key === "PageUp" ? i = n + 10 : e.key === "PageDown" ? i = n - 10 : e.key === "Home" ? i = t.min : e.key === "End" && (i = t.max), i !== null && (e.preventDefault(), i = t.wrap ? ((i - t.min) % r + r) % r + t.min : Math.min(t.max, Math.max(t.min, i)), t.set(i), e.target.value = kn(t));
|
|
509
551
|
}
|
|
510
|
-
function
|
|
552
|
+
function jn(e, t) {
|
|
511
553
|
let n = e.target, r = n.value.replace(/\D/g, "").slice(0, String(t.max).length);
|
|
512
554
|
if (n.value = r, !r) return;
|
|
513
555
|
let i = Number(r);
|
|
514
556
|
i > t.max && (i = Number(r.slice(-1))), t.set(Math.max(t.min, i));
|
|
515
557
|
}
|
|
516
|
-
function
|
|
517
|
-
e.target.value =
|
|
558
|
+
function Mn(e, t) {
|
|
559
|
+
e.target.value = kn(t);
|
|
518
560
|
}
|
|
519
|
-
function
|
|
520
|
-
if (Et.value = null, e && (
|
|
521
|
-
let e =
|
|
522
|
-
|
|
561
|
+
function Nn(e = !0) {
|
|
562
|
+
if (Et.value = null, e && (T.value = "days", O.value = "date"), y.mode === "duration") {
|
|
563
|
+
let e = z.value[0] ? bn(z.value[0]) ?? 0 : 0;
|
|
564
|
+
N.d = Math.floor(e / 86400), N.h = Math.floor(e % 86400 / 3600), N.m = Math.floor(e % 3600 / 60);
|
|
523
565
|
return;
|
|
524
566
|
}
|
|
525
|
-
let [t, n] =
|
|
526
|
-
if (
|
|
567
|
+
let [t, n] = z.value;
|
|
568
|
+
if (A.value = null, j.value = null, Object.assign(M, {
|
|
527
569
|
h: 0,
|
|
528
570
|
m: 0,
|
|
529
571
|
s: 0
|
|
530
572
|
}), Object.assign(Dt, {
|
|
531
573
|
h: 23,
|
|
532
574
|
m: 59,
|
|
533
|
-
s:
|
|
534
|
-
}),
|
|
575
|
+
s: y.showSeconds ? 59 : 0
|
|
576
|
+
}), y.autoApply) {
|
|
535
577
|
let e = Y(Date.now());
|
|
536
|
-
Object.assign(
|
|
578
|
+
Object.assign(M, {
|
|
537
579
|
h: e.h,
|
|
538
580
|
m: e.m,
|
|
539
581
|
s: 0
|
|
540
582
|
});
|
|
541
583
|
}
|
|
542
|
-
if (
|
|
584
|
+
if (I.value) {
|
|
543
585
|
let e = t ? X(t) : null, r = n ? X(n) : null;
|
|
544
586
|
if (e !== null) {
|
|
545
587
|
let t = Y(e);
|
|
546
|
-
|
|
588
|
+
A.value = t.day, Object.assign(M, {
|
|
547
589
|
h: t.h,
|
|
548
590
|
m: t.m,
|
|
549
591
|
s: t.s
|
|
@@ -551,21 +593,21 @@ var ye = ["for"], be = { key: 0 }, xe = {
|
|
|
551
593
|
}
|
|
552
594
|
if (r !== null) {
|
|
553
595
|
let e = Y(r);
|
|
554
|
-
|
|
596
|
+
j.value = e.day, Object.assign(Dt, {
|
|
555
597
|
h: e.h,
|
|
556
598
|
m: e.m,
|
|
557
599
|
s: e.s
|
|
558
600
|
});
|
|
559
601
|
}
|
|
560
|
-
} else
|
|
561
|
-
let r =
|
|
562
|
-
!
|
|
563
|
-
}
|
|
564
|
-
function
|
|
565
|
-
let
|
|
566
|
-
if (!
|
|
567
|
-
let n =
|
|
568
|
-
|
|
602
|
+
} else A.value = t ? yn(t) : null, j.value = n ? yn(n) : null;
|
|
603
|
+
let r = A.value ?? It.value;
|
|
604
|
+
!A.value && L.value && r < L.value && (r = L.value), !A.value && R.value && r > R.value && (r = R.value), k.value = r, w.value = J(r);
|
|
605
|
+
}
|
|
606
|
+
function Pn() {
|
|
607
|
+
let t = Tt.value;
|
|
608
|
+
if (!t) return;
|
|
609
|
+
let n = t.getBoundingClientRect(), r = e(), i = S.value?.offsetWidth ?? 300, a = S.value?.offsetHeight ?? 380, o = r.bottom - n.bottom - 6 - 8, s = n.top - r.top - 6 - 8, c = o < a && s > o, l = Math.max(8, Math.min(n.left - r.left, r.width - i - 8)), u = Math.min(n.width, 448);
|
|
610
|
+
C.value = c ? {
|
|
569
611
|
bottom: r.bottom - n.top + 6,
|
|
570
612
|
left: l,
|
|
571
613
|
maxHeight: Math.max(200, s),
|
|
@@ -577,123 +619,123 @@ var ye = ["for"], be = { key: 0 }, xe = {
|
|
|
577
619
|
minWidth: u
|
|
578
620
|
};
|
|
579
621
|
}
|
|
580
|
-
function
|
|
581
|
-
|
|
622
|
+
function Fn() {
|
|
623
|
+
y.disabled || b.value || (b.value = !0);
|
|
582
624
|
}
|
|
583
|
-
function
|
|
584
|
-
|
|
625
|
+
function In(e = !0) {
|
|
626
|
+
b.value && (b.value = !1, e && Tt.value?.focus());
|
|
585
627
|
}
|
|
586
|
-
async function
|
|
587
|
-
|
|
628
|
+
async function Ln() {
|
|
629
|
+
Nn(), Pn(), fr(), await f(), Pn(), y.mode === "duration" ? S.value?.querySelector("input")?.focus() : Rn();
|
|
588
630
|
}
|
|
589
|
-
function
|
|
590
|
-
|
|
631
|
+
function Rn() {
|
|
632
|
+
f(() => S.value?.querySelector(`[data-day="${k.value}"]`)?.focus());
|
|
591
633
|
}
|
|
592
634
|
function $(e, t = !0) {
|
|
593
|
-
|
|
635
|
+
zt.value = e, t && In();
|
|
594
636
|
}
|
|
595
|
-
function
|
|
596
|
-
|
|
637
|
+
function zn() {
|
|
638
|
+
y.autoApply && I.value && (F.value || (A.value ??= k.value), rn.value && $(F.value ? [Z(H.value), Z(en.value)] : Z(H.value), !1));
|
|
597
639
|
}
|
|
598
|
-
function
|
|
599
|
-
|
|
640
|
+
function Bn() {
|
|
641
|
+
y.inline ? Nn(!1) : In();
|
|
600
642
|
}
|
|
601
|
-
function
|
|
602
|
-
if (!
|
|
603
|
-
if (
|
|
604
|
-
|
|
643
|
+
function Vn(e) {
|
|
644
|
+
if (!Cn(e)) {
|
|
645
|
+
if (k.value = e, J(e) !== w.value && (w.value = J(e), Rn()), !F.value) {
|
|
646
|
+
A.value = e, I.value ? zn() : $(e);
|
|
605
647
|
return;
|
|
606
648
|
}
|
|
607
|
-
if (!
|
|
608
|
-
|
|
649
|
+
if (!A.value || j.value) {
|
|
650
|
+
A.value = e, j.value = null;
|
|
609
651
|
return;
|
|
610
652
|
}
|
|
611
|
-
e <
|
|
653
|
+
e < A.value ? (j.value = A.value, A.value = e) : j.value = e, Et.value = null, I.value ? zn() : $([A.value, j.value]);
|
|
612
654
|
}
|
|
613
655
|
}
|
|
614
|
-
function
|
|
615
|
-
if (
|
|
616
|
-
if (
|
|
617
|
-
if (!
|
|
618
|
-
$(
|
|
656
|
+
function Hn() {
|
|
657
|
+
if (rn.value) {
|
|
658
|
+
if (y.mode === "duration") return $(xn(an.value));
|
|
659
|
+
if (!I.value) return $(F.value ? [A.value, j.value] : A.value);
|
|
660
|
+
$(F.value ? [Z(H.value), Z(en.value)] : Z(H.value));
|
|
619
661
|
}
|
|
620
662
|
}
|
|
621
|
-
function
|
|
663
|
+
function Un() {
|
|
622
664
|
let e = Y(Date.now());
|
|
623
|
-
|
|
665
|
+
A.value = e.day, Object.assign(M, {
|
|
624
666
|
h: e.h,
|
|
625
667
|
m: e.m,
|
|
626
|
-
s:
|
|
627
|
-
}),
|
|
668
|
+
s: y.showSeconds ? e.s : 0
|
|
669
|
+
}), k.value = e.day, w.value = J(e.day), T.value = "days", zn(), O.value === "time" && f(() => rr("smooth"));
|
|
628
670
|
}
|
|
629
|
-
function
|
|
630
|
-
|
|
671
|
+
function Wn() {
|
|
672
|
+
Vn(It.value);
|
|
631
673
|
}
|
|
632
|
-
function
|
|
674
|
+
function Gn(e) {
|
|
633
675
|
if (e.value) return $(e.value());
|
|
634
676
|
if (!e.duration) return;
|
|
635
|
-
if (
|
|
636
|
-
let t = Math.floor(Date.now() / 1e3) * 1e3, n = t - (
|
|
637
|
-
if (
|
|
638
|
-
$(
|
|
677
|
+
if (y.mode === "duration") return $(xn(bn(e.duration) ?? 0));
|
|
678
|
+
let t = Math.floor(Date.now() / 1e3) * 1e3, n = t - (bn(e.duration) ?? 0) * 1e3;
|
|
679
|
+
if (y.mode === "date") return $(F.value ? [Y(n).day, Y(t).day] : Y(n).day);
|
|
680
|
+
$(F.value ? [Z(n), Z(t)] : Z(n));
|
|
639
681
|
}
|
|
640
|
-
function
|
|
641
|
-
|
|
682
|
+
function Kn() {
|
|
683
|
+
zt.value = null, Tt.value?.focus();
|
|
642
684
|
}
|
|
643
|
-
function
|
|
644
|
-
|
|
685
|
+
function qn(e) {
|
|
686
|
+
w.value = pn(w.value, e), k.value = pn(k.value, e);
|
|
645
687
|
}
|
|
646
|
-
function
|
|
647
|
-
|
|
688
|
+
function Jn(e) {
|
|
689
|
+
T.value === "days" ? qn(e) : T.value === "months" ? w.value = pn(w.value, 12 * e) : E.value += 10 * e;
|
|
648
690
|
}
|
|
649
|
-
function
|
|
650
|
-
|
|
691
|
+
function Yn() {
|
|
692
|
+
T.value = "months", D.value = Kt.value, Zn();
|
|
651
693
|
}
|
|
652
|
-
function
|
|
653
|
-
|
|
694
|
+
function Xn() {
|
|
695
|
+
T.value = "years", E.value = Math.floor(B.value / 10) * 10, D.value = B.value, Zn();
|
|
654
696
|
}
|
|
655
|
-
function
|
|
656
|
-
|
|
697
|
+
function Zn() {
|
|
698
|
+
f(() => S.value?.querySelector(`[data-pick="${Zt.value}"]`)?.focus());
|
|
657
699
|
}
|
|
658
|
-
function
|
|
700
|
+
function Qn(e) {
|
|
659
701
|
if (!e.disabled) {
|
|
660
|
-
if (
|
|
661
|
-
|
|
702
|
+
if (T.value === "years") {
|
|
703
|
+
w.value = W(e.value, Kt.value + 1, 1), Yn();
|
|
662
704
|
return;
|
|
663
705
|
}
|
|
664
|
-
|
|
706
|
+
w.value = W(B.value, e.value + 1, 1), k.value = W(B.value, e.value + 1, Math.min(G(k.value).d, mn(w.value))), T.value = "days", Rn();
|
|
665
707
|
}
|
|
666
708
|
}
|
|
667
|
-
function
|
|
709
|
+
function $n(e) {
|
|
668
710
|
if (e.key === "Escape") {
|
|
669
|
-
e.preventDefault(), e.stopPropagation(),
|
|
711
|
+
e.preventDefault(), e.stopPropagation(), T.value === "years" ? Yn() : (T.value = "days", Rn());
|
|
670
712
|
return;
|
|
671
713
|
}
|
|
672
714
|
if (e.key === "Enter" || e.key === " ") {
|
|
673
715
|
e.preventDefault();
|
|
674
|
-
let t =
|
|
675
|
-
t &&
|
|
716
|
+
let t = Yt.value.find((e) => e.value === D.value);
|
|
717
|
+
t && Qn(t);
|
|
676
718
|
return;
|
|
677
719
|
}
|
|
678
|
-
let t =
|
|
720
|
+
let t = T.value === "years", n = t ? E.value : 0, r = {
|
|
679
721
|
ArrowLeft: -1,
|
|
680
722
|
ArrowRight: 1,
|
|
681
723
|
ArrowUp: -4,
|
|
682
724
|
ArrowDown: 4
|
|
683
725
|
}, i;
|
|
684
|
-
if (e.key in r) i =
|
|
726
|
+
if (e.key in r) i = D.value + r[e.key];
|
|
685
727
|
else if (e.key === "Home") i = n;
|
|
686
728
|
else if (e.key === "End") i = n + 11;
|
|
687
729
|
else if (e.key === "PageUp" || e.key === "PageDown") {
|
|
688
|
-
e.preventDefault(),
|
|
730
|
+
e.preventDefault(), Jn(e.key === "PageUp" ? -1 : 1), t && (D.value += e.key === "PageUp" ? -10 : 10), Zn();
|
|
689
731
|
return;
|
|
690
732
|
} else return;
|
|
691
|
-
e.preventDefault(), t ? i <
|
|
733
|
+
e.preventDefault(), t ? i < E.value ? E.value -= 10 : i > E.value + 11 && (E.value += 10) : i = Math.max(0, Math.min(11, i)), D.value = i, Zn();
|
|
692
734
|
}
|
|
693
|
-
function
|
|
694
|
-
|
|
735
|
+
function er(e) {
|
|
736
|
+
O.value = e, e === "time" && f(() => rr("instant"));
|
|
695
737
|
}
|
|
696
|
-
function
|
|
738
|
+
function tr(e) {
|
|
697
739
|
if (![
|
|
698
740
|
"ArrowLeft",
|
|
699
741
|
"ArrowRight",
|
|
@@ -701,15 +743,15 @@ var ye = ["for"], be = { key: 0 }, xe = {
|
|
|
701
743
|
"End"
|
|
702
744
|
].includes(e.key)) return;
|
|
703
745
|
e.preventDefault();
|
|
704
|
-
let t = e.key === "Home" ? "date" : e.key === "End" ||
|
|
705
|
-
|
|
746
|
+
let t = e.key === "Home" ? "date" : e.key === "End" || O.value === "date" ? "time" : "date";
|
|
747
|
+
er(t), f(() => S.value?.querySelector(`[data-tab="${t}"]`)?.focus());
|
|
706
748
|
}
|
|
707
|
-
function
|
|
749
|
+
function nr(e) {
|
|
708
750
|
return e.values ?? Array.from({ length: e.max - e.min + 1 }, (t, n) => e.min + n);
|
|
709
751
|
}
|
|
710
|
-
function
|
|
752
|
+
function rr(e) {
|
|
711
753
|
let t = e === "smooth" && !window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
712
|
-
|
|
754
|
+
S.value?.querySelectorAll("[data-time-list]").forEach((e) => {
|
|
713
755
|
let n = e.querySelector("[aria-selected=true]");
|
|
714
756
|
n && e.scrollTo({
|
|
715
757
|
top: n.offsetTop - (e.clientHeight - n.offsetHeight) / 2,
|
|
@@ -717,22 +759,22 @@ var ye = ["for"], be = { key: 0 }, xe = {
|
|
|
717
759
|
});
|
|
718
760
|
});
|
|
719
761
|
}
|
|
720
|
-
function
|
|
721
|
-
|
|
762
|
+
function ir(e) {
|
|
763
|
+
S.value?.querySelector(`[data-time-list="${e}"] [aria-selected=true]`)?.focus({ preventScroll: !0 });
|
|
722
764
|
}
|
|
723
|
-
function
|
|
724
|
-
e.set(t),
|
|
725
|
-
|
|
765
|
+
function ar(e, t, n) {
|
|
766
|
+
e.set(t), zn(), f(() => {
|
|
767
|
+
rr("smooth"), ir(n);
|
|
726
768
|
});
|
|
727
769
|
}
|
|
728
|
-
function
|
|
770
|
+
function or(e, t, n) {
|
|
729
771
|
if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
|
|
730
772
|
e.preventDefault();
|
|
731
|
-
let t = [...
|
|
732
|
-
r &&
|
|
773
|
+
let t = [...S.value?.querySelectorAll("[data-time-list]") ?? []].map((e) => e.dataset.timeList), r = t[t.indexOf(n) + (e.key === "ArrowRight" ? 1 : -1)];
|
|
774
|
+
r && ir(r);
|
|
733
775
|
return;
|
|
734
776
|
}
|
|
735
|
-
let r =
|
|
777
|
+
let r = nr(t), i = r.indexOf(t.get()), a = {
|
|
736
778
|
ArrowUp: i - 1,
|
|
737
779
|
ArrowDown: i + 1,
|
|
738
780
|
PageUp: i - 5,
|
|
@@ -740,208 +782,211 @@ var ye = ["for"], be = { key: 0 }, xe = {
|
|
|
740
782
|
Home: 0,
|
|
741
783
|
End: r.length - 1
|
|
742
784
|
};
|
|
743
|
-
e.key in a && (e.preventDefault(),
|
|
785
|
+
e.key in a && (e.preventDefault(), ar(t, r[Math.min(r.length - 1, Math.max(0, a[e.key]))], n));
|
|
744
786
|
}
|
|
745
|
-
function
|
|
746
|
-
let t =
|
|
787
|
+
function sr(e) {
|
|
788
|
+
let t = k.value, n = (hn(t) - Ot.value + 7) % 7, r = {
|
|
747
789
|
ArrowLeft: () => q(t, -1),
|
|
748
790
|
ArrowRight: () => q(t, 1),
|
|
749
791
|
ArrowUp: () => q(t, -7),
|
|
750
792
|
ArrowDown: () => q(t, 7),
|
|
751
793
|
Home: () => q(t, -n),
|
|
752
794
|
End: () => q(t, 6 - n),
|
|
753
|
-
PageUp: () =>
|
|
754
|
-
PageDown: () =>
|
|
795
|
+
PageUp: () => pn(t, e.shiftKey ? -12 : -1),
|
|
796
|
+
PageDown: () => pn(t, e.shiftKey ? 12 : 1)
|
|
755
797
|
};
|
|
756
798
|
if (e.key === "Enter" || e.key === " ") {
|
|
757
|
-
e.preventDefault(),
|
|
799
|
+
e.preventDefault(), Vn(t);
|
|
758
800
|
return;
|
|
759
801
|
}
|
|
760
802
|
let i = r[e.key];
|
|
761
|
-
i && (e.preventDefault(),
|
|
803
|
+
i && (e.preventDefault(), k.value = i(), w.value = J(k.value), F.value && A.value && !j.value && (Et.value = k.value), Rn());
|
|
762
804
|
}
|
|
763
|
-
function
|
|
764
|
-
if (
|
|
805
|
+
function cr(e) {
|
|
806
|
+
if (y.inline) return;
|
|
765
807
|
if (e.key === "Escape") {
|
|
766
|
-
e.preventDefault(), e.stopPropagation(),
|
|
808
|
+
e.preventDefault(), e.stopPropagation(), In();
|
|
767
809
|
return;
|
|
768
810
|
}
|
|
769
|
-
if (e.key !== "Tab" || !
|
|
770
|
-
let t = [...
|
|
811
|
+
if (e.key !== "Tab" || !S.value) return;
|
|
812
|
+
let t = [...S.value.querySelectorAll("button:not([disabled]), input:not([disabled])")].filter((e) => e.tabIndex >= 0);
|
|
771
813
|
if (!t.length) return;
|
|
772
814
|
let n = t[0], r = t[t.length - 1];
|
|
773
815
|
e.shiftKey && document.activeElement === n ? (e.preventDefault(), r.focus()) : !e.shiftKey && document.activeElement === r && (e.preventDefault(), n.focus());
|
|
774
816
|
}
|
|
775
|
-
function
|
|
776
|
-
(e.key === "ArrowDown" || e.key === "ArrowUp" && e.altKey) && (e.preventDefault(),
|
|
817
|
+
function lr(e) {
|
|
818
|
+
(e.key === "ArrowDown" || e.key === "ArrowUp" && e.altKey) && (e.preventDefault(), Fn());
|
|
777
819
|
}
|
|
778
|
-
function
|
|
820
|
+
function ur(e) {
|
|
779
821
|
let t = e.target;
|
|
780
|
-
wt.value?.contains(t) ||
|
|
822
|
+
wt.value?.contains(t) || S.value?.contains(t) || In(!1);
|
|
781
823
|
}
|
|
782
|
-
function
|
|
783
|
-
e?.target instanceof Node &&
|
|
824
|
+
function dr(e) {
|
|
825
|
+
e?.target instanceof Node && S.value?.contains(e.target) || Pn();
|
|
784
826
|
}
|
|
785
|
-
function
|
|
786
|
-
document.addEventListener("pointerdown",
|
|
827
|
+
function fr() {
|
|
828
|
+
document.addEventListener("pointerdown", ur, !0), window.addEventListener("scroll", dr, !0), window.addEventListener("resize", dr);
|
|
787
829
|
}
|
|
788
|
-
function
|
|
789
|
-
document.removeEventListener("pointerdown",
|
|
830
|
+
function pr() {
|
|
831
|
+
document.removeEventListener("pointerdown", ur, !0), window.removeEventListener("scroll", dr, !0), window.removeEventListener("resize", dr);
|
|
790
832
|
}
|
|
791
|
-
return
|
|
792
|
-
|
|
793
|
-
}),
|
|
833
|
+
return de(b, (e) => e ? Ln() : pr()), de(zt, () => y.inline && Nn(!1)), ie(() => {
|
|
834
|
+
y.inline ? Nn() : b.value && Ln();
|
|
835
|
+
}), re(pr), te({ focus: () => y.inline ? Rn() : Tt.value?.focus() }), (e, a) => (m(), c("div", ne({
|
|
794
836
|
ref_key: "root",
|
|
795
837
|
ref: wt
|
|
796
838
|
}, gt.value, {
|
|
797
|
-
class: ["w-full",
|
|
839
|
+
class: ["w-full", d.disabled && "opacity-50"],
|
|
798
840
|
"data-ac-ds": "",
|
|
799
841
|
"data-testid": "ac-date-picker"
|
|
800
842
|
}), [
|
|
801
|
-
|
|
843
|
+
d.label || e.$slots["label-icon"] || e.$slots["label-extra"] ? (m(), c("label", {
|
|
802
844
|
key: 0,
|
|
803
845
|
id: vt,
|
|
804
|
-
for:
|
|
846
|
+
for: d.inline ? void 0 : `${v(x)}-trigger`,
|
|
805
847
|
class: "mb-2 flex items-center gap-1 text-base font-medium text-heading"
|
|
806
848
|
}, [
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
], 8,
|
|
812
|
-
|
|
849
|
+
oe(e.$slots, "label-icon"),
|
|
850
|
+
d.label ? (m(), c("span", xe, _(d.label), 1)) : s("", !0),
|
|
851
|
+
oe(e.$slots, "label-extra"),
|
|
852
|
+
d.required ? (m(), c("span", Se, "*")) : s("", !0)
|
|
853
|
+
], 8, be)) : s("", !0),
|
|
854
|
+
d.hint ? (m(), c("p", {
|
|
813
855
|
key: 1,
|
|
814
856
|
id: St,
|
|
815
857
|
class: "mb-2 text-base text-muted"
|
|
816
|
-
},
|
|
817
|
-
|
|
818
|
-
|
|
858
|
+
}, _(d.hint), 1)) : s("", !0),
|
|
859
|
+
d.inline ? s("", !0) : (m(), c("div", {
|
|
860
|
+
key: 2,
|
|
861
|
+
class: p(["relative", d.fieldClass])
|
|
862
|
+
}, [l("button", ne({
|
|
863
|
+
id: `${v(x)}-trigger`,
|
|
819
864
|
ref_key: "trigger",
|
|
820
865
|
ref: Tt
|
|
821
866
|
}, _t.value, {
|
|
822
867
|
type: "button",
|
|
823
|
-
disabled:
|
|
868
|
+
disabled: d.disabled,
|
|
824
869
|
"aria-haspopup": "dialog",
|
|
825
|
-
"aria-expanded":
|
|
826
|
-
"aria-labelledby":
|
|
827
|
-
"aria-describedby":
|
|
828
|
-
"aria-invalid": !!
|
|
829
|
-
"aria-required":
|
|
830
|
-
class: ["flex w-full items-center rounded-10 border bg-background text-left text-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
870
|
+
"aria-expanded": b.value,
|
|
871
|
+
"aria-labelledby": d.label || e.$slots["label-icon"] || e.$slots["label-extra"] ? `${vt} ${yt}` : yt,
|
|
872
|
+
"aria-describedby": un.value,
|
|
873
|
+
"aria-invalid": !!d.errorMsg || void 0,
|
|
874
|
+
"aria-required": d.required || void 0,
|
|
875
|
+
class: ["flex w-full items-center rounded-10 border bg-background text-left text-heading transition-[color,background-color,border-color,box-shadow] duration-200 outline-none disabled:cursor-not-allowed", [
|
|
876
|
+
d.size === "small" ? "h-9 pl-3 text-base font-normal" : d.size === "large" ? "h-[50px] pl-4 text-lg font-medium" : "h-10.5 pl-4 text-base font-normal",
|
|
877
|
+
d.clearable && Ht.value && !d.disabled ? "pr-20" : "pr-10",
|
|
878
|
+
d.disabled ? "" : "cursor-pointer hover:bg-accent-hover",
|
|
879
|
+
d.errorMsg ? ["border-danger/60", ln.value && "border-danger shadow-[0_0_0_2px_color-mix(in_srgb,var(--color-danger)_20%,transparent)]"] : ln.value ? "focus-ring" : ["border-border", !d.disabled && "hover:border-accent-active"]
|
|
835
880
|
]],
|
|
836
|
-
onClick: a[0] ||= (e) =>
|
|
837
|
-
onKeydown:
|
|
838
|
-
onFocus: a[1] ||= (e) =>
|
|
839
|
-
onBlur: a[2] ||= (e) =>
|
|
881
|
+
onClick: a[0] ||= (e) => b.value ? In() : Fn(),
|
|
882
|
+
onKeydown: lr,
|
|
883
|
+
onFocus: a[1] ||= (e) => cn.value = !0,
|
|
884
|
+
onBlur: a[2] ||= (e) => cn.value = !1
|
|
840
885
|
}), [l("span", {
|
|
841
886
|
id: yt,
|
|
842
|
-
class:
|
|
843
|
-
},
|
|
887
|
+
class: p(["truncate tabular-nums", !Ut.value && "text-muted/80"])
|
|
888
|
+
}, _(Ut.value || d.placeholder || (d.mode === "duration" ? "Choose duration" : "Choose date")), 3)], 16, Ce), l("span", { class: p(["pointer-events-none absolute inset-y-0 flex items-center gap-4 text-muted", d.size === "small" ? "right-3" : "right-4"]) }, [d.clearable && Ht.value && !d.disabled ? (m(), c("button", {
|
|
844
889
|
key: 0,
|
|
845
890
|
type: "button",
|
|
846
891
|
class: "pointer-events-auto inline-flex cursor-pointer items-center justify-center rounded-full p-1 transition-colors duration-200 hover:bg-accent-hover hover:text-primary active:bg-accent-active focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",
|
|
847
|
-
"aria-label":
|
|
848
|
-
onClick:
|
|
849
|
-
}, [
|
|
892
|
+
"aria-label": d.label ? `Clear ${d.label}` : "Clear",
|
|
893
|
+
onClick: Kn
|
|
894
|
+
}, [ee(v(ye), {
|
|
850
895
|
class: "size-4",
|
|
851
896
|
"aria-hidden": "true"
|
|
852
|
-
})], 8, we)) : s("", !0), (
|
|
853
|
-
class:
|
|
897
|
+
})], 8, we)) : s("", !0), (m(), o(se(fn.value), {
|
|
898
|
+
class: p(["size-4", b.value && "text-heading"]),
|
|
854
899
|
"aria-hidden": "true"
|
|
855
|
-
}, null, 8, ["class"]))], 2)])),
|
|
856
|
-
(
|
|
900
|
+
}, null, 8, ["class"]))], 2)], 2)),
|
|
901
|
+
(m(), o(r, {
|
|
857
902
|
to: "body",
|
|
858
|
-
disabled:
|
|
859
|
-
}, [
|
|
903
|
+
disabled: d.inline
|
|
904
|
+
}, [ee(i, {
|
|
860
905
|
"enter-active-class": "transition duration-150 ease-out motion-reduce:transition-opacity",
|
|
861
906
|
"enter-from-class": "opacity-0 scale-95",
|
|
862
907
|
"leave-active-class": "transition duration-100 ease-in",
|
|
863
908
|
"leave-to-class": "opacity-0"
|
|
864
909
|
}, {
|
|
865
|
-
default:
|
|
910
|
+
default: fe(() => [b.value || d.inline ? (m(), c("div", ne({
|
|
866
911
|
key: 0,
|
|
867
912
|
ref_key: "panel",
|
|
868
|
-
ref:
|
|
869
|
-
role:
|
|
870
|
-
"aria-modal":
|
|
871
|
-
"aria-label":
|
|
872
|
-
"aria-describedby":
|
|
873
|
-
inert:
|
|
874
|
-
},
|
|
875
|
-
class: ["flex flex-col sm:flex-row", !
|
|
876
|
-
style:
|
|
877
|
-
top:
|
|
878
|
-
bottom:
|
|
879
|
-
left: `${
|
|
880
|
-
maxHeight: `${
|
|
881
|
-
minWidth: `${
|
|
913
|
+
ref: S,
|
|
914
|
+
role: d.inline ? "group" : "dialog",
|
|
915
|
+
"aria-modal": d.inline ? void 0 : "true",
|
|
916
|
+
"aria-label": dn.value,
|
|
917
|
+
"aria-describedby": d.inline ? un.value : void 0,
|
|
918
|
+
inert: d.inline && d.disabled
|
|
919
|
+
}, d.inline ? _t.value : void 0, {
|
|
920
|
+
class: ["flex flex-col sm:flex-row", !d.inline && "ac-scrollbar fixed z-[90] max-w-[calc(100vw-16px)] rounded-10 border border-border bg-surface shadow-sm"],
|
|
921
|
+
style: d.inline ? void 0 : {
|
|
922
|
+
top: C.value.top === void 0 ? void 0 : `${C.value.top}px`,
|
|
923
|
+
bottom: C.value.bottom === void 0 ? void 0 : `${C.value.bottom}px`,
|
|
924
|
+
left: `${C.value.left}px`,
|
|
925
|
+
maxHeight: `${C.value.maxHeight}px`,
|
|
926
|
+
minWidth: `${C.value.minWidth}px`
|
|
882
927
|
},
|
|
883
928
|
"data-ac-ds": "",
|
|
884
929
|
"data-testid": "ac-date-picker-panel",
|
|
885
|
-
onKeydown:
|
|
886
|
-
}), [
|
|
930
|
+
onKeydown: cr
|
|
931
|
+
}), [d.presets.length ? (m(), c("div", Ee, [(m(!0), c(n, null, g(d.presets, (e) => (m(), c("button", {
|
|
887
932
|
key: e.label,
|
|
888
933
|
type: "button",
|
|
889
934
|
class: "cursor-pointer rounded-8 px-3 py-2 text-left text-base text-heading transition-colors duration-200 hover:bg-accent-hover active:bg-accent-active focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none focus-visible:ring-inset max-sm:rounded-full max-sm:border max-sm:border-border max-sm:px-2.5 max-sm:py-1 max-sm:text-xs",
|
|
890
|
-
onClick: (t) =>
|
|
891
|
-
},
|
|
892
|
-
l("p", ke,
|
|
893
|
-
l("p", Ae,
|
|
894
|
-
l("div", je, [(
|
|
935
|
+
onClick: (t) => Gn(e)
|
|
936
|
+
}, _(e.label), 9, De))), 128))])) : s("", !0), l("div", { class: p(["max-w-full min-w-0 flex-auto max-sm:w-auto", d.inline ? "w-full" : d.mode === "duration" ? "w-72" : "w-[calc(328px*var(--ac-scale))]"]) }, [d.mode === "duration" ? (m(), c("div", Oe, [
|
|
937
|
+
l("p", ke, _(d.label || "Duration"), 1),
|
|
938
|
+
l("p", Ae, _(Sn(an.value)), 1),
|
|
939
|
+
l("div", je, [(m(!0), c(n, null, g(sn.value, (e) => (m(), c("label", {
|
|
895
940
|
key: e.key,
|
|
896
941
|
class: "block"
|
|
897
|
-
}, [l("span", Me,
|
|
942
|
+
}, [l("span", Me, _(e.label), 1), l("input", {
|
|
898
943
|
type: "text",
|
|
899
944
|
inputmode: "numeric",
|
|
900
945
|
role: "spinbutton",
|
|
901
946
|
autocomplete: "off",
|
|
902
|
-
value:
|
|
947
|
+
value: kn(e),
|
|
903
948
|
"aria-valuenow": e.get(),
|
|
904
949
|
"aria-valuemin": e.min,
|
|
905
950
|
"aria-valuemax": e.max,
|
|
906
951
|
class: "h-10 w-full rounded-10 border border-border bg-background px-2.5 text-center text-base text-heading tabular-nums transition-[border-color,box-shadow] duration-200 outline-none hover:border-accent-active focus:focus-ring",
|
|
907
|
-
onKeydown: (t) =>
|
|
908
|
-
onInput: (t) =>
|
|
909
|
-
onBlur: (t) =>
|
|
952
|
+
onKeydown: (t) => An(t, e),
|
|
953
|
+
onInput: (t) => jn(t, e),
|
|
954
|
+
onBlur: (t) => Mn(t, e),
|
|
910
955
|
onFocus: a[3] ||= (e) => e.target.select()
|
|
911
956
|
}, null, 40, Ne)]))), 128))]),
|
|
912
957
|
a[9] ||= l("p", { class: "mt-2 text-xs text-muted" }, "↑ ↓ to adjust, or type a number.", -1)
|
|
913
|
-
])) : (
|
|
958
|
+
])) : (m(), c(n, { key: 1 }, [I.value ? (m(), c("div", {
|
|
914
959
|
key: 0,
|
|
915
960
|
role: "tablist",
|
|
916
961
|
"aria-label": "Date or time",
|
|
917
962
|
class: "flex border-b border-border",
|
|
918
|
-
onKeydown:
|
|
919
|
-
}, [(
|
|
920
|
-
id: `${
|
|
963
|
+
onKeydown: tr
|
|
964
|
+
}, [(m(), c(n, null, g(mt, (e) => l("button", {
|
|
965
|
+
id: `${v(x)}-tab-${e.key}`,
|
|
921
966
|
key: e.key,
|
|
922
967
|
type: "button",
|
|
923
968
|
role: "tab",
|
|
924
969
|
"data-tab": e.key,
|
|
925
|
-
"aria-selected":
|
|
926
|
-
"aria-controls": `${
|
|
927
|
-
tabindex:
|
|
928
|
-
class:
|
|
929
|
-
onClick: (t) =>
|
|
930
|
-
}, [(
|
|
970
|
+
"aria-selected": O.value === e.key,
|
|
971
|
+
"aria-controls": `${v(x)}-tabpanel`,
|
|
972
|
+
tabindex: O.value === e.key ? 0 : -1,
|
|
973
|
+
class: p(["flex flex-1 cursor-pointer items-center justify-center gap-2 px-4 py-2 text-base font-medium transition-colors duration-200 focus-visible:ring-2 focus-visible:outline-none focus-visible:ring-inset", O.value === e.key ? "bg-primary text-white focus-visible:ring-white/70" : "text-heading hover:bg-accent-hover focus-visible:ring-ring active:bg-accent-active"]),
|
|
974
|
+
onClick: (t) => er(e.key)
|
|
975
|
+
}, [(m(), o(se(e.icon), {
|
|
931
976
|
class: "size-4",
|
|
932
977
|
"aria-hidden": "true"
|
|
933
|
-
})), u(" " +
|
|
934
|
-
id: `${
|
|
978
|
+
})), u(" " + _(e.label), 1)], 10, Pe)), 64))], 32)) : s("", !0), l("div", {
|
|
979
|
+
id: `${v(x)}-tabpanel`,
|
|
935
980
|
class: "p-3",
|
|
936
|
-
role:
|
|
937
|
-
"aria-labelledby":
|
|
938
|
-
}, [
|
|
981
|
+
role: I.value ? "tabpanel" : void 0,
|
|
982
|
+
"aria-labelledby": I.value ? `${v(x)}-tab-${O.value}` : void 0
|
|
983
|
+
}, [O.value === "date" ? (m(), c(n, { key: 0 }, [l("div", Ie, [
|
|
939
984
|
l("button", {
|
|
940
985
|
type: "button",
|
|
941
986
|
class: "inline-flex cursor-pointer items-center justify-center rounded-8 p-2 text-muted transition-colors duration-200 hover:bg-accent-hover hover:text-heading active:bg-accent-active focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",
|
|
942
|
-
"aria-label":
|
|
943
|
-
onClick: a[4] ||= (e) =>
|
|
944
|
-
}, [
|
|
987
|
+
"aria-label": Qt.value[0],
|
|
988
|
+
onClick: a[4] ||= (e) => Jn(-1)
|
|
989
|
+
}, [ee(v(he), {
|
|
945
990
|
class: "size-4",
|
|
946
991
|
"aria-hidden": "true"
|
|
947
992
|
})], 8, Le),
|
|
@@ -949,127 +994,127 @@ var ye = ["for"], be = { key: 0 }, xe = {
|
|
|
949
994
|
id: bt,
|
|
950
995
|
class: "sr-only",
|
|
951
996
|
"aria-live": "polite"
|
|
952
|
-
},
|
|
953
|
-
|
|
997
|
+
}, _(V.value), 1),
|
|
998
|
+
T.value === "years" ? (m(), c("span", ze, _(V.value), 1)) : (m(), c("button", {
|
|
954
999
|
key: 0,
|
|
955
1000
|
type: "button",
|
|
956
1001
|
class: "cursor-pointer rounded-10 bg-accent px-4 py-2 text-base font-semibold text-heading tabular-nums transition-colors duration-200 hover:bg-accent-hover active:bg-accent-active focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",
|
|
957
|
-
"aria-label":
|
|
958
|
-
onClick: a[5] ||= (e) =>
|
|
959
|
-
},
|
|
1002
|
+
"aria-label": T.value === "days" ? `${V.value}, choose month` : `${V.value}, choose year`,
|
|
1003
|
+
onClick: a[5] ||= (e) => T.value === "days" ? Yn() : Xn()
|
|
1004
|
+
}, _(V.value), 9, Re)),
|
|
960
1005
|
l("button", {
|
|
961
1006
|
type: "button",
|
|
962
1007
|
class: "inline-flex cursor-pointer items-center justify-center rounded-8 p-2 text-muted transition-colors duration-200 hover:bg-accent-hover hover:text-heading active:bg-accent-active focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",
|
|
963
|
-
"aria-label":
|
|
964
|
-
onClick: a[6] ||= (e) =>
|
|
965
|
-
}, [
|
|
1008
|
+
"aria-label": Qt.value[1],
|
|
1009
|
+
onClick: a[6] ||= (e) => Jn(1)
|
|
1010
|
+
}, [ee(v(ge), {
|
|
966
1011
|
class: "size-4",
|
|
967
1012
|
"aria-hidden": "true"
|
|
968
1013
|
})], 8, Be)
|
|
969
|
-
]),
|
|
1014
|
+
]), T.value === "days" ? (m(), c("table", {
|
|
970
1015
|
key: 0,
|
|
971
1016
|
role: "grid",
|
|
972
1017
|
"aria-labelledby": bt,
|
|
973
1018
|
class: "w-full table-fixed border-collapse",
|
|
974
|
-
onKeydown:
|
|
975
|
-
}, [l("thead", null, [l("tr", null, [(
|
|
1019
|
+
onKeydown: sr
|
|
1020
|
+
}, [l("thead", null, [l("tr", null, [(m(!0), c(n, null, g(Pt.value, (e) => (m(), c("th", {
|
|
976
1021
|
key: e.long,
|
|
977
1022
|
scope: "col",
|
|
978
1023
|
abbr: e.long,
|
|
979
1024
|
class: "pt-2 pb-2 text-center text-xs font-medium text-heading"
|
|
980
|
-
},
|
|
1025
|
+
}, _(e.short.slice(0, 2)), 9, Ve))), 128))])]), l("tbody", { onMouseleave: a[7] ||= (e) => Et.value = null }, [(m(!0), c(n, null, g(Gt.value, (e, t) => (m(), c("tr", { key: t }, [(m(!0), c(n, null, g(e, (e) => (m(), c("td", {
|
|
981
1026
|
key: e,
|
|
982
1027
|
role: "gridcell",
|
|
983
|
-
"aria-selected":
|
|
1028
|
+
"aria-selected": Tn(e) || En(e),
|
|
984
1029
|
class: "p-0 py-0.5"
|
|
985
|
-
}, [l("div", { class:
|
|
1030
|
+
}, [l("div", { class: p(["px-0.5", En(e) && J(e) === w.value && ["bg-primary/10", ...Dn(e)]]) }, [l("button", {
|
|
986
1031
|
type: "button",
|
|
987
1032
|
"data-day": e,
|
|
988
|
-
tabindex: e ===
|
|
1033
|
+
tabindex: e === k.value ? 0 : -1,
|
|
989
1034
|
"aria-label": Mt.value.format(K(e)),
|
|
990
|
-
"aria-disabled":
|
|
1035
|
+
"aria-disabled": Cn(e) || void 0,
|
|
991
1036
|
"aria-current": e === It.value ? "date" : void 0,
|
|
992
|
-
class:
|
|
993
|
-
onClick: (t) =>
|
|
994
|
-
onMouseenter: (t) =>
|
|
995
|
-
},
|
|
1037
|
+
class: p(["relative flex aspect-square w-full items-center justify-center rounded-8 text-base tabular-nums transition-all duration-200 outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface motion-reduce:transition-none", [J(e) !== w.value && "invisible", Cn(e) ? "cursor-not-allowed text-muted/50 line-through" : Tn(e) ? "cursor-pointer bg-primary font-semibold text-white" : e === It.value ? "cursor-pointer bg-accent font-medium text-heading hover:bg-accent-hover active:bg-accent-active" : "cursor-pointer text-heading hover:bg-accent-hover hover:font-semibold active:bg-accent-active"]]),
|
|
1038
|
+
onClick: (t) => Vn(e),
|
|
1039
|
+
onMouseenter: (t) => F.value && A.value && !j.value && (Et.value = e)
|
|
1040
|
+
}, _(Nt.value.format(K(e))), 43, Ue)], 2)], 8, He))), 128))]))), 128))], 32)], 32)) : (m(), c("div", {
|
|
996
1041
|
key: 1,
|
|
997
1042
|
role: "grid",
|
|
998
|
-
"aria-label":
|
|
1043
|
+
"aria-label": T.value === "months" ? `Months of ${V.value}` : `Years ${V.value}`,
|
|
999
1044
|
class: "grid gap-2",
|
|
1000
|
-
onKeydown:
|
|
1001
|
-
}, [(
|
|
1045
|
+
onKeydown: $n
|
|
1046
|
+
}, [(m(!0), c(n, null, g(Xt.value, (e, t) => (m(), c("div", {
|
|
1002
1047
|
key: t,
|
|
1003
1048
|
role: "row",
|
|
1004
1049
|
class: "grid grid-cols-4 gap-2"
|
|
1005
|
-
}, [(
|
|
1050
|
+
}, [(m(!0), c(n, null, g(e, (e) => (m(), c("button", {
|
|
1006
1051
|
key: e.value,
|
|
1007
1052
|
type: "button",
|
|
1008
1053
|
role: "gridcell",
|
|
1009
1054
|
"data-pick": e.value,
|
|
1010
|
-
tabindex: e.value ===
|
|
1055
|
+
tabindex: e.value === Zt.value ? 0 : -1,
|
|
1011
1056
|
"aria-label": e.label,
|
|
1012
1057
|
"aria-selected": e.selected,
|
|
1013
1058
|
"aria-disabled": e.disabled || void 0,
|
|
1014
|
-
class:
|
|
1015
|
-
onClick: (t) =>
|
|
1016
|
-
onFocus: (t) =>
|
|
1017
|
-
},
|
|
1059
|
+
class: p(["rounded-8 px-4 py-3 text-base tabular-nums transition-all duration-200 outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface motion-reduce:transition-none", e.disabled ? "cursor-not-allowed text-muted/50 line-through" : e.selected ? "cursor-pointer bg-primary font-semibold text-white" : "cursor-pointer text-heading hover:bg-accent-hover hover:font-semibold active:bg-accent-active"]),
|
|
1060
|
+
onClick: (t) => Qn(e),
|
|
1061
|
+
onFocus: (t) => D.value = e.value
|
|
1062
|
+
}, _(e.text), 43, Ge))), 128))]))), 128))], 40, We))], 64)) : (m(), c(n, { key: 1 }, [l("div", Ke, [(m(!0), c(n, null, g(on.value, (e, t) => (m(), c(n, { key: e.key }, [t > 0 ? (m(), c("span", qe)) : s("", !0), l("div", {
|
|
1018
1063
|
class: "flex min-w-0 flex-1 flex-col",
|
|
1019
1064
|
role: "group",
|
|
1020
1065
|
"aria-label": `${e.label} time`
|
|
1021
|
-
}, [
|
|
1066
|
+
}, [F.value ? (m(), c("p", Ye, _(e.label), 1)) : s("", !0), l("div", Xe, [(m(!0), c(n, null, g(e.spinners, (t, r) => (m(), c(n, { key: t.key }, [t.key === "p" ? (m(), c("span", Ze)) : r > 0 ? (m(), c("span", Qe, ":")) : s("", !0), l("div", { class: p(["flex h-full flex-1 flex-col items-center", t.key === "p" ? "min-w-12" : "min-w-10"]) }, [l("span", $e, _(pt[t.key]), 1), l("div", {
|
|
1022
1067
|
role: "listbox",
|
|
1023
1068
|
"aria-label": t.label,
|
|
1024
1069
|
"data-time-list": `${e.key}-${t.key}`,
|
|
1025
1070
|
class: "relative min-h-0 w-full flex-1 scroll-smooth overflow-x-hidden overflow-y-auto [scrollbar-width:none] motion-reduce:scroll-auto [&::-webkit-scrollbar]:hidden",
|
|
1026
|
-
onKeydown: (n) =>
|
|
1027
|
-
}, [l("div", tt, [(
|
|
1071
|
+
onKeydown: (n) => or(n, t, `${e.key}-${t.key}`)
|
|
1072
|
+
}, [l("div", tt, [(m(!0), c(n, null, g(nr(t), (n) => (m(), c("button", {
|
|
1028
1073
|
key: n,
|
|
1029
1074
|
type: "button",
|
|
1030
1075
|
role: "option",
|
|
1031
1076
|
tabindex: n === t.get() ? 0 : -1,
|
|
1032
1077
|
"aria-selected": n === t.get(),
|
|
1033
|
-
class:
|
|
1034
|
-
onClick: (r) =>
|
|
1035
|
-
},
|
|
1036
|
-
|
|
1078
|
+
class: p(["inline-flex h-10 shrink-0 cursor-pointer items-center justify-center rounded-8 tabular-nums transition-all duration-200 outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset motion-reduce:transition-none", [t.key === "p" ? "w-12 text-xs font-bold" : "w-10 text-base", n === t.get() ? ["bg-primary text-white", t.key !== "p" && "scale-110 font-bold"] : "text-heading hover:bg-accent-hover hover:font-bold active:bg-accent-active"]]),
|
|
1079
|
+
onClick: (r) => ar(t, n, `${e.key}-${t.key}`)
|
|
1080
|
+
}, _(t.text ? t.text(n) : U(n)), 11, nt))), 128))])], 40, et)], 2)], 64))), 128))])], 8, Je)], 64))), 128))]), d.showTimeZone ? (m(), c("p", rt, [u("Times in " + _(Ft.value), 1), Ft.value === P.value ? s("", !0) : (m(), c(n, { key: 0 }, [u(" (" + _(P.value) + ")", 1)], 64))])) : s("", !0)], 64))], 8, Fe)], 64)), nn.value ? (m(), c("div", it, [
|
|
1081
|
+
d.mode !== "duration" && !F.value ? (m(), c("button", {
|
|
1037
1082
|
key: 0,
|
|
1038
1083
|
type: "button",
|
|
1039
1084
|
class: "cursor-pointer rounded-8 bg-accent px-3 py-1.5 text-xs font-medium text-heading transition-colors duration-200 hover:bg-accent-hover active:bg-accent-active focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
1040
|
-
disabled:
|
|
1041
|
-
onClick: a[8] ||= (e) =>
|
|
1042
|
-
},
|
|
1043
|
-
|
|
1085
|
+
disabled: Cn(It.value),
|
|
1086
|
+
onClick: a[8] ||= (e) => I.value ? Un() : Wn()
|
|
1087
|
+
}, _(I.value ? "Now" : "Today"), 9, at)) : s("", !0),
|
|
1088
|
+
tn.value ? (m(), c("p", ot, _(tn.value), 1)) : s("", !0),
|
|
1044
1089
|
a[10] ||= l("span", { class: "flex-1" }, null, -1),
|
|
1045
|
-
|
|
1090
|
+
I.value && !d.autoApply || d.mode === "duration" ? (m(), c(n, { key: 2 }, [ee(t, {
|
|
1046
1091
|
title: "Cancel",
|
|
1047
1092
|
color: "white",
|
|
1048
1093
|
size: "small",
|
|
1049
|
-
onClick:
|
|
1050
|
-
}),
|
|
1094
|
+
onClick: Bn
|
|
1095
|
+
}), ee(t, {
|
|
1051
1096
|
title: "Apply",
|
|
1052
1097
|
size: "small",
|
|
1053
|
-
disabled: !
|
|
1054
|
-
onClick:
|
|
1098
|
+
disabled: !rn.value,
|
|
1099
|
+
onClick: Hn
|
|
1055
1100
|
}, null, 8, ["disabled"])], 64)) : s("", !0)
|
|
1056
1101
|
])) : s("", !0)], 2)], 16, Te)) : s("", !0)]),
|
|
1057
1102
|
_: 1
|
|
1058
1103
|
})], 8, ["disabled"])),
|
|
1059
|
-
|
|
1104
|
+
d.errorMsg ? (m(), c("p", {
|
|
1060
1105
|
key: 3,
|
|
1061
1106
|
id: xt,
|
|
1062
1107
|
class: "mt-1 text-base text-danger-strong",
|
|
1063
1108
|
role: "alert"
|
|
1064
|
-
},
|
|
1065
|
-
|
|
1109
|
+
}, _(d.errorMsg), 1)) : s("", !0),
|
|
1110
|
+
d.name ? (m(), c("input", {
|
|
1066
1111
|
key: 4,
|
|
1067
1112
|
type: "hidden",
|
|
1068
|
-
name:
|
|
1069
|
-
value:
|
|
1113
|
+
name: d.name,
|
|
1114
|
+
value: Wt.value
|
|
1070
1115
|
}, null, 8, st)) : s("", !0)
|
|
1071
1116
|
], 16));
|
|
1072
1117
|
}
|
|
1073
1118
|
});
|
|
1074
1119
|
//#endregion
|
|
1075
|
-
export {
|
|
1120
|
+
export { y as default };
|