@code0-tech/pictor 0.17.1 → 0.17.2

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,22 +1,24 @@
1
- import { jsx as t } from "react/jsx-runtime";
1
+ import { jsx as o } from "react/jsx-runtime";
2
2
  import a from "react";
3
- import { Input as l } from "./Input.js";
4
- import { IconX as m } from "@tabler/icons-react";
5
- import { Button as p } from "../button/Button.js";
6
- import { clearInputElement as f } from "./Input.utils.js";
7
- import { ButtonGroup as s } from "../button-group/ButtonGroup.js";
8
- const u = /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/, g = (o) => u.test(o), R = a.forwardRef((o, x) => {
9
- x = x || a.useRef(null);
3
+ import { Input as m } from "./Input.js";
4
+ import { IconX as s } from "@tabler/icons-react";
5
+ import { Button as f } from "../button/Button.js";
6
+ import { clearInputElement as p } from "./Input.utils.js";
7
+ import { ButtonGroup as u } from "../button-group/ButtonGroup.js";
8
+ const z = /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/, R = (x) => z.test(x), y = a.forwardRef((x, t) => {
9
+ t = t || a.useRef(null);
10
10
  const {
11
- clearable: e = !1,
12
- right: i,
13
- ...n
14
- } = o, c = () => {
15
- f(x.current);
16
- }, r = [i];
17
- return e && r.push(/* @__PURE__ */ t(p, { color: "secondary", paddingSize: "xxs", onClick: c, children: /* @__PURE__ */ t(m, { size: 13 }) })), /* @__PURE__ */ t(l, { right: /* @__PURE__ */ t(s, { color: "primary", children: r }), type: "email", ref: x, ...n });
11
+ clearable: i = !1,
12
+ right: n,
13
+ ...c
14
+ } = x, l = () => {
15
+ p(t.current);
16
+ }, r = [n];
17
+ i && r.push(/* @__PURE__ */ o(f, { color: "secondary", paddingSize: "xxs", onClick: l, children: /* @__PURE__ */ o(s, { size: 13 }) }));
18
+ const e = r.filter(Boolean);
19
+ return /* @__PURE__ */ o(m, { right: e.length > 0 ? /* @__PURE__ */ o(u, { color: "primary", children: e }) : void 0, type: "email", ref: t, ...c });
18
20
  });
19
21
  export {
20
- R as EmailInput,
21
- g as emailValidation
22
+ y as EmailInput,
23
+ R as emailValidation
22
24
  };
@@ -1,46 +1,46 @@
1
- import { jsxs as l, Fragment as w, jsx as s } from "react/jsx-runtime";
2
- import c from "react";
3
- import { Input as b } from "./Input.js";
4
- import { IconEye as I, IconX as R } from "@tabler/icons-react";
5
- import { Button as u } from "../button/Button.js";
6
- import { clearInputElement as z } from "./Input.utils.js";
7
- import { Flex as P } from "../flex/Flex.js";
8
- import { Progress as D } from "../progress/Progress.js";
9
- import { InputMessage as A } from "./InputMessage.js";
10
- import { ButtonGroup as B } from "../button-group/ButtonGroup.js";
11
- const X = c.forwardRef((r, t) => {
12
- t = t || c.useRef(null);
1
+ import { jsxs as c, Fragment as b, jsx as o } from "react/jsx-runtime";
2
+ import u from "react";
3
+ import { Input as I } from "./Input.js";
4
+ import { IconEye as R, IconX as z } from "@tabler/icons-react";
5
+ import { Button as p } from "../button/Button.js";
6
+ import { clearInputElement as P } from "./Input.utils.js";
7
+ import { Flex as A } from "../flex/Flex.js";
8
+ import { Progress as B } from "../progress/Progress.js";
9
+ import { InputMessage as D } from "./InputMessage.js";
10
+ import { ButtonGroup as C } from "../button-group/ButtonGroup.js";
11
+ const X = u.forwardRef((r, t) => {
12
+ t = t || u.useRef(null);
13
13
  const {
14
- clearable: p = !0,
15
- visible: d = !0,
16
- right: m,
17
- formValidation: o,
18
- ...f
19
- } = r, g = (e) => (z(t.current), e.stopPropagation(), e.preventDefault(), !1), h = (e) => (t.current instanceof HTMLInputElement && (t.current.type === "password" ? t.current.type = "text" : t.current.type === "text" && (t.current.type = "password")), e.stopPropagation(), e.preventDefault(), !1), n = [m];
20
- d && n.push(/* @__PURE__ */ s(u, { color: "secondary", paddingSize: "xxs", onClick: (e) => h(e), children: /* @__PURE__ */ s(I, { size: 13 }) })), p && n.push(/* @__PURE__ */ s(u, { color: "secondary", paddingSize: "xxs", onClick: (e) => g(e), children: /* @__PURE__ */ s(R, { size: 13 }) }));
21
- const i = o?.notValidMessage ?? "", a = /^[1-5]+$/.test(i), x = i.length, y = Math.max(0, 5 - x) / 5 * 100;
22
- return /* @__PURE__ */ l(w, { children: [
23
- /* @__PURE__ */ s(b, { right: /* @__PURE__ */ s(B, { color: "primary", children: n }), rightType: "action", type: "password", ref: t, ...o ? {
24
- formValidation: a ? {
25
- setValue: o.setValue,
26
- valid: o.valid
27
- } : o
28
- } : {}, ...f }),
29
- a && !o?.valid && /* @__PURE__ */ l(P, { mt: 0.7, style: {
14
+ clearable: d = !0,
15
+ visible: m = !0,
16
+ right: f,
17
+ formValidation: s,
18
+ ...g
19
+ } = r, h = (e) => (P(t.current), e.stopPropagation(), e.preventDefault(), !1), x = (e) => (t.current instanceof HTMLInputElement && (t.current.type === "password" ? t.current.type = "text" : t.current.type === "text" && (t.current.type = "password")), e.stopPropagation(), e.preventDefault(), !1), n = [f];
20
+ m && n.push(/* @__PURE__ */ o(p, { color: "secondary", paddingSize: "xxs", onClick: (e) => x(e), children: /* @__PURE__ */ o(R, { size: 13 }) })), d && n.push(/* @__PURE__ */ o(p, { color: "secondary", paddingSize: "xxs", onClick: (e) => h(e), children: /* @__PURE__ */ o(z, { size: 13 }) }));
21
+ const a = n.filter(Boolean), i = s?.notValidMessage ?? "", l = /^[1-5]+$/.test(i), y = i.length, M = Math.max(0, 5 - y) / 5 * 100;
22
+ return /* @__PURE__ */ c(b, { children: [
23
+ /* @__PURE__ */ o(I, { right: a.length > 0 ? /* @__PURE__ */ o(C, { color: "primary", children: a }) : void 0, rightType: "action", type: "password", ref: t, ...s ? {
24
+ formValidation: l ? {
25
+ setValue: s.setValue,
26
+ valid: s.valid
27
+ } : s
28
+ } : {}, ...g }),
29
+ l && !s?.valid && /* @__PURE__ */ c(A, { mt: 0.7, style: {
30
30
  flexDirection: "column"
31
31
  }, children: [
32
- /* @__PURE__ */ s(D, { value: y, max: 100, color: "linear-gradient(to right, #D90429 0%, #29BF12 100%)" }),
32
+ /* @__PURE__ */ o(B, { value: M, max: 100, color: "linear-gradient(to right, #D90429 0%, #29BF12 100%)" }),
33
33
  (() => {
34
- const e = ["2", "3", "4", "5", "1"].find((V) => i.includes(V));
34
+ const e = ["2", "3", "4", "5", "1"].find((w) => i.includes(w));
35
35
  if (!e) return null;
36
- const M = {
36
+ const V = {
37
37
  1: "Must be at least 8 characters",
38
38
  2: "Must include a lowercase letter",
39
39
  3: "Must include an uppercase letter",
40
40
  4: "Must include a number",
41
41
  5: "Must include a special character"
42
42
  }[e];
43
- return /* @__PURE__ */ s(A, { children: M });
43
+ return /* @__PURE__ */ o(D, { children: V });
44
44
  })()
45
45
  ] })
46
46
  ] });
@@ -1,19 +1,21 @@
1
- import { jsx as o } from "react/jsx-runtime";
1
+ import { jsx as e } from "react/jsx-runtime";
2
2
  import a from "react";
3
- import { Input as u } from "./Input.js";
4
- import { IconX as f } from "@tabler/icons-react";
3
+ import { Input as s } from "./Input.js";
4
+ import { IconX as u } from "@tabler/icons-react";
5
5
  import { Button as p } from "../button/Button.js";
6
- import { clearInputElement as s } from "./Input.utils.js";
7
- const R = a.forwardRef((r, t) => {
6
+ import { clearInputElement as h } from "./Input.utils.js";
7
+ const R = a.forwardRef((o, t) => {
8
8
  t = t || a.useRef(null);
9
9
  const {
10
- clearable: i = !1,
11
- right: l,
10
+ clearable: l = !1,
11
+ right: c,
12
12
  ...m
13
- } = r, c = (e) => {
14
- s(t.current), r.onClear && r.onClear(e);
15
- }, n = [l];
16
- return i && n.push(/* @__PURE__ */ o(p, { variant: "none", onClick: (e) => c(e), children: /* @__PURE__ */ o(f, { size: 13 }) })), /* @__PURE__ */ o(u, { right: n, type: "textarea", ref: t, ...m });
13
+ } = o, f = (r) => {
14
+ h(t.current), o.onClear && o.onClear(r);
15
+ }, n = [c];
16
+ l && n.push(/* @__PURE__ */ e(p, { variant: "none", onClick: (r) => f(r), children: /* @__PURE__ */ e(u, { size: 13 }) }));
17
+ const i = n.filter(Boolean);
18
+ return /* @__PURE__ */ e(s, { right: i.length > 0 ? i : void 0, type: "textarea", ref: t, ...m });
17
19
  });
18
20
  export {
19
21
  R as TextAreaInput
@@ -1,20 +1,22 @@
1
- import { jsx as r } from "react/jsx-runtime";
2
- import i from "react";
3
- import { Input as p } from "./Input.js";
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import l from "react";
3
+ import { Input as s } from "./Input.js";
4
4
  import { IconX as u } from "@tabler/icons-react";
5
5
  import { Button as f } from "../button/Button.js";
6
- import { clearInputElement as s } from "./Input.utils.js";
7
- import { ButtonGroup as d } from "../button-group/ButtonGroup.js";
8
- const b = i.forwardRef((o, t) => {
9
- t = t || i.useRef(null);
6
+ import { clearInputElement as d } from "./Input.utils.js";
7
+ import { ButtonGroup as h } from "../button-group/ButtonGroup.js";
8
+ const b = l.forwardRef((r, t) => {
9
+ t = t || l.useRef(null);
10
10
  const {
11
- clearable: l = !1,
12
- right: c,
13
- ...m
14
- } = o, a = (e) => {
15
- s(t.current), o.onClear && o.onClear(e);
16
- }, n = [c];
17
- return l && n.push(/* @__PURE__ */ r(f, { color: "secondary", paddingSize: "xxs", onClick: (e) => a(e), children: /* @__PURE__ */ r(u, { size: 13 }) })), /* @__PURE__ */ r(p, { right: /* @__PURE__ */ r(d, { color: "primary", children: n }), type: "text", ref: t, ...m });
11
+ clearable: c = !1,
12
+ right: m,
13
+ ...a
14
+ } = r, p = (e) => {
15
+ d(t.current), r.onClear && r.onClear(e);
16
+ }, n = [m];
17
+ c && n.push(/* @__PURE__ */ o(f, { color: "secondary", paddingSize: "xxs", onClick: (e) => p(e), children: /* @__PURE__ */ o(u, { size: 13 }) }));
18
+ const i = n.filter(Boolean);
19
+ return /* @__PURE__ */ o(s, { right: i.length > 0 ? /* @__PURE__ */ o(h, { color: "primary", children: i }) : void 0, type: "text", ref: t, ...a });
18
20
  });
19
21
  export {
20
22
  b as TextInput
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code0-tech/pictor",
3
- "version": "0.17.1",
3
+ "version": "0.17.2",
4
4
  "type": "module",
5
5
  "description": "A simple template for a custom React component library",
6
6
  "scripts": {