@ac-design/design-system 1.0.2 → 2.0.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/README.md +27 -18
- package/dist/lib/charts/ChartFrame.js +5 -0
- package/dist/lib/charts/ChartFrame.vue.d.ts +69 -0
- package/dist/lib/charts/ChartFrame.vue_vue_type_script_setup_true_lang.js +168 -0
- package/dist/lib/charts/index.d.ts +7 -0
- package/dist/lib/charts/index.js +5 -0
- package/dist/lib/charts/shared.d.ts +60 -0
- package/dist/lib/charts/shared.js +114 -0
- package/dist/lib/charts/xy.d.ts +65 -0
- package/dist/lib/charts/xy.js +92 -0
- package/dist/lib/compat.css +1707 -1042
- package/dist/lib/components/AcAccordion.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/lib/components/AcAccordionItem.vue.d.ts +1 -1
- package/dist/lib/components/AcAccordionItem.vue_vue_type_script_setup_true_lang.js +5 -5
- package/dist/lib/components/AcAlert.vue.d.ts +1 -1
- package/dist/lib/components/AcAlert.vue_vue_type_script_setup_true_lang.js +19 -25
- package/dist/lib/components/AcAppSwitcher.vue_vue_type_script_setup_true_lang.js +19 -19
- package/dist/lib/components/AcAreaChart.js +5 -0
- package/dist/lib/components/AcAreaChart.vue.d.ts +44 -0
- package/dist/lib/components/AcAreaChart.vue_vue_type_script_setup_true_lang.js +215 -0
- package/dist/lib/components/AcAvatar.vue_vue_type_script_setup_true_lang.js +8 -8
- package/dist/lib/components/AcBadge.vue.d.ts +16 -7
- package/dist/lib/components/AcBadge.vue_vue_type_script_setup_true_lang.js +59 -43
- package/dist/lib/components/AcBanner.vue.d.ts +1 -1
- package/dist/lib/components/AcBanner.vue_vue_type_script_setup_true_lang.js +30 -30
- package/dist/lib/components/AcBarChart.js +5 -0
- package/dist/lib/components/AcBarChart.vue.d.ts +43 -0
- package/dist/lib/components/AcBarChart.vue_vue_type_script_setup_true_lang.js +217 -0
- package/dist/lib/components/AcBreadcrumb.vue_vue_type_script_setup_true_lang.js +27 -26
- package/dist/lib/components/AcBulkActionBar.js +5 -0
- package/dist/lib/components/AcBulkActionBar.vue.d.ts +43 -0
- package/dist/lib/components/AcBulkActionBar.vue_vue_type_script_setup_true_lang.js +84 -0
- package/dist/lib/components/AcButton.vue.d.ts +3 -3
- package/dist/lib/components/AcButton.vue_vue_type_script_setup_true_lang.js +42 -34
- package/dist/lib/components/AcButtons.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/lib/components/AcCard.vue.d.ts +10 -2
- package/dist/lib/components/AcCard.vue_vue_type_script_setup_true_lang.js +37 -11
- package/dist/lib/components/AcCellValue.vue.d.ts +4 -1
- package/dist/lib/components/AcCellValue.vue_vue_type_script_setup_true_lang.js +214 -179
- package/dist/lib/components/AcCheckBox.vue.d.ts +17 -3
- package/dist/lib/components/AcCheckBox.vue_vue_type_script_setup_true_lang.js +126 -29
- package/dist/lib/components/AcCheckRadio.vue.d.ts +1 -1
- package/dist/lib/components/AcCheckRadio.vue_vue_type_script_setup_true_lang.js +33 -21
- package/dist/lib/components/AcCircularProgress.js +5 -0
- package/dist/lib/components/AcCircularProgress.vue.d.ts +44 -0
- package/dist/lib/components/AcCircularProgress.vue_vue_type_script_setup_true_lang.js +111 -0
- package/dist/lib/components/AcClusterSwitcher.vue_vue_type_script_setup_true_lang.js +142 -167
- package/dist/lib/components/AcCodeEditor.vue_vue_type_script_setup_true_lang.js +9 -9
- package/dist/lib/components/AcColorInput.js +5 -0
- package/dist/lib/components/AcColorInput.vue.d.ts +54 -0
- package/dist/lib/components/AcColorInput.vue_vue_type_script_setup_true_lang.js +187 -0
- package/dist/lib/components/AcConfirmModal.js +5 -0
- package/dist/lib/components/AcConfirmModal.vue.d.ts +56 -0
- package/dist/lib/components/AcConfirmModal.vue_vue_type_script_setup_true_lang.js +92 -0
- package/dist/lib/components/AcContentHeader.vue.d.ts +1 -1
- package/dist/lib/components/AcContentHeader.vue_vue_type_script_setup_true_lang.js +5 -4
- package/dist/lib/components/AcContentLayout.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/lib/components/AcCopyButton.js +5 -0
- package/dist/lib/components/AcCopyButton.vue.d.ts +43 -0
- package/dist/lib/components/AcCopyButton.vue_vue_type_script_setup_true_lang.js +92 -0
- package/dist/lib/components/AcDatePicker.vue.d.ts +5 -5
- package/dist/lib/components/AcDatePicker.vue_vue_type_script_setup_true_lang.js +204 -213
- package/dist/lib/components/AcDeleteModal.vue.d.ts +4 -4
- package/dist/lib/components/AcDeleteModal.vue_vue_type_script_setup_true_lang.js +37 -46
- package/dist/lib/components/AcDonutChart.js +5 -0
- package/dist/lib/components/AcDonutChart.vue.d.ts +73 -0
- package/dist/lib/components/AcDonutChart.vue_vue_type_script_setup_true_lang.js +210 -0
- package/dist/lib/components/AcDropdown.vue.d.ts +1 -1
- package/dist/lib/components/AcDropdown.vue_vue_type_script_setup_true_lang.js +9 -9
- package/dist/lib/components/AcDropdownDivider.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/lib/components/AcDropdownItem.vue.d.ts +1 -1
- package/dist/lib/components/AcDropdownItem.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/lib/components/AcEmptyState.vue.d.ts +4 -1
- package/dist/lib/components/AcEmptyState.vue_vue_type_script_setup_true_lang.js +50 -39
- package/dist/lib/components/AcFeatureCard.vue_vue_type_script_setup_true_lang.js +14 -13
- package/dist/lib/components/AcFileEditor.vue_vue_type_script_setup_true_lang.js +16 -16
- package/dist/lib/components/AcFileUpload.vue.d.ts +2 -2
- package/dist/lib/components/AcFileUpload.vue_vue_type_script_setup_true_lang.js +55 -53
- package/dist/lib/components/AcFontScale.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/lib/components/AcFooter.js +5 -0
- package/dist/lib/components/AcFooter.vue.d.ts +37 -0
- package/dist/lib/components/AcFooter.vue_vue_type_script_setup_true_lang.js +107 -0
- package/dist/lib/components/AcForm.vue.d.ts +3 -0
- package/dist/lib/components/AcForm.vue_vue_type_script_setup_true_lang.js +4 -2
- package/dist/lib/components/AcFormArray.vue.d.ts +2 -2
- package/dist/lib/components/AcFormArray.vue_vue_type_script_setup_true_lang.js +149 -147
- package/dist/lib/components/AcFormFooter.vue.d.ts +2 -2
- package/dist/lib/components/AcFormFooter.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/lib/components/AcFormSection.vue.d.ts +7 -0
- package/dist/lib/components/AcFormSection.vue_vue_type_script_setup_true_lang.js +31 -21
- package/dist/lib/components/AcHeader.vue.d.ts +3 -3
- package/dist/lib/components/AcHeader.vue_vue_type_script_setup_true_lang.js +22 -22
- package/dist/lib/components/AcInfoTable.vue_vue_type_script_setup_true_lang.js +17 -13
- package/dist/lib/components/AcInput.vue.d.ts +3 -3
- package/dist/lib/components/AcInput.vue_vue_type_script_setup_true_lang.js +98 -87
- package/dist/lib/components/AcKbd.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/lib/components/AcKeyValueInput.js +5 -0
- package/dist/lib/components/AcKeyValueInput.vue.d.ts +114 -0
- package/dist/lib/components/AcKeyValueInput.vue_vue_type_script_setup_true_lang.js +320 -0
- package/dist/lib/components/AcLineChart.js +5 -0
- package/dist/lib/components/AcLineChart.vue.d.ts +38 -0
- package/dist/lib/components/AcLineChart.vue_vue_type_script_setup_true_lang.js +187 -0
- package/dist/lib/components/AcLocaleSwitcher.js +5 -0
- package/dist/lib/components/AcLocaleSwitcher.vue.d.ts +46 -0
- package/dist/lib/components/AcLocaleSwitcher.vue_vue_type_script_setup_true_lang.js +103 -0
- package/dist/lib/components/AcModal.vue_vue_type_script_setup_true_lang.js +23 -23
- package/dist/lib/components/AcNavbar.vue_vue_type_script_setup_true_lang.js +6 -6
- package/dist/lib/components/AcNavbarItem.vue.d.ts +1 -1
- package/dist/lib/components/AcNavbarItem.vue_vue_type_script_setup_true_lang.js +22 -22
- package/dist/lib/components/AcNotificationMenu.vue_vue_type_script_setup_true_lang.js +26 -26
- package/dist/lib/components/AcNumberInput.js +5 -0
- package/dist/lib/components/AcNumberInput.vue.d.ts +79 -0
- package/dist/lib/components/AcNumberInput.vue_vue_type_script_setup_true_lang.js +251 -0
- package/dist/lib/components/AcPage.vue.d.ts +2 -2
- package/dist/lib/components/AcPage.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/lib/components/AcPagination.vue.d.ts +20 -3
- package/dist/lib/components/AcPagination.vue_vue_type_script_setup_true_lang.js +81 -53
- package/dist/lib/components/AcPreloader.vue.d.ts +1 -1
- package/dist/lib/components/AcPreloader.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/lib/components/AcProgress.vue.d.ts +2 -2
- package/dist/lib/components/AcProgress.vue_vue_type_script_setup_true_lang.js +4 -4
- package/dist/lib/components/AcResourceCard.vue.d.ts +2 -2
- package/dist/lib/components/AcResourceCard.vue_vue_type_script_setup_true_lang.js +13 -13
- package/dist/lib/components/AcSearchBar.vue.d.ts +1 -1
- package/dist/lib/components/AcSearchBar.vue_vue_type_script_setup_true_lang.js +9 -8
- package/dist/lib/components/AcSectionContent.vue.d.ts +2 -2
- package/dist/lib/components/AcSectionContent.vue_vue_type_script_setup_true_lang.js +8 -8
- package/dist/lib/components/AcSegmentedControl.vue.d.ts +1 -1
- package/dist/lib/components/AcSegmentedControl.vue_vue_type_script_setup_true_lang.js +4 -4
- package/dist/lib/components/AcSelect.vue.d.ts +4 -4
- package/dist/lib/components/AcSelect.vue_vue_type_script_setup_true_lang.js +230 -227
- package/dist/lib/components/AcSidePanel.vue_vue_type_script_setup_true_lang.js +31 -31
- package/dist/lib/components/AcSideTabs.vue.d.ts +1 -1
- package/dist/lib/components/AcSideTabs.vue_vue_type_script_setup_true_lang.js +37 -37
- package/dist/lib/components/AcSidebar.vue.d.ts +3 -3
- package/dist/lib/components/AcSidebar.vue_vue_type_script_setup_true_lang.js +75 -75
- package/dist/lib/components/AcSidebarItem.vue_vue_type_script_setup_true_lang.js +33 -32
- package/dist/lib/components/AcSidebarSection.vue_vue_type_script_setup_true_lang.js +6 -6
- package/dist/lib/components/AcSkeleton.vue_vue_type_script_setup_true_lang.js +8 -8
- package/dist/lib/components/AcSlider.vue.d.ts +1 -1
- package/dist/lib/components/AcSlider.vue_vue_type_script_setup_true_lang.js +174 -172
- package/dist/lib/components/AcStatCard.vue.d.ts +3 -3
- package/dist/lib/components/AcStatCard.vue_vue_type_script_setup_true_lang.js +90 -85
- package/dist/lib/components/AcStatusBar.vue.d.ts +1 -1
- package/dist/lib/components/AcStatusBar.vue_vue_type_script_setup_true_lang.js +6 -6
- package/dist/lib/components/AcSteps.vue_vue_type_script_setup_true_lang.js +28 -28
- package/dist/lib/components/AcSwitch.vue_vue_type_script_setup_true_lang.js +39 -34
- package/dist/lib/components/AcSwitchCard.js +5 -0
- package/dist/lib/components/AcSwitchCard.vue.d.ts +59 -0
- package/dist/lib/components/AcSwitchCard.vue_vue_type_script_setup_true_lang.js +119 -0
- package/dist/lib/components/AcTable.vue_vue_type_script_setup_true_lang.js +87 -87
- package/dist/lib/components/AcTabs.vue_vue_type_script_setup_true_lang.js +4 -4
- package/dist/lib/components/AcTag.vue.d.ts +1 -1
- package/dist/lib/components/AcTag.vue_vue_type_script_setup_true_lang.js +22 -22
- package/dist/lib/components/AcTagInput.js +5 -0
- package/dist/lib/components/AcTagInput.vue.d.ts +74 -0
- package/dist/lib/components/AcTagInput.vue_vue_type_script_setup_true_lang.js +291 -0
- package/dist/lib/components/AcTextarea.vue.d.ts +3 -3
- package/dist/lib/components/AcTextarea.vue_vue_type_script_setup_true_lang.js +89 -64
- package/dist/lib/components/AcThemeMode.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/lib/components/AcTimePicker.js +5 -0
- package/dist/lib/components/AcTimePicker.vue.d.ts +65 -0
- package/dist/lib/components/AcTimePicker.vue_vue_type_script_setup_true_lang.js +463 -0
- package/dist/lib/components/AcToaster.vue_vue_type_script_setup_true_lang.js +65 -71
- package/dist/lib/components/AcTooltip.vue.d.ts +1 -1
- package/dist/lib/components/AcTooltip.vue_vue_type_script_setup_true_lang.js +77 -67
- package/dist/lib/components/AcUsageCard.vue_vue_type_script_setup_true_lang.js +27 -27
- package/dist/lib/components/AcUserMenu.vue_vue_type_script_setup_true_lang.js +111 -103
- package/dist/lib/components/index.d.ts +14 -2
- package/dist/lib/components/status.d.ts +26 -0
- package/dist/lib/components/status.js +110 -0
- package/dist/lib/composables/copyText.d.ts +2 -1
- package/dist/lib/composables/copyText.js +2 -2
- package/dist/lib/composables/useApiPagination.d.ts +55 -0
- package/dist/lib/composables/useApiPagination.js +58 -0
- package/dist/lib/composables/useBulkSelection.d.ts +44 -0
- package/dist/lib/composables/useBulkSelection.js +41 -0
- package/dist/lib/composables/useFormValidation.d.ts +65 -0
- package/dist/lib/composables/useFormValidation.js +148 -0
- package/dist/lib/composables/useTablePagination.d.ts +49 -0
- package/dist/lib/composables/useTablePagination.js +41 -0
- package/dist/lib/editor/theme.js +65 -62
- package/dist/lib/index.d.ts +14 -0
- package/dist/lib/index.js +95 -78
- package/dist/lib/theme.css +391 -272
- package/package.json +11 -4
|
@@ -0,0 +1,463 @@
|
|
|
1
|
+
import e from "./AcButton.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, createTextVNode as ee, createVNode as l, defineComponent as u, mergeModels as d, mergeProps as f, nextTick as p, normalizeClass as m, normalizeStyle as te, onBeforeUnmount as ne, onMounted as re, openBlock as h, ref as g, renderList as _, toDisplayString as v, unref as y, useAttrs as ie, useId as ae, useModel as b, watch as oe, withCtx as se } from "vue";
|
|
3
|
+
import { CircleAlert as ce, Clock as le, X as ue } from "@lucide/vue";
|
|
4
|
+
//#region src/lib/components/AcTimePicker.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
+
var de = ["for"], fe = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "text-danger",
|
|
8
|
+
"aria-hidden": "true"
|
|
9
|
+
}, pe = { class: "relative" }, me = [
|
|
10
|
+
"id",
|
|
11
|
+
"disabled",
|
|
12
|
+
"aria-expanded",
|
|
13
|
+
"aria-labelledby",
|
|
14
|
+
"aria-describedby",
|
|
15
|
+
"aria-invalid",
|
|
16
|
+
"aria-required"
|
|
17
|
+
], he = { class: "pointer-events-none absolute inset-y-0 right-1.5 flex items-center gap-0.5 text-muted" }, ge = ["aria-label"], _e = ["name", "value"], ve = ["aria-label"], ye = { class: "flex min-h-0 items-stretch justify-center gap-1 p-3" }, be = {
|
|
18
|
+
key: 0,
|
|
19
|
+
class: "mx-1.5 mt-6 h-32 w-px shrink-0 self-center bg-border",
|
|
20
|
+
"aria-hidden": "true"
|
|
21
|
+
}, xe = {
|
|
22
|
+
key: 1,
|
|
23
|
+
class: "mt-6 self-center font-semibold text-muted",
|
|
24
|
+
"aria-hidden": "true"
|
|
25
|
+
}, Se = ["data-col"], Ce = {
|
|
26
|
+
class: "mb-2 text-sm font-semibold tracking-[0.08em] text-muted uppercase",
|
|
27
|
+
"aria-hidden": "true"
|
|
28
|
+
}, we = ["aria-label", "onKeydown"], Te = { class: "flex flex-col items-center gap-0.5 py-[76px]" }, Ee = [
|
|
29
|
+
"data-value",
|
|
30
|
+
"tabindex",
|
|
31
|
+
"aria-selected",
|
|
32
|
+
"aria-disabled",
|
|
33
|
+
"onClick"
|
|
34
|
+
], De = { class: "flex items-center gap-2 border-t border-border px-3 py-3" }, Oe = ["disabled"], x = 86399, S = /*@__PURE__*/ u({
|
|
35
|
+
inheritAttrs: !1,
|
|
36
|
+
__name: "AcTimePicker",
|
|
37
|
+
props: /*@__PURE__*/ d({
|
|
38
|
+
label: { default: "" },
|
|
39
|
+
placeholder: { default: "Choose time" },
|
|
40
|
+
hourCycle: { default: 24 },
|
|
41
|
+
minuteStep: { default: 1 },
|
|
42
|
+
showSeconds: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: !1
|
|
45
|
+
},
|
|
46
|
+
min: { default: "" },
|
|
47
|
+
max: { default: "" },
|
|
48
|
+
clearable: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
default: !1
|
|
51
|
+
},
|
|
52
|
+
disabled: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: !1
|
|
55
|
+
},
|
|
56
|
+
required: {
|
|
57
|
+
type: Boolean,
|
|
58
|
+
default: !1
|
|
59
|
+
},
|
|
60
|
+
errorMsg: { default: "" },
|
|
61
|
+
hint: { default: "" },
|
|
62
|
+
size: { default: "normal" },
|
|
63
|
+
name: { default: "" }
|
|
64
|
+
}, {
|
|
65
|
+
modelValue: { default: null },
|
|
66
|
+
modelModifiers: {},
|
|
67
|
+
open: {
|
|
68
|
+
type: Boolean,
|
|
69
|
+
default: !1
|
|
70
|
+
},
|
|
71
|
+
openModifiers: {}
|
|
72
|
+
}),
|
|
73
|
+
emits: ["update:modelValue", "update:open"],
|
|
74
|
+
setup(u, { expose: d }) {
|
|
75
|
+
let S = u, C = b(u, "modelValue"), w = b(u, "open"), ke = /^(\d{1,2}):(\d{2})(?::(\d{2}))?$/, T = ae(), E = ie(), Ae = i(() => ({
|
|
76
|
+
class: E.class,
|
|
77
|
+
style: E.style
|
|
78
|
+
})), je = i(() => {
|
|
79
|
+
let { class: e, style: t, ...n } = E;
|
|
80
|
+
return n;
|
|
81
|
+
}), D = `${T}-label`, O = `${T}-value`, k = `${T}-msg`, A = `${T}-hint`, j = g(null), M = g(null), N = g(null), P = g({
|
|
82
|
+
left: 0,
|
|
83
|
+
maxHeight: 400
|
|
84
|
+
}), F = g(!1), I = i(() => w.value || F.value), L = i(() => G(C.value)), R = i(() => G(S.min) ?? 0), z = i(() => G(S.max) ?? x), B = i(() => L.value === null ? null : K(L.value)), V = i(() => S.hourCycle === 12), H = i(() => L.value === null ? "" : Le(L.value)), Me = i(() => [S.hint && A, S.errorMsg && k].filter(Boolean).join(" ") || void 0), Ne = i(() => S.label ? `${S.label}: choose time` : "Choose time"), Pe = i(() => q(ze())), Fe = i(() => {
|
|
85
|
+
let e = B.value, t = e?.h ?? null, n = e?.m ?? null, r = t === null ? 0 : t >= 12 ? 12 : 0, i = [], a = V.value ? [
|
|
86
|
+
0,
|
|
87
|
+
1,
|
|
88
|
+
2,
|
|
89
|
+
3,
|
|
90
|
+
4,
|
|
91
|
+
5,
|
|
92
|
+
6,
|
|
93
|
+
7,
|
|
94
|
+
8,
|
|
95
|
+
9,
|
|
96
|
+
10,
|
|
97
|
+
11
|
|
98
|
+
].map((e) => e + r) : W(0, 23, 1);
|
|
99
|
+
i.push({
|
|
100
|
+
unit: "h",
|
|
101
|
+
heading: "Hrs",
|
|
102
|
+
name: "Hours",
|
|
103
|
+
selected: t,
|
|
104
|
+
cells: a.map((e) => ({
|
|
105
|
+
value: e,
|
|
106
|
+
text: U(V.value ? e % 12 || 12 : e),
|
|
107
|
+
disabled: !J(e * 3600, e * 3600 + 3599)
|
|
108
|
+
}))
|
|
109
|
+
});
|
|
110
|
+
let o = t ?? Re();
|
|
111
|
+
if (i.push({
|
|
112
|
+
unit: "m",
|
|
113
|
+
heading: "Min",
|
|
114
|
+
name: "Minutes",
|
|
115
|
+
selected: n,
|
|
116
|
+
cells: W(0, 59, Math.max(1, S.minuteStep)).map((e) => {
|
|
117
|
+
let t = o * 3600 + e * 60;
|
|
118
|
+
return {
|
|
119
|
+
value: e,
|
|
120
|
+
text: U(e),
|
|
121
|
+
disabled: !J(t, S.showSeconds ? t + 59 : t)
|
|
122
|
+
};
|
|
123
|
+
})
|
|
124
|
+
}), S.showSeconds) {
|
|
125
|
+
let t = n ?? 0;
|
|
126
|
+
i.push({
|
|
127
|
+
unit: "s",
|
|
128
|
+
heading: "Sec",
|
|
129
|
+
name: "Seconds",
|
|
130
|
+
selected: e?.s ?? null,
|
|
131
|
+
cells: W(0, 59, 1).map((e) => ({
|
|
132
|
+
value: e,
|
|
133
|
+
text: U(e),
|
|
134
|
+
disabled: !q(o * 3600 + t * 60 + e)
|
|
135
|
+
}))
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
return V.value && i.push({
|
|
139
|
+
unit: "p",
|
|
140
|
+
heading: "AM/PM",
|
|
141
|
+
name: "AM or PM",
|
|
142
|
+
selected: t === null ? null : r,
|
|
143
|
+
cells: [{
|
|
144
|
+
value: 0,
|
|
145
|
+
text: "AM",
|
|
146
|
+
disabled: !J(0, 43199)
|
|
147
|
+
}, {
|
|
148
|
+
value: 12,
|
|
149
|
+
text: "PM",
|
|
150
|
+
disabled: !J(43200, x)
|
|
151
|
+
}]
|
|
152
|
+
}), i;
|
|
153
|
+
});
|
|
154
|
+
function U(e) {
|
|
155
|
+
return String(e).padStart(2, "0");
|
|
156
|
+
}
|
|
157
|
+
function W(e, t, n) {
|
|
158
|
+
let r = [];
|
|
159
|
+
for (let i = e; i <= t; i += n) r.push(i);
|
|
160
|
+
return r;
|
|
161
|
+
}
|
|
162
|
+
function G(e) {
|
|
163
|
+
let t = e ? ke.exec(e.trim()) : null;
|
|
164
|
+
if (!t) return null;
|
|
165
|
+
let [n, r, i] = [
|
|
166
|
+
Number(t[1]),
|
|
167
|
+
Number(t[2]),
|
|
168
|
+
Number(t[3] ?? 0)
|
|
169
|
+
];
|
|
170
|
+
return n > 23 || r > 59 || i > 59 ? null : n * 3600 + r * 60 + i;
|
|
171
|
+
}
|
|
172
|
+
function K(e) {
|
|
173
|
+
return {
|
|
174
|
+
h: Math.floor(e / 3600),
|
|
175
|
+
m: Math.floor(e % 3600 / 60),
|
|
176
|
+
s: e % 60
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
function Ie(e) {
|
|
180
|
+
let { h: t, m: n, s: r } = K(e);
|
|
181
|
+
return S.showSeconds ? `${U(t)}:${U(n)}:${U(r)}` : `${U(t)}:${U(n)}`;
|
|
182
|
+
}
|
|
183
|
+
function Le(e) {
|
|
184
|
+
let { h: t, m: n, s: r } = K(e), i = S.showSeconds ? `${U(n)}:${U(r)}` : U(n);
|
|
185
|
+
return V.value ? `${U(t % 12 || 12)}:${i} ${t >= 12 ? "PM" : "AM"}` : `${U(t)}:${i}`;
|
|
186
|
+
}
|
|
187
|
+
function q(e) {
|
|
188
|
+
return e >= R.value && e <= z.value;
|
|
189
|
+
}
|
|
190
|
+
function J(e, t) {
|
|
191
|
+
return t >= R.value && e <= z.value;
|
|
192
|
+
}
|
|
193
|
+
function Re() {
|
|
194
|
+
return Math.floor(R.value / 3600);
|
|
195
|
+
}
|
|
196
|
+
function ze() {
|
|
197
|
+
let e = /* @__PURE__ */ new Date(), t = Math.max(1, S.minuteStep), n = Math.floor(e.getMinutes() / t) * t;
|
|
198
|
+
return e.getHours() * 3600 + n * 60 + (S.showSeconds ? e.getSeconds() : 0);
|
|
199
|
+
}
|
|
200
|
+
function Be(e) {
|
|
201
|
+
if (q(e) && Ve(e)) return e;
|
|
202
|
+
let { h: t } = K(e), n = Math.max(1, S.minuteStep) * 60, r = [];
|
|
203
|
+
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);
|
|
204
|
+
else r.push(e);
|
|
205
|
+
let i = r.filter(q);
|
|
206
|
+
return i.length ? i.reduce((t, n) => Math.abs(n - e) < Math.abs(t - e) ? n : t) : null;
|
|
207
|
+
}
|
|
208
|
+
function Ve(e) {
|
|
209
|
+
let { m: t, s: n } = K(e);
|
|
210
|
+
return t % Math.max(1, S.minuteStep) === 0 && (S.showSeconds || n === 0);
|
|
211
|
+
}
|
|
212
|
+
function He(e, t) {
|
|
213
|
+
let { h: n, m: r, s: i } = B.value ?? K(Be(R.value) ?? R.value);
|
|
214
|
+
e === "h" ? n = t : e === "m" ? r = t : e === "s" ? i = t : n = n % 12 + t;
|
|
215
|
+
let a = Be(n * 3600 + r * 60 + (S.showSeconds ? i : 0));
|
|
216
|
+
a !== null && (C.value = Ie(a));
|
|
217
|
+
}
|
|
218
|
+
function Ue() {
|
|
219
|
+
C.value = Ie(ze()), p(() => Z("smooth"));
|
|
220
|
+
}
|
|
221
|
+
function We() {
|
|
222
|
+
C.value = null, M.value?.focus();
|
|
223
|
+
}
|
|
224
|
+
function Y() {
|
|
225
|
+
let e = M.value;
|
|
226
|
+
if (!e) return;
|
|
227
|
+
let t = e.getBoundingClientRect(), n = N.value?.offsetWidth ?? 240, r = N.value?.offsetHeight ?? 320, i = window.innerHeight - t.bottom - 6 - 8, a = t.top - 6 - 8, o = i < r && a > i, s = Math.max(8, Math.min(t.left, window.innerWidth - n - 8));
|
|
228
|
+
P.value = o ? {
|
|
229
|
+
bottom: window.innerHeight - t.top + 6,
|
|
230
|
+
left: s,
|
|
231
|
+
maxHeight: Math.max(200, a)
|
|
232
|
+
} : {
|
|
233
|
+
top: t.bottom + 6,
|
|
234
|
+
left: s,
|
|
235
|
+
maxHeight: Math.max(200, i)
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
function Ge() {
|
|
239
|
+
S.disabled || w.value || (w.value = !0);
|
|
240
|
+
}
|
|
241
|
+
function X(e = !0) {
|
|
242
|
+
w.value && (w.value = !1, e && M.value?.focus());
|
|
243
|
+
}
|
|
244
|
+
async function Ke() {
|
|
245
|
+
Y(), tt(), await p(), Y(), Z("instant"), Je(0);
|
|
246
|
+
}
|
|
247
|
+
function Z(e) {
|
|
248
|
+
let t = e === "smooth" && !window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
249
|
+
N.value?.querySelectorAll("[role=listbox]").forEach((e) => {
|
|
250
|
+
let n = e.querySelector("[aria-selected=true]") ?? e.querySelector("[aria-disabled=false]");
|
|
251
|
+
n && e.scrollTo({
|
|
252
|
+
top: n.offsetTop - (e.clientHeight - n.offsetHeight) / 2,
|
|
253
|
+
behavior: t ? "smooth" : "instant"
|
|
254
|
+
});
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
function qe(e) {
|
|
258
|
+
return [...N.value?.querySelectorAll(`[data-col="${e}"] [role=option]`) ?? []];
|
|
259
|
+
}
|
|
260
|
+
function Je(e) {
|
|
261
|
+
let t = qe(e);
|
|
262
|
+
(t.find((e) => e.tabIndex === 0) ?? t[0])?.focus({ preventScroll: !0 });
|
|
263
|
+
}
|
|
264
|
+
function Ye(e, t) {
|
|
265
|
+
return (e.cells.find((t) => t.value === e.selected) ?? e.cells.find((e) => !e.disabled)) === t ? 0 : -1;
|
|
266
|
+
}
|
|
267
|
+
function Xe(e, t, n) {
|
|
268
|
+
n.disabled || (He(t.unit, n.value), p(() => {
|
|
269
|
+
Z("smooth"), qe(e).find((e) => e.tabIndex === 0)?.focus({ preventScroll: !0 });
|
|
270
|
+
}));
|
|
271
|
+
}
|
|
272
|
+
function Ze(e, t, n) {
|
|
273
|
+
let r = n.cells.filter((e) => !e.disabled);
|
|
274
|
+
if (!r.length) return;
|
|
275
|
+
let i = r.findIndex((e) => e.value === n.selected), a = {
|
|
276
|
+
ArrowDown: i + 1,
|
|
277
|
+
ArrowUp: i < 0 ? r.length - 1 : i - 1,
|
|
278
|
+
PageDown: i + 5,
|
|
279
|
+
PageUp: i < 0 ? 0 : i - 5,
|
|
280
|
+
Home: 0,
|
|
281
|
+
End: r.length - 1
|
|
282
|
+
};
|
|
283
|
+
if (e.key === "ArrowRight" || e.key === "ArrowLeft") {
|
|
284
|
+
e.preventDefault();
|
|
285
|
+
let n = t + (e.key === "ArrowRight" ? 1 : -1);
|
|
286
|
+
n >= 0 && n < Fe.value.length && Je(n);
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
if (e.key === "Enter") {
|
|
290
|
+
e.preventDefault();
|
|
291
|
+
let t = n.cells.find((t) => String(t.value) === e.target.dataset.value);
|
|
292
|
+
t && !t.disabled && He(n.unit, t.value), X();
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
if (!(e.key in a)) return;
|
|
296
|
+
e.preventDefault();
|
|
297
|
+
let o = r[Math.max(0, Math.min(r.length - 1, a[e.key]))];
|
|
298
|
+
Xe(t, n, o);
|
|
299
|
+
}
|
|
300
|
+
function Qe(e) {
|
|
301
|
+
if (e.key === "Escape") {
|
|
302
|
+
e.preventDefault(), e.stopPropagation(), X();
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
if (e.key !== "Tab" || !N.value) return;
|
|
306
|
+
let t = [...N.value.querySelectorAll("button:not([disabled])")].filter((e) => e.tabIndex >= 0);
|
|
307
|
+
if (!t.length) return;
|
|
308
|
+
let n = t[0], r = t[t.length - 1];
|
|
309
|
+
e.shiftKey && document.activeElement === n ? (e.preventDefault(), r.focus()) : !e.shiftKey && document.activeElement === r && (e.preventDefault(), n.focus());
|
|
310
|
+
}
|
|
311
|
+
function $e(e) {
|
|
312
|
+
(e.key === "ArrowDown" || e.key === "ArrowUp" && e.altKey) && (e.preventDefault(), Ge());
|
|
313
|
+
}
|
|
314
|
+
function et(e) {
|
|
315
|
+
let t = e.target;
|
|
316
|
+
j.value?.contains(t) || N.value?.contains(t) || X(!1);
|
|
317
|
+
}
|
|
318
|
+
function Q(e) {
|
|
319
|
+
e?.target instanceof Node && N.value?.contains(e.target) || Y();
|
|
320
|
+
}
|
|
321
|
+
function tt() {
|
|
322
|
+
document.addEventListener("pointerdown", et, !0), window.addEventListener("scroll", Q, !0), window.addEventListener("resize", Q);
|
|
323
|
+
}
|
|
324
|
+
function $() {
|
|
325
|
+
document.removeEventListener("pointerdown", et, !0), window.removeEventListener("scroll", Q, !0), window.removeEventListener("resize", Q);
|
|
326
|
+
}
|
|
327
|
+
return oe(w, (e) => e ? Ke() : $()), re(() => {
|
|
328
|
+
w.value && Ke();
|
|
329
|
+
}), ne($), d({ focus: () => M.value?.focus() }), (i, d) => (h(), s("div", f({
|
|
330
|
+
ref_key: "root",
|
|
331
|
+
ref: j
|
|
332
|
+
}, Ae.value, {
|
|
333
|
+
class: ["w-full", u.disabled && "opacity-50"],
|
|
334
|
+
"data-ac-ds": "",
|
|
335
|
+
"data-testid": "ac-time-picker"
|
|
336
|
+
}), [
|
|
337
|
+
u.label ? (h(), s("label", {
|
|
338
|
+
key: 0,
|
|
339
|
+
id: D,
|
|
340
|
+
for: `${y(T)}-trigger`,
|
|
341
|
+
class: "mb-2 flex items-center gap-1 text-base font-medium text-heading"
|
|
342
|
+
}, [c("span", null, v(u.label), 1), u.required ? (h(), s("span", fe, "*")) : o("", !0)], 8, de)) : o("", !0),
|
|
343
|
+
u.hint ? (h(), s("p", {
|
|
344
|
+
key: 1,
|
|
345
|
+
id: A,
|
|
346
|
+
class: "mb-2 text-base text-muted"
|
|
347
|
+
}, v(u.hint), 1)) : o("", !0),
|
|
348
|
+
c("div", pe, [c("button", f({
|
|
349
|
+
id: `${y(T)}-trigger`,
|
|
350
|
+
ref_key: "trigger",
|
|
351
|
+
ref: M
|
|
352
|
+
}, je.value, {
|
|
353
|
+
type: "button",
|
|
354
|
+
disabled: u.disabled,
|
|
355
|
+
"aria-haspopup": "dialog",
|
|
356
|
+
"aria-expanded": w.value,
|
|
357
|
+
"aria-labelledby": u.label ? `${D} ${O}` : O,
|
|
358
|
+
"aria-describedby": Me.value,
|
|
359
|
+
"aria-invalid": !!u.errorMsg || void 0,
|
|
360
|
+
"aria-required": u.required || void 0,
|
|
361
|
+
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", [
|
|
362
|
+
u.size === "small" ? "h-9 pl-3" : "h-10 pl-4",
|
|
363
|
+
u.clearable && C.value ? "pr-16" : "pr-10",
|
|
364
|
+
u.disabled ? "" : "cursor-pointer",
|
|
365
|
+
u.errorMsg ? ["border-danger/60", I.value && "border-danger shadow-[0_0_0_2px_color-mix(in_srgb,var(--color-danger)_20%,transparent)]"] : I.value ? "focus-ring" : ["border-border", !u.disabled && "hover:border-accent-active"]
|
|
366
|
+
]],
|
|
367
|
+
onClick: d[0] ||= (e) => w.value ? X() : Ge(),
|
|
368
|
+
onKeydown: $e,
|
|
369
|
+
onFocus: d[1] ||= (e) => F.value = !0,
|
|
370
|
+
onBlur: d[2] ||= (e) => F.value = !1
|
|
371
|
+
}), [c("span", {
|
|
372
|
+
id: O,
|
|
373
|
+
class: m(["truncate tabular-nums", !H.value && "text-muted/80"])
|
|
374
|
+
}, v(H.value || C.value || u.placeholder), 3)], 16, me), c("span", he, [u.clearable && C.value && !u.disabled ? (h(), s("button", {
|
|
375
|
+
key: 0,
|
|
376
|
+
type: "button",
|
|
377
|
+
class: "pointer-events-auto inline-flex size-7 cursor-pointer items-center justify-center rounded-8 transition-colors duration-200 hover:bg-surface-sunken hover:text-heading focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",
|
|
378
|
+
"aria-label": u.label ? `Clear ${u.label}` : "Clear",
|
|
379
|
+
onClick: We
|
|
380
|
+
}, [l(y(ue), {
|
|
381
|
+
class: "size-4",
|
|
382
|
+
"aria-hidden": "true"
|
|
383
|
+
})], 8, ge)) : o("", !0), l(y(le), {
|
|
384
|
+
class: m(["mx-1.5 size-4", w.value && "text-heading"]),
|
|
385
|
+
"aria-hidden": "true"
|
|
386
|
+
}, null, 8, ["class"])])]),
|
|
387
|
+
u.errorMsg ? (h(), s("p", {
|
|
388
|
+
key: 2,
|
|
389
|
+
id: k,
|
|
390
|
+
class: "mt-1.5 flex items-center gap-1.5 text-base text-danger-strong",
|
|
391
|
+
role: "alert"
|
|
392
|
+
}, [l(y(ce), {
|
|
393
|
+
class: "size-4 shrink-0",
|
|
394
|
+
"aria-hidden": "true"
|
|
395
|
+
}), ee(" " + 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, _e)) : o("", !0),
|
|
402
|
+
(h(), a(n, { to: "body" }, [l(r, {
|
|
403
|
+
"enter-active-class": "transition duration-150 ease-out motion-reduce:transition-opacity",
|
|
404
|
+
"enter-from-class": "opacity-0 scale-95",
|
|
405
|
+
"leave-active-class": "transition duration-100 ease-in",
|
|
406
|
+
"leave-to-class": "opacity-0"
|
|
407
|
+
}, {
|
|
408
|
+
default: se(() => [w.value ? (h(), s("div", {
|
|
409
|
+
key: 0,
|
|
410
|
+
ref_key: "panel",
|
|
411
|
+
ref: N,
|
|
412
|
+
role: "dialog",
|
|
413
|
+
"aria-modal": "true",
|
|
414
|
+
"aria-label": Ne.value,
|
|
415
|
+
class: "fixed z-[90] flex max-w-[calc(100vw-16px)] flex-col overflow-hidden rounded-14 border border-border bg-surface shadow-lg",
|
|
416
|
+
style: te({
|
|
417
|
+
top: P.value.top === void 0 ? void 0 : `${P.value.top}px`,
|
|
418
|
+
bottom: P.value.bottom === void 0 ? void 0 : `${P.value.bottom}px`,
|
|
419
|
+
left: `${P.value.left}px`,
|
|
420
|
+
maxHeight: `${P.value.maxHeight}px`
|
|
421
|
+
}),
|
|
422
|
+
"data-ac-ds": "",
|
|
423
|
+
"data-testid": "ac-time-picker-panel",
|
|
424
|
+
onKeydown: Qe
|
|
425
|
+
}, [c("div", ye, [(h(!0), s(t, null, _(Fe.value, (e, n) => (h(), s(t, { key: e.unit }, [e.unit === "p" ? (h(), s("span", be)) : n > 0 ? (h(), s("span", xe, ":")) : o("", !0), c("div", {
|
|
426
|
+
class: "flex w-14 shrink-0 flex-col items-center",
|
|
427
|
+
"data-col": n
|
|
428
|
+
}, [c("span", Ce, v(e.heading), 1), c("div", {
|
|
429
|
+
role: "listbox",
|
|
430
|
+
"aria-label": e.name,
|
|
431
|
+
class: "relative h-48 w-full overflow-y-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
|
|
432
|
+
onKeydown: (t) => Ze(t, n, e)
|
|
433
|
+
}, [c("div", Te, [(h(!0), s(t, null, _(e.cells, (t) => (h(), s("button", {
|
|
434
|
+
key: t.value,
|
|
435
|
+
type: "button",
|
|
436
|
+
"data-value": t.value,
|
|
437
|
+
role: "option",
|
|
438
|
+
tabindex: Ye(e, t),
|
|
439
|
+
"aria-selected": t.value === e.selected,
|
|
440
|
+
"aria-disabled": t.disabled,
|
|
441
|
+
class: m(["inline-flex size-10 shrink-0 items-center justify-center rounded-8 text-base tabular-nums transition-colors duration-200 outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface", [e.unit === "p" && "w-12 text-xs font-semibold", t.disabled ? "cursor-not-allowed text-muted/50 line-through" : t.value === e.selected ? "cursor-pointer bg-primary font-semibold text-white shadow-button" : "cursor-pointer text-heading hover:bg-accent-hover active:bg-accent-active"]]),
|
|
442
|
+
onClick: (r) => Xe(n, e, t)
|
|
443
|
+
}, v(t.text), 11, Ee))), 128))])], 40, we)], 8, Se)], 64))), 128))]), c("div", De, [
|
|
444
|
+
c("button", {
|
|
445
|
+
type: "button",
|
|
446
|
+
class: "inline-flex h-8 cursor-pointer items-center rounded-8 px-2.5 text-base font-medium text-primary-strong transition-colors duration-200 hover:bg-primary/10 focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
447
|
+
disabled: !Pe.value,
|
|
448
|
+
onClick: Ue
|
|
449
|
+
}, " Now ", 8, Oe),
|
|
450
|
+
d[4] ||= c("span", { class: "flex-1" }, null, -1),
|
|
451
|
+
l(e, {
|
|
452
|
+
title: "Done",
|
|
453
|
+
size: "small",
|
|
454
|
+
onClick: d[3] ||= (e) => X()
|
|
455
|
+
})
|
|
456
|
+
])], 44, ve)) : o("", !0)]),
|
|
457
|
+
_: 1
|
|
458
|
+
})]))
|
|
459
|
+
], 16));
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
//#endregion
|
|
463
|
+
export { S as default };
|
|
@@ -13,7 +13,10 @@ var O = ["aria-label"], k = {
|
|
|
13
13
|
role: "alert",
|
|
14
14
|
"aria-live": "assertive",
|
|
15
15
|
"aria-atomic": "true"
|
|
16
|
-
}, j = ["data-tone"], M = { class: "min-w-0 flex-1
|
|
16
|
+
}, j = ["data-tone"], M = { class: "flex min-w-0 flex-1 flex-col gap-0.5" }, N = { class: "text-base font-medium break-words text-heading" }, P = {
|
|
17
|
+
key: 0,
|
|
18
|
+
class: "text-base break-words text-muted"
|
|
19
|
+
}, F = ["aria-label", "onClick"], I = 3, L = /*@__PURE__*/ d({
|
|
17
20
|
__name: "AcToaster",
|
|
18
21
|
props: {
|
|
19
22
|
position: { default: "bottom-right" },
|
|
@@ -21,141 +24,132 @@ var O = ["aria-label"], k = {
|
|
|
21
24
|
label: { default: "Notifications" }
|
|
22
25
|
},
|
|
23
26
|
setup(d) {
|
|
24
|
-
let
|
|
27
|
+
let L = d, R = {
|
|
25
28
|
neutral: {
|
|
26
|
-
|
|
27
|
-
box: "border-border bg-surface"
|
|
28
|
-
title: "text-heading",
|
|
29
|
-
text: "text-muted"
|
|
29
|
+
iconClass: "",
|
|
30
|
+
box: "border-border bg-surface"
|
|
30
31
|
},
|
|
31
32
|
success: {
|
|
32
33
|
icon: w,
|
|
33
|
-
|
|
34
|
-
box:
|
|
35
|
-
title: "text-green-10",
|
|
36
|
-
text: "text-green-20"
|
|
34
|
+
iconClass: "text-success",
|
|
35
|
+
box: "border-border bg-surface"
|
|
37
36
|
},
|
|
38
37
|
error: {
|
|
39
38
|
icon: C,
|
|
40
|
-
|
|
41
|
-
box:
|
|
42
|
-
title: "text-red-10",
|
|
43
|
-
text: "text-red-20"
|
|
39
|
+
iconClass: "text-danger",
|
|
40
|
+
box: "border-danger/25 bg-[color-mix(in_srgb,var(--color-danger)_8%,var(--color-surface))]"
|
|
44
41
|
},
|
|
45
42
|
warning: {
|
|
46
43
|
icon: E,
|
|
47
|
-
|
|
48
|
-
box:
|
|
49
|
-
title: "text-yellow-10",
|
|
50
|
-
text: "text-yellow-20"
|
|
44
|
+
iconClass: "text-warning",
|
|
45
|
+
box: "border-border bg-surface"
|
|
51
46
|
},
|
|
52
47
|
info: {
|
|
53
48
|
icon: T,
|
|
54
|
-
|
|
55
|
-
box:
|
|
56
|
-
title: "text-blue-10",
|
|
57
|
-
text: "text-blue-20"
|
|
49
|
+
iconClass: "text-info",
|
|
50
|
+
box: "border-border bg-surface"
|
|
58
51
|
}
|
|
59
|
-
},
|
|
52
|
+
}, z = {
|
|
60
53
|
"bottom-right": "bottom-3 sm:bottom-6 sm:right-6",
|
|
61
54
|
"bottom-center": "bottom-3 sm:bottom-6 sm:left-1/2 sm:-translate-x-1/2",
|
|
62
55
|
"top-right": "top-3 sm:top-6 sm:right-6",
|
|
63
56
|
"top-center": "top-3 sm:top-6 sm:left-1/2 sm:-translate-x-1/2"
|
|
64
|
-
}, { toasts:
|
|
65
|
-
let e =
|
|
66
|
-
return
|
|
57
|
+
}, { toasts: B, dismiss: V } = t(), H = g(""), U = g(""), W = /* @__PURE__ */ new Map(), G = !1, K = /* @__PURE__ */ new Set(), q = a(() => L.position.startsWith("top")), J = a(() => {
|
|
58
|
+
let e = B.value.slice(-L.max);
|
|
59
|
+
return q.value ? [...e].reverse() : e;
|
|
67
60
|
});
|
|
68
|
-
function J(e) {
|
|
69
|
-
let t = U.get(e);
|
|
70
|
-
t && !W && (t.started = Date.now(), t.handle = setTimeout(() => B(e), t.remaining));
|
|
71
|
-
}
|
|
72
61
|
function Y(e) {
|
|
73
|
-
let t =
|
|
74
|
-
t
|
|
62
|
+
let t = W.get(e);
|
|
63
|
+
t && !G && (t.started = Date.now(), t.handle = setTimeout(() => V(e), t.remaining));
|
|
75
64
|
}
|
|
76
|
-
function X() {
|
|
77
|
-
|
|
65
|
+
function X(e) {
|
|
66
|
+
let t = W.get(e);
|
|
67
|
+
t?.handle && (clearTimeout(t.handle), t.handle = void 0, t.remaining -= Date.now() - t.started);
|
|
78
68
|
}
|
|
79
69
|
function Z() {
|
|
80
|
-
|
|
70
|
+
G = !0, W.forEach((e, t) => X(t));
|
|
81
71
|
}
|
|
82
|
-
function Q(
|
|
83
|
-
|
|
72
|
+
function Q() {
|
|
73
|
+
G = !1, W.forEach((e, t) => Y(t));
|
|
84
74
|
}
|
|
85
75
|
function $(e) {
|
|
76
|
+
e.currentTarget.contains(e.relatedTarget) || Q();
|
|
77
|
+
}
|
|
78
|
+
function ee(e) {
|
|
86
79
|
let t = new Set(e.map((e) => e.id));
|
|
87
|
-
for (let [e] of
|
|
88
|
-
for (let t of e)
|
|
80
|
+
for (let [e] of W) t.has(e) || (X(e), W.delete(e));
|
|
81
|
+
for (let t of e) W.get(t.id)?.version !== t.version && (X(t.id), W.delete(t.id), t.duration > 0 && (W.set(t.id, {
|
|
89
82
|
version: t.version,
|
|
90
83
|
remaining: t.duration,
|
|
91
84
|
started: 0
|
|
92
|
-
}),
|
|
85
|
+
}), Y(t.id)));
|
|
93
86
|
}
|
|
94
|
-
async function
|
|
95
|
-
let t = e.filter((e) => !
|
|
96
|
-
if (
|
|
87
|
+
async function te(e) {
|
|
88
|
+
let t = e.filter((e) => !K.has(`${e.id}:${e.version}`));
|
|
89
|
+
if (K = new Set(e.map((e) => `${e.id}:${e.version}`)), !t.length) return;
|
|
97
90
|
let n = (e) => /[.!?…]$/.test(e.trim()) ? e.trim() : `${e.trim()}.`, r = (e) => e.flatMap((e) => [e.title, e.description ?? ""].filter(Boolean).map(n)).join(" "), i = t.filter((e) => e.tone === "error"), a = t.filter((e) => e.tone !== "error");
|
|
98
|
-
|
|
91
|
+
H.value = "", U.value = "", await f(), a.length && (H.value = r(a)), i.length && (U.value = r(i));
|
|
99
92
|
}
|
|
100
|
-
function
|
|
101
|
-
e.action?.onClick(),
|
|
93
|
+
function ne(e) {
|
|
94
|
+
e.action?.onClick(), V(e.id);
|
|
102
95
|
}
|
|
103
|
-
return x(
|
|
104
|
-
|
|
105
|
-
}, { immediate: !0 }), m(() =>
|
|
96
|
+
return x(J, (e) => {
|
|
97
|
+
ee(e), te(e);
|
|
98
|
+
}, { immediate: !0 }), m(() => W.forEach((e) => clearTimeout(e.handle))), (t, a) => (h(), o(r, { to: "body" }, [l("section", {
|
|
106
99
|
"aria-label": d.label,
|
|
107
100
|
"data-ac-ds": "",
|
|
108
101
|
"data-testid": "ac-toaster"
|
|
109
102
|
}, [
|
|
110
|
-
l("div", k, y(
|
|
111
|
-
l("div", A, y(
|
|
103
|
+
l("div", k, y(H.value), 1),
|
|
104
|
+
l("div", A, y(U.value), 1),
|
|
112
105
|
u(i, {
|
|
113
106
|
tag: "ol",
|
|
114
|
-
class: p(["pointer-events-none fixed inset-x-3 z-[100] flex flex-col gap-
|
|
107
|
+
class: p(["pointer-events-none fixed inset-x-3 z-[100] flex flex-col gap-3 sm:inset-x-auto sm:w-89", z[d.position]]),
|
|
115
108
|
"enter-active-class": "transition duration-200 ease-out",
|
|
116
|
-
"enter-from-class": `opacity-0 ${
|
|
109
|
+
"enter-from-class": `opacity-0 ${q.value ? "motion-safe:-translate-y-2" : "motion-safe:translate-y-2"}`,
|
|
117
110
|
"leave-active-class": "transition duration-150 ease-in",
|
|
118
111
|
"leave-to-class": "opacity-0 motion-safe:scale-95",
|
|
119
112
|
"move-class": "motion-safe:transition-transform motion-safe:duration-200",
|
|
120
|
-
onPointerenter:
|
|
121
|
-
onPointerleave:
|
|
122
|
-
onFocusin:
|
|
123
|
-
onFocusout:
|
|
113
|
+
onPointerenter: Z,
|
|
114
|
+
onPointerleave: Q,
|
|
115
|
+
onFocusin: Z,
|
|
116
|
+
onFocusout: $
|
|
124
117
|
}, {
|
|
125
|
-
default: S(() => [(h(!0), c(n, null, _(
|
|
118
|
+
default: S(() => [(h(!0), c(n, null, _(J.value, (t, n) => (h(), c("li", {
|
|
126
119
|
key: t.id,
|
|
127
|
-
class: p(["pointer-events-auto flex items-start gap-3 rounded-10 border py-3
|
|
120
|
+
class: p(["pointer-events-auto relative flex items-start gap-3 overflow-hidden rounded-10 border py-3.5 pl-4 shadow-lg", [
|
|
121
|
+
R[t.tone].box,
|
|
122
|
+
t.dismissible ? "pr-10" : "pr-4",
|
|
123
|
+
(q.value ? n : J.value.length - 1 - n) >= I && "max-sm:hidden"
|
|
124
|
+
]]),
|
|
128
125
|
"data-ac-ds": "",
|
|
129
126
|
"data-testid": "ac-toast",
|
|
130
127
|
"data-tone": t.tone
|
|
131
128
|
}, [
|
|
132
|
-
|
|
129
|
+
R[t.tone].icon ? (h(), o(v(R[t.tone].icon), {
|
|
133
130
|
key: 0,
|
|
134
|
-
class: p(["mt-
|
|
131
|
+
class: p(["mt-px size-5 shrink-0", R[t.tone].iconClass]),
|
|
135
132
|
"aria-hidden": "true"
|
|
136
133
|
}, null, 8, ["class"])) : s("", !0),
|
|
137
|
-
l("div", M, [l("p",
|
|
138
|
-
key: 0,
|
|
139
|
-
class: p(["mt-0.5 text-base", L[t.tone].text])
|
|
140
|
-
}, y(t.description), 3)) : s("", !0)]),
|
|
134
|
+
l("div", M, [l("p", N, y(t.title), 1), t.description ? (h(), c("p", P, y(t.description), 1)) : s("", !0)]),
|
|
141
135
|
t.action ? (h(), o(e, {
|
|
142
136
|
key: 1,
|
|
143
137
|
title: t.action.label,
|
|
144
138
|
size: "small",
|
|
145
139
|
color: "white",
|
|
146
|
-
class: "shrink-0",
|
|
147
|
-
onClick: (e) =>
|
|
140
|
+
class: "-my-1 shrink-0",
|
|
141
|
+
onClick: (e) => ne(t)
|
|
148
142
|
}, null, 8, ["title", "onClick"])) : s("", !0),
|
|
149
143
|
t.dismissible ? (h(), c("button", {
|
|
150
144
|
key: 2,
|
|
151
145
|
type: "button",
|
|
152
|
-
class: "inline-flex size-6
|
|
146
|
+
class: "absolute top-2 right-2 inline-flex size-6 cursor-pointer items-center justify-center rounded-8 text-muted transition-colors hover:bg-surface-sunken hover:text-heading focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",
|
|
153
147
|
"aria-label": `Dismiss: ${t.title}`,
|
|
154
|
-
onClick: (e) => b(
|
|
148
|
+
onClick: (e) => b(V)(t.id)
|
|
155
149
|
}, [u(b(D), {
|
|
156
150
|
class: "size-3.5",
|
|
157
151
|
"aria-hidden": "true"
|
|
158
|
-
})], 8,
|
|
152
|
+
})], 8, F)) : s("", !0)
|
|
159
153
|
], 10, j))), 128))]),
|
|
160
154
|
_: 1
|
|
161
155
|
}, 8, ["class", "enter-from-class"])
|
|
@@ -163,4 +157,4 @@ var O = ["aria-label"], k = {
|
|
|
163
157
|
}
|
|
164
158
|
});
|
|
165
159
|
//#endregion
|
|
166
|
-
export {
|
|
160
|
+
export { L as default };
|