trepur_components 2.3.24 → 2.3.25
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/Button/index.d.ts +1 -1
- package/lib/components/Input/index.js +39 -39
- package/lib/components/Nav/Nav.stories.d.ts +1 -0
- package/lib/components/Nav/index.d.ts +1 -0
- package/lib/components/Nav/index.js +85 -74
- package/lib/components/NavItem/NavItem.stories.d.ts +3 -1
- package/lib/components/NavItem/index.d.ts +2 -1
- package/lib/components/NavItem/index.js +12 -12
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ export interface ButtonProps {
|
|
|
4
4
|
variant?: 'primary' | 'secondary' | 'ghost' | 'bordered' | 'basic';
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
loading?: boolean;
|
|
7
|
-
type?: 'button' | 'link';
|
|
7
|
+
type?: 'button' | 'link' | 'submit';
|
|
8
8
|
href?: string;
|
|
9
9
|
target?: string;
|
|
10
10
|
size?: 'sm' | 'md' | 'lg';
|
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
import { jsx as o, jsxs as
|
|
2
|
-
import { createContext as
|
|
3
|
-
import
|
|
4
|
-
const d =
|
|
5
|
-
const
|
|
1
|
+
import { jsx as o, jsxs as I } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as b, forwardRef as a, useMemo as N, useRef as h, useContext as i } from "react";
|
|
3
|
+
import m from "clsx";
|
|
4
|
+
const d = b(null), p = a(({ children: r, errors: t, placeholder: n, ...e }, l) => {
|
|
5
|
+
const s = N(
|
|
6
6
|
() => ({
|
|
7
7
|
errors: t,
|
|
8
|
-
placeholder:
|
|
9
|
-
...
|
|
8
|
+
placeholder: n,
|
|
9
|
+
...e
|
|
10
10
|
}),
|
|
11
|
-
[t,
|
|
11
|
+
[t, e]
|
|
12
12
|
);
|
|
13
|
-
return /* @__PURE__ */ o(d.Provider, { value:
|
|
14
|
-
}),
|
|
15
|
-
({ children:
|
|
16
|
-
const
|
|
13
|
+
return /* @__PURE__ */ o(d.Provider, { value: s, children: /* @__PURE__ */ o("div", { ref: l, children: r }) });
|
|
14
|
+
}), u = a(
|
|
15
|
+
({ children: r, ...t }, n) => {
|
|
16
|
+
const e = h(null);
|
|
17
17
|
return /* @__PURE__ */ o(
|
|
18
18
|
"div",
|
|
19
19
|
{
|
|
20
20
|
className: "mt-4 w-full",
|
|
21
21
|
onClick: () => {
|
|
22
22
|
var l;
|
|
23
|
-
return (l =
|
|
23
|
+
return (l = e.current) == null ? void 0 : l.focus();
|
|
24
24
|
},
|
|
25
|
-
ref:
|
|
25
|
+
ref: n,
|
|
26
26
|
...t,
|
|
27
|
-
children:
|
|
27
|
+
children: r
|
|
28
28
|
}
|
|
29
29
|
);
|
|
30
30
|
}
|
|
31
|
-
),
|
|
31
|
+
), c = a(({ className: r, children: t, required: n = !1 }, e) => /* @__PURE__ */ I(
|
|
32
32
|
"div",
|
|
33
33
|
{
|
|
34
34
|
ref: e,
|
|
35
|
-
className: "
|
|
35
|
+
className: m("flex px-1 text-sm font-normal leading-5", r),
|
|
36
36
|
children: [
|
|
37
|
-
/* @__PURE__ */ o("p", { children:
|
|
38
|
-
|
|
37
|
+
/* @__PURE__ */ o("p", { children: t }),
|
|
38
|
+
n && /* @__PURE__ */ o("p", { className: "text-sm font-normal", children: " *" })
|
|
39
39
|
]
|
|
40
40
|
}
|
|
41
|
-
)),
|
|
42
|
-
({ ...
|
|
43
|
-
const { errors: t, placeholder:
|
|
41
|
+
)), x = a(
|
|
42
|
+
({ ...r }) => {
|
|
43
|
+
const { errors: t, placeholder: n } = i(d) || {};
|
|
44
44
|
return /* @__PURE__ */ o(
|
|
45
45
|
"input",
|
|
46
46
|
{
|
|
47
|
-
placeholder:
|
|
48
|
-
className:
|
|
47
|
+
placeholder: n,
|
|
48
|
+
className: m(
|
|
49
49
|
"text-ink text-md w-full rounded-md border border-gray-300 bg-white py-2 pl-4",
|
|
50
50
|
{
|
|
51
51
|
"border-error border-2": t != null
|
|
52
52
|
}
|
|
53
53
|
),
|
|
54
|
-
...
|
|
54
|
+
...r
|
|
55
55
|
}
|
|
56
56
|
);
|
|
57
57
|
}
|
|
58
|
-
),
|
|
59
|
-
const { errors:
|
|
58
|
+
), f = a(({ children: r, ...t }, n) => {
|
|
59
|
+
const { errors: e } = i(d) || {};
|
|
60
60
|
return /* @__PURE__ */ o(
|
|
61
61
|
"div",
|
|
62
62
|
{
|
|
63
|
-
ref:
|
|
63
|
+
ref: n,
|
|
64
64
|
className: "text-md gap-y-2 pl-1 pt-2 font-semibold text-error-default",
|
|
65
65
|
...t,
|
|
66
|
-
children:
|
|
66
|
+
children: e == null ? void 0 : e.map((l, s) => /* @__PURE__ */ o("p", { children: l }, `error-msg-${s + 1}`))
|
|
67
67
|
}
|
|
68
68
|
);
|
|
69
69
|
});
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const C = Object.assign(
|
|
76
|
-
Item:
|
|
77
|
-
Label:
|
|
78
|
-
Box:
|
|
79
|
-
Validation:
|
|
70
|
+
p.displayName = "Input";
|
|
71
|
+
u.displayName = "Input.Item";
|
|
72
|
+
c.displayName = "Input.Label";
|
|
73
|
+
x.displayName = "Input.Box";
|
|
74
|
+
f.displayName = "Input.Validation";
|
|
75
|
+
const C = Object.assign(p, {
|
|
76
|
+
Item: u,
|
|
77
|
+
Label: c,
|
|
78
|
+
Box: x,
|
|
79
|
+
Validation: f
|
|
80
80
|
});
|
|
81
81
|
export {
|
|
82
82
|
C as Input
|
|
@@ -4,6 +4,7 @@ import { HTMLAttributes } from 'react';
|
|
|
4
4
|
export interface NavContextProps {
|
|
5
5
|
expanded?: boolean;
|
|
6
6
|
setExpanded?: (val: boolean) => void;
|
|
7
|
+
loading?: boolean;
|
|
7
8
|
}
|
|
8
9
|
declare const Nav: import('react').ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & NavContextProps & import('react').RefAttributes<HTMLDivElement>> & {
|
|
9
10
|
Header: import('react').ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -1,125 +1,136 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { createContext as C, forwardRef as
|
|
1
|
+
import { jsx as e, jsxs as c, Fragment as v } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as C, forwardRef as n, useState as N, useMemo as k, useContext as m, 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 l from "clsx";
|
|
6
6
|
import { Icon as D } from "../Icon/index.js";
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
import { NavItem as F } from "../NavItem/index.js";
|
|
8
|
+
const i = C(null), f = n(({ className: a, children: t, loading: r }, o) => {
|
|
9
|
+
const [s, d] = N(!1), p = k(
|
|
9
10
|
() => ({
|
|
10
|
-
expanded:
|
|
11
|
-
setExpanded: d
|
|
11
|
+
expanded: s,
|
|
12
|
+
setExpanded: d,
|
|
13
|
+
loading: r
|
|
12
14
|
}),
|
|
13
|
-
[
|
|
15
|
+
[s, d]
|
|
14
16
|
);
|
|
15
|
-
return /* @__PURE__ */ e(
|
|
16
|
-
}),
|
|
17
|
-
({ className: a, children: t },
|
|
17
|
+
return /* @__PURE__ */ e(i.Provider, { value: p, children: /* @__PURE__ */ e("div", { className: a, ref: o, children: t }) });
|
|
18
|
+
}), g = n(
|
|
19
|
+
({ className: a, children: t }, r) => /* @__PURE__ */ e(
|
|
18
20
|
"div",
|
|
19
21
|
{
|
|
20
|
-
ref:
|
|
21
|
-
className:
|
|
22
|
+
ref: r,
|
|
23
|
+
className: l("relative h-24 w-full bg-nav-bg px-2 py-2", a),
|
|
22
24
|
children: t
|
|
23
25
|
}
|
|
24
26
|
)
|
|
25
|
-
),
|
|
26
|
-
const { setExpanded:
|
|
27
|
-
return /* @__PURE__ */
|
|
28
|
-
/* @__PURE__ */ e("div", { className: "my-auto", children: /* @__PURE__ */ e(
|
|
27
|
+
), u = n(({ className: a, children: t }, r) => {
|
|
28
|
+
const { loading: o, setExpanded: s, expanded: d } = m(i) || {};
|
|
29
|
+
return /* @__PURE__ */ c("div", { ref: r, className: l("flex h-full md:hidden", a), children: [
|
|
30
|
+
!o && /* @__PURE__ */ e("div", { className: "my-auto", children: /* @__PURE__ */ e(
|
|
29
31
|
M,
|
|
30
32
|
{
|
|
31
33
|
variant: "ghost",
|
|
32
|
-
onClick: () =>
|
|
34
|
+
onClick: () => s == null ? void 0 : s(!d),
|
|
33
35
|
className: "aspect-square"
|
|
34
36
|
}
|
|
35
37
|
) }),
|
|
36
38
|
/* @__PURE__ */ e("div", { className: "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 transform", children: t })
|
|
37
39
|
] });
|
|
38
|
-
}),
|
|
40
|
+
}), x = n(({ className: a, children: t }, r) => /* @__PURE__ */ e(
|
|
39
41
|
"div",
|
|
40
42
|
{
|
|
41
|
-
ref:
|
|
42
|
-
className:
|
|
43
|
+
ref: r,
|
|
44
|
+
className: l(
|
|
43
45
|
"hidden justify-between md:flex md:gap-4 md:px-4 lg:gap-8 lg:px-20",
|
|
44
46
|
a
|
|
45
47
|
),
|
|
46
48
|
children: t
|
|
47
49
|
}
|
|
48
|
-
)),
|
|
49
|
-
({ className: a, children: t },
|
|
50
|
-
const { expanded:
|
|
51
|
-
return
|
|
50
|
+
)), h = n(
|
|
51
|
+
({ className: a, children: t }, r) => {
|
|
52
|
+
const { expanded: o } = m(i) || {};
|
|
53
|
+
return o ? /* @__PURE__ */ e(
|
|
52
54
|
"div",
|
|
53
55
|
{
|
|
54
|
-
ref:
|
|
55
|
-
className:
|
|
56
|
+
ref: r,
|
|
57
|
+
className: l(
|
|
56
58
|
"h-screen bg-nav-bg px-8 pb-12 pt-2 md:hidden",
|
|
57
59
|
a
|
|
58
60
|
),
|
|
59
61
|
children: /* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-4 md:hidden", children: t })
|
|
60
62
|
}
|
|
61
|
-
) : /* @__PURE__ */ e(
|
|
63
|
+
) : /* @__PURE__ */ e(v, {});
|
|
62
64
|
}
|
|
63
|
-
),
|
|
64
|
-
({ className: a, children: t },
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
65
|
+
), b = n(
|
|
66
|
+
({ className: a, children: t }, r) => {
|
|
67
|
+
const { loading: o } = m(i) || {};
|
|
68
|
+
return /* @__PURE__ */ e(
|
|
69
|
+
"div",
|
|
70
|
+
{
|
|
71
|
+
ref: r,
|
|
72
|
+
className: l("my-4 md:flex md:gap-4 lg:gap-6", a),
|
|
73
|
+
children: /* @__PURE__ */ c(v, { children: [
|
|
74
|
+
o && [...Array(5)].map((s) => /* @__PURE__ */ e(F, { loading: !0 })),
|
|
75
|
+
!o && t
|
|
76
|
+
] })
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
), y = n(({ className: a, label: t, children: r, active: o = !1 }) => {
|
|
81
|
+
const [s, d] = N(!1), p = w(null);
|
|
82
|
+
return /* @__PURE__ */ c(
|
|
75
83
|
"div",
|
|
76
84
|
{
|
|
77
|
-
ref:
|
|
78
|
-
onClick: () =>
|
|
79
|
-
onMouseLeave: () =>
|
|
80
|
-
className:
|
|
85
|
+
ref: p,
|
|
86
|
+
onClick: () => d(!0),
|
|
87
|
+
onMouseLeave: () => d(!1),
|
|
88
|
+
className: l(
|
|
81
89
|
"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",
|
|
82
90
|
{
|
|
83
|
-
"font-bold":
|
|
84
|
-
"font-light": !
|
|
91
|
+
"font-bold": o,
|
|
92
|
+
"font-light": !o
|
|
85
93
|
},
|
|
86
94
|
a
|
|
87
95
|
),
|
|
88
96
|
children: [
|
|
89
|
-
/* @__PURE__ */
|
|
97
|
+
/* @__PURE__ */ c("div", { className: "flex items-center gap-1", children: [
|
|
90
98
|
/* @__PURE__ */ e("p", { className: "text-lg", children: t }),
|
|
91
99
|
/* @__PURE__ */ e(D, { size: "xs", icon: j })
|
|
92
100
|
] }),
|
|
93
|
-
|
|
101
|
+
s && /* @__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: r }) })
|
|
94
102
|
]
|
|
95
103
|
}
|
|
96
104
|
);
|
|
97
|
-
}),
|
|
98
|
-
|
|
99
|
-
{
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
f.displayName = "Nav
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
105
|
+
}), H = n(({ className: a, src: t, ...r }, o) => {
|
|
106
|
+
const { loading: s } = m(i) || {};
|
|
107
|
+
return s ? /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e("div", { className: "h-20 w-20 animate-pulse bg-gray-300" }) }) : /* @__PURE__ */ e(
|
|
108
|
+
"img",
|
|
109
|
+
{
|
|
110
|
+
className: l("h-20 flex-none", a),
|
|
111
|
+
ref: o,
|
|
112
|
+
src: t,
|
|
113
|
+
...r
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
});
|
|
117
|
+
f.displayName = "Nav";
|
|
118
|
+
g.displayName = "Nav.Header";
|
|
119
|
+
x.displayName = "Nav.DesktopHeader";
|
|
120
|
+
u.displayName = "Nav.MobileHeader";
|
|
121
|
+
H.displayName = "Nav.Logo";
|
|
122
|
+
b.displayName = "Nav.Section";
|
|
123
|
+
h.displayName = "Nav.Body";
|
|
124
|
+
y.displayName = "Nav.Folder";
|
|
125
|
+
const A = Object.assign(f, {
|
|
126
|
+
Header: g,
|
|
127
|
+
DesktopHeader: x,
|
|
128
|
+
MobileHeader: u,
|
|
129
|
+
Section: b,
|
|
130
|
+
Logo: H,
|
|
131
|
+
Body: h,
|
|
132
|
+
Folder: y
|
|
122
133
|
});
|
|
123
134
|
export {
|
|
124
|
-
|
|
135
|
+
A as Nav
|
|
125
136
|
};
|
|
@@ -4,8 +4,9 @@ import { NavItem } from './';
|
|
|
4
4
|
declare const meta: {
|
|
5
5
|
title: string;
|
|
6
6
|
component: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLAnchorElement> & {
|
|
7
|
-
href
|
|
7
|
+
href?: string | undefined;
|
|
8
8
|
active?: boolean | undefined;
|
|
9
|
+
loading?: boolean | undefined;
|
|
9
10
|
} & import('react').RefAttributes<HTMLAnchorElement>> & {
|
|
10
11
|
Label: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLParagraphElement> & import('react').RefAttributes<HTMLParagraphElement>>;
|
|
11
12
|
};
|
|
@@ -17,3 +18,4 @@ export default meta;
|
|
|
17
18
|
type Story = StoryObj<typeof NavItem>;
|
|
18
19
|
export declare const Default: Story;
|
|
19
20
|
export declare const Active: Story;
|
|
21
|
+
export declare const Loading: Story;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { HTMLAttributes } from 'react';
|
|
2
2
|
|
|
3
3
|
declare const NavItem: import('react').ForwardRefExoticComponent<HTMLAttributes<HTMLAnchorElement> & {
|
|
4
|
-
href
|
|
4
|
+
href?: string | undefined;
|
|
5
5
|
active?: boolean | undefined;
|
|
6
|
+
loading?: boolean | undefined;
|
|
6
7
|
} & import('react').RefAttributes<HTMLAnchorElement>> & {
|
|
7
8
|
Label: import('react').ForwardRefExoticComponent<HTMLAttributes<HTMLParagraphElement> & import('react').RefAttributes<HTMLParagraphElement>>;
|
|
8
9
|
};
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as o } from "react";
|
|
3
3
|
import c from "clsx";
|
|
4
|
-
const s = o(({ active: e, children: t, className:
|
|
4
|
+
const s = o(({ loading: r = !1, active: e, children: t, className: n, href: m, ...f }, i) => r ? /* @__PURE__ */ a("div", { className: "m-auto", children: /* @__PURE__ */ a("div", { className: "h-7 w-20 animate-pulse rounded-md bg-gray-300" }) }) : /* @__PURE__ */ a(
|
|
5
5
|
"a",
|
|
6
6
|
{
|
|
7
|
-
href:
|
|
8
|
-
ref:
|
|
7
|
+
href: m,
|
|
8
|
+
ref: i,
|
|
9
9
|
className: c(
|
|
10
|
-
"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",
|
|
10
|
+
"m-auto inline-block 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",
|
|
11
11
|
{
|
|
12
12
|
"font-bold": e,
|
|
13
13
|
"font-light": !e
|
|
14
14
|
},
|
|
15
|
-
|
|
15
|
+
n
|
|
16
16
|
),
|
|
17
|
-
...
|
|
17
|
+
...f,
|
|
18
18
|
children: t
|
|
19
19
|
}
|
|
20
|
-
)),
|
|
20
|
+
)), l = o(({ className: r, ...e }, t) => /* @__PURE__ */ a("p", { className: "flex-none text-nowrap text-lg", ref: t, ...e }));
|
|
21
21
|
s.displayName = "NavItem";
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
Label:
|
|
22
|
+
l.displayName = "NavItem.Label";
|
|
23
|
+
const b = Object.assign(s, {
|
|
24
|
+
Label: l
|
|
25
25
|
});
|
|
26
26
|
export {
|
|
27
|
-
|
|
27
|
+
b as NavItem
|
|
28
28
|
};
|