@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.
- package/dist/components/types/form/types/select/index.js +8 -1
- package/dist/components/types/form/types/select/index.mjs +8 -1
- package/dist/components/types/form/types/select/styles.js +1 -0
- package/dist/components/types/form/types/select/styles.mjs +1 -0
- package/dist/contexts/target/index.js +2 -2
- package/dist/contexts/target/index.mjs +2 -2
- package/package.json +1 -1
|
@@ -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.
|
|
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.
|
|
104
|
+
inputRef.current.focus();
|
|
98
105
|
},
|
|
99
106
|
children: [
|
|
100
107
|
/* @__PURE__ */ jsx("i", { "aria-hidden": true, className: "fa-solid fa-chevron-up" }),
|
|
@@ -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
|
});
|