@kernel4632/kima 0.8.5 → 0.8.7

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 (69) hide show
  1. package/dist/components/advanced-input/editable.ce.vue_vue_type_style_index_0_scoped_82c96de0_lang.css +1 -0
  2. package/dist/components/core/{text-field.ce.vue_vue_type_style_index_0_scoped_7334ab60_lang.css → text-field.ce.vue_vue_type_style_index_0_scoped_f22e5c02_lang.css} +1 -1
  3. package/dist/components/data/table.ce.vue_vue_type_style_index_0_scoped_c1ac8a33_lang.css +1 -0
  4. package/dist/components/display/list.ce.vue_vue_type_style_index_0_scoped_df3ec98f_lang.css +1 -0
  5. package/dist/components/display/skeleton.ce.vue_vue_type_style_index_0_scoped_92807af5_lang.css +1 -0
  6. package/dist/components/display/timeline.ce.vue_vue_type_style_index_0_scoped_72323605_lang.css +1 -0
  7. package/dist/components/form-completion/dynamic-input.ce.vue_vue_type_style_index_0_scoped_6a5bc26a_lang.css +1 -0
  8. package/dist/components/form-completion/upload-manager.ce.vue_vue_type_style_index_0_scoped_fe810c3a_lang.css +1 -0
  9. package/dist/components/input/field.ce.vue_vue_type_style_index_0_scoped_a01eded5_lang.css +1 -0
  10. package/dist/components/input/{file-upload.ce.vue_vue_type_style_index_0_scoped_1568bdab_lang.css → file-upload.ce.vue_vue_type_style_index_0_scoped_8fd77a68_lang.css} +1 -1
  11. package/dist/components/input/tags-input.ce.vue_vue_type_style_index_0_scoped_b46618b2_lang.css +1 -0
  12. package/dist/components/input/textarea.ce.vue_vue_type_style_index_0_scoped_60d0751b_lang.css +1 -0
  13. package/dist/components/interaction/multi-select.ce.vue_vue_type_style_index_0_scoped_cf70a212_lang.css +1 -0
  14. package/dist/components/navigation/carousel.ce.vue_vue_type_style_index_0_scoped_03e729d7_lang.css +1 -0
  15. package/dist/components/utility/progress-group.ce.vue_vue_type_style_index_0_scoped_d4453504_lang.css +1 -0
  16. package/dist/components/utility/tag-group.ce.vue_vue_type_style_index_0_scoped_892954ad_lang.css +1 -0
  17. package/dist/kima-elements-core.js +9739 -9684
  18. package/dist/kima-elements.js +11180 -11079
  19. package/dist/style.css +16 -16
  20. package/dist/styles/carousel.css +1 -1
  21. package/dist/styles/core.css +5 -5
  22. package/dist/styles/dynamic-input.css +1 -1
  23. package/dist/styles/editable.css +1 -1
  24. package/dist/styles/field.css +1 -1
  25. package/dist/styles/file-upload.css +1 -1
  26. package/dist/styles/list.css +1 -1
  27. package/dist/styles/multi-select.css +1 -1
  28. package/dist/styles/progress-group.css +1 -1
  29. package/dist/styles/skeleton.css +1 -1
  30. package/dist/styles/table.css +1 -1
  31. package/dist/styles/tag-group.css +1 -1
  32. package/dist/styles/tags-input.css +1 -1
  33. package/dist/styles/text-field.css +1 -1
  34. package/dist/styles/textarea.css +1 -1
  35. package/dist/styles/timeline.css +1 -1
  36. package/dist/styles/upload-manager.css +2 -2
  37. package/dist/vue/components/advanced-input/editable.ce.js +70 -69
  38. package/dist/vue/components/core/text-field.ce.js +66 -65
  39. package/dist/vue/components/data/table.ce.js +230 -232
  40. package/dist/vue/components/display/list.ce.js +28 -22
  41. package/dist/vue/components/display/skeleton.ce.js +27 -20
  42. package/dist/vue/components/display/timeline.ce.js +33 -25
  43. package/dist/vue/components/form-completion/dynamic-input.ce.js +75 -68
  44. package/dist/vue/components/form-completion/upload-manager.ce.js +91 -82
  45. package/dist/vue/components/input/field.ce.js +25 -23
  46. package/dist/vue/components/input/file-upload.ce.js +70 -64
  47. package/dist/vue/components/input/tags-input.ce.js +62 -56
  48. package/dist/vue/components/input/textarea.ce.js +36 -35
  49. package/dist/vue/components/interaction/multi-select.ce.js +95 -90
  50. package/dist/vue/components/navigation/carousel.ce.js +1 -1
  51. package/dist/vue/components/utility/progress-group.ce.js +26 -22
  52. package/dist/vue/components/utility/tag-group.ce.js +51 -45
  53. package/dist/vue/utils/content-motion.js +63 -28
  54. package/dist/vue/utils/motion.js +32 -17
  55. package/package.json +1 -1
  56. package/dist/components/advanced-input/editable.ce.vue_vue_type_style_index_0_scoped_91cd5b33_lang.css +0 -1
  57. package/dist/components/data/table.ce.vue_vue_type_style_index_0_scoped_44836eb1_lang.css +0 -1
  58. package/dist/components/display/list.ce.vue_vue_type_style_index_0_scoped_1c170b37_lang.css +0 -1
  59. package/dist/components/display/skeleton.ce.vue_vue_type_style_index_0_scoped_d9a7d212_lang.css +0 -1
  60. package/dist/components/display/timeline.ce.vue_vue_type_style_index_0_scoped_ff6a1726_lang.css +0 -1
  61. package/dist/components/form-completion/dynamic-input.ce.vue_vue_type_style_index_0_scoped_5913d05a_lang.css +0 -1
  62. package/dist/components/form-completion/upload-manager.ce.vue_vue_type_style_index_0_scoped_5d214e0f_lang.css +0 -1
  63. package/dist/components/input/field.ce.vue_vue_type_style_index_0_scoped_f2ce3fc2_lang.css +0 -1
  64. package/dist/components/input/tags-input.ce.vue_vue_type_style_index_0_scoped_7a178bc6_lang.css +0 -1
  65. package/dist/components/input/textarea.ce.vue_vue_type_style_index_0_scoped_c0cc3612_lang.css +0 -1
  66. package/dist/components/interaction/multi-select.ce.vue_vue_type_style_index_0_scoped_b5be8e98_lang.css +0 -1
  67. package/dist/components/navigation/carousel.ce.vue_vue_type_style_index_0_scoped_6a7ca57f_lang.css +0 -1
  68. package/dist/components/utility/progress-group.ce.vue_vue_type_style_index_0_scoped_681cf67d_lang.css +0 -1
  69. package/dist/components/utility/tag-group.ce.vue_vue_type_style_index_0_scoped_3d44ac1c_lang.css +0 -1
@@ -1,11 +1,12 @@
1
1
  import e from "../../_virtual/_plugin-vue_export-helper.js";
2
2
  import t from "../core/button.ce.js";
3
- import { presenceTransition as n } from "../../utils/motion.js";
4
- import r from "../input/file-upload.ce.js";
3
+ import { freezeLeaveLayout as n, presenceTransition as r } from "../../utils/motion.js";
4
+ import { useContentMotion as i } from "../../utils/content-motion.js";
5
+ import a from "../input/file-upload.ce.js";
5
6
  /* empty css */
6
- import { Fragment as i, TransitionGroup as a, computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createTextVNode as d, createVNode as f, mergeProps as p, onBeforeUnmount as m, openBlock as h, ref as g, renderList as _, toDisplayString as v, unref as y, watch as b, withCtx as x } from "vue";
7
+ import { Fragment as o, TransitionGroup as s, computed as c, createBlock as l, createCommentVNode as u, createElementBlock as d, createElementVNode as f, createTextVNode as p, createVNode as m, mergeProps as h, onBeforeUnmount as g, openBlock as _, ref as v, renderList as y, toDisplayString as b, unref as x, watch as S, withCtx as C } from "vue";
7
8
  // src/components/form-completion/upload-manager.ce.vue
8
- var S = ["aria-disabled"], C = { class: "kima-upload-manager__info" }, w = ["value", "aria-label"], T = { role: "status" }, E = { class: "kima-upload-manager__actions" }, D = /*#__PURE__*/ e({
9
+ var w = ["aria-disabled"], T = { class: "kima-upload-manager__info" }, E = ["value", "aria-label"], D = { role: "status" }, O = { class: "kima-upload-manager__actions" }, k = /*#__PURE__*/ e({
9
10
  __name: "upload-manager.ce",
10
11
  props: {
11
12
  modelValue: {
@@ -36,21 +37,24 @@ var S = ["aria-disabled"], C = { class: "kima-upload-manager__info" }, w = ["val
36
37
  "error",
37
38
  "cancel"
38
39
  ],
39
- setup(e, { expose: D, emit: O }) {
40
- let k = e, A = O, j = 0, M = g([]), N = /* @__PURE__ */ new Map(), P = o(() => M.value.filter((e) => e.status === "queued"));
41
- function F(e) {
40
+ setup(e, { expose: k, emit: A }) {
41
+ let j = e, M = A, N = 0, P = v([]), F = /* @__PURE__ */ new Map();
42
+ v(null);
43
+ let I = v(null), L = c(() => P.value.filter((e) => e.status === "queued"));
44
+ i(I, () => P.value);
45
+ function R(e) {
42
46
  let t = [...e].map((e) => ({
43
- id: ++j,
47
+ id: ++N,
44
48
  file: e,
45
49
  status: "queued",
46
50
  progress: 0,
47
51
  error: "",
48
52
  result: null
49
53
  }));
50
- M.value = [...M.value, ...t], I(), R();
54
+ P.value = [...P.value, ...t], z(), V();
51
55
  }
52
- function I() {
53
- let e = M.value.map(({ id: e, file: t, status: n, progress: r, error: i, result: a }) => ({
56
+ function z() {
57
+ let e = P.value.map(({ id: e, file: t, status: n, progress: r, error: i, result: a }) => ({
54
58
  id: e,
55
59
  file: t,
56
60
  status: n,
@@ -58,157 +62,162 @@ var S = ["aria-disabled"], C = { class: "kima-upload-manager__info" }, w = ["val
58
62
  error: i,
59
63
  result: a
60
64
  }));
61
- A("update:modelValue", e), A("change", e);
65
+ M("update:modelValue", e), M("change", e);
62
66
  }
63
- function L(e, t) {
64
- Object.assign(e, t), I();
67
+ function B(e, t) {
68
+ Object.assign(e, t), z();
65
69
  }
66
- function R() {
67
- for (; N.size < Math.max(1, Math.floor(k.concurrency)) && P.value.length;) {
68
- let e = P.value[0];
69
- z(e);
70
+ function V() {
71
+ for (; F.size < Math.max(1, Math.floor(j.concurrency)) && L.value.length;) {
72
+ let e = L.value[0];
73
+ H(e);
70
74
  }
71
75
  }
72
- async function z(e) {
73
- if (typeof k.upload != "function") {
74
- L(e, {
76
+ async function H(e) {
77
+ if (typeof j.upload != "function") {
78
+ B(e, {
75
79
  status: "error",
76
80
  error: "缺少 upload(file, { signal, onProgress }) 宿主处理函数"
77
- }), A("error", {
81
+ }), M("error", {
78
82
  task: e,
79
83
  error: Error(e.error)
80
84
  });
81
85
  return;
82
86
  }
83
87
  let t = new AbortController();
84
- N.set(e.id, t), L(e, {
88
+ F.set(e.id, t), B(e, {
85
89
  status: "uploading",
86
90
  error: "",
87
91
  progress: 0
88
92
  });
89
93
  try {
90
- let n = await k.upload(e.file, {
94
+ let n = await j.upload(e.file, {
91
95
  signal: t.signal,
92
96
  onProgress: (n) => {
93
- if (N.get(e.id) !== t) return;
97
+ if (F.get(e.id) !== t) return;
94
98
  let r = Math.max(0, Math.min(100, Number(n) || 0));
95
- e.progress = r, A("progress", {
99
+ e.progress = r, M("progress", {
96
100
  task: e,
97
101
  file: e.file,
98
102
  progress: r
99
- }), I();
103
+ }), z();
100
104
  }
101
105
  });
102
- if (N.get(e.id) !== t) return;
103
- L(e, {
106
+ if (F.get(e.id) !== t) return;
107
+ B(e, {
104
108
  status: "success",
105
109
  progress: 100,
106
110
  result: n
107
- }), A("success", {
111
+ }), M("success", {
108
112
  task: e,
109
113
  result: n
110
114
  });
111
115
  } catch (n) {
112
- if (N.get(e.id) !== t) return;
113
- t.signal.aborted ? (L(e, { status: "cancelled" }), A("cancel", e)) : (L(e, {
116
+ if (F.get(e.id) !== t) return;
117
+ t.signal.aborted ? (B(e, { status: "cancelled" }), M("cancel", e)) : (B(e, {
114
118
  status: "error",
115
119
  error: n?.message || String(n)
116
- }), A("error", {
120
+ }), M("error", {
117
121
  task: e,
118
122
  error: n
119
123
  }));
120
124
  } finally {
121
- N.get(e.id) === t && N.delete(e.id), R();
125
+ F.get(e.id) === t && F.delete(e.id), V();
122
126
  }
123
127
  }
124
- function B(e) {
125
- if (e.status === "queued") L(e, { status: "cancelled" }), A("cancel", e);
128
+ function U(e) {
129
+ if (e.status === "queued") B(e, { status: "cancelled" }), M("cancel", e);
126
130
  else if (e.status === "uploading") {
127
- let t = N.get(e.id);
131
+ let t = F.get(e.id);
128
132
  if (!t) return;
129
- N.delete(e.id), t.abort(), L(e, { status: "cancelled" }), A("cancel", e), R();
133
+ F.delete(e.id), t.abort(), B(e, { status: "cancelled" }), M("cancel", e), V();
130
134
  }
131
135
  }
132
- function V(e) {
133
- (e.status === "error" || e.status === "cancelled") && (L(e, {
136
+ function W(e) {
137
+ (e.status === "error" || e.status === "cancelled") && (B(e, {
134
138
  status: "queued",
135
139
  progress: 0,
136
140
  error: "",
137
141
  result: null
138
- }), R());
142
+ }), V());
139
143
  }
140
- function H(e) {
141
- B(e), M.value = M.value.filter((t) => t.id !== e.id), I();
144
+ function G(e) {
145
+ U(e), P.value = P.value.filter((t) => t.id !== e.id), z();
142
146
  }
143
- return b(() => k.modelValue, (e) => {
144
- Array.isArray(e) && e.length && !M.value.length && (M.value = e.map((e) => ({
147
+ return S(() => j.modelValue, (e) => {
148
+ Array.isArray(e) && e.length && !P.value.length && (P.value = e.map((e) => ({
145
149
  ...e,
146
- id: e.id || ++j
150
+ id: e.id || ++N
147
151
  })));
148
- }), m(() => {
149
- for (let e of N.values()) e.abort();
150
- N.clear();
151
- }), D({
152
- add: F,
153
- cancel: B,
154
- retry: V,
155
- remove: H,
156
- tasks: M,
157
- pump: R
158
- }), (o, m) => (h(), l("section", {
152
+ }), g(() => {
153
+ for (let e of F.values()) e.abort();
154
+ F.clear();
155
+ }), k({
156
+ add: R,
157
+ cancel: U,
158
+ retry: W,
159
+ remove: G,
160
+ tasks: P,
161
+ pump: V
162
+ }), (i, c) => (_(), d("section", {
163
+ ref_key: "root",
164
+ ref: I,
159
165
  class: "kima-upload-manager",
160
166
  "aria-disabled": e.disabled || void 0
161
- }, [f(r, {
162
- "model-value": M.value.map((e) => e.file),
167
+ }, [m(a, {
168
+ "model-value": P.value.map((e) => e.file),
163
169
  label: e.label,
164
170
  accept: e.accept,
165
171
  multiple: e.multiple,
166
172
  disabled: e.disabled,
167
- "onUpdate:modelValue": m[0] ||= (e) => F(e.slice(M.value.filter((e) => e.status !== "cancelled").length))
173
+ "onUpdate:modelValue": c[0] ||= (e) => R(e.slice(P.value.filter((e) => e.status !== "cancelled").length))
168
174
  }, null, 8, [
169
175
  "model-value",
170
176
  "label",
171
177
  "accept",
172
178
  "multiple",
173
179
  "disabled"
174
- ]), f(a, p({
180
+ ]), m(s, h({
175
181
  tag: "ul",
176
182
  name: "kima-list"
177
- }, y(n), { class: "kima-upload-manager__list" }), {
178
- default: x(() => [(h(!0), l(i, null, _(M.value, (n) => (h(), l("li", { key: n.id }, [u("div", C, [
179
- u("strong", null, v(n.file.name), 1),
180
- u("progress", {
183
+ }, {
184
+ ...x(r),
185
+ onBeforeLeave: x(n)
186
+ }, { class: "kima-upload-manager__list" }), {
187
+ default: C(() => [(_(!0), d(o, null, y(P.value, (n) => (_(), d("li", { key: n.id }, [f("div", T, [
188
+ f("strong", null, b(n.file.name), 1),
189
+ f("progress", {
181
190
  max: "100",
182
191
  value: n.progress,
183
192
  "aria-label": `${n.file.name}上传进度`
184
- }, null, 8, w),
185
- u("span", T, v(n.status === "queued" ? "等待中" : n.status === "uploading" ? `${n.progress}%` : n.status === "success" ? "已完成" : n.status === "cancelled" ? "已取消" : n.error), 1)
186
- ]), u("div", E, [
187
- n.status === "uploading" || n.status === "queued" ? (h(), s(t, {
193
+ }, null, 8, E),
194
+ f("span", D, b(n.status === "queued" ? "等待中" : n.status === "uploading" ? `${n.progress}%` : n.status === "success" ? "已完成" : n.status === "cancelled" ? "已取消" : n.error), 1)
195
+ ]), f("div", O, [
196
+ n.status === "uploading" || n.status === "queued" ? (_(), l(t, {
188
197
  key: 0,
189
198
  variant: "text",
190
199
  disabled: e.disabled,
191
- onClick: (e) => B(n)
200
+ onClick: (e) => U(n)
192
201
  }, {
193
- default: x(() => [...m[1] ||= [d("取消", -1)]]),
202
+ default: C(() => [...c[1] ||= [p("取消", -1)]]),
194
203
  _: 1
195
- }, 8, ["disabled", "onClick"])) : c("", !0),
196
- n.status === "error" || n.status === "cancelled" ? (h(), s(t, {
204
+ }, 8, ["disabled", "onClick"])) : u("", !0),
205
+ n.status === "error" || n.status === "cancelled" ? (_(), l(t, {
197
206
  key: 1,
198
207
  variant: "text",
199
208
  disabled: e.disabled,
200
- onClick: (e) => V(n)
209
+ onClick: (e) => W(n)
201
210
  }, {
202
- default: x(() => [...m[2] ||= [d("重试", -1)]]),
211
+ default: C(() => [...c[2] ||= [p("重试", -1)]]),
203
212
  _: 1
204
- }, 8, ["disabled", "onClick"])) : c("", !0),
205
- f(t, {
213
+ }, 8, ["disabled", "onClick"])) : u("", !0),
214
+ m(t, {
206
215
  variant: "text",
207
216
  disabled: e.disabled,
208
217
  "aria-label": `移除 ${n.file.name}`,
209
- onClick: (e) => H(n)
218
+ onClick: (e) => G(n)
210
219
  }, {
211
- default: x(() => [...m[3] ||= [d("移除", -1)]]),
220
+ default: C(() => [...c[3] ||= [p("移除", -1)]]),
212
221
  _: 1
213
222
  }, 8, [
214
223
  "disabled",
@@ -217,7 +226,7 @@ var S = ["aria-disabled"], C = { class: "kima-upload-manager__info" }, w = ["val
217
226
  ])
218
227
  ])]))), 128))]),
219
228
  _: 1
220
- }, 16)], 8, S));
229
+ }, 16)], 8, w));
221
230
  }
222
- }, [["__scopeId", "data-v-5d214e0f"]]);
223
- export { D as default };
231
+ }, [["__scopeId", "data-v-fe810c3a"]]);
232
+ export { k as default };
@@ -1,6 +1,7 @@
1
1
  import { useNativeSlots as e } from "../../utils/native-slots.js";
2
2
  import t from "../../_virtual/_plugin-vue_export-helper.js";
3
- import { collapseTransition as n, presenceTransition as r } from "../../utils/motion.js";
3
+ import { collapseTransition as n } from "../../utils/motion.js";
4
+ import { useContentMotion as r } from "../../utils/content-motion.js";
4
5
  /* empty css */
5
6
  import { Transition as i, computed as a, createElementBlock as o, createElementVNode as s, createVNode as c, mergeProps as l, onBeforeUnmount as u, onMounted as d, openBlock as f, ref as p, renderSlot as m, toDisplayString as h, unref as g, useId as _, vShow as v, watch as y, withCtx as b, withDirectives as x } from "vue";
6
7
  // src/components/input/field.ce.vue
@@ -19,56 +20,57 @@ var S = ["inert", "aria-hidden"], C = ["role"], w = /*#__PURE__*/ t({
19
20
  setup(t) {
20
21
  let w = t, T = p(null);
21
22
  e(T);
22
- let E = `kima-field-${_()}`, D = a(() => w.error || w.hint), O = p(D.value), k = p(!!w.error);
23
+ let E = `kima-field-${_()}`, D = a(() => w.error || w.hint), O = p(null);
24
+ r(O, () => [D.value, !!w.error]);
25
+ let k = p(D.value), A = p(!!w.error);
23
26
  y([D, () => w.error], ([e, t]) => {
24
- e && (O.value = e, k.value = !!t);
27
+ e && (k.value = e, A.value = !!t);
25
28
  });
26
- let A = /* @__PURE__ */ new Set(), j = /* @__PURE__ */ new Set(), M;
27
- function N() {
29
+ let j = /* @__PURE__ */ new Set(), M = /* @__PURE__ */ new Set(), N;
30
+ function P() {
28
31
  return [...T.value.querySelectorAll("input:not([type=\"hidden\"]),textarea,select,button[role=\"combobox\"],[role=\"radiogroup\"]")].filter((e) => e.closest(".kima-field") === T.value);
29
32
  }
30
- function P() {
31
- if (T.value) for (let e of N()) {
33
+ function F() {
34
+ if (T.value) for (let e of P()) {
32
35
  let t = (e.getAttribute("aria-describedby") || "").split(/\s+/).filter(Boolean).filter((e) => e !== E);
33
- D.value && (t.push(E), j.add(e));
36
+ D.value && (t.push(E), M.add(e));
34
37
  let n = t.join(" ");
35
- (e.getAttribute("aria-describedby") || "") !== n && (n ? e.setAttribute("aria-describedby", n) : e.removeAttribute("aria-describedby")), w.error && !e.hasAttribute("aria-invalid") && (e.setAttribute("aria-invalid", "true"), A.add(e)), !w.error && A.has(e) && (e.removeAttribute("aria-invalid"), A.delete(e));
38
+ (e.getAttribute("aria-describedby") || "") !== n && (n ? e.setAttribute("aria-describedby", n) : e.removeAttribute("aria-describedby")), w.error && !e.hasAttribute("aria-invalid") && (e.setAttribute("aria-invalid", "true"), j.add(e)), !w.error && j.has(e) && (e.removeAttribute("aria-invalid"), j.delete(e));
36
39
  }
37
40
  }
38
- return y(D, P, { flush: "post" }), y(() => w.error, P, { flush: "post" }), d(() => {
39
- P(), M = new MutationObserver(P), M.observe(T.value, {
41
+ return y(D, F, { flush: "post" }), y(() => w.error, F, { flush: "post" }), d(() => {
42
+ F(), N = new MutationObserver(F), N.observe(T.value, {
40
43
  childList: !0,
41
44
  subtree: !0,
42
45
  attributes: !0,
43
46
  attributeFilter: ["aria-describedby", "aria-invalid"]
44
47
  });
45
48
  }), u(() => {
46
- M?.disconnect();
47
- for (let e of j) {
49
+ N?.disconnect();
50
+ for (let e of M) {
48
51
  let t = (e.getAttribute("aria-describedby") || "").split(/\s+/).filter((e) => e && e !== E);
49
52
  t.length ? e.setAttribute("aria-describedby", t.join(" ")) : e.removeAttribute("aria-describedby");
50
53
  }
51
- for (let e of A) e.removeAttribute("aria-invalid");
54
+ for (let e of j) e.removeAttribute("aria-invalid");
52
55
  }), (e, t) => (f(), o("div", {
53
56
  ref_key: "root",
54
57
  ref: T,
55
58
  class: "kima-field"
56
59
  }, [m(e.$slots, "default", {}, void 0, !0), c(i, l({ css: !1 }, g(n)), {
57
60
  default: b(() => [x(s("div", {
61
+ ref_key: "messageWrap",
62
+ ref: O,
58
63
  id: E,
59
64
  class: "kima-field__messages",
60
65
  inert: !D.value,
61
66
  "aria-hidden": !D.value || void 0
62
- }, [c(i, l({ name: "kima-content" }, g(r)), {
63
- default: b(() => [(f(), o("p", {
64
- key: `${k.value}:${O.value}`,
65
- class: "kima-field__message",
66
- role: k.value ? "alert" : void 0
67
- }, h(O.value), 9, C))]),
68
- _: 1
69
- }, 16)], 8, S), [[v, D.value]])]),
67
+ }, [(f(), o("p", {
68
+ key: `${A.value}:${k.value}`,
69
+ class: "kima-field__message",
70
+ role: A.value ? "alert" : void 0
71
+ }, h(k.value), 9, C))], 8, S), [[v, D.value]])]),
70
72
  _: 1
71
73
  }, 16)], 512));
72
74
  }
73
- }, [["__scopeId", "data-v-f2ce3fc2"]]);
75
+ }, [["__scopeId", "data-v-a01eded5"]]);
74
76
  export { w as default };
@@ -1,21 +1,22 @@
1
1
  import { useRipple as e } from "../../utils/ripple.js";
2
2
  import t from "../../_virtual/_plugin-vue_export-helper.js";
3
- import { collapseTransition as n, presenceTransition as r } from "../../utils/motion.js";
4
- import { useInputAttrs as i, useInputState as a } from "../../utils/input-state.js";
5
- import o from "../core/icon-button.ce.js";
6
- import s from "../core/tooltip.ce.js";
3
+ import { collapseTransition as n, freezeLeaveLayout as r, presenceTransition as i } from "../../utils/motion.js";
4
+ import { useInputAttrs as a, useInputState as o } from "../../utils/input-state.js";
5
+ import s from "../core/icon-button.ce.js";
6
+ import c from "../core/tooltip.ce.js";
7
+ import { useContentMotion as l } from "../../utils/content-motion.js";
7
8
  /* empty css */
8
- import { Fragment as c, Transition as l, TransitionGroup as u, createElementBlock as d, createElementVNode as f, createVNode as p, mergeProps as m, nextTick as h, normalizeClass as g, normalizeStyle as _, openBlock as v, ref as y, renderList as b, toDisplayString as x, toRaw as S, unref as C, vShow as w, watch as T, withCtx as E, withDirectives as D, withModifiers as O } from "vue";
9
- import { Cancel01Icon as k } from "@hugeicons/core-free-icons";
9
+ import { Fragment as u, Transition as d, TransitionGroup as f, createElementBlock as p, createElementVNode as m, createVNode as h, mergeProps as g, nextTick as _, normalizeClass as v, normalizeStyle as y, openBlock as b, ref as x, renderList as S, toDisplayString as C, toRaw as w, unref as T, vShow as E, watch as D, withCtx as O, withDirectives as k, withModifiers as A } from "vue";
10
+ import { Cancel01Icon as j } from "@hugeicons/core-free-icons";
10
11
  // src/components/input/file-upload.ce.vue
11
- var A = ["aria-disabled"], j = ["aria-disabled"], M = [
12
+ var M = ["aria-disabled"], N = ["aria-disabled"], P = [
12
13
  "aria-label",
13
14
  "name",
14
15
  "accept",
15
16
  "multiple",
16
17
  "disabled",
17
18
  "required"
18
- ], N = ["inert", "aria-hidden"], P = { class: "kima-file-upload__filename" }, F = /*#__PURE__*/ t(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
19
+ ], F = ["inert", "aria-hidden"], I = { class: "kima-file-upload__filename" }, L = /*#__PURE__*/ t(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
19
20
  __name: "file-upload.ce",
20
21
  props: {
21
22
  modelValue: {
@@ -45,92 +46,97 @@ var A = ["aria-disabled"], j = ["aria-disabled"], M = [
45
46
  "change",
46
47
  "reject"
47
48
  ],
48
- setup(t, { emit: F }) {
49
- let I = t, L = F, R = y(null), z = y(null), B = y(!1), { attrs: V, controlAttrs: H } = i(), { local: U, update: W } = a(I, L, R, (e) => Array.isArray(e) ? e : [], () => h(G));
50
- e(R);
51
- function G() {
52
- if (!z.value) return;
49
+ setup(t, { emit: L }) {
50
+ let R = t, z = L, B = x(null), V = x(null), H = x(!1), { attrs: U, controlAttrs: W } = a(), { local: G, update: K } = o(R, z, B, (e) => Array.isArray(e) ? e : [], () => _(J)), q = x(null);
51
+ l(B, () => G.value), e(B);
52
+ function J() {
53
+ if (!V.value) return;
53
54
  let e = new DataTransfer();
54
- for (let t of U.value) t instanceof File && e.items.add(t);
55
- z.value.files = e.files;
55
+ for (let t of G.value) t instanceof File && e.items.add(t);
56
+ V.value.files = e.files;
56
57
  }
57
- T(U, () => h(G), {
58
+ D(G, () => _(J), {
58
59
  immediate: !0,
59
60
  deep: !0
60
61
  });
61
- function K(e) {
62
- return !I.accept || I.accept.split(",").some((t) => {
62
+ function Y(e) {
63
+ return !R.accept || R.accept.split(",").some((t) => {
63
64
  let n = t.trim().toLowerCase();
64
65
  return n ? n.startsWith(".") ? e.name.toLowerCase().endsWith(n) : n.endsWith("/*") ? e.type.toLowerCase().startsWith(n.slice(0, -1)) : e.type.toLowerCase() === n : !1;
65
66
  });
66
67
  }
67
- function q(e) {
68
- if (I.disabled) return;
69
- let t = [], n = Math.max(0, I.multiple ? I.maxFiles : Math.min(1, I.maxFiles));
68
+ function X(e) {
69
+ if (R.disabled) return;
70
+ let t = [], n = Math.max(0, R.multiple ? R.maxFiles : Math.min(1, R.maxFiles));
70
71
  for (let r of e) {
71
- let e = K(r) ? r.size > I.maxSize ? "size" : t.length >= n ? "count" : "" : "accept";
72
- e ? L("reject", {
72
+ let e = Y(r) ? r.size > R.maxSize ? "size" : t.length >= n ? "count" : "" : "accept";
73
+ e ? z("reject", {
73
74
  file: r,
74
75
  reason: e
75
76
  }) : t.push(r);
76
77
  }
77
- W(t), h(G);
78
+ K(t), _(J);
78
79
  }
79
- function J(e) {
80
- B.value = !1, q([...e.dataTransfer.files]);
80
+ function Z(e) {
81
+ H.value = !1, X([...e.dataTransfer.files]);
81
82
  }
82
- function Y(e) {
83
- I.disabled || W(U.value.filter((t, n) => n !== e));
83
+ function Q(e) {
84
+ R.disabled || K(G.value.filter((t, n) => n !== e));
84
85
  }
85
- let X = /* @__PURE__ */ new WeakMap(), Z = 0;
86
- function Q(e, t) {
87
- let n = S(e);
88
- X.has(n) || X.set(n, ++Z);
89
- let r = U.value.slice(0, t).filter((e) => S(e) === n).length;
90
- return `${X.get(n)}-${r}`;
86
+ let $ = /* @__PURE__ */ new WeakMap(), ee = 0;
87
+ function te(e, t) {
88
+ let n = w(e);
89
+ $.has(n) || $.set(n, ++ee);
90
+ let r = G.value.slice(0, t).filter((e) => w(e) === n).length;
91
+ return `${$.get(n)}-${r}`;
91
92
  }
92
- return (e, i) => (v(), d("div", {
93
- class: g(["kima-file-upload", C(V).class]),
94
- style: _(C(V).style),
95
- "aria-disabled": t.disabled || void 0
96
- }, [f("div", {
93
+ return (e, a) => (b(), p("div", {
97
94
  ref_key: "root",
98
- ref: R,
99
- class: g(["kima-file-upload__drop", { "kima-file-upload__drop--active": B.value && !t.disabled }]),
95
+ ref: B,
96
+ class: v(["kima-file-upload", T(U).class]),
97
+ style: y(T(U).style),
98
+ "aria-disabled": t.disabled || void 0
99
+ }, [m("div", {
100
+ class: v(["kima-file-upload__drop", { "kima-file-upload__drop--active": H.value && !t.disabled }]),
100
101
  "aria-disabled": t.disabled || void 0,
101
- onDragover: i[2] ||= O((e) => B.value = !0, ["prevent"]),
102
- onDragleave: i[3] ||= O((e) => B.value = !1, ["prevent"]),
103
- onDrop: O(J, ["prevent"])
104
- }, [f("input", m({
102
+ onDragover: a[2] ||= A((e) => H.value = !0, ["prevent"]),
103
+ onDragleave: a[3] ||= A((e) => H.value = !1, ["prevent"]),
104
+ onDrop: A(Z, ["prevent"])
105
+ }, [m("input", g({
105
106
  ref_key: "input",
106
- ref: z
107
- }, C(H), {
107
+ ref: V
108
+ }, T(W), {
108
109
  type: "file",
109
- "aria-label": C(H)["aria-label"] || t.label,
110
+ "aria-label": T(W)["aria-label"] || t.label,
110
111
  name: t.name,
111
112
  accept: t.accept,
112
113
  multiple: t.multiple,
113
114
  disabled: t.disabled,
114
115
  required: t.required,
115
- onInput: i[0] ||= O(() => {}, ["stop"]),
116
- onChange: i[1] ||= O((e) => q([...e.target.files]), ["stop"])
117
- }), null, 16, M), f("p", null, x(t.label), 1)], 42, j), p(l, m({ css: !1 }, C(n)), {
118
- default: E(() => [D(f("div", {
119
- inert: !C(U).length,
120
- "aria-hidden": !C(U).length || void 0
121
- }, [p(u, m({
116
+ onInput: a[0] ||= A(() => {}, ["stop"]),
117
+ onChange: a[1] ||= A((e) => X([...e.target.files]), ["stop"])
118
+ }), null, 16, P), m("p", null, C(t.label), 1)], 42, N), h(d, g({ css: !1 }, T(n)), {
119
+ default: O(() => [k(m("div", {
120
+ inert: !T(G).length,
121
+ "aria-hidden": !T(G).length || void 0
122
+ }, [h(f, g({
123
+ ref_key: "fileList",
124
+ ref: q,
122
125
  tag: "ul",
123
126
  name: "kima-list"
124
- }, C(r), { class: "kima-file-upload__files" }), {
125
- default: E(() => [(v(!0), d(c, null, b(C(U), (e, n) => (v(), d("li", { key: Q(e, n) }, [f("span", P, x(e.name) + " · " + x(e.size) + " B", 1), p(s, {
127
+ }, {
128
+ ...T(i),
129
+ onBeforeLeave: T(r)
130
+ }, { class: "kima-file-upload__files" }), {
131
+ default: O(() => [(b(!0), p(u, null, S(T(G), (e, n) => (b(), p("li", { key: te(e, n) }, [m("span", I, C(e.name) + " · " + C(e.size) + " B", 1), h(c, {
126
132
  text: "移除文件",
127
133
  position: "left"
128
134
  }, {
129
- default: E(() => [p(o, {
130
- icon: C(k),
135
+ default: O(() => [h(s, {
136
+ icon: T(j),
131
137
  disabled: t.disabled,
132
138
  label: `移除 ${e.name}`,
133
- onClick: (e) => Y(n)
139
+ onClick: (e) => Q(n)
134
140
  }, null, 8, [
135
141
  "icon",
136
142
  "disabled",
@@ -140,9 +146,9 @@ var A = ["aria-disabled"], j = ["aria-disabled"], M = [
140
146
  _: 2
141
147
  }, 1024)]))), 128))]),
142
148
  _: 1
143
- }, 16)], 8, N), [[w, C(U).length]])]),
149
+ }, 16)], 8, F), [[E, T(G).length]])]),
144
150
  _: 1
145
- }, 16)], 14, A));
151
+ }, 16)], 14, M));
146
152
  }
147
- }), [["__scopeId", "data-v-1568bdab"]]);
148
- export { F as default };
153
+ }), [["__scopeId", "data-v-8fd77a68"]]);
154
+ export { L as default };