@astral/ui 4.22.2 → 4.24.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/BottomDrawer/BottomDrawer.js +2 -2
- package/components/BottomDrawer/constants.d.ts +3 -0
- package/components/BottomDrawer/constants.js +4 -0
- package/components/BottomDrawer/index.d.ts +1 -0
- package/components/BottomDrawer/index.js +1 -0
- package/components/BottomDrawer/public.d.ts +1 -0
- package/components/BottomDrawer/public.js +1 -0
- package/components/BulletList/BulletList.d.ts +4 -0
- package/components/BulletList/BulletList.js +9 -3
- package/components/BulletList/constants.d.ts +4 -0
- package/components/BulletList/constants.js +5 -0
- package/components/BulletList/styles.d.ts +5 -1
- package/components/BulletList/styles.js +9 -1
- package/components/DashboardContext/DashboardContext.d.ts +2 -1
- package/components/DashboardContext/DashboardContext.js +2 -1
- package/components/DashboardContext/DashboardContextProvider/DashboardContextProvider.js +9 -2
- package/components/DashboardLayout/Header/Header.js +3 -9
- package/components/DashboardLayout/Header/useLogic/useLogic.d.ts +6 -1
- package/components/DashboardLayout/Header/useLogic/useLogic.js +18 -2
- package/components/DashboardSidebar/DashboardSidebar.js +2 -4
- package/components/DashboardSidebar/constants.d.ts +1 -0
- package/components/DashboardSidebar/constants.js +1 -0
- package/components/DashboardSidebar/styles.js +6 -0
- package/components/DashboardSidebar/useLogic/useLogic.d.ts +2 -1
- package/components/DashboardSidebar/useLogic/useLogic.js +10 -3
- package/components/MenuOrganization/MenuOrganization.js +5 -6
- package/components/MenuOrganization/NoData/styles.js +4 -0
- package/components/MenuOrganization/OrganizationButton/constants.d.ts +1 -0
- package/components/MenuOrganization/OrganizationButton/constants.js +1 -0
- package/components/MenuOrganization/OrganizationButton/index.d.ts +1 -0
- package/components/MenuOrganization/OrganizationButton/index.js +1 -0
- package/components/MenuOrganization/OrganizationButton/styles.js +22 -0
- package/components/MenuOrganization/OrganizationItem/styles.d.ts +1 -1
- package/components/MenuOrganization/OrganizationItem/styles.js +9 -0
- package/components/MenuOrganization/OrganizationListSkeleton/styles.js +12 -0
- package/components/MenuOrganization/constants.d.ts +2 -0
- package/components/MenuOrganization/constants.js +2 -0
- package/components/MenuOrganization/styles.d.ts +11 -0
- package/components/MenuOrganization/styles.js +82 -0
- package/components/MenuOrganization/useLogic/useLogic.d.ts +14 -4
- package/components/MenuOrganization/useLogic/useLogic.js +21 -2
- package/components/Popover/Popover.d.ts +1 -1
- package/components/Popover/Popover.js +3 -3
- package/components/placeholders/Placeholder/Placeholder.js +2 -2
- package/components/placeholders/Placeholder/constants.d.ts +4 -0
- package/components/placeholders/Placeholder/constants.js +5 -0
- package/components/placeholders/Placeholder/index.d.ts +1 -0
- package/components/placeholders/Placeholder/index.js +1 -0
- package/components/placeholders/Placeholder/public.d.ts +1 -0
- package/components/placeholders/Placeholder/public.js +1 -0
- package/node/components/BottomDrawer/BottomDrawer.js +1 -1
- package/node/components/BottomDrawer/constants.d.ts +3 -0
- package/node/components/BottomDrawer/constants.js +5 -1
- package/node/components/BottomDrawer/index.d.ts +1 -0
- package/node/components/BottomDrawer/index.js +3 -0
- package/node/components/BottomDrawer/public.d.ts +1 -0
- package/node/components/BottomDrawer/public.js +3 -0
- package/node/components/BulletList/BulletList.d.ts +4 -0
- package/node/components/BulletList/BulletList.js +8 -2
- package/node/components/BulletList/constants.d.ts +4 -0
- package/node/components/BulletList/constants.js +8 -0
- package/node/components/BulletList/styles.d.ts +5 -1
- package/node/components/BulletList/styles.js +10 -2
- package/node/components/DashboardContext/DashboardContext.d.ts +2 -1
- package/node/components/DashboardContext/DashboardContext.js +1 -0
- package/node/components/DashboardContext/DashboardContextProvider/DashboardContextProvider.js +8 -1
- package/node/components/DashboardLayout/Header/Header.js +2 -8
- package/node/components/DashboardLayout/Header/useLogic/useLogic.d.ts +6 -1
- package/node/components/DashboardLayout/Header/useLogic/useLogic.js +18 -2
- package/node/components/DashboardSidebar/DashboardSidebar.js +2 -4
- package/node/components/DashboardSidebar/constants.d.ts +1 -0
- package/node/components/DashboardSidebar/constants.js +1 -0
- package/node/components/DashboardSidebar/styles.js +6 -0
- package/node/components/DashboardSidebar/useLogic/useLogic.d.ts +2 -1
- package/node/components/DashboardSidebar/useLogic/useLogic.js +9 -2
- package/node/components/MenuOrganization/MenuOrganization.js +3 -4
- package/node/components/MenuOrganization/NoData/styles.js +4 -0
- package/node/components/MenuOrganization/OrganizationButton/constants.d.ts +1 -0
- package/node/components/MenuOrganization/OrganizationButton/constants.js +4 -0
- package/node/components/MenuOrganization/OrganizationButton/index.d.ts +1 -0
- package/node/components/MenuOrganization/OrganizationButton/index.js +3 -0
- package/node/components/MenuOrganization/OrganizationButton/styles.js +22 -0
- package/node/components/MenuOrganization/OrganizationItem/styles.d.ts +1 -1
- package/node/components/MenuOrganization/OrganizationItem/styles.js +11 -2
- package/node/components/MenuOrganization/OrganizationListSkeleton/styles.js +12 -0
- package/node/components/MenuOrganization/constants.d.ts +2 -0
- package/node/components/MenuOrganization/constants.js +3 -1
- package/node/components/MenuOrganization/styles.d.ts +11 -0
- package/node/components/MenuOrganization/styles.js +87 -5
- package/node/components/MenuOrganization/useLogic/useLogic.d.ts +14 -4
- package/node/components/MenuOrganization/useLogic/useLogic.js +21 -2
- package/node/components/Popover/Popover.d.ts +1 -1
- package/node/components/Popover/Popover.js +3 -3
- package/node/components/placeholders/Placeholder/Placeholder.js +1 -1
- package/node/components/placeholders/Placeholder/constants.d.ts +4 -0
- package/node/components/placeholders/Placeholder/constants.js +6 -1
- package/node/components/placeholders/Placeholder/index.d.ts +1 -0
- package/node/components/placeholders/Placeholder/index.js +3 -0
- package/node/components/placeholders/Placeholder/public.d.ts +1 -0
- package/node/components/placeholders/Placeholder/public.js +3 -0
- package/package.json +1 -1
|
@@ -8,10 +8,12 @@ const Main_1 = require("../../DashboardLayout/Main");
|
|
|
8
8
|
const DashboardSidebarProvider_1 = require("../../DashboardSidebarProvider");
|
|
9
9
|
const useTheme_1 = require("../../theme/hooks/useTheme");
|
|
10
10
|
const useViewportType_1 = require("../../useViewportType");
|
|
11
|
+
const classNames_1 = require("../../utils/classNames");
|
|
12
|
+
const constants_1 = require("../constants");
|
|
11
13
|
const useLogic = (props) => {
|
|
12
14
|
const { className, menu, header, isLoading } = props;
|
|
13
15
|
const { onToggleSidebar, isPinned, onTogglePin, collapsedIn, setIsPopupOpen, } = (0, react_1.useContext)(DashboardSidebarProvider_1.DashboardSidebarContext);
|
|
14
|
-
const { alertHeight, isLoading: isDashboardLoading } = (0, react_1.useContext)(DashboardContext_1.DashboardContext);
|
|
16
|
+
const { alertHeight, isLoading: isDashboardLoading, hasMenuOrganizationRef, } = (0, react_1.useContext)(DashboardContext_1.DashboardContext);
|
|
15
17
|
const { isMobile } = (0, useViewportType_1.useViewportType)();
|
|
16
18
|
const hoverTimerRef = (0, react_1.useRef)(null);
|
|
17
19
|
const theme = (0, useTheme_1.useTheme)();
|
|
@@ -81,6 +83,10 @@ const useLogic = (props) => {
|
|
|
81
83
|
}
|
|
82
84
|
};
|
|
83
85
|
}, [collapsedIn, isPinned]);
|
|
86
|
+
const wrapperClassnames = (0, react_1.useMemo)(() => (0, classNames_1.classNames)({
|
|
87
|
+
[constants_1.dashboardSidebarClassnames.hasMenuOrganization]: hasMenuOrganizationRef.current,
|
|
88
|
+
}), [hasMenuOrganizationRef.current]);
|
|
89
|
+
const classnames = (0, classNames_1.classNames)(className, constants_1.dashboardSidebarClassnames.root);
|
|
84
90
|
return {
|
|
85
91
|
isPinned,
|
|
86
92
|
isMobile,
|
|
@@ -89,10 +95,11 @@ const useLogic = (props) => {
|
|
|
89
95
|
onMouseEnter,
|
|
90
96
|
onMouseLeave,
|
|
91
97
|
alertHeight,
|
|
92
|
-
className,
|
|
93
98
|
menu,
|
|
94
99
|
header,
|
|
95
100
|
isLoading: isLoading || isDashboardLoading,
|
|
101
|
+
classnames,
|
|
102
|
+
wrapperClassnames,
|
|
96
103
|
};
|
|
97
104
|
};
|
|
98
105
|
exports.useLogic = useLogic;
|
|
@@ -4,7 +4,6 @@ exports.MenuOrganization = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const Button_1 = require("../Button");
|
|
6
6
|
const ContentState_1 = require("../ContentState");
|
|
7
|
-
const Popover_1 = require("../Popover");
|
|
8
7
|
const SearchField_1 = require("../SearchField");
|
|
9
8
|
const constants_1 = require("./constants");
|
|
10
9
|
const MenuOrganizationSkeleton_1 = require("./MenuOrganizationSkeleton");
|
|
@@ -16,14 +15,14 @@ const styles_1 = require("./styles");
|
|
|
16
15
|
const useLogic_1 = require("./useLogic");
|
|
17
16
|
const MenuOrganization = (props) => {
|
|
18
17
|
const { anchorOrigin = { vertical: 'bottom', horizontal: 'right' }, transformOrigin = { vertical: 'top', horizontal: 'right' }, } = props;
|
|
19
|
-
const {
|
|
18
|
+
const { actionButtonProps, hasAction, isLoading, isError, onRetry, isComponentLoading, isShowOrganizationList, searchProps, popoverProps, organizationListProps, organizationButtonProps, isShowSearchField, isMobile, classnames, alertHeight, } = (0, useLogic_1.useLogic)(props);
|
|
20
19
|
if (isComponentLoading) {
|
|
21
20
|
return (0, jsx_runtime_1.jsx)(MenuOrganizationSkeleton_1.MenuOrganizationSkeleton, {});
|
|
22
21
|
}
|
|
23
|
-
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)(
|
|
22
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(styles_1.ButtonWrapper, { className: classnames, "$alertHeight": alertHeight, 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: {
|
|
24
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" })),
|
|
25
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" })),
|
|
26
25
|
className: constants_1.menuOrganizationClassnames.errorPlaceholder,
|
|
27
|
-
}, loadingContent: (0, jsx_runtime_1.jsx)(OrganizationListSkeleton_1.OrganizationListSkeleton, {}), children: isShowOrganizationList ? ((0, jsx_runtime_1.jsx)(OrganizationList_1.OrganizationList, { ...organizationListProps })) : ((0, jsx_runtime_1.jsx)(NoData_1.NoData, {})) }) }),
|
|
26
|
+
}, loadingContent: (0, jsx_runtime_1.jsx)(OrganizationListSkeleton_1.OrganizationListSkeleton, {}), children: isShowOrganizationList ? ((0, jsx_runtime_1.jsx)(OrganizationList_1.OrganizationList, { ...organizationListProps })) : ((0, jsx_runtime_1.jsx)(NoData_1.NoData, {})) }) }), hasAction && ((0, jsx_runtime_1.jsx)(styles_1.ActionWrapper, { children: (0, jsx_runtime_1.jsx)(Button_1.Button, { fullWidth: true, ...actionButtonProps, size: isMobile ? 'large' : 'medium', children: actionButtonProps.text }) }))] })] }));
|
|
28
27
|
};
|
|
29
28
|
exports.MenuOrganization = MenuOrganization;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const MOBILE_BUTTON_HEIGHT = "68px";
|
|
@@ -14,4 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.MOBILE_BUTTON_HEIGHT = void 0;
|
|
17
18
|
__exportStar(require("./OrganizationButton"), exports);
|
|
19
|
+
var constants_1 = require("./constants");
|
|
20
|
+
Object.defineProperty(exports, "MOBILE_BUTTON_HEIGHT", { enumerable: true, get: function () { return constants_1.MOBILE_BUTTON_HEIGHT; } });
|
|
@@ -5,6 +5,7 @@ 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");
|
|
8
9
|
exports.StyledButton = (0, styled_1.styled)(Button_1.Button) `
|
|
9
10
|
display: flex;
|
|
10
11
|
align-items: center;
|
|
@@ -25,6 +26,27 @@ exports.StyledButton = (0, styled_1.styled)(Button_1.Button) `
|
|
|
25
26
|
|
|
26
27
|
background-color: ${({ theme }) => theme.palette.primary[100]};
|
|
27
28
|
}
|
|
29
|
+
|
|
30
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
31
|
+
justify-content: space-between;
|
|
32
|
+
|
|
33
|
+
max-width: unset;
|
|
34
|
+
height: ${constants_1.MOBILE_BUTTON_HEIGHT};
|
|
35
|
+
padding: ${({ theme }) => theme.spacing(3, 4)};
|
|
36
|
+
|
|
37
|
+
border-bottom: 1px solid ${({ theme }) => theme.palette.grey[300]};
|
|
38
|
+
border-radius: 0;
|
|
39
|
+
|
|
40
|
+
&:hover {
|
|
41
|
+
background-color: initial;
|
|
42
|
+
border-bottom: 1px solid ${({ theme }) => theme.palette.grey[300]};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&:active {
|
|
46
|
+
background-color: ${({ theme }) => theme.palette.primary[100]};
|
|
47
|
+
border-bottom: 1px solid ${({ theme }) => theme.palette.grey[300]};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
28
50
|
`;
|
|
29
51
|
exports.StyledChevron = (0, styled_1.styled)(Chevron_1.Chevron) `
|
|
30
52
|
width: 24px;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const StyledMenuItem: import("@emotion/styled/dist/declarations/src/types").StyledComponent<import("../..").WithoutEmotionSpecific<Omit<import("@mui/material").MenuItemProps, "component">> & {
|
|
2
|
+
export declare const StyledMenuItem: import("@emotion/styled/dist/declarations/src/types").StyledComponent<import("../..").WithoutEmotionSpecific<Omit<import("@mui/material/MenuItem").MenuItemProps, "component">> & {
|
|
3
3
|
disabledReason?: string | undefined;
|
|
4
4
|
note?: string | undefined;
|
|
5
5
|
tooltipPlacement?: "bottom" | "left" | "right" | "top" | "bottom-end" | "bottom-start" | "left-end" | "left-start" | "right-end" | "right-start" | "top-end" | "top-start" | undefined;
|
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StyledButton = exports.StyledMenuItem = void 0;
|
|
4
|
+
const MenuItem_1 = require("@mui/material/MenuItem");
|
|
4
5
|
const Button_1 = require("../../Button");
|
|
5
|
-
const
|
|
6
|
+
const MenuItem_2 = require("../../MenuItem");
|
|
6
7
|
const styled_1 = require("../../styled");
|
|
7
|
-
exports.StyledMenuItem = (0, styled_1.styled)(
|
|
8
|
+
exports.StyledMenuItem = (0, styled_1.styled)(MenuItem_2.MenuItem) `
|
|
8
9
|
cursor: ${({ selected }) => (selected ? 'auto' : 'pointer')};
|
|
9
10
|
user-select: ${({ selected }) => (selected ? 'auto' : 'unset')};
|
|
10
11
|
|
|
11
12
|
padding: ${({ theme }) => theme.microSpacing(3, 6)};
|
|
13
|
+
|
|
14
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
15
|
+
padding: ${({ theme }) => theme.microSpacing(5, 6)};
|
|
16
|
+
|
|
17
|
+
&.${MenuItem_1.menuItemClasses.selected} {
|
|
18
|
+
padding: ${({ theme }) => theme.microSpacing(3, 6)};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
12
21
|
`;
|
|
13
22
|
exports.StyledButton = (0, styled_1.styled)(Button_1.Button) `
|
|
14
23
|
justify-content: flex-start;
|
|
@@ -9,6 +9,12 @@ exports.Item = styled_1.styled.div `
|
|
|
9
9
|
|
|
10
10
|
width: 100%;
|
|
11
11
|
padding: ${({ theme }) => theme.spacing(0, 2)};
|
|
12
|
+
|
|
13
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
14
|
+
gap: ${({ theme }) => theme.spacing(3)};
|
|
15
|
+
|
|
16
|
+
padding: ${({ theme }) => theme.spacing(3)};
|
|
17
|
+
}
|
|
12
18
|
`;
|
|
13
19
|
exports.Wrapper = styled_1.styled.div `
|
|
14
20
|
overflow: hidden;
|
|
@@ -18,6 +24,12 @@ exports.Wrapper = styled_1.styled.div `
|
|
|
18
24
|
|
|
19
25
|
width: 100%;
|
|
20
26
|
padding: ${({ theme }) => theme.microSpacing(5, 0)};
|
|
27
|
+
|
|
28
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
29
|
+
gap: ${({ theme }) => theme.spacing(2)};
|
|
30
|
+
|
|
31
|
+
padding: 0;
|
|
32
|
+
}
|
|
21
33
|
`;
|
|
22
34
|
exports.OrganizationInfoWrapper = styled_1.styled.div `
|
|
23
35
|
display: flex;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export declare const DEFAULT_LINK_BUTTON_NAME = "\u041F\u0435\u0440\u0435\u0439\u0442\u0438 \u043A \u0434\u0430\u043D\u043D\u044B\u043C \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438";
|
|
2
|
+
export declare const POPOVER_TITLE = "\u0412\u044B\u0431\u043E\u0440 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438";
|
|
2
3
|
export declare const PLACEHOLDER_HEIGHT = "108px";
|
|
3
4
|
export declare const menuOrganizationClassnames: {
|
|
4
5
|
root: string;
|
|
5
6
|
errorPlaceholder: string;
|
|
7
|
+
mobileVisible: string;
|
|
6
8
|
};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.menuOrganizationClassnames = exports.PLACEHOLDER_HEIGHT = exports.DEFAULT_LINK_BUTTON_NAME = void 0;
|
|
3
|
+
exports.menuOrganizationClassnames = exports.PLACEHOLDER_HEIGHT = exports.POPOVER_TITLE = exports.DEFAULT_LINK_BUTTON_NAME = void 0;
|
|
4
4
|
const createUIKitClassname_1 = require("../utils/createUIKitClassname");
|
|
5
5
|
exports.DEFAULT_LINK_BUTTON_NAME = 'Перейти к данным организации';
|
|
6
|
+
exports.POPOVER_TITLE = 'Выбор организации';
|
|
6
7
|
exports.PLACEHOLDER_HEIGHT = '108px';
|
|
7
8
|
exports.menuOrganizationClassnames = {
|
|
8
9
|
root: (0, createUIKitClassname_1.createUIKitClassname)('menu-organization'),
|
|
9
10
|
errorPlaceholder: (0, createUIKitClassname_1.createUIKitClassname)('menu-organization__error-placeholder'),
|
|
11
|
+
mobileVisible: (0, createUIKitClassname_1.createUIKitClassname)('menu-organization_visible'),
|
|
10
12
|
};
|
|
@@ -25,3 +25,14 @@ 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
|
+
export declare const StyledPopover: import("@emotion/styled/dist/declarations/src/types").StyledComponent<import("..").WithoutEmotionSpecific<import("@mui/material").PopoverProps> & {
|
|
35
|
+
title?: string | undefined;
|
|
36
|
+
} & {
|
|
37
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
38
|
+
}, {}, {}>;
|
|
@@ -1,20 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StyledTypography = exports.OrganizationData = exports.OrganizationsWrapper = exports.SearchWrapper = exports.ActionWrapper = void 0;
|
|
3
|
+
exports.StyledPopover = exports.ButtonWrapper = exports.StyledTypography = exports.OrganizationData = exports.OrganizationsWrapper = exports.SearchWrapper = exports.ActionWrapper = void 0;
|
|
4
|
+
const BottomDrawer_1 = require("../BottomDrawer");
|
|
5
|
+
const constants_1 = require("../BottomDrawer/constants");
|
|
6
|
+
const constants_2 = require("../DashboardLayout/constants");
|
|
4
7
|
const Grid_1 = require("../Grid");
|
|
8
|
+
const Popover_1 = require("../Popover");
|
|
9
|
+
const LoadingPlaceholder_1 = require("../placeholders/LoadingPlaceholder");
|
|
10
|
+
const Placeholder_1 = require("../placeholders/Placeholder");
|
|
5
11
|
const styled_1 = require("../styled");
|
|
6
12
|
const Typography_1 = require("../Typography");
|
|
7
|
-
const
|
|
13
|
+
const constants_3 = require("./constants");
|
|
8
14
|
exports.ActionWrapper = styled_1.styled.div `
|
|
9
15
|
padding: ${({ theme }) => theme.spacing(2)};
|
|
10
16
|
|
|
11
17
|
border-top: 1px solid ${({ theme }) => theme.palette.grey[300]};
|
|
18
|
+
|
|
19
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
20
|
+
padding: ${({ theme }) => theme.spacing(4)};
|
|
21
|
+
}
|
|
12
22
|
`;
|
|
13
23
|
exports.SearchWrapper = styled_1.styled.div `
|
|
14
24
|
max-width: 300px;
|
|
15
25
|
padding: ${({ theme }) => theme.spacing(2, 3)};
|
|
16
26
|
|
|
17
27
|
border-bottom: ${({ theme }) => `1px solid ${theme.palette.grey['300']}`};
|
|
28
|
+
|
|
29
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
30
|
+
max-width: unset;
|
|
31
|
+
padding: ${({ theme }) => theme.spacing(3, 4)};
|
|
32
|
+
}
|
|
18
33
|
`;
|
|
19
34
|
exports.OrganizationsWrapper = styled_1.styled.div `
|
|
20
35
|
overflow-y: auto;
|
|
@@ -24,17 +39,39 @@ exports.OrganizationsWrapper = styled_1.styled.div `
|
|
|
24
39
|
|
|
25
40
|
box-sizing: ${({ $isLoading }) => ($isLoading ? 'content-box' : 'inherit')};
|
|
26
41
|
width: 300px;
|
|
27
|
-
min-height: ${({ $isLoading }) => ($isLoading ?
|
|
42
|
+
min-height: ${({ $isLoading }) => ($isLoading ? constants_3.PLACEHOLDER_HEIGHT : '64px')};
|
|
28
43
|
max-height: 328px;
|
|
29
44
|
|
|
30
|
-
& .${
|
|
45
|
+
& .${constants_3.menuOrganizationClassnames.errorPlaceholder} {
|
|
46
|
+
display: flex;
|
|
31
47
|
gap: ${({ theme }) => theme.spacing(1)};
|
|
32
48
|
|
|
33
|
-
height: ${
|
|
49
|
+
height: ${constants_3.PLACEHOLDER_HEIGHT};
|
|
34
50
|
}
|
|
35
51
|
|
|
36
52
|
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
37
53
|
width: 100%;
|
|
54
|
+
height: 100%;
|
|
55
|
+
max-height: unset;
|
|
56
|
+
|
|
57
|
+
& .${LoadingPlaceholder_1.loadingPlaceholderClassnames.root} {
|
|
58
|
+
justify-content: unset;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
& .${constants_3.menuOrganizationClassnames.errorPlaceholder} {
|
|
62
|
+
gap: ${({ theme }) => theme.spacing(6)};
|
|
63
|
+
justify-content: center;
|
|
64
|
+
|
|
65
|
+
height: 100%;
|
|
66
|
+
|
|
67
|
+
& .${Placeholder_1.placeholderClassnames.title} {
|
|
68
|
+
margin-bottom: unset;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
& .${Placeholder_1.placeholderClassnames.footer} {
|
|
72
|
+
margin-top: unset;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
38
75
|
}
|
|
39
76
|
`;
|
|
40
77
|
exports.OrganizationData = (0, styled_1.styled)(Grid_1.Grid) `
|
|
@@ -46,3 +83,48 @@ exports.OrganizationData = (0, styled_1.styled)(Grid_1.Grid) `
|
|
|
46
83
|
exports.StyledTypography = (0, styled_1.styled)(Typography_1.Typography) `
|
|
47
84
|
color: ${({ theme }) => theme.palette.grey[600]};
|
|
48
85
|
`;
|
|
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
|
+
exports.StyledPopover = (0, styled_1.styled)(Popover_1.Popover) `
|
|
115
|
+
|
|
116
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
117
|
+
& .${BottomDrawer_1.bottomDrawerClassnames.content} {
|
|
118
|
+
display: flex;
|
|
119
|
+
flex-direction: column;
|
|
120
|
+
|
|
121
|
+
height: calc(100vh - ${constants_1.OFFSET_TOP_SCREEN});
|
|
122
|
+
|
|
123
|
+
@supports (height: 100dvh) {
|
|
124
|
+
height: calc(100dvh - ${constants_1.OFFSET_TOP_SCREEN});
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
`;
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
import { type ChangeEvent, type SyntheticEvent } from 'react';
|
|
1
|
+
import { type ChangeEvent, type MouseEvent, type SyntheticEvent } from 'react';
|
|
2
2
|
import { type MenuOrganizationProps, type Organization } from '../types';
|
|
3
3
|
type UseLogicParams<TData extends Organization & Record<string, unknown>> = MenuOrganizationProps<TData>;
|
|
4
4
|
export declare const useLogic: <TData extends Organization & Record<string, unknown>>({ organizations, onChangeSearch, onChange, currentOrganizationGroupLabel, currentOrganization, groupBy, onClose, onOpen, isOpen: isOpenPopover, isDisabled, disabledReason, isHidePersonalData, action, isLoading, isError, onRetry, renderItem, renderPreview, }: UseLogicParams<TData>) => {
|
|
5
|
-
|
|
6
|
-
text
|
|
7
|
-
|
|
5
|
+
actionButtonProps: {
|
|
6
|
+
text?: string | undefined;
|
|
7
|
+
component?: import("react").ElementType | undefined;
|
|
8
|
+
href?: string | undefined;
|
|
9
|
+
variant?: "light" | "link" | "text" | "contained" | "outlined" | undefined;
|
|
10
|
+
endIcon?: import("react").ReactNode;
|
|
11
|
+
startIcon?: import("react").ReactNode;
|
|
12
|
+
onClick: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
13
|
+
};
|
|
14
|
+
hasAction: boolean;
|
|
8
15
|
isLoading: boolean | undefined;
|
|
9
16
|
isError: boolean | undefined;
|
|
10
17
|
onRetry: () => void;
|
|
@@ -53,5 +60,8 @@ export declare const useLogic: <TData extends Organization & Record<string, unkn
|
|
|
53
60
|
hasSearch: boolean;
|
|
54
61
|
};
|
|
55
62
|
isShowSearchField: boolean;
|
|
63
|
+
isMobile: boolean;
|
|
64
|
+
classnames: string;
|
|
65
|
+
alertHeight: number;
|
|
56
66
|
};
|
|
57
67
|
export {};
|
|
@@ -3,12 +3,19 @@ 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");
|
|
6
7
|
const personalDataSecurity_1 = require("../../personalDataSecurity");
|
|
7
8
|
const usePopover_1 = require("../../usePopover");
|
|
9
|
+
const useViewportType_1 = require("../../useViewportType");
|
|
10
|
+
const classNames_1 = require("../../utils/classNames");
|
|
11
|
+
const constants_1 = require("../constants");
|
|
8
12
|
const useLogic = ({ organizations = [], onChangeSearch, onChange, currentOrganizationGroupLabel, currentOrganization, groupBy, onClose, onOpen, isOpen: isOpenPopover, isDisabled, disabledReason, isHidePersonalData, action, isLoading, isError, onRetry, renderItem, renderPreview, }) => {
|
|
9
|
-
const { isLoading: isDashboardLoading } = (0, react_1.useContext)(DashboardContext_1.DashboardContext);
|
|
13
|
+
const { isLoading: isDashboardLoading, alertHeight } = (0, react_1.useContext)(DashboardContext_1.DashboardContext);
|
|
10
14
|
const [searchValue, setSearchValue] = (0, react_1.useState)('');
|
|
11
15
|
const [anchorButtonEl, setAnchorButtonEl] = (0, react_1.useState)(null);
|
|
16
|
+
const { isPinned } = (0, react_1.useContext)(DashboardSidebarProvider_1.DashboardSidebarContext);
|
|
17
|
+
const { isMobile } = (0, useViewportType_1.useViewportType)();
|
|
18
|
+
const { onClick, ...restActionProps } = action || {};
|
|
12
19
|
const buttonRef = (0, react_1.useCallback)((node) => {
|
|
13
20
|
if (node) {
|
|
14
21
|
setAnchorButtonEl(node);
|
|
@@ -40,6 +47,10 @@ const useLogic = ({ organizations = [], onChangeSearch, onChange, currentOrganiz
|
|
|
40
47
|
onChange(organization);
|
|
41
48
|
handleClosePopover();
|
|
42
49
|
};
|
|
50
|
+
const handleActionClick = (event) => {
|
|
51
|
+
onClick?.(event);
|
|
52
|
+
handleClosePopover();
|
|
53
|
+
};
|
|
43
54
|
const isShowCurrentOrganization = (0, react_1.useMemo)(() => {
|
|
44
55
|
return (!searchValue.length || filteredOrganization.includes(currentOrganization));
|
|
45
56
|
}, [currentOrganization, filteredOrganization, searchValue.length]);
|
|
@@ -56,8 +67,13 @@ const useLogic = ({ organizations = [], onChangeSearch, onChange, currentOrganiz
|
|
|
56
67
|
const renderPreviewWrapper = (0, react_1.useMemo)(() => renderPreview
|
|
57
68
|
? (organization, params) => renderPreview(organization, params)
|
|
58
69
|
: undefined, [renderPreview]);
|
|
70
|
+
const classnames = (0, react_1.useMemo)(() => (0, classNames_1.classNames)({ [constants_1.menuOrganizationClassnames.mobileVisible]: isPinned }), [isPinned]);
|
|
59
71
|
return {
|
|
60
|
-
|
|
72
|
+
actionButtonProps: {
|
|
73
|
+
onClick: handleActionClick,
|
|
74
|
+
...restActionProps,
|
|
75
|
+
},
|
|
76
|
+
hasAction: Boolean(action),
|
|
61
77
|
isLoading,
|
|
62
78
|
isError,
|
|
63
79
|
onRetry,
|
|
@@ -95,6 +111,9 @@ const useLogic = ({ organizations = [], onChangeSearch, onChange, currentOrganiz
|
|
|
95
111
|
hasSearch: isShowSearchField,
|
|
96
112
|
},
|
|
97
113
|
isShowSearchField,
|
|
114
|
+
isMobile,
|
|
115
|
+
classnames,
|
|
116
|
+
alertHeight,
|
|
98
117
|
};
|
|
99
118
|
};
|
|
100
119
|
exports.useLogic = useLogic;
|
|
@@ -6,4 +6,4 @@ export type PopoverProps = WithoutEmotionSpecific<MuiPopoverProps> & {
|
|
|
6
6
|
*/
|
|
7
7
|
title?: string;
|
|
8
8
|
};
|
|
9
|
-
export declare const Popover: ({ children, onClose, open, title, ...restProps }: PopoverProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare const Popover: ({ children, onClose, open, title, className, ...restProps }: PopoverProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,11 +5,11 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const BottomDrawer_1 = require("../BottomDrawer");
|
|
6
6
|
const useViewportType_1 = require("../useViewportType");
|
|
7
7
|
const styles_1 = require("./styles");
|
|
8
|
-
const Popover = ({ children, onClose, open, title, ...restProps }) => {
|
|
8
|
+
const Popover = ({ children, onClose, open, title, className, ...restProps }) => {
|
|
9
9
|
const { isMobile } = (0, useViewportType_1.useViewportType)();
|
|
10
10
|
if (isMobile) {
|
|
11
|
-
return ((0, jsx_runtime_1.jsx)(BottomDrawer_1.BottomDrawer, { title: title, onClose: onClose, open: open, children: children }));
|
|
11
|
+
return ((0, jsx_runtime_1.jsx)(BottomDrawer_1.BottomDrawer, { title: title, onClose: onClose, open: open, className: className, children: children }));
|
|
12
12
|
}
|
|
13
|
-
return ((0, jsx_runtime_1.jsx)(styles_1.StyledMuiPopover, { open: open, onClose: onClose, ...restProps, children: children }));
|
|
13
|
+
return ((0, jsx_runtime_1.jsx)(styles_1.StyledMuiPopover, { open: open, onClose: onClose, className: className, ...restProps, children: children }));
|
|
14
14
|
};
|
|
15
15
|
exports.Popover = Popover;
|
|
@@ -13,6 +13,6 @@ const Placeholder = ({ className, title, imgSrc, imgAlt, description, Actions, s
|
|
|
13
13
|
const RenderImage = (0, react_1.useMemo)(() => (renderImage && (0, Image_1.setDefaultImageStyles)(renderImage)) ||
|
|
14
14
|
(configRenderImage && (0, Image_1.setDefaultImageStyles)(configRenderImage)) ||
|
|
15
15
|
Image_1.Image, [renderImage, configRenderImage]);
|
|
16
|
-
return ((0, jsx_runtime_1.jsxs)(styles_1.Wrapper, { "$size": size, className: className, children: [(0, jsx_runtime_1.jsxs)(styles_1.InnerContainer, { "$size": size, children: [imgSrc && ((0, jsx_runtime_1.jsx)(RenderImage, { src: imgSrc, alt: imgAlt, width: constants_1.IMAGE_WIDTH[size], height: constants_1.IMAGE_HEIGHT[size], size: size })), (0, jsx_runtime_1.jsx)(styles_1.Title, { "$size": size, variant: constants_1.TITLE_HEADER_LEVEL[size], children: title }), description && ((0, jsx_runtime_1.jsx)(styles_1.Description, { "$size": size, component: "div", variant: constants_1.DESCRIPTION_LEVEL[size], children: description }))] }), Actions && (0, jsx_runtime_1.jsx)(styles_1.Footer, { children: Actions })] }));
|
|
16
|
+
return ((0, jsx_runtime_1.jsxs)(styles_1.Wrapper, { "$size": size, className: className, children: [(0, jsx_runtime_1.jsxs)(styles_1.InnerContainer, { "$size": size, children: [imgSrc && ((0, jsx_runtime_1.jsx)(RenderImage, { src: imgSrc, alt: imgAlt, width: constants_1.IMAGE_WIDTH[size], height: constants_1.IMAGE_HEIGHT[size], size: size })), (0, jsx_runtime_1.jsx)(styles_1.Title, { className: constants_1.placeholderClassnames.title, "$size": size, variant: constants_1.TITLE_HEADER_LEVEL[size], children: title }), description && ((0, jsx_runtime_1.jsx)(styles_1.Description, { "$size": size, component: "div", variant: constants_1.DESCRIPTION_LEVEL[size], children: description }))] }), Actions && ((0, jsx_runtime_1.jsx)(styles_1.Footer, { className: constants_1.placeholderClassnames.footer, children: Actions }))] }));
|
|
17
17
|
};
|
|
18
18
|
exports.Placeholder = Placeholder;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DESCRIPTION_LEVEL = exports.TITLE_HEADER_LEVEL = exports.MAX_INNER_WIDTH = exports.IMAGE_HEIGHT = exports.IMAGE_WIDTH = exports.SIZE = void 0;
|
|
3
|
+
exports.placeholderClassnames = exports.DESCRIPTION_LEVEL = exports.TITLE_HEADER_LEVEL = exports.MAX_INNER_WIDTH = exports.IMAGE_HEIGHT = exports.IMAGE_WIDTH = exports.SIZE = void 0;
|
|
4
|
+
const createUIKitClassname_1 = require("../../utils/createUIKitClassname");
|
|
4
5
|
exports.SIZE = {
|
|
5
6
|
Small: 'small',
|
|
6
7
|
Medium: 'medium',
|
|
@@ -31,3 +32,7 @@ exports.DESCRIPTION_LEVEL = {
|
|
|
31
32
|
[exports.SIZE.Medium]: 'body1',
|
|
32
33
|
[exports.SIZE.Large]: 'subtitle1',
|
|
33
34
|
};
|
|
35
|
+
exports.placeholderClassnames = {
|
|
36
|
+
footer: (0, createUIKitClassname_1.createUIKitClassname)('placeholder__footer'),
|
|
37
|
+
title: (0, createUIKitClassname_1.createUIKitClassname)('placeholder__title'),
|
|
38
|
+
};
|
|
@@ -14,6 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.placeholderClassnames = void 0;
|
|
17
18
|
__exportStar(require("./Image"), exports);
|
|
18
19
|
__exportStar(require("./Placeholder"), exports);
|
|
19
20
|
__exportStar(require("./types"), exports);
|
|
21
|
+
var constants_1 = require("./constants");
|
|
22
|
+
Object.defineProperty(exports, "placeholderClassnames", { enumerable: true, get: function () { return constants_1.placeholderClassnames; } });
|
|
@@ -14,5 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.placeholderClassnames = void 0;
|
|
18
|
+
var constants_1 = require("./constants");
|
|
19
|
+
Object.defineProperty(exports, "placeholderClassnames", { enumerable: true, get: function () { return constants_1.placeholderClassnames; } });
|
|
17
20
|
__exportStar(require("./Placeholder"), exports);
|
|
18
21
|
__exportStar(require("./types"), exports);
|