@gustavo-valsechi/client 1.4.130 → 1.4.132

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.
@@ -85,6 +85,7 @@ function InputSelect(props) {
85
85
  if (!optionsElement) return;
86
86
  optionsElement.setAttribute("value", value2);
87
87
  };
88
+ console.log("focus", focus);
88
89
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styles.Container, { className: props.className, error: props.error, children: [
89
90
  !!props.label && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_label.InputLabel, { children: [
90
91
  props.label,
@@ -116,6 +117,7 @@ function InputSelect(props) {
116
117
  {
117
118
  className: "input-label-value",
118
119
  onClick: () => inputRef.current.click(),
120
+ "data-focus": focus,
119
121
  children: value
120
122
  }
121
123
  ),
@@ -124,10 +126,7 @@ function InputSelect(props) {
124
126
  {
125
127
  className: "input-icon",
126
128
  "data-focus": focus,
127
- onClick: () => {
128
- if (focus) return inputRef.current.blur();
129
- inputRef.current.click();
130
- },
129
+ onClick: () => inputRef.current.click(),
131
130
  children: [
132
131
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", { "aria-hidden": true, className: "fa-solid fa-chevron-up" }),
133
132
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", { "aria-hidden": true, className: "fa-solid fa-chevron-down" })
@@ -52,6 +52,7 @@ function InputSelect(props) {
52
52
  if (!optionsElement) return;
53
53
  optionsElement.setAttribute("value", value2);
54
54
  };
55
+ console.log("focus", focus);
55
56
  return /* @__PURE__ */ jsxs(Container, { className: props.className, error: props.error, children: [
56
57
  !!props.label && /* @__PURE__ */ jsxs(InputLabel, { children: [
57
58
  props.label,
@@ -83,6 +84,7 @@ function InputSelect(props) {
83
84
  {
84
85
  className: "input-label-value",
85
86
  onClick: () => inputRef.current.click(),
87
+ "data-focus": focus,
86
88
  children: value
87
89
  }
88
90
  ),
@@ -91,10 +93,7 @@ function InputSelect(props) {
91
93
  {
92
94
  className: "input-icon",
93
95
  "data-focus": focus,
94
- onClick: () => {
95
- if (focus) return inputRef.current.blur();
96
- inputRef.current.click();
97
- },
96
+ onClick: () => inputRef.current.click(),
98
97
  children: [
99
98
  /* @__PURE__ */ jsx("i", { "aria-hidden": true, className: "fa-solid fa-chevron-up" }),
100
99
  /* @__PURE__ */ jsx("i", { "aria-hidden": true, className: "fa-solid fa-chevron-down" })
@@ -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,10 @@ 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
+ return import_lodash.default.includes(normalize(text), normalize(filter));
60
59
  });
61
60
  setOptions(filtredOptions);
62
61
  }
@@ -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,10 @@ 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
+ return _.includes(normalize(text), normalize(filter));
27
26
  });
28
27
  setOptions(filtredOptions);
29
28
  }
@@ -60,6 +60,7 @@ const Container = import_styled_components.default.div`
60
60
 
61
61
  &:focus {
62
62
  cursor: text;
63
+ pointer-events: none;
63
64
  }
64
65
 
65
66
  &:disabled {
@@ -84,6 +85,10 @@ const Container = import_styled_components.default.div`
84
85
  padding: 0 1rem;
85
86
  display: flex;
86
87
  align-items: center;
88
+
89
+ &[data-focus="true"] {
90
+ pointer-events: none;
91
+ }
87
92
  }
88
93
 
89
94
  .input-icon {
@@ -27,6 +27,7 @@ const Container = styled.div`
27
27
 
28
28
  &:focus {
29
29
  cursor: text;
30
+ pointer-events: none;
30
31
  }
31
32
 
32
33
  &:disabled {
@@ -51,6 +52,10 @@ const Container = styled.div`
51
52
  padding: 0 1rem;
52
53
  display: flex;
53
54
  align-items: center;
55
+
56
+ &[data-focus="true"] {
57
+ pointer-events: none;
58
+ }
54
59
  }
55
60
 
56
61
  .input-icon {
@@ -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
+ elementFocusable(targets[index], index).blur();
59
59
  };
60
60
  const close = (index) => {
61
61
  const element = containerRef.current[index];
@@ -184,7 +184,7 @@ const TargetProviderContainer = ({ children }) => {
184
184
  {
185
185
  ref: (element) => containerRef.current[index] = element,
186
186
  onMouseLeave: () => insideMemory.splice(import_lodash.default.findIndex(insideMemory, (i) => i === index), 1),
187
- onMouseEnter: () => {
187
+ onMouseMove: () => {
188
188
  elementFocusable(target, index).focus();
189
189
  if (import_lodash.default.some(insideMemory, (i) => i === index)) return;
190
190
  insideMemory.push(index);
@@ -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
+ elementFocusable(targets[index], index).blur();
25
25
  };
26
26
  const close = (index) => {
27
27
  const element = containerRef.current[index];
@@ -150,7 +150,7 @@ const TargetProviderContainer = ({ children }) => {
150
150
  {
151
151
  ref: (element) => containerRef.current[index] = element,
152
152
  onMouseLeave: () => insideMemory.splice(_.findIndex(insideMemory, (i) => i === index), 1),
153
- onMouseEnter: () => {
153
+ onMouseMove: () => {
154
154
  elementFocusable(target, index).focus();
155
155
  if (_.some(insideMemory, (i) => i === index)) return;
156
156
  insideMemory.push(index);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gustavo-valsechi/client",
3
- "version": "1.4.130",
3
+ "version": "1.4.132",
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",