@gustavo-valsechi/client 1.4.37 → 1.4.39

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",
@@ -1,10 +1,8 @@
1
1
  "use strict";
2
2
  "use client";
3
- var __create = Object.create;
4
3
  var __defProp = Object.defineProperty;
5
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf;
8
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
7
  var __export = (target, all) => {
10
8
  for (var name in all)
@@ -18,14 +16,6 @@ var __copyProps = (to, from, except, desc) => {
18
16
  }
19
17
  return to;
20
18
  };
21
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
- // If the importer is in node compatibility mode or this is not an ESM
23
- // file that has been converted to a CommonJS file using a Babel-
24
- // compatible transform (i.e. "__esModule" has not been set), then set
25
- // "default" to the CommonJS "module.exports" for node compatibility.
26
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
- mod
28
- ));
29
19
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
20
  var options_exports = {};
31
21
  __export(options_exports, {
@@ -34,18 +24,7 @@ __export(options_exports, {
34
24
  module.exports = __toCommonJS(options_exports);
35
25
  var import_jsx_runtime = require("react/jsx-runtime");
36
26
  var import_styles = require("./styles");
37
- var import_lodash = __toESM(require("lodash"));
38
27
  function InputSelectOption(props) {
39
28
  const [value, set] = props.option;
40
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.Container, { children: import_lodash.default.map(
41
- props.options,
42
- (data, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
43
- "option",
44
- {
45
- value: Object.keys(data),
46
- children: Object.values(data)
47
- },
48
- index
49
- )
50
- ) });
29
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.Container, {});
51
30
  }
@@ -1,20 +1,9 @@
1
1
  "use client";
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  import { Container } from "./styles";
4
- import _ from "lodash";
5
4
  function InputSelectOption(props) {
6
5
  const [value, set] = props.option;
7
- return /* @__PURE__ */ jsx(Container, { children: _.map(
8
- props.options,
9
- (data, index) => /* @__PURE__ */ jsx(
10
- "option",
11
- {
12
- value: Object.keys(data),
13
- children: Object.values(data)
14
- },
15
- index
16
- )
17
- ) });
6
+ return /* @__PURE__ */ jsx(Container, {});
18
7
  }
19
8
  export {
20
9
  InputSelectOption as default
@@ -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.39",
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"