@ac-design/design-system 2.2.1 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/compat.css +421 -0
- package/dist/lib/components/AcAppSwitcher.vue.d.ts +1 -1
- package/dist/lib/components/AcAppSwitcher.vue_vue_type_script_setup_true_lang.js +23 -23
- package/dist/lib/components/AcAreaChart.vue.d.ts +1 -1
- package/dist/lib/components/AcBarChart.vue.d.ts +1 -1
- package/dist/lib/components/AcButton.vue.d.ts +25 -13
- package/dist/lib/components/AcButton.vue_vue_type_script_setup_true_lang.js +122 -71
- package/dist/lib/components/AcCard.vue.d.ts +11 -5
- package/dist/lib/components/AcCard.vue_vue_type_script_setup_true_lang.js +99 -51
- package/dist/lib/components/AcCellValue.vue.d.ts +3 -3
- package/dist/lib/components/AcCellValue.vue_vue_type_script_setup_true_lang.js +20 -20
- package/dist/lib/components/AcCheckBox.vue.d.ts +4 -1
- package/dist/lib/components/AcCheckBox.vue_vue_type_script_setup_true_lang.js +50 -50
- package/dist/lib/components/AcCircularProgress.vue.d.ts +1 -1
- package/dist/lib/components/AcCodeEditor.vue.d.ts +12 -0
- package/dist/lib/components/AcCodeEditor.vue_vue_type_script_setup_true_lang.js +240 -207
- package/dist/lib/components/AcColorInput.vue.d.ts +4 -4
- package/dist/lib/components/AcColorInput.vue_vue_type_script_setup_true_lang.js +72 -66
- package/dist/lib/components/AcCostSummary.vue.d.ts +1 -1
- package/dist/lib/components/AcDatePicker.vue.d.ts +41 -10
- package/dist/lib/components/AcDatePicker.vue_vue_type_script_setup_true_lang.js +554 -446
- package/dist/lib/components/AcDeleteModal.vue.d.ts +1 -1
- package/dist/lib/components/AcDonutChart.vue.d.ts +2 -2
- package/dist/lib/components/AcDropdown.vue.d.ts +1 -1
- package/dist/lib/components/AcDropdown.vue_vue_type_script_setup_true_lang.js +8 -8
- package/dist/lib/components/AcErrorState.vue.d.ts +1 -1
- package/dist/lib/components/AcFormFooter.vue_vue_type_script_setup_true_lang.js +8 -8
- package/dist/lib/components/AcGraphChart.vue.d.ts +2 -2
- package/dist/lib/components/AcHeader.vue.d.ts +1 -1
- package/dist/lib/components/AcInput.vue.d.ts +86 -44
- package/dist/lib/components/AcInput.vue_vue_type_script_setup_true_lang.js +319 -86
- package/dist/lib/components/AcKeyValueInput.vue.d.ts +34 -54
- package/dist/lib/components/AcKeyValueInput.vue_vue_type_script_setup_true_lang.js +134 -106
- package/dist/lib/components/AcLineChart.vue.d.ts +1 -1
- package/dist/lib/components/AcLocaleSwitcher.vue.d.ts +6 -0
- package/dist/lib/components/AcLocaleSwitcher.vue_vue_type_script_setup_true_lang.js +74 -58
- package/dist/lib/components/AcMapChart.vue.d.ts +2 -2
- package/dist/lib/components/AcModal.vue.d.ts +1 -1
- package/dist/lib/components/AcNavbar.vue.d.ts +2 -0
- package/dist/lib/components/AcNavbar.vue_vue_type_script_setup_true_lang.js +31 -25
- package/dist/lib/components/AcNotificationMenu.vue.d.ts +1 -1
- package/dist/lib/components/AcNotificationMenu.vue_vue_type_script_setup_true_lang.js +24 -24
- package/dist/lib/components/AcNumberInput.vue.d.ts +55 -45
- package/dist/lib/components/AcNumberInput.vue_vue_type_script_setup_true_lang.js +159 -99
- package/dist/lib/components/AcRadioCard.js +5 -0
- package/dist/lib/components/AcRadioCard.vue.d.ts +55 -0
- package/dist/lib/components/AcRadioCard.vue_vue_type_script_setup_true_lang.js +135 -0
- package/dist/lib/components/AcSelect.vue.d.ts +46 -6
- package/dist/lib/components/AcSelect.vue_vue_type_script_setup_true_lang.js +309 -197
- package/dist/lib/components/AcSidePanel.vue.d.ts +1 -1
- package/dist/lib/components/AcSidebar.vue.d.ts +9 -0
- package/dist/lib/components/AcSidebar.vue_vue_type_script_setup_true_lang.js +113 -94
- package/dist/lib/components/AcSidebarSection.vue_vue_type_script_setup_true_lang.js +19 -18
- package/dist/lib/components/AcSlider.vue.d.ts +2 -2
- package/dist/lib/components/AcSwitch.vue_vue_type_script_setup_true_lang.js +23 -23
- package/dist/lib/components/AcTable.vue.d.ts +50 -5
- package/dist/lib/components/AcTable.vue_vue_type_script_setup_true_lang.js +257 -129
- package/dist/lib/components/AcTagInput.vue.d.ts +23 -4
- package/dist/lib/components/AcTagInput.vue_vue_type_script_setup_true_lang.js +126 -114
- package/dist/lib/components/AcTaintInput.js +5 -0
- package/dist/lib/components/AcTaintInput.vue.d.ts +44 -0
- package/dist/lib/components/AcTaintInput.vue_vue_type_script_setup_true_lang.js +208 -0
- package/dist/lib/components/AcTextarea.vue.d.ts +64 -4
- package/dist/lib/components/AcTextarea.vue_vue_type_script_setup_true_lang.js +159 -68
- package/dist/lib/components/AcThemeMode.vue.d.ts +10 -2
- package/dist/lib/components/AcThemeMode.vue_vue_type_script_setup_true_lang.js +53 -42
- package/dist/lib/components/AcTimePicker.vue.d.ts +36 -11
- package/dist/lib/components/AcTimePicker.vue_vue_type_script_setup_true_lang.js +232 -168
- package/dist/lib/components/AcTooltip.vue.d.ts +3 -3
- package/dist/lib/components/AcUserMenu.vue.d.ts +8 -0
- package/dist/lib/components/AcUserMenu.vue_vue_type_script_setup_true_lang.js +126 -109
- package/dist/lib/components/index.d.ts +2 -0
- package/dist/lib/components/types.d.ts +2 -0
- package/dist/lib/composables/useToast.d.ts +2 -2
- package/dist/lib/index.d.ts +2 -1
- package/dist/lib/index.js +51 -49
- package/package.json +1 -1
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
import { computed as e, createCommentVNode as t, createElementBlock as n, createElementVNode as r, createVNode as i, defineComponent as a, mergeModels as o, mergeProps as s, normalizeClass as c, onBeforeUnmount as
|
|
2
|
-
import { Minus as
|
|
1
|
+
import { computed as e, createCommentVNode as t, createElementBlock as n, createElementVNode as r, createVNode as i, defineComponent as a, mergeModels as o, mergeProps as s, normalizeClass as c, onBeforeUnmount as ee, openBlock as l, ref as u, renderSlot as d, toDisplayString as f, unref as p, useAttrs as m, useId as h, useModel as te, useSlots as ne, watch as re } from "vue";
|
|
2
|
+
import { Minus as ie, Plus as ae } from "@lucide/vue";
|
|
3
3
|
//#region src/lib/components/AcNumberInput.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
-
var
|
|
5
|
-
key: 0,
|
|
6
|
-
class: "text-muted"
|
|
7
|
-
}, ie = {
|
|
8
|
-
key: 1,
|
|
9
|
-
class: "text-danger",
|
|
10
|
-
"aria-hidden": "true"
|
|
11
|
-
}, y = ["id"], b = { class: "flex items-center gap-3" }, ae = [
|
|
4
|
+
var oe = ["for"], g = { key: 0 }, _ = ["id"], se = { class: "flex items-center gap-3" }, ce = ["tabindex"], le = [
|
|
12
5
|
"id",
|
|
13
6
|
"inputmode",
|
|
14
7
|
"value",
|
|
15
8
|
"name",
|
|
9
|
+
"placeholder",
|
|
16
10
|
"disabled",
|
|
17
11
|
"readonly",
|
|
18
12
|
"required",
|
|
@@ -22,12 +16,13 @@ var re = ["for"], v = {
|
|
|
22
16
|
"aria-valuetext",
|
|
23
17
|
"aria-invalid",
|
|
24
18
|
"aria-describedby"
|
|
25
|
-
],
|
|
19
|
+
], ue = { key: 0 }, de = ["tabindex"], v = ["id"], y = /*@__PURE__*/ a({
|
|
26
20
|
inheritAttrs: !1,
|
|
27
21
|
__name: "AcNumberInput",
|
|
28
22
|
props: /*@__PURE__*/ o({
|
|
29
23
|
label: { default: "" },
|
|
30
24
|
name: { default: "" },
|
|
25
|
+
placeholder: { default: void 0 },
|
|
31
26
|
min: { default: void 0 },
|
|
32
27
|
max: { default: void 0 },
|
|
33
28
|
step: { default: 1 },
|
|
@@ -43,6 +38,10 @@ var re = ["for"], v = {
|
|
|
43
38
|
type: Boolean,
|
|
44
39
|
default: !1
|
|
45
40
|
},
|
|
41
|
+
requiredMark: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: !1
|
|
44
|
+
},
|
|
46
45
|
disabled: {
|
|
47
46
|
type: Boolean,
|
|
48
47
|
default: !1
|
|
@@ -53,37 +52,82 @@ var re = ["for"], v = {
|
|
|
53
52
|
},
|
|
54
53
|
errorMsg: { default: "" },
|
|
55
54
|
hint: { default: "" },
|
|
56
|
-
size: { default: "normal" }
|
|
55
|
+
size: { default: "normal" },
|
|
56
|
+
emptyValue: { default: "null" },
|
|
57
|
+
readonlyText: { default: "(read only)" },
|
|
58
|
+
plainReadonly: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
default: !1
|
|
61
|
+
},
|
|
62
|
+
plainError: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: !1
|
|
65
|
+
},
|
|
66
|
+
flushLabelSlots: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
default: !1
|
|
69
|
+
},
|
|
70
|
+
rangeMessage: { default: "" },
|
|
71
|
+
inheritFont: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
default: !1
|
|
74
|
+
},
|
|
75
|
+
focusableStepButtons: {
|
|
76
|
+
type: Boolean,
|
|
77
|
+
default: !1
|
|
78
|
+
},
|
|
79
|
+
autoWidth: {
|
|
80
|
+
type: Boolean,
|
|
81
|
+
default: !1
|
|
82
|
+
}
|
|
57
83
|
}, {
|
|
58
84
|
modelValue: { default: null },
|
|
59
85
|
modelModifiers: {}
|
|
60
86
|
}),
|
|
61
87
|
emits: /*@__PURE__*/ o(["change"], ["update:modelValue"]),
|
|
62
|
-
setup(a, { expose: o, emit:
|
|
63
|
-
let
|
|
64
|
-
class:
|
|
65
|
-
style:
|
|
66
|
-
})),
|
|
67
|
-
let { class: e, style: t, ...n } =
|
|
88
|
+
setup(a, { expose: o, emit: y }) {
|
|
89
|
+
let b = a, x = te(a, "modelValue"), fe = y, S = h(), C = m(), w = ne(), T = e(() => ({
|
|
90
|
+
class: C.class,
|
|
91
|
+
style: C.style
|
|
92
|
+
})), E = e(() => {
|
|
93
|
+
let { class: e, style: t, ...n } = C;
|
|
68
94
|
return n;
|
|
69
|
-
}),
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
95
|
+
}), D = u(null), O = u(G(x.value)), k = u(!1), A = u(""), j, M, pe = e(() => !!b.label || !!w["label-icon"] || !!w["label-extra"]), N = {
|
|
96
|
+
small: "h-9",
|
|
97
|
+
normal: "h-10.5",
|
|
98
|
+
large: "h-11.5"
|
|
99
|
+
}, P = e(() => b.size in N ? b.size : "normal"), F = e(() => b.precision ?? ve(b.step)), I = e(() => b.min === void 0 || b.min < 0), L = e(() => b.disabled || b.readonly), R = e(() => x.value), z = e(() => b.min !== void 0 && !U(R.value) && R.value <= b.min), B = e(() => b.max !== void 0 && !U(R.value) && R.value >= b.max), me = e(() => {
|
|
100
|
+
let e = R.value;
|
|
101
|
+
if (!k.value || U(e)) return "";
|
|
102
|
+
let { min: t, max: n } = b;
|
|
73
103
|
return (t === void 0 || e >= t) && (n === void 0 || e <= n) ? "" : t !== void 0 && n !== void 0 ? `Enter a value from ${t} to ${n}` : t === void 0 ? `Enter ${n} or less` : `Enter ${t} or more`;
|
|
74
|
-
}),
|
|
104
|
+
}), V = e(() => b.rangeMessage ? A.value || b.errorMsg : b.errorMsg || me.value), he = e(() => {
|
|
105
|
+
if (V.value && !b.plainError) return "border-danger focus-within:shadow-[0_0_0_2px_color-mix(in_srgb,var(--color-danger)_20%,transparent)]";
|
|
106
|
+
let e = !b.disabled && "hover:border-accent-active";
|
|
107
|
+
return b.readonly && b.plainReadonly ? ["border-border focus-within:border-[color-mix(in_srgb,var(--color-primary)_35%,transparent)]", e] : ["border-border focus-within:focus-ring", e];
|
|
108
|
+
}), ge = e(() => [b.hint && `${S}-hint`, V.value && `${S}-msg`].filter(Boolean).join(" ") || void 0), H = e(() => [
|
|
109
|
+
"inline-flex shrink-0 cursor-pointer items-center justify-center rounded-10 border border-border bg-accent text-heading transition-colors duration-200 select-none hover:bg-accent-hover active:bg-accent-active disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-accent",
|
|
110
|
+
N[P.value],
|
|
111
|
+
P.value === "small" ? "px-3" : "px-5"
|
|
112
|
+
]), _e = e(() => U(x.value) ? void 0 : [O.value, b.unit].filter(Boolean).join(" "));
|
|
113
|
+
function U(e) {
|
|
114
|
+
return e == null;
|
|
115
|
+
}
|
|
75
116
|
function W(e) {
|
|
117
|
+
return e === null && b.emptyValue === "undefined" ? void 0 : e;
|
|
118
|
+
}
|
|
119
|
+
function ve(e) {
|
|
76
120
|
let t = String(e);
|
|
77
121
|
return t.includes("e-") ? Number(t.split("e-")[1]) : t.split(".")[1]?.length ?? 0;
|
|
78
122
|
}
|
|
79
123
|
function G(e) {
|
|
80
|
-
return e
|
|
124
|
+
return U(e) ? "" : String(e);
|
|
81
125
|
}
|
|
82
126
|
function K(e) {
|
|
83
|
-
return Number(e.toFixed(
|
|
127
|
+
return Number(e.toFixed(F.value));
|
|
84
128
|
}
|
|
85
129
|
function q(e) {
|
|
86
|
-
return
|
|
130
|
+
return b.min !== void 0 && e < b.min ? b.min : b.max !== void 0 && e > b.max ? b.max : e;
|
|
87
131
|
}
|
|
88
132
|
function J(e) {
|
|
89
133
|
if (e === "" || e === "-" || e === "." || e === "-.") return null;
|
|
@@ -91,151 +135,167 @@ var re = ["for"], v = {
|
|
|
91
135
|
return Number.isNaN(t) ? null : t;
|
|
92
136
|
}
|
|
93
137
|
function Y(e) {
|
|
94
|
-
let t = e !==
|
|
95
|
-
|
|
138
|
+
let t = W(e), n = t !== x.value;
|
|
139
|
+
x.value = t, O.value = G(e), n && fe("change", t);
|
|
140
|
+
}
|
|
141
|
+
function ye() {
|
|
142
|
+
return b.rangeMessage.replace("{min}", String(b.min ?? -Infinity)).replace("{max}", String(b.max ?? Infinity));
|
|
96
143
|
}
|
|
97
144
|
function X(e, t = 1) {
|
|
98
|
-
|
|
145
|
+
L.value || Y(q(K((x.value ?? 0) + e * b.step * t)));
|
|
99
146
|
}
|
|
100
|
-
function
|
|
147
|
+
function be(e) {
|
|
101
148
|
let t = e.target;
|
|
102
|
-
if (!RegExp(`^${
|
|
103
|
-
t.value =
|
|
149
|
+
if (!RegExp(`^${I.value ? "-?" : ""}\\d*${F.value > 0 ? "(\\.\\d*)?" : ""}$`).test(t.value)) {
|
|
150
|
+
t.value = O.value;
|
|
104
151
|
return;
|
|
105
152
|
}
|
|
106
|
-
|
|
153
|
+
O.value = t.value;
|
|
107
154
|
let n = J(t.value);
|
|
108
|
-
(n !== null || t.value === "") && (
|
|
155
|
+
if ((n !== null || t.value === "") && (x.value = W(n)), b.rangeMessage) {
|
|
156
|
+
let e = Number(t.value);
|
|
157
|
+
A.value = e > (b.max ?? Infinity) || e < (b.min ?? -Infinity) ? ye() : "";
|
|
158
|
+
}
|
|
109
159
|
}
|
|
110
160
|
function Z() {
|
|
111
|
-
let e = J(
|
|
161
|
+
let e = J(O.value);
|
|
112
162
|
Y(e === null ? null : q(K(e)));
|
|
113
163
|
}
|
|
114
|
-
function
|
|
115
|
-
|
|
164
|
+
function xe() {
|
|
165
|
+
k.value = !1, Z(), O.value !== "" && (A.value = "");
|
|
116
166
|
}
|
|
117
|
-
function
|
|
167
|
+
function Se(e) {
|
|
118
168
|
let t = {
|
|
119
169
|
ArrowUp: () => X(1),
|
|
120
170
|
ArrowDown: () => X(-1),
|
|
121
171
|
PageUp: () => X(1, 10),
|
|
122
172
|
PageDown: () => X(-1, 10)
|
|
123
173
|
};
|
|
124
|
-
if (
|
|
174
|
+
if (b.min !== void 0 && (t.Home = () => !L.value && Y(b.min)), b.max !== void 0 && (t.End = () => !L.value && Y(b.max)), e.key === "Enter") return Z();
|
|
125
175
|
let n = t[e.key];
|
|
126
176
|
n && (e.preventDefault(), n());
|
|
127
177
|
}
|
|
128
178
|
function Q() {
|
|
129
|
-
clearTimeout(
|
|
179
|
+
clearTimeout(j), clearInterval(M);
|
|
130
180
|
}
|
|
131
|
-
function
|
|
132
|
-
e.button !== 0 ||
|
|
133
|
-
|
|
134
|
-
X(t), (t > 0 &&
|
|
135
|
-
},
|
|
136
|
-
},
|
|
181
|
+
function Ce(e, t) {
|
|
182
|
+
e.button !== 0 || L.value || (Q(), X(t), j = setTimeout(() => {
|
|
183
|
+
M = setInterval(() => {
|
|
184
|
+
X(t), (t > 0 && B.value || t < 0 && z.value) && Q();
|
|
185
|
+
}, b.holdIntervalDelay);
|
|
186
|
+
}, b.holdDelay));
|
|
137
187
|
}
|
|
138
|
-
function
|
|
188
|
+
function we(e, t) {
|
|
139
189
|
e.detail === 0 && X(t);
|
|
140
190
|
}
|
|
141
191
|
function $(e) {
|
|
142
192
|
let t = e < 0 ? "Decrease" : "Increase";
|
|
143
193
|
return {
|
|
144
194
|
"aria-label": t,
|
|
145
|
-
"aria-controls":
|
|
195
|
+
"aria-controls": S,
|
|
146
196
|
"data-testid": `ac-number-input-${t.toLowerCase()}`,
|
|
147
|
-
disabled:
|
|
148
|
-
onMousedown: (e) => e.preventDefault(),
|
|
149
|
-
onPointerdown: (t) =>
|
|
197
|
+
disabled: L.value || (e < 0 ? z.value : B.value),
|
|
198
|
+
onMousedown: (e) => !b.focusableStepButtons && e.preventDefault(),
|
|
199
|
+
onPointerdown: (t) => Ce(t, e),
|
|
150
200
|
onPointerup: Q,
|
|
151
201
|
onPointerleave: Q,
|
|
152
202
|
onPointercancel: Q,
|
|
153
|
-
onClick: (t) =>
|
|
203
|
+
onClick: (t) => we(t, e)
|
|
154
204
|
};
|
|
155
205
|
}
|
|
156
|
-
return
|
|
157
|
-
J(
|
|
158
|
-
}),
|
|
159
|
-
class: ["w-full", a.disabled && "opacity-50"],
|
|
206
|
+
return re(x, (e) => {
|
|
207
|
+
J(O.value) !== (e ?? null) && (O.value = G(e));
|
|
208
|
+
}), ee(Q), o({ focus: () => D.value?.focus() }), (e, o) => (l(), n("div", s(T.value, {
|
|
209
|
+
class: [!a.autoWidth && "w-full", a.disabled && "opacity-50"],
|
|
160
210
|
"data-ac-ds": "",
|
|
161
211
|
"data-testid": "ac-number-input"
|
|
162
212
|
}), [
|
|
163
|
-
|
|
213
|
+
pe.value ? (l(), n("label", {
|
|
164
214
|
key: 0,
|
|
165
|
-
for:
|
|
166
|
-
class: "mb-2 flex items-center
|
|
215
|
+
for: p(S),
|
|
216
|
+
class: c(["mb-2 flex items-center text-base font-medium text-heading", !a.flushLabelSlots && "gap-1"])
|
|
167
217
|
}, [
|
|
168
|
-
|
|
169
|
-
a.
|
|
170
|
-
a.
|
|
171
|
-
|
|
172
|
-
|
|
218
|
+
d(e.$slots, "label-icon"),
|
|
219
|
+
a.label ? (l(), n("span", g, f(a.label), 1)) : t("", !0),
|
|
220
|
+
a.readonly ? (l(), n("span", {
|
|
221
|
+
key: 1,
|
|
222
|
+
class: c(["text-muted", a.flushLabelSlots && "ml-1"])
|
|
223
|
+
}, f(a.readonlyText), 3)) : t("", !0),
|
|
224
|
+
d(e.$slots, "label-extra"),
|
|
225
|
+
a.required || a.requiredMark ? (l(), n("span", {
|
|
226
|
+
key: 2,
|
|
227
|
+
class: c(["text-danger", a.flushLabelSlots && "ml-1"]),
|
|
228
|
+
"aria-hidden": "true"
|
|
229
|
+
}, "*", 2)) : t("", !0)
|
|
230
|
+
], 10, oe)) : t("", !0),
|
|
231
|
+
a.hint ? (l(), n("p", {
|
|
173
232
|
key: 1,
|
|
174
|
-
id: `${
|
|
233
|
+
id: `${p(S)}-hint`,
|
|
175
234
|
class: "mb-2 text-base text-muted"
|
|
176
|
-
},
|
|
177
|
-
r("div",
|
|
178
|
-
a.stepButtons ? (
|
|
235
|
+
}, f(a.hint), 9, _)) : t("", !0),
|
|
236
|
+
r("div", se, [
|
|
237
|
+
a.stepButtons ? (l(), n("button", s({
|
|
179
238
|
key: 0,
|
|
180
239
|
type: "button",
|
|
181
|
-
tabindex:
|
|
240
|
+
tabindex: a.focusableStepButtons ? void 0 : -1,
|
|
182
241
|
class: H.value
|
|
183
|
-
}, $(-1)), [i(
|
|
242
|
+
}, $(-1)), [i(p(ie), {
|
|
184
243
|
class: c(a.size === "small" ? "size-4" : "size-6"),
|
|
185
244
|
"aria-hidden": "true"
|
|
186
|
-
}, null, 8, ["class"])], 16)) : t("", !0),
|
|
245
|
+
}, null, 8, ["class"])], 16, ce)) : t("", !0),
|
|
187
246
|
r("div", { class: c(["relative flex min-w-0 flex-1 items-center rounded-10 border transition-[border-color,box-shadow,background-color] duration-200", [
|
|
188
|
-
|
|
189
|
-
a.readonly ? "bg-surface-muted" : "bg-background",
|
|
190
|
-
|
|
247
|
+
N[P.value],
|
|
248
|
+
a.readonly && !a.plainReadonly ? "bg-surface-muted" : "bg-background",
|
|
249
|
+
he.value
|
|
191
250
|
]]) }, [r("input", s({
|
|
192
|
-
id:
|
|
251
|
+
id: p(S),
|
|
193
252
|
ref_key: "input",
|
|
194
|
-
ref:
|
|
195
|
-
},
|
|
253
|
+
ref: D
|
|
254
|
+
}, E.value, {
|
|
196
255
|
type: "text",
|
|
197
256
|
role: "spinbutton",
|
|
198
257
|
autocomplete: "off",
|
|
199
|
-
inputmode:
|
|
200
|
-
value:
|
|
258
|
+
inputmode: F.value > 0 || I.value ? "decimal" : "numeric",
|
|
259
|
+
value: O.value,
|
|
201
260
|
name: a.name,
|
|
261
|
+
placeholder: a.placeholder,
|
|
202
262
|
disabled: a.disabled,
|
|
203
263
|
readonly: a.readonly,
|
|
204
264
|
required: a.required,
|
|
205
|
-
"aria-valuenow":
|
|
265
|
+
"aria-valuenow": x.value ?? void 0,
|
|
206
266
|
"aria-valuemin": a.min,
|
|
207
267
|
"aria-valuemax": a.max,
|
|
208
|
-
"aria-valuetext":
|
|
209
|
-
"aria-invalid": !!
|
|
210
|
-
"aria-describedby":
|
|
211
|
-
class: "block h-full w-full min-w-0 flex-1 rounded-10 bg-transparent px-2 text-center text-base
|
|
212
|
-
onInput:
|
|
213
|
-
onKeydown:
|
|
214
|
-
onFocus: o[0] ||= (e) =>
|
|
215
|
-
onBlur:
|
|
216
|
-
}), null, 16,
|
|
268
|
+
"aria-valuetext": _e.value,
|
|
269
|
+
"aria-invalid": !!V.value || void 0,
|
|
270
|
+
"aria-describedby": ge.value,
|
|
271
|
+
class: ["block h-full w-full min-w-0 flex-1 rounded-10 bg-transparent px-2 text-center text-base text-heading tabular-nums outline-none disabled:cursor-not-allowed", [a.inheritFont ? "font-[inherit]" : "font-normal placeholder:text-muted/80", a.readonly && a.plainReadonly && "cursor-default"]],
|
|
272
|
+
onInput: be,
|
|
273
|
+
onKeydown: Se,
|
|
274
|
+
onFocus: o[0] ||= (e) => k.value = !0,
|
|
275
|
+
onBlur: xe
|
|
276
|
+
}), null, 16, le), a.unit || e.$slots.suffix ? (l(), n("span", {
|
|
217
277
|
key: 0,
|
|
218
278
|
class: c(["flex h-full shrink-0 items-center gap-1.5 text-base whitespace-nowrap text-muted select-none [&_svg]:size-4", a.size === "small" ? "pr-3" : "pr-4"]),
|
|
219
279
|
"aria-hidden": "true"
|
|
220
|
-
}, [
|
|
221
|
-
a.stepButtons ? (
|
|
280
|
+
}, [d(e.$slots, "suffix"), a.unit ? (l(), n("span", ue, f(a.unit), 1)) : t("", !0)], 2)) : t("", !0)], 2),
|
|
281
|
+
a.stepButtons ? (l(), n("button", s({
|
|
222
282
|
key: 1,
|
|
223
283
|
type: "button",
|
|
224
|
-
tabindex:
|
|
284
|
+
tabindex: a.focusableStepButtons ? void 0 : -1,
|
|
225
285
|
class: H.value
|
|
226
|
-
}, $(1)), [i(
|
|
286
|
+
}, $(1)), [i(p(ae), {
|
|
227
287
|
class: c(a.size === "small" ? "size-4" : "size-6"),
|
|
228
288
|
"aria-hidden": "true"
|
|
229
|
-
}, null, 8, ["class"])], 16)) : t("", !0)
|
|
289
|
+
}, null, 8, ["class"])], 16, de)) : t("", !0)
|
|
230
290
|
]),
|
|
231
|
-
|
|
291
|
+
V.value ? (l(), n("p", {
|
|
232
292
|
key: 2,
|
|
233
|
-
id: `${
|
|
234
|
-
class: "mt-1 text-base text-danger-strong",
|
|
293
|
+
id: `${p(S)}-msg`,
|
|
294
|
+
class: c(["mt-1 text-base", a.plainError ? "text-danger" : "text-danger-strong"]),
|
|
235
295
|
role: "alert"
|
|
236
|
-
},
|
|
296
|
+
}, f(V.value), 11, v)) : t("", !0)
|
|
237
297
|
], 16));
|
|
238
298
|
}
|
|
239
299
|
});
|
|
240
300
|
//#endregion
|
|
241
|
-
export {
|
|
301
|
+
export { y as default };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export interface Props<V> {
|
|
2
|
+
/** Native radio `name`, used as given. Cards with the same `name` form one group: arrow keys move between them. Old cloud-ui `group`. */
|
|
3
|
+
name: string;
|
|
4
|
+
/** The value this card writes to `v-model` when it's selected. */
|
|
5
|
+
value: V;
|
|
6
|
+
/** Bold line at the top of the card. */
|
|
7
|
+
title?: string;
|
|
8
|
+
/** Muted text under the title. */
|
|
9
|
+
description?: string;
|
|
10
|
+
/** Greys the card out and stops it from being selected. */
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
/** Shows an 18px radio before the content instead of the check badge in the corner. Old cloud-ui `is-radio-show`. */
|
|
13
|
+
showRadio?: boolean;
|
|
14
|
+
/** Classes for the title, replacing `text-base font-semibold text-heading`, e.g. `text-lg font-semibold text-heading`. */
|
|
15
|
+
titleClass?: string;
|
|
16
|
+
/** Classes for the description, replacing `mt-0.5 text-xs leading-relaxed text-muted`. */
|
|
17
|
+
descriptionClass?: string;
|
|
18
|
+
}
|
|
19
|
+
declare const __VLS_export: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
20
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<(Props<T> & {
|
|
21
|
+
modelValue?: T;
|
|
22
|
+
}) & {
|
|
23
|
+
"onUpdate:modelValue"?: ((value: T) => any) | undefined;
|
|
24
|
+
onChange?: ((value: T) => any) | undefined;
|
|
25
|
+
}> & (typeof globalThis extends {
|
|
26
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
27
|
+
} ? P : {});
|
|
28
|
+
expose: (exposed: import("vue").ShallowUnwrapRef<{
|
|
29
|
+
/** Moves focus to the radio. */
|
|
30
|
+
focus: () => void | undefined;
|
|
31
|
+
}>) => void;
|
|
32
|
+
attrs: any;
|
|
33
|
+
slots: {
|
|
34
|
+
/** Replaces the whole card body (icon, title, description, features and right content). The radio and selection styles stay. Old cloud-ui `is-custom` with `#custom`. */
|
|
35
|
+
default?: () => unknown;
|
|
36
|
+
/** Icon or logo tile before the title. */
|
|
37
|
+
icon?: () => unknown;
|
|
38
|
+
/** Content after the title on the same line, e.g. a "Recommended" pill. Old cloud-ui `#subTitle`. */
|
|
39
|
+
subtitle?: () => unknown;
|
|
40
|
+
/** Pills under the description, e.g. "HA" or "PITR". */
|
|
41
|
+
features?: () => unknown;
|
|
42
|
+
/** Content on the right of the card, e.g. a price. Below 768px it moves under the text. Hides the check badge, so pair it with `show-radio`. Old cloud-ui `#rightContent`. */
|
|
43
|
+
right?: () => unknown;
|
|
44
|
+
};
|
|
45
|
+
emit: ((evt: "change", value: T) => void) & ((event: "update:modelValue", value: T) => void);
|
|
46
|
+
}>) => import("vue").VNode & {
|
|
47
|
+
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
48
|
+
};
|
|
49
|
+
declare const _default: typeof __VLS_export;
|
|
50
|
+
export default _default;
|
|
51
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
52
|
+
[K in keyof T]: T[K];
|
|
53
|
+
} : {
|
|
54
|
+
[K in keyof T as K]: T[K];
|
|
55
|
+
}) & {};
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { Comment as e, Transition as t, computed as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createVNode as o, defineComponent as s, mergeModels as c, mergeProps as l, normalizeClass as u, openBlock as d, ref as f, renderSlot as p, toDisplayString as m, unref as h, useAttrs as g, useId as _, useModel as v, useSlots as y, withCtx as b } from "vue";
|
|
2
|
+
import { Check as x } from "@lucide/vue";
|
|
3
|
+
//#region src/lib/components/AcRadioCard.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var S = ["aria-disabled"], C = [
|
|
5
|
+
"name",
|
|
6
|
+
"value",
|
|
7
|
+
"checked",
|
|
8
|
+
"disabled",
|
|
9
|
+
"aria-labelledby",
|
|
10
|
+
"aria-describedby"
|
|
11
|
+
], w = {
|
|
12
|
+
key: 1,
|
|
13
|
+
class: "flex min-w-0 flex-1 items-start gap-3"
|
|
14
|
+
}, T = {
|
|
15
|
+
key: 0,
|
|
16
|
+
class: "flex shrink-0 items-center"
|
|
17
|
+
}, E = { class: "flex min-w-0 flex-1 flex-col gap-2 md:flex-row md:items-start md:justify-between md:gap-4" }, D = { class: "block min-w-0" }, O = ["id"], k = ["id"], A = ["id"], j = ["id"], M = {
|
|
18
|
+
key: 0,
|
|
19
|
+
class: "absolute top-2 right-2 flex size-4 items-center justify-center rounded-full bg-primary text-white shadow-sm",
|
|
20
|
+
"aria-hidden": "true"
|
|
21
|
+
}, N = /*@__PURE__*/ s({
|
|
22
|
+
inheritAttrs: !1,
|
|
23
|
+
__name: "AcRadioCard",
|
|
24
|
+
props: /*@__PURE__*/ c({
|
|
25
|
+
name: {},
|
|
26
|
+
value: {},
|
|
27
|
+
title: { default: "" },
|
|
28
|
+
description: { default: "" },
|
|
29
|
+
disabled: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: !1
|
|
32
|
+
},
|
|
33
|
+
showRadio: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: !1
|
|
36
|
+
},
|
|
37
|
+
titleClass: { default: "text-base font-semibold text-heading" },
|
|
38
|
+
descriptionClass: { default: "mt-0.5 text-xs leading-relaxed text-muted" }
|
|
39
|
+
}, {
|
|
40
|
+
modelValue: { default: void 0 },
|
|
41
|
+
modelModifiers: {}
|
|
42
|
+
}),
|
|
43
|
+
emits: /*@__PURE__*/ c(["change"], ["update:modelValue"]),
|
|
44
|
+
setup(s, { expose: c, emit: N }) {
|
|
45
|
+
let P = s, F = v(s, "modelValue"), I = N, L = _(), R = g(), z = y(), B = f(null), V = n(() => ({
|
|
46
|
+
class: R.class,
|
|
47
|
+
style: R.style
|
|
48
|
+
})), H = n(() => {
|
|
49
|
+
let { class: e, style: t, ...n } = R;
|
|
50
|
+
return n;
|
|
51
|
+
}), U = n(() => F.value === P.value);
|
|
52
|
+
function W() {
|
|
53
|
+
return !!z.default?.().some((t) => t.type !== e);
|
|
54
|
+
}
|
|
55
|
+
function G() {
|
|
56
|
+
return !W() && (!!P.title || !!z.subtitle);
|
|
57
|
+
}
|
|
58
|
+
function K() {
|
|
59
|
+
if (!W()) return [
|
|
60
|
+
P.description && `${L}-desc`,
|
|
61
|
+
z.features && `${L}-features`,
|
|
62
|
+
z.right && `${L}-right`
|
|
63
|
+
].filter(Boolean).join(" ") || void 0;
|
|
64
|
+
}
|
|
65
|
+
function q() {
|
|
66
|
+
P.disabled || (F.value = P.value, I("change", P.value));
|
|
67
|
+
}
|
|
68
|
+
return c({ focus: () => B.value?.focus() }), (e, n) => (d(), i("label", l(V.value, {
|
|
69
|
+
class: ["group relative flex items-start gap-3 rounded-14 border p-3 transition-[border-color,background-color,box-shadow] duration-200 ease-out has-[>span>input[type=radio]:focus-visible]:ring-2 has-[>span>input[type=radio]:focus-visible]:ring-ring has-[>span>input[type=radio]:focus-visible]:ring-offset-2 has-[>span>input[type=radio]:focus-visible]:ring-offset-background motion-reduce:transition-none", [
|
|
70
|
+
s.disabled ? "cursor-not-allowed opacity-60" : "cursor-pointer",
|
|
71
|
+
U.value ? "border-primary bg-primary/5 shadow-[inset_0_0_0_1px_var(--color-primary)]" : "border-border bg-surface",
|
|
72
|
+
!U.value && !s.disabled && "hover:border-primary/40 hover:bg-accent-hover"
|
|
73
|
+
]],
|
|
74
|
+
"aria-disabled": s.disabled || void 0,
|
|
75
|
+
"data-ac-ds": "",
|
|
76
|
+
"data-testid": "ac-radio-card"
|
|
77
|
+
}), [
|
|
78
|
+
a("span", { class: u(s.showRadio ? "relative mt-0.5 inline-flex size-[18px] shrink-0" : "sr-only") }, [a("input", l({
|
|
79
|
+
ref_key: "input",
|
|
80
|
+
ref: B,
|
|
81
|
+
type: "radio",
|
|
82
|
+
name: s.name,
|
|
83
|
+
value: s.value,
|
|
84
|
+
checked: U.value,
|
|
85
|
+
disabled: s.disabled,
|
|
86
|
+
"aria-labelledby": G() ? `${h(L)}-title` : void 0,
|
|
87
|
+
"aria-describedby": K()
|
|
88
|
+
}, H.value, {
|
|
89
|
+
class: ["peer size-[18px] appearance-none rounded-full border transition-colors duration-200 focus-visible:outline-none disabled:cursor-not-allowed motion-reduce:transition-none", [U.value ? "border-primary bg-primary" : "border-muted/70 bg-background group-hover:border-primary/60", s.disabled ? "cursor-not-allowed" : "cursor-pointer"]],
|
|
90
|
+
onChange: q
|
|
91
|
+
}), null, 16, C), a("span", {
|
|
92
|
+
class: u(["pointer-events-none absolute inset-0 m-auto size-1.5 rounded-full bg-white transition-transform duration-200 motion-reduce:transition-none", U.value ? "scale-100" : "scale-0"]),
|
|
93
|
+
"aria-hidden": "true"
|
|
94
|
+
}, null, 2)], 2),
|
|
95
|
+
W() ? p(e.$slots, "default", {}, void 0, void 0, 0) : (d(), i("span", w, [e.$slots.icon ? (d(), i("span", T, [p(e.$slots, "icon")])) : r("", !0), a("span", E, [a("span", D, [
|
|
96
|
+
G() ? (d(), i("span", {
|
|
97
|
+
key: 0,
|
|
98
|
+
id: `${h(L)}-title`,
|
|
99
|
+
class: "flex flex-wrap items-center gap-x-2 gap-y-1"
|
|
100
|
+
}, [s.title ? (d(), i("span", {
|
|
101
|
+
key: 0,
|
|
102
|
+
class: u(["block font-heading tracking-[-0.012em] text-balance", s.titleClass])
|
|
103
|
+
}, m(s.title), 3)) : r("", !0), p(e.$slots, "subtitle")], 8, O)) : r("", !0),
|
|
104
|
+
s.description ? (d(), i("span", {
|
|
105
|
+
key: 1,
|
|
106
|
+
id: `${h(L)}-desc`,
|
|
107
|
+
class: u(["block text-pretty", s.descriptionClass])
|
|
108
|
+
}, m(s.description), 11, k)) : r("", !0),
|
|
109
|
+
e.$slots.features ? (d(), i("span", {
|
|
110
|
+
key: 2,
|
|
111
|
+
id: `${h(L)}-features`,
|
|
112
|
+
class: "mt-2.5 flex flex-wrap gap-1.5"
|
|
113
|
+
}, [p(e.$slots, "features")], 8, A)) : r("", !0)
|
|
114
|
+
]), e.$slots.right ? (d(), i("span", {
|
|
115
|
+
key: 0,
|
|
116
|
+
id: `${h(L)}-right`,
|
|
117
|
+
class: "block shrink-0"
|
|
118
|
+
}, [p(e.$slots, "right")], 8, j)) : r("", !0)])])),
|
|
119
|
+
o(t, {
|
|
120
|
+
"enter-active-class": "transition duration-150 ease-out motion-reduce:transition-none",
|
|
121
|
+
"enter-from-class": "scale-50 opacity-0",
|
|
122
|
+
"leave-active-class": "transition duration-100 ease-in motion-reduce:transition-none",
|
|
123
|
+
"leave-to-class": "scale-50 opacity-0"
|
|
124
|
+
}, {
|
|
125
|
+
default: b(() => [U.value && !s.showRadio && !e.$slots.right ? (d(), i("span", M, [o(h(x), {
|
|
126
|
+
class: "size-2.5",
|
|
127
|
+
"stroke-width": 3.5
|
|
128
|
+
})])) : r("", !0)]),
|
|
129
|
+
_: 1
|
|
130
|
+
})
|
|
131
|
+
], 16, S));
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
//#endregion
|
|
135
|
+
export { N as default };
|