@gustavo-valsechi/client 1.4.109 → 1.4.111

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.
@@ -41,31 +41,28 @@ function InputSelectOption(props) {
41
41
  const [options, setOptions] = (0, import_react.useState)(props.options);
42
42
  (0, import_react.useEffect)(() => {
43
43
  var _a, _b;
44
- console.log("value", value);
45
- console.log("setValue", props.setValue);
46
- (_a = props.setValue) == null ? void 0 : _a.call(props, value);
44
+ (_a = props.setValue) == null ? void 0 : _a.call(props, props.name, value);
47
45
  if (!value || !((_b = props.inputRef) == null ? void 0 : _b.current)) return;
48
46
  props.inputRef.current.click();
49
47
  }, [value, props.inputRef]);
50
48
  (0, import_react.useEffect)(() => {
51
- var _a;
52
- console.log("props.inputRef antes", props.inputRef);
53
- if (!((_a = props.inputRef) == null ? void 0 : _a.current)) return;
54
- console.log("props.inputRef depois", props.inputRef);
55
- props.inputRef.current.addEventListener("change", (e) => {
49
+ const inputRef = document.getElementById(`input-${props.name}`);
50
+ if (!inputRef) return;
51
+ inputRef.addEventListener("change", (e) => {
56
52
  e.preventDefault();
57
- const filter = e.target.value || "";
53
+ const target = e.target;
54
+ const filter = target.value || "";
58
55
  console.log("filter", filter);
59
56
  if (!filter) return setOptions(props.options);
60
57
  const filtredOptions = import_lodash.default.filter(props.options, (data) => {
61
- var _a2;
62
- const value2 = ((_a2 = Object.values(data || {})) == null ? void 0 : _a2[0]) || "";
58
+ var _a;
59
+ const value2 = ((_a = Object.values(data || {})) == null ? void 0 : _a[0]) || "";
63
60
  if (import_lodash.default.isString(value2)) return import_lodash.default.includes(value2, filter);
64
61
  return import_lodash.default.includes(value2 == null ? void 0 : value2.textContent, filter);
65
62
  });
66
63
  setOptions(filtredOptions);
67
64
  });
68
- }, [props.inputRef]);
65
+ }, []);
69
66
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.Container, { width: props.width, children: import_lodash.default.map(
70
67
  options,
71
68
  (data, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -8,31 +8,28 @@ function InputSelectOption(props) {
8
8
  const [options, setOptions] = useState(props.options);
9
9
  useEffect(() => {
10
10
  var _a, _b;
11
- console.log("value", value);
12
- console.log("setValue", props.setValue);
13
- (_a = props.setValue) == null ? void 0 : _a.call(props, value);
11
+ (_a = props.setValue) == null ? void 0 : _a.call(props, props.name, value);
14
12
  if (!value || !((_b = props.inputRef) == null ? void 0 : _b.current)) return;
15
13
  props.inputRef.current.click();
16
14
  }, [value, props.inputRef]);
17
15
  useEffect(() => {
18
- var _a;
19
- console.log("props.inputRef antes", props.inputRef);
20
- if (!((_a = props.inputRef) == null ? void 0 : _a.current)) return;
21
- console.log("props.inputRef depois", props.inputRef);
22
- props.inputRef.current.addEventListener("change", (e) => {
16
+ const inputRef = document.getElementById(`input-${props.name}`);
17
+ if (!inputRef) return;
18
+ inputRef.addEventListener("change", (e) => {
23
19
  e.preventDefault();
24
- const filter = e.target.value || "";
20
+ const target = e.target;
21
+ const filter = target.value || "";
25
22
  console.log("filter", filter);
26
23
  if (!filter) return setOptions(props.options);
27
24
  const filtredOptions = _.filter(props.options, (data) => {
28
- var _a2;
29
- const value2 = ((_a2 = Object.values(data || {})) == null ? void 0 : _a2[0]) || "";
25
+ var _a;
26
+ const value2 = ((_a = Object.values(data || {})) == null ? void 0 : _a[0]) || "";
30
27
  if (_.isString(value2)) return _.includes(value2, filter);
31
28
  return _.includes(value2 == null ? void 0 : value2.textContent, filter);
32
29
  });
33
30
  setOptions(filtredOptions);
34
31
  });
35
- }, [props.inputRef]);
32
+ }, []);
36
33
  return /* @__PURE__ */ jsx(Container, { width: props.width, children: _.map(
37
34
  options,
38
35
  (data, index) => /* @__PURE__ */ jsx(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gustavo-valsechi/client",
3
- "version": "1.4.109",
3
+ "version": "1.4.111",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",