lawgic-dev-kit 0.23.8 → 0.25.0
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.
- package/dist/components/atoms/TextArea/TextArea.d.ts +5 -0
- package/dist/components/atoms/TextArea/TextArea.js +92 -0
- package/dist/components/atoms/TextArea/TextArea.types.d.ts +12 -0
- package/dist/components/atoms/TextArea/index.d.ts +1 -0
- package/dist/components/atoms/TextInput/TextInput.d.ts +1 -1
- package/dist/components/atoms/TextInput/TextInput.js +26 -21
- package/dist/components/atoms/TextInput/TextInput.types.d.ts +1 -0
- package/dist/components/atoms/UncontrolledTextInput/UncontrolledTextInput.js +43 -38
- package/dist/components/atoms/UncontrolledTextInput/UncontrolledTextInput.types.d.ts +1 -0
- package/dist/components/atoms/UploadContainer/UploadContainer.js +104 -92
- package/dist/components/atoms/UploadContainer/UploadContainer.types.d.ts +5 -0
- package/dist/components/atoms/index.d.ts +1 -0
- package/dist/components/molecules/DateInput/DateInput.d.ts +2 -1
- package/dist/components/molecules/DateInput/DateInput.js +32 -30
- package/dist/index.js +109 -107
- package/dist/lawgic-dev-kit.css +1 -1
- package/dist/lawgic-dev-kit.umd.js +61 -47
- package/dist/src/components/atoms/TextArea/TextArea.d.ts +5 -0
- package/dist/src/components/atoms/TextArea/TextArea.types.d.ts +12 -0
- package/dist/src/components/atoms/TextArea/index.d.ts +1 -0
- package/dist/src/components/atoms/TextInput/TextInput.d.ts +1 -1
- package/dist/src/components/atoms/TextInput/TextInput.types.d.ts +1 -0
- package/dist/src/components/atoms/UncontrolledTextInput/UncontrolledTextInput.types.d.ts +1 -0
- package/dist/src/components/atoms/UploadContainer/UploadContainer.types.d.ts +5 -0
- package/dist/src/components/atoms/index.d.ts +1 -0
- package/dist/src/components/molecules/DateInput/DateInput.d.ts +2 -1
- package/package.json +1 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { TextAreaProps } from './TextArea.types';
|
|
3
|
+
import { FieldValues } from 'react-hook-form';
|
|
4
|
+
declare const TextArea: <T extends FieldValues = FieldValues>({ label, control, name, placeholder, className, disabled, translateKey, size, rows, ...props }: TextAreaProps<T>) => React.ReactElement;
|
|
5
|
+
export default TextArea;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { j as l } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
+
import { useController as j } from "react-hook-form";
|
|
3
|
+
import { useTheme as N } from "../../../hooks/useTheme.js";
|
|
4
|
+
import "react";
|
|
5
|
+
const T = ({
|
|
6
|
+
label: s,
|
|
7
|
+
control: u,
|
|
8
|
+
name: r,
|
|
9
|
+
placeholder: x,
|
|
10
|
+
className: c = "",
|
|
11
|
+
disabled: e = !1,
|
|
12
|
+
translateKey: d = "",
|
|
13
|
+
size: i = "md",
|
|
14
|
+
rows: p = 4,
|
|
15
|
+
...g
|
|
16
|
+
}) => {
|
|
17
|
+
const {
|
|
18
|
+
field: { value: n = "", onChange: m, ref: f, onBlur: h },
|
|
19
|
+
fieldState: { error: t }
|
|
20
|
+
} = j({ name: r, control: u }), { t: a } = N(), o = {
|
|
21
|
+
sm: {
|
|
22
|
+
container: "px-16 py-8",
|
|
23
|
+
text: "text-sm",
|
|
24
|
+
label: "text-sm",
|
|
25
|
+
error: "text-sm",
|
|
26
|
+
gap: "gap-8"
|
|
27
|
+
},
|
|
28
|
+
md: {
|
|
29
|
+
container: "p-16",
|
|
30
|
+
text: "text-14",
|
|
31
|
+
label: "text-14",
|
|
32
|
+
error: "text-sm",
|
|
33
|
+
gap: "gap-8"
|
|
34
|
+
}
|
|
35
|
+
}[i], b = a(r), $ = a(d);
|
|
36
|
+
return /* @__PURE__ */ l.jsxs(
|
|
37
|
+
"label",
|
|
38
|
+
{
|
|
39
|
+
className: `flex flex-col group select-none ${o.gap} ${e && "cursor-not-allowed"} ${c}`,
|
|
40
|
+
htmlFor: r,
|
|
41
|
+
children: [
|
|
42
|
+
s && /* @__PURE__ */ l.jsx(
|
|
43
|
+
"h6",
|
|
44
|
+
{
|
|
45
|
+
className: `text-gray-600 font-600 leading-none group ${t && "text-red-500!"} ${o.label} ${e && "text-gray-300"}`,
|
|
46
|
+
children: s
|
|
47
|
+
}
|
|
48
|
+
),
|
|
49
|
+
/* @__PURE__ */ l.jsx(
|
|
50
|
+
"div",
|
|
51
|
+
{
|
|
52
|
+
className: `
|
|
53
|
+
${o.container}
|
|
54
|
+
|
|
55
|
+
${t && "border-red-500!"}
|
|
56
|
+
|
|
57
|
+
!bg-blue-50
|
|
58
|
+
|
|
59
|
+
rounded-2xl border
|
|
60
|
+
|
|
61
|
+
${n && !e ? "border-blue-200" : "border-blue-100"}
|
|
62
|
+
${!e && "group-hover:border-blue-300"}
|
|
63
|
+
${e && "cursor-not-allowed"}
|
|
64
|
+
|
|
65
|
+
group-focus-within:border-blue-500 transition-colors duration-200 ease-in-out
|
|
66
|
+
`,
|
|
67
|
+
children: /* @__PURE__ */ l.jsx(
|
|
68
|
+
"textarea",
|
|
69
|
+
{
|
|
70
|
+
id: r,
|
|
71
|
+
name: r,
|
|
72
|
+
disabled: e,
|
|
73
|
+
placeholder: x,
|
|
74
|
+
value: n,
|
|
75
|
+
onChange: (y) => m(y.target.value),
|
|
76
|
+
onBlur: h,
|
|
77
|
+
ref: f,
|
|
78
|
+
rows: p,
|
|
79
|
+
className: `bg-transparent w-full font-600 placeholder:font-600 select-text ${o.text} disabled:text-gray-300 disabled:placeholder:text-gray-300 placeholder:text-gray-400 disabled:cursor-not-allowed resize-none outline-hidden`,
|
|
80
|
+
...g
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
),
|
|
85
|
+
(t == null ? void 0 : t.message) && /* @__PURE__ */ l.jsx("h4", { className: `font-500 text-red-500 leading-none ${o.error}`, children: a(t.message, { x: $ || b }) })
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
};
|
|
90
|
+
export {
|
|
91
|
+
T as default
|
|
92
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Control, FieldValues, Path } from 'react-hook-form';
|
|
2
|
+
export type TextAreaProps<T extends FieldValues = FieldValues> = {
|
|
3
|
+
label?: string;
|
|
4
|
+
placeholder?: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
translateKey?: string;
|
|
8
|
+
size?: 'sm' | 'md';
|
|
9
|
+
rows?: number;
|
|
10
|
+
control: Control<T>;
|
|
11
|
+
name: Path<T>;
|
|
12
|
+
} & Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'size'>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as TextArea } from './TextArea';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { TextInputProps } from './TextInput.types';
|
|
3
3
|
import { FieldValues } from 'react-hook-form';
|
|
4
|
-
declare const TextInput: <T extends FieldValues = FieldValues>({ label, control, name, placeholder, className, disabled, leftSide, rightSide, translateKey, size, ...props }: TextInputProps<T>) => React.ReactElement;
|
|
4
|
+
declare const TextInput: <T extends FieldValues = FieldValues>({ label, control, name, placeholder, className, disabled, leftSide, rightSide, translateKey, size, required, ...props }: TextInputProps<T>) => React.ReactElement;
|
|
5
5
|
export default TextInput;
|
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
import { j as l } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
-
import { useController as
|
|
2
|
+
import { useController as N } from "react-hook-form";
|
|
3
3
|
import { useTheme as v } from "../../../hooks/useTheme.js";
|
|
4
4
|
import "react";
|
|
5
|
-
const
|
|
5
|
+
const T = ({
|
|
6
6
|
label: a,
|
|
7
|
-
control:
|
|
7
|
+
control: d,
|
|
8
8
|
name: e,
|
|
9
|
-
placeholder:
|
|
9
|
+
placeholder: p,
|
|
10
10
|
className: i = "",
|
|
11
11
|
disabled: t = !1,
|
|
12
12
|
leftSide: n,
|
|
13
13
|
rightSide: u,
|
|
14
|
-
translateKey:
|
|
15
|
-
size:
|
|
16
|
-
|
|
14
|
+
translateKey: g = "",
|
|
15
|
+
size: m = "md",
|
|
16
|
+
required: c = !1,
|
|
17
|
+
...f
|
|
17
18
|
}) => {
|
|
18
19
|
const {
|
|
19
|
-
field: { value:
|
|
20
|
+
field: { value: x = "", onChange: b, ref: h, onBlur: $ },
|
|
20
21
|
fieldState: { error: r }
|
|
21
|
-
} =
|
|
22
|
+
} = N({ name: e, control: d }), { t: s } = v(), o = {
|
|
22
23
|
sm: {
|
|
23
24
|
container: "px-16 py-8",
|
|
24
25
|
text: "text-sm",
|
|
@@ -33,18 +34,21 @@ const S = ({
|
|
|
33
34
|
error: "text-sm",
|
|
34
35
|
gap: "gap-8"
|
|
35
36
|
}
|
|
36
|
-
}[
|
|
37
|
+
}[m], y = s(e), j = s(g);
|
|
37
38
|
return /* @__PURE__ */ l.jsxs(
|
|
38
39
|
"label",
|
|
39
40
|
{
|
|
40
41
|
className: `flex flex-col group select-none ${o.gap} ${t && "cursor-not-allowed"} ${i}`,
|
|
41
42
|
htmlFor: e,
|
|
42
43
|
children: [
|
|
43
|
-
a && /* @__PURE__ */ l.
|
|
44
|
+
a && /* @__PURE__ */ l.jsxs(
|
|
44
45
|
"h6",
|
|
45
46
|
{
|
|
46
47
|
className: `text-gray-600 font-600 leading-none group ${r && "text-red-500!"} ${o.label} ${t && "text-gray-300"}`,
|
|
47
|
-
children:
|
|
48
|
+
children: [
|
|
49
|
+
a,
|
|
50
|
+
c && /* @__PURE__ */ l.jsx("span", { className: "text-red-500 ml-4", children: "*" })
|
|
51
|
+
]
|
|
48
52
|
}
|
|
49
53
|
),
|
|
50
54
|
/* @__PURE__ */ l.jsxs(
|
|
@@ -60,7 +64,7 @@ const S = ({
|
|
|
60
64
|
|
|
61
65
|
rounded-full border
|
|
62
66
|
|
|
63
|
-
${
|
|
67
|
+
${x && !t ? "border-blue-200" : "border-blue-100"}
|
|
64
68
|
${!t && "group-hover:border-blue-300"}
|
|
65
69
|
${t && "cursor-not-allowed"}
|
|
66
70
|
|
|
@@ -76,24 +80,25 @@ const S = ({
|
|
|
76
80
|
id: e,
|
|
77
81
|
name: e,
|
|
78
82
|
disabled: t,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
83
|
+
required: c,
|
|
84
|
+
placeholder: p,
|
|
85
|
+
value: x,
|
|
86
|
+
onChange: (w) => b(w.target.value),
|
|
87
|
+
onBlur: $,
|
|
88
|
+
ref: h,
|
|
84
89
|
className: `group bg-transparent w-full h-full font-600 placeholder:font-600 select-text ${o.text} disabled:text-gray-300 disabled:placeholder:text-gray-300 placeholder:text-gray-400 disabled:cursor-not-allowed overflow-visible outline-hidden`,
|
|
85
|
-
...
|
|
90
|
+
...f
|
|
86
91
|
}
|
|
87
92
|
),
|
|
88
93
|
u && u
|
|
89
94
|
]
|
|
90
95
|
}
|
|
91
96
|
),
|
|
92
|
-
(r == null ? void 0 : r.message) && /* @__PURE__ */ l.jsx("h4", { className: `font-500 text-red-500 leading-none ${o.error}`, children: s(r.message, { x:
|
|
97
|
+
(r == null ? void 0 : r.message) && /* @__PURE__ */ l.jsx("h4", { className: `font-500 text-red-500 leading-none ${o.error}`, children: s(r.message, { x: j || y }) })
|
|
93
98
|
]
|
|
94
99
|
}
|
|
95
100
|
);
|
|
96
101
|
};
|
|
97
102
|
export {
|
|
98
|
-
|
|
103
|
+
T as default
|
|
99
104
|
};
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { useTheme as
|
|
1
|
+
import { j as t } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
+
import { useTheme as b } from "../../../hooks/useTheme.js";
|
|
3
3
|
import "react";
|
|
4
|
-
const
|
|
5
|
-
label:
|
|
6
|
-
onChange:
|
|
7
|
-
value:
|
|
8
|
-
name:
|
|
4
|
+
const N = ({
|
|
5
|
+
label: s,
|
|
6
|
+
onChange: i,
|
|
7
|
+
value: n,
|
|
8
|
+
name: r,
|
|
9
9
|
error: l,
|
|
10
|
-
placeholder:
|
|
11
|
-
className:
|
|
10
|
+
placeholder: g,
|
|
11
|
+
className: d = "",
|
|
12
12
|
disabled: e = !1,
|
|
13
13
|
disabledInput: a = !1,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
required: c = !1,
|
|
15
|
+
size: m = "md",
|
|
16
|
+
leftSide: x,
|
|
17
|
+
rightSide: p,
|
|
18
|
+
...f
|
|
18
19
|
}) => {
|
|
19
|
-
const { t: u } =
|
|
20
|
+
const { t: u } = b(), o = {
|
|
20
21
|
sm: {
|
|
21
22
|
container: "px-16 py-8",
|
|
22
23
|
text: "text-sm",
|
|
@@ -31,28 +32,31 @@ const w = ({
|
|
|
31
32
|
error: "text-14",
|
|
32
33
|
gap: "gap-8"
|
|
33
34
|
}
|
|
34
|
-
}[
|
|
35
|
-
return /* @__PURE__ */
|
|
35
|
+
}[m];
|
|
36
|
+
return /* @__PURE__ */ t.jsxs(
|
|
36
37
|
"label",
|
|
37
38
|
{
|
|
38
|
-
className: `flex flex-col group select-none ${
|
|
39
|
-
htmlFor:
|
|
39
|
+
className: `flex flex-col group select-none ${o.gap} ${e && "cursor-not-allowed"} ${d}`,
|
|
40
|
+
htmlFor: r,
|
|
40
41
|
children: [
|
|
41
|
-
|
|
42
|
+
s && /* @__PURE__ */ t.jsxs(
|
|
42
43
|
"h6",
|
|
43
44
|
{
|
|
44
|
-
className: `text-gray-600 font-600 leading-none group ${l && "!text-red-500"} ${
|
|
45
|
-
children:
|
|
45
|
+
className: `text-gray-600 font-600 leading-none group ${l && "!text-red-500"} ${o.label} ${e && "text-gray-300"}`,
|
|
46
|
+
children: [
|
|
47
|
+
s,
|
|
48
|
+
c && /* @__PURE__ */ t.jsx("span", { className: "text-red-500 ml-4", children: "*" })
|
|
49
|
+
]
|
|
46
50
|
}
|
|
47
51
|
),
|
|
48
|
-
/* @__PURE__ */
|
|
52
|
+
/* @__PURE__ */ t.jsxs(
|
|
49
53
|
"label",
|
|
50
54
|
{
|
|
51
|
-
htmlFor:
|
|
55
|
+
htmlFor: r,
|
|
52
56
|
className: `
|
|
53
57
|
flex items-center justify-between gap-8 bg-light
|
|
54
|
-
${
|
|
55
|
-
${
|
|
58
|
+
${o.container} ${l && "!border-red-500"} rounded-full border
|
|
59
|
+
${n && !e ? "border-blue-200" : "border-blue-100"}
|
|
56
60
|
${!e && "group-hover:border-blue-300"}
|
|
57
61
|
${e && "cursor-not-allowed"}
|
|
58
62
|
|
|
@@ -61,31 +65,32 @@ const w = ({
|
|
|
61
65
|
group-disabled:bg-gray-500
|
|
62
66
|
`,
|
|
63
67
|
children: [
|
|
64
|
-
|
|
65
|
-
/* @__PURE__ */
|
|
68
|
+
x && x,
|
|
69
|
+
/* @__PURE__ */ t.jsx(
|
|
66
70
|
"input",
|
|
67
71
|
{
|
|
68
|
-
...
|
|
69
|
-
id:
|
|
70
|
-
name:
|
|
72
|
+
...f,
|
|
73
|
+
id: r,
|
|
74
|
+
name: r,
|
|
71
75
|
disabled: e,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
required: c,
|
|
77
|
+
placeholder: g,
|
|
78
|
+
value: n,
|
|
79
|
+
onChange: (h) => {
|
|
80
|
+
i(h.target.value);
|
|
76
81
|
},
|
|
77
|
-
className: `group bg-transparent w-full h-full font-600 placeholder:font-600 select-text ${
|
|
82
|
+
className: `group bg-transparent w-full h-full font-600 placeholder:font-600 select-text ${o.text} disabled:text-gray-300 disabled:placeholder:text-gray-300 placeholder:text-gray-400 disabled:cursor-not-allowed overflow-visible outline-none ${a && "pointer-events-none !select-none !caret-transparent"}`
|
|
78
83
|
}
|
|
79
84
|
),
|
|
80
|
-
|
|
85
|
+
p && p
|
|
81
86
|
]
|
|
82
87
|
}
|
|
83
88
|
),
|
|
84
|
-
l && /* @__PURE__ */
|
|
89
|
+
l && /* @__PURE__ */ t.jsx("h4", { className: `font-500 text-red-500 leading-none ${o.error}`, children: u(l, { x: u(r) }) })
|
|
85
90
|
]
|
|
86
91
|
}
|
|
87
92
|
);
|
|
88
93
|
};
|
|
89
94
|
export {
|
|
90
|
-
|
|
95
|
+
N as default
|
|
91
96
|
};
|