trepur_components 2.4.3 → 2.4.5
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,7 +1,7 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as o, useMemo as v, createContext as
|
|
1
|
+
import { jsx as n, jsxs as c } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as o, useMemo as v, createContext as h, useContext as p } from "react";
|
|
3
3
|
import d from "clsx";
|
|
4
|
-
const s =
|
|
4
|
+
const s = h(null), x = o(({ children: r, className: a, errors: t, placeholder: l, ...e }, i) => {
|
|
5
5
|
const m = v(
|
|
6
6
|
() => ({
|
|
7
7
|
errors: t,
|
|
@@ -10,24 +10,24 @@ const s = L(null), x = o(({ children: n, className: a, errors: t, placeholder: l
|
|
|
10
10
|
}),
|
|
11
11
|
[t, e]
|
|
12
12
|
);
|
|
13
|
-
return /* @__PURE__ */
|
|
13
|
+
return /* @__PURE__ */ n(s.Provider, { value: m, children: /* @__PURE__ */ n(
|
|
14
14
|
"div",
|
|
15
15
|
{
|
|
16
16
|
ref: i,
|
|
17
17
|
className: d("grid grid-cols-1 gap-2 w-full rounded-md", a),
|
|
18
18
|
...e,
|
|
19
|
-
children:
|
|
19
|
+
children: r
|
|
20
20
|
}
|
|
21
21
|
) });
|
|
22
|
-
}), f = o(({ children:
|
|
22
|
+
}), f = o(({ children: r, handleChange: a, onClick: t, onBlur: l, ...e }, i) => {
|
|
23
23
|
const { placeholder: m, value: g, errors: u } = p(s) || {};
|
|
24
24
|
return /* @__PURE__ */ c("div", { ref: i, className: "group/input relative isolate flex w-full", children: [
|
|
25
|
-
/* @__PURE__ */
|
|
25
|
+
/* @__PURE__ */ n(
|
|
26
26
|
"input",
|
|
27
27
|
{
|
|
28
28
|
placeholder: m,
|
|
29
29
|
className: d(
|
|
30
|
-
"rounded-md flex w-full bg-card px-3 py-1.5 text-sm placeholder:text-gray-500",
|
|
30
|
+
"h-10 border border-black rounded-md flex w-full bg-card px-3 py-1.5 text-sm placeholder:text-gray-500",
|
|
31
31
|
{
|
|
32
32
|
"border-border border": !u,
|
|
33
33
|
"border-red-600 border-2": u
|
|
@@ -50,39 +50,39 @@ const s = L(null), x = o(({ children: n, className: a, errors: t, placeholder: l
|
|
|
50
50
|
onFocus: e.onFocus
|
|
51
51
|
}
|
|
52
52
|
),
|
|
53
|
-
|
|
53
|
+
r
|
|
54
54
|
] });
|
|
55
55
|
}), b = o(
|
|
56
|
-
({ className:
|
|
56
|
+
({ className: r, children: a }, t) => /* @__PURE__ */ n(
|
|
57
57
|
"div",
|
|
58
58
|
{
|
|
59
59
|
ref: t,
|
|
60
60
|
className: d(
|
|
61
61
|
"absolute right-1 top-1/2 my-auto -translate-y-1/2",
|
|
62
|
-
|
|
62
|
+
r
|
|
63
63
|
),
|
|
64
64
|
children: a
|
|
65
65
|
}
|
|
66
66
|
)
|
|
67
|
-
), y = o(({ className:
|
|
67
|
+
), y = o(({ className: r, children: a, required: t = !1 }, l) => /* @__PURE__ */ c(
|
|
68
68
|
"div",
|
|
69
69
|
{
|
|
70
70
|
ref: l,
|
|
71
|
-
className: d("flex px-1 text-sm font-normal leading-5",
|
|
71
|
+
className: d("flex px-1 text-sm font-normal leading-5", r),
|
|
72
72
|
children: [
|
|
73
|
-
/* @__PURE__ */
|
|
74
|
-
t && /* @__PURE__ */
|
|
73
|
+
/* @__PURE__ */ n("p", { children: a }),
|
|
74
|
+
t && /* @__PURE__ */ n("p", { className: "text-sm font-normal", children: "*" })
|
|
75
75
|
]
|
|
76
76
|
}
|
|
77
|
-
)), I = o(({ ...
|
|
77
|
+
)), I = o(({ ...r }, a) => {
|
|
78
78
|
const { errors: t } = p(s) || {};
|
|
79
|
-
return /* @__PURE__ */
|
|
79
|
+
return /* @__PURE__ */ n(
|
|
80
80
|
"div",
|
|
81
81
|
{
|
|
82
82
|
ref: a,
|
|
83
83
|
className: "text-sm pl-1 font-medium text-error-default",
|
|
84
|
-
...
|
|
85
|
-
children: t == null ? void 0 : t.map((l, e) => /* @__PURE__ */
|
|
84
|
+
...r,
|
|
85
|
+
children: t == null ? void 0 : t.map((l, e) => /* @__PURE__ */ n("p", { children: l }, `error-msg-${e + 1}`))
|
|
86
86
|
}
|
|
87
87
|
);
|
|
88
88
|
});
|
|
@@ -7,9 +7,13 @@ declare const meta: {
|
|
|
7
7
|
Item: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLLIElement> & {
|
|
8
8
|
value: string;
|
|
9
9
|
} & import('react').RefAttributes<HTMLLIElement>>;
|
|
10
|
+
Label: import('react').ForwardRefExoticComponent<Omit<import('react').HTMLAttributes<HTMLDivElement> & {
|
|
11
|
+
required?: boolean;
|
|
12
|
+
} & import('react').RefAttributes<HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
10
13
|
};
|
|
11
14
|
parameters: {};
|
|
12
15
|
args: {
|
|
16
|
+
label: string;
|
|
13
17
|
children: import("react/jsx-runtime").JSX.Element[];
|
|
14
18
|
};
|
|
15
19
|
};
|
|
@@ -7,12 +7,17 @@ export interface SelectContextProps {
|
|
|
7
7
|
onChange?: (value: string) => void;
|
|
8
8
|
open?: boolean;
|
|
9
9
|
setOpen?: (open: boolean) => void;
|
|
10
|
-
internalValue
|
|
11
|
-
setInternalValue
|
|
10
|
+
internalValue?: string;
|
|
11
|
+
setInternalValue?: (val: string) => void;
|
|
12
|
+
label?: string;
|
|
13
|
+
handleChange?: (e: any) => void;
|
|
12
14
|
}
|
|
13
15
|
declare const Select: import('react').ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & SelectContextProps & import('react').RefAttributes<HTMLDivElement>> & {
|
|
14
16
|
Item: import('react').ForwardRefExoticComponent<HTMLAttributes<HTMLLIElement> & {
|
|
15
17
|
value: string;
|
|
16
18
|
} & import('react').RefAttributes<HTMLLIElement>>;
|
|
19
|
+
Label: import('react').ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement> & {
|
|
20
|
+
required?: boolean;
|
|
21
|
+
} & import('react').RefAttributes<HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
17
22
|
};
|
|
18
23
|
export { Select };
|
|
@@ -1,62 +1,64 @@
|
|
|
1
1
|
import { jsx as o, jsxs as I } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as i, useState as
|
|
3
|
-
import
|
|
4
|
-
import { Input as
|
|
5
|
-
import { Card as
|
|
6
|
-
import { Button as
|
|
7
|
-
import { faCaretDown as
|
|
8
|
-
const
|
|
2
|
+
import { forwardRef as i, useState as x, useCallback as y, useEffect as A, createContext as E, useContext as p } from "react";
|
|
3
|
+
import u from "clsx";
|
|
4
|
+
import { Input as m } from "../Input/index.js";
|
|
5
|
+
import { Card as H } from "../Card/index.js";
|
|
6
|
+
import { Button as v } from "../Button/index.js";
|
|
7
|
+
import { faCaretDown as P } from "@fortawesome/fontawesome-free-solid";
|
|
8
|
+
const d = E(null), w = i(
|
|
9
9
|
({
|
|
10
10
|
id: l,
|
|
11
11
|
open: a,
|
|
12
12
|
defaultOpen: r,
|
|
13
13
|
onOpenChange: t,
|
|
14
14
|
onChange: e,
|
|
15
|
-
className:
|
|
16
|
-
children:
|
|
17
|
-
loading:
|
|
18
|
-
|
|
15
|
+
className: c,
|
|
16
|
+
children: s,
|
|
17
|
+
loading: f,
|
|
18
|
+
label: T,
|
|
19
|
+
...B
|
|
19
20
|
}) => {
|
|
20
|
-
const [
|
|
21
|
-
(
|
|
22
|
-
|
|
21
|
+
const [D, M] = x(a ?? r), [S, b] = x(""), N = y(
|
|
22
|
+
(n) => {
|
|
23
|
+
M(n), t == null || t(n);
|
|
23
24
|
},
|
|
24
25
|
[t]
|
|
25
|
-
),
|
|
26
|
-
loading:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
), V = {
|
|
27
|
+
loading: f,
|
|
28
|
+
label: T,
|
|
29
|
+
open: D,
|
|
30
|
+
setOpen: N,
|
|
31
|
+
internalValue: S,
|
|
32
|
+
setInternalValue: b
|
|
31
33
|
};
|
|
32
|
-
|
|
33
|
-
() =>
|
|
34
|
-
[a, r,
|
|
34
|
+
A(
|
|
35
|
+
() => N(a ?? r ?? !1),
|
|
36
|
+
[a, r, N]
|
|
35
37
|
);
|
|
36
|
-
const
|
|
37
|
-
(
|
|
38
|
-
|
|
38
|
+
const z = y(
|
|
39
|
+
(n) => {
|
|
40
|
+
S.includes(n) ? (b(""), e == null || e("")) : (b(n), e == null || e(n));
|
|
39
41
|
},
|
|
40
|
-
[
|
|
42
|
+
[S, e]
|
|
41
43
|
);
|
|
42
|
-
return /* @__PURE__ */ o(
|
|
44
|
+
return /* @__PURE__ */ o(d.Provider, { value: V, children: /* @__PURE__ */ I("div", { className: "grid gap-1", children: [
|
|
43
45
|
/* @__PURE__ */ o(
|
|
44
|
-
|
|
46
|
+
g,
|
|
45
47
|
{
|
|
46
48
|
id: l,
|
|
47
|
-
className:
|
|
48
|
-
onChange: () =>
|
|
49
|
-
...
|
|
50
|
-
children:
|
|
49
|
+
className: c,
|
|
50
|
+
onChange: () => z,
|
|
51
|
+
...B,
|
|
52
|
+
children: s
|
|
51
53
|
}
|
|
52
54
|
),
|
|
53
|
-
/* @__PURE__ */ o(
|
|
55
|
+
/* @__PURE__ */ o(j, { children: s })
|
|
54
56
|
] }) });
|
|
55
57
|
}
|
|
56
|
-
),
|
|
57
|
-
const { open: t, setOpen: e } = p(
|
|
58
|
+
), R = i(({ className: l, ...a }, r) => {
|
|
59
|
+
const { open: t, setOpen: e } = p(d) || {};
|
|
58
60
|
return /* @__PURE__ */ o(
|
|
59
|
-
|
|
61
|
+
v,
|
|
60
62
|
{
|
|
61
63
|
ref: r,
|
|
62
64
|
className: l,
|
|
@@ -66,22 +68,22 @@ const m = V(null), v = i(
|
|
|
66
68
|
size: "sm",
|
|
67
69
|
...a,
|
|
68
70
|
children: /* @__PURE__ */ o(
|
|
69
|
-
|
|
71
|
+
v.Icon,
|
|
70
72
|
{
|
|
71
|
-
className:
|
|
73
|
+
className: u("transition-transform duration-300 ease-in-out", {
|
|
72
74
|
"rotate-180 transform": t
|
|
73
75
|
}),
|
|
74
|
-
icon:
|
|
76
|
+
icon: P
|
|
75
77
|
}
|
|
76
78
|
)
|
|
77
79
|
}
|
|
78
80
|
);
|
|
79
|
-
}),
|
|
80
|
-
const { open: r, setOpen: t, internalValue: e } = p(
|
|
81
|
+
}), L = i(({ className: l, children: a }, r) => /* @__PURE__ */ o(m.Label, { className: l, ref: r, children: a })), g = i(({ className: l }, a) => {
|
|
82
|
+
const { open: r, setOpen: t, internalValue: e, label: c, handleChange: s } = p(d) || {};
|
|
81
83
|
return /* @__PURE__ */ I(
|
|
82
|
-
|
|
84
|
+
m,
|
|
83
85
|
{
|
|
84
|
-
className:
|
|
86
|
+
className: u(
|
|
85
87
|
"w-full rounded-md bg-white caret-transparent ",
|
|
86
88
|
l
|
|
87
89
|
),
|
|
@@ -89,30 +91,31 @@ const m = V(null), v = i(
|
|
|
89
91
|
"data-open": r,
|
|
90
92
|
placeholder: "boo",
|
|
91
93
|
value: e ?? "",
|
|
94
|
+
onChange: (f) => s == null ? void 0 : s(f.target.value),
|
|
92
95
|
children: [
|
|
93
|
-
/* @__PURE__ */ o(
|
|
96
|
+
/* @__PURE__ */ o(m.Label, { children: c }),
|
|
94
97
|
/* @__PURE__ */ o(
|
|
95
|
-
|
|
98
|
+
m.Wrapper,
|
|
96
99
|
{
|
|
97
100
|
onClick: () => t == null ? void 0 : t(!r),
|
|
98
101
|
onBlur: () => t == null ? void 0 : t(!1),
|
|
99
|
-
className:
|
|
102
|
+
className: u(
|
|
100
103
|
"caret-transparent rounded hover:cursor-pointer data-[open=true]:border-primary data-[open=true]:ring-1 data-[open=true]:ring-primary",
|
|
101
104
|
l
|
|
102
105
|
),
|
|
103
|
-
children: /* @__PURE__ */ o(
|
|
106
|
+
children: /* @__PURE__ */ o(m.Actions, { children: /* @__PURE__ */ o(R, {}) })
|
|
104
107
|
}
|
|
105
108
|
)
|
|
106
109
|
]
|
|
107
110
|
}
|
|
108
111
|
);
|
|
109
|
-
}),
|
|
110
|
-
const { open: e } = p(
|
|
112
|
+
}), j = i(({ children: l, className: a, ...r }, t) => {
|
|
113
|
+
const { open: e } = p(d) || {};
|
|
111
114
|
return e ? /* @__PURE__ */ o(
|
|
112
|
-
|
|
115
|
+
H,
|
|
113
116
|
{
|
|
114
117
|
ref: t,
|
|
115
|
-
className:
|
|
118
|
+
className: u(
|
|
116
119
|
"!px-0 data-[state=open]:animate-in w-full data-[state=open]:fade-in-0",
|
|
117
120
|
a
|
|
118
121
|
),
|
|
@@ -120,30 +123,32 @@ const m = V(null), v = i(
|
|
|
120
123
|
children: /* @__PURE__ */ o("ul", { children: l })
|
|
121
124
|
}
|
|
122
125
|
) : null;
|
|
123
|
-
}),
|
|
124
|
-
const { setInternalValue:
|
|
126
|
+
}), k = i(({ children: l, value: a, className: r, ...t }, e) => {
|
|
127
|
+
const { setInternalValue: c } = p(d) || {};
|
|
125
128
|
return /* @__PURE__ */ o(
|
|
126
129
|
"li",
|
|
127
130
|
{
|
|
128
131
|
ref: e,
|
|
129
|
-
className:
|
|
132
|
+
className: u(
|
|
130
133
|
"hover:cursor-pointer hover:bg-gray-100 w-full py-2 px-4",
|
|
131
134
|
r
|
|
132
135
|
),
|
|
133
136
|
value: a,
|
|
134
|
-
onMouseDown: (
|
|
137
|
+
onMouseDown: (s) => c == null ? void 0 : c(s.target.innerHTML),
|
|
135
138
|
...t,
|
|
136
139
|
children: l
|
|
137
140
|
}
|
|
138
141
|
);
|
|
139
142
|
});
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
143
|
+
w.displayName = "Select";
|
|
144
|
+
j.displayName = "Select.Content";
|
|
145
|
+
g.displayName = "Select.Trigger";
|
|
146
|
+
k.displayName = "Select.Item";
|
|
147
|
+
L.displayName = "Select.Label";
|
|
148
|
+
const Q = Object.assign(w, {
|
|
149
|
+
Item: k,
|
|
150
|
+
Label: L
|
|
146
151
|
});
|
|
147
152
|
export {
|
|
148
|
-
|
|
153
|
+
Q as Select
|
|
149
154
|
};
|
package/lib/styles/global.css
CHANGED