@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.
Files changed (54) hide show
  1. package/dist/lib/charts/ChartFrame.vue_vue_type_script_setup_true_lang.js +89 -88
  2. package/dist/lib/compat.css +210 -0
  3. package/dist/lib/components/AcAppSwitcher.vue_vue_type_script_setup_true_lang.js +74 -73
  4. package/dist/lib/components/AcButton.vue.d.ts +18 -12
  5. package/dist/lib/components/AcButton.vue_vue_type_script_setup_true_lang.js +62 -32
  6. package/dist/lib/components/AcCard.vue.d.ts +11 -5
  7. package/dist/lib/components/AcCard.vue_vue_type_script_setup_true_lang.js +99 -51
  8. package/dist/lib/components/AcClusterSwitcher.vue_vue_type_script_setup_true_lang.js +151 -150
  9. package/dist/lib/components/AcColorInput.vue.d.ts +1 -1
  10. package/dist/lib/components/AcDatePicker.vue.d.ts +27 -3
  11. package/dist/lib/components/AcDatePicker.vue_vue_type_script_setup_true_lang.js +518 -454
  12. package/dist/lib/components/AcDropdown.vue_vue_type_script_setup_true_lang.js +56 -55
  13. package/dist/lib/components/AcErrorState.vue.d.ts +1 -1
  14. package/dist/lib/components/AcFormFooter.vue_vue_type_script_setup_true_lang.js +39 -38
  15. package/dist/lib/components/AcHeader.vue.d.ts +1 -1
  16. package/dist/lib/components/AcInput.vue.d.ts +28 -7
  17. package/dist/lib/components/AcInput.vue_vue_type_script_setup_true_lang.js +149 -80
  18. package/dist/lib/components/AcKeyValueInput.vue.d.ts +1 -1
  19. package/dist/lib/components/AcLocaleSwitcher.vue.d.ts +6 -0
  20. package/dist/lib/components/AcLocaleSwitcher.vue_vue_type_script_setup_true_lang.js +74 -58
  21. package/dist/lib/components/AcModal.vue_vue_type_script_setup_true_lang.js +3 -1
  22. package/dist/lib/components/AcNavbar.vue.d.ts +2 -0
  23. package/dist/lib/components/AcNavbar.vue_vue_type_script_setup_true_lang.js +31 -25
  24. package/dist/lib/components/AcNotificationMenu.vue_vue_type_script_setup_true_lang.js +90 -89
  25. package/dist/lib/components/AcNumberInput.vue.d.ts +1 -1
  26. package/dist/lib/components/AcRadioCard.js +5 -0
  27. package/dist/lib/components/AcRadioCard.vue.d.ts +55 -0
  28. package/dist/lib/components/AcRadioCard.vue_vue_type_script_setup_true_lang.js +135 -0
  29. package/dist/lib/components/AcSelect.vue.d.ts +12 -1
  30. package/dist/lib/components/AcSelect.vue_vue_type_script_setup_true_lang.js +237 -220
  31. package/dist/lib/components/AcSidePanel.vue_vue_type_script_setup_true_lang.js +3 -1
  32. package/dist/lib/components/AcSideTabs.vue.d.ts +1 -1
  33. package/dist/lib/components/AcSidebar.vue.d.ts +9 -0
  34. package/dist/lib/components/AcSidebar.vue_vue_type_script_setup_true_lang.js +113 -94
  35. package/dist/lib/components/AcSidebarSection.vue_vue_type_script_setup_true_lang.js +19 -18
  36. package/dist/lib/components/AcSlider.vue.d.ts +1 -1
  37. package/dist/lib/components/AcTable.vue.d.ts +13 -1
  38. package/dist/lib/components/AcTable.vue_vue_type_script_setup_true_lang.js +106 -86
  39. package/dist/lib/components/AcTagInput.vue.d.ts +1 -1
  40. package/dist/lib/components/AcTextarea.vue.d.ts +30 -4
  41. package/dist/lib/components/AcTextarea.vue_vue_type_script_setup_true_lang.js +92 -61
  42. package/dist/lib/components/AcThemeMode.vue.d.ts +10 -2
  43. package/dist/lib/components/AcThemeMode.vue_vue_type_script_setup_true_lang.js +53 -42
  44. package/dist/lib/components/AcTimePicker.vue.d.ts +21 -3
  45. package/dist/lib/components/AcTimePicker.vue_vue_type_script_setup_true_lang.js +234 -201
  46. package/dist/lib/components/AcTooltip.vue_vue_type_script_setup_true_lang.js +73 -72
  47. package/dist/lib/components/AcUserMenu.vue.d.ts +8 -0
  48. package/dist/lib/components/AcUserMenu.vue_vue_type_script_setup_true_lang.js +125 -107
  49. package/dist/lib/components/fixedFrame.d.ts +11 -0
  50. package/dist/lib/components/fixedFrame.js +24 -0
  51. package/dist/lib/components/index.d.ts +1 -0
  52. package/dist/lib/components/types.d.ts +2 -0
  53. package/dist/lib/index.js +34 -33
  54. package/package.json +1 -1
@@ -1,37 +1,48 @@
1
- import { computed as e, createBlock as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, defineComponent as a, mergeModels as o, mergeProps as s, normalizeClass as c, openBlock as l, ref as u, renderSlot as d, resolveDynamicComponent as f, toDisplayString as p, unref as m, useAttrs as h, useId as g, useModel as _, useSlots as v, vModelDynamic as y, withDirectives as b } from "vue";
2
- import { Eye as x, EyeOff as S } from "@lucide/vue";
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 C = ["for"], w = {
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
- }, E = ["id"], D = { class: "flex" }, O = [
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
- ], k = ["aria-label", "aria-pressed"], A = [
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
- ], j = { key: 1 }, M = ["id"], N = /*@__PURE__*/ a({
31
+ ], M = { key: 1 }, N = ["id"], P = /*@__PURE__*/ o({
25
32
  inheritAttrs: !1,
26
33
  __name: "AcInput",
27
- props: /*@__PURE__*/ o({
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__*/ o(["addon"], ["update:modelValue"]),
57
- setup(a, { expose: o, emit: N }) {
58
- let P = a, F = _(a, "modelValue"), I = N, L = g(), R = h(), z = v(), B = e(() => ({
59
- class: R.class,
60
- style: R.style
61
- })), V = e(() => {
62
- let { class: e, style: t, ...n } = R;
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
- }), H = u(null), U = u(!1), W = e(() => P.type === "password" && U.value ? "text" : P.type), G = e(() => [P.hint && `${L}-hint`, P.errorMsg && `${L}-msg`].filter(Boolean).join(" ") || void 0), K = e(() => !!P.addonLabel || !!P.addonIcon), q = e(() => !!z.suffix || P.type === "password");
65
- function J(e) {
66
- P.disabled || I("addon", e);
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 o({ focus: () => H.value?.focus() }), (e, o) => (l(), r("div", s(B.value, {
69
- class: ["w-full", a.disabled && "opacity-50"],
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
- for: m(L),
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
- i("span", null, p(a.label), 1),
78
- a.readonly ? (l(), r("span", w, "(read only)")) : n("", !0),
79
- a.required ? (l(), r("span", T, "*")) : n("", !0)
80
- ], 8, C),
81
- a.hint ? (l(), r("p", {
82
- key: 0,
83
- id: `${m(L)}-hint`,
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
- }, p(a.hint), 9, E)) : n("", !0),
86
- i("div", D, [i("div", { class: c(["relative flex min-w-0 flex-1 items-center border transition-[border-color,box-shadow,background-color] duration-200", [
87
- a.size === "small" ? "h-9" : "h-10.5",
88
- K.value ? "rounded-l-10" : "rounded-10",
89
- a.readonly ? "bg-surface-muted" : "bg-background",
90
- a.errorMsg ? "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", !a.disabled && "hover:border-accent-active"]
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
- e.$slots.prefix ? (l(), r("span", {
149
+ t.$slots.prefix ? (u(), i("span", {
93
150
  key: 0,
94
- class: c(["flex h-full shrink-0 items-center text-base whitespace-nowrap text-muted select-none [&_svg]:size-4", a.size === "small" ? "pl-3" : "pl-4"])
95
- }, [d(e.$slots, "prefix")], 2)) : n("", !0),
96
- b(i("input", s({
97
- id: m(L),
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: H
100
- }, V.value, {
101
- "onUpdate:modelValue": o[0] ||= (e) => F.value = e,
102
- name: a.name,
103
- type: W.value,
104
- disabled: a.disabled,
105
- readonly: a.readonly,
106
- required: a.required,
107
- "aria-invalid": !!a.errorMsg || void 0,
108
- "aria-describedby": G.value,
109
- 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", [e.$slots.prefix ? "pl-2" : a.size === "small" ? "pl-4" : "pl-5", q.value ? "pr-2" : a.size === "small" ? "pr-4" : "pr-5"]]
110
- }), null, 16, O), [[y, F.value]]),
111
- e.$slots.suffix ? (l(), r("span", {
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: c(["relative flex h-full shrink-0 items-center text-base whitespace-nowrap text-muted select-none [&_svg]:size-4", a.type === "password" ? "pr-2" : a.size === "small" ? "pr-3" : "pr-4"])
114
- }, [d(e.$slots, "suffix")], 2)) : n("", !0),
115
- a.type === "password" ? (l(), r("button", {
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: c(["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", a.size === "small" ? "mr-3" : "mr-4"]),
119
- "aria-label": U.value ? "Hide value" : "Show value",
120
- "aria-pressed": U.value,
121
- onClick: o[1] ||= (e) => U.value = !U.value
122
- }, [(l(), t(f(U.value ? m(S) : m(x)), {
123
- class: c(a.size === "small" ? "size-4" : "size-5"),
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, k)) : n("", !0)
126
- ], 2), K.value ? (l(), r("button", {
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: c(["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", [a.size === "small" ? "h-9" : "h-10.5", a.addonIconOnly ? a.size === "small" ? "w-9" : "w-10.5" : "px-4"]]),
130
- disabled: a.disabled,
131
- "aria-label": a.addonIconOnly ? a.addonLabel : void 0,
132
- title: a.addonIconOnly ? a.addonLabel : void 0,
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: J
136
- }, [a.addonIcon ? (l(), t(f(a.addonIcon), {
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
- })) : n("", !0), a.addonIconOnly ? n("", !0) : (l(), r("span", j, p(a.addonLabel), 1))], 10, A)) : n("", !0)]),
141
- a.errorMsg ? (l(), r("p", {
142
- key: 1,
143
- id: `${m(L)}-msg`,
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
- }, p(a.errorMsg), 9, M)) : n("", !0)
215
+ }, m(o.errorMsg), 9, N)) : r("", !0)
147
216
  ], 16));
148
217
  }
149
218
  });
150
219
  //#endregion
151
- export { N as default };
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 "./AcDropdown.js";
2
- import t from "./AcDropdownItem.js";
3
- import { Fragment as n, computed as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createVNode as c, defineComponent as l, mergeModels as u, normalizeClass as d, openBlock as f, renderList as p, toDisplayString as m, unref as h, useModel as g, withCtx as _ } from "vue";
4
- import { ChevronDown as v, Languages as y } from "@lucide/vue";
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 b = ["aria-label"], x = ["aria-label"], S = { class: "font-mono text-xs tracking-wide uppercase" }, C = {
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
- }, O = /*@__PURE__*/ l({
11
+ }, D = /*@__PURE__*/ u({
19
12
  __name: "AcLocaleSwitcher",
20
- props: /*@__PURE__*/ u({
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__*/ u(["change"], ["update:modelValue"]),
36
- setup(l, { emit: u }) {
37
- let O = l, k = g(l, "modelValue"), A = u, j = r(() => O.locales.find((e) => e.value === k.value)), M = r(() => j.value ? `${O.ariaLabel} (${j.value.label})` : O.ariaLabel);
38
- function N() {
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(O.storageKey);
35
+ return localStorage.getItem(D.storageKey);
41
36
  } catch {
42
37
  return null;
43
38
  }
44
39
  }
45
- function P(e) {
46
- if (e !== k.value && (k.value = e, A("change", e), O.persist)) try {
47
- localStorage.setItem(O.storageKey, e);
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 (O.persist && typeof window < "u") {
51
- let e = N();
52
- e && e !== k.value && O.locales.some((t) => t.value === e) && P(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 (r, u) => l.locales.length > 1 ? (f(), i(e, {
49
+ return (i, d) => u.locales.length > 1 ? (p(), a(t, {
55
50
  key: 0,
56
- align: l.align,
57
- "menu-label": l.ariaLabel,
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: _(({ open: e }) => [l.variant === "icon" ? (f(), o("button", {
57
+ trigger: y(() => [u.variant === "icon" ? (p(), a(e, {
61
58
  key: 0,
62
- type: "button",
63
- "aria-label": M.value,
64
- class: d(["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", e ? "text-heading" : "text-muted"])
65
- }, [c(h(y), {
66
- class: "size-5",
67
- "aria-hidden": "true"
68
- })], 10, b)) : (f(), o("button", {
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": M.value,
72
- class: d(["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", e && "bg-surface-sunken/50"])
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
- c(h(y), {
78
+ l(_(x), {
75
79
  class: "size-4 text-muted",
76
80
  "aria-hidden": "true"
77
81
  }),
78
- s("span", S, m(j.value?.value ?? ""), 1),
79
- c(h(v), {
80
- class: d(["size-4 text-muted transition-transform duration-200 motion-reduce:transition-none", e && "rotate-180"]),
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, x))]),
84
- default: _(() => [l.menuTitle ? (f(), o("p", C, m(l.menuTitle), 1)) : a("", !0), (f(!0), o(n, null, p(l.locales, (e) => (f(), i(t, {
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 === k.value ? "true" : void 0,
88
- class: d(e.value === k.value && "bg-surface-sunken/50"),
89
- onClick: (t) => P(e.value)
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: _(() => [s("span", w, [
92
- e.flag ? (f(), o("span", T, m(e.flag), 1)) : a("", !0),
93
- s("span", {
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
- }, m(e.label), 9, E),
97
- e.value === k.value ? (f(), o("span", D)) : a("", !0)
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, ["align", "menu-label"])) : a("", !0);
119
+ }, 8, [
120
+ "open",
121
+ "align",
122
+ "menu-label"
123
+ ])) : o("", !0);
108
124
  }
109
125
  });
110
126
  //#endregion
111
- export { O as default };
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", e > 0 && (t.style.paddingRight = `${e}px`);
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
  };