@gustavo-valsechi/client 1.4.110 → 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.
@@ -52,10 +52,6 @@ function InputSelect(props) {
52
52
  console.log("inputValue", inputValue);
53
53
  const value = ((_b = import_lodash.default.find(props.options, (option) => Object.keys(option)[0] === inputValue)) == null ? void 0 : _b[inputValue || ""]) || "";
54
54
  console.log("valueContent", value);
55
- (0, import_react.useEffect)(() => {
56
- var _a2;
57
- (_a2 = props.setValue) == null ? void 0 : _a2.call(props, "1");
58
- }, []);
59
55
  (0, import_react.useEffect)(() => {
60
56
  var _a2;
61
57
  if (!(inputRef == null ? void 0 : inputRef.current) || !(containerRef == null ? void 0 : containerRef.current)) return;
@@ -19,10 +19,6 @@ function InputSelect(props) {
19
19
  console.log("inputValue", inputValue);
20
20
  const value = ((_b = _.find(props.options, (option) => Object.keys(option)[0] === inputValue)) == null ? void 0 : _b[inputValue || ""]) || "";
21
21
  console.log("valueContent", value);
22
- useEffect(() => {
23
- var _a2;
24
- (_a2 = props.setValue) == null ? void 0 : _a2.call(props, "1");
25
- }, []);
26
22
  useEffect(() => {
27
23
  var _a2;
28
24
  if (!(inputRef == null ? void 0 : inputRef.current) || !(containerRef == null ? void 0 : containerRef.current)) return;
@@ -41,29 +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
- if (!((_a = props.inputRef) == null ? void 0 : _a.current)) return;
53
- props.inputRef.current.addEventListener("change", (e) => {
49
+ const inputRef = document.getElementById(`input-${props.name}`);
50
+ if (!inputRef) return;
51
+ inputRef.addEventListener("change", (e) => {
54
52
  e.preventDefault();
55
- const filter = e.target.value || "";
53
+ const target = e.target;
54
+ const filter = target.value || "";
56
55
  console.log("filter", filter);
57
56
  if (!filter) return setOptions(props.options);
58
57
  const filtredOptions = import_lodash.default.filter(props.options, (data) => {
59
- var _a2;
60
- 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]) || "";
61
60
  if (import_lodash.default.isString(value2)) return import_lodash.default.includes(value2, filter);
62
61
  return import_lodash.default.includes(value2 == null ? void 0 : value2.textContent, filter);
63
62
  });
64
63
  setOptions(filtredOptions);
65
64
  });
66
- }, [props.inputRef]);
65
+ }, []);
67
66
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.Container, { width: props.width, children: import_lodash.default.map(
68
67
  options,
69
68
  (data, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -8,29 +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
- if (!((_a = props.inputRef) == null ? void 0 : _a.current)) return;
20
- props.inputRef.current.addEventListener("change", (e) => {
16
+ const inputRef = document.getElementById(`input-${props.name}`);
17
+ if (!inputRef) return;
18
+ inputRef.addEventListener("change", (e) => {
21
19
  e.preventDefault();
22
- const filter = e.target.value || "";
20
+ const target = e.target;
21
+ const filter = target.value || "";
23
22
  console.log("filter", filter);
24
23
  if (!filter) return setOptions(props.options);
25
24
  const filtredOptions = _.filter(props.options, (data) => {
26
- var _a2;
27
- 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]) || "";
28
27
  if (_.isString(value2)) return _.includes(value2, filter);
29
28
  return _.includes(value2 == null ? void 0 : value2.textContent, filter);
30
29
  });
31
30
  setOptions(filtredOptions);
32
31
  });
33
- }, [props.inputRef]);
32
+ }, []);
34
33
  return /* @__PURE__ */ jsx(Container, { width: props.width, children: _.map(
35
34
  options,
36
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.110",
3
+ "version": "1.4.111",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",