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