@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.
Files changed (54) hide show
  1. package/dist/lib/charts/ChartFrame.vue_vue_type_script_setup_true_lang.js +89 -88
  2. package/dist/lib/compat.css +210 -0
  3. package/dist/lib/components/AcAppSwitcher.vue_vue_type_script_setup_true_lang.js +74 -73
  4. package/dist/lib/components/AcButton.vue.d.ts +18 -12
  5. package/dist/lib/components/AcButton.vue_vue_type_script_setup_true_lang.js +62 -32
  6. package/dist/lib/components/AcCard.vue.d.ts +11 -5
  7. package/dist/lib/components/AcCard.vue_vue_type_script_setup_true_lang.js +99 -51
  8. package/dist/lib/components/AcClusterSwitcher.vue_vue_type_script_setup_true_lang.js +151 -150
  9. package/dist/lib/components/AcColorInput.vue.d.ts +1 -1
  10. package/dist/lib/components/AcDatePicker.vue.d.ts +27 -3
  11. package/dist/lib/components/AcDatePicker.vue_vue_type_script_setup_true_lang.js +518 -454
  12. package/dist/lib/components/AcDropdown.vue_vue_type_script_setup_true_lang.js +56 -55
  13. package/dist/lib/components/AcErrorState.vue.d.ts +1 -1
  14. package/dist/lib/components/AcFormFooter.vue_vue_type_script_setup_true_lang.js +39 -38
  15. package/dist/lib/components/AcHeader.vue.d.ts +1 -1
  16. package/dist/lib/components/AcInput.vue.d.ts +28 -7
  17. package/dist/lib/components/AcInput.vue_vue_type_script_setup_true_lang.js +149 -80
  18. package/dist/lib/components/AcKeyValueInput.vue.d.ts +1 -1
  19. package/dist/lib/components/AcLocaleSwitcher.vue.d.ts +6 -0
  20. package/dist/lib/components/AcLocaleSwitcher.vue_vue_type_script_setup_true_lang.js +74 -58
  21. package/dist/lib/components/AcModal.vue_vue_type_script_setup_true_lang.js +3 -1
  22. package/dist/lib/components/AcNavbar.vue.d.ts +2 -0
  23. package/dist/lib/components/AcNavbar.vue_vue_type_script_setup_true_lang.js +31 -25
  24. package/dist/lib/components/AcNotificationMenu.vue_vue_type_script_setup_true_lang.js +90 -89
  25. package/dist/lib/components/AcNumberInput.vue.d.ts +1 -1
  26. package/dist/lib/components/AcRadioCard.js +5 -0
  27. package/dist/lib/components/AcRadioCard.vue.d.ts +55 -0
  28. package/dist/lib/components/AcRadioCard.vue_vue_type_script_setup_true_lang.js +135 -0
  29. package/dist/lib/components/AcSelect.vue.d.ts +12 -1
  30. package/dist/lib/components/AcSelect.vue_vue_type_script_setup_true_lang.js +237 -220
  31. package/dist/lib/components/AcSidePanel.vue_vue_type_script_setup_true_lang.js +3 -1
  32. package/dist/lib/components/AcSideTabs.vue.d.ts +1 -1
  33. package/dist/lib/components/AcSidebar.vue.d.ts +9 -0
  34. package/dist/lib/components/AcSidebar.vue_vue_type_script_setup_true_lang.js +113 -94
  35. package/dist/lib/components/AcSidebarSection.vue_vue_type_script_setup_true_lang.js +19 -18
  36. package/dist/lib/components/AcSlider.vue.d.ts +1 -1
  37. package/dist/lib/components/AcTable.vue.d.ts +13 -1
  38. package/dist/lib/components/AcTable.vue_vue_type_script_setup_true_lang.js +106 -86
  39. package/dist/lib/components/AcTagInput.vue.d.ts +1 -1
  40. package/dist/lib/components/AcTextarea.vue.d.ts +30 -4
  41. package/dist/lib/components/AcTextarea.vue_vue_type_script_setup_true_lang.js +92 -61
  42. package/dist/lib/components/AcThemeMode.vue.d.ts +10 -2
  43. package/dist/lib/components/AcThemeMode.vue_vue_type_script_setup_true_lang.js +53 -42
  44. package/dist/lib/components/AcTimePicker.vue.d.ts +21 -3
  45. package/dist/lib/components/AcTimePicker.vue_vue_type_script_setup_true_lang.js +234 -201
  46. package/dist/lib/components/AcTooltip.vue_vue_type_script_setup_true_lang.js +73 -72
  47. package/dist/lib/components/AcUserMenu.vue.d.ts +8 -0
  48. package/dist/lib/components/AcUserMenu.vue_vue_type_script_setup_true_lang.js +125 -107
  49. package/dist/lib/components/fixedFrame.d.ts +11 -0
  50. package/dist/lib/components/fixedFrame.js +24 -0
  51. package/dist/lib/components/index.d.ts +1 -0
  52. package/dist/lib/components/types.d.ts +2 -0
  53. package/dist/lib/index.js +34 -33
  54. package/package.json +1 -1
@@ -1,12 +1,16 @@
1
1
  import e from "./AcButton.js";
2
- import { Fragment as t, Teleport as n, Transition as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as ee, createVNode as l, defineComponent as u, mergeModels as d, mergeProps as te, nextTick as f, normalizeClass as p, normalizeStyle as ne, onBeforeUnmount as re, onMounted as ie, openBlock as m, reactive as ae, ref as h, renderList as g, resolveDynamicComponent as oe, toDisplayString as _, unref as v, useAttrs as se, useId as ce, useModel as le, watch as ue, withCtx as de } from "vue";
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: 0,
6
+ var ye = ["for"], be = { key: 0 }, xe = {
7
+ key: 1,
7
8
  class: "text-danger",
8
9
  "aria-hidden": "true"
9
- }, xe = { class: "relative" }, Se = [
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
- ], Ce = ["aria-label"], we = ["name", "value"], Te = ["aria-label"], Ee = {
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
- }, Qe = { class: "flex h-full min-w-10 flex-1 flex-col items-center" }, $e = {
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 = { class: "mt-3 text-center text-xs text-muted" }, it = {
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
- }, y = /*@__PURE__*/ u({
113
+ }, st = ["name", "value"], b = /*@__PURE__*/ f({
97
114
  inheritAttrs: !1,
98
115
  __name: "AcDatePicker",
99
- props: /*@__PURE__*/ d({
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(u, { expose: d }) {
148
- let y = u, st = le(u, "modelValue"), b = le(u, "open"), ct = /^\d{4}-\d{2}-\d{2}$/, lt = /^(\d{4}-\d{2}-\d{2})T(\d{2}):(\d{2})(?::(\d{2}))?$/, ut = {
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
- }, dt = Date.UTC(2023, 0, 1), ft = {
188
+ }, ft = Date.UTC(2023, 0, 1), pt = {
159
189
  h: "Hrs",
160
190
  m: "Min",
161
- s: "Sec"
162
- }, pt = [{
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
- }], x = ce(), mt = se(), ht = i(() => ({
171
- class: mt.class,
172
- style: mt.style
173
- })), gt = i(() => {
174
- let { class: e, style: t, ...n } = mt;
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
- }), _t = `${x}-label`, vt = `${x}-value`, yt = `${x}-month`, bt = `${x}-msg`, xt = `${x}-hint`, St = /* @__PURE__ */ new Map(), Ct = h(null), wt = h(null), S = h(null), C = h({
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
- }), w = h("2026-01-01"), T = h("days"), E = h(2020), D = h(0), O = h("date"), k = h("2026-01-01"), A = h(null), j = h(null), M = h(null), N = ae({
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
- }), P = ae({
215
+ }), Dt = ie({
185
216
  h: 23,
186
217
  m: 59,
187
218
  s: 59
188
- }), F = ae({
219
+ }), P = ie({
189
220
  d: 0,
190
221
  h: 0,
191
222
  m: 0
192
- }), I = i(() => y.timeZone || Intl.DateTimeFormat().resolvedOptions().timeZone), L = i(() => y.range && y.mode !== "duration"), R = i(() => y.mode === "datetime"), Tt = i(() => y.weekStartsOn ?? un()), Et = i(() => new Intl.DateTimeFormat(y.locale, {
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
- })), Dt = i(() => new Intl.DateTimeFormat(y.locale, {
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: y.showSeconds ? "2-digit" : void 0,
204
- hourCycle: "h23",
205
- timeZone: I.value,
206
- timeZoneName: "short"
207
- })), Ot = i(() => new Intl.DateTimeFormat(y.locale, {
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
- })), kt = i(() => new Intl.DateTimeFormat(y.locale, {
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
- })), At = i(() => new Intl.DateTimeFormat(y.locale, {
248
+ })), Nt = a(() => new Intl.DateTimeFormat(b.locale, {
218
249
  day: "numeric",
219
250
  timeZone: "UTC"
220
- })), jt = i(() => {
221
- let e = new Intl.DateTimeFormat(y.locale, {
251
+ })), Pt = a(() => {
252
+ let e = new Intl.DateTimeFormat(b.locale, {
222
253
  weekday: "short",
223
254
  timeZone: "UTC"
224
- }), t = new Intl.DateTimeFormat(y.locale, {
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(dt + (Tt.value + r) % 7 * 864e5);
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
- }), Mt = i(() => new Intl.DateTimeFormat(y.locale, {
236
- timeZone: I.value,
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 ?? I.value), Nt = i(() => X(Date.now()).day), z = i(() => y.minDate ? Q(y.minDate) : null), B = i(() => y.maxDate ? Q(y.maxDate) : null), Pt = i(() => y.minDate ? Z(y.minDate) : null), Ft = i(() => y.maxDate ? ct.test(y.maxDate) ? fn(J(y.maxDate, 1), 0, 0, 0) - 1e3 : Z(y.maxDate) : null), V = i(() => {
239
- let e = st.value;
240
- return L.value ? Array.isArray(e) ? [e[0] || null, e[1] || null] : [null, null] : [typeof e == "string" && e ? e : null];
241
- }), It = i(() => V.value.some(Boolean)), Lt = i(() => {
242
- let [e, t] = V.value;
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 (y.mode === "duration") {
245
- let t = mn(e);
246
- return t === null ? e : gn(t);
275
+ if (b.mode === "duration") {
276
+ let t = vn(e);
277
+ return t === null ? e : bn(t);
247
278
  }
248
- if (y.mode === "date") {
249
- let n = Q(e), r = t ? Q(t) : null;
250
- return n ? L.value ? r ? Et.value.formatRange(q(n), q(r)) : `${Et.value.format(q(n))} –` : Et.value.format(q(n)) : e;
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 = Z(e), r = t ? Z(t) : null;
253
- return n === null ? e : L.value ? r === null ? `${Dt.value.format(n)} –` : Dt.value.formatRange(n, r) : Dt.value.format(n);
254
- }), Rt = i(() => V.value.filter(Boolean).join("/")), zt = i(() => {
255
- let e = (ln(w.value) - Tt.value + 7) % 7, t = J(w.value, -e), n = Math.ceil((e + cn(w.value)) / 7);
256
- return Array.from({ length: n }, (e, n) => Array.from({ length: 7 }, (e, r) => J(t, n * 7 + r)));
257
- }), H = i(() => K(w.value).y), Bt = i(() => K(w.value).m - 1), Vt = i(() => {
258
- let e = new Intl.DateTimeFormat(y.locale, {
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(y.locale, {
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 = G(H.value, r + 1, 1);
298
+ let i = W(V.value, r + 1, 1);
268
299
  return {
269
300
  value: r,
270
- text: e.format(q(i)),
271
- label: t.format(q(i)),
272
- disabled: vn(i, G(H.value, r + 2, 0)),
273
- selected: r === Bt.value
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
- }), Ht = i(() => Array.from({ length: 12 }, (e, t) => {
277
- let n = E.value + t;
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: vn(G(n, 1, 1), G(n, 12, 31)),
283
- selected: n === H.value
313
+ disabled: Sn(W(n, 1, 1), W(n, 12, 31)),
314
+ selected: n === V.value
284
315
  };
285
- })), Ut = i(() => T.value === "months" ? Vt.value : Ht.value), Wt = i(() => [
316
+ })), Kt = a(() => E.value === "months" ? Wt.value : Gt.value), qt = a(() => [
286
317
  0,
287
318
  4,
288
319
  8
289
- ].map((e) => Ut.value.slice(e, e + 4))), Gt = i(() => Ut.value.some((e) => e.value === D.value) ? D.value : Ut.value[0].value), U = i(() => T.value === "days" ? Ot.value.format(q(w.value)) : T.value === "months" ? String(H.value) : `${E.value}–${E.value + 9}`), Kt = i(() => T.value === "days" ? ["Previous month", "Next month"] : T.value === "months" ? ["Previous year", "Next year"] : ["Previous years", "Next years"]), qt = i(() => !L.value || !j.value ? null : M.value ?? A.value ?? null), W = i(() => j.value ? fn(j.value, N.h, N.m, N.s) : null), Jt = i(() => M.value ? fn(M.value, P.h, P.m, P.s) : null), Yt = i(() => {
290
- if (!R.value) return "";
291
- let e = L.value ? [W.value, Jt.value] : [W.value];
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 (Pt.value !== null && t < Pt.value) return `Choose a time from ${Dt.value.format(Pt.value)}`;
294
- if (Ft.value !== null && t > Ft.value) return `Choose a time up to ${Dt.value.format(Ft.value)}`;
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 L.value && W.value !== null && Jt.value !== null && Jt.value < W.value ? "The end must be after the start" : "";
297
- }), Xt = i(() => y.mode === "duration" ? !0 : !j.value || L.value && !M.value ? !1 : !Yt.value), Zt = i(() => F.d * 86400 + F.h * 3600 + F.m * 60), Qt = i(() => {
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: L.value ? "Start" : "Time",
331
+ label: I.value ? "Start" : "Time",
301
332
  clock: N
302
333
  }];
303
- return L.value && e.push({
334
+ return I.value && e.push({
304
335
  key: "end",
305
336
  label: "End",
306
- clock: P
337
+ clock: Dt
307
338
  }), e.map((e) => ({
308
339
  ...e,
309
- spinners: Cn(e.clock, e.label)
340
+ spinners: En(e.clock, e.label)
310
341
  }));
311
- }), $t = i(() => [
312
- Sn("d", "Days", 0, 999, !1, !1, () => F.d, (e) => F.d = e),
313
- Sn("h", "Hours", 0, 23, !1, !1, () => F.h, (e) => F.h = e),
314
- Sn("m", "Minutes", 0, 59, !1, !1, () => F.m, (e) => F.m = e)
315
- ]), en = h(!1), tn = i(() => b.value || en.value), nn = i(() => [y.hint && xt, y.errorMsg && bt].filter(Boolean).join(" ") || void 0), rn = i(() => {
316
- if (y.mode === "duration") return y.label || "Choose duration";
317
- let e = L.value ? "date range" : R.value ? "date and time" : "date";
318
- return y.label ? `${y.label}: choose ${e}` : `Choose ${e}`;
319
- }), an = i(() => y.mode === "duration" ? _e : L.value ? pe : fe);
320
- function on(e) {
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 G(e, t, n) {
354
+ function W(e, t, n) {
324
355
  let r = new Date(Date.UTC(e, t - 1, n));
325
- return `${r.getUTCFullYear()}-${on(r.getUTCMonth() + 1)}-${on(r.getUTCDate())}`;
356
+ return `${r.getUTCFullYear()}-${un(r.getUTCMonth() + 1)}-${un(r.getUTCDate())}`;
326
357
  }
327
- function K(e) {
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 q(e) {
336
- let { y: t, m: n, d: r } = K(e);
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 J(e, t) {
340
- let { y: n, m: r, d: i } = K(e);
341
- return G(n, r, i + t);
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 sn(e, t) {
344
- let { y: n, m: r, d: i } = K(e), a = new Date(Date.UTC(n, r - 1 + t + 1, 0)).getUTCDate();
345
- return G(n, r + t, Math.min(i, a));
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 Y(e) {
378
+ function J(e) {
348
379
  return `${e.slice(0, 7)}-01`;
349
380
  }
350
- function cn(e) {
351
- let { y: t, m: n } = K(e);
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 ln(e) {
355
- return q(e).getUTCDay();
385
+ function pn(e) {
386
+ return K(e).getUTCDay();
356
387
  }
357
- function un() {
388
+ function mn() {
358
389
  try {
359
- let e = new Intl.Locale(y.locale ?? navigator.language), t = (e.getWeekInfo?.() ?? e.weekInfo)?.firstDay;
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 X(e) {
365
- let t = St.get(I.value);
395
+ function Y(e) {
396
+ let t = Ct.get(F.value);
366
397
  t || (t = new Intl.DateTimeFormat("en-US", {
367
- timeZone: I.value,
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
- }), St.set(I.value, t));
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: G(n.year, n.month, n.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 dn(e) {
386
- let t = X(e), { y: n, m: r, d: i } = K(t.day);
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 fn(e, t, n, r) {
390
- let { y: i, m: a, d: o } = K(e), s = Date.UTC(i, a - 1, o, t, n, r), c = dn(s), ee = s - c, l = dn(ee);
391
- return l === c ? ee : s - l;
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 Z(e) {
394
- let t = lt.exec(e);
395
- if (t) return fn(t[1], Number(t[2]), Number(t[3]), Number(t[4] ?? 0));
396
- if (ct.test(e)) return fn(e, 0, 0, 0);
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 Q(e) {
401
- if (ct.test(e)) return e;
402
- let t = Z(e);
403
- return t === null ? null : X(t).day;
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 pn(e) {
436
+ function Z(e) {
406
437
  return new Date(e).toISOString().replace(/\.000Z$/, "Z");
407
438
  }
408
- function mn(e) {
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]) * ut[a[2]], i = n.lastIndex;
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 hn(e) {
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 gn(e) {
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 _n(e) {
431
- return z.value && e < z.value || B.value && e > B.value ? !0 : y.isDateDisabled?.(e) ?? !1;
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 vn(e, t) {
434
- return !!z.value && t < z.value || !!B.value && e > B.value;
464
+ function Sn(e, t) {
465
+ return !!R.value && t < R.value || !!z.value && e > z.value;
435
466
  }
436
- function yn(e) {
437
- return e === j.value || L.value && e === (M.value ?? qt.value);
467
+ function Cn(e) {
468
+ return e === j.value || I.value && e === (M.value ?? Xt.value);
438
469
  }
439
- function bn(e) {
440
- let t = j.value, n = qt.value;
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 xn(e) {
446
- let t = j.value, n = qt.value, [r, i] = t <= n ? [t, n] : [n, t];
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 Sn(e, t, n, r, i, a, o, s) {
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 Cn(e, t) {
462
- let n = [Sn("h", `${t} hours`, 0, 23, !0, !0, () => e.h, (t) => e.h = t), Sn("m", `${t} minutes`, 0, 59, !0, !0, () => e.m, (t) => e.m = t)];
463
- return y.showSeconds && n.push(Sn("s", `${t} seconds`, 0, 59, !0, !0, () => e.s, (t) => e.s = t)), n;
464
- }
465
- function wn(e) {
466
- return e.padded ? on(e.get()) : String(e.get());
467
- }
468
- function Tn(e, t) {
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 = wn(t));
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 En(e, t) {
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 Dn(e, t) {
479
- e.target.value = wn(t);
516
+ function An(e, t) {
517
+ e.target.value = Dn(t);
480
518
  }
481
- function On() {
482
- if (A.value = null, T.value = "days", O.value = "date", y.mode === "duration") {
483
- let e = V.value[0] ? mn(V.value[0]) ?? 0 : 0;
484
- F.d = Math.floor(e / 86400), F.h = Math.floor(e % 86400 / 3600), F.m = Math.floor(e % 3600 / 60);
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 [e, t] = V.value;
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(P, {
530
+ }), Object.assign(Dt, {
493
531
  h: 23,
494
532
  m: 59,
495
- s: y.showSeconds ? 59 : 0
496
- }), R.value) {
497
- let n = e ? Z(e) : null, r = t ? Z(t) : null;
498
- if (n !== null) {
499
- let e = X(n);
500
- j.value = e.day, Object.assign(N, {
501
- h: e.h,
502
- m: e.m,
503
- s: e.s
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 = X(r);
508
- M.value = e.day, Object.assign(P, {
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 = e ? Q(e) : null, M.value = t ? Q(t) : null;
515
- let n = j.value ?? Nt.value;
516
- !j.value && z.value && n < z.value && (n = z.value), !j.value && B.value && n > B.value && (n = B.value), k.value = n, w.value = Y(n);
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 kn() {
519
- let e = wt.value;
564
+ function Mn() {
565
+ let e = Tt.value;
520
566
  if (!e) return;
521
- let t = e.getBoundingClientRect(), n = S.value?.offsetWidth ?? 300, r = S.value?.offsetHeight ?? 380, i = window.innerHeight - t.bottom - 6 - 8, a = t.top - 6 - 8, o = i < r && a > i, s = Math.max(8, Math.min(t.left, window.innerWidth - n - 8)), c = Math.min(t.width, 448);
522
- C.value = o ? {
523
- bottom: window.innerHeight - t.top + 6,
524
- left: s,
525
- maxHeight: Math.max(200, a),
526
- minWidth: c
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: t.bottom + 6,
529
- left: s,
530
- maxHeight: Math.max(200, i),
531
- minWidth: c
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 An() {
535
- y.disabled || b.value || (b.value = !0);
580
+ function Nn() {
581
+ b.disabled || x.value || (x.value = !0);
536
582
  }
537
- function jn(e = !0) {
538
- b.value && (b.value = !1, e && wt.value?.focus());
583
+ function Pn(e = !0) {
584
+ x.value && (x.value = !1, e && Tt.value?.focus());
539
585
  }
540
- async function Mn() {
541
- On(), kn(), ar(), await f(), kn(), y.mode === "duration" ? S.value?.querySelector("input")?.focus() : Nn();
586
+ async function Fn() {
587
+ jn(), Mn(), ur(), await p(), Mn(), b.mode === "duration" ? C.value?.querySelector("input")?.focus() : In();
542
588
  }
543
- function Nn() {
544
- f(() => S.value?.querySelector(`[data-day="${k.value}"]`)?.focus());
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 $(e) {
547
- st.value = e, jn();
598
+ function Rn() {
599
+ b.inline ? jn(!1) : Pn();
548
600
  }
549
- function Pn(e) {
550
- if (!_n(e)) {
551
- if (k.value = e, Y(e) !== w.value && (w.value = Y(e), Nn()), !L.value) {
552
- j.value = e, R.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, A.value = null, R.value || $([j.value, M.value]);
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 Fn() {
563
- if (Xt.value) {
564
- if (y.mode === "duration") return $(hn(Zt.value));
565
- if (!R.value) return $(L.value ? [j.value, M.value] : j.value);
566
- $(L.value ? [pn(W.value), pn(Jt.value)] : pn(W.value));
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 In() {
570
- let e = X(Date.now());
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: y.showSeconds ? e.s : 0
575
- }), k.value = e.day, w.value = Y(e.day), T.value = "days", O.value === "time" && f(() => Xn("smooth"));
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 Ln() {
578
- Pn(Nt.value);
629
+ function Hn() {
630
+ zn(It.value);
579
631
  }
580
- function Rn(e) {
632
+ function Un(e) {
581
633
  if (e.value) return $(e.value());
582
634
  if (!e.duration) return;
583
- if (y.mode === "duration") return $(hn(mn(e.duration) ?? 0));
584
- let t = Math.floor(Date.now() / 1e3) * 1e3, n = t - (mn(e.duration) ?? 0) * 1e3;
585
- if (y.mode === "date") return $(L.value ? [X(n).day, X(t).day] : X(n).day);
586
- $(L.value ? [pn(n), pn(t)] : pn(n));
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 zn() {
589
- st.value = null, wt.value?.focus();
640
+ function Wn() {
641
+ ct.value = null, Tt.value?.focus();
590
642
  }
591
- function Bn(e) {
592
- w.value = sn(w.value, e), k.value = sn(k.value, e);
643
+ function Gn(e) {
644
+ T.value = dn(T.value, e), A.value = dn(A.value, e);
593
645
  }
594
- function Vn(e) {
595
- T.value === "days" ? Bn(e) : T.value === "months" ? w.value = sn(w.value, 12 * e) : E.value += 10 * e;
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 Hn() {
598
- T.value = "months", D.value = Bt.value, Wn();
649
+ function qn() {
650
+ E.value = "months", O.value = Ut.value, Yn();
599
651
  }
600
- function Un() {
601
- T.value = "years", E.value = Math.floor(H.value / 10) * 10, D.value = H.value, Wn();
652
+ function Jn() {
653
+ E.value = "years", D.value = Math.floor(V.value / 10) * 10, O.value = V.value, Yn();
602
654
  }
603
- function Wn() {
604
- f(() => S.value?.querySelector(`[data-pick="${Gt.value}"]`)?.focus());
655
+ function Yn() {
656
+ p(() => C.value?.querySelector(`[data-pick="${Jt.value}"]`)?.focus());
605
657
  }
606
- function Gn(e) {
658
+ function Xn(e) {
607
659
  if (!e.disabled) {
608
- if (T.value === "years") {
609
- w.value = G(e.value, Bt.value + 1, 1), Hn();
660
+ if (E.value === "years") {
661
+ T.value = W(e.value, Ut.value + 1, 1), qn();
610
662
  return;
611
663
  }
612
- w.value = G(H.value, e.value + 1, 1), k.value = G(H.value, e.value + 1, Math.min(K(k.value).d, cn(w.value))), T.value = "days", Nn();
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 Kn(e) {
667
+ function Zn(e) {
616
668
  if (e.key === "Escape") {
617
- e.preventDefault(), e.stopPropagation(), T.value === "years" ? Hn() : (T.value = "days", Nn());
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 = Ut.value.find((e) => e.value === D.value);
623
- t && Gn(t);
674
+ let t = Kt.value.find((e) => e.value === O.value);
675
+ t && Xn(t);
624
676
  return;
625
677
  }
626
- let t = T.value === "years", n = t ? E.value : 0, r = {
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 = D.value + r[e.key];
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(), Vn(e.key === "PageUp" ? -1 : 1), t && (D.value += e.key === "PageUp" ? -10 : 10), Wn();
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 < E.value ? E.value -= 10 : i > E.value + 11 && (E.value += 10) : i = Math.max(0, Math.min(11, i)), D.value = i, Wn();
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 qn(e) {
642
- O.value = e, e === "time" && f(() => Xn("instant"));
693
+ function Qn(e) {
694
+ k.value = e, e === "time" && p(() => tr("instant"));
643
695
  }
644
- function Jn(e) {
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" || O.value === "date" ? "time" : "date";
653
- qn(t), f(() => S.value?.querySelector(`[data-tab="${t}"]`)?.focus());
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 Yn(e) {
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 Xn(e) {
710
+ function tr(e) {
659
711
  let t = e === "smooth" && !window.matchMedia("(prefers-reduced-motion: reduce)").matches;
660
- S.value?.querySelectorAll("[data-time-list]").forEach((e) => {
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 Zn(e) {
669
- S.value?.querySelector(`[data-time-list="${e}"] [aria-selected=true]`)?.focus({ preventScroll: !0 });
720
+ function nr(e) {
721
+ C.value?.querySelector(`[data-time-list="${e}"] [aria-selected=true]`)?.focus({ preventScroll: !0 });
670
722
  }
671
- function Qn(e, t, n) {
672
- e.set(t), f(() => {
673
- Xn("smooth"), Zn(n);
723
+ function rr(e, t, n) {
724
+ e.set(t), Ln(), p(() => {
725
+ tr("smooth"), nr(n);
674
726
  });
675
727
  }
676
- function $n(e, t, n) {
728
+ function ir(e, t, n) {
677
729
  if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
678
730
  e.preventDefault();
679
- let t = [...S.value?.querySelectorAll("[data-time-list]") ?? []].map((e) => e.dataset.timeList), r = t[t.indexOf(n) + (e.key === "ArrowRight" ? 1 : -1)];
680
- r && Zn(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(), i = {
684
- ArrowUp: r - 1,
685
- ArrowDown: r + 1,
686
- PageUp: r - 5,
687
- PageDown: r + 5,
688
- Home: t.min,
689
- End: t.max
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 i && (e.preventDefault(), Qn(t, Math.min(t.max, Math.max(t.min, i[e.key])), n));
692
- }
693
- function er(e) {
694
- let t = k.value, n = (ln(t) - Tt.value + 7) % 7, r = {
695
- ArrowLeft: () => J(t, -1),
696
- ArrowRight: () => J(t, 1),
697
- ArrowUp: () => J(t, -7),
698
- ArrowDown: () => J(t, 7),
699
- Home: () => J(t, -n),
700
- End: () => J(t, 6 - n),
701
- PageUp: () => sn(t, e.shiftKey ? -12 : -1),
702
- PageDown: () => sn(t, e.shiftKey ? 12 : 1)
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(), Pn(t);
757
+ e.preventDefault(), zn(t);
706
758
  return;
707
759
  }
708
760
  let i = r[e.key];
709
- i && (e.preventDefault(), k.value = i(), w.value = Y(k.value), L.value && j.value && !M.value && (A.value = k.value), Nn());
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 tr(e) {
763
+ function or(e) {
764
+ if (b.inline) return;
712
765
  if (e.key === "Escape") {
713
- e.preventDefault(), e.stopPropagation(), jn();
766
+ e.preventDefault(), e.stopPropagation(), Pn();
714
767
  return;
715
768
  }
716
- if (e.key !== "Tab" || !S.value) return;
717
- let t = [...S.value.querySelectorAll("button:not([disabled]), input:not([disabled])")].filter((e) => e.tabIndex >= 0);
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 nr(e) {
723
- (e.key === "ArrowDown" || e.key === "ArrowUp" && e.altKey) && (e.preventDefault(), An());
775
+ function sr(e) {
776
+ (e.key === "ArrowDown" || e.key === "ArrowUp" && e.altKey) && (e.preventDefault(), Nn());
724
777
  }
725
- function rr(e) {
778
+ function cr(e) {
726
779
  let t = e.target;
727
- Ct.value?.contains(t) || S.value?.contains(t) || jn(!1);
780
+ wt.value?.contains(t) || C.value?.contains(t) || Pn(!1);
728
781
  }
729
- function ir(e) {
730
- e?.target instanceof Node && S.value?.contains(e.target) || kn();
782
+ function lr(e) {
783
+ e?.target instanceof Node && C.value?.contains(e.target) || Mn();
731
784
  }
732
- function ar() {
733
- document.addEventListener("pointerdown", rr, !0), window.addEventListener("scroll", ir, !0), window.addEventListener("resize", ir);
785
+ function ur() {
786
+ document.addEventListener("pointerdown", cr, !0), window.addEventListener("scroll", lr, !0), window.addEventListener("resize", lr);
734
787
  }
735
- function or() {
736
- document.removeEventListener("pointerdown", rr, !0), window.removeEventListener("scroll", ir, !0), window.removeEventListener("resize", ir);
788
+ function dr() {
789
+ document.removeEventListener("pointerdown", cr, !0), window.removeEventListener("scroll", lr, !0), window.removeEventListener("resize", lr);
737
790
  }
738
- return ue(b, (e) => e ? Mn() : or()), ie(() => {
739
- b.value && Mn();
740
- }), re(or), d({ focus: () => wt.value?.focus() }), (i, d) => (m(), s("div", te({
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: Ct
743
- }, ht.value, {
744
- class: ["w-full", u.disabled && "opacity-50"],
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
- u.label ? (m(), s("label", {
801
+ f.label || t.$slots["label-icon"] || t.$slots["label-extra"] ? (h(), c("label", {
749
802
  key: 0,
750
- id: _t,
751
- for: `${v(x)}-trigger`,
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
- }, [c("span", null, _(u.label), 1), u.required ? (m(), s("span", be, "*")) : o("", !0)], 8, ye)) : o("", !0),
754
- u.hint ? (m(), s("p", {
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: xt,
814
+ id: St,
757
815
  class: "mb-2 text-base text-muted"
758
- }, _(u.hint), 1)) : o("", !0),
759
- c("div", xe, [c("button", te({
760
- id: `${v(x)}-trigger`,
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: wt
763
- }, gt.value, {
820
+ ref: Tt
821
+ }, _t.value, {
764
822
  type: "button",
765
- disabled: u.disabled,
823
+ disabled: f.disabled,
766
824
  "aria-haspopup": "dialog",
767
- "aria-expanded": b.value,
768
- "aria-labelledby": u.label ? `${_t} ${vt}` : vt,
769
- "aria-describedby": nn.value,
770
- "aria-invalid": !!u.errorMsg || void 0,
771
- "aria-required": u.required || void 0,
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
- u.size === "small" ? "h-9 pl-3" : "h-10.5 pl-4",
774
- u.clearable && It.value && !u.disabled ? "pr-20" : "pr-10",
775
- u.disabled ? "" : "cursor-pointer hover:bg-accent-hover",
776
- u.errorMsg ? ["border-danger/60", tn.value && "border-danger shadow-[0_0_0_2px_color-mix(in_srgb,var(--color-danger)_20%,transparent)]"] : tn.value ? "focus-ring" : ["border-border", !u.disabled && "hover:border-accent-active"]
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: d[0] ||= (e) => b.value ? jn() : An(),
779
- onKeydown: nr,
780
- onFocus: d[1] ||= (e) => en.value = !0,
781
- onBlur: d[2] ||= (e) => en.value = !1
782
- }), [c("span", {
783
- id: vt,
784
- class: p(["truncate tabular-nums", !Lt.value && "text-muted/80"])
785
- }, _(Lt.value || u.placeholder || (u.mode === "duration" ? "Choose duration" : "Choose date")), 3)], 16, Se), c("span", { class: p(["pointer-events-none absolute inset-y-0 flex items-center gap-4 text-muted", u.size === "small" ? "right-3" : "right-4"]) }, [u.clearable && It.value && !u.disabled ? (m(), s("button", {
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": u.label ? `Clear ${u.label}` : "Clear",
790
- onClick: zn
791
- }, [l(v(ve), {
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, Ce)) : o("", !0), (m(), a(oe(an.value), {
795
- class: p(["size-4", b.value && "text-heading"]),
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
- u.errorMsg ? (m(), s("p", {
799
- key: 2,
800
- id: bt,
801
- class: "mt-1 text-base text-danger-strong",
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(() => [b.value ? (m(), s("div", {
865
+ default: de(() => [x.value || f.inline ? (h(), c("div", te({
817
866
  key: 0,
818
867
  ref_key: "panel",
819
- ref: S,
820
- role: "dialog",
821
- "aria-modal": "true",
822
- "aria-label": rn.value,
823
- class: "ac-scrollbar fixed z-[90] flex max-w-[calc(100vw-16px)] flex-col rounded-10 border border-border bg-surface shadow-sm sm:flex-row",
824
- style: ne({
825
- top: C.value.top === void 0 ? void 0 : `${C.value.top}px`,
826
- bottom: C.value.bottom === void 0 ? void 0 : `${C.value.bottom}px`,
827
- left: `${C.value.left}px`,
828
- maxHeight: `${C.value.maxHeight}px`,
829
- minWidth: `${C.value.minWidth}px`
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: tr
834
- }, [u.presets.length ? (m(), s("div", Ee, [(m(!0), s(t, null, g(u.presets, (e) => (m(), s("button", {
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) => Rn(e)
839
- }, _(e.label), 9, De))), 128))])) : o("", !0), c("div", { class: p(["max-w-full min-w-0 flex-auto max-sm:w-auto", u.mode === "duration" ? "w-72" : "w-[calc(328px*var(--ac-scale))]"]) }, [u.mode === "duration" ? (m(), s("div", Oe, [
840
- c("p", ke, _(u.label || "Duration"), 1),
841
- c("p", Ae, _(gn(Zt.value)), 1),
842
- c("div", je, [(m(!0), s(t, null, g($t.value, (e) => (m(), s("label", {
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
- }, [c("span", Me, _(e.label), 1), c("input", {
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: wn(e),
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) => Tn(t, e),
856
- onInput: (t) => En(t, e),
857
- onBlur: (t) => Dn(t, e),
858
- onFocus: d[3] ||= (e) => e.target.select()
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
- d[10] ||= c("p", { class: "mt-2 text-xs text-muted" }, "↑ ↓ to adjust, or type a number.", -1)
861
- ])) : (m(), s(t, { key: 1 }, [R.value ? (m(), s("div", {
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: Jn
867
- }, [(m(), s(t, null, g(pt, (e) => c("button", {
868
- id: `${v(x)}-tab-${e.key}`,
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": O.value === e.key,
874
- "aria-controls": `${v(x)}-tabpanel`,
875
- tabindex: O.value === e.key ? 0 : -1,
876
- 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"]),
877
- onClick: (t) => qn(e.key)
878
- }, [(m(), a(oe(e.icon), {
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
- })), ee(" " + _(e.label), 1)], 10, Pe)), 64))], 32)) : o("", !0), c("div", {
882
- id: `${v(x)}-tabpanel`,
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: R.value ? "tabpanel" : void 0,
885
- "aria-labelledby": R.value ? `${v(x)}-tab-${O.value}` : void 0
886
- }, [O.value === "date" ? (m(), s(t, { key: 0 }, [c("div", Ie, [
887
- c("button", {
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": Kt.value[0],
891
- onClick: d[4] ||= (e) => Vn(-1)
892
- }, [l(v(me), {
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
- c("span", {
897
- id: yt,
948
+ l("span", {
949
+ id: bt,
898
950
  class: "sr-only",
899
951
  "aria-live": "polite"
900
- }, _(U.value), 1),
901
- T.value === "years" ? (m(), s("span", ze, _(U.value), 1)) : (m(), s("button", {
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": T.value === "days" ? `${U.value}, choose month` : `${U.value}, choose year`,
906
- onClick: d[5] ||= (e) => T.value === "days" ? Hn() : Un()
907
- }, _(U.value), 9, Re)),
908
- c("button", {
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": Kt.value[1],
912
- onClick: d[6] ||= (e) => Vn(1)
913
- }, [l(v(he), {
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
- ]), T.value === "days" ? (m(), s("table", {
969
+ ]), E.value === "days" ? (h(), c("table", {
918
970
  key: 0,
919
971
  role: "grid",
920
- "aria-labelledby": yt,
972
+ "aria-labelledby": bt,
921
973
  class: "w-full table-fixed border-collapse",
922
- onKeydown: er
923
- }, [c("thead", null, [c("tr", null, [(m(!0), s(t, null, g(jt.value, (e) => (m(), s("th", {
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
- }, _(e.short.slice(0, 2)), 9, Ve))), 128))])]), c("tbody", { onMouseleave: d[7] ||= (e) => A.value = null }, [(m(!0), s(t, null, g(zt.value, (e, n) => (m(), s("tr", { key: n }, [(m(!0), s(t, null, g(e, (e) => (m(), s("td", {
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": yn(e) || bn(e),
983
+ "aria-selected": Cn(e) || wn(e),
932
984
  class: "p-0 py-0.5"
933
- }, [c("div", { class: p(["px-0.5", bn(e) && Y(e) === w.value && ["bg-primary/10", ...xn(e)]]) }, [c("button", {
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 === k.value ? 0 : -1,
937
- "aria-label": kt.value.format(q(e)),
938
- "aria-disabled": _n(e) || void 0,
939
- "aria-current": e === Nt.value ? "date" : void 0,
940
- 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", [Y(e) !== w.value && "invisible", _n(e) ? "cursor-not-allowed text-muted/50 line-through" : yn(e) ? "cursor-pointer bg-primary font-semibold text-white" : e === Nt.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"]]),
941
- onClick: (t) => Pn(e),
942
- onMouseenter: (t) => L.value && j.value && !M.value && (A.value = e)
943
- }, _(At.value.format(q(e))), 43, Ue)], 2)], 8, He))), 128))]))), 128))], 32)], 32)) : (m(), s("div", {
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": T.value === "months" ? `Months of ${U.value}` : `Years ${U.value}`,
998
+ "aria-label": E.value === "months" ? `Months of ${H.value}` : `Years ${H.value}`,
947
999
  class: "grid gap-2",
948
- onKeydown: Kn
949
- }, [(m(!0), s(t, null, g(Wt.value, (e, n) => (m(), s("div", {
950
- key: n,
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
- }, [(m(!0), s(t, null, g(e, (e) => (m(), s("button", {
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 === Gt.value ? 0 : -1,
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: 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"]),
963
- onClick: (t) => Gn(e),
964
- onFocus: (t) => D.value = e.value
965
- }, _(e.text), 43, Ge))), 128))]))), 128))], 40, We))], 64)) : (m(), s(t, { key: 1 }, [c("div", Ke, [(m(!0), s(t, null, g(Qt.value, (e, n) => (m(), s(t, { key: e.key }, [n > 0 ? (m(), s("span", qe)) : o("", !0), c("div", {
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
- }, [L.value ? (m(), s("p", Ye, _(e.label), 1)) : o("", !0), c("div", Xe, [(m(!0), s(t, null, g(e.spinners, (n, r) => (m(), s(t, { key: n.key }, [r > 0 ? (m(), s("span", Ze, ":")) : o("", !0), c("div", Qe, [c("span", $e, _(ft[n.key]), 1), c("div", {
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": n.label,
972
- "data-time-list": `${e.key}-${n.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: (t) => $n(t, n, `${e.key}-${n.key}`)
975
- }, [c("div", tt, [(m(!0), s(t, null, g(Yn(n), (t) => (m(), s("button", {
976
- key: t,
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: t === n.get() ? 0 : -1,
980
- "aria-selected": t === n.get(),
981
- class: p(["inline-flex size-10 shrink-0 cursor-pointer 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-inset motion-reduce:transition-none", t === n.get() ? "scale-110 bg-primary font-bold text-white" : "text-heading hover:bg-accent-hover hover:font-bold active:bg-accent-active"]),
982
- onClick: (r) => Qn(n, t, `${e.key}-${n.key}`)
983
- }, _(on(t)), 11, nt))), 128))])], 40, et)])], 64))), 128))])], 8, Je)], 64))), 128))]), c("p", rt, [ee("Times in " + _(Mt.value), 1), Mt.value === I.value ? o("", !0) : (m(), s(t, { key: 0 }, [ee(" (" + _(I.value) + ")", 1)], 64))])], 64))], 8, Fe)], 64)), R.value || u.mode === "duration" || !L.value ? (m(), s("div", it, [
984
- u.mode !== "duration" && !L.value ? (m(), s("button", {
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: _n(Nt.value),
989
- onClick: d[8] ||= (e) => R.value ? In() : Ln()
990
- }, _(R.value ? "Now" : "Today"), 9, at)) : o("", !0),
991
- Yt.value ? (m(), s("p", ot, _(Yt.value), 1)) : o("", !0),
992
- d[11] ||= c("span", { class: "flex-1" }, null, -1),
993
- R.value || u.mode === "duration" ? (m(), s(t, { key: 2 }, [l(e, {
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: d[9] ||= (e) => jn()
998
- }), l(e, {
1049
+ onClick: Rn
1050
+ }), d(e, {
999
1051
  title: "Apply",
1000
1052
  size: "small",
1001
- disabled: !Xt.value,
1002
- onClick: Fn
1003
- }, null, 8, ["disabled"])], 64)) : o("", !0)
1004
- ])) : o("", !0)], 2)], 44, Te)) : o("", !0)]),
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 { y as default };
1075
+ export { b as default };