@gustavo-valsechi/client 1.4.327 → 1.4.329
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/datetime/picker/index.js +2 -1
- package/dist/src/components/types/form/types/datetime/picker/index.mjs +2 -1
- package/dist/src/contexts/modal/index.js +3 -0
- package/dist/src/contexts/modal/index.mjs +3 -0
- package/dist/src/contexts/target/events/click.d.ts +1 -1
- package/dist/src/contexts/target/events/click.js +3 -1
- package/dist/src/contexts/target/events/click.mjs +3 -1
- package/dist/src/contexts/target/index.js +24 -4
- package/dist/src/contexts/target/index.mjs +24 -4
- package/dist/test/lab/index.d.ts +1 -0
- package/dist/test/{modal → lab/modal}/index.d.ts +1 -1
- package/dist/test/lab/tools/index.d.ts +1 -0
- package/dist/test/lab/tools/styles.d.ts +1 -0
- package/package.json +18 -18
- /package/dist/test/{modal → lab/modal}/styles.d.ts +0 -0
- /package/dist/test/{styles.d.ts → lab/styles.d.ts} +0 -0
|
@@ -45,8 +45,9 @@ var import_x_date_pickers = require("@mui/x-date-pickers");
|
|
|
45
45
|
var import_locales = require("@mui/x-date-pickers/locales");
|
|
46
46
|
var import_utils = __toESM(require("@gustavo-valsechi/utils"));
|
|
47
47
|
function InputDateTimePicker(props) {
|
|
48
|
+
var _a;
|
|
48
49
|
const theme = (0, import_contexts.useTheme)();
|
|
49
|
-
const [dateTime, setDateTime] = (0, import_react.useState)(import_utils.default.moment());
|
|
50
|
+
const [dateTime, setDateTime] = (0, import_react.useState)(import_utils.default.moment((_a = props.getValues) == null ? void 0 : _a.call(props, props.name)));
|
|
50
51
|
(0, import_react.useEffect)(() => {
|
|
51
52
|
if (!props.setValue) return;
|
|
52
53
|
props.setValue(props.name, import_utils.default.moment(dateTime.startOf("minutes").toDate()).format("YYYY-MM-DD HH:mm"));
|
|
@@ -12,8 +12,9 @@ import { StaticDateTimePicker, PickersLayout } from "@mui/x-date-pickers";
|
|
|
12
12
|
import { ptBR } from "@mui/x-date-pickers/locales";
|
|
13
13
|
import Utils from "@gustavo-valsechi/utils";
|
|
14
14
|
function InputDateTimePicker(props) {
|
|
15
|
+
var _a;
|
|
15
16
|
const theme = useTheme();
|
|
16
|
-
const [dateTime, setDateTime] = useState(Utils.moment());
|
|
17
|
+
const [dateTime, setDateTime] = useState(Utils.moment((_a = props.getValues) == null ? void 0 : _a.call(props, props.name)));
|
|
17
18
|
useEffect(() => {
|
|
18
19
|
if (!props.setValue) return;
|
|
19
20
|
props.setValue(props.name, Utils.moment(dateTime.startOf("minutes").toDate()).format("YYYY-MM-DD HH:mm"));
|
|
@@ -56,6 +56,9 @@ const ModalProviderContainer = ({ children }) => {
|
|
|
56
56
|
};
|
|
57
57
|
const remove = (modalName) => {
|
|
58
58
|
const removeModal = (name) => {
|
|
59
|
+
const index = import_lodash.default.findIndex(memory, (data) => data.name === name);
|
|
60
|
+
memory.splice(index, 1);
|
|
61
|
+
setModals(memory);
|
|
59
62
|
};
|
|
60
63
|
if (import_lodash.default.isArray(modalName)) {
|
|
61
64
|
import_lodash.default.forEach(modalName, (name) => removeModal(name));
|
|
@@ -22,6 +22,9 @@ const ModalProviderContainer = ({ children }) => {
|
|
|
22
22
|
};
|
|
23
23
|
const remove = (modalName) => {
|
|
24
24
|
const removeModal = (name) => {
|
|
25
|
+
const index = _.findIndex(memory, (data) => data.name === name);
|
|
26
|
+
memory.splice(index, 1);
|
|
27
|
+
setModals(memory);
|
|
25
28
|
};
|
|
26
29
|
if (_.isArray(modalName)) {
|
|
27
30
|
_.forEach(modalName, (name) => removeModal(name));
|
|
@@ -1,2 +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;
|
|
2
|
+
export declare const onClick: (target: ITargetConfig, index: number, close: (index: number) => void, addInside: (index: number) => void, focusable: HTMLElement, targetElement: HTMLElement, theme: IThemeContext, setModal: (value: number) => void) => void;
|
|
@@ -22,7 +22,8 @@ __export(click_exports, {
|
|
|
22
22
|
onClick: () => onClick
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(click_exports);
|
|
25
|
-
const onClick = (target, index, close, focusable, targetElement, theme, setModal) => {
|
|
25
|
+
const onClick = (target, index, close, addInside, focusable, targetElement, theme, setModal) => {
|
|
26
|
+
var _a;
|
|
26
27
|
if (theme.content.isMobile) {
|
|
27
28
|
setModal(index);
|
|
28
29
|
return;
|
|
@@ -32,6 +33,7 @@ const onClick = (target, index, close, focusable, targetElement, theme, setModal
|
|
|
32
33
|
close(index);
|
|
33
34
|
return;
|
|
34
35
|
}
|
|
36
|
+
if ((_a = target.toggleRef) == null ? void 0 : _a.current) addInside(index);
|
|
35
37
|
focusable.focus();
|
|
36
38
|
};
|
|
37
39
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const onClick = (target, index, close, focusable, targetElement, theme, setModal) => {
|
|
2
|
+
const onClick = (target, index, close, addInside, focusable, targetElement, theme, setModal) => {
|
|
3
|
+
var _a;
|
|
3
4
|
if (theme.content.isMobile) {
|
|
4
5
|
setModal(index);
|
|
5
6
|
return;
|
|
@@ -9,6 +10,7 @@ const onClick = (target, index, close, focusable, targetElement, theme, setModal
|
|
|
9
10
|
close(index);
|
|
10
11
|
return;
|
|
11
12
|
}
|
|
13
|
+
if ((_a = target.toggleRef) == null ? void 0 : _a.current) addInside(index);
|
|
12
14
|
focusable.focus();
|
|
13
15
|
};
|
|
14
16
|
export {
|
|
@@ -62,13 +62,30 @@ 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.addEventListener("click", () =>
|
|
65
|
+
toggleElement.addEventListener("click", () => {
|
|
66
|
+
(0, import_events.onClick)(target, index, close, addInside, focusable, targetElement, theme, setModal);
|
|
67
|
+
});
|
|
66
68
|
if (theme.content.isMobile) return;
|
|
67
69
|
toggleElement.addEventListener("mouseleave", () => removeInside(index));
|
|
68
70
|
focusable.addEventListener("focus", () => (0, import_events.onFocus)(target, index, open));
|
|
69
71
|
focusable.addEventListener("blur", () => (0, import_events.onBlur)(target, index, close, focusable, insideMemory));
|
|
70
72
|
});
|
|
71
73
|
}, [targets, inputRef, containerRef, theme.content.isMobile]);
|
|
74
|
+
(0, import_react.useEffect)(() => {
|
|
75
|
+
const observer = new MutationObserver((mutations) => {
|
|
76
|
+
for (const mutation of mutations) {
|
|
77
|
+
mutation.removedNodes.forEach((node) => {
|
|
78
|
+
if (!(node instanceof HTMLElement)) return;
|
|
79
|
+
const invalidTargets = import_lodash.default.filter(memory, (target) => !target.ref.current);
|
|
80
|
+
memory = import_lodash.default.filter(memory, (target) => !!target.ref.current);
|
|
81
|
+
insideMemory = invalidTargets.length ? [] : insideMemory;
|
|
82
|
+
setTargets([...memory]);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
87
|
+
return () => observer.disconnect();
|
|
88
|
+
}, []);
|
|
72
89
|
const getCoords = (target, component) => {
|
|
73
90
|
const rect = target.getBoundingClientRect();
|
|
74
91
|
const targetTop = rect.top + window.scrollY;
|
|
@@ -79,7 +96,7 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
79
96
|
top: targetTop + (target.offsetHeight + 5),
|
|
80
97
|
left: targetLeft - 0.5
|
|
81
98
|
};
|
|
82
|
-
if (targetBottom < component.offsetHeight) {
|
|
99
|
+
if (targetBottom < component.offsetHeight + 5) {
|
|
83
100
|
coords.top = targetTop - (component.offsetHeight + 5);
|
|
84
101
|
}
|
|
85
102
|
if (targetRight < component.offsetWidth - target.offsetWidth) {
|
|
@@ -95,13 +112,14 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
95
112
|
};
|
|
96
113
|
const close = (index) => {
|
|
97
114
|
const element = containerRef.current[index];
|
|
115
|
+
if (!element) return;
|
|
98
116
|
element.style.opacity = "0";
|
|
99
117
|
element.style.zIndex = "-1";
|
|
100
|
-
removeInside(index);
|
|
101
118
|
elementFocusable(memory[index], index).blur();
|
|
102
119
|
};
|
|
103
120
|
const open = (target, index) => {
|
|
104
121
|
const element = containerRef.current[index];
|
|
122
|
+
if (!element) return;
|
|
105
123
|
const coords = getCoords(target.ref.current, element);
|
|
106
124
|
element.style.top = `${coords.top}px`;
|
|
107
125
|
element.style.left = `${coords.left}px`;
|
|
@@ -129,6 +147,7 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
129
147
|
const closeTarget = (ref) => {
|
|
130
148
|
if (theme.content.isMobile) return setModal(-1);
|
|
131
149
|
const index = import_lodash.default.findIndex(memory, (data) => data.ref.current === ref.current);
|
|
150
|
+
removeInside(index);
|
|
132
151
|
close(index);
|
|
133
152
|
};
|
|
134
153
|
const isActive = (ref) => {
|
|
@@ -159,13 +178,14 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
159
178
|
{
|
|
160
179
|
className: "target-container",
|
|
161
180
|
ref: (element) => containerRef.current[index] = element,
|
|
181
|
+
onMouseEnter: () => addInside(index),
|
|
182
|
+
onClick: () => addInside(index),
|
|
162
183
|
onMouseLeave: () => {
|
|
163
184
|
removeInside(index);
|
|
164
185
|
const styles = window.getComputedStyle(containerRef.current[index]);
|
|
165
186
|
if (styles.opacity === "0") return;
|
|
166
187
|
elementFocusable(target, index).focus();
|
|
167
188
|
},
|
|
168
|
-
onMouseEnter: () => addInside(index),
|
|
169
189
|
children: target.component
|
|
170
190
|
}
|
|
171
191
|
),
|
|
@@ -28,13 +28,30 @@ 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.addEventListener("click", () =>
|
|
31
|
+
toggleElement.addEventListener("click", () => {
|
|
32
|
+
onClick(target, index, close, addInside, focusable, targetElement, theme, setModal);
|
|
33
|
+
});
|
|
32
34
|
if (theme.content.isMobile) return;
|
|
33
35
|
toggleElement.addEventListener("mouseleave", () => removeInside(index));
|
|
34
36
|
focusable.addEventListener("focus", () => onFocus(target, index, open));
|
|
35
37
|
focusable.addEventListener("blur", () => onBlur(target, index, close, focusable, insideMemory));
|
|
36
38
|
});
|
|
37
39
|
}, [targets, inputRef, containerRef, theme.content.isMobile]);
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
const observer = new MutationObserver((mutations) => {
|
|
42
|
+
for (const mutation of mutations) {
|
|
43
|
+
mutation.removedNodes.forEach((node) => {
|
|
44
|
+
if (!(node instanceof HTMLElement)) return;
|
|
45
|
+
const invalidTargets = _.filter(memory, (target) => !target.ref.current);
|
|
46
|
+
memory = _.filter(memory, (target) => !!target.ref.current);
|
|
47
|
+
insideMemory = invalidTargets.length ? [] : insideMemory;
|
|
48
|
+
setTargets([...memory]);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
53
|
+
return () => observer.disconnect();
|
|
54
|
+
}, []);
|
|
38
55
|
const getCoords = (target, component) => {
|
|
39
56
|
const rect = target.getBoundingClientRect();
|
|
40
57
|
const targetTop = rect.top + window.scrollY;
|
|
@@ -45,7 +62,7 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
45
62
|
top: targetTop + (target.offsetHeight + 5),
|
|
46
63
|
left: targetLeft - 0.5
|
|
47
64
|
};
|
|
48
|
-
if (targetBottom < component.offsetHeight) {
|
|
65
|
+
if (targetBottom < component.offsetHeight + 5) {
|
|
49
66
|
coords.top = targetTop - (component.offsetHeight + 5);
|
|
50
67
|
}
|
|
51
68
|
if (targetRight < component.offsetWidth - target.offsetWidth) {
|
|
@@ -61,13 +78,14 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
61
78
|
};
|
|
62
79
|
const close = (index) => {
|
|
63
80
|
const element = containerRef.current[index];
|
|
81
|
+
if (!element) return;
|
|
64
82
|
element.style.opacity = "0";
|
|
65
83
|
element.style.zIndex = "-1";
|
|
66
|
-
removeInside(index);
|
|
67
84
|
elementFocusable(memory[index], index).blur();
|
|
68
85
|
};
|
|
69
86
|
const open = (target, index) => {
|
|
70
87
|
const element = containerRef.current[index];
|
|
88
|
+
if (!element) return;
|
|
71
89
|
const coords = getCoords(target.ref.current, element);
|
|
72
90
|
element.style.top = `${coords.top}px`;
|
|
73
91
|
element.style.left = `${coords.left}px`;
|
|
@@ -95,6 +113,7 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
95
113
|
const closeTarget = (ref) => {
|
|
96
114
|
if (theme.content.isMobile) return setModal(-1);
|
|
97
115
|
const index = _.findIndex(memory, (data) => data.ref.current === ref.current);
|
|
116
|
+
removeInside(index);
|
|
98
117
|
close(index);
|
|
99
118
|
};
|
|
100
119
|
const isActive = (ref) => {
|
|
@@ -125,13 +144,14 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
125
144
|
{
|
|
126
145
|
className: "target-container",
|
|
127
146
|
ref: (element) => containerRef.current[index] = element,
|
|
147
|
+
onMouseEnter: () => addInside(index),
|
|
148
|
+
onClick: () => addInside(index),
|
|
128
149
|
onMouseLeave: () => {
|
|
129
150
|
removeInside(index);
|
|
130
151
|
const styles = window.getComputedStyle(containerRef.current[index]);
|
|
131
152
|
if (styles.opacity === "0") return;
|
|
132
153
|
elementFocusable(target, index).focus();
|
|
133
154
|
},
|
|
134
|
-
onMouseEnter: () => addInside(index),
|
|
135
155
|
children: target.component
|
|
136
156
|
}
|
|
137
157
|
),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function Lab(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { IModal } from "
|
|
1
|
+
import { IModal } from "../../../src/interfaces";
|
|
2
2
|
export default function Modal(props: IModal): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function LabTools(props: any): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Container: import("styled-components/dist/types").IStyledComponentBase<"web", any> & string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gustavo-valsechi/client",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.329",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@emotion/is-prop-valid": "1.3.0",
|
|
28
|
-
"@emotion/react": "
|
|
29
|
-
"@emotion/styled": "
|
|
28
|
+
"@emotion/react": "11.14.0",
|
|
29
|
+
"@emotion/styled": "11.14.1",
|
|
30
30
|
"@gustavo-valsechi/server": "1.0.13",
|
|
31
31
|
"@gustavo-valsechi/utils": "1.0.5",
|
|
32
32
|
"@hookform/resolvers": "5.2.2",
|
|
33
|
-
"@mui/material": "
|
|
33
|
+
"@mui/material": "7.3.7",
|
|
34
34
|
"@mui/x-date-pickers": "8.24.0",
|
|
35
35
|
"apexcharts": "3.51.0",
|
|
36
36
|
"dayjs": "1.11.19",
|
|
@@ -47,11 +47,11 @@
|
|
|
47
47
|
"zod-formik-adapter": "1.3.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@babel/core": "
|
|
51
|
-
"@babel/preset-env": "
|
|
52
|
-
"@babel/preset-react": "
|
|
53
|
-
"@babel/preset-typescript": "
|
|
54
|
-
"@svgr/webpack": "
|
|
50
|
+
"@babel/core": "7.28.6",
|
|
51
|
+
"@babel/preset-env": "7.28.6",
|
|
52
|
+
"@babel/preset-react": "7.28.5",
|
|
53
|
+
"@babel/preset-typescript": "7.28.5",
|
|
54
|
+
"@svgr/webpack": "8.1.0",
|
|
55
55
|
"@types/lodash": "4.17.7",
|
|
56
56
|
"@types/node": "22.0.2",
|
|
57
57
|
"@types/randomcolor": "0.5.9",
|
|
@@ -60,26 +60,26 @@
|
|
|
60
60
|
"@types/react-lottie": "1.2.10",
|
|
61
61
|
"@types/styled-components": "5.1.34",
|
|
62
62
|
"@vitejs/plugin-react": "5.1.0",
|
|
63
|
-
"babel-loader": "
|
|
64
|
-
"babel-plugin-styled-components": "
|
|
63
|
+
"babel-loader": "10.0.0",
|
|
64
|
+
"babel-plugin-styled-components": "2.1.4",
|
|
65
65
|
"baseline-browser-mapping": "2.9.14",
|
|
66
|
-
"css-loader": "
|
|
66
|
+
"css-loader": "7.1.2",
|
|
67
67
|
"esbuild": "0.25.11",
|
|
68
68
|
"esbuild-css-modules-plugin": "3.1.5",
|
|
69
|
-
"html-webpack-plugin": "
|
|
70
|
-
"process": "
|
|
69
|
+
"html-webpack-plugin": "5.6.5",
|
|
70
|
+
"process": "0.11.10",
|
|
71
71
|
"raw-loader": "4.0.2",
|
|
72
72
|
"react": "18.3.1",
|
|
73
73
|
"react-dom": "18.3.1",
|
|
74
74
|
"react-hot-toast": "2.4.1",
|
|
75
75
|
"rimraf": "6.1.0",
|
|
76
|
-
"style-loader": "
|
|
76
|
+
"style-loader": "4.0.0",
|
|
77
77
|
"styled-components": "6.1.12",
|
|
78
78
|
"tsc-alias": "1.8.16",
|
|
79
79
|
"typescript": "5.5.4",
|
|
80
|
-
"webpack": "
|
|
81
|
-
"webpack-cli": "
|
|
82
|
-
"webpack-dev-server": "
|
|
80
|
+
"webpack": "5.104.1",
|
|
81
|
+
"webpack-cli": "6.0.1",
|
|
82
|
+
"webpack-dev-server": "5.2.3"
|
|
83
83
|
},
|
|
84
84
|
"publishConfig": {
|
|
85
85
|
"access": "public"
|
|
File without changes
|
|
File without changes
|