@gustavo-valsechi/client 1.4.10 → 1.4.12

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.
@@ -72,19 +72,22 @@ function Form(props) {
72
72
  (0, import_react.useEffect)(() => {
73
73
  var _a;
74
74
  if (!props.defaultValues || !((_a = Object.keys(props.defaultValues || {})) == null ? void 0 : _a.length)) return;
75
- import_lodash.default.forEach(props.defaultValues, (value, key) => {
75
+ const defaultValues = { ...props.defaultValues };
76
+ import_lodash.default.forEach(defaultValues, (value, key) => {
76
77
  const input = import_lodash.default.find(props.inputs, (data) => data.name === key);
77
78
  if (!input) {
78
- delete props.defaultValues[key];
79
+ delete defaultValues[key];
79
80
  return;
80
81
  }
81
- props.defaultValues[key] = input.mask ? input.mask(value) : value;
82
+ defaultValues[key] = input.mask ? input.mask(value) : value;
82
83
  });
83
- reset(props.defaultValues, { keepErrors: false });
84
+ reset(defaultValues, { keepErrors: false });
84
85
  }, [props.defaultValues]);
85
86
  const component = (data) => {
86
87
  var _a;
87
- const component2 = Types[import_lodash.default.camelCase(data.type)];
88
+ data.type = import_lodash.default.upperFirst(import_lodash.default.camelCase(data.type));
89
+ data.type = import_lodash.default.includes(data.type, "Input") ? data.type : `Input${data.type}`;
90
+ const component2 = Types[data.type];
88
91
  const TypeComponent = component2 || Types.InputText;
89
92
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
90
93
  TypeComponent,
@@ -38,19 +38,22 @@ function Form(props) {
38
38
  useEffect(() => {
39
39
  var _a;
40
40
  if (!props.defaultValues || !((_a = Object.keys(props.defaultValues || {})) == null ? void 0 : _a.length)) return;
41
- _.forEach(props.defaultValues, (value, key) => {
41
+ const defaultValues = { ...props.defaultValues };
42
+ _.forEach(defaultValues, (value, key) => {
42
43
  const input = _.find(props.inputs, (data) => data.name === key);
43
44
  if (!input) {
44
- delete props.defaultValues[key];
45
+ delete defaultValues[key];
45
46
  return;
46
47
  }
47
- props.defaultValues[key] = input.mask ? input.mask(value) : value;
48
+ defaultValues[key] = input.mask ? input.mask(value) : value;
48
49
  });
49
- reset(props.defaultValues, { keepErrors: false });
50
+ reset(defaultValues, { keepErrors: false });
50
51
  }, [props.defaultValues]);
51
52
  const component = (data) => {
52
53
  var _a;
53
- const component2 = Types[_.camelCase(data.type)];
54
+ data.type = _.upperFirst(_.camelCase(data.type));
55
+ data.type = _.includes(data.type, "Input") ? data.type : `Input${data.type}`;
56
+ const component2 = Types[data.type];
54
57
  const TypeComponent = component2 || Types.InputText;
55
58
  return /* @__PURE__ */ jsx(
56
59
  TypeComponent,
@@ -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, { ...props, 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", 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: [
@@ -48,7 +48,7 @@ function Modal(props) {
48
48
  ] }),
49
49
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", { "aria-hidden": true, className: "fa-solid fa-xmark", onClick: props.onClose })
50
50
  ] }),
51
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "iz-modal-content", children: [
51
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: `iz-modal-content ${props.className || ""}`, children: [
52
52
  props.onClose && !props.title && !props.header && !props.noCloseIcon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "iz-modal-close", onClick: props.onClose, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", { "aria-hidden": true, className: "fa-solid fa-xmark" }) }),
53
53
  props.children
54
54
  ] }),
@@ -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, { ...props, position: props.position || "center", children: [
8
+ return /* @__PURE__ */ jsxs(Container, { ..._.omit(props, ["className"]), position: props.position || "center", 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: [
@@ -15,7 +15,7 @@ function Modal(props) {
15
15
  ] }),
16
16
  /* @__PURE__ */ jsx("i", { "aria-hidden": true, className: "fa-solid fa-xmark", onClick: props.onClose })
17
17
  ] }),
18
- /* @__PURE__ */ jsxs("div", { className: "iz-modal-content", children: [
18
+ /* @__PURE__ */ jsxs("div", { className: `iz-modal-content ${props.className || ""}`, children: [
19
19
  props.onClose && !props.title && !props.header && !props.noCloseIcon && /* @__PURE__ */ jsx("div", { className: "iz-modal-close", onClick: props.onClose, children: /* @__PURE__ */ jsx("i", { "aria-hidden": true, className: "fa-solid fa-xmark" }) }),
20
20
  props.children
21
21
  ] }),
@@ -82,7 +82,7 @@ const Container = import_styled_components.default.div`
82
82
  }
83
83
 
84
84
  .iz-modal-header {
85
- padding: 1.5rem 2rem;
85
+ padding: 1rem 1.5rem;
86
86
  display: flex;
87
87
  align-items: center;
88
88
  justify-content: space-between;
@@ -118,6 +118,7 @@ const Container = import_styled_components.default.div`
118
118
  overflow-y: overlay;
119
119
  position: relative;
120
120
  height: ${(props) => props.position === "center" ? "initial" : "100%"};
121
+ padding: ${(props) => props.position === "center" ? "1.5rem" : "0"};
121
122
 
122
123
  .iz-modal-close {
123
124
  position: absolute;
@@ -49,7 +49,7 @@ const Container = styled.div`
49
49
  }
50
50
 
51
51
  .iz-modal-header {
52
- padding: 1.5rem 2rem;
52
+ padding: 1rem 1.5rem;
53
53
  display: flex;
54
54
  align-items: center;
55
55
  justify-content: space-between;
@@ -85,6 +85,7 @@ const Container = styled.div`
85
85
  overflow-y: overlay;
86
86
  position: relative;
87
87
  height: ${(props) => props.position === "center" ? "initial" : "100%"};
88
+ padding: ${(props) => props.position === "center" ? "1.5rem" : "0"};
88
89
 
89
90
  .iz-modal-close {
90
91
  position: absolute;
@@ -1,4 +1,4 @@
1
- import { IIconProvider } from "@interfaces";
1
+ import { IIconProvider, IIconContext } from "@interfaces";
2
2
  declare const IconProviderContainer: ({ children }: IIconProvider) => import("react/jsx-runtime").JSX.Element;
3
- declare const useIcon: () => any;
3
+ declare const useIcon: () => IIconContext;
4
4
  export { IconProviderContainer as IconProvider, useIcon };
@@ -96,7 +96,16 @@ const IconProviderContainer = ({ children }) => {
96
96
  });
97
97
  return () => observer.disconnect();
98
98
  }, [isClient, matches]);
99
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconContext.Provider, { value: {}, children });
99
+ const getAll = () => {
100
+ const content2 = [];
101
+ for (const style in import_assets.default) {
102
+ for (const icon in import_assets.default[style]) {
103
+ content2.push(import_lodash.default.replace(icon, ".svg", ""));
104
+ }
105
+ }
106
+ return content2;
107
+ };
108
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconContext.Provider, { value: { getAll }, children });
100
109
  };
101
110
  const useIcon = () => (0, import_react.useContext)(IconContext);
102
111
  // Annotate the CommonJS export names for ESM import in node:
@@ -62,7 +62,16 @@ const IconProviderContainer = ({ children }) => {
62
62
  });
63
63
  return () => observer.disconnect();
64
64
  }, [isClient, matches]);
65
- return /* @__PURE__ */ jsx(IconContext.Provider, { value: {}, children });
65
+ const getAll = () => {
66
+ const content2 = [];
67
+ for (const style in assets) {
68
+ for (const icon in assets[style]) {
69
+ content2.push(_.replace(icon, ".svg", ""));
70
+ }
71
+ }
72
+ return content2;
73
+ };
74
+ return /* @__PURE__ */ jsx(IconContext.Provider, { value: { getAll }, children });
66
75
  };
67
76
  const useIcon = () => useContext(IconContext);
68
77
  export {
@@ -13,5 +13,5 @@ export interface IModal {
13
13
  position?: "center" | "right" | "left";
14
14
  noCloseIcon?: boolean;
15
15
  content?: any;
16
- setData?: (data: any) => void;
16
+ className?: string;
17
17
  }
@@ -1,3 +1,9 @@
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";
2
5
  export interface IIconProvider extends IBaseProvider {
3
6
  }
7
+ export interface IIconContext {
8
+ getAll: () => Array<keyof typeof solid | keyof typeof regular | keyof typeof brands>;
9
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gustavo-valsechi/client",
3
- "version": "1.4.10",
3
+ "version": "1.4.12",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",