@wikicasa-dev/components 2.0.31 → 2.0.33

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,4 +1,4 @@
1
- import { _ as f } from "./chunks/BaseTabView.vue_vue_type_script_setup_true_lang.DjAQCt5a.js";
1
+ import { _ as f } from "./chunks/BaseTabView.vue_vue_type_script_setup_true_lang.DTPN9Rg-.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -0,0 +1,105 @@
1
+ import { defineComponent as S, mergeModels as C, useModel as z, ref as b, useId as j, useSlots as q, computed as G, provide as v, watch as k, openBlock as i, createElementBlock as p, normalizeClass as I, createElementVNode as H, unref as f, toDisplayString as J, createBlock as d, createCommentVNode as o, Fragment as _, renderList as K, withCtx as O, resolveDynamicComponent as Q } from "vue";
2
+ import { _ as R } from "./BaseTabPanel.vue_vue_type_script_setup_true_lang.DoZHWHt1.js";
3
+ import { _ as g } from "./BaseTabList.vue_vue_type_script_setup_true_lang.CohlLou1.js";
4
+ const U = ["data-cy"], W = ["id"], te = /* @__PURE__ */ S({
5
+ inheritAttrs: !1,
6
+ __name: "BaseTabView",
7
+ props: /* @__PURE__ */ C({
8
+ tabsPosition: { default: "top" },
9
+ tabViewDescription: {},
10
+ tabListClasses: {},
11
+ dataCy: {}
12
+ }, {
13
+ activeIdx: { default: 0 },
14
+ activeIdxModifiers: {}
15
+ }),
16
+ emits: /* @__PURE__ */ C(["tabClicked"], ["update:activeIdx"]),
17
+ setup(P, { emit: x }) {
18
+ const B = x, l = z(P, "activeIdx"), $ = b(""), u = b(null), A = b(null), r = j(), m = q(), c = (e) => e.props ?? null, h = (e) => e.type.__name === "BaseTab", y = (e, a) => ({
19
+ renderFn: e,
20
+ tabId: T(a),
21
+ "active-tab-panel-idx": c(e)?.["active-tab-panel-idx"] ?? a,
22
+ "header-title": c(e)?.["header-title"] || "",
23
+ class: c(e)?.class || "",
24
+ "tab-panel-classes": c(e)?.["tab-panel-classes"] || "",
25
+ "data-cy": c(e)?.["data-cy"] || ""
26
+ }), n = G(() => m.default ? m.default().reduce((e, a) => (a.children && Array.isArray(a.children) ? a.children.forEach((t) => {
27
+ h(t) && e.push(y(t, e.length));
28
+ }) : h(a) && e.push(y(a, e.length)), e), []) : []);
29
+ v("tabs", n), v("isTabActive", (e) => l.value === e);
30
+ const F = (e = -1) => u.value === e, T = (e) => `base-tab-${e}-${r}`, V = (e = -1) => `base-tab-panel-${e}-${r}`, w = (e = -1) => {
31
+ const a = n.value.reduce(
32
+ (t, s, N) => (s["active-tab-panel-idx"] !== e || t.push({ tab: s, idx: N }), t),
33
+ []
34
+ );
35
+ return a && a.length === 1 ? a[0].tab.tabId : a.find((t) => t.idx === l.value)?.tab.tabId;
36
+ }, D = (e) => {
37
+ $.value = T(e);
38
+ }, L = (e) => {
39
+ const a = n.value.at(e ?? -1);
40
+ u.value = a?.["active-tab-panel-idx"] ?? null;
41
+ };
42
+ v("handleClick", (e, a) => {
43
+ D(e), l.value = e, B("tabClicked", { tabIdx: e, tabElement: a });
44
+ }), k(
45
+ l,
46
+ (e) => {
47
+ L(e ?? -1);
48
+ },
49
+ {
50
+ immediate: !0
51
+ }
52
+ );
53
+ const E = (e, a) => {
54
+ for (let t = 0; t < e.length; t++)
55
+ if (e[t] !== a[t]) return t;
56
+ return null;
57
+ }, M = (e = -1) => n.value.find((a) => a["active-tab-panel-idx"] === e);
58
+ return k(
59
+ () => n.value.map((e) => e["active-tab-panel-idx"]),
60
+ (e, a) => {
61
+ const t = E(e, a);
62
+ if (t === null) return;
63
+ const s = n.value[t]["active-tab-panel-idx"];
64
+ l.value !== t || s === void 0 || (u.value = s);
65
+ }
66
+ ), (e, a) => (i(), p("div", {
67
+ ref_key: "root",
68
+ ref: A,
69
+ class: I(e.$attrs.class),
70
+ "data-cy": e.dataCy
71
+ }, [
72
+ H("span", {
73
+ id: `tablist-${f(r)}`,
74
+ class: "uikit-sr-only"
75
+ }, J(e.tabViewDescription), 9, W),
76
+ e.tabsPosition === "top" ? (i(), d(g, {
77
+ key: 0,
78
+ uid: f(r),
79
+ "tab-list-classes": e.tabListClasses
80
+ }, null, 8, ["uid", "tab-list-classes"])) : o("", !0),
81
+ (i(!0), p(_, null, K(n.value, (t, s) => (i(), p(_, { key: s }, [
82
+ M(s) ? (i(), d(R, {
83
+ key: 0,
84
+ id: V(t["active-tab-panel-idx"]),
85
+ "labelled-by": w(s) ?? "",
86
+ active: F(s),
87
+ class: I(t["tab-panel-classes"])
88
+ }, {
89
+ default: O(() => [
90
+ t.renderFn.children && t.renderFn.children.default ? (i(), d(Q(t.renderFn.children.default), { key: 0 })) : o("", !0)
91
+ ]),
92
+ _: 2
93
+ }, 1032, ["id", "labelled-by", "active", "class"])) : o("", !0)
94
+ ], 64))), 128)),
95
+ e.tabsPosition === "bottom" ? (i(), d(g, {
96
+ key: 1,
97
+ uid: f(r),
98
+ "tab-list-classes": e.tabListClasses
99
+ }, null, 8, ["uid", "tab-list-classes"])) : o("", !0)
100
+ ], 10, U));
101
+ }
102
+ });
103
+ export {
104
+ te as _
105
+ };
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import { _ as l } from "./chunks/SelectItem.vue_vue_type_script_setup_true_lang.
6
6
  import { default as d } from "./CheckboxBtn.js";
7
7
  import { _ as u } from "./chunks/CheckboxGroup.vue_vue_type_script_setup_true_lang.Cf8YnCGf.js";
8
8
  import { _ } from "./chunks/BaseTab.vue_vue_type_script_setup_true_lang.Cu67jd8K.js";
9
- import { _ as S } from "./chunks/BaseTabView.vue_vue_type_script_setup_true_lang.DjAQCt5a.js";
9
+ import { _ as S } from "./chunks/BaseTabView.vue_vue_type_script_setup_true_lang.DTPN9Rg-.js";
10
10
  import { _ as g } from "./chunks/RadioButton.vue_vue_type_script_setup_true_lang.CiJAhkRj.js";
11
11
  import { _ as h } from "./chunks/RadioGroup.vue_vue_type_script_setup_true_lang.DdmSUyxZ.js";
12
12
  import { _ as I } from "./chunks/AccessibleSelect.vue_vue_type_script_setup_true_lang.ClV6kObA.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wikicasa-dev/components",
3
- "version": "2.0.31",
3
+ "version": "2.0.33",
4
4
  "description": "Wikicasa frontend components",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,97 +0,0 @@
1
- import { defineComponent as E, mergeModels as T, useModel as M, ref as u, useId as N, useSlots as S, computed as z, provide as b, watch as C, openBlock as l, createElementBlock as k, normalizeClass as _, createElementVNode as j, unref as p, toDisplayString as q, createBlock as o, createCommentVNode as v, Fragment as G, renderList as H, withCtx as J, resolveDynamicComponent as K } from "vue";
2
- import { _ as O } from "./BaseTabPanel.vue_vue_type_script_setup_true_lang.DoZHWHt1.js";
3
- import { _ as I } from "./BaseTabList.vue_vue_type_script_setup_true_lang.CohlLou1.js";
4
- const Q = ["data-cy"], R = ["id"], ee = /* @__PURE__ */ E({
5
- inheritAttrs: !1,
6
- __name: "BaseTabView",
7
- props: /* @__PURE__ */ T({
8
- tabsPosition: { default: "top" },
9
- tabViewDescription: {},
10
- tabListClasses: {},
11
- dataCy: {}
12
- }, {
13
- activeIdx: { default: 0 },
14
- activeIdxModifiers: {}
15
- }),
16
- emits: /* @__PURE__ */ T(["tabClicked"], ["update:activeIdx"]),
17
- setup(g, { emit: P }) {
18
- const B = P, r = M(g, "activeIdx"), $ = u(""), d = u(null), A = u(null), i = N(), f = S(), c = (e) => e.props ?? null, m = (e) => e.type.__name === "BaseTab", h = (e, a) => ({
19
- renderFn: e,
20
- tabId: y(a),
21
- "active-tab-panel-idx": c(e)?.["active-tab-panel-idx"] ?? a,
22
- "header-title": c(e)?.["header-title"] || "",
23
- class: c(e)?.class || "",
24
- "tab-panel-classes": c(e)?.["tab-panel-classes"] || "",
25
- "data-cy": c(e)?.["data-cy"] || ""
26
- }), n = z(() => f.default ? f.default().reduce((e, a) => (a.children && Array.isArray(a.children) ? a.children.forEach((t) => {
27
- m(t) && e.push(h(t, e.length));
28
- }) : m(a) && e.push(h(a, e.length)), e), []) : []);
29
- b("tabs", n), b("isTabActive", (e) => r.value === e);
30
- const x = (e) => d.value === e, y = (e) => `base-tab-${e}-${i}`, F = (e) => `base-tab-panel-${e}-${i}`, V = (e) => n.value.find((a) => a["active-tab-panel-idx"] === e)?.tabId, w = (e) => {
31
- $.value = y(e);
32
- }, D = (e) => {
33
- const a = n.value.at(e ?? -1);
34
- d.value = a?.["active-tab-panel-idx"] ?? null;
35
- };
36
- b("handleClick", (e, a) => {
37
- w(e), r.value = e, B("tabClicked", { tabIdx: e, tabElement: a });
38
- }), C(
39
- r,
40
- (e) => {
41
- D(e ?? -1);
42
- },
43
- {
44
- immediate: !0
45
- }
46
- );
47
- const L = (e, a) => {
48
- for (let t = 0; t < e.length; t++)
49
- if (e[t] !== a[t]) return t;
50
- return null;
51
- };
52
- return C(
53
- () => n.value.map((e) => e["active-tab-panel-idx"]),
54
- (e, a) => {
55
- const t = L(e, a);
56
- if (t === null) return;
57
- const s = n.value[t]["active-tab-panel-idx"];
58
- r.value !== t || s === void 0 || (d.value = s);
59
- }
60
- ), (e, a) => (l(), k("div", {
61
- ref_key: "root",
62
- ref: A,
63
- class: _(e.$attrs.class),
64
- "data-cy": e.dataCy
65
- }, [
66
- j("span", {
67
- id: `tablist-${p(i)}`,
68
- class: "uikit-sr-only"
69
- }, q(e.tabViewDescription), 9, R),
70
- e.tabsPosition === "top" ? (l(), o(I, {
71
- key: 0,
72
- uid: p(i),
73
- "tab-list-classes": e.tabListClasses
74
- }, null, 8, ["uid", "tab-list-classes"])) : v("", !0),
75
- (l(!0), k(G, null, H(n.value, (t, s) => (l(), o(O, {
76
- id: F(s),
77
- key: s,
78
- "labelled-by": V(s) || "",
79
- active: x(s),
80
- class: _(t["tab-panel-classes"])
81
- }, {
82
- default: J(() => [
83
- t.renderFn.children && t.renderFn.children.default ? (l(), o(K(t.renderFn.children.default), { key: 0 })) : v("", !0)
84
- ]),
85
- _: 2
86
- }, 1032, ["id", "labelled-by", "active", "class"]))), 128)),
87
- e.tabsPosition === "bottom" ? (l(), o(I, {
88
- key: 1,
89
- uid: p(i),
90
- "tab-list-classes": e.tabListClasses
91
- }, null, 8, ["uid", "tab-list-classes"])) : v("", !0)
92
- ], 10, Q));
93
- }
94
- });
95
- export {
96
- ee as _
97
- };