golden-logic-ui 1.3.24 → 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.
@@ -137,7 +137,7 @@ function y(t, n, e, _, k, a) {
137
137
  disabled: e.is_disabled
138
138
  }, { type: e.is_submit ? "submit" : void 0 }, {
139
139
  href: e.tag === "a" ? e.href : void 0,
140
- class: ` ${e.is_disabled ? "cursor-not-allowed opacity-50" : ""} ${e.icon || e.svg_icon ? "flex" : ""} h-10 items-center justify-center gap-2 focus:outline-hidden text-sm px-3 py-2 font-medium ${e.has_border_reduced ? "rounded-xl" : ""} ${a.buttonTypeClass} ${e.classes}`
140
+ class: ` ${e.is_disabled ? "cursor-not-allowed opacity-50" : ""} ${e.icon || e.svg_icon ? "flex" : "inline-flex"} h-10 items-center justify-center gap-2 focus:outline-hidden text-sm px-3 py-2 font-medium ${e.has_border_reduced ? "rounded-xl" : ""} ${a.buttonTypeClass} ${e.classes}`
141
141
  }), {
142
142
  default: o(() => [
143
143
  e.icon ? (r(), s("i", {
@@ -153,7 +153,7 @@ function y(t, n, e, _, k, a) {
153
153
  _: 3
154
154
  }, 16, ["type", "disabled", "href", "class"]));
155
155
  }
156
- const x = /* @__PURE__ */ c(f, [["render", y]]);
156
+ const C = /* @__PURE__ */ c(f, [["render", y]]);
157
157
  export {
158
- x as default
158
+ C as default
159
159
  };
@@ -1,22 +1,30 @@
1
- import { createElementBlock as c, createCommentVNode as l, openBlock as r, renderSlot as s, inject as n } from "vue";
2
- import i from "../../_virtual/_plugin-vue_export-helper.js";
3
- const d = {
4
- props: ["title"],
5
- setup() {
6
- return {
7
- selectedTitle: n("selectedTitle")
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
- }, a = {
16
+ }, v = {
11
17
  key: 0,
12
18
  class: "block"
13
19
  };
14
- function p(e, _, t, o, f, m) {
15
- return t.title == o.selectedTitle ? (r(), c("div", a, [
16
- s(e.$slots, "default")
17
- ])) : l("", !0);
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 k = /* @__PURE__ */ i(d, [["render", p]]);
27
+ const w = /* @__PURE__ */ _(u, [["render", k]]);
20
28
  export {
21
- k as default
29
+ w as default
22
30
  };
@@ -1,6 +1,6 @@
1
- import { useSlots as $, ref as x, Comment as K, provide as M, computed as N, watch as _, onMounted as U, onBeforeUnmount as V, createElementBlock as s, openBlock as i, Fragment as C, createElementVNode as c, withDirectives as W, normalizeClass as u, renderList as G, createCommentVNode as j, createTextVNode as z, toDisplayString as q, renderSlot as J, vShow as O } from "vue";
2
- import { nextGlId as P } from "./useGlFocusTrap.js";
3
- const Q = ["onClick"], X = ["id", "aria-selected", "tabindex", "onKeydown"], Y = ["innerHTML"], Z = { 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" }, ee = { class: "flex-auto px-4 py-5" }, te = ["aria-labelledby"], oe = {
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(p, { expose: L, emit: I }) {
21
- const f = p, S = I, E = $(), l = x(
22
- (E.default?.() ?? []).filter((e) => e.type !== K && e.props !== null).map((e) => e.props)
23
- ), H = (e) => typeof e == "string" && /<\s*(svg|path|g|circle|rect)\b/i.test(e), r = x("");
24
- M("selectedTitle", r);
25
- const w = P("gl-tabs"), k = `${w}-panel`, b = (e) => `${w}-tab-${e}`, g = x(null), h = N(() => l.value.findIndex((e) => e.title === r.value)), A = (e, a) => h.value >= 0 ? e.title === r.value : a === 0, B = (e) => {
26
- const a = l.value[e];
27
- a && (r.value = a.title, document.getElementById(b(e))?.focus());
28
- }, D = (e, a) => {
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 = g.value ? getComputedStyle(g.value).direction === "rtl" : !1, d = n ? "ArrowLeft" : "ArrowRight", R = n ? "ArrowRight" : "ArrowLeft";
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 === d ? o = (a + 1) % t : e.key === R ? o = (a - 1 + t) % t : e.key === "Home" ? o = 0 : e.key === "End" ? o = t - 1 : (e.key === "Enter" || e.key === " ") && (o = a), o !== null && (e.preventDefault(), B(o));
34
- }, T = (e) => e.trim().toLowerCase().replace(/\s+/g, "-");
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 F = (e) => {
37
- const a = T(e), t = encodeURIComponent(a);
38
- window.location.hash.replace("#", "") !== t && (m = !0, window.location.hash = t), S("TabChange", e);
39
- }, y = (e) => {
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) && (r.value = e);
62
+ l.value.find((t) => t.title === e) && (a.value = e);
42
63
  };
43
- L({
44
- setActiveTab: y
64
+ B({
65
+ setActiveTab: h
45
66
  });
46
- const v = () => {
67
+ const x = () => {
47
68
  if (m) {
48
69
  m = !1;
49
70
  return;
50
71
  }
51
- const e = decodeURIComponent(window.location.hash.replace("#", "")), a = l.value.find((t) => T(t.title) === e);
52
- a && (r.value = a.title);
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 _(r, (e) => {
55
- F(e);
56
- }), _(() => f.activeTab, (e) => {
57
- e && e !== r.value && y(e);
58
- }), U(() => {
59
- v(), !r.value && f.activeTab && y(f.activeTab), window.addEventListener("hashchange", v);
60
- }), V(() => {
61
- window.removeEventListener("hashchange", v);
62
- }), (e, a) => (i(), s(C, null, [
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: g,
86
+ ref: y,
66
87
  role: "tablist",
67
- class: u(["flex flex-row flex-wrap gap-2 pt-3 pb-4 mb-0 list-none text-gray-500 dark:text-gray-400", p.tabsWrapperClass])
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(C, null, G(l.value, (t, n) => (i(), s("li", {
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: (d) => r.value = t.title,
93
+ onClick: (b) => a.value = t.title,
73
94
  class: u(["-mb-px text-center", {
74
- "flex-auto ": p.autoFlexTabs
95
+ "flex-auto ": g.autoFlexTabs && !p.value
75
96
  }])
76
97
  }, [
77
98
  c("a", {
78
- id: b(n),
99
+ id: f(n),
79
100
  role: "tab",
80
- "aria-selected": r.value === t.title ? "true" : "false",
81
- "aria-controls": k,
82
- tabindex: A(t, n) ? 0 : -1,
83
- onKeydown: (d) => D(d, n),
84
- class: u([{ " 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": r.value != t.title, "text-white bg-primary dark:bg-primaryDark": r.value === t.title }, "block px-5 py-3 text-xs font-bold leading-normal rounded-xl tabs_buttons"])
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 && H(t.icon) ? (i(), s("span", {
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, Y)) : t.icon ? (i(), s("i", {
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)) : j("", !0),
94
- z(q(t.title), 1)
95
- ], 42, X)
96
- ], 10, Q))), 128))
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
- W(c("div", Z, [
99
- c("div", ee, [
123
+ q(c("div", te, [
124
+ c("div", re, [
100
125
  c("div", {
101
- id: k,
126
+ id: C,
102
127
  role: "tabpanel",
103
- "aria-labelledby": h.value >= 0 ? b(h.value) : void 0,
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
- J(e.$slots, "default")
108
- ], 8, te)
132
+ P(e.$slots, "default")
133
+ ], 8, ae)
109
134
  ])
110
135
  ], 512), [
111
- [O, r.value]
136
+ [Q, a.value]
112
137
  ])
113
138
  ], 64));
114
139
  }
115
140
  };
116
141
  export {
117
- oe as default
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.24",
6
+ "version": "1.3.26",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "git+https://github.com/mrgiant/GoldenLogicUi.git"