@gustavo-valsechi/client 1.4.13 → 1.4.14
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/types/form/index.js +1 -1
- package/dist/components/types/form/index.mjs +1 -1
- package/dist/components/types/modal/index.js +1 -1
- package/dist/components/types/modal/index.mjs +1 -1
- package/dist/contexts/tooltip/index.js +3 -2
- package/dist/contexts/tooltip/index.mjs +3 -2
- package/dist/interfaces/components/form/datetime/index.d.ts +4 -0
- package/dist/interfaces/components/form/file/index.d.ts +4 -0
- package/dist/interfaces/components/form/index.d.ts +8 -2
- package/dist/interfaces/components/form/input/index.d.ts +4 -1
- package/dist/interfaces/components/form/select/index.d.ts +4 -0
- package/dist/interfaces/components/form/textarea/index.d.ts +4 -0
- package/package.json +1 -1
|
@@ -109,7 +109,7 @@ function Form(props) {
|
|
|
109
109
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styles.Container, { ref: formRef, onSubmit: handleSubmit(onSubmit), children: [
|
|
110
110
|
import_lodash.default.map(
|
|
111
111
|
props.inputs,
|
|
112
|
-
(data, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.default.Fragment, { children: component(data) }, index)
|
|
112
|
+
(data, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.default.Fragment, { children: data.type === "custom" ? data.component : component(data) }, index)
|
|
113
113
|
),
|
|
114
114
|
import_lodash.default.isArray(props.buttons) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "form-buttons", children: import_lodash.default.map(
|
|
115
115
|
props.buttons,
|
|
@@ -75,7 +75,7 @@ function Form(props) {
|
|
|
75
75
|
return /* @__PURE__ */ jsxs(Container, { ref: formRef, onSubmit: handleSubmit(onSubmit), children: [
|
|
76
76
|
_.map(
|
|
77
77
|
props.inputs,
|
|
78
|
-
(data, index) => /* @__PURE__ */ jsx(React.Fragment, { children: component(data) }, index)
|
|
78
|
+
(data, index) => /* @__PURE__ */ jsx(React.Fragment, { children: data.type === "custom" ? data.component : component(data) }, index)
|
|
79
79
|
),
|
|
80
80
|
_.isArray(props.buttons) && /* @__PURE__ */ jsx("div", { className: "form-buttons", children: _.map(
|
|
81
81
|
props.buttons,
|
|
@@ -38,7 +38,7 @@ var import__ = require("../..");
|
|
|
38
38
|
var import_lodash = __toESM(require("lodash"));
|
|
39
39
|
function Modal(props) {
|
|
40
40
|
var _a, _b, _c;
|
|
41
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styles.Container, { ...import_lodash.default.omit(props, ["className"]), position: props.position || "center", children: [
|
|
41
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styles.Container, { ...import_lodash.default.omit(props, ["className"]), position: props.position || "center", title: "", children: [
|
|
42
42
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "iz-modal-back", onClick: props.onClose }),
|
|
43
43
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "iz-modal-container", children: [
|
|
44
44
|
(!!props.title || !!props.header) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "iz-modal-header", children: [
|
|
@@ -5,7 +5,7 @@ import { Button } from "../..";
|
|
|
5
5
|
import _ from "lodash";
|
|
6
6
|
function Modal(props) {
|
|
7
7
|
var _a, _b, _c;
|
|
8
|
-
return /* @__PURE__ */ jsxs(Container, { ..._.omit(props, ["className"]), position: props.position || "center", children: [
|
|
8
|
+
return /* @__PURE__ */ jsxs(Container, { ..._.omit(props, ["className"]), position: props.position || "center", title: "", children: [
|
|
9
9
|
/* @__PURE__ */ jsx("div", { className: "iz-modal-back", onClick: props.onClose }),
|
|
10
10
|
/* @__PURE__ */ jsxs("div", { className: "iz-modal-container", children: [
|
|
11
11
|
(!!props.title || !!props.header) && /* @__PURE__ */ jsxs("div", { className: "iz-modal-header", children: [
|
|
@@ -41,12 +41,13 @@ const TooltipContext = (0, import_react.createContext)({});
|
|
|
41
41
|
const TooltipProviderContainer = ({ children }) => {
|
|
42
42
|
const [tooltips, setTooltips] = (0, import_react.useState)([]);
|
|
43
43
|
const getContent = (target) => {
|
|
44
|
-
var _a;
|
|
44
|
+
var _a, _b;
|
|
45
45
|
const rect = target.getBoundingClientRect();
|
|
46
46
|
return {
|
|
47
47
|
top: rect.top + window.scrollY - (target.offsetHeight + 8),
|
|
48
48
|
left: rect.left + window.scrollX + target.offsetWidth / 2,
|
|
49
|
-
content: ((_a = target.dataset) == null ? void 0 : _a.tooltip) || ""
|
|
49
|
+
content: ((_a = target.dataset) == null ? void 0 : _a.tooltip) || "",
|
|
50
|
+
props: JSON.parse(((_b = target.dataset) == null ? void 0 : _b["tooltip-props"]) || "{}")
|
|
50
51
|
};
|
|
51
52
|
};
|
|
52
53
|
(0, import_react.useEffect)(() => {
|
|
@@ -7,12 +7,13 @@ const TooltipContext = createContext({});
|
|
|
7
7
|
const TooltipProviderContainer = ({ children }) => {
|
|
8
8
|
const [tooltips, setTooltips] = useState([]);
|
|
9
9
|
const getContent = (target) => {
|
|
10
|
-
var _a;
|
|
10
|
+
var _a, _b;
|
|
11
11
|
const rect = target.getBoundingClientRect();
|
|
12
12
|
return {
|
|
13
13
|
top: rect.top + window.scrollY - (target.offsetHeight + 8),
|
|
14
14
|
left: rect.left + window.scrollX + target.offsetWidth / 2,
|
|
15
|
-
content: ((_a = target.dataset) == null ? void 0 : _a.tooltip) || ""
|
|
15
|
+
content: ((_a = target.dataset) == null ? void 0 : _a.tooltip) || "",
|
|
16
|
+
props: JSON.parse(((_b = target.dataset) == null ? void 0 : _b["tooltip-props"]) || "{}")
|
|
16
17
|
};
|
|
17
18
|
};
|
|
18
19
|
useEffect(() => {
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { UseFormRegister } from "react-hook-form";
|
|
2
|
+
import { IInputType } from "@interfaces";
|
|
3
|
+
import { z } from "zod";
|
|
2
4
|
export interface IInputDateTime {
|
|
5
|
+
type?: IInputType;
|
|
3
6
|
className?: string;
|
|
4
7
|
label?: string;
|
|
5
8
|
name: string;
|
|
@@ -12,4 +15,5 @@ export interface IInputDateTime {
|
|
|
12
15
|
disabled?: boolean;
|
|
13
16
|
required?: boolean;
|
|
14
17
|
register?: UseFormRegister<any>;
|
|
18
|
+
validation?: typeof z;
|
|
15
19
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { UseFormRegister } from "react-hook-form";
|
|
2
|
+
import { IInputType } from "@interfaces";
|
|
3
|
+
import { z } from "zod";
|
|
2
4
|
export interface IInputFile {
|
|
5
|
+
type?: IInputType;
|
|
3
6
|
className?: string;
|
|
4
7
|
label?: string;
|
|
5
8
|
name: string;
|
|
@@ -11,4 +14,5 @@ export interface IInputFile {
|
|
|
11
14
|
onFocus: (value: string) => void;
|
|
12
15
|
required?: boolean;
|
|
13
16
|
register?: UseFormRegister<any>;
|
|
17
|
+
validation?: typeof z;
|
|
14
18
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { IButton, IInputSelect, IInputFile, IInputText, IInputTextarea, IInputDateTime } from "@interfaces";
|
|
1
3
|
export * from "./file";
|
|
2
4
|
export * from "./label";
|
|
3
5
|
export * from "./input";
|
|
@@ -5,12 +7,16 @@ export * from "./select";
|
|
|
5
7
|
export * from "./button";
|
|
6
8
|
export * from "./datetime";
|
|
7
9
|
export * from "./textarea";
|
|
10
|
+
export type IInputType = "text" | "password" | "select" | "textarea" | "date-time" | "file" | "custom";
|
|
8
11
|
export interface IForm {
|
|
9
12
|
defaultValues?: any;
|
|
10
13
|
validation?: any;
|
|
11
14
|
formRef?: any;
|
|
12
15
|
onSubmit: (values: any, actions?: any) => void;
|
|
13
16
|
clearWhen?: boolean;
|
|
14
|
-
inputs: Array<
|
|
15
|
-
|
|
17
|
+
inputs: Array<IInputSelect & IInputFile & IInputText & IInputTextarea & IInputDateTime & {
|
|
18
|
+
type: IInputType;
|
|
19
|
+
component: React.ReactNode;
|
|
20
|
+
}>;
|
|
21
|
+
buttons?: Array<IButton>;
|
|
16
22
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { UseFormRegister } from "react-hook-form";
|
|
2
|
+
import { IInputType } from "@interfaces";
|
|
3
|
+
import { z } from "zod";
|
|
2
4
|
export interface IInputText {
|
|
3
5
|
className?: string;
|
|
4
6
|
label?: string;
|
|
5
7
|
id?: string;
|
|
6
8
|
name?: string;
|
|
7
|
-
type?:
|
|
9
|
+
type?: IInputType;
|
|
8
10
|
value?: string;
|
|
9
11
|
mask?: (value: string) => void;
|
|
10
12
|
onChange?: (event: any) => void;
|
|
@@ -14,4 +16,5 @@ export interface IInputText {
|
|
|
14
16
|
onFocus?: (value: any) => void;
|
|
15
17
|
required?: boolean;
|
|
16
18
|
register?: UseFormRegister<any>;
|
|
19
|
+
validation?: typeof z;
|
|
17
20
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { UseFormRegister } from "react-hook-form";
|
|
2
|
+
import { IInputType } from "@interfaces";
|
|
3
|
+
import { z } from "zod";
|
|
2
4
|
export interface IInputSelect {
|
|
5
|
+
type?: IInputType;
|
|
3
6
|
className?: string;
|
|
4
7
|
label?: string;
|
|
5
8
|
name: string;
|
|
@@ -11,4 +14,5 @@ export interface IInputSelect {
|
|
|
11
14
|
onFocus: (value: any) => void;
|
|
12
15
|
required?: boolean;
|
|
13
16
|
register?: UseFormRegister<any>;
|
|
17
|
+
validation?: typeof z;
|
|
14
18
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { UseFormRegister } from "react-hook-form";
|
|
2
|
+
import { IInputType } from "@interfaces";
|
|
3
|
+
import { z } from "zod";
|
|
2
4
|
export interface IInputTextarea {
|
|
5
|
+
type?: IInputType;
|
|
3
6
|
className?: string;
|
|
4
7
|
label?: string;
|
|
5
8
|
name: string;
|
|
@@ -13,4 +16,5 @@ export interface IInputTextarea {
|
|
|
13
16
|
onFocus: (value: string) => void;
|
|
14
17
|
required?: boolean;
|
|
15
18
|
register?: UseFormRegister<any>;
|
|
19
|
+
validation?: typeof z;
|
|
16
20
|
}
|