@gustavo-valsechi/client 1.4.88 → 1.4.90
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 +1 -2
- package/dist/components/types/form/types/select/index.mjs +1 -2
- package/dist/components/types/form/types/select/styles.js +5 -1
- package/dist/components/types/form/types/select/styles.mjs +5 -1
- package/dist/contexts/target/index.js +5 -12
- package/dist/contexts/target/index.mjs +5 -12
- package/package.json +1 -1
|
@@ -77,8 +77,7 @@ function InputSelect(props) {
|
|
|
77
77
|
...register,
|
|
78
78
|
onChange,
|
|
79
79
|
onFocus,
|
|
80
|
-
onBlur
|
|
81
|
-
focus
|
|
80
|
+
onBlur
|
|
82
81
|
}
|
|
83
82
|
),
|
|
84
83
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "input-icon", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", { "aria-hidden": true, className: focus ? "fa-solid fa-chevron-up" : "fa-solid fa-chevron-down" }) })
|
|
@@ -44,8 +44,7 @@ function InputSelect(props) {
|
|
|
44
44
|
...register,
|
|
45
45
|
onChange,
|
|
46
46
|
onFocus,
|
|
47
|
-
onBlur
|
|
48
|
-
focus
|
|
47
|
+
onBlur
|
|
49
48
|
}
|
|
50
49
|
),
|
|
51
50
|
/* @__PURE__ */ jsx("div", { className: "input-icon", children: /* @__PURE__ */ jsx("i", { "aria-hidden": true, className: focus ? "fa-solid fa-chevron-up" : "fa-solid fa-chevron-down" }) })
|
|
@@ -53,8 +53,12 @@ const Container = import_styled_components.default.div`
|
|
|
53
53
|
font-size: .8rem;
|
|
54
54
|
background-color: ${({ theme }) => theme.primary};
|
|
55
55
|
color: ${({ theme }) => theme.t6};
|
|
56
|
-
cursor:
|
|
56
|
+
cursor: pointer;
|
|
57
57
|
|
|
58
|
+
&:focus {
|
|
59
|
+
cursor: vertical-text;
|
|
60
|
+
}
|
|
61
|
+
|
|
58
62
|
&:disabled {
|
|
59
63
|
background-color: ${({ theme }) => theme.t2};
|
|
60
64
|
color: ${({ theme }) => theme.t6};
|
|
@@ -20,8 +20,12 @@ const Container = styled.div`
|
|
|
20
20
|
font-size: .8rem;
|
|
21
21
|
background-color: ${({ theme }) => theme.primary};
|
|
22
22
|
color: ${({ theme }) => theme.t6};
|
|
23
|
-
cursor:
|
|
23
|
+
cursor: pointer;
|
|
24
24
|
|
|
25
|
+
&:focus {
|
|
26
|
+
cursor: vertical-text;
|
|
27
|
+
}
|
|
28
|
+
|
|
25
29
|
&:disabled {
|
|
26
30
|
background-color: ${({ theme }) => theme.t2};
|
|
27
31
|
color: ${({ theme }) => theme.t6};
|
|
@@ -44,19 +44,10 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
44
44
|
const containerRef = (0, import_react.useRef)([]);
|
|
45
45
|
const [targets, setTargets] = (0, import_react.useState)([]);
|
|
46
46
|
const [inside, setInside] = (0, import_react.useState)(false);
|
|
47
|
-
const [show, setShow] = (0, import_react.useState)([]);
|
|
48
47
|
const elementFocusable = (target, index) => {
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"textarea",
|
|
53
|
-
"button",
|
|
54
|
-
"a[href]",
|
|
55
|
-
"[tabindex]",
|
|
56
|
-
"[contenteditable]"
|
|
57
|
-
];
|
|
58
|
-
const focusable = import_lodash.default.some(focusableSelectors, (sel) => target.ref.current.matches(sel));
|
|
59
|
-
if (focusable) return target.ref.current;
|
|
48
|
+
const focusableTags = ["input", "select", "textarea", "button"];
|
|
49
|
+
const isFocusable = import_lodash.default.some(focusableTags, (tag) => target.ref.current.tagName.toLowerCase() === tag);
|
|
50
|
+
if (isFocusable) return target.ref.current;
|
|
60
51
|
return inputRef.current[index];
|
|
61
52
|
};
|
|
62
53
|
const close = (element) => {
|
|
@@ -113,6 +104,8 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
113
104
|
element.addEventListener("click", () => {
|
|
114
105
|
const targetElement = import_lodash.default.find(containerRef.current, (data, i) => i === index);
|
|
115
106
|
if (!targetElement) return;
|
|
107
|
+
console.log("document.activeElement", document.activeElement);
|
|
108
|
+
console.log("elementFocusable", elementFocusable(target, index));
|
|
116
109
|
console.log("target focus", elementFocusable(target, index) === document.activeElement);
|
|
117
110
|
if (elementFocusable(target, index) === document.activeElement) {
|
|
118
111
|
close(targetElement);
|
|
@@ -10,19 +10,10 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
10
10
|
const containerRef = useRef([]);
|
|
11
11
|
const [targets, setTargets] = useState([]);
|
|
12
12
|
const [inside, setInside] = useState(false);
|
|
13
|
-
const [show, setShow] = useState([]);
|
|
14
13
|
const elementFocusable = (target, index) => {
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"textarea",
|
|
19
|
-
"button",
|
|
20
|
-
"a[href]",
|
|
21
|
-
"[tabindex]",
|
|
22
|
-
"[contenteditable]"
|
|
23
|
-
];
|
|
24
|
-
const focusable = _.some(focusableSelectors, (sel) => target.ref.current.matches(sel));
|
|
25
|
-
if (focusable) return target.ref.current;
|
|
14
|
+
const focusableTags = ["input", "select", "textarea", "button"];
|
|
15
|
+
const isFocusable = _.some(focusableTags, (tag) => target.ref.current.tagName.toLowerCase() === tag);
|
|
16
|
+
if (isFocusable) return target.ref.current;
|
|
26
17
|
return inputRef.current[index];
|
|
27
18
|
};
|
|
28
19
|
const close = (element) => {
|
|
@@ -79,6 +70,8 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
79
70
|
element.addEventListener("click", () => {
|
|
80
71
|
const targetElement = _.find(containerRef.current, (data, i) => i === index);
|
|
81
72
|
if (!targetElement) return;
|
|
73
|
+
console.log("document.activeElement", document.activeElement);
|
|
74
|
+
console.log("elementFocusable", elementFocusable(target, index));
|
|
82
75
|
console.log("target focus", elementFocusable(target, index) === document.activeElement);
|
|
83
76
|
if (elementFocusable(target, index) === document.activeElement) {
|
|
84
77
|
close(targetElement);
|