golden-logic-ui 1.3.25 → 1.3.26
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,22 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { withDirectives as n, createCommentVNode as s, createElementBlock as a, openBlock as d, renderSlot as f, vShow as m, inject as i, ref as r, watch as p } from "vue";
|
|
2
|
+
import _ from "../../_virtual/_plugin-vue_export-helper.js";
|
|
3
|
+
const u = {
|
|
4
|
+
// icon and badge are read by the tabs wrapper, which draws the tab itself.
|
|
5
|
+
props: ["title", "icon", "badge"],
|
|
6
|
+
setup(l) {
|
|
7
|
+
const o = i("selectedTitle"), t = i("glTabsKeepAlive", r(!1)), e = r(!1);
|
|
8
|
+
return p(o, (c) => {
|
|
9
|
+
c == l.title && (e.value = !0);
|
|
10
|
+
}, { immediate: !0 }), {
|
|
11
|
+
selectedTitle: o,
|
|
12
|
+
keepAlive: t,
|
|
13
|
+
opened: e
|
|
8
14
|
};
|
|
9
15
|
}
|
|
10
|
-
},
|
|
16
|
+
}, v = {
|
|
11
17
|
key: 0,
|
|
12
18
|
class: "block"
|
|
13
19
|
};
|
|
14
|
-
function
|
|
15
|
-
return t.title ==
|
|
16
|
-
|
|
17
|
-
]))
|
|
20
|
+
function k(l, o, t, e, c, T) {
|
|
21
|
+
return (e.keepAlive ? e.opened : t.title == e.selectedTitle) ? n((d(), a("div", v, [
|
|
22
|
+
f(l.$slots, "default")
|
|
23
|
+
], 512)), [
|
|
24
|
+
[m, t.title == e.selectedTitle]
|
|
25
|
+
]) : s("", !0);
|
|
18
26
|
}
|
|
19
|
-
const
|
|
27
|
+
const w = /* @__PURE__ */ _(u, [["render", k]]);
|
|
20
28
|
export {
|
|
21
|
-
|
|
29
|
+
w as default
|
|
22
30
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useSlots as
|
|
2
|
-
import { nextGlId as
|
|
3
|
-
const
|
|
1
|
+
import { useSlots as W, ref as k, Comment as G, provide as L, computed as w, watch as I, onMounted as j, onBeforeUnmount as z, createElementBlock as s, openBlock as i, Fragment as S, createElementVNode as c, withDirectives as q, normalizeClass as u, renderList as J, createCommentVNode as A, createTextVNode as O, toDisplayString as E, renderSlot as P, vShow as Q } from "vue";
|
|
2
|
+
import { nextGlId as X } from "./useGlFocusTrap.js";
|
|
3
|
+
const Y = ["onClick"], Z = ["id", "aria-selected", "tabindex", "onKeydown"], ee = ["innerHTML"], te = { class: "relative flex flex-col w-full min-w-0 mb-6 wrap-break-word rounded-[20px] border border-gray-200 dark:border-gray-700" }, re = { class: "flex-auto px-4 py-5" }, ae = ["aria-labelledby"], ne = {
|
|
4
4
|
__name: "GlTabsWrapper",
|
|
5
5
|
props: {
|
|
6
6
|
autoFlexTabs: {
|
|
@@ -14,105 +14,130 @@ const Q = ["onClick"], X = ["id", "aria-selected", "tabindex", "onKeydown"], Y =
|
|
|
14
14
|
activeTab: {
|
|
15
15
|
type: String,
|
|
16
16
|
default: ""
|
|
17
|
+
},
|
|
18
|
+
// 'pills' (the default) draws each tab as a button; 'underline' draws a
|
|
19
|
+
// single bar with a line under the selected tab, for pages with many tabs.
|
|
20
|
+
variant: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: "pills"
|
|
23
|
+
},
|
|
24
|
+
// Keep a tab's content mounted once it has been opened, so coming back to
|
|
25
|
+
// it does not reload it or lose its page, search and scroll.
|
|
26
|
+
keepAlive: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: !1
|
|
17
29
|
}
|
|
18
30
|
},
|
|
19
31
|
emits: ["TabChange"],
|
|
20
|
-
setup(
|
|
21
|
-
const
|
|
22
|
-
(
|
|
23
|
-
),
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
32
|
+
setup(g, { expose: B, emit: D }) {
|
|
33
|
+
const d = g, H = D, F = W(), l = k(
|
|
34
|
+
(F.default?.() ?? []).filter((e) => e.type !== G && e.props !== null).map((e) => e.props)
|
|
35
|
+
), R = (e) => typeof e == "string" && /<\s*(svg|path|g|circle|rect)\b/i.test(e), a = k("");
|
|
36
|
+
L("selectedTitle", a), L("glTabsKeepAlive", w(() => d.keepAlive));
|
|
37
|
+
const p = w(() => d.variant === "underline"), $ = (e) => {
|
|
38
|
+
const r = a.value === e.title;
|
|
39
|
+
return p.value ? [
|
|
40
|
+
"px-3 pt-3.5 pb-3 text-sm border-b-[3px] cursor-pointer",
|
|
41
|
+
r ? "font-bold text-gray-900 border-primary dark:text-white dark:border-primaryDark" : "font-medium border-transparent hover:text-gray-900 hover:border-gray-300 dark:hover:text-white dark:hover:border-gray-600"
|
|
42
|
+
] : [
|
|
43
|
+
"px-5 py-3 text-xs font-bold rounded-xl",
|
|
44
|
+
r ? "text-white bg-primary dark:bg-primaryDark" : " bg-gray-50 dark:bg-gray-900 hover:text-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 dark:hover:text-white border border-gray-300 dark:border-gray-700 hover:border-primary dark:hover:border-primaryDark"
|
|
45
|
+
];
|
|
46
|
+
}, T = X("gl-tabs"), C = `${T}-panel`, f = (e) => `${T}-tab-${e}`, y = k(null), v = w(() => l.value.findIndex((e) => e.title === a.value)), K = (e, r) => v.value >= 0 ? e.title === a.value : r === 0, U = (e) => {
|
|
47
|
+
const r = l.value[e];
|
|
48
|
+
r && (a.value = r.title, document.getElementById(f(e))?.focus());
|
|
49
|
+
}, M = (e, r) => {
|
|
29
50
|
const t = l.value.length;
|
|
30
51
|
if (t === 0) return;
|
|
31
|
-
const n =
|
|
52
|
+
const n = y.value ? getComputedStyle(y.value).direction === "rtl" : !1, b = n ? "ArrowLeft" : "ArrowRight", V = n ? "ArrowRight" : "ArrowLeft";
|
|
32
53
|
let o = null;
|
|
33
|
-
e.key ===
|
|
34
|
-
},
|
|
54
|
+
e.key === b ? o = (r + 1) % t : e.key === V ? o = (r - 1 + t) % t : e.key === "Home" ? o = 0 : e.key === "End" ? o = t - 1 : (e.key === "Enter" || e.key === " ") && (o = r), o !== null && (e.preventDefault(), U(o));
|
|
55
|
+
}, _ = (e) => e.trim().toLowerCase().replace(/\s+/g, "-");
|
|
35
56
|
let m = !1;
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
window.location.hash.replace("#", "") !== t && (m = !0, window.location.hash = t),
|
|
39
|
-
},
|
|
57
|
+
const N = (e) => {
|
|
58
|
+
const r = _(e), t = encodeURIComponent(r);
|
|
59
|
+
window.location.hash.replace("#", "") !== t && (m = !0, window.location.hash = t), H("TabChange", e);
|
|
60
|
+
}, h = (e) => {
|
|
40
61
|
if (typeof e != "string") return;
|
|
41
|
-
l.value.find((t) => t.title === e) && (
|
|
62
|
+
l.value.find((t) => t.title === e) && (a.value = e);
|
|
42
63
|
};
|
|
43
|
-
|
|
44
|
-
setActiveTab:
|
|
64
|
+
B({
|
|
65
|
+
setActiveTab: h
|
|
45
66
|
});
|
|
46
|
-
const
|
|
67
|
+
const x = () => {
|
|
47
68
|
if (m) {
|
|
48
69
|
m = !1;
|
|
49
70
|
return;
|
|
50
71
|
}
|
|
51
|
-
const e = decodeURIComponent(window.location.hash.replace("#", "")),
|
|
52
|
-
|
|
72
|
+
const e = decodeURIComponent(window.location.hash.replace("#", "")), r = l.value.find((t) => _(t.title) === e);
|
|
73
|
+
r && (a.value = r.title);
|
|
53
74
|
};
|
|
54
|
-
return
|
|
55
|
-
|
|
56
|
-
}),
|
|
57
|
-
e && e !==
|
|
58
|
-
}),
|
|
59
|
-
|
|
60
|
-
}),
|
|
61
|
-
window.removeEventListener("hashchange",
|
|
62
|
-
}), (e,
|
|
75
|
+
return I(a, (e) => {
|
|
76
|
+
N(e);
|
|
77
|
+
}), I(() => d.activeTab, (e) => {
|
|
78
|
+
e && e !== a.value && h(e);
|
|
79
|
+
}), j(() => {
|
|
80
|
+
x(), !a.value && d.activeTab && h(d.activeTab), window.addEventListener("hashchange", x);
|
|
81
|
+
}), z(() => {
|
|
82
|
+
window.removeEventListener("hashchange", x);
|
|
83
|
+
}), (e, r) => (i(), s(S, null, [
|
|
63
84
|
c("ul", {
|
|
64
85
|
ref_key: "tabList",
|
|
65
|
-
ref:
|
|
86
|
+
ref: y,
|
|
66
87
|
role: "tablist",
|
|
67
|
-
class: u(["flex flex-row flex-wrap
|
|
88
|
+
class: u(["flex flex-row flex-wrap mb-0 list-none text-gray-500 dark:text-gray-400", [p.value ? "gap-1 px-2 mb-4 bg-white border border-gray-200 rounded-xl dark:bg-gray-900 dark:border-gray-700" : "gap-2 pt-3 pb-4", g.tabsWrapperClass]])
|
|
68
89
|
}, [
|
|
69
|
-
(i(!0), s(
|
|
90
|
+
(i(!0), s(S, null, J(l.value, (t, n) => (i(), s("li", {
|
|
70
91
|
key: t.title,
|
|
71
92
|
role: "presentation",
|
|
72
|
-
onClick: (
|
|
93
|
+
onClick: (b) => a.value = t.title,
|
|
73
94
|
class: u(["-mb-px text-center", {
|
|
74
|
-
"flex-auto ": p.
|
|
95
|
+
"flex-auto ": g.autoFlexTabs && !p.value
|
|
75
96
|
}])
|
|
76
97
|
}, [
|
|
77
98
|
c("a", {
|
|
78
|
-
id:
|
|
99
|
+
id: f(n),
|
|
79
100
|
role: "tab",
|
|
80
|
-
"aria-selected":
|
|
81
|
-
"aria-controls":
|
|
82
|
-
tabindex:
|
|
83
|
-
onKeydown: (
|
|
84
|
-
class: u([
|
|
101
|
+
"aria-selected": a.value === t.title ? "true" : "false",
|
|
102
|
+
"aria-controls": C,
|
|
103
|
+
tabindex: K(t, n) ? 0 : -1,
|
|
104
|
+
onKeydown: (b) => M(b, n),
|
|
105
|
+
class: u([$(t), "block leading-normal tabs_buttons"])
|
|
85
106
|
}, [
|
|
86
|
-
t.icon &&
|
|
107
|
+
t.icon && R(t.icon) ? (i(), s("span", {
|
|
87
108
|
key: 0,
|
|
88
109
|
class: "inline-flex items-center justify-center me-2 align-middle",
|
|
89
110
|
innerHTML: t.icon
|
|
90
|
-
}, null, 8,
|
|
111
|
+
}, null, 8, ee)) : t.icon ? (i(), s("i", {
|
|
91
112
|
key: 1,
|
|
92
113
|
class: u([t.icon, "me-2 text-sm"])
|
|
93
|
-
}, null, 2)) :
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
114
|
+
}, null, 2)) : A("", !0),
|
|
115
|
+
O(E(t.title) + " ", 1),
|
|
116
|
+
t.badge !== void 0 && t.badge !== null && t.badge !== "" ? (i(), s("span", {
|
|
117
|
+
key: 2,
|
|
118
|
+
class: u(["inline-flex items-center px-2 py-0.5 ms-2 text-[11px] font-semibold rounded-full align-middle", a.value === t.title && !p.value ? "bg-white/20 text-white" : "bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-200"])
|
|
119
|
+
}, E(t.badge), 3)) : A("", !0)
|
|
120
|
+
], 42, Z)
|
|
121
|
+
], 10, Y))), 128))
|
|
97
122
|
], 2),
|
|
98
|
-
|
|
99
|
-
c("div",
|
|
123
|
+
q(c("div", te, [
|
|
124
|
+
c("div", re, [
|
|
100
125
|
c("div", {
|
|
101
|
-
id:
|
|
126
|
+
id: C,
|
|
102
127
|
role: "tabpanel",
|
|
103
|
-
"aria-labelledby":
|
|
128
|
+
"aria-labelledby": v.value >= 0 ? f(v.value) : void 0,
|
|
104
129
|
tabindex: "0",
|
|
105
130
|
class: "tab-content tab-space"
|
|
106
131
|
}, [
|
|
107
|
-
|
|
108
|
-
], 8,
|
|
132
|
+
P(e.$slots, "default")
|
|
133
|
+
], 8, ae)
|
|
109
134
|
])
|
|
110
135
|
], 512), [
|
|
111
|
-
[
|
|
136
|
+
[Q, a.value]
|
|
112
137
|
])
|
|
113
138
|
], 64));
|
|
114
139
|
}
|
|
115
140
|
};
|
|
116
141
|
export {
|
|
117
|
-
|
|
142
|
+
ne as default
|
|
118
143
|
};
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "The most popular library of interactive components built with Vuejs && Tailwind CSS",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
|
-
"version": "1.3.
|
|
6
|
+
"version": "1.3.26",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "git+https://github.com/mrgiant/GoldenLogicUi.git"
|