@annatarhe/lake-ui 0.0.20 → 0.0.23
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/dist/form/input-field.js +50 -20
- package/dist/form/multi-select.js +99 -84
- package/dist/form/number-field.js +36 -17
- package/dist/form/select-field.js +36 -13
- package/dist/form/switch-field.js +66 -46
- package/dist/src/form/input-field.d.ts +6 -2
- package/dist/src/form/multi-select.d.ts +2 -1
- package/dist/src/form/number-field.d.ts +3 -1
- package/dist/src/form/select-field.d.ts +4 -3
- package/dist/src/form/switch-field.d.ts +8 -6
- package/package.json +1 -1
package/dist/form/input-field.js
CHANGED
|
@@ -1,24 +1,54 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { cn as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { jsxs as d, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { cn as l } from "../utils/cn.js";
|
|
3
|
+
import { Loader2 as u } from "lucide-react";
|
|
4
|
+
function p(s) {
|
|
5
|
+
const {
|
|
6
|
+
className: i,
|
|
7
|
+
value: n,
|
|
8
|
+
onChange: c,
|
|
9
|
+
label: o,
|
|
10
|
+
error: e,
|
|
11
|
+
loading: a,
|
|
12
|
+
disabled: t,
|
|
13
|
+
...g
|
|
14
|
+
} = s;
|
|
15
|
+
return /* @__PURE__ */ d("div", { className: "w-full", children: [
|
|
16
|
+
o && /* @__PURE__ */ r(
|
|
17
|
+
"label",
|
|
18
|
+
{
|
|
19
|
+
className: l(
|
|
20
|
+
"block text-sm font-medium mb-1.5 transition-colors text-gray-700 dark:text-gray-300",
|
|
21
|
+
t && "opacity-60"
|
|
22
|
+
),
|
|
23
|
+
children: o
|
|
24
|
+
}
|
|
25
|
+
),
|
|
26
|
+
/* @__PURE__ */ d("div", { className: "relative", children: [
|
|
27
|
+
/* @__PURE__ */ r(
|
|
28
|
+
"input",
|
|
29
|
+
{
|
|
30
|
+
type: "text",
|
|
31
|
+
value: n,
|
|
32
|
+
onChange: c,
|
|
33
|
+
disabled: t || a,
|
|
34
|
+
className: l(
|
|
35
|
+
"w-full rounded-lg border py-2 px-3 transition-colors",
|
|
36
|
+
"border-gray-300 bg-white text-gray-900 placeholder-gray-400",
|
|
37
|
+
"dark:border-gray-700 dark:bg-gray-800/50 dark:text-gray-200 dark:placeholder-gray-500",
|
|
38
|
+
"focus:outline-none focus:ring-2 focus:border-transparent",
|
|
39
|
+
"focus:ring-blue-400 dark:focus:ring-blue-500",
|
|
40
|
+
e && "border-red-500 focus:ring-red-400 dark:border-red-500/70 dark:focus:ring-red-500",
|
|
41
|
+
(t || a) && "opacity-60 cursor-not-allowed bg-gray-100 dark:bg-gray-700/50",
|
|
42
|
+
i
|
|
43
|
+
),
|
|
44
|
+
...g
|
|
45
|
+
}
|
|
17
46
|
),
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
47
|
+
a && /* @__PURE__ */ r("div", { className: "absolute right-3 top-1/2 -translate-y-1/2", children: /* @__PURE__ */ r(u, { className: "h-4 w-4 animate-spin text-gray-500 dark:text-gray-400" }) })
|
|
48
|
+
] }),
|
|
49
|
+
e && /* @__PURE__ */ r("p", { className: "mt-1.5 text-sm text-red-500 dark:text-red-400", children: e })
|
|
50
|
+
] });
|
|
21
51
|
}
|
|
22
52
|
export {
|
|
23
|
-
|
|
53
|
+
p as default
|
|
24
54
|
};
|
|
@@ -1,142 +1,157 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { X as
|
|
3
|
-
import n, { useCallback as
|
|
4
|
-
import
|
|
5
|
-
import { cn as
|
|
6
|
-
function
|
|
1
|
+
import { jsxs as l, jsx as r, Fragment as I } from "react/jsx-runtime";
|
|
2
|
+
import { Loader2 as _, X as z, ChevronsUpDown as B, Search as F, Check as P } from "lucide-react";
|
|
3
|
+
import n, { useCallback as U } from "react";
|
|
4
|
+
import X from "../hooks/useClickOutside.js";
|
|
5
|
+
import { cn as d } from "../utils/cn.js";
|
|
6
|
+
function W(S) {
|
|
7
7
|
const {
|
|
8
|
-
options:
|
|
8
|
+
options: h,
|
|
9
9
|
value: v,
|
|
10
10
|
onChange: N,
|
|
11
11
|
disabled: i,
|
|
12
|
-
clearable:
|
|
13
|
-
searchable:
|
|
14
|
-
label:
|
|
15
|
-
placeholder:
|
|
12
|
+
clearable: q,
|
|
13
|
+
searchable: A,
|
|
14
|
+
label: O,
|
|
15
|
+
placeholder: L = "Select options...",
|
|
16
16
|
maxValues: s,
|
|
17
17
|
ref: M,
|
|
18
|
-
error:
|
|
18
|
+
error: x,
|
|
19
|
+
loading: u,
|
|
19
20
|
...j
|
|
20
|
-
} = S,
|
|
21
|
-
N(
|
|
22
|
-
},
|
|
21
|
+
} = S, o = s === 1, t = o ? [v] : v, g = (e) => {
|
|
22
|
+
N(o ? e.length === 0 ? void 0 : e[0] : e);
|
|
23
|
+
}, m = n.useMemo(() => h.length === 0 ? [] : h.map((e) => typeof e == "string" ? {
|
|
23
24
|
value: e,
|
|
24
25
|
label: e
|
|
25
|
-
} : e), [
|
|
26
|
-
(e) => e.label.toLowerCase().includes(
|
|
27
|
-
) :
|
|
26
|
+
} : e), [h]), [f, w] = n.useState(!1), [y, p] = n.useState(""), k = n.useRef(null), b = n.useMemo(() => y.toLowerCase().trim(), [y]), C = n.useMemo(() => b ? m.filter(
|
|
27
|
+
(e) => e.label.toLowerCase().includes(b) || e.value.toLowerCase().includes(b)
|
|
28
|
+
) : m, [m, b]), R = (e) => {
|
|
28
29
|
if (!i) {
|
|
29
|
-
if (
|
|
30
|
-
|
|
30
|
+
if (t.includes(e)) {
|
|
31
|
+
g(t.filter((a) => a !== e));
|
|
31
32
|
return;
|
|
32
33
|
}
|
|
33
|
-
if (
|
|
34
|
-
|
|
34
|
+
if (o) {
|
|
35
|
+
g([e]);
|
|
35
36
|
return;
|
|
36
37
|
}
|
|
37
|
-
(!s ||
|
|
38
|
+
(!s || t.length < s) && g([...t, e]);
|
|
38
39
|
}
|
|
39
|
-
},
|
|
40
|
-
i || (e.stopPropagation(),
|
|
41
|
-
},
|
|
42
|
-
const
|
|
43
|
-
return
|
|
40
|
+
}, E = (e) => {
|
|
41
|
+
i || (e.stopPropagation(), g([]), p(""));
|
|
42
|
+
}, Q = t.map((e) => {
|
|
43
|
+
const a = m.find((c) => c.value === e);
|
|
44
|
+
return a ? a.labelElement ?? a.label : !1;
|
|
44
45
|
}).filter(Boolean);
|
|
45
46
|
n.useEffect(() => {
|
|
46
|
-
|
|
47
|
-
}, [
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
w(!1),
|
|
47
|
+
f && k.current && k.current.focus();
|
|
48
|
+
}, [f]);
|
|
49
|
+
const D = X(
|
|
50
|
+
U(() => {
|
|
51
|
+
w(!1), p("");
|
|
51
52
|
}, [])
|
|
52
53
|
);
|
|
53
|
-
return /* @__PURE__ */
|
|
54
|
+
return /* @__PURE__ */ l(
|
|
54
55
|
"div",
|
|
55
56
|
{
|
|
56
|
-
className:
|
|
57
|
+
className: d("relative w-full", (i || u) && "opacity-60"),
|
|
57
58
|
ref: (e) => {
|
|
58
|
-
|
|
59
|
+
D.current = e, M(e);
|
|
59
60
|
},
|
|
60
61
|
...j,
|
|
61
62
|
children: [
|
|
62
|
-
/* @__PURE__ */
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
63
|
+
/* @__PURE__ */ l(
|
|
64
|
+
"label",
|
|
65
|
+
{
|
|
66
|
+
className: d(
|
|
67
|
+
"mb-1.5 block text-sm font-medium transition-colors text-gray-700 dark:text-gray-300",
|
|
68
|
+
(i || u) && "opacity-60"
|
|
69
|
+
),
|
|
70
|
+
children: [
|
|
71
|
+
O,
|
|
72
|
+
s && !o && /* @__PURE__ */ l("span", { className: "ml-1 text-gray-500 dark:text-gray-400", children: [
|
|
73
|
+
"(",
|
|
74
|
+
t.length,
|
|
75
|
+
"/",
|
|
76
|
+
s,
|
|
77
|
+
")"
|
|
78
|
+
] })
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
),
|
|
82
|
+
/* @__PURE__ */ l(
|
|
73
83
|
"div",
|
|
74
84
|
{
|
|
75
|
-
className:
|
|
76
|
-
"relative rounded-lg border border-gray-700 bg-gray-800",
|
|
77
|
-
|
|
85
|
+
className: d(
|
|
86
|
+
"relative rounded-lg border transition-colors border-gray-300 bg-white dark:border-gray-700 dark:bg-gray-800/50",
|
|
87
|
+
x && "border-red-500 dark:border-red-500/70"
|
|
78
88
|
),
|
|
79
89
|
children: [
|
|
80
|
-
/* @__PURE__ */
|
|
90
|
+
/* @__PURE__ */ l(
|
|
81
91
|
"button",
|
|
82
92
|
{
|
|
83
93
|
type: "button",
|
|
84
|
-
className:
|
|
85
|
-
|
|
86
|
-
|
|
94
|
+
className: d(
|
|
95
|
+
"flex w-full items-center justify-between rounded-lg px-3 py-2 text-left transition-colors",
|
|
96
|
+
"text-gray-700 hover:bg-gray-100/80 dark:text-gray-300 dark:hover:bg-gray-700/50",
|
|
97
|
+
"focus:outline-none focus:ring-2 focus:ring-blue-400 dark:focus:ring-blue-500"
|
|
98
|
+
),
|
|
99
|
+
onClick: () => w(!f),
|
|
100
|
+
disabled: i || u,
|
|
87
101
|
children: [
|
|
88
|
-
/* @__PURE__ */
|
|
102
|
+
/* @__PURE__ */ r("div", { className: "flex-1 truncate", children: t.length === 0 ? /* @__PURE__ */ r("span", { className: "text-gray-400 dark:text-gray-500", children: L }) : /* @__PURE__ */ r("div", { className: "flex flex-wrap gap-1", children: Q.map((e, a) => /* @__PURE__ */ r(
|
|
89
103
|
"span",
|
|
90
104
|
{
|
|
91
|
-
className: "inline-flex items-center rounded bg-blue-
|
|
105
|
+
className: "inline-flex items-center rounded px-1.5 text-sm bg-blue-400/20 text-blue-600 dark:bg-blue-500/20 dark:text-blue-400",
|
|
92
106
|
children: e
|
|
93
107
|
},
|
|
94
|
-
|
|
108
|
+
a
|
|
95
109
|
)) }) }),
|
|
96
|
-
/* @__PURE__ */
|
|
97
|
-
|
|
110
|
+
/* @__PURE__ */ r("div", { className: "ml-2 flex items-center gap-2", children: u ? /* @__PURE__ */ r(_, { className: "h-4 w-4 animate-spin text-gray-500 dark:text-gray-400" }) : /* @__PURE__ */ l(I, { children: [
|
|
111
|
+
t.length > 0 && /* @__PURE__ */ r(
|
|
98
112
|
"button",
|
|
99
113
|
{
|
|
100
|
-
onClick:
|
|
101
|
-
className: "rounded-full p-1 transition-colors hover:bg-gray-700",
|
|
102
|
-
children: /* @__PURE__ */
|
|
114
|
+
onClick: E,
|
|
115
|
+
className: "rounded-full p-1 transition-colors hover:bg-gray-200 dark:hover:bg-gray-700",
|
|
116
|
+
children: /* @__PURE__ */ r(z, { className: "h-4 w-4 text-gray-500 hover:text-gray-600 dark:text-gray-400 dark:hover:text-gray-300" })
|
|
103
117
|
}
|
|
104
118
|
),
|
|
105
|
-
/* @__PURE__ */
|
|
106
|
-
] })
|
|
119
|
+
/* @__PURE__ */ r(B, { className: "h-4 w-4 opacity-50 text-gray-500 dark:text-gray-400" })
|
|
120
|
+
] }) })
|
|
107
121
|
]
|
|
108
122
|
}
|
|
109
123
|
),
|
|
110
|
-
|
|
111
|
-
/* @__PURE__ */
|
|
112
|
-
/* @__PURE__ */
|
|
113
|
-
/* @__PURE__ */
|
|
124
|
+
f && /* @__PURE__ */ l("div", { className: "absolute z-20 mt-1 w-full rounded-lg border shadow-lg animate-in fade-in-50 slide-in-from-top-2 isolate border-gray-300 bg-white dark:border-gray-700 dark:bg-gray-800", children: [
|
|
125
|
+
/* @__PURE__ */ r("div", { className: "border-b p-2 border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ l("div", { className: "relative", children: [
|
|
126
|
+
/* @__PURE__ */ r(F, { className: "absolute left-2 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-500 dark:text-gray-400" }),
|
|
127
|
+
/* @__PURE__ */ r(
|
|
114
128
|
"input",
|
|
115
129
|
{
|
|
116
|
-
ref:
|
|
130
|
+
ref: k,
|
|
117
131
|
type: "text",
|
|
118
|
-
value:
|
|
119
|
-
onChange: (e) =>
|
|
120
|
-
className: "w-full rounded-md
|
|
132
|
+
value: y,
|
|
133
|
+
onChange: (e) => p(e.target.value),
|
|
134
|
+
className: "w-full rounded-md py-1.5 pl-8 pr-4 text-sm focus:outline-none focus:ring-2 bg-gray-100/70 text-gray-700 focus:ring-blue-400 dark:bg-gray-900/50 dark:text-gray-300 dark:focus:ring-blue-500",
|
|
121
135
|
placeholder: "Search options..."
|
|
122
136
|
}
|
|
123
137
|
)
|
|
124
138
|
] }) }),
|
|
125
|
-
/* @__PURE__ */
|
|
126
|
-
const
|
|
127
|
-
let
|
|
128
|
-
return
|
|
139
|
+
/* @__PURE__ */ r("div", { className: "max-h-60 overflow-auto", children: C.length === 0 ? /* @__PURE__ */ r("div", { className: "px-3 py-2 text-center text-sm text-gray-500 dark:text-gray-400", children: "No options found" }) : C.map((e) => {
|
|
140
|
+
const a = t.includes(e.value);
|
|
141
|
+
let c = !a && s && t.length >= s;
|
|
142
|
+
return o && (c = !1), /* @__PURE__ */ l(
|
|
129
143
|
"div",
|
|
130
144
|
{
|
|
131
|
-
className:
|
|
132
|
-
"flex cursor-pointer items-center px-3 py-2
|
|
133
|
-
|
|
145
|
+
className: d(
|
|
146
|
+
"flex cursor-pointer items-center px-3 py-2 transition-colors",
|
|
147
|
+
"text-gray-700 hover:bg-gray-100/80 dark:text-gray-300 dark:hover:bg-gray-700/50",
|
|
148
|
+
c && "cursor-not-allowed opacity-50"
|
|
134
149
|
),
|
|
135
|
-
onClick: () => !
|
|
150
|
+
onClick: () => !c && R(e.value),
|
|
136
151
|
children: [
|
|
137
|
-
!
|
|
152
|
+
!o && /* @__PURE__ */ r("div", { className: "mr-2 flex h-4 w-4 items-center justify-center rounded border border-gray-400 dark:border-gray-600", children: a && /* @__PURE__ */ r(P, { className: "h-3 w-3 text-blue-500 dark:text-blue-400" }) }),
|
|
138
153
|
e.labelElement ?? e.label,
|
|
139
|
-
|
|
154
|
+
c && /* @__PURE__ */ r("span", { className: "ml-auto text-xs text-gray-500 dark:text-gray-400", children: "Max limit reached" })
|
|
140
155
|
]
|
|
141
156
|
},
|
|
142
157
|
e.value
|
|
@@ -146,11 +161,11 @@ function J(S) {
|
|
|
146
161
|
]
|
|
147
162
|
}
|
|
148
163
|
),
|
|
149
|
-
|
|
164
|
+
x && /* @__PURE__ */ r("p", { className: "mt-1.5 text-sm text-red-500 dark:text-red-400", children: x })
|
|
150
165
|
]
|
|
151
166
|
}
|
|
152
167
|
);
|
|
153
168
|
}
|
|
154
169
|
export {
|
|
155
|
-
|
|
170
|
+
W as default
|
|
156
171
|
};
|
|
@@ -1,25 +1,44 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { cn as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { jsxs as d, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { cn as o } from "../utils/cn.js";
|
|
3
|
+
import { Loader2 as c } from "lucide-react";
|
|
4
|
+
function g(l) {
|
|
5
|
+
const { label: s, disabled: e, ref: i, error: a, loading: t, ...n } = l;
|
|
6
|
+
return /* @__PURE__ */ d("div", { className: "w-full", children: [
|
|
7
7
|
/* @__PURE__ */ r(
|
|
8
|
-
"
|
|
8
|
+
"label",
|
|
9
9
|
{
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
className: n(
|
|
14
|
-
"w-full bg-gray-900/50 border border-gray-700 rounded-lg px-4 py-2 text-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-500",
|
|
15
|
-
e && "opacity-50 cursor-not-allowed"
|
|
10
|
+
className: o(
|
|
11
|
+
"block text-sm font-medium mb-1.5 transition-colors text-gray-700 dark:text-gray-300",
|
|
12
|
+
e && "opacity-60"
|
|
16
13
|
),
|
|
17
|
-
|
|
14
|
+
children: s
|
|
18
15
|
}
|
|
19
|
-
)
|
|
16
|
+
),
|
|
17
|
+
/* @__PURE__ */ d("div", { className: "relative", children: [
|
|
18
|
+
/* @__PURE__ */ r(
|
|
19
|
+
"input",
|
|
20
|
+
{
|
|
21
|
+
type: "number",
|
|
22
|
+
ref: i,
|
|
23
|
+
disabled: e || t,
|
|
24
|
+
className: o(
|
|
25
|
+
"w-full rounded-lg border py-2 px-3 transition-colors",
|
|
26
|
+
"border-gray-300 bg-white text-gray-900 placeholder-gray-400",
|
|
27
|
+
"dark:border-gray-700 dark:bg-gray-800/50 dark:text-gray-200 dark:placeholder-gray-500",
|
|
28
|
+
"focus:outline-none focus:ring-2 focus:border-transparent",
|
|
29
|
+
"focus:ring-blue-400 dark:focus:ring-blue-500",
|
|
30
|
+
a && "border-red-500 focus:ring-red-400 dark:border-red-500/70 dark:focus:ring-red-500",
|
|
31
|
+
(e || t) && "opacity-60 cursor-not-allowed bg-gray-100 dark:bg-gray-700/50"
|
|
32
|
+
),
|
|
33
|
+
...n
|
|
34
|
+
}
|
|
35
|
+
),
|
|
36
|
+
t && /* @__PURE__ */ r("div", { className: "absolute right-3 top-1/2 -translate-y-1/2", children: /* @__PURE__ */ r(c, { className: "h-4 w-4 animate-spin text-gray-500 dark:text-gray-400" }) })
|
|
37
|
+
] }),
|
|
38
|
+
a && /* @__PURE__ */ r("p", { className: "mt-1.5 text-sm text-red-500 dark:text-red-400", children: a })
|
|
20
39
|
] });
|
|
21
40
|
}
|
|
22
|
-
|
|
41
|
+
g.displayName = "NumberField";
|
|
23
42
|
export {
|
|
24
|
-
|
|
43
|
+
g as default
|
|
25
44
|
};
|
|
@@ -1,19 +1,42 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { jsxs as s, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { cn as o } from "../utils/cn.js";
|
|
3
|
+
import { Loader2 as m, ChevronDown as u } from "lucide-react";
|
|
4
|
+
function x(d) {
|
|
5
|
+
const { label: n, options: i, disabled: e, error: a, loading: t, className: c, ...g } = d;
|
|
6
|
+
return /* @__PURE__ */ s("div", { className: o("w-full", c), children: [
|
|
7
|
+
/* @__PURE__ */ r(
|
|
8
|
+
"label",
|
|
8
9
|
{
|
|
9
|
-
className:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
className: o(
|
|
11
|
+
"block text-sm font-medium mb-1.5 transition-colors text-gray-700 dark:text-gray-300",
|
|
12
|
+
e && "opacity-60"
|
|
13
|
+
),
|
|
14
|
+
children: n
|
|
13
15
|
}
|
|
14
|
-
)
|
|
16
|
+
),
|
|
17
|
+
/* @__PURE__ */ s("div", { className: "relative", children: [
|
|
18
|
+
/* @__PURE__ */ r(
|
|
19
|
+
"select",
|
|
20
|
+
{
|
|
21
|
+
className: o(
|
|
22
|
+
"w-full rounded-lg border py-2 px-3 pr-8 appearance-none transition-colors",
|
|
23
|
+
"border-gray-300 bg-white text-gray-900",
|
|
24
|
+
"dark:border-gray-700 dark:bg-gray-800/50 dark:text-gray-200",
|
|
25
|
+
"focus:outline-none focus:ring-2 focus:border-transparent",
|
|
26
|
+
"focus:ring-blue-400 dark:focus:ring-blue-500",
|
|
27
|
+
a && "border-red-500 focus:ring-red-400 dark:border-red-500/70 dark:focus:ring-red-500",
|
|
28
|
+
(e || t) && "opacity-60 cursor-not-allowed bg-gray-100 dark:bg-gray-700/50"
|
|
29
|
+
),
|
|
30
|
+
disabled: e || t,
|
|
31
|
+
...g,
|
|
32
|
+
children: i.map((l) => /* @__PURE__ */ r("option", { value: l.value, children: l.label }, l.value))
|
|
33
|
+
}
|
|
34
|
+
),
|
|
35
|
+
/* @__PURE__ */ r("div", { className: "absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none", children: t ? /* @__PURE__ */ r(m, { className: "h-4 w-4 animate-spin text-gray-500 dark:text-gray-400" }) : /* @__PURE__ */ r(u, { className: "h-4 w-4 text-gray-500 dark:text-gray-400" }) })
|
|
36
|
+
] }),
|
|
37
|
+
a && /* @__PURE__ */ r("p", { className: "mt-1.5 text-sm text-red-500 dark:text-red-400", children: a })
|
|
15
38
|
] });
|
|
16
39
|
}
|
|
17
40
|
export {
|
|
18
|
-
|
|
41
|
+
x as default
|
|
19
42
|
};
|
|
@@ -1,52 +1,72 @@
|
|
|
1
|
-
import { jsxs as r, jsx as
|
|
2
|
-
import { Loader2 as
|
|
3
|
-
import { cn as
|
|
4
|
-
function
|
|
5
|
-
const {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { jsxs as r, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { Loader2 as u } from "lucide-react";
|
|
3
|
+
import { cn as s } from "../utils/cn.js";
|
|
4
|
+
function h(o) {
|
|
5
|
+
const {
|
|
6
|
+
label: c,
|
|
7
|
+
loading: i = !1,
|
|
8
|
+
value: t,
|
|
9
|
+
onChange: d,
|
|
10
|
+
children: f,
|
|
11
|
+
disabled: a,
|
|
12
|
+
error: l,
|
|
13
|
+
description: n
|
|
14
|
+
} = o;
|
|
15
|
+
return /* @__PURE__ */ r("div", { className: "w-full", children: [
|
|
16
|
+
/* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
|
|
17
|
+
/* @__PURE__ */ r("div", { className: "flex flex-col", children: [
|
|
18
|
+
/* @__PURE__ */ e(
|
|
19
|
+
"label",
|
|
20
|
+
{
|
|
21
|
+
className: s(
|
|
22
|
+
"text-sm font-medium transition-colors text-gray-700 dark:text-gray-300",
|
|
23
|
+
a && "opacity-60"
|
|
24
|
+
),
|
|
25
|
+
children: c
|
|
26
|
+
}
|
|
16
27
|
),
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
28
|
+
n && /* @__PURE__ */ e("p", { className: "text-xs mt-0.5 text-gray-500 dark:text-gray-400", children: n })
|
|
29
|
+
] }),
|
|
30
|
+
/* @__PURE__ */ r("div", { className: "flex items-center gap-3", children: [
|
|
31
|
+
/* @__PURE__ */ r(
|
|
32
|
+
"button",
|
|
33
|
+
{
|
|
34
|
+
type: "button",
|
|
35
|
+
className: s(
|
|
36
|
+
"relative inline-flex h-6 w-11 items-center rounded-full transition-colors",
|
|
37
|
+
t ? "bg-blue-500 dark:bg-blue-600" : "bg-gray-300 dark:bg-gray-700",
|
|
38
|
+
"focus:outline-none focus:ring-2",
|
|
39
|
+
"focus:ring-blue-500 focus:ring-offset-1 focus:ring-offset-white",
|
|
40
|
+
"dark:focus:ring-blue-600 dark:focus:ring-offset-2 dark:focus:ring-offset-gray-900",
|
|
41
|
+
a && "opacity-50 cursor-not-allowed",
|
|
42
|
+
l && "ring-2 ring-red-400 dark:ring-red-500"
|
|
43
|
+
),
|
|
44
|
+
role: "switch",
|
|
45
|
+
disabled: a || i,
|
|
46
|
+
onClick: () => {
|
|
47
|
+
d(!t);
|
|
48
|
+
},
|
|
49
|
+
"aria-checked": t,
|
|
50
|
+
children: [
|
|
51
|
+
/* @__PURE__ */ e(
|
|
52
|
+
"span",
|
|
53
|
+
{
|
|
54
|
+
className: s(
|
|
55
|
+
"inline-block h-4 w-4 transform rounded-full bg-white transition-transform shadow-sm",
|
|
56
|
+
t ? "translate-x-6" : "translate-x-1"
|
|
57
|
+
)
|
|
58
|
+
}
|
|
40
59
|
),
|
|
41
|
-
children: /* @__PURE__ */
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
60
|
+
i && /* @__PURE__ */ e("div", { className: "absolute left-0 top-0 z-10 flex h-full w-full items-center justify-center rounded-full bg-slate-300/55 dark:bg-slate-500/55 backdrop-blur-md", children: /* @__PURE__ */ e(u, { className: "h-3 w-3 animate-spin text-white" }) })
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
),
|
|
64
|
+
f
|
|
65
|
+
] })
|
|
66
|
+
] }),
|
|
67
|
+
l && /* @__PURE__ */ e("p", { className: "mt-1.5 text-sm text-red-500 dark:text-red-400", children: l })
|
|
48
68
|
] });
|
|
49
69
|
}
|
|
50
70
|
export {
|
|
51
|
-
|
|
71
|
+
h as default
|
|
52
72
|
};
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
interface InputFieldProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
2
|
+
label?: string | React.ReactNode;
|
|
3
|
+
error?: string;
|
|
4
|
+
loading?: boolean;
|
|
5
|
+
}
|
|
6
|
+
declare function InputField(props: InputFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
3
7
|
export default InputField;
|
|
@@ -9,7 +9,7 @@ interface MultiSelectProps {
|
|
|
9
9
|
disabled?: boolean;
|
|
10
10
|
value?: string[] | string;
|
|
11
11
|
onChange: (value?: string[] | string) => void;
|
|
12
|
-
label: string;
|
|
12
|
+
label: string | React.ReactNode;
|
|
13
13
|
placeholder?: string;
|
|
14
14
|
maxValues?: number;
|
|
15
15
|
searchable?: boolean;
|
|
@@ -18,6 +18,7 @@ interface MultiSelectProps {
|
|
|
18
18
|
name?: string;
|
|
19
19
|
ref: React.RefCallback<HTMLDivElement | null>;
|
|
20
20
|
error?: string;
|
|
21
|
+
loading?: boolean;
|
|
21
22
|
}
|
|
22
23
|
declare function MultiSelect(props: MultiSelectProps): import("react/jsx-runtime").JSX.Element;
|
|
23
24
|
export default MultiSelect;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
interface NumberFieldProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
3
|
-
label: string;
|
|
3
|
+
label: string | React.ReactNode;
|
|
4
4
|
disabled?: boolean;
|
|
5
5
|
ref?: React.Ref<HTMLInputElement>;
|
|
6
|
+
error?: string;
|
|
7
|
+
loading?: boolean;
|
|
6
8
|
}
|
|
7
9
|
declare function NumberField(props: NumberFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
8
10
|
declare namespace NumberField {
|
|
@@ -5,10 +5,11 @@ interface SelectFieldProps extends React.SelectHTMLAttributes<HTMLSelectElement>
|
|
|
5
5
|
value: string;
|
|
6
6
|
label: string;
|
|
7
7
|
}>;
|
|
8
|
-
ref
|
|
8
|
+
ref?: React.Ref<HTMLSelectElement>;
|
|
9
9
|
disabled?: boolean;
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
error?: string;
|
|
11
|
+
loading?: boolean;
|
|
12
|
+
className?: string;
|
|
12
13
|
}
|
|
13
14
|
declare function SelectField(props: SelectFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
14
15
|
export default SelectField;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
|
|
3
|
-
label: string;
|
|
4
|
-
loading
|
|
2
|
+
interface SwitchFieldProps {
|
|
3
|
+
label: string | React.ReactNode;
|
|
4
|
+
loading?: boolean;
|
|
5
5
|
value: boolean;
|
|
6
|
-
onChange: (value: boolean) => Promise<unknown
|
|
6
|
+
onChange: (value: boolean) => Promise<unknown> | void;
|
|
7
7
|
children?: React.ReactNode;
|
|
8
8
|
disabled?: boolean;
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
error?: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
}
|
|
12
|
+
declare function SwitchField(props: SwitchFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
11
13
|
export default SwitchField;
|