@gustavo-valsechi/client 1.4.259 → 1.4.261
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/index.js +2 -1
- package/dist/src/components/types/form/index.mjs +2 -1
- package/dist/src/components/types/form/types/datetime/index.js +1 -5
- package/dist/src/components/types/form/types/datetime/index.mjs +1 -5
- package/dist/src/components/types/form/types/select/index.js +1 -5
- package/dist/src/components/types/form/types/select/index.mjs +1 -5
- package/dist/src/contexts/target/index.js +3 -2
- package/dist/src/contexts/target/index.mjs +3 -2
- package/dist/src/contexts/theme/content.js +1 -1
- package/dist/src/contexts/theme/content.mjs +1 -1
- package/dist/src/interfaces/components/form/button/index.d.ts +1 -1
- package/dist/src/interfaces/components/form/index.d.ts +4 -2
- package/dist/test/modal/index.d.ts +2 -0
- package/dist/test/modal/styles.d.ts +1 -0
- package/package.json +1 -1
|
@@ -72,7 +72,8 @@ function Form(props) {
|
|
|
72
72
|
} = (0, import_react_hook_form.useForm)({
|
|
73
73
|
resolver: (0, import_zod2.zodResolver)(schema),
|
|
74
74
|
defaultValues: props.defaultValues,
|
|
75
|
-
mode: "
|
|
75
|
+
mode: "onChange",
|
|
76
|
+
reValidateMode: "onChange"
|
|
76
77
|
});
|
|
77
78
|
(0, import_react.useEffect)(() => {
|
|
78
79
|
if (!props.clearWhen) return;
|
|
@@ -46,7 +46,6 @@ function InputDateTime(props) {
|
|
|
46
46
|
const toggleRef = (0, import_react.useRef)();
|
|
47
47
|
const target = (0, import_contexts.useTarget)();
|
|
48
48
|
const register = (props.register || ((name) => ({})))(props.name || "");
|
|
49
|
-
const isActive = target.isActive(inputRef);
|
|
50
49
|
(0, import_react.useEffect)(() => {
|
|
51
50
|
if (!inputRef.current || !toggleRef.current) return;
|
|
52
51
|
target.add({
|
|
@@ -57,6 +56,7 @@ function InputDateTime(props) {
|
|
|
57
56
|
buttons: [
|
|
58
57
|
{
|
|
59
58
|
label: "confirmar",
|
|
59
|
+
type: "button",
|
|
60
60
|
onClick: () => target.close(inputRef)
|
|
61
61
|
}
|
|
62
62
|
]
|
|
@@ -64,10 +64,6 @@ function InputDateTime(props) {
|
|
|
64
64
|
component: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_picker.default, { ...props })
|
|
65
65
|
});
|
|
66
66
|
}, [inputRef, toggleRef]);
|
|
67
|
-
(0, import_react.useEffect)(() => {
|
|
68
|
-
if (!isActive) return;
|
|
69
|
-
if (props.setError && props.name) props.setError(props.name, "");
|
|
70
|
-
}, [isActive]);
|
|
71
67
|
const onChange = (event) => {
|
|
72
68
|
var _a;
|
|
73
69
|
if (register.onChange) register.onChange(event);
|
|
@@ -13,7 +13,6 @@ function InputDateTime(props) {
|
|
|
13
13
|
const toggleRef = useRef();
|
|
14
14
|
const target = useTarget();
|
|
15
15
|
const register = (props.register || ((name) => ({})))(props.name || "");
|
|
16
|
-
const isActive = target.isActive(inputRef);
|
|
17
16
|
useEffect(() => {
|
|
18
17
|
if (!inputRef.current || !toggleRef.current) return;
|
|
19
18
|
target.add({
|
|
@@ -24,6 +23,7 @@ function InputDateTime(props) {
|
|
|
24
23
|
buttons: [
|
|
25
24
|
{
|
|
26
25
|
label: "confirmar",
|
|
26
|
+
type: "button",
|
|
27
27
|
onClick: () => target.close(inputRef)
|
|
28
28
|
}
|
|
29
29
|
]
|
|
@@ -31,10 +31,6 @@ function InputDateTime(props) {
|
|
|
31
31
|
component: /* @__PURE__ */ jsx(InputDateTimePicker, { ...props })
|
|
32
32
|
});
|
|
33
33
|
}, [inputRef, toggleRef]);
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
if (!isActive) return;
|
|
36
|
-
if (props.setError && props.name) props.setError(props.name, "");
|
|
37
|
-
}, [isActive]);
|
|
38
34
|
const onChange = (event) => {
|
|
39
35
|
var _a;
|
|
40
36
|
if (register.onChange) register.onChange(event);
|
|
@@ -51,7 +51,6 @@ function InputSelect(props) {
|
|
|
51
51
|
const register = (props.register || ((name) => ({})))(props.name || "");
|
|
52
52
|
const inputValue = ((_a = props.watch) == null ? void 0 : _a.call(props, props.name)) || "";
|
|
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
|
-
const isActive = target.isActive(inputRef);
|
|
55
54
|
(0, import_react.useEffect)(() => {
|
|
56
55
|
var _a2;
|
|
57
56
|
if (!(inputRef == null ? void 0 : inputRef.current) || !(containerRef == null ? void 0 : containerRef.current) || !Object.keys(props.options || {}).length) return;
|
|
@@ -73,13 +72,10 @@ function InputSelect(props) {
|
|
|
73
72
|
if (!inputRef.current || !inputValue) return;
|
|
74
73
|
target.close(inputRef);
|
|
75
74
|
}, [inputValue, inputRef]);
|
|
76
|
-
(0, import_react.useEffect)(() => {
|
|
77
|
-
if (!isActive) return;
|
|
78
|
-
if (props.setError && props.name) props.setError(props.name, "");
|
|
79
|
-
}, [isActive]);
|
|
80
75
|
const onBlur = (event) => {
|
|
81
76
|
setFocus(false);
|
|
82
77
|
setFilter("");
|
|
78
|
+
if (props.onBlur) props.onBlur(event);
|
|
83
79
|
if (register.onBlur) register.onBlur(event);
|
|
84
80
|
const optionsElement = document.getElementById(`input[${props.name}-options]`);
|
|
85
81
|
if (!optionsElement) return;
|
|
@@ -18,7 +18,6 @@ function InputSelect(props) {
|
|
|
18
18
|
const register = (props.register || ((name) => ({})))(props.name || "");
|
|
19
19
|
const inputValue = ((_a = props.watch) == null ? void 0 : _a.call(props, props.name)) || "";
|
|
20
20
|
const value = ((_b = props.options) == null ? void 0 : _b[inputValue]) || /* @__PURE__ */ jsx("div", { className: "input-label-value-placeholder", children: "selecione" });
|
|
21
|
-
const isActive = target.isActive(inputRef);
|
|
22
21
|
useEffect(() => {
|
|
23
22
|
var _a2;
|
|
24
23
|
if (!(inputRef == null ? void 0 : inputRef.current) || !(containerRef == null ? void 0 : containerRef.current) || !Object.keys(props.options || {}).length) return;
|
|
@@ -40,13 +39,10 @@ function InputSelect(props) {
|
|
|
40
39
|
if (!inputRef.current || !inputValue) return;
|
|
41
40
|
target.close(inputRef);
|
|
42
41
|
}, [inputValue, inputRef]);
|
|
43
|
-
useEffect(() => {
|
|
44
|
-
if (!isActive) return;
|
|
45
|
-
if (props.setError && props.name) props.setError(props.name, "");
|
|
46
|
-
}, [isActive]);
|
|
47
42
|
const onBlur = (event) => {
|
|
48
43
|
setFocus(false);
|
|
49
44
|
setFilter("");
|
|
45
|
+
if (props.onBlur) props.onBlur(event);
|
|
50
46
|
if (register.onBlur) register.onBlur(event);
|
|
51
47
|
const optionsElement = document.getElementById(`input[${props.name}-options]`);
|
|
52
48
|
if (!optionsElement) return;
|
|
@@ -51,9 +51,9 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
51
51
|
const [targets, setTargets] = (0, import_react.useState)([]);
|
|
52
52
|
const [modal, setModal] = (0, import_react.useState)(-1);
|
|
53
53
|
(0, import_react.useEffect)(() => {
|
|
54
|
-
if (!theme.content.isMobile) return;
|
|
55
54
|
const handleScroll = () => {
|
|
56
55
|
import_lodash.default.forEach(containerRef.current, (element, index) => {
|
|
56
|
+
console.log("handleScroll", insideMemory);
|
|
57
57
|
if (import_lodash.default.some(insideMemory, (i) => i === index)) return;
|
|
58
58
|
close(index);
|
|
59
59
|
});
|
|
@@ -88,7 +88,7 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
88
88
|
});
|
|
89
89
|
observer.disconnect();
|
|
90
90
|
};
|
|
91
|
-
}, [
|
|
91
|
+
}, [containerRef]);
|
|
92
92
|
(0, import_react.useEffect)(() => {
|
|
93
93
|
import_lodash.default.forEach(targets, (target, index) => {
|
|
94
94
|
var _a, _b;
|
|
@@ -162,6 +162,7 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
162
162
|
element.style.opacity = "0";
|
|
163
163
|
element.style.zIndex = "-1";
|
|
164
164
|
removeInside(index);
|
|
165
|
+
elementFocusable(memory[index], index).blur();
|
|
165
166
|
};
|
|
166
167
|
const open = (target, index) => {
|
|
167
168
|
const element = containerRef.current[index];
|
|
@@ -17,9 +17,9 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
17
17
|
const [targets, setTargets] = useState([]);
|
|
18
18
|
const [modal, setModal] = useState(-1);
|
|
19
19
|
useEffect(() => {
|
|
20
|
-
if (!theme.content.isMobile) return;
|
|
21
20
|
const handleScroll = () => {
|
|
22
21
|
_.forEach(containerRef.current, (element, index) => {
|
|
22
|
+
console.log("handleScroll", insideMemory);
|
|
23
23
|
if (_.some(insideMemory, (i) => i === index)) return;
|
|
24
24
|
close(index);
|
|
25
25
|
});
|
|
@@ -54,7 +54,7 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
54
54
|
});
|
|
55
55
|
observer.disconnect();
|
|
56
56
|
};
|
|
57
|
-
}, [
|
|
57
|
+
}, [containerRef]);
|
|
58
58
|
useEffect(() => {
|
|
59
59
|
_.forEach(targets, (target, index) => {
|
|
60
60
|
var _a, _b;
|
|
@@ -128,6 +128,7 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
128
128
|
element.style.opacity = "0";
|
|
129
129
|
element.style.zIndex = "-1";
|
|
130
130
|
removeInside(index);
|
|
131
|
+
elementFocusable(memory[index], index).blur();
|
|
131
132
|
};
|
|
132
133
|
const open = (target, index) => {
|
|
133
134
|
const element = containerRef.current[index];
|
|
@@ -29,7 +29,7 @@ const CommonTheme = {
|
|
|
29
29
|
tertiary: "#629dfd33",
|
|
30
30
|
positive: "#65c965",
|
|
31
31
|
negative: "#FF334E",
|
|
32
|
-
isMobile: 650 >= window.innerWidth,
|
|
32
|
+
isMobile: 650 >= (window == null ? void 0 : window.innerWidth),
|
|
33
33
|
mobileMaxWidth: "650px",
|
|
34
34
|
mobileMinWidth: "315px"
|
|
35
35
|
};
|
|
@@ -10,20 +10,21 @@ export * from "./datetime";
|
|
|
10
10
|
export * from "./textarea";
|
|
11
11
|
export * from "./custom";
|
|
12
12
|
export * from "./error";
|
|
13
|
+
export type IFormInput = IInputSelect | IInputCustom | IInputFile | IInputText | IInputDateTime | IInputTextarea;
|
|
13
14
|
export interface IForm {
|
|
14
15
|
defaultValues?: any;
|
|
15
16
|
validation?: (validations: z.ZodTypeAny) => z.ZodTypeAny;
|
|
16
17
|
formRef?: any;
|
|
17
18
|
onSubmit: (values: any, actions?: any) => void;
|
|
18
19
|
clearWhen?: boolean;
|
|
19
|
-
inputs: Array<
|
|
20
|
+
inputs: Array<IFormInput>;
|
|
20
21
|
buttons?: Array<IButton>;
|
|
21
22
|
}
|
|
22
23
|
export interface IInputBase {
|
|
23
24
|
className?: string;
|
|
24
25
|
label?: string;
|
|
25
26
|
id?: string;
|
|
26
|
-
name
|
|
27
|
+
name: string;
|
|
27
28
|
value?: string;
|
|
28
29
|
error?: string;
|
|
29
30
|
disabled?: boolean;
|
|
@@ -36,4 +37,5 @@ export interface IInputBase {
|
|
|
36
37
|
getValues?: (name?: string) => any;
|
|
37
38
|
onChange?: (event: any) => void;
|
|
38
39
|
onFocus?: (value: any) => void;
|
|
40
|
+
onBlur?: (value: any) => void;
|
|
39
41
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Container: import("styled-components/dist/types").IStyledComponentBase<"web", any> & string;
|