@astral/ui 4.24.0 → 4.24.2
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/DashboardLayout/Header/Header.js +3 -3
- package/components/DashboardLayout/Header/constants.d.ts +1 -0
- package/components/DashboardLayout/Header/constants.js +1 -0
- package/components/DashboardLayout/Header/styles.d.ts +6 -0
- package/components/DashboardLayout/Header/styles.js +46 -0
- package/components/DashboardLayout/Header/useLogic/useLogic.d.ts +2 -0
- package/components/DashboardLayout/Header/useLogic/useLogic.js +10 -3
- package/components/DashboardSidebar/styles.js +10 -0
- package/components/MenuOrganization/MenuOrganization.js +3 -3
- package/components/MenuOrganization/OrganizationButton/OrganizationButton.js +2 -1
- package/components/MenuOrganization/OrganizationButton/styles.js +1 -6
- package/components/MenuOrganization/constants.d.ts +1 -1
- package/components/MenuOrganization/constants.js +1 -1
- package/components/MenuOrganization/styles.d.ts +0 -6
- package/components/MenuOrganization/styles.js +0 -29
- package/components/MenuOrganization/useLogic/useLogic.d.ts +0 -2
- package/components/MenuOrganization/useLogic/useLogic.js +1 -8
- package/components/PageHeader/Title/Title.js +1 -1
- package/node/components/DashboardLayout/Header/Header.js +2 -2
- package/node/components/DashboardLayout/Header/constants.d.ts +1 -0
- package/node/components/DashboardLayout/Header/constants.js +1 -0
- package/node/components/DashboardLayout/Header/styles.d.ts +6 -0
- package/node/components/DashboardLayout/Header/styles.js +52 -6
- package/node/components/DashboardLayout/Header/useLogic/useLogic.d.ts +2 -0
- package/node/components/DashboardLayout/Header/useLogic/useLogic.js +9 -2
- package/node/components/DashboardSidebar/styles.js +12 -2
- package/node/components/MenuOrganization/MenuOrganization.js +2 -2
- package/node/components/MenuOrganization/OrganizationButton/OrganizationButton.js +2 -1
- package/node/components/MenuOrganization/OrganizationButton/styles.js +1 -6
- package/node/components/MenuOrganization/constants.d.ts +1 -1
- package/node/components/MenuOrganization/constants.js +1 -1
- package/node/components/MenuOrganization/styles.d.ts +0 -6
- package/node/components/MenuOrganization/styles.js +6 -35
- package/node/components/MenuOrganization/useLogic/useLogic.d.ts +0 -2
- package/node/components/MenuOrganization/useLogic/useLogic.js +1 -8
- package/node/components/PageHeader/Title/Title.js +1 -1
- package/package.json +1 -1
|
@@ -8,13 +8,13 @@ import { Product } from '../../Product';
|
|
|
8
8
|
import { Profile } from '../../Profile';
|
|
9
9
|
import { getInertProps } from '../../utils/getInertProps';
|
|
10
10
|
import { dashboardLayoutHeaderClassnames } from './constants';
|
|
11
|
-
import { ExitButton, HeaderContent, HeaderContentSection, HeaderRoot, HeaderSection, MobileSidebarTogglerWrapper, ProductSwitcherWrapper, ProfileWrapper, } from './styles';
|
|
11
|
+
import { ExitButton, HeaderContent, HeaderContentSection, HeaderRoot, HeaderSection, MenuOrganizationWrapper, MobileSidebarTogglerWrapper, ProductSwitcherWrapper, ProfileWrapper, } from './styles';
|
|
12
12
|
import { useLogic } from './useLogic';
|
|
13
13
|
/**
|
|
14
14
|
* Основной header приложения
|
|
15
15
|
*/
|
|
16
16
|
export const Header = forwardRef((props, ref) => {
|
|
17
17
|
const { productSwitcher: ProductSwitcher, product, profile, menuOrganization, children, } = props;
|
|
18
|
-
const { isShowExitButton, isShowProfile, isFocusedMode, isMobile, collapsedIn, onToggleSidebar, isLoading, } = useLogic(props);
|
|
19
|
-
return (_jsx(HeaderRoot, { ref: ref, "$isFocusedMode": isFocusedMode, ...getInertProps(!isMobile && isFocusedMode), className: dashboardLayoutHeaderClassnames.root, children: _jsxs(HeaderContent, { children: [_jsx(MobileSidebarTogglerWrapper, { className: dashboardLayoutHeaderClassnames.mobileSidebarButton, children: _jsx(Button, { startIcon: collapsedIn ? _jsx(CrossOutlineMd, {}) : _jsx(MenuOnOutlineMd, {}), variant: "text", onClick: () => onToggleSidebar(), title: "\u041F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u044C \u0431\u043E\u043A\u043E\u0432\u043E\u0435 \u043C\u0435\u043D\u044E" }) }), _jsxs(HeaderSection, { children: [ProductSwitcher && (_jsx(ProductSwitcherWrapper, { children: _jsx(ProductSwitcher, {}) })), _jsx(Product, { ...product })] }), _jsxs(HeaderContentSection, { children: [children, menuOrganization
|
|
18
|
+
const { isShowExitButton, isShowProfile, isFocusedMode, isMobile, collapsedIn, onToggleSidebar, isLoading, alertHeight, menuOrganizationClassnames, } = useLogic(props);
|
|
19
|
+
return (_jsx(HeaderRoot, { ref: ref, "$isFocusedMode": isFocusedMode, ...getInertProps(!isMobile && isFocusedMode), className: dashboardLayoutHeaderClassnames.root, children: _jsxs(HeaderContent, { children: [_jsx(MobileSidebarTogglerWrapper, { className: dashboardLayoutHeaderClassnames.mobileSidebarButton, children: _jsx(Button, { startIcon: collapsedIn ? _jsx(CrossOutlineMd, {}) : _jsx(MenuOnOutlineMd, {}), variant: "text", onClick: () => onToggleSidebar(), title: "\u041F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u044C \u0431\u043E\u043A\u043E\u0432\u043E\u0435 \u043C\u0435\u043D\u044E" }) }), _jsxs(HeaderSection, { children: [ProductSwitcher && (_jsx(ProductSwitcherWrapper, { children: _jsx(ProductSwitcher, {}) })), _jsx(Product, { ...product })] }), _jsxs(HeaderContentSection, { children: [children, menuOrganization && (_jsx(MenuOrganizationWrapper, { className: menuOrganizationClassnames, "$alertHeight": alertHeight, children: menuOrganization() })), profile && (_jsx(ProfileWrapper, { "$isShow": isShowProfile, children: _jsx(Profile, { isLoading: isLoading, ...profile }) })), _jsx(ExitButton, { "$isShow": isShowExitButton, onClick: profile?.exitButton?.onClick, title: "\u0412\u044B\u0445\u043E\u0434", variant: "text", children: _jsx(QuitOutlineMd, {}) })] })] }) }));
|
|
20
20
|
});
|
|
@@ -2,4 +2,5 @@ import { createUIKitClassname } from '../../utils/createUIKitClassname';
|
|
|
2
2
|
export const dashboardLayoutHeaderClassnames = {
|
|
3
3
|
root: createUIKitClassname('dashboard-layout-header'),
|
|
4
4
|
mobileSidebarButton: createUIKitClassname('dashboard-layout-header__sidebar-button_mobile'),
|
|
5
|
+
mobileMenuOrganizationVisible: createUIKitClassname('dashboard-layout-header__menu-organization_visible'),
|
|
5
6
|
};
|
|
@@ -44,3 +44,9 @@ export declare const HeaderContent: import("../../styled").StyledComponent<{
|
|
|
44
44
|
theme?: import("@emotion/react").Theme | undefined;
|
|
45
45
|
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
46
46
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
47
|
+
export declare const MenuOrganizationWrapper: import("../../styled").StyledComponent<{
|
|
48
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
49
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
50
|
+
} & {
|
|
51
|
+
$alertHeight?: number | undefined;
|
|
52
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { buttonClasses } from '@mui/material/Button';
|
|
2
2
|
import { dashboardSidebarClassnames } from '../../DashboardSidebar/constants';
|
|
3
3
|
import { IconButton } from '../../IconButton';
|
|
4
|
+
import { menuOrganizationClassnames } from '../../MenuOrganization/constants';
|
|
5
|
+
import { MOBILE_BUTTON_HEIGHT } from '../../MenuOrganization/OrganizationButton/constants';
|
|
4
6
|
import { styled } from '../../styled';
|
|
5
7
|
import { dashboardLayoutClassnames, HEADER_HEIGHT, HEADER_HEIGHT_MOBILE, } from '../constants';
|
|
8
|
+
import { dashboardLayoutHeaderClassnames } from './constants';
|
|
6
9
|
export const HeaderRoot = styled('header', {
|
|
7
10
|
shouldForwardProp: (prop) => !['$isFocusedMode'].includes(prop),
|
|
8
11
|
}) `
|
|
@@ -102,3 +105,46 @@ export const HeaderContent = styled.div `
|
|
|
102
105
|
padding: 0;
|
|
103
106
|
}
|
|
104
107
|
`;
|
|
108
|
+
export const MenuOrganizationWrapper = styled.div `
|
|
109
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
110
|
+
position: absolute;
|
|
111
|
+
z-index: ${({ theme }) => theme.zIndex.appBar - 1};
|
|
112
|
+
top: ${({ $alertHeight }) => `calc(${$alertHeight}px + ${HEADER_HEIGHT_MOBILE}) `};
|
|
113
|
+
left: 0;
|
|
114
|
+
|
|
115
|
+
/* Необходимо для анимации компонента вместе с sidebar */
|
|
116
|
+
transform: translateX(-100vw);
|
|
117
|
+
|
|
118
|
+
display: flex;
|
|
119
|
+
flex-direction: column;
|
|
120
|
+
|
|
121
|
+
width: 100vw;
|
|
122
|
+
|
|
123
|
+
background-color: ${({ theme }) => theme.palette.background.default};
|
|
124
|
+
|
|
125
|
+
transition: ${({ theme }) => {
|
|
126
|
+
return theme.transitions.create(['transform'], {
|
|
127
|
+
duration: theme.transitions.duration.standard,
|
|
128
|
+
});
|
|
129
|
+
}};
|
|
130
|
+
|
|
131
|
+
&.${dashboardLayoutHeaderClassnames.mobileMenuOrganizationVisible} {
|
|
132
|
+
transform: translateX(0);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
& .${menuOrganizationClassnames.button} {
|
|
136
|
+
height: ${MOBILE_BUTTON_HEIGHT};
|
|
137
|
+
padding: ${({ theme }) => theme.spacing(3, 4)};
|
|
138
|
+
|
|
139
|
+
border-bottom: 1px solid ${({ theme }) => theme.palette.grey[300]};
|
|
140
|
+
|
|
141
|
+
&:hover {
|
|
142
|
+
border-bottom: 1px solid ${({ theme }) => theme.palette.grey[300]};
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
&:active {
|
|
146
|
+
border-bottom: 1px solid ${({ theme }) => theme.palette.grey[300]};
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
`;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { useContext, useEffect } from 'react';
|
|
1
|
+
import { useContext, useEffect, useMemo } from 'react';
|
|
2
2
|
import { DashboardContext } from '../../../DashboardContext';
|
|
3
3
|
import { DashboardSidebarContext } from '../../../DashboardSidebarProvider';
|
|
4
4
|
import { useViewportType } from '../../../useViewportType';
|
|
5
|
+
import { classNames } from '../../../utils/classNames';
|
|
6
|
+
import { dashboardLayoutHeaderClassnames } from '../constants';
|
|
5
7
|
export const useLogic = ({ profile, menuOrganization }) => {
|
|
6
|
-
const { isFocusedMode, isLoading, hasMenuOrganizationRef } = useContext(DashboardContext);
|
|
7
|
-
const { collapsedIn, onToggleSidebar } = useContext(DashboardSidebarContext);
|
|
8
|
+
const { isFocusedMode, isLoading, hasMenuOrganizationRef, alertHeight } = useContext(DashboardContext);
|
|
9
|
+
const { collapsedIn, onToggleSidebar, isPinned } = useContext(DashboardSidebarContext);
|
|
8
10
|
useEffect(() => {
|
|
9
11
|
hasMenuOrganizationRef.current = Boolean(menuOrganization);
|
|
10
12
|
}, [menuOrganization]);
|
|
@@ -12,6 +14,9 @@ export const useLogic = ({ profile, menuOrganization }) => {
|
|
|
12
14
|
const hasMenu = Boolean(profile?.menu || profile?.menuList);
|
|
13
15
|
const isShowProfile = (Boolean(profile) && !isMobile) || (hasMenu && isMobile);
|
|
14
16
|
const isShowExitButton = isMobile && !hasMenu && Boolean(profile?.exitButton);
|
|
17
|
+
const menuOrganizationClassnames = useMemo(() => classNames({
|
|
18
|
+
[dashboardLayoutHeaderClassnames.mobileMenuOrganizationVisible]: isPinned,
|
|
19
|
+
}), [isPinned]);
|
|
15
20
|
return {
|
|
16
21
|
isShowExitButton,
|
|
17
22
|
isShowProfile,
|
|
@@ -20,5 +25,7 @@ export const useLogic = ({ profile, menuOrganization }) => {
|
|
|
20
25
|
isLoading,
|
|
21
26
|
collapsedIn,
|
|
22
27
|
onToggleSidebar,
|
|
28
|
+
alertHeight,
|
|
29
|
+
menuOrganizationClassnames,
|
|
23
30
|
};
|
|
24
31
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { HEADER_HEIGHT_MOBILE } from '../DashboardLayout/constants';
|
|
2
|
+
import { menuOrganizationClassnames } from '../MenuOrganization/constants';
|
|
2
3
|
import { MOBILE_BUTTON_HEIGHT } from '../MenuOrganization/OrganizationButton';
|
|
3
4
|
import { Paper } from '../Paper';
|
|
4
5
|
import { pinButtonClassnames } from '../PinButton';
|
|
@@ -83,6 +84,15 @@ export const SidebarHeader = styled.header `
|
|
|
83
84
|
padding: ${({ theme }) => theme.spacing(4)};
|
|
84
85
|
|
|
85
86
|
border-bottom: 1px solid ${({ theme }) => theme.palette.grey[300]};
|
|
87
|
+
|
|
88
|
+
&:has(.${menuOrganizationClassnames.button}) {
|
|
89
|
+
padding: 0;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
& .${menuOrganizationClassnames.button} {
|
|
93
|
+
height: ${MOBILE_BUTTON_HEIGHT};
|
|
94
|
+
padding: ${({ theme }) => theme.spacing(3, 4)};
|
|
95
|
+
}
|
|
86
96
|
}
|
|
87
97
|
`;
|
|
88
98
|
export const SidebarContent = styled.div `
|
|
@@ -8,15 +8,15 @@ import { NoData } from './NoData';
|
|
|
8
8
|
import { OrganizationButton } from './OrganizationButton';
|
|
9
9
|
import { OrganizationList } from './OrganizationList';
|
|
10
10
|
import { OrganizationListSkeleton } from './OrganizationListSkeleton';
|
|
11
|
-
import { ActionWrapper,
|
|
11
|
+
import { ActionWrapper, OrganizationsWrapper, SearchWrapper, StyledPopover, StyledTypography, } from './styles';
|
|
12
12
|
import { useLogic } from './useLogic';
|
|
13
13
|
export const MenuOrganization = (props) => {
|
|
14
14
|
const { anchorOrigin = { vertical: 'bottom', horizontal: 'right' }, transformOrigin = { vertical: 'top', horizontal: 'right' }, } = props;
|
|
15
|
-
const { actionButtonProps, hasAction, isLoading, isError, onRetry, isComponentLoading, isShowOrganizationList, searchProps, popoverProps, organizationListProps, organizationButtonProps, isShowSearchField, isMobile,
|
|
15
|
+
const { actionButtonProps, hasAction, isLoading, isError, onRetry, isComponentLoading, isShowOrganizationList, searchProps, popoverProps, organizationListProps, organizationButtonProps, isShowSearchField, isMobile, } = useLogic(props);
|
|
16
16
|
if (isComponentLoading) {
|
|
17
17
|
return _jsx(MenuOrganizationSkeleton, {});
|
|
18
18
|
}
|
|
19
|
-
return (_jsxs(_Fragment, { children: [_jsx(
|
|
19
|
+
return (_jsxs(_Fragment, { children: [_jsx(OrganizationButton, { ...organizationButtonProps }), _jsxs(StyledPopover, { ...popoverProps, anchorOrigin: anchorOrigin, transformOrigin: transformOrigin, title: POPOVER_TITLE, children: [isShowSearchField && (_jsx(SearchWrapper, { children: _jsx(SearchField, { fullWidth: true, ...searchProps }) })), _jsx(OrganizationsWrapper, { "$isLoading": isLoading, className: menuOrganizationClassnames.root, children: _jsx(ContentState, { isLoading: isLoading, isCustom: isError, customState: {
|
|
20
20
|
title: (_jsx(StyledTypography, { children: "\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0434\u0430\u043D\u043D\u044B\u0435" })),
|
|
21
21
|
Actions: (_jsx(Button, { variant: "light", color: "grey", onClick: onRetry, children: "\u041F\u043E\u043F\u0440\u043E\u0431\u043E\u0432\u0430\u0442\u044C \u0441\u043D\u043E\u0432\u0430" })),
|
|
22
22
|
className: menuOrganizationClassnames.errorPlaceholder,
|
|
@@ -3,6 +3,7 @@ import { forwardRef } from 'react';
|
|
|
3
3
|
import { OverflowTypography } from '../../OverflowTypography';
|
|
4
4
|
import { useHidePersonalData } from '../../personalDataSecurity';
|
|
5
5
|
import { Tooltip } from '../../Tooltip';
|
|
6
|
+
import { menuOrganizationClassnames } from '../constants';
|
|
6
7
|
import { OrganizationData } from '../styles';
|
|
7
8
|
import { Container, StyledButton, StyledChevron, StyledTypography, } from './styles';
|
|
8
9
|
export const OrganizationButton = forwardRef(({ onClick, isOpen, currentOrganization, isDisabled, disabledReason, isHidePersonalData, renderPreview, }, ref) => {
|
|
@@ -10,7 +11,7 @@ export const OrganizationButton = forwardRef(({ onClick, isOpen, currentOrganiza
|
|
|
10
11
|
const hidePersonalDataClassname = useHidePersonalData({
|
|
11
12
|
isEnabled: isHidePersonalData,
|
|
12
13
|
});
|
|
13
|
-
const renderButton = () => (_jsx(StyledButton, { ref: ref, variant: "text", disabled: isDisabled, onClick: onClick, endIcon: _jsx(StyledChevron, { isActive: isOpen, width: 24, height: 24 }), children: renderPreview ? (renderPreview(currentOrganization, {
|
|
14
|
+
const renderButton = () => (_jsx(StyledButton, { ref: ref, variant: "text", disabled: isDisabled, onClick: onClick, className: menuOrganizationClassnames.button, endIcon: _jsx(StyledChevron, { isActive: isOpen, width: 24, height: 24 }), children: renderPreview ? (renderPreview(currentOrganization, {
|
|
14
15
|
className: hidePersonalDataClassname,
|
|
15
16
|
})) : (_jsxs(Container, { className: hidePersonalDataClassname, children: [_jsx(OverflowTypography, { variant: "h6", component: "div", children: name }), _jsxs(OrganizationData, { children: [_jsxs(StyledTypography, { "$isDisabled": isDisabled, variant: "caption", color: "textSecondary", children: ["\u0418\u041D\u041D ", inn] }), kpp && (_jsxs(StyledTypography, { "$isDisabled": isDisabled, variant: "caption", color: "textSecondary", children: ["\u041A\u041F\u041F ", kpp] }))] })] })) }));
|
|
16
17
|
if (isDisabled && disabledReason) {
|
|
@@ -2,7 +2,6 @@ import { Button } from '../../Button';
|
|
|
2
2
|
import { Chevron } from '../../Chevron';
|
|
3
3
|
import { styled } from '../../styled/styled';
|
|
4
4
|
import { Typography } from '../../Typography';
|
|
5
|
-
import { MOBILE_BUTTON_HEIGHT } from './constants';
|
|
6
5
|
export const StyledButton = styled(Button) `
|
|
7
6
|
display: flex;
|
|
8
7
|
align-items: center;
|
|
@@ -27,21 +26,17 @@ export const StyledButton = styled(Button) `
|
|
|
27
26
|
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
28
27
|
justify-content: space-between;
|
|
29
28
|
|
|
29
|
+
width: 100%;
|
|
30
30
|
max-width: unset;
|
|
31
|
-
height: ${MOBILE_BUTTON_HEIGHT};
|
|
32
|
-
padding: ${({ theme }) => theme.spacing(3, 4)};
|
|
33
31
|
|
|
34
|
-
border-bottom: 1px solid ${({ theme }) => theme.palette.grey[300]};
|
|
35
32
|
border-radius: 0;
|
|
36
33
|
|
|
37
34
|
&:hover {
|
|
38
35
|
background-color: initial;
|
|
39
|
-
border-bottom: 1px solid ${({ theme }) => theme.palette.grey[300]};
|
|
40
36
|
}
|
|
41
37
|
|
|
42
38
|
&:active {
|
|
43
39
|
background-color: ${({ theme }) => theme.palette.primary[100]};
|
|
44
|
-
border-bottom: 1px solid ${({ theme }) => theme.palette.grey[300]};
|
|
45
40
|
}
|
|
46
41
|
}
|
|
47
42
|
`;
|
|
@@ -5,5 +5,5 @@ export const PLACEHOLDER_HEIGHT = '108px';
|
|
|
5
5
|
export const menuOrganizationClassnames = {
|
|
6
6
|
root: createUIKitClassname('menu-organization'),
|
|
7
7
|
errorPlaceholder: createUIKitClassname('menu-organization__error-placeholder'),
|
|
8
|
-
|
|
8
|
+
button: createUIKitClassname('menu-organization__button'),
|
|
9
9
|
};
|
|
@@ -25,12 +25,6 @@ export declare const StyledTypography: import("../styled").StyledComponent<impor
|
|
|
25
25
|
} & import("react").HTMLAttributes<HTMLParagraphElement> & import("react").RefAttributes<HTMLSpanElement> & {
|
|
26
26
|
theme?: import("@emotion/react").Theme | undefined;
|
|
27
27
|
}, {}, {}>;
|
|
28
|
-
export declare const ButtonWrapper: import("../styled").StyledComponent<{
|
|
29
|
-
theme?: import("@emotion/react").Theme | undefined;
|
|
30
|
-
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
31
|
-
} & {
|
|
32
|
-
$alertHeight?: number | undefined;
|
|
33
|
-
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
34
28
|
export declare const StyledPopover: import("../styled").StyledComponent<import("..").WithoutEmotionSpecific<import("@mui/material").PopoverProps> & {
|
|
35
29
|
title?: string | undefined;
|
|
36
30
|
} & {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { bottomDrawerClassnames } from '../BottomDrawer';
|
|
2
2
|
import { OFFSET_TOP_SCREEN } from '../BottomDrawer/constants';
|
|
3
|
-
import { HEADER_HEIGHT_MOBILE } from '../DashboardLayout/constants';
|
|
4
3
|
import { Grid } from '../Grid';
|
|
5
4
|
import { Popover } from '../Popover';
|
|
6
5
|
import { loadingPlaceholderClassnames } from '../placeholders/LoadingPlaceholder';
|
|
@@ -80,34 +79,6 @@ export const OrganizationData = styled(Grid) `
|
|
|
80
79
|
export const StyledTypography = styled(Typography) `
|
|
81
80
|
color: ${({ theme }) => theme.palette.grey[600]};
|
|
82
81
|
`;
|
|
83
|
-
export const ButtonWrapper = styled.div `
|
|
84
|
-
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
85
|
-
position: absolute;
|
|
86
|
-
z-index: ${({ theme }) => theme.zIndex.appBar - 1};
|
|
87
|
-
top: ${({ $alertHeight }) => `calc(${$alertHeight}px + ${HEADER_HEIGHT_MOBILE}) `};
|
|
88
|
-
left: 0;
|
|
89
|
-
|
|
90
|
-
/* Необходимо для анимации компонента вместе с sidebar */
|
|
91
|
-
transform: translateX(-100vw);
|
|
92
|
-
|
|
93
|
-
display: flex;
|
|
94
|
-
flex-direction: column;
|
|
95
|
-
|
|
96
|
-
width: 100vw;
|
|
97
|
-
|
|
98
|
-
background-color: ${({ theme }) => theme.palette.background.default};
|
|
99
|
-
|
|
100
|
-
transition: ${({ theme }) => {
|
|
101
|
-
return theme.transitions.create(['transform'], {
|
|
102
|
-
duration: theme.transitions.duration.standard,
|
|
103
|
-
});
|
|
104
|
-
}};
|
|
105
|
-
|
|
106
|
-
&.${menuOrganizationClassnames.mobileVisible} {
|
|
107
|
-
transform: translateX(0);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
`;
|
|
111
82
|
export const StyledPopover = styled(Popover) `
|
|
112
83
|
|
|
113
84
|
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
import { useCallback, useContext, useMemo, useState, } from 'react';
|
|
2
2
|
import { DashboardContext } from '../../DashboardContext';
|
|
3
|
-
import { DashboardSidebarContext } from '../../DashboardSidebarProvider';
|
|
4
3
|
import { useHidePersonalData } from '../../personalDataSecurity';
|
|
5
4
|
import { usePopover } from '../../usePopover';
|
|
6
5
|
import { useViewportType } from '../../useViewportType';
|
|
7
|
-
import { classNames } from '../../utils/classNames';
|
|
8
|
-
import { menuOrganizationClassnames } from '../constants';
|
|
9
6
|
export const useLogic = ({ organizations = [], onChangeSearch, onChange, currentOrganizationGroupLabel, currentOrganization, groupBy, onClose, onOpen, isOpen: isOpenPopover, isDisabled, disabledReason, isHidePersonalData, action, isLoading, isError, onRetry, renderItem, renderPreview, }) => {
|
|
10
|
-
const { isLoading: isDashboardLoading
|
|
7
|
+
const { isLoading: isDashboardLoading } = useContext(DashboardContext);
|
|
11
8
|
const [searchValue, setSearchValue] = useState('');
|
|
12
9
|
const [anchorButtonEl, setAnchorButtonEl] = useState(null);
|
|
13
|
-
const { isPinned } = useContext(DashboardSidebarContext);
|
|
14
10
|
const { isMobile } = useViewportType();
|
|
15
11
|
const { onClick, ...restActionProps } = action || {};
|
|
16
12
|
const buttonRef = useCallback((node) => {
|
|
@@ -64,7 +60,6 @@ export const useLogic = ({ organizations = [], onChangeSearch, onChange, current
|
|
|
64
60
|
const renderPreviewWrapper = useMemo(() => renderPreview
|
|
65
61
|
? (organization, params) => renderPreview(organization, params)
|
|
66
62
|
: undefined, [renderPreview]);
|
|
67
|
-
const classnames = useMemo(() => classNames({ [menuOrganizationClassnames.mobileVisible]: isPinned }), [isPinned]);
|
|
68
63
|
return {
|
|
69
64
|
actionButtonProps: {
|
|
70
65
|
onClick: handleActionClick,
|
|
@@ -109,7 +104,5 @@ export const useLogic = ({ organizations = [], onChangeSearch, onChange, current
|
|
|
109
104
|
},
|
|
110
105
|
isShowSearchField,
|
|
111
106
|
isMobile,
|
|
112
|
-
classnames,
|
|
113
|
-
alertHeight,
|
|
114
107
|
};
|
|
115
108
|
};
|
|
@@ -6,5 +6,5 @@ export const Title = ({ backButton, title, isLoading, hasDescription, hasBreadcr
|
|
|
6
6
|
if (!title && isLoading) {
|
|
7
7
|
return _jsx(StyledSkeleton, { height: 20, width: 280, variant: "rounded" });
|
|
8
8
|
}
|
|
9
|
-
return (_jsxs(_Fragment, { children: [backButton && (_jsx(BackButton, { ...backButton, variant: "outlined", color: "grey", size: "medium", children: _jsx(ArrowLOutlineMd, {}) })), typeof title === 'string' ? (_jsx(TitleWrapper, { component: "h1", variant: "h3", "$hasDescription": hasDescription, "$hasBreadcrumbs": hasBreadcrumbs, children: _jsx(OverflowTypography, { component: "div", variant: "inherit", children: title }) })) : (_jsx(TitleWrapper, { component: "div", role: "heading", variant: "h3", "aria-level": 1, "$hasDescription": hasDescription, "$hasBreadcrumbs": hasBreadcrumbs, children: title }))] }));
|
|
9
|
+
return (_jsxs(_Fragment, { children: [backButton && (_jsx(BackButton, { ...backButton, variant: "outlined", color: "grey", size: "medium", children: _jsx(ArrowLOutlineMd, {}) })), typeof title === 'string' ? (_jsx(TitleWrapper, { component: "h1", variant: "h3", "$hasDescription": hasDescription || isLoading, "$hasBreadcrumbs": hasBreadcrumbs, children: _jsx(OverflowTypography, { component: "div", variant: "inherit", children: title }) })) : (_jsx(TitleWrapper, { component: "div", role: "heading", variant: "h3", "aria-level": 1, "$hasDescription": hasDescription, "$hasBreadcrumbs": hasBreadcrumbs, children: title }))] }));
|
|
10
10
|
};
|
|
@@ -18,6 +18,6 @@ const useLogic_1 = require("./useLogic");
|
|
|
18
18
|
*/
|
|
19
19
|
exports.Header = (0, react_1.forwardRef)((props, ref) => {
|
|
20
20
|
const { productSwitcher: ProductSwitcher, product, profile, menuOrganization, children, } = props;
|
|
21
|
-
const { isShowExitButton, isShowProfile, isFocusedMode, isMobile, collapsedIn, onToggleSidebar, isLoading, } = (0, useLogic_1.useLogic)(props);
|
|
22
|
-
return ((0, jsx_runtime_1.jsx)(styles_1.HeaderRoot, { ref: ref, "$isFocusedMode": isFocusedMode, ...(0, getInertProps_1.getInertProps)(!isMobile && isFocusedMode), className: constants_1.dashboardLayoutHeaderClassnames.root, children: (0, jsx_runtime_1.jsxs)(styles_1.HeaderContent, { children: [(0, jsx_runtime_1.jsx)(styles_1.MobileSidebarTogglerWrapper, { className: constants_1.dashboardLayoutHeaderClassnames.mobileSidebarButton, children: (0, jsx_runtime_1.jsx)(Button_1.Button, { startIcon: collapsedIn ? (0, jsx_runtime_1.jsx)(CrossOutlineMd_1.CrossOutlineMd, {}) : (0, jsx_runtime_1.jsx)(MenuOnOutlineMd_1.MenuOnOutlineMd, {}), variant: "text", onClick: () => onToggleSidebar(), title: "\u041F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u044C \u0431\u043E\u043A\u043E\u0432\u043E\u0435 \u043C\u0435\u043D\u044E" }) }), (0, jsx_runtime_1.jsxs)(styles_1.HeaderSection, { children: [ProductSwitcher && ((0, jsx_runtime_1.jsx)(styles_1.ProductSwitcherWrapper, { children: (0, jsx_runtime_1.jsx)(ProductSwitcher, {}) })), (0, jsx_runtime_1.jsx)(Product_1.Product, { ...product })] }), (0, jsx_runtime_1.jsxs)(styles_1.HeaderContentSection, { children: [children, menuOrganization
|
|
21
|
+
const { isShowExitButton, isShowProfile, isFocusedMode, isMobile, collapsedIn, onToggleSidebar, isLoading, alertHeight, menuOrganizationClassnames, } = (0, useLogic_1.useLogic)(props);
|
|
22
|
+
return ((0, jsx_runtime_1.jsx)(styles_1.HeaderRoot, { ref: ref, "$isFocusedMode": isFocusedMode, ...(0, getInertProps_1.getInertProps)(!isMobile && isFocusedMode), className: constants_1.dashboardLayoutHeaderClassnames.root, children: (0, jsx_runtime_1.jsxs)(styles_1.HeaderContent, { children: [(0, jsx_runtime_1.jsx)(styles_1.MobileSidebarTogglerWrapper, { className: constants_1.dashboardLayoutHeaderClassnames.mobileSidebarButton, children: (0, jsx_runtime_1.jsx)(Button_1.Button, { startIcon: collapsedIn ? (0, jsx_runtime_1.jsx)(CrossOutlineMd_1.CrossOutlineMd, {}) : (0, jsx_runtime_1.jsx)(MenuOnOutlineMd_1.MenuOnOutlineMd, {}), variant: "text", onClick: () => onToggleSidebar(), title: "\u041F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u044C \u0431\u043E\u043A\u043E\u0432\u043E\u0435 \u043C\u0435\u043D\u044E" }) }), (0, jsx_runtime_1.jsxs)(styles_1.HeaderSection, { children: [ProductSwitcher && ((0, jsx_runtime_1.jsx)(styles_1.ProductSwitcherWrapper, { children: (0, jsx_runtime_1.jsx)(ProductSwitcher, {}) })), (0, jsx_runtime_1.jsx)(Product_1.Product, { ...product })] }), (0, jsx_runtime_1.jsxs)(styles_1.HeaderContentSection, { children: [children, menuOrganization && ((0, jsx_runtime_1.jsx)(styles_1.MenuOrganizationWrapper, { className: menuOrganizationClassnames, "$alertHeight": alertHeight, children: menuOrganization() })), profile && ((0, jsx_runtime_1.jsx)(styles_1.ProfileWrapper, { "$isShow": isShowProfile, children: (0, jsx_runtime_1.jsx)(Profile_1.Profile, { isLoading: isLoading, ...profile }) })), (0, jsx_runtime_1.jsx)(styles_1.ExitButton, { "$isShow": isShowExitButton, onClick: profile?.exitButton?.onClick, title: "\u0412\u044B\u0445\u043E\u0434", variant: "text", children: (0, jsx_runtime_1.jsx)(QuitOutlineMd_1.QuitOutlineMd, {}) })] })] }) }));
|
|
23
23
|
});
|
|
@@ -5,4 +5,5 @@ const createUIKitClassname_1 = require("../../utils/createUIKitClassname");
|
|
|
5
5
|
exports.dashboardLayoutHeaderClassnames = {
|
|
6
6
|
root: (0, createUIKitClassname_1.createUIKitClassname)('dashboard-layout-header'),
|
|
7
7
|
mobileSidebarButton: (0, createUIKitClassname_1.createUIKitClassname)('dashboard-layout-header__sidebar-button_mobile'),
|
|
8
|
+
mobileMenuOrganizationVisible: (0, createUIKitClassname_1.createUIKitClassname)('dashboard-layout-header__menu-organization_visible'),
|
|
8
9
|
};
|
|
@@ -44,3 +44,9 @@ export declare const HeaderContent: import("@emotion/styled/dist/declarations/sr
|
|
|
44
44
|
theme?: import("@emotion/react").Theme | undefined;
|
|
45
45
|
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
46
46
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
47
|
+
export declare const MenuOrganizationWrapper: import("@emotion/styled/dist/declarations/src/types").StyledComponent<{
|
|
48
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
49
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
50
|
+
} & {
|
|
51
|
+
$alertHeight?: number | undefined;
|
|
52
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HeaderContent = exports.ExitButton = exports.ProfileWrapper = exports.ProductSwitcherWrapper = exports.HeaderContentSection = exports.HeaderSection = exports.MobileSidebarTogglerWrapper = exports.HeaderRoot = void 0;
|
|
3
|
+
exports.MenuOrganizationWrapper = exports.HeaderContent = exports.ExitButton = exports.ProfileWrapper = exports.ProductSwitcherWrapper = exports.HeaderContentSection = exports.HeaderSection = exports.MobileSidebarTogglerWrapper = exports.HeaderRoot = void 0;
|
|
4
4
|
const Button_1 = require("@mui/material/Button");
|
|
5
5
|
const constants_1 = require("../../DashboardSidebar/constants");
|
|
6
6
|
const IconButton_1 = require("../../IconButton");
|
|
7
|
+
const constants_2 = require("../../MenuOrganization/constants");
|
|
8
|
+
const constants_3 = require("../../MenuOrganization/OrganizationButton/constants");
|
|
7
9
|
const styled_1 = require("../../styled");
|
|
8
|
-
const
|
|
10
|
+
const constants_4 = require("../constants");
|
|
11
|
+
const constants_5 = require("./constants");
|
|
9
12
|
exports.HeaderRoot = (0, styled_1.styled)('header', {
|
|
10
13
|
shouldForwardProp: (prop) => !['$isFocusedMode'].includes(prop),
|
|
11
14
|
}) `
|
|
@@ -18,8 +21,8 @@ exports.HeaderRoot = (0, styled_1.styled)('header', {
|
|
|
18
21
|
justify-content: space-between;
|
|
19
22
|
|
|
20
23
|
width: 100%;
|
|
21
|
-
height: ${
|
|
22
|
-
margin-top: ${({ $isFocusedMode }) => $isFocusedMode ? `-${
|
|
24
|
+
height: ${constants_4.HEADER_HEIGHT};
|
|
25
|
+
margin-top: ${({ $isFocusedMode }) => $isFocusedMode ? `-${constants_4.HEADER_HEIGHT}` : 0};
|
|
23
26
|
margin-bottom: ${({ theme }) => theme.spacing(4)};
|
|
24
27
|
|
|
25
28
|
transition: ${({ theme }) => {
|
|
@@ -32,7 +35,7 @@ exports.HeaderRoot = (0, styled_1.styled)('header', {
|
|
|
32
35
|
grid-row: 2;
|
|
33
36
|
justify-content: flex-start;
|
|
34
37
|
|
|
35
|
-
height: ${
|
|
38
|
+
height: ${constants_4.HEADER_HEIGHT_MOBILE};
|
|
36
39
|
margin-bottom: 0;
|
|
37
40
|
padding: ${({ theme }) => theme.spacing(0, 2, 0, 1)};
|
|
38
41
|
|
|
@@ -51,7 +54,7 @@ exports.MobileSidebarTogglerWrapper = styled_1.styled.div `
|
|
|
51
54
|
padding: ${({ theme }) => theme.spacing(2)};
|
|
52
55
|
}
|
|
53
56
|
|
|
54
|
-
.${
|
|
57
|
+
.${constants_4.dashboardLayoutClassnames.root}:not(:has(.${constants_1.dashboardSidebarClassnames.root}))
|
|
55
58
|
& {
|
|
56
59
|
display: none;
|
|
57
60
|
}
|
|
@@ -105,3 +108,46 @@ exports.HeaderContent = styled_1.styled.div `
|
|
|
105
108
|
padding: 0;
|
|
106
109
|
}
|
|
107
110
|
`;
|
|
111
|
+
exports.MenuOrganizationWrapper = styled_1.styled.div `
|
|
112
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
113
|
+
position: absolute;
|
|
114
|
+
z-index: ${({ theme }) => theme.zIndex.appBar - 1};
|
|
115
|
+
top: ${({ $alertHeight }) => `calc(${$alertHeight}px + ${constants_4.HEADER_HEIGHT_MOBILE}) `};
|
|
116
|
+
left: 0;
|
|
117
|
+
|
|
118
|
+
/* Необходимо для анимации компонента вместе с sidebar */
|
|
119
|
+
transform: translateX(-100vw);
|
|
120
|
+
|
|
121
|
+
display: flex;
|
|
122
|
+
flex-direction: column;
|
|
123
|
+
|
|
124
|
+
width: 100vw;
|
|
125
|
+
|
|
126
|
+
background-color: ${({ theme }) => theme.palette.background.default};
|
|
127
|
+
|
|
128
|
+
transition: ${({ theme }) => {
|
|
129
|
+
return theme.transitions.create(['transform'], {
|
|
130
|
+
duration: theme.transitions.duration.standard,
|
|
131
|
+
});
|
|
132
|
+
}};
|
|
133
|
+
|
|
134
|
+
&.${constants_5.dashboardLayoutHeaderClassnames.mobileMenuOrganizationVisible} {
|
|
135
|
+
transform: translateX(0);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
& .${constants_2.menuOrganizationClassnames.button} {
|
|
139
|
+
height: ${constants_3.MOBILE_BUTTON_HEIGHT};
|
|
140
|
+
padding: ${({ theme }) => theme.spacing(3, 4)};
|
|
141
|
+
|
|
142
|
+
border-bottom: 1px solid ${({ theme }) => theme.palette.grey[300]};
|
|
143
|
+
|
|
144
|
+
&:hover {
|
|
145
|
+
border-bottom: 1px solid ${({ theme }) => theme.palette.grey[300]};
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
&:active {
|
|
149
|
+
border-bottom: 1px solid ${({ theme }) => theme.palette.grey[300]};
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
`;
|
|
@@ -5,9 +5,11 @@ const react_1 = require("react");
|
|
|
5
5
|
const DashboardContext_1 = require("../../../DashboardContext");
|
|
6
6
|
const DashboardSidebarProvider_1 = require("../../../DashboardSidebarProvider");
|
|
7
7
|
const useViewportType_1 = require("../../../useViewportType");
|
|
8
|
+
const classNames_1 = require("../../../utils/classNames");
|
|
9
|
+
const constants_1 = require("../constants");
|
|
8
10
|
const useLogic = ({ profile, menuOrganization }) => {
|
|
9
|
-
const { isFocusedMode, isLoading, hasMenuOrganizationRef } = (0, react_1.useContext)(DashboardContext_1.DashboardContext);
|
|
10
|
-
const { collapsedIn, onToggleSidebar } = (0, react_1.useContext)(DashboardSidebarProvider_1.DashboardSidebarContext);
|
|
11
|
+
const { isFocusedMode, isLoading, hasMenuOrganizationRef, alertHeight } = (0, react_1.useContext)(DashboardContext_1.DashboardContext);
|
|
12
|
+
const { collapsedIn, onToggleSidebar, isPinned } = (0, react_1.useContext)(DashboardSidebarProvider_1.DashboardSidebarContext);
|
|
11
13
|
(0, react_1.useEffect)(() => {
|
|
12
14
|
hasMenuOrganizationRef.current = Boolean(menuOrganization);
|
|
13
15
|
}, [menuOrganization]);
|
|
@@ -15,6 +17,9 @@ const useLogic = ({ profile, menuOrganization }) => {
|
|
|
15
17
|
const hasMenu = Boolean(profile?.menu || profile?.menuList);
|
|
16
18
|
const isShowProfile = (Boolean(profile) && !isMobile) || (hasMenu && isMobile);
|
|
17
19
|
const isShowExitButton = isMobile && !hasMenu && Boolean(profile?.exitButton);
|
|
20
|
+
const menuOrganizationClassnames = (0, react_1.useMemo)(() => (0, classNames_1.classNames)({
|
|
21
|
+
[constants_1.dashboardLayoutHeaderClassnames.mobileMenuOrganizationVisible]: isPinned,
|
|
22
|
+
}), [isPinned]);
|
|
18
23
|
return {
|
|
19
24
|
isShowExitButton,
|
|
20
25
|
isShowProfile,
|
|
@@ -23,6 +28,8 @@ const useLogic = ({ profile, menuOrganization }) => {
|
|
|
23
28
|
isLoading,
|
|
24
29
|
collapsedIn,
|
|
25
30
|
onToggleSidebar,
|
|
31
|
+
alertHeight,
|
|
32
|
+
menuOrganizationClassnames,
|
|
26
33
|
};
|
|
27
34
|
};
|
|
28
35
|
exports.useLogic = useLogic;
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Footer = exports.SidebarContent = exports.SidebarHeader = exports.SidebarRoot = exports.StyledPaper = exports.Wrapper = void 0;
|
|
4
4
|
const constants_1 = require("../DashboardLayout/constants");
|
|
5
|
+
const constants_2 = require("../MenuOrganization/constants");
|
|
5
6
|
const OrganizationButton_1 = require("../MenuOrganization/OrganizationButton");
|
|
6
7
|
const Paper_1 = require("../Paper");
|
|
7
8
|
const PinButton_1 = require("../PinButton");
|
|
8
9
|
const styled_1 = require("../styled");
|
|
9
|
-
const
|
|
10
|
+
const constants_3 = require("./constants");
|
|
10
11
|
exports.Wrapper = (0, styled_1.styled)('div', {
|
|
11
12
|
shouldForwardProp: (prop) => !['$isPinned', '$alertHeight'].includes(prop),
|
|
12
13
|
}) `
|
|
@@ -35,7 +36,7 @@ exports.Wrapper = (0, styled_1.styled)('div', {
|
|
|
35
36
|
});
|
|
36
37
|
}};
|
|
37
38
|
|
|
38
|
-
&.${
|
|
39
|
+
&.${constants_3.dashboardSidebarClassnames.hasMenuOrganization} {
|
|
39
40
|
top: ${({ $alertHeight }) => `calc(${$alertHeight}px + ${constants_1.HEADER_HEIGHT_MOBILE} + ${OrganizationButton_1.MOBILE_BUTTON_HEIGHT}) `};
|
|
40
41
|
}
|
|
41
42
|
}
|
|
@@ -86,6 +87,15 @@ exports.SidebarHeader = styled_1.styled.header `
|
|
|
86
87
|
padding: ${({ theme }) => theme.spacing(4)};
|
|
87
88
|
|
|
88
89
|
border-bottom: 1px solid ${({ theme }) => theme.palette.grey[300]};
|
|
90
|
+
|
|
91
|
+
&:has(.${constants_2.menuOrganizationClassnames.button}) {
|
|
92
|
+
padding: 0;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
& .${constants_2.menuOrganizationClassnames.button} {
|
|
96
|
+
height: ${OrganizationButton_1.MOBILE_BUTTON_HEIGHT};
|
|
97
|
+
padding: ${({ theme }) => theme.spacing(3, 4)};
|
|
98
|
+
}
|
|
89
99
|
}
|
|
90
100
|
`;
|
|
91
101
|
exports.SidebarContent = styled_1.styled.div `
|
|
@@ -15,11 +15,11 @@ const styles_1 = require("./styles");
|
|
|
15
15
|
const useLogic_1 = require("./useLogic");
|
|
16
16
|
const MenuOrganization = (props) => {
|
|
17
17
|
const { anchorOrigin = { vertical: 'bottom', horizontal: 'right' }, transformOrigin = { vertical: 'top', horizontal: 'right' }, } = props;
|
|
18
|
-
const { actionButtonProps, hasAction, isLoading, isError, onRetry, isComponentLoading, isShowOrganizationList, searchProps, popoverProps, organizationListProps, organizationButtonProps, isShowSearchField, isMobile,
|
|
18
|
+
const { actionButtonProps, hasAction, isLoading, isError, onRetry, isComponentLoading, isShowOrganizationList, searchProps, popoverProps, organizationListProps, organizationButtonProps, isShowSearchField, isMobile, } = (0, useLogic_1.useLogic)(props);
|
|
19
19
|
if (isComponentLoading) {
|
|
20
20
|
return (0, jsx_runtime_1.jsx)(MenuOrganizationSkeleton_1.MenuOrganizationSkeleton, {});
|
|
21
21
|
}
|
|
22
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(
|
|
22
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(OrganizationButton_1.OrganizationButton, { ...organizationButtonProps }), (0, jsx_runtime_1.jsxs)(styles_1.StyledPopover, { ...popoverProps, anchorOrigin: anchorOrigin, transformOrigin: transformOrigin, title: constants_1.POPOVER_TITLE, children: [isShowSearchField && ((0, jsx_runtime_1.jsx)(styles_1.SearchWrapper, { children: (0, jsx_runtime_1.jsx)(SearchField_1.SearchField, { fullWidth: true, ...searchProps }) })), (0, jsx_runtime_1.jsx)(styles_1.OrganizationsWrapper, { "$isLoading": isLoading, className: constants_1.menuOrganizationClassnames.root, children: (0, jsx_runtime_1.jsx)(ContentState_1.ContentState, { isLoading: isLoading, isCustom: isError, customState: {
|
|
23
23
|
title: ((0, jsx_runtime_1.jsx)(styles_1.StyledTypography, { children: "\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0434\u0430\u043D\u043D\u044B\u0435" })),
|
|
24
24
|
Actions: ((0, jsx_runtime_1.jsx)(Button_1.Button, { variant: "light", color: "grey", onClick: onRetry, children: "\u041F\u043E\u043F\u0440\u043E\u0431\u043E\u0432\u0430\u0442\u044C \u0441\u043D\u043E\u0432\u0430" })),
|
|
25
25
|
className: constants_1.menuOrganizationClassnames.errorPlaceholder,
|
|
@@ -6,6 +6,7 @@ const react_1 = require("react");
|
|
|
6
6
|
const OverflowTypography_1 = require("../../OverflowTypography");
|
|
7
7
|
const personalDataSecurity_1 = require("../../personalDataSecurity");
|
|
8
8
|
const Tooltip_1 = require("../../Tooltip");
|
|
9
|
+
const constants_1 = require("../constants");
|
|
9
10
|
const styles_1 = require("../styles");
|
|
10
11
|
const styles_2 = require("./styles");
|
|
11
12
|
exports.OrganizationButton = (0, react_1.forwardRef)(({ onClick, isOpen, currentOrganization, isDisabled, disabledReason, isHidePersonalData, renderPreview, }, ref) => {
|
|
@@ -13,7 +14,7 @@ exports.OrganizationButton = (0, react_1.forwardRef)(({ onClick, isOpen, current
|
|
|
13
14
|
const hidePersonalDataClassname = (0, personalDataSecurity_1.useHidePersonalData)({
|
|
14
15
|
isEnabled: isHidePersonalData,
|
|
15
16
|
});
|
|
16
|
-
const renderButton = () => ((0, jsx_runtime_1.jsx)(styles_2.StyledButton, { ref: ref, variant: "text", disabled: isDisabled, onClick: onClick, endIcon: (0, jsx_runtime_1.jsx)(styles_2.StyledChevron, { isActive: isOpen, width: 24, height: 24 }), children: renderPreview ? (renderPreview(currentOrganization, {
|
|
17
|
+
const renderButton = () => ((0, jsx_runtime_1.jsx)(styles_2.StyledButton, { ref: ref, variant: "text", disabled: isDisabled, onClick: onClick, className: constants_1.menuOrganizationClassnames.button, endIcon: (0, jsx_runtime_1.jsx)(styles_2.StyledChevron, { isActive: isOpen, width: 24, height: 24 }), children: renderPreview ? (renderPreview(currentOrganization, {
|
|
17
18
|
className: hidePersonalDataClassname,
|
|
18
19
|
})) : ((0, jsx_runtime_1.jsxs)(styles_2.Container, { className: hidePersonalDataClassname, children: [(0, jsx_runtime_1.jsx)(OverflowTypography_1.OverflowTypography, { variant: "h6", component: "div", children: name }), (0, jsx_runtime_1.jsxs)(styles_1.OrganizationData, { children: [(0, jsx_runtime_1.jsxs)(styles_2.StyledTypography, { "$isDisabled": isDisabled, variant: "caption", color: "textSecondary", children: ["\u0418\u041D\u041D ", inn] }), kpp && ((0, jsx_runtime_1.jsxs)(styles_2.StyledTypography, { "$isDisabled": isDisabled, variant: "caption", color: "textSecondary", children: ["\u041A\u041F\u041F ", kpp] }))] })] })) }));
|
|
19
20
|
if (isDisabled && disabledReason) {
|
|
@@ -5,7 +5,6 @@ const Button_1 = require("../../Button");
|
|
|
5
5
|
const Chevron_1 = require("../../Chevron");
|
|
6
6
|
const styled_1 = require("../../styled/styled");
|
|
7
7
|
const Typography_1 = require("../../Typography");
|
|
8
|
-
const constants_1 = require("./constants");
|
|
9
8
|
exports.StyledButton = (0, styled_1.styled)(Button_1.Button) `
|
|
10
9
|
display: flex;
|
|
11
10
|
align-items: center;
|
|
@@ -30,21 +29,17 @@ exports.StyledButton = (0, styled_1.styled)(Button_1.Button) `
|
|
|
30
29
|
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
31
30
|
justify-content: space-between;
|
|
32
31
|
|
|
32
|
+
width: 100%;
|
|
33
33
|
max-width: unset;
|
|
34
|
-
height: ${constants_1.MOBILE_BUTTON_HEIGHT};
|
|
35
|
-
padding: ${({ theme }) => theme.spacing(3, 4)};
|
|
36
34
|
|
|
37
|
-
border-bottom: 1px solid ${({ theme }) => theme.palette.grey[300]};
|
|
38
35
|
border-radius: 0;
|
|
39
36
|
|
|
40
37
|
&:hover {
|
|
41
38
|
background-color: initial;
|
|
42
|
-
border-bottom: 1px solid ${({ theme }) => theme.palette.grey[300]};
|
|
43
39
|
}
|
|
44
40
|
|
|
45
41
|
&:active {
|
|
46
42
|
background-color: ${({ theme }) => theme.palette.primary[100]};
|
|
47
|
-
border-bottom: 1px solid ${({ theme }) => theme.palette.grey[300]};
|
|
48
43
|
}
|
|
49
44
|
}
|
|
50
45
|
`;
|
|
@@ -8,5 +8,5 @@ exports.PLACEHOLDER_HEIGHT = '108px';
|
|
|
8
8
|
exports.menuOrganizationClassnames = {
|
|
9
9
|
root: (0, createUIKitClassname_1.createUIKitClassname)('menu-organization'),
|
|
10
10
|
errorPlaceholder: (0, createUIKitClassname_1.createUIKitClassname)('menu-organization__error-placeholder'),
|
|
11
|
-
|
|
11
|
+
button: (0, createUIKitClassname_1.createUIKitClassname)('menu-organization__button'),
|
|
12
12
|
};
|
|
@@ -25,12 +25,6 @@ export declare const StyledTypography: import("@emotion/styled/dist/declarations
|
|
|
25
25
|
} & import("react").HTMLAttributes<HTMLParagraphElement> & import("react").RefAttributes<HTMLSpanElement> & {
|
|
26
26
|
theme?: import("@emotion/react").Theme | undefined;
|
|
27
27
|
}, {}, {}>;
|
|
28
|
-
export declare const ButtonWrapper: import("@emotion/styled/dist/declarations/src/types").StyledComponent<{
|
|
29
|
-
theme?: import("@emotion/react").Theme | undefined;
|
|
30
|
-
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
31
|
-
} & {
|
|
32
|
-
$alertHeight?: number | undefined;
|
|
33
|
-
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
34
28
|
export declare const StyledPopover: import("@emotion/styled/dist/declarations/src/types").StyledComponent<import("..").WithoutEmotionSpecific<import("@mui/material").PopoverProps> & {
|
|
35
29
|
title?: string | undefined;
|
|
36
30
|
} & {
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StyledPopover = exports.
|
|
3
|
+
exports.StyledPopover = exports.StyledTypography = exports.OrganizationData = exports.OrganizationsWrapper = exports.SearchWrapper = exports.ActionWrapper = void 0;
|
|
4
4
|
const BottomDrawer_1 = require("../BottomDrawer");
|
|
5
5
|
const constants_1 = require("../BottomDrawer/constants");
|
|
6
|
-
const constants_2 = require("../DashboardLayout/constants");
|
|
7
6
|
const Grid_1 = require("../Grid");
|
|
8
7
|
const Popover_1 = require("../Popover");
|
|
9
8
|
const LoadingPlaceholder_1 = require("../placeholders/LoadingPlaceholder");
|
|
10
9
|
const Placeholder_1 = require("../placeholders/Placeholder");
|
|
11
10
|
const styled_1 = require("../styled");
|
|
12
11
|
const Typography_1 = require("../Typography");
|
|
13
|
-
const
|
|
12
|
+
const constants_2 = require("./constants");
|
|
14
13
|
exports.ActionWrapper = styled_1.styled.div `
|
|
15
14
|
padding: ${({ theme }) => theme.spacing(2)};
|
|
16
15
|
|
|
@@ -39,14 +38,14 @@ exports.OrganizationsWrapper = styled_1.styled.div `
|
|
|
39
38
|
|
|
40
39
|
box-sizing: ${({ $isLoading }) => ($isLoading ? 'content-box' : 'inherit')};
|
|
41
40
|
width: 300px;
|
|
42
|
-
min-height: ${({ $isLoading }) => ($isLoading ?
|
|
41
|
+
min-height: ${({ $isLoading }) => ($isLoading ? constants_2.PLACEHOLDER_HEIGHT : '64px')};
|
|
43
42
|
max-height: 328px;
|
|
44
43
|
|
|
45
|
-
& .${
|
|
44
|
+
& .${constants_2.menuOrganizationClassnames.errorPlaceholder} {
|
|
46
45
|
display: flex;
|
|
47
46
|
gap: ${({ theme }) => theme.spacing(1)};
|
|
48
47
|
|
|
49
|
-
height: ${
|
|
48
|
+
height: ${constants_2.PLACEHOLDER_HEIGHT};
|
|
50
49
|
}
|
|
51
50
|
|
|
52
51
|
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
@@ -58,7 +57,7 @@ exports.OrganizationsWrapper = styled_1.styled.div `
|
|
|
58
57
|
justify-content: unset;
|
|
59
58
|
}
|
|
60
59
|
|
|
61
|
-
& .${
|
|
60
|
+
& .${constants_2.menuOrganizationClassnames.errorPlaceholder} {
|
|
62
61
|
gap: ${({ theme }) => theme.spacing(6)};
|
|
63
62
|
justify-content: center;
|
|
64
63
|
|
|
@@ -83,34 +82,6 @@ exports.OrganizationData = (0, styled_1.styled)(Grid_1.Grid) `
|
|
|
83
82
|
exports.StyledTypography = (0, styled_1.styled)(Typography_1.Typography) `
|
|
84
83
|
color: ${({ theme }) => theme.palette.grey[600]};
|
|
85
84
|
`;
|
|
86
|
-
exports.ButtonWrapper = styled_1.styled.div `
|
|
87
|
-
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
88
|
-
position: absolute;
|
|
89
|
-
z-index: ${({ theme }) => theme.zIndex.appBar - 1};
|
|
90
|
-
top: ${({ $alertHeight }) => `calc(${$alertHeight}px + ${constants_2.HEADER_HEIGHT_MOBILE}) `};
|
|
91
|
-
left: 0;
|
|
92
|
-
|
|
93
|
-
/* Необходимо для анимации компонента вместе с sidebar */
|
|
94
|
-
transform: translateX(-100vw);
|
|
95
|
-
|
|
96
|
-
display: flex;
|
|
97
|
-
flex-direction: column;
|
|
98
|
-
|
|
99
|
-
width: 100vw;
|
|
100
|
-
|
|
101
|
-
background-color: ${({ theme }) => theme.palette.background.default};
|
|
102
|
-
|
|
103
|
-
transition: ${({ theme }) => {
|
|
104
|
-
return theme.transitions.create(['transform'], {
|
|
105
|
-
duration: theme.transitions.duration.standard,
|
|
106
|
-
});
|
|
107
|
-
}};
|
|
108
|
-
|
|
109
|
-
&.${constants_3.menuOrganizationClassnames.mobileVisible} {
|
|
110
|
-
transform: translateX(0);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
`;
|
|
114
85
|
exports.StyledPopover = (0, styled_1.styled)(Popover_1.Popover) `
|
|
115
86
|
|
|
116
87
|
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
@@ -3,17 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useLogic = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const DashboardContext_1 = require("../../DashboardContext");
|
|
6
|
-
const DashboardSidebarProvider_1 = require("../../DashboardSidebarProvider");
|
|
7
6
|
const personalDataSecurity_1 = require("../../personalDataSecurity");
|
|
8
7
|
const usePopover_1 = require("../../usePopover");
|
|
9
8
|
const useViewportType_1 = require("../../useViewportType");
|
|
10
|
-
const classNames_1 = require("../../utils/classNames");
|
|
11
|
-
const constants_1 = require("../constants");
|
|
12
9
|
const useLogic = ({ organizations = [], onChangeSearch, onChange, currentOrganizationGroupLabel, currentOrganization, groupBy, onClose, onOpen, isOpen: isOpenPopover, isDisabled, disabledReason, isHidePersonalData, action, isLoading, isError, onRetry, renderItem, renderPreview, }) => {
|
|
13
|
-
const { isLoading: isDashboardLoading
|
|
10
|
+
const { isLoading: isDashboardLoading } = (0, react_1.useContext)(DashboardContext_1.DashboardContext);
|
|
14
11
|
const [searchValue, setSearchValue] = (0, react_1.useState)('');
|
|
15
12
|
const [anchorButtonEl, setAnchorButtonEl] = (0, react_1.useState)(null);
|
|
16
|
-
const { isPinned } = (0, react_1.useContext)(DashboardSidebarProvider_1.DashboardSidebarContext);
|
|
17
13
|
const { isMobile } = (0, useViewportType_1.useViewportType)();
|
|
18
14
|
const { onClick, ...restActionProps } = action || {};
|
|
19
15
|
const buttonRef = (0, react_1.useCallback)((node) => {
|
|
@@ -67,7 +63,6 @@ const useLogic = ({ organizations = [], onChangeSearch, onChange, currentOrganiz
|
|
|
67
63
|
const renderPreviewWrapper = (0, react_1.useMemo)(() => renderPreview
|
|
68
64
|
? (organization, params) => renderPreview(organization, params)
|
|
69
65
|
: undefined, [renderPreview]);
|
|
70
|
-
const classnames = (0, react_1.useMemo)(() => (0, classNames_1.classNames)({ [constants_1.menuOrganizationClassnames.mobileVisible]: isPinned }), [isPinned]);
|
|
71
66
|
return {
|
|
72
67
|
actionButtonProps: {
|
|
73
68
|
onClick: handleActionClick,
|
|
@@ -112,8 +107,6 @@ const useLogic = ({ organizations = [], onChangeSearch, onChange, currentOrganiz
|
|
|
112
107
|
},
|
|
113
108
|
isShowSearchField,
|
|
114
109
|
isMobile,
|
|
115
|
-
classnames,
|
|
116
|
-
alertHeight,
|
|
117
110
|
};
|
|
118
111
|
};
|
|
119
112
|
exports.useLogic = useLogic;
|
|
@@ -9,6 +9,6 @@ const Title = ({ backButton, title, isLoading, hasDescription, hasBreadcrumbs, }
|
|
|
9
9
|
if (!title && isLoading) {
|
|
10
10
|
return (0, jsx_runtime_1.jsx)(styles_1.StyledSkeleton, { height: 20, width: 280, variant: "rounded" });
|
|
11
11
|
}
|
|
12
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [backButton && ((0, jsx_runtime_1.jsx)(styles_1.BackButton, { ...backButton, variant: "outlined", color: "grey", size: "medium", children: (0, jsx_runtime_1.jsx)(ArrowLOutlineMd_1.ArrowLOutlineMd, {}) })), typeof title === 'string' ? ((0, jsx_runtime_1.jsx)(styles_1.TitleWrapper, { component: "h1", variant: "h3", "$hasDescription": hasDescription, "$hasBreadcrumbs": hasBreadcrumbs, children: (0, jsx_runtime_1.jsx)(OverflowTypography_1.OverflowTypography, { component: "div", variant: "inherit", children: title }) })) : ((0, jsx_runtime_1.jsx)(styles_1.TitleWrapper, { component: "div", role: "heading", variant: "h3", "aria-level": 1, "$hasDescription": hasDescription, "$hasBreadcrumbs": hasBreadcrumbs, children: title }))] }));
|
|
12
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [backButton && ((0, jsx_runtime_1.jsx)(styles_1.BackButton, { ...backButton, variant: "outlined", color: "grey", size: "medium", children: (0, jsx_runtime_1.jsx)(ArrowLOutlineMd_1.ArrowLOutlineMd, {}) })), typeof title === 'string' ? ((0, jsx_runtime_1.jsx)(styles_1.TitleWrapper, { component: "h1", variant: "h3", "$hasDescription": hasDescription || isLoading, "$hasBreadcrumbs": hasBreadcrumbs, children: (0, jsx_runtime_1.jsx)(OverflowTypography_1.OverflowTypography, { component: "div", variant: "inherit", children: title }) })) : ((0, jsx_runtime_1.jsx)(styles_1.TitleWrapper, { component: "div", role: "heading", variant: "h3", "aria-level": 1, "$hasDescription": hasDescription, "$hasBreadcrumbs": hasBreadcrumbs, children: title }))] }));
|
|
13
13
|
};
|
|
14
14
|
exports.Title = Title;
|