@ac-design/design-system 1.0.3 → 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,119 @@
|
|
|
1
|
+
import e from "./AcSpinner.js";
|
|
2
|
+
import t from "./AcSwitch.js";
|
|
3
|
+
import { Comment as n, Fragment as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, mergeModels as f, mergeProps as p, normalizeClass as m, openBlock as h, ref as g, renderSlot as _, resolveDynamicComponent as v, toDisplayString as y, unref as b, useAttrs as x, useId as S, useModel as C, useSlots as w } from "vue";
|
|
4
|
+
import { Sparkles as T } from "@lucide/vue";
|
|
5
|
+
//#region src/lib/components/AcSwitchCard.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
+
var E = ["aria-busy"], D = { class: "flex min-w-[200px] flex-1 items-start gap-3" }, O = { class: "min-w-0 flex-1" }, k = { class: "flex flex-wrap items-center gap-x-2 gap-y-1 text-base font-semibold text-heading" }, A = {
|
|
7
|
+
key: 0,
|
|
8
|
+
class: "inline-flex items-center gap-1 rounded-full bg-primary/15 px-2 py-0.5 text-sm font-bold tracking-wide text-primary-strong uppercase"
|
|
9
|
+
}, j = { class: "ml-auto flex shrink-0 items-center gap-3" }, M = {
|
|
10
|
+
key: 0,
|
|
11
|
+
class: "text-sm text-muted"
|
|
12
|
+
}, N = {
|
|
13
|
+
key: 0,
|
|
14
|
+
class: "mt-4 border-t border-border pt-4"
|
|
15
|
+
}, P = "a, button, input, select, textarea, label, [tabindex], [contenteditable]", F = /*@__PURE__*/ d({
|
|
16
|
+
inheritAttrs: !1,
|
|
17
|
+
__name: "AcSwitchCard",
|
|
18
|
+
props: /*@__PURE__*/ f({
|
|
19
|
+
title: {},
|
|
20
|
+
description: { default: "" },
|
|
21
|
+
status: { default: "" },
|
|
22
|
+
statusDetail: { default: "" },
|
|
23
|
+
icon: { default: void 0 },
|
|
24
|
+
recommended: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: !1
|
|
27
|
+
},
|
|
28
|
+
warning: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: !1
|
|
31
|
+
},
|
|
32
|
+
disabled: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: !1
|
|
35
|
+
},
|
|
36
|
+
loading: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: !1
|
|
39
|
+
}
|
|
40
|
+
}, {
|
|
41
|
+
modelValue: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: !1
|
|
44
|
+
},
|
|
45
|
+
modelModifiers: {}
|
|
46
|
+
}),
|
|
47
|
+
emits: ["update:modelValue"],
|
|
48
|
+
setup(d, { expose: f }) {
|
|
49
|
+
let F = d, I = C(d, "modelValue"), L = w(), R = S(), z = `${R}-title`, B = `${R}-description`, V = `${R}-status`, H = x(), U = i(() => ({
|
|
50
|
+
class: H.class,
|
|
51
|
+
style: H.style
|
|
52
|
+
})), W = i(() => {
|
|
53
|
+
let { class: e, style: t, ...n } = H;
|
|
54
|
+
return n;
|
|
55
|
+
}), G = g(null), K = i(() => F.disabled || F.loading), q = i(() => I.value && !F.disabled && !F.warning), J = i(() => !!(F.status || F.statusDetail || L.status)), Y = i(() => [F.description && B, J.value && V].filter(Boolean).join(" ") || void 0), X = i(() => I.value && F.warning ? "border-warning/40 bg-[color-mix(in_srgb,var(--color-warning)_5%,var(--color-surface))]" : q.value ? "border-primary bg-[color-mix(in_srgb,var(--color-primary)_5%,var(--color-surface))] ring-1 ring-primary/30" : ["border-border bg-surface", !K.value && "hover:border-primary/30"]), Z = i(() => I.value && F.warning ? "text-warning-strong" : q.value ? "text-heading" : "text-muted");
|
|
56
|
+
function Q(e) {
|
|
57
|
+
return !!e?.some((e) => e.type !== n && (e.type !== r || Q(e.children)));
|
|
58
|
+
}
|
|
59
|
+
function $() {
|
|
60
|
+
return I.value && Q(L.default?.());
|
|
61
|
+
}
|
|
62
|
+
function ee(e) {
|
|
63
|
+
if (K.value) return;
|
|
64
|
+
let t = e.target.closest(P);
|
|
65
|
+
t && e.currentTarget.contains(t) || window.getSelection()?.toString() || (I.value = !I.value, G.value?.focus());
|
|
66
|
+
}
|
|
67
|
+
return f({ focus: () => G.value?.focus() }), (n, r) => (h(), s("div", p(U.value, {
|
|
68
|
+
class: ["rounded-14 border p-4 transition-[background-color,border-color,box-shadow] duration-200 motion-reduce:transition-none", X.value],
|
|
69
|
+
"aria-busy": d.loading || void 0,
|
|
70
|
+
"data-ac-ds": "",
|
|
71
|
+
"data-testid": "ac-switch-card"
|
|
72
|
+
}), [c("div", {
|
|
73
|
+
class: m(["flex flex-wrap items-center justify-between gap-x-4 gap-y-3", K.value ? "cursor-not-allowed" : "cursor-pointer"]),
|
|
74
|
+
onClick: ee
|
|
75
|
+
}, [c("div", D, [d.icon ? (h(), s("span", {
|
|
76
|
+
key: 0,
|
|
77
|
+
class: m(["flex size-8 shrink-0 items-center justify-center rounded-10 border transition-colors duration-200", q.value ? "border-primary/25 bg-primary/10 text-primary-strong" : "border-border bg-surface-sunken text-muted"]),
|
|
78
|
+
"aria-hidden": "true"
|
|
79
|
+
}, [(h(), a(v(d.icon), { class: "size-4" }))], 2)) : o("", !0), c("div", O, [c("p", k, [
|
|
80
|
+
c("span", { id: z }, y(d.title), 1),
|
|
81
|
+
d.recommended ? (h(), s("span", A, [u(b(T), {
|
|
82
|
+
class: "size-3",
|
|
83
|
+
"aria-hidden": "true"
|
|
84
|
+
}), r[1] ||= l(" Recommended ", -1)])) : o("", !0),
|
|
85
|
+
_(n.$slots, "badges")
|
|
86
|
+
]), d.description ? (h(), s("p", {
|
|
87
|
+
key: 0,
|
|
88
|
+
id: B,
|
|
89
|
+
class: "mt-0.5 text-xs leading-snug text-muted"
|
|
90
|
+
}, y(d.description), 1)) : o("", !0)])]), c("div", j, [
|
|
91
|
+
J.value ? (h(), s("div", {
|
|
92
|
+
key: 0,
|
|
93
|
+
id: V,
|
|
94
|
+
class: "text-right"
|
|
95
|
+
}, [c("div", { class: m(["text-base font-bold tabular-nums", Z.value]) }, [_(n.$slots, "status", {}, () => [l(y(d.status), 1)])], 2), d.statusDetail ? (h(), s("div", M, y(d.statusDetail), 1)) : o("", !0)])) : o("", !0),
|
|
96
|
+
d.loading ? (h(), a(e, {
|
|
97
|
+
key: 1,
|
|
98
|
+
class: "text-muted",
|
|
99
|
+
label: "Saving"
|
|
100
|
+
})) : o("", !0),
|
|
101
|
+
u(t, p({
|
|
102
|
+
ref_key: "toggle",
|
|
103
|
+
ref: G
|
|
104
|
+
}, W.value, {
|
|
105
|
+
modelValue: I.value,
|
|
106
|
+
"onUpdate:modelValue": r[0] ||= (e) => I.value = e,
|
|
107
|
+
disabled: K.value,
|
|
108
|
+
"aria-labelledby": z,
|
|
109
|
+
"aria-describedby": Y.value
|
|
110
|
+
}), null, 16, [
|
|
111
|
+
"modelValue",
|
|
112
|
+
"disabled",
|
|
113
|
+
"aria-describedby"
|
|
114
|
+
])
|
|
115
|
+
])], 2), $() ? (h(), s("div", N, [_(n.$slots, "default")])) : o("", !0)], 16, E));
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
//#endregion
|
|
119
|
+
export { F as default };
|
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
import e from "./AcCellValue.js";
|
|
2
2
|
import { Fragment as t, computed as n, createBlock as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createTextVNode as s, createVNode as c, defineComponent as l, mergeModels as u, normalizeClass as d, normalizeStyle as f, openBlock as p, renderList as m, renderSlot as h, resolveDynamicComponent as g, toDisplayString as _, unref as v, useId as ee, useModel as y, withModifiers as b } from "vue";
|
|
3
|
-
import { ArrowUp as
|
|
3
|
+
import { ArrowUp as x, Check as S, ChevronRight as C, ChevronsUpDown as w, Minus as te } from "@lucide/vue";
|
|
4
4
|
//#region src/lib/components/AcTable.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
-
var
|
|
5
|
+
var ne = { class: "ac-scrollbar" }, re = { class: "w-full border-separate border-spacing-0 text-base" }, ie = { class: "relative flex size-4" }, ae = [
|
|
6
6
|
"checked",
|
|
7
7
|
"indeterminate",
|
|
8
8
|
"disabled"
|
|
9
|
-
],
|
|
9
|
+
], oe = ["aria-sort", "onClick"], se = {
|
|
10
10
|
key: 0,
|
|
11
|
-
class: "h-12 border-b border-border
|
|
12
|
-
},
|
|
11
|
+
class: "h-12 border-b border-border pl-4 [tr:last-child_&]:border-0"
|
|
12
|
+
}, ce = {
|
|
13
13
|
key: 1,
|
|
14
|
-
class: "h-12 border-b border-border
|
|
15
|
-
},
|
|
14
|
+
class: "h-12 border-b border-border pl-4 [tr:last-child_&]:border-0"
|
|
15
|
+
}, T = [
|
|
16
16
|
"aria-current",
|
|
17
17
|
"aria-disabled",
|
|
18
18
|
"onClick"
|
|
19
|
-
],
|
|
19
|
+
], E = [
|
|
20
20
|
"aria-expanded",
|
|
21
21
|
"aria-controls",
|
|
22
22
|
"aria-label",
|
|
23
23
|
"onClick"
|
|
24
|
-
],
|
|
24
|
+
], le = { class: "relative flex size-4" }, ue = [
|
|
25
25
|
"checked",
|
|
26
26
|
"disabled",
|
|
27
27
|
"aria-label",
|
|
28
28
|
"onChange"
|
|
29
|
-
],
|
|
29
|
+
], de = {
|
|
30
30
|
key: 0,
|
|
31
31
|
class: "group",
|
|
32
32
|
"data-testid": "ac-table-detail"
|
|
33
|
-
},
|
|
33
|
+
}, D = ["colspan"], O = ["id", "aria-label"], fe = {
|
|
34
34
|
key: 0,
|
|
35
|
-
class: "px-
|
|
36
|
-
}, k = "peer size-4 cursor-pointer appearance-none rounded-4 border border-
|
|
35
|
+
class: "px-6 py-12 text-center text-muted"
|
|
36
|
+
}, k = "border-border", A = "peer size-4 cursor-pointer appearance-none rounded-4 border border-muted/70 bg-surface align-middle transition-colors duration-150 checked:border-primary checked:bg-primary indeterminate:border-primary indeterminate:bg-primary focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-surface focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50", j = /*@__PURE__*/ l({
|
|
37
37
|
__name: "AcTable",
|
|
38
38
|
props: /*@__PURE__*/ u({
|
|
39
39
|
columns: {},
|
|
@@ -95,70 +95,70 @@ var T = { class: "ac-scrollbar" }, ne = { class: "w-full border-separate border-
|
|
|
95
95
|
"update:sortBy"
|
|
96
96
|
]),
|
|
97
97
|
setup(l, { emit: u }) {
|
|
98
|
-
let
|
|
98
|
+
let j = l, M = y(l, "selected"), N = y(l, "expanded"), P = u, F = ee(), I = y(l, "sortBy"), L = n(() => I.value?.key ?? ""), R = n(() => I.value?.mode ?? "asc"), z = (e) => {
|
|
99
99
|
if (!e.sortable) return;
|
|
100
|
-
let t =
|
|
101
|
-
|
|
100
|
+
let t = L.value === e.key && R.value === "asc" ? "desc" : "asc";
|
|
101
|
+
I.value = {
|
|
102
102
|
key: e.key,
|
|
103
103
|
mode: t
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
if (!
|
|
107
|
-
let e =
|
|
108
|
-
return [...
|
|
104
|
+
}, P("sort", e.key, t);
|
|
105
|
+
}, B = n(() => {
|
|
106
|
+
if (!L.value || j.manualSort) return j.rows;
|
|
107
|
+
let e = L.value, t = R.value === "asc" ? 1 : -1;
|
|
108
|
+
return [...j.rows].sort((n, r) => String(H(n[e]) ?? "").localeCompare(String(H(r[e]) ?? ""), void 0, { numeric: !0 }) * t);
|
|
109
109
|
});
|
|
110
|
-
function
|
|
110
|
+
function V(e) {
|
|
111
111
|
return typeof e == "object" && !!e && !Array.isArray(e) && "data" in e;
|
|
112
112
|
}
|
|
113
|
-
function
|
|
114
|
-
return
|
|
113
|
+
function H(e) {
|
|
114
|
+
return V(e) ? e.sort ?? e.data : e;
|
|
115
115
|
}
|
|
116
|
-
let
|
|
116
|
+
let U = (e) => !!j.rowDisabled?.(e), W = n(() => j.rows.filter((e) => !U(e)).map((e) => e[j.rowKey])), G = n(() => new Set(M.value)), K = n(() => W.value.length > 0 && W.value.every((e) => G.value.has(e))), q = n(() => !K.value && W.value.some((e) => G.value.has(e)));
|
|
117
117
|
function pe() {
|
|
118
|
-
let e = new Set(
|
|
119
|
-
|
|
118
|
+
let e = new Set(W.value);
|
|
119
|
+
M.value = K.value ? M.value.filter((t) => !e.has(t)) : [...M.value, ...W.value.filter((e) => !G.value.has(e))];
|
|
120
120
|
}
|
|
121
121
|
function me(e) {
|
|
122
|
-
let t = e[
|
|
123
|
-
|
|
122
|
+
let t = e[j.rowKey];
|
|
123
|
+
M.value = G.value.has(t) ? M.value.filter((e) => e !== t) : [...M.value, t];
|
|
124
124
|
}
|
|
125
|
-
let
|
|
125
|
+
let J = n(() => new Set(N.value)), Y = (e) => j.expandable && J.value.has(e[j.rowKey]), X = (e) => !j.canExpand || j.canExpand(e), Z = (e) => `${F}-detail-${String(e[j.rowKey])}`, he = n(() => j.columns.length + +!!j.selectable + +!!j.expandable);
|
|
126
126
|
function ge(e) {
|
|
127
|
-
let t = e[
|
|
128
|
-
|
|
127
|
+
let t = e[j.rowKey];
|
|
128
|
+
N.value = J.value.has(t) ? N.value.filter((e) => e !== t) : [...N.value, t];
|
|
129
129
|
}
|
|
130
|
-
function
|
|
131
|
-
let t = e[
|
|
132
|
-
return typeof n == "string" || typeof n == "number" ? n : String(e[
|
|
130
|
+
function Q(e) {
|
|
131
|
+
let t = e[j.columns[0]?.key ?? ""], n = V(t) ? t.data : t;
|
|
132
|
+
return typeof n == "string" || typeof n == "number" ? n : String(e[j.rowKey]);
|
|
133
133
|
}
|
|
134
|
-
let
|
|
134
|
+
let $ = (e) => ({
|
|
135
135
|
left: "text-left",
|
|
136
136
|
center: "text-center",
|
|
137
137
|
right: "text-right"
|
|
138
138
|
})[e.align ?? "left"];
|
|
139
139
|
return (n, u) => (p(), a("div", {
|
|
140
|
-
class: d(["w-full overflow-hidden bg-surface", !l.flat && "rounded-10 border border-border
|
|
140
|
+
class: d(["w-full overflow-hidden bg-surface", !l.flat && "rounded-10 border border-border"]),
|
|
141
141
|
"data-ac-ds": "",
|
|
142
142
|
"data-testid": "ac-table"
|
|
143
|
-
}, [o("div",
|
|
143
|
+
}, [o("div", ne, [o("table", re, [o("thead", null, [o("tr", null, [
|
|
144
144
|
l.expandable ? (p(), a("th", {
|
|
145
145
|
key: 0,
|
|
146
146
|
scope: "col",
|
|
147
|
-
class: d(["h-
|
|
147
|
+
class: d(["h-11 w-10 border-b bg-surface-sunken/50 pr-0 pl-4", [k, !l.flat && "first:rounded-tl-10"]])
|
|
148
148
|
}, [...u[2] ||= [o("span", { class: "sr-only" }, "Expand", -1)]], 2)) : i("", !0),
|
|
149
149
|
l.selectable ? (p(), a("th", {
|
|
150
150
|
key: 1,
|
|
151
151
|
scope: "col",
|
|
152
|
-
class: d(["h-
|
|
153
|
-
}, [o("span",
|
|
152
|
+
class: d(["h-11 w-10 border-b bg-surface-sunken/50 pr-1 pl-4", [k, !l.flat && "first:rounded-tl-10"]])
|
|
153
|
+
}, [o("span", ie, [o("input", {
|
|
154
154
|
type: "checkbox",
|
|
155
|
-
class: d(
|
|
156
|
-
checked:
|
|
157
|
-
indeterminate:
|
|
155
|
+
class: d(A),
|
|
156
|
+
checked: K.value,
|
|
157
|
+
indeterminate: q.value,
|
|
158
158
|
disabled: l.loading || !l.rows.length,
|
|
159
159
|
"aria-label": "Select all rows",
|
|
160
160
|
onChange: pe
|
|
161
|
-
}, null, 40,
|
|
161
|
+
}, null, 40, ae), (p(), r(g(q.value ? v(te) : v(S)), {
|
|
162
162
|
class: "pointer-events-none absolute inset-0 m-auto size-3 text-white opacity-0 peer-checked:opacity-100 peer-indeterminate:opacity-100",
|
|
163
163
|
"stroke-width": 3,
|
|
164
164
|
"aria-hidden": "true"
|
|
@@ -166,85 +166,85 @@ var T = { class: "ac-scrollbar" }, ne = { class: "w-full border-separate border-
|
|
|
166
166
|
(p(!0), a(t, null, m(l.columns, (e) => (p(), a("th", {
|
|
167
167
|
key: e.key,
|
|
168
168
|
scope: "col",
|
|
169
|
-
class: d(["h-
|
|
170
|
-
|
|
169
|
+
class: d(["h-11 border-b bg-surface-sunken/50 px-6 text-base font-semibold whitespace-nowrap text-muted", [
|
|
170
|
+
k,
|
|
171
171
|
!l.flat && "first:rounded-tl-10 last:rounded-tr-10",
|
|
172
172
|
$(e),
|
|
173
173
|
e.sortable && "cursor-pointer select-none transition-colors hover:text-heading"
|
|
174
174
|
]]),
|
|
175
175
|
style: f(e.width ? { width: e.width } : void 0),
|
|
176
|
-
"aria-sort":
|
|
177
|
-
onClick: (t) =>
|
|
178
|
-
}, [o("span", { class: d(["inline-flex items-center gap-
|
|
176
|
+
"aria-sort": L.value === e.key ? R.value === "asc" ? "ascending" : "descending" : void 0,
|
|
177
|
+
onClick: (t) => z(e)
|
|
178
|
+
}, [o("span", { class: d(["inline-flex items-center gap-2", L.value === e.key && "text-heading"]) }, [h(n.$slots, `header-${e.key}`, { column: e }, () => [s(_(e.label), 1)]), e.sortable ? (p(), r(g(L.value === e.key ? v(x) : v(w)), {
|
|
179
179
|
key: 0,
|
|
180
|
-
class: d(["size-
|
|
180
|
+
class: d(["size-4 shrink-0 transition-transform", [L.value === e.key ? "text-primary" : "text-muted/70", L.value === e.key && R.value === "desc" && "rotate-180"]]),
|
|
181
181
|
"aria-hidden": "true"
|
|
182
|
-
}, null, 8, ["class"])) : i("", !0)], 2)], 14,
|
|
182
|
+
}, null, 8, ["class"])) : i("", !0)], 2)], 14, oe))), 128))
|
|
183
183
|
])]), o("tbody", null, [l.loading ? (p(!0), a(t, { key: 0 }, m(l.loaderRows, (e) => (p(), a("tr", { key: `loader-${e}` }, [
|
|
184
|
-
l.expandable ? (p(), a("td",
|
|
185
|
-
l.selectable ? (p(), a("td",
|
|
184
|
+
l.expandable ? (p(), a("td", se)) : i("", !0),
|
|
185
|
+
l.selectable ? (p(), a("td", ce)) : i("", !0),
|
|
186
186
|
(p(!0), a(t, null, m(l.columns, (t, n) => (p(), a("td", {
|
|
187
187
|
key: t.key,
|
|
188
|
-
class: "h-12 border-b border-border
|
|
188
|
+
class: "h-12 border-b border-border px-6 [tr:last-child_&]:border-0"
|
|
189
189
|
}, [o("span", {
|
|
190
190
|
class: "block h-2.5 animate-pulse rounded-full bg-surface-sunken",
|
|
191
191
|
style: f({ width: `${50 + (e * 17 + n * 23) % 40}%` })
|
|
192
192
|
}, null, 4)]))), 128))
|
|
193
|
-
]))), 128)) : (p(!0), a(t, { key: 1 }, m(
|
|
193
|
+
]))), 128)) : (p(!0), a(t, { key: 1 }, m(B.value, (f, g) => (p(), a(t, { key: String(f[l.rowKey] ?? g) }, [o("tr", {
|
|
194
194
|
"data-testid": "ac-table-row",
|
|
195
|
-
class: d(["group transition-colors duration-
|
|
195
|
+
class: d(["group transition-colors duration-150 hover:bg-surface-sunken/40", [
|
|
196
196
|
l.clickable && "cursor-pointer",
|
|
197
|
-
(l.rowActive?.(f) || l.selectable &&
|
|
197
|
+
(l.rowActive?.(f) || l.selectable && G.value.has(f[l.rowKey])) && "bg-primary/5",
|
|
198
198
|
l.rowActive?.(f) && "shadow-[inset_0_0_0_1px_var(--color-primary)]",
|
|
199
|
-
|
|
199
|
+
U(f) && "pointer-events-none cursor-not-allowed opacity-50"
|
|
200
200
|
]]),
|
|
201
201
|
"aria-current": l.rowActive?.(f) ? "true" : void 0,
|
|
202
|
-
"aria-disabled":
|
|
203
|
-
onClick: (e) => l.clickable && !
|
|
202
|
+
"aria-disabled": U(f) || void 0,
|
|
203
|
+
onClick: (e) => l.clickable && !U(f) && P("row-click", f)
|
|
204
204
|
}, [
|
|
205
205
|
l.expandable ? (p(), a("td", {
|
|
206
206
|
key: 0,
|
|
207
|
-
class: "h-12 w-10 border-b border-border
|
|
207
|
+
class: "h-12 w-10 border-b border-border pr-0 pl-4 group-last:border-0",
|
|
208
208
|
onClick: u[0] ||= b(() => {}, ["stop"])
|
|
209
|
-
}, [
|
|
209
|
+
}, [X(f) ? (p(), a("button", {
|
|
210
210
|
key: 0,
|
|
211
211
|
type: "button",
|
|
212
|
-
class: "inline-flex size-7 cursor-pointer items-center justify-center rounded-
|
|
213
|
-
"aria-expanded":
|
|
214
|
-
"aria-controls":
|
|
215
|
-
"aria-label": `${
|
|
212
|
+
class: "inline-flex size-7 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",
|
|
213
|
+
"aria-expanded": Y(f),
|
|
214
|
+
"aria-controls": Z(f),
|
|
215
|
+
"aria-label": `${Y(f) ? "Collapse" : "Expand"} ${Q(f)}`,
|
|
216
216
|
"data-testid": "ac-table-expand",
|
|
217
217
|
onClick: (e) => ge(f)
|
|
218
|
-
}, [c(v(
|
|
219
|
-
class: d(["size-4 transition-transform duration-150 motion-reduce:transition-none",
|
|
218
|
+
}, [c(v(C), {
|
|
219
|
+
class: d(["size-4 transition-transform duration-150 motion-reduce:transition-none", Y(f) && "rotate-90"]),
|
|
220
220
|
"aria-hidden": "true"
|
|
221
|
-
}, null, 8, ["class"])], 8,
|
|
221
|
+
}, null, 8, ["class"])], 8, E)) : i("", !0)])) : i("", !0),
|
|
222
222
|
l.selectable ? (p(), a("td", {
|
|
223
223
|
key: 1,
|
|
224
|
-
class: "h-12 w-10 border-b border-border
|
|
224
|
+
class: "h-12 w-10 border-b border-border pr-1 pl-4 group-last:border-0",
|
|
225
225
|
onClick: u[1] ||= b(() => {}, ["stop"])
|
|
226
|
-
}, [o("span",
|
|
226
|
+
}, [o("span", le, [o("input", {
|
|
227
227
|
type: "checkbox",
|
|
228
|
-
class: d(
|
|
229
|
-
checked:
|
|
230
|
-
disabled:
|
|
231
|
-
"aria-label": `Select ${
|
|
228
|
+
class: d(A),
|
|
229
|
+
checked: G.value.has(f[l.rowKey]),
|
|
230
|
+
disabled: U(f),
|
|
231
|
+
"aria-label": `Select ${Q(f)}`,
|
|
232
232
|
onChange: (e) => me(f)
|
|
233
|
-
}, null, 40,
|
|
233
|
+
}, null, 40, ue), c(v(S), {
|
|
234
234
|
class: "pointer-events-none absolute inset-0 m-auto size-3 text-white opacity-0 peer-checked:opacity-100",
|
|
235
235
|
"stroke-width": 3,
|
|
236
236
|
"aria-hidden": "true"
|
|
237
237
|
})])])) : i("", !0),
|
|
238
238
|
(p(!0), a(t, null, m(l.columns, (i) => (p(), a("td", {
|
|
239
239
|
key: i.key,
|
|
240
|
-
class: d(["h-12 border-b border-border
|
|
240
|
+
class: d(["h-12 border-b border-border px-6 whitespace-nowrap text-body tabular-nums group-last:border-0", $(i)])
|
|
241
241
|
}, [h(n.$slots, `cell-${i.key}`, {
|
|
242
242
|
row: f,
|
|
243
243
|
value: f[i.key]
|
|
244
244
|
}, () => [i.type || i.descriptor ? (p(), r(e, {
|
|
245
245
|
key: 0,
|
|
246
|
-
value:
|
|
247
|
-
cell:
|
|
246
|
+
value: V(f[i.key]) ? void 0 : f[i.key],
|
|
247
|
+
cell: V(f[i.key]) ? f[i.key] : void 0,
|
|
248
248
|
column: i.descriptor,
|
|
249
249
|
type: i.type,
|
|
250
250
|
title: i.label,
|
|
@@ -257,16 +257,16 @@ var T = { class: "ac-scrollbar" }, ne = { class: "w-full border-separate border-
|
|
|
257
257
|
"title",
|
|
258
258
|
"resolve-link"
|
|
259
259
|
])) : (p(), a(t, { key: 1 }, [s(_(f[i.key]), 1)], 64))])], 2))), 128))
|
|
260
|
-
], 10,
|
|
260
|
+
], 10, T), Y(f) && X(f) ? (p(), a("tr", de, [o("td", {
|
|
261
261
|
colspan: he.value,
|
|
262
|
-
class: "border-b border-border
|
|
262
|
+
class: "border-b border-border bg-surface-muted p-0 group-last:border-0"
|
|
263
263
|
}, [o("div", {
|
|
264
|
-
id:
|
|
264
|
+
id: Z(f),
|
|
265
265
|
role: "region",
|
|
266
|
-
"aria-label": `Details for ${
|
|
267
|
-
class: "px-
|
|
268
|
-
}, [h(n.$slots, "expanded", { row: f })], 8,
|
|
266
|
+
"aria-label": `Details for ${Q(f)}`,
|
|
267
|
+
class: "px-6 py-4 text-body"
|
|
268
|
+
}, [h(n.$slots, "expanded", { row: f })], 8, O)], 8, D)])) : i("", !0)], 64))), 128))])])]), !l.loading && !l.rows.length ? (p(), a("div", fe, [h(n.$slots, "empty", {}, () => [s(_(l.emptyText), 1)])])) : i("", !0)], 2));
|
|
269
269
|
}
|
|
270
270
|
});
|
|
271
271
|
//#endregion
|
|
272
|
-
export {
|
|
272
|
+
export { j as default };
|
|
@@ -5,11 +5,11 @@ var b = {
|
|
|
5
5
|
"data-testid": "ac-tabs"
|
|
6
6
|
}, x = {
|
|
7
7
|
role: "tablist",
|
|
8
|
-
class: "flex gap-
|
|
8
|
+
class: "flex gap-6 overflow-x-auto overflow-y-hidden border-b border-border px-1 text-base font-medium [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"
|
|
9
9
|
}, S = {
|
|
10
10
|
key: 0,
|
|
11
11
|
role: "tabpanel",
|
|
12
|
-
class: "pt-
|
|
12
|
+
class: "pt-6"
|
|
13
13
|
}, C = /*@__PURE__*/ s({
|
|
14
14
|
__name: "AcTabs",
|
|
15
15
|
props: /*@__PURE__*/ l({ items: {} }, {
|
|
@@ -53,12 +53,12 @@ var b = {
|
|
|
53
53
|
return (t, c) => (f(), i("div", b, [a("div", x, [(f(!0), i(e, null, p(s.items, (e) => (f(), n(h(O(e)), u({ key: e.key }, { ref_for: !0 }, k(e), {
|
|
54
54
|
role: "tab",
|
|
55
55
|
"aria-selected": C.value === e.key,
|
|
56
|
-
class: ["relative
|
|
56
|
+
class: ["relative inline-flex shrink-0 cursor-pointer items-center gap-2 border-b-2 pt-1 pb-3 whitespace-nowrap no-underline transition-colors duration-200 focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none focus-visible:ring-inset disabled:cursor-not-allowed disabled:opacity-40 aria-disabled:pointer-events-none aria-disabled:cursor-not-allowed aria-disabled:opacity-40", C.value === e.key ? "border-primary text-primary-strong" : "border-transparent text-muted hover:border-border hover:text-heading"],
|
|
57
57
|
onClick: (t) => A(e, t)
|
|
58
58
|
}), {
|
|
59
59
|
default: y(() => [o(g(e.label) + " ", 1), e.count === void 0 ? r("", !0) : (f(), i("span", {
|
|
60
60
|
key: 0,
|
|
61
|
-
class: d(["inline-flex h-
|
|
61
|
+
class: d(["inline-flex h-5 min-w-5 items-center justify-center rounded-full px-1.5 text-xs leading-none font-medium tabular-nums", C.value === e.key ? "bg-primary/10 text-primary-strong" : "bg-surface-sunken text-muted"])
|
|
62
62
|
}, g(e.count), 3))]),
|
|
63
63
|
_: 2
|
|
64
64
|
}, 1040, [
|
|
@@ -4,7 +4,7 @@ export interface Props {
|
|
|
4
4
|
label?: string;
|
|
5
5
|
/** `neutral` for most labels; a tone to group filters by kind, e.g. environment or region. */
|
|
6
6
|
color?: Tone | "neutral";
|
|
7
|
-
/** Pill shape (`rounded-
|
|
7
|
+
/** Pill shape (`rounded-full`), as cloud-ui's label chips, instead of 6px corners. */
|
|
8
8
|
rounded?: boolean;
|
|
9
9
|
/** Shows a remove button that emits `remove`. */
|
|
10
10
|
removable?: boolean;
|
|
@@ -29,49 +29,49 @@ var m = {
|
|
|
29
29
|
setup(s, { emit: b }) {
|
|
30
30
|
let x = s, S = b, C = {
|
|
31
31
|
neutral: {
|
|
32
|
-
box: "bg-surface text-
|
|
33
|
-
value: "
|
|
32
|
+
box: "bg-surface-sunken text-heading border-border",
|
|
33
|
+
value: "text-heading",
|
|
34
34
|
divider: "border-border"
|
|
35
35
|
},
|
|
36
36
|
primary: {
|
|
37
|
-
box: "bg-primary
|
|
38
|
-
value: "bg-primary
|
|
39
|
-
divider: "border-primary
|
|
37
|
+
box: "bg-primary/10 text-primary-strong border-primary/25",
|
|
38
|
+
value: "bg-primary/10 text-primary-strong",
|
|
39
|
+
divider: "border-primary/25"
|
|
40
40
|
},
|
|
41
41
|
info: {
|
|
42
|
-
box: "bg-
|
|
43
|
-
value: "bg-
|
|
44
|
-
divider: "border-
|
|
42
|
+
box: "bg-info/10 text-info-strong border-info/25",
|
|
43
|
+
value: "bg-info/10 text-info-strong",
|
|
44
|
+
divider: "border-info/25"
|
|
45
45
|
},
|
|
46
46
|
success: {
|
|
47
|
-
box: "bg-
|
|
48
|
-
value: "bg-
|
|
49
|
-
divider: "border-
|
|
47
|
+
box: "bg-success/10 text-success-strong border-success/25",
|
|
48
|
+
value: "bg-success/10 text-success-strong",
|
|
49
|
+
divider: "border-success/25"
|
|
50
50
|
},
|
|
51
51
|
warning: {
|
|
52
|
-
box: "bg-
|
|
53
|
-
value: "bg-
|
|
54
|
-
divider: "border-
|
|
52
|
+
box: "bg-warning/10 text-warning-strong border-warning/30",
|
|
53
|
+
value: "bg-warning/10 text-warning-strong",
|
|
54
|
+
divider: "border-warning/30"
|
|
55
55
|
},
|
|
56
56
|
danger: {
|
|
57
|
-
box: "bg-
|
|
58
|
-
value: "bg-
|
|
59
|
-
divider: "border-
|
|
57
|
+
box: "bg-danger/10 text-danger-strong border-danger/25",
|
|
58
|
+
value: "bg-danger/10 text-danger-strong",
|
|
59
|
+
divider: "border-danger/25"
|
|
60
60
|
}
|
|
61
|
-
}, w = t(() => !!x.keyLabel), T = t(() => C[x.color]), E = t(() => w.value ? `${x.keyLabel}=${x.valueLabel}` : x.label), D = t(() => w.value ? ["bg-surface text-
|
|
61
|
+
}, w = t(() => !!x.keyLabel), T = t(() => C[x.color]), E = t(() => w.value ? `${x.keyLabel}=${x.valueLabel}` : x.label), D = t(() => w.value ? ["bg-surface-sunken text-muted", T.value.divider] : T.value.box);
|
|
62
62
|
function O() {
|
|
63
63
|
S("remove");
|
|
64
64
|
}
|
|
65
65
|
return (t, b) => (l(), r("span", {
|
|
66
|
-
class: c(["inline-flex h-6 max-w-full items-stretch overflow-hidden border text-xs leading-none whitespace-nowrap", [
|
|
66
|
+
class: c(["inline-flex h-6 max-w-full items-stretch overflow-hidden border text-xs leading-none font-medium whitespace-nowrap", [
|
|
67
67
|
D.value,
|
|
68
|
-
s.rounded ? "rounded-
|
|
69
|
-
w.value && "font-mono
|
|
68
|
+
s.rounded ? "rounded-full" : "rounded-6",
|
|
69
|
+
w.value && "font-mono"
|
|
70
70
|
]]),
|
|
71
71
|
"data-ac-ds": "",
|
|
72
72
|
"data-testid": "ac-tag"
|
|
73
73
|
}, [w.value ? (l(), r(e, { key: 0 }, [
|
|
74
|
-
i("span", { class: c(["inline-flex min-w-0 items-center gap-1.5
|
|
74
|
+
i("span", { class: c(["inline-flex min-w-0 items-center gap-1.5 pr-1.5 text-muted", s.rounded ? "pl-2.5" : "pl-2"]) }, [t.$slots.icon ? (l(), r("span", m, [u(t.$slots, "icon")])) : n("", !0), i("span", h, d(s.keyLabel), 1)], 2),
|
|
75
75
|
b[0] ||= i("span", { class: "sr-only" }, "=", -1),
|
|
76
76
|
i("span", { class: c(["inline-flex min-w-0 shrink-[0.25] items-center border-l pl-1.5", [
|
|
77
77
|
T.value.value,
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
export interface Props {
|
|
2
|
+
/** Label above the field. Also the accessible name of the input and of the list of values. */
|
|
3
|
+
label: string;
|
|
4
|
+
/** Native `name` attribute of the text input. */
|
|
5
|
+
name?: string;
|
|
6
|
+
/** Example value shown in the empty input, e.g. "e.g. 10.0.0.0/16". */
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
/** Help text between the label and the field. */
|
|
9
|
+
hint?: string;
|
|
10
|
+
/** Error text under the field. Turns the border red and sets `aria-invalid`. A rejected value's own message shows first. */
|
|
11
|
+
errorMsg?: string;
|
|
12
|
+
/** `small` 36px or `normal` 40px tall when empty; the field grows as values wrap. */
|
|
13
|
+
size?: "small" | "normal";
|
|
14
|
+
/** Most values allowed. The count shows under the field and adding more shows an error. */
|
|
15
|
+
maxItems?: number;
|
|
16
|
+
/** Lets the same value be added twice. Off by default: a repeat shows “… is already added”. */
|
|
17
|
+
allowDuplicates?: boolean;
|
|
18
|
+
/** Checks a value before it's added. Return a message to reject it; the text stays in the input with the message. */
|
|
19
|
+
validate?: (value: string, values: string[]) => string | void | null | undefined;
|
|
20
|
+
/** Cleans typed text before it's checked and added, e.g. `(v) => v.trim().toLowerCase()`. Defaults to trimming. */
|
|
21
|
+
transform?: (value: string) => string;
|
|
22
|
+
/** Shows a button that removes every value. Was `show-all-clear` in cloud-ui. */
|
|
23
|
+
showClear?: boolean;
|
|
24
|
+
/** Adds the typed text when the input loses focus, so a value isn't lost when people click Save. */
|
|
25
|
+
addOnBlur?: boolean;
|
|
26
|
+
/** Shows values and the input in the monospace font, for IPs, CIDRs and resource names. */
|
|
27
|
+
mono?: boolean;
|
|
28
|
+
/** Marks the field required and adds a red asterisk. Pass `error-msg` when the list is empty on submit. Was `is-required` in cloud-ui. */
|
|
29
|
+
required?: boolean;
|
|
30
|
+
/** Disables the field. Was `is-disabled` in cloud-ui. */
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
/** Shows the values on a muted fill, without remove buttons or the text input. Was `is-read-only` in cloud-ui. */
|
|
33
|
+
readonly?: boolean;
|
|
34
|
+
}
|
|
35
|
+
type __VLS_Props = Props;
|
|
36
|
+
type __VLS_ModelProps = {
|
|
37
|
+
/** The values, in the order they were added. Replaced with a new array on every change. */
|
|
38
|
+
modelValue?: string[];
|
|
39
|
+
};
|
|
40
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
41
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
42
|
+
/** Moves focus to the text input. */
|
|
43
|
+
focus: () => void | undefined;
|
|
44
|
+
/** Adds the typed text now, e.g. before submitting. Returns `false` when text was rejected and is still in the input. */
|
|
45
|
+
commit: () => boolean;
|
|
46
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
47
|
+
"update:modelValue": (value: string[]) => any;
|
|
48
|
+
clear: () => any;
|
|
49
|
+
add: (value: string) => any;
|
|
50
|
+
remove: (value: string, index: number) => any;
|
|
51
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
52
|
+
"onUpdate:modelValue"?: ((value: string[]) => any) | undefined;
|
|
53
|
+
onClear?: (() => any) | undefined;
|
|
54
|
+
onAdd?: ((value: string) => any) | undefined;
|
|
55
|
+
onRemove?: ((value: string, index: number) => any) | undefined;
|
|
56
|
+
}>, {
|
|
57
|
+
required: boolean;
|
|
58
|
+
disabled: boolean;
|
|
59
|
+
name: string;
|
|
60
|
+
transform: (value: string) => string;
|
|
61
|
+
size: "small" | "normal";
|
|
62
|
+
maxItems: number;
|
|
63
|
+
readonly: boolean;
|
|
64
|
+
hint: string;
|
|
65
|
+
validate: (value: string, values: string[]) => string | void | null | undefined;
|
|
66
|
+
placeholder: string;
|
|
67
|
+
errorMsg: string;
|
|
68
|
+
mono: boolean;
|
|
69
|
+
allowDuplicates: boolean;
|
|
70
|
+
showClear: boolean;
|
|
71
|
+
addOnBlur: boolean;
|
|
72
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
73
|
+
declare const _default: typeof __VLS_export;
|
|
74
|
+
export default _default;
|