@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.
- package/dist/lib/charts/ChartFrame.vue_vue_type_script_setup_true_lang.js +89 -88
- package/dist/lib/compat.css +210 -0
- package/dist/lib/components/AcAppSwitcher.vue_vue_type_script_setup_true_lang.js +74 -73
- 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/AcClusterSwitcher.vue_vue_type_script_setup_true_lang.js +151 -150
- 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 +518 -454
- package/dist/lib/components/AcDropdown.vue_vue_type_script_setup_true_lang.js +56 -55
- package/dist/lib/components/AcErrorState.vue.d.ts +1 -1
- package/dist/lib/components/AcFormFooter.vue_vue_type_script_setup_true_lang.js +39 -38
- 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/AcModal.vue_vue_type_script_setup_true_lang.js +3 -1
- package/dist/lib/components/AcNavbar.vue.d.ts +2 -0
- package/dist/lib/components/AcNavbar.vue_vue_type_script_setup_true_lang.js +31 -25
- package/dist/lib/components/AcNotificationMenu.vue_vue_type_script_setup_true_lang.js +90 -89
- 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 +237 -220
- package/dist/lib/components/AcSidePanel.vue_vue_type_script_setup_true_lang.js +3 -1
- package/dist/lib/components/AcSideTabs.vue.d.ts +1 -1
- package/dist/lib/components/AcSidebar.vue.d.ts +9 -0
- package/dist/lib/components/AcSidebar.vue_vue_type_script_setup_true_lang.js +113 -94
- package/dist/lib/components/AcSidebarSection.vue_vue_type_script_setup_true_lang.js +19 -18
- package/dist/lib/components/AcSlider.vue.d.ts +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 +234 -201
- package/dist/lib/components/AcTooltip.vue_vue_type_script_setup_true_lang.js +73 -72
- package/dist/lib/components/AcUserMenu.vue.d.ts +8 -0
- package/dist/lib/components/AcUserMenu.vue_vue_type_script_setup_true_lang.js +125 -107
- package/dist/lib/components/fixedFrame.d.ts +11 -0
- package/dist/lib/components/fixedFrame.js +24 -0
- 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,11 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
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
|
|
5
|
-
key:
|
|
5
|
+
var ce = ["for"], le = { key: 0 }, ue = {
|
|
6
|
+
key: 1,
|
|
6
7
|
class: "text-danger",
|
|
7
8
|
"aria-hidden": "true"
|
|
8
|
-
}, de = {
|
|
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 = [
|
|
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
|
-
},
|
|
30
|
+
}, _e = {
|
|
21
31
|
key: 1,
|
|
22
32
|
class: "mt-6 self-center font-bold text-heading/50",
|
|
23
33
|
"aria-hidden": "true"
|
|
24
|
-
},
|
|
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
|
-
},
|
|
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
|
-
],
|
|
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__*/
|
|
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(
|
|
74
|
-
let
|
|
75
|
-
class:
|
|
76
|
-
style:
|
|
77
|
-
})),
|
|
78
|
-
let { class: e, style: t, ...n } =
|
|
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
|
-
}),
|
|
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
|
-
}),
|
|
85
|
-
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 ? [
|
|
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) :
|
|
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:
|
|
107
|
-
disabled: !
|
|
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 ??
|
|
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:
|
|
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:
|
|
121
|
-
disabled: !
|
|
134
|
+
text: V(e),
|
|
135
|
+
disabled: !K(t, C.showSeconds ? t + 59 : t)
|
|
122
136
|
};
|
|
123
137
|
})
|
|
124
|
-
}),
|
|
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:
|
|
145
|
+
cells: H(0, 59, 1).map((e) => ({
|
|
132
146
|
value: e,
|
|
133
|
-
text:
|
|
134
|
-
disabled: !
|
|
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: !
|
|
160
|
+
disabled: !K(0, 43199)
|
|
147
161
|
}, {
|
|
148
162
|
value: 12,
|
|
149
163
|
text: "PM",
|
|
150
|
-
disabled: !
|
|
164
|
+
disabled: !K(43200, S)
|
|
151
165
|
}]
|
|
152
166
|
}), i;
|
|
153
167
|
});
|
|
154
|
-
function
|
|
168
|
+
function V(e) {
|
|
155
169
|
return String(e).padStart(2, "0");
|
|
156
170
|
}
|
|
157
|
-
function
|
|
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
|
|
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
|
|
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
|
|
180
|
-
let { h: t, m: n, s: r } =
|
|
181
|
-
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)}`;
|
|
182
196
|
}
|
|
183
|
-
function
|
|
184
|
-
let { h: t, m: n, s: r } =
|
|
185
|
-
return B.value ? `${
|
|
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
|
|
188
|
-
return e >=
|
|
201
|
+
function G(e) {
|
|
202
|
+
return e >= z.value && e <= ke.value;
|
|
189
203
|
}
|
|
190
|
-
function
|
|
191
|
-
return t >=
|
|
204
|
+
function K(e, t) {
|
|
205
|
+
return t >= z.value && e <= ke.value;
|
|
192
206
|
}
|
|
193
|
-
function
|
|
194
|
-
return Math.floor(
|
|
207
|
+
function Re() {
|
|
208
|
+
return Math.floor(z.value / 3600);
|
|
195
209
|
}
|
|
196
|
-
function
|
|
197
|
-
let e = /* @__PURE__ */ new Date(), t = Math.max(1,
|
|
198
|
-
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);
|
|
199
213
|
}
|
|
200
|
-
function
|
|
201
|
-
if (
|
|
202
|
-
let { h: t } =
|
|
203
|
-
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);
|
|
204
218
|
else r.push(e);
|
|
205
|
-
let i = r.filter(
|
|
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
|
|
209
|
-
let { m: t, s: n } =
|
|
210
|
-
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);
|
|
211
225
|
}
|
|
212
|
-
function
|
|
213
|
-
|
|
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 =
|
|
216
|
-
a !== null && (
|
|
230
|
+
let a = Be(n * 3600 + r * 60 + (C.showSeconds ? i : 0));
|
|
231
|
+
a !== null && (w.value = Ie(a));
|
|
217
232
|
}
|
|
218
|
-
function
|
|
219
|
-
|
|
220
|
-
}
|
|
221
|
-
function
|
|
222
|
-
|
|
223
|
-
}
|
|
224
|
-
function
|
|
225
|
-
let
|
|
226
|
-
if (!
|
|
227
|
-
let
|
|
228
|
-
|
|
229
|
-
bottom:
|
|
230
|
-
left:
|
|
231
|
-
maxHeight: Math.max(200,
|
|
232
|
-
minWidth:
|
|
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:
|
|
235
|
-
left:
|
|
236
|
-
maxHeight: Math.max(200,
|
|
237
|
-
minWidth:
|
|
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
|
|
241
|
-
|
|
255
|
+
function Ge() {
|
|
256
|
+
C.disabled || T.value || (T.value = !0);
|
|
242
257
|
}
|
|
243
|
-
function
|
|
244
|
-
|
|
258
|
+
function J(e = !0) {
|
|
259
|
+
T.value && (T.value = !1, e && P.value?.focus());
|
|
245
260
|
}
|
|
246
|
-
async function
|
|
247
|
-
|
|
261
|
+
async function Y() {
|
|
262
|
+
q(), $e(), await p(), q(), X("instant"), Z(0);
|
|
248
263
|
}
|
|
249
|
-
function
|
|
264
|
+
function X(e) {
|
|
250
265
|
let t = e === "smooth" && !window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
251
|
-
|
|
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
|
|
260
|
-
return [...
|
|
274
|
+
function Ke(e) {
|
|
275
|
+
return [...F.value?.querySelectorAll(`[data-col="${e}"] [role=option]`) ?? []];
|
|
261
276
|
}
|
|
262
|
-
function
|
|
263
|
-
let t =
|
|
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
|
|
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
|
|
270
|
-
n.disabled || (
|
|
271
|
-
|
|
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
|
|
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 <
|
|
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 &&
|
|
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
|
-
|
|
315
|
+
Je(t, n, o);
|
|
301
316
|
}
|
|
302
|
-
function
|
|
317
|
+
function Xe(e) {
|
|
318
|
+
if (C.inline) return;
|
|
303
319
|
if (e.key === "Escape") {
|
|
304
|
-
e.preventDefault(), e.stopPropagation(),
|
|
320
|
+
e.preventDefault(), e.stopPropagation(), J();
|
|
305
321
|
return;
|
|
306
322
|
}
|
|
307
|
-
if (e.key !== "Tab" || !
|
|
308
|
-
let t = [...
|
|
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
|
|
314
|
-
(e.key === "ArrowDown" || e.key === "ArrowUp" && e.altKey) && (e.preventDefault(),
|
|
329
|
+
function Ze(e) {
|
|
330
|
+
(e.key === "ArrowDown" || e.key === "ArrowUp" && e.altKey) && (e.preventDefault(), Ge());
|
|
315
331
|
}
|
|
316
|
-
function
|
|
332
|
+
function Qe(e) {
|
|
317
333
|
let t = e.target;
|
|
318
|
-
|
|
334
|
+
N.value?.contains(t) || F.value?.contains(t) || J(!1);
|
|
319
335
|
}
|
|
320
336
|
function Q(e) {
|
|
321
|
-
e?.target instanceof Node &&
|
|
337
|
+
e?.target instanceof Node && F.value?.contains(e.target) || q();
|
|
322
338
|
}
|
|
323
|
-
function
|
|
324
|
-
document.addEventListener("pointerdown",
|
|
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",
|
|
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
|
|
330
|
-
C.value &&
|
|
331
|
-
}),
|
|
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:
|
|
355
|
+
ref: N
|
|
334
356
|
}, De.value, {
|
|
335
|
-
class: ["w-full",
|
|
357
|
+
class: ["w-full", u.disabled && "opacity-50"],
|
|
336
358
|
"data-ac-ds": "",
|
|
337
359
|
"data-testid": "ac-time-picker"
|
|
338
360
|
}), [
|
|
339
|
-
|
|
361
|
+
u.label || e.$slots["label-icon"] || e.$slots["label-extra"] ? (h(), s("label", {
|
|
340
362
|
key: 0,
|
|
341
|
-
id:
|
|
342
|
-
for: `${
|
|
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
|
-
}, [
|
|
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),
|
|
372
|
+
u.hint ? (h(), s("p", {
|
|
346
373
|
key: 1,
|
|
347
|
-
id:
|
|
374
|
+
id: M,
|
|
348
375
|
class: "mb-2 text-base text-muted"
|
|
349
|
-
},
|
|
350
|
-
s("div", de, [
|
|
351
|
-
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`,
|
|
352
379
|
ref_key: "trigger",
|
|
353
|
-
ref:
|
|
354
|
-
},
|
|
380
|
+
ref: P
|
|
381
|
+
}, O.value, {
|
|
355
382
|
type: "button",
|
|
356
|
-
disabled:
|
|
383
|
+
disabled: u.disabled,
|
|
357
384
|
"aria-haspopup": "dialog",
|
|
358
|
-
"aria-expanded":
|
|
359
|
-
"aria-labelledby":
|
|
360
|
-
"aria-describedby":
|
|
361
|
-
"aria-invalid": !!
|
|
362
|
-
"aria-required":
|
|
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
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
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:
|
|
370
|
-
onKeydown:
|
|
371
|
-
onFocus:
|
|
372
|
-
onBlur:
|
|
373
|
-
}), [
|
|
374
|
-
id:
|
|
375
|
-
class:
|
|
376
|
-
},
|
|
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":
|
|
381
|
-
onClick:
|
|
382
|
-
}, [
|
|
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)) :
|
|
386
|
-
class:
|
|
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
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
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:
|
|
425
|
+
default: ae(() => [T.value || u.inline ? (h(), s("div", f({
|
|
408
426
|
key: 0,
|
|
409
427
|
ref_key: "panel",
|
|
410
|
-
ref:
|
|
411
|
-
role: "dialog",
|
|
412
|
-
"aria-modal": "true",
|
|
413
|
-
"aria-label":
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
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:
|
|
425
|
-
}, [
|
|
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
|
-
}, [
|
|
449
|
+
}, [c("span", ye, y(e.heading), 1), c("div", {
|
|
429
450
|
role: "listbox",
|
|
430
|
-
"aria-label":
|
|
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: (
|
|
433
|
-
}, [
|
|
434
|
-
key:
|
|
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":
|
|
457
|
+
"data-value": t.value,
|
|
437
458
|
role: "option",
|
|
438
|
-
tabindex:
|
|
439
|
-
"aria-selected":
|
|
440
|
-
"aria-disabled":
|
|
441
|
-
class:
|
|
442
|
-
onClick: (r) =>
|
|
443
|
-
},
|
|
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: !
|
|
447
|
-
onClick:
|
|
448
|
-
}, " Current time ", 8,
|
|
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 {
|
|
488
|
+
export { C as default };
|