@wikicasa-dev/components 2.2.8-alpha.24 → 2.2.8-alpha.25

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,5 +1,5 @@
1
1
  import { Autoplay as t } from "swiper/modules";
2
- import '../assets/swiper-autoplay.css';/* empty css */
2
+ import '../assets/swiper-keyboard.css';/* empty css */
3
3
  export {
4
4
  t as Autoplay
5
5
  };
@@ -1,5 +1,5 @@
1
1
  import { Controller as e } from "swiper/modules";
2
- import '../assets/swiper-autoplay.css';/* empty css */
2
+ import '../assets/swiper-keyboard.css';/* empty css */
3
3
  export {
4
4
  e as Controller
5
5
  };
@@ -1,5 +1,5 @@
1
1
  import { Keyboard as m } from "swiper/modules";
2
- import '../assets/swiper-autoplay.css';/* empty css */
2
+ import '../assets/swiper-keyboard.css';/* empty css */
3
3
  export {
4
4
  m as Keyboard
5
5
  };
@@ -1,5 +1,5 @@
1
1
  import { Thumbs as p } from "swiper/modules";
2
- import '../assets/swiper-autoplay.css';/* empty css */
2
+ import '../assets/swiper-keyboard.css';/* empty css */
3
3
  export {
4
4
  p as Thumbs
5
5
  };
@@ -1,11 +1,11 @@
1
- import { defineComponent as $, mergeModels as y, useId as T, useModel as C, shallowRef as h, computed as W, useTemplateRef as g, onMounted as H, watch as n, nextTick as N, createElementBlock as V, openBlock as c, normalizeClass as i, renderSlot as D, createBlock as x, createVNode as R, unref as r, withCtx as B, createElementVNode as q, createCommentVNode as z, resolveDynamicComponent as F } from "vue";
2
- import j from "./BaseButton.vue.js";
3
- import { ArrowIcon as G } from "@wikicasa-dev/svg-icons";
4
- import { useKeyboardController as J } from "@wikicasa-dev/vue-composables";
5
- const P = ["innerHTML"], _ = /* @__PURE__ */ $({
1
+ import { defineComponent as T, mergeModels as D, useId as H, useModel as E, shallowRef as x, computed as N, useTemplateRef as B, onMounted as V, onUnmounted as z, watch as l, nextTick as R, createElementBlock as U, openBlock as c, normalizeClass as a, renderSlot as I, createBlock as L, createVNode as q, unref as r, withCtx as S, createElementVNode as G, createCommentVNode as j, resolveDynamicComponent as F } from "vue";
2
+ import J from "./BaseButton.vue.js";
3
+ import { ArrowIcon as P } from "@wikicasa-dev/svg-icons";
4
+ import { useKeyboardController as Q } from "@wikicasa-dev/vue-composables";
5
+ const X = ["innerHTML"], oe = /* @__PURE__ */ T({
6
6
  inheritAttrs: !1,
7
7
  __name: "BaseDropDown",
8
- props: /* @__PURE__ */ y({
8
+ props: /* @__PURE__ */ D({
9
9
  dropdownClasses: { default: "" },
10
10
  btnClasses: { default: "" },
11
11
  withArrowIcon: { type: Boolean, default: !1 },
@@ -27,118 +27,125 @@ const P = ["innerHTML"], _ = /* @__PURE__ */ $({
27
27
  resetKeyboardController: { type: Boolean, default: !1 },
28
28
  resetKeyboardControllerModifiers: {}
29
29
  }),
30
- emits: /* @__PURE__ */ y(["click", "update:dropdownState"], ["update:toggleDropdown", "update:resetKeyboardController"]),
31
- setup(t, { expose: I, emit: S }) {
32
- const l = t, f = T(), k = S, w = C(t, "toggleDropdown"), v = C(
33
- t,
30
+ emits: /* @__PURE__ */ D(["click", "update:dropdownState"], ["update:toggleDropdown", "update:resetKeyboardController"]),
31
+ setup(o, { expose: K, emit: A }) {
32
+ const n = o, f = H(), k = A, v = E(o, "toggleDropdown"), w = E(
33
+ o,
34
34
  "resetKeyboardController"
35
- ), o = h(!1), u = h([]), A = W(() => u.value.length), K = g("container"), m = g("dropdown"), { activeIdx: d, selectedIdx: a } = J({
36
- optionsLength: A,
37
- isDropdownOpen: o,
38
- activate: l.activateKeyboardController
39
- }), E = () => {
40
- o.value = !1;
41
- }, L = (e) => {
42
- l.closeWhenClickedOutside && (K.value?.contains(e.relatedTarget) || E());
35
+ );
36
+ let m = !1;
37
+ const t = x(!1), u = x([]), M = N(() => u.value.length), p = B("container"), y = B("dropdown"), { activeIdx: d, selectedIdx: i } = Q({
38
+ optionsLength: M,
39
+ isDropdownOpen: t,
40
+ activate: n.activateKeyboardController
41
+ }), O = () => {
42
+ t.value = !1;
43
+ }, b = ({ target: e }) => {
44
+ p.value?.contains(e) || O();
45
+ }, C = (e) => {
46
+ t.value && p.value?.contains(document.activeElement) && (console.log("DEBUG:closing dropdown", document.activeElement), e.key === "Tab" && (t.value = !1));
43
47
  }, s = () => {
44
- l.keepState === "closed" && !o.value || l.keepState === "opened" && o.value || (o.value = !o.value);
45
- }, M = (e) => {
48
+ n.keepState === "closed" && !t.value || n.keepState === "opened" && t.value || (t.value = !t.value);
49
+ }, W = (e) => {
46
50
  e != null && (d.value = e);
47
- }, O = (e) => {
48
- e != null && (a.value = e);
49
- }, p = () => {
50
- m.value && (u.value = Array.from(m.value.children));
51
+ }, $ = (e) => {
52
+ e != null && (i.value = e);
53
+ }, h = () => {
54
+ y.value && (u.value = Array.from(y.value.children));
51
55
  };
52
- return H(() => {
53
- p();
54
- }), n(v, (e) => {
55
- e && (d.value = -1, a.value = -1, N(() => {
56
- p(), v.value = !1;
56
+ return V(() => {
57
+ h();
58
+ }), z(() => {
59
+ n.closeWhenClickedOutside && (document.removeEventListener("click", b), document.removeEventListener("keydown", C));
60
+ }), l(w, (e) => {
61
+ e && (d.value = -1, i.value = -1, R(() => {
62
+ h(), w.value = !1;
57
63
  }));
58
- }), n(
59
- () => l.openDropdown,
64
+ }), l(
65
+ () => n.openDropdown,
60
66
  (e) => {
61
- o.value = e;
67
+ t.value = e;
62
68
  },
63
69
  {
64
70
  immediate: !0
65
71
  }
66
- ), n(o, (e) => {
72
+ ), l(t, (e) => {
67
73
  k("update:dropdownState", e);
68
- }), n(w, (e) => {
69
- e && (o.value = !o.value, w.value = !1);
70
- }), n(a, (e) => {
74
+ }), l(t, (e) => {
75
+ !e || m || !n.closeWhenClickedOutside || (document.addEventListener("click", b), document.addEventListener("keydown", C), m = !0);
76
+ }), l(v, (e) => {
77
+ e && (t.value = !t.value, v.value = !1);
78
+ }), l(i, (e) => {
71
79
  e !== -1 && u.value[e].querySelector("a")?.click();
72
- }), I({
80
+ }), K({
73
81
  activeIdx: d,
74
- selectedIdx: a
75
- }), (e, b) => (c(), V("div", {
82
+ selectedIdx: i
83
+ }), (e, g) => (c(), U("div", {
76
84
  ref: "container",
77
- class: i(["uikit-relative uikit-block", e.$attrs.class]),
78
- onFocusout: L
85
+ class: a(["uikit-relative uikit-block", e.$attrs.class])
79
86
  }, [
80
- D(e.$slots, "btn_slot", {
87
+ I(e.$slots, "btn_slot", {
81
88
  toggleDropdown: s,
82
- isOpen: o.value
89
+ isOpen: t.value
83
90
  }, () => [
84
- R(j, {
91
+ q(J, {
85
92
  id: r(f),
86
93
  type: "button",
87
- "data-cy": t.dataCy,
88
- class: i([
94
+ "data-cy": o.dataCy,
95
+ class: a([
89
96
  "!uikit-flex uikit-w-full uikit-items-center uikit-truncate",
90
- t.btnClasses
97
+ o.btnClasses
91
98
  ]),
92
- "aria-expanded": o.value,
99
+ "aria-expanded": t.value,
93
100
  "btn-class": "uikit-btn-single-selection",
94
- onClick: b[0] || (b[0] = (Q) => {
101
+ onClick: g[0] || (g[0] = (Y) => {
95
102
  k("click"), s();
96
103
  })
97
104
  }, {
98
- default: B(() => [
99
- q("span", {
100
- class: i(["uikit-mr-5px", t.labelClasses]),
101
- innerHTML: t.btnLabel
102
- }, null, 10, P),
103
- t.withArrowIcon ? (c(), x(r(G), {
105
+ default: S(() => [
106
+ G("span", {
107
+ class: a(["uikit-mr-5px", o.labelClasses]),
108
+ innerHTML: o.btnLabel
109
+ }, null, 10, X),
110
+ o.withArrowIcon ? (c(), L(r(P), {
104
111
  key: 0,
105
- class: i(["uikit-shrink-0 uikit-transition-transform motion-reduce:uikit-transition-none", o.value ? "uikit-rotate-180" : ""]),
106
- width: t.arrowWidth,
107
- height: t.arrowWidth,
108
- "stroke-color": t.arrowStrokeColor
109
- }, null, 8, ["class", "width", "height", "stroke-color"])) : z("", !0)
112
+ class: a(["uikit-shrink-0 uikit-transition-transform motion-reduce:uikit-transition-none", t.value ? "uikit-rotate-180" : ""]),
113
+ width: o.arrowWidth,
114
+ height: o.arrowWidth,
115
+ "stroke-color": o.arrowStrokeColor
116
+ }, null, 8, ["class", "width", "height", "stroke-color"])) : j("", !0)
110
117
  ]),
111
118
  _: 1
112
119
  }, 8, ["id", "data-cy", "class", "aria-expanded"])
113
120
  ]),
114
- (c(), x(F(t.dropdownElement), {
121
+ (c(), L(F(o.dropdownElement), {
115
122
  id: "dropdown_" + r(f),
116
123
  ref: "dropdown",
117
- "data-cy": t.dataCy && `${t.dataCy}_dropdown`,
118
- class: i(["uikit-dropdown-content uikit-w-full uikit-flex-col uikit-overflow-y-auto uikit-border uikit-border-solid uikit-bg-white uikit-pl-0 uikit-opacity-100 uikit-shadow uikit-no-scrollbar", [
119
- t.dropdownClasses,
120
- o.value ? "uikit-flex" : "uikit-hidden",
121
- { "uikit-bottom-[55px] uikit-rounded-xs": t.direction === "up" },
122
- { "uikit-rounded-b uikit-border-t-0": t.direction === "down" },
123
- { "uikit-absolute": t.isAbsolute }
124
+ "data-cy": o.dataCy && `${o.dataCy}_dropdown`,
125
+ class: a(["uikit-dropdown-content uikit-w-full uikit-flex-col uikit-overflow-y-auto uikit-border uikit-border-solid uikit-bg-white uikit-pl-0 uikit-opacity-100 uikit-shadow uikit-no-scrollbar", [
126
+ o.dropdownClasses,
127
+ t.value ? "uikit-flex" : "uikit-hidden",
128
+ { "uikit-bottom-[55px] uikit-rounded-xs": o.direction === "up" },
129
+ { "uikit-rounded-b uikit-border-t-0": o.direction === "down" },
130
+ { "uikit-absolute": o.isAbsolute }
124
131
  ]]),
125
- "aria-hidden": !o.value
132
+ "aria-hidden": !t.value
126
133
  }, {
127
- default: B(() => [
128
- D(e.$slots, "default", {
129
- isOpen: o.value,
134
+ default: S(() => [
135
+ I(e.$slots, "default", {
136
+ isOpen: t.value,
130
137
  toggleDropdown: s,
131
138
  activeIdx: r(d),
132
- selectedIdx: r(a),
133
- setActiveIdx: M,
134
- setSelectedIdx: O
139
+ selectedIdx: r(i),
140
+ setActiveIdx: W,
141
+ setSelectedIdx: $
135
142
  })
136
143
  ]),
137
144
  _: 3
138
145
  }, 8, ["id", "data-cy", "class", "aria-hidden"]))
139
- ], 34));
146
+ ], 2));
140
147
  }
141
148
  });
142
149
  export {
143
- _ as default
150
+ oe as default
144
151
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wikicasa-dev/components",
3
- "version": "2.2.8-alpha.24",
3
+ "version": "2.2.8-alpha.25",
4
4
  "description": "Wikicasa frontend components",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",