@wikicasa-dev/components 2.2.9-alpha.26 → 2.2.9-alpha.28

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.
@@ -1,7 +1,7 @@
1
- import { defineComponent as I, ref as d, useTemplateRef as T, onUnmounted as z, watch as H, createBlock as O, openBlock as f, Teleport as $, createElementVNode as l, normalizeClass as s, withModifiers as y, createElementBlock as h, createCommentVNode as w, renderSlot as c, createVNode as D, unref as F, nextTick as K } from "vue";
2
- import { isWindows as g, awaitableSetTimeout as N } from "@wikicasa-dev/utilities";
3
- import { CloseIcon as S } from "@wikicasa-dev/svg-icons";
4
- const V = ["id", "data-cy"], U = ["innerHTML"], R = /* @__PURE__ */ I({
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
+ import { CloseIcon as V } from "@wikicasa-dev/svg-icons";
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,24 +24,24 @@ const V = ["id", "data-cy"], U = ["innerHTML"], R = /* @__PURE__ */ I({
24
24
  titleClasses: {}
25
25
  },
26
26
  emits: ["closed", "opened", "dialogClick"],
27
- setup(e, { emit: C }) {
28
- const k = C, i = d(!1), r = d(null), a = T("modalDialog"), m = d(!1), u = d(!1), b = ({ 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 = () => {
31
- document?.body.addEventListener("keydown", b);
32
- }, v = () => {
33
- document?.body.removeEventListener("keydown", b);
34
- }, p = async () => {
35
- i.value = !0, K(() => {
36
- x(), g() ? document?.body.classList.add("uikit-no-scrolling", "sm:uikit-pr-15px") : document?.body.classList.add("uikit-no-scrolling");
37
- }), k("opened"), e.autoClose !== void 0 && setTimeout(() => {
30
+ }, C = () => {
31
+ document?.body.addEventListener("keydown", f);
32
+ }, b = () => {
33
+ document?.body.removeEventListener("keydown", f);
34
+ }, x = async () => {
35
+ i.value = !0, N(() => {
36
+ C(), g() ? document?.body.classList.add("uikit-no-scrolling", "sm:uikit-pr-15px") : document?.body.classList.add("uikit-no-scrolling");
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 (t) => {
43
+ l.value && l.value.contains(t.target) && (u.value = !1);
44
+ }, B = async (t) => {
45
45
  if (!r.value?.contains(t.target) && e.closeOnClickOut) {
46
46
  if (u.value) {
47
47
  u.value = !1;
@@ -50,20 +50,24 @@ const V = ["id", "data-cy"], U = ["innerHTML"], R = /* @__PURE__ */ I({
50
50
  await o();
51
51
  }
52
52
  }, o = async () => {
53
- i.value = !1, v(), 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 N(() => {
54
- r.value?.classList.add("uikit-hidden"), k("closed");
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
+ r.value?.classList.add("uikit-hidden"), c("closed");
55
55
  }, 250);
56
56
  };
57
- return z(() => {
58
- v(), 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");
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 ? m.value = !0 : m.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, n) => (f(), 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
72
  ref: r,
69
73
  class: s(["bbt-backdrop uikit-fixed uikit-left-0 uikit-top-0 uikit-h-full uikit-w-full", [
@@ -73,14 +77,14 @@ const V = ["id", "data-cy"], U = ["innerHTML"], R = /* @__PURE__ */ I({
73
77
  },
74
78
  { "uikit-bg-transparent": !i.value },
75
79
  { "sm:uikit-pt-[30px]": !e.centered },
76
- { hide: m.value }
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,
@@ -95,52 +99,51 @@ const V = ["id", "data-cy"], U = ["innerHTML"], R = /* @__PURE__ */ I({
95
99
  e.fullHeight ? "uikit-h-[95%]" : "uikit-h-auto"
96
100
  ]]),
97
101
  tabindex: "-1",
98
- onClick: n[0] || (n[0] = (E) => k("dialogClick", E)),
99
- onFocusin: n[1] || (n[1] = y(() => {
100
- }, ["stop"]))
102
+ onClick: v[0] || (v[0] = (E) => c("dialogClick", E)),
103
+ onFocusin: L
101
104
  }, [
102
- l("div", {
105
+ a("div", {
103
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]])
104
107
  }, [
105
- e.withCloseIcon ? (f(), h("button", {
108
+ e.withCloseIcon ? (m(), y("button", {
106
109
  key: 0,
107
110
  id: "close-icon-btn",
108
111
  "data-cy": "bbt-default-close-icon-btn",
109
112
  class: s(["uikit-absolute uikit-right-15px uikit-top-15px uikit-z-10 uikit-bg-transparent uikit-p-5px", e.closeIconBtnClasses]),
110
113
  type: "button",
111
114
  "aria-label": "Close",
112
- onClick: y(o, ["prevent", "stop"])
115
+ onClick: D(o, ["prevent", "stop"])
113
116
  }, [
114
- D(F(S), {
117
+ F(K(V), {
115
118
  class: s(["bbt-close-icon uikit-box-border", e.closeIcon?.classes]),
116
119
  width: e.closeIcon?.size || 20,
117
120
  height: e.closeIcon?.size || 20
118
121
  }, null, 8, ["class", "width", "height"])
119
- ], 2)) : w("", !0),
120
- c(t.$slots, "header", { closeModal: o }, () => [
121
- l("span", {
122
+ ], 2)) : h("", !0),
123
+ d(t.$slots, "header", { closeModal: o }, () => [
124
+ a("span", {
122
125
  class: s(["uikit-w-auto uikit-text-18 uikit-font-semibold sm:uikit-text-22", e.titleClasses]),
123
126
  innerHTML: e.headerTitle
124
127
  }, null, 10, U)
125
128
  ])
126
129
  ], 2),
127
- l("div", {
130
+ a("div", {
128
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]])
129
132
  }, [
130
- c(t.$slots, "body", { closeModal: o })
133
+ d(t.$slots, "body", { closeModal: o })
131
134
  ], 2),
132
- t.$slots.footer ? (f(), h("div", {
135
+ t.$slots.footer ? (m(), y("div", {
133
136
  key: 0,
134
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])
135
138
  }, [
136
- c(t.$slots, "footer", { closeModal: o })
137
- ], 2)) : w("", !0),
138
- c(t.$slots, "fixed-bottom")
139
- ], 42, V)
139
+ d(t.$slots, "footer", { closeModal: o })
140
+ ], 2)) : h("", !0),
141
+ d(t.$slots, "fixed-bottom")
142
+ ], 42, P)
140
143
  ], 34)
141
144
  ]));
142
145
  }
143
146
  });
144
147
  export {
145
- R as default
148
+ j as default
146
149
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wikicasa-dev/components",
3
- "version": "2.2.9-alpha.26",
3
+ "version": "2.2.9-alpha.28",
4
4
  "description": "Wikicasa frontend components",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",