@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.
@@ -1,24 +1,54 @@
1
- import { jsx as l } from "react/jsx-runtime";
2
- import { cn as n } from "../utils/cn.js";
3
- function u(r) {
4
- const { className: e, value: o, onChange: a, ...t } = r;
5
- return /* @__PURE__ */ l(
6
- "input",
7
- {
8
- type: "text",
9
- value: o,
10
- onChange: a,
11
- className: n(
12
- "w-full rounded-lg border border-gray-700 bg-gray-800/50 py-2 pl-10 pr-10",
13
- "text-gray-200 placeholder-gray-500",
14
- "focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500",
15
- "disabled:opacity-50 disabled:cursor-not-allowed disabled:bg-gray-700/50",
16
- e
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
- ...t
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
- u as default
53
+ p as default
24
54
  };
@@ -1,142 +1,157 @@
1
- import { jsxs as a, jsx as t } from "react/jsx-runtime";
2
- import { X as D, ChevronsUpDown as I, Search as _, Check as z } from "lucide-react";
3
- import n, { useCallback as B } from "react";
4
- import P from "../hooks/useClickOutside.js";
5
- import { cn as y } from "../utils/cn.js";
6
- function J(S) {
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: g,
8
+ options: h,
9
9
  value: v,
10
10
  onChange: N,
11
11
  disabled: i,
12
- clearable: U,
13
- searchable: X,
14
- label: k,
15
- placeholder: O = "Select options...",
12
+ clearable: q,
13
+ searchable: A,
14
+ label: O,
15
+ placeholder: L = "Select options...",
16
16
  maxValues: s,
17
17
  ref: M,
18
- error: h,
18
+ error: x,
19
+ loading: u,
19
20
  ...j
20
- } = S, c = s === 1, r = c ? [v] : v, u = (e) => {
21
- N(c ? e.length === 0 ? void 0 : e[0] : e);
22
- }, d = n.useMemo(() => g.length === 0 ? [] : g.map((e) => typeof e == "string" ? {
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), [g]), [m, w] = n.useState(!1), [p, b] = n.useState(""), x = n.useRef(null), f = n.useMemo(() => p.toLowerCase().trim(), [p]), C = n.useMemo(() => f ? d.filter(
26
- (e) => e.label.toLowerCase().includes(f) || e.value.toLowerCase().includes(f)
27
- ) : d, [d, f]), L = (e) => {
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 (r.includes(e)) {
30
- u(r.filter((l) => l !== e));
30
+ if (t.includes(e)) {
31
+ g(t.filter((a) => a !== e));
31
32
  return;
32
33
  }
33
- if (c) {
34
- u([e]);
34
+ if (o) {
35
+ g([e]);
35
36
  return;
36
37
  }
37
- (!s || r.length < s) && u([...r, e]);
38
+ (!s || t.length < s) && g([...t, e]);
38
39
  }
39
- }, R = (e) => {
40
- i || (e.stopPropagation(), u([]), b(""));
41
- }, E = r.map((e) => {
42
- const l = d.find((o) => o.value === e);
43
- return l ? l.labelElement ?? l.label : !1;
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
- m && x.current && x.current.focus();
47
- }, [m]);
48
- const Q = P(
49
- B(() => {
50
- w(!1), b("");
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__ */ a(
54
+ return /* @__PURE__ */ l(
54
55
  "div",
55
56
  {
56
- className: y("relative", i && "opacity-50"),
57
+ className: d("relative w-full", (i || u) && "opacity-60"),
57
58
  ref: (e) => {
58
- Q.current = e, M(e);
59
+ D.current = e, M(e);
59
60
  },
60
61
  ...j,
61
62
  children: [
62
- /* @__PURE__ */ a("label", { className: "mb-1 block text-sm font-medium text-gray-300", children: [
63
- k,
64
- s && !c && /* @__PURE__ */ a("span", { className: "ml-1 text-gray-400", children: [
65
- "(",
66
- r.length,
67
- "/",
68
- s,
69
- ")"
70
- ] })
71
- ] }),
72
- /* @__PURE__ */ a(
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: y(
76
- "relative rounded-lg border border-gray-700 bg-gray-800",
77
- h && "border-red-500"
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__ */ a(
90
+ /* @__PURE__ */ l(
81
91
  "button",
82
92
  {
83
93
  type: "button",
84
- className: "flex w-full items-center justify-between rounded-lg px-3 py-2 text-left text-gray-300 hover:bg-gray-700/50 focus:outline-none focus:ring-2 focus:ring-blue-500",
85
- onClick: () => w(!m),
86
- disabled: i,
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__ */ t("div", { className: "flex-1 truncate", children: r.length === 0 ? /* @__PURE__ */ t("span", { className: "text-gray-500", children: O }) : /* @__PURE__ */ t("div", { className: "flex flex-wrap gap-1", children: E.map((e, l) => /* @__PURE__ */ t(
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-500/20 px-1.5 text-sm text-blue-400",
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
- l
108
+ a
95
109
  )) }) }),
96
- /* @__PURE__ */ a("div", { className: "ml-2 flex items-center gap-2", children: [
97
- r.length > 0 && /* @__PURE__ */ t(
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: R,
101
- className: "rounded-full p-1 transition-colors hover:bg-gray-700",
102
- children: /* @__PURE__ */ t(D, { className: "h-4 w-4 text-gray-400 hover:text-gray-300" })
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__ */ t(I, { className: "h-4 w-4 opacity-50" })
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
- m && /* @__PURE__ */ a("div", { className: "absolute z-20 mt-1 w-full rounded-lg border border-gray-700 bg-gray-800 shadow-lg animate-in fade-in-50 slide-in-from-top-2 isolate", children: [
111
- /* @__PURE__ */ t("div", { className: "border-b border-gray-700 p-2", children: /* @__PURE__ */ a("div", { className: "relative", children: [
112
- /* @__PURE__ */ t(_, { className: "absolute left-2 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400" }),
113
- /* @__PURE__ */ t(
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: x,
130
+ ref: k,
117
131
  type: "text",
118
- value: p,
119
- onChange: (e) => b(e.target.value),
120
- className: "w-full rounded-md bg-gray-900/50 py-1.5 pl-8 pr-4 text-sm text-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500",
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__ */ t("div", { className: "max-h-60 overflow-auto", children: C.length === 0 ? /* @__PURE__ */ t("div", { className: "px-3 py-2 text-center text-sm text-gray-400", children: "No options found" }) : C.map((e) => {
126
- const l = r.includes(e.value);
127
- let o = !l && s && r.length >= s;
128
- return c && (o = !1), /* @__PURE__ */ a(
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: y(
132
- "flex cursor-pointer items-center px-3 py-2 text-gray-300 hover:bg-gray-700/50",
133
- o && "cursor-not-allowed opacity-50"
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: () => !o && L(e.value),
150
+ onClick: () => !c && R(e.value),
136
151
  children: [
137
- !c && /* @__PURE__ */ t("div", { className: "mr-2 flex h-4 w-4 items-center justify-center rounded border border-gray-600", children: l && /* @__PURE__ */ t(z, { className: "h-3 w-3 text-blue-400" }) }),
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
- o && /* @__PURE__ */ t("span", { className: "ml-auto text-xs text-gray-400", children: "Max limit reached" })
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
- h && /* @__PURE__ */ t("p", { className: "text-red-500 text-sm mt-1", children: h })
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
- J as default
170
+ W as default
156
171
  };
@@ -1,25 +1,44 @@
1
- import { jsxs as a, jsx as r } from "react/jsx-runtime";
2
- import { cn as n } from "../utils/cn.js";
3
- function i(o) {
4
- const { label: l, disabled: e, ref: t, ...s } = o;
5
- return /* @__PURE__ */ a("div", { children: [
6
- /* @__PURE__ */ r("label", { className: "block text-sm font-medium text-gray-300 mb-1", children: l }),
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
- "input",
8
+ "label",
9
9
  {
10
- type: "number",
11
- ref: t,
12
- disabled: e,
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
- ...s
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
- i.displayName = "NumberField";
41
+ g.displayName = "NumberField";
23
42
  export {
24
- i as default
43
+ g as default
25
44
  };
@@ -1,19 +1,42 @@
1
- import { jsxs as n, jsx as l } from "react/jsx-runtime";
2
- function i(r) {
3
- const { label: a, options: s, disabled: t, hasError: d, classNames: c, ...o } = r;
4
- return /* @__PURE__ */ n("div", { className: c, children: [
5
- /* @__PURE__ */ l("label", { className: "block text-sm font-medium text-gray-300 mb-1", children: a }),
6
- /* @__PURE__ */ l(
7
- "select",
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: "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",
10
- disabled: t,
11
- ...o,
12
- children: s.map((e) => /* @__PURE__ */ l("option", { value: e.value, children: e.label }, e.value))
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
- i as default
41
+ x as default
19
42
  };
@@ -1,52 +1,72 @@
1
- import { jsxs as r, jsx as t } from "react/jsx-runtime";
2
- import { Loader2 as f } from "lucide-react";
3
- import { cn as l } from "../utils/cn.js";
4
- function b(a) {
5
- const { label: o, loading: i, value: e, onChange: s, children: c, disabled: n } = a;
6
- return /* @__PURE__ */ r("label", { className: "flex items-center gap-3 cursor-pointer", children: [
7
- /* @__PURE__ */ r(
8
- "button",
9
- {
10
- type: "button",
11
- className: l(
12
- "relative inline-flex h-6 w-11 items-center rounded-full transition-colors",
13
- e ? "bg-blue-600" : "bg-gray-700",
14
- "focus:outline-none focus:ring-2 focus:ring-blue-600 focus:ring-offset-2 focus:ring-offset-gray-900",
15
- n && "opacity-50 cursor-not-allowed"
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
- role: "switch",
18
- disabled: n,
19
- onClick: () => {
20
- s(!e);
21
- },
22
- "aria-checked": e,
23
- "aria-label": o,
24
- children: [
25
- /* @__PURE__ */ t(
26
- "span",
27
- {
28
- className: l(
29
- "inline-block h-4 w-4 transform rounded-full bg-white transition-transform",
30
- e ? "translate-x-6" : "translate-x-1"
31
- )
32
- }
33
- ),
34
- /* @__PURE__ */ t(
35
- "div",
36
- {
37
- className: l(
38
- "absolute left-0 top-0 z-10 flex h-full w-full items-center justify-center rounded-2xl bg-slate-500 bg-opacity-55 backdrop-blur-md",
39
- i ? "flex" : "hidden"
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__ */ t(f, { className: l("h-3 w-3 animate-spin text-white") })
42
- }
43
- )
44
- ]
45
- }
46
- ),
47
- c
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
- b as default
71
+ h as default
52
72
  };
@@ -1,3 +1,7 @@
1
- type Props = React.InputHTMLAttributes<HTMLInputElement>;
2
- declare function InputField(props: Props): import("react/jsx-runtime").JSX.Element;
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: React.Ref<HTMLSelectElement>;
8
+ ref?: React.Ref<HTMLSelectElement>;
9
9
  disabled?: boolean;
10
- hasError?: string;
11
- classNames?: string;
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
- type Props = {
3
- label: string;
4
- loading: boolean;
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
- declare function SwitchField(props: Props): import("react/jsx-runtime").JSX.Element;
9
+ error?: string;
10
+ description?: string;
11
+ }
12
+ declare function SwitchField(props: SwitchFieldProps): import("react/jsx-runtime").JSX.Element;
11
13
  export default SwitchField;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@annatarhe/lake-ui",
3
3
  "private": false,
4
- "version": "0.0.20",
4
+ "version": "0.0.23",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "exports": {