@gustavo-valsechi/client 1.4.129 → 1.4.131

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.
@@ -36,6 +36,7 @@ var import_jsx_runtime = require("react/jsx-runtime");
36
36
  var import_react = require("react");
37
37
  var import_styles = require("./styles");
38
38
  var import_contexts = require("../../../../../../contexts");
39
+ var import_utils = __toESM(require("@gustavo-valsechi/utils"));
39
40
  var import_lodash = __toESM(require("lodash"));
40
41
  function InputSelectOption(props) {
41
42
  const target = (0, import_contexts.useTarget)();
@@ -51,12 +52,11 @@ function InputSelectOption(props) {
51
52
  const filtredOptions = import_lodash.default.filter(props.options, (data) => {
52
53
  var _a;
53
54
  const value = ((_a = Object.values(data || {})) == null ? void 0 : _a[0]) || "";
54
- const normalize = (text) => import_lodash.default.deburr(text == null ? void 0 : text.toLowerCase());
55
+ const normalize = (text2) => import_lodash.default.deburr(text2 == null ? void 0 : text2.toLowerCase());
55
56
  if (import_lodash.default.isString(value)) return import_lodash.default.includes(normalize(value), normalize(filter));
56
- console.log(typeof value);
57
- console.log(value);
58
- console.log(value == null ? void 0 : value.textContent);
59
- return import_lodash.default.includes(normalize(value == null ? void 0 : value.textContent), normalize(filter));
57
+ const text = import_utils.default.format.textIntoElement(value);
58
+ console.log(text);
59
+ return import_lodash.default.includes(normalize(text), normalize(filter));
60
60
  });
61
61
  setOptions(filtredOptions);
62
62
  }
@@ -3,6 +3,7 @@ import { jsx } from "react/jsx-runtime";
3
3
  import { useEffect, useState } from "react";
4
4
  import { Container } from "./styles";
5
5
  import { useTarget } from "../../../../../../contexts";
6
+ import Utils from "@gustavo-valsechi/utils";
6
7
  import _ from "lodash";
7
8
  function InputSelectOption(props) {
8
9
  const target = useTarget();
@@ -18,12 +19,11 @@ function InputSelectOption(props) {
18
19
  const filtredOptions = _.filter(props.options, (data) => {
19
20
  var _a;
20
21
  const value = ((_a = Object.values(data || {})) == null ? void 0 : _a[0]) || "";
21
- const normalize = (text) => _.deburr(text == null ? void 0 : text.toLowerCase());
22
+ const normalize = (text2) => _.deburr(text2 == null ? void 0 : text2.toLowerCase());
22
23
  if (_.isString(value)) return _.includes(normalize(value), normalize(filter));
23
- console.log(typeof value);
24
- console.log(value);
25
- console.log(value == null ? void 0 : value.textContent);
26
- return _.includes(normalize(value == null ? void 0 : value.textContent), normalize(filter));
24
+ const text = Utils.format.textIntoElement(value);
25
+ console.log(text);
26
+ return _.includes(normalize(text), normalize(filter));
27
27
  });
28
28
  setOptions(filtredOptions);
29
29
  }
@@ -55,7 +55,7 @@ const TargetProviderContainer = ({ children }) => {
55
55
  insideMemory.splice(import_lodash.default.findIndex(insideMemory, (i) => i === index), 1);
56
56
  console.log("insideMemory in blur function", insideMemory);
57
57
  elementFocusable(targets[index], index).focus();
58
- setTimeout(() => elementFocusable(targets[index], index).blur(), 1);
58
+ setTimeout(() => elementFocusable(targets[index], index).blur(), 0.1);
59
59
  };
60
60
  const close = (index) => {
61
61
  const element = containerRef.current[index];
@@ -120,7 +120,7 @@ const TargetProviderContainer = ({ children }) => {
120
120
  element.addEventListener("click", () => {
121
121
  const styles = window.getComputedStyle(targetElement);
122
122
  if (styles.opacity === "1") {
123
- close(index);
123
+ blur(index);
124
124
  return;
125
125
  }
126
126
  open(target, index);
@@ -183,15 +183,12 @@ const TargetProviderContainer = ({ children }) => {
183
183
  import_styles.Container,
184
184
  {
185
185
  ref: (element) => containerRef.current[index] = element,
186
- onMouseEnter: () => {
186
+ onMouseLeave: () => insideMemory.splice(import_lodash.default.findIndex(insideMemory, (i) => i === index), 1),
187
+ onMouseMove: () => {
187
188
  elementFocusable(target, index).focus();
188
189
  if (import_lodash.default.some(insideMemory, (i) => i === index)) return;
189
190
  insideMemory.push(index);
190
191
  },
191
- onMouseLeave: () => {
192
- insideMemory.splice(import_lodash.default.findIndex(insideMemory, (i) => i === index), 1);
193
- },
194
- onClick: () => elementFocusable(target, index).focus(),
195
192
  children: target.component
196
193
  }
197
194
  ),
@@ -21,7 +21,7 @@ const TargetProviderContainer = ({ children }) => {
21
21
  insideMemory.splice(_.findIndex(insideMemory, (i) => i === index), 1);
22
22
  console.log("insideMemory in blur function", insideMemory);
23
23
  elementFocusable(targets[index], index).focus();
24
- setTimeout(() => elementFocusable(targets[index], index).blur(), 1);
24
+ setTimeout(() => elementFocusable(targets[index], index).blur(), 0.1);
25
25
  };
26
26
  const close = (index) => {
27
27
  const element = containerRef.current[index];
@@ -86,7 +86,7 @@ const TargetProviderContainer = ({ children }) => {
86
86
  element.addEventListener("click", () => {
87
87
  const styles = window.getComputedStyle(targetElement);
88
88
  if (styles.opacity === "1") {
89
- close(index);
89
+ blur(index);
90
90
  return;
91
91
  }
92
92
  open(target, index);
@@ -149,15 +149,12 @@ const TargetProviderContainer = ({ children }) => {
149
149
  Container,
150
150
  {
151
151
  ref: (element) => containerRef.current[index] = element,
152
- onMouseEnter: () => {
152
+ onMouseLeave: () => insideMemory.splice(_.findIndex(insideMemory, (i) => i === index), 1),
153
+ onMouseMove: () => {
153
154
  elementFocusable(target, index).focus();
154
155
  if (_.some(insideMemory, (i) => i === index)) return;
155
156
  insideMemory.push(index);
156
157
  },
157
- onMouseLeave: () => {
158
- insideMemory.splice(_.findIndex(insideMemory, (i) => i === index), 1);
159
- },
160
- onClick: () => elementFocusable(target, index).focus(),
161
158
  children: target.component
162
159
  }
163
160
  ),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gustavo-valsechi/client",
3
- "version": "1.4.129",
3
+ "version": "1.4.131",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -26,7 +26,7 @@
26
26
  "dependencies": {
27
27
  "@emotion/is-prop-valid": "1.3.0",
28
28
  "@gustavo-valsechi/server": "1.0.13",
29
- "@gustavo-valsechi/utils": "1.0.4",
29
+ "@gustavo-valsechi/utils": "1.0.5",
30
30
  "@hookform/resolvers": "5.2.2",
31
31
  "apexcharts": "3.51.0",
32
32
  "lodash": "4.17.21",