@astral/ui 4.101.0 → 4.103.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/Alert/styles.js +12 -2
- package/components/Autocomplete/styles.js +5 -2
- package/components/Breadcrumbs/styles.js +18 -13
- package/components/CheckableTag/styles.js +6 -3
- package/components/Checkbox/styles.js +10 -7
- package/components/Chip/styles.js +11 -6
- package/components/CodeField/styles.js +5 -2
- package/components/CopyTypography/styles.js +19 -5
- package/components/DashboardLayout/Header/styles.js +5 -2
- package/components/DashboardSidebarPopover/SidebarPopoverItem/styles.js +5 -2
- package/components/DataGrid/Row/styles.js +14 -19
- package/components/DataGrid/RowBase/styles.js +10 -17
- package/components/DataGridCollapsibleRow/styles.js +5 -2
- package/components/Description/Value/styles.js +5 -2
- package/components/Dialog/Dialog.d.ts +1 -1
- package/components/Dialog/Dialog.js +5 -4
- package/components/Dialog/styles.js +8 -0
- package/components/Dialog/types.d.ts +5 -0
- package/components/Dialog/useLogic/useLogic.d.ts +3 -3
- package/components/Dialog/useLogic/useLogic.js +6 -2
- package/components/ExpansionPanel/Summary/styles.js +5 -2
- package/components/Fab/styles.js +12 -3
- package/components/HintPopover/styles.js +2 -1
- package/components/InfiniteDataList/styles.js +5 -2
- package/components/InfiniteTreeList/InfiniteTreeListItem/styles.js +5 -2
- package/components/InputGroup/styles.js +8 -5
- package/components/JsonViewer/JsonNode/styles.js +5 -2
- package/components/Link/styles.js +11 -6
- package/components/ListItem/styles.js +5 -2
- package/components/MenuOrganization/OrganizationButton/styles.js +5 -6
- package/components/NavMenu/Item/ItemButton/styles.js +14 -7
- package/components/NewPopover/NewPopover.js +1 -0
- package/components/NewPopover/constants.d.ts +5 -0
- package/components/NewPopover/constants.js +6 -1
- package/components/NewPopover/styles.js +2 -1
- package/components/NewPopover/types.d.ts +1 -1
- package/components/NewPopover/useLogic/useLogic.d.ts +2 -2
- package/components/NewPopover/useLogic/useLogic.js +12 -12
- package/components/NewPopover/useLogic/utils/getFallbackPlacements/getFallbackPlacements.d.ts +7 -0
- package/components/NewPopover/useLogic/utils/getFallbackPlacements/getFallbackPlacements.js +19 -0
- package/components/NewPopover/useLogic/utils/getFallbackPlacements/index.d.ts +1 -0
- package/components/NewPopover/useLogic/utils/getFallbackPlacements/index.js +1 -0
- package/components/NewPopover/useLogic/utils/index.d.ts +4 -0
- package/components/NewPopover/useLogic/utils/index.js +4 -0
- package/components/NewStepper/Step/styles.js +18 -15
- package/components/Notification/NotificationStackContainer/styles.js +5 -2
- package/components/Onboarding/types/step.d.ts +1 -1
- package/components/Onboarding/ui/StepStrategy/steps/HighlightStep/styles.d.ts +1 -1
- package/components/Onboarding/ui/StepStrategy/steps/StandaloneStep/StandaloneStep.js +1 -1
- package/components/Onboarding/ui/StepStrategy/steps/StandaloneStep/styles.d.ts +1 -0
- package/components/Onboarding/ui/hooks/useTrackedRect/constants.d.ts +6 -0
- package/components/Onboarding/ui/hooks/useTrackedRect/constants.js +6 -0
- package/components/Onboarding/ui/hooks/useTrackedRect/useTrackedRect.js +34 -12
- package/components/PageAsideNavigation/PageAsideNavigationItem/styles.js +5 -6
- package/components/PageHeader/MobilePageActions/styles.js +0 -4
- package/components/Radio/styles.js +7 -4
- package/components/RadioCard/styles.js +5 -2
- package/components/StaticCalendar/StaticCalendarGridButton/styles.js +8 -5
- package/components/Tabs/Tab/styles.js +5 -2
- package/components/ToggleButton/styles.js +25 -10
- package/components/Tree/TreeItem/MobileSlidePanel/MobileSlidePanelContent/styles.js +3 -3
- package/components/Tree/TreeItem/styles.js +23 -10
- package/components/constants/index.d.ts +1 -0
- package/components/constants/index.js +1 -0
- package/components/constants/media.d.ts +8 -0
- package/components/constants/media.js +8 -0
- package/components/theme/components/MuiButton.js +46 -23
- package/components/theme/components/MuiListItemButton.js +10 -2
- package/components/theme/components/MuiMenuItem.js +5 -2
- package/components/theme/components/MuiOutlinedInput.js +15 -12
- package/components/theme/components/MuiSwitch.js +14 -9
- package/components/theme/components/MuiTableRow.js +11 -3
- package/hook-form/FormFilters/FormFiltersDialog/styles.d.ts +1 -0
- package/node/components/Alert/styles.js +24 -14
- package/node/components/Autocomplete/styles.js +8 -5
- package/node/components/Breadcrumbs/styles.js +18 -13
- package/node/components/CheckableTag/styles.js +6 -3
- package/node/components/Checkbox/styles.js +26 -23
- package/node/components/Chip/styles.js +36 -31
- package/node/components/CodeField/styles.js +5 -2
- package/node/components/CopyTypography/styles.js +22 -8
- package/node/components/DashboardLayout/Header/styles.js +35 -32
- package/node/components/DashboardSidebarPopover/SidebarPopoverItem/styles.js +7 -4
- package/node/components/DataGrid/Row/styles.js +41 -46
- package/node/components/DataGrid/RowBase/styles.js +16 -23
- package/node/components/DataGridCollapsibleRow/styles.js +11 -8
- package/node/components/Description/Value/styles.js +5 -2
- package/node/components/Dialog/Dialog.d.ts +1 -1
- package/node/components/Dialog/Dialog.js +5 -4
- package/node/components/Dialog/styles.js +8 -0
- package/node/components/Dialog/types.d.ts +5 -0
- package/node/components/Dialog/useLogic/useLogic.d.ts +3 -3
- package/node/components/Dialog/useLogic/useLogic.js +6 -2
- package/node/components/ExpansionPanel/Summary/styles.js +5 -2
- package/node/components/Fab/styles.js +12 -3
- package/node/components/HintPopover/styles.js +2 -1
- package/node/components/InfiniteDataList/styles.js +7 -4
- package/node/components/InfiniteTreeList/InfiniteTreeListItem/styles.js +11 -8
- package/node/components/InputGroup/styles.js +8 -5
- package/node/components/JsonViewer/JsonNode/styles.js +5 -2
- package/node/components/Link/styles.js +13 -8
- package/node/components/ListItem/styles.js +10 -7
- package/node/components/MenuOrganization/OrganizationButton/styles.js +5 -6
- package/node/components/NavMenu/Item/ItemButton/styles.js +16 -9
- package/node/components/NewPopover/NewPopover.js +1 -0
- package/node/components/NewPopover/constants.d.ts +5 -0
- package/node/components/NewPopover/constants.js +7 -2
- package/node/components/NewPopover/styles.js +1 -0
- package/node/components/NewPopover/types.d.ts +1 -1
- package/node/components/NewPopover/useLogic/useLogic.d.ts +2 -2
- package/node/components/NewPopover/useLogic/useLogic.js +15 -15
- package/node/components/NewPopover/useLogic/utils/getFallbackPlacements/getFallbackPlacements.d.ts +7 -0
- package/node/components/NewPopover/useLogic/utils/getFallbackPlacements/getFallbackPlacements.js +23 -0
- package/node/components/NewPopover/useLogic/utils/getFallbackPlacements/index.d.ts +1 -0
- package/node/components/NewPopover/useLogic/utils/getFallbackPlacements/index.js +17 -0
- package/node/components/NewPopover/useLogic/utils/index.d.ts +4 -0
- package/node/components/NewPopover/useLogic/utils/index.js +20 -0
- package/node/components/NewStepper/Step/styles.js +68 -65
- package/node/components/Notification/NotificationStackContainer/styles.js +57 -54
- package/node/components/Onboarding/types/step.d.ts +1 -1
- package/node/components/Onboarding/ui/StepStrategy/steps/HighlightStep/styles.d.ts +1 -1
- package/node/components/Onboarding/ui/StepStrategy/steps/StandaloneStep/StandaloneStep.js +1 -1
- package/node/components/Onboarding/ui/StepStrategy/steps/StandaloneStep/styles.d.ts +1 -0
- package/node/components/Onboarding/ui/hooks/useTrackedRect/constants.d.ts +6 -0
- package/node/components/Onboarding/ui/hooks/useTrackedRect/constants.js +9 -0
- package/node/components/Onboarding/ui/hooks/useTrackedRect/useTrackedRect.js +34 -12
- package/node/components/PageAsideNavigation/PageAsideNavigationItem/styles.js +12 -13
- package/node/components/PageHeader/MobilePageActions/styles.js +0 -4
- package/node/components/Radio/styles.js +20 -17
- package/node/components/RadioCard/styles.js +7 -4
- package/node/components/StaticCalendar/StaticCalendarGridButton/styles.js +8 -5
- package/node/components/Tabs/Tab/styles.js +5 -2
- package/node/components/ToggleButton/styles.js +27 -12
- package/node/components/Tree/TreeItem/MobileSlidePanel/MobileSlidePanelContent/styles.js +3 -3
- package/node/components/Tree/TreeItem/styles.js +44 -31
- package/node/components/constants/index.d.ts +1 -0
- package/node/components/constants/index.js +1 -0
- package/node/components/constants/media.d.ts +8 -0
- package/node/components/constants/media.js +11 -0
- package/node/components/theme/components/MuiButton.js +46 -23
- package/node/components/theme/components/MuiListItemButton.js +10 -2
- package/node/components/theme/components/MuiMenuItem.js +5 -2
- package/node/components/theme/components/MuiOutlinedInput.js +15 -12
- package/node/components/theme/components/MuiSwitch.js +14 -9
- package/node/components/theme/components/MuiTableRow.js +11 -3
- package/node/hook-form/FormFilters/FormFiltersDialog/styles.d.ts +1 -0
- package/package.json +1 -1
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Chevron = exports.IconWrapper = exports.NodeContainer = void 0;
|
|
4
4
|
const ChevronROutlineMd_1 = require("../../../icons/ChevronROutlineMd");
|
|
5
|
+
const constants_1 = require("../../constants");
|
|
5
6
|
const styled_1 = require("../../styled");
|
|
6
7
|
exports.NodeContainer = (0, styled_1.styled)('dl', {
|
|
7
8
|
shouldForwardProp: (prop) => prop !== 'level' && prop !== 'isExpandable',
|
|
@@ -24,8 +25,10 @@ exports.NodeContainer = (0, styled_1.styled)('dl', {
|
|
|
24
25
|
duration: theme.transitions.duration.shortest,
|
|
25
26
|
})};
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
${constants_1.HOVER_MEDIA} {
|
|
29
|
+
&:hover {
|
|
30
|
+
background-color: ${({ theme, isExpandable }) => isExpandable ? theme.palette.background.elementHover : 'transparent'};
|
|
31
|
+
}
|
|
29
32
|
}
|
|
30
33
|
`;
|
|
31
34
|
exports.IconWrapper = (0, styled_1.styled)('div', {
|
|
@@ -5,9 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.StyledLink = void 0;
|
|
7
7
|
const Link_1 = __importDefault(require("@mui/material/Link"));
|
|
8
|
+
const constants_1 = require("../constants");
|
|
8
9
|
const SvgIcon_1 = require("../SvgIcon");
|
|
9
10
|
const styled_1 = require("../styled");
|
|
10
|
-
const
|
|
11
|
+
const constants_2 = require("./constants");
|
|
11
12
|
exports.StyledLink = (0, styled_1.styled)(Link_1.default) `
|
|
12
13
|
display: inline-flex;
|
|
13
14
|
gap: ${({ theme }) => theme.spacing(1)};
|
|
@@ -22,26 +23,30 @@ exports.StyledLink = (0, styled_1.styled)(Link_1.default) `
|
|
|
22
23
|
color: ${({ theme }) => theme.palette.components.link.visited};
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
${constants_1.HOVER_MEDIA} {
|
|
27
|
+
&:hover {
|
|
28
|
+
color: ${({ theme }) => theme.palette.components.link.hover};
|
|
29
|
+
text-decoration: underline;
|
|
30
|
+
}
|
|
28
31
|
}
|
|
29
32
|
|
|
30
33
|
&:active {
|
|
31
34
|
color: ${({ theme }) => theme.palette.components.link.active};
|
|
32
35
|
}
|
|
33
36
|
|
|
34
|
-
&.${
|
|
37
|
+
&.${constants_2.linkClassnames.isContrast} {
|
|
35
38
|
color: ${({ theme }) => theme.palette.components.link.contrast.main};
|
|
36
39
|
|
|
37
40
|
&:visited {
|
|
38
41
|
color: ${({ theme }) => theme.palette.components.link.contrast.visited};
|
|
39
42
|
}
|
|
40
43
|
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
${constants_1.HOVER_MEDIA} {
|
|
45
|
+
&:hover {
|
|
46
|
+
color: ${({ theme }) => theme.palette.components.link.contrast.hover};
|
|
47
|
+
}
|
|
43
48
|
}
|
|
44
|
-
|
|
49
|
+
|
|
45
50
|
&:active {
|
|
46
51
|
color: ${({ theme }) => theme.palette.components.link.contrast.active};
|
|
47
52
|
}
|
|
@@ -5,8 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.StyledListItem = exports.getColor = exports.getBgColor = void 0;
|
|
7
7
|
const ListItem_1 = __importDefault(require("@mui/material/ListItem"));
|
|
8
|
+
const constants_1 = require("../constants");
|
|
8
9
|
const styled_1 = require("../styled");
|
|
9
|
-
const
|
|
10
|
+
const constants_2 = require("./constants");
|
|
10
11
|
const getBgColor = ({ selected, theme, }) => {
|
|
11
12
|
if (selected) {
|
|
12
13
|
return theme.palette.grey[200];
|
|
@@ -18,10 +19,10 @@ const getColor = ({ theme, selected, listItemState, }) => {
|
|
|
18
19
|
if (selected) {
|
|
19
20
|
return theme.palette.primary[800];
|
|
20
21
|
}
|
|
21
|
-
if (listItemState ===
|
|
22
|
+
if (listItemState === constants_2.ListItemStates.Default) {
|
|
22
23
|
return theme.palette.grey[900];
|
|
23
24
|
}
|
|
24
|
-
if (listItemState ===
|
|
25
|
+
if (listItemState === constants_2.ListItemStates.Hover) {
|
|
25
26
|
return theme.palette.primary[800];
|
|
26
27
|
}
|
|
27
28
|
return theme.palette.grey[900];
|
|
@@ -35,15 +36,17 @@ exports.StyledListItem = (0, styled_1.styled)(ListItem_1.default, {
|
|
|
35
36
|
|
|
36
37
|
padding-left: ${({ theme }) => theme.spacing(3)};
|
|
37
38
|
|
|
38
|
-
color: ${(props) => (0, exports.getColor)({ ...props, listItemState:
|
|
39
|
+
color: ${(props) => (0, exports.getColor)({ ...props, listItemState: constants_2.ListItemStates.Default })};
|
|
39
40
|
|
|
40
41
|
background-color: ${(props) => (0, exports.getBgColor)({ ...props })};
|
|
41
42
|
border-radius: ${({ theme }) => theme.shape.small};
|
|
42
43
|
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
${constants_1.HOVER_MEDIA} {
|
|
45
|
+
:hover {
|
|
46
|
+
color: ${(props) => (0, exports.getColor)({
|
|
45
47
|
...props,
|
|
46
|
-
listItemState:
|
|
48
|
+
listItemState: constants_2.ListItemStates.Hover,
|
|
47
49
|
})};
|
|
50
|
+
}
|
|
48
51
|
}
|
|
49
52
|
`;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.StyledTypography = exports.Container = exports.StyledChevron = exports.StyledButton = void 0;
|
|
4
4
|
const Button_1 = require("../../Button");
|
|
5
5
|
const Chevron_1 = require("../../Chevron");
|
|
6
|
+
const constants_1 = require("../../constants");
|
|
6
7
|
const styled_1 = require("../../styled/styled");
|
|
7
8
|
const Typography_1 = require("../../Typography");
|
|
8
9
|
exports.StyledButton = (0, styled_1.styled)(Button_1.Button) `
|
|
@@ -16,8 +17,10 @@ exports.StyledButton = (0, styled_1.styled)(Button_1.Button) `
|
|
|
16
17
|
|
|
17
18
|
text-align: left;
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
${constants_1.HOVER_MEDIA} {
|
|
21
|
+
&:hover {
|
|
22
|
+
background-color: ${({ theme }) => theme.palette.background.elementHover};
|
|
23
|
+
}
|
|
21
24
|
}
|
|
22
25
|
|
|
23
26
|
&:active {
|
|
@@ -35,10 +38,6 @@ exports.StyledButton = (0, styled_1.styled)(Button_1.Button) `
|
|
|
35
38
|
|
|
36
39
|
border-radius: 0;
|
|
37
40
|
|
|
38
|
-
&:hover {
|
|
39
|
-
background-color: initial;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
41
|
&:active {
|
|
43
42
|
background-color: ${({ theme }) => theme.palette.primary[100]};
|
|
44
43
|
}
|
|
@@ -4,13 +4,14 @@ exports.StyledPageDotOutlineMd = exports.EndAdornmentWrapper = exports.NavMenuIt
|
|
|
4
4
|
const ListItemButton_1 = require("@mui/material/ListItemButton");
|
|
5
5
|
const ChevronDOutlineMd_1 = require("../../../../icons/ChevronDOutlineMd");
|
|
6
6
|
const PageDotOutlineMd_1 = require("../../../../icons/PageDotOutlineMd");
|
|
7
|
+
const constants_1 = require("../../../constants");
|
|
7
8
|
const ListItemButton_2 = require("../../../ListItemButton");
|
|
8
9
|
const ListItemIcon_1 = require("../../../ListItemIcon");
|
|
9
10
|
const OverflowTypography_1 = require("../../../OverflowTypography");
|
|
10
11
|
const SvgIcon_1 = require("../../../SvgIcon");
|
|
11
12
|
const styled_1 = require("../../../styled");
|
|
12
13
|
const mixins_1 = require("../../../styled/mixins");
|
|
13
|
-
const
|
|
14
|
+
const constants_2 = require("./constants");
|
|
14
15
|
exports.StyledListItemButton = (0, styled_1.styled)(ListItemButton_2.ListItemButton) `
|
|
15
16
|
overflow: hidden;
|
|
16
17
|
|
|
@@ -36,23 +37,29 @@ exports.StyledListItemButton = (0, styled_1.styled)(ListItemButton_2.ListItemBut
|
|
|
36
37
|
border-left: 3px solid ${({ theme }) => theme.palette.primary[800]};
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
${constants_1.HOVER_MEDIA} {
|
|
41
|
+
&:hover {
|
|
42
|
+
background-color: ${({ theme }) => theme.palette.primary[100]};
|
|
43
|
+
}
|
|
41
44
|
}
|
|
42
45
|
|
|
43
|
-
&.${
|
|
46
|
+
&.${constants_2.navMenuItemButtonClassnames.hasGroup} {
|
|
44
47
|
background-color: inherit;
|
|
45
48
|
|
|
46
|
-
|
|
47
|
-
|
|
49
|
+
${constants_1.HOVER_MEDIA} {
|
|
50
|
+
&:hover {
|
|
51
|
+
background-color: inherit;
|
|
52
|
+
}
|
|
48
53
|
}
|
|
49
54
|
}
|
|
50
55
|
}
|
|
51
56
|
|
|
52
|
-
|
|
53
|
-
|
|
57
|
+
${constants_1.HOVER_MEDIA} {
|
|
58
|
+
&:hover {
|
|
59
|
+
color: ${({ theme }) => theme.palette.primary['800']};
|
|
54
60
|
|
|
55
|
-
|
|
61
|
+
background-color: inherit;
|
|
62
|
+
}
|
|
56
63
|
}
|
|
57
64
|
|
|
58
65
|
&:active {
|
|
@@ -26,6 +26,7 @@ const NewPopover = ({ children, onClose, isOpen, title, className, style, placem
|
|
|
26
26
|
disableAutoFocus,
|
|
27
27
|
hasArrow,
|
|
28
28
|
disableMobileDrawer,
|
|
29
|
+
placement,
|
|
29
30
|
});
|
|
30
31
|
if (shouldRenderDrawer) {
|
|
31
32
|
return ((0, jsx_runtime_1.jsx)(BottomDrawer_1.BottomDrawer, { title: title, onClose: handleClose, open: isOpened, className: className, style: style, ModalProps: {
|
|
@@ -18,6 +18,11 @@ export declare const ARROW_PADDING = 24;
|
|
|
18
18
|
export declare const ARROW_MIN_PADDING = 16;
|
|
19
19
|
/** Мин. «ход» стрелки вдоль кромки (px). */
|
|
20
20
|
export declare const ARROW_MIN_TRACK = 16;
|
|
21
|
+
/**
|
|
22
|
+
* Мин. отступ popover от края вьюпорта (px).
|
|
23
|
+
* Наружу отдаётся CSS-переменной `--popover-viewport-padding`.
|
|
24
|
+
*/
|
|
25
|
+
export declare const VIEWPORT_MIN_PADDING = 16;
|
|
21
26
|
/**
|
|
22
27
|
* Базовые модификаторы Popper.js. У MUI Popper (popper.js)
|
|
23
28
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_MODIFIERS = exports.ARROW_MIN_TRACK = exports.ARROW_MIN_PADDING = exports.ARROW_PADDING = exports.ARROW_HEIGHT = exports.ARROW_BASE = exports.popoverClassnames = void 0;
|
|
3
|
+
exports.DEFAULT_MODIFIERS = exports.VIEWPORT_MIN_PADDING = exports.ARROW_MIN_TRACK = exports.ARROW_MIN_PADDING = exports.ARROW_PADDING = exports.ARROW_HEIGHT = exports.ARROW_BASE = exports.popoverClassnames = void 0;
|
|
4
4
|
const createUIKitClassname_1 = require("../utils/createUIKitClassname");
|
|
5
5
|
exports.popoverClassnames = {
|
|
6
6
|
root: (0, createUIKitClassname_1.createUIKitClassname)('popover'),
|
|
@@ -21,12 +21,17 @@ exports.ARROW_PADDING = 24;
|
|
|
21
21
|
exports.ARROW_MIN_PADDING = 16;
|
|
22
22
|
/** Мин. «ход» стрелки вдоль кромки (px). */
|
|
23
23
|
exports.ARROW_MIN_TRACK = 16;
|
|
24
|
+
/**
|
|
25
|
+
* Мин. отступ popover от края вьюпорта (px).
|
|
26
|
+
* Наружу отдаётся CSS-переменной `--popover-viewport-padding`.
|
|
27
|
+
*/
|
|
28
|
+
exports.VIEWPORT_MIN_PADDING = 16;
|
|
24
29
|
/**
|
|
25
30
|
* Базовые модификаторы Popper.js. У MUI Popper (popper.js)
|
|
26
31
|
*/
|
|
27
32
|
exports.DEFAULT_MODIFIERS = [
|
|
28
33
|
{
|
|
29
34
|
name: 'preventOverflow',
|
|
30
|
-
options: { altAxis: true, tether: false, padding:
|
|
35
|
+
options: { altAxis: true, tether: false, padding: exports.VIEWPORT_MIN_PADDING },
|
|
31
36
|
},
|
|
32
37
|
];
|
|
@@ -11,6 +11,7 @@ exports.StyledMuiPopper = (0, styled_1.styled)(Popper_1.default) `
|
|
|
11
11
|
&.${constants_1.popoverClassnames.root} {
|
|
12
12
|
--arrow-base: ${constants_1.ARROW_BASE}px;
|
|
13
13
|
--arrow-height: ${constants_1.ARROW_HEIGHT}px;
|
|
14
|
+
--popover-viewport-padding: ${constants_1.VIEWPORT_MIN_PADDING}px;
|
|
14
15
|
|
|
15
16
|
z-index: ${({ theme }) => theme.zIndex.modal};
|
|
16
17
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { type NewPopoverModifier, type NewPopoverProps } from '../types';
|
|
3
|
-
type UseLogicParams = Pick<NewPopoverProps, 'isOpen' | 'anchorEl' | 'onClose' | 'disableAutoFocus' | 'hasArrow' | 'disableMobileDrawer'
|
|
4
|
-
export declare const useLogic: ({ isOpen, anchorEl, onClose, disableAutoFocus, hasArrow, disableMobileDrawer, }: UseLogicParams) => {
|
|
3
|
+
type UseLogicParams = Pick<NewPopoverProps, 'isOpen' | 'anchorEl' | 'onClose' | 'disableAutoFocus' | 'hasArrow' | 'disableMobileDrawer'> & Required<Pick<NewPopoverProps, 'placement'>>;
|
|
4
|
+
export declare const useLogic: ({ isOpen, anchorEl, onClose, disableAutoFocus, hasArrow, disableMobileDrawer, placement, }: UseLogicParams) => {
|
|
5
5
|
shouldRenderDrawer: boolean;
|
|
6
6
|
isOpened: boolean;
|
|
7
7
|
shouldRender: boolean;
|
|
@@ -8,10 +8,8 @@ const useFocusTrapEffect_1 = require("../../useFocusTrapEffect");
|
|
|
8
8
|
const usePopoverAnimation_1 = require("../../usePopoverAnimation");
|
|
9
9
|
const useViewportType_1 = require("../../useViewportType");
|
|
10
10
|
const constants_1 = require("../constants");
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const resolveAnchorNode_1 = require("./utils/resolveAnchorNode");
|
|
14
|
-
const useLogic = ({ isOpen, anchorEl, onClose, disableAutoFocus, hasArrow, disableMobileDrawer, }) => {
|
|
11
|
+
const utils_1 = require("./utils");
|
|
12
|
+
const useLogic = ({ isOpen, anchorEl, onClose, disableAutoFocus, hasArrow, disableMobileDrawer, placement, }) => {
|
|
15
13
|
const containerRef = (0, react_1.useRef)(null);
|
|
16
14
|
const [isContainerMounted, setIsContainerMounted] = (0, react_1.useState)(false);
|
|
17
15
|
const [arrowElement, setArrowElement] = (0, react_1.useState)(null);
|
|
@@ -23,10 +21,10 @@ const useLogic = ({ isOpen, anchorEl, onClose, disableAutoFocus, hasArrow, disab
|
|
|
23
21
|
const isControlled = isOpen !== undefined;
|
|
24
22
|
const { isMobile } = (0, useViewportType_1.useViewportType)();
|
|
25
23
|
const { shouldRender, handleAnimationEnd } = (0, usePopoverAnimation_1.usePopoverAnimation)(isOpened);
|
|
26
|
-
const animatedWrapperStyle = (0,
|
|
24
|
+
const animatedWrapperStyle = (0, utils_1.getPopoverCssVars)();
|
|
27
25
|
const shouldRenderDrawer = isMobile && !disableMobileDrawer;
|
|
28
26
|
const isPopoverActive = !shouldRenderDrawer && isOpened && isContainerMounted;
|
|
29
|
-
const anchorNode = (0, react_1.useMemo)(() => (0,
|
|
27
|
+
const anchorNode = (0, react_1.useMemo)(() => (0, utils_1.resolveAnchorNode)(anchorEl), [anchorEl]);
|
|
30
28
|
const excludeNodes = (0, react_1.useMemo)(() => [anchorNode], [anchorNode]);
|
|
31
29
|
const handleClose = (event) => {
|
|
32
30
|
onClose?.(event);
|
|
@@ -53,18 +51,20 @@ const useLogic = ({ isOpen, anchorEl, onClose, disableAutoFocus, hasArrow, disab
|
|
|
53
51
|
fallbackFocus: () => containerRef.current || document.body,
|
|
54
52
|
});
|
|
55
53
|
const mergedModifiers = (0, react_1.useMemo)(() => {
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
const modifiers = [...constants_1.DEFAULT_MODIFIERS];
|
|
55
|
+
const fallbackPlacements = (0, utils_1.getFallbackPlacements)(placement);
|
|
56
|
+
if (fallbackPlacements) {
|
|
57
|
+
modifiers.push({ name: 'flip', options: { fallbackPlacements } });
|
|
58
58
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
{
|
|
59
|
+
if (hasArrow) {
|
|
60
|
+
modifiers.push({
|
|
62
61
|
name: 'arrow',
|
|
63
62
|
enabled: true,
|
|
64
|
-
options: { element: arrowElement, padding:
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
options: { element: arrowElement, padding: utils_1.getArrowPadding },
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
return modifiers;
|
|
67
|
+
}, [hasArrow, arrowElement, placement]);
|
|
68
68
|
return {
|
|
69
69
|
shouldRenderDrawer,
|
|
70
70
|
isOpened,
|
package/node/components/NewPopover/useLogic/utils/getFallbackPlacements/getFallbackPlacements.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type NewPopoverPlacement } from '../../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Значение fallbackPlacements для модификатора flip: заданная сторона не подошла —
|
|
4
|
+
* берётся следующая по списку. Для вертикальной стороны и `auto` список не задаётся,
|
|
5
|
+
* flip справляется сам.
|
|
6
|
+
*/
|
|
7
|
+
export declare const getFallbackPlacements: (placement: NewPopoverPlacement) => NewPopoverPlacement[] | undefined;
|
package/node/components/NewPopover/useLogic/utils/getFallbackPlacements/getFallbackPlacements.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFallbackPlacements = void 0;
|
|
4
|
+
const OPPOSITE_SIDE = {
|
|
5
|
+
left: 'right',
|
|
6
|
+
right: 'left',
|
|
7
|
+
};
|
|
8
|
+
const VERTICAL_SIDES = ['bottom', 'top'];
|
|
9
|
+
const checkIsSidePlacement = (side) => side in OPPOSITE_SIDE;
|
|
10
|
+
/**
|
|
11
|
+
* Значение fallbackPlacements для модификатора flip: заданная сторона не подошла —
|
|
12
|
+
* берётся следующая по списку. Для вертикальной стороны и `auto` список не задаётся,
|
|
13
|
+
* flip справляется сам.
|
|
14
|
+
*/
|
|
15
|
+
const getFallbackPlacements = (placement) => {
|
|
16
|
+
const [side, alignment] = placement.split('-');
|
|
17
|
+
if (!checkIsSidePlacement(side)) {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
const suffix = alignment ? `-${alignment}` : '';
|
|
21
|
+
return [OPPOSITE_SIDE[side], ...VERTICAL_SIDES].map((fallbackSide) => `${fallbackSide}${suffix}`);
|
|
22
|
+
};
|
|
23
|
+
exports.getFallbackPlacements = getFallbackPlacements;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './getFallbackPlacements';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./getFallbackPlacements"), exports);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./getArrowPadding"), exports);
|
|
18
|
+
__exportStar(require("./getFallbackPlacements"), exports);
|
|
19
|
+
__exportStar(require("./getPopoverCssVars"), exports);
|
|
20
|
+
__exportStar(require("./resolveAnchorNode"), exports);
|