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