@mcistudio/unoui-vue 1.0.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 (187) hide show
  1. package/README.md +95 -0
  2. package/dist/alert/Alert.vue.d.ts +67 -0
  3. package/dist/alert/index.d.ts +40 -0
  4. package/dist/alert/index.js +2 -0
  5. package/dist/attrs.d.ts +11 -0
  6. package/dist/attrs.js +16 -0
  7. package/dist/attrs.js.map +1 -0
  8. package/dist/badge/Badge.vue.d.ts +57 -0
  9. package/dist/badge/BadgeRibbon.vue.d.ts +34 -0
  10. package/dist/badge/index.d.ts +42 -0
  11. package/dist/badge/index.js +2 -0
  12. package/dist/build.d.ts +2 -0
  13. package/dist/button/Button.vue.d.ts +46 -0
  14. package/dist/button/ButtonGroup.vue.d.ts +13 -0
  15. package/dist/button/index.d.ts +13 -0
  16. package/dist/button/index.js +2 -0
  17. package/dist/checkbox/Checkbox.vue.d.ts +47 -0
  18. package/dist/checkbox/CheckboxGroup.vue.d.ts +38 -0
  19. package/dist/checkbox/index.d.ts +30 -0
  20. package/dist/checkbox/index.js +2 -0
  21. package/dist/chunks/Progress-BL4KZ3HE.js +271 -0
  22. package/dist/chunks/Progress-BL4KZ3HE.js.map +1 -0
  23. package/dist/chunks/Skeleton-ohStUD4M.js +153 -0
  24. package/dist/chunks/Skeleton-ohStUD4M.js.map +1 -0
  25. package/dist/chunks/Table-DhXmuKQd.js +330 -0
  26. package/dist/chunks/Table-DhXmuKQd.js.map +1 -0
  27. package/dist/chunks/_plugin-vue_export-helper-B3ysoDQm.js +8 -0
  28. package/dist/chunks/alert-CczW_DKs.js +190 -0
  29. package/dist/chunks/alert-CczW_DKs.js.map +1 -0
  30. package/dist/chunks/badge-BHOZeImh.js +287 -0
  31. package/dist/chunks/badge-BHOZeImh.js.map +1 -0
  32. package/dist/chunks/button-pDObrN_X.js +168 -0
  33. package/dist/chunks/button-pDObrN_X.js.map +1 -0
  34. package/dist/chunks/checkbox-9_0oR4kg.js +260 -0
  35. package/dist/chunks/checkbox-9_0oR4kg.js.map +1 -0
  36. package/dist/chunks/colorpicker-CcizUCQv.js +594 -0
  37. package/dist/chunks/colorpicker-CcizUCQv.js.map +1 -0
  38. package/dist/chunks/datepicker-Cy808x7X.js +1414 -0
  39. package/dist/chunks/datepicker-Cy808x7X.js.map +1 -0
  40. package/dist/chunks/drawer-C3JZ28Xo.js +193 -0
  41. package/dist/chunks/drawer-C3JZ28Xo.js.map +1 -0
  42. package/dist/chunks/dropdown-0l967g7D.js +329 -0
  43. package/dist/chunks/dropdown-0l967g7D.js.map +1 -0
  44. package/dist/chunks/form-Qeqkd-HH.js +642 -0
  45. package/dist/chunks/form-Qeqkd-HH.js.map +1 -0
  46. package/dist/chunks/input-BDOXVCrK.js +1281 -0
  47. package/dist/chunks/input-BDOXVCrK.js.map +1 -0
  48. package/dist/chunks/inputOtp-Dyxj9lNj.js +261 -0
  49. package/dist/chunks/inputOtp-Dyxj9lNj.js.map +1 -0
  50. package/dist/chunks/message-xPfuG0EX.js +107 -0
  51. package/dist/chunks/message-xPfuG0EX.js.map +1 -0
  52. package/dist/chunks/millercolumns-Dp3fBrq6.js +426 -0
  53. package/dist/chunks/millercolumns-Dp3fBrq6.js.map +1 -0
  54. package/dist/chunks/modal-D6l1iIvE.js +81 -0
  55. package/dist/chunks/modal-D6l1iIvE.js.map +1 -0
  56. package/dist/chunks/pagination-Bc583AQX.js +265 -0
  57. package/dist/chunks/pagination-Bc583AQX.js.map +1 -0
  58. package/dist/chunks/popconfirm-D6lUfSxG.js +343 -0
  59. package/dist/chunks/popconfirm-D6lUfSxG.js.map +1 -0
  60. package/dist/chunks/qrcode-B0t_pZna.js +1099 -0
  61. package/dist/chunks/qrcode-B0t_pZna.js.map +1 -0
  62. package/dist/chunks/radio-DnYm59xH.js +477 -0
  63. package/dist/chunks/radio-DnYm59xH.js.map +1 -0
  64. package/dist/chunks/rate-0sme__Kb.js +309 -0
  65. package/dist/chunks/rate-0sme__Kb.js.map +1 -0
  66. package/dist/chunks/select-ChTfQM5u.js +417 -0
  67. package/dist/chunks/select-ChTfQM5u.js.map +1 -0
  68. package/dist/chunks/slider-C-W5GzTP.js +724 -0
  69. package/dist/chunks/slider-C-W5GzTP.js.map +1 -0
  70. package/dist/chunks/splitter-CgfiXY65.js +524 -0
  71. package/dist/chunks/splitter-CgfiXY65.js.map +1 -0
  72. package/dist/chunks/switch-BULGbODP.js +327 -0
  73. package/dist/chunks/switch-BULGbODP.js.map +1 -0
  74. package/dist/chunks/tab-Dxfg1_To.js +663 -0
  75. package/dist/chunks/tab-Dxfg1_To.js.map +1 -0
  76. package/dist/chunks/tag-BYmNsrZC.js +167 -0
  77. package/dist/chunks/tag-BYmNsrZC.js.map +1 -0
  78. package/dist/chunks/timepicker-DsGIdcf8.js +1059 -0
  79. package/dist/chunks/timepicker-DsGIdcf8.js.map +1 -0
  80. package/dist/chunks/tooltip-DMhiAqto.js +242 -0
  81. package/dist/chunks/tooltip-DMhiAqto.js.map +1 -0
  82. package/dist/colorpicker/ColorPicker.vue.d.ts +30 -0
  83. package/dist/colorpicker/color.d.ts +56 -0
  84. package/dist/colorpicker/color.js +99 -0
  85. package/dist/colorpicker/color.js.map +1 -0
  86. package/dist/colorpicker/index.d.ts +12 -0
  87. package/dist/colorpicker/index.js +2 -0
  88. package/dist/config.d.ts +55 -0
  89. package/dist/config.js +260 -0
  90. package/dist/config.js.map +1 -0
  91. package/dist/datepicker/DatePicker.vue.d.ts +82 -0
  92. package/dist/datepicker/RangePicker.vue.d.ts +87 -0
  93. package/dist/datepicker/index.d.ts +59 -0
  94. package/dist/datepicker/index.js +2 -0
  95. package/dist/drawer/Drawer.vue.d.ts +86 -0
  96. package/dist/drawer/index.d.ts +23 -0
  97. package/dist/drawer/index.js +2 -0
  98. package/dist/dropdown/Dropdown.vue.d.ts +118 -0
  99. package/dist/dropdown/index.d.ts +2 -0
  100. package/dist/dropdown/index.js +2 -0
  101. package/dist/form/Form.vue.d.ts +170 -0
  102. package/dist/form/FormItem.vue.d.ts +83 -0
  103. package/dist/form/index.d.ts +176 -0
  104. package/dist/form/index.js +2 -0
  105. package/dist/index.d.ts +31 -0
  106. package/dist/index.js +32 -0
  107. package/dist/input/Autocomplete.vue.d.ts +121 -0
  108. package/dist/input/Input.vue.d.ts +142 -0
  109. package/dist/input/InputI18n.vue.d.ts +80 -0
  110. package/dist/input/InputTag.vue.d.ts +114 -0
  111. package/dist/input/index.d.ts +41 -0
  112. package/dist/input/index.js +2 -0
  113. package/dist/inputOtp/InputOtp.vue.d.ts +60 -0
  114. package/dist/inputOtp/index.d.ts +21 -0
  115. package/dist/inputOtp/index.js +2 -0
  116. package/dist/message/MessageContainer.vue.d.ts +11 -0
  117. package/dist/message/index.d.ts +20 -0
  118. package/dist/message/index.js +2 -0
  119. package/dist/message/types.d.ts +25 -0
  120. package/dist/millercolumns/MillerColumns.vue.d.ts +88 -0
  121. package/dist/millercolumns/index.d.ts +39 -0
  122. package/dist/millercolumns/index.js +2 -0
  123. package/dist/modal/Modal.vue.d.ts +54 -0
  124. package/dist/modal/index.d.ts +2 -0
  125. package/dist/modal/index.js +2 -0
  126. package/dist/pagination/Pagination.vue.d.ts +70 -0
  127. package/dist/pagination/index.d.ts +12 -0
  128. package/dist/pagination/index.js +2 -0
  129. package/dist/popconfirm/Popconfirm.vue.d.ts +104 -0
  130. package/dist/popconfirm/index.d.ts +36 -0
  131. package/dist/popconfirm/index.js +2 -0
  132. package/dist/progress/Progress.vue.d.ts +64 -0
  133. package/dist/progress/index.d.ts +26 -0
  134. package/dist/progress/index.js +2 -0
  135. package/dist/qrcode/QRCode.vue.d.ts +87 -0
  136. package/dist/qrcode/index.d.ts +43 -0
  137. package/dist/qrcode/index.js +2 -0
  138. package/dist/qrcode/qr.d.ts +51 -0
  139. package/dist/qrcode/qrcodegen.d.ts +94 -0
  140. package/dist/radio/Radio.vue.d.ts +52 -0
  141. package/dist/radio/RadioGroup.vue.d.ts +44 -0
  142. package/dist/radio/index.d.ts +55 -0
  143. package/dist/radio/index.js +2 -0
  144. package/dist/rate/Rate.vue.d.ts +100 -0
  145. package/dist/rate/index.d.ts +38 -0
  146. package/dist/rate/index.js +2 -0
  147. package/dist/select/Select.vue.d.ts +129 -0
  148. package/dist/select/index.d.ts +33 -0
  149. package/dist/select/index.js +2 -0
  150. package/dist/skeleton/Skeleton.vue.d.ts +31 -0
  151. package/dist/skeleton/index.d.ts +2 -0
  152. package/dist/skeleton/index.js +2 -0
  153. package/dist/slider/Slider.vue.d.ts +81 -0
  154. package/dist/slider/index.d.ts +61 -0
  155. package/dist/slider/index.js +2 -0
  156. package/dist/splitter/Splitter.vue.d.ts +63 -0
  157. package/dist/splitter/SplitterPanel.vue.d.ts +53 -0
  158. package/dist/splitter/index.d.ts +39 -0
  159. package/dist/splitter/index.js +2 -0
  160. package/dist/style.css +2 -0
  161. package/dist/switch/Switch.vue.d.ts +97 -0
  162. package/dist/switch/index.d.ts +31 -0
  163. package/dist/switch/index.js +2 -0
  164. package/dist/tab/TabPane.vue.d.ts +32 -0
  165. package/dist/tab/Tabs.vue.d.ts +87 -0
  166. package/dist/tab/index.d.ts +78 -0
  167. package/dist/tab/index.js +2 -0
  168. package/dist/table/Table.vue.d.ts +96 -0
  169. package/dist/table/index.d.ts +3 -0
  170. package/dist/table/index.js +2 -0
  171. package/dist/table/types.d.ts +35 -0
  172. package/dist/table/types.js +0 -0
  173. package/dist/tag/Tag.vue.d.ts +46 -0
  174. package/dist/tag/index.d.ts +11 -0
  175. package/dist/tag/index.js +2 -0
  176. package/dist/timepicker/TimePicker.vue.d.ts +92 -0
  177. package/dist/timepicker/TimeRangePicker.vue.d.ts +90 -0
  178. package/dist/timepicker/index.d.ts +39 -0
  179. package/dist/timepicker/index.js +2 -0
  180. package/dist/tooltip/Tooltip.vue.d.ts +79 -0
  181. package/dist/tooltip/index.d.ts +14 -0
  182. package/dist/tooltip/index.js +2 -0
  183. package/dist/uno.d.ts +32 -0
  184. package/dist/uno.js +83 -0
  185. package/dist/uno.js.map +1 -0
  186. package/dist/utils/DnD.d.ts +38 -0
  187. package/package.json +115 -0
@@ -0,0 +1,1281 @@
1
+ import { r as e } from "./button-pDObrN_X.js";
2
+ import { t } from "./_plugin-vue_export-helper-B3ysoDQm.js";
3
+ import { getUiAttrStyle as n } from "../attrs.js";
4
+ import { getUnoUILanguageOption as r, normalizeUnoUILanguages as i, useUnoUIConfig as a } from "../config.js";
5
+ import { t as o } from "./dropdown-0l967g7D.js";
6
+ import { t as s } from "./modal-D6l1iIvE.js";
7
+ import { n as c } from "./tag-BYmNsrZC.js";
8
+ import { cva as l } from "class-variance-authority";
9
+ import { Fragment as u, computed as d, createBlock as f, createCommentVNode as p, createElementBlock as m, createElementVNode as h, createSlots as g, createTextVNode as _, createVNode as v, defineComponent as y, mergeProps as ee, nextTick as b, normalizeClass as x, normalizeStyle as S, onUnmounted as C, openBlock as w, ref as T, renderList as E, renderSlot as D, toDisplayString as O, unref as k, useAttrs as te, useSlots as A, useTemplateRef as j, watch as ne, withCtx as M, withModifiers as N } from "vue";
10
+ import { clsx as P } from "clsx";
11
+ import { useI18n as re } from "vue-i18n";
12
+ //#region src/input/Input.vue?vue&type=script&setup=true&lang.ts
13
+ var F = {
14
+ key: 2,
15
+ class: "text-xs"
16
+ }, I = [
17
+ "name",
18
+ "value",
19
+ "rows",
20
+ "maxlength",
21
+ "placeholder",
22
+ "disabled",
23
+ "readonly",
24
+ "autocomplete"
25
+ ], L = [
26
+ "name",
27
+ "type",
28
+ "value",
29
+ "step",
30
+ "min",
31
+ "max",
32
+ "maxlength",
33
+ "placeholder",
34
+ "disabled",
35
+ "readonly",
36
+ "autocomplete"
37
+ ], ie = {
38
+ key: 3,
39
+ class: "flex shrink-0 items-center gap-1 pr-2 text-tertiary"
40
+ }, R = {
41
+ key: 1,
42
+ class: "text-xs"
43
+ }, z = {
44
+ key: 2,
45
+ class: "whitespace-nowrap text-[10px] text-tertiary/70"
46
+ }, B = ["aria-label", "disabled"], V = {
47
+ key: 0,
48
+ class: "mt-1 text-right text-[10px] text-tertiary/70"
49
+ }, H = /*#__PURE__*/ t(/* @__PURE__ */ y({
50
+ inheritAttrs: !1,
51
+ __name: "Input",
52
+ props: {
53
+ modelValue: { default: "" },
54
+ type: { default: "text" },
55
+ size: { default: "md" },
56
+ disabled: {
57
+ type: Boolean,
58
+ default: !1
59
+ },
60
+ placeholder: { default: "" },
61
+ prefixIcon: { default: "" },
62
+ suffixIcon: { default: "" },
63
+ prefix: { default: "" },
64
+ suffix: { default: "" },
65
+ password: {
66
+ type: Boolean,
67
+ default: !1
68
+ },
69
+ showPassword: {
70
+ type: Boolean,
71
+ default: !1
72
+ },
73
+ clearable: {
74
+ type: Boolean,
75
+ default: !1
76
+ },
77
+ clearIcon: { default: "i-lucide:x" },
78
+ rows: { default: void 0 },
79
+ multiline: {
80
+ type: Boolean,
81
+ default: !1
82
+ },
83
+ maxlength: { default: void 0 },
84
+ showWordLimit: {
85
+ type: Boolean,
86
+ default: !1
87
+ },
88
+ formatter: {
89
+ type: Function,
90
+ default: void 0
91
+ },
92
+ parser: {
93
+ type: Function,
94
+ default: void 0
95
+ },
96
+ precision: { default: void 0 },
97
+ step: { default: 1 },
98
+ min: { default: void 0 },
99
+ max: { default: void 0 },
100
+ draggable: {
101
+ type: Boolean,
102
+ default: !1
103
+ },
104
+ dragIcon: { default: "i-lucide:grip-horizontal" },
105
+ dragStep: { default: void 0 },
106
+ name: { default: void 0 },
107
+ autocomplete: { default: void 0 },
108
+ readonly: {
109
+ type: Boolean,
110
+ default: !1
111
+ },
112
+ modelModifiers: {}
113
+ },
114
+ emits: [
115
+ "update:modelValue",
116
+ "input",
117
+ "change",
118
+ "clear",
119
+ "focus",
120
+ "blur",
121
+ "keydown",
122
+ "drag-start",
123
+ "drag-end"
124
+ ],
125
+ setup(e, { expose: t, emit: n }) {
126
+ let r = e, i = n, a = te(), o = A(), s = j("controlRef"), c = T(!1), l = T(!1), f = T(!1), g = T(null), _ = !!o.prepend, v = !!o.append, y = () => r.multiline || r.rows !== void 0, E = () => !y() && r.type === "number", M = () => r.password || r.showPassword || r.type === "password", re = () => r.showWordLimit && r.maxlength !== void 0, H = () => re() && !y(), ae = () => r.clearable && !r.disabled && !r.readonly && W.value.length > 0, oe = () => !!o.prefix || !!r.prefix || !!r.prefixIcon || E() && r.draggable, U = () => !!o.suffix || !!r.suffix || !!r.suffixIcon || M() || ae() || H(), W = d(() => r.modelValue === void 0 || r.modelValue === null ? "" : String(r.modelValue)), G = d(() => r.formatter ? r.formatter(W.value) : W.value), se = d(() => E() && g.value !== null ? g.value : G.value), ce = d(() => W.value.length), K = d(() => {
127
+ if (!y()) return M() ? l.value ? "text" : "password" : r.type;
128
+ }), le = () => P(a.class), ue = () => a.style, q = () => {
129
+ let { class: e, style: t, ...n } = a;
130
+ return n;
131
+ }, de = d(() => P(le(), ge({
132
+ size: r.size,
133
+ focused: c.value,
134
+ disabled: r.disabled,
135
+ multiline: y()
136
+ }), _ && "-ml-px rounded-l-none", v && "-mr-px rounded-r-none")), fe = () => _e({
137
+ size: r.size,
138
+ multiline: y(),
139
+ number: E()
140
+ }), J = (e) => {
141
+ if (e === void 0 || e === "") return;
142
+ let t = Number(e);
143
+ return Number.isFinite(t) ? t : void 0;
144
+ }, pe = () => J(r.min), me = () => J(r.max), he = () => J(r.step) ?? 1, Y = () => r.dragStep ?? he(), X = (e) => {
145
+ let t = String(e), n = t.match(/e-(\d+)$/i);
146
+ return n ? Number(n[1]) : t.includes(".") && t.split(".")[1]?.length || 0;
147
+ }, ye = (e) => {
148
+ let t = e, n = pe(), r = me();
149
+ return n !== void 0 && (t = Math.max(n, t)), r !== void 0 && (t = Math.min(r, t)), t;
150
+ }, be = (e) => {
151
+ let t = r.precision ?? X(he());
152
+ return Number(ye(e).toFixed(t));
153
+ }, xe = () => E() && (r.modelModifiers?.number || typeof r.modelValue == "number"), Se = (e) => {
154
+ let t = be(e);
155
+ return xe() ? t : r.precision === void 0 ? String(t) : t.toFixed(r.precision);
156
+ }, Q = (e) => {
157
+ let t = r.modelModifiers?.trim ? e.trim() : e, n = r.parser ? r.parser(t) : t;
158
+ if (!E()) return n;
159
+ if (n === "") return "";
160
+ let i = Number(n);
161
+ return Number.isFinite(i) ? Se(i) : n;
162
+ }, Ce = async () => {
163
+ await b();
164
+ let e = s.value;
165
+ e && e.value !== G.value && (e.value = G.value);
166
+ };
167
+ ne(G, () => {
168
+ c.value && g.value !== null || f.value || Ce();
169
+ });
170
+ let we = (e, t) => {
171
+ i("update:modelValue", e), i("input", e, t);
172
+ }, Te = (e) => {
173
+ !E() || r.disabled || r.readonly || !e.data?.includes("。") || (e.preventDefault(), document.execCommand("insertText", !1, e.data.replaceAll("。", ".")));
174
+ }, Ee = (e) => {
175
+ if (r.disabled) return;
176
+ let t = e.target;
177
+ if (E() && t.tagName === "INPUT" && (g.value = t.value), f.value) {
178
+ i("input", Q(t.value), e);
179
+ return;
180
+ }
181
+ we(Q(t.value), e);
182
+ }, De = (e) => {
183
+ r.disabled || i("change", Q(e.target.value), e);
184
+ }, Oe = (e) => {
185
+ c.value = !0, i("focus", e);
186
+ }, ke = (e) => {
187
+ c.value = !1, g.value = null, i("blur", e), Ce();
188
+ }, Ae = () => {
189
+ f.value = !0;
190
+ }, je = (e) => {
191
+ f.value = !1;
192
+ let t = e.target;
193
+ E() && t.tagName === "INPUT" && (g.value = t.value), we(Q(t.value), e);
194
+ }, Me = () => {
195
+ r.disabled || r.readonly || (g.value = null, i("update:modelValue", ""), i("input", "", new Event("input")), i("clear"), Ce(), s.value?.focus());
196
+ }, Ne = () => s.value?.focus(), Pe = () => s.value?.blur(), Fe = () => s.value?.select(), $ = null, Ie = () => {
197
+ window.removeEventListener("pointermove", ze), window.removeEventListener("pointerup", Be), window.removeEventListener("pointercancel", Be);
198
+ }, Le = () => {
199
+ let e = J(r.modelValue);
200
+ return e === void 0 ? J(Q(s.value?.value || "")) ?? 0 : e;
201
+ }, Re = (e, t) => {
202
+ let n = be(e), r = Se(n);
203
+ g.value = null, $ && ($.lastValue = n), i("update:modelValue", r), i("input", r, t);
204
+ };
205
+ function ze(e) {
206
+ let t = $;
207
+ if (!t || e.pointerId !== t.pointerId) return;
208
+ e.preventDefault();
209
+ let n = e.clientX - t.startX;
210
+ Re(t.startValue + n * Y(), e);
211
+ }
212
+ function Be(e) {
213
+ let t = $;
214
+ if (!t || e.pointerId !== t.pointerId) return;
215
+ e.preventDefault(), Ie(), $ = null;
216
+ let n = t.lastValue;
217
+ i("change", Se(n), e), i("drag-end", n, e);
218
+ }
219
+ let Ve = (e) => {
220
+ if (!E() || !r.draggable || r.disabled || r.readonly || e.button !== 0) return;
221
+ e.preventDefault(), Ie();
222
+ let t = Le();
223
+ $ = {
224
+ pointerId: e.pointerId,
225
+ startX: e.clientX,
226
+ startValue: t,
227
+ lastValue: t
228
+ }, e.currentTarget?.setPointerCapture?.(e.pointerId), i("drag-start", t, e), window.addEventListener("pointermove", ze), window.addEventListener("pointerup", Be), window.addEventListener("pointercancel", Be);
229
+ };
230
+ return C(() => {
231
+ Ie();
232
+ }), t({
233
+ blur: Pe,
234
+ clear: Me,
235
+ focus: Ne,
236
+ select: Fe
237
+ }), (t, n) => (w(), m(u, null, [h("div", { class: x(k(Z)({
238
+ size: e.size,
239
+ multiline: y()
240
+ })) }, [
241
+ _ ? (w(), m("div", {
242
+ key: 0,
243
+ class: x(k(ve)({
244
+ position: "prepend",
245
+ size: e.size,
246
+ disabled: e.disabled
247
+ }))
248
+ }, [D(t.$slots, "prepend", {}, void 0, !0)], 2)) : p("", !0),
249
+ h("div", {
250
+ class: x(de.value),
251
+ style: S(ue()),
252
+ "data-ui-input": "true"
253
+ }, [
254
+ oe() ? (w(), m("span", {
255
+ key: 0,
256
+ class: x(["flex shrink-0 items-center gap-1 pl-2 text-tertiary", { "cursor-ew-resize select-none": E() && e.draggable && !e.disabled && !e.readonly }]),
257
+ onPointerdown: Ve
258
+ }, [
259
+ E() && e.draggable ? (w(), m("span", {
260
+ key: 0,
261
+ class: x([e.dragIcon, "size-4"])
262
+ }, null, 2)) : p("", !0),
263
+ e.prefixIcon ? (w(), m("span", {
264
+ key: 1,
265
+ class: x([e.prefixIcon, "size-4"])
266
+ }, null, 2)) : p("", !0),
267
+ e.prefix ? (w(), m("span", F, O(e.prefix), 1)) : p("", !0),
268
+ D(t.$slots, "prefix", {}, void 0, !0)
269
+ ], 34)) : p("", !0),
270
+ y() ? (w(), m("textarea", ee({
271
+ key: 1,
272
+ ref_key: "controlRef",
273
+ ref: s
274
+ }, q(), {
275
+ "data-ui-input-control": "true",
276
+ name: e.name,
277
+ value: G.value,
278
+ rows: e.rows,
279
+ maxlength: e.maxlength,
280
+ placeholder: e.placeholder,
281
+ disabled: e.disabled,
282
+ readonly: e.readonly,
283
+ autocomplete: e.autocomplete,
284
+ class: fe(),
285
+ onInput: Ee,
286
+ onChange: De,
287
+ onFocus: Oe,
288
+ onBlur: ke,
289
+ onKeydown: n[0] ||= (e) => i("keydown", e),
290
+ onCompositionstart: Ae,
291
+ onCompositionend: je
292
+ }), null, 16, I)) : (w(), m("input", ee({
293
+ key: 2,
294
+ ref_key: "controlRef",
295
+ ref: s
296
+ }, q(), {
297
+ "data-ui-input-control": "true",
298
+ name: e.name,
299
+ type: K.value,
300
+ value: se.value,
301
+ step: E() ? e.step : void 0,
302
+ min: E() ? e.min : void 0,
303
+ max: E() ? e.max : void 0,
304
+ maxlength: e.maxlength,
305
+ placeholder: e.placeholder,
306
+ disabled: e.disabled,
307
+ readonly: e.readonly,
308
+ autocomplete: e.autocomplete,
309
+ class: fe(),
310
+ onBeforeinput: Te,
311
+ onInput: Ee,
312
+ onChange: De,
313
+ onFocus: Oe,
314
+ onBlur: ke,
315
+ onKeydown: n[1] ||= (e) => i("keydown", e),
316
+ onCompositionstart: Ae,
317
+ onCompositionend: je
318
+ }), null, 16, L)),
319
+ U() ? (w(), m("span", ie, [
320
+ D(t.$slots, "suffix", {}, void 0, !0),
321
+ e.suffixIcon ? (w(), m("span", {
322
+ key: 0,
323
+ class: x([e.suffixIcon, "size-4"])
324
+ }, null, 2)) : p("", !0),
325
+ e.suffix ? (w(), m("span", R, O(e.suffix), 1)) : p("", !0),
326
+ H() ? (w(), m("span", z, O(ce.value) + " / " + O(e.maxlength), 1)) : p("", !0),
327
+ ae() ? (w(), m("button", {
328
+ key: 3,
329
+ type: "button",
330
+ "aria-label": "清空",
331
+ class: "flex size-4 items-center justify-center rounded-full bg-tertiary/90 text-tertiary/60 opacity-0 transition-all duration-150 hover:bg-tertiary hover:text-tertiary group-hover/ui-input:opacity-100 group-focus-within/ui-input:opacity-100",
332
+ onClick: N(Me, ["stop"])
333
+ }, [h("span", { class: x([e.clearIcon, "size-3"]) }, null, 2)])) : p("", !0),
334
+ M() ? (w(), m("button", {
335
+ key: 4,
336
+ type: "button",
337
+ "aria-label": l.value ? "隐藏密码" : "显示密码",
338
+ class: "flex size-5 items-center justify-center rounded text-tertiary transition-colors hover:bg-secondary/30 hover:text-primary disabled:cursor-not-allowed disabled:opacity-50",
339
+ disabled: e.disabled,
340
+ onClick: n[2] ||= N((e) => l.value = !l.value, ["stop"])
341
+ }, [h("span", { class: x([l.value ? "i-lucide:eye-off" : "i-lucide:eye", "size-3.5"]) }, null, 2)], 8, B)) : p("", !0)
342
+ ])) : p("", !0)
343
+ ], 6),
344
+ v ? (w(), m("div", {
345
+ key: 1,
346
+ class: x(k(ve)({
347
+ position: "append",
348
+ size: e.size,
349
+ disabled: e.disabled
350
+ }))
351
+ }, [D(t.$slots, "append", {}, void 0, !0)], 2)) : p("", !0)
352
+ ], 2), re() && y() ? (w(), m("div", V, O(ce.value) + " / " + O(e.maxlength), 1)) : p("", !0)], 64));
353
+ }
354
+ }), [["__scopeId", "data-v-465b18d7"]]), ae = { class: "min-w-0 flex-1 truncate" }, oe = {
355
+ key: 0,
356
+ class: "border-t border-medium px-3 py-3 text-center text-sm text-tertiary"
357
+ }, U = /* @__PURE__ */ y({
358
+ inheritAttrs: !1,
359
+ __name: "Autocomplete",
360
+ props: {
361
+ modelValue: { default: "" },
362
+ dataSource: {},
363
+ valueKey: { default: "value" },
364
+ triggerOnFocus: {
365
+ type: Boolean,
366
+ default: !0
367
+ },
368
+ debounce: { default: 300 },
369
+ size: { default: "md" },
370
+ disabled: {
371
+ type: Boolean,
372
+ default: !1
373
+ },
374
+ readonly: {
375
+ type: Boolean,
376
+ default: !1
377
+ },
378
+ placeholder: { default: "" },
379
+ prefixIcon: { default: "" },
380
+ suffixIcon: { default: "" },
381
+ prefix: { default: "" },
382
+ suffix: { default: "" },
383
+ clearable: {
384
+ type: Boolean,
385
+ default: !1
386
+ },
387
+ clearIcon: { default: "i-lucide:x" },
388
+ name: { default: void 0 },
389
+ autocomplete: { default: void 0 },
390
+ teleportedWidth: { default: void 0 },
391
+ maxHeight: { default: "280px" },
392
+ hideLoading: {
393
+ type: Boolean,
394
+ default: !1
395
+ },
396
+ selectWhenUnmatched: {
397
+ type: Boolean,
398
+ default: !1
399
+ },
400
+ noDataText: { default: "暂无数据" },
401
+ loadingText: { default: "加载中" }
402
+ },
403
+ emits: [
404
+ "update:modelValue",
405
+ "input",
406
+ "change",
407
+ "clear",
408
+ "select",
409
+ "focus",
410
+ "blur",
411
+ "keydown"
412
+ ],
413
+ setup(e, { expose: t, emit: n }) {
414
+ let r = e, i = n, a = te(), s = T(!1), c = T(!1), l = T(r.modelValue), u = T([]), _ = T(null), y = T(null), S = T(null), E = T("0px"), A = 0, j = 0, P = !1, re = 0, F = d(() => r.modelValue === void 0 || r.modelValue === null ? "" : String(r.modelValue)), I = d(() => r.teleportedWidth || E.value || "180px"), L = d(() => c.value && !r.hideLoading ? r.loadingText : r.noDataText);
415
+ ne(() => r.modelValue, (e) => {
416
+ l.value = e ?? "";
417
+ });
418
+ let ie = async () => {
419
+ await b();
420
+ let e = _.value?.getBoundingClientRect().width;
421
+ e && (E.value = `${Math.round(e)}px`);
422
+ }, R = (e) => String(e[r.valueKey] ?? ""), z = (e) => {
423
+ if (r.disabled || r.readonly) {
424
+ s.value = !1;
425
+ return;
426
+ }
427
+ s.value = e, e && ie();
428
+ }, B = (e) => {
429
+ if (r.disabled || r.readonly) return;
430
+ let t = ++j, n = (e) => {
431
+ t === j && (u.value = e, c.value = !1, z(!0));
432
+ };
433
+ if (Array.isArray(r.dataSource)) {
434
+ let t = e.trim().toLowerCase();
435
+ n(t ? r.dataSource.filter((e) => R(e).toLowerCase().includes(t)) : r.dataSource);
436
+ return;
437
+ }
438
+ c.value = !0, z(!0), r.dataSource(e, n);
439
+ }, V = (e, t = !1) => {
440
+ if (!(r.disabled || r.readonly)) {
441
+ if (A && window.clearTimeout(A), A = 0, t) {
442
+ B(e);
443
+ return;
444
+ }
445
+ A = window.setTimeout(() => {
446
+ A = 0, B(e);
447
+ }, Math.max(0, r.debounce));
448
+ }
449
+ }, U = () => {
450
+ A && window.clearTimeout(A), A = 0, j += 1, c.value = !1, s.value = !1;
451
+ }, W = (e, t) => {
452
+ l.value = e, i("update:modelValue", e), i("input", e, t), V(String(e));
453
+ }, G = (e, t) => {
454
+ i("change", e, t);
455
+ }, se = (e) => {
456
+ if (P || Date.now() < re) {
457
+ P = !1, i("focus", e);
458
+ return;
459
+ }
460
+ r.triggerOnFocus && V(F.value), i("focus", e);
461
+ }, ce = () => {
462
+ l.value = "", U(), V("", !0), i("clear");
463
+ }, K = (e) => {
464
+ if (r.disabled || r.readonly || e.disabled) return;
465
+ let t = R(e);
466
+ l.value = t, i("update:modelValue", t), i("input", t, new Event("input")), i("change", t, new Event("change")), i("select", e), U(), P = !0, re = Date.now() + 120, y.value?.focus();
467
+ }, le = (e) => {
468
+ if (i("keydown", e), !r.disabled) {
469
+ if (s.value && [
470
+ "ArrowDown",
471
+ "ArrowUp",
472
+ "PageDown",
473
+ "PageUp"
474
+ ].includes(e.key)) {
475
+ S.value?.handleKeyDown(e);
476
+ return;
477
+ }
478
+ if (!(s.value && e.key === "Enter" && (S.value?.handleKeyDown(e), e.defaultPrevented))) {
479
+ if (e.key === "Escape") {
480
+ U();
481
+ return;
482
+ }
483
+ e.key === "Enter" && r.selectWhenUnmatched && F.value && (e.preventDefault(), i("select", { value: F.value }), U());
484
+ }
485
+ }
486
+ };
487
+ return C(U), t({
488
+ blur: () => y.value?.blur(),
489
+ clear: () => y.value?.clear(),
490
+ focus: () => y.value?.focus(),
491
+ select: () => y.value?.select()
492
+ }), (t, n) => (w(), f(k(o), {
493
+ ref_key: "dropdownRef",
494
+ ref: S,
495
+ open: s.value,
496
+ "onUpdate:open": n[2] ||= (e) => s.value = e,
497
+ items: u.value,
498
+ "value-key": "value",
499
+ width: I.value,
500
+ "max-height": e.maxHeight,
501
+ "focus-on-open": !1,
502
+ "content-class": "ui-autocomplete-dropdown",
503
+ class: "w-full",
504
+ onSelect: n[3] ||= (e) => K(e)
505
+ }, {
506
+ trigger: M(() => [h("div", {
507
+ ref_key: "triggerRef",
508
+ ref: _,
509
+ class: "w-full",
510
+ onClick: n[1] ||= N(() => {}, ["stop"])
511
+ }, [v(H, ee({
512
+ ref_key: "inputRef",
513
+ ref: y
514
+ }, k(a), {
515
+ "model-value": l.value,
516
+ size: e.size,
517
+ disabled: e.disabled,
518
+ readonly: e.readonly,
519
+ placeholder: e.placeholder,
520
+ "prefix-icon": e.prefixIcon,
521
+ "suffix-icon": e.suffixIcon,
522
+ prefix: e.prefix,
523
+ suffix: e.suffix,
524
+ clearable: e.clearable,
525
+ "clear-icon": e.clearIcon,
526
+ name: e.name,
527
+ autocomplete: e.autocomplete,
528
+ onInput: W,
529
+ onChange: G,
530
+ onClear: ce,
531
+ onFocus: se,
532
+ onBlur: n[0] ||= (e) => i("blur", e),
533
+ onKeydown: le
534
+ }), g({ _: 2 }, [
535
+ t.$slots.prepend ? {
536
+ name: "prepend",
537
+ fn: M(() => [D(t.$slots, "prepend")]),
538
+ key: "0"
539
+ } : void 0,
540
+ t.$slots.append ? {
541
+ name: "append",
542
+ fn: M(() => [D(t.$slots, "append")]),
543
+ key: "1"
544
+ } : void 0,
545
+ t.$slots.prefix ? {
546
+ name: "prefix",
547
+ fn: M(() => [D(t.$slots, "prefix")]),
548
+ key: "2"
549
+ } : void 0,
550
+ t.$slots.suffix ? {
551
+ name: "suffix",
552
+ fn: M(() => [D(t.$slots, "suffix")]),
553
+ key: "3"
554
+ } : void 0
555
+ ]), 1040, [
556
+ "model-value",
557
+ "size",
558
+ "disabled",
559
+ "readonly",
560
+ "placeholder",
561
+ "prefix-icon",
562
+ "suffix-icon",
563
+ "prefix",
564
+ "suffix",
565
+ "clearable",
566
+ "clear-icon",
567
+ "name",
568
+ "autocomplete"
569
+ ])], 512)]),
570
+ item: M(({ item: e }) => [D(t.$slots, "suggestion", { item: e }, () => [h("div", { class: x(["flex min-h-9 cursor-pointer items-center gap-2 px-3 py-2 text-sm text-primary transition-colors hover:bg-secondary", { "pointer-events-none text-tertiary opacity-50": e.disabled }]) }, [h("span", ae, O(R(e)), 1)], 2)])]),
571
+ footer: M(() => [c.value && !e.hideLoading || u.value.length === 0 ? (w(), m("div", oe, O(L.value), 1)) : p("", !0)]),
572
+ _: 3
573
+ }, 8, [
574
+ "open",
575
+ "items",
576
+ "width",
577
+ "max-height"
578
+ ]));
579
+ }
580
+ }), W = {
581
+ key: 1,
582
+ class: "text-xs"
583
+ }, G = [
584
+ "disabled",
585
+ "title",
586
+ "aria-label"
587
+ ], se = { class: "space-y-3 p-4" }, ce = { class: "flex min-h-7 items-center justify-between gap-3" }, K = { class: "min-w-0 flex-1" }, le = { class: "flex flex-col gap-3" }, ue = ["for"], q = {
588
+ key: 1,
589
+ class: "w-18"
590
+ }, de = { class: "flex w-full items-center justify-center gap-3" }, fe = /* @__PURE__ */ y({
591
+ inheritAttrs: !1,
592
+ __name: "InputI18n",
593
+ props: {
594
+ modelValue: { default: () => ({}) },
595
+ languages: { default: void 0 },
596
+ size: { default: "md" },
597
+ disabled: {
598
+ type: Boolean,
599
+ default: !1
600
+ },
601
+ readonly: {
602
+ type: Boolean,
603
+ default: !1
604
+ },
605
+ placeholder: { default: "" },
606
+ name: { default: void 0 },
607
+ clearable: {
608
+ type: Boolean,
609
+ default: !1
610
+ },
611
+ prefixIcon: { default: "" },
612
+ suffixIcon: { default: "" },
613
+ prefix: { default: "" },
614
+ suffix: { default: "" },
615
+ autocomplete: { default: "new-password" },
616
+ modalZIndex: { default: 2e3 }
617
+ },
618
+ emits: [
619
+ "update:modelValue",
620
+ "input",
621
+ "change",
622
+ "clear",
623
+ "focus",
624
+ "blur"
625
+ ],
626
+ setup(t, { emit: o }) {
627
+ let c = t, l = o, y = te(), { t: b } = re(), S = a(), C = T(!1), A = T({}), j = T([]), P = T(null), F = T(null), I = T(!1), L = d(() => S.languages), ie = d(() => {
628
+ let e = S.locale;
629
+ return typeof e == "function" ? e() : e;
630
+ }), R = d(() => c.languages ? i(c.languages) : L.value.map((e) => e.key)), z = d(() => {
631
+ let e = String(ie.value || "");
632
+ return c.languages ? R.value.includes(e) ? e : R.value[0] : e;
633
+ }), B = d(() => c.modelValue?.[z.value] || ""), V = d(() => c.disabled || y.disabled === "" || y.disabled === !0 || y.disabled === "true"), ae = d(() => c.clearable && !V.value && !c.readonly && B.value.length > 0), oe = () => y.class, U = () => {
634
+ let { class: e, style: t, disabled: n, readonly: r, ...i } = y;
635
+ return i;
636
+ }, fe = d(() => P.value ? P.value.tone === "success" ? "border-teal-500/20 bg-teal-50/60 text-teal-700 dark:border-teal-500/25 dark:bg-teal-950/20 dark:text-teal-300" : P.value.tone === "warning" ? "border-orange-400/25 bg-orange-50/60 text-orange-700 dark:border-orange-400/30 dark:bg-orange-950/20 dark:text-orange-300" : P.value.tone === "error" ? "border-rose-500/20 bg-rose-50/60 text-rose-700 dark:border-rose-500/30 dark:bg-rose-950/20 dark:text-rose-300" : "border-brand/20 bg-brand/5 text-brand dark:border-brand/30 dark:bg-brand/10 dark:text-brand-300" : ""), J = (e, t = R.value) => {
637
+ let n = {};
638
+ return t.forEach((t) => {
639
+ n[t] = e?.[t] || "";
640
+ }), Object.entries(e || {}).forEach(([e, t]) => {
641
+ e in n || (n[e] = t || "");
642
+ }), n;
643
+ }, pe = (e) => r(e, L.value).label, me = () => {
644
+ let e = R.value;
645
+ j.value = [z.value, ...e.filter((e) => e !== z.value)], A.value = J(A.value);
646
+ }, he = (e, t) => {
647
+ l("update:modelValue", e), l("input", e, t);
648
+ }, Y = (e, t) => {
649
+ he(e, t), l("change", e, t);
650
+ }, X = (e, t) => {
651
+ he({
652
+ ...J(c.modelValue),
653
+ [z.value]: String(e)
654
+ }, t);
655
+ }, ge = (e, t) => {
656
+ Y({
657
+ ...J(c.modelValue),
658
+ [z.value]: String(e)
659
+ }, t);
660
+ }, _e = () => {
661
+ Y({
662
+ ...J(c.modelValue),
663
+ [z.value]: ""
664
+ }), l("clear");
665
+ }, Z = (e, t) => {
666
+ P.value = {
667
+ tone: e,
668
+ text: t
669
+ };
670
+ }, ve = () => {
671
+ V.value || (A.value = J(c.modelValue), P.value = null, C.value = !0);
672
+ }, ye = () => {
673
+ Y(A.value), C.value = !1;
674
+ }, be = () => {
675
+ C.value = !1;
676
+ }, xe = (e) => {
677
+ if (e) {
678
+ C.value = !0;
679
+ return;
680
+ }
681
+ be();
682
+ }, Se = (e) => {
683
+ if (e instanceof Error) return e.message;
684
+ if (e && typeof e == "object") {
685
+ let t = e;
686
+ if (typeof t.data?.message == "string") return t.data.message;
687
+ if (typeof t.message == "string") return t.message;
688
+ }
689
+ return b("comp.mpInputI18n.unknownError");
690
+ }, Q = {
691
+ "zh-CN": "zh",
692
+ "zh-HK": "cht",
693
+ "zh-TW": "cht",
694
+ en: "en",
695
+ "en-US": "en",
696
+ "en-GB": "en",
697
+ ja: "jp",
698
+ ko: "kor",
699
+ ar: "ara",
700
+ fr: "fra",
701
+ de: "de",
702
+ es: "spa",
703
+ pt: "pt",
704
+ "pt-BR": "pt",
705
+ ru: "ru",
706
+ it: "it",
707
+ th: "th",
708
+ vi: "vie",
709
+ hi: "hi",
710
+ tr: "tr",
711
+ nl: "nl",
712
+ pl: "pl",
713
+ sv: "swe",
714
+ da: "dan",
715
+ fi: "fin",
716
+ cs: "cs",
717
+ hu: "hu",
718
+ ro: "rom",
719
+ el: "el"
720
+ }, Ce = (e) => r(e, L.value).baidu || Q[e] || e.split("-")[0], we = async (e) => {
721
+ let t = A.value[z.value];
722
+ if (!t) return Z("warning", b("comp.mpInputI18n.sourceRequired")), null;
723
+ if (!S.translate) throw Error(b("comp.mpInputI18n.translateFailed"));
724
+ let n = await S.translate({
725
+ q: t,
726
+ from: Ce(z.value) || "auto",
727
+ to: Ce(e) || e
728
+ });
729
+ if (typeof n == "string") return n;
730
+ if (!n) throw Error(b("comp.mpInputI18n.translateFailed"));
731
+ if (n.text) return n.text;
732
+ if (n.trans_result?.[0]) return n.trans_result[0].dst;
733
+ throw Error(b("comp.mpInputI18n.translateFailed"));
734
+ }, Te = async (e, t = !1) => {
735
+ if (F.value || I.value) return !1;
736
+ F.value = e;
737
+ try {
738
+ let n = await we(e);
739
+ return n ? (A.value[e] = n, t || Z("success", b("comp.mpInputI18n.translateSuccess", { lang: pe(e) })), !0) : !1;
740
+ } catch (e) {
741
+ return Z("error", b("comp.mpInputI18n.translateFailedWithReason", { reason: Se(e) })), !1;
742
+ } finally {
743
+ F.value = null;
744
+ }
745
+ }, Ee = async () => {
746
+ if (F.value || I.value) return;
747
+ if (!A.value[z.value]) {
748
+ Z("warning", b("comp.mpInputI18n.sourceRequired"));
749
+ return;
750
+ }
751
+ let e = j.value.filter((e) => e !== z.value);
752
+ I.value = !0, Z("info", b("comp.mpInputI18n.translatingAll"));
753
+ try {
754
+ for (let t of e) {
755
+ let e = await we(t);
756
+ e && (A.value[t] = e);
757
+ }
758
+ Z("success", b("comp.mpInputI18n.translateAllSuccess"));
759
+ } catch (e) {
760
+ Z("error", b("comp.mpInputI18n.translateFailedWithReason", { reason: Se(e) }));
761
+ } finally {
762
+ I.value = !1, F.value = null;
763
+ }
764
+ };
765
+ return ne([z, R], me, { immediate: !0 }), ne(() => c.modelValue, (e) => {
766
+ C.value || (A.value = J(e));
767
+ }, {
768
+ deep: !0,
769
+ immediate: !0
770
+ }), (r, i) => (w(), m(u, null, [v(H, ee(U(), {
771
+ "data-ui-input-i18n": "true",
772
+ "model-value": B.value,
773
+ class: oe(),
774
+ style: k(n)(k(y)),
775
+ size: t.size,
776
+ disabled: V.value,
777
+ readonly: t.readonly,
778
+ placeholder: t.placeholder,
779
+ name: t.name,
780
+ clearable: !1,
781
+ "prefix-icon": t.prefixIcon,
782
+ prefix: t.prefix,
783
+ autocomplete: t.autocomplete,
784
+ dir: k(S).rtlLanguages.includes(z.value) ? "rtl" : "ltr",
785
+ onInput: X,
786
+ onChange: ge,
787
+ onClear: _e,
788
+ onFocus: i[1] ||= (e) => l("focus", e),
789
+ onBlur: i[2] ||= (e) => l("blur", e)
790
+ }), g({
791
+ suffix: M(() => [
792
+ D(r.$slots, "suffix"),
793
+ t.suffixIcon ? (w(), m("span", {
794
+ key: 0,
795
+ class: x([t.suffixIcon, "size-4"])
796
+ }, null, 2)) : p("", !0),
797
+ t.suffix ? (w(), m("span", W, O(t.suffix), 1)) : p("", !0),
798
+ ae.value ? (w(), m("button", {
799
+ key: 2,
800
+ type: "button",
801
+ "aria-label": "清空",
802
+ class: "flex size-4 items-center justify-center rounded-full bg-tertiary/90 text-tertiary/60 opacity-0 transition-all duration-150 hover:bg-tertiary hover:text-tertiary group-hover/ui-input:opacity-100 group-focus-within/ui-input:opacity-100",
803
+ onClick: N(_e, ["stop"])
804
+ }, [...i[3] ||= [h("span", { class: "i-lucide:x size-3" }, null, -1)]])) : p("", !0),
805
+ j.value.length > 1 ? (w(), m("button", {
806
+ key: 3,
807
+ type: "button",
808
+ class: "flex size-5 items-center justify-center rounded text-tertiary transition-colors hover:bg-secondary/30 hover:text-primary disabled:cursor-not-allowed disabled:opacity-50",
809
+ disabled: V.value,
810
+ title: k(b)("comp.mpInputI18n.editorTitle"),
811
+ "aria-label": k(b)("comp.mpInputI18n.editorTitle"),
812
+ onMousedown: i[0] ||= N(() => {}, ["prevent"]),
813
+ onClick: N(ve, ["stop"])
814
+ }, [...i[4] ||= [h("span", { class: "i-lucide:globe size-3.5" }, null, -1)]], 40, G)) : p("", !0)
815
+ ]),
816
+ _: 2
817
+ }, [
818
+ r.$slots.prepend ? {
819
+ name: "prepend",
820
+ fn: M(() => [D(r.$slots, "prepend")]),
821
+ key: "0"
822
+ } : void 0,
823
+ r.$slots.prefix ? {
824
+ name: "prefix",
825
+ fn: M(() => [D(r.$slots, "prefix")]),
826
+ key: "1"
827
+ } : void 0,
828
+ r.$slots.append ? {
829
+ name: "append",
830
+ fn: M(() => [D(r.$slots, "append")]),
831
+ key: "2"
832
+ } : void 0
833
+ ]), 1040, [
834
+ "model-value",
835
+ "class",
836
+ "style",
837
+ "size",
838
+ "disabled",
839
+ "readonly",
840
+ "placeholder",
841
+ "name",
842
+ "prefix-icon",
843
+ "prefix",
844
+ "autocomplete",
845
+ "dir"
846
+ ]), v(k(s), {
847
+ visible: C.value,
848
+ title: k(b)("comp.mpInputI18n.editorTitle"),
849
+ width: 560,
850
+ "z-index": t.modalZIndex,
851
+ "onUpdate:visible": xe
852
+ }, {
853
+ icon: M(() => [...i[5] ||= [h("span", { class: "i-lucide:globe text-brand" }, null, -1)]]),
854
+ footer: M(() => [h("div", de, [v(k(e), {
855
+ color: "gray",
856
+ variant: "mono",
857
+ size: "lg",
858
+ class: "min-w-24",
859
+ onClick: be
860
+ }, {
861
+ default: M(() => [_(O(k(b)("common.cancel")), 1)]),
862
+ _: 1
863
+ }), v(k(e), {
864
+ size: "lg",
865
+ class: "min-w-24",
866
+ onClick: ye
867
+ }, {
868
+ default: M(() => [_(O(k(b)("common.save")), 1)]),
869
+ _: 1
870
+ })])]),
871
+ default: M(() => [h("div", se, [h("div", ce, [h("div", K, [P.value ? (w(), m("div", {
872
+ key: 0,
873
+ class: x(["truncate rounded border px-2.5 py-1.5 text-xs font-medium", fe.value])
874
+ }, O(P.value.text), 3)) : p("", !0)]), v(k(e), {
875
+ size: "sm",
876
+ variant: "outline",
877
+ loading: I.value,
878
+ disabled: !!F.value || I.value,
879
+ onClick: Ee
880
+ }, {
881
+ default: M(() => [_(O(k(b)("comp.mpInputI18n.translateAll")), 1)]),
882
+ _: 1
883
+ }, 8, ["loading", "disabled"])]), h("div", le, [(w(!0), m(u, null, E(j.value, (t) => (w(), m("div", {
884
+ key: t,
885
+ class: "grid grid-cols-1 items-center gap-2 sm:grid-cols-[96px_minmax(0,1fr)_72px]"
886
+ }, [
887
+ h("label", {
888
+ class: x(["truncate text-left text-xs font-bold text-tertiary sm:text-right", `font-${t}`]),
889
+ for: `ui-input-i18n-editor-${t}`
890
+ }, [_(O(pe(t)), 1), i[6] ||= h("span", { "aria-hidden": "true" }, ":", -1)], 10, ue),
891
+ v(H, {
892
+ id: `ui-input-i18n-editor-${t}`,
893
+ modelValue: A.value[t],
894
+ "onUpdate:modelValue": (e) => A.value[t] = e,
895
+ size: "sm",
896
+ class: x(`font-${t}`),
897
+ dir: k(S).rtlLanguages.includes(t) ? "rtl" : "ltr",
898
+ autocomplete: "new-password"
899
+ }, null, 8, [
900
+ "id",
901
+ "modelValue",
902
+ "onUpdate:modelValue",
903
+ "class",
904
+ "dir"
905
+ ]),
906
+ t === z.value ? (w(), m("span", q)) : (w(), f(k(e), {
907
+ key: 0,
908
+ size: "sm",
909
+ variant: "outline",
910
+ disabled: !!F.value || I.value,
911
+ loading: F.value === t,
912
+ onClick: () => Te(t)
913
+ }, {
914
+ default: M(() => [_(O(k(b)("comp.mpInputI18n.translate")), 1)]),
915
+ _: 1
916
+ }, 8, [
917
+ "disabled",
918
+ "loading",
919
+ "onClick"
920
+ ]))
921
+ ]))), 128))])])]),
922
+ _: 1
923
+ }, 8, [
924
+ "visible",
925
+ "title",
926
+ "z-index"
927
+ ])], 64));
928
+ }
929
+ }), J = {
930
+ key: 0,
931
+ class: "flex shrink-0 self-center items-center gap-1 text-tertiary"
932
+ }, pe = [
933
+ "name",
934
+ "value",
935
+ "maxlength",
936
+ "placeholder",
937
+ "disabled",
938
+ "readonly",
939
+ "autocomplete"
940
+ ], me = {
941
+ key: 1,
942
+ class: "ml-auto flex shrink-0 self-center items-center gap-1 text-tertiary"
943
+ }, he = /* @__PURE__ */ y({
944
+ inheritAttrs: !1,
945
+ __name: "InputTag",
946
+ props: {
947
+ modelValue: { default: () => [] },
948
+ size: { default: "md" },
949
+ disabled: {
950
+ type: Boolean,
951
+ default: !1
952
+ },
953
+ readonly: {
954
+ type: Boolean,
955
+ default: !1
956
+ },
957
+ placeholder: { default: "" },
958
+ inputPlaceholder: { default: "" },
959
+ clearable: {
960
+ type: Boolean,
961
+ default: !1
962
+ },
963
+ clearIcon: { default: "i-lucide:x" },
964
+ closeIcon: { default: "i-lucide:x" },
965
+ trigger: { default: "Enter" },
966
+ delimiters: { default: () => [","] },
967
+ max: { default: void 0 },
968
+ maxlength: { default: void 0 },
969
+ validateTag: {
970
+ type: Function,
971
+ default: void 0
972
+ },
973
+ allowDuplicates: {
974
+ type: Boolean,
975
+ default: !1
976
+ },
977
+ tagColor: { default: "brand" },
978
+ tagVariant: { default: "light" },
979
+ tagRadius: { default: "md" },
980
+ name: { default: void 0 },
981
+ autocomplete: { default: void 0 }
982
+ },
983
+ emits: [
984
+ "update:modelValue",
985
+ "input",
986
+ "change",
987
+ "add-tag",
988
+ "remove-tag",
989
+ "clear",
990
+ "focus",
991
+ "blur",
992
+ "keydown"
993
+ ],
994
+ setup(e, { expose: t, emit: n }) {
995
+ let r = e, i = n, a = te(), o = A(), s = j("inputRef"), l = T(""), g = T(!1), v = T(!1), y = !!o.prepend, C = !!o.append, ne = () => !!o.prefix, re = () => !!o.suffix, F = () => r.disabled || r.readonly, I = d(() => r.modelValue.filter((e) => e != null)), L = () => r.max === void 0 || I.value.length < r.max, ie = () => r.clearable && !F() && I.value.length > 0, R = d(() => r.size === "lg" ? "md" : "sm"), z = d(() => I.value.length === 0 ? r.placeholder : r.inputPlaceholder), B = d(() => {
996
+ let e = Array.isArray(r.trigger) ? r.trigger : [r.trigger];
997
+ return new Set(e);
998
+ }), V = d(() => r.delimiters.filter(Boolean)), H = () => P(a.class), ae = () => a.style, oe = d(() => r.size === "sm" ? "calc(2rem + 2px)" : r.size === "lg" ? "calc(2.5rem + 2px)" : "calc(2rem + 2px)"), U = d(() => [ae(), {
999
+ minHeight: oe.value,
1000
+ "--ui-input-tag-clear-size": "1rem",
1001
+ "--ui-input-tag-row-height": oe.value
1002
+ }]), W = () => {
1003
+ let { class: e, style: t, ...n } = a;
1004
+ return n;
1005
+ }, G = d(() => P(H(), ge({
1006
+ size: r.size,
1007
+ focused: g.value,
1008
+ disabled: r.disabled,
1009
+ multiline: !0
1010
+ }), "flex-wrap items-center! content-start overflow-visible! gap-1 px-2 py-1", r.size === "sm" && "px-1.5 py-0.5", r.size === "lg" && "px-2.5 py-1.5", ie() && "pr-7!", y && "-ml-px rounded-l-none", C && "-mr-px rounded-r-none")), se = d(() => P(_e({
1011
+ size: r.size,
1012
+ multiline: !1,
1013
+ number: !1
1014
+ }), "h-6! min-w-20 flex-[1_0_5rem]! self-center px-1! py-0!", r.size === "sm" && "h-5 text-sm/5", r.size === "sm" && "h-5!", r.size === "lg" && "h-7", r.size === "lg" && "h-7!")), ce = d(() => P("absolute right-2 top-[calc((var(--ui-input-tag-row-height)-var(--ui-input-tag-clear-size))/2-1px)] flex size-4 items-center justify-center rounded-full bg-tertiary/90 text-tertiary/60 opacity-0 transition-all duration-150 hover:bg-tertiary hover:text-tertiary group-hover/ui-input:opacity-100 group-focus-within/ui-input:opacity-100")), K = () => s.value?.focus(), le = () => s.value?.blur(), ue = (e) => {
1015
+ i("update:modelValue", e), i("input", e);
1016
+ }, q = (e) => {
1017
+ ue(e), i("change", e);
1018
+ }, de = (e) => e.trim(), fe = (e, t) => !(!e || !r.allowDuplicates && t.includes(e) || r.validateTag && !r.validateTag(e)), he = (e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), Y = (e) => V.value.length === 0 ? [e] : e.split(new RegExp(V.value.map(he).join("|"))), X = (e) => {
1019
+ if (F() || !L()) return !1;
1020
+ let t = [...I.value], n = !1;
1021
+ for (let a of Y(e)) {
1022
+ if (r.max !== void 0 && t.length >= r.max) break;
1023
+ let e = de(a);
1024
+ if (fe(e, t) && (t.push(e), n = !0, i("add-tag", e), r.max !== void 0 && t.length >= r.max)) break;
1025
+ }
1026
+ return n && (l.value = "", q(t)), n;
1027
+ }, ye = (e) => {
1028
+ if (F()) return;
1029
+ let t = [...I.value], [n] = t.splice(e, 1);
1030
+ q(t), n !== void 0 && i("remove-tag", n, e), b(K);
1031
+ }, be = () => {
1032
+ F() || I.value.length === 0 || (l.value = "", q([]), i("clear"), b(K));
1033
+ }, xe = (e) => {
1034
+ e.target !== s.value && (e.target?.closest("button") || (e.preventDefault(), K()));
1035
+ }, Se = (e) => {
1036
+ F() || (l.value = e.target.value, !v.value && V.value.some((e) => l.value.includes(e)) && X(l.value));
1037
+ }, Q = (e) => {
1038
+ if (F()) return;
1039
+ let t = e.clipboardData?.getData("text");
1040
+ !t || !V.value.some((e) => t.includes(e)) || (e.preventDefault(), X(t));
1041
+ }, Ce = (e) => {
1042
+ g.value = !0, i("focus", e);
1043
+ }, we = (e) => {
1044
+ g.value = !1, l.value && X(l.value), i("blur", e);
1045
+ }, Te = () => {
1046
+ v.value = !0;
1047
+ }, Ee = (e) => {
1048
+ v.value = !1, l.value = e.target.value;
1049
+ }, De = (e) => {
1050
+ if (i("keydown", e), !(F() || v.value)) {
1051
+ if (B.value.has(e.key) || e.key === " " && B.value.has("Space")) {
1052
+ e.key === "Tab" && l.value.trim() && e.preventDefault();
1053
+ let t = X(l.value);
1054
+ (t || l.value.trim()) && e.preventDefault(), t && e.key === "Tab" && b(K);
1055
+ return;
1056
+ }
1057
+ e.key === "Backspace" && l.value === "" && I.value.length > 0 && (e.preventDefault(), ye(I.value.length - 1));
1058
+ }
1059
+ };
1060
+ return t({
1061
+ blur: le,
1062
+ clear: be,
1063
+ focus: K
1064
+ }), (t, n) => (w(), m("div", { class: x(k(Z)({
1065
+ size: e.size,
1066
+ multiline: !0
1067
+ })) }, [
1068
+ y ? (w(), m("div", {
1069
+ key: 0,
1070
+ class: x(k(ve)({
1071
+ position: "prepend",
1072
+ size: e.size,
1073
+ disabled: e.disabled
1074
+ }))
1075
+ }, [D(t.$slots, "prepend")], 2)) : p("", !0),
1076
+ h("div", {
1077
+ class: x(G.value),
1078
+ style: S(U.value),
1079
+ "data-ui-input-tag": "true",
1080
+ onPointerdown: xe
1081
+ }, [
1082
+ ne() ? (w(), m("span", J, [D(t.$slots, "prefix")])) : p("", !0),
1083
+ (w(!0), m(u, null, E(I.value, (n, r) => (w(), f(k(c), {
1084
+ key: `${n}-${r}`,
1085
+ color: e.tagColor,
1086
+ variant: e.tagVariant,
1087
+ size: R.value,
1088
+ radius: e.tagRadius,
1089
+ closable: !e.disabled && !e.readonly,
1090
+ "close-icon": e.closeIcon,
1091
+ class: "max-w-full self-center",
1092
+ onClose: (e) => ye(r)
1093
+ }, {
1094
+ default: M(() => [D(t.$slots, "tag", {
1095
+ tag: n,
1096
+ index: r
1097
+ }, () => [_(O(n), 1)])]),
1098
+ _: 2
1099
+ }, 1032, [
1100
+ "color",
1101
+ "variant",
1102
+ "size",
1103
+ "radius",
1104
+ "closable",
1105
+ "close-icon",
1106
+ "onClose"
1107
+ ]))), 128)),
1108
+ h("input", ee({
1109
+ ref_key: "inputRef",
1110
+ ref: s
1111
+ }, W(), {
1112
+ "data-ui-input-tag-control": "true",
1113
+ name: e.name,
1114
+ value: l.value,
1115
+ maxlength: e.maxlength,
1116
+ placeholder: z.value,
1117
+ disabled: e.disabled || !L(),
1118
+ readonly: e.readonly,
1119
+ autocomplete: e.autocomplete,
1120
+ class: se.value,
1121
+ onInput: Se,
1122
+ onPaste: Q,
1123
+ onFocus: Ce,
1124
+ onBlur: we,
1125
+ onKeydown: De,
1126
+ onCompositionstart: Te,
1127
+ onCompositionend: Ee
1128
+ }), null, 16, pe),
1129
+ re() ? (w(), m("span", me, [D(t.$slots, "suffix")])) : p("", !0),
1130
+ ie() ? (w(), m("button", {
1131
+ key: 2,
1132
+ type: "button",
1133
+ "aria-label": "清空",
1134
+ class: x(ce.value),
1135
+ onClick: N(be, ["stop"])
1136
+ }, [h("span", { class: x([e.clearIcon, "size-3"]) }, null, 2)], 2)) : p("", !0)
1137
+ ], 38),
1138
+ C ? (w(), m("div", {
1139
+ key: 1,
1140
+ class: x(k(ve)({
1141
+ position: "append",
1142
+ size: e.size,
1143
+ disabled: e.disabled
1144
+ }))
1145
+ }, [D(t.$slots, "append")], 2)) : p("", !0)
1146
+ ], 2));
1147
+ }
1148
+ }), Y = {
1149
+ sm: "h-[calc(1.75rem+2px)]",
1150
+ md: "h-[calc(2rem+2px)]",
1151
+ lg: "h-[calc(2.25rem+2px)]"
1152
+ }, X = [
1153
+ "sm",
1154
+ "md",
1155
+ "lg"
1156
+ ].map((e) => ({
1157
+ size: e,
1158
+ multiline: !1,
1159
+ class: Y[e]
1160
+ })), ge = l("group/ui-input relative flex w-full min-w-0 items-stretch overflow-hidden border bg-primary text-primary transition-colors duration-150", {
1161
+ variants: {
1162
+ size: {
1163
+ sm: "rounded-md text-sm/5",
1164
+ md: "rounded-md text-base/4",
1165
+ lg: "rounded-md text-lg/5"
1166
+ },
1167
+ focused: {
1168
+ true: "border-brand ring-2 ring-brand/15",
1169
+ false: "border-medium hover:border-brand/40"
1170
+ },
1171
+ disabled: {
1172
+ true: "cursor-not-allowed bg-tertiary/20 text-tertiary opacity-70 hover:border-medium",
1173
+ false: ""
1174
+ },
1175
+ multiline: {
1176
+ true: "h-auto",
1177
+ false: ""
1178
+ }
1179
+ },
1180
+ defaultVariants: {
1181
+ size: "md",
1182
+ focused: !1,
1183
+ disabled: !1,
1184
+ multiline: !1
1185
+ },
1186
+ compoundVariants: X
1187
+ }), _e = l("min-w-0 flex-1 border-0 bg-transparent text-inherit outline-none placeholder:text-tertiary/60 disabled:cursor-not-allowed disabled:opacity-100", {
1188
+ variants: {
1189
+ size: {
1190
+ sm: "text-sm/5",
1191
+ md: "text-base/4",
1192
+ lg: "text-lg/5"
1193
+ },
1194
+ multiline: {
1195
+ true: "min-h-20 resize-y",
1196
+ false: "h-full py-0"
1197
+ },
1198
+ number: {
1199
+ true: "font-mono [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none",
1200
+ false: ""
1201
+ }
1202
+ },
1203
+ defaultVariants: {
1204
+ size: "md",
1205
+ multiline: !1,
1206
+ number: !1
1207
+ },
1208
+ compoundVariants: [
1209
+ {
1210
+ size: "sm",
1211
+ multiline: !1,
1212
+ class: "px-2"
1213
+ },
1214
+ {
1215
+ size: "md",
1216
+ multiline: !1,
1217
+ class: "px-3"
1218
+ },
1219
+ {
1220
+ size: "lg",
1221
+ multiline: !1,
1222
+ class: "px-4"
1223
+ },
1224
+ {
1225
+ size: "sm",
1226
+ multiline: !0,
1227
+ class: "px-2 py-1"
1228
+ },
1229
+ {
1230
+ size: "md",
1231
+ multiline: !0,
1232
+ class: "px-3 py-2"
1233
+ },
1234
+ {
1235
+ size: "lg",
1236
+ multiline: !0,
1237
+ class: "px-4 py-2"
1238
+ }
1239
+ ]
1240
+ }), Z = l("inline-flex w-full min-w-0 items-stretch align-middle", {
1241
+ variants: {
1242
+ size: {
1243
+ sm: "",
1244
+ md: "",
1245
+ lg: ""
1246
+ },
1247
+ multiline: {
1248
+ true: "h-auto",
1249
+ false: ""
1250
+ }
1251
+ },
1252
+ defaultVariants: {
1253
+ size: "md",
1254
+ multiline: !1
1255
+ },
1256
+ compoundVariants: X
1257
+ }), ve = l("flex shrink-0 items-center border border-medium bg-tertiary/50 px-3 text-tertiary", {
1258
+ variants: {
1259
+ position: {
1260
+ prepend: "rounded-l-md border-r-0",
1261
+ append: "rounded-r-md border-l-0"
1262
+ },
1263
+ size: {
1264
+ sm: "text-xs",
1265
+ md: "text-sm",
1266
+ lg: "text-base"
1267
+ },
1268
+ disabled: {
1269
+ true: "cursor-not-allowed opacity-70",
1270
+ false: ""
1271
+ }
1272
+ },
1273
+ defaultVariants: {
1274
+ size: "md",
1275
+ disabled: !1
1276
+ }
1277
+ });
1278
+ //#endregion
1279
+ export { he as a, H as c, ge as i, _e as n, fe as o, Z as r, U as s, ve as t };
1280
+
1281
+ //# sourceMappingURL=input-BDOXVCrK.js.map