@gustavo-valsechi/client 1.4.12 → 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.
@@ -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: [
@@ -100,7 +100,8 @@ const IconProviderContainer = ({ children }) => {
100
100
  const content2 = [];
101
101
  for (const style in import_assets.default) {
102
102
  for (const icon in import_assets.default[style]) {
103
- content2.push(import_lodash.default.replace(icon, ".svg", ""));
103
+ const name = import_lodash.default.replace(icon, ".svg", "");
104
+ content2.push(`fa-${style} fa-${name}`);
104
105
  }
105
106
  }
106
107
  return content2;
@@ -66,7 +66,8 @@ const IconProviderContainer = ({ children }) => {
66
66
  const content2 = [];
67
67
  for (const style in assets) {
68
68
  for (const icon in assets[style]) {
69
- content2.push(_.replace(icon, ".svg", ""));
69
+ const name = _.replace(icon, ".svg", "");
70
+ content2.push(`fa-${style} fa-${name}`);
70
71
  }
71
72
  }
72
73
  return content2;
@@ -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<any>;
15
- buttons?: Array<any>;
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?: string;
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
  }
@@ -1,9 +1,6 @@
1
1
  import { IBaseProvider } from "../..";
2
- import solid from "@contexts/icon/assets/solid";
3
- import regular from "@contexts/icon/assets/regular";
4
- import brands from "@contexts/icon/assets/brands";
5
2
  export interface IIconProvider extends IBaseProvider {
6
3
  }
7
4
  export interface IIconContext {
8
- getAll: () => Array<keyof typeof solid | keyof typeof regular | keyof typeof brands>;
5
+ getAll: () => Array<string>;
9
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gustavo-valsechi/client",
3
- "version": "1.4.12",
3
+ "version": "1.4.14",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",