@gustavo-valsechi/client 1.4.37 → 1.4.38

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.
@@ -95,7 +95,7 @@ function Form(props) {
95
95
  ComponentType,
96
96
  {
97
97
  ...import_lodash.default.omit(data, ["validation"]),
98
- id: data.name,
98
+ id: `iz-input-${data.name}`,
99
99
  type: component2 ? void 0 : data.type,
100
100
  error: (_a = errors[data.name]) == null ? void 0 : _a.message,
101
101
  register,
@@ -61,7 +61,7 @@ function Form(props) {
61
61
  ComponentType,
62
62
  {
63
63
  ..._.omit(data, ["validation"]),
64
- id: data.name,
64
+ id: `iz-input-${data.name}`,
65
65
  type: component2 ? void 0 : data.type,
66
66
  error: (_a = errors[data.name]) == null ? void 0 : _a.message,
67
67
  register,
@@ -53,6 +53,7 @@ function Button(props) {
53
53
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
54
54
  import_styles.Container,
55
55
  {
56
+ id: `iz-button-${import_lodash.default.replace(import_lodash.default.lowerCase(props.label), /\s/g, "-")}`,
56
57
  loading: String(loading || !!props.loading),
57
58
  disabled: props.disabled,
58
59
  type: props.type || "button",
@@ -20,6 +20,7 @@ function Button(props) {
20
20
  return /* @__PURE__ */ jsxs(
21
21
  Container,
22
22
  {
23
+ id: `iz-button-${_.replace(_.lowerCase(props.label), /\s/g, "-")}`,
23
24
  loading: String(loading || !!props.loading),
24
25
  disabled: props.disabled,
25
26
  type: props.type || "button",
@@ -38,6 +38,7 @@ var import_react = require("react");
38
38
  var import_styles = require("./styles");
39
39
  var import_lodash = __toESM(require("lodash"));
40
40
  const TargetContext = (0, import_react.createContext)({});
41
+ const memory = [];
41
42
  const TargetProviderContainer = ({ children }) => {
42
43
  const [targets, setTargets] = (0, import_react.useState)([]);
43
44
  (0, import_react.useEffect)(() => {
@@ -69,10 +70,13 @@ const TargetProviderContainer = ({ children }) => {
69
70
  return coords;
70
71
  };
71
72
  const add = (target) => {
72
- setTargets(import_lodash.default.concat(targets, target));
73
+ memory.push(target);
74
+ setTargets(memory);
73
75
  };
74
76
  const remove = (ref) => {
75
- setTargets(import_lodash.default.filter(targets, (data) => data.ref.current !== ref.current));
77
+ const index = import_lodash.default.findIndex(memory, (data) => data.ref.current === ref.current);
78
+ memory.slice(index, 1);
79
+ setTargets(memory);
76
80
  };
77
81
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
78
82
  TargetContext.Provider,
@@ -84,7 +88,7 @@ const TargetProviderContainer = ({ children }) => {
84
88
  children: [
85
89
  import_lodash.default.map(
86
90
  targets,
87
- (target, index) => target.show && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
91
+ (target, index) => !!target.show && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
88
92
  import_styles.Container,
89
93
  {
90
94
  style: getCoords(target.ref.current),
@@ -4,6 +4,7 @@ import { createContext, useContext, useEffect, useState } from "react";
4
4
  import { Container } from "./styles";
5
5
  import _ from "lodash";
6
6
  const TargetContext = createContext({});
7
+ const memory = [];
7
8
  const TargetProviderContainer = ({ children }) => {
8
9
  const [targets, setTargets] = useState([]);
9
10
  useEffect(() => {
@@ -35,10 +36,13 @@ const TargetProviderContainer = ({ children }) => {
35
36
  return coords;
36
37
  };
37
38
  const add = (target) => {
38
- setTargets(_.concat(targets, target));
39
+ memory.push(target);
40
+ setTargets(memory);
39
41
  };
40
42
  const remove = (ref) => {
41
- setTargets(_.filter(targets, (data) => data.ref.current !== ref.current));
43
+ const index = _.findIndex(memory, (data) => data.ref.current === ref.current);
44
+ memory.slice(index, 1);
45
+ setTargets(memory);
42
46
  };
43
47
  return /* @__PURE__ */ jsxs(
44
48
  TargetContext.Provider,
@@ -50,7 +54,7 @@ const TargetProviderContainer = ({ children }) => {
50
54
  children: [
51
55
  _.map(
52
56
  targets,
53
- (target, index) => target.show && /* @__PURE__ */ jsx(
57
+ (target, index) => !!target.show && /* @__PURE__ */ jsx(
54
58
  Container,
55
59
  {
56
60
  style: getCoords(target.ref.current),
@@ -1,4 +1,4 @@
1
- import { IButton, IInputSelect, IInputFile, IInputText, IInputTextarea, IInputDateTime, IInputCustom } from "@interfaces";
1
+ import { IButton, IInputSelect } from "@interfaces";
2
2
  export * from "./file";
3
3
  export * from "./label";
4
4
  export * from "./text";
@@ -15,6 +15,6 @@ export interface IForm {
15
15
  formRef?: any;
16
16
  onSubmit: (values: any, actions?: any) => void;
17
17
  clearWhen?: boolean;
18
- inputs: Array<IInputSelect & IInputFile & IInputText & IInputTextarea & IInputDateTime & IInputCustom>;
18
+ inputs: Array<IInputSelect>;
19
19
  buttons?: Array<IButton>;
20
20
  }
@@ -9,9 +9,9 @@ export interface IInputSelect {
9
9
  value?: string;
10
10
  onChange?: (event: any) => void;
11
11
  options: Array<any>;
12
- error: string;
12
+ error?: string;
13
13
  disabled?: boolean;
14
- onFocus: (value: any) => void;
14
+ onFocus?: (value: any) => void;
15
15
  required?: boolean;
16
16
  register?: UseFormRegister<any>;
17
17
  validation?: typeof z;
@@ -0,0 +1 @@
1
+ export default function App(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gustavo-valsechi/client",
3
- "version": "1.4.37",
3
+ "version": "1.4.38",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -15,7 +15,8 @@
15
15
  "build:remodel": "node scripts/remodel.js",
16
16
  "build:assets": "node scripts/assets.js",
17
17
  "build": "npm run clean && npm run build:js && npm run build:types && npm run build:assets && npm run build:remodel",
18
- "commit": "npm run build && npm version patch --no-git-tag-version && npm publish --access public"
18
+ "commit": "npm run build && npm version patch --no-git-tag-version && npm publish --access public",
19
+ "dev": "vite --open test/index.html"
19
20
  },
20
21
  "peerDependencies": {
21
22
  "react": "18.3.1",
@@ -24,8 +25,8 @@
24
25
  },
25
26
  "dependencies": {
26
27
  "@emotion/is-prop-valid": "1.3.0",
27
- "@gustavo-valsechi/utils": "1.0.4",
28
28
  "@gustavo-valsechi/server": "1.0.13",
29
+ "@gustavo-valsechi/utils": "1.0.4",
29
30
  "@hookform/resolvers": "5.2.2",
30
31
  "apexcharts": "3.51.0",
31
32
  "lodash": "4.17.21",
@@ -48,6 +49,7 @@
48
49
  "@types/react-dom": "18.3.0",
49
50
  "@types/react-lottie": "1.2.10",
50
51
  "@types/styled-components": "5.1.34",
52
+ "@vitejs/plugin-react": "^5.1.0",
51
53
  "esbuild": "0.25.11",
52
54
  "esbuild-css-modules-plugin": "^3.1.5",
53
55
  "raw-loader": "4.0.2",
@@ -56,7 +58,8 @@
56
58
  "rimraf": "6.1.0",
57
59
  "styled-components": "6.1.12",
58
60
  "tsc-alias": "1.8.16",
59
- "typescript": "5.5.4"
61
+ "typescript": "5.5.4",
62
+ "vite": "^7.2.1"
60
63
  },
61
64
  "publishConfig": {
62
65
  "access": "public"