trepur_components 2.3.25 → 2.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.
- package/lib/components/Nav/index.js +85 -81
- package/package.json +1 -1
|
@@ -1,135 +1,139 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { createContext as C, forwardRef as
|
|
1
|
+
import { jsx as e, jsxs as p, Fragment as H } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as C, forwardRef as l, useState as v, useMemo as k, useContext as c, useRef as w } from "react";
|
|
3
3
|
import { HamburgerIcon as M } from "../HamburgerIcon/index.js";
|
|
4
4
|
import { faChevronDown as j } from "@fortawesome/fontawesome-free-solid";
|
|
5
|
-
import
|
|
5
|
+
import d from "clsx";
|
|
6
6
|
import { Icon as D } from "../Icon/index.js";
|
|
7
7
|
import { NavItem as F } from "../NavItem/index.js";
|
|
8
|
-
const i = C(null),
|
|
9
|
-
const [
|
|
8
|
+
const i = C(null), N = l(({ className: t, children: r, loading: a }, s) => {
|
|
9
|
+
const [o, n] = v(!1), m = k(
|
|
10
10
|
() => ({
|
|
11
|
-
expanded:
|
|
12
|
-
setExpanded:
|
|
13
|
-
loading:
|
|
11
|
+
expanded: o,
|
|
12
|
+
setExpanded: n,
|
|
13
|
+
loading: a
|
|
14
14
|
}),
|
|
15
|
-
[
|
|
15
|
+
[o, n, a]
|
|
16
16
|
);
|
|
17
|
-
return /* @__PURE__ */ e(i.Provider, { value:
|
|
18
|
-
}),
|
|
19
|
-
({ className:
|
|
17
|
+
return /* @__PURE__ */ e(i.Provider, { value: m, children: /* @__PURE__ */ e("div", { className: t, ref: s, children: r }) });
|
|
18
|
+
}), f = l(
|
|
19
|
+
({ className: t, children: r }, a) => /* @__PURE__ */ e(
|
|
20
20
|
"div",
|
|
21
21
|
{
|
|
22
|
-
ref:
|
|
23
|
-
className:
|
|
24
|
-
children:
|
|
22
|
+
ref: a,
|
|
23
|
+
className: d("relative h-24 w-full bg-nav-bg px-2 py-2", t),
|
|
24
|
+
children: r
|
|
25
25
|
}
|
|
26
26
|
)
|
|
27
|
-
),
|
|
28
|
-
const { loading:
|
|
29
|
-
return /* @__PURE__ */
|
|
30
|
-
!
|
|
27
|
+
), g = l(({ className: t, children: r }, a) => {
|
|
28
|
+
const { loading: s, setExpanded: o, expanded: n } = c(i) || {};
|
|
29
|
+
return /* @__PURE__ */ p("div", { ref: a, className: d("flex h-full md:hidden", t), children: [
|
|
30
|
+
!s && /* @__PURE__ */ e("div", { className: "my-auto", children: /* @__PURE__ */ e(
|
|
31
31
|
M,
|
|
32
32
|
{
|
|
33
33
|
variant: "ghost",
|
|
34
|
-
onClick: () =>
|
|
34
|
+
onClick: () => o == null ? void 0 : o(!n),
|
|
35
35
|
className: "aspect-square"
|
|
36
36
|
}
|
|
37
37
|
) }),
|
|
38
|
-
/* @__PURE__ */ e("div", { className: "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 transform", children:
|
|
38
|
+
/* @__PURE__ */ e("div", { className: "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 transform", children: r })
|
|
39
39
|
] });
|
|
40
|
-
}),
|
|
40
|
+
}), u = l(({ className: t, children: r }, a) => /* @__PURE__ */ e(
|
|
41
41
|
"div",
|
|
42
42
|
{
|
|
43
|
-
ref:
|
|
44
|
-
className:
|
|
43
|
+
ref: a,
|
|
44
|
+
className: d(
|
|
45
45
|
"hidden justify-between md:flex md:gap-4 md:px-4 lg:gap-8 lg:px-20",
|
|
46
|
-
|
|
46
|
+
t
|
|
47
47
|
),
|
|
48
|
-
children:
|
|
48
|
+
children: r
|
|
49
49
|
}
|
|
50
|
-
)),
|
|
51
|
-
({ className:
|
|
52
|
-
const { expanded:
|
|
53
|
-
return
|
|
50
|
+
)), x = l(
|
|
51
|
+
({ className: t, children: r }, a) => {
|
|
52
|
+
const { expanded: s } = c(i) || {};
|
|
53
|
+
return s ? /* @__PURE__ */ e(
|
|
54
54
|
"div",
|
|
55
55
|
{
|
|
56
|
-
ref:
|
|
57
|
-
className:
|
|
56
|
+
ref: a,
|
|
57
|
+
className: d(
|
|
58
58
|
"h-screen bg-nav-bg px-8 pb-12 pt-2 md:hidden",
|
|
59
|
-
|
|
59
|
+
t
|
|
60
60
|
),
|
|
61
|
-
children: /* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-4 md:hidden", children:
|
|
61
|
+
children: /* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-4 md:hidden", children: r })
|
|
62
62
|
}
|
|
63
|
-
) : /* @__PURE__ */ e(
|
|
63
|
+
) : /* @__PURE__ */ e(H, {});
|
|
64
64
|
}
|
|
65
|
-
),
|
|
66
|
-
({ className:
|
|
67
|
-
const { loading:
|
|
68
|
-
return /* @__PURE__ */ e(
|
|
65
|
+
), h = l(
|
|
66
|
+
({ className: t, children: r }, a) => {
|
|
67
|
+
const { loading: s } = c(i) || {};
|
|
68
|
+
return s ? /* @__PURE__ */ e(
|
|
69
69
|
"div",
|
|
70
70
|
{
|
|
71
|
-
ref:
|
|
72
|
-
className:
|
|
73
|
-
children: /* @__PURE__ */
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
71
|
+
ref: a,
|
|
72
|
+
className: d("my-4 md:flex md:gap-4 lg:gap-6", t),
|
|
73
|
+
children: [...Array(5)].map((o, n) => /* @__PURE__ */ e(F, { loading: !0 }, n))
|
|
74
|
+
}
|
|
75
|
+
) : /* @__PURE__ */ e(
|
|
76
|
+
"div",
|
|
77
|
+
{
|
|
78
|
+
ref: a,
|
|
79
|
+
className: d("my-4 md:flex md:gap-4 lg:gap-6", t),
|
|
80
|
+
children: r
|
|
77
81
|
}
|
|
78
82
|
);
|
|
79
83
|
}
|
|
80
|
-
),
|
|
81
|
-
const [
|
|
82
|
-
return /* @__PURE__ */
|
|
84
|
+
), b = l(({ className: t, label: r, children: a, active: s = !1 }) => {
|
|
85
|
+
const [o, n] = v(!1), m = w(null);
|
|
86
|
+
return /* @__PURE__ */ p(
|
|
83
87
|
"div",
|
|
84
88
|
{
|
|
85
|
-
ref:
|
|
86
|
-
onClick: () =>
|
|
87
|
-
onMouseLeave: () =>
|
|
88
|
-
className:
|
|
89
|
+
ref: m,
|
|
90
|
+
onClick: () => n(!0),
|
|
91
|
+
onMouseLeave: () => n(!1),
|
|
92
|
+
className: d(
|
|
89
93
|
"relative m-auto py-0 text-nav-text after:block after:scale-x-0 after:border-b-2 after:border-nav-text after:transition-all after:duration-300 after:ease-in-out hover:cursor-pointer hover:after:scale-x-100",
|
|
90
94
|
{
|
|
91
|
-
"font-bold":
|
|
92
|
-
"font-light": !
|
|
95
|
+
"font-bold": s,
|
|
96
|
+
"font-light": !s
|
|
93
97
|
},
|
|
94
|
-
|
|
98
|
+
t
|
|
95
99
|
),
|
|
96
100
|
children: [
|
|
97
|
-
/* @__PURE__ */
|
|
98
|
-
/* @__PURE__ */ e("p", { className: "text-lg", children:
|
|
101
|
+
/* @__PURE__ */ p("div", { className: "flex items-center gap-1", children: [
|
|
102
|
+
/* @__PURE__ */ e("p", { className: "text-lg", children: r }),
|
|
99
103
|
/* @__PURE__ */ e(D, { size: "xs", icon: j })
|
|
100
104
|
] }),
|
|
101
|
-
|
|
105
|
+
o && /* @__PURE__ */ e("div", { className: "absolute -left-5 top-7 z-50 w-40 bg-nav-bg", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-y-2 bg-nav-bg px-4 py-4", children: a }) })
|
|
102
106
|
]
|
|
103
107
|
}
|
|
104
108
|
);
|
|
105
|
-
}),
|
|
106
|
-
const { loading:
|
|
107
|
-
return
|
|
109
|
+
}), y = l(({ className: t, src: r, ...a }, s) => {
|
|
110
|
+
const { loading: o } = c(i) || {};
|
|
111
|
+
return o ? /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e("div", { className: "h-20 w-20 animate-pulse bg-gray-300" }) }) : /* @__PURE__ */ e(
|
|
108
112
|
"img",
|
|
109
113
|
{
|
|
110
|
-
className:
|
|
111
|
-
ref:
|
|
112
|
-
src:
|
|
113
|
-
...
|
|
114
|
+
className: d("h-20 flex-none", t),
|
|
115
|
+
ref: s,
|
|
116
|
+
src: r,
|
|
117
|
+
...a
|
|
114
118
|
}
|
|
115
119
|
);
|
|
116
120
|
});
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
const A = Object.assign(
|
|
126
|
-
Header:
|
|
127
|
-
DesktopHeader:
|
|
128
|
-
MobileHeader:
|
|
129
|
-
Section:
|
|
130
|
-
Logo:
|
|
131
|
-
Body:
|
|
132
|
-
Folder:
|
|
121
|
+
N.displayName = "Nav";
|
|
122
|
+
f.displayName = "Nav.Header";
|
|
123
|
+
u.displayName = "Nav.DesktopHeader";
|
|
124
|
+
g.displayName = "Nav.MobileHeader";
|
|
125
|
+
y.displayName = "Nav.Logo";
|
|
126
|
+
h.displayName = "Nav.Section";
|
|
127
|
+
x.displayName = "Nav.Body";
|
|
128
|
+
b.displayName = "Nav.Folder";
|
|
129
|
+
const A = Object.assign(N, {
|
|
130
|
+
Header: f,
|
|
131
|
+
DesktopHeader: u,
|
|
132
|
+
MobileHeader: g,
|
|
133
|
+
Section: h,
|
|
134
|
+
Logo: y,
|
|
135
|
+
Body: x,
|
|
136
|
+
Folder: b
|
|
133
137
|
});
|
|
134
138
|
export {
|
|
135
139
|
A as Nav
|