@ac-design/design-system 2.2.1 → 2.3.0

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