@wikicasa-dev/components 2.4.1-alpha.18 → 2.4.1-alpha.3

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.
@@ -12,6 +12,7 @@ type __VLS_Props = {
12
12
  classes?: ClassTypeProp;
13
13
  }>;
14
14
  withCloseIcon?: boolean;
15
+ showModal?: boolean;
15
16
  headerTitle?: string;
16
17
  autoClose?: number;
17
18
  fullHeight?: boolean;
@@ -23,10 +24,8 @@ type __VLS_Props = {
23
24
  dataCy?: string;
24
25
  closeIconBtnClasses?: ClassTypeProp;
25
26
  titleClasses?: ClassTypeProp;
27
+ appear?: boolean;
26
28
  };
27
- type __VLS_PublicProps = {
28
- "showModal"?: boolean;
29
- } & __VLS_Props;
30
29
  declare function __VLS_template(): {
31
30
  attrs: Partial<{}>;
32
31
  slots: {
@@ -48,16 +47,14 @@ declare function __VLS_template(): {
48
47
  rootEl: any;
49
48
  };
50
49
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
51
- declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
50
+ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
52
51
  opened: () => any;
53
52
  closed: () => any;
54
53
  dialogClick: (args_0: MouseEvent) => any;
55
- "update:showModal": (value: boolean) => any;
56
- }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
54
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
57
55
  onOpened?: (() => any) | undefined;
58
56
  onClosed?: (() => any) | undefined;
59
57
  onDialogClick?: ((args_0: MouseEvent) => any) | undefined;
60
- "onUpdate:showModal"?: ((value: boolean) => any) | undefined;
61
58
  }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
62
59
  backdrop: HTMLDivElement;
63
60
  modalDialog: HTMLDialogElement;
@@ -1 +1 @@
1
- .no-transition[data-v-705dfad0]{transition-duration:0ms!important}.disable-select[data-v-705dfad0]{-webkit-user-select:none;-moz-user-select:none;user-select:none}.swiper-button-disabled[data-v-705dfad0]{pointer-events:auto!important}
1
+ .no-transition[data-v-1ea2f6ce]{transition-duration:0ms!important}.disable-select[data-v-1ea2f6ce]{-webkit-user-select:none;-moz-user-select:none;user-select:none}.swiper-button-disabled[data-v-1ea2f6ce]{pointer-events:auto!important}
@@ -0,0 +1,10 @@
1
+ import { ChartOptions, ChartType } from 'chart.js';
2
+ export declare const useChartJsModules: <T extends ChartType = ChartType>(options: ChartOptions<T>) => {
3
+ registerTitle: () => Promise<void>;
4
+ registerLegend: () => Promise<void>;
5
+ registerTooltip: () => Promise<void>;
6
+ registerTimeCartesianAxis: () => Promise<void>;
7
+ executeRegistration: (...args: (() => Promise<unknown>)[]) => Promise<void>;
8
+ registerPlugins: () => Promise<void>;
9
+ resolved: import('vue').Ref<boolean, boolean>;
10
+ };
@@ -0,0 +1,37 @@
1
+ import { computed as t, ref as f } from "vue";
2
+ import { Chart as r, TimeScale as d, Tooltip as T, Legend as h, Title as w } from "chart.js";
3
+ import "chartjs-adapter-date-fns";
4
+ const L = (e) => {
5
+ if (!e) throw Error("Options must be defined");
6
+ const l = t(
7
+ () => !!e.plugins?.tooltip
8
+ ), o = t(
9
+ () => e.scales?.x?.type === "time"
10
+ ), c = t(() => !!e.plugins?.title), u = t(
11
+ () => !!e.plugins?.legend
12
+ ), i = async () => {
13
+ l.value && r.register(T);
14
+ }, g = async () => {
15
+ o.value && r.register(d);
16
+ }, s = async () => {
17
+ c.value && r.register(w);
18
+ }, n = async () => {
19
+ u.value && r.register(h);
20
+ }, a = f(!1);
21
+ return {
22
+ registerTitle: s,
23
+ registerLegend: n,
24
+ registerTooltip: i,
25
+ registerTimeCartesianAxis: g,
26
+ executeRegistration: async (...m) => {
27
+ await Promise.all(m.map((p) => p())), a.value = !0;
28
+ },
29
+ registerPlugins: async () => {
30
+ await Promise.all([i(), s(), n()]);
31
+ },
32
+ resolved: a
33
+ };
34
+ };
35
+ export {
36
+ L as useChartJsModules
37
+ };
@@ -42,9 +42,9 @@ declare const __VLS_component: import('vue').DefineComponent<IntersectionObserve
42
42
  }, string, import('vue').PublicProps, Readonly<IntersectionObserverProps> & Readonly<{
43
43
  onIntersection?: (() => any) | undefined;
44
44
  }>, {
45
+ threshold: number;
45
46
  observeOnce: boolean;
46
47
  skip: boolean;
47
- threshold: number;
48
48
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
49
49
  root: HTMLDivElement;
50
50
  }, any>;
@@ -1,5 +1,6 @@
1
1
  import { Image } from '@wikicasa-dev/types';
2
- import { Swiper, SwiperOptions } from 'swiper/types';
2
+ import { Swiper } from 'swiper';
3
+ import { SwiperOptions } from 'swiper/types';
3
4
  type SwiperCarouselProps = {
4
5
  id?: string;
5
6
  swiperOptions: SwiperOptions;
@@ -20,8 +21,8 @@ declare function __VLS_template(): {
20
21
  last_slide?(_: {}): any;
21
22
  };
22
23
  refs: {
23
- rootRef: HTMLDivElement;
24
- swiperWrapperRef: HTMLDivElement;
24
+ root: HTMLDivElement;
25
+ swiperWrapper: HTMLDivElement;
25
26
  };
26
27
  rootEl: any;
27
28
  };
@@ -2364,8 +2365,8 @@ declare const __VLS_component: import('vue').DefineComponent<SwiperCarouselProps
2364
2365
  onFirstSlideLoaded?: (() => any) | undefined;
2365
2366
  onInit?: (() => any) | undefined;
2366
2367
  }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
2367
- rootRef: HTMLDivElement;
2368
- swiperWrapperRef: HTMLDivElement;
2368
+ root: HTMLDivElement;
2369
+ swiperWrapper: HTMLDivElement;
2369
2370
  }, any>;
2370
2371
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
2371
2372
  export default _default;
@@ -2,7 +2,7 @@ import o from "../../packages/components/lib/components/carousel/SwiperCarousel.
2
2
  import '../../assets/SwiperCarousel2.css';import '../../assets/SwiperCarousel.css';/* empty css */
3
3
  /* empty css */
4
4
  import r from "../../_virtual/_plugin-vue_export-helper.js";
5
- const e = /* @__PURE__ */ r(o, [["__scopeId", "data-v-705dfad0"]]);
5
+ const m = /* @__PURE__ */ r(o, [["__scopeId", "data-v-1ea2f6ce"]]);
6
6
  export {
7
- e as default
7
+ m as default
8
8
  };
@@ -1,8 +1,8 @@
1
- import { defineComponent as A, mergeModels as h, useModel as F, useTemplateRef as y, shallowRef as C, onUnmounted as K, createBlock as N, openBlock as k, Teleport as S, createVNode as w, Transition as V, unref as p, withCtx as P, withDirectives as R, createElementVNode as l, normalizeClass as i, createElementBlock as x, createCommentVNode as g, renderSlot as d, withModifiers as U, vShow as j } from "vue";
2
- import { CloseIcon as q } from "@wikicasa-dev/svg-icons";
3
- const G = ["id", "data-cy"], J = ["innerHTML"], X = /* @__PURE__ */ A({
1
+ import { defineComponent as T, shallowRef as v, useTemplateRef as h, onUnmounted as D, watch as $, createBlock as H, openBlock as c, Teleport as O, createVNode as y, Transition as F, withCtx as K, withDirectives as N, createElementVNode as l, normalizeClass as i, createElementBlock as C, createCommentVNode as w, renderSlot as d, withModifiers as S, unref as U, vShow as V } from "vue";
2
+ import { CloseIcon as A } from "@wikicasa-dev/svg-icons";
3
+ const P = ["id", "data-cy"], R = ["innerHTML"], q = /* @__PURE__ */ T({
4
4
  __name: "BaseModal",
5
- props: /* @__PURE__ */ h({
5
+ props: {
6
6
  id: { default: "base-bt-modal" },
7
7
  size: { default: "modal-md" },
8
8
  customBackdropClasses: {},
@@ -12,6 +12,7 @@ const G = ["id", "data-cy"], J = ["innerHTML"], X = /* @__PURE__ */ A({
12
12
  customModalFooterClasses: {},
13
13
  closeIcon: {},
14
14
  withCloseIcon: { type: Boolean, default: !0 },
15
+ showModal: { type: Boolean, default: !0 },
15
16
  headerTitle: { default: "" },
16
17
  autoClose: {},
17
18
  fullHeight: { type: Boolean, default: !1 },
@@ -19,74 +20,75 @@ const G = ["id", "data-cy"], J = ["innerHTML"], X = /* @__PURE__ */ A({
19
20
  centered: { type: Boolean, default: !1 },
20
21
  dataCy: {},
21
22
  closeIconBtnClasses: {},
22
- titleClasses: {}
23
- }, {
24
- showModal: { type: Boolean, default: !0 },
25
- showModalModifiers: {}
26
- }),
27
- emits: /* @__PURE__ */ h(["closed", "opened", "dialogClick"], ["update:showModal"]),
28
- setup(e, { emit: M }) {
29
- const r = M, o = F(e, "showModal"), B = o.value, m = y("backdrop"), a = y("modalDialog"), u = C(!1), c = C(!1), f = ({ key: t }) => {
30
- t === "Escape" && s();
31
- }, E = () => {
32
- document?.body.addEventListener("keydown", f);
33
- }, b = () => {
34
- document?.body.removeEventListener("keydown", f);
35
- }, I = () => {
36
- c.value || (E(), document?.body.classList.add(
23
+ titleClasses: {},
24
+ appear: { type: Boolean, default: !0 }
25
+ },
26
+ emits: ["closed", "opened", "dialogClick"],
27
+ setup(e, { emit: x }) {
28
+ const r = x, o = v(!1), k = h("backdrop"), s = h("modalDialog"), u = v(!1), m = ({ key: t }) => {
29
+ t === "Escape" && a();
30
+ }, p = () => {
31
+ document?.body.addEventListener("keydown", m);
32
+ }, f = () => {
33
+ document?.body.removeEventListener("keydown", m);
34
+ }, g = () => {
35
+ console.log("DEBUG:onBeforeEnter called"), p(), document?.body.classList.add(
37
36
  "sm:uikit-pr-15px",
38
37
  "sm:uikit-mr-0",
39
38
  "uikit-overflow-hidden"
40
- ), c.value = !0);
41
- }, L = () => {
39
+ );
40
+ }, B = () => {
42
41
  r("opened"), e.autoClose !== void 0 && setTimeout(() => {
43
- s();
42
+ a();
44
43
  }, e.autoClose);
45
- }, z = () => {
46
- document?.body.classList.remove(
44
+ }, M = () => {
45
+ f(), document?.body.classList.remove(
47
46
  "sm:uikit-pr-15px",
48
47
  "sm:uikit-mr-0",
49
48
  "uikit-overflow-hidden"
50
- );
51
- }, T = () => {
52
- b(), c.value = !1, r("closed");
53
- }, s = () => {
49
+ ), r("closed");
50
+ }, a = () => {
54
51
  o.value = !1;
55
- }, $ = (t) => {
56
- a.value && a.value.contains(t.target) && (u.value = !0);
57
- }, D = (t) => {
58
- a.value && a.value.contains(t.target) && (u.value = !1);
59
- }, H = async (t) => {
60
- if (!(t.target !== m.value && m.value?.contains(t.target)) && e.closeOnClickOut) {
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) {
61
58
  if (u.value) {
62
59
  u.value = !1;
63
60
  return;
64
61
  }
65
- s();
62
+ a();
66
63
  }
67
64
  };
68
- K(() => {
69
- b(), document?.body.classList.remove(
65
+ D(() => {
66
+ f(), document?.body.classList.remove(
70
67
  "sm:uikit-pr-15px",
71
68
  "sm:uikit-mr-0",
72
69
  "uikit-overflow-hidden"
73
70
  );
74
- });
75
- const O = (t) => {
76
- a.value === t.target && t.stopPropagation();
71
+ }), $(
72
+ () => e.showModal,
73
+ async (t) => {
74
+ o.value = t;
75
+ },
76
+ { immediate: !0 }
77
+ );
78
+ const z = (t) => {
79
+ s.value === t.target && t.stopPropagation();
77
80
  };
78
- return (t, n) => (k(), N(S, { to: "body" }, [
79
- w(V, {
80
- appear: p(B),
81
+ return (t, n) => (c(), H(O, { to: "body" }, [
82
+ y(F, {
83
+ appear: e.appear,
81
84
  name: "modal-transition",
82
85
  duration: { enter: 500, leave: 250 },
83
- onBeforeEnter: I,
84
- onAfterEnter: L,
85
- onLeave: z,
86
- onAfterLeave: T
86
+ onBeforeEnter: g,
87
+ onAfterEnter: B,
88
+ onAfterLeave: M
87
89
  }, {
88
- default: P(() => [
89
- R(l("div", {
90
+ default: K(() => [
91
+ N(l("div", {
90
92
  ref: "backdrop",
91
93
  class: i(["bbt-backdrop uikit-fixed uikit-left-0 uikit-top-0 uikit-z-50 uikit-h-full uikit-w-full", [
92
94
  e.customBackdropClasses,
@@ -96,9 +98,9 @@ const G = ["id", "data-cy"], J = ["innerHTML"], X = /* @__PURE__ */ A({
96
98
  { "uikit-bg-transparent": !o.value },
97
99
  { "sm:uikit-pt-[30px]": !e.centered }
98
100
  ]]),
99
- onClick: H,
100
- onMousedown: $,
101
- onMouseup: D
101
+ onClick: L,
102
+ onMousedown: E,
103
+ onMouseup: I
102
104
  }, [
103
105
  l("dialog", {
104
106
  id: e.id,
@@ -114,49 +116,49 @@ const G = ["id", "data-cy"], J = ["innerHTML"], X = /* @__PURE__ */ A({
114
116
  e.fullHeight ? "uikit-h-[95%]" : "uikit-h-auto"
115
117
  ]]),
116
118
  tabindex: "-1",
117
- onClick: n[1] || (n[1] = (v) => r("dialogClick", v)),
118
- onFocusin: O
119
+ onClick: n[1] || (n[1] = (b) => r("dialogClick", b)),
120
+ onFocusin: z
119
121
  }, [
120
122
  l("div", {
121
123
  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", [e.customModalHeaderClasses]])
122
124
  }, [
123
- e.withCloseIcon ? (k(), x("button", {
125
+ e.withCloseIcon ? (c(), C("button", {
124
126
  key: 0,
125
127
  id: "close-icon-btn",
126
128
  "data-cy": "bbt-default-close-icon-btn",
127
129
  class: i(["uikit-absolute uikit-right-15px uikit-top-15px uikit-z-10 uikit-bg-transparent uikit-p-5px", e.closeIconBtnClasses]),
128
130
  type: "button",
129
131
  "aria-label": "Close",
130
- onClick: n[0] || (n[0] = U((v) => o.value = !1, ["prevent", "stop"]))
132
+ onClick: n[0] || (n[0] = S((b) => o.value = !1, ["prevent", "stop"]))
131
133
  }, [
132
- w(p(q), {
134
+ y(U(A), {
133
135
  class: i(["bbt-close-icon uikit-box-border", e.closeIcon?.classes]),
134
136
  width: e.closeIcon?.size || 20,
135
137
  height: e.closeIcon?.size || 20
136
138
  }, null, 8, ["class", "width", "height"])
137
- ], 2)) : g("", !0),
138
- d(t.$slots, "header", { closeModal: s }, () => [
139
+ ], 2)) : w("", !0),
140
+ d(t.$slots, "header", { closeModal: a }, () => [
139
141
  l("span", {
140
142
  class: i(["uikit-w-auto uikit-text-18 uikit-font-semibold sm:uikit-text-22", e.titleClasses]),
141
143
  innerHTML: e.headerTitle
142
- }, null, 10, J)
144
+ }, null, 10, R)
143
145
  ])
144
146
  ], 2),
145
147
  l("div", {
146
148
  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", [e.customModalBodyClasses]])
147
149
  }, [
148
- d(t.$slots, "body", { closeModal: s })
150
+ d(t.$slots, "body", { closeModal: a })
149
151
  ], 2),
150
- t.$slots.footer ? (k(), x("div", {
152
+ t.$slots.footer ? (c(), C("div", {
151
153
  key: 0,
152
154
  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", e.customModalFooterClasses])
153
155
  }, [
154
- d(t.$slots, "footer", { closeModal: s })
155
- ], 2)) : g("", !0),
156
+ d(t.$slots, "footer", { closeModal: a })
157
+ ], 2)) : w("", !0),
156
158
  d(t.$slots, "fixed-bottom")
157
- ], 42, G)
159
+ ], 42, P)
158
160
  ], 34), [
159
- [j, o.value]
161
+ [V, o.value]
160
162
  ])
161
163
  ]),
162
164
  _: 3
@@ -165,5 +167,5 @@ const G = ["id", "data-cy"], J = ["innerHTML"], X = /* @__PURE__ */ A({
165
167
  }
166
168
  });
167
169
  export {
168
- X as default
170
+ q as default
169
171
  };
@@ -1,26 +1,27 @@
1
- import { defineComponent as o, defineAsyncComponent as e, hydrateOnIdle as a, createBlock as i, openBlock as l, unref as r } from "vue";
2
- import { createDoughnutChart as u } from "../../../../VueChartJs/Doughnut/factory.js";
3
- const h = /* @__PURE__ */ o({
1
+ import { defineComponent as s, onBeforeMount as u, createBlock as i, createCommentVNode as c, unref as o, openBlock as m } from "vue";
2
+ import { Doughnut as p } from "vue-chartjs";
3
+ import { Chart as l, DoughnutController as d, ArcElement as f } from "chart.js";
4
+ import { useChartJsModules as g } from "../../../../chart/composables/useChartjsModules.js";
5
+ const y = /* @__PURE__ */ s({
4
6
  __name: "DoughnutChart",
5
7
  props: {
6
8
  options: {},
7
9
  data: {}
8
10
  },
9
11
  setup(t) {
10
- const n = e({
11
- loader: () => u({
12
- tooltip: !!t.options.plugins?.tooltip,
13
- legend: !!t.options.plugins?.legend,
14
- title: !!t.options.plugins?.title
15
- }),
16
- hydrate: a()
17
- });
18
- return (s, d) => (l(), i(r(n), {
12
+ l.register(d, f);
13
+ const e = t, { registerPlugins: r, resolved: n, executeRegistration: a } = g(
14
+ e.options
15
+ );
16
+ return u(async () => {
17
+ await a(r);
18
+ }), (h, C) => o(n) ? (m(), i(o(p), {
19
+ key: 0,
19
20
  options: t.options,
20
21
  data: t.data
21
- }, null, 8, ["options", "data"]));
22
+ }, null, 8, ["options", "data"])) : c("", !0);
22
23
  }
23
24
  });
24
25
  export {
25
- h as default
26
+ y as default
26
27
  };
@@ -1,30 +1,42 @@
1
- import { defineComponent as i, defineAsyncComponent as c, hydrateOnIdle as s, useTemplateRef as l, computed as r, createBlock as p, openBlock as d, unref as m } from "vue";
2
- import { createLineChart as u } from "../../../../VueChartJs/Line/factory.js";
3
- const y = /* @__PURE__ */ i({
1
+ import { defineComponent as m, onBeforeMount as p, useTemplateRef as u, computed as f, createBlock as d, createCommentVNode as h, unref as t, openBlock as C } from "vue";
2
+ import { Line as g } from "vue-chartjs";
3
+ import { Chart as x, LineController as L, LineElement as k, Filler as B, PointElement as E, CategoryScale as v, LinearScale as y } from "chart.js";
4
+ import { useChartJsModules as M } from "../../../../chart/composables/useChartjsModules.js";
5
+ const F = /* @__PURE__ */ m({
4
6
  __name: "LineChart",
5
7
  props: {
6
8
  options: {},
7
9
  data: {}
8
10
  },
9
- setup(t, { expose: e }) {
10
- const n = c({
11
- loader: () => u({
12
- timeAxis: t.options.scales?.x?.type === "time",
13
- tooltip: !!t.options.plugins?.tooltip,
14
- legend: !!t.options.plugins?.legend,
15
- title: !!t.options.plugins?.title
16
- }),
17
- hydrate: s()
18
- }), o = l("chart"), a = r(
19
- () => o.value?.chart
11
+ setup(e, { expose: o }) {
12
+ x.register(
13
+ L,
14
+ k,
15
+ B,
16
+ E,
17
+ v,
18
+ y
20
19
  );
21
- return e({ chartInstance: a }), (h, f) => (d(), p(m(n), {
20
+ const r = e, {
21
+ registerPlugins: n,
22
+ registerTimeCartesianAxis: a,
23
+ executeRegistration: i,
24
+ resolved: s
25
+ } = M(r.options);
26
+ p(() => {
27
+ i(n, a);
28
+ });
29
+ const c = u("chart"), l = f(
30
+ () => c.value?.chart
31
+ );
32
+ return o({ chartInstance: l }), (P, R) => t(s) ? (C(), d(t(g), {
33
+ key: 0,
22
34
  ref: "chart",
23
- options: t.options,
24
- data: t.data
25
- }, null, 8, ["options", "data"]));
35
+ options: e.options,
36
+ data: e.data
37
+ }, null, 8, ["options", "data"])) : h("", !0);
26
38
  }
27
39
  });
28
40
  export {
29
- y as default
41
+ F as default
30
42
  };
@@ -1,6 +1,10 @@
1
- import { defineComponent as Q, reactive as U, useTemplateRef as z, shallowRef as X, useId as Y, computed as v, onMounted as x, watch as _, nextTick as L, createElementBlock as u, openBlock as p, normalizeClass as d, createElementVNode as g, createCommentVNode as P, renderSlot as V, Fragment as k, renderList as M, mergeProps as T, withModifiers as O } from "vue";
1
+ import { defineComponent as Q, reactive as U, ref as k, useId as X, computed as f, onMounted as Y, watch as x, nextTick as V, createElementBlock as l, openBlock as u, normalizeClass as d, createElementVNode as v, createCommentVNode as $, renderSlot as M, Fragment as P, renderList as E, mergeProps as F, withModifiers as O } from "vue";
2
+ import { Swiper as T } from "swiper";
3
+ import { Zoom as _ } from "swiper/modules";
4
+ import '../../../../../assets/swiper-zoom.css';import '../../../../../assets/swiper-swiper.css';/* empty css */
5
+ /* empty css */
2
6
  import { shallowCopyObjectTo as ee } from "@wikicasa-dev/utilities";
3
- const te = ["id"], se = ["id", "data-cy"], ie = ["data-idx", "alt", "width", "height", "onLoad"], ae = ["id"], re = ["alt"], ue = /* @__PURE__ */ Q({
7
+ const te = ["id"], se = ["id", "data-cy"], ie = ["data-idx", "alt", "width", "height", "onLoad"], ae = ["id"], re = ["alt"], ce = /* @__PURE__ */ Q({
4
8
  inheritAttrs: !1,
5
9
  __name: "SwiperCarousel",
6
10
  props: {
@@ -14,232 +18,229 @@ const te = ["id"], se = ["id", "data-cy"], ie = ["data-idx", "alt", "width", "he
14
18
  shiftFirstImage: { type: Boolean, default: !1 }
15
19
  },
16
20
  emits: ["moved", "click", "firstSlideLoaded", "init"],
17
- setup(t, { expose: R, emit: E }) {
18
- const $ = E, a = U({
19
- swiperParams: { modules: [] },
21
+ setup(s, { expose: B, emit: D }) {
22
+ const y = D, a = U({
23
+ swiperParams: { modules: [_] },
20
24
  swiper: null,
21
25
  initCarousel: !1
22
- }), F = z("rootRef"), B = z("swiperWrapperRef"), D = X(!1), j = Y(), w = v(() => t.id ?? j), A = v(() => a.swiper), h = v(() => t.swiperOptions?.slidesPerView || 1), N = v(() => !!t.swiperOptions?.keyboard), S = v(() => !!t.swiperOptions.navigation), C = v(() => !!t.swiperOptions.pagination), W = v(() => !!t.swiperOptions.autoplay), q = v(
23
- () => t.swiperOptions?.effect || "slider"
24
- ), K = () => {
25
- t.swiperOptions && ee(t.swiperOptions, a.swiperParams);
26
- }, I = (e, s = -1, i = !1) => {
26
+ }), S = k(), j = k(!1), A = X(), p = f(() => s.id ?? A), N = f(() => a.swiper), g = f(() => s.swiperOptions?.slidesPerView || 1), W = f(() => !!s.swiperOptions?.keyboard), C = f(() => !!s.swiperOptions.navigation), I = f(() => !!s.swiperOptions.pagination), q = f(() => !!s.swiperOptions.autoplay), K = f(
27
+ () => s.swiperOptions?.effect || "slider"
28
+ ), R = () => {
29
+ s.swiperOptions && ee(s.swiperOptions, a.swiperParams);
30
+ }, z = (e, i = -1, t = !1) => {
27
31
  if (!e.images)
28
32
  return { src: e.src || "" };
29
- let o = "", r = "", n = "";
30
- if (t.artDirection) {
31
- for (const l in t.artDirection) {
32
- const { mq: c, width: m } = t.artDirection[l];
33
- m && (n += n ? `,${c} ${parseInt(m)}px` : `${c} ${parseInt(m)}px`);
33
+ let r = "", o = "", b = "";
34
+ if (s.artDirection) {
35
+ for (const n in s.artDirection) {
36
+ const { mq: w, width: c } = s.artDirection[n];
37
+ c && (b += b ? `,${w} ${parseInt(c)}px` : `${w} ${parseInt(c)}px`);
34
38
  }
35
- r = e.images.reduce((l, c, m) => {
36
- const f = Object.values(t.artDirection)[m];
37
- return !f || !f.width || (l += l ? `, ${c.storagePath} ${f.width}` : `${c.storagePath} ${f.width}`), l;
38
- }, ""), o = e.images[0].storagePath;
39
+ o = e.images.reduce((n, w, c) => {
40
+ const m = Object.values(s.artDirection)[c];
41
+ return !m || !m.width || (n += n ? `, ${w.storagePath} ${m.width}` : `${w.storagePath} ${m.width}`), n;
42
+ }, ""), r = e.images[0].storagePath;
39
43
  } else {
40
- let l = e.images;
41
- e.images.length > 3 ? l = e.images.slice(2, 5) : t.shiftFirstImage && (l[0] = l[1]), r = l.reduce((c, m, f) => (f === 0 && (o = `${m.storagePath}`), f > 0 && (c += ", "), `${c}${m.storagePath} ${f + 1}x`), "");
44
+ let n = e.images;
45
+ e.images.length > 3 ? n = e.images.slice(2, 5) : s.shiftFirstImage && (n[0] = n[1]), o = n.reduce((w, c, m) => (m === 0 && (r = `${c.storagePath}`), m > 0 && (w += ", "), `${w}${c.storagePath} ${m + 1}x`), "");
42
46
  }
43
- const y = o, J = r;
44
- return typeof h.value == "number" && s > h.value ? (o = "", r = "", { sizes: n, "data-src": y, "data-srcset": J }) : i ? {
45
- src: o,
46
- srcset: r,
47
- sizes: n,
47
+ const H = r, J = o;
48
+ return typeof g.value == "number" && i > g.value ? (r = "", o = "", { sizes: b, "data-src": H, "data-srcset": J }) : t ? {
49
+ src: r,
50
+ srcset: o,
51
+ sizes: b,
48
52
  loading: "lazy",
49
53
  fetchpriority: "low"
50
54
  } : {
51
- src: o,
52
- srcset: r,
53
- sizes: n,
54
- loading: t.lazyLoadImages || s >= h.value ? "lazy" : void 0,
55
- fetchpriority: !t.lazyLoadImages && s === 0 ? "high" : "low"
55
+ src: r,
56
+ srcset: o,
57
+ sizes: b,
58
+ loading: s.lazyLoadImages || i >= g.value ? "lazy" : void 0,
59
+ fetchpriority: !s.lazyLoadImages && i === 0 ? "high" : "low"
56
60
  };
57
- }, b = [], Z = (e) => {
58
- if (typeof h.value == "string") return;
59
- const s = b[e];
60
- if (s && !s.src && (s.src = s.dataset.src || "", s.srcset = s.dataset.srcset || ""), e < h.value || e + 1 >= (t.images ?? []).length)
61
+ }, h = [], Z = (e) => {
62
+ if (typeof g.value == "string") return;
63
+ const i = h[e];
64
+ if (i && !i.src && (i.src = i.dataset.src || "", i.srcset = i.dataset.srcset || ""), e < g.value || e + 1 >= (s.images ?? []).length)
61
65
  return;
62
- const i = b[e + 1];
63
- i && !i.src && (i.src = i?.dataset.src || "", i.srcset = i?.dataset.srcset || "");
64
- }, G = (e) => {
65
- e === 0 && b && b[e] && L(() => {
66
- F.value?.setAttribute("data-first-slide-loaded", "true"), $("firstSlideLoaded");
66
+ const t = h[e + 1];
67
+ t && !t.src && (t.src = t?.dataset.src || "", t.srcset = t?.dataset.srcset || "");
68
+ }, L = k(null), G = (e) => {
69
+ e === 0 && h && h[e] && V(() => {
70
+ L.value?.setAttribute("data-first-slide-loaded", "true"), y("firstSlideLoaded");
67
71
  });
68
- }, H = async () => {
69
- K();
70
- const [{ Swiper: e }, { Zoom: s }] = await Promise.all([
71
- import("../../../../../Swiper/index.js"),
72
- import("../../../../../Swiper/zoom.js")
73
- ]);
74
- if (a.swiperParams.modules?.push(s), N.value) {
75
- const { Keyboard: r } = await import("../../../../../Swiper/keyboard.js");
76
- a.swiperParams.modules?.push(r), a.swiperParams.keyboard = t.swiperOptions.keyboard;
72
+ };
73
+ return Y(async () => {
74
+ if (R(), W.value) {
75
+ const { Keyboard: t } = await import("../../../../../Swiper/keyboard.js");
76
+ a.swiperParams.modules?.push(t), a.swiperParams.keyboard = s.swiperOptions.keyboard;
77
77
  }
78
- if (C.value) {
79
- const { Pagination: r } = await import("../../../../../Swiper/pagination.js");
80
- a.swiperParams.modules?.push(r), a.swiperParams.pagination = {
78
+ if (I.value) {
79
+ const { Pagination: t } = await import("../../../../../Swiper/pagination.js");
80
+ a.swiperParams.modules?.push(t), a.swiperParams.pagination = {
81
81
  el: ".swiper-pagination",
82
- renderFraction: (n, y) => `<div class="uikit-rounded-xs uikit-border-w-black uikit-border uikit-border-solid uikit-px-3 uikit-bg-white uikit-pt-[3px] uikit-pb-[3px]">
83
- <span data-cy="swiper-pagination-current" class="${n}"></span>
82
+ renderFraction: (r, o) => `<div class="uikit-rounded-xs uikit-border-w-black uikit-border uikit-border-solid uikit-px-3 uikit-bg-white uikit-pt-[3px] uikit-pb-[3px]">
83
+ <span data-cy="swiper-pagination-current" class="${r}"></span>
84
84
  /
85
- <span data-cy="swiper-pagination-total" class="${y}"></span>
85
+ <span data-cy="swiper-pagination-total" class="${o}"></span>
86
86
  </div>`,
87
87
  ...typeof a.swiperParams.pagination == "boolean" ? {} : a.swiperParams.pagination
88
88
  };
89
89
  }
90
- if (S.value) {
91
- const { Navigation: r } = await import("../../../../../Swiper/navigation.js");
92
- a.swiperParams.modules?.push(r);
93
- const n = {
94
- ...t.swiperOptions.navigation.nextEl ?? {
90
+ if (C.value) {
91
+ const { Navigation: t } = await import("../../../../../Swiper/navigation.js");
92
+ a.swiperParams.modules?.push(t);
93
+ const r = {
94
+ ...s.swiperOptions.navigation.nextEl ?? {
95
95
  nextEl: ".swiper-button-next"
96
96
  },
97
- ...t.swiperOptions.navigation.prevEl ?? {
97
+ ...s.swiperOptions.navigation.prevEl ?? {
98
98
  prevEl: ".swiper-button-prev"
99
99
  }
100
100
  };
101
101
  a.swiperParams.navigation = {
102
- ...typeof t.swiperOptions.navigation == "object" ? t.swiperOptions.navigation : {},
103
- ...n
102
+ ...typeof s.swiperOptions.navigation == "object" ? s.swiperOptions.navigation : {},
103
+ ...r
104
104
  };
105
105
  }
106
- if (W.value) {
107
- const { Autoplay: r } = await import("../../../../../Swiper/autoplay.js");
108
- a.swiperParams.modules?.push(r), a.swiperParams.autoplay = t.swiperOptions.autoplay;
106
+ if (q.value) {
107
+ const { Autoplay: t } = await import("../../../../../Swiper/autoplay.js");
108
+ a.swiperParams.modules?.push(t), a.swiperParams.autoplay = s.swiperOptions.autoplay;
109
109
  }
110
- const i = {
110
+ const e = {
111
111
  ...a.swiperParams,
112
112
  on: {
113
113
  init: () => {
114
- D.value = !0, $("init");
114
+ j.value = !0, y("init");
115
115
  },
116
- slideChange: (r) => {
117
- Z(r.activeIndex), $("moved", { activeIndex: r.activeIndex });
116
+ slideChange: (t) => {
117
+ Z(t.activeIndex), y("moved", { activeIndex: t.activeIndex });
118
118
  }
119
119
  }
120
120
  };
121
- let o = null;
122
- if (t.thumbSwiperOptions) {
123
- const [r, n, y] = await Promise.all([
121
+ let i = null;
122
+ if (s.thumbSwiperOptions) {
123
+ const [t, r, o] = await Promise.all([
124
124
  import("../../../../../Swiper/thumbs.js"),
125
125
  import("../../../../../Swiper/free-mode.js"),
126
126
  import("../../../../../Swiper/controller.js")
127
127
  ]);
128
- a.swiperParams.modules?.push(r.Thumbs), a.swiperParams.modules?.push(y.Controller), o = new e(`#thumb_${w.value}`, {
129
- ...t.thumbSwiperOptions,
130
- modules: [n.FreeMode]
131
- }), i.thumbs = {
132
- swiper: o
128
+ a.swiperParams.modules?.push(t.Thumbs), a.swiperParams.modules?.push(o.Controller), i = new T(`#thumb_${p.value}`, {
129
+ ...s.thumbSwiperOptions,
130
+ modules: [r.FreeMode]
131
+ }), e.thumbs = {
132
+ swiper: i
133
133
  };
134
134
  }
135
- i.lazyPreloadPrevNext = 1, a.swiper = new e(`#${w.value}`, i), B.value?.classList.remove("uikit-hidden");
136
- };
137
- return x(() => setTimeout(H)), _(
138
- () => t.images,
135
+ e.lazyPreloadPrevNext = 1, a.swiper = new T(`#${p.value}`, e), S.value?.classList.remove("uikit-hidden");
136
+ }), x(
137
+ () => s.images,
139
138
  () => {
140
- L(() => {
139
+ V(() => {
141
140
  a.swiper?.update();
142
141
  });
143
142
  }
144
- ), R({
145
- swiper: A,
146
- moveTo(e, s = 0, i = !0) {
147
- a.swiper?.slideTo(e, s, i);
143
+ ), B({
144
+ swiper: N,
145
+ moveTo(e, i = 0, t = !0) {
146
+ a.swiper?.slideTo(e, i, t);
148
147
  },
149
148
  updateSlidesPerView: (e) => {
150
149
  !a.swiper || a.swiper.params.slidesPerView === e || (a.swiper.params.slidesPerView = e, a.swiper.update());
151
150
  }
152
- }), (e, s) => (p(), u("div", {
153
- id: `root-${w.value}`,
154
- ref: "rootRef",
151
+ }), (e, i) => (u(), l("div", {
152
+ id: `root-${p.value}`,
153
+ ref_key: "root",
154
+ ref: L,
155
155
  class: d(["swiper-carousel-root", e.$attrs["root-classes"]])
156
156
  }, [
157
- g("div", {
158
- id: w.value,
157
+ v("div", {
158
+ id: p.value,
159
159
  "data-cy": e.$attrs["data-cy"],
160
160
  class: d(["swiper", e.$attrs["swiper-classes"]])
161
161
  }, [
162
- g("div", {
163
- ref: "swiperWrapperRef",
162
+ v("div", {
163
+ ref_key: "swiperWrapper",
164
+ ref: S,
164
165
  class: d(["swiper-wrapper", [
165
166
  e.$attrs["swiper-wrapper-classes"],
166
- q.value === "none" && "no-transition"
167
+ K.value === "none" && "no-transition"
167
168
  ]]),
168
- onClick: s[0] || (s[0] = (i) => $("click"))
169
+ onClick: i[0] || (i[0] = (t) => y("click"))
169
170
  }, [
170
- V(e.$slots, "default", {}, () => [
171
- (p(!0), u(k, null, M(t.images, (i, o) => (p(), u("div", {
172
- key: `swiper_${w.value}_${o}`,
171
+ M(e.$slots, "default", {}, () => [
172
+ (u(!0), l(P, null, E(s.images, (t, r) => (u(), l("div", {
173
+ key: `swiper_${p.value}_${r}`,
173
174
  class: d(["swiper-slide", e.$attrs["swiper-slide-classes"]])
174
175
  }, [
175
- g("div", {
176
+ v("div", {
176
177
  class: d(["swiper-zoom-container", e.$attrs["swiper-zoom-container-classes"]])
177
178
  }, [
178
- t.backgroundImage ? P("", !0) : (p(), u("img", T({
179
+ s.backgroundImage ? $("", !0) : (u(), l("img", F({
179
180
  key: 0,
180
181
  ref_for: !0,
181
- ref: (r) => {
182
- b.push(r);
182
+ ref: (o) => {
183
+ h.push(o);
183
184
  },
184
- class: ["disable-select", [e.$attrs["slide-img-classes"] || i.classes]],
185
- "data-idx": `${w.value}-slide-img-${o}`
186
- }, { ref_for: !0 }, I(i, o), {
187
- alt: i.alt,
185
+ class: ["disable-select", [e.$attrs["slide-img-classes"] || t.classes]],
186
+ "data-idx": `${p.value}-slide-img-${r}`
187
+ }, { ref_for: !0 }, z(t, r), {
188
+ alt: t.alt,
188
189
  itemprop: "image",
189
- width: i.width,
190
- height: i.height,
191
- onLoad: (r) => G(o)
190
+ width: t.width,
191
+ height: t.height,
192
+ onLoad: (o) => G(r)
192
193
  }), null, 16, ie))
193
194
  ], 2)
194
195
  ], 2))), 128)),
195
- V(e.$slots, "last_slide", {}, void 0, !0)
196
+ M(e.$slots, "last_slide", {}, void 0, !0)
196
197
  ], !0)
197
198
  ], 2),
198
- C.value ? (p(), u("div", {
199
+ I.value ? (u(), l("div", {
199
200
  key: 0,
200
201
  class: d([e.$attrs["swiper-pagination-classes"], "swiper-pagination [&.swiper-pagination-fraction]:uikit-flex [&.swiper-pagination-fraction]:uikit-justify-center"]),
201
- onClick: s[1] || (s[1] = O(() => {
202
+ onClick: i[1] || (i[1] = O(() => {
202
203
  }, ["stop"]))
203
- }, null, 2)) : P("", !0),
204
- S.value ? (p(), u(k, { key: 1 }, [
205
- g("div", {
204
+ }, null, 2)) : $("", !0),
205
+ C.value ? (u(), l(P, { key: 1 }, [
206
+ v("div", {
206
207
  class: "swiper-button-prev",
207
208
  "data-cy": "swiper-button-prev",
208
- onClick: s[2] || (s[2] = O(() => {
209
+ onClick: i[2] || (i[2] = O(() => {
209
210
  }, ["stop"]))
210
211
  }),
211
- g("div", {
212
+ v("div", {
212
213
  class: "swiper-button-next",
213
214
  "data-cy": "swiper-button-next",
214
- onClick: s[3] || (s[3] = O(() => {
215
+ onClick: i[3] || (i[3] = O(() => {
215
216
  }, ["stop"]))
216
217
  })
217
- ], 64)) : P("", !0)
218
+ ], 64)) : $("", !0)
218
219
  ], 10, se),
219
- t.thumbSwiperOptions ? (p(), u("div", {
220
+ s.thumbSwiperOptions ? (u(), l("div", {
220
221
  key: 0,
221
- id: `thumb_${w.value}`,
222
+ id: `thumb_${p.value}`,
222
223
  thumbsSlider: "",
223
224
  class: d(["swiper", e.$attrs["thumb-swiper-classes"]])
224
225
  }, [
225
- g("div", {
226
+ v("div", {
226
227
  class: d(["swiper-wrapper", e.$attrs["thumb-swiper-wrapper-classes"]])
227
228
  }, [
228
- (p(!0), u(k, null, M(t.images, (i, o) => (p(), u("div", {
229
- key: `thumb_${w.value}_${o}`,
229
+ (u(!0), l(P, null, E(s.images, (t, r) => (u(), l("div", {
230
+ key: `thumb_${p.value}_${r}`,
230
231
  class: d(["swiper-slide", e.$attrs["thumb-img-wrapper-classes"]])
231
232
  }, [
232
- g("img", T({
233
+ v("img", F({
233
234
  class: e.$attrs["thumb-img-classes"]
234
- }, { ref_for: !0 }, I(i, -1, !1), {
235
- alt: i.alt
235
+ }, { ref_for: !0 }, z(t, -1, !1), {
236
+ alt: t.alt
236
237
  }), null, 16, re)
237
238
  ], 2))), 128))
238
239
  ], 2)
239
- ], 10, ae)) : P("", !0)
240
+ ], 10, ae)) : $("", !0)
240
241
  ], 10, te));
241
242
  }
242
243
  });
243
244
  export {
244
- ue as default
245
+ ce as default
245
246
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wikicasa-dev/components",
3
- "version": "2.4.1-alpha.18",
3
+ "version": "2.4.1-alpha.3",
4
4
  "description": "Wikicasa frontend components",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,4 +0,0 @@
1
- import { Chart as t } from "chart.js";
2
- export {
3
- t as Chart
4
- };
@@ -1,6 +0,0 @@
1
- import { Chart as r, DoughnutController as t, ArcElement as o } from "chart.js";
2
- import { Chart as m } from "chart.js";
3
- r.register(t, o);
4
- export {
5
- m as ChartJS
6
- };
@@ -1,6 +0,0 @@
1
- import { Chart as r, CategoryScale as a, LinearScale as e, Filler as t } from "chart.js";
2
- import { Chart as C } from "chart.js";
3
- r.register(a, e, t);
4
- export {
5
- C as ChartJS
6
- };
@@ -1,6 +0,0 @@
1
- import { Chart as r, LineController as e, LineElement as t, PointElement as o } from "chart.js";
2
- import { Chart as a } from "chart.js";
3
- r.register(e, t, o);
4
- export {
5
- a as ChartJS
6
- };
@@ -1,2 +0,0 @@
1
- import { Chart as r, Legend as e } from "chart.js";
2
- r.register(e);
@@ -1,3 +0,0 @@
1
- import "chartjs-adapter-date-fns";
2
- import { Chart as r, TimeScale as e } from "chart.js";
3
- r.register(e);
@@ -1,2 +0,0 @@
1
- import { Chart as r, Title as t } from "chart.js";
2
- r.register(t);
@@ -1,2 +0,0 @@
1
- import { Chart as r, Tooltip as o } from "chart.js";
2
- r.register(o);
@@ -1,5 +0,0 @@
1
- import '../assets/swiper-swiper.css';/* empty css */
2
- import { Swiper as e } from "swiper";
3
- export {
4
- e as Swiper
5
- };
@@ -1,5 +0,0 @@
1
- import { Zoom as p } from "swiper/modules";
2
- import '../assets/swiper-zoom.css';/* empty css */
3
- export {
4
- p as Zoom
5
- };
@@ -1,12 +0,0 @@
1
- const e = async (i) => {
2
- const t = [
3
- import("../../ChartJs/DoughnutChart/core.js")
4
- // always needed
5
- ];
6
- i.timeAxis && t.push(import("../../ChartJs/Plugins/TimeScale.js")), i.tooltip && t.push(import("../../ChartJs/Plugins/Tooltip.js")), i.legend && t.push(import("../../ChartJs/Plugins/Legend.js")), i.title && t.push(import("../../ChartJs/Plugins/Title.js")), await Promise.all(t);
7
- const { Doughnut: r } = await import("./index.js");
8
- return r;
9
- };
10
- export {
11
- e as createDoughnutChart
12
- };
@@ -1,4 +0,0 @@
1
- import { Doughnut as t } from "vue-chartjs";
2
- export {
3
- t as Doughnut
4
- };
@@ -1,14 +0,0 @@
1
- const e = async (i) => {
2
- const t = [
3
- import("../../ChartJs/LineChart/core.js"),
4
- // always needed
5
- import("../../ChartJs/LineChart/cartesian.js")
6
- // always needed
7
- ];
8
- i.timeAxis && t.push(import("../../ChartJs/Plugins/TimeScale.js")), i.tooltip && t.push(import("../../ChartJs/Plugins/Tooltip.js")), i.legend && t.push(import("../../ChartJs/Plugins/Legend.js")), i.title && t.push(import("../../ChartJs/Plugins/Title.js")), await Promise.all(t);
9
- const { Line: r } = await import("./index.js");
10
- return r;
11
- };
12
- export {
13
- e as createLineChart
14
- };
@@ -1,4 +0,0 @@
1
- import { Line as r } from "vue-chartjs";
2
- export {
3
- r as Line
4
- };