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