@gustavo-valsechi/client 1.4.112 → 1.4.113

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.
@@ -49,9 +49,7 @@ function InputSelect(props) {
49
49
  const [filter, setFilter] = (0, import_react.useState)("");
50
50
  const register = (props.register || ((name) => ({})))(props.name || "");
51
51
  const inputValue = (_a = props.watch) == null ? void 0 : _a.call(props, props.name);
52
- console.log("inputValue", inputValue);
53
52
  const value = ((_b = import_lodash.default.find(props.options, (option) => Object.keys(option)[0] === inputValue)) == null ? void 0 : _b[inputValue || ""]) || "";
54
- console.log("valueContent", value);
55
53
  (0, import_react.useEffect)(() => {
56
54
  var _a2;
57
55
  if (!(inputRef == null ? void 0 : inputRef.current) || !(containerRef == null ? void 0 : containerRef.current)) return;
@@ -16,9 +16,7 @@ function InputSelect(props) {
16
16
  const [filter, setFilter] = useState("");
17
17
  const register = (props.register || ((name) => ({})))(props.name || "");
18
18
  const inputValue = (_a = props.watch) == null ? void 0 : _a.call(props, props.name);
19
- console.log("inputValue", inputValue);
20
19
  const value = ((_b = _.find(props.options, (option) => Object.keys(option)[0] === inputValue)) == null ? void 0 : _b[inputValue || ""]) || "";
21
- console.log("valueContent", value);
22
20
  useEffect(() => {
23
21
  var _a2;
24
22
  if (!(inputRef == null ? void 0 : inputRef.current) || !(containerRef == null ? void 0 : containerRef.current)) return;
@@ -43,7 +43,7 @@ function InputSelectOption(props) {
43
43
  var _a, _b;
44
44
  (_a = props.setValue) == null ? void 0 : _a.call(props, props.name, value);
45
45
  if (!value || !((_b = props.inputRef) == null ? void 0 : _b.current)) return;
46
- props.inputRef.current.click();
46
+ props.inputRef.current.blur();
47
47
  }, [value, props.inputRef]);
48
48
  (0, import_react.useEffect)(() => {
49
49
  const filter = props.value || "";
@@ -10,7 +10,7 @@ function InputSelectOption(props) {
10
10
  var _a, _b;
11
11
  (_a = props.setValue) == null ? void 0 : _a.call(props, props.name, value);
12
12
  if (!value || !((_b = props.inputRef) == null ? void 0 : _b.current)) return;
13
- props.inputRef.current.click();
13
+ props.inputRef.current.blur();
14
14
  }, [value, props.inputRef]);
15
15
  useEffect(() => {
16
16
  const filter = props.value || "";
@@ -126,9 +126,10 @@ const TargetProviderContainer = ({ children }) => {
126
126
  });
127
127
  focusable.addEventListener("change", (e) => {
128
128
  var _a2;
129
- if (!targetElement) return;
130
129
  e.preventDefault();
131
- targetElement.setAttribute("value", ((_a2 = e.target) == null ? void 0 : _a2.value) || "");
130
+ const value = ((_a2 = e.target) == null ? void 0 : _a2.value) || "";
131
+ console.log("input target value", value);
132
+ target.component = import_react.default.cloneElement(target.component, { value });
132
133
  });
133
134
  });
134
135
  }, [targets, inputRef, containerRef]);
@@ -92,9 +92,10 @@ const TargetProviderContainer = ({ children }) => {
92
92
  });
93
93
  focusable.addEventListener("change", (e) => {
94
94
  var _a2;
95
- if (!targetElement) return;
96
95
  e.preventDefault();
97
- targetElement.setAttribute("value", ((_a2 = e.target) == null ? void 0 : _a2.value) || "");
96
+ const value = ((_a2 = e.target) == null ? void 0 : _a2.value) || "";
97
+ console.log("input target value", value);
98
+ target.component = React.cloneElement(target.component, { value });
98
99
  });
99
100
  });
100
101
  }, [targets, inputRef, containerRef]);
@@ -4,7 +4,7 @@ export interface ITargetProvider extends IBaseProvider {
4
4
  }
5
5
  export interface ITargetConfig {
6
6
  ref: React.RefObject<any>;
7
- component: React.ReactNode;
7
+ component: React.ReactElement;
8
8
  }
9
9
  export interface ITargetConfigCoords {
10
10
  top: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gustavo-valsechi/client",
3
- "version": "1.4.112",
3
+ "version": "1.4.113",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",