@wikicasa-dev/components 2.2.9-alpha.18 → 2.2.9-alpha.20

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-thumbs.css';/* empty css */
2
+ import '../assets/swiper-controller.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-thumbs.css';/* empty css */
2
+ import '../assets/swiper-controller.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-thumbs.css';/* empty css */
2
+ import '../assets/swiper-controller.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-thumbs.css';/* empty css */
2
+ import '../assets/swiper-controller.css';/* empty css */
3
3
  export {
4
4
  p as Thumbs
5
5
  };
@@ -18,6 +18,13 @@ type __VLS_Props = {
18
18
  dropdownElement?: "div" | "ul" | "ol";
19
19
  keepState?: "opened" | "closed" | "";
20
20
  activateKeyboardController?: boolean;
21
+ /**
22
+ * List of keys that will close the dropdown.
23
+ * For the full list of keys, see
24
+ * @link https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values
25
+ * @default "Escape" and "Enter"
26
+ */
27
+ closeKeys?: false | string[];
21
28
  dataCy?: string;
22
29
  };
23
30
  type __VLS_PublicProps = {
@@ -78,6 +85,7 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps,
78
85
  dropdownElement: "div" | "ul" | "ol";
79
86
  keepState: "opened" | "closed" | "";
80
87
  activateKeyboardController: boolean;
88
+ closeKeys: false | string[];
81
89
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
82
90
  container: HTMLDivElement;
83
91
  dropdown: unknown;
@@ -1,4 +1,4 @@
1
- import { defineComponent as N, mergeModels as D, useId as R, useModel as E, shallowRef as x, computed as V, useTemplateRef as B, onMounted as z, onUnmounted as U, watch as l, nextTick as q, createElementBlock as G, openBlock as k, normalizeClass as i, renderSlot as I, createBlock as K, createVNode as j, unref as r, withCtx as L, createElementVNode as F, createCommentVNode as J, resolveDynamicComponent as P } from "vue";
1
+ import { defineComponent as N, mergeModels as D, useId as R, useModel as E, shallowRef as K, computed as V, useTemplateRef as B, onMounted as z, onUnmounted as U, watch as l, nextTick as q, createElementBlock as G, openBlock as k, normalizeClass as i, renderSlot as x, createBlock as I, createVNode as j, unref as r, withCtx as L, createElementVNode as F, createCommentVNode as J, resolveDynamicComponent as P } from "vue";
2
2
  import Q from "./BaseButton.vue.js";
3
3
  import { ArrowIcon as X } from "@wikicasa-dev/svg-icons";
4
4
  import { useKeyboardController as Y } from "@wikicasa-dev/vue-composables";
@@ -20,6 +20,7 @@ const Z = ["innerHTML"], le = /* @__PURE__ */ N({
20
20
  dropdownElement: { default: "div" },
21
21
  keepState: { default: "" },
22
22
  activateKeyboardController: { type: Boolean, default: !0 },
23
+ closeKeys: { type: [Boolean, Array], default: () => ["Escape", "Enter"] },
23
24
  dataCy: { default: "" }
24
25
  }, {
25
26
  toggleDropdown: { type: Boolean, default: void 0 },
@@ -29,21 +30,22 @@ const Z = ["innerHTML"], le = /* @__PURE__ */ N({
29
30
  }),
30
31
  emits: /* @__PURE__ */ D(["click", "update:dropdownState"], ["update:toggleDropdown", "update:resetKeyboardController"]),
31
32
  setup(o, { expose: S, emit: A }) {
32
- const n = o, v = R(), w = A, m = E(o, "toggleDropdown"), p = E(
33
+ const n = o, v = R(), w = A, m = E(o, "toggleDropdown"), y = E(
33
34
  o,
34
35
  "resetKeyboardController"
35
36
  );
36
- let y = !1;
37
- const t = x(!1), u = x([]), M = V(() => u.value.length), s = B("container"), c = B("dropdown"), { activeIdx: d, selectedIdx: a, onKeyDownHandler: O } = Y({
37
+ let p = !1;
38
+ const t = K(!1), s = K([]), M = V(() => s.value.length), u = B("container"), c = B("dropdown"), { activeIdx: d, selectedIdx: a, onKeyDownHandler: O } = Y({
38
39
  optionsLength: M,
39
40
  isDropdownOpen: t,
40
- global: !1
41
+ global: !1,
42
+ closeKeys: n.closeKeys ? n.closeKeys : []
41
43
  }), W = () => {
42
44
  t.value = !1;
43
45
  }, b = ({ target: e }) => {
44
- s.value?.contains(e) || W();
46
+ u.value?.contains(e) || W();
45
47
  }, g = (e) => {
46
- t.value && (s.value?.contains(e.target) || (t.value = !1));
48
+ t.value && (u.value?.contains(e.target) || (t.value = !1));
47
49
  }, $ = (e) => {
48
50
  if (!n.activateKeyboardController) {
49
51
  console.log("DEBUG:not triggering kkeyboard controller");
@@ -57,15 +59,15 @@ const Z = ["innerHTML"], le = /* @__PURE__ */ N({
57
59
  }, T = (e) => {
58
60
  e != null && (a.value = e);
59
61
  }, C = () => {
60
- c.value && (u.value = Array.from(c.value.children));
62
+ c.value && (s.value = Array.from(c.value.children));
61
63
  };
62
64
  return z(() => {
63
65
  C();
64
66
  }), U(() => {
65
67
  n.closeWhenClickedOutside && (document.removeEventListener("click", b), document.removeEventListener("focusin", g));
66
- }), l(p, (e) => {
68
+ }), l(y, (e) => {
67
69
  e && (d.value = -1, a.value = -1, q(() => {
68
- C(), p.value = !1;
70
+ C(), y.value = !1;
69
71
  }));
70
72
  }), l(
71
73
  () => n.openDropdown,
@@ -78,22 +80,22 @@ const Z = ["innerHTML"], le = /* @__PURE__ */ N({
78
80
  ), l(t, (e) => {
79
81
  w("update:dropdownState", e);
80
82
  }), l(t, (e) => {
81
- !e || y || !n.closeWhenClickedOutside || (document.addEventListener("click", b), document.addEventListener("focusin", g), y = !0);
83
+ !e || p || !n.closeWhenClickedOutside || (document.addEventListener("click", b), document.addEventListener("focusin", g), p = !0);
82
84
  }), l(m, (e) => {
83
85
  e && (t.value = !t.value, m.value = !1);
84
86
  }), l(a, (e) => {
85
- e !== -1 && u.value[e].querySelector("a")?.click();
87
+ e !== -1 && s.value[e]?.querySelector("a")?.click();
86
88
  }), S({
87
89
  activeIdx: d,
88
90
  selectedIdx: a,
89
- getRootElement: () => s.value,
91
+ getRootElement: () => u.value,
90
92
  getContentElement: () => c.value
91
93
  }), (e, h) => (k(), G("div", {
92
94
  ref: "container",
93
95
  class: i(["uikit-relative uikit-block", e.$attrs.class]),
94
96
  onKeydown: $
95
97
  }, [
96
- I(e.$slots, "btn_slot", {
98
+ x(e.$slots, "btn_slot", {
97
99
  toggleDropdown: f,
98
100
  isOpen: t.value
99
101
  }, () => [
@@ -116,7 +118,7 @@ const Z = ["innerHTML"], le = /* @__PURE__ */ N({
116
118
  class: i(["uikit-mr-5px", o.labelClasses]),
117
119
  innerHTML: o.btnLabel
118
120
  }, null, 10, Z),
119
- o.withArrowIcon ? (k(), K(r(X), {
121
+ o.withArrowIcon ? (k(), I(r(X), {
120
122
  key: 0,
121
123
  class: i(["uikit-shrink-0 uikit-transition-transform motion-reduce:uikit-transition-none", t.value ? "uikit-rotate-180" : ""]),
122
124
  width: o.arrowWidth,
@@ -127,7 +129,7 @@ const Z = ["innerHTML"], le = /* @__PURE__ */ N({
127
129
  _: 1
128
130
  }, 8, ["id", "data-cy", "class", "aria-expanded"])
129
131
  ]),
130
- (k(), K(P(o.dropdownElement), {
132
+ (k(), I(P(o.dropdownElement), {
131
133
  id: "dropdown_" + r(v),
132
134
  ref: "dropdown",
133
135
  "data-cy": o.dataCy && `${o.dataCy}_dropdown`,
@@ -141,7 +143,7 @@ const Z = ["innerHTML"], le = /* @__PURE__ */ N({
141
143
  "aria-hidden": !t.value
142
144
  }, {
143
145
  default: L(() => [
144
- I(e.$slots, "default", {
146
+ x(e.$slots, "default", {
145
147
  isOpen: t.value,
146
148
  toggleDropdown: f,
147
149
  activeIdx: r(d),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wikicasa-dev/components",
3
- "version": "2.2.9-alpha.18",
3
+ "version": "2.2.9-alpha.20",
4
4
  "description": "Wikicasa frontend components",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -44,7 +44,7 @@
44
44
  "vue": "^3.5.0",
45
45
  "date-fns": "^4.0.0",
46
46
  "@wikicasa-dev/svg-icons": "^1.2.24",
47
- "@wikicasa-dev/vue-composables": "^0.0.29",
47
+ "@wikicasa-dev/vue-composables": "^0.0.32",
48
48
  "@wikicasa-dev/types": "^2.4.0",
49
49
  "@wikicasa-dev/utilities": "^1.2.0"
50
50
  },
@@ -64,7 +64,7 @@
64
64
  "@vue/eslint-config-prettier": "^10.2.0",
65
65
  "@vue/eslint-config-typescript": "^14.6.0",
66
66
  "@wikicasa-dev/svg-icons": "1.2.24",
67
- "@wikicasa-dev/vue-composables": "0.0.29",
67
+ "@wikicasa-dev/vue-composables": "0.0.32",
68
68
  "@wikicasa-dev/tailwind-plugins": "^0.0.3",
69
69
  "@wikicasa-dev/types": "2.4.6",
70
70
  "@wikicasa-dev/utilities": "1.2.0",