@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,11 +1,15 @@
1
- import { Fragment as e, Teleport as t, Transition as n, computed as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createVNode as c, defineComponent as l, mergeModels as u, mergeProps as d, nextTick as f, normalizeClass as p, normalizeStyle as ee, onBeforeUnmount as te, onMounted as ne, openBlock as m, ref as h, renderList as g, toDisplayString as _, unref as v, useAttrs as re, useId as ie, useModel as y, watch as ae, withCtx as oe } from "vue";
2
- import { Clock as se, X as ce } from "@lucide/vue";
1
+ import { fixedFrame as e } from "./fixedFrame.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, createVNode as l, defineComponent as u, mergeModels as d, mergeProps as f, nextTick as p, normalizeClass as m, onBeforeUnmount as ee, onMounted as te, openBlock as h, ref as g, renderList as _, renderSlot as v, toDisplayString as y, unref as b, useAttrs as ne, useId as re, useModel as x, watch as ie, withCtx as ae } from "vue";
3
+ import { Clock as oe, X as se } from "@lucide/vue";
3
4
  //#region src/lib/components/AcTimePicker.vue?vue&type=script&setup=true&lang.ts
4
- var le = ["for"], ue = {
5
- key: 0,
5
+ var ce = ["for"], le = { key: 0 }, ue = {
6
+ key: 1,
6
7
  class: "text-danger",
7
8
  "aria-hidden": "true"
8
- }, de = { class: "relative" }, fe = [
9
+ }, de = {
10
+ key: 2,
11
+ class: "relative"
12
+ }, fe = [
9
13
  "id",
10
14
  "disabled",
11
15
  "aria-expanded",
@@ -13,27 +17,33 @@ var le = ["for"], ue = {
13
17
  "aria-describedby",
14
18
  "aria-invalid",
15
19
  "aria-required"
16
- ], pe = ["aria-label"], me = ["name", "value"], he = ["aria-label"], ge = { class: "flex h-48 min-h-0 shrink-0 items-stretch justify-center gap-1" }, _e = {
20
+ ], pe = ["aria-label"], me = [
21
+ "role",
22
+ "aria-modal",
23
+ "aria-label",
24
+ "aria-describedby",
25
+ "inert"
26
+ ], he = { class: "flex h-48 min-h-0 shrink-0 items-stretch justify-center gap-1" }, ge = {
17
27
  key: 0,
18
28
  class: "mx-2 mt-6 h-32 w-px shrink-0 self-center bg-border",
19
29
  "aria-hidden": "true"
20
- }, ve = {
30
+ }, _e = {
21
31
  key: 1,
22
32
  class: "mt-6 self-center font-bold text-heading/50",
23
33
  "aria-hidden": "true"
24
- }, ye = ["data-col"], be = {
34
+ }, ve = ["data-col"], ye = {
25
35
  class: "mb-2 text-xm font-bold tracking-wider text-heading/50 uppercase",
26
36
  "aria-hidden": "true"
27
- }, xe = ["aria-label", "onKeydown"], Se = { class: "flex w-full flex-col items-center py-20" }, Ce = [
37
+ }, be = ["aria-label", "onKeydown"], xe = { class: "flex w-full flex-col items-center py-20" }, Se = [
28
38
  "data-value",
29
39
  "tabindex",
30
40
  "aria-selected",
31
41
  "aria-disabled",
32
42
  "onClick"
33
- ], we = { class: "mt-4 flex shrink-0 justify-center gap-2 border-t border-border pt-4" }, Te = ["disabled"], b = 86399, x = /*@__PURE__*/ l({
43
+ ], Ce = { class: "mt-4 flex shrink-0 justify-center gap-2 border-t border-border pt-4" }, we = ["disabled"], Te = ["name", "value"], S = 86399, C = /*@__PURE__*/ u({
34
44
  inheritAttrs: !1,
35
45
  __name: "AcTimePicker",
36
- props: /*@__PURE__*/ u({
46
+ props: /*@__PURE__*/ d({
37
47
  label: { default: "" },
38
48
  placeholder: { default: "Choose time" },
39
49
  hourCycle: { default: 24 },
@@ -59,7 +69,11 @@ var le = ["for"], ue = {
59
69
  errorMsg: { default: "" },
60
70
  hint: { default: "" },
61
71
  size: { default: "normal" },
62
- name: { default: "" }
72
+ name: { default: "" },
73
+ inline: {
74
+ type: Boolean,
75
+ default: !1
76
+ }
63
77
  }, {
64
78
  modelValue: { default: null },
65
79
  modelModifiers: {},
@@ -70,19 +84,19 @@ var le = ["for"], ue = {
70
84
  openModifiers: {}
71
85
  }),
72
86
  emits: ["update:modelValue", "update:open"],
73
- setup(l, { expose: u }) {
74
- let x = l, S = y(l, "modelValue"), C = y(l, "open"), Ee = /^(\d{1,2}):(\d{2})(?::(\d{2}))?$/, w = ie(), T = re(), De = r(() => ({
75
- class: T.class,
76
- style: T.style
77
- })), Oe = r(() => {
78
- let { class: e, style: t, ...n } = T;
87
+ setup(u, { expose: d }) {
88
+ let C = u, w = x(u, "modelValue"), T = x(u, "open"), Ee = /^(\d{1,2}):(\d{2})(?::(\d{2}))?$/, E = re(), D = ne(), De = i(() => ({
89
+ class: D.class,
90
+ style: D.style
91
+ })), O = i(() => {
92
+ let { class: e, style: t, ...n } = D;
79
93
  return n;
80
- }), E = `${w}-label`, D = `${w}-value`, O = `${w}-msg`, k = `${w}-hint`, A = h(null), j = h(null), M = h(null), N = h({
94
+ }), k = `${E}-label`, A = `${E}-value`, j = `${E}-msg`, M = `${E}-hint`, N = g(null), P = g(null), F = g(null), I = g({
81
95
  left: 0,
82
96
  maxHeight: 400,
83
97
  minWidth: 0
84
- }), P = h(!1), F = r(() => C.value || P.value), I = r(() => G(S.value)), L = r(() => G(x.min) ?? 0), R = r(() => G(x.max) ?? b), z = r(() => I.value === null ? null : K(I.value)), B = r(() => x.hourCycle === 12), V = r(() => I.value === null ? "" : Ne(I.value)), ke = r(() => [x.hint && k, x.errorMsg && O].filter(Boolean).join(" ") || void 0), Ae = r(() => x.label ? `${x.label}: choose time` : "Choose time"), je = r(() => q(Fe())), H = r(() => {
85
- let e = z.value, t = e?.h ?? null, n = e?.m ?? null, r = t === null ? 0 : t >= 12 ? 12 : 0, i = [], a = B.value ? [
98
+ }), L = g(!1), Oe = i(() => T.value || L.value), R = i(() => U(w.value)), z = i(() => U(C.min) ?? 0), ke = i(() => U(C.max) ?? S), Ae = i(() => R.value === null ? null : W(R.value)), B = i(() => C.hourCycle === 12), je = i(() => R.value === null ? "" : Le(R.value)), Me = i(() => [C.hint && M, C.errorMsg && j].filter(Boolean).join(" ") || void 0), Ne = i(() => C.label ? `${C.label}: choose time` : "Choose time"), Pe = i(() => G(ze())), Fe = i(() => {
99
+ let e = Ae.value, t = e?.h ?? null, n = e?.m ?? null, r = t === null ? 0 : t >= 12 ? 12 : 0, i = [], a = B.value ? [
86
100
  0,
87
101
  1,
88
102
  2,
@@ -95,7 +109,7 @@ var le = ["for"], ue = {
95
109
  9,
96
110
  10,
97
111
  11
98
- ].map((e) => e + r) : W(0, 23, 1);
112
+ ].map((e) => e + r) : H(0, 23, 1);
99
113
  i.push({
100
114
  unit: "h",
101
115
  heading: "Hrs",
@@ -103,35 +117,35 @@ var le = ["for"], ue = {
103
117
  selected: t,
104
118
  cells: a.map((e) => ({
105
119
  value: e,
106
- text: U(B.value ? e % 12 || 12 : e),
107
- disabled: !J(e * 3600, e * 3600 + 3599)
120
+ text: V(B.value ? e % 12 || 12 : e),
121
+ disabled: !K(e * 3600, e * 3600 + 3599)
108
122
  }))
109
123
  });
110
- let o = t ?? Pe();
124
+ let o = t ?? Re();
111
125
  if (i.push({
112
126
  unit: "m",
113
127
  heading: "Min",
114
128
  name: "Minutes",
115
129
  selected: n,
116
- cells: W(0, 59, Math.max(1, x.minuteStep)).map((e) => {
130
+ cells: H(0, 59, Math.max(1, C.minuteStep)).map((e) => {
117
131
  let t = o * 3600 + e * 60;
118
132
  return {
119
133
  value: e,
120
- text: U(e),
121
- disabled: !J(t, x.showSeconds ? t + 59 : t)
134
+ text: V(e),
135
+ disabled: !K(t, C.showSeconds ? t + 59 : t)
122
136
  };
123
137
  })
124
- }), x.showSeconds) {
138
+ }), C.showSeconds) {
125
139
  let t = n ?? 0;
126
140
  i.push({
127
141
  unit: "s",
128
142
  heading: "Sec",
129
143
  name: "Seconds",
130
144
  selected: e?.s ?? null,
131
- cells: W(0, 59, 1).map((e) => ({
145
+ cells: H(0, 59, 1).map((e) => ({
132
146
  value: e,
133
- text: U(e),
134
- disabled: !q(o * 3600 + t * 60 + e)
147
+ text: V(e),
148
+ disabled: !G(o * 3600 + t * 60 + e)
135
149
  }))
136
150
  });
137
151
  }
@@ -143,23 +157,23 @@ var le = ["for"], ue = {
143
157
  cells: [{
144
158
  value: 0,
145
159
  text: "AM",
146
- disabled: !J(0, 43199)
160
+ disabled: !K(0, 43199)
147
161
  }, {
148
162
  value: 12,
149
163
  text: "PM",
150
- disabled: !J(43200, b)
164
+ disabled: !K(43200, S)
151
165
  }]
152
166
  }), i;
153
167
  });
154
- function U(e) {
168
+ function V(e) {
155
169
  return String(e).padStart(2, "0");
156
170
  }
157
- function W(e, t, n) {
171
+ function H(e, t, n) {
158
172
  let r = [];
159
173
  for (let i = e; i <= t; i += n) r.push(i);
160
174
  return r;
161
175
  }
162
- function G(e) {
176
+ function U(e) {
163
177
  let t = e ? Ee.exec(e.trim()) : null;
164
178
  if (!t) return null;
165
179
  let [n, r, i] = [
@@ -169,86 +183,87 @@ var le = ["for"], ue = {
169
183
  ];
170
184
  return n > 23 || r > 59 || i > 59 ? null : n * 3600 + r * 60 + i;
171
185
  }
172
- function K(e) {
186
+ function W(e) {
173
187
  return {
174
188
  h: Math.floor(e / 3600),
175
189
  m: Math.floor(e % 3600 / 60),
176
190
  s: e % 60
177
191
  };
178
192
  }
179
- function Me(e) {
180
- let { h: t, m: n, s: r } = K(e);
181
- return x.showSeconds ? `${U(t)}:${U(n)}:${U(r)}` : `${U(t)}:${U(n)}`;
193
+ function Ie(e) {
194
+ let { h: t, m: n, s: r } = W(e);
195
+ return C.showSeconds ? `${V(t)}:${V(n)}:${V(r)}` : `${V(t)}:${V(n)}`;
182
196
  }
183
- function Ne(e) {
184
- let { h: t, m: n, s: r } = K(e), i = x.showSeconds ? `${U(n)}:${U(r)}` : U(n);
185
- return B.value ? `${U(t % 12 || 12)}:${i} ${t >= 12 ? "PM" : "AM"}` : `${U(t)}:${i}`;
197
+ function Le(e) {
198
+ let { h: t, m: n, s: r } = W(e), i = C.showSeconds ? `${V(n)}:${V(r)}` : V(n);
199
+ return B.value ? `${V(t % 12 || 12)}:${i} ${t >= 12 ? "PM" : "AM"}` : `${V(t)}:${i}`;
186
200
  }
187
- function q(e) {
188
- return e >= L.value && e <= R.value;
201
+ function G(e) {
202
+ return e >= z.value && e <= ke.value;
189
203
  }
190
- function J(e, t) {
191
- return t >= L.value && e <= R.value;
204
+ function K(e, t) {
205
+ return t >= z.value && e <= ke.value;
192
206
  }
193
- function Pe() {
194
- return Math.floor(L.value / 3600);
207
+ function Re() {
208
+ return Math.floor(z.value / 3600);
195
209
  }
196
- function Fe() {
197
- let e = /* @__PURE__ */ new Date(), t = Math.max(1, x.minuteStep), n = Math.floor(e.getMinutes() / t) * t;
198
- return e.getHours() * 3600 + n * 60 + (x.showSeconds ? e.getSeconds() : 0);
210
+ function ze() {
211
+ let e = /* @__PURE__ */ new Date(), t = Math.max(1, C.minuteStep), n = Math.floor(e.getMinutes() / t) * t;
212
+ return e.getHours() * 3600 + n * 60 + (C.showSeconds ? e.getSeconds() : 0);
199
213
  }
200
- function Ie(e) {
201
- if (q(e) && Le(e)) return e;
202
- let { h: t } = K(e), n = Math.max(1, x.minuteStep) * 60, r = [];
203
- for (let e = t * 3600; e < (t + 1) * 3600; e += n) if (x.showSeconds) for (let t = 0; t < 60; t++) r.push(e + t);
214
+ function Be(e) {
215
+ if (G(e) && Ve(e)) return e;
216
+ let { h: t } = W(e), n = Math.max(1, C.minuteStep) * 60, r = [];
217
+ for (let e = t * 3600; e < (t + 1) * 3600; e += n) if (C.showSeconds) for (let t = 0; t < 60; t++) r.push(e + t);
204
218
  else r.push(e);
205
- let i = r.filter(q);
219
+ let i = r.filter(G);
206
220
  return i.length ? i.reduce((t, n) => Math.abs(n - e) < Math.abs(t - e) ? n : t) : null;
207
221
  }
208
- function Le(e) {
209
- let { m: t, s: n } = K(e);
210
- return t % Math.max(1, x.minuteStep) === 0 && (x.showSeconds || n === 0);
222
+ function Ve(e) {
223
+ let { m: t, s: n } = W(e);
224
+ return t % Math.max(1, C.minuteStep) === 0 && (C.showSeconds || n === 0);
211
225
  }
212
- function Re(e, t) {
213
- let { h: n, m: r, s: i } = z.value ?? K(Ie(L.value) ?? L.value);
226
+ function He(e, t) {
227
+ if (C.disabled) return;
228
+ let { h: n, m: r, s: i } = Ae.value ?? W(Be(z.value) ?? z.value);
214
229
  e === "h" ? n = t : e === "m" ? r = t : e === "s" ? i = t : n = n % 12 + t;
215
- let a = Ie(n * 3600 + r * 60 + (x.showSeconds ? i : 0));
216
- a !== null && (S.value = Me(a));
230
+ let a = Be(n * 3600 + r * 60 + (C.showSeconds ? i : 0));
231
+ a !== null && (w.value = Ie(a));
217
232
  }
218
- function ze() {
219
- S.value = Me(Fe()), f(() => Z("smooth"));
220
- }
221
- function Be() {
222
- S.value = null, j.value?.focus();
223
- }
224
- function Y() {
225
- let e = j.value;
226
- if (!e) return;
227
- let t = e.getBoundingClientRect(), n = M.value?.offsetWidth ?? 240, r = M.value?.offsetHeight ?? 320, 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);
228
- N.value = o ? {
229
- bottom: window.innerHeight - t.top + 6,
230
- left: s,
231
- maxHeight: Math.max(200, a),
232
- minWidth: c
233
+ function Ue() {
234
+ C.disabled || (w.value = Ie(ze()), p(() => X("smooth")));
235
+ }
236
+ function We() {
237
+ w.value = null, P.value?.focus();
238
+ }
239
+ function q() {
240
+ let t = P.value;
241
+ if (!t) return;
242
+ let n = t.getBoundingClientRect(), r = e(), i = F.value?.offsetWidth ?? 240, a = F.value?.offsetHeight ?? 320, 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);
243
+ I.value = c ? {
244
+ bottom: r.bottom - n.top + 6,
245
+ left: l,
246
+ maxHeight: Math.max(200, s),
247
+ minWidth: u
233
248
  } : {
234
- top: t.bottom + 6,
235
- left: s,
236
- maxHeight: Math.max(200, i),
237
- minWidth: c
249
+ top: n.bottom + 6 - r.top,
250
+ left: l,
251
+ maxHeight: Math.max(200, o),
252
+ minWidth: u
238
253
  };
239
254
  }
240
- function Ve() {
241
- x.disabled || C.value || (C.value = !0);
255
+ function Ge() {
256
+ C.disabled || T.value || (T.value = !0);
242
257
  }
243
- function X(e = !0) {
244
- C.value && (C.value = !1, e && j.value?.focus());
258
+ function J(e = !0) {
259
+ T.value && (T.value = !1, e && P.value?.focus());
245
260
  }
246
- async function He() {
247
- Y(), Ze(), await f(), Y(), Z("instant"), We(0);
261
+ async function Y() {
262
+ q(), $e(), await p(), q(), X("instant"), Z(0);
248
263
  }
249
- function Z(e) {
264
+ function X(e) {
250
265
  let t = e === "smooth" && !window.matchMedia("(prefers-reduced-motion: reduce)").matches;
251
- M.value?.querySelectorAll("[role=listbox]").forEach((e) => {
266
+ F.value?.querySelectorAll("[role=listbox]").forEach((e) => {
252
267
  let n = e.querySelector("[aria-selected=true]") ?? e.querySelector("[aria-disabled=false]");
253
268
  n && e.scrollTo({
254
269
  top: n.offsetTop - (e.clientHeight - n.offsetHeight) / 2,
@@ -256,22 +271,22 @@ var le = ["for"], ue = {
256
271
  });
257
272
  });
258
273
  }
259
- function Ue(e) {
260
- return [...M.value?.querySelectorAll(`[data-col="${e}"] [role=option]`) ?? []];
274
+ function Ke(e) {
275
+ return [...F.value?.querySelectorAll(`[data-col="${e}"] [role=option]`) ?? []];
261
276
  }
262
- function We(e) {
263
- let t = Ue(e);
277
+ function Z(e) {
278
+ let t = Ke(e);
264
279
  (t.find((e) => e.tabIndex === 0) ?? t[0])?.focus({ preventScroll: !0 });
265
280
  }
266
- function Ge(e, t) {
281
+ function qe(e, t) {
267
282
  return (e.cells.find((t) => t.value === e.selected) ?? e.cells.find((e) => !e.disabled)) === t ? 0 : -1;
268
283
  }
269
- function Ke(e, t, n) {
270
- n.disabled || (Re(t.unit, n.value), f(() => {
271
- Z("smooth"), Ue(e).find((e) => e.tabIndex === 0)?.focus({ preventScroll: !0 });
284
+ function Je(e, t, n) {
285
+ n.disabled || (He(t.unit, n.value), p(() => {
286
+ X("smooth"), Ke(e).find((e) => e.tabIndex === 0)?.focus({ preventScroll: !0 });
272
287
  }));
273
288
  }
274
- function qe(e, t, n) {
289
+ function Ye(e, t, n) {
275
290
  let r = n.cells.filter((e) => !e.disabled);
276
291
  if (!r.length) return;
277
292
  let i = r.findIndex((e) => e.value === n.selected), a = {
@@ -285,171 +300,189 @@ var le = ["for"], ue = {
285
300
  if (e.key === "ArrowRight" || e.key === "ArrowLeft") {
286
301
  e.preventDefault();
287
302
  let n = t + (e.key === "ArrowRight" ? 1 : -1);
288
- n >= 0 && n < H.value.length && We(n);
303
+ n >= 0 && n < Fe.value.length && Z(n);
289
304
  return;
290
305
  }
291
306
  if (e.key === "Enter") {
292
307
  e.preventDefault();
293
308
  let t = n.cells.find((t) => String(t.value) === e.target.dataset.value);
294
- t && !t.disabled && Re(n.unit, t.value), X();
309
+ t && !t.disabled && He(n.unit, t.value), J();
295
310
  return;
296
311
  }
297
312
  if (!(e.key in a)) return;
298
313
  e.preventDefault();
299
314
  let o = r[Math.max(0, Math.min(r.length - 1, a[e.key]))];
300
- Ke(t, n, o);
315
+ Je(t, n, o);
301
316
  }
302
- function Je(e) {
317
+ function Xe(e) {
318
+ if (C.inline) return;
303
319
  if (e.key === "Escape") {
304
- e.preventDefault(), e.stopPropagation(), X();
320
+ e.preventDefault(), e.stopPropagation(), J();
305
321
  return;
306
322
  }
307
- if (e.key !== "Tab" || !M.value) return;
308
- let t = [...M.value.querySelectorAll("button:not([disabled])")].filter((e) => e.tabIndex >= 0);
323
+ if (e.key !== "Tab" || !F.value) return;
324
+ let t = [...F.value.querySelectorAll("button:not([disabled])")].filter((e) => e.tabIndex >= 0);
309
325
  if (!t.length) return;
310
326
  let n = t[0], r = t[t.length - 1];
311
327
  e.shiftKey && document.activeElement === n ? (e.preventDefault(), r.focus()) : !e.shiftKey && document.activeElement === r && (e.preventDefault(), n.focus());
312
328
  }
313
- function Ye(e) {
314
- (e.key === "ArrowDown" || e.key === "ArrowUp" && e.altKey) && (e.preventDefault(), Ve());
329
+ function Ze(e) {
330
+ (e.key === "ArrowDown" || e.key === "ArrowUp" && e.altKey) && (e.preventDefault(), Ge());
315
331
  }
316
- function Xe(e) {
332
+ function Qe(e) {
317
333
  let t = e.target;
318
- A.value?.contains(t) || M.value?.contains(t) || X(!1);
334
+ N.value?.contains(t) || F.value?.contains(t) || J(!1);
319
335
  }
320
336
  function Q(e) {
321
- e?.target instanceof Node && M.value?.contains(e.target) || Y();
337
+ e?.target instanceof Node && F.value?.contains(e.target) || q();
322
338
  }
323
- function Ze() {
324
- document.addEventListener("pointerdown", Xe, !0), window.addEventListener("scroll", Q, !0), window.addEventListener("resize", Q);
339
+ function $e() {
340
+ document.addEventListener("pointerdown", Qe, !0), window.addEventListener("scroll", Q, !0), window.addEventListener("resize", Q);
325
341
  }
326
342
  function $() {
327
- document.removeEventListener("pointerdown", Xe, !0), window.removeEventListener("scroll", Q, !0), window.removeEventListener("resize", Q);
343
+ document.removeEventListener("pointerdown", Qe, !0), window.removeEventListener("scroll", Q, !0), window.removeEventListener("resize", Q);
344
+ }
345
+ async function et() {
346
+ await p(), X("instant");
328
347
  }
329
- return ae(C, (e) => e ? He() : $()), ne(() => {
330
- C.value && He();
331
- }), te($), u({ focus: () => j.value?.focus() }), (r, u) => (m(), o("div", d({
348
+ return ie(T, (e) => e ? Y() : $()), ie(w, () => C.inline && p(() => X("smooth"))), te(() => {
349
+ C.inline ? X("instant") : T.value && Y();
350
+ }), ee($), d({
351
+ focus: () => C.inline ? Z(0) : P.value?.focus(),
352
+ scrollToSelected: et
353
+ }), (e, i) => (h(), s("div", f({
332
354
  ref_key: "root",
333
- ref: A
355
+ ref: N
334
356
  }, De.value, {
335
- class: ["w-full", l.disabled && "opacity-50"],
357
+ class: ["w-full", u.disabled && "opacity-50"],
336
358
  "data-ac-ds": "",
337
359
  "data-testid": "ac-time-picker"
338
360
  }), [
339
- l.label ? (m(), o("label", {
361
+ u.label || e.$slots["label-icon"] || e.$slots["label-extra"] ? (h(), s("label", {
340
362
  key: 0,
341
- id: E,
342
- for: `${v(w)}-trigger`,
363
+ id: k,
364
+ for: u.inline ? void 0 : `${b(E)}-trigger`,
343
365
  class: "mb-2 flex items-center gap-1 text-base font-medium text-heading"
344
- }, [s("span", null, _(l.label), 1), l.required ? (m(), o("span", ue, "*")) : a("", !0)], 8, le)) : a("", !0),
345
- l.hint ? (m(), o("p", {
366
+ }, [
367
+ v(e.$slots, "label-icon"),
368
+ u.label ? (h(), s("span", le, y(u.label), 1)) : o("", !0),
369
+ v(e.$slots, "label-extra"),
370
+ u.required ? (h(), s("span", ue, "*")) : o("", !0)
371
+ ], 8, ce)) : o("", !0),
372
+ u.hint ? (h(), s("p", {
346
373
  key: 1,
347
- id: k,
374
+ id: M,
348
375
  class: "mb-2 text-base text-muted"
349
- }, _(l.hint), 1)) : a("", !0),
350
- s("div", de, [s("button", d({
351
- id: `${v(w)}-trigger`,
376
+ }, y(u.hint), 1)) : o("", !0),
377
+ u.inline ? o("", !0) : (h(), s("div", de, [c("button", f({
378
+ id: `${b(E)}-trigger`,
352
379
  ref_key: "trigger",
353
- ref: j
354
- }, Oe.value, {
380
+ ref: P
381
+ }, O.value, {
355
382
  type: "button",
356
- disabled: l.disabled,
383
+ disabled: u.disabled,
357
384
  "aria-haspopup": "dialog",
358
- "aria-expanded": C.value,
359
- "aria-labelledby": l.label ? `${E} ${D}` : D,
360
- "aria-describedby": ke.value,
361
- "aria-invalid": !!l.errorMsg || void 0,
362
- "aria-required": l.required || void 0,
385
+ "aria-expanded": T.value,
386
+ "aria-labelledby": u.label || e.$slots["label-icon"] || e.$slots["label-extra"] ? `${k} ${A}` : A,
387
+ "aria-describedby": Me.value,
388
+ "aria-invalid": !!u.errorMsg || void 0,
389
+ "aria-required": u.required || void 0,
363
390
  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", [
364
- l.size === "small" ? "h-9 pl-3" : "h-10.5 pl-4",
365
- l.clearable && S.value ? "pr-20" : "pr-10",
366
- l.disabled ? "" : "cursor-pointer hover:bg-accent-hover",
367
- l.errorMsg ? ["border-danger/60", F.value && "border-danger shadow-[0_0_0_2px_color-mix(in_srgb,var(--color-danger)_20%,transparent)]"] : F.value ? "focus-ring" : ["border-border", !l.disabled && "hover:border-accent-active"]
391
+ u.size === "small" ? "h-9 pl-3" : "h-10.5 pl-4",
392
+ u.clearable && w.value ? "pr-20" : "pr-10",
393
+ u.disabled ? "" : "cursor-pointer hover:bg-accent-hover",
394
+ u.errorMsg ? ["border-danger/60", Oe.value && "border-danger shadow-[0_0_0_2px_color-mix(in_srgb,var(--color-danger)_20%,transparent)]"] : Oe.value ? "focus-ring" : ["border-border", !u.disabled && "hover:border-accent-active"]
368
395
  ]],
369
- onClick: u[0] ||= (e) => C.value ? X() : Ve(),
370
- onKeydown: Ye,
371
- onFocus: u[1] ||= (e) => P.value = !0,
372
- onBlur: u[2] ||= (e) => P.value = !1
373
- }), [s("span", {
374
- id: D,
375
- class: p(["truncate tabular-nums", !V.value && "text-muted/80"])
376
- }, _(V.value || S.value || l.placeholder), 3)], 16, fe), s("span", { class: p(["pointer-events-none absolute inset-y-0 flex items-center gap-4 text-muted", l.size === "small" ? "right-3" : "right-4"]) }, [l.clearable && S.value && !l.disabled ? (m(), o("button", {
396
+ onClick: i[0] ||= (e) => T.value ? J() : Ge(),
397
+ onKeydown: Ze,
398
+ onFocus: i[1] ||= (e) => L.value = !0,
399
+ onBlur: i[2] ||= (e) => L.value = !1
400
+ }), [c("span", {
401
+ id: A,
402
+ class: m(["truncate tabular-nums", !je.value && "text-muted/80"])
403
+ }, y(je.value || w.value || u.placeholder), 3)], 16, fe), c("span", { class: m(["pointer-events-none absolute inset-y-0 flex items-center gap-4 text-muted", u.size === "small" ? "right-3" : "right-4"]) }, [u.clearable && w.value && !u.disabled ? (h(), s("button", {
377
404
  key: 0,
378
405
  type: "button",
379
406
  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",
380
- "aria-label": l.label ? `Clear ${l.label}` : "Clear",
381
- onClick: Be
382
- }, [c(v(ce), {
407
+ "aria-label": u.label ? `Clear ${u.label}` : "Clear",
408
+ onClick: We
409
+ }, [l(b(se), {
383
410
  class: "size-4",
384
411
  "aria-hidden": "true"
385
- })], 8, pe)) : a("", !0), c(v(se), {
386
- class: p(["size-4", C.value && "text-heading"]),
412
+ })], 8, pe)) : o("", !0), l(b(oe), {
413
+ class: m(["size-4", T.value && "text-heading"]),
387
414
  "aria-hidden": "true"
388
- }, null, 8, ["class"])], 2)]),
389
- l.errorMsg ? (m(), o("p", {
390
- key: 2,
391
- id: O,
392
- class: "mt-1 text-base text-danger-strong",
393
- role: "alert"
394
- }, _(l.errorMsg), 1)) : a("", !0),
395
- l.name ? (m(), o("input", {
396
- key: 3,
397
- type: "hidden",
398
- name: l.name,
399
- value: S.value ?? ""
400
- }, null, 8, me)) : a("", !0),
401
- (m(), i(t, { to: "body" }, [c(n, {
415
+ }, null, 8, ["class"])], 2)])),
416
+ (h(), a(n, {
417
+ to: "body",
418
+ disabled: u.inline
419
+ }, [l(r, {
402
420
  "enter-active-class": "transition duration-150 ease-out motion-reduce:transition-opacity",
403
421
  "enter-from-class": "opacity-0 scale-95",
404
422
  "leave-active-class": "transition duration-100 ease-in",
405
423
  "leave-to-class": "opacity-0"
406
424
  }, {
407
- default: oe(() => [C.value ? (m(), o("div", {
425
+ default: ae(() => [T.value || u.inline ? (h(), s("div", f({
408
426
  key: 0,
409
427
  ref_key: "panel",
410
- ref: M,
411
- role: "dialog",
412
- "aria-modal": "true",
413
- "aria-label": Ae.value,
414
- class: "fixed z-[90] flex max-w-[calc(100vw-16px)] flex-col overflow-hidden rounded-10 border border-border bg-surface p-3 shadow-sm",
415
- style: ee({
416
- top: N.value.top === void 0 ? void 0 : `${N.value.top}px`,
417
- bottom: N.value.bottom === void 0 ? void 0 : `${N.value.bottom}px`,
418
- left: `${N.value.left}px`,
419
- maxHeight: `${N.value.maxHeight}px`,
420
- minWidth: `${N.value.minWidth}px`
421
- }),
428
+ ref: F,
429
+ role: u.inline ? "group" : "dialog",
430
+ "aria-modal": u.inline ? void 0 : "true",
431
+ "aria-label": Ne.value,
432
+ "aria-describedby": u.inline ? Me.value : void 0,
433
+ inert: u.inline && u.disabled
434
+ }, u.inline ? O.value : void 0, {
435
+ class: ["flex flex-col overflow-hidden p-3", !u.inline && "fixed z-[90] max-w-[calc(100vw-16px)] rounded-10 border border-border bg-surface shadow-sm"],
436
+ style: u.inline ? void 0 : {
437
+ top: I.value.top === void 0 ? void 0 : `${I.value.top}px`,
438
+ bottom: I.value.bottom === void 0 ? void 0 : `${I.value.bottom}px`,
439
+ left: `${I.value.left}px`,
440
+ maxHeight: `${I.value.maxHeight}px`,
441
+ minWidth: `${I.value.minWidth}px`
442
+ },
422
443
  "data-ac-ds": "",
423
444
  "data-testid": "ac-time-picker-panel",
424
- onKeydown: Je
425
- }, [s("div", ge, [(m(!0), o(e, null, g(H.value, (t, n) => (m(), o(e, { key: t.unit }, [t.unit === "p" ? (m(), o("span", _e)) : n > 0 ? (m(), o("span", ve, ":")) : a("", !0), s("div", {
445
+ onKeydown: Xe
446
+ }), [c("div", he, [(h(!0), s(t, null, _(Fe.value, (e, n) => (h(), s(t, { key: e.unit }, [e.unit === "p" ? (h(), s("span", ge)) : n > 0 ? (h(), s("span", _e, ":")) : o("", !0), c("div", {
426
447
  class: "flex h-full min-w-14 flex-1 flex-col items-center",
427
448
  "data-col": n
428
- }, [s("span", be, _(t.heading), 1), s("div", {
449
+ }, [c("span", ye, y(e.heading), 1), c("div", {
429
450
  role: "listbox",
430
- "aria-label": t.name,
451
+ "aria-label": e.name,
431
452
  class: "relative min-h-0 w-full flex-1 scroll-smooth overflow-y-auto [scrollbar-width:none] motion-reduce:scroll-auto [&::-webkit-scrollbar]:hidden",
432
- onKeydown: (e) => qe(e, n, t)
433
- }, [s("div", Se, [(m(!0), o(e, null, g(t.cells, (e) => (m(), o("button", {
434
- key: e.value,
453
+ onKeydown: (t) => Ye(t, n, e)
454
+ }, [c("div", xe, [(h(!0), s(t, null, _(e.cells, (t) => (h(), s("button", {
455
+ key: t.value,
435
456
  type: "button",
436
- "data-value": e.value,
457
+ "data-value": t.value,
437
458
  role: "option",
438
- tabindex: Ge(t, e),
439
- "aria-selected": e.value === t.selected,
440
- "aria-disabled": e.disabled,
441
- class: p(["inline-flex h-10 shrink-0 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.unit === "p" ? "w-12 text-xs font-bold" : "w-10 text-base", e.disabled ? "cursor-not-allowed text-muted/50 line-through" : e.value === t.selected ? ["cursor-pointer bg-primary text-white", t.unit !== "p" && "scale-110 font-bold"] : "cursor-pointer text-heading hover:bg-accent-hover hover:font-bold active:bg-accent-active"]]),
442
- onClick: (r) => Ke(n, t, e)
443
- }, _(e.text), 11, Ce))), 128))])], 40, xe)], 8, ye)], 64))), 128))]), s("div", we, [s("button", {
459
+ tabindex: qe(e, t),
460
+ "aria-selected": t.value === e.selected,
461
+ "aria-disabled": t.disabled,
462
+ class: m(["inline-flex h-10 shrink-0 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", [e.unit === "p" ? "w-12 text-xs font-bold" : "w-10 text-base", t.disabled ? "cursor-not-allowed text-muted/50 line-through" : t.value === e.selected ? ["cursor-pointer bg-primary text-white", e.unit !== "p" && "scale-110 font-bold"] : "cursor-pointer text-heading hover:bg-accent-hover hover:font-bold active:bg-accent-active"]]),
463
+ onClick: (r) => Je(n, e, t)
464
+ }, y(t.text), 11, Se))), 128))])], 40, be)], 8, ve)], 64))), 128))]), c("div", Ce, [c("button", {
444
465
  type: "button",
445
466
  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",
446
- disabled: !je.value,
447
- onClick: ze
448
- }, " Current time ", 8, Te)])], 44, he)) : a("", !0)]),
467
+ disabled: !Pe.value,
468
+ onClick: Ue
469
+ }, " Current time ", 8, we)])], 16, me)) : o("", !0)]),
449
470
  _: 1
450
- })]))
471
+ })], 8, ["disabled"])),
472
+ u.errorMsg ? (h(), s("p", {
473
+ key: 3,
474
+ id: j,
475
+ class: "mt-1 text-base text-danger-strong",
476
+ role: "alert"
477
+ }, y(u.errorMsg), 1)) : o("", !0),
478
+ u.name ? (h(), s("input", {
479
+ key: 4,
480
+ type: "hidden",
481
+ name: u.name,
482
+ value: w.value ?? ""
483
+ }, null, 8, Te)) : o("", !0)
451
484
  ], 16));
452
485
  }
453
486
  });
454
487
  //#endregion
455
- export { x as default };
488
+ export { C as default };