@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.
Files changed (77) hide show
  1. package/dist/lib/compat.css +421 -0
  2. package/dist/lib/components/AcAppSwitcher.vue.d.ts +1 -1
  3. package/dist/lib/components/AcAppSwitcher.vue_vue_type_script_setup_true_lang.js +23 -23
  4. package/dist/lib/components/AcAreaChart.vue.d.ts +1 -1
  5. package/dist/lib/components/AcBarChart.vue.d.ts +1 -1
  6. package/dist/lib/components/AcButton.vue.d.ts +25 -13
  7. package/dist/lib/components/AcButton.vue_vue_type_script_setup_true_lang.js +122 -71
  8. package/dist/lib/components/AcCard.vue.d.ts +11 -5
  9. package/dist/lib/components/AcCard.vue_vue_type_script_setup_true_lang.js +99 -51
  10. package/dist/lib/components/AcCellValue.vue.d.ts +3 -3
  11. package/dist/lib/components/AcCellValue.vue_vue_type_script_setup_true_lang.js +20 -20
  12. package/dist/lib/components/AcCheckBox.vue.d.ts +4 -1
  13. package/dist/lib/components/AcCheckBox.vue_vue_type_script_setup_true_lang.js +50 -50
  14. package/dist/lib/components/AcCircularProgress.vue.d.ts +1 -1
  15. package/dist/lib/components/AcCodeEditor.vue.d.ts +12 -0
  16. package/dist/lib/components/AcCodeEditor.vue_vue_type_script_setup_true_lang.js +240 -207
  17. package/dist/lib/components/AcColorInput.vue.d.ts +4 -4
  18. package/dist/lib/components/AcColorInput.vue_vue_type_script_setup_true_lang.js +72 -66
  19. package/dist/lib/components/AcCostSummary.vue.d.ts +1 -1
  20. package/dist/lib/components/AcDatePicker.vue.d.ts +41 -10
  21. package/dist/lib/components/AcDatePicker.vue_vue_type_script_setup_true_lang.js +554 -446
  22. package/dist/lib/components/AcDeleteModal.vue.d.ts +1 -1
  23. package/dist/lib/components/AcDonutChart.vue.d.ts +2 -2
  24. package/dist/lib/components/AcDropdown.vue.d.ts +1 -1
  25. package/dist/lib/components/AcDropdown.vue_vue_type_script_setup_true_lang.js +8 -8
  26. package/dist/lib/components/AcErrorState.vue.d.ts +1 -1
  27. package/dist/lib/components/AcFormFooter.vue_vue_type_script_setup_true_lang.js +8 -8
  28. package/dist/lib/components/AcGraphChart.vue.d.ts +2 -2
  29. package/dist/lib/components/AcHeader.vue.d.ts +1 -1
  30. package/dist/lib/components/AcInput.vue.d.ts +86 -44
  31. package/dist/lib/components/AcInput.vue_vue_type_script_setup_true_lang.js +319 -86
  32. package/dist/lib/components/AcKeyValueInput.vue.d.ts +34 -54
  33. package/dist/lib/components/AcKeyValueInput.vue_vue_type_script_setup_true_lang.js +134 -106
  34. package/dist/lib/components/AcLineChart.vue.d.ts +1 -1
  35. package/dist/lib/components/AcLocaleSwitcher.vue.d.ts +6 -0
  36. package/dist/lib/components/AcLocaleSwitcher.vue_vue_type_script_setup_true_lang.js +74 -58
  37. package/dist/lib/components/AcMapChart.vue.d.ts +2 -2
  38. package/dist/lib/components/AcModal.vue.d.ts +1 -1
  39. package/dist/lib/components/AcNavbar.vue.d.ts +2 -0
  40. package/dist/lib/components/AcNavbar.vue_vue_type_script_setup_true_lang.js +31 -25
  41. package/dist/lib/components/AcNotificationMenu.vue.d.ts +1 -1
  42. package/dist/lib/components/AcNotificationMenu.vue_vue_type_script_setup_true_lang.js +24 -24
  43. package/dist/lib/components/AcNumberInput.vue.d.ts +55 -45
  44. package/dist/lib/components/AcNumberInput.vue_vue_type_script_setup_true_lang.js +159 -99
  45. package/dist/lib/components/AcRadioCard.js +5 -0
  46. package/dist/lib/components/AcRadioCard.vue.d.ts +55 -0
  47. package/dist/lib/components/AcRadioCard.vue_vue_type_script_setup_true_lang.js +135 -0
  48. package/dist/lib/components/AcSelect.vue.d.ts +46 -6
  49. package/dist/lib/components/AcSelect.vue_vue_type_script_setup_true_lang.js +309 -197
  50. package/dist/lib/components/AcSidePanel.vue.d.ts +1 -1
  51. package/dist/lib/components/AcSidebar.vue.d.ts +9 -0
  52. package/dist/lib/components/AcSidebar.vue_vue_type_script_setup_true_lang.js +113 -94
  53. package/dist/lib/components/AcSidebarSection.vue_vue_type_script_setup_true_lang.js +19 -18
  54. package/dist/lib/components/AcSlider.vue.d.ts +2 -2
  55. package/dist/lib/components/AcSwitch.vue_vue_type_script_setup_true_lang.js +23 -23
  56. package/dist/lib/components/AcTable.vue.d.ts +50 -5
  57. package/dist/lib/components/AcTable.vue_vue_type_script_setup_true_lang.js +257 -129
  58. package/dist/lib/components/AcTagInput.vue.d.ts +23 -4
  59. package/dist/lib/components/AcTagInput.vue_vue_type_script_setup_true_lang.js +126 -114
  60. package/dist/lib/components/AcTaintInput.js +5 -0
  61. package/dist/lib/components/AcTaintInput.vue.d.ts +44 -0
  62. package/dist/lib/components/AcTaintInput.vue_vue_type_script_setup_true_lang.js +208 -0
  63. package/dist/lib/components/AcTextarea.vue.d.ts +64 -4
  64. package/dist/lib/components/AcTextarea.vue_vue_type_script_setup_true_lang.js +159 -68
  65. package/dist/lib/components/AcThemeMode.vue.d.ts +10 -2
  66. package/dist/lib/components/AcThemeMode.vue_vue_type_script_setup_true_lang.js +53 -42
  67. package/dist/lib/components/AcTimePicker.vue.d.ts +36 -11
  68. package/dist/lib/components/AcTimePicker.vue_vue_type_script_setup_true_lang.js +232 -168
  69. package/dist/lib/components/AcTooltip.vue.d.ts +3 -3
  70. package/dist/lib/components/AcUserMenu.vue.d.ts +8 -0
  71. package/dist/lib/components/AcUserMenu.vue_vue_type_script_setup_true_lang.js +126 -109
  72. package/dist/lib/components/index.d.ts +2 -0
  73. package/dist/lib/components/types.d.ts +2 -0
  74. package/dist/lib/composables/useToast.d.ts +2 -2
  75. package/dist/lib/index.d.ts +2 -1
  76. package/dist/lib/index.js +51 -49
  77. package/package.json +1 -1
@@ -1,39 +1,39 @@
1
1
  import e from "./AcButton.js";
2
2
  import t from "./AcInput.js";
3
3
  import n from "./AcSelect.js";
4
- import { Fragment as r, TransitionGroup as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createVNode as u, defineComponent as d, mergeModels as f, nextTick as p, normalizeClass as m, openBlock as h, ref as g, renderList as ee, renderSlot as _, toDisplayString as v, unref as y, useId as b, useModel as te, watch as ne, withCtx as x, withKeys as S } from "vue";
5
- import { Plus as C, Trash as w } from "@lucide/vue";
4
+ import { Fragment as r, TransitionGroup as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createVNode as u, defineComponent as d, mergeModels as f, nextTick as p, normalizeClass as m, openBlock as h, ref as g, renderList as ee, renderSlot as te, toDisplayString as _, unref as v, useId as ne, useModel as re, watch as y, withCtx as b, withKeys as x } from "vue";
5
+ import { Plus as ie, Trash as ae } from "@lucide/vue";
6
6
  //#region src/lib/components/AcKeyValueInput.vue?vue&type=script&setup=true&lang.ts
7
- var T = [
7
+ var oe = [
8
8
  "aria-labelledby",
9
9
  "aria-label",
10
10
  "aria-describedby"
11
- ], re = {
11
+ ], se = {
12
12
  key: 0,
13
13
  class: "font-normal text-muted"
14
- }, ie = {
14
+ }, ce = {
15
15
  key: 1,
16
16
  class: "text-danger",
17
17
  "aria-hidden": "true"
18
- }, ae = {
18
+ }, le = {
19
19
  key: 2,
20
20
  class: "mb-1.5 hidden grid-cols-[minmax(0,1fr)_auto] gap-x-4 sm:grid",
21
21
  "aria-hidden": "true"
22
- }, oe = { key: 0 }, se = [
22
+ }, ue = { key: 0 }, de = [
23
23
  "data-row",
24
24
  "onFocusin",
25
25
  "onFocusout"
26
- ], ce = [
26
+ ], fe = [
27
27
  "aria-label",
28
28
  "title",
29
29
  "onClick"
30
- ], E = {
30
+ ], pe = {
31
31
  key: 4,
32
32
  class: "text-base text-muted"
33
- }, D = {
33
+ }, me = {
34
34
  class: "sr-only",
35
35
  "aria-live": "polite"
36
- }, O = /*@__PURE__*/ d({
36
+ }, S = /*@__PURE__*/ d({
37
37
  __name: "AcKeyValueInput",
38
38
  props: /*@__PURE__*/ f({
39
39
  label: { default: "" },
@@ -77,117 +77,142 @@ var T = [
77
77
  readonly: {
78
78
  type: Boolean,
79
79
  default: !1
80
+ },
81
+ plain: {
82
+ type: Boolean,
83
+ default: !1
80
84
  }
81
85
  }, {
82
86
  modelValue: { default: () => [] },
83
87
  modelModifiers: {}
84
88
  }),
85
89
  emits: /*@__PURE__*/ f(["add", "remove"], ["update:modelValue"]),
86
- setup(d, { expose: f, emit: O }) {
87
- let k = d, A = te(d, "modelValue"), j = O, M = b(), N = `${M}-label`, P = `${M}-hint`, F = `${M}-msg`, I = g(null), L = 0, R = g([]), z = g(null), B = g(""), V = a(() => A.value ?? []), H = a(() => !!k.options?.length), U = a(() => !k.disabled && !k.readonly), W = a(() => k.max !== void 0 && V.value.length >= k.max), le = a(() => k.addLabel || "Add new"), ue = a(() => [k.hint && P, k.errorMsg && F].filter(Boolean).join(" ") || void 0), G = a(() => H.value ? "sm:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_256px]" : "sm:grid-cols-2"), de = a(() => k.size === "small" ? "size-[34px]" : "size-[38px]"), K = a(() => {
90
+ setup(d, { expose: f, emit: S }) {
91
+ let C = d, w = re(d, "modelValue"), T = S, E = ne(), D = `${E}-label`, O = `${E}-hint`, k = `${E}-msg`, A = g(null), j = 0, M = g([]), N = g(null), P = g(""), F = g([]), I = {}, L = a(() => !!w.value && !Array.isArray(w.value)), R = a(() => L.value ? F.value : w.value ?? []), z = a(() => !!C.options?.length), B = a(() => !C.disabled && !C.readonly), V = a(() => C.max !== void 0 && R.value.length >= C.max), he = a(() => C.addLabel || "Add new"), ge = a(() => [C.hint && O, C.errorMsg && k].filter(Boolean).join(" ") || void 0), H = a(() => C.plain ? z.value ? "grid-cols-[minmax(0,1fr)_minmax(0,1fr)_256px]" : "grid-cols-2" : z.value ? "sm:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_256px]" : "sm:grid-cols-2"), U = a(() => C.plain ? "[&>label:first-child]:sr-only" : "sm:[&>label:first-child]:sr-only"), _e = a(() => C.size === "small" ? "size-[34px]" : "size-[38px]"), W = a(() => {
88
92
  let e = /* @__PURE__ */ new Set();
89
- return V.value.map((t, n) => {
93
+ return R.value.map((t, n) => {
90
94
  let r = {}, i = t.key.trim();
91
95
  if (i) {
92
- let a = H.value ? `${i}\u0000${t.option ?? ""}` : i;
93
- !k.allowDuplicateKeys && e.has(a) && (r.key = H.value && t.option ? `“${i}” with ${q(t.option)} is already used.` : `“${i}” is already used. Keys must be unique.`), e.add(a), r.key ||= k.validateKey?.(t.key, n, V.value) || void 0;
94
- } else t.value && z.value !== R.value[n] && (r.key = `Enter a key, or remove this ${k.itemName}.`);
95
- return (i || t.value) && (r.value = k.validateValue?.(t.value, t.key, n, V.value) || void 0), r;
96
+ let a = z.value ? `${i}\u0000${t.option ?? ""}` : i;
97
+ !C.allowDuplicateKeys && e.has(a) && (r.key = z.value && t.option ? `“${i}” with ${G(t.option)} is already used.` : `“${i}” is already used. Keys must be unique.`), e.add(a), r.key ||= C.validateKey?.(t.key, n, R.value) || void 0;
98
+ } else t.value && N.value !== M.value[n] && (r.key = `Enter a key, or remove this ${C.itemName}.`);
99
+ return (i || t.value) && (r.value = C.validateValue?.(t.value, t.key, n, R.value) || void 0), r;
96
100
  });
97
- }), fe = a(() => K.value.some((e) => e.key || e.value));
98
- function q(e) {
99
- return k.options?.find((t) => t.value === e)?.label ?? e;
101
+ }), ve = a(() => W.value.some((e) => e.key || e.value));
102
+ function G(e) {
103
+ return C.options?.find((t) => t.value === e)?.label ?? e;
100
104
  }
101
- function J(e) {
102
- let t = V.value[e]?.key.trim();
103
- return t ? `${k.itemName} ${t}` : `${k.itemName} ${e + 1}`;
105
+ function K(e) {
106
+ let t = R.value[e]?.key.trim();
107
+ return t ? `${C.itemName} ${t}` : `${C.itemName} ${e + 1}`;
104
108
  }
105
- function Y(e) {
109
+ function q(e) {
106
110
  return e.charAt(0).toUpperCase() + e.slice(1);
107
111
  }
108
- function X(e) {
109
- B.value = "", p(() => B.value = e);
112
+ function J(e) {
113
+ P.value = "", p(() => P.value = e);
110
114
  }
111
- function Z(e, t) {
115
+ function Y(e, t) {
112
116
  p(() => {
113
- ([...I.value?.querySelectorAll(`[data-row="${e}"]`) ?? []].at(-1)?.querySelector(t === "remove" ? "[data-action='remove']" : `[data-cell="${t}"]`) ?? I.value?.querySelector("[data-action='add']"))?.focus();
117
+ ([...A.value?.querySelectorAll(`[data-row="${e}"]`) ?? []].at(-1)?.querySelector(t === "remove" ? "[data-action='remove']" : `[data-cell="${t}"]`) ?? A.value?.querySelector("[data-action='add']"))?.focus();
114
118
  });
115
119
  }
120
+ function X(e) {
121
+ let t = {};
122
+ for (let n of e) n.key && (t[n.key] = n.value);
123
+ return t;
124
+ }
125
+ function ye(e, t) {
126
+ let n = Object.keys(e);
127
+ return n.length === Object.keys(t).length && n.every((n) => n in t && e[n] === t[n]);
128
+ }
129
+ function Z(e) {
130
+ if (!L.value) {
131
+ w.value = e;
132
+ return;
133
+ }
134
+ F.value = e, I = X(e), w.value = I;
135
+ }
116
136
  function Q(e, t) {
117
- A.value = V.value.map((n, r) => r === e ? {
137
+ Z(R.value.map((n, r) => r === e ? {
118
138
  ...n,
119
139
  ...t
120
- } : n);
140
+ } : n));
121
141
  }
122
142
  function $() {
123
- if (!U.value || W.value) return;
143
+ if (!B.value || V.value) return;
124
144
  let e = {
125
145
  key: "",
126
146
  value: ""
127
147
  };
128
- H.value && (e.option = k.defaultOption ?? k.options[0].value), R.value = [...R.value, L++], A.value = [...V.value, e];
129
- let t = V.value.length;
130
- j("add", t), X(`${Y(k.itemName)} ${t + 1} added.`), Z(t, "key");
148
+ z.value && (e.option = C.defaultOption ?? C.options[0].value), M.value = [...M.value, j++], Z([...R.value, e]);
149
+ let t = R.value.length;
150
+ T("add", t), J(`${q(C.itemName)} ${t + 1} added.`), Y(t, "key");
131
151
  }
132
- function pe(e) {
133
- if (!U.value) return;
134
- let t = V.value[e];
152
+ function be(e) {
153
+ if (!B.value) return;
154
+ let t = R.value[e];
135
155
  if (!t) return;
136
- let n = J(e);
137
- R.value = R.value.filter((t, n) => n !== e), A.value = V.value.filter((t, n) => n !== e), j("remove", t, e), X(`${Y(n)} removed.`);
138
- let r = V.value.length;
139
- r ? Z(Math.min(e, r - 1), "remove") : p(() => I.value?.querySelector("[data-action='add']")?.focus());
156
+ let n = K(e);
157
+ M.value = M.value.filter((t, n) => n !== e), Z(R.value.filter((t, n) => n !== e)), T("remove", t, e), J(`${q(n)} removed.`);
158
+ let r = R.value.length;
159
+ r ? Y(Math.min(e, r - 1), "remove") : p(() => A.value?.querySelector("[data-action='add']")?.focus());
140
160
  }
141
- function me(e, t) {
142
- e.isComposing || (e.preventDefault(), Z(t, "value"));
161
+ function xe(e, t) {
162
+ e.isComposing || (e.preventDefault(), Y(t, "value"));
143
163
  }
144
- function he(e, t) {
145
- e.isComposing || (e.preventDefault(), t < V.value.length - 1 ? Z(t + 1, "key") : W.value || $());
164
+ function Se(e, t) {
165
+ e.isComposing || (e.preventDefault(), t < R.value.length - 1 ? Y(t + 1, "key") : V.value || $());
146
166
  }
147
- function ge(e, t) {
167
+ function Ce(e, t) {
148
168
  let n = e.currentTarget, r = e.relatedTarget;
149
- r && (n.contains(r) || r instanceof Element && r.closest("[data-testid='ac-select-panel']")) || z.value === t && (z.value = null);
169
+ r && (n.contains(r) || r instanceof Element && r.closest("[data-testid='ac-select-panel']")) || N.value === t && (N.value = null);
150
170
  }
151
- return ne(() => V.value.length, (e) => {
152
- R.value.length !== e && (R.value = Array.from({ length: e }, () => L++));
171
+ return y(w, (e) => {
172
+ !e || Array.isArray(e) || ye(e, I) || (F.value = Object.entries(e).map(([e, t]) => ({
173
+ key: e,
174
+ value: String(t)
175
+ })), I = X(F.value));
176
+ }, { immediate: !0 }), y(() => R.value.length, (e) => {
177
+ M.value.length !== e && (M.value = Array.from({ length: e }, () => j++));
153
178
  }, { immediate: !0 }), f({
154
179
  add: $,
155
- focus: () => Z(0, "key"),
156
- hasErrors: () => fe.value
180
+ focus: () => Y(0, "key"),
181
+ hasErrors: () => ve.value
157
182
  }), (a, f) => (h(), c("div", {
158
183
  ref_key: "root",
159
- ref: I,
184
+ ref: A,
160
185
  role: "group",
161
- "aria-labelledby": d.label ? N : void 0,
162
- "aria-label": d.label ? void 0 : `${Y(d.itemName)}s`,
163
- "aria-describedby": ue.value,
186
+ "aria-labelledby": d.label ? D : void 0,
187
+ "aria-label": d.label ? void 0 : `${q(d.itemName)}s`,
188
+ "aria-describedby": ge.value,
164
189
  class: m(d.disabled && "opacity-50"),
165
190
  "data-ac-ds": "",
166
191
  "data-testid": "ac-key-value-input"
167
192
  }, [
168
193
  d.label ? (h(), c("div", {
169
194
  key: 0,
170
- id: N,
195
+ id: D,
171
196
  class: "mb-2 flex items-center gap-1 text-base font-medium text-heading"
172
197
  }, [
173
- l("span", null, v(d.label), 1),
174
- d.readonly ? (h(), c("span", re, "(read only)")) : s("", !0),
175
- d.required ? (h(), c("span", ie, "*")) : s("", !0)
198
+ l("span", null, _(d.label), 1),
199
+ d.readonly ? (h(), c("span", se, "(read only)")) : s("", !0),
200
+ d.required ? (h(), c("span", ce, "*")) : s("", !0)
176
201
  ])) : s("", !0),
177
202
  d.hint ? (h(), c("p", {
178
203
  key: 1,
179
- id: P,
204
+ id: O,
180
205
  class: "mb-2 text-base text-muted"
181
- }, v(d.hint), 1)) : s("", !0),
182
- V.value.length ? (h(), c("div", ae, [l("div", { class: m(["grid gap-x-4 text-base font-medium text-muted", G.value]) }, [
183
- l("span", null, v(d.keyLabel), 1),
184
- l("span", null, v(d.valueLabel), 1),
185
- H.value ? (h(), c("span", oe, v(d.optionLabel), 1)) : s("", !0)
186
- ], 2), U.value ? (h(), c("span", {
206
+ }, _(d.hint), 1)) : s("", !0),
207
+ R.value.length && !d.plain ? (h(), c("div", le, [l("div", { class: m(["grid gap-x-4 text-base font-medium text-muted", H.value]) }, [
208
+ l("span", null, _(d.keyLabel), 1),
209
+ l("span", null, _(d.valueLabel), 1),
210
+ z.value ? (h(), c("span", ue, _(d.optionLabel), 1)) : s("", !0)
211
+ ], 2), B.value ? (h(), c("span", {
187
212
  key: 0,
188
213
  class: m(d.size === "small" ? "w-[34px]" : "w-[38px]")
189
214
  }, null, 2)) : s("", !0)])) : s("", !0),
190
- V.value.length || U.value ? (h(), o(i, {
215
+ R.value.length || B.value ? (h(), o(i, {
191
216
  key: 3,
192
217
  tag: "div",
193
218
  class: "relative space-y-4",
@@ -197,13 +222,13 @@ var T = [
197
222
  "leave-to-class": "translate-x-5 opacity-0",
198
223
  "move-class": "transition-transform duration-300 ease-out motion-reduce:transition-none"
199
224
  }, {
200
- default: x(() => [(h(!0), c(r, null, ee(V.value, (e, r) => (h(), c("div", {
201
- key: R.value[r] ?? r,
225
+ default: b(() => [(h(!0), c(r, null, ee(R.value, (e, r) => (h(), c("div", {
226
+ key: M.value[r] ?? r,
202
227
  "data-row": r,
203
- class: "grid grid-cols-[minmax(0,1fr)_auto] items-start gap-x-4 max-sm:rounded-10 max-sm:border max-sm:border-border max-sm:bg-surface max-sm:p-3",
204
- onFocusin: (e) => z.value = R.value[r] ?? null,
205
- onFocusout: (e) => ge(e, R.value[r] ?? -1)
206
- }, [l("div", { class: m(["grid items-start gap-x-4 gap-y-3 [&_div:has(>input)]:rounded-8 [&_input]:rounded-8 [&_input]:font-medium", G.value]) }, [
228
+ class: m(["grid grid-cols-[minmax(0,1fr)_auto] items-start gap-x-4", !d.plain && "max-sm:rounded-10 max-sm:border max-sm:border-border max-sm:bg-surface max-sm:p-3"]),
229
+ onFocusin: (e) => N.value = M.value[r] ?? null,
230
+ onFocusout: (e) => Ce(e, M.value[r] ?? -1)
231
+ }, [l("div", { class: m(["grid items-start gap-x-4 gap-y-3 [&_div:has(>input)]:rounded-8 [&_input]:rounded-8 [&_input]:font-medium", [H.value, d.plain && "[&_input]:pr-3 [&_input]:pl-3"]]) }, [
207
232
  u(t, {
208
233
  "data-cell": "key",
209
234
  "model-value": e.key,
@@ -212,12 +237,12 @@ var T = [
212
237
  size: d.size,
213
238
  disabled: d.disabled,
214
239
  readonly: d.readonly,
215
- "error-msg": K.value[r]?.key,
240
+ "error-msg": W.value[r]?.key,
216
241
  autocomplete: "off",
217
242
  spellcheck: "false",
218
- class: m(["sm:[&>label:first-child]:sr-only", d.mono && "[&_input]:font-mono"]),
243
+ class: m([U.value, d.mono && "[&_input]:font-mono"]),
219
244
  "onUpdate:modelValue": (e) => Q(r, { key: String(e) }),
220
- onKeydown: S((e) => me(e, r), ["enter"])
245
+ onKeydown: x((e) => xe(e, r), ["enter"])
221
246
  }, null, 8, [
222
247
  "model-value",
223
248
  "label",
@@ -238,12 +263,12 @@ var T = [
238
263
  size: d.size,
239
264
  disabled: d.disabled,
240
265
  readonly: d.readonly,
241
- "error-msg": K.value[r]?.value,
266
+ "error-msg": W.value[r]?.value,
242
267
  autocomplete: "off",
243
268
  spellcheck: "false",
244
- class: "sm:[&>label:first-child]:sr-only",
269
+ class: m(U.value),
245
270
  "onUpdate:modelValue": (e) => Q(r, { value: String(e) }),
246
- onKeydown: S((e) => he(e, r), ["enter"])
271
+ onKeydown: x((e) => Se(e, r), ["enter"])
247
272
  }, null, 8, [
248
273
  "model-value",
249
274
  "label",
@@ -252,22 +277,24 @@ var T = [
252
277
  "disabled",
253
278
  "readonly",
254
279
  "error-msg",
280
+ "class",
255
281
  "onUpdate:modelValue",
256
282
  "onKeydown"
257
283
  ]),
258
- H.value && d.readonly ? (h(), o(t, {
284
+ z.value && d.readonly ? (h(), o(t, {
259
285
  key: 0,
260
286
  "data-cell": "option",
261
- "model-value": e.option ? q(e.option) : "",
287
+ "model-value": e.option ? G(e.option) : "",
262
288
  label: `${d.optionLabel} ${r + 1}`,
263
289
  size: d.size,
264
290
  readonly: "",
265
- class: "sm:[&>label:first-child]:sr-only"
291
+ class: m(U.value)
266
292
  }, null, 8, [
267
293
  "model-value",
268
294
  "label",
269
- "size"
270
- ])) : H.value ? (h(), o(n, {
295
+ "size",
296
+ "class"
297
+ ])) : z.value ? (h(), o(n, {
271
298
  key: 1,
272
299
  "data-cell": "option",
273
300
  "model-value": e.option ?? null,
@@ -275,7 +302,7 @@ var T = [
275
302
  label: `${d.optionLabel} ${r + 1}`,
276
303
  size: d.size,
277
304
  disabled: d.disabled,
278
- class: "sm:[&>div:first-child]:sr-only",
305
+ class: m(d.plain ? "[&>div:first-child]:sr-only" : "sm:[&>div:first-child]:sr-only"),
279
306
  "onUpdate:modelValue": (e) => Q(r, { option: e ?? void 0 })
280
307
  }, null, 8, [
281
308
  "model-value",
@@ -283,36 +310,37 @@ var T = [
283
310
  "label",
284
311
  "size",
285
312
  "disabled",
313
+ "class",
286
314
  "onUpdate:modelValue"
287
315
  ])) : s("", !0)
288
- ], 2), U.value ? (h(), c("button", {
316
+ ], 2), B.value ? (h(), c("button", {
289
317
  key: 0,
290
318
  type: "button",
291
319
  "data-action": "remove",
292
- class: m(["inline-flex shrink-0 cursor-pointer items-center justify-center rounded-8 bg-danger/5 text-danger/60 transition-all duration-200 hover:bg-danger/10 hover:text-danger focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none max-sm:mt-7", de.value]),
293
- "aria-label": `Remove ${J(r)}`,
320
+ class: m(["inline-flex shrink-0 cursor-pointer items-center justify-center rounded-8 bg-danger/5 text-danger/60 transition-all duration-200 hover:bg-danger/10 hover:text-danger focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none", [_e.value, !d.plain && "max-sm:mt-7"]]),
321
+ "aria-label": `Remove ${K(r)}`,
294
322
  title: `Remove ${d.itemName}`,
295
- onClick: (e) => pe(r)
296
- }, [u(y(w), {
323
+ onClick: (e) => be(r)
324
+ }, [u(v(ae), {
297
325
  class: "size-[18px]",
298
326
  "aria-hidden": "true"
299
- })], 10, ce)) : s("", !0)], 40, se))), 128))]),
327
+ })], 10, fe)) : s("", !0)], 42, de))), 128))]),
300
328
  _: 1
301
- })) : (h(), c("p", E, "No " + v(d.itemName) + "s.", 1)),
302
- _(a.$slots, "footer"),
303
- U.value ? (h(), c("div", {
329
+ })) : (h(), c("p", pe, "No " + _(d.itemName) + "s.", 1)),
330
+ te(a.$slots, "footer"),
331
+ B.value ? (h(), c("div", {
304
332
  key: 5,
305
- class: m(["flex items-center gap-3", V.value.length || a.$slots.footer ? "mt-2" : ""])
333
+ class: m(["flex items-center gap-3", R.value.length || a.$slots.footer ? "mt-2" : ""])
306
334
  }, [u(e, {
307
335
  "data-action": "add",
308
- title: le.value,
336
+ title: he.value,
309
337
  "aria-label": d.addLabel ? void 0 : `Add new ${d.itemName}`,
310
338
  size: "small",
311
339
  variant: "light",
312
- disabled: W.value,
340
+ disabled: V.value,
313
341
  onClick: $
314
342
  }, {
315
- icon: x(() => [u(y(C), { "aria-hidden": "true" })]),
343
+ icon: b(() => [u(v(ie), { "aria-hidden": "true" })]),
316
344
  _: 1
317
345
  }, 8, [
318
346
  "title",
@@ -320,17 +348,17 @@ var T = [
320
348
  "disabled"
321
349
  ]), d.max === void 0 ? s("", !0) : (h(), c("span", {
322
350
  key: 0,
323
- class: m(["text-xs text-muted tabular-nums", W.value && "font-medium text-heading"])
324
- }, v(V.value.length) + " of " + v(d.max), 3))], 2)) : s("", !0),
351
+ class: m(["text-xs text-muted tabular-nums", V.value && "font-medium text-heading"])
352
+ }, _(R.value.length) + " of " + _(d.max), 3))], 2)) : s("", !0),
325
353
  d.errorMsg ? (h(), c("p", {
326
354
  key: 6,
327
- id: F,
355
+ id: k,
328
356
  class: "mt-1 text-base text-danger-strong",
329
357
  role: "alert"
330
- }, v(d.errorMsg), 1)) : s("", !0),
331
- l("p", D, v(B.value), 1)
332
- ], 10, T));
358
+ }, _(d.errorMsg), 1)) : s("", !0),
359
+ l("p", me, _(P.value), 1)
360
+ ], 10, oe));
333
361
  }
334
362
  });
335
363
  //#endregion
336
- export { O as default };
364
+ export { S as default };
@@ -19,9 +19,9 @@ declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, i
19
19
  description: string;
20
20
  height: number;
21
21
  points: boolean | "auto";
22
- loading: boolean;
23
22
  animation: boolean;
24
23
  tooltip: boolean;
24
+ loading: boolean;
25
25
  emptyText: string;
26
26
  lineWidth: number;
27
27
  renderer: "canvas" | "svg";
@@ -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 };