@wikicasa-dev/components 2.2.9-alpha.9 → 2.3.1-alpha.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 (62) hide show
  1. package/dist/Swiper/autoplay.js +1 -1
  2. package/dist/Swiper/controller.js +1 -1
  3. package/dist/Swiper/keyboard.js +1 -1
  4. package/dist/Swiper/thumbs.js +1 -1
  5. package/dist/UIKit/AccessibleSelect.d.ts +5 -4
  6. package/dist/UIKit/AccessibleSelect.js +3 -2
  7. package/dist/UIKit/Autocomplete/ClearableAutocomplete.d.ts +7 -2
  8. package/dist/UIKit/BaseAutocomplete.d.ts +4 -4
  9. package/dist/UIKit/BaseButton.d.ts +14 -8
  10. package/dist/UIKit/BaseCard.js +1 -3
  11. package/dist/UIKit/BaseDropDown.d.ts +19 -13
  12. package/dist/UIKit/BaseFloatingLabel.js +4 -4
  13. package/dist/UIKit/BaseInput.d.ts +3 -2
  14. package/dist/UIKit/BaseInput.js +1 -1
  15. package/dist/UIKit/BaseSnackbar.d.ts +2 -2
  16. package/dist/UIKit/BaseTextarea.d.ts +2 -2
  17. package/dist/UIKit/BaseToggle.d.ts +5 -8
  18. package/dist/UIKit/BaseToggle.js +1 -4
  19. package/dist/UIKit/Checkbox/CheckboxBtn.d.ts +14 -7
  20. package/dist/UIKit/Checkbox/CheckboxGroup.d.ts +5 -2
  21. package/dist/UIKit/Checkbox/v2/CheckboxButtonGroup.d.ts +40 -0
  22. package/dist/UIKit/Checkbox/v2/CheckboxButtonGroup.js +4 -0
  23. package/dist/UIKit/Radio/RadioButton.d.ts +28 -23
  24. package/dist/UIKit/Radio/RadioGroup.d.ts +49 -50
  25. package/dist/UIKit/Radio/v2/RadioButtonGroup.d.ts +29 -0
  26. package/dist/UIKit/Radio/v2/RadioButtonGroup.js +4 -0
  27. package/dist/UIKit/Radio/v2/RadioButtonItem.d.ts +16 -0
  28. package/dist/UIKit/Radio/v2/RadioButtonItem.js +5 -0
  29. package/dist/assets/AccessibleSelect.css +1 -0
  30. package/dist/assets/BaseCard.css +1 -1
  31. package/dist/assets/BaseDropDown.css +1 -1
  32. package/dist/assets/BaseFloatingLabel.css +1 -1
  33. package/dist/assets/BaseInput.css +1 -1
  34. package/dist/assets/RadioButtonItem.css +1 -0
  35. package/dist/assets/tailwind.css +1 -1
  36. package/dist/composables/mock.d.ts +25 -0
  37. package/dist/composables/mock.js +49 -0
  38. package/dist/index.d.ts +4 -0
  39. package/dist/index.js +94 -83
  40. package/dist/packages/components/lib/UIKit/AccessibleSelect.vue.js +158 -160
  41. package/dist/packages/components/lib/UIKit/Accordion/BaseAccordionItem.vue.js +4 -6
  42. package/dist/packages/components/lib/UIKit/Autocomplete/ClearableAutocomplete.vue.js +112 -106
  43. package/dist/packages/components/lib/UIKit/BaseAutocomplete.vue.js +36 -36
  44. package/dist/packages/components/lib/UIKit/BaseButton.vue.js +28 -24
  45. package/dist/packages/components/lib/UIKit/BaseCard.vue.js +13 -13
  46. package/dist/packages/components/lib/UIKit/BaseDropDown.vue.js +102 -105
  47. package/dist/packages/components/lib/UIKit/BaseFloatingLabel.vue.js +8 -8
  48. package/dist/packages/components/lib/UIKit/BaseInput.vue.js +65 -64
  49. package/dist/packages/components/lib/UIKit/BaseModal.vue.js +42 -36
  50. package/dist/packages/components/lib/UIKit/BaseSelect/SelectItem.vue.js +18 -17
  51. package/dist/packages/components/lib/UIKit/BaseToggle.vue.js +25 -29
  52. package/dist/packages/components/lib/UIKit/Checkbox/CheckboxBtn.vue.js +48 -41
  53. package/dist/packages/components/lib/UIKit/Checkbox/CheckboxGroup.vue.js +60 -55
  54. package/dist/packages/components/lib/UIKit/Checkbox/v2/CheckboxButtonGroup.vue.js +78 -0
  55. package/dist/packages/components/lib/UIKit/Radio/RadioButton.vue.js +16 -14
  56. package/dist/packages/components/lib/UIKit/Radio/RadioGroup.vue.js +37 -33
  57. package/dist/packages/components/lib/UIKit/Radio/v2/RadioButtonGroup.vue.js +49 -0
  58. package/dist/packages/components/lib/UIKit/Radio/v2/RadioButtonItem.vue.js +45 -0
  59. package/dist/types/index.d.ts +3 -0
  60. package/package.json +8 -7
  61. package/dist/assets/BaseToggle.css +0 -1
  62. /package/dist/assets/{swiper-thumbs.css → swiper-controller.css} +0 -0
@@ -1,7 +1,7 @@
1
- import { defineComponent as I, ref as n, useTemplateRef as T, onUnmounted as z, watch as H, createBlock as O, openBlock as r, Teleport as $, createElementVNode as l, normalizeClass as s, withModifiers as y, createElementBlock as h, createCommentVNode as w, renderSlot as d, createVNode as D, unref as K, nextTick as N } from "vue";
2
- import { isWindows as C, awaitableSetTimeout as S } from "@wikicasa-dev/utilities";
1
+ import { defineComponent as I, ref as n, useTemplateRef as T, onUnmounted as z, watch as H, createBlock as O, openBlock as m, Teleport as $, createElementVNode as a, normalizeClass as s, createElementBlock as y, createCommentVNode as h, renderSlot as d, withModifiers as D, createVNode as F, unref as K, nextTick as N } from "vue";
2
+ import { isWindows as g, awaitableSetTimeout as S } from "@wikicasa-dev/utilities";
3
3
  import { CloseIcon as V } from "@wikicasa-dev/svg-icons";
4
- const F = ["id", "data-cy"], U = ["innerHTML"], R = /* @__PURE__ */ I({
4
+ const P = ["id", "data-cy"], U = ["innerHTML"], j = /* @__PURE__ */ I({
5
5
  __name: "BaseModal",
6
6
  props: {
7
7
  id: { default: "base-bt-modal" },
@@ -24,25 +24,25 @@ const F = ["id", "data-cy"], U = ["innerHTML"], R = /* @__PURE__ */ I({
24
24
  titleClasses: {}
25
25
  },
26
26
  emits: ["closed", "opened", "dialogClick"],
27
- setup(e, { emit: g }) {
28
- const c = g, i = n(!1), m = n(null), a = T("modalDialog"), k = n(!1), u = n(!1), f = ({ key: t }) => {
27
+ setup(e, { emit: w }) {
28
+ const c = w, i = n(!1), r = n(null), l = T("modalDialog"), k = n(!1), u = n(!1), f = ({ key: t }) => {
29
29
  t === "Escape" && o();
30
- }, x = () => {
30
+ }, C = () => {
31
31
  document?.body.addEventListener("keydown", f);
32
32
  }, b = () => {
33
33
  document?.body.removeEventListener("keydown", f);
34
- }, p = async () => {
34
+ }, x = async () => {
35
35
  i.value = !0, N(() => {
36
- x(), C() ? document?.body.classList.add("uikit-no-scrolling", "sm:uikit-pr-15px") : document?.body.classList.add("uikit-no-scrolling");
36
+ C(), g() ? document?.body.classList.add("uikit-no-scrolling", "sm:uikit-pr-15px") : document?.body.classList.add("uikit-no-scrolling");
37
37
  }), c("opened"), e.autoClose !== void 0 && setTimeout(() => {
38
38
  o();
39
39
  }, e.autoClose);
40
+ }, p = (t) => {
41
+ l.value && l.value.contains(t.target) && (u.value = !0);
40
42
  }, M = (t) => {
41
- a.value && a.value.contains(t.target) && (u.value = !0);
42
- }, B = (t) => {
43
- a.value && a.value.contains(t.target) && (u.value = !1);
44
- }, L = async () => {
45
- if (e.closeOnClickOut) {
43
+ l.value && l.value.contains(t.target) && (u.value = !1);
44
+ }, B = async (t) => {
45
+ if (!r.value?.contains(t.target) && e.closeOnClickOut) {
46
46
  if (u.value) {
47
47
  u.value = !1;
48
48
  return;
@@ -51,21 +51,25 @@ const F = ["id", "data-cy"], U = ["innerHTML"], R = /* @__PURE__ */ I({
51
51
  }
52
52
  }, o = async () => {
53
53
  i.value = !1, b(), document?.documentElement.classList.remove("uikit-no-scrolling"), navigator.userAgent.includes("Windows") ? document?.body.classList.remove("uikit-no-scrolling", "sm:uikit-pr-15px") : document?.body.classList.remove("uikit-no-scrolling"), await S(() => {
54
- m.value?.classList.add("uikit-hidden"), c("closed");
54
+ r.value?.classList.add("uikit-hidden"), c("closed");
55
55
  }, 250);
56
56
  };
57
- return z(() => {
58
- b(), document?.documentElement.classList.remove("uikit-no-scrolling"), C() ? document?.body.classList.remove("uikit-no-scrolling", "sm:uikit-pr-15px") : document?.body.classList.remove("uikit-no-scrolling");
57
+ z(() => {
58
+ b(), document?.documentElement.classList.remove("uikit-no-scrolling"), g() ? document?.body.classList.remove("uikit-no-scrolling", "sm:uikit-pr-15px") : document?.body.classList.remove("uikit-no-scrolling");
59
59
  }), H(
60
60
  () => e.showModal,
61
61
  async (t) => {
62
- !t && !i.value ? k.value = !0 : k.value = !1, t && !i.value && await p(), !t && i.value && await o(), i.value = t;
62
+ !t && !i.value ? k.value = !0 : k.value = !1, t && !i.value && await x(), !t && i.value && await o(), i.value = t;
63
63
  },
64
64
  { immediate: !0 }
65
- ), (t, v) => (r(), O($, { to: "body" }, [
66
- l("div", {
65
+ );
66
+ const L = (t) => {
67
+ l.value === t.target && t.stopPropagation();
68
+ };
69
+ return (t, v) => (m(), O($, { to: "body" }, [
70
+ a("div", {
67
71
  ref_key: "backdropEl",
68
- ref: m,
72
+ ref: r,
69
73
  class: s(["bbt-backdrop uikit-fixed uikit-left-0 uikit-top-0 uikit-h-full uikit-w-full", [
70
74
  e.customBackdropClasses,
71
75
  {
@@ -76,11 +80,11 @@ const F = ["id", "data-cy"], U = ["innerHTML"], R = /* @__PURE__ */ I({
76
80
  { hide: k.value }
77
81
  ]]),
78
82
  style: { "z-index": "1062" },
79
- onClick: L,
80
- onMousedown: M,
81
- onMouseup: B
83
+ onClick: B,
84
+ onMousedown: p,
85
+ onMouseup: M
82
86
  }, [
83
- l("dialog", {
87
+ a("dialog", {
84
88
  id: e.id,
85
89
  ref: "modalDialog",
86
90
  "data-cy": e.dataCy,
@@ -94,50 +98,52 @@ const F = ["id", "data-cy"], U = ["innerHTML"], R = /* @__PURE__ */ I({
94
98
  `base-${e.size}`,
95
99
  e.fullHeight ? "uikit-h-[95%]" : "uikit-h-auto"
96
100
  ]]),
97
- onClick: v[0] || (v[0] = y((E) => c("dialogClick", E), ["stop"]))
101
+ tabindex: "-1",
102
+ onClick: v[0] || (v[0] = (E) => c("dialogClick", E)),
103
+ onFocusin: L
98
104
  }, [
99
- l("div", {
105
+ a("div", {
100
106
  class: s(["default-header uikit-sticky uikit-top-0 uikit-z-10 uikit-rounded-t uikit-border-0 uikit-bg-white uikit-px-4 uikit-pb-10px uikit-pt-20px sm:uikit-px-6", [e.customModalHeaderClasses]])
101
107
  }, [
102
- e.withCloseIcon ? (r(), h("button", {
108
+ e.withCloseIcon ? (m(), y("button", {
103
109
  key: 0,
104
110
  id: "close-icon-btn",
105
111
  "data-cy": "bbt-default-close-icon-btn",
106
112
  class: s(["uikit-absolute uikit-right-15px uikit-top-15px uikit-z-10 uikit-bg-transparent uikit-p-5px", e.closeIconBtnClasses]),
107
113
  type: "button",
108
114
  "aria-label": "Close",
109
- onClick: y(o, ["prevent", "stop"])
115
+ onClick: D(o, ["prevent", "stop"])
110
116
  }, [
111
- D(K(V), {
117
+ F(K(V), {
112
118
  class: s(["bbt-close-icon uikit-box-border", e.closeIcon?.classes]),
113
119
  width: e.closeIcon?.size || 20,
114
120
  height: e.closeIcon?.size || 20
115
121
  }, null, 8, ["class", "width", "height"])
116
- ], 2)) : w("", !0),
122
+ ], 2)) : h("", !0),
117
123
  d(t.$slots, "header", { closeModal: o }, () => [
118
- l("span", {
124
+ a("span", {
119
125
  class: s(["uikit-w-auto uikit-text-18 uikit-font-semibold sm:uikit-text-22", e.titleClasses]),
120
126
  innerHTML: e.headerTitle
121
127
  }, null, 10, U)
122
128
  ])
123
129
  ], 2),
124
- l("div", {
130
+ a("div", {
125
131
  class: s(["uikit-bbt-body uikit-flex-auto uikit-overflow-y-auto uikit-overflow-x-hidden uikit-px-4 uikit-pb-0 uikit-no-scrollbar sm:uikit-px-6 sm:uikit-pb-25px", [e.customModalBodyClasses]])
126
132
  }, [
127
133
  d(t.$slots, "body", { closeModal: o })
128
134
  ], 2),
129
- t.$slots.footer ? (r(), h("div", {
135
+ t.$slots.footer ? (m(), y("div", {
130
136
  key: 0,
131
137
  class: s(["uikit-bbt-footer uikit-sticky uikit-bottom-0 uikit-border-0 uikit-bg-white uikit-px-4 uikit-py-15px sm:uikit-px-6", e.customModalFooterClasses])
132
138
  }, [
133
139
  d(t.$slots, "footer", { closeModal: o })
134
- ], 2)) : w("", !0),
140
+ ], 2)) : h("", !0),
135
141
  d(t.$slots, "fixed-bottom")
136
- ], 10, F)
142
+ ], 42, P)
137
143
  ], 34)
138
144
  ]));
139
145
  }
140
146
  });
141
147
  export {
142
- R as default
148
+ j as default
143
149
  };
@@ -1,5 +1,5 @@
1
- import { defineComponent as u, useTemplateRef as r, watch as m, nextTick as c, createElementBlock as d, openBlock as f, normalizeClass as k, renderSlot as v, createElementVNode as x } from "vue";
2
- const p = ["tabindex"], b = ["innerHTML"], $ = /* @__PURE__ */ u({
1
+ import { defineComponent as u, useTemplateRef as c, watch as d, nextTick as m, createElementBlock as r, openBlock as f, normalizeClass as v, renderSlot as k, createElementVNode as x } from "vue";
2
+ const b = ["data-active", "tabindex"], p = ["innerHTML"], $ = /* @__PURE__ */ u({
3
3
  __name: "SelectItem",
4
4
  props: {
5
5
  label: { default: "" },
@@ -7,33 +7,34 @@ const p = ["tabindex"], b = ["innerHTML"], $ = /* @__PURE__ */ u({
7
7
  idx: { default: -1 }
8
8
  },
9
9
  emits: ["click", "mouseover"],
10
- setup(l, { emit: a }) {
11
- const n = a, t = l, o = r("liItem");
12
- return m(
13
- () => t.active,
10
+ setup(t, { emit: o }) {
11
+ const a = o, i = t, n = c("liItem");
12
+ return d(
13
+ () => i.active,
14
14
  (e) => {
15
- e && c(() => {
16
- o.value && o.value.focus();
15
+ e && m(() => {
16
+ n.value && n.value.focus();
17
17
  });
18
18
  },
19
19
  { immediate: !0 }
20
- ), (e, i) => (f(), d("li", {
20
+ ), (e, l) => (f(), r("li", {
21
21
  ref: "liItem",
22
- class: k(["uikit-list-none uikit-text-w-black", [
23
- { "active uikit-bg-w-cultured": l.active },
22
+ class: v(["uikit-list-none uikit-text-w-black", [
23
+ { "active uikit-bg-w-cultured": t.active },
24
24
  "uikit-outline-none",
25
25
  e.$attrs.class
26
26
  ]]),
27
+ "data-active": t.active,
27
28
  tabindex: e.$attrs.tabindex ?? -1,
28
- onClick: i[0] || (i[0] = (s) => n("click", t.idx)),
29
- onMouseover: i[1] || (i[1] = (s) => n("mouseover", t.idx))
29
+ onClick: l[0] || (l[0] = (s) => a("click", i.idx)),
30
+ onMouseover: l[1] || (l[1] = (s) => a("mouseover", i.idx))
30
31
  }, [
31
- v(e.$slots, "default", { itemIdx: l.idx }, () => [
32
+ k(e.$slots, "default", { itemIdx: t.idx }, () => [
32
33
  x("span", {
33
- innerHTML: t.label
34
- }, null, 8, b)
34
+ innerHTML: i.label
35
+ }, null, 8, p)
35
36
  ])
36
- ], 42, p));
37
+ ], 42, b));
37
38
  }
38
39
  });
39
40
  export {
@@ -1,40 +1,36 @@
1
- import { defineComponent as s, mergeModels as n, useModel as d, createElementBlock as k, openBlock as b, normalizeClass as c, renderSlot as r, createElementVNode as i, createCommentVNode as f, withModifiers as m } from "vue";
2
- const p = { class: "switch uikit-relative uikit-inline-block uikit-min-w-[40px] uikit-text-sm" }, h = ["data-cy", "checked"], g = ["innerHTML"], y = /* @__PURE__ */ s({
1
+ import { defineComponent as s, mergeModels as n, useModel as d, createElementBlock as k, openBlock as c, renderSlot as u, createVNode as a, createCommentVNode as m, unref as o, withCtx as f, createElementVNode as p } from "vue";
2
+ import { SwitchRoot as b, SwitchThumb as h } from "reka-ui";
3
+ const g = { class: "uikit-flex uikit-items-center uikit-gap-[8px]" }, w = ["innerHTML"], y = /* @__PURE__ */ s({
3
4
  inheritAttrs: !1,
4
5
  __name: "BaseToggle",
5
6
  props: /* @__PURE__ */ n({
6
- withRightLabel: { type: Boolean, default: !0 },
7
- label: { default: "" }
7
+ label: {}
8
8
  }, {
9
9
  modelValue: { type: Boolean, default: !1 },
10
10
  modelModifiers: {}
11
11
  }),
12
12
  emits: ["update:modelValue"],
13
- setup(o) {
14
- const l = d(o, "modelValue"), u = ({ target: e }) => {
15
- l.value = e.checked;
16
- };
17
- return (e, t) => (b(), k("div", {
18
- class: c(["switch-container uikit-inline-block uikit-items-center", e.$attrs.class])
19
- }, [
20
- r(e.$slots, "leftLabel", {}, void 0, !0),
21
- i("label", p, [
22
- i("input", {
23
- "data-cy": e.$attrs["data-cy"] ?? "",
24
- class: "uikit-peer/toggle uikit-h-0 uikit-w-0 uikit-opacity-0",
25
- type: "checkbox",
26
- checked: l.value,
27
- onInput: t[0] || (t[0] = m((a) => u(a), ["stop"]))
28
- }, null, 40, h),
29
- t[1] || (t[1] = i("span", { class: "slider round uikit-absolute uikit-bottom-0 uikit-left-0 uikit-right-0 uikit-top-0 uikit-cursor-pointer uikit-bg-w-lavender uikit-duration-300 before:uikit-absolute before:uikit-bottom-0 before:uikit-left-0 before:uikit-top-0 before:uikit-box-border before:uikit-h-[22px] before:uikit-w-[22px] before:uikit-rounded-circle before:uikit-border before:uikit-border-solid before:uikit-border-w-secondary before:uikit-bg-white before:uikit-shadow-sm before:uikit-duration-300 before:uikit-content-[''] peer-checked/toggle:uikit-bg-w-primary" }, null, -1))
30
- ]),
31
- o.withRightLabel ? r(e.$slots, "rightLabel", { key: 0 }, () => [
32
- i("span", {
33
- class: "uikit-ml-10px",
34
- innerHTML: o.label
35
- }, null, 8, g)
36
- ], !0) : f("", !0)
37
- ], 2));
13
+ setup(t) {
14
+ const i = d(t, "modelValue");
15
+ return (e, l) => (c(), k("div", g, [
16
+ u(e.$slots, "leftLabel"),
17
+ a(o(b), {
18
+ modelValue: i.value,
19
+ "onUpdate:modelValue": l[0] || (l[0] = (r) => i.value = r),
20
+ class: "uikit-flex uikit-h-[20px] uikit-w-[40px] uikit-cursor-pointer uikit-rounded-full uikit-p-0 uikit-transition-[background] uikit-will-change-[background] focus-visible:uikit-outline-w-primary data-[state=checked]:uikit-bg-w-primary data-[state=unchecked]:uikit-bg-w-cultured"
21
+ }, {
22
+ default: f(() => [
23
+ a(o(h), { class: "uikit-box-border uikit-flex uikit-size-[20px] uikit-translate-x-0 uikit-items-center uikit-justify-center uikit-rounded-full uikit-border uikit-border-solid uikit-border-w-lightgray uikit-bg-white uikit-shadow-xl uikit-transition-transform uikit-will-change-transform data-[state=checked]:uikit-translate-x-full" })
24
+ ]),
25
+ _: 1
26
+ }, 8, ["modelValue"]),
27
+ e.$slots.leftLabel ? m("", !0) : u(e.$slots, "rightLabel", { key: 0 }, () => [
28
+ p("span", {
29
+ class: "uikit-ml-[10px]",
30
+ innerHTML: t.label
31
+ }, null, 8, w)
32
+ ])
33
+ ]));
38
34
  }
39
35
  });
40
36
  export {
@@ -1,9 +1,9 @@
1
- import { defineComponent as m, useId as f, computed as h, watch as b, createElementBlock as C, openBlock as u, createVNode as c, renderSlot as x, unref as i, normalizeClass as y, withCtx as n, createBlock as V, createCommentVNode as g, createTextVNode as B, toDisplayString as w } from "vue";
2
- import { CheckIcon as p } from "@wikicasa-dev/svg-icons";
3
- import { CheckboxRoot as I, CheckboxIndicator as v } from "reka-ui";
4
- const N = ["for"], j = /* @__PURE__ */ m({
1
+ import { defineComponent as y, mergeModels as c, useId as p, useTemplateRef as u, useModel as B, watch as I, inject as n, onMounted as V, onUnmounted as R, createElementBlock as w, openBlock as r, createVNode as s, renderSlot as E, unref as l, normalizeClass as M, withCtx as k, createBlock as N, createCommentVNode as j, createTextVNode as z, toDisplayString as S } from "vue";
2
+ import { CheckIcon as T } from "@wikicasa-dev/svg-icons";
3
+ import { CheckboxRoot as U, CheckboxIndicator as $ } from "reka-ui";
4
+ const F = /* @__PURE__ */ y({
5
5
  __name: "CheckboxBtn",
6
- props: {
6
+ props: /* @__PURE__ */ c({
7
7
  id: {},
8
8
  dataCy: {},
9
9
  disabled: { type: Boolean },
@@ -12,64 +12,71 @@ const N = ["for"], j = /* @__PURE__ */ m({
12
12
  required: { type: Boolean },
13
13
  inputClass: {},
14
14
  label: { default: "" },
15
- modelValue: { type: Boolean, default: !1 }
16
- },
17
- emits: ["click", "update:modelValue", "change"],
18
- setup(e, { emit: r }) {
19
- const l = f(), d = h(() => `${e.id ?? l}`), a = r;
20
- b(
15
+ value: {}
16
+ }, {
17
+ modelValue: { type: Boolean, default: !1 },
18
+ modelModifiers: {}
19
+ }),
20
+ emits: /* @__PURE__ */ c(["click", "change"], ["update:modelValue"]),
21
+ setup(e, { expose: m, emit: f }) {
22
+ const h = p(), o = u("root"), b = u("checkboxRoot"), a = B(e, "modelValue"), i = f;
23
+ I(
21
24
  () => e.checked,
22
25
  (t) => {
23
- t !== void 0 && a("update:modelValue", t);
26
+ t !== void 0 && (a.value = t);
24
27
  }
25
28
  );
26
- const k = (t) => {
27
- t !== "indeterminate" && (a("change", {
28
- id: e.id ?? l,
29
+ const x = (t) => {
30
+ t !== "indeterminate" && (i("change", {
31
+ id: e.id ?? h,
29
32
  label: e.label,
30
33
  checked: t
31
- }), a("update:modelValue", t));
32
- };
33
- return (t, o) => (u(), C("label", {
34
+ }), a.value = t);
35
+ }, v = n("addItem", void 0), C = n(
36
+ "removeItem",
37
+ void 0
38
+ );
39
+ return V(() => {
40
+ v?.(e.value, o.value);
41
+ }), R(() => {
42
+ C?.(e.value);
43
+ }), m({
44
+ getRootElement: () => o.value,
45
+ getCheckboxElement: () => b.value?.$el
46
+ }), (t, d) => (r(), w("label", {
47
+ ref: "root",
34
48
  class: "uikit-checkbox-btn uikit-flex uikit-items-center uikit-gap-[12px]",
35
- for: d.value,
36
- onClick: o[0] || (o[0] = (s) => a("click", s))
49
+ onClick: d[0] || (d[0] = (g) => i("click", g))
37
50
  }, [
38
- c(i(I), {
39
- id: d.value,
40
- "model-value": e.modelValue,
51
+ s(l(U), {
52
+ ref: "checkboxRoot",
53
+ "model-value": a.value,
41
54
  "data-cy": e.dataCy,
42
55
  disabled: e.disabled,
43
- class: y(["uikit-inline-flex uikit-size-[20px] uikit-items-center uikit-justify-center uikit-rounded-[4px] uikit-p-0 data-[state='unchecked']:uikit-border data-[state='unchecked']:uikit-border-solid data-[state='unchecked']:uikit-border-w-lightgray", [
44
- {
45
- "uikit-bg-white": !e.modelValue,
46
- "uikit-bg-w-primary": e.modelValue
47
- },
48
- e.inputClass
49
- ]]),
50
- "onUpdate:modelValue": k
56
+ class: M(["uikit-inline-flex uikit-size-[20px] uikit-shrink-0 uikit-items-center uikit-justify-center uikit-rounded-[4px] uikit-p-0 data-[state='unchecked']:uikit-border data-[state='unchecked']:uikit-border-solid data-[state='unchecked']:uikit-border-w-lightgray data-[state='checked']:uikit-bg-w-primary data-[state='unchecked']:uikit-bg-white", e.inputClass]),
57
+ "onUpdate:modelValue": x
51
58
  }, {
52
- default: n(() => [
53
- c(i(v), { class: "uikit-flex" }, {
54
- default: n(() => [
55
- e.modelValue === !0 ? (u(), V(i(p), {
59
+ default: k(() => [
60
+ s(l($), { class: "uikit-flex" }, {
61
+ default: k(() => [
62
+ a.value === !0 ? (r(), N(l(T), {
56
63
  key: 0,
57
64
  "fill-color": "#fff",
58
65
  width: 12,
59
66
  height: 14
60
- })) : g("", !0)
67
+ })) : j("", !0)
61
68
  ]),
62
69
  _: 1
63
70
  })
64
71
  ]),
65
72
  _: 1
66
- }, 8, ["id", "model-value", "data-cy", "disabled", "class"]),
67
- x(t.$slots, "label", {}, () => [
68
- B(w(e.label), 1)
73
+ }, 8, ["model-value", "data-cy", "disabled", "class"]),
74
+ E(t.$slots, "label", {}, () => [
75
+ z(S(e.label), 1)
69
76
  ])
70
- ], 8, N));
77
+ ], 512));
71
78
  }
72
79
  });
73
80
  export {
74
- j as default
81
+ F as default
75
82
  };
@@ -1,11 +1,11 @@
1
- import { defineComponent as v, ref as D, computed as h, watch as E, renderSlot as b, createElementVNode as $, normalizeClass as g, createElementBlock as B, createCommentVNode as A, openBlock as C, Fragment as I, renderList as R, createBlock as K, unref as V } from "vue";
2
- import { stringToHyphened as L, isArrNullOrEmpty as G } from "@wikicasa-dev/utilities";
3
- import N from "./CheckboxBtn.vue.js";
1
+ import { defineComponent as B, mergeModels as y, useModel as A, ref as I, computed as i, watch as C, renderSlot as p, createElementVNode as M, normalizeClass as x, createElementBlock as R, createCommentVNode as K, openBlock as v, Fragment as V, renderList as w, createBlock as L, unref as G } from "vue";
2
+ import { stringToHyphened as N, isArrNullOrEmpty as T } from "@wikicasa-dev/utilities";
3
+ import F from "./CheckboxBtn.vue.js";
4
4
  import '../../../../../assets/CheckboxBtn.css';/* empty css */
5
- const T = ["id", "data-cy"], j = /* @__PURE__ */ v({
5
+ const O = ["id", "data-cy"], q = /* @__PURE__ */ B({
6
6
  inheritAttrs: !1,
7
7
  __name: "CheckboxGroup",
8
- props: {
8
+ props: /* @__PURE__ */ y({
9
9
  checkboxData: { default() {
10
10
  return [];
11
11
  } },
@@ -18,95 +18,100 @@ const T = ["id", "data-cy"], j = /* @__PURE__ */ v({
18
18
  getKey: { type: Function, default: (a) => typeof a == "string" || typeof a == "number" ? `${a}` : `${a.id}` },
19
19
  groupId: { default: "" },
20
20
  dataCy: { default: "" }
21
- },
22
- emits: ["resetted", "update:modelValue", "checkedGroup"],
23
- setup(a, { emit: y }) {
24
- const o = a, s = y, l = D(
21
+ }, {
22
+ refresh: { type: Boolean, default: !1 },
23
+ refreshModifiers: {}
24
+ }),
25
+ emits: /* @__PURE__ */ y(["resetted", "update:modelValue", "checkedGroup"], ["update:refresh"]),
26
+ setup(a, { emit: D }) {
27
+ const o = a, s = D, f = A(a, "refresh"), l = I(
25
28
  /* @__PURE__ */ new Map()
26
- ), r = h(() => {
29
+ ), r = i(() => {
27
30
  for (const e of o.checkboxData)
28
31
  if (e.reset) return e;
29
32
  return null;
30
- }), x = h(() => o.checkboxData.length), f = h(() => {
33
+ }), E = i(() => o.checkboxData.length), k = i(() => {
31
34
  let e = 0;
32
- return l.value.forEach((t) => {
33
- t.checked && e++;
35
+ return l.value.forEach((c) => {
36
+ c.checked && e++;
34
37
  }), e;
35
- });
36
- (() => {
37
- const e = [];
38
+ }), m = () => {
39
+ const e = [], c = /* @__PURE__ */ new Map();
38
40
  for (const t of o.checkboxData)
39
- l.value.set(`${t.id}`, {
41
+ c.set(`${t.id}`, {
40
42
  ...t,
41
43
  checked: !!t.checked
42
44
  }), t.checked && e.push(t);
43
- s("update:modelValue", e);
44
- })();
45
- const u = (e, t) => {
46
- const c = l.value.get(e);
47
- if (c) {
48
- if (t) {
49
- l.value.set(e, { ...c, ...t });
45
+ l.value = c, s("update:modelValue", e);
46
+ };
47
+ m();
48
+ const u = (e, c) => {
49
+ const t = l.value.get(e);
50
+ if (t) {
51
+ if (c) {
52
+ l.value.set(e, { ...t, ...c });
50
53
  return;
51
54
  }
52
- l.value.set(e, { ...c, checked: !c.checked });
55
+ l.value.set(e, { ...t, checked: !t.checked });
53
56
  }
54
- }, k = () => {
57
+ }, b = () => {
55
58
  l.value.forEach((e) => {
56
59
  e.checked = !1;
57
60
  });
58
- }, m = () => {
59
- k(), s("update:modelValue", []), s("resetted");
60
- }, d = (e) => l.value.get(o.getKey(e))?.checked ?? !1, i = (e) => {
61
- if (G(o.checkboxData)) return;
62
- const t = l.value.get(e.id);
63
- t?.reset && e.checked ? k() : r.value && !t?.reset && u(o.getKey(r.value), { checked: !1 }), u(`${e.id}`), o.autoCheckResetAll && r.value && f.value === x.value - 1 && l.value.forEach((n) => {
61
+ }, g = () => {
62
+ b(), s("update:modelValue", []), s("resetted");
63
+ }, d = (e) => l.value.get(o.getKey(e))?.checked ?? !1, h = (e) => {
64
+ if (T(o.checkboxData)) return;
65
+ const c = l.value.get(e.id);
66
+ c?.reset && e.checked ? b() : r.value && !c?.reset && u(o.getKey(r.value), { checked: !1 }), u(`${e.id}`), o.autoCheckResetAll && r.value && k.value === E.value - 1 && l.value.forEach((n) => {
64
67
  n.checked = !!n.reset;
65
- }), o.autoCheckResetEmpty && r.value && !f.value && (!o.manualToggleResetButton || !t?.reset) && u(o.getKey(r.value), { checked: !0 });
66
- const c = [];
68
+ }), o.autoCheckResetEmpty && r.value && !k.value && (!o.manualToggleResetButton || !c?.reset) && u(o.getKey(r.value), { checked: !0 });
69
+ const t = [];
67
70
  l.value.forEach((n) => {
68
- n.checked && c.push(n);
69
- }), s("update:modelValue", c), s("checkedGroup", o.groupId);
71
+ n.checked && t.push(n);
72
+ }), s("update:modelValue", t), s("checkedGroup", o.groupId);
70
73
  };
71
- return E(
74
+ return C(
72
75
  () => o.reset,
73
76
  (e) => {
74
- e && m();
77
+ e && g();
75
78
  }
76
- ), (e, t) => b(e.$slots, "default", {
79
+ ), C(f, (e) => {
80
+ e && (m(), f.value = !1);
81
+ }), (e, c) => p(e.$slots, "default", {
77
82
  isActive: d,
78
- handleChange: i,
83
+ handleChange: h,
79
84
  checkboxesData: a.checkboxData
80
85
  }, () => [
81
- $("div", {
86
+ M("div", {
82
87
  id: a.groupId,
83
- class: g(["checkbox-group-container", e.$attrs.class || ""]),
88
+ class: x(["checkbox-group-container", e.$attrs.class || ""]),
84
89
  "data-cy": a.dataCy
85
90
  }, [
86
- b(e.$slots, "checkbox_elements", {
91
+ p(e.$slots, "checkbox_elements", {
87
92
  isActive: d,
88
- handleChange: i,
93
+ handleChange: h,
89
94
  checkboxesData: a.checkboxData,
90
- reset: m
95
+ reset: g
91
96
  }, () => [
92
- a.checkboxData ? (C(!0), B(I, { key: 0 }, R(a.checkboxData, (c, n) => (C(), K(N, {
93
- id: a.getKey(c),
97
+ a.checkboxData ? (v(!0), R(V, { key: 0 }, w(a.checkboxData, (t, n) => (v(), L(F, {
98
+ id: a.getKey(t),
94
99
  key: n,
95
- "data-cy": c.dataCy ?? `checkbox_${V(L)(`${c.label}`)}`,
96
- label: c.label,
100
+ "data-cy": t.dataCy ?? `checkbox_${G(N)(`${t.label}`)}`,
101
+ label: t.label,
97
102
  inline: a.formCheckInline,
98
- "model-value": d(c),
99
- class: g([
103
+ "model-value": d(t),
104
+ class: x([
100
105
  a.formCheckInline ? "uikit-mr-10px" : "uikit-mb-10px",
101
106
  a.checkboxContainerClasses
102
107
  ]),
103
- onChange: t[0] || (t[0] = (p) => i(p))
104
- }, null, 8, ["id", "data-cy", "label", "inline", "model-value", "class"]))), 128)) : A("", !0)
108
+ onChange: c[0] || (c[0] = ($) => h($))
109
+ }, null, 8, ["id", "data-cy", "label", "inline", "model-value", "class"]))), 128)) : K("", !0)
105
110
  ])
106
- ], 10, T)
111
+ ], 10, O)
107
112
  ]);
108
113
  }
109
114
  });
110
115
  export {
111
- j as default
116
+ q as default
112
117
  };