@ac-design/design-system 2.2.0 → 2.3.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/charts/ChartFrame.vue_vue_type_script_setup_true_lang.js +89 -88
- package/dist/lib/compat.css +210 -0
- package/dist/lib/components/AcAppSwitcher.vue_vue_type_script_setup_true_lang.js +74 -73
- package/dist/lib/components/AcButton.vue.d.ts +18 -12
- package/dist/lib/components/AcButton.vue_vue_type_script_setup_true_lang.js +62 -32
- 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/AcClusterSwitcher.vue_vue_type_script_setup_true_lang.js +151 -150
- package/dist/lib/components/AcColorInput.vue.d.ts +1 -1
- package/dist/lib/components/AcDatePicker.vue.d.ts +27 -3
- package/dist/lib/components/AcDatePicker.vue_vue_type_script_setup_true_lang.js +518 -454
- package/dist/lib/components/AcDropdown.vue_vue_type_script_setup_true_lang.js +56 -55
- package/dist/lib/components/AcErrorState.vue.d.ts +1 -1
- package/dist/lib/components/AcFormFooter.vue_vue_type_script_setup_true_lang.js +39 -38
- package/dist/lib/components/AcHeader.vue.d.ts +1 -1
- package/dist/lib/components/AcInput.vue.d.ts +28 -7
- package/dist/lib/components/AcInput.vue_vue_type_script_setup_true_lang.js +149 -80
- package/dist/lib/components/AcKeyValueInput.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/AcModal.vue_vue_type_script_setup_true_lang.js +3 -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_vue_type_script_setup_true_lang.js +90 -89
- package/dist/lib/components/AcNumberInput.vue.d.ts +1 -1
- 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 +12 -1
- package/dist/lib/components/AcSelect.vue_vue_type_script_setup_true_lang.js +237 -220
- package/dist/lib/components/AcSidePanel.vue_vue_type_script_setup_true_lang.js +3 -1
- package/dist/lib/components/AcSideTabs.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 +1 -1
- package/dist/lib/components/AcTable.vue.d.ts +13 -1
- package/dist/lib/components/AcTable.vue_vue_type_script_setup_true_lang.js +106 -86
- package/dist/lib/components/AcTagInput.vue.d.ts +1 -1
- package/dist/lib/components/AcTextarea.vue.d.ts +30 -4
- package/dist/lib/components/AcTextarea.vue_vue_type_script_setup_true_lang.js +92 -61
- 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 +21 -3
- package/dist/lib/components/AcTimePicker.vue_vue_type_script_setup_true_lang.js +234 -201
- package/dist/lib/components/AcTooltip.vue_vue_type_script_setup_true_lang.js +73 -72
- package/dist/lib/components/AcUserMenu.vue.d.ts +8 -0
- package/dist/lib/components/AcUserMenu.vue_vue_type_script_setup_true_lang.js +125 -107
- package/dist/lib/components/fixedFrame.d.ts +11 -0
- package/dist/lib/components/fixedFrame.js +24 -0
- package/dist/lib/components/index.d.ts +1 -0
- package/dist/lib/components/types.d.ts +2 -0
- package/dist/lib/index.js +34 -33
- package/package.json +1 -1
|
@@ -1,37 +1,48 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import e from "./AcSpinner.js";
|
|
2
|
+
import { computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, defineComponent as o, mergeModels as s, mergeProps as c, normalizeClass as l, openBlock as u, ref as d, renderSlot as f, resolveDynamicComponent as p, toDisplayString as m, unref as h, useAttrs as g, useId as _, useModel as v, useSlots as y, vModelDynamic as b, withDirectives as x } from "vue";
|
|
3
|
+
import { Eye as S, EyeOff as C } from "@lucide/vue";
|
|
3
4
|
//#region src/lib/components/AcInput.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
-
var
|
|
5
|
-
key: 0,
|
|
6
|
-
class: "text-muted"
|
|
7
|
-
}, T = {
|
|
5
|
+
var w = ["for"], T = { key: 0 }, E = {
|
|
8
6
|
key: 1,
|
|
7
|
+
class: "text-muted"
|
|
8
|
+
}, D = {
|
|
9
|
+
key: 2,
|
|
9
10
|
class: "text-danger",
|
|
10
11
|
"aria-hidden": "true"
|
|
11
|
-
},
|
|
12
|
+
}, O = ["id"], ee = { class: "flex" }, k = [
|
|
12
13
|
"id",
|
|
13
14
|
"name",
|
|
14
15
|
"type",
|
|
15
16
|
"disabled",
|
|
16
17
|
"readonly",
|
|
17
18
|
"required",
|
|
19
|
+
"aria-label",
|
|
18
20
|
"aria-invalid",
|
|
19
21
|
"aria-describedby"
|
|
20
|
-
],
|
|
22
|
+
], A = [
|
|
23
|
+
"disabled",
|
|
24
|
+
"aria-label",
|
|
25
|
+
"aria-pressed",
|
|
26
|
+
"aria-busy"
|
|
27
|
+
], j = [
|
|
21
28
|
"disabled",
|
|
22
29
|
"aria-label",
|
|
23
30
|
"title"
|
|
24
|
-
],
|
|
31
|
+
], M = { key: 1 }, N = ["id"], P = /*@__PURE__*/ o({
|
|
25
32
|
inheritAttrs: !1,
|
|
26
33
|
__name: "AcInput",
|
|
27
|
-
props: /*@__PURE__*/
|
|
28
|
-
label: {},
|
|
34
|
+
props: /*@__PURE__*/ s({
|
|
35
|
+
label: { default: "" },
|
|
29
36
|
name: { default: "" },
|
|
30
37
|
type: { default: "text" },
|
|
31
38
|
required: {
|
|
32
39
|
type: Boolean,
|
|
33
40
|
default: !1
|
|
34
41
|
},
|
|
42
|
+
requiredMark: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: !1
|
|
45
|
+
},
|
|
35
46
|
disabled: {
|
|
36
47
|
type: Boolean,
|
|
37
48
|
default: !1
|
|
@@ -41,8 +52,26 @@ var C = ["for"], w = {
|
|
|
41
52
|
default: !1
|
|
42
53
|
},
|
|
43
54
|
errorMsg: { default: "" },
|
|
55
|
+
invalid: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
default: !1
|
|
58
|
+
},
|
|
44
59
|
hint: { default: "" },
|
|
45
60
|
size: { default: "normal" },
|
|
61
|
+
inputClass: {
|
|
62
|
+
type: [
|
|
63
|
+
Boolean,
|
|
64
|
+
null,
|
|
65
|
+
String,
|
|
66
|
+
Object,
|
|
67
|
+
Array
|
|
68
|
+
],
|
|
69
|
+
default: void 0
|
|
70
|
+
},
|
|
71
|
+
revealing: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
default: !1
|
|
74
|
+
},
|
|
46
75
|
addonLabel: { default: "" },
|
|
47
76
|
addonIcon: { default: void 0 },
|
|
48
77
|
addonIconOnly: {
|
|
@@ -51,101 +80,141 @@ var C = ["for"], w = {
|
|
|
51
80
|
}
|
|
52
81
|
}, {
|
|
53
82
|
modelValue: { default: "" },
|
|
54
|
-
modelModifiers: {}
|
|
83
|
+
modelModifiers: {},
|
|
84
|
+
showValue: {
|
|
85
|
+
type: Boolean,
|
|
86
|
+
default: !1
|
|
87
|
+
},
|
|
88
|
+
showValueModifiers: {}
|
|
55
89
|
}),
|
|
56
|
-
emits: /*@__PURE__*/
|
|
57
|
-
setup(
|
|
58
|
-
let
|
|
59
|
-
class:
|
|
60
|
-
style:
|
|
61
|
-
})),
|
|
62
|
-
let { class: e, style: t, ...n } =
|
|
90
|
+
emits: /*@__PURE__*/ s(["addon"], ["update:modelValue", "update:showValue"]),
|
|
91
|
+
setup(o, { expose: s, emit: P }) {
|
|
92
|
+
let F = o, I = v(o, "modelValue"), L = v(o, "showValue"), R = P, z = _(), B = g(), V = y(), H = t(() => ({
|
|
93
|
+
class: B.class,
|
|
94
|
+
style: B.style
|
|
95
|
+
})), U = t(() => {
|
|
96
|
+
let { class: e, style: t, ...n } = B;
|
|
63
97
|
return n;
|
|
64
|
-
}),
|
|
65
|
-
|
|
66
|
-
|
|
98
|
+
}), W = d(null), G = t(() => !!F.label || !!V["label-icon"] || !!V["label-extra"]), K = t(() => G.value ? void 0 : B["aria-label"] ?? B.placeholder), q = t(() => !!F.errorMsg || F.invalid), J = t(() => F.type === "password" && L.value ? "text" : F.type), Y = t(() => [
|
|
99
|
+
B["aria-describedby"],
|
|
100
|
+
F.hint && `${z}-hint`,
|
|
101
|
+
F.errorMsg && `${z}-msg`
|
|
102
|
+
].filter(Boolean).join(" ") || void 0), X = t(() => !!F.addonLabel || !!F.addonIcon), Z = t(() => !!V.suffix || F.type === "password"), Q = {
|
|
103
|
+
xsmall: "h-8.5",
|
|
104
|
+
small: "h-9",
|
|
105
|
+
normal: "h-10.5"
|
|
106
|
+
}, te = {
|
|
107
|
+
xsmall: "w-8.5",
|
|
108
|
+
small: "w-9",
|
|
109
|
+
normal: "w-10.5"
|
|
110
|
+
}, ne = {
|
|
111
|
+
xsmall: "pl-3",
|
|
112
|
+
small: "pl-4",
|
|
113
|
+
normal: "pl-5"
|
|
114
|
+
}, re = {
|
|
115
|
+
xsmall: "pr-3",
|
|
116
|
+
small: "pr-4",
|
|
117
|
+
normal: "pr-5"
|
|
118
|
+
}, $ = t(() => F.size in Q ? F.size : "normal");
|
|
119
|
+
function ie(e) {
|
|
120
|
+
F.disabled || R("addon", e);
|
|
67
121
|
}
|
|
68
|
-
return
|
|
69
|
-
class: ["w-full",
|
|
122
|
+
return s({ focus: () => W.value?.focus() }), (t, s) => (u(), i("div", c(H.value, {
|
|
123
|
+
class: ["w-full", o.disabled && "opacity-50"],
|
|
70
124
|
"data-ac-ds": "",
|
|
71
125
|
"data-testid": "ac-input"
|
|
72
126
|
}), [
|
|
73
|
-
i("label", {
|
|
74
|
-
|
|
127
|
+
G.value ? (u(), i("label", {
|
|
128
|
+
key: 0,
|
|
129
|
+
for: h(z),
|
|
75
130
|
class: "mb-2 flex items-center gap-1 text-base font-medium text-heading"
|
|
76
131
|
}, [
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
132
|
+
f(t.$slots, "label-icon"),
|
|
133
|
+
o.label ? (u(), i("span", T, m(o.label), 1)) : r("", !0),
|
|
134
|
+
o.readonly ? (u(), i("span", E, "(read only)")) : r("", !0),
|
|
135
|
+
f(t.$slots, "label-extra"),
|
|
136
|
+
o.required || o.requiredMark ? (u(), i("span", D, "*")) : r("", !0)
|
|
137
|
+
], 8, w)) : r("", !0),
|
|
138
|
+
o.hint ? (u(), i("p", {
|
|
139
|
+
key: 1,
|
|
140
|
+
id: `${h(z)}-hint`,
|
|
84
141
|
class: "mb-2 text-base text-muted"
|
|
85
|
-
},
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
142
|
+
}, m(o.hint), 9, O)) : r("", !0),
|
|
143
|
+
a("div", ee, [a("div", { class: l(["relative flex min-w-0 flex-1 items-center border transition-[border-color,box-shadow,background-color] duration-200", [
|
|
144
|
+
Q[$.value],
|
|
145
|
+
X.value ? "rounded-l-10" : "rounded-10",
|
|
146
|
+
o.readonly ? "bg-surface-muted" : "bg-background",
|
|
147
|
+
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"]
|
|
91
148
|
]]) }, [
|
|
92
|
-
|
|
149
|
+
t.$slots.prefix ? (u(), i("span", {
|
|
93
150
|
key: 0,
|
|
94
|
-
class:
|
|
95
|
-
}, [
|
|
96
|
-
|
|
97
|
-
id:
|
|
151
|
+
class: l(["flex h-full shrink-0 items-center text-base whitespace-nowrap text-muted select-none [&_svg]:size-4", o.size === "normal" ? "pl-4" : "pl-3"])
|
|
152
|
+
}, [f(t.$slots, "prefix")], 2)) : r("", !0),
|
|
153
|
+
x(a("input", c({
|
|
154
|
+
id: h(z),
|
|
98
155
|
ref_key: "input",
|
|
99
|
-
ref:
|
|
100
|
-
},
|
|
101
|
-
"onUpdate:modelValue":
|
|
102
|
-
name:
|
|
103
|
-
type:
|
|
104
|
-
disabled:
|
|
105
|
-
readonly:
|
|
106
|
-
required:
|
|
107
|
-
"aria-
|
|
108
|
-
"aria-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
156
|
+
ref: W
|
|
157
|
+
}, U.value, {
|
|
158
|
+
"onUpdate:modelValue": s[0] ||= (e) => I.value = e,
|
|
159
|
+
name: o.name,
|
|
160
|
+
type: J.value,
|
|
161
|
+
disabled: o.disabled,
|
|
162
|
+
readonly: o.readonly,
|
|
163
|
+
required: o.required,
|
|
164
|
+
"aria-label": K.value,
|
|
165
|
+
"aria-invalid": q.value || void 0,
|
|
166
|
+
"aria-describedby": Y.value,
|
|
167
|
+
class: ["block h-full w-full min-w-0 flex-1 rounded-10 bg-transparent text-base font-normal text-heading outline-none placeholder:text-muted/80 disabled:cursor-not-allowed", [
|
|
168
|
+
t.$slots.prefix ? "pl-2" : ne[$.value],
|
|
169
|
+
Z.value ? "pr-2" : re[$.value],
|
|
170
|
+
o.inputClass
|
|
171
|
+
]]
|
|
172
|
+
}), null, 16, k), [[b, I.value]]),
|
|
173
|
+
t.$slots.suffix ? (u(), i("span", {
|
|
112
174
|
key: 1,
|
|
113
|
-
class:
|
|
114
|
-
}, [
|
|
115
|
-
|
|
175
|
+
class: l(["relative flex h-full shrink-0 items-center text-base whitespace-nowrap text-muted select-none [&_svg]:size-4", o.type === "password" ? "pr-2" : o.size === "normal" ? "pr-4" : "pr-3"])
|
|
176
|
+
}, [f(t.$slots, "suffix")], 2)) : r("", !0),
|
|
177
|
+
o.type === "password" ? (u(), i("button", {
|
|
116
178
|
key: 2,
|
|
117
179
|
type: "button",
|
|
118
|
-
class:
|
|
119
|
-
|
|
120
|
-
"aria-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
180
|
+
class: l(["relative inline-flex shrink-0 cursor-pointer items-center justify-center rounded-4 text-muted transition-colors hover:text-heading focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none disabled:cursor-wait", o.size === "normal" ? "mr-4" : "mr-3"]),
|
|
181
|
+
disabled: o.revealing,
|
|
182
|
+
"aria-label": L.value ? "Hide value" : "Show value",
|
|
183
|
+
"aria-pressed": L.value,
|
|
184
|
+
"aria-busy": o.revealing || void 0,
|
|
185
|
+
onClick: s[1] ||= (e) => L.value = !L.value
|
|
186
|
+
}, [o.revealing ? (u(), n(e, {
|
|
187
|
+
key: 0,
|
|
188
|
+
size: o.size === "normal" ? "normal" : "small",
|
|
189
|
+
label: ""
|
|
190
|
+
}, null, 8, ["size"])) : (u(), n(p(L.value ? h(C) : h(S)), {
|
|
191
|
+
key: 1,
|
|
192
|
+
class: l(o.size === "normal" ? "size-5" : "size-4"),
|
|
124
193
|
"aria-hidden": "true"
|
|
125
|
-
}, null, 8, ["class"]))], 10,
|
|
126
|
-
], 2),
|
|
194
|
+
}, null, 8, ["class"]))], 10, A)) : r("", !0)
|
|
195
|
+
], 2), X.value ? (u(), i("button", {
|
|
127
196
|
key: 0,
|
|
128
197
|
type: "button",
|
|
129
|
-
class:
|
|
130
|
-
disabled:
|
|
131
|
-
"aria-label":
|
|
132
|
-
title:
|
|
198
|
+
class: l(["relative -ml-px inline-flex shrink-0 cursor-pointer items-center justify-center gap-1.5 rounded-r-10 border border-border bg-surface text-base font-medium whitespace-nowrap text-heading transition-colors duration-200 hover:bg-surface-sunken/70 focus-visible:z-10 focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none disabled:cursor-not-allowed disabled:hover:bg-surface", [Q[$.value], o.addonIconOnly ? te[$.value] : "px-4"]]),
|
|
199
|
+
disabled: o.disabled,
|
|
200
|
+
"aria-label": o.addonIconOnly ? o.addonLabel : void 0,
|
|
201
|
+
title: o.addonIconOnly ? o.addonLabel : void 0,
|
|
133
202
|
"data-ac-ds": "",
|
|
134
203
|
"data-testid": "ac-input-addon",
|
|
135
|
-
onClick:
|
|
136
|
-
}, [
|
|
204
|
+
onClick: ie
|
|
205
|
+
}, [o.addonIcon ? (u(), n(p(o.addonIcon), {
|
|
137
206
|
key: 0,
|
|
138
207
|
class: "size-4 text-muted",
|
|
139
208
|
"aria-hidden": "true"
|
|
140
|
-
})) :
|
|
141
|
-
|
|
142
|
-
key:
|
|
143
|
-
id: `${
|
|
209
|
+
})) : r("", !0), o.addonIconOnly ? r("", !0) : (u(), i("span", M, m(o.addonLabel), 1))], 10, j)) : r("", !0)]),
|
|
210
|
+
o.errorMsg ? (u(), i("p", {
|
|
211
|
+
key: 2,
|
|
212
|
+
id: `${h(z)}-msg`,
|
|
144
213
|
class: "mt-1 text-base text-danger-strong",
|
|
145
214
|
role: "alert"
|
|
146
|
-
},
|
|
215
|
+
}, m(o.errorMsg), 9, N)) : r("", !0)
|
|
147
216
|
], 16));
|
|
148
217
|
}
|
|
149
218
|
});
|
|
150
219
|
//#endregion
|
|
151
|
-
export {
|
|
220
|
+
export { P as default };
|
|
@@ -87,9 +87,9 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
87
87
|
disabled: boolean;
|
|
88
88
|
max: number;
|
|
89
89
|
size: "small" | "normal";
|
|
90
|
+
hint: string;
|
|
90
91
|
readonly: boolean;
|
|
91
92
|
options: SelectOption<string>[];
|
|
92
|
-
hint: string;
|
|
93
93
|
errorMsg: string;
|
|
94
94
|
mono: boolean;
|
|
95
95
|
itemName: string;
|
|
@@ -23,6 +23,10 @@ export interface Props {
|
|
|
23
23
|
persist?: boolean;
|
|
24
24
|
/** localStorage key for `persist`. cloud-ui uses `user-locale`. */
|
|
25
25
|
storageKey?: string;
|
|
26
|
+
/** `compact` rows run edge to edge at 36px. `comfortable` is cloud-ui's navbar language menu: 48px rounded rows inset 8px from the edge, with 20px flags. */
|
|
27
|
+
density?: "compact" | "comfortable";
|
|
28
|
+
/** A hint shown under the `icon` trigger on hover and focus, e.g. "Change language". */
|
|
29
|
+
tooltip?: string;
|
|
26
30
|
}
|
|
27
31
|
type __VLS_Props = Props;
|
|
28
32
|
type __VLS_ModelProps = {
|
|
@@ -39,10 +43,12 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
39
43
|
}>, {
|
|
40
44
|
variant: "icon" | "button";
|
|
41
45
|
align: "start" | "end";
|
|
46
|
+
tooltip: string;
|
|
42
47
|
ariaLabel: string;
|
|
43
48
|
menuTitle: string;
|
|
44
49
|
persist: boolean;
|
|
45
50
|
storageKey: string;
|
|
51
|
+
density: "compact" | "comfortable";
|
|
46
52
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
47
53
|
declare const _default: typeof __VLS_export;
|
|
48
54
|
export default _default;
|
|
@@ -1,23 +1,16 @@
|
|
|
1
|
-
import e from "./
|
|
2
|
-
import t from "./
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
1
|
+
import e from "./AcTooltip.js";
|
|
2
|
+
import t from "./AcDropdown.js";
|
|
3
|
+
import n from "./AcDropdownItem.js";
|
|
4
|
+
import { Fragment as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createVNode as l, defineComponent as u, mergeModels as d, normalizeClass as f, openBlock as p, ref as m, renderList as h, toDisplayString as g, unref as _, useModel as v, withCtx as y } from "vue";
|
|
5
|
+
import { ChevronDown as b, Languages as x } from "@lucide/vue";
|
|
5
6
|
//#region src/lib/components/AcLocaleSwitcher.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
-
var
|
|
7
|
-
key: 0,
|
|
8
|
-
class: "mb-2 border-b border-border px-4 py-2 text-xs font-semibold text-muted",
|
|
9
|
-
"aria-hidden": "true"
|
|
10
|
-
}, w = { class: "flex items-center gap-2" }, T = {
|
|
11
|
-
key: 0,
|
|
12
|
-
class: "shrink-0 text-xl leading-none",
|
|
13
|
-
"aria-hidden": "true"
|
|
14
|
-
}, E = ["lang"], D = {
|
|
7
|
+
var S = ["aria-label"], C = ["aria-label"], w = { class: "font-mono text-xs tracking-wide uppercase" }, T = ["lang"], E = {
|
|
15
8
|
key: 1,
|
|
16
9
|
class: "size-2 shrink-0 rounded-full bg-primary",
|
|
17
10
|
"aria-hidden": "true"
|
|
18
|
-
},
|
|
11
|
+
}, D = /*@__PURE__*/ u({
|
|
19
12
|
__name: "AcLocaleSwitcher",
|
|
20
|
-
props: /*@__PURE__*/
|
|
13
|
+
props: /*@__PURE__*/ d({
|
|
21
14
|
locales: {},
|
|
22
15
|
variant: { default: "icon" },
|
|
23
16
|
ariaLabel: { default: "Change language" },
|
|
@@ -27,85 +20,108 @@ var b = ["aria-label"], x = ["aria-label"], S = { class: "font-mono text-xs trac
|
|
|
27
20
|
type: Boolean,
|
|
28
21
|
default: !1
|
|
29
22
|
},
|
|
30
|
-
storageKey: { default: "user-locale" }
|
|
23
|
+
storageKey: { default: "user-locale" },
|
|
24
|
+
density: { default: "compact" },
|
|
25
|
+
tooltip: { default: "" }
|
|
31
26
|
}, {
|
|
32
27
|
modelValue: { default: "" },
|
|
33
28
|
modelModifiers: {}
|
|
34
29
|
}),
|
|
35
|
-
emits: /*@__PURE__*/
|
|
36
|
-
setup(
|
|
37
|
-
let
|
|
38
|
-
function
|
|
30
|
+
emits: /*@__PURE__*/ d(["change"], ["update:modelValue"]),
|
|
31
|
+
setup(u, { emit: d }) {
|
|
32
|
+
let D = u, O = v(u, "modelValue"), k = d, A = m(!1), j = i(() => D.density === "comfortable"), M = i(() => D.locales.find((e) => e.value === O.value)), N = i(() => M.value ? `${D.ariaLabel} (${M.value.label})` : D.ariaLabel);
|
|
33
|
+
function P() {
|
|
39
34
|
try {
|
|
40
|
-
return localStorage.getItem(
|
|
35
|
+
return localStorage.getItem(D.storageKey);
|
|
41
36
|
} catch {
|
|
42
37
|
return null;
|
|
43
38
|
}
|
|
44
39
|
}
|
|
45
|
-
function
|
|
46
|
-
if (e !==
|
|
47
|
-
localStorage.setItem(
|
|
40
|
+
function F(e) {
|
|
41
|
+
if (e !== O.value && (O.value = e, k("change", e), D.persist)) try {
|
|
42
|
+
localStorage.setItem(D.storageKey, e);
|
|
48
43
|
} catch {}
|
|
49
44
|
}
|
|
50
|
-
if (
|
|
51
|
-
let e =
|
|
52
|
-
e && e !==
|
|
45
|
+
if (D.persist && typeof window < "u") {
|
|
46
|
+
let e = P();
|
|
47
|
+
e && e !== O.value && D.locales.some((t) => t.value === e) && F(e);
|
|
53
48
|
}
|
|
54
|
-
return (
|
|
49
|
+
return (i, d) => u.locales.length > 1 ? (p(), a(t, {
|
|
55
50
|
key: 0,
|
|
56
|
-
|
|
57
|
-
"
|
|
51
|
+
open: A.value,
|
|
52
|
+
"onUpdate:open": d[0] ||= (e) => A.value = e,
|
|
53
|
+
align: u.align,
|
|
54
|
+
"menu-label": u.ariaLabel,
|
|
58
55
|
"data-testid": "ac-locale-switcher"
|
|
59
56
|
}, {
|
|
60
|
-
trigger:
|
|
57
|
+
trigger: y(() => [u.variant === "icon" ? (p(), a(e, {
|
|
61
58
|
key: 0,
|
|
62
|
-
|
|
63
|
-
"
|
|
64
|
-
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
59
|
+
content: u.tooltip,
|
|
60
|
+
placement: "bottom",
|
|
61
|
+
disabled: !u.tooltip || A.value
|
|
62
|
+
}, {
|
|
63
|
+
default: y(() => [c("button", {
|
|
64
|
+
type: "button",
|
|
65
|
+
"aria-label": N.value,
|
|
66
|
+
class: f(["inline-flex cursor-pointer items-center gap-2 rounded-10 px-2 py-0.5 transition-colors duration-200 hover:text-heading focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-surface focus-visible:outline-none", A.value ? "text-heading" : "text-muted"])
|
|
67
|
+
}, [l(_(x), {
|
|
68
|
+
class: "size-5",
|
|
69
|
+
"aria-hidden": "true"
|
|
70
|
+
})], 10, S)]),
|
|
71
|
+
_: 1
|
|
72
|
+
}, 8, ["content", "disabled"])) : (p(), s("button", {
|
|
69
73
|
key: 1,
|
|
70
74
|
type: "button",
|
|
71
|
-
"aria-label":
|
|
72
|
-
class:
|
|
75
|
+
"aria-label": N.value,
|
|
76
|
+
class: f(["inline-flex h-9 cursor-pointer items-center gap-1.5 rounded-10 border border-border bg-surface px-3 text-base font-medium text-heading transition-colors duration-200 hover:bg-surface-sunken/50 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-surface focus-visible:outline-none", A.value && "bg-surface-sunken/50"])
|
|
73
77
|
}, [
|
|
74
|
-
|
|
78
|
+
l(_(x), {
|
|
75
79
|
class: "size-4 text-muted",
|
|
76
80
|
"aria-hidden": "true"
|
|
77
81
|
}),
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
class:
|
|
82
|
+
c("span", w, g(M.value?.value ?? ""), 1),
|
|
83
|
+
l(_(b), {
|
|
84
|
+
class: f(["size-4 text-muted transition-transform duration-200 motion-reduce:transition-none", A.value && "rotate-180"]),
|
|
81
85
|
"aria-hidden": "true"
|
|
82
86
|
}, null, 8, ["class"])
|
|
83
|
-
], 10,
|
|
84
|
-
default:
|
|
87
|
+
], 10, C))]),
|
|
88
|
+
default: y(() => [c("div", { class: f(j.value && "flex flex-col px-2 py-1") }, [u.menuTitle ? (p(), s("p", {
|
|
89
|
+
key: 0,
|
|
90
|
+
class: f(["mb-2 border-b border-border py-2 text-xs font-semibold text-muted", j.value ? "px-3" : "px-4"]),
|
|
91
|
+
"aria-hidden": "true"
|
|
92
|
+
}, g(u.menuTitle), 3)) : o("", !0), (p(!0), s(r, null, h(u.locales, (e) => (p(), a(n, {
|
|
85
93
|
key: e.value,
|
|
86
94
|
description: e.description,
|
|
87
|
-
"aria-current": e.value ===
|
|
88
|
-
class:
|
|
89
|
-
onClick: (t) =>
|
|
95
|
+
"aria-current": e.value === O.value ? "true" : void 0,
|
|
96
|
+
class: f([e.value === O.value && "bg-surface-sunken/50", j.value && "rounded-8"]),
|
|
97
|
+
onClick: (t) => F(e.value)
|
|
90
98
|
}, {
|
|
91
|
-
default:
|
|
92
|
-
e.flag ? (
|
|
93
|
-
|
|
99
|
+
default: y(() => [c("span", { class: f(["flex items-center gap-2", j.value && "min-h-8 px-1"]) }, [
|
|
100
|
+
e.flag ? (p(), s("span", {
|
|
101
|
+
key: 0,
|
|
102
|
+
class: f(["shrink-0 leading-none", j.value ? "text-2xl" : "text-xl"]),
|
|
103
|
+
"aria-hidden": "true"
|
|
104
|
+
}, g(e.flag), 3)) : o("", !0),
|
|
105
|
+
c("span", {
|
|
94
106
|
class: "min-w-0 flex-1 truncate font-medium text-heading",
|
|
95
107
|
lang: e.value
|
|
96
|
-
},
|
|
97
|
-
e.value ===
|
|
98
|
-
])]),
|
|
108
|
+
}, g(e.label), 9, T),
|
|
109
|
+
e.value === O.value ? (p(), s("span", E)) : o("", !0)
|
|
110
|
+
], 2)]),
|
|
99
111
|
_: 2
|
|
100
112
|
}, 1032, [
|
|
101
113
|
"description",
|
|
102
114
|
"aria-current",
|
|
103
115
|
"class",
|
|
104
116
|
"onClick"
|
|
105
|
-
]))), 128))]),
|
|
117
|
+
]))), 128))], 2)]),
|
|
106
118
|
_: 1
|
|
107
|
-
}, 8, [
|
|
119
|
+
}, 8, [
|
|
120
|
+
"open",
|
|
121
|
+
"align",
|
|
122
|
+
"menu-label"
|
|
123
|
+
])) : o("", !0);
|
|
108
124
|
}
|
|
109
125
|
});
|
|
110
126
|
//#endregion
|
|
111
|
-
export {
|
|
127
|
+
export { D as default };
|
|
@@ -82,7 +82,9 @@ var w = [
|
|
|
82
82
|
let t = document.body, n = Number(t.dataset.acModals ?? 0) + (e ? 1 : -1);
|
|
83
83
|
if (t.dataset.acModals = String(Math.max(n, 0)), e && n === 1) {
|
|
84
84
|
let e = window.innerWidth - document.documentElement.clientWidth;
|
|
85
|
-
t.style.overflow = "hidden"
|
|
85
|
+
t.style.overflow = "hidden";
|
|
86
|
+
let n = getComputedStyle(document.documentElement).scrollbarGutter.includes("stable");
|
|
87
|
+
e > 0 && !n && (t.style.paddingRight = `${e}px`);
|
|
86
88
|
} else !e && n <= 0 && (t.style.overflow = "", t.style.paddingRight = "");
|
|
87
89
|
}
|
|
88
90
|
return b(V, async (e, t) => {
|
|
@@ -19,6 +19,8 @@ type __VLS_Slots = {
|
|
|
19
19
|
default?: () => unknown;
|
|
20
20
|
/** A search field, placed by `search-position`. Hidden below 640px. */
|
|
21
21
|
search?: () => unknown;
|
|
22
|
+
/** Left-hand content that fills the row up to `actions` and shrinks first when space runs out, e.g. cloud-ui's search field with its phone-only search button. Use it instead of a centred `search`. */
|
|
23
|
+
start?: () => unknown;
|
|
22
24
|
/** Right side: icon actions, notifications, theme and `AcUserMenu` last. */
|
|
23
25
|
actions?: () => unknown;
|
|
24
26
|
};
|