@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.
- package/dist/lib/compat.css +210 -0
- package/dist/lib/components/AcButton.vue.d.ts +18 -12
- package/dist/lib/components/AcButton.vue_vue_type_script_setup_true_lang.js +62 -32
- package/dist/lib/components/AcCard.vue.d.ts +11 -5
- package/dist/lib/components/AcCard.vue_vue_type_script_setup_true_lang.js +99 -51
- package/dist/lib/components/AcColorInput.vue.d.ts +1 -1
- package/dist/lib/components/AcDatePicker.vue.d.ts +27 -3
- package/dist/lib/components/AcDatePicker.vue_vue_type_script_setup_true_lang.js +432 -369
- package/dist/lib/components/AcErrorState.vue.d.ts +1 -1
- package/dist/lib/components/AcHeader.vue.d.ts +1 -1
- package/dist/lib/components/AcInput.vue.d.ts +28 -7
- package/dist/lib/components/AcInput.vue_vue_type_script_setup_true_lang.js +149 -80
- package/dist/lib/components/AcKeyValueInput.vue.d.ts +1 -1
- package/dist/lib/components/AcLocaleSwitcher.vue.d.ts +6 -0
- package/dist/lib/components/AcLocaleSwitcher.vue_vue_type_script_setup_true_lang.js +74 -58
- package/dist/lib/components/AcNavbar.vue.d.ts +2 -0
- package/dist/lib/components/AcNavbar.vue_vue_type_script_setup_true_lang.js +31 -25
- package/dist/lib/components/AcNumberInput.vue.d.ts +1 -1
- package/dist/lib/components/AcRadioCard.js +5 -0
- package/dist/lib/components/AcRadioCard.vue.d.ts +55 -0
- package/dist/lib/components/AcRadioCard.vue_vue_type_script_setup_true_lang.js +135 -0
- package/dist/lib/components/AcSelect.vue.d.ts +12 -1
- package/dist/lib/components/AcSelect.vue_vue_type_script_setup_true_lang.js +190 -174
- package/dist/lib/components/AcSidebar.vue.d.ts +9 -0
- package/dist/lib/components/AcSidebar.vue_vue_type_script_setup_true_lang.js +113 -94
- package/dist/lib/components/AcSidebarSection.vue_vue_type_script_setup_true_lang.js +19 -18
- package/dist/lib/components/AcSlider.vue.d.ts +1 -1
- package/dist/lib/components/AcTable.vue.d.ts +13 -1
- package/dist/lib/components/AcTable.vue_vue_type_script_setup_true_lang.js +106 -86
- package/dist/lib/components/AcTagInput.vue.d.ts +1 -1
- package/dist/lib/components/AcTextarea.vue.d.ts +30 -4
- package/dist/lib/components/AcTextarea.vue_vue_type_script_setup_true_lang.js +92 -61
- package/dist/lib/components/AcThemeMode.vue.d.ts +10 -2
- package/dist/lib/components/AcThemeMode.vue_vue_type_script_setup_true_lang.js +53 -42
- package/dist/lib/components/AcTimePicker.vue.d.ts +21 -3
- package/dist/lib/components/AcTimePicker.vue_vue_type_script_setup_true_lang.js +206 -174
- package/dist/lib/components/AcUserMenu.vue.d.ts +8 -0
- package/dist/lib/components/AcUserMenu.vue_vue_type_script_setup_true_lang.js +126 -109
- package/dist/lib/components/index.d.ts +1 -0
- package/dist/lib/components/types.d.ts +2 -0
- package/dist/lib/index.js +34 -33
- package/package.json +1 -1
|
@@ -1,12 +1,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,
|
|
3
|
-
import { Clock as
|
|
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
|
|
6
|
-
key:
|
|
5
|
+
var ce = ["for"], le = { key: 0 }, ue = {
|
|
6
|
+
key: 1,
|
|
7
7
|
class: "text-danger",
|
|
8
8
|
"aria-hidden": "true"
|
|
9
|
-
}, de = {
|
|
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 = [
|
|
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
|
-
},
|
|
30
|
+
}, _e = {
|
|
22
31
|
key: 1,
|
|
23
32
|
class: "mt-6 self-center font-bold text-heading/50",
|
|
24
33
|
"aria-hidden": "true"
|
|
25
|
-
},
|
|
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
|
-
},
|
|
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
|
-
],
|
|
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
|
|
76
|
-
class:
|
|
77
|
-
style:
|
|
78
|
-
})),
|
|
79
|
-
let { class: e, style: t, ...n } =
|
|
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
|
-
}),
|
|
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
|
-
}),
|
|
86
|
-
let e =
|
|
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) :
|
|
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:
|
|
108
|
-
disabled: !
|
|
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 ??
|
|
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:
|
|
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:
|
|
122
|
-
disabled: !
|
|
134
|
+
text: V(e),
|
|
135
|
+
disabled: !K(t, C.showSeconds ? t + 59 : t)
|
|
123
136
|
};
|
|
124
137
|
})
|
|
125
|
-
}),
|
|
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:
|
|
145
|
+
cells: H(0, 59, 1).map((e) => ({
|
|
133
146
|
value: e,
|
|
134
|
-
text:
|
|
135
|
-
disabled: !
|
|
147
|
+
text: V(e),
|
|
148
|
+
disabled: !G(o * 3600 + t * 60 + e)
|
|
136
149
|
}))
|
|
137
150
|
});
|
|
138
151
|
}
|
|
139
|
-
return
|
|
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: !
|
|
160
|
+
disabled: !K(0, 43199)
|
|
148
161
|
}, {
|
|
149
162
|
value: 12,
|
|
150
163
|
text: "PM",
|
|
151
|
-
disabled: !
|
|
164
|
+
disabled: !K(43200, S)
|
|
152
165
|
}]
|
|
153
166
|
}), i;
|
|
154
167
|
});
|
|
155
|
-
function
|
|
168
|
+
function V(e) {
|
|
156
169
|
return String(e).padStart(2, "0");
|
|
157
170
|
}
|
|
158
|
-
function
|
|
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
|
|
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
|
|
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
|
|
181
|
-
let { h: t, m: n, s: r } =
|
|
182
|
-
return
|
|
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
|
|
185
|
-
let { h: t, m: n, s: r } =
|
|
186
|
-
return
|
|
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
|
|
189
|
-
return e >=
|
|
201
|
+
function G(e) {
|
|
202
|
+
return e >= z.value && e <= ke.value;
|
|
190
203
|
}
|
|
191
|
-
function
|
|
192
|
-
return t >=
|
|
204
|
+
function K(e, t) {
|
|
205
|
+
return t >= z.value && e <= ke.value;
|
|
193
206
|
}
|
|
194
|
-
function
|
|
195
|
-
return Math.floor(
|
|
207
|
+
function Re() {
|
|
208
|
+
return Math.floor(z.value / 3600);
|
|
196
209
|
}
|
|
197
|
-
function
|
|
198
|
-
let e = /* @__PURE__ */ new Date(), t = Math.max(1,
|
|
199
|
-
return e.getHours() * 3600 + n * 60 + (
|
|
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
|
|
202
|
-
if (
|
|
203
|
-
let { h: t } =
|
|
204
|
-
for (let e = t * 3600; e < (t + 1) * 3600; e += n) if (
|
|
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(
|
|
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
|
|
210
|
-
let { m: t, s: n } =
|
|
211
|
-
return t % Math.max(1,
|
|
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
|
|
214
|
-
|
|
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 =
|
|
217
|
-
a !== null && (
|
|
230
|
+
let a = Be(n * 3600 + r * 60 + (C.showSeconds ? i : 0));
|
|
231
|
+
a !== null && (w.value = Ie(a));
|
|
218
232
|
}
|
|
219
|
-
function
|
|
220
|
-
C.value =
|
|
233
|
+
function Ue() {
|
|
234
|
+
C.disabled || (w.value = Ie(ze()), p(() => X("smooth")));
|
|
221
235
|
}
|
|
222
|
-
function
|
|
223
|
-
|
|
236
|
+
function We() {
|
|
237
|
+
w.value = null, P.value?.focus();
|
|
224
238
|
}
|
|
225
|
-
function
|
|
226
|
-
let t =
|
|
239
|
+
function q() {
|
|
240
|
+
let t = P.value;
|
|
227
241
|
if (!t) return;
|
|
228
|
-
let n = t.getBoundingClientRect(), r = e(), i =
|
|
229
|
-
|
|
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
|
|
242
|
-
|
|
255
|
+
function Ge() {
|
|
256
|
+
C.disabled || T.value || (T.value = !0);
|
|
243
257
|
}
|
|
244
|
-
function
|
|
245
|
-
|
|
258
|
+
function J(e = !0) {
|
|
259
|
+
T.value && (T.value = !1, e && P.value?.focus());
|
|
246
260
|
}
|
|
247
|
-
async function
|
|
248
|
-
|
|
261
|
+
async function Y() {
|
|
262
|
+
q(), $e(), await p(), q(), X("instant"), Z(0);
|
|
249
263
|
}
|
|
250
|
-
function
|
|
264
|
+
function X(e) {
|
|
251
265
|
let t = e === "smooth" && !window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
252
|
-
|
|
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
|
|
261
|
-
return [...
|
|
274
|
+
function Ke(e) {
|
|
275
|
+
return [...F.value?.querySelectorAll(`[data-col="${e}"] [role=option]`) ?? []];
|
|
262
276
|
}
|
|
263
|
-
function
|
|
264
|
-
let t =
|
|
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
|
|
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
|
|
271
|
-
n.disabled || (
|
|
272
|
-
|
|
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
|
|
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 <
|
|
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 &&
|
|
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
|
-
|
|
315
|
+
Je(t, n, o);
|
|
302
316
|
}
|
|
303
|
-
function
|
|
317
|
+
function Xe(e) {
|
|
318
|
+
if (C.inline) return;
|
|
304
319
|
if (e.key === "Escape") {
|
|
305
|
-
e.preventDefault(), e.stopPropagation(),
|
|
320
|
+
e.preventDefault(), e.stopPropagation(), J();
|
|
306
321
|
return;
|
|
307
322
|
}
|
|
308
|
-
if (e.key !== "Tab" || !
|
|
309
|
-
let t = [...
|
|
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
|
-
|
|
334
|
+
N.value?.contains(t) || F.value?.contains(t) || J(!1);
|
|
320
335
|
}
|
|
321
336
|
function Q(e) {
|
|
322
|
-
e?.target instanceof Node &&
|
|
337
|
+
e?.target instanceof Node && F.value?.contains(e.target) || q();
|
|
323
338
|
}
|
|
324
|
-
function
|
|
325
|
-
document.addEventListener("pointerdown",
|
|
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",
|
|
343
|
+
document.removeEventListener("pointerdown", Qe, !0), window.removeEventListener("scroll", Q, !0), window.removeEventListener("resize", Q);
|
|
329
344
|
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
}
|
|
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:
|
|
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:
|
|
343
|
-
for: `${
|
|
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
|
-
}, [
|
|
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:
|
|
374
|
+
id: M,
|
|
349
375
|
class: "mb-2 text-base text-muted"
|
|
350
|
-
},
|
|
351
|
-
|
|
352
|
-
id: `${
|
|
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:
|
|
355
|
-
},
|
|
380
|
+
ref: P
|
|
381
|
+
}, O.value, {
|
|
356
382
|
type: "button",
|
|
357
383
|
disabled: u.disabled,
|
|
358
384
|
"aria-haspopup": "dialog",
|
|
359
|
-
"aria-expanded":
|
|
360
|
-
"aria-labelledby": u.label ? `${
|
|
361
|
-
"aria-describedby":
|
|
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 &&
|
|
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",
|
|
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) =>
|
|
371
|
-
onKeydown:
|
|
372
|
-
onFocus: i[1] ||= (e) =>
|
|
373
|
-
onBlur: i[2] ||= (e) =>
|
|
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:
|
|
376
|
-
class: m(["truncate tabular-nums", !
|
|
377
|
-
},
|
|
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:
|
|
383
|
-
}, [l(
|
|
408
|
+
onClick: We
|
|
409
|
+
}, [l(b(se), {
|
|
384
410
|
class: "size-4",
|
|
385
411
|
"aria-hidden": "true"
|
|
386
|
-
})], 8, pe)) : o("", !0), l(
|
|
387
|
-
class: m(["size-4",
|
|
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
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
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:
|
|
425
|
+
default: ae(() => [T.value || u.inline ? (h(), s("div", f({
|
|
409
426
|
key: 0,
|
|
410
427
|
ref_key: "panel",
|
|
411
|
-
ref:
|
|
412
|
-
role: "dialog",
|
|
413
|
-
"aria-modal": "true",
|
|
414
|
-
"aria-label":
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
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:
|
|
426
|
-
}, [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",
|
|
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) =>
|
|
434
|
-
}, [c("div",
|
|
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:
|
|
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) =>
|
|
444
|
-
},
|
|
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: !
|
|
448
|
-
onClick:
|
|
449
|
-
}, " Current time ", 8,
|
|
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 {
|
|
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;
|