@kernel4632/kima 0.8.5 → 0.8.6

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,16 +1,17 @@
1
1
  import { useNativeSlots as e } from "../../utils/native-slots.js";
2
2
  import t from "../../_virtual/_plugin-vue_export-helper.js";
3
- import { presenceTransition as n } from "../../utils/motion.js";
3
+ import { freezeLeaveLayout as n, presenceTransition as r } from "../../utils/motion.js";
4
+ import { useContentMotion as i } from "../../utils/content-motion.js";
4
5
  /* empty css */
5
- import { Fragment as r, TransitionGroup as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createVNode as l, mergeProps as u, openBlock as d, ref as f, renderList as p, renderSlot as m, resolveDynamicComponent as h, toDisplayString as g, toRaw as _, unref as v, useAttrs as y, withCtx as b } from "vue";
6
+ import { Fragment as a, TransitionGroup as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createVNode as d, mergeProps as f, openBlock as p, ref as m, renderList as h, renderSlot as g, resolveDynamicComponent as _, toDisplayString as v, toRaw as y, unref as b, useAttrs as x, withCtx as S } from "vue";
6
7
  // src/components/display/list.ce.vue
7
- var x = { class: "kima-list__body" }, S = { key: 0 }, C = {
8
+ var C = { class: "kima-list__body" }, w = { key: 0 }, T = {
8
9
  key: 0,
9
10
  class: "kima-list__action"
10
- }, w = {
11
+ }, E = {
11
12
  key: "empty",
12
13
  class: "kima-list__empty"
13
- }, T = /*#__PURE__*/ t(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
14
+ }, D = /*#__PURE__*/ t(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
14
15
  __name: "list.ce",
15
16
  props: {
16
17
  items: {
@@ -36,38 +37,43 @@ var x = { class: "kima-list__body" }, S = { key: 0 }, C = {
36
37
  }
37
38
  },
38
39
  setup(t) {
39
- let T = t, E = y(), D = f(null), { isCustomElement: O, hasNativeSlot: k } = e(D), A = /* @__PURE__ */ new WeakMap(), j = 0;
40
- function M(e, t) {
40
+ let D = t, O = x(), k = m(null), { isCustomElement: A, hasNativeSlot: j } = e(k);
41
+ i(k, () => D.items);
42
+ let M = /* @__PURE__ */ new WeakMap(), N = 0;
43
+ function P(e, t) {
41
44
  let n;
42
45
  if (typeof e == "object" && e) {
43
- let t = _(e);
44
- t.id == null ? (A.has(t) || A.set(t, ++j), n = `object:${A.get(t)}`) : n = `id:${typeof t.id}:${t.id}`;
46
+ let t = y(e);
47
+ t.id == null ? (M.has(t) || M.set(t, ++N), n = `object:${M.get(t)}`) : n = `id:${typeof t.id}:${t.id}`;
45
48
  } else n = `value:${typeof e}:${e}`;
46
- let r = T.items.slice(0, t).filter((t) => Object.is(_(t), _(e))).length;
49
+ let r = D.items.slice(0, t).filter((t) => Object.is(y(t), y(e))).length;
47
50
  return `${n}:${r}`;
48
51
  }
49
- return (e, f) => (d(), a(h(t.ordered ? "ol" : "ul"), u({
52
+ return (e, i) => (p(), s(_(t.ordered ? "ol" : "ul"), f({
50
53
  ref_key: "root",
51
- ref: D
54
+ ref: k
52
55
  }, {
53
- ...v(E),
54
- id: v(O) ? void 0 : v(E).id
56
+ ...b(O),
57
+ id: b(A) ? void 0 : b(O).id
55
58
  }, {
56
59
  class: ["kima-list", { "kima-list--plain": t.variant === "plain" }],
57
60
  style: { "--kima-list-gap": typeof t.gap == "number" ? `${t.gap}px` : t.gap || void 0 },
58
61
  "aria-label": t.label
59
62
  }), {
60
- default: b(() => [m(e.$slots, "default", {}, () => [l(i, u({ name: "kima-list" }, v(n)), {
61
- default: b(() => [(d(!0), s(r, null, p(t.items, (t, n) => (d(), s("li", {
62
- key: M(t, n),
63
+ default: S(() => [g(e.$slots, "default", {}, () => [d(o, f({ name: "kima-list" }, {
64
+ ...b(r),
65
+ onBeforeLeave: b(n)
66
+ }), {
67
+ default: S(() => [(p(!0), l(a, null, h(t.items, (t, n) => (p(), l("li", {
68
+ key: P(t, n),
63
69
  class: "kima-list__item"
64
- }, [m(e.$slots, "item", {
70
+ }, [g(e.$slots, "item", {
65
71
  item: t,
66
72
  index: n
67
- }, () => [c("div", x, [c("strong", null, g(typeof t == "object" && t ? t.title : t), 1), t?.description ? (d(), s("p", S, g(t.description), 1)) : o("", !0)]), e.$slots.action ? (d(), s("div", C, [m(e.$slots, "action", {
73
+ }, () => [u("div", C, [u("strong", null, v(typeof t == "object" && t ? t.title : t), 1), t?.description ? (p(), l("p", w, v(t.description), 1)) : c("", !0)]), e.$slots.action ? (p(), l("div", T, [g(e.$slots, "action", {
68
74
  item: t,
69
75
  index: n
70
- }, void 0, !0)])) : o("", !0)], !0)]))), 128)), !t.items.length && !v(k)("default") ? (d(), s("li", w, g(t.emptyText), 1)) : o("", !0)]),
76
+ }, void 0, !0)])) : c("", !0)], !0)]))), 128)), !t.items.length && !b(j)("default") ? (p(), l("li", E, v(t.emptyText), 1)) : c("", !0)]),
71
77
  _: 3
72
78
  }, 16)], !0)]),
73
79
  _: 3
@@ -77,5 +83,5 @@ var x = { class: "kima-list__body" }, S = { key: 0 }, C = {
77
83
  "aria-label"
78
84
  ]));
79
85
  }
80
- }), [["__scopeId", "data-v-1c170b37"]]);
81
- export { T as default };
86
+ }), [["__scopeId", "data-v-df3ec98f"]]);
87
+ export { D as default };
@@ -1,20 +1,21 @@
1
1
  import { useNativeSlots as e } from "../../utils/native-slots.js";
2
2
  import t from "../../_virtual/_plugin-vue_export-helper.js";
3
- import { presenceTransition as n } from "../../utils/motion.js";
3
+ import { freezeLeaveLayout as n, presenceTransition as r } from "../../utils/motion.js";
4
+ import { useContentMotion as i } from "../../utils/content-motion.js";
4
5
  /* empty css */
5
- import { Fragment as r, Transition as i, computed as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createVNode as l, mergeProps as u, openBlock as d, ref as f, renderList as p, renderSlot as m, unref as h, useAttrs as g, vShow as _, withCtx as v, withDirectives as y } from "vue";
6
+ import { Fragment as a, Transition as o, computed as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createVNode as d, mergeProps as f, openBlock as p, ref as m, renderList as h, renderSlot as g, unref as _, useAttrs as v, vShow as y, withCtx as b, withDirectives as x } from "vue";
6
7
  // src/components/display/skeleton.ce.vue
7
- var b = [
8
+ var S = [
8
9
  "aria-busy",
9
10
  "aria-label",
10
11
  "role"
11
- ], x = {
12
+ ], C = {
12
13
  class: "kima-skeleton__placeholder",
13
14
  "aria-hidden": "true"
14
- }, S = {
15
+ }, w = {
15
16
  key: 0,
16
17
  class: "kima-skeleton__avatar"
17
- }, C = { class: "kima-skeleton__lines" }, w = ["inert", "aria-hidden"], T = /*#__PURE__*/ t(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
18
+ }, T = { class: "kima-skeleton__lines" }, E = ["inert", "aria-hidden"], D = /*#__PURE__*/ t(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
18
19
  __name: "skeleton.ce",
19
20
  props: {
20
21
  loading: {
@@ -36,32 +37,38 @@ var b = [
36
37
  }
37
38
  },
38
39
  setup(t) {
39
- let T = t, E = g(), D = f(null), { isCustomElement: O } = e(D), k = a(() => Number.isFinite(T.rows) ? Math.min(50, Math.max(1, Math.floor(T.rows))) : 3);
40
- return (e, a) => (d(), s("div", u({
40
+ let D = t, O = v(), k = m(null), { isCustomElement: A } = e(k), j = s(() => Number.isFinite(D.rows) ? Math.min(50, Math.max(1, Math.floor(D.rows))) : 3);
41
+ return i(k, () => D.loading), (e, i) => (p(), l("div", f({
41
42
  ref_key: "root",
42
- ref: D
43
+ ref: k
43
44
  }, {
44
- ...h(E),
45
- id: h(O) ? void 0 : h(E).id
45
+ ..._(O),
46
+ id: _(A) ? void 0 : _(O).id
46
47
  }, {
47
48
  class: ["kima-skeleton", { "kima-skeleton--animated": t.animated && t.loading }],
48
49
  "aria-busy": t.loading || void 0,
49
50
  "aria-label": t.loading ? t.label : void 0,
50
51
  role: t.loading ? "status" : void 0
51
- }), [l(i, { name: "kima-fade" }, {
52
- default: v(() => [y(c("div", x, [t.avatar ? (d(), s("span", S)) : o("", !0), c("div", C, [(d(!0), s(r, null, p(k.value, (e) => (d(), s("span", {
52
+ }), [d(o, f({ name: "kima-fade" }, {
53
+ ..._(r),
54
+ onBeforeLeave: _(n)
55
+ }), {
56
+ default: b(() => [x(u("div", C, [t.avatar ? (p(), l("span", w)) : c("", !0), u("div", T, [(p(!0), l(a, null, h(j.value, (e) => (p(), l("span", {
53
57
  key: e,
54
58
  class: "kima-skeleton__line"
55
- }))), 128))])], 512), [[_, t.loading]])]),
59
+ }))), 128))])], 512), [[y, t.loading]])]),
56
60
  _: 1
57
- }), l(i, u({ name: "kima-fade" }, h(n)), {
58
- default: v(() => [y(c("div", {
61
+ }, 16), d(o, f({ name: "kima-fade" }, {
62
+ ..._(r),
63
+ onBeforeLeave: _(n)
64
+ }), {
65
+ default: b(() => [x(u("div", {
59
66
  class: "kima-skeleton__content",
60
67
  inert: t.loading,
61
68
  "aria-hidden": t.loading || void 0
62
- }, [m(e.$slots, "default", {}, void 0, !0)], 8, w), [[_, !t.loading]])]),
69
+ }, [g(e.$slots, "default", {}, void 0, !0)], 8, E), [[y, !t.loading]])]),
63
70
  _: 3
64
- }, 16)], 16, b));
71
+ }, 16)], 16, S));
65
72
  }
66
- }), [["__scopeId", "data-v-d9a7d212"]]);
67
- export { T as default };
73
+ }), [["__scopeId", "data-v-92807af5"]]);
74
+ export { D as default };
@@ -1,12 +1,13 @@
1
1
  import { useNativeSlots as e } from "../../utils/native-slots.js";
2
2
  import t from "../../_virtual/_plugin-vue_export-helper.js";
3
3
  import n from "../core/icon.ce.js";
4
- import { presenceTransition as r } from "../../utils/motion.js";
5
- import { displayStatus as i } from "../../utils/display-status.js";
4
+ import { freezeLeaveLayout as r, presenceTransition as i } from "../../utils/motion.js";
5
+ import { displayStatus as a } from "../../utils/display-status.js";
6
+ import { useContentMotion as o } from "../../utils/content-motion.js";
6
7
  /* empty css */
7
- import { Fragment as a, TransitionGroup as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createVNode as u, mergeProps as d, openBlock as f, ref as p, renderList as m, renderSlot as h, toDisplayString as g, unref as _, useAttrs as v, withCtx as y } from "vue";
8
+ import { Fragment as s, TransitionGroup as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createVNode as f, mergeProps as p, openBlock as m, ref as h, renderList as g, renderSlot as _, toDisplayString as v, unref as y, useAttrs as b, withCtx as x } from "vue";
8
9
  // src/components/display/timeline.ce.vue
9
- var b = ["aria-label"], x = ["data-variant"], S = ["aria-label"], C = { class: "kima-timeline__body" }, w = ["datetime"], T = { key: 1 }, E = /*#__PURE__*/ t(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
10
+ var S = ["aria-label"], C = ["data-variant"], w = ["aria-label"], T = { class: "kima-timeline__body" }, E = ["datetime"], D = { key: 1 }, O = /*#__PURE__*/ t(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
10
11
  __name: "timeline.ce",
11
12
  props: {
12
13
  items: {
@@ -19,41 +20,48 @@ var b = ["aria-label"], x = ["data-variant"], S = ["aria-label"], C = { class: "
19
20
  }
20
21
  },
21
22
  setup(t) {
22
- let E = v(), D = p(null), { isCustomElement: O } = e(D);
23
- return (e, p) => (f(), c("ol", d({
23
+ let O = t, k = b(), A = h(null), { isCustomElement: j } = e(A);
24
+ return o(A, () => O.items), (e, o) => (m(), u("ol", p({
24
25
  ref_key: "root",
25
- ref: D
26
+ ref: A
26
27
  }, {
27
- ..._(E),
28
- id: _(O) ? void 0 : _(E).id
28
+ ...y(k),
29
+ id: y(j) ? void 0 : y(k).id
29
30
  }, {
30
31
  class: "kima-timeline",
31
32
  "aria-label": t.label
32
- }), [h(e.$slots, "default", {}, () => [u(o, d({ name: "kima-list" }, _(r)), {
33
- default: y(() => [(f(!0), c(a, null, m(t.items, (t, r) => (f(), c("li", {
33
+ }), [f(c, p({
34
+ name: "kima-list",
35
+ tag: "div",
36
+ class: "kima-timeline__items"
37
+ }, {
38
+ ...y(i),
39
+ onBeforeLeave: y(r)
40
+ }), {
41
+ default: x(() => [(m(!0), u(s, null, g(t.items, (t, r) => (m(), u("li", {
34
42
  key: t.id ?? r,
35
43
  class: "kima-timeline__item",
36
- "data-variant": _(i)(t.variant).variant
37
- }, [l("span", {
44
+ "data-variant": y(a)(t.variant).variant
45
+ }, [d("span", {
38
46
  class: "kima-timeline__marker",
39
47
  role: "img",
40
- "aria-label": _(i)(t.variant).label
41
- }, [u(n, {
42
- icon: _(i)(t.variant).icon,
48
+ "aria-label": y(a)(t.variant).label
49
+ }, [f(n, {
50
+ icon: y(a)(t.variant).icon,
43
51
  size: 24
44
- }, null, 8, ["icon"])], 8, S), l("div", C, [h(e.$slots, "item", {
52
+ }, null, 8, ["icon"])], 8, w), d("div", T, [_(e.$slots, "item", {
45
53
  item: t,
46
54
  index: r
47
55
  }, () => [
48
- t.time ? (f(), c("time", {
56
+ t.time ? (m(), u("time", {
49
57
  key: 0,
50
58
  datetime: t.datetime
51
- }, g(t.time), 9, w)) : s("", !0),
52
- l("strong", null, g(t.title), 1),
53
- t.description ? (f(), c("p", T, g(t.description), 1)) : s("", !0)
54
- ], !0)])], 8, x))), 128))]),
59
+ }, v(t.time), 9, E)) : l("", !0),
60
+ d("strong", null, v(t.title), 1),
61
+ t.description ? (m(), u("p", D, v(t.description), 1)) : l("", !0)
62
+ ], !0)])], 8, C))), 128))]),
55
63
  _: 3
56
- }, 16)], !0)], 16, b));
64
+ }, 16)], 16, S));
57
65
  }
58
- }), [["__scopeId", "data-v-ff6a1726"]]);
59
- export { E as default };
66
+ }), [["__scopeId", "data-v-72323605"]]);
67
+ export { O as default };
@@ -1,13 +1,14 @@
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 "../core/icon-button.ce.js";
5
- import i from "../core/tooltip.ce.js";
3
+ import { freezeLeaveLayout as n, presenceTransition as r } from "../../utils/motion.js";
4
+ import i from "../core/icon-button.ce.js";
5
+ import a from "../core/tooltip.ce.js";
6
+ import { useContentMotion as o } from "../../utils/content-motion.js";
6
7
  /* empty css */
7
- import { Fragment as a, TransitionGroup as o, computed as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, createVNode as d, mergeProps as f, openBlock as p, ref as m, renderList as h, renderSlot as g, toDisplayString as _, unref as v, withCtx as y } from "vue";
8
- import { ArrowDown01Icon as b, ArrowUp01Icon as x, Cancel01Icon as S } from "@hugeicons/core-free-icons";
8
+ import { Fragment as s, TransitionGroup as c, computed as l, createElementBlock as u, createElementVNode as d, createTextVNode as f, createVNode as p, mergeProps as m, openBlock as h, ref as g, renderList as _, renderSlot as v, toDisplayString as y, unref as b, withCtx as x } from "vue";
9
+ import { ArrowDown01Icon as S, ArrowUp01Icon as C, Cancel01Icon as w } from "@hugeicons/core-free-icons";
9
10
  // src/components/form-completion/dynamic-input.ce.vue
10
- var C = ["aria-label"], w = { class: "kima-dynamic-input__actions" }, T = /*#__PURE__*/ e({
11
+ var T = ["aria-label"], E = { class: "kima-dynamic-input__actions" }, D = /*#__PURE__*/ e({
11
12
  __name: "dynamic-input.ce",
12
13
  props: {
13
14
  modelValue: {
@@ -39,80 +40,86 @@ var C = ["aria-label"], w = { class: "kima-dynamic-input__actions" }, T = /*#__P
39
40
  "remove",
40
41
  "move"
41
42
  ],
42
- setup(e, { expose: T, emit: E }) {
43
- let D = e, O = E, k = 0, A = /* @__PURE__ */ new WeakMap();
44
- function j(e) {
45
- return !e || typeof e != "object" ? `row-${++k}` : (A.has(e) || A.set(e, e.id || `row-${++k}`), A.get(e));
43
+ setup(e, { expose: D, emit: O }) {
44
+ let k = e, A = O, j = 0, M = /* @__PURE__ */ new WeakMap();
45
+ function N(e) {
46
+ return !e || typeof e != "object" ? `row-${++j}` : (M.has(e) || M.set(e, e.id || `row-${++j}`), M.get(e));
46
47
  }
47
- let M = m(D.modelValue.map((e) => ({ ...e }))), N = s(() => D.disabled || M.value.length >= D.max);
48
- function P(e, t, n) {
49
- M.value = e, O("update:modelValue", e.map((e) => ({ ...e }))), O("change", e.map((e) => ({ ...e }))), t && O(t, n);
48
+ let P = g(k.modelValue.map((e) => ({ ...e }))), F = l(() => k.disabled || P.value.length >= k.max), I = g(null);
49
+ o(I, () => P.value);
50
+ function L(e, t, n) {
51
+ P.value = e, A("update:modelValue", e.map((e) => ({ ...e }))), A("change", e.map((e) => ({ ...e }))), t && A(t, n);
50
52
  }
51
- function F() {
52
- if (N.value) return;
53
+ function R() {
54
+ if (F.value) return;
53
55
  let e = {
54
- ...D.create(),
55
- id: `row-${++k}`
56
+ ...k.create(),
57
+ id: `row-${++j}`
56
58
  };
57
- P([...M.value, e], "add", {
59
+ L([...P.value, e], "add", {
58
60
  row: e,
59
- index: M.value.length
61
+ index: P.value.length
60
62
  });
61
63
  }
62
- function I(e) {
63
- if (D.disabled || M.value.length <= D.min) return;
64
- let t = M.value[e];
65
- P(M.value.filter((t, n) => n !== e), "remove", {
64
+ function z(e) {
65
+ if (k.disabled || P.value.length <= k.min) return;
66
+ let t = P.value[e];
67
+ L(P.value.filter((t, n) => n !== e), "remove", {
66
68
  row: t,
67
69
  index: e
68
70
  });
69
71
  }
70
- function L(e, t) {
72
+ function B(e, t) {
71
73
  let n = e + t;
72
- if (D.disabled || n < 0 || n >= M.value.length) return;
73
- let r = [...M.value];
74
- [r[e], r[n]] = [r[n], r[e]], P(r, "move", {
74
+ if (k.disabled || n < 0 || n >= P.value.length) return;
75
+ let r = [...P.value];
76
+ [r[e], r[n]] = [r[n], r[e]], L(r, "move", {
75
77
  row: r[n],
76
78
  from: e,
77
79
  to: n
78
80
  });
79
81
  }
80
- function R(e, t) {
81
- let n = [...M.value];
82
- n[e] = t, P(n);
82
+ function V(e, t) {
83
+ let n = [...P.value];
84
+ n[e] = t, L(n);
83
85
  }
84
- function z() {
85
- return M.value.every((e) => e && e.valid !== !1);
86
+ function H() {
87
+ return P.value.every((e) => e && e.valid !== !1);
86
88
  }
87
- return T({
88
- add: F,
89
- remove: I,
90
- move: L,
91
- validate: z,
92
- rows: M
93
- }), (s, m) => (p(), c("div", {
89
+ return D({
90
+ add: R,
91
+ remove: z,
92
+ move: B,
93
+ validate: H,
94
+ rows: P
95
+ }), (o, l) => (h(), u("div", {
96
+ ref_key: "root",
97
+ ref: I,
94
98
  class: "kima-dynamic-input",
95
99
  role: "group",
96
100
  "aria-label": e.label
97
- }, [d(o, f({
101
+ }, [p(c, m({
98
102
  tag: "div",
99
103
  name: "kima-list"
100
- }, v(n), { class: "kima-dynamic-input__rows" }), {
101
- default: y(() => [(p(!0), c(a, null, h(M.value, (t, n) => (p(), c("div", {
102
- key: j(t),
104
+ }, {
105
+ ...b(r),
106
+ onBeforeLeave: b(n)
107
+ }, { class: "kima-dynamic-input__rows" }), {
108
+ default: x(() => [(h(!0), u(s, null, _(P.value, (t, n) => (h(), u("div", {
109
+ key: N(t),
103
110
  class: "kima-dynamic-input__row"
104
- }, [g(s.$slots, "default", {
111
+ }, [v(o.$slots, "default", {
105
112
  row: t,
106
113
  index: n,
107
- id: j(t),
108
- update: (e) => R(n, e)
109
- }, () => [l("output", null, _(JSON.stringify(t)), 1)], !0), l("div", w, [
110
- d(i, { text: "上移" }, {
111
- default: y(() => [d(r, {
112
- icon: v(x),
114
+ id: N(t),
115
+ update: (e) => V(n, e)
116
+ }, () => [d("output", null, y(JSON.stringify(t)), 1)], !0), d("div", E, [
117
+ p(a, { text: "上移" }, {
118
+ default: x(() => [p(i, {
119
+ icon: b(C),
113
120
  label: `${e.label}上移第${n + 1}项`,
114
121
  disabled: e.disabled || n === 0,
115
- onClick: (e) => L(n, -1)
122
+ onClick: (e) => B(n, -1)
116
123
  }, null, 8, [
117
124
  "icon",
118
125
  "label",
@@ -121,12 +128,12 @@ var C = ["aria-label"], w = { class: "kima-dynamic-input__actions" }, T = /*#__P
121
128
  ])]),
122
129
  _: 2
123
130
  }, 1024),
124
- d(i, { text: "下移" }, {
125
- default: y(() => [d(r, {
126
- icon: v(b),
131
+ p(a, { text: "下移" }, {
132
+ default: x(() => [p(i, {
133
+ icon: b(S),
127
134
  label: `${e.label}下移第${n + 1}项`,
128
- disabled: e.disabled || n === M.value.length - 1,
129
- onClick: (e) => L(n, 1)
135
+ disabled: e.disabled || n === P.value.length - 1,
136
+ onClick: (e) => B(n, 1)
130
137
  }, null, 8, [
131
138
  "icon",
132
139
  "label",
@@ -135,12 +142,12 @@ var C = ["aria-label"], w = { class: "kima-dynamic-input__actions" }, T = /*#__P
135
142
  ])]),
136
143
  _: 2
137
144
  }, 1024),
138
- d(i, { text: "移除" }, {
139
- default: y(() => [d(r, {
140
- icon: v(S),
145
+ p(a, { text: "移除" }, {
146
+ default: x(() => [p(i, {
147
+ icon: b(w),
141
148
  label: `移除第${n + 1}项`,
142
- disabled: e.disabled || M.value.length <= e.min,
143
- onClick: (e) => I(n)
149
+ disabled: e.disabled || P.value.length <= e.min,
150
+ onClick: (e) => z(n)
144
151
  }, null, 8, [
145
152
  "icon",
146
153
  "label",
@@ -151,14 +158,14 @@ var C = ["aria-label"], w = { class: "kima-dynamic-input__actions" }, T = /*#__P
151
158
  }, 1024)
152
159
  ])]))), 128))]),
153
160
  _: 3
154
- }, 16), d(t, {
161
+ }, 16), p(t, {
155
162
  variant: "tonal",
156
- disabled: N.value,
157
- onClick: F
163
+ disabled: F.value,
164
+ onClick: R
158
165
  }, {
159
- default: y(() => [...m[0] ||= [u("添加字段", -1)]]),
166
+ default: x(() => [...l[0] ||= [f("添加字段", -1)]]),
160
167
  _: 1
161
- }, 8, ["disabled"])], 8, C));
168
+ }, 8, ["disabled"])], 8, T));
162
169
  }
163
- }, [["__scopeId", "data-v-5913d05a"]]);
164
- export { T as default };
170
+ }, [["__scopeId", "data-v-6a5bc26a"]]);
171
+ export { D as default };