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