@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
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { Fragment as e, computed as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, createTextVNode as a, createVNode as
|
|
2
|
-
import { CircleAlert as
|
|
1
|
+
import { Fragment as e, computed as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, createTextVNode as a, createVNode as ee, defineComponent as o, mergeModels as s, normalizeClass as c, normalizeStyle as l, openBlock as u, ref as d, renderList as f, toDisplayString as p, unref as te, useId as ne, useModel as re } from "vue";
|
|
2
|
+
import { CircleAlert as ie } from "@lucide/vue";
|
|
3
3
|
//#region src/lib/components/AcSlider.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
-
var
|
|
4
|
+
var m = {
|
|
5
5
|
key: 0,
|
|
6
6
|
class: "mb-2 flex items-start justify-between gap-3"
|
|
7
|
-
},
|
|
7
|
+
}, h = { class: "min-w-0" }, g = {
|
|
8
8
|
key: 0,
|
|
9
9
|
class: "text-danger",
|
|
10
10
|
"aria-hidden": "true"
|
|
11
|
-
},
|
|
11
|
+
}, _ = {
|
|
12
12
|
key: 1,
|
|
13
13
|
class: "mt-0.5 text-xs text-muted"
|
|
14
|
-
},
|
|
14
|
+
}, ae = {
|
|
15
15
|
key: 0,
|
|
16
16
|
class: "shrink-0 text-base font-medium text-heading tabular-nums",
|
|
17
17
|
"aria-hidden": "true"
|
|
18
|
-
},
|
|
18
|
+
}, oe = {
|
|
19
19
|
key: 1,
|
|
20
20
|
class: "mb-2 text-right text-base font-medium text-heading tabular-nums",
|
|
21
21
|
"aria-hidden": "true"
|
|
22
|
-
},
|
|
22
|
+
}, se = [
|
|
23
23
|
"value",
|
|
24
24
|
"min",
|
|
25
25
|
"max",
|
|
@@ -27,7 +27,7 @@ var ne = {
|
|
|
27
27
|
"disabled",
|
|
28
28
|
"aria-label",
|
|
29
29
|
"aria-invalid"
|
|
30
|
-
],
|
|
30
|
+
], v = { class: "relative min-w-0 flex-1" }, y = [
|
|
31
31
|
"tabindex",
|
|
32
32
|
"aria-valuemin",
|
|
33
33
|
"aria-valuemax",
|
|
@@ -40,14 +40,14 @@ var ne = {
|
|
|
40
40
|
"aria-invalid",
|
|
41
41
|
"aria-required",
|
|
42
42
|
"onKeydown"
|
|
43
|
-
],
|
|
43
|
+
], b = {
|
|
44
44
|
key: 0,
|
|
45
45
|
class: "absolute inset-x-0 top-full mt-1 h-4",
|
|
46
46
|
"aria-hidden": "true"
|
|
47
|
-
},
|
|
47
|
+
}, ce = ["onClick"], le = {
|
|
48
48
|
key: 1,
|
|
49
49
|
class: "relative shrink-0"
|
|
50
|
-
},
|
|
50
|
+
}, ue = [
|
|
51
51
|
"value",
|
|
52
52
|
"min",
|
|
53
53
|
"max",
|
|
@@ -56,13 +56,13 @@ var ne = {
|
|
|
56
56
|
"aria-label",
|
|
57
57
|
"aria-invalid",
|
|
58
58
|
"aria-describedby"
|
|
59
|
-
],
|
|
59
|
+
], x = {
|
|
60
60
|
key: 0,
|
|
61
|
-
class: "pointer-events-none absolute top-1/2 right-
|
|
61
|
+
class: "pointer-events-none absolute top-1/2 right-3 -translate-y-1/2 text-xs text-muted",
|
|
62
62
|
"aria-hidden": "true"
|
|
63
|
-
},
|
|
63
|
+
}, S = "h-10 rounded-10 border bg-background px-3 text-base text-heading tabular-nums transition-[color,background-color,border-color,box-shadow] duration-200 outline-none [appearance:textfield] disabled:cursor-not-allowed [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none", C = /*@__PURE__*/ o({
|
|
64
64
|
__name: "AcSlider",
|
|
65
|
-
props: /*@__PURE__*/
|
|
65
|
+
props: /*@__PURE__*/ s({
|
|
66
66
|
label: { default: "" },
|
|
67
67
|
description: { default: "" },
|
|
68
68
|
min: { default: 0 },
|
|
@@ -97,231 +97,233 @@ var ne = {
|
|
|
97
97
|
modelValue: { default: null },
|
|
98
98
|
modelModifiers: {}
|
|
99
99
|
}),
|
|
100
|
-
emits: /*@__PURE__*/
|
|
101
|
-
setup(
|
|
102
|
-
let
|
|
103
|
-
let e =
|
|
104
|
-
if (
|
|
105
|
-
let [t, n] = Array.isArray(e) ? e : [
|
|
100
|
+
emits: /*@__PURE__*/ s(["change"], ["update:modelValue"]),
|
|
101
|
+
setup(o, { expose: s, emit: C }) {
|
|
102
|
+
let w = o, T = re(o, "modelValue"), E = C, D = ne(), O = `${D}-label`, k = `${D}-msg`, A = `${D}-hint`, j = d(null), M = d([]), N = d(null), P = t(() => Math.max(w.max - w.min, 2 ** -52)), F = t(() => Math.max(H(w.step), H(w.min))), I = t(() => Math.max(w.step, Math.round(P.value / 10 / w.step) * w.step)), L = t(() => {
|
|
103
|
+
let e = T.value;
|
|
104
|
+
if (w.range) {
|
|
105
|
+
let [t, n] = Array.isArray(e) ? e : [w.min, w.max];
|
|
106
106
|
return [U(Math.min(t, n)), U(Math.max(t, n))];
|
|
107
107
|
}
|
|
108
|
-
return [U(typeof e == "number" ? e : Array.isArray(e) ? e[0] :
|
|
109
|
-
}),
|
|
110
|
-
left: `${
|
|
111
|
-
width: `${
|
|
108
|
+
return [U(typeof e == "number" ? e : Array.isArray(e) ? e[0] : w.min)];
|
|
109
|
+
}), R = t(() => w.range ? {
|
|
110
|
+
left: `${W(L.value[0])}%`,
|
|
111
|
+
width: `${W(L.value[1]) - W(L.value[0])}%`
|
|
112
112
|
} : {
|
|
113
113
|
left: "0%",
|
|
114
|
-
width: `${
|
|
115
|
-
}),
|
|
114
|
+
width: `${W(L.value[0])}%`
|
|
115
|
+
}), z = t(() => w.marks.map((e) => typeof e == "number" ? {
|
|
116
116
|
value: e,
|
|
117
|
-
label:
|
|
117
|
+
label: G(e)
|
|
118
118
|
} : {
|
|
119
119
|
value: e.value,
|
|
120
|
-
label: e.label ??
|
|
121
|
-
}).filter((e) => e.value >=
|
|
120
|
+
label: e.label ?? G(e.value)
|
|
121
|
+
}).filter((e) => e.value >= w.min && e.value <= w.max)), B = t(() => w.errorMsg ? "border-danger/60 focus:border-danger focus:shadow-[0_0_0_2px_color-mix(in_srgb,var(--color-danger)_20%,transparent)]" : ["border-border focus:focus-ring", !w.disabled && "hover:border-accent-active"]), V = t(() => [w.hint && A, w.errorMsg && k].filter(Boolean).join(" ") || void 0);
|
|
122
122
|
function H(e) {
|
|
123
123
|
let t = String(e);
|
|
124
124
|
return t.includes(".") ? t.split(".")[1].length : 0;
|
|
125
125
|
}
|
|
126
126
|
function U(e) {
|
|
127
|
-
return Math.min(
|
|
127
|
+
return Math.min(w.max, Math.max(w.min, Number.isFinite(e) ? e : w.min));
|
|
128
|
+
}
|
|
129
|
+
function de(e) {
|
|
130
|
+
let t = Math.round((U(e) - w.min) / w.step) * w.step + w.min;
|
|
131
|
+
return U(Number(t.toFixed(F.value)));
|
|
128
132
|
}
|
|
129
133
|
function W(e) {
|
|
130
|
-
|
|
131
|
-
return U(Number(t.toFixed(I.value)));
|
|
134
|
+
return (e - w.min) / P.value * 100;
|
|
132
135
|
}
|
|
133
136
|
function G(e) {
|
|
134
|
-
return (e
|
|
135
|
-
}
|
|
136
|
-
function K(e) {
|
|
137
|
-
return E.formatValue ? E.formatValue(e) : E.unit ? /^[a-z]/i.test(E.unit) ? `${e} ${E.unit}` : `${e}${E.unit}` : String(e);
|
|
137
|
+
return w.formatValue ? w.formatValue(e) : w.unit ? /^[a-z]/i.test(w.unit) ? `${e} ${w.unit}` : `${e}${w.unit}` : String(e);
|
|
138
138
|
}
|
|
139
|
-
function
|
|
140
|
-
return
|
|
139
|
+
function K() {
|
|
140
|
+
return w.range ? [L.value[0], L.value[1]] : L.value[0];
|
|
141
141
|
}
|
|
142
|
-
function
|
|
143
|
-
return
|
|
144
|
-
lo:
|
|
145
|
-
hi:
|
|
142
|
+
function q(e) {
|
|
143
|
+
return w.range ? e === 0 ? {
|
|
144
|
+
lo: w.min,
|
|
145
|
+
hi: L.value[1]
|
|
146
146
|
} : {
|
|
147
|
-
lo:
|
|
148
|
-
hi:
|
|
147
|
+
lo: L.value[0],
|
|
148
|
+
hi: w.max
|
|
149
149
|
} : {
|
|
150
|
-
lo:
|
|
151
|
-
hi:
|
|
150
|
+
lo: w.min,
|
|
151
|
+
hi: w.max
|
|
152
152
|
};
|
|
153
153
|
}
|
|
154
|
-
function
|
|
155
|
-
let { lo: n, hi: r } =
|
|
156
|
-
if (!
|
|
157
|
-
i !==
|
|
154
|
+
function J(e, t) {
|
|
155
|
+
let { lo: n, hi: r } = q(e), i = Math.min(r, Math.max(n, de(t)));
|
|
156
|
+
if (!w.range) {
|
|
157
|
+
i !== L.value[0] && (T.value = i);
|
|
158
158
|
return;
|
|
159
159
|
}
|
|
160
|
-
let a = [
|
|
161
|
-
a[e] = i, (a[0] !==
|
|
160
|
+
let a = [L.value[0], L.value[1]];
|
|
161
|
+
a[e] = i, (a[0] !== L.value[0] || a[1] !== L.value[1] || !Array.isArray(T.value)) && (T.value = a);
|
|
162
162
|
}
|
|
163
|
-
function
|
|
164
|
-
let t =
|
|
165
|
-
return
|
|
163
|
+
function Y(e) {
|
|
164
|
+
let t = j.value.getBoundingClientRect(), n = t.width ? (e - t.left) / t.width : 0;
|
|
165
|
+
return w.min + Math.min(1, Math.max(0, n)) * P.value;
|
|
166
166
|
}
|
|
167
|
-
function
|
|
168
|
-
if (!
|
|
169
|
-
let [t, n] =
|
|
167
|
+
function X(e) {
|
|
168
|
+
if (!w.range) return 0;
|
|
169
|
+
let [t, n] = L.value;
|
|
170
170
|
return t === n ? e < t ? 0 : 1 : Math.abs(e - t) <= Math.abs(e - n) ? 0 : 1;
|
|
171
171
|
}
|
|
172
|
-
function
|
|
173
|
-
if (
|
|
172
|
+
function fe(e) {
|
|
173
|
+
if (w.disabled || e.button !== 0 || !j.value) return;
|
|
174
174
|
e.preventDefault();
|
|
175
|
-
let t =
|
|
176
|
-
|
|
175
|
+
let t = Y(e.clientX), n = X(t);
|
|
176
|
+
N.value = n, J(n, t), j.value.setPointerCapture(e.pointerId), M.value[n]?.focus({ preventScroll: !0 });
|
|
177
177
|
}
|
|
178
|
-
function
|
|
179
|
-
|
|
178
|
+
function pe(e) {
|
|
179
|
+
N.value !== null && J(N.value, Y(e.clientX));
|
|
180
180
|
}
|
|
181
|
-
function
|
|
182
|
-
|
|
181
|
+
function Z(e) {
|
|
182
|
+
N.value !== null && (N.value = null, j.value?.hasPointerCapture(e.pointerId) && j.value.releasePointerCapture(e.pointerId), E("change", K()));
|
|
183
183
|
}
|
|
184
|
-
function
|
|
185
|
-
if (
|
|
186
|
-
let n =
|
|
187
|
-
ArrowRight: n +
|
|
188
|
-
ArrowUp: n +
|
|
189
|
-
ArrowLeft: n -
|
|
190
|
-
ArrowDown: n -
|
|
191
|
-
PageUp: n +
|
|
192
|
-
PageDown: n -
|
|
184
|
+
function Q(e, t) {
|
|
185
|
+
if (w.disabled) return;
|
|
186
|
+
let n = L.value[t], { lo: r, hi: i } = q(t), a = {
|
|
187
|
+
ArrowRight: n + w.step,
|
|
188
|
+
ArrowUp: n + w.step,
|
|
189
|
+
ArrowLeft: n - w.step,
|
|
190
|
+
ArrowDown: n - w.step,
|
|
191
|
+
PageUp: n + I.value,
|
|
192
|
+
PageDown: n - I.value,
|
|
193
193
|
Home: r,
|
|
194
194
|
End: i
|
|
195
195
|
};
|
|
196
|
-
e.key in a && (e.preventDefault(),
|
|
196
|
+
e.key in a && (e.preventDefault(), J(t, a[e.key]), E("change", K()));
|
|
197
197
|
}
|
|
198
|
-
function
|
|
199
|
-
if (
|
|
200
|
-
let t =
|
|
201
|
-
|
|
198
|
+
function me(e) {
|
|
199
|
+
if (w.disabled) return;
|
|
200
|
+
let t = X(e);
|
|
201
|
+
J(t, e), M.value[t]?.focus(), E("change", K());
|
|
202
202
|
}
|
|
203
203
|
function $(e, t) {
|
|
204
204
|
let n = e.target, r = n.valueAsNumber;
|
|
205
|
-
Number.isFinite(r) && (
|
|
205
|
+
Number.isFinite(r) && (J(t, r), E("change", K())), n.value = String(L.value[t]);
|
|
206
206
|
}
|
|
207
|
-
function
|
|
208
|
-
let t =
|
|
209
|
-
return
|
|
207
|
+
function he(e) {
|
|
208
|
+
let t = w.label || "Value";
|
|
209
|
+
return w.range ? `${t}, ${e === 0 ? "minimum" : "maximum"}` : w.label ? void 0 : t;
|
|
210
210
|
}
|
|
211
|
-
function
|
|
212
|
-
e && (
|
|
211
|
+
function ge(e, t) {
|
|
212
|
+
e && (M.value[t] = e);
|
|
213
213
|
}
|
|
214
|
-
return
|
|
215
|
-
class:
|
|
214
|
+
return s({ focus: () => M.value[0]?.focus() }), (t, s) => (u(), r("div", {
|
|
215
|
+
class: c(["w-full", o.disabled && "opacity-50"]),
|
|
216
216
|
"data-ac-ds": "",
|
|
217
217
|
"data-testid": "ac-slider"
|
|
218
218
|
}, [
|
|
219
|
-
|
|
219
|
+
o.label || o.description || !o.showInput && !o.range ? (u(), r("div", m, [i("div", h, [o.label ? (u(), r("p", {
|
|
220
220
|
key: 0,
|
|
221
|
+
id: O,
|
|
222
|
+
class: "flex items-center gap-1 text-base font-medium text-heading"
|
|
223
|
+
}, [i("span", null, p(o.label), 1), o.required ? (u(), r("span", g, "*")) : n("", !0)])) : n("", !0), o.description ? (u(), r("p", _, p(o.description), 1)) : n("", !0)]), o.showInput ? n("", !0) : (u(), r("span", ae, p(o.range ? `${G(L.value[0])} – ${G(L.value[1])}` : G(L.value[0])), 1))])) : !o.showInput && o.range ? (u(), r("div", oe, p(G(L.value[0])) + " – " + p(G(L.value[1])), 1)) : n("", !0),
|
|
224
|
+
o.hint ? (u(), r("p", {
|
|
225
|
+
key: 2,
|
|
221
226
|
id: A,
|
|
222
|
-
class: "text-base
|
|
223
|
-
},
|
|
224
|
-
i("div", { class:
|
|
225
|
-
|
|
227
|
+
class: "mb-2 text-base text-muted"
|
|
228
|
+
}, p(o.hint), 1)) : n("", !0),
|
|
229
|
+
i("div", { class: c(["flex items-center gap-3", z.value.length > 0 && "pb-5"]) }, [
|
|
230
|
+
o.showInput && o.range ? (u(), r("input", {
|
|
226
231
|
key: 0,
|
|
227
232
|
type: "number",
|
|
228
|
-
value:
|
|
229
|
-
min:
|
|
230
|
-
max:
|
|
231
|
-
step:
|
|
232
|
-
disabled:
|
|
233
|
-
"aria-label": `${
|
|
234
|
-
"aria-invalid": !!
|
|
235
|
-
class:
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
233
|
+
value: L.value[0],
|
|
234
|
+
min: o.min,
|
|
235
|
+
max: L.value[1],
|
|
236
|
+
step: o.step,
|
|
237
|
+
disabled: o.disabled,
|
|
238
|
+
"aria-label": `${o.label || "Value"}, minimum`,
|
|
239
|
+
"aria-invalid": !!o.errorMsg || void 0,
|
|
240
|
+
class: c(["shrink-0", [
|
|
241
|
+
S,
|
|
242
|
+
B.value,
|
|
243
|
+
"w-16"
|
|
239
244
|
]]),
|
|
240
|
-
onChange:
|
|
241
|
-
}, null, 42,
|
|
242
|
-
i("div",
|
|
245
|
+
onChange: s[0] ||= (e) => $(e, 0)
|
|
246
|
+
}, null, 42, se)) : n("", !0),
|
|
247
|
+
i("div", v, [i("div", { class: c(o.tooltip === "always" && "pt-10") }, [i("div", {
|
|
243
248
|
ref_key: "track",
|
|
244
|
-
ref:
|
|
245
|
-
class:
|
|
246
|
-
onPointerdown:
|
|
247
|
-
onPointermove:
|
|
248
|
-
onPointerup:
|
|
249
|
-
onPointercancel:
|
|
250
|
-
}, [i("div", { class:
|
|
251
|
-
class:
|
|
252
|
-
style:
|
|
253
|
-
}, null, 6), (
|
|
249
|
+
ref: j,
|
|
250
|
+
class: c(["relative flex h-5 touch-none items-center select-none", o.disabled ? "cursor-not-allowed" : "cursor-pointer"]),
|
|
251
|
+
onPointerdown: fe,
|
|
252
|
+
onPointermove: pe,
|
|
253
|
+
onPointerup: Z,
|
|
254
|
+
onPointercancel: Z
|
|
255
|
+
}, [i("div", { class: c(["relative h-1.5 w-full rounded-full", o.errorMsg ? "bg-danger/15" : "bg-surface-sunken"]) }, [i("div", {
|
|
256
|
+
class: c(["absolute inset-y-0 rounded-full", o.errorMsg ? "bg-danger" : "bg-primary"]),
|
|
257
|
+
style: l(R.value)
|
|
258
|
+
}, null, 6), (u(!0), r(e, null, f(z.value, (e) => (u(), r("span", {
|
|
254
259
|
key: e.value,
|
|
255
|
-
class:
|
|
256
|
-
style:
|
|
260
|
+
class: c(["absolute top-1/2 size-1 -translate-x-1/2 -translate-y-1/2 rounded-full", (o.range ? e.value >= L.value[0] && e.value <= L.value[1] : e.value <= L.value[0]) ? "bg-white/70" : "bg-muted/40"]),
|
|
261
|
+
style: l({ left: `${W(e.value)}%` }),
|
|
257
262
|
"aria-hidden": "true"
|
|
258
|
-
}, null, 6))), 128))], 2), (
|
|
263
|
+
}, null, 6))), 128))], 2), (u(!0), r(e, null, f(L.value, (e, t) => (u(), r("div", {
|
|
259
264
|
key: t,
|
|
260
265
|
ref_for: !0,
|
|
261
|
-
ref: (e) =>
|
|
266
|
+
ref: (e) => ge(e, t),
|
|
262
267
|
role: "slider",
|
|
263
|
-
tabindex:
|
|
264
|
-
"aria-valuemin":
|
|
265
|
-
"aria-valuemax":
|
|
268
|
+
tabindex: o.disabled ? -1 : 0,
|
|
269
|
+
"aria-valuemin": q(t).lo,
|
|
270
|
+
"aria-valuemax": q(t).hi,
|
|
266
271
|
"aria-valuenow": e,
|
|
267
|
-
"aria-valuetext":
|
|
272
|
+
"aria-valuetext": G(e),
|
|
268
273
|
"aria-orientation": "horizontal",
|
|
269
|
-
"aria-labelledby": !
|
|
270
|
-
"aria-label":
|
|
274
|
+
"aria-labelledby": !o.range && o.label ? O : void 0,
|
|
275
|
+
"aria-label": he(t),
|
|
271
276
|
"aria-describedby": V.value,
|
|
272
|
-
"aria-disabled":
|
|
273
|
-
"aria-invalid": !!
|
|
274
|
-
"aria-required":
|
|
275
|
-
class:
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
277
|
+
"aria-disabled": o.disabled || void 0,
|
|
278
|
+
"aria-invalid": !!o.errorMsg || void 0,
|
|
279
|
+
"aria-required": o.required || void 0,
|
|
280
|
+
class: c(["group/thumb absolute top-1/2 size-4.5 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 bg-surface shadow-sm transition-[box-shadow,scale] duration-200 outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-surface motion-safe:hover:scale-110", [
|
|
281
|
+
o.errorMsg ? "border-danger" : "border-primary",
|
|
282
|
+
N.value === t && (o.errorMsg ? "ring-4 ring-danger/20" : "ring-4 ring-primary/20") + " motion-safe:scale-110",
|
|
283
|
+
o.range && L.value[0] === L.value[1] && t === 1 && "z-10"
|
|
279
284
|
]]),
|
|
280
|
-
style:
|
|
281
|
-
onKeydown: (e) =>
|
|
282
|
-
}, [
|
|
285
|
+
style: l({ left: `${W(e)}%` }),
|
|
286
|
+
onKeydown: (e) => Q(e, t)
|
|
287
|
+
}, [o.tooltip === "never" ? n("", !0) : (u(), r("span", {
|
|
283
288
|
key: 0,
|
|
284
|
-
class:
|
|
289
|
+
class: c(["pointer-events-none absolute bottom-full left-1/2 mb-2 -translate-x-1/2 rounded-10 border border-white/10 bg-tooltip px-2.5 py-1.5 text-xs leading-relaxed font-medium whitespace-nowrap text-on-tooltip tabular-nums shadow-lg shadow-black/25 transition-opacity duration-100", o.tooltip === "always" || N.value === t ? "opacity-100" : "opacity-0 group-hover/thumb:opacity-100 group-focus-visible/thumb:opacity-100"]),
|
|
285
290
|
"aria-hidden": "true"
|
|
286
|
-
},
|
|
291
|
+
}, p(G(e)), 3))], 46, y))), 128))], 34)], 2), z.value.length ? (u(), r("div", b, [(u(!0), r(e, null, f(z.value, (e, t) => (u(), r("span", {
|
|
287
292
|
key: e.value,
|
|
288
|
-
class:
|
|
289
|
-
style:
|
|
290
|
-
onClick: (t) =>
|
|
291
|
-
},
|
|
292
|
-
|
|
293
|
+
class: c(["absolute top-0 text-xs whitespace-nowrap text-muted tabular-nums transition-colors", [t === 0 && W(e.value) < 5 ? "" : t === z.value.length - 1 && W(e.value) > 95 ? "-translate-x-full" : "-translate-x-1/2", !o.disabled && "cursor-pointer hover:text-heading"]]),
|
|
294
|
+
style: l({ left: `${W(e.value)}%` }),
|
|
295
|
+
onClick: (t) => me(e.value)
|
|
296
|
+
}, p(e.label), 15, ce))), 128))])) : n("", !0)]),
|
|
297
|
+
o.showInput ? (u(), r("div", le, [i("input", {
|
|
293
298
|
type: "number",
|
|
294
|
-
value:
|
|
295
|
-
min:
|
|
296
|
-
max:
|
|
297
|
-
step:
|
|
298
|
-
disabled:
|
|
299
|
-
"aria-label":
|
|
300
|
-
"aria-invalid": !!
|
|
299
|
+
value: L.value[+!!o.range],
|
|
300
|
+
min: o.range ? L.value[0] : o.min,
|
|
301
|
+
max: o.max,
|
|
302
|
+
step: o.step,
|
|
303
|
+
disabled: o.disabled,
|
|
304
|
+
"aria-label": o.range ? `${o.label || "Value"}, maximum` : o.label || "Value",
|
|
305
|
+
"aria-invalid": !!o.errorMsg || void 0,
|
|
301
306
|
"aria-describedby": V.value,
|
|
302
|
-
class:
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
+
class: c([
|
|
308
|
+
S,
|
|
309
|
+
B.value,
|
|
310
|
+
o.range ? "w-16" : "w-20",
|
|
311
|
+
o.unit && !o.formatValue && !o.range && "pr-8"
|
|
307
312
|
]),
|
|
308
|
-
onChange:
|
|
309
|
-
}, null, 42,
|
|
313
|
+
onChange: s[1] ||= (e) => $(e, +!!o.range)
|
|
314
|
+
}, null, 42, ue), o.unit && !o.formatValue && !o.range ? (u(), r("span", x, p(o.unit.trim()), 1)) : n("", !0)])) : n("", !0)
|
|
310
315
|
], 2),
|
|
311
|
-
|
|
312
|
-
key: 2,
|
|
313
|
-
id: j,
|
|
314
|
-
class: "mt-1.5 flex items-center gap-1 text-xs text-red-30"
|
|
315
|
-
}, [o(h(te), {
|
|
316
|
-
class: "size-3.5 shrink-0",
|
|
317
|
-
"aria-hidden": "true"
|
|
318
|
-
}), a(" " + m(s.errorMsg), 1)])) : s.hint ? (d(), r("p", {
|
|
316
|
+
o.errorMsg ? (u(), r("p", {
|
|
319
317
|
key: 3,
|
|
320
|
-
id:
|
|
321
|
-
class: "mt-1.5 text-
|
|
322
|
-
|
|
318
|
+
id: k,
|
|
319
|
+
class: "mt-1.5 flex items-center gap-1.5 text-base text-danger-strong",
|
|
320
|
+
role: "alert"
|
|
321
|
+
}, [ee(te(ie), {
|
|
322
|
+
class: "size-4 shrink-0",
|
|
323
|
+
"aria-hidden": "true"
|
|
324
|
+
}), a(" " + p(o.errorMsg), 1)])) : n("", !0)
|
|
323
325
|
], 2));
|
|
324
326
|
}
|
|
325
327
|
});
|
|
326
328
|
//#endregion
|
|
327
|
-
export {
|
|
329
|
+
export { C as default };
|
|
@@ -23,13 +23,13 @@ export interface Props {
|
|
|
23
23
|
progress?: number;
|
|
24
24
|
/** Colour of the `progress` bar. `auto` turns it warning from 80 and danger from 95. */
|
|
25
25
|
progressColor?: Tone | "auto";
|
|
26
|
-
/** A Lucide icon shown in a
|
|
26
|
+
/** A Lucide icon shown in a round 36px tile at the top right, tinted with `status`. Or use the `icon` slot. */
|
|
27
27
|
icon?: Component;
|
|
28
|
-
/** `small` for dense grids and summaries (
|
|
28
|
+
/** `small` for dense grids and summaries (16px value); `normal` for overview rows (24px value), as cloud-ui's dashboard widgets. */
|
|
29
29
|
size?: "small" | "normal";
|
|
30
30
|
/** Label on the left and value on the right, in one compact row. Replaces the old OverviewCard. */
|
|
31
31
|
inline?: boolean;
|
|
32
|
-
/** Sets the value in
|
|
32
|
+
/** Sets the value in the monospace font, for IDs, timestamps and durations. */
|
|
33
33
|
mono?: boolean;
|
|
34
34
|
/** Shows a placeholder bar instead of the value while it loads. */
|
|
35
35
|
loading?: boolean;
|