@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,6 +1,6 @@
|
|
|
1
1
|
export interface Props {
|
|
2
|
-
/** Label above the field. Also the accessible name of the input and of the list of values. */
|
|
3
|
-
label
|
|
2
|
+
/** Label above the field. Also the accessible name of the input and of the list of values. Without one, pass `aria-label`. */
|
|
3
|
+
label?: string;
|
|
4
4
|
/** Native `name` attribute of the text input. */
|
|
5
5
|
name?: string;
|
|
6
6
|
/** Example value shown in the empty input, e.g. "e.g. 10.0.0.0/16". Defaults to "Add item and press Enter". */
|
|
@@ -31,14 +31,24 @@ export interface Props {
|
|
|
31
31
|
disabled?: boolean;
|
|
32
32
|
/** Shows the input on a muted fill and the chips without remove buttons. Was `is-read-only` in cloud-ui. */
|
|
33
33
|
readonly?: boolean;
|
|
34
|
+
/** Puts new values first instead of last, as cloud-ui's list field did. */
|
|
35
|
+
prepend?: boolean;
|
|
36
|
+
/** Error shown when a `required` field is left with no values: on leaving the input, or after removing the last value. Cleared by typing or adding. E.g. "This field is required. Please input at least one". */
|
|
37
|
+
requiredMessage?: string;
|
|
34
38
|
}
|
|
35
39
|
type __VLS_Props = Props;
|
|
40
|
+
type __VLS_Slots = {
|
|
41
|
+
/** Content before the label text, such as a 14px icon. Was `icon` in cloud-ui. */
|
|
42
|
+
"label-icon"?: () => unknown;
|
|
43
|
+
/** Content after the label text, such as an info tooltip. Was `labelInfo` in cloud-ui. */
|
|
44
|
+
"label-extra"?: () => unknown;
|
|
45
|
+
};
|
|
36
46
|
type __VLS_ModelProps = {
|
|
37
47
|
/** The values, in the order they were added. Replaced with a new array on every change. */
|
|
38
48
|
modelValue?: string[];
|
|
39
49
|
};
|
|
40
50
|
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
41
|
-
declare const
|
|
51
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
42
52
|
/** Moves focus to the text input. */
|
|
43
53
|
focus: () => void | undefined;
|
|
44
54
|
/** Adds the typed text now, e.g. before submitting. Returns `false` when text was rejected and is still in the input. */
|
|
@@ -55,20 +65,29 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
55
65
|
onRemove?: ((value: string, index: number) => any) | undefined;
|
|
56
66
|
}>, {
|
|
57
67
|
required: boolean;
|
|
68
|
+
label: string;
|
|
58
69
|
disabled: boolean;
|
|
59
70
|
name: string;
|
|
60
71
|
transform: (value: string) => string;
|
|
61
72
|
size: "small" | "normal";
|
|
73
|
+
hint: string;
|
|
62
74
|
maxItems: number;
|
|
63
75
|
readonly: boolean;
|
|
64
|
-
hint: string;
|
|
65
76
|
validate: (value: string, values: string[]) => string | void | null | undefined;
|
|
66
77
|
placeholder: string;
|
|
67
78
|
errorMsg: string;
|
|
68
79
|
mono: boolean;
|
|
80
|
+
requiredMessage: string;
|
|
69
81
|
allowDuplicates: boolean;
|
|
70
82
|
showClear: boolean;
|
|
71
83
|
addOnBlur: boolean;
|
|
84
|
+
prepend: boolean;
|
|
72
85
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
86
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
73
87
|
declare const _default: typeof __VLS_export;
|
|
74
88
|
export default _default;
|
|
89
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
90
|
+
new (): {
|
|
91
|
+
$slots: S;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { Fragment as e, computed as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, createVNode as a, defineComponent as o, mergeModels as s, mergeProps as c, nextTick as l, normalizeClass as u, openBlock as d, ref as f, renderList as p,
|
|
2
|
-
import { Plus as
|
|
1
|
+
import { Fragment as e, computed as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, createVNode as a, defineComponent as o, mergeModels as s, mergeProps as c, nextTick as l, normalizeClass as u, openBlock as d, ref as f, renderList as p, renderSlot as m, toDisplayString as h, unref as g, useAttrs as _, useId as v, useModel as y, vModelText as b, watch as x, withDirectives as ee, withModifiers as te } from "vue";
|
|
2
|
+
import { Plus as ne, X as S } from "@lucide/vue";
|
|
3
3
|
//#region src/lib/components/AcTagInput.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
-
var
|
|
4
|
+
var re = ["for"], ie = {
|
|
5
5
|
key: 0,
|
|
6
6
|
class: "font-normal text-muted"
|
|
7
|
-
},
|
|
7
|
+
}, C = {
|
|
8
8
|
key: 1,
|
|
9
9
|
class: "text-danger",
|
|
10
10
|
"aria-hidden": "true"
|
|
11
|
-
},
|
|
11
|
+
}, ae = [
|
|
12
12
|
"id",
|
|
13
13
|
"name",
|
|
14
14
|
"placeholder",
|
|
@@ -17,26 +17,26 @@ var ie = ["for"], x = {
|
|
|
17
17
|
"aria-invalid",
|
|
18
18
|
"aria-required",
|
|
19
19
|
"aria-describedby"
|
|
20
|
-
],
|
|
20
|
+
], oe = [
|
|
21
21
|
"disabled",
|
|
22
22
|
"aria-label",
|
|
23
23
|
"title"
|
|
24
|
-
],
|
|
24
|
+
], se = ["aria-label"], ce = ["title"], le = [
|
|
25
25
|
"aria-label",
|
|
26
26
|
"title",
|
|
27
27
|
"onClick",
|
|
28
28
|
"onKeydown"
|
|
29
|
-
],
|
|
29
|
+
], ue = {
|
|
30
30
|
key: 3,
|
|
31
31
|
class: "mt-2 flex items-center justify-between gap-3 text-xs text-muted tabular-nums"
|
|
32
|
-
},
|
|
32
|
+
}, de = { key: 0 }, fe = {
|
|
33
33
|
class: "sr-only",
|
|
34
34
|
"aria-live": "polite"
|
|
35
|
-
},
|
|
35
|
+
}, w = /*@__PURE__*/ o({
|
|
36
36
|
inheritAttrs: !1,
|
|
37
37
|
__name: "AcTagInput",
|
|
38
38
|
props: /*@__PURE__*/ s({
|
|
39
|
-
label: {},
|
|
39
|
+
label: { default: "" },
|
|
40
40
|
name: { default: "" },
|
|
41
41
|
placeholder: { default: "" },
|
|
42
42
|
hint: { default: "" },
|
|
@@ -78,7 +78,12 @@ var ie = ["for"], x = {
|
|
|
78
78
|
readonly: {
|
|
79
79
|
type: Boolean,
|
|
80
80
|
default: !1
|
|
81
|
-
}
|
|
81
|
+
},
|
|
82
|
+
prepend: {
|
|
83
|
+
type: Boolean,
|
|
84
|
+
default: !1
|
|
85
|
+
},
|
|
86
|
+
requiredMessage: { default: "" }
|
|
82
87
|
}, {
|
|
83
88
|
modelValue: { default: () => [] },
|
|
84
89
|
modelModifiers: {}
|
|
@@ -88,202 +93,209 @@ var ie = ["for"], x = {
|
|
|
88
93
|
"remove",
|
|
89
94
|
"clear"
|
|
90
95
|
], ["update:modelValue"]),
|
|
91
|
-
setup(o, { expose: s, emit:
|
|
92
|
-
let
|
|
93
|
-
class:
|
|
94
|
-
style:
|
|
95
|
-
})),
|
|
96
|
-
let { class: e, style: t, ...n } =
|
|
96
|
+
setup(o, { expose: s, emit: w }) {
|
|
97
|
+
let T = o, E = y(o, "modelValue"), D = w, O = /[\s,;]+/, pe = /[,\n]+/, k = v(), A = `${k}-hint`, j = `${k}-msg`, M = `${k}-count`, N = `${k}-help`, P = _(), F = t(() => ({
|
|
98
|
+
class: P.class,
|
|
99
|
+
style: P.style
|
|
100
|
+
})), I = t(() => {
|
|
101
|
+
let { class: e, style: t, ...n } = P;
|
|
97
102
|
return n;
|
|
98
|
-
}),
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
].filter(Boolean).join(" ") || void 0),
|
|
104
|
-
function
|
|
105
|
-
|
|
103
|
+
}), L = f(null), R = f(null), z = f(""), B = f(""), V = f(""), H = f(!1), U = f(""), W = t(() => E.value ?? []), G = t(() => !T.disabled && !T.readonly), K = t(() => T.maxItems !== void 0 && W.value.length >= T.maxItems), me = t(() => T.maxItems !== void 0 && W.value.length >= T.maxItems * .8), q = t(() => B.value || V.value || T.errorMsg), he = t(() => [
|
|
104
|
+
T.hint && A,
|
|
105
|
+
q.value && j,
|
|
106
|
+
T.maxItems !== void 0 && M,
|
|
107
|
+
G.value && N
|
|
108
|
+
].filter(Boolean).join(" ") || void 0), ge = t(() => G.value ? K.value ? `Maximum ${T.maxItems} items reached` : T.placeholder || "Add item and press Enter" : ""), _e = t(() => G.value && !K.value && !!z.value.trim());
|
|
109
|
+
function J(e) {
|
|
110
|
+
U.value = "", l(() => U.value = e);
|
|
106
111
|
}
|
|
107
|
-
function
|
|
108
|
-
return
|
|
112
|
+
function ve(e, t) {
|
|
113
|
+
return T.maxItems !== void 0 && t.length >= T.maxItems ? `You can add up to ${T.maxItems} ${T.maxItems === 1 ? "value" : "values"}. Remove one first.` : !T.allowDuplicates && t.includes(e) ? `“${e}” is already added.` : T.validate?.(e, t) || "";
|
|
109
114
|
}
|
|
110
|
-
function
|
|
111
|
-
let n = [...
|
|
115
|
+
function Y(e, t) {
|
|
116
|
+
let n = [...W.value], r = [], i = [], a = "";
|
|
112
117
|
for (let o of e.split(t)) {
|
|
113
|
-
let e =
|
|
118
|
+
let e = T.transform(o);
|
|
114
119
|
if (!e) continue;
|
|
115
|
-
let t =
|
|
120
|
+
let t = ve(e, n);
|
|
116
121
|
if (t) {
|
|
117
122
|
i.push(o.trim()), a ||= t;
|
|
118
123
|
continue;
|
|
119
124
|
}
|
|
120
125
|
n.push(e), r.push(e);
|
|
121
126
|
}
|
|
122
|
-
return r.length && (
|
|
127
|
+
return r.length && (E.value = T.prepend ? [...[...r].reverse(), ...W.value] : n, V.value = "", r.forEach((e) => D("add", e)), J(r.length === 1 ? `Added ${r[0]}.` : `Added ${r.length} values.`)), z.value = i.join(", "), l(() => B.value = a), i.length > 0;
|
|
123
128
|
}
|
|
124
|
-
function
|
|
125
|
-
return !
|
|
129
|
+
function X() {
|
|
130
|
+
return !G.value || !z.value.trim() ? !1 : Y(z.value, pe);
|
|
126
131
|
}
|
|
127
|
-
function
|
|
128
|
-
if (!
|
|
129
|
-
let n =
|
|
132
|
+
function Z(e, t = !0) {
|
|
133
|
+
if (!G.value) return;
|
|
134
|
+
let n = W.value[e];
|
|
130
135
|
if (n === void 0) return;
|
|
131
|
-
let r =
|
|
132
|
-
|
|
136
|
+
let r = W.value.filter((t, n) => n !== e);
|
|
137
|
+
E.value = r, H.value = !1, B.value = "", D("remove", n, e), J(`Removed ${n}.`), Q(r), t && l(() => {
|
|
133
138
|
let t = $();
|
|
134
|
-
(t[Math.min(e, t.length - 1)] ??
|
|
139
|
+
(t[Math.min(e, t.length - 1)] ?? L.value)?.focus();
|
|
135
140
|
});
|
|
136
141
|
}
|
|
137
|
-
function
|
|
138
|
-
|
|
142
|
+
function ye() {
|
|
143
|
+
G.value && W.value.length && (E.value = [], H.value = !1, D("clear"), Q([]), J("Removed every value."), L.value?.focus());
|
|
144
|
+
}
|
|
145
|
+
function Q(e = W.value) {
|
|
146
|
+
V.value = T.required && T.requiredMessage && !e.length ? T.requiredMessage : "";
|
|
139
147
|
}
|
|
140
148
|
function $() {
|
|
141
|
-
return Array.from(
|
|
149
|
+
return Array.from(R.value?.querySelectorAll("[data-remove]") ?? []);
|
|
142
150
|
}
|
|
143
|
-
function
|
|
144
|
-
if (!
|
|
151
|
+
function be(e) {
|
|
152
|
+
if (!G.value || e.isComposing) return;
|
|
145
153
|
let t = e.target, n = t.selectionStart === 0 && t.selectionEnd === 0;
|
|
146
|
-
e.key === "Enter" || e.key === "," ? (e.preventDefault(),
|
|
154
|
+
e.key === "Enter" || e.key === "," ? (e.preventDefault(), X()) : e.key === "Tab" && !e.shiftKey && z.value.trim() ? X() : e.key === "Backspace" && !z.value && W.value.length ? (e.preventDefault(), H.value ? Z(W.value.length - 1, !1) : (H.value = !0, J(`${W.value[W.value.length - 1]} selected. Press Backspace again to remove it.`))) : e.key === "ArrowLeft" && n && W.value.length ? (e.preventDefault(), H.value = !1, $().at(-1)?.focus()) : e.key === "Escape" && (z.value || B.value) ? (e.preventDefault(), z.value = "", B.value = "") : H.value = !1;
|
|
147
155
|
}
|
|
148
|
-
function
|
|
156
|
+
function xe(e, t) {
|
|
149
157
|
let n = $();
|
|
150
|
-
e.key === "Backspace" || e.key === "Delete" ? (e.preventDefault(),
|
|
158
|
+
e.key === "Backspace" || e.key === "Delete" ? (e.preventDefault(), Z(t)) : e.key === "ArrowLeft" ? (e.preventDefault(), n[Math.max(t - 1, 0)]?.focus()) : e.key === "ArrowRight" ? (e.preventDefault(), (n[t + 1] ?? L.value)?.focus()) : e.key === "Home" ? (e.preventDefault(), n[0]?.focus()) : e.key === "End" && (e.preventDefault(), L.value?.focus());
|
|
151
159
|
}
|
|
152
|
-
function
|
|
153
|
-
if (!
|
|
160
|
+
function Se(e) {
|
|
161
|
+
if (!G.value) return;
|
|
154
162
|
let t = e.clipboardData?.getData("text") ?? "";
|
|
155
|
-
if (!
|
|
163
|
+
if (!O.test(t.trim())) return;
|
|
156
164
|
e.preventDefault();
|
|
157
|
-
let n =
|
|
158
|
-
|
|
165
|
+
let n = L.value, r = n?.selectionStart ?? z.value.length, i = n?.selectionEnd ?? z.value.length;
|
|
166
|
+
Y(z.value.slice(0, r) + t + z.value.slice(i), O);
|
|
159
167
|
}
|
|
160
|
-
function
|
|
161
|
-
|
|
168
|
+
function Ce() {
|
|
169
|
+
H.value = !1;
|
|
170
|
+
let e = !!z.value.trim();
|
|
171
|
+
T.addOnBlur && X(), T.addOnBlur && e || Q();
|
|
162
172
|
}
|
|
163
|
-
function
|
|
164
|
-
|
|
173
|
+
function we(e) {
|
|
174
|
+
T.disabled || e.target.closest("button") || L.value?.focus();
|
|
165
175
|
}
|
|
166
|
-
return
|
|
167
|
-
|
|
176
|
+
return x(z, () => {
|
|
177
|
+
B.value = "", V.value = "", H.value = !1;
|
|
168
178
|
}), s({
|
|
169
|
-
focus: () =>
|
|
170
|
-
commit: () => !
|
|
171
|
-
}), (t, s) => (d(), r("div", c(
|
|
179
|
+
focus: () => L.value?.focus(),
|
|
180
|
+
commit: () => !X()
|
|
181
|
+
}), (t, s) => (d(), r("div", c(F.value, {
|
|
172
182
|
class: ["w-full", o.disabled && "opacity-50"],
|
|
173
183
|
"data-ac-ds": "",
|
|
174
184
|
"data-testid": "ac-tag-input"
|
|
175
185
|
}), [
|
|
176
186
|
i("label", {
|
|
177
|
-
for:
|
|
187
|
+
for: g(k),
|
|
178
188
|
class: "mb-2 flex items-center gap-1 text-base font-medium text-heading"
|
|
179
189
|
}, [
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
190
|
+
m(t.$slots, "label-icon"),
|
|
191
|
+
i("span", null, h(o.label), 1),
|
|
192
|
+
m(t.$slots, "label-extra"),
|
|
193
|
+
o.readonly ? (d(), r("span", ie, "(read only)")) : n("", !0),
|
|
194
|
+
o.required ? (d(), r("span", C, "*")) : n("", !0)
|
|
195
|
+
], 8, re),
|
|
184
196
|
o.hint ? (d(), r("p", {
|
|
185
197
|
key: 0,
|
|
186
|
-
id:
|
|
198
|
+
id: A,
|
|
187
199
|
class: "mb-2 text-base text-muted"
|
|
188
|
-
},
|
|
200
|
+
}, h(o.hint), 1)) : n("", !0),
|
|
189
201
|
i("div", {
|
|
190
202
|
class: u(["flex w-full items-center rounded-10 border transition-[border-color,box-shadow,background-color] duration-200", [
|
|
191
203
|
o.size === "small" ? "h-9" : "h-10.5",
|
|
192
204
|
o.readonly ? "bg-surface-muted" : "bg-background",
|
|
193
205
|
o.disabled ? "cursor-not-allowed" : "cursor-text",
|
|
194
|
-
|
|
206
|
+
q.value ? "border-danger/50 focus-within:border-danger focus-within:shadow-[0_0_0_2px_color-mix(in_srgb,var(--color-danger)_20%,transparent)]" : ["border-border focus-within:focus-ring", !o.disabled && "hover:border-accent-active"]
|
|
195
207
|
]]),
|
|
196
|
-
onClick:
|
|
197
|
-
}, [
|
|
198
|
-
id:
|
|
208
|
+
onClick: we
|
|
209
|
+
}, [ee(i("input", c({
|
|
210
|
+
id: g(k),
|
|
199
211
|
ref_key: "input",
|
|
200
|
-
ref:
|
|
201
|
-
},
|
|
202
|
-
"onUpdate:modelValue": s[0] ||= (e) =>
|
|
212
|
+
ref: L
|
|
213
|
+
}, I.value, {
|
|
214
|
+
"onUpdate:modelValue": s[0] ||= (e) => z.value = e,
|
|
203
215
|
type: "text",
|
|
204
216
|
name: o.name,
|
|
205
|
-
placeholder:
|
|
217
|
+
placeholder: ge.value,
|
|
206
218
|
disabled: o.disabled,
|
|
207
219
|
readonly: o.readonly,
|
|
208
|
-
"aria-invalid": !!
|
|
220
|
+
"aria-invalid": !!q.value || void 0,
|
|
209
221
|
"aria-required": o.required || void 0,
|
|
210
|
-
"aria-describedby":
|
|
222
|
+
"aria-describedby": he.value,
|
|
211
223
|
autocomplete: "off",
|
|
212
224
|
autocapitalize: "off",
|
|
213
225
|
spellcheck: "false",
|
|
214
226
|
class: ["h-full min-w-0 flex-1 rounded-10 bg-transparent pr-2 text-base font-normal text-heading outline-none placeholder:text-muted/80 disabled:cursor-not-allowed", [o.mono && "font-mono", o.size === "small" ? "pl-4" : "pl-5"]],
|
|
215
|
-
onKeydown:
|
|
216
|
-
onPaste:
|
|
217
|
-
onBlur:
|
|
218
|
-
}), null, 16,
|
|
227
|
+
onKeydown: be,
|
|
228
|
+
onPaste: Se,
|
|
229
|
+
onBlur: Ce
|
|
230
|
+
}), null, 16, ae), [[b, z.value]]), i("span", { class: u(["flex shrink-0 items-center text-heading", o.size === "small" ? "mr-1" : "mr-3"]) }, [G.value && o.showClear && W.value.length ? (d(), r("button", {
|
|
219
231
|
key: 0,
|
|
220
232
|
type: "button",
|
|
221
233
|
class: u(["inline-flex cursor-pointer items-center justify-center rounded-full transition-colors hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none", o.size === "small" ? "size-7" : "size-8"]),
|
|
222
234
|
"aria-label": "Clear all values",
|
|
223
235
|
title: "Clear all items",
|
|
224
|
-
onClick:
|
|
225
|
-
}, [a(
|
|
236
|
+
onClick: ye
|
|
237
|
+
}, [a(g(S), {
|
|
226
238
|
class: "size-4",
|
|
227
239
|
"aria-hidden": "true"
|
|
228
240
|
})], 2)) : n("", !0), i("button", {
|
|
229
241
|
type: "button",
|
|
230
242
|
class: u(["inline-flex items-center justify-center rounded-full transition-colors focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none enabled:cursor-pointer enabled:hover:bg-surface-sunken disabled:cursor-not-allowed disabled:opacity-40", o.size === "small" ? "size-7" : "size-8"]),
|
|
231
|
-
disabled: !
|
|
232
|
-
"aria-label":
|
|
233
|
-
title:
|
|
243
|
+
disabled: !_e.value,
|
|
244
|
+
"aria-label": z.value.trim() ? `Add ${z.value.trim()}` : "Add item",
|
|
245
|
+
title: z.value.trim() ? `Add “${z.value.trim()}”` : "Add item",
|
|
234
246
|
tabindex: "-1",
|
|
235
|
-
onMousedown: s[1] ||=
|
|
236
|
-
onClick:
|
|
237
|
-
}, [a(
|
|
247
|
+
onMousedown: s[1] ||= te(() => {}, ["prevent"]),
|
|
248
|
+
onClick: X
|
|
249
|
+
}, [a(g(ne), {
|
|
238
250
|
class: "size-4",
|
|
239
251
|
"aria-hidden": "true"
|
|
240
|
-
})], 42,
|
|
241
|
-
|
|
252
|
+
})], 42, oe)], 2)], 2),
|
|
253
|
+
q.value ? (d(), r("p", {
|
|
242
254
|
key: 1,
|
|
243
|
-
id:
|
|
255
|
+
id: j,
|
|
244
256
|
class: "mt-1 text-base text-danger-strong",
|
|
245
257
|
role: "alert"
|
|
246
|
-
},
|
|
247
|
-
|
|
258
|
+
}, h(q.value), 1)) : n("", !0),
|
|
259
|
+
W.value.length ? (d(), r("ul", {
|
|
248
260
|
key: 2,
|
|
249
261
|
ref_key: "list",
|
|
250
|
-
ref:
|
|
262
|
+
ref: R,
|
|
251
263
|
role: "list",
|
|
252
|
-
"aria-label": o.label,
|
|
264
|
+
"aria-label": o.label || g(P)["aria-label"],
|
|
253
265
|
class: "mt-3 flex w-full flex-wrap gap-2"
|
|
254
|
-
}, [(d(!0), r(e, null, p(
|
|
266
|
+
}, [(d(!0), r(e, null, p(W.value, (e, t) => (d(), r("li", {
|
|
255
267
|
key: `${t}-${e}`,
|
|
256
|
-
class: u(["inline-flex h-8 max-w-full min-w-0 items-center justify-between gap-2 rounded-10 border px-3 text-base text-heading transition-all duration-300 hover:shadow-sm motion-reduce:transition-none", [o.mono && "font-mono",
|
|
268
|
+
class: u(["inline-flex h-8 max-w-full min-w-0 items-center justify-between gap-2 rounded-10 border px-3 text-base text-heading transition-all duration-300 hover:shadow-sm motion-reduce:transition-none", [o.mono && "font-mono", H.value && t === W.value.length - 1 ? "border-primary bg-accent-active ring-2 ring-ring" : "border-border bg-background"]]),
|
|
257
269
|
"data-testid": "ac-tag-input-chip"
|
|
258
270
|
}, [i("span", {
|
|
259
271
|
class: "truncate",
|
|
260
272
|
title: e
|
|
261
|
-
},
|
|
273
|
+
}, h(e), 9, ce), G.value ? (d(), r("button", {
|
|
262
274
|
key: 0,
|
|
263
275
|
type: "button",
|
|
264
276
|
"data-remove": "",
|
|
265
277
|
class: "inline-flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-full transition-colors hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",
|
|
266
278
|
"aria-label": `Remove ${e}`,
|
|
267
279
|
title: `Remove ${e}`,
|
|
268
|
-
onClick: (e) =>
|
|
269
|
-
onKeydown: (e) =>
|
|
270
|
-
}, [a(
|
|
280
|
+
onClick: (e) => Z(t),
|
|
281
|
+
onKeydown: (e) => xe(e, t)
|
|
282
|
+
}, [a(g(S), {
|
|
271
283
|
class: "size-4",
|
|
272
284
|
"aria-hidden": "true"
|
|
273
|
-
})], 40,
|
|
274
|
-
|
|
285
|
+
})], 40, le)) : n("", !0)], 2))), 128))], 8, se)) : n("", !0),
|
|
286
|
+
W.value.length || o.maxItems !== void 0 ? (d(), r("div", ue, [W.value.length ? (d(), r("span", de, h(W.value.length) + " " + h(W.value.length === 1 ? "item" : "items"), 1)) : n("", !0), o.maxItems === void 0 ? n("", !0) : (d(), r("span", {
|
|
275
287
|
key: 1,
|
|
276
|
-
id:
|
|
277
|
-
class: u(["ml-auto",
|
|
278
|
-
},
|
|
279
|
-
|
|
288
|
+
id: M,
|
|
289
|
+
class: u(["ml-auto", K.value ? "text-danger-strong" : me.value && "text-warning-strong"])
|
|
290
|
+
}, h(W.value.length) + " / " + h(o.maxItems) + " items ", 3))])) : n("", !0),
|
|
291
|
+
G.value ? (d(), r("p", {
|
|
280
292
|
key: 4,
|
|
281
|
-
id:
|
|
293
|
+
id: N,
|
|
282
294
|
class: "sr-only"
|
|
283
295
|
}, "Press Enter or comma to add a value. Backspace in the empty input removes the last one.")) : n("", !0),
|
|
284
|
-
i("p",
|
|
296
|
+
i("p", fe, h(U.value), 1)
|
|
285
297
|
], 16));
|
|
286
298
|
}
|
|
287
299
|
});
|
|
288
300
|
//#endregion
|
|
289
|
-
export {
|
|
301
|
+
export { w as default };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { SelectOption } from "./types";
|
|
2
|
+
/** One Kubernetes node taint. */
|
|
3
|
+
export interface TaintItem<E = string> {
|
|
4
|
+
key: string;
|
|
5
|
+
value: string;
|
|
6
|
+
/** One of `effects`' values, e.g. `NoSchedule`. */
|
|
7
|
+
effect: E;
|
|
8
|
+
}
|
|
9
|
+
export interface Props<T> {
|
|
10
|
+
/** Effects to choose from, each with a `description` shown under its name. Defaults to Kubernetes' `NoSchedule`, `NoExecute` and `PreferNoSchedule`; pass your own to store enum numbers. The first is the default for a new row. */
|
|
11
|
+
effects?: SelectOption<T>[];
|
|
12
|
+
/** The effect that evicts running pods. Choosing it shows a warning under the rows. */
|
|
13
|
+
evictEffect?: T;
|
|
14
|
+
/** Disables every field and button. Was `is-disabled` in cloud-ui. */
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
}
|
|
17
|
+
declare const __VLS_export: <V extends string | number = string>(__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<{
|
|
18
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<(Props<V> & {
|
|
19
|
+
/** The taints that have a key, in order. Rows without a key stay on screen but aren't in the model. */
|
|
20
|
+
modelValue?: TaintItem<V>[];
|
|
21
|
+
}) & {
|
|
22
|
+
"onUpdate:modelValue"?: ((value: TaintItem<V>[]) => any) | undefined;
|
|
23
|
+
onAdd?: (() => any) | undefined;
|
|
24
|
+
onRemove?: ((index: number) => any) | undefined;
|
|
25
|
+
}> & (typeof globalThis extends {
|
|
26
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
27
|
+
} ? P : {});
|
|
28
|
+
expose: (exposed: import("vue").ShallowUnwrapRef<{
|
|
29
|
+
/** Adds an empty row and focuses its key. */
|
|
30
|
+
add: () => void;
|
|
31
|
+
}>) => void;
|
|
32
|
+
attrs: any;
|
|
33
|
+
slots: {};
|
|
34
|
+
emit: (((evt: "add") => void) & ((evt: "remove", index: number) => void)) & ((event: "update:modelValue", value: TaintItem<V>[]) => void);
|
|
35
|
+
}>) => import("vue").VNode & {
|
|
36
|
+
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
37
|
+
};
|
|
38
|
+
declare const _default: typeof __VLS_export;
|
|
39
|
+
export default _default;
|
|
40
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
41
|
+
[K in keyof T]: T[K];
|
|
42
|
+
} : {
|
|
43
|
+
[K in keyof T as K]: T[K];
|
|
44
|
+
}) & {};
|