@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 d } from "react/jsx-runtime";
2
- import { forwardRef as m } from "react";
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 p } from "./components/Wrapper.js";
5
- const h = m(({ onChange: r, value: e, error: s, helperText: l, name: o, ...a }, i) => /* @__PURE__ */ t(n, { onChange: r, value: e, name: o, children: /* @__PURE__ */ d("div", { className: "relative w-full", children: [
6
- /* @__PURE__ */ t(p, { name: o, error: s, ref: i, ...a }),
7
- s ? /* @__PURE__ */ t("span", { className: "text-xs text-red-700", children: s }) : null,
8
- !s && l ? /* @__PURE__ */ t("span", { className: "text-xs text-slate-600", children: l }) : null
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
- h as Dropdown
29
+ v as Dropdown
12
30
  };
@@ -1,29 +1,29 @@
1
- import { jsx as i } from "react/jsx-runtime";
2
- import { useState as u, useCallback as d } from "react";
3
- import { DropdownContext as f } from "./dropdown.context.js";
4
- import { useToggle as v } from "../../../hooks/useToggle.js";
5
- const D = ({ children: t, onChange: r, value: o, name: e }) => {
6
- const [s, m] = v(!1), [l, p] = u(""), a = d(
7
- (c) => {
8
- r == null || r({ target: { value: c, name: e ?? "" } });
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, e]
10
+ [e, r, t]
11
11
  );
12
- return /* @__PURE__ */ i(
13
- f.Provider,
12
+ return /* @__PURE__ */ f(
13
+ x.Provider,
14
14
  {
15
15
  value: {
16
16
  value: o,
17
- isOpen: s,
18
- searchTerm: l,
19
- setSearchTerm: p,
20
- setValue: a,
21
- toggleOpen: m
17
+ isOpen: m,
18
+ searchTerm: a,
19
+ setSearchTerm: c,
20
+ setValue: i,
21
+ toggleOpen: p
22
22
  },
23
- children: t
23
+ children: s
24
24
  }
25
25
  );
26
26
  };
27
27
  export {
28
- D as DropdownProvider
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: p = "text",
125
+ type: f = "text",
126
126
  helperText: w,
127
127
  ...j
128
128
  }, N) => {
129
- const O = k(), [u, E] = z(() => p !== "password"), f = typeof r == "string" && r.length >= 0, P = u ? x : y;
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": f
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 ? p : "password",
165
+ type: u ? "text" : "password",
166
166
  className: d(
167
167
  _({
168
168
  className: t,
169
- variant: f ? "error" : "default"
169
+ variant: p ? "error" : "default"
170
170
  }),
171
- (p === "password" || f) && "pr-10",
171
+ (f === "password" || p) && "pr-10",
172
172
  e && "pl-8"
173
173
  ),
174
174
  ...j
175
175
  }
176
176
  ),
177
- f ? /* @__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
- p === "password" && !r ? /* @__PURE__ */ s("i", { className: "absolute right-3 text-slate-400 top-1/2 -translate-y-[50%]", children: /* @__PURE__ */ s(
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.22",
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.23",
5
+ "version": "0.1.0-alpha.25",
6
6
  "type": "module",
7
7
  "license": "MIT",
8
8
  "main": "dist/index.js",