@astral/ui 4.115.1 → 4.116.0
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/hook-form/EditableText/EditingForm/EditingForm.js +13 -8
- package/hook-form/EditableText/EditingForm/styles.d.ts +12 -10
- package/hook-form/EditableText/EditingForm/styles.js +20 -12
- package/hook-form/EditableText/EditingForm/useLogic/useLogic.d.ts +1 -0
- package/hook-form/EditableText/EditingForm/useLogic/useLogic.js +3 -0
- package/hook-form/EditableText/FormIconSubmitButton/FormIconSubmitButton.d.ts +3 -0
- package/hook-form/EditableText/FormIconSubmitButton/FormIconSubmitButton.js +7 -0
- package/hook-form/EditableText/FormIconSubmitButton/index.d.ts +1 -0
- package/hook-form/EditableText/FormIconSubmitButton/index.js +1 -0
- package/node/hook-form/EditableText/EditingForm/EditingForm.js +12 -7
- package/node/hook-form/EditableText/EditingForm/styles.d.ts +12 -10
- package/node/hook-form/EditableText/EditingForm/styles.js +20 -12
- package/node/hook-form/EditableText/EditingForm/useLogic/useLogic.d.ts +1 -0
- package/node/hook-form/EditableText/EditingForm/useLogic/useLogic.js +3 -0
- package/node/hook-form/EditableText/FormIconSubmitButton/FormIconSubmitButton.d.ts +3 -0
- package/node/hook-form/EditableText/FormIconSubmitButton/FormIconSubmitButton.js +11 -0
- package/node/hook-form/EditableText/FormIconSubmitButton/index.d.ts +1 -0
- package/node/hook-form/EditableText/FormIconSubmitButton/index.js +17 -0
- package/package.json +1 -1
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { IconButton } from '../../../components/IconButton';
|
|
3
|
+
import { CheckOutlineMd } from '../../../icons/CheckOutlineMd';
|
|
4
|
+
import { CrossOutlineMd } from '../../../icons/CrossOutlineMd';
|
|
2
5
|
import { Form } from '../../Form';
|
|
3
6
|
import { FormSubmitButton } from '../../FormSubmitButton';
|
|
4
7
|
import { FormTextField } from '../../FormTextField';
|
|
5
8
|
import { FIELD_NAME } from '../constants';
|
|
6
|
-
import {
|
|
9
|
+
import { FormIconSubmitButton } from '../FormIconSubmitButton';
|
|
10
|
+
import { Actions, Description, FieldContainer, FieldRow, FormFooter, Wrapper, } from './styles';
|
|
7
11
|
import { useLogic } from './useLogic';
|
|
8
12
|
// biome-ignore lint/complexity/noUselessTypeConstraint: Фикс типизация в тестах
|
|
9
13
|
export const EditingForm = (props) => {
|
|
10
|
-
const { formProps } = useLogic(props);
|
|
14
|
+
const { formProps, isMobile } = useLogic(props);
|
|
11
15
|
const { componentField = (fieldProps) => _jsx(FormTextField, { ...fieldProps }), onClose, } = props;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
const formFieldProps = {
|
|
17
|
+
name: FIELD_NAME,
|
|
18
|
+
control: formProps.form.control,
|
|
19
|
+
fullWidth: true,
|
|
20
|
+
autoFocus: true,
|
|
21
|
+
};
|
|
22
|
+
return (_jsx(Wrapper, { children: _jsxs(Form, { ...formProps, children: [_jsx(Description, { children: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043D\u043E\u0432\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0438 \u043D\u0430\u0436\u043C\u0438\u0442\u0435 \u00AB\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C\u00BB" }), _jsxs(FieldRow, { children: [_jsx(FieldContainer, { children: componentField(formFieldProps) }), !isMobile && (_jsxs(Actions, { children: [_jsx(FormIconSubmitButton, { variant: "outlined", size: "large", color: "success", "aria-label": "\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C", children: _jsx(CheckOutlineMd, {}) }), _jsx(IconButton, { variant: "outlined", size: "large", color: "grey", "aria-label": "\u041E\u0442\u043C\u0435\u043D\u0430", onClick: onClose, children: _jsx(CrossOutlineMd, {}) })] }))] }), isMobile && (_jsx(FormFooter, { children: _jsx(FormSubmitButton, { children: "\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C" }) }))] }) }));
|
|
18
23
|
};
|
|
@@ -14,17 +14,19 @@ export declare const Description: import("../../../components/styled").StyledCom
|
|
|
14
14
|
} & import("react").HTMLAttributes<HTMLParagraphElement> & import("react").RefAttributes<HTMLSpanElement> & {
|
|
15
15
|
theme?: import("@emotion/react").Theme | undefined;
|
|
16
16
|
}, {}, {}>;
|
|
17
|
+
export declare const FieldRow: import("../../../components/styled").StyledComponent<{
|
|
18
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
19
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
20
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
21
|
+
export declare const FieldContainer: import("../../../components/styled").StyledComponent<{
|
|
22
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
23
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
24
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
25
|
+
export declare const Actions: import("../../../components/styled").StyledComponent<{
|
|
26
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
27
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
28
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
17
29
|
export declare const FormFooter: import("../../../components/styled").StyledComponent<{
|
|
18
30
|
theme?: import("@emotion/react").Theme | undefined;
|
|
19
31
|
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
20
32
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, {}>;
|
|
21
|
-
export declare const CancelButton: import("../../../components/styled").StyledComponent<Omit<import("../../..").WithoutEmotionSpecific<import("@mui/material").ButtonProps>, "color" | "component" | "size" | "variant" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple"> & {
|
|
22
|
-
variant?: "light" | "link" | "text" | "contained" | "outlined" | undefined;
|
|
23
|
-
loading?: boolean | undefined;
|
|
24
|
-
color?: "primary" | "success" | "warning" | "error" | "grey" | undefined;
|
|
25
|
-
component?: import("react").ElementType | undefined;
|
|
26
|
-
selected?: boolean | undefined;
|
|
27
|
-
size?: "large" | "medium" | undefined;
|
|
28
|
-
} & Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, ""> & import("react").RefAttributes<HTMLButtonElement> & {
|
|
29
|
-
theme?: import("@emotion/react").Theme | undefined;
|
|
30
|
-
}, {}, {}>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { buttonClasses } from '../../../components/Button';
|
|
2
2
|
import { styled } from '../../../components/styled';
|
|
3
3
|
import { Typography } from '../../../components/Typography';
|
|
4
4
|
export const Wrapper = styled.div `
|
|
@@ -16,22 +16,30 @@ export const Description = styled(Typography) `
|
|
|
16
16
|
display: none;
|
|
17
17
|
}
|
|
18
18
|
`;
|
|
19
|
+
export const FieldRow = styled.div `
|
|
20
|
+
display: flex;
|
|
21
|
+
gap: ${({ theme }) => theme.spacing(5)};
|
|
22
|
+
align-items: flex-start;
|
|
23
|
+
`;
|
|
24
|
+
export const FieldContainer = styled.div `
|
|
25
|
+
flex: 1;
|
|
26
|
+
|
|
27
|
+
min-width: 0;
|
|
28
|
+
`;
|
|
29
|
+
export const Actions = styled.div `
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-shrink: 0;
|
|
32
|
+
gap: ${({ theme }) => theme.spacing(2)};
|
|
33
|
+
`;
|
|
19
34
|
export const FormFooter = styled.footer `
|
|
20
35
|
display: flex;
|
|
21
36
|
gap: ${({ theme }) => theme.spacing(3)};
|
|
22
37
|
justify-content: end;
|
|
23
38
|
|
|
24
|
-
${({ theme }) => theme.
|
|
25
|
-
padding-top: ${({ theme }) => theme.spacing(4)};
|
|
39
|
+
padding-top: ${({ theme }) => theme.spacing(4)};
|
|
26
40
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
`;
|
|
33
|
-
export const CancelButton = styled(Button) `
|
|
34
|
-
${({ theme }) => theme.breakpoints.down('mobile')} {
|
|
35
|
-
display: none;
|
|
41
|
+
& .${buttonClasses.root} {
|
|
42
|
+
width: 100%;
|
|
43
|
+
height: 48px;
|
|
36
44
|
}
|
|
37
45
|
`;
|
|
@@ -7,5 +7,6 @@ export declare const useLogic: <TValue>({ initialValue, children, validate, onCl
|
|
|
7
7
|
form: import("react-hook-form").UseFormReturn<FormValues, any>;
|
|
8
8
|
onSubmit: (e?: import("react").BaseSyntheticEvent<object, any, any> | undefined) => Promise<void | undefined>;
|
|
9
9
|
};
|
|
10
|
+
isMobile: boolean;
|
|
10
11
|
};
|
|
11
12
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
|
+
import { useViewportType } from '../../../../components/useViewportType';
|
|
2
3
|
import { useForm } from '../../../useForm';
|
|
3
4
|
import { FIELD_NAME } from '../../constants';
|
|
4
5
|
export const useLogic = ({ initialValue, children, validate, onClose, onSubmit, }) => {
|
|
@@ -45,10 +46,12 @@ export const useLogic = ({ initialValue, children, validate, onClose, onSubmit,
|
|
|
45
46
|
return onSubmit(fieldValue);
|
|
46
47
|
}
|
|
47
48
|
};
|
|
49
|
+
const { isMobile } = useViewportType();
|
|
48
50
|
return {
|
|
49
51
|
formProps: {
|
|
50
52
|
form,
|
|
51
53
|
onSubmit: form.handleSubmit(handleSubmit),
|
|
52
54
|
},
|
|
55
|
+
isMobile,
|
|
53
56
|
};
|
|
54
57
|
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type IconButtonProps } from '../../../components/IconButton';
|
|
2
|
+
export type FormIconSubmitButtonProps = Omit<IconButtonProps, 'type'>;
|
|
3
|
+
export declare const FormIconSubmitButton: ({ children, loading, ...props }: FormIconSubmitButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { IconButton, } from '../../../components/IconButton';
|
|
3
|
+
import { useFormContext } from '../../useFormContext';
|
|
4
|
+
export const FormIconSubmitButton = ({ children, loading, ...props }) => {
|
|
5
|
+
const { formState } = useFormContext();
|
|
6
|
+
return (_jsx(IconButton, { type: "submit", loading: loading || formState?.isSubmitting, ...props, children: children }));
|
|
7
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './FormIconSubmitButton';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './FormIconSubmitButton';
|
|
@@ -2,21 +2,26 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EditingForm = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const IconButton_1 = require("../../../components/IconButton");
|
|
6
|
+
const CheckOutlineMd_1 = require("../../../icons/CheckOutlineMd");
|
|
7
|
+
const CrossOutlineMd_1 = require("../../../icons/CrossOutlineMd");
|
|
5
8
|
const Form_1 = require("../../Form");
|
|
6
9
|
const FormSubmitButton_1 = require("../../FormSubmitButton");
|
|
7
10
|
const FormTextField_1 = require("../../FormTextField");
|
|
8
11
|
const constants_1 = require("../constants");
|
|
12
|
+
const FormIconSubmitButton_1 = require("../FormIconSubmitButton");
|
|
9
13
|
const styles_1 = require("./styles");
|
|
10
14
|
const useLogic_1 = require("./useLogic");
|
|
11
15
|
// biome-ignore lint/complexity/noUselessTypeConstraint: Фикс типизация в тестах
|
|
12
16
|
const EditingForm = (props) => {
|
|
13
|
-
const { formProps } = (0, useLogic_1.useLogic)(props);
|
|
17
|
+
const { formProps, isMobile } = (0, useLogic_1.useLogic)(props);
|
|
14
18
|
const { componentField = (fieldProps) => (0, jsx_runtime_1.jsx)(FormTextField_1.FormTextField, { ...fieldProps }), onClose, } = props;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
const formFieldProps = {
|
|
20
|
+
name: constants_1.FIELD_NAME,
|
|
21
|
+
control: formProps.form.control,
|
|
22
|
+
fullWidth: true,
|
|
23
|
+
autoFocus: true,
|
|
24
|
+
};
|
|
25
|
+
return ((0, jsx_runtime_1.jsx)(styles_1.Wrapper, { children: (0, jsx_runtime_1.jsxs)(Form_1.Form, { ...formProps, children: [(0, jsx_runtime_1.jsx)(styles_1.Description, { children: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043D\u043E\u0432\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0438 \u043D\u0430\u0436\u043C\u0438\u0442\u0435 \u00AB\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C\u00BB" }), (0, jsx_runtime_1.jsxs)(styles_1.FieldRow, { children: [(0, jsx_runtime_1.jsx)(styles_1.FieldContainer, { children: componentField(formFieldProps) }), !isMobile && ((0, jsx_runtime_1.jsxs)(styles_1.Actions, { children: [(0, jsx_runtime_1.jsx)(FormIconSubmitButton_1.FormIconSubmitButton, { variant: "outlined", size: "large", color: "success", "aria-label": "\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C", children: (0, jsx_runtime_1.jsx)(CheckOutlineMd_1.CheckOutlineMd, {}) }), (0, jsx_runtime_1.jsx)(IconButton_1.IconButton, { variant: "outlined", size: "large", color: "grey", "aria-label": "\u041E\u0442\u043C\u0435\u043D\u0430", onClick: onClose, children: (0, jsx_runtime_1.jsx)(CrossOutlineMd_1.CrossOutlineMd, {}) })] }))] }), isMobile && ((0, jsx_runtime_1.jsx)(styles_1.FormFooter, { children: (0, jsx_runtime_1.jsx)(FormSubmitButton_1.FormSubmitButton, { children: "\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C" }) }))] }) }));
|
|
21
26
|
};
|
|
22
27
|
exports.EditingForm = EditingForm;
|
|
@@ -14,17 +14,19 @@ export declare const Description: import("@emotion/styled/dist/declarations/src/
|
|
|
14
14
|
} & import("react").HTMLAttributes<HTMLParagraphElement> & import("react").RefAttributes<HTMLSpanElement> & {
|
|
15
15
|
theme?: import("@emotion/react").Theme | undefined;
|
|
16
16
|
}, {}, {}>;
|
|
17
|
+
export declare const FieldRow: import("@emotion/styled/dist/declarations/src/types").StyledComponent<{
|
|
18
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
19
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
20
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
21
|
+
export declare const FieldContainer: import("@emotion/styled/dist/declarations/src/types").StyledComponent<{
|
|
22
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
23
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
24
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
25
|
+
export declare const Actions: import("@emotion/styled/dist/declarations/src/types").StyledComponent<{
|
|
26
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
27
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
28
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
17
29
|
export declare const FormFooter: import("@emotion/styled/dist/declarations/src/types").StyledComponent<{
|
|
18
30
|
theme?: import("@emotion/react").Theme | undefined;
|
|
19
31
|
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
20
32
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, {}>;
|
|
21
|
-
export declare const CancelButton: import("@emotion/styled/dist/declarations/src/types").StyledComponent<Omit<import("../../..").WithoutEmotionSpecific<import("@mui/material").ButtonProps>, "color" | "component" | "size" | "variant" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple"> & {
|
|
22
|
-
variant?: "light" | "link" | "text" | "contained" | "outlined" | undefined;
|
|
23
|
-
loading?: boolean | undefined;
|
|
24
|
-
color?: "primary" | "success" | "warning" | "error" | "grey" | undefined;
|
|
25
|
-
component?: import("react").ElementType | undefined;
|
|
26
|
-
selected?: boolean | undefined;
|
|
27
|
-
size?: "large" | "medium" | undefined;
|
|
28
|
-
} & Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, ""> & import("react").RefAttributes<HTMLButtonElement> & {
|
|
29
|
-
theme?: import("@emotion/react").Theme | undefined;
|
|
30
|
-
}, {}, {}>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.FormFooter = exports.Actions = exports.FieldContainer = exports.FieldRow = exports.Description = exports.Wrapper = void 0;
|
|
4
4
|
const Button_1 = require("../../../components/Button");
|
|
5
5
|
const styled_1 = require("../../../components/styled");
|
|
6
6
|
const Typography_1 = require("../../../components/Typography");
|
|
@@ -19,22 +19,30 @@ exports.Description = (0, styled_1.styled)(Typography_1.Typography) `
|
|
|
19
19
|
display: none;
|
|
20
20
|
}
|
|
21
21
|
`;
|
|
22
|
+
exports.FieldRow = styled_1.styled.div `
|
|
23
|
+
display: flex;
|
|
24
|
+
gap: ${({ theme }) => theme.spacing(5)};
|
|
25
|
+
align-items: flex-start;
|
|
26
|
+
`;
|
|
27
|
+
exports.FieldContainer = styled_1.styled.div `
|
|
28
|
+
flex: 1;
|
|
29
|
+
|
|
30
|
+
min-width: 0;
|
|
31
|
+
`;
|
|
32
|
+
exports.Actions = styled_1.styled.div `
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-shrink: 0;
|
|
35
|
+
gap: ${({ theme }) => theme.spacing(2)};
|
|
36
|
+
`;
|
|
22
37
|
exports.FormFooter = styled_1.styled.footer `
|
|
23
38
|
display: flex;
|
|
24
39
|
gap: ${({ theme }) => theme.spacing(3)};
|
|
25
40
|
justify-content: end;
|
|
26
41
|
|
|
27
|
-
${({ theme }) => theme.
|
|
28
|
-
padding-top: ${({ theme }) => theme.spacing(4)};
|
|
42
|
+
padding-top: ${({ theme }) => theme.spacing(4)};
|
|
29
43
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
`;
|
|
36
|
-
exports.CancelButton = (0, styled_1.styled)(Button_1.Button) `
|
|
37
|
-
${({ theme }) => theme.breakpoints.down('mobile')} {
|
|
38
|
-
display: none;
|
|
44
|
+
& .${Button_1.buttonClasses.root} {
|
|
45
|
+
width: 100%;
|
|
46
|
+
height: 48px;
|
|
39
47
|
}
|
|
40
48
|
`;
|
|
@@ -7,5 +7,6 @@ export declare const useLogic: <TValue>({ initialValue, children, validate, onCl
|
|
|
7
7
|
form: import("react-hook-form").UseFormReturn<FormValues, any>;
|
|
8
8
|
onSubmit: (e?: import("react").BaseSyntheticEvent<object, any, any> | undefined) => Promise<void | undefined>;
|
|
9
9
|
};
|
|
10
|
+
isMobile: boolean;
|
|
10
11
|
};
|
|
11
12
|
export {};
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useLogic = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
+
const useViewportType_1 = require("../../../../components/useViewportType");
|
|
5
6
|
const useForm_1 = require("../../../useForm");
|
|
6
7
|
const constants_1 = require("../../constants");
|
|
7
8
|
const useLogic = ({ initialValue, children, validate, onClose, onSubmit, }) => {
|
|
@@ -48,11 +49,13 @@ const useLogic = ({ initialValue, children, validate, onClose, onSubmit, }) => {
|
|
|
48
49
|
return onSubmit(fieldValue);
|
|
49
50
|
}
|
|
50
51
|
};
|
|
52
|
+
const { isMobile } = (0, useViewportType_1.useViewportType)();
|
|
51
53
|
return {
|
|
52
54
|
formProps: {
|
|
53
55
|
form,
|
|
54
56
|
onSubmit: form.handleSubmit(handleSubmit),
|
|
55
57
|
},
|
|
58
|
+
isMobile,
|
|
56
59
|
};
|
|
57
60
|
};
|
|
58
61
|
exports.useLogic = useLogic;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type IconButtonProps } from '../../../components/IconButton';
|
|
2
|
+
export type FormIconSubmitButtonProps = Omit<IconButtonProps, 'type'>;
|
|
3
|
+
export declare const FormIconSubmitButton: ({ children, loading, ...props }: FormIconSubmitButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FormIconSubmitButton = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const IconButton_1 = require("../../../components/IconButton");
|
|
6
|
+
const useFormContext_1 = require("../../useFormContext");
|
|
7
|
+
const FormIconSubmitButton = ({ children, loading, ...props }) => {
|
|
8
|
+
const { formState } = (0, useFormContext_1.useFormContext)();
|
|
9
|
+
return ((0, jsx_runtime_1.jsx)(IconButton_1.IconButton, { type: "submit", loading: loading || formState?.isSubmitting, ...props, children: children }));
|
|
10
|
+
};
|
|
11
|
+
exports.FormIconSubmitButton = FormIconSubmitButton;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './FormIconSubmitButton';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./FormIconSubmitButton"), exports);
|