lawgic-dev-kit 0.21.0 → 0.21.6

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.
@@ -0,0 +1,4 @@
1
+ import { FieldValues } from "react-hook-form";
2
+ import type { SelectInputProps } from "./SelectInput.types";
3
+ declare const SelectInput: <T extends FieldValues>({ options, name, control, label, placeholder, className, input, dropdownStyle, innerClassName, showChevron, }: SelectInputProps<T>) => import("react/jsx-runtime").JSX.Element;
4
+ export default SelectInput;
@@ -0,0 +1,31 @@
1
+ import type { Control, FieldValues, Path } from "react-hook-form";
2
+ export interface Option {
3
+ key: string;
4
+ label: string;
5
+ expandedLabel?: string | React.ReactNode;
6
+ }
7
+ export interface SelectInputProps<T extends FieldValues> {
8
+ options: Option[];
9
+ name: Path<T>;
10
+ control: Control<T>;
11
+ label?: string;
12
+ placeholder?: string;
13
+ input?: boolean;
14
+ className?: string;
15
+ innerClassName?: string;
16
+ dropdownStyle?: React.CSSProperties;
17
+ showChevron?: boolean;
18
+ }
19
+ export interface SelectInputFieldProps {
20
+ options: Option[];
21
+ value: Option | null;
22
+ onChange: (option: Option | null) => void;
23
+ label?: string;
24
+ placeholder?: string;
25
+ error?: string;
26
+ input?: boolean;
27
+ className?: string;
28
+ innerClassName?: string;
29
+ dropdownStyle?: React.CSSProperties;
30
+ showChevron?: boolean;
31
+ }
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ interface Option {
3
+ value: number | string;
4
+ label: string | React.ReactNode;
5
+ expandedLabel?: string | React.ReactNode;
6
+ }
7
+ interface UncontrolledSelectorProps {
8
+ value: number | string;
9
+ onChange: (value: number | string) => void;
10
+ options: Option[];
11
+ placeholder?: string;
12
+ label?: string;
13
+ error?: string;
14
+ disabled?: boolean;
15
+ allowSearch?: boolean;
16
+ className?: string;
17
+ innerClassName?: string;
18
+ dropdownStyle?: React.CSSProperties;
19
+ showChevron?: boolean;
20
+ }
21
+ declare const UncontrolledSelector: React.FC<UncontrolledSelectorProps>;
22
+ export default UncontrolledSelector;
@@ -15,8 +15,8 @@ export interface ToastMethods {
15
15
  success: ToastContent;
16
16
  error: ToastContent;
17
17
  }, options?: ToastOptions) => {
18
- resolve: () => void;
19
- reject: () => void;
18
+ resolve: (value?: unknown) => void;
19
+ reject: (reason?: unknown) => void;
20
20
  };
21
21
  async: (promise: Promise<unknown>, messages: {
22
22
  loading: ToastContent;
@@ -12,11 +12,11 @@ import "../components/atoms/ImageProfileInput/ImageProfileInput.validators.js";
12
12
  import h from "../components/atoms/Toast/Toast.js";
13
13
  import "fuse.js";
14
14
  const m = [];
15
- function l(e = "bottom-center") {
15
+ function l(t = "bottom-center") {
16
16
  var o;
17
- if (!m.find((t) => t.id === e)) {
18
- const t = document.createElement("div");
19
- switch (t.classList.add(
17
+ if (!m.find((e) => e.id === t)) {
18
+ const e = document.createElement("div");
19
+ switch (e.classList.add(
20
20
  "fixed",
21
21
  "z-[99999]",
22
22
  "flex",
@@ -24,48 +24,48 @@ function l(e = "bottom-center") {
24
24
  "items-center",
25
25
  "w-fit",
26
26
  "min-w-[18rem]"
27
- ), t.style.setProperty("z-index", "99999"), e) {
27
+ ), e.style.setProperty("z-index", "99999"), t) {
28
28
  case "top-left":
29
- t.classList.add("top-8", "left-8");
29
+ e.classList.add("top-8", "left-8");
30
30
  break;
31
31
  case "top-right":
32
- t.classList.add("top-8", "right-8");
32
+ e.classList.add("top-8", "right-8");
33
33
  break;
34
34
  case "bottom-left":
35
- t.classList.add("bottom-8", "left-8");
35
+ e.classList.add("bottom-8", "left-8");
36
36
  break;
37
37
  case "bottom-right":
38
- t.classList.add("bottom-8", "right-8");
38
+ e.classList.add("bottom-8", "right-8");
39
39
  break;
40
40
  case "top-center":
41
- t.classList.add("top-8", "left-1/2", "-translate-x-1/2");
41
+ e.classList.add("top-8", "left-1/2", "-translate-x-1/2");
42
42
  break;
43
43
  case "bottom-center":
44
44
  default:
45
- t.classList.add(
45
+ e.classList.add(
46
46
  "bottom-8",
47
47
  "left-1/2",
48
48
  "-translate-x-1/2"
49
49
  );
50
50
  }
51
- m.push({ id: e, element: t }), document.body.appendChild(t);
51
+ m.push({ id: t, element: e }), document.body.appendChild(e);
52
52
  }
53
- return (o = m.find((t) => t.id === e)) == null ? void 0 : o.element;
53
+ return (o = m.find((e) => e.id === t)) == null ? void 0 : o.element;
54
54
  }
55
- function c(e, o = "success", { position: t = "top-right", duration: a = 3e3 } = {}) {
55
+ function a(t, o = "success", { position: e = "top-right", duration: i = 3e3 } = {}) {
56
56
  import("react-dom/client").then(({ createRoot: n }) => {
57
- const s = l(t);
57
+ const s = l(e);
58
58
  if (!s) return;
59
- const r = document.createElement("div"), i = n(r), f = () => {
60
- i.unmount(), s.removeChild(r);
59
+ const r = document.createElement("div"), c = n(r), f = () => {
60
+ c.unmount(), s.removeChild(r);
61
61
  };
62
- i.render(
62
+ c.render(
63
63
  /* @__PURE__ */ d.jsx(
64
64
  h,
65
65
  {
66
- content: e,
66
+ content: t,
67
67
  type: o,
68
- duration: a,
68
+ duration: i,
69
69
  onClose: f
70
70
  }
71
71
  )
@@ -74,45 +74,49 @@ function c(e, o = "success", { position: t = "top-right", duration: a = 3e3 } =
74
74
  }, 10);
75
75
  });
76
76
  }
77
- const p = (e, o, t = {}) => {
78
- import("react-dom/client").then(({ createRoot: a }) => {
79
- const n = l(t.position);
77
+ const p = (t, o, e = {}) => {
78
+ import("react-dom/client").then(({ createRoot: i }) => {
79
+ const n = l(e.position);
80
80
  if (!n) return;
81
- const s = document.createElement("div"), r = a(s), i = () => {
81
+ const s = document.createElement("div"), r = i(s), c = () => {
82
82
  r.unmount(), n.removeChild(s);
83
83
  };
84
84
  r.render(
85
85
  /* @__PURE__ */ d.jsx(
86
86
  u,
87
87
  {
88
- promise: e,
88
+ promise: t,
89
89
  messages: o,
90
- options: t,
91
- onClose: i
90
+ options: e,
91
+ onClose: c
92
92
  }
93
93
  )
94
94
  ), n.prepend(s), setTimeout(() => {
95
95
  s.classList.add("mt-[0.5rem]");
96
96
  }, 10);
97
97
  });
98
- }, b = (e, o = {}) => {
99
- let t = () => {
100
- }, a = () => {
98
+ }, b = (t, o = {}) => {
99
+ let e = () => {
100
+ }, i = () => {
101
101
  };
102
102
  const n = new Promise((s, r) => {
103
- t = s, a = r;
103
+ e = s, i = r;
104
104
  });
105
- return p(n, e, o), {
106
- resolve: t,
107
- reject: a
105
+ return p(n, t, o), {
106
+ resolve: (s) => {
107
+ typeof s == "string" && (t.success = s), e(s);
108
+ },
109
+ reject: (s) => {
110
+ typeof s == "string" && (t.error = s), i(s);
111
+ }
108
112
  };
109
113
  }, F = {
110
- success: (e, o = {}) => c(e, "success", o),
111
- error: (e, o = {}) => c(e, "error", o),
112
- warning: (e, o = {}) => c(e, "warning", o),
113
- info: (e, o = {}) => c(e, "info", o),
114
- async: (e, o, t = {}) => p(e, o, t),
115
- loading: (e, o = {}) => b(e, o)
114
+ success: (t, o = {}) => a(t, "success", o),
115
+ error: (t, o = {}) => a(t, "error", o),
116
+ warning: (t, o = {}) => a(t, "warning", o),
117
+ info: (t, o = {}) => a(t, "info", o),
118
+ async: (t, o, e = {}) => p(t, o, e),
119
+ loading: (t, o = {}) => b(t, o)
116
120
  };
117
121
  export {
118
122
  p as showToastAsync,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lawgic-dev-kit",
3
- "version": "0.21.0",
3
+ "version": "0.21.6",
4
4
  "description": "Componentes de UI para Lawgic",
5
5
  "type": "module",
6
6
  "private": false,