@astral/ui 4.37.2 → 4.39.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/components/Button/Button.js +2 -8
- package/components/Button/constants.d.ts +12 -0
- package/components/Button/constants.js +9 -0
- package/components/Button/useLogic/useLogic.d.ts +2 -1
- package/components/Button/useLogic/useLogic.js +12 -3
- package/components/NotFoundPage/styles.js +1 -1
- package/components/PageAside/styles.js +2 -3
- package/components/PageContent/PageContentHeader/styles.js +3 -1
- package/components/PageContent/styles.js +8 -0
- package/components/PageHeader/constants.d.ts +1 -0
- package/components/PageHeader/constants.js +1 -0
- package/components/PageHeader/styles.js +12 -0
- package/components/PageHeader/useLogic/useLogic.d.ts +1 -1
- package/components/PageHeader/useLogic/useLogic.js +2 -1
- package/components/PageLayout/PageLayout.js +5 -2
- package/components/PageLayoutContainer/constants.d.ts +1 -0
- package/components/PageLayoutContainer/constants.js +1 -0
- package/components/PageLayoutContainer/styles.js +5 -0
- package/components/PagePinnableAside/styles.js +1 -0
- package/hook-form/FormPageLayoutBase/styles.js +4 -3
- package/node/components/Button/Button.js +2 -8
- package/node/components/Button/constants.d.ts +12 -0
- package/node/components/Button/constants.js +10 -1
- package/node/components/Button/useLogic/useLogic.d.ts +2 -1
- package/node/components/Button/useLogic/useLogic.js +11 -2
- package/node/components/NotFoundPage/styles.js +1 -1
- package/node/components/PageAside/styles.js +2 -3
- package/node/components/PageContent/PageContentHeader/styles.js +3 -1
- package/node/components/PageContent/styles.js +13 -5
- package/node/components/PageHeader/constants.d.ts +1 -0
- package/node/components/PageHeader/constants.js +1 -0
- package/node/components/PageHeader/styles.js +12 -0
- package/node/components/PageHeader/useLogic/useLogic.d.ts +1 -1
- package/node/components/PageHeader/useLogic/useLogic.js +2 -1
- package/node/components/PageLayout/PageLayout.js +4 -1
- package/node/components/PageLayoutContainer/constants.d.ts +1 -0
- package/node/components/PageLayoutContainer/constants.js +1 -0
- package/node/components/PageLayoutContainer/styles.js +5 -0
- package/node/components/PagePinnableAside/styles.js +1 -0
- package/node/hook-form/FormPageLayoutBase/styles.js +4 -3
- package/package.json +1 -1
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRefWithGeneric } from '../forwardRefWithGeneric';
|
|
3
|
-
import { classNames } from '../utils/classNames';
|
|
4
|
-
import { buttonClassnames } from './constants';
|
|
5
3
|
import { ButtonColors, ButtonVariants } from './enums';
|
|
6
4
|
import { StyledButton, StyledLoader } from './styles';
|
|
7
5
|
import { useLogic } from './useLogic';
|
|
8
6
|
const UnwrappedButton = (props, ref) => {
|
|
9
|
-
const { loadingIndicatorColor } = useLogic(props);
|
|
7
|
+
const { loadingIndicatorColor, classnames } = useLogic(props);
|
|
10
8
|
const { variant = ButtonVariants.Contained, color = variant === ButtonVariants.Text
|
|
11
9
|
? ButtonColors.Grey
|
|
12
10
|
: ButtonColors.Primary, loading, disabled, children, className, selected, ...restProps } = props;
|
|
13
|
-
return (_jsxs(StyledButton, { variant: variant, ref: ref, color: color, disabled: disabled || loading, selected: selected, ...restProps, className:
|
|
14
|
-
[buttonClassnames.loading]: loading,
|
|
15
|
-
[buttonClassnames.selected]: selected,
|
|
16
|
-
[buttonClassnames.disabled]: disabled,
|
|
17
|
-
}), "aria-disabled": loading, children: [loading && (_jsx(StyledLoader, { color: loadingIndicatorColor, size: "small", "$color": color, "$variant": variant, "$isDisabled": disabled })), children] }));
|
|
11
|
+
return (_jsxs(StyledButton, { variant: variant, ref: ref, color: color, disabled: disabled || loading, selected: selected, ...restProps, className: classnames, "aria-disabled": loading, children: [loading && (_jsx(StyledLoader, { color: loadingIndicatorColor, size: "small", "$color": color, "$variant": variant, "$isDisabled": disabled })), children] }));
|
|
18
12
|
};
|
|
19
13
|
export const Button = forwardRefWithGeneric(UnwrappedButton);
|
|
20
14
|
export default Button;
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
export { buttonClasses } from '@mui/material/Button';
|
|
2
|
+
export declare const buttonColorClassnames: {
|
|
3
|
+
primary: string;
|
|
4
|
+
error: string;
|
|
5
|
+
success: string;
|
|
6
|
+
warning: string;
|
|
7
|
+
grey: string;
|
|
8
|
+
};
|
|
2
9
|
export declare const buttonClassnames: {
|
|
10
|
+
primary: string;
|
|
11
|
+
error: string;
|
|
12
|
+
success: string;
|
|
13
|
+
warning: string;
|
|
14
|
+
grey: string;
|
|
3
15
|
root: string;
|
|
4
16
|
loading: string;
|
|
5
17
|
selected: string;
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import { createUIKitClassname } from '../utils/createUIKitClassname';
|
|
2
|
+
import { ButtonColors } from './enums';
|
|
2
3
|
export { buttonClasses } from '@mui/material/Button';
|
|
4
|
+
export const buttonColorClassnames = {
|
|
5
|
+
[ButtonColors.Primary]: createUIKitClassname('button_color-primary'),
|
|
6
|
+
[ButtonColors.Error]: createUIKitClassname('button_color-error'),
|
|
7
|
+
[ButtonColors.Success]: createUIKitClassname('button_color-success'),
|
|
8
|
+
[ButtonColors.Warning]: createUIKitClassname('button_color-warning'),
|
|
9
|
+
[ButtonColors.Grey]: createUIKitClassname('button_color-grey'),
|
|
10
|
+
};
|
|
3
11
|
export const buttonClassnames = {
|
|
4
12
|
root: createUIKitClassname('button'),
|
|
5
13
|
loading: createUIKitClassname('button_loading'),
|
|
6
14
|
selected: createUIKitClassname('button_selected'),
|
|
7
15
|
disabled: createUIKitClassname('button_disabled'),
|
|
16
|
+
...buttonColorClassnames,
|
|
8
17
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { type ButtonProps } from '../types';
|
|
2
2
|
type UseLogicParam = ButtonProps;
|
|
3
3
|
type Color = 'primary' | 'inverted';
|
|
4
|
-
export declare const useLogic: ({ variant, }: UseLogicParam) => {
|
|
4
|
+
export declare const useLogic: ({ loading, selected, variant, color, disabled, className, }: UseLogicParam) => {
|
|
5
5
|
loadingIndicatorColor: Color;
|
|
6
|
+
classnames: string;
|
|
6
7
|
};
|
|
7
8
|
export {};
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { classNames } from '../../utils/classNames';
|
|
3
|
+
import { buttonClassnames, buttonColorClassnames } from '../constants';
|
|
4
|
+
import { ButtonColors, ButtonVariants } from '../enums';
|
|
5
|
+
export const useLogic = ({ loading, selected, variant = ButtonVariants.Contained, color = variant === ButtonVariants.Text
|
|
6
|
+
? ButtonColors.Grey
|
|
7
|
+
: ButtonColors.Primary, disabled, className, }) => {
|
|
4
8
|
const loadingIndicatorColor = useMemo(() => {
|
|
5
9
|
if (variant !== ButtonVariants.Contained) {
|
|
6
10
|
return 'primary';
|
|
7
11
|
}
|
|
8
12
|
return 'inverted';
|
|
9
13
|
}, [variant]);
|
|
10
|
-
|
|
14
|
+
const classnames = useMemo(() => classNames(buttonClassnames.root, buttonColorClassnames[color], className, {
|
|
15
|
+
[buttonClassnames.loading]: loading,
|
|
16
|
+
[buttonClassnames.disabled]: disabled,
|
|
17
|
+
[buttonClassnames.selected]: selected,
|
|
18
|
+
}), [loading, selected, color, className, disabled]);
|
|
19
|
+
return { loadingIndicatorColor, classnames };
|
|
11
20
|
};
|
|
@@ -22,9 +22,8 @@ export const Wrapper = styled.aside `
|
|
|
22
22
|
width: unset;
|
|
23
23
|
margin: ${({ theme }) => theme.spacing(0, 4, 4)};
|
|
24
24
|
|
|
25
|
-
background-color: ${({ theme }) => theme.palette.background.default};
|
|
26
|
-
border
|
|
27
|
-
border-left: 0;
|
|
25
|
+
background-color: ${({ theme }) => theme.palette.background.default};
|
|
26
|
+
border: 1px solid ${({ theme }) => theme.palette.grey[300]};
|
|
28
27
|
border-radius: ${({ theme }) => theme.shape.medium};
|
|
29
28
|
}
|
|
30
29
|
`;
|
|
@@ -8,11 +8,13 @@ export const Wrapper = styled.header `
|
|
|
8
8
|
padding: ${({ theme }) => theme.spacing(4, 6)};
|
|
9
9
|
|
|
10
10
|
border-bottom: 1px solid ${({ theme }) => theme.palette.grey[300]};
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
13
13
|
margin: ${({ theme }) => theme.spacing(0, 4)};
|
|
14
14
|
|
|
15
15
|
background-color: ${({ theme }) => theme.palette.background.default};
|
|
16
|
+
border: 1px solid ${({ theme }) => theme.palette.grey[300]};
|
|
17
|
+
border-bottom: none;
|
|
16
18
|
border-top-left-radius: ${({ theme }) => theme.shape.medium};
|
|
17
19
|
border-top-right-radius: ${({ theme }) => theme.shape.medium};
|
|
18
20
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { cardGridClassnames } from '../CardGridInfinite/constants';
|
|
1
2
|
import { pdfViewerClassnames } from '../PdfViewer';
|
|
2
3
|
import { styled } from '../styled';
|
|
3
4
|
import { PAGE_CONTENT_ANIMATION, pageContentClassnames } from './constants';
|
|
@@ -74,8 +75,15 @@ export const Content = styled.div `
|
|
|
74
75
|
padding: ${({ theme }) => theme.spacing(4, 4, 3)};
|
|
75
76
|
|
|
76
77
|
background-color: ${({ theme }) => theme.palette.background.default};
|
|
78
|
+
border: 1px solid ${({ theme }) => theme.palette.grey[300]};
|
|
77
79
|
border-radius: ${({ theme }) => theme.shape.medium};
|
|
78
80
|
|
|
81
|
+
/* Причина игнора: Не критично для отображения */
|
|
82
|
+
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
83
|
+
&:has(.${cardGridClassnames.root}) {
|
|
84
|
+
border: none;
|
|
85
|
+
}
|
|
86
|
+
|
|
79
87
|
&.${pageContentClassnames.contentHasHeader} {
|
|
80
88
|
border-top-left-radius: 0;
|
|
81
89
|
border-top-right-radius: 0;
|
|
@@ -6,5 +6,6 @@ export const pageHeaderClassnames = {
|
|
|
6
6
|
hasTitle: createUIKitClassname('page-header_has-title'),
|
|
7
7
|
filters: createUIKitClassname('page-header__filters'),
|
|
8
8
|
quickFilters: createUIKitClassname('page-header__quick-filters'),
|
|
9
|
+
hasFilters: createUIKitClassname('page-header_has-filters'),
|
|
9
10
|
};
|
|
10
11
|
export const PAGE_HEADER_HEIGHT_MOBILE = '48px';
|
|
@@ -15,6 +15,10 @@ export const Wrapper = styled.header `
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
18
|
+
position: sticky;
|
|
19
|
+
z-index: ${({ theme }) => theme.zIndex.fab};
|
|
20
|
+
top: ${PAGE_HEADER_HEIGHT_MOBILE};
|
|
21
|
+
|
|
18
22
|
display: block;
|
|
19
23
|
|
|
20
24
|
margin-bottom: ${({ theme }) => theme.spacing(4)};
|
|
@@ -31,6 +35,10 @@ export const Wrapper = styled.header `
|
|
|
31
35
|
grid-column: 3;
|
|
32
36
|
grid-row: 1 / -1;
|
|
33
37
|
}
|
|
38
|
+
|
|
39
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
40
|
+
border-bottom: 1px solid ${({ theme }) => theme.palette.grey[300]};
|
|
41
|
+
}
|
|
34
42
|
}
|
|
35
43
|
|
|
36
44
|
.${pageHeaderClassnames.quickFilters} {
|
|
@@ -60,6 +68,10 @@ export const MobileTitleWrapper = styled.div `
|
|
|
60
68
|
order: 1;
|
|
61
69
|
|
|
62
70
|
background-color: ${({ theme }) => theme.palette.background.default};
|
|
71
|
+
|
|
72
|
+
&:not(.${pageHeaderClassnames.hasFilters}) {
|
|
73
|
+
border-bottom: 1px solid ${({ theme }) => theme.palette.grey[300]};
|
|
74
|
+
}
|
|
63
75
|
|
|
64
76
|
&.${pageHeaderClassnames.hasTitle} {
|
|
65
77
|
display: flex;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ElementType } from 'react';
|
|
2
2
|
import type { PageHeaderProps } from '../types';
|
|
3
3
|
type UseLogicParams<TMainActionComponent extends ElementType = ElementType, TSecondaryActionComponent extends ElementType = ElementType, TBackButtonComponent extends ElementType = ElementType> = PageHeaderProps<TMainActionComponent, TSecondaryActionComponent, TBackButtonComponent>;
|
|
4
|
-
export declare const useLogic: <TMainActionComponent extends ElementType = ElementType, TSecondaryActionComponent extends ElementType = ElementType, TBackButtonComponent extends ElementType = ElementType>({ shouldUpdateDocumentTitle, title, actions, htmlTitle, backButton, }: UseLogicParams<TMainActionComponent, TSecondaryActionComponent, TBackButtonComponent>) => {
|
|
4
|
+
export declare const useLogic: <TMainActionComponent extends ElementType = ElementType, TSecondaryActionComponent extends ElementType = ElementType, TBackButtonComponent extends ElementType = ElementType>({ shouldUpdateDocumentTitle, title, actions, htmlTitle, backButton, filters, }: UseLogicParams<TMainActionComponent, TSecondaryActionComponent, TBackButtonComponent>) => {
|
|
5
5
|
isShowMobileActions: boolean | undefined;
|
|
6
6
|
isLoading: boolean | undefined;
|
|
7
7
|
mobileTitleActions: import("react").ReactNode;
|
|
@@ -3,7 +3,7 @@ import { PageContext } from '../../PageContext';
|
|
|
3
3
|
import { classNames } from '../../utils/classNames';
|
|
4
4
|
import { pageHeaderClassnames } from '../constants';
|
|
5
5
|
import { usePageTitle } from '../hooks/usePageTitle';
|
|
6
|
-
export const useLogic = ({ shouldUpdateDocumentTitle, title, actions, htmlTitle, backButton, }) => {
|
|
6
|
+
export const useLogic = ({ shouldUpdateDocumentTitle, title, actions, htmlTitle, backButton, filters, }) => {
|
|
7
7
|
//Переопределение Html title на title из параметров
|
|
8
8
|
usePageTitle({ shouldUpdateDocumentTitle, htmlTitle, title });
|
|
9
9
|
const { mobileTitleActions, isLoading } = useContext(PageContext);
|
|
@@ -11,6 +11,7 @@ export const useLogic = ({ shouldUpdateDocumentTitle, title, actions, htmlTitle,
|
|
|
11
11
|
const mobileClassnames = useMemo(() => classNames(pageHeaderClassnames.pageHeaderMobileTitle, {
|
|
12
12
|
[pageHeaderClassnames.hasTitle]: Boolean(title) || isLoading,
|
|
13
13
|
[pageHeaderClassnames.hasBackButton]: Boolean(backButton),
|
|
14
|
+
[pageHeaderClassnames.hasFilters]: Boolean(filters),
|
|
14
15
|
}), [title, backButton, isLoading]);
|
|
15
16
|
return {
|
|
16
17
|
isShowMobileActions,
|
|
@@ -4,14 +4,17 @@ import { PageAside } from '../PageAside';
|
|
|
4
4
|
import { PageContent } from '../PageContent';
|
|
5
5
|
import { PageContextProvider } from '../PageContext';
|
|
6
6
|
import { PageHeader } from '../PageHeader';
|
|
7
|
-
import { PageLayoutContainer } from '../PageLayoutContainer';
|
|
7
|
+
import { PageLayoutContainer, pageLayoutClassnames, } from '../PageLayoutContainer';
|
|
8
8
|
import { LoadingPlaceholder } from '../placeholders/LoadingPlaceholder';
|
|
9
|
+
import { classNames } from '../utils/classNames';
|
|
9
10
|
import { DesktopAlertWrapper, LoaderWrapper, MobileAlertWrapper, } from './styles';
|
|
10
11
|
import { useLogic } from './useLogic';
|
|
11
12
|
export const PageLayout = (props) => {
|
|
12
13
|
const { header, content, aside, footer, className, alert, isLoading } = props;
|
|
13
14
|
const { hasAside, ref } = useLogic(props);
|
|
14
|
-
return (_jsxs(PageContextProvider, { hasAside: hasAside, isLoading: isLoading, children: [alert && _jsx(DesktopAlertWrapper, { children: alert }), _jsxs(PageLayoutContainer, { className: className,
|
|
15
|
+
return (_jsxs(PageContextProvider, { hasAside: hasAside, isLoading: isLoading, children: [alert && _jsx(DesktopAlertWrapper, { children: alert }), _jsxs(PageLayoutContainer, { className: classNames(className, {
|
|
16
|
+
[pageLayoutClassnames.withoutHeader]: !header,
|
|
17
|
+
}), ref: ref, children: [alert && _jsx(MobileAlertWrapper, { children: alert }), isValidElement(header)
|
|
15
18
|
? header
|
|
16
19
|
: header && _jsx(PageHeader, { ...header }), isLoading ? (_jsx(LoaderWrapper, { children: _jsx(LoadingPlaceholder, { title: "\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u0434\u0430\u043D\u043D\u044B\u0445..." }) })) : (_jsxs(_Fragment, { children: [isValidElement(content) ? (content) : (_jsx(PageContent, { ...content, footer: footer })), aside && !isValidElement(aside) && (_jsx(PageAside, { ...aside })), isValidElement(aside) && aside] }))] })] }));
|
|
17
20
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Paper } from '../Paper';
|
|
2
2
|
import { styled } from '../styled';
|
|
3
|
+
import { pageLayoutClassnames } from './constants';
|
|
3
4
|
export const Wrapper = styled.div `
|
|
4
5
|
display: grid;
|
|
5
6
|
grid-row-gap: ${({ theme }) => theme.spacing(4)};
|
|
@@ -39,5 +40,9 @@ export const StylePaper = styled(Paper) `
|
|
|
39
40
|
|
|
40
41
|
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
41
42
|
border: unset;
|
|
43
|
+
|
|
44
|
+
.${pageLayoutClassnames.withoutHeader} {
|
|
45
|
+
padding-top: ${({ theme }) => theme.spacing(4)};
|
|
46
|
+
}
|
|
42
47
|
}
|
|
43
48
|
`;
|
|
@@ -31,6 +31,7 @@ export const Aside = styled('aside', {
|
|
|
31
31
|
margin: ${({ theme }) => theme.spacing(0, 4, 4)};
|
|
32
32
|
|
|
33
33
|
background-color: ${({ theme }) => theme.palette.background.default};
|
|
34
|
+
border: 1px solid ${({ theme }) => theme.palette.grey[300]};
|
|
34
35
|
border-radius: ${({ theme }) => theme.shape.medium};
|
|
35
36
|
}
|
|
36
37
|
`;
|
|
@@ -33,13 +33,14 @@ export const StyledPageContent = styled(PageContent) `
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
36
|
-
margin-bottom: ${({ theme }) => theme.spacing(
|
|
36
|
+
margin-bottom: ${({ theme }) => theme.spacing(20)};
|
|
37
|
+
padding-top: 0;
|
|
37
38
|
|
|
38
39
|
&.${formPageContentClassnames.formPageContentSecondaryActions} {
|
|
39
|
-
margin-bottom: ${({ theme }) => theme.spacing(
|
|
40
|
+
margin-bottom: ${({ theme }) => theme.spacing(32)};
|
|
40
41
|
|
|
41
42
|
&.${formPageContentClassnames.formWizardPageContentActions} {
|
|
42
|
-
margin-bottom: ${({ theme }) => theme.spacing(
|
|
43
|
+
margin-bottom: ${({ theme }) => theme.spacing(50)};
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
46
|
}
|
|
@@ -3,21 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Button = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const forwardRefWithGeneric_1 = require("../forwardRefWithGeneric");
|
|
6
|
-
const classNames_1 = require("../utils/classNames");
|
|
7
|
-
const constants_1 = require("./constants");
|
|
8
6
|
const enums_1 = require("./enums");
|
|
9
7
|
const styles_1 = require("./styles");
|
|
10
8
|
const useLogic_1 = require("./useLogic");
|
|
11
9
|
const UnwrappedButton = (props, ref) => {
|
|
12
|
-
const { loadingIndicatorColor } = (0, useLogic_1.useLogic)(props);
|
|
10
|
+
const { loadingIndicatorColor, classnames } = (0, useLogic_1.useLogic)(props);
|
|
13
11
|
const { variant = enums_1.ButtonVariants.Contained, color = variant === enums_1.ButtonVariants.Text
|
|
14
12
|
? enums_1.ButtonColors.Grey
|
|
15
13
|
: enums_1.ButtonColors.Primary, loading, disabled, children, className, selected, ...restProps } = props;
|
|
16
|
-
return ((0, jsx_runtime_1.jsxs)(styles_1.StyledButton, { variant: variant, ref: ref, color: color, disabled: disabled || loading, selected: selected, ...restProps, className: (0,
|
|
17
|
-
[constants_1.buttonClassnames.loading]: loading,
|
|
18
|
-
[constants_1.buttonClassnames.selected]: selected,
|
|
19
|
-
[constants_1.buttonClassnames.disabled]: disabled,
|
|
20
|
-
}), "aria-disabled": loading, children: [loading && ((0, jsx_runtime_1.jsx)(styles_1.StyledLoader, { color: loadingIndicatorColor, size: "small", "$color": color, "$variant": variant, "$isDisabled": disabled })), children] }));
|
|
14
|
+
return ((0, jsx_runtime_1.jsxs)(styles_1.StyledButton, { variant: variant, ref: ref, color: color, disabled: disabled || loading, selected: selected, ...restProps, className: classnames, "aria-disabled": loading, children: [loading && ((0, jsx_runtime_1.jsx)(styles_1.StyledLoader, { color: loadingIndicatorColor, size: "small", "$color": color, "$variant": variant, "$isDisabled": disabled })), children] }));
|
|
21
15
|
};
|
|
22
16
|
exports.Button = (0, forwardRefWithGeneric_1.forwardRefWithGeneric)(UnwrappedButton);
|
|
23
17
|
exports.default = exports.Button;
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
export { buttonClasses } from '@mui/material/Button';
|
|
2
|
+
export declare const buttonColorClassnames: {
|
|
3
|
+
primary: string;
|
|
4
|
+
error: string;
|
|
5
|
+
success: string;
|
|
6
|
+
warning: string;
|
|
7
|
+
grey: string;
|
|
8
|
+
};
|
|
2
9
|
export declare const buttonClassnames: {
|
|
10
|
+
primary: string;
|
|
11
|
+
error: string;
|
|
12
|
+
success: string;
|
|
13
|
+
warning: string;
|
|
14
|
+
grey: string;
|
|
3
15
|
root: string;
|
|
4
16
|
loading: string;
|
|
5
17
|
selected: string;
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buttonClassnames = exports.buttonClasses = void 0;
|
|
3
|
+
exports.buttonClassnames = exports.buttonColorClassnames = exports.buttonClasses = void 0;
|
|
4
4
|
const createUIKitClassname_1 = require("../utils/createUIKitClassname");
|
|
5
|
+
const enums_1 = require("./enums");
|
|
5
6
|
var Button_1 = require("@mui/material/Button");
|
|
6
7
|
Object.defineProperty(exports, "buttonClasses", { enumerable: true, get: function () { return Button_1.buttonClasses; } });
|
|
8
|
+
exports.buttonColorClassnames = {
|
|
9
|
+
[enums_1.ButtonColors.Primary]: (0, createUIKitClassname_1.createUIKitClassname)('button_color-primary'),
|
|
10
|
+
[enums_1.ButtonColors.Error]: (0, createUIKitClassname_1.createUIKitClassname)('button_color-error'),
|
|
11
|
+
[enums_1.ButtonColors.Success]: (0, createUIKitClassname_1.createUIKitClassname)('button_color-success'),
|
|
12
|
+
[enums_1.ButtonColors.Warning]: (0, createUIKitClassname_1.createUIKitClassname)('button_color-warning'),
|
|
13
|
+
[enums_1.ButtonColors.Grey]: (0, createUIKitClassname_1.createUIKitClassname)('button_color-grey'),
|
|
14
|
+
};
|
|
7
15
|
exports.buttonClassnames = {
|
|
8
16
|
root: (0, createUIKitClassname_1.createUIKitClassname)('button'),
|
|
9
17
|
loading: (0, createUIKitClassname_1.createUIKitClassname)('button_loading'),
|
|
10
18
|
selected: (0, createUIKitClassname_1.createUIKitClassname)('button_selected'),
|
|
11
19
|
disabled: (0, createUIKitClassname_1.createUIKitClassname)('button_disabled'),
|
|
20
|
+
...exports.buttonColorClassnames,
|
|
12
21
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { type ButtonProps } from '../types';
|
|
2
2
|
type UseLogicParam = ButtonProps;
|
|
3
3
|
type Color = 'primary' | 'inverted';
|
|
4
|
-
export declare const useLogic: ({ variant, }: UseLogicParam) => {
|
|
4
|
+
export declare const useLogic: ({ loading, selected, variant, color, disabled, className, }: UseLogicParam) => {
|
|
5
5
|
loadingIndicatorColor: Color;
|
|
6
|
+
classnames: string;
|
|
6
7
|
};
|
|
7
8
|
export {};
|
|
@@ -2,14 +2,23 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useLogic = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
+
const classNames_1 = require("../../utils/classNames");
|
|
6
|
+
const constants_1 = require("../constants");
|
|
5
7
|
const enums_1 = require("../enums");
|
|
6
|
-
const useLogic = ({ variant = enums_1.ButtonVariants.Contained,
|
|
8
|
+
const useLogic = ({ loading, selected, variant = enums_1.ButtonVariants.Contained, color = variant === enums_1.ButtonVariants.Text
|
|
9
|
+
? enums_1.ButtonColors.Grey
|
|
10
|
+
: enums_1.ButtonColors.Primary, disabled, className, }) => {
|
|
7
11
|
const loadingIndicatorColor = (0, react_1.useMemo)(() => {
|
|
8
12
|
if (variant !== enums_1.ButtonVariants.Contained) {
|
|
9
13
|
return 'primary';
|
|
10
14
|
}
|
|
11
15
|
return 'inverted';
|
|
12
16
|
}, [variant]);
|
|
13
|
-
|
|
17
|
+
const classnames = (0, react_1.useMemo)(() => (0, classNames_1.classNames)(constants_1.buttonClassnames.root, constants_1.buttonColorClassnames[color], className, {
|
|
18
|
+
[constants_1.buttonClassnames.loading]: loading,
|
|
19
|
+
[constants_1.buttonClassnames.disabled]: disabled,
|
|
20
|
+
[constants_1.buttonClassnames.selected]: selected,
|
|
21
|
+
}), [loading, selected, color, className, disabled]);
|
|
22
|
+
return { loadingIndicatorColor, classnames };
|
|
14
23
|
};
|
|
15
24
|
exports.useLogic = useLogic;
|
|
@@ -40,6 +40,6 @@ exports.Image = styled_1.styled.img `
|
|
|
40
40
|
`;
|
|
41
41
|
exports.StyledPageContent = (0, styled_1.styled)(PageContent_1.PageContent) `
|
|
42
42
|
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
43
|
-
margin: ${({ theme }) => theme.spacing(4)};
|
|
43
|
+
margin-top: ${({ theme }) => theme.spacing(4)};
|
|
44
44
|
}
|
|
45
45
|
`;
|
|
@@ -25,9 +25,8 @@ exports.Wrapper = styled_1.styled.aside `
|
|
|
25
25
|
width: unset;
|
|
26
26
|
margin: ${({ theme }) => theme.spacing(0, 4, 4)};
|
|
27
27
|
|
|
28
|
-
background-color: ${({ theme }) => theme.palette.background.default};
|
|
29
|
-
border
|
|
30
|
-
border-left: 0;
|
|
28
|
+
background-color: ${({ theme }) => theme.palette.background.default};
|
|
29
|
+
border: 1px solid ${({ theme }) => theme.palette.grey[300]};
|
|
31
30
|
border-radius: ${({ theme }) => theme.shape.medium};
|
|
32
31
|
}
|
|
33
32
|
`;
|
|
@@ -11,11 +11,13 @@ exports.Wrapper = styled_1.styled.header `
|
|
|
11
11
|
padding: ${({ theme }) => theme.spacing(4, 6)};
|
|
12
12
|
|
|
13
13
|
border-bottom: 1px solid ${({ theme }) => theme.palette.grey[300]};
|
|
14
|
-
|
|
14
|
+
|
|
15
15
|
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
16
16
|
margin: ${({ theme }) => theme.spacing(0, 4)};
|
|
17
17
|
|
|
18
18
|
background-color: ${({ theme }) => theme.palette.background.default};
|
|
19
|
+
border: 1px solid ${({ theme }) => theme.palette.grey[300]};
|
|
20
|
+
border-bottom: none;
|
|
19
21
|
border-top-left-radius: ${({ theme }) => theme.shape.medium};
|
|
20
22
|
border-top-right-radius: ${({ theme }) => theme.shape.medium};
|
|
21
23
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Content = exports.Wrapper = void 0;
|
|
4
|
+
const constants_1 = require("../CardGridInfinite/constants");
|
|
4
5
|
const PdfViewer_1 = require("../PdfViewer");
|
|
5
6
|
const styled_1 = require("../styled");
|
|
6
|
-
const
|
|
7
|
+
const constants_2 = require("./constants");
|
|
7
8
|
const getPaddingContent = (theme, hasAside) => {
|
|
8
9
|
return hasAside ? theme.spacing(4, 6, 4) : theme.spacing(0, 6, 4);
|
|
9
10
|
};
|
|
@@ -31,7 +32,7 @@ exports.Wrapper = (0, styled_1.styled)('article', {
|
|
|
31
32
|
border-top: none;
|
|
32
33
|
}
|
|
33
34
|
|
|
34
|
-
@keyframes ${
|
|
35
|
+
@keyframes ${constants_2.PAGE_CONTENT_ANIMATION} {
|
|
35
36
|
0% {
|
|
36
37
|
display: none;
|
|
37
38
|
|
|
@@ -49,8 +50,8 @@ exports.Wrapper = (0, styled_1.styled)('article', {
|
|
|
49
50
|
}
|
|
50
51
|
}
|
|
51
52
|
|
|
52
|
-
&.${
|
|
53
|
-
animation: ${({ theme }) => `${
|
|
53
|
+
&.${constants_2.pageContentClassnames.animation} > * {
|
|
54
|
+
animation: ${({ theme }) => `${constants_2.PAGE_CONTENT_ANIMATION} ${theme.transitions.duration.complex * 2}ms`};
|
|
54
55
|
}
|
|
55
56
|
`;
|
|
56
57
|
exports.Content = styled_1.styled.div `
|
|
@@ -77,9 +78,16 @@ exports.Content = styled_1.styled.div `
|
|
|
77
78
|
padding: ${({ theme }) => theme.spacing(4, 4, 3)};
|
|
78
79
|
|
|
79
80
|
background-color: ${({ theme }) => theme.palette.background.default};
|
|
81
|
+
border: 1px solid ${({ theme }) => theme.palette.grey[300]};
|
|
80
82
|
border-radius: ${({ theme }) => theme.shape.medium};
|
|
81
83
|
|
|
82
|
-
|
|
84
|
+
/* Причина игнора: Не критично для отображения */
|
|
85
|
+
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
86
|
+
&:has(.${constants_1.cardGridClassnames.root}) {
|
|
87
|
+
border: none;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
&.${constants_2.pageContentClassnames.contentHasHeader} {
|
|
83
91
|
border-top-left-radius: 0;
|
|
84
92
|
border-top-right-radius: 0;
|
|
85
93
|
}
|
|
@@ -9,5 +9,6 @@ exports.pageHeaderClassnames = {
|
|
|
9
9
|
hasTitle: (0, createUIKitClassname_1.createUIKitClassname)('page-header_has-title'),
|
|
10
10
|
filters: (0, createUIKitClassname_1.createUIKitClassname)('page-header__filters'),
|
|
11
11
|
quickFilters: (0, createUIKitClassname_1.createUIKitClassname)('page-header__quick-filters'),
|
|
12
|
+
hasFilters: (0, createUIKitClassname_1.createUIKitClassname)('page-header_has-filters'),
|
|
12
13
|
};
|
|
13
14
|
exports.PAGE_HEADER_HEIGHT_MOBILE = '48px';
|
|
@@ -18,6 +18,10 @@ exports.Wrapper = styled_1.styled.header `
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
21
|
+
position: sticky;
|
|
22
|
+
z-index: ${({ theme }) => theme.zIndex.fab};
|
|
23
|
+
top: ${constants_1.PAGE_HEADER_HEIGHT_MOBILE};
|
|
24
|
+
|
|
21
25
|
display: block;
|
|
22
26
|
|
|
23
27
|
margin-bottom: ${({ theme }) => theme.spacing(4)};
|
|
@@ -34,6 +38,10 @@ exports.Wrapper = styled_1.styled.header `
|
|
|
34
38
|
grid-column: 3;
|
|
35
39
|
grid-row: 1 / -1;
|
|
36
40
|
}
|
|
41
|
+
|
|
42
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
43
|
+
border-bottom: 1px solid ${({ theme }) => theme.palette.grey[300]};
|
|
44
|
+
}
|
|
37
45
|
}
|
|
38
46
|
|
|
39
47
|
.${constants_1.pageHeaderClassnames.quickFilters} {
|
|
@@ -63,6 +71,10 @@ exports.MobileTitleWrapper = styled_1.styled.div `
|
|
|
63
71
|
order: 1;
|
|
64
72
|
|
|
65
73
|
background-color: ${({ theme }) => theme.palette.background.default};
|
|
74
|
+
|
|
75
|
+
&:not(.${constants_1.pageHeaderClassnames.hasFilters}) {
|
|
76
|
+
border-bottom: 1px solid ${({ theme }) => theme.palette.grey[300]};
|
|
77
|
+
}
|
|
66
78
|
|
|
67
79
|
&.${constants_1.pageHeaderClassnames.hasTitle} {
|
|
68
80
|
display: flex;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ElementType } from 'react';
|
|
2
2
|
import type { PageHeaderProps } from '../types';
|
|
3
3
|
type UseLogicParams<TMainActionComponent extends ElementType = ElementType, TSecondaryActionComponent extends ElementType = ElementType, TBackButtonComponent extends ElementType = ElementType> = PageHeaderProps<TMainActionComponent, TSecondaryActionComponent, TBackButtonComponent>;
|
|
4
|
-
export declare const useLogic: <TMainActionComponent extends ElementType = ElementType, TSecondaryActionComponent extends ElementType = ElementType, TBackButtonComponent extends ElementType = ElementType>({ shouldUpdateDocumentTitle, title, actions, htmlTitle, backButton, }: UseLogicParams<TMainActionComponent, TSecondaryActionComponent, TBackButtonComponent>) => {
|
|
4
|
+
export declare const useLogic: <TMainActionComponent extends ElementType = ElementType, TSecondaryActionComponent extends ElementType = ElementType, TBackButtonComponent extends ElementType = ElementType>({ shouldUpdateDocumentTitle, title, actions, htmlTitle, backButton, filters, }: UseLogicParams<TMainActionComponent, TSecondaryActionComponent, TBackButtonComponent>) => {
|
|
5
5
|
isShowMobileActions: boolean | undefined;
|
|
6
6
|
isLoading: boolean | undefined;
|
|
7
7
|
mobileTitleActions: import("react").ReactNode;
|
|
@@ -6,7 +6,7 @@ const PageContext_1 = require("../../PageContext");
|
|
|
6
6
|
const classNames_1 = require("../../utils/classNames");
|
|
7
7
|
const constants_1 = require("../constants");
|
|
8
8
|
const usePageTitle_1 = require("../hooks/usePageTitle");
|
|
9
|
-
const useLogic = ({ shouldUpdateDocumentTitle, title, actions, htmlTitle, backButton, }) => {
|
|
9
|
+
const useLogic = ({ shouldUpdateDocumentTitle, title, actions, htmlTitle, backButton, filters, }) => {
|
|
10
10
|
//Переопределение Html title на title из параметров
|
|
11
11
|
(0, usePageTitle_1.usePageTitle)({ shouldUpdateDocumentTitle, htmlTitle, title });
|
|
12
12
|
const { mobileTitleActions, isLoading } = (0, react_1.useContext)(PageContext_1.PageContext);
|
|
@@ -14,6 +14,7 @@ const useLogic = ({ shouldUpdateDocumentTitle, title, actions, htmlTitle, backBu
|
|
|
14
14
|
const mobileClassnames = (0, react_1.useMemo)(() => (0, classNames_1.classNames)(constants_1.pageHeaderClassnames.pageHeaderMobileTitle, {
|
|
15
15
|
[constants_1.pageHeaderClassnames.hasTitle]: Boolean(title) || isLoading,
|
|
16
16
|
[constants_1.pageHeaderClassnames.hasBackButton]: Boolean(backButton),
|
|
17
|
+
[constants_1.pageHeaderClassnames.hasFilters]: Boolean(filters),
|
|
17
18
|
}), [title, backButton, isLoading]);
|
|
18
19
|
return {
|
|
19
20
|
isShowMobileActions,
|
|
@@ -9,12 +9,15 @@ const PageContext_1 = require("../PageContext");
|
|
|
9
9
|
const PageHeader_1 = require("../PageHeader");
|
|
10
10
|
const PageLayoutContainer_1 = require("../PageLayoutContainer");
|
|
11
11
|
const LoadingPlaceholder_1 = require("../placeholders/LoadingPlaceholder");
|
|
12
|
+
const classNames_1 = require("../utils/classNames");
|
|
12
13
|
const styles_1 = require("./styles");
|
|
13
14
|
const useLogic_1 = require("./useLogic");
|
|
14
15
|
const PageLayout = (props) => {
|
|
15
16
|
const { header, content, aside, footer, className, alert, isLoading } = props;
|
|
16
17
|
const { hasAside, ref } = (0, useLogic_1.useLogic)(props);
|
|
17
|
-
return ((0, jsx_runtime_1.jsxs)(PageContext_1.PageContextProvider, { hasAside: hasAside, isLoading: isLoading, children: [alert && (0, jsx_runtime_1.jsx)(styles_1.DesktopAlertWrapper, { children: alert }), (0, jsx_runtime_1.jsxs)(PageLayoutContainer_1.PageLayoutContainer, { className:
|
|
18
|
+
return ((0, jsx_runtime_1.jsxs)(PageContext_1.PageContextProvider, { hasAside: hasAside, isLoading: isLoading, children: [alert && (0, jsx_runtime_1.jsx)(styles_1.DesktopAlertWrapper, { children: alert }), (0, jsx_runtime_1.jsxs)(PageLayoutContainer_1.PageLayoutContainer, { className: (0, classNames_1.classNames)(className, {
|
|
19
|
+
[PageLayoutContainer_1.pageLayoutClassnames.withoutHeader]: !header,
|
|
20
|
+
}), ref: ref, children: [alert && (0, jsx_runtime_1.jsx)(styles_1.MobileAlertWrapper, { children: alert }), (0, react_1.isValidElement)(header)
|
|
18
21
|
? header
|
|
19
22
|
: header && (0, jsx_runtime_1.jsx)(PageHeader_1.PageHeader, { ...header }), isLoading ? ((0, jsx_runtime_1.jsx)(styles_1.LoaderWrapper, { children: (0, jsx_runtime_1.jsx)(LoadingPlaceholder_1.LoadingPlaceholder, { title: "\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u0434\u0430\u043D\u043D\u044B\u0445..." }) })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, react_1.isValidElement)(content) ? (content) : ((0, jsx_runtime_1.jsx)(PageContent_1.PageContent, { ...content, footer: footer })), aside && !(0, react_1.isValidElement)(aside) && ((0, jsx_runtime_1.jsx)(PageAside_1.PageAside, { ...aside })), (0, react_1.isValidElement)(aside) && aside] }))] })] }));
|
|
20
23
|
};
|
|
@@ -4,4 +4,5 @@ exports.pageLayoutClassnames = void 0;
|
|
|
4
4
|
const createUIKitClassname_1 = require("../utils/createUIKitClassname");
|
|
5
5
|
exports.pageLayoutClassnames = {
|
|
6
6
|
root: (0, createUIKitClassname_1.createUIKitClassname)('page-layout'),
|
|
7
|
+
withoutHeader: (0, createUIKitClassname_1.createUIKitClassname)('page-layout_without-header'),
|
|
7
8
|
};
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.StylePaper = exports.Wrapper = void 0;
|
|
4
4
|
const Paper_1 = require("../Paper");
|
|
5
5
|
const styled_1 = require("../styled");
|
|
6
|
+
const constants_1 = require("./constants");
|
|
6
7
|
exports.Wrapper = styled_1.styled.div `
|
|
7
8
|
display: grid;
|
|
8
9
|
grid-row-gap: ${({ theme }) => theme.spacing(4)};
|
|
@@ -42,5 +43,9 @@ exports.StylePaper = (0, styled_1.styled)(Paper_1.Paper) `
|
|
|
42
43
|
|
|
43
44
|
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
44
45
|
border: unset;
|
|
46
|
+
|
|
47
|
+
.${constants_1.pageLayoutClassnames.withoutHeader} {
|
|
48
|
+
padding-top: ${({ theme }) => theme.spacing(4)};
|
|
49
|
+
}
|
|
45
50
|
}
|
|
46
51
|
`;
|
|
@@ -34,6 +34,7 @@ exports.Aside = (0, styled_1.styled)('aside', {
|
|
|
34
34
|
margin: ${({ theme }) => theme.spacing(0, 4, 4)};
|
|
35
35
|
|
|
36
36
|
background-color: ${({ theme }) => theme.palette.background.default};
|
|
37
|
+
border: 1px solid ${({ theme }) => theme.palette.grey[300]};
|
|
37
38
|
border-radius: ${({ theme }) => theme.shape.medium};
|
|
38
39
|
}
|
|
39
40
|
`;
|
|
@@ -36,13 +36,14 @@ exports.StyledPageContent = (0, styled_1.styled)(PageContent_1.PageContent) `
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
39
|
-
margin-bottom: ${({ theme }) => theme.spacing(
|
|
39
|
+
margin-bottom: ${({ theme }) => theme.spacing(20)};
|
|
40
|
+
padding-top: 0;
|
|
40
41
|
|
|
41
42
|
&.${constants_1.formPageContentClassnames.formPageContentSecondaryActions} {
|
|
42
|
-
margin-bottom: ${({ theme }) => theme.spacing(
|
|
43
|
+
margin-bottom: ${({ theme }) => theme.spacing(32)};
|
|
43
44
|
|
|
44
45
|
&.${constants_1.formPageContentClassnames.formWizardPageContentActions} {
|
|
45
|
-
margin-bottom: ${({ theme }) => theme.spacing(
|
|
46
|
+
margin-bottom: ${({ theme }) => theme.spacing(50)};
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
49
|
}
|