@gustavo-valsechi/client 1.4.91 → 1.4.93

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.
@@ -67,11 +67,12 @@ function InputSelect(props) {
67
67
  props.label,
68
68
  props.required ? "*" : ""
69
69
  ] }),
70
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { ref: inputRef, className: "input-content", children: [
70
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "input-content", children: [
71
71
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
72
72
  "input",
73
73
  {
74
74
  ...import_lodash.default.omit(props, ["className", "register", "mask", "setValue"]),
75
+ ref: inputRef,
75
76
  type: "text",
76
77
  maxLength: props.maxLength || 255,
77
78
  ...register,
@@ -80,7 +81,7 @@ function InputSelect(props) {
80
81
  onBlur
81
82
  }
82
83
  ),
83
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "input-icon", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", { "aria-hidden": true, className: focus ? "fa-solid fa-chevron-up" : "fa-solid fa-chevron-down" }) })
84
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "input-icon", onClick: () => inputRef.current.click(), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", { "aria-hidden": true, className: focus ? "fa-solid fa-chevron-up" : "fa-solid fa-chevron-down" }) })
84
85
  ] }),
85
86
  !!props.error && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_error.InputError, { children: props.error })
86
87
  ] });
@@ -34,11 +34,12 @@ function InputSelect(props) {
34
34
  props.label,
35
35
  props.required ? "*" : ""
36
36
  ] }),
37
- /* @__PURE__ */ jsxs("div", { ref: inputRef, className: "input-content", children: [
37
+ /* @__PURE__ */ jsxs("div", { className: "input-content", children: [
38
38
  /* @__PURE__ */ jsx(
39
39
  "input",
40
40
  {
41
41
  ..._.omit(props, ["className", "register", "mask", "setValue"]),
42
+ ref: inputRef,
42
43
  type: "text",
43
44
  maxLength: props.maxLength || 255,
44
45
  ...register,
@@ -47,7 +48,7 @@ function InputSelect(props) {
47
48
  onBlur
48
49
  }
49
50
  ),
50
- /* @__PURE__ */ jsx("div", { className: "input-icon", children: /* @__PURE__ */ jsx("i", { "aria-hidden": true, className: focus ? "fa-solid fa-chevron-up" : "fa-solid fa-chevron-down" }) })
51
+ /* @__PURE__ */ jsx("div", { className: "input-icon", onClick: () => inputRef.current.click(), children: /* @__PURE__ */ jsx("i", { "aria-hidden": true, className: focus ? "fa-solid fa-chevron-up" : "fa-solid fa-chevron-down" }) })
51
52
  ] }),
52
53
  !!props.error && /* @__PURE__ */ jsx(InputError, { children: props.error })
53
54
  ] });
@@ -50,7 +50,7 @@ function InputSelectOption(props) {
50
50
  {
51
51
  className: "input-option",
52
52
  onClick: () => set(Object.keys(data)[index]),
53
- children: Object.values(data)
53
+ children: Object.values(data)[index] || ""
54
54
  },
55
55
  index
56
56
  )
@@ -17,7 +17,7 @@ function InputSelectOption(props) {
17
17
  {
18
18
  className: "input-option",
19
19
  onClick: () => set(Object.keys(data)[index]),
20
- children: Object.values(data)
20
+ children: Object.values(data)[index] || ""
21
21
  },
22
22
  index
23
23
  )
@@ -104,24 +104,8 @@ const TargetProviderContainer = ({ children }) => {
104
104
  import_lodash.default.forEach(targets, (target, index) => {
105
105
  var _a;
106
106
  const element = (_a = target.ref) == null ? void 0 : _a.current;
107
+ console.log(element);
107
108
  if (!element) return;
108
- element.addEventListener("click", () => {
109
- const targetElement = import_lodash.default.find(containerRef.current, (data, i) => i === index);
110
- if (!targetElement) return;
111
- console.log("document.activeElement", document.activeElement);
112
- console.log("elementFocusable", elementFocusable(target, index));
113
- console.log("target focus", elementFocusable(target, index) === document.activeElement);
114
- if (elementFocusable(target, index) === document.activeElement) {
115
- close(targetElement);
116
- return;
117
- }
118
- const coords = getCoords(element);
119
- open(targetElement, coords);
120
- elementFocusable(target, index).focus();
121
- });
122
- element.addEventListener("resize", () => {
123
- import_lodash.default.forEach(containerRef.current, (elementRef) => close(elementRef));
124
- });
125
109
  });
126
110
  }, [targets, inputRef, containerRef]);
127
111
  const getCoords = (target) => {
@@ -70,24 +70,8 @@ const TargetProviderContainer = ({ children }) => {
70
70
  _.forEach(targets, (target, index) => {
71
71
  var _a;
72
72
  const element = (_a = target.ref) == null ? void 0 : _a.current;
73
+ console.log(element);
73
74
  if (!element) return;
74
- element.addEventListener("click", () => {
75
- const targetElement = _.find(containerRef.current, (data, i) => i === index);
76
- if (!targetElement) return;
77
- console.log("document.activeElement", document.activeElement);
78
- console.log("elementFocusable", elementFocusable(target, index));
79
- console.log("target focus", elementFocusable(target, index) === document.activeElement);
80
- if (elementFocusable(target, index) === document.activeElement) {
81
- close(targetElement);
82
- return;
83
- }
84
- const coords = getCoords(element);
85
- open(targetElement, coords);
86
- elementFocusable(target, index).focus();
87
- });
88
- element.addEventListener("resize", () => {
89
- _.forEach(containerRef.current, (elementRef) => close(elementRef));
90
- });
91
75
  });
92
76
  }, [targets, inputRef, containerRef]);
93
77
  const getCoords = (target) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gustavo-valsechi/client",
3
- "version": "1.4.91",
3
+ "version": "1.4.93",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",