@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
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { formControlClasses } from '@mui/material/FormControl';
|
|
2
2
|
import { inputBaseClasses } from '@mui/material/InputBase';
|
|
3
|
+
import { HOVER_MEDIA } from '../constants';
|
|
3
4
|
import { styled } from '../styled';
|
|
4
5
|
export const InputsWrapper = styled.fieldset `
|
|
5
6
|
display: grid;
|
|
@@ -76,11 +77,13 @@ export const InputsWrapper = styled.fieldset `
|
|
|
76
77
|
width: auto;
|
|
77
78
|
margin-right: -2px;
|
|
78
79
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
80
|
+
${HOVER_MEDIA} {
|
|
81
|
+
&:hover {
|
|
82
|
+
z-index: 3;
|
|
83
|
+
|
|
84
|
+
&.${inputBaseClasses.disabled} {
|
|
85
|
+
z-index: 1;
|
|
86
|
+
}
|
|
84
87
|
}
|
|
85
88
|
}
|
|
86
89
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ChevronROutlineMd } from '../../../icons/ChevronROutlineMd';
|
|
2
|
+
import { HOVER_MEDIA } from '../../constants';
|
|
2
3
|
import { styled } from '../../styled';
|
|
3
4
|
export const NodeContainer = styled('dl', {
|
|
4
5
|
shouldForwardProp: (prop) => prop !== 'level' && prop !== 'isExpandable',
|
|
@@ -21,8 +22,10 @@ export const NodeContainer = styled('dl', {
|
|
|
21
22
|
duration: theme.transitions.duration.shortest,
|
|
22
23
|
})};
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
${HOVER_MEDIA} {
|
|
26
|
+
&:hover {
|
|
27
|
+
background-color: ${({ theme, isExpandable }) => isExpandable ? theme.palette.background.elementHover : 'transparent'};
|
|
28
|
+
}
|
|
26
29
|
}
|
|
27
30
|
`;
|
|
28
31
|
export const IconWrapper = styled('div', {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Link from '@mui/material/Link';
|
|
2
|
+
import { HOVER_MEDIA } from '../constants';
|
|
2
3
|
import { svgIconClassnames } from '../SvgIcon';
|
|
3
4
|
import { styled } from '../styled';
|
|
4
5
|
import { linkClassnames } from './constants';
|
|
@@ -16,9 +17,11 @@ export const StyledLink = styled(Link) `
|
|
|
16
17
|
color: ${({ theme }) => theme.palette.components.link.visited};
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
${HOVER_MEDIA} {
|
|
21
|
+
&:hover {
|
|
22
|
+
color: ${({ theme }) => theme.palette.components.link.hover};
|
|
23
|
+
text-decoration: underline;
|
|
24
|
+
}
|
|
22
25
|
}
|
|
23
26
|
|
|
24
27
|
&:active {
|
|
@@ -32,10 +35,12 @@ export const StyledLink = styled(Link) `
|
|
|
32
35
|
color: ${({ theme }) => theme.palette.components.link.contrast.visited};
|
|
33
36
|
}
|
|
34
37
|
|
|
35
|
-
|
|
36
|
-
|
|
38
|
+
${HOVER_MEDIA} {
|
|
39
|
+
&:hover {
|
|
40
|
+
color: ${({ theme }) => theme.palette.components.link.contrast.hover};
|
|
41
|
+
}
|
|
37
42
|
}
|
|
38
|
-
|
|
43
|
+
|
|
39
44
|
&:active {
|
|
40
45
|
color: ${({ theme }) => theme.palette.components.link.contrast.active};
|
|
41
46
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import ListItem from '@mui/material/ListItem';
|
|
2
|
+
import { HOVER_MEDIA } from '../constants';
|
|
2
3
|
import { styled } from '../styled';
|
|
3
4
|
import { ListItemStates } from './constants';
|
|
4
5
|
export const getBgColor = ({ selected, theme, }) => {
|
|
@@ -32,10 +33,12 @@ export const StyledListItem = styled(ListItem, {
|
|
|
32
33
|
background-color: ${(props) => getBgColor({ ...props })};
|
|
33
34
|
border-radius: ${({ theme }) => theme.shape.small};
|
|
34
35
|
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
${HOVER_MEDIA} {
|
|
37
|
+
:hover {
|
|
38
|
+
color: ${(props) => getColor({
|
|
37
39
|
...props,
|
|
38
40
|
listItemState: ListItemStates.Hover,
|
|
39
41
|
})};
|
|
42
|
+
}
|
|
40
43
|
}
|
|
41
44
|
`;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Button } from '../../Button';
|
|
2
2
|
import { Chevron } from '../../Chevron';
|
|
3
|
+
import { HOVER_MEDIA } from '../../constants';
|
|
3
4
|
import { styled } from '../../styled/styled';
|
|
4
5
|
import { Typography } from '../../Typography';
|
|
5
6
|
export const StyledButton = styled(Button) `
|
|
@@ -13,8 +14,10 @@ export const StyledButton = styled(Button) `
|
|
|
13
14
|
|
|
14
15
|
text-align: left;
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
${HOVER_MEDIA} {
|
|
18
|
+
&:hover {
|
|
19
|
+
background-color: ${({ theme }) => theme.palette.background.elementHover};
|
|
20
|
+
}
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
&:active {
|
|
@@ -32,10 +35,6 @@ export const StyledButton = styled(Button) `
|
|
|
32
35
|
|
|
33
36
|
border-radius: 0;
|
|
34
37
|
|
|
35
|
-
&:hover {
|
|
36
|
-
background-color: initial;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
38
|
&:active {
|
|
40
39
|
background-color: ${({ theme }) => theme.palette.primary[100]};
|
|
41
40
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { listItemButtonClasses } from '@mui/material/ListItemButton';
|
|
2
2
|
import { ChevronDOutlineMd } from '../../../../icons/ChevronDOutlineMd';
|
|
3
3
|
import { PageDotOutlineMd } from '../../../../icons/PageDotOutlineMd';
|
|
4
|
+
import { HOVER_MEDIA } from '../../../constants';
|
|
4
5
|
import { ListItemButton } from '../../../ListItemButton';
|
|
5
6
|
import { ListItemIcon } from '../../../ListItemIcon';
|
|
6
7
|
import { OverflowTypography } from '../../../OverflowTypography';
|
|
@@ -33,23 +34,29 @@ export const StyledListItemButton = styled(ListItemButton) `
|
|
|
33
34
|
border-left: 3px solid ${({ theme }) => theme.palette.primary[800]};
|
|
34
35
|
}
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
${HOVER_MEDIA} {
|
|
38
|
+
&:hover {
|
|
39
|
+
background-color: ${({ theme }) => theme.palette.primary[100]};
|
|
40
|
+
}
|
|
38
41
|
}
|
|
39
42
|
|
|
40
43
|
&.${navMenuItemButtonClassnames.hasGroup} {
|
|
41
44
|
background-color: inherit;
|
|
42
45
|
|
|
43
|
-
|
|
44
|
-
|
|
46
|
+
${HOVER_MEDIA} {
|
|
47
|
+
&:hover {
|
|
48
|
+
background-color: inherit;
|
|
49
|
+
}
|
|
45
50
|
}
|
|
46
51
|
}
|
|
47
52
|
}
|
|
48
53
|
|
|
49
|
-
|
|
50
|
-
|
|
54
|
+
${HOVER_MEDIA} {
|
|
55
|
+
&:hover {
|
|
56
|
+
color: ${({ theme }) => theme.palette.primary['800']};
|
|
51
57
|
|
|
52
|
-
|
|
58
|
+
background-color: inherit;
|
|
59
|
+
}
|
|
53
60
|
}
|
|
54
61
|
|
|
55
62
|
&:active {
|
|
@@ -23,6 +23,7 @@ export const NewPopover = ({ children, onClose, isOpen, title, className, style,
|
|
|
23
23
|
disableAutoFocus,
|
|
24
24
|
hasArrow,
|
|
25
25
|
disableMobileDrawer,
|
|
26
|
+
placement,
|
|
26
27
|
});
|
|
27
28
|
if (shouldRenderDrawer) {
|
|
28
29
|
return (_jsx(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
|
*/
|
|
@@ -18,12 +18,17 @@ export const ARROW_PADDING = 24;
|
|
|
18
18
|
export const ARROW_MIN_PADDING = 16;
|
|
19
19
|
/** Мин. «ход» стрелки вдоль кромки (px). */
|
|
20
20
|
export const ARROW_MIN_TRACK = 16;
|
|
21
|
+
/**
|
|
22
|
+
* Мин. отступ popover от края вьюпорта (px).
|
|
23
|
+
* Наружу отдаётся CSS-переменной `--popover-viewport-padding`.
|
|
24
|
+
*/
|
|
25
|
+
export const VIEWPORT_MIN_PADDING = 16;
|
|
21
26
|
/**
|
|
22
27
|
* Базовые модификаторы Popper.js. У MUI Popper (popper.js)
|
|
23
28
|
*/
|
|
24
29
|
export const DEFAULT_MODIFIERS = [
|
|
25
30
|
{
|
|
26
31
|
name: 'preventOverflow',
|
|
27
|
-
options: { altAxis: true, tether: false, padding:
|
|
32
|
+
options: { altAxis: true, tether: false, padding: VIEWPORT_MIN_PADDING },
|
|
28
33
|
},
|
|
29
34
|
];
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import MuiPopper from '@mui/material/Popper';
|
|
2
2
|
import { styled } from '../styled';
|
|
3
|
-
import { ARROW_BASE, ARROW_HEIGHT, popoverClassnames } from './constants';
|
|
3
|
+
import { ARROW_BASE, ARROW_HEIGHT, popoverClassnames, VIEWPORT_MIN_PADDING, } from './constants';
|
|
4
4
|
export const StyledMuiPopper = styled(MuiPopper) `
|
|
5
5
|
&.${popoverClassnames.root} {
|
|
6
6
|
--arrow-base: ${ARROW_BASE}px;
|
|
7
7
|
--arrow-height: ${ARROW_HEIGHT}px;
|
|
8
|
+
--popover-viewport-padding: ${VIEWPORT_MIN_PADDING}px;
|
|
8
9
|
|
|
9
10
|
z-index: ${({ theme }) => theme.zIndex.modal};
|
|
10
11
|
}
|
|
@@ -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;
|
|
@@ -5,10 +5,8 @@ import { useFocusTrapEffect } from '../../useFocusTrapEffect';
|
|
|
5
5
|
import { usePopoverAnimation } from '../../usePopoverAnimation';
|
|
6
6
|
import { useViewportType } from '../../useViewportType';
|
|
7
7
|
import { DEFAULT_MODIFIERS } from '../constants';
|
|
8
|
-
import { getArrowPadding } from './utils
|
|
9
|
-
|
|
10
|
-
import { resolveAnchorNode } from './utils/resolveAnchorNode';
|
|
11
|
-
export const useLogic = ({ isOpen, anchorEl, onClose, disableAutoFocus, hasArrow, disableMobileDrawer, }) => {
|
|
8
|
+
import { getArrowPadding, getFallbackPlacements, getPopoverCssVars, resolveAnchorNode, } from './utils';
|
|
9
|
+
export const useLogic = ({ isOpen, anchorEl, onClose, disableAutoFocus, hasArrow, disableMobileDrawer, placement, }) => {
|
|
12
10
|
const containerRef = useRef(null);
|
|
13
11
|
const [isContainerMounted, setIsContainerMounted] = useState(false);
|
|
14
12
|
const [arrowElement, setArrowElement] = useState(null);
|
|
@@ -50,18 +48,20 @@ export const useLogic = ({ isOpen, anchorEl, onClose, disableAutoFocus, hasArrow
|
|
|
50
48
|
fallbackFocus: () => containerRef.current || document.body,
|
|
51
49
|
});
|
|
52
50
|
const mergedModifiers = useMemo(() => {
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
const modifiers = [...DEFAULT_MODIFIERS];
|
|
52
|
+
const fallbackPlacements = getFallbackPlacements(placement);
|
|
53
|
+
if (fallbackPlacements) {
|
|
54
|
+
modifiers.push({ name: 'flip', options: { fallbackPlacements } });
|
|
55
55
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
{
|
|
56
|
+
if (hasArrow) {
|
|
57
|
+
modifiers.push({
|
|
59
58
|
name: 'arrow',
|
|
60
59
|
enabled: true,
|
|
61
60
|
options: { element: arrowElement, padding: getArrowPadding },
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return modifiers;
|
|
64
|
+
}, [hasArrow, arrowElement, placement]);
|
|
65
65
|
return {
|
|
66
66
|
shouldRenderDrawer,
|
|
67
67
|
isOpened,
|
|
@@ -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;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const OPPOSITE_SIDE = {
|
|
2
|
+
left: 'right',
|
|
3
|
+
right: 'left',
|
|
4
|
+
};
|
|
5
|
+
const VERTICAL_SIDES = ['bottom', 'top'];
|
|
6
|
+
const checkIsSidePlacement = (side) => side in OPPOSITE_SIDE;
|
|
7
|
+
/**
|
|
8
|
+
* Значение fallbackPlacements для модификатора flip: заданная сторона не подошла —
|
|
9
|
+
* берётся следующая по списку. Для вертикальной стороны и `auto` список не задаётся,
|
|
10
|
+
* flip справляется сам.
|
|
11
|
+
*/
|
|
12
|
+
export const getFallbackPlacements = (placement) => {
|
|
13
|
+
const [side, alignment] = placement.split('-');
|
|
14
|
+
if (!checkIsSidePlacement(side)) {
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
const suffix = alignment ? `-${alignment}` : '';
|
|
18
|
+
return [OPPOSITE_SIDE[side], ...VERTICAL_SIDES].map((fallbackSide) => `${fallbackSide}${suffix}`);
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './getFallbackPlacements';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './getFallbackPlacements';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { NextOutlineMd } from '../../../icons/NextOutlineMd';
|
|
2
2
|
import { Button } from '../../Button';
|
|
3
|
+
import { HOVER_MEDIA } from '../../constants';
|
|
3
4
|
import { styled } from '../../styled';
|
|
4
5
|
import { typographyClassnames } from '../../Typography/constants';
|
|
5
6
|
import { STEPPER_ORDER_COUNTER_NAME } from '../constants';
|
|
@@ -271,26 +272,28 @@ export const StyledButton = styled(Button) `
|
|
|
271
272
|
height: auto;
|
|
272
273
|
}
|
|
273
274
|
|
|
274
|
-
|
|
275
|
-
|
|
275
|
+
${HOVER_MEDIA} {
|
|
276
|
+
&:hover {
|
|
277
|
+
background: transparent;
|
|
276
278
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
279
|
+
& .${stepClassnames.label} {
|
|
280
|
+
color: ${({ theme }) => theme.palette.grey[700]};
|
|
281
|
+
}
|
|
280
282
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
+
& .${stepIconClassnames.root} {
|
|
284
|
+
color: ${({ theme }) => theme.palette.primary[700]};
|
|
283
285
|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
286
|
+
&.${stepIconClassnames.success} {
|
|
287
|
+
color: ${({ theme }) => theme.palette.success[700]};
|
|
288
|
+
}
|
|
287
289
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
290
|
+
&.${stepIconClassnames.error} {
|
|
291
|
+
color: ${({ theme }) => theme.palette.error[700]};
|
|
292
|
+
}
|
|
291
293
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
+
&.${stepIconClassnames.warning} {
|
|
295
|
+
color: ${({ theme }) => theme.palette.warning[700]};
|
|
296
|
+
}
|
|
294
297
|
}
|
|
295
298
|
}
|
|
296
299
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ToastContainer } from 'react-toastify-next';
|
|
2
2
|
import { Button } from '../../Button';
|
|
3
|
+
import { HOVER_MEDIA } from '../../constants';
|
|
3
4
|
import { keyframes, styled } from '../../styled';
|
|
4
5
|
import { NOTIFY_HEIGHT, NOTIFY_HEIGHT_MOBILE, NOTIFY_NO_TRANSITION_ATTR, NotificationVariantTypes, notifyClassnames, } from '../constants';
|
|
5
6
|
const fade = keyframes `
|
|
@@ -485,8 +486,10 @@ export const CloseButton = styled(Button) `
|
|
|
485
486
|
|
|
486
487
|
animation: ${fade} 500ms linear;
|
|
487
488
|
|
|
488
|
-
|
|
489
|
-
|
|
489
|
+
${HOVER_MEDIA} {
|
|
490
|
+
&:hover {
|
|
491
|
+
box-shadow: ${({ theme }) => theme.elevation[300]};
|
|
492
|
+
}
|
|
490
493
|
}
|
|
491
494
|
|
|
492
495
|
&.${notifyClassnames.closeButtonAnimationOut} {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const StepPopover: import("../../../../../styled").StyledComponent<Omit<import("../../../../../NewPopover").NewPopoverProps, "title" | "
|
|
2
|
+
export declare const StepPopover: import("../../../../../styled").StyledComponent<Omit<import("../../../../../NewPopover").NewPopoverProps, "title" | "disableMobileDrawer" | "hasArrow"> & {
|
|
3
3
|
variant?: import("../../../../../HintPopover").HintPopoverVariant | undefined;
|
|
4
4
|
title?: import("react").ReactNode;
|
|
5
5
|
action?: import("react").ReactNode;
|
|
@@ -7,5 +7,5 @@ import { Footer, StepDialog } from './styles';
|
|
|
7
7
|
*/
|
|
8
8
|
export const StandaloneStep = ({ activeStep, isClosing, }) => {
|
|
9
9
|
const { step, isConfirming, requestClose } = activeStep;
|
|
10
|
-
return (_jsxs(StepDialog, { open: !isConfirming && !isClosing, title: step.title, onClose: requestClose, size: step.dialogSize, disableAutoFocus: true, children: [_jsx(DialogContent, { children: step.content }), _jsx(Footer, { children: _jsx(StepFooter, { activeStep: activeStep }) })] }));
|
|
10
|
+
return (_jsxs(StepDialog, { open: !isConfirming && !isClosing, title: step.title, onClose: requestClose, size: step.dialogSize, disableAutoFocus: true, disableMobileDrawer: true, children: [_jsx(DialogContent, { children: step.content }), _jsx(Footer, { children: _jsx(StepFooter, { activeStep: activeStep }) })] }));
|
|
11
11
|
};
|
|
@@ -4,6 +4,7 @@ export declare const StepDialog: import("../../../../../styled").StyledComponent
|
|
|
4
4
|
disableBackdropClick?: boolean | undefined;
|
|
5
5
|
size?: import("../../../../../Dialog").DialogSize | undefined;
|
|
6
6
|
headerContent?: import("react").ReactNode;
|
|
7
|
+
disableMobileDrawer?: boolean | undefined;
|
|
7
8
|
} & {
|
|
8
9
|
theme?: import("@emotion/react").Theme | undefined;
|
|
9
10
|
}, {}, {}>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Сколько миллисекунд без изменений области считать покоем и останавливать
|
|
3
|
+
* отслеживание по кадрам. Перекрывает длительность анимаций MUI, чтобы
|
|
4
|
+
* отслеживание не выключилось в паузе перед стартом анимации.
|
|
5
|
+
*/
|
|
6
|
+
export declare const TRACKING_IDLE_TIMEOUT_MS = 300;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
2
|
import { clampToScrollParents, getViewport, isSameRect, rectFromDomRect, } from '../../../utils/geometry';
|
|
3
3
|
import { getScrollParents } from '../../../utils/getScrollParents';
|
|
4
|
+
import { TRACKING_IDLE_TIMEOUT_MS } from './constants';
|
|
4
5
|
/**
|
|
5
6
|
* Отслеживает область элемента для hole overlay и якоря popover.
|
|
6
7
|
*/
|
|
@@ -11,32 +12,53 @@ export const useTrackedRect = (element) => {
|
|
|
11
12
|
setRect(null);
|
|
12
13
|
return;
|
|
13
14
|
}
|
|
14
|
-
// ID
|
|
15
|
+
// ID кадра активного отслеживания, 0 — отслеживание остановлено.
|
|
15
16
|
let frame = 0;
|
|
17
|
+
let lastChangeTime = 0;
|
|
18
|
+
let lastRect = null;
|
|
16
19
|
const scrollParents = getScrollParents(element);
|
|
17
20
|
const update = () => {
|
|
18
21
|
const elementRect = rectFromDomRect(element.getBoundingClientRect());
|
|
19
22
|
const viewport = getViewport();
|
|
20
23
|
const next = clampToScrollParents(elementRect, scrollParents.map((parent) => rectFromDomRect(parent.getBoundingClientRect())), viewport);
|
|
21
|
-
|
|
24
|
+
if (isSameRect(lastRect, next)) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
lastRect = next;
|
|
28
|
+
setRect(next);
|
|
29
|
+
return true;
|
|
22
30
|
};
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
31
|
+
const track = () => {
|
|
32
|
+
if (update()) {
|
|
33
|
+
lastChangeTime = performance.now();
|
|
34
|
+
}
|
|
35
|
+
if (performance.now() - lastChangeTime >= TRACKING_IDLE_TIMEOUT_MS) {
|
|
36
|
+
frame = 0;
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
frame = requestAnimationFrame(track);
|
|
40
|
+
};
|
|
41
|
+
// Продлевает отслеживание, а если оно уже остановилось — запускает заново.
|
|
42
|
+
const scheduleTracking = () => {
|
|
43
|
+
lastChangeTime = performance.now();
|
|
44
|
+
if (!frame) {
|
|
45
|
+
frame = requestAnimationFrame(track);
|
|
46
|
+
}
|
|
26
47
|
};
|
|
27
48
|
update();
|
|
49
|
+
scheduleTracking();
|
|
28
50
|
const scrollOptions = { passive: true };
|
|
29
|
-
scrollParents.forEach((parent) => parent.addEventListener('scroll',
|
|
30
|
-
window.addEventListener('scroll',
|
|
31
|
-
window.addEventListener('resize',
|
|
32
|
-
const resizeObserver = new ResizeObserver(
|
|
51
|
+
scrollParents.forEach((parent) => parent.addEventListener('scroll', scheduleTracking, scrollOptions));
|
|
52
|
+
window.addEventListener('scroll', scheduleTracking, scrollOptions);
|
|
53
|
+
window.addEventListener('resize', scheduleTracking);
|
|
54
|
+
const resizeObserver = new ResizeObserver(scheduleTracking);
|
|
33
55
|
resizeObserver.observe(element);
|
|
34
56
|
return () => {
|
|
35
57
|
cancelAnimationFrame(frame);
|
|
36
58
|
resizeObserver.disconnect();
|
|
37
|
-
scrollParents.forEach((parent) => parent.removeEventListener('scroll',
|
|
38
|
-
window.removeEventListener('scroll',
|
|
39
|
-
window.removeEventListener('resize',
|
|
59
|
+
scrollParents.forEach((parent) => parent.removeEventListener('scroll', scheduleTracking, scrollOptions));
|
|
60
|
+
window.removeEventListener('scroll', scheduleTracking, scrollOptions);
|
|
61
|
+
window.removeEventListener('resize', scheduleTracking);
|
|
40
62
|
};
|
|
41
63
|
}, [element]);
|
|
42
64
|
return rect;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { HOVER_MEDIA } from '../../constants';
|
|
1
2
|
import { svgIconClassnames } from '../../SvgIcon/constants';
|
|
2
3
|
import { styled } from '../../styled';
|
|
3
4
|
import { pageAsideNavigationItemClassnames } from './constants';
|
|
@@ -33,8 +34,10 @@ export const Wrapper = styled.li `
|
|
|
33
34
|
color: ${({ theme }) => theme.palette.grey[800]};
|
|
34
35
|
}
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
${HOVER_MEDIA} {
|
|
38
|
+
&:hover {
|
|
39
|
+
color: ${({ theme }) => theme.palette.primary[800]};
|
|
40
|
+
}
|
|
38
41
|
}
|
|
39
42
|
|
|
40
43
|
&:active {
|
|
@@ -73,10 +76,6 @@ export const Wrapper = styled.li `
|
|
|
73
76
|
transition: ${({ theme }) => theme.transitions.create(['border-color', 'background-color'], {
|
|
74
77
|
duration: theme.transitions.duration.shortest,
|
|
75
78
|
})};
|
|
76
|
-
|
|
77
|
-
&:hover {
|
|
78
|
-
color: ${({ theme }) => theme.palette.grey[800]};
|
|
79
|
-
}
|
|
80
79
|
|
|
81
80
|
&:active {
|
|
82
81
|
color: ${({ theme }) => theme.palette.grey[800]};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { HOVER_MEDIA } from '../constants';
|
|
1
2
|
import { styled } from '../styled';
|
|
2
3
|
import { easeOutBackTransition } from '../styled/mixins';
|
|
3
4
|
import { MOBILE_RADIO_SIZE, RADIO_SIZE, radioClassnames } from './constants';
|
|
@@ -58,22 +59,24 @@ export const Wrapper = styled('span', {
|
|
|
58
59
|
${easeOutBackTransition};
|
|
59
60
|
}
|
|
60
61
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
${HOVER_MEDIA} {
|
|
63
|
+
&:hover {
|
|
64
|
+
.${radioClassnames.outerCircle} {
|
|
65
|
+
fill: ${({ theme, $isDisabled, $isError, $isChecked }) => getFillColor({
|
|
64
66
|
theme,
|
|
65
67
|
isHover: true,
|
|
66
68
|
isDisabled: $isDisabled,
|
|
67
69
|
isError: $isError,
|
|
68
70
|
isChecked: $isChecked,
|
|
69
71
|
})};
|
|
70
|
-
|
|
72
|
+
stroke: ${({ theme, $isDisabled, $isError, $isChecked }) => getOutlineColor({
|
|
71
73
|
theme,
|
|
72
74
|
isHover: true,
|
|
73
75
|
isDisabled: $isDisabled,
|
|
74
76
|
isError: $isError,
|
|
75
77
|
isChecked: $isChecked,
|
|
76
78
|
})};
|
|
79
|
+
}
|
|
77
80
|
}
|
|
78
81
|
}
|
|
79
82
|
`;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { HOVER_MEDIA } from '../constants';
|
|
1
2
|
import { Radio, radioClassnames } from '../Radio';
|
|
2
3
|
import { styled } from '../styled';
|
|
3
4
|
import { radioCardClassnames } from './constants';
|
|
@@ -63,10 +64,12 @@ export const Wrapper = styled.label `
|
|
|
63
64
|
cursor: default;
|
|
64
65
|
}
|
|
65
66
|
|
|
66
|
-
|
|
67
|
-
|
|
67
|
+
${HOVER_MEDIA} {
|
|
68
|
+
&:hover {
|
|
69
|
+
background-color: ${({ theme, $isDisabled }) => $isDisabled
|
|
68
70
|
? theme.palette.background.element
|
|
69
71
|
: theme.palette.background.elementHover};
|
|
72
|
+
}
|
|
70
73
|
}
|
|
71
74
|
`;
|
|
72
75
|
export const Content = styled.div `
|