@wikicasa-dev/components 2.4.1-alpha.2 → 2.4.1-alpha.4

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.
@@ -24,6 +24,7 @@ type __VLS_Props = {
24
24
  dataCy?: string;
25
25
  closeIconBtnClasses?: ClassTypeProp;
26
26
  titleClasses?: ClassTypeProp;
27
+ appear?: boolean;
27
28
  };
28
29
  declare function __VLS_template(): {
29
30
  attrs: Partial<{}>;
@@ -1,6 +1,6 @@
1
- import { defineComponent as $, shallowRef as h, useTemplateRef as v, onUnmounted as H, watch as O, createBlock as F, openBlock as r, Teleport as S, createVNode as y, Transition as K, unref as w, withCtx as N, withDirectives as U, createElementVNode as l, normalizeClass as i, createElementBlock as C, createCommentVNode as x, renderSlot as d, withModifiers as V, vShow as A } from "vue";
2
- import { CloseIcon as P } from "@wikicasa-dev/svg-icons";
3
- const R = ["id", "data-cy"], G = ["innerHTML"], J = /* @__PURE__ */ $({
1
+ import { defineComponent as D, shallowRef as v, useTemplateRef as h, onUnmounted as T, watch as $, createBlock as H, openBlock as c, Teleport as O, createVNode as y, Transition as F, withCtx as U, withDirectives as V, createElementVNode as l, normalizeClass as o, createElementBlock as w, createCommentVNode as C, renderSlot as d, withModifiers as K, unref as N, vShow as S } from "vue";
2
+ import { CloseIcon as A } from "@wikicasa-dev/svg-icons";
3
+ const G = ["id", "data-cy"], P = ["innerHTML"], q = /* @__PURE__ */ D({
4
4
  __name: "BaseModal",
5
5
  props: {
6
6
  id: { default: "base-bt-modal" },
@@ -20,144 +20,148 @@ const R = ["id", "data-cy"], G = ["innerHTML"], J = /* @__PURE__ */ $({
20
20
  centered: { type: Boolean, default: !1 },
21
21
  dataCy: {},
22
22
  closeIconBtnClasses: {},
23
- titleClasses: {}
23
+ titleClasses: {},
24
+ appear: { type: Boolean, default: !0 }
24
25
  },
25
26
  emits: ["closed", "opened", "dialogClick"],
26
- setup(t, { emit: g }) {
27
- const c = g, o = h(!1), k = v("backdrop"), a = v("modalDialog"), u = h(!1), p = t.showModal, m = ({ key: e }) => {
28
- e === "Escape" && s();
29
- }, M = () => {
27
+ setup(e, { emit: x }) {
28
+ const r = x, i = v(!1), k = h("backdrop"), s = h("modalDialog"), u = v(!1), m = ({ key: t }) => {
29
+ t === "Escape" && a();
30
+ }, p = () => {
30
31
  document?.body.addEventListener("keydown", m);
31
32
  }, f = () => {
32
33
  document?.body.removeEventListener("keydown", m);
33
- }, B = () => {
34
- console.log("DEBUG:onBeforeEnter called"), M(), document?.body.classList.add(
34
+ }, g = () => {
35
+ console.log("DEBUG:onBeforeEnter called"), p(), document?.body.classList.add(
35
36
  "sm:uikit-pr-15px",
36
37
  "sm:uikit-mr-0",
37
38
  "uikit-overflow-hidden"
38
39
  );
39
- }, E = () => {
40
- c("opened"), t.autoClose !== void 0 && setTimeout(() => {
41
- s();
42
- }, t.autoClose);
43
- }, I = () => {
40
+ }, B = () => {
41
+ r("opened"), e.autoClose !== void 0 && setTimeout(() => {
42
+ a();
43
+ }, e.autoClose);
44
+ }, M = () => {
44
45
  f(), document?.body.classList.remove(
45
46
  "sm:uikit-pr-15px",
46
47
  "sm:uikit-mr-0",
47
48
  "uikit-overflow-hidden"
48
- ), c("closed");
49
- }, s = () => {
50
- o.value = !1;
51
- }, L = (e) => {
52
- a.value && a.value.contains(e.target) && (u.value = !0);
53
- }, z = (e) => {
54
- a.value && a.value.contains(e.target) && (u.value = !1);
55
- }, T = async (e) => {
56
- if (!(e.target !== k.value && k.value?.contains(e.target)) && t.closeOnClickOut) {
49
+ ), r("closed");
50
+ }, a = () => {
51
+ i.value = !1;
52
+ }, E = (t) => {
53
+ s.value && s.value.contains(t.target) && (u.value = !0);
54
+ }, I = (t) => {
55
+ s.value && s.value.contains(t.target) && (u.value = !1);
56
+ }, L = async (t) => {
57
+ if (!(t.target !== k.value && k.value?.contains(t.target)) && e.closeOnClickOut) {
57
58
  if (u.value) {
58
59
  u.value = !1;
59
60
  return;
60
61
  }
61
- s();
62
+ a();
62
63
  }
63
64
  };
64
- H(() => {
65
+ T(() => {
65
66
  f(), document?.body.classList.remove(
66
67
  "sm:uikit-pr-15px",
67
68
  "sm:uikit-mr-0",
68
69
  "uikit-overflow-hidden"
69
70
  );
70
- }), O(
71
- () => t.showModal,
72
- async (e) => {
73
- o.value = e;
71
+ });
72
+ const z = (t) => {
73
+ s.value === t.target && t.stopPropagation();
74
+ };
75
+ return $(
76
+ () => e.showModal,
77
+ async (t) => {
78
+ t !== i.value && (console.log("DEBUG:showModal => watcher", {
79
+ cur: t,
80
+ showValue: i.value
81
+ }), i.value = t);
74
82
  },
75
83
  { immediate: !0 }
76
- );
77
- const D = (e) => {
78
- a.value === e.target && e.stopPropagation();
79
- };
80
- return (e, n) => (r(), F(S, { to: "body" }, [
81
- y(K, {
82
- appear: w(p),
84
+ ), (t, n) => (c(), H(O, { to: "body" }, [
85
+ y(F, {
86
+ appear: e.appear,
83
87
  name: "modal-transition",
84
88
  duration: { enter: 500, leave: 250 },
85
- onBeforeEnter: B,
86
- onAfterEnter: E,
87
- onAfterLeave: I
89
+ onBeforeEnter: g,
90
+ onAfterEnter: B,
91
+ onAfterLeave: M
88
92
  }, {
89
- default: N(() => [
90
- U(l("div", {
93
+ default: U(() => [
94
+ V(l("div", {
91
95
  ref: "backdrop",
92
- class: i(["bbt-backdrop uikit-fixed uikit-left-0 uikit-top-0 uikit-z-50 uikit-h-full uikit-w-full", [
93
- t.customBackdropClasses,
96
+ class: o(["bbt-backdrop uikit-fixed uikit-left-0 uikit-top-0 uikit-z-50 uikit-h-full uikit-w-full", [
97
+ e.customBackdropClasses,
94
98
  {
95
- "uikit-bg-w-secondary/70": o.value
99
+ "uikit-bg-w-secondary/70": i.value
96
100
  },
97
- { "uikit-bg-transparent": !o.value },
98
- { "sm:uikit-pt-[30px]": !t.centered }
101
+ { "uikit-bg-transparent": !i.value },
102
+ { "sm:uikit-pt-[30px]": !e.centered }
99
103
  ]]),
100
- onClick: T,
101
- onMousedown: L,
102
- onMouseup: z
104
+ onClick: L,
105
+ onMousedown: E,
106
+ onMouseup: I
103
107
  }, [
104
108
  l("dialog", {
105
- id: t.id,
109
+ id: e.id,
106
110
  ref: "modalDialog",
107
- "data-cy": t.dataCy,
108
- class: i(["uikit-modal-dialog uikit-mx-auto uikit-block uikit-w-full uikit-overflow-y-auto uikit-overflow-x-hidden uikit-rounded uikit-border-none uikit-bg-transparent uikit-bg-white uikit-p-0 uikit-shadow-lg uikit-no-scrollbar uikit-safe-bottom max-sm:uikit-fixed max-sm:uikit-bottom-0 max-sm:uikit-max-h-[95%] max-sm:uikit-rounded-bl-none max-sm:uikit-rounded-br-none sm:uikit-h-auto", [
109
- t.customModalDialogClasses,
111
+ "data-cy": e.dataCy,
112
+ class: o(["uikit-modal-dialog uikit-mx-auto uikit-block uikit-w-full uikit-overflow-y-auto uikit-overflow-x-hidden uikit-rounded uikit-border-none uikit-bg-transparent uikit-bg-white uikit-p-0 uikit-shadow-lg uikit-no-scrollbar uikit-safe-bottom max-sm:uikit-fixed max-sm:uikit-bottom-0 max-sm:uikit-max-h-[95%] max-sm:uikit-rounded-bl-none max-sm:uikit-rounded-br-none sm:uikit-h-auto", [
113
+ e.customModalDialogClasses,
110
114
  {
111
- "centered sm:uikit-absolute sm:uikit-top-1/2 sm:-uikit-translate-y-1/2": t.centered
115
+ "centered sm:uikit-absolute sm:uikit-top-1/2 sm:-uikit-translate-y-1/2": e.centered
112
116
  },
113
- { "uikit-static": !t.centered },
114
- `base-${t.size}`,
115
- t.fullHeight ? "uikit-h-[95%]" : "uikit-h-auto"
117
+ { "uikit-static": !e.centered },
118
+ `base-${e.size}`,
119
+ e.fullHeight ? "uikit-h-[95%]" : "uikit-h-auto"
116
120
  ]]),
117
121
  tabindex: "-1",
118
- onClick: n[1] || (n[1] = (b) => c("dialogClick", b)),
119
- onFocusin: D
122
+ onClick: n[1] || (n[1] = (b) => r("dialogClick", b)),
123
+ onFocusin: z
120
124
  }, [
121
125
  l("div", {
122
- class: i(["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", [t.customModalHeaderClasses]])
126
+ class: o(["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]])
123
127
  }, [
124
- t.withCloseIcon ? (r(), C("button", {
128
+ e.withCloseIcon ? (c(), w("button", {
125
129
  key: 0,
126
130
  id: "close-icon-btn",
127
131
  "data-cy": "bbt-default-close-icon-btn",
128
- class: i(["uikit-absolute uikit-right-15px uikit-top-15px uikit-z-10 uikit-bg-transparent uikit-p-5px", t.closeIconBtnClasses]),
132
+ class: o(["uikit-absolute uikit-right-15px uikit-top-15px uikit-z-10 uikit-bg-transparent uikit-p-5px", e.closeIconBtnClasses]),
129
133
  type: "button",
130
134
  "aria-label": "Close",
131
- onClick: n[0] || (n[0] = V((b) => o.value = !1, ["prevent", "stop"]))
135
+ onClick: n[0] || (n[0] = K((b) => i.value = !1, ["prevent", "stop"]))
132
136
  }, [
133
- y(w(P), {
134
- class: i(["bbt-close-icon uikit-box-border", t.closeIcon?.classes]),
135
- width: t.closeIcon?.size || 20,
136
- height: t.closeIcon?.size || 20
137
+ y(N(A), {
138
+ class: o(["bbt-close-icon uikit-box-border", e.closeIcon?.classes]),
139
+ width: e.closeIcon?.size || 20,
140
+ height: e.closeIcon?.size || 20
137
141
  }, null, 8, ["class", "width", "height"])
138
- ], 2)) : x("", !0),
139
- d(e.$slots, "header", { closeModal: s }, () => [
142
+ ], 2)) : C("", !0),
143
+ d(t.$slots, "header", { closeModal: a }, () => [
140
144
  l("span", {
141
- class: i(["uikit-w-auto uikit-text-18 uikit-font-semibold sm:uikit-text-22", t.titleClasses]),
142
- innerHTML: t.headerTitle
143
- }, null, 10, G)
145
+ class: o(["uikit-w-auto uikit-text-18 uikit-font-semibold sm:uikit-text-22", e.titleClasses]),
146
+ innerHTML: e.headerTitle
147
+ }, null, 10, P)
144
148
  ])
145
149
  ], 2),
146
150
  l("div", {
147
- class: i(["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", [t.customModalBodyClasses]])
151
+ class: o(["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]])
148
152
  }, [
149
- d(e.$slots, "body", { closeModal: s })
153
+ d(t.$slots, "body", { closeModal: a })
150
154
  ], 2),
151
- e.$slots.footer ? (r(), C("div", {
155
+ t.$slots.footer ? (c(), w("div", {
152
156
  key: 0,
153
- class: i(["uikit-bbt-footer uikit-sticky uikit-bottom-0 uikit-border-0 uikit-bg-white uikit-px-4 uikit-py-15px sm:uikit-px-6", t.customModalFooterClasses])
157
+ class: o(["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])
154
158
  }, [
155
- d(e.$slots, "footer", { closeModal: s })
156
- ], 2)) : x("", !0),
157
- d(e.$slots, "fixed-bottom")
158
- ], 42, R)
159
+ d(t.$slots, "footer", { closeModal: a })
160
+ ], 2)) : C("", !0),
161
+ d(t.$slots, "fixed-bottom")
162
+ ], 42, G)
159
163
  ], 34), [
160
- [A, o.value]
164
+ [S, i.value]
161
165
  ])
162
166
  ]),
163
167
  _: 3
@@ -166,5 +170,5 @@ const R = ["id", "data-cy"], G = ["innerHTML"], J = /* @__PURE__ */ $({
166
170
  }
167
171
  });
168
172
  export {
169
- J as default
173
+ q as default
170
174
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wikicasa-dev/components",
3
- "version": "2.4.1-alpha.2",
3
+ "version": "2.4.1-alpha.4",
4
4
  "description": "Wikicasa frontend components",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",