@konstructio/ui 0.1.0-alpha.23 → 0.1.0-alpha.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.
|
@@ -1,12 +1,30 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import { forwardRef as
|
|
1
|
+
import { jsx as t, jsxs as m } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as p } from "react";
|
|
3
3
|
import { DropdownProvider as n } from "./contexts/dropdown.provider.js";
|
|
4
|
-
import { Wrapper as
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
import { Wrapper as c } from "./components/Wrapper.js";
|
|
5
|
+
const v = p(({ onChange: r, onBlur: l, value: a, error: s, helperText: e, name: o, ...i }, d) => /* @__PURE__ */ t(
|
|
6
|
+
n,
|
|
7
|
+
{
|
|
8
|
+
onChange: r,
|
|
9
|
+
onBlur: l,
|
|
10
|
+
value: a,
|
|
11
|
+
name: o,
|
|
12
|
+
children: /* @__PURE__ */ m("div", { className: "relative w-full", children: [
|
|
13
|
+
/* @__PURE__ */ t(
|
|
14
|
+
c,
|
|
15
|
+
{
|
|
16
|
+
name: o,
|
|
17
|
+
error: s,
|
|
18
|
+
ref: d,
|
|
19
|
+
onBlur: l,
|
|
20
|
+
...i
|
|
21
|
+
}
|
|
22
|
+
),
|
|
23
|
+
s ? /* @__PURE__ */ t("span", { className: "text-xs text-red-700", children: s }) : null,
|
|
24
|
+
!s && e ? /* @__PURE__ */ t("span", { className: "text-xs text-slate-600", children: e }) : null
|
|
25
|
+
] })
|
|
26
|
+
}
|
|
27
|
+
));
|
|
10
28
|
export {
|
|
11
|
-
|
|
29
|
+
v as Dropdown
|
|
12
30
|
};
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { DropdownContext as
|
|
4
|
-
import { useToggle as
|
|
5
|
-
const
|
|
6
|
-
const [
|
|
7
|
-
(
|
|
8
|
-
|
|
1
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
2
|
+
import { useState as l, useCallback as v } from "react";
|
|
3
|
+
import { DropdownContext as x } from "./dropdown.context.js";
|
|
4
|
+
import { useToggle as T } from "../../../hooks/useToggle.js";
|
|
5
|
+
const P = ({ children: s, value: o, name: r, onChange: e, onBlur: t }) => {
|
|
6
|
+
const [m, p] = T(!1), [a, c] = l(""), i = v(
|
|
7
|
+
(d) => {
|
|
8
|
+
e == null || e({ target: { value: d, name: r ?? "" } }), t == null || t();
|
|
9
9
|
},
|
|
10
|
-
[r,
|
|
10
|
+
[e, r, t]
|
|
11
11
|
);
|
|
12
|
-
return /* @__PURE__ */
|
|
13
|
-
|
|
12
|
+
return /* @__PURE__ */ f(
|
|
13
|
+
x.Provider,
|
|
14
14
|
{
|
|
15
15
|
value: {
|
|
16
16
|
value: o,
|
|
17
|
-
isOpen:
|
|
18
|
-
searchTerm:
|
|
19
|
-
setSearchTerm:
|
|
20
|
-
setValue:
|
|
21
|
-
toggleOpen:
|
|
17
|
+
isOpen: m,
|
|
18
|
+
searchTerm: a,
|
|
19
|
+
setSearchTerm: c,
|
|
20
|
+
setValue: i,
|
|
21
|
+
toggleOpen: p
|
|
22
22
|
},
|
|
23
|
-
children:
|
|
23
|
+
children: s
|
|
24
24
|
}
|
|
25
25
|
);
|
|
26
26
|
};
|
|
27
27
|
export {
|
|
28
|
-
|
|
28
|
+
P as DropdownProvider
|
|
29
29
|
};
|
|
@@ -122,11 +122,11 @@ const C = v(
|
|
|
122
122
|
labelClassName: a,
|
|
123
123
|
name: c,
|
|
124
124
|
theme: b,
|
|
125
|
-
type:
|
|
125
|
+
type: f = "text",
|
|
126
126
|
helperText: w,
|
|
127
127
|
...j
|
|
128
128
|
}, N) => {
|
|
129
|
-
const O = k(), [u, E] = z(() =>
|
|
129
|
+
const O = k(), [u, E] = z(() => f !== "password"), p = typeof r == "string" && r.length >= 0, P = u ? x : y;
|
|
130
130
|
return /* @__PURE__ */ m("div", { className: "flex flex-col gap-2 w-full relative", "data-theme": b, children: [
|
|
131
131
|
n ? /* @__PURE__ */ m(
|
|
132
132
|
"label",
|
|
@@ -150,7 +150,7 @@ const C = v(
|
|
|
150
150
|
className: d(
|
|
151
151
|
"absolute left-2.5 top-1/2 -translate-y-[50%] text-slate-400",
|
|
152
152
|
{
|
|
153
|
-
"text-red-700":
|
|
153
|
+
"text-red-700": p
|
|
154
154
|
}
|
|
155
155
|
),
|
|
156
156
|
children: /* @__PURE__ */ s(I, { className: "w-5 h-5" })
|
|
@@ -162,20 +162,20 @@ const C = v(
|
|
|
162
162
|
id: O,
|
|
163
163
|
ref: N,
|
|
164
164
|
name: c,
|
|
165
|
-
type: u ?
|
|
165
|
+
type: u ? "text" : "password",
|
|
166
166
|
className: d(
|
|
167
167
|
_({
|
|
168
168
|
className: t,
|
|
169
|
-
variant:
|
|
169
|
+
variant: p ? "error" : "default"
|
|
170
170
|
}),
|
|
171
|
-
(
|
|
171
|
+
(f === "password" || p) && "pr-10",
|
|
172
172
|
e && "pl-8"
|
|
173
173
|
),
|
|
174
174
|
...j
|
|
175
175
|
}
|
|
176
176
|
),
|
|
177
|
-
|
|
178
|
-
|
|
177
|
+
p ? /* @__PURE__ */ s("i", { className: "absolute right-3 text-red-700 top-1/2 -translate-y-[50%]", children: /* @__PURE__ */ s(W, { className: "w-5 h-5" }) }) : null,
|
|
178
|
+
f === "password" && !r ? /* @__PURE__ */ s("i", { className: "absolute right-3 text-slate-400 top-1/2 -translate-y-[50%]", children: /* @__PURE__ */ s(
|
|
179
179
|
P,
|
|
180
180
|
{
|
|
181
181
|
className: "w-5 h-5 cursor-pointer",
|
package/dist/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@konstructio/ui",
|
|
3
3
|
"description": "A set of reusable and customizable React components built for konstruct.io",
|
|
4
4
|
"private": false,
|
|
5
|
-
"version": "0.1.0-alpha.
|
|
5
|
+
"version": "0.1.0-alpha.24",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"main": "dist/index.js",
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@konstructio/ui",
|
|
3
3
|
"description": "A set of reusable and customizable React components built for konstruct.io",
|
|
4
4
|
"private": false,
|
|
5
|
-
"version": "0.1.0-alpha.
|
|
5
|
+
"version": "0.1.0-alpha.25",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"main": "dist/index.js",
|