@gustavo-valsechi/client 1.4.279 → 1.4.281
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/src/components/types/form/types/select/index.js +1 -1
- package/dist/src/components/types/form/types/select/index.mjs +1 -1
- package/dist/src/components/types/form/types/select/options/index.js +5 -2
- package/dist/src/components/types/form/types/select/options/index.mjs +5 -2
- package/dist/src/components/types/form/types/select/options/styles.js +10 -0
- package/dist/src/components/types/form/types/select/options/styles.mjs +10 -0
- package/dist/src/contexts/target/events/blur.d.ts +2 -1
- package/dist/src/contexts/target/events/blur.js +0 -1
- package/dist/src/contexts/target/events/blur.mjs +0 -1
- package/dist/src/contexts/target/events/click.d.ts +2 -1
- package/dist/src/contexts/target/events/click.js +0 -1
- package/dist/src/contexts/target/events/click.mjs +0 -1
- package/dist/src/contexts/target/events/focus.d.ts +2 -1
- package/dist/src/contexts/target/events/focus.js +0 -1
- package/dist/src/contexts/target/events/focus.mjs +0 -1
- package/dist/src/contexts/target/events/scroll.d.ts +2 -1
- package/dist/src/contexts/target/events/scroll.js +3 -3
- package/dist/src/contexts/target/events/scroll.mjs +3 -3
- package/dist/src/contexts/target/index.js +1 -6
- package/dist/src/contexts/target/index.mjs +1 -6
- package/package.json +1 -1
|
@@ -53,7 +53,7 @@ function InputSelect(props) {
|
|
|
53
53
|
const value = ((_b = props.options) == null ? void 0 : _b[inputValue]) || /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "input-label-value-placeholder", children: "selecione" });
|
|
54
54
|
(0, import_react.useEffect)(() => {
|
|
55
55
|
var _a2;
|
|
56
|
-
if (!(inputRef == null ? void 0 : inputRef.current) || !(containerRef == null ? void 0 : containerRef.current)
|
|
56
|
+
if (!(inputRef == null ? void 0 : inputRef.current) || !(containerRef == null ? void 0 : containerRef.current)) return;
|
|
57
57
|
target.add({
|
|
58
58
|
ref: inputRef,
|
|
59
59
|
component: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -20,7 +20,7 @@ function InputSelect(props) {
|
|
|
20
20
|
const value = ((_b = props.options) == null ? void 0 : _b[inputValue]) || /* @__PURE__ */ jsx("div", { className: "input-label-value-placeholder", children: "selecione" });
|
|
21
21
|
useEffect(() => {
|
|
22
22
|
var _a2;
|
|
23
|
-
if (!(inputRef == null ? void 0 : inputRef.current) || !(containerRef == null ? void 0 : containerRef.current)
|
|
23
|
+
if (!(inputRef == null ? void 0 : inputRef.current) || !(containerRef == null ? void 0 : containerRef.current)) return;
|
|
24
24
|
target.add({
|
|
25
25
|
ref: inputRef,
|
|
26
26
|
component: /* @__PURE__ */ jsx(
|
|
@@ -71,7 +71,10 @@ function InputSelectOption(props) {
|
|
|
71
71
|
(0, import_react.useEffect)(() => {
|
|
72
72
|
const content = document.getElementById(`input[${props.name}-options-content-mask]`);
|
|
73
73
|
if (!content) return;
|
|
74
|
-
if (content.clientHeight === content.scrollHeight)
|
|
74
|
+
if (content.clientHeight === content.scrollHeight) {
|
|
75
|
+
content.style.maskImage = "initial";
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
75
78
|
const maskTop = "linear-gradient(to bottom, transparent, black 50%)";
|
|
76
79
|
const maskBottom = "linear-gradient(to bottom, black calc(100% - 50%), transparent)";
|
|
77
80
|
const maskTopBottom = "linear-gradient(to bottom, transparent, black 50%, black calc(100% - 50%), transparent)";
|
|
@@ -112,7 +115,7 @@ function InputSelectOption(props) {
|
|
|
112
115
|
{
|
|
113
116
|
id: `input[${props.name}-options-content-mask]`,
|
|
114
117
|
className: "input-option-content-mask",
|
|
115
|
-
children: import_lodash.default.map(
|
|
118
|
+
children: !Object.keys(options || {}).length ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "input-option empty", children: "Nenhuma op\xE7\xE3o encontrada" }) : import_lodash.default.map(
|
|
116
119
|
options,
|
|
117
120
|
(value, key) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
118
121
|
"div",
|
|
@@ -38,7 +38,10 @@ function InputSelectOption(props) {
|
|
|
38
38
|
useEffect(() => {
|
|
39
39
|
const content = document.getElementById(`input[${props.name}-options-content-mask]`);
|
|
40
40
|
if (!content) return;
|
|
41
|
-
if (content.clientHeight === content.scrollHeight)
|
|
41
|
+
if (content.clientHeight === content.scrollHeight) {
|
|
42
|
+
content.style.maskImage = "initial";
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
42
45
|
const maskTop = "linear-gradient(to bottom, transparent, black 50%)";
|
|
43
46
|
const maskBottom = "linear-gradient(to bottom, black calc(100% - 50%), transparent)";
|
|
44
47
|
const maskTopBottom = "linear-gradient(to bottom, transparent, black 50%, black calc(100% - 50%), transparent)";
|
|
@@ -79,7 +82,7 @@ function InputSelectOption(props) {
|
|
|
79
82
|
{
|
|
80
83
|
id: `input[${props.name}-options-content-mask]`,
|
|
81
84
|
className: "input-option-content-mask",
|
|
82
|
-
children: _.map(
|
|
85
|
+
children: !Object.keys(options || {}).length ? /* @__PURE__ */ jsx("div", { className: "input-option empty", children: "Nenhuma op\xE7\xE3o encontrada" }) : _.map(
|
|
83
86
|
options,
|
|
84
87
|
(value, key) => /* @__PURE__ */ jsx(
|
|
85
88
|
"div",
|
|
@@ -76,9 +76,19 @@ const Container = import_styled_components.default.div`
|
|
|
76
76
|
font-size: .8rem;
|
|
77
77
|
color: ${({ theme }) => theme.t6};
|
|
78
78
|
}
|
|
79
|
+
|
|
80
|
+
&.empty {
|
|
81
|
+
font-size: .8rem;
|
|
82
|
+
color: ${({ theme }) => theme.t4};
|
|
83
|
+
cursor: default;
|
|
84
|
+
}
|
|
79
85
|
|
|
80
86
|
&:hover {
|
|
81
87
|
background-color: ${({ theme }) => theme.t05};
|
|
88
|
+
|
|
89
|
+
&.empty {
|
|
90
|
+
background-color: transparent;
|
|
91
|
+
}
|
|
82
92
|
}
|
|
83
93
|
}
|
|
84
94
|
}
|
|
@@ -43,9 +43,19 @@ const Container = styled.div`
|
|
|
43
43
|
font-size: .8rem;
|
|
44
44
|
color: ${({ theme }) => theme.t6};
|
|
45
45
|
}
|
|
46
|
+
|
|
47
|
+
&.empty {
|
|
48
|
+
font-size: .8rem;
|
|
49
|
+
color: ${({ theme }) => theme.t4};
|
|
50
|
+
cursor: default;
|
|
51
|
+
}
|
|
46
52
|
|
|
47
53
|
&:hover {
|
|
48
54
|
background-color: ${({ theme }) => theme.t05};
|
|
55
|
+
|
|
56
|
+
&.empty {
|
|
57
|
+
background-color: transparent;
|
|
58
|
+
}
|
|
49
59
|
}
|
|
50
60
|
}
|
|
51
61
|
}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { ITargetConfig } from "../../../interfaces";
|
|
2
|
+
export declare const onBlur: (target: ITargetConfig, index: number, close: (index: number) => void, focusable: HTMLElement, insideMemory: Array<number>) => void;
|
|
@@ -35,7 +35,6 @@ module.exports = __toCommonJS(blur_exports);
|
|
|
35
35
|
var import_lodash = __toESM(require("lodash"));
|
|
36
36
|
const onBlur = (target, index, close, focusable, insideMemory) => {
|
|
37
37
|
if (import_lodash.default.some(insideMemory, (i) => i === index)) {
|
|
38
|
-
console.log("BLUR", target, index);
|
|
39
38
|
focusable.focus();
|
|
40
39
|
return;
|
|
41
40
|
}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { ITargetConfig, IThemeContext } from "../../../interfaces";
|
|
2
|
+
export declare const onClick: (target: ITargetConfig, index: number, close: (index: number) => void, focusable: HTMLElement, targetElement: HTMLElement, theme: IThemeContext, setModal: (value: number) => void) => void;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { ITargetConfig } from "../../../interfaces";
|
|
2
|
+
export declare const onFocus: (target: ITargetConfig, index: number, open: (target: ITargetConfig, index: number) => void) => void;
|
|
@@ -23,7 +23,6 @@ __export(focus_exports, {
|
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(focus_exports);
|
|
25
25
|
const onFocus = (target, index, open) => {
|
|
26
|
-
console.log("FOCUS", target, index);
|
|
27
26
|
open(target, index);
|
|
28
27
|
};
|
|
29
28
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { MutableRefObject } from "react";
|
|
2
|
+
export declare const onScroll: (close: (index: number) => void, containerRef: MutableRefObject<HTMLElement[]>) => () => void;
|
|
@@ -33,10 +33,10 @@ __export(scroll_exports, {
|
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(scroll_exports);
|
|
35
35
|
var import_lodash = __toESM(require("lodash"));
|
|
36
|
-
const onScroll = (close, containerRef
|
|
37
|
-
const handleScroll = () => {
|
|
36
|
+
const onScroll = (close, containerRef) => {
|
|
37
|
+
const handleScroll = (event) => {
|
|
38
38
|
import_lodash.default.forEach(containerRef.current, (element, index) => {
|
|
39
|
-
if (
|
|
39
|
+
if (element.contains(event.target)) return;
|
|
40
40
|
close(index);
|
|
41
41
|
});
|
|
42
42
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import _ from "lodash";
|
|
3
|
-
const onScroll = (close, containerRef
|
|
4
|
-
const handleScroll = () => {
|
|
3
|
+
const onScroll = (close, containerRef) => {
|
|
4
|
+
const handleScroll = (event) => {
|
|
5
5
|
_.forEach(containerRef.current, (element, index) => {
|
|
6
|
-
if (
|
|
6
|
+
if (element.contains(event.target)) return;
|
|
7
7
|
close(index);
|
|
8
8
|
});
|
|
9
9
|
};
|
|
@@ -52,7 +52,7 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
52
52
|
const [targets, setTargets] = (0, import_react.useState)([]);
|
|
53
53
|
const [modal, setModal] = (0, import_react.useState)(-1);
|
|
54
54
|
(0, import_react.useEffect)(() => {
|
|
55
|
-
(0, import_events.onScroll)(close, containerRef
|
|
55
|
+
(0, import_events.onScroll)(close, containerRef);
|
|
56
56
|
}, [containerRef]);
|
|
57
57
|
(0, import_react.useEffect)(() => {
|
|
58
58
|
import_lodash.default.forEach(targets, (target, index) => {
|
|
@@ -62,12 +62,8 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
62
62
|
if (!(toggleElement == null ? void 0 : toggleElement.addEventListener)) return;
|
|
63
63
|
const focusable = elementFocusable(target, index);
|
|
64
64
|
const targetElement = containerRef.current[index];
|
|
65
|
-
toggleElement.removeEventListener("click", () => (0, import_events.onClick)(target, index, close, focusable, targetElement, theme, setModal));
|
|
66
65
|
toggleElement.addEventListener("click", () => (0, import_events.onClick)(target, index, close, focusable, targetElement, theme, setModal));
|
|
67
66
|
if (theme.content.isMobile) return;
|
|
68
|
-
toggleElement.removeEventListener("mouseleave", () => removeInside(index));
|
|
69
|
-
focusable.removeEventListener("focus", () => (0, import_events.onFocus)(target, index, open));
|
|
70
|
-
focusable.removeEventListener("blur", () => (0, import_events.onBlur)(target, index, close, focusable, insideMemory));
|
|
71
67
|
toggleElement.addEventListener("mouseleave", () => removeInside(index));
|
|
72
68
|
focusable.addEventListener("focus", () => (0, import_events.onFocus)(target, index, open));
|
|
73
69
|
focusable.addEventListener("blur", () => (0, import_events.onBlur)(target, index, close, focusable, insideMemory));
|
|
@@ -137,7 +133,6 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
137
133
|
const add = (target) => {
|
|
138
134
|
const exists = import_lodash.default.find(memory, (data) => data.ref.current === target.ref.current);
|
|
139
135
|
if (exists) return;
|
|
140
|
-
console.log("memory", [...memory]);
|
|
141
136
|
memory.push(target);
|
|
142
137
|
setTargets([...memory]);
|
|
143
138
|
};
|
|
@@ -18,7 +18,7 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
18
18
|
const [targets, setTargets] = useState([]);
|
|
19
19
|
const [modal, setModal] = useState(-1);
|
|
20
20
|
useEffect(() => {
|
|
21
|
-
onScroll(close, containerRef
|
|
21
|
+
onScroll(close, containerRef);
|
|
22
22
|
}, [containerRef]);
|
|
23
23
|
useEffect(() => {
|
|
24
24
|
_.forEach(targets, (target, index) => {
|
|
@@ -28,12 +28,8 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
28
28
|
if (!(toggleElement == null ? void 0 : toggleElement.addEventListener)) return;
|
|
29
29
|
const focusable = elementFocusable(target, index);
|
|
30
30
|
const targetElement = containerRef.current[index];
|
|
31
|
-
toggleElement.removeEventListener("click", () => onClick(target, index, close, focusable, targetElement, theme, setModal));
|
|
32
31
|
toggleElement.addEventListener("click", () => onClick(target, index, close, focusable, targetElement, theme, setModal));
|
|
33
32
|
if (theme.content.isMobile) return;
|
|
34
|
-
toggleElement.removeEventListener("mouseleave", () => removeInside(index));
|
|
35
|
-
focusable.removeEventListener("focus", () => onFocus(target, index, open));
|
|
36
|
-
focusable.removeEventListener("blur", () => onBlur(target, index, close, focusable, insideMemory));
|
|
37
33
|
toggleElement.addEventListener("mouseleave", () => removeInside(index));
|
|
38
34
|
focusable.addEventListener("focus", () => onFocus(target, index, open));
|
|
39
35
|
focusable.addEventListener("blur", () => onBlur(target, index, close, focusable, insideMemory));
|
|
@@ -103,7 +99,6 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
103
99
|
const add = (target) => {
|
|
104
100
|
const exists = _.find(memory, (data) => data.ref.current === target.ref.current);
|
|
105
101
|
if (exists) return;
|
|
106
|
-
console.log("memory", [...memory]);
|
|
107
102
|
memory.push(target);
|
|
108
103
|
setTargets([...memory]);
|
|
109
104
|
};
|