@gustavo-valsechi/client 1.4.32 → 1.4.34

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.
@@ -1,3 +1,3 @@
1
1
  import { IComponent } from "@interfaces";
2
2
  export * from "./types";
3
- export declare function Component(props: IComponent): import("react/jsx-runtime").JSX.Element;
3
+ export default function Component(props: IComponent): import("react/jsx-runtime").JSX.Element;
@@ -30,7 +30,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
30
30
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
31
31
  var components_exports = {};
32
32
  __export(components_exports, {
33
- Component: () => Component
33
+ default: () => Component
34
34
  });
35
35
  module.exports = __toCommonJS(components_exports);
36
36
  var import_jsx_runtime = require("react/jsx-runtime");
@@ -57,6 +57,5 @@ function Component(props) {
57
57
  }
58
58
  // Annotate the CommonJS export names for ESM import in node:
59
59
  0 && (module.exports = {
60
- Component,
61
60
  ...require("./types")
62
61
  });
@@ -22,5 +22,5 @@ function Component(props) {
22
22
  ) });
23
23
  }
24
24
  export {
25
- Component
25
+ Component as default
26
26
  };
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  "use client";
3
+ var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
6
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
9
  var __export = (target, all) => {
8
10
  for (var name in all)
@@ -16,6 +18,14 @@ var __copyProps = (to, from, except, desc) => {
16
18
  }
17
19
  return to;
18
20
  };
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
+ ));
19
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
30
  var block_exports = {};
21
31
  __export(block_exports, {
@@ -24,7 +34,7 @@ __export(block_exports, {
24
34
  module.exports = __toCommonJS(block_exports);
25
35
  var import_jsx_runtime = require("react/jsx-runtime");
26
36
  var import_styles = require("./styles");
27
- var import__ = require("../..");
37
+ var import__ = __toESM(require("../.."));
28
38
  function Block(props) {
29
39
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styles.Container, { children: [
30
40
  (!!props.icon || !!props.label) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", { children: [
@@ -32,7 +42,7 @@ function Block(props) {
32
42
  !!props.label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: props.label })
33
43
  ] }),
34
44
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styles.Content, { children: [
35
- !!props.component && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.Component, { content: props.component }),
45
+ !!props.component && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { content: props.component }),
36
46
  props.children
37
47
  ] })
38
48
  ] });
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { Container, Content } from "./styles";
4
- import { Component } from "../..";
4
+ import Component from "../..";
5
5
  function Block(props) {
6
6
  return /* @__PURE__ */ jsxs(Container, { children: [
7
7
  (!!props.icon || !!props.label) && /* @__PURE__ */ jsxs("header", { children: [
@@ -43,12 +43,21 @@ var import_options = __toESM(require("./options"));
43
43
  function InputSelect(props) {
44
44
  const inputRef = (0, import_react.useRef)({});
45
45
  const target = (0, import_contexts.useTarget)();
46
+ const option = (0, import_react.useState)("");
46
47
  const [focus, setFocus] = (0, import_react.useState)(false);
47
48
  const register = (props.register || ((name) => ({})))(props.name || "");
48
49
  (0, import_react.useEffect)(() => {
49
- target.add({ ref: inputRef, component: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_options.default, {}) });
50
+ target.add({ ref: inputRef, component: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_options.default, { option: true, ...props }) });
50
51
  return () => target.remove(inputRef);
51
52
  }, []);
53
+ const onBlur = (event) => {
54
+ setFocus(false);
55
+ if (register.onBlur) register.onBlur(event);
56
+ };
57
+ const onFocus = (event) => {
58
+ setFocus(true);
59
+ if (register.onFocus) register.onFocus(event);
60
+ };
52
61
  const onChange = (event) => {
53
62
  const value = event.target.value || "";
54
63
  event.target.value = props.mask ? props.mask(value) : value;
@@ -67,34 +76,9 @@ function InputSelect(props) {
67
76
  type: "text",
68
77
  maxLength: props.maxLength || 255,
69
78
  ...register,
70
- onChange
71
- }
72
- ),
73
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
74
- "select",
75
- {
76
- ...import_lodash.default.omit(props, ["className", "onChange", "onFocus", "options", "onMouseDown", "onBlur", "maxLength", "required", "register"]),
77
- onMouseDown: () => setFocus(!focus),
78
- onFocus: () => {
79
- if (props.onFocus) props.onFocus(props.name);
80
- },
81
- ...register,
82
- onBlur: (event) => {
83
- if (register.onBlur) register.onBlur(event);
84
- setFocus(false);
85
- },
86
79
  onChange,
87
- children: import_lodash.default.map(
88
- props.options,
89
- (data, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
90
- "option",
91
- {
92
- value: Object.keys(data),
93
- children: Object.values(data)
94
- },
95
- index
96
- )
97
- )
80
+ onFocus,
81
+ onBlur
98
82
  }
99
83
  ),
100
84
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", { "aria-hidden": true, className: focus ? "fa-solid fa-chevron-up" : "fa-solid fa-chevron-down" })
@@ -10,12 +10,21 @@ import InputSelectOption from "./options";
10
10
  function InputSelect(props) {
11
11
  const inputRef = useRef({});
12
12
  const target = useTarget();
13
+ const option = useState("");
13
14
  const [focus, setFocus] = useState(false);
14
15
  const register = (props.register || ((name) => ({})))(props.name || "");
15
16
  useEffect(() => {
16
- target.add({ ref: inputRef, component: /* @__PURE__ */ jsx(InputSelectOption, {}) });
17
+ target.add({ ref: inputRef, component: /* @__PURE__ */ jsx(InputSelectOption, { option: true, ...props }) });
17
18
  return () => target.remove(inputRef);
18
19
  }, []);
20
+ const onBlur = (event) => {
21
+ setFocus(false);
22
+ if (register.onBlur) register.onBlur(event);
23
+ };
24
+ const onFocus = (event) => {
25
+ setFocus(true);
26
+ if (register.onFocus) register.onFocus(event);
27
+ };
19
28
  const onChange = (event) => {
20
29
  const value = event.target.value || "";
21
30
  event.target.value = props.mask ? props.mask(value) : value;
@@ -34,34 +43,9 @@ function InputSelect(props) {
34
43
  type: "text",
35
44
  maxLength: props.maxLength || 255,
36
45
  ...register,
37
- onChange
38
- }
39
- ),
40
- /* @__PURE__ */ jsx(
41
- "select",
42
- {
43
- ..._.omit(props, ["className", "onChange", "onFocus", "options", "onMouseDown", "onBlur", "maxLength", "required", "register"]),
44
- onMouseDown: () => setFocus(!focus),
45
- onFocus: () => {
46
- if (props.onFocus) props.onFocus(props.name);
47
- },
48
- ...register,
49
- onBlur: (event) => {
50
- if (register.onBlur) register.onBlur(event);
51
- setFocus(false);
52
- },
53
46
  onChange,
54
- children: _.map(
55
- props.options,
56
- (data, index) => /* @__PURE__ */ jsx(
57
- "option",
58
- {
59
- value: Object.keys(data),
60
- children: Object.values(data)
61
- },
62
- index
63
- )
64
- )
47
+ onFocus,
48
+ onBlur
65
49
  }
66
50
  ),
67
51
  /* @__PURE__ */ jsx("i", { "aria-hidden": true, className: focus ? "fa-solid fa-chevron-up" : "fa-solid fa-chevron-down" })
@@ -1 +1,4 @@
1
- export default function InputSelectOption(props: any): import("react/jsx-runtime").JSX.Element;
1
+ import { IInputSelect } from "@interfaces";
2
+ export default function InputSelectOption(props: IInputSelect & {
3
+ option: any;
4
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  "use client";
3
+ var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
6
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
9
  var __export = (target, all) => {
8
10
  for (var name in all)
@@ -16,6 +18,14 @@ var __copyProps = (to, from, except, desc) => {
16
18
  }
17
19
  return to;
18
20
  };
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
+ ));
19
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
30
  var options_exports = {};
21
31
  __export(options_exports, {
@@ -24,6 +34,18 @@ __export(options_exports, {
24
34
  module.exports = __toCommonJS(options_exports);
25
35
  var import_jsx_runtime = require("react/jsx-runtime");
26
36
  var import_styles = require("./styles");
37
+ var import_lodash = __toESM(require("lodash"));
27
38
  function InputSelectOption(props) {
28
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.Container, {});
39
+ 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
51
  }
@@ -1,8 +1,20 @@
1
1
  "use client";
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  import { Container } from "./styles";
4
+ import _ from "lodash";
4
5
  function InputSelectOption(props) {
5
- return /* @__PURE__ */ jsx(Container, {});
6
+ 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
18
  }
7
19
  export {
8
20
  InputSelectOption as default
@@ -35,8 +35,8 @@ module.exports = __toCommonJS(modal_exports);
35
35
  var import_jsx_runtime = require("react/jsx-runtime");
36
36
  var import_styles = require("./styles");
37
37
  var import_styles2 = require("../styles");
38
- var import__ = require("../../..");
39
38
  var import_contexts = require("../../../../contexts");
39
+ var import__ = __toESM(require("../../.."));
40
40
  var import_lodash = __toESM(require("lodash"));
41
41
  var import_actions = __toESM(require("./actions"));
42
42
  function Modal(props) {
@@ -47,7 +47,7 @@ function Modal(props) {
47
47
  modal.toggle("table");
48
48
  };
49
49
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
50
- import__.Component,
50
+ import__.default,
51
51
  {
52
52
  content: [{
53
53
  type: "Modal",
@@ -64,7 +64,7 @@ function Modal(props) {
64
64
  ] }, key)
65
65
  ) }) }),
66
66
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "iz-table-modal-actions", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
67
- import__.Component,
67
+ import__.default,
68
68
  {
69
69
  content: import_lodash.default.concat(import_lodash.default.map(actions, (data) => ({
70
70
  type: "Button",
@@ -2,8 +2,8 @@
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { Content } from "./styles";
4
4
  import { Container } from "../styles";
5
- import { Component } from "../../..";
6
5
  import { useModal } from "../../../../contexts";
6
+ import Component from "../../..";
7
7
  import _ from "lodash";
8
8
  import actionConfig from "./actions";
9
9
  function Modal(props) {
@@ -4,4 +4,4 @@ export * from "./theme";
4
4
  export * from "./tooltip";
5
5
  export * from "./modal";
6
6
  export * from "./target";
7
- export declare function Context(props: IContext): import("react/jsx-runtime").JSX.Element;
7
+ export default function Context(props: IContext): import("react/jsx-runtime").JSX.Element;
@@ -20,7 +20,7 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
20
20
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
21
  var contexts_exports = {};
22
22
  __export(contexts_exports, {
23
- Context: () => Context
23
+ default: () => Context
24
24
  });
25
25
  module.exports = __toCommonJS(contexts_exports);
26
26
  var import_jsx_runtime = require("react/jsx-runtime");
@@ -39,7 +39,6 @@ function Context(props) {
39
39
  }
40
40
  // Annotate the CommonJS export names for ESM import in node:
41
41
  0 && (module.exports = {
42
- Context,
43
42
  ...require("./icon"),
44
43
  ...require("./theme"),
45
44
  ...require("./tooltip"),
@@ -14,5 +14,5 @@ function Context(props) {
14
14
  return /* @__PURE__ */ jsx(ThemeProvider, { theme: props.theme, children: /* @__PURE__ */ jsx(IconProvider, { children: /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsx(TargetProvider, { children: /* @__PURE__ */ jsx(ModalProvider, { children: props.children }) }) }) }) });
15
15
  }
16
16
  export {
17
- Context
17
+ Context as default
18
18
  };
@@ -40,8 +40,12 @@ const TargetContext = (0, import_react.createContext)({});
40
40
  const TargetProviderContainer = ({ children }) => {
41
41
  const [targets, setTargets] = (0, import_react.useState)([]);
42
42
  (0, import_react.useEffect)(() => {
43
- import_lodash.default.forEach(targets, ({ ref }) => {
44
- ref.current.addEventListener("click", () => {
43
+ let newTargets = [...targets];
44
+ if (JSON.stringify(targets) === JSON.stringify(newTargets)) return;
45
+ import_lodash.default.forEach(targets, (target, index) => {
46
+ target.ref.current.addEventListener("click", () => {
47
+ newTargets.splice(index, 1, { ...target, show: !target.show });
48
+ setTargets(newTargets);
45
49
  });
46
50
  });
47
51
  }, [targets]);
@@ -62,7 +66,6 @@ const TargetProviderContainer = ({ children }) => {
62
66
  return coords;
63
67
  };
64
68
  const add = (target) => {
65
- target.ref.current.addEventListener("click", () => target.show = !target.show);
66
69
  setTargets(import_lodash.default.concat(targets, target));
67
70
  };
68
71
  const remove = (ref) => {
@@ -6,8 +6,12 @@ const TargetContext = createContext({});
6
6
  const TargetProviderContainer = ({ children }) => {
7
7
  const [targets, setTargets] = useState([]);
8
8
  useEffect(() => {
9
- _.forEach(targets, ({ ref }) => {
10
- ref.current.addEventListener("click", () => {
9
+ let newTargets = [...targets];
10
+ if (JSON.stringify(targets) === JSON.stringify(newTargets)) return;
11
+ _.forEach(targets, (target, index) => {
12
+ target.ref.current.addEventListener("click", () => {
13
+ newTargets.splice(index, 1, { ...target, show: !target.show });
14
+ setTargets(newTargets);
11
15
  });
12
16
  });
13
17
  }, [targets]);
@@ -28,7 +32,6 @@ const TargetProviderContainer = ({ children }) => {
28
32
  return coords;
29
33
  };
30
34
  const add = (target) => {
31
- target.ref.current.addEventListener("click", () => target.show = !target.show);
32
35
  setTargets(_.concat(targets, target));
33
36
  };
34
37
  const remove = (ref) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gustavo-valsechi/client",
3
- "version": "1.4.32",
3
+ "version": "1.4.34",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",