@gustavo-valsechi/client 1.4.135 → 1.4.138

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.
@@ -50,6 +50,12 @@ function InputSelect(props) {
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
52
  const value = ((_b = import_lodash.default.find(props.options, (option) => Object.keys(option)[0] === inputValue)) == null ? void 0 : _b[inputValue || ""]) || "";
53
+ (0, import_react.useEffect)(() => {
54
+ if (focus) return;
55
+ const optionsElement = document.getElementById("input-options");
56
+ if (!optionsElement) return;
57
+ optionsElement.setAttribute("value", "");
58
+ }, [focus]);
53
59
  (0, import_react.useEffect)(() => {
54
60
  var _a2;
55
61
  if (!(inputRef == null ? void 0 : inputRef.current) || !(containerRef == null ? void 0 : containerRef.current)) return;
@@ -126,8 +132,9 @@ function InputSelect(props) {
126
132
  className: "input-icon",
127
133
  "data-focus": focus,
128
134
  onClick: () => {
135
+ console.log(focus);
129
136
  if (focus) return;
130
- inputRef.current.click();
137
+ inputRef.current.focus();
131
138
  },
132
139
  children: [
133
140
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", { "aria-hidden": true, className: "fa-solid fa-chevron-up" }),
@@ -17,6 +17,12 @@ function InputSelect(props) {
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
19
  const value = ((_b = _.find(props.options, (option) => Object.keys(option)[0] === inputValue)) == null ? void 0 : _b[inputValue || ""]) || "";
20
+ useEffect(() => {
21
+ if (focus) return;
22
+ const optionsElement = document.getElementById("input-options");
23
+ if (!optionsElement) return;
24
+ optionsElement.setAttribute("value", "");
25
+ }, [focus]);
20
26
  useEffect(() => {
21
27
  var _a2;
22
28
  if (!(inputRef == null ? void 0 : inputRef.current) || !(containerRef == null ? void 0 : containerRef.current)) return;
@@ -93,8 +99,9 @@ function InputSelect(props) {
93
99
  className: "input-icon",
94
100
  "data-focus": focus,
95
101
  onClick: () => {
102
+ console.log(focus);
96
103
  if (focus) return;
97
- inputRef.current.click();
104
+ inputRef.current.focus();
98
105
  },
99
106
  children: [
100
107
  /* @__PURE__ */ jsx("i", { "aria-hidden": true, className: "fa-solid fa-chevron-up" }),
@@ -84,6 +84,7 @@ const Container = import_styled_components.default.div`
84
84
  padding: 0 1rem;
85
85
  display: flex;
86
86
  align-items: center;
87
+ user-select: none;
87
88
  }
88
89
 
89
90
  .input-icon {
@@ -51,6 +51,7 @@ const Container = styled.div`
51
51
  padding: 0 1rem;
52
52
  display: flex;
53
53
  align-items: center;
54
+ user-select: none;
54
55
  }
55
56
 
56
57
  .input-icon {
@@ -50,10 +50,8 @@ const TargetProviderContainer = ({ children }) => {
50
50
  if (isFocusable) return target.ref.current;
51
51
  return inputRef.current[index];
52
52
  };
53
- console.log("insideMemory", insideMemory);
54
53
  const blur = (index) => {
55
54
  insideMemory.splice(import_lodash.default.findIndex(insideMemory, (i) => i === index), 1);
56
- console.log("insideMemory in blur function", insideMemory);
57
55
  elementFocusable(targets[index], index).focus();
58
56
  elementFocusable(targets[index], index).blur();
59
57
  };
@@ -118,6 +116,7 @@ const TargetProviderContainer = ({ children }) => {
118
116
  const focusable = elementFocusable(target, index);
119
117
  const targetElement = containerRef.current[index];
120
118
  element.addEventListener("click", () => {
119
+ console.log("click", insideMemory);
121
120
  const styles = window.getComputedStyle(targetElement);
122
121
  if (styles.opacity === "1") {
123
122
  blur(index);
@@ -132,6 +131,7 @@ const TargetProviderContainer = ({ children }) => {
132
131
  open(target, index);
133
132
  });
134
133
  focusable.addEventListener("blur", () => {
134
+ console.log("blur", insideMemory);
135
135
  if (import_lodash.default.some(insideMemory, (i) => i === index)) return;
136
136
  close(index);
137
137
  });
@@ -16,10 +16,8 @@ const TargetProviderContainer = ({ children }) => {
16
16
  if (isFocusable) return target.ref.current;
17
17
  return inputRef.current[index];
18
18
  };
19
- console.log("insideMemory", insideMemory);
20
19
  const blur = (index) => {
21
20
  insideMemory.splice(_.findIndex(insideMemory, (i) => i === index), 1);
22
- console.log("insideMemory in blur function", insideMemory);
23
21
  elementFocusable(targets[index], index).focus();
24
22
  elementFocusable(targets[index], index).blur();
25
23
  };
@@ -84,6 +82,7 @@ const TargetProviderContainer = ({ children }) => {
84
82
  const focusable = elementFocusable(target, index);
85
83
  const targetElement = containerRef.current[index];
86
84
  element.addEventListener("click", () => {
85
+ console.log("click", insideMemory);
87
86
  const styles = window.getComputedStyle(targetElement);
88
87
  if (styles.opacity === "1") {
89
88
  blur(index);
@@ -98,6 +97,7 @@ const TargetProviderContainer = ({ children }) => {
98
97
  open(target, index);
99
98
  });
100
99
  focusable.addEventListener("blur", () => {
100
+ console.log("blur", insideMemory);
101
101
  if (_.some(insideMemory, (i) => i === index)) return;
102
102
  close(index);
103
103
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gustavo-valsechi/client",
3
- "version": "1.4.135",
3
+ "version": "1.4.138",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",