@ac-design/design-system 2.3.0 → 2.4.1
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 +211 -6
- 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 +7 -1
- package/dist/lib/components/AcButton.vue_vue_type_script_setup_true_lang.js +90 -69
- 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 +3 -3
- 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 +14 -7
- package/dist/lib/components/AcDatePicker.vue_vue_type_script_setup_true_lang.js +417 -372
- 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/AcDropdownItem.vue_vue_type_script_setup_true_lang.js +27 -30
- 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/AcInput.vue.d.ts +75 -54
- package/dist/lib/components/AcInput.vue_vue_type_script_setup_true_lang.js +253 -89
- 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/AcMapChart.vue.d.ts +2 -2
- package/dist/lib/components/AcModal.vue.d.ts +2 -2
- package/dist/lib/components/AcModal.vue_vue_type_script_setup_true_lang.js +4 -4
- 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.vue.d.ts +2 -2
- package/dist/lib/components/AcRadioCard.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/lib/components/AcSelect.vue.d.ts +35 -6
- package/dist/lib/components/AcSelect.vue_vue_type_script_setup_true_lang.js +272 -176
- package/dist/lib/components/AcSidePanel.vue.d.ts +1 -1
- package/dist/lib/components/AcSidePanel.vue_vue_type_script_setup_true_lang.js +2 -2
- 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 +37 -4
- package/dist/lib/components/AcTable.vue_vue_type_script_setup_true_lang.js +239 -131
- package/dist/lib/components/AcTagInput.vue.d.ts +22 -3
- 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 +38 -4
- package/dist/lib/components/AcTextarea.vue_vue_type_script_setup_true_lang.js +113 -53
- package/dist/lib/components/AcTimePicker.vue.d.ts +15 -8
- package/dist/lib/components/AcTimePicker.vue_vue_type_script_setup_true_lang.js +102 -70
- package/dist/lib/components/AcTooltip.vue.d.ts +3 -3
- package/dist/lib/components/index.d.ts +1 -0
- package/dist/lib/composables/useToast.d.ts +2 -2
- package/dist/lib/index.d.ts +2 -1
- package/dist/lib/index.js +31 -30
- package/package.json +1 -1
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
export interface Props {
|
|
1
|
+
export interface Props<K extends "null" | "undefined" = "null"> {
|
|
2
2
|
/** Label above the field. Without one, pass `aria-label` so the field still has a name. */
|
|
3
3
|
label?: string;
|
|
4
4
|
/** Native `name` attribute. */
|
|
5
5
|
name?: string;
|
|
6
|
+
/** Text shown inside the empty field, e.g. "Enter number". */
|
|
7
|
+
placeholder?: string;
|
|
6
8
|
/** Lowest allowed value. ↓, − and Home stop here, and typed values are clamped to it on blur. No limit by default. */
|
|
7
9
|
min?: number;
|
|
8
10
|
/** Highest allowed value. ↑, + and End stop here, and typed values are clamped to it on blur. No limit by default. */
|
|
@@ -21,6 +23,8 @@ export interface Props {
|
|
|
21
23
|
holdIntervalDelay?: number;
|
|
22
24
|
/** Marks the field required and adds a red asterisk. */
|
|
23
25
|
required?: boolean;
|
|
26
|
+
/** Adds the red asterisk without native `required`, for forms that run their own validation on submit. Cloud `is-required`. */
|
|
27
|
+
requiredMark?: boolean;
|
|
24
28
|
/** Disables the field and its buttons. */
|
|
25
29
|
disabled?: boolean;
|
|
26
30
|
/** Read-only field: a muted fill, "(read only)" after the label, and no stepping. */
|
|
@@ -29,51 +33,57 @@ export interface Props {
|
|
|
29
33
|
errorMsg?: string;
|
|
30
34
|
/** Help text between the label and the field. */
|
|
31
35
|
hint?: string;
|
|
32
|
-
/** `small` 36px
|
|
33
|
-
size?: "small" | "normal";
|
|
36
|
+
/** `small` 36px, `normal` 42px or `large` 46px tall (cloud-ui's default number field); the step buttons match. */
|
|
37
|
+
size?: "small" | "normal" | "large";
|
|
38
|
+
/** What an empty field puts in `v-model`: `"null"` (default) or `"undefined"`, as cloud-ui's v1 AcNumberInput did. */
|
|
39
|
+
emptyValue?: K;
|
|
40
|
+
/** Text after the label of a read-only field, e.g. "(Read Only)". */
|
|
41
|
+
readonlyText?: string;
|
|
42
|
+
/** Keeps the editable fill on a read-only field and shows no focus halo, as cloud-ui's v1 AcNumberInput did. */
|
|
43
|
+
plainReadonly?: boolean;
|
|
44
|
+
/** Cloud-ui v1 error look: the border stays grey and the message uses the base `text-danger` red instead of the AA `-strong` shade. */
|
|
45
|
+
plainError?: boolean;
|
|
46
|
+
/** No gap around `#label-icon` and `#label-extra`, for slot content that brings its own margin. */
|
|
47
|
+
flushLabelSlots?: boolean;
|
|
48
|
+
/** Replaces the built-in range message, e.g. "Value must be between {min} and {max}". It shows from a keystroke that leaves the range until a blur that commits a value, and wins over `error-msg`. */
|
|
49
|
+
rangeMessage?: string;
|
|
50
|
+
/** The value and placeholder take the page's font weight and default placeholder colour instead of the field's own. */
|
|
51
|
+
inheritFont?: boolean;
|
|
52
|
+
/** Puts the − and + buttons in the tab order and lets a click focus them, as cloud-ui's v1 AcNumberInput did. */
|
|
53
|
+
focusableStepButtons?: boolean;
|
|
54
|
+
/** Drops the root's `w-full`, so in a flex row the field sizes to its content, as cloud-ui's v1 AcNumberInput did. */
|
|
55
|
+
autoWidth?: boolean;
|
|
34
56
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
57
|
+
declare const __VLS_export: <K extends "null" | "undefined" = "null">(__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<{
|
|
58
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<(Props<K> & {
|
|
59
|
+
modelValue?: number | (K extends "undefined" ? undefined : null);
|
|
60
|
+
}) & {
|
|
61
|
+
"onUpdate:modelValue"?: ((value: number | (K extends "undefined" ? undefined : null)) => any) | undefined;
|
|
62
|
+
onChange?: ((value: number | (K extends "undefined" ? undefined : null)) => any) | undefined;
|
|
63
|
+
}> & (typeof globalThis extends {
|
|
64
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
65
|
+
} ? P : {});
|
|
66
|
+
expose: (exposed: import("vue").ShallowUnwrapRef<{
|
|
67
|
+
/** Moves focus to the input. */
|
|
68
|
+
focus: () => void | undefined;
|
|
69
|
+
}>) => void;
|
|
70
|
+
attrs: any;
|
|
71
|
+
slots: {
|
|
72
|
+
/** Content before the label text, such as a 14px icon. */
|
|
73
|
+
"label-icon"?: () => unknown;
|
|
74
|
+
/** Content after the label text, such as "(Optional)" or an info tooltip. */
|
|
75
|
+
"label-extra"?: () => unknown;
|
|
76
|
+
/** Content inside the field after the value, before the buttons: an icon or richer unit text. */
|
|
77
|
+
suffix?: () => unknown;
|
|
78
|
+
};
|
|
79
|
+
emit: ((evt: "change", value: number | (K extends "undefined" ? undefined : null)) => void) & ((event: "update:modelValue", value: number | (K extends "undefined" ? undefined : null)) => void);
|
|
80
|
+
}>) => import("vue").VNode & {
|
|
81
|
+
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
43
82
|
};
|
|
44
|
-
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
45
|
-
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
46
|
-
/** Moves focus to the input. */
|
|
47
|
-
focus: () => void | undefined;
|
|
48
|
-
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
49
|
-
"update:modelValue": (value: number | null) => any;
|
|
50
|
-
change: (value: number | null) => any;
|
|
51
|
-
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
52
|
-
"onUpdate:modelValue"?: ((value: number | null) => any) | undefined;
|
|
53
|
-
onChange?: ((value: number | null) => any) | undefined;
|
|
54
|
-
}>, {
|
|
55
|
-
required: boolean;
|
|
56
|
-
label: string;
|
|
57
|
-
disabled: boolean;
|
|
58
|
-
max: number;
|
|
59
|
-
min: number;
|
|
60
|
-
name: string;
|
|
61
|
-
size: "small" | "normal";
|
|
62
|
-
hint: string;
|
|
63
|
-
step: number;
|
|
64
|
-
readonly: boolean;
|
|
65
|
-
errorMsg: string;
|
|
66
|
-
unit: string;
|
|
67
|
-
precision: number;
|
|
68
|
-
stepButtons: boolean;
|
|
69
|
-
holdDelay: number;
|
|
70
|
-
holdIntervalDelay: number;
|
|
71
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
72
|
-
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
73
83
|
declare const _default: typeof __VLS_export;
|
|
74
84
|
export default _default;
|
|
75
|
-
type
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
};
|
|
85
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
86
|
+
[K in keyof T]: T[K];
|
|
87
|
+
} : {
|
|
88
|
+
[K in keyof T as K]: T[K];
|
|
89
|
+
}) & {};
|
|
@@ -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 };
|
|
@@ -20,7 +20,7 @@ declare const __VLS_export: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_se
|
|
|
20
20
|
props: import("vue").PublicProps & __VLS_PrettifyLocal<(Props<T> & {
|
|
21
21
|
modelValue?: T;
|
|
22
22
|
}) & {
|
|
23
|
-
"onUpdate:modelValue"?: ((value: T
|
|
23
|
+
"onUpdate:modelValue"?: ((value: T) => any) | undefined;
|
|
24
24
|
onChange?: ((value: T) => any) | undefined;
|
|
25
25
|
}> & (typeof globalThis extends {
|
|
26
26
|
__VLS_PROPS_FALLBACK: infer P;
|
|
@@ -42,7 +42,7 @@ declare const __VLS_export: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_se
|
|
|
42
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
43
|
right?: () => unknown;
|
|
44
44
|
};
|
|
45
|
-
emit: ((evt: "change", value: T) => void) & ((event: "update:modelValue", value: T
|
|
45
|
+
emit: ((evt: "change", value: T) => void) & ((event: "update:modelValue", value: T) => void);
|
|
46
46
|
}>) => import("vue").VNode & {
|
|
47
47
|
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
48
48
|
};
|
|
@@ -37,7 +37,7 @@ var S = ["aria-disabled"], C = [
|
|
|
37
37
|
titleClass: { default: "text-base font-semibold text-heading" },
|
|
38
38
|
descriptionClass: { default: "mt-0.5 text-xs leading-relaxed text-muted" }
|
|
39
39
|
}, {
|
|
40
|
-
modelValue: {},
|
|
40
|
+
modelValue: { default: void 0 },
|
|
41
41
|
modelModifiers: {}
|
|
42
42
|
}),
|
|
43
43
|
emits: /*@__PURE__*/ c(["change"], ["update:modelValue"]),
|
|
@@ -32,23 +32,44 @@ export interface Props<T> {
|
|
|
32
32
|
errorMsg?: string;
|
|
33
33
|
/** Help text between the label and the field. */
|
|
34
34
|
hint?: string;
|
|
35
|
-
/** `compact` 32px (toolbars and filters), `small` 36px
|
|
36
|
-
size?: "compact" | "small" | "normal";
|
|
35
|
+
/** Field height: `xs` 26px, `compact` 32px (toolbars and filters), `xsmall` 34px, `small` 36px, `medium` 38px, `normal` 42px or `large` 50px. Old cloud-ui `size` `xs`, `sm`, `md`, `lg`, `xl` are `xs`, `xsmall`, `medium`, `normal`, `large`. */
|
|
36
|
+
size?: "xs" | "compact" | "xsmall" | "small" | "medium" | "normal" | "large";
|
|
37
|
+
/** Field style: `outline` (bordered), `soft` (accent fill, no border) or `ghost` (no fill, no border), e.g. inside a table row. */
|
|
38
|
+
variant?: "outline" | "soft" | "ghost";
|
|
39
|
+
/** Draws a primary halo around the field to point the viewer at it. */
|
|
40
|
+
highlight?: boolean;
|
|
41
|
+
/** Shows the value but blocks changes: a muted fill, and "(read only)" after the label. Old cloud-ui `is-read-only`. */
|
|
42
|
+
readonly?: boolean;
|
|
43
|
+
/** With `required`, shows "This field is required. Please select an option." (with `multiple`, "…at least one option.") when the list closes or the value changes while nothing is selected. It shows instead of `errorMsg`. */
|
|
44
|
+
validateRequired?: boolean;
|
|
45
|
+
/** Treats values that aren't in `options` as no selection, so the field shows the placeholder instead of the raw value. */
|
|
46
|
+
hideUnknownValues?: boolean;
|
|
47
|
+
/** What a single select writes to `v-model` when the viewer clears it, e.g. `""` for a string field. */
|
|
48
|
+
emptyValue?: T | null;
|
|
49
|
+
/** With `multiple`, writes `[]` on mount when `v-model` starts empty (`null`, `undefined` or `""`), so the app always reads an array. */
|
|
50
|
+
initEmptyArray?: boolean;
|
|
51
|
+
/** Text shown when the list is empty or nothing matches the search, in place of "No options" and "No results for “text”", e.g. "No options found". */
|
|
52
|
+
emptyText?: string;
|
|
53
|
+
/** With `refreshable`, hides the refresh button while the field is disabled instead of showing it greyed out. */
|
|
54
|
+
hideRefreshWhenDisabled?: boolean;
|
|
55
|
+
/** With `multiple`, pads the chips like a line of text, so a field with chips is 4–8px taller than the bare field. */
|
|
56
|
+
looseChips?: boolean;
|
|
37
57
|
/** Text shown when no option matches the search. */
|
|
38
58
|
noResultText?: string;
|
|
39
59
|
/** Side of the field the list opens on: `bottom` or `top`. It flips to the other side when there isn't room. */
|
|
40
60
|
placement?: "bottom" | "top";
|
|
41
61
|
}
|
|
42
|
-
declare const __VLS_export: <V>(__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<{
|
|
62
|
+
declare const __VLS_export: <V, M = V | V[] | null>(__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<{
|
|
43
63
|
props: import("vue").PublicProps & __VLS_PrettifyLocal<(Props<V> & {
|
|
44
|
-
modelValue?:
|
|
64
|
+
modelValue?: M;
|
|
45
65
|
/** Whether the list is open. Bind `v-model:open` to react when it opens or closes, e.g. to check a required field. */
|
|
46
66
|
open?: boolean;
|
|
47
67
|
}) & {
|
|
48
68
|
onSearch?: ((query: string) => any) | undefined;
|
|
49
69
|
onSelect?: ((option: SelectOption<V>) => any) | undefined;
|
|
50
|
-
"onUpdate:modelValue"?: ((value:
|
|
70
|
+
"onUpdate:modelValue"?: ((value: M) => any) | undefined;
|
|
51
71
|
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
72
|
+
onChange?: ((value: M) => any) | undefined;
|
|
52
73
|
onCreate?: ((text: string) => any) | undefined;
|
|
53
74
|
onRemove?: ((option: SelectOption<V>) => any) | undefined;
|
|
54
75
|
onRefresh?: (() => any) | undefined;
|
|
@@ -75,8 +96,16 @@ declare const __VLS_export: <V>(__VLS_props: NonNullable<Awaited<typeof __VLS_se
|
|
|
75
96
|
empty?: (props: {
|
|
76
97
|
query: string;
|
|
77
98
|
}) => unknown;
|
|
99
|
+
/** One template for an option in the list and in the closed field (single select). `option` and `selected` win over it. Old cloud-ui `custom-options`. */
|
|
100
|
+
content?: (props: {
|
|
101
|
+
option: SelectOption<V>;
|
|
102
|
+
}) => unknown;
|
|
103
|
+
/** Content before the label text, e.g. an icon. */
|
|
104
|
+
"label-icon"?: () => unknown;
|
|
105
|
+
/** Content after the label text, e.g. "(Optional)". */
|
|
106
|
+
"label-extra"?: () => unknown;
|
|
78
107
|
};
|
|
79
|
-
emit: (((evt: "search", query: string) => void) & ((evt: "select", option: SelectOption<V>) => void) & ((evt: "create", text: string) => void) & ((evt: "remove", option: SelectOption<V>) => void) & ((evt: "refresh") => void)) & (((event: "update:modelValue", value:
|
|
108
|
+
emit: (((evt: "search", query: string) => void) & ((evt: "select", option: SelectOption<V>) => void) & ((evt: "change", value: M) => void) & ((evt: "create", text: string) => void) & ((evt: "remove", option: SelectOption<V>) => void) & ((evt: "refresh") => void)) & (((event: "update:modelValue", value: M) => void) & ((event: "update:open", value: boolean) => void));
|
|
80
109
|
}>) => import("vue").VNode & {
|
|
81
110
|
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
82
111
|
};
|