@gustavo-valsechi/client 1.4.237 → 1.4.239
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/src/components/types/form/index.js +1 -1
- package/dist/src/components/types/form/index.mjs +1 -1
- package/dist/src/components/types/form/types/button/index.js +1 -1
- package/dist/src/components/types/form/types/button/index.mjs +1 -1
- package/dist/src/components/types/form/types/datetime/index.d.ts +1 -0
- package/dist/src/components/types/form/types/datetime/index.js +12 -9
- package/dist/src/components/types/form/types/datetime/index.mjs +13 -10
- package/dist/src/components/types/form/types/select/index.js +0 -1
- package/dist/src/components/types/form/types/select/index.mjs +0 -1
- package/dist/src/interfaces/components/form/custom/index.d.ts +2 -14
- package/dist/src/interfaces/components/form/datetime/index.d.ts +2 -15
- package/dist/src/interfaces/components/form/file/index.d.ts +2 -14
- package/dist/src/interfaces/components/form/index.d.ts +17 -1
- package/dist/src/interfaces/components/form/select/index.d.ts +2 -16
- package/dist/src/interfaces/components/form/text/index.d.ts +2 -15
- package/dist/src/interfaces/components/form/textarea/index.d.ts +2 -14
- package/package.json +5 -3
|
@@ -115,7 +115,7 @@ function Form(props) {
|
|
|
115
115
|
ComponentType,
|
|
116
116
|
{
|
|
117
117
|
...import_lodash.default.omit(data, ["validation"]),
|
|
118
|
-
id: `input
|
|
118
|
+
id: `input[${data.name}]`,
|
|
119
119
|
type: component2 ? void 0 : data.type,
|
|
120
120
|
error: (_a = errors[data.name]) == null ? void 0 : _a.message,
|
|
121
121
|
register,
|
|
@@ -81,7 +81,7 @@ function Form(props) {
|
|
|
81
81
|
ComponentType,
|
|
82
82
|
{
|
|
83
83
|
..._.omit(data, ["validation"]),
|
|
84
|
-
id: `input
|
|
84
|
+
id: `input[${data.name}]`,
|
|
85
85
|
type: component2 ? void 0 : data.type,
|
|
86
86
|
error: (_a = errors[data.name]) == null ? void 0 : _a.message,
|
|
87
87
|
register,
|
|
@@ -54,7 +54,7 @@ function Button(props) {
|
|
|
54
54
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
55
55
|
import_styles.Container,
|
|
56
56
|
{
|
|
57
|
-
id: `button
|
|
57
|
+
id: `button[${import_lodash.default.replace(import_lodash.default.lowerCase(props.label), /\s/g, "-")}]`,
|
|
58
58
|
loading: String(loading || !!props.loading),
|
|
59
59
|
disabled: props.disabled,
|
|
60
60
|
type: props.type || "button",
|
|
@@ -21,7 +21,7 @@ function Button(props) {
|
|
|
21
21
|
return /* @__PURE__ */ jsxs(
|
|
22
22
|
Container,
|
|
23
23
|
{
|
|
24
|
-
id: `button
|
|
24
|
+
id: `button[${_.replace(_.lowerCase(props.label), /\s/g, "-")}]`,
|
|
25
25
|
loading: String(loading || !!props.loading),
|
|
26
26
|
disabled: props.disabled,
|
|
27
27
|
type: props.type || "button",
|
|
@@ -38,10 +38,13 @@ var import_react = require("react");
|
|
|
38
38
|
var import_styles = require("./styles");
|
|
39
39
|
var import_label = require("../label");
|
|
40
40
|
var import_error = require("../error");
|
|
41
|
+
var import_react_datepicker = __toESM(require("react-datepicker"));
|
|
41
42
|
var import_lodash = __toESM(require("lodash"));
|
|
43
|
+
var import_react_datepicker2 = require("react-datepicker/dist/react-datepicker.css");
|
|
42
44
|
function InputDateTime(props) {
|
|
43
45
|
const inputRef = (0, import_react.useRef)();
|
|
44
46
|
const register = (props.register || ((name) => ({})))(props.name || "");
|
|
47
|
+
const [date, setDate] = (0, import_react.useState)(null);
|
|
45
48
|
const onChange = (event) => {
|
|
46
49
|
if (register.onChange) register.onChange(event);
|
|
47
50
|
if (props.onChange) props.onChange(event);
|
|
@@ -54,17 +57,17 @@ function InputDateTime(props) {
|
|
|
54
57
|
!!props.label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_label.InputLabel, { optional: props.optional, children: props.label }),
|
|
55
58
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "input-content", children: [
|
|
56
59
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
57
|
-
|
|
60
|
+
import_react_datepicker.default,
|
|
58
61
|
{
|
|
59
62
|
...import_lodash.default.omit(props, ["className", "onChange", "mask", "type", "optional", "register", "setValue", "watch", "optional"]),
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
selected: date,
|
|
64
|
+
onChange: (value) => setDate(value),
|
|
65
|
+
locale: "pt-BR",
|
|
66
|
+
showTimeSelect: true,
|
|
67
|
+
timeFormat: "HH:mm",
|
|
68
|
+
timeIntervals: 1,
|
|
69
|
+
dateFormat: "dd/MM/yyyy HH:mm",
|
|
70
|
+
placeholderText: "Selecione data e hora"
|
|
68
71
|
}
|
|
69
72
|
),
|
|
70
73
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
import { useRef } from "react";
|
|
4
|
+
import { useRef, useState } from "react";
|
|
5
5
|
import { Container } from "./styles";
|
|
6
6
|
import { InputLabel } from "../label";
|
|
7
7
|
import { InputError } from "../error";
|
|
8
|
+
import DatePicker from "react-datepicker";
|
|
8
9
|
import _ from "lodash";
|
|
10
|
+
import "react-datepicker/dist/react-datepicker.css";
|
|
9
11
|
function InputDateTime(props) {
|
|
10
12
|
const inputRef = useRef();
|
|
11
13
|
const register = (props.register || ((name) => ({})))(props.name || "");
|
|
14
|
+
const [date, setDate] = useState(null);
|
|
12
15
|
const onChange = (event) => {
|
|
13
16
|
if (register.onChange) register.onChange(event);
|
|
14
17
|
if (props.onChange) props.onChange(event);
|
|
@@ -21,17 +24,17 @@ function InputDateTime(props) {
|
|
|
21
24
|
!!props.label && /* @__PURE__ */ jsx(InputLabel, { optional: props.optional, children: props.label }),
|
|
22
25
|
/* @__PURE__ */ jsxs("div", { className: "input-content", children: [
|
|
23
26
|
/* @__PURE__ */ jsx(
|
|
24
|
-
|
|
27
|
+
DatePicker,
|
|
25
28
|
{
|
|
26
29
|
..._.omit(props, ["className", "onChange", "mask", "type", "optional", "register", "setValue", "watch", "optional"]),
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
selected: date,
|
|
31
|
+
onChange: (value) => setDate(value),
|
|
32
|
+
locale: "pt-BR",
|
|
33
|
+
showTimeSelect: true,
|
|
34
|
+
timeFormat: "HH:mm",
|
|
35
|
+
timeIntervals: 1,
|
|
36
|
+
dateFormat: "dd/MM/yyyy HH:mm",
|
|
37
|
+
placeholderText: "Selecione data e hora"
|
|
35
38
|
}
|
|
36
39
|
),
|
|
37
40
|
/* @__PURE__ */ jsx(
|
|
@@ -82,7 +82,6 @@ function InputSelect(props) {
|
|
|
82
82
|
};
|
|
83
83
|
const onChange = (event) => {
|
|
84
84
|
const value2 = event.target.value || "";
|
|
85
|
-
event.target.value = props.mask ? props.mask(value2) : value2;
|
|
86
85
|
setFilter(value2);
|
|
87
86
|
if (props.onFilter) props.onFilter(value2);
|
|
88
87
|
if (register.onChange) register.onChange(event);
|
|
@@ -49,7 +49,6 @@ function InputSelect(props) {
|
|
|
49
49
|
};
|
|
50
50
|
const onChange = (event) => {
|
|
51
51
|
const value2 = event.target.value || "";
|
|
52
|
-
event.target.value = props.mask ? props.mask(value2) : value2;
|
|
53
52
|
setFilter(value2);
|
|
54
53
|
if (props.onFilter) props.onFilter(value2);
|
|
55
54
|
if (register.onChange) register.onChange(event);
|
|
@@ -1,18 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export interface IInputCustom {
|
|
5
|
-
className?: string;
|
|
6
|
-
label?: string;
|
|
7
|
-
id?: string;
|
|
8
|
-
name?: string;
|
|
2
|
+
import { IInputBase } from "../index";
|
|
3
|
+
export interface IInputCustom extends IInputBase {
|
|
9
4
|
type: "custom";
|
|
10
|
-
value?: string;
|
|
11
|
-
error?: string;
|
|
12
|
-
disabled?: boolean;
|
|
13
|
-
optional?: boolean;
|
|
14
|
-
register?: UseFormRegister<any>;
|
|
15
|
-
setValue?: (...args: any[]) => void;
|
|
16
5
|
children: React.ReactNode;
|
|
17
|
-
validation?: z.ZodTypeAny;
|
|
18
6
|
}
|
|
@@ -1,17 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export interface IInputDateTime {
|
|
1
|
+
import { IInputBase } from "../index";
|
|
2
|
+
export interface IInputDateTime extends IInputBase {
|
|
4
3
|
type: "date-time";
|
|
5
|
-
className?: string;
|
|
6
|
-
label?: string;
|
|
7
|
-
name: string;
|
|
8
|
-
value: string;
|
|
9
|
-
onFocus: (value: any) => void;
|
|
10
|
-
onChange: (event: any) => void;
|
|
11
|
-
maxLength?: number;
|
|
12
|
-
error: string;
|
|
13
|
-
disabled?: boolean;
|
|
14
|
-
optional?: boolean;
|
|
15
|
-
register?: UseFormRegister<any>;
|
|
16
|
-
validation?: z.ZodTypeAny;
|
|
17
4
|
}
|
|
@@ -1,17 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export interface IInputFile {
|
|
1
|
+
import { IInputBase } from "../index";
|
|
2
|
+
export interface IInputFile extends IInputBase {
|
|
4
3
|
type: "file";
|
|
5
|
-
className?: string;
|
|
6
|
-
label?: string;
|
|
7
|
-
name: string;
|
|
8
|
-
value: string;
|
|
9
4
|
onPreview?: (url: any) => void;
|
|
10
|
-
onChange: (event: any) => void;
|
|
11
|
-
disabled?: boolean;
|
|
12
|
-
error: string;
|
|
13
|
-
onFocus: (value: string) => void;
|
|
14
|
-
optional?: boolean;
|
|
15
|
-
register?: UseFormRegister<any>;
|
|
16
|
-
validation?: z.ZodTypeAny;
|
|
17
5
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { IButton, IInputSelect, IInputCustom, IInputFile, IInputText, IInputDateTime, IInputTextarea } from "../form";
|
|
3
|
+
import { UseFormRegister } from "react-hook-form";
|
|
3
4
|
export * from "./file";
|
|
4
5
|
export * from "./label";
|
|
5
6
|
export * from "./text";
|
|
@@ -9,7 +10,6 @@ export * from "./datetime";
|
|
|
9
10
|
export * from "./textarea";
|
|
10
11
|
export * from "./custom";
|
|
11
12
|
export * from "./error";
|
|
12
|
-
export type IInputType = "text" | "password" | "select" | "textarea" | "date-time" | "file" | "custom";
|
|
13
13
|
export interface IForm {
|
|
14
14
|
defaultValues?: any;
|
|
15
15
|
validation?: (validations: z.ZodTypeAny) => z.ZodTypeAny;
|
|
@@ -19,3 +19,19 @@ export interface IForm {
|
|
|
19
19
|
inputs: Array<IInputSelect | IInputCustom | IInputFile | IInputText | IInputDateTime | IInputTextarea>;
|
|
20
20
|
buttons?: Array<IButton>;
|
|
21
21
|
}
|
|
22
|
+
export interface IInputBase {
|
|
23
|
+
className?: string;
|
|
24
|
+
label?: string;
|
|
25
|
+
id?: string;
|
|
26
|
+
name?: string;
|
|
27
|
+
value?: string;
|
|
28
|
+
error?: string;
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
optional?: boolean;
|
|
31
|
+
register?: UseFormRegister<any>;
|
|
32
|
+
validation?: z.ZodTypeAny;
|
|
33
|
+
watch?: (...args: any[]) => string;
|
|
34
|
+
setValue?: (...args: any[]) => void;
|
|
35
|
+
onChange?: (event: any) => void;
|
|
36
|
+
onFocus?: (value: any) => void;
|
|
37
|
+
}
|
|
@@ -1,23 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export interface IInputSelect {
|
|
1
|
+
import { IInputBase } from "../index";
|
|
2
|
+
export interface IInputSelect extends IInputBase {
|
|
4
3
|
type: "select";
|
|
5
|
-
className?: string;
|
|
6
|
-
label?: string;
|
|
7
|
-
name: string;
|
|
8
|
-
value?: string;
|
|
9
4
|
onFilter?: (event: any) => void;
|
|
10
5
|
options: {
|
|
11
6
|
[value: string]: any;
|
|
12
7
|
};
|
|
13
|
-
error?: string;
|
|
14
|
-
disabled?: boolean;
|
|
15
|
-
onFocus?: (value: any) => void;
|
|
16
|
-
optional?: boolean;
|
|
17
|
-
register?: UseFormRegister<any>;
|
|
18
|
-
validation?: z.ZodTypeAny;
|
|
19
|
-
mask?: (value: string) => void;
|
|
20
|
-
setValue?: (...args: any[]) => void;
|
|
21
|
-
watch?: (...args: any[]) => string;
|
|
22
8
|
maxLength?: number;
|
|
23
9
|
}
|
|
@@ -1,19 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export interface IInputText {
|
|
4
|
-
className?: string;
|
|
5
|
-
label?: string;
|
|
6
|
-
id?: string;
|
|
7
|
-
name?: string;
|
|
1
|
+
import { IInputBase } from "../index";
|
|
2
|
+
export interface IInputText extends IInputBase {
|
|
8
3
|
type: "text" | "password" | undefined;
|
|
9
|
-
value?: string;
|
|
10
4
|
mask?: (value: string) => void;
|
|
11
|
-
onChange?: (event: any) => void;
|
|
12
5
|
maxLength?: number;
|
|
13
|
-
error?: string;
|
|
14
|
-
disabled?: boolean;
|
|
15
|
-
onFocus?: (value: any) => void;
|
|
16
|
-
optional?: boolean;
|
|
17
|
-
register?: UseFormRegister<any>;
|
|
18
|
-
validation?: z.ZodTypeAny;
|
|
19
6
|
}
|
|
@@ -1,19 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export interface IInputTextarea {
|
|
1
|
+
import { IInputBase } from "../index";
|
|
2
|
+
export interface IInputTextarea extends IInputBase {
|
|
4
3
|
type: "textarea";
|
|
5
|
-
className?: string;
|
|
6
|
-
label?: string;
|
|
7
|
-
name: string;
|
|
8
|
-
value: string;
|
|
9
4
|
mask?: (value: string) => void;
|
|
10
|
-
onChange: (event: any) => void;
|
|
11
5
|
maxLength?: number;
|
|
12
6
|
rows?: number;
|
|
13
|
-
error: string;
|
|
14
|
-
disabled?: boolean;
|
|
15
|
-
onFocus: (value: string) => void;
|
|
16
|
-
optional?: boolean;
|
|
17
|
-
register?: UseFormRegister<any>;
|
|
18
|
-
validation?: z.ZodTypeAny;
|
|
19
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gustavo-valsechi/client",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.239",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"peerDependencies": {
|
|
21
21
|
"react": "18.3.1",
|
|
22
22
|
"react-dom": "18.3.1",
|
|
23
|
-
"
|
|
24
|
-
"
|
|
23
|
+
"react-hot-toast": "2.4.1",
|
|
24
|
+
"styled-components": "6.1.12"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@emotion/is-prop-valid": "1.3.0",
|
|
@@ -29,12 +29,14 @@
|
|
|
29
29
|
"@gustavo-valsechi/utils": "1.0.5",
|
|
30
30
|
"@hookform/resolvers": "5.2.2",
|
|
31
31
|
"apexcharts": "3.51.0",
|
|
32
|
+
"date-fns": "4.1.0",
|
|
32
33
|
"lodash": "4.17.21",
|
|
33
34
|
"luhn": "2.4.1",
|
|
34
35
|
"next": "14.2.5",
|
|
35
36
|
"randomcolor": "0.6.2",
|
|
36
37
|
"react-apexcharts": "1.4.1",
|
|
37
38
|
"react-credit-cards-2": "1.0.3",
|
|
39
|
+
"react-datepicker": "9.1.0",
|
|
38
40
|
"react-hook-form": "7.65.0",
|
|
39
41
|
"react-lottie": "1.2.4",
|
|
40
42
|
"tsup": "8.5.0",
|