@astral/ui 4.113.0 → 4.113.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/DatePicker/DatePickerPopover/DatePickerPopover.d.ts +2 -1
- package/components/DatePicker/DatePickerPopover/DatePickerPopover.js +4 -2
- package/components/DatePicker/DatePickerPopover/useLogic/index.d.ts +1 -0
- package/components/DatePicker/DatePickerPopover/useLogic/index.js +1 -0
- package/components/DatePicker/DatePickerPopover/useLogic/useLogic.d.ts +9 -0
- package/components/DatePicker/DatePickerPopover/useLogic/useLogic.js +9 -0
- package/components/DatePicker/DatePickerPopover/useLogic/utils/index.d.ts +1 -0
- package/components/DatePicker/DatePickerPopover/useLogic/utils/index.js +1 -0
- package/components/DatePicker/DatePickerPopover/useLogic/utils/stopNextMouseDownPropagation/index.d.ts +1 -0
- package/components/DatePicker/DatePickerPopover/useLogic/utils/stopNextMouseDownPropagation/index.js +1 -0
- package/components/DatePicker/DatePickerPopover/useLogic/utils/stopNextMouseDownPropagation/stopNextMouseDownPropagation.d.ts +4 -0
- package/components/DatePicker/DatePickerPopover/useLogic/utils/stopNextMouseDownPropagation/stopNextMouseDownPropagation.js +15 -0
- package/components/DatePicker/useLogic/useLogic.d.ts +3 -2
- package/components/DatePicker/useLogic/useLogic.js +3 -3
- package/components/DateRangePicker/useLogic/useLogic.d.ts +2 -1
- package/components/DateRangePicker/useLogic/useLogic.js +2 -2
- package/components/NotificationList/Tabs/Tabs.js +2 -3
- package/components/Tabs/Tab/styles.js +6 -2
- package/components/Tabs/styles.js +11 -2
- package/components/constants/index.d.ts +1 -0
- package/components/constants/index.js +1 -0
- package/components/constants/tabs.d.ts +2 -0
- package/components/constants/tabs.js +2 -0
- package/components/theme/components/MuiTabs.js +7 -3
- package/node/components/DatePicker/DatePickerPopover/DatePickerPopover.d.ts +2 -1
- package/node/components/DatePicker/DatePickerPopover/DatePickerPopover.js +4 -2
- package/node/components/DatePicker/DatePickerPopover/useLogic/index.d.ts +1 -0
- package/node/components/DatePicker/DatePickerPopover/useLogic/index.js +17 -0
- package/node/components/DatePicker/DatePickerPopover/useLogic/useLogic.d.ts +9 -0
- package/node/components/DatePicker/DatePickerPopover/useLogic/useLogic.js +13 -0
- package/node/components/DatePicker/DatePickerPopover/useLogic/utils/index.d.ts +1 -0
- package/node/components/DatePicker/DatePickerPopover/useLogic/utils/index.js +17 -0
- package/node/components/DatePicker/DatePickerPopover/useLogic/utils/stopNextMouseDownPropagation/index.d.ts +1 -0
- package/node/components/DatePicker/DatePickerPopover/useLogic/utils/stopNextMouseDownPropagation/index.js +17 -0
- package/node/components/DatePicker/DatePickerPopover/useLogic/utils/stopNextMouseDownPropagation/stopNextMouseDownPropagation.d.ts +4 -0
- package/node/components/DatePicker/DatePickerPopover/useLogic/utils/stopNextMouseDownPropagation/stopNextMouseDownPropagation.js +19 -0
- package/node/components/DatePicker/useLogic/useLogic.d.ts +3 -2
- package/node/components/DatePicker/useLogic/useLogic.js +3 -3
- package/node/components/DateRangePicker/useLogic/useLogic.d.ts +2 -1
- package/node/components/DateRangePicker/useLogic/useLogic.js +2 -2
- package/node/components/NotificationList/Tabs/Tabs.js +1 -2
- package/node/components/Tabs/Tab/styles.js +5 -1
- package/node/components/Tabs/styles.js +11 -2
- package/node/components/constants/index.d.ts +1 -0
- package/node/components/constants/index.js +1 -0
- package/node/components/constants/tabs.d.ts +2 -0
- package/node/components/constants/tabs.js +5 -0
- package/node/components/theme/components/MuiTabs.js +7 -3
- package/package.json +1 -1
- package/components/NotificationList/Tabs/styles.d.ts +0 -3
- package/components/NotificationList/Tabs/styles.js +0 -5
- package/node/components/NotificationList/Tabs/styles.d.ts +0 -3
- package/node/components/NotificationList/Tabs/styles.js +0 -8
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { type PopperProps } from '@mui/material/Popper';
|
|
2
2
|
import { type PropsWithChildren } from 'react';
|
|
3
|
+
import { type CloseEventReason } from '../../types/CloseEventReason';
|
|
3
4
|
import { type WithoutEmotionSpecific } from '../../types/WithoutEmotionSpecific';
|
|
4
5
|
export type DatePickerPopperProps = PropsWithChildren<Omit<WithoutEmotionSpecific<PopperProps>, 'children' | 'disablePortal' | 'transition'> & {
|
|
5
6
|
/**
|
|
6
7
|
* Обработчик закрытия Popper
|
|
7
8
|
*/
|
|
8
|
-
onClose: () => void;
|
|
9
|
+
onClose: (event?: Event, reason?: CloseEventReason) => void;
|
|
9
10
|
}>;
|
|
10
11
|
export declare const DatePickerPopover: ({ children, onMouseEnter, onMouseLeave, onClose, anchorEl, title, open, ...props }: DatePickerPopperProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,13 +5,15 @@ import { usePopoverAnimation } from '../../usePopoverAnimation';
|
|
|
5
5
|
import { useViewportType } from '../../useViewportType';
|
|
6
6
|
import { datePickerClassnames } from '../constants';
|
|
7
7
|
import { AnimatedWrapper, InnerContainer, StyledPopper } from './styles';
|
|
8
|
+
import { useLogic } from './useLogic';
|
|
8
9
|
export const DatePickerPopover = ({ children, onMouseEnter, onMouseLeave, onClose, anchorEl, title, open, ...props }) => {
|
|
9
10
|
const { isMobile } = useViewportType();
|
|
10
11
|
const { shouldRender, handleAnimationEnd } = usePopoverAnimation(open);
|
|
12
|
+
const { handleClickAway, handleDrawerClose } = useLogic({ onClose });
|
|
11
13
|
if (isMobile) {
|
|
12
|
-
return (_jsx(BottomDrawer, { className: datePickerClassnames.popover, title: title, open: open, onClose:
|
|
14
|
+
return (_jsx(BottomDrawer, { className: datePickerClassnames.popover, title: title, open: open, onClose: handleDrawerClose,
|
|
13
15
|
// Отключает простановку фокуса в инпут при закрытии Drawer
|
|
14
16
|
disableRestoreFocus: true, children: children }));
|
|
15
17
|
}
|
|
16
|
-
return (_jsx(StyledPopper, { className: datePickerClassnames.popover, open: shouldRender, anchorEl: anchorEl, ...props, children: _jsx(AnimatedWrapper, { "$isOpen": open, onAnimationEnd: handleAnimationEnd, children: _jsx(ClickAwayListener, { onClickAway:
|
|
18
|
+
return (_jsx(StyledPopper, { className: datePickerClassnames.popover, open: shouldRender, anchorEl: anchorEl, ...props, children: _jsx(AnimatedWrapper, { "$isOpen": open, onAnimationEnd: handleAnimationEnd, children: _jsx(ClickAwayListener, { isActive: open, onClickAway: handleClickAway, children: _jsx(InnerContainer, { onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, className: datePickerClassnames.popoverContainer, children: children }) }) }) }));
|
|
17
19
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useLogic';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useLogic';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type CloseEventReason } from '../../../types/CloseEventReason';
|
|
2
|
+
type UseLogicParams = {
|
|
3
|
+
onClose: (event?: Event, reason?: CloseEventReason) => void;
|
|
4
|
+
};
|
|
5
|
+
export declare const useLogic: ({ onClose }: UseLogicParams) => {
|
|
6
|
+
handleClickAway: (event: PointerEvent, reason: CloseEventReason) => void;
|
|
7
|
+
handleDrawerClose: () => void;
|
|
8
|
+
};
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { stopNextMouseDownPropagation } from './utils';
|
|
2
|
+
export const useLogic = ({ onClose }) => {
|
|
3
|
+
const handleClickAway = (event, reason) => {
|
|
4
|
+
stopNextMouseDownPropagation();
|
|
5
|
+
onClose(event, reason);
|
|
6
|
+
};
|
|
7
|
+
const handleDrawerClose = () => onClose();
|
|
8
|
+
return { handleClickAway, handleDrawerClose };
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './stopNextMouseDownPropagation';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './stopNextMouseDownPropagation';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './stopNextMouseDownPropagation';
|
package/components/DatePicker/DatePickerPopover/useLogic/utils/stopNextMouseDownPropagation/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './stopNextMouseDownPropagation';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Останавливает всплытие следующего mousedown.
|
|
3
|
+
*/
|
|
4
|
+
export const stopNextMouseDownPropagation = () => {
|
|
5
|
+
const stopMouseDown = (event) => {
|
|
6
|
+
event.stopPropagation();
|
|
7
|
+
removeListeners();
|
|
8
|
+
};
|
|
9
|
+
const removeListeners = () => {
|
|
10
|
+
window.removeEventListener('mousedown', stopMouseDown, true);
|
|
11
|
+
window.removeEventListener('pointerdown', removeListeners, true);
|
|
12
|
+
};
|
|
13
|
+
window.addEventListener('mousedown', stopMouseDown, true);
|
|
14
|
+
window.addEventListener('pointerdown', removeListeners, true);
|
|
15
|
+
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { type Ref, type SyntheticEvent } from 'react';
|
|
2
|
+
import { type CloseEventReason } from '../../types/CloseEventReason';
|
|
2
3
|
import { type DatePickerProps } from '../types/props';
|
|
3
4
|
type UseLogicParams = DatePickerProps & {
|
|
4
5
|
forwardedRef: Ref<HTMLDivElement>;
|
|
5
6
|
};
|
|
6
7
|
export declare const useLogic: ({ label, value, maxDate, minDate, mask, onOpen, onClose, onBlur, onChange, forwardedRef, }: UseLogicParams) => {
|
|
7
8
|
handleOpen: (event: SyntheticEvent) => void;
|
|
8
|
-
handleClose: () => void;
|
|
9
|
+
handleClose: (event?: Event, reason?: CloseEventReason) => void;
|
|
9
10
|
confirmButtonProps: {
|
|
10
11
|
onClick: () => void;
|
|
11
12
|
disabled: boolean;
|
|
@@ -22,7 +23,7 @@ export declare const useLogic: ({ label, value, maxDate, minDate, mask, onOpen,
|
|
|
22
23
|
datePickerProps: {
|
|
23
24
|
open: boolean;
|
|
24
25
|
anchorEl: HTMLDivElement | null;
|
|
25
|
-
onClose: () => void;
|
|
26
|
+
onClose: (event?: Event, reason?: CloseEventReason) => void;
|
|
26
27
|
title: string | undefined;
|
|
27
28
|
};
|
|
28
29
|
};
|
|
@@ -41,11 +41,11 @@ export const useLogic = ({ label, value, maxDate = DEFAULT_MAX_DATE, minDate = D
|
|
|
41
41
|
onMaskedValueBlur();
|
|
42
42
|
onBlur?.();
|
|
43
43
|
};
|
|
44
|
-
|
|
44
|
+
const handleClose = (event, reason) => {
|
|
45
45
|
flushMaskedValueAndCallOnBlur();
|
|
46
|
-
onClose?.();
|
|
46
|
+
onClose?.(event, reason);
|
|
47
47
|
close();
|
|
48
|
-
}
|
|
48
|
+
};
|
|
49
49
|
const handleInputBlur = () => {
|
|
50
50
|
if (isOpen) {
|
|
51
51
|
return;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ForwardedRef, type SyntheticEvent } from 'react';
|
|
2
|
+
import { type CloseEventReason } from '../../types/CloseEventReason';
|
|
2
3
|
import { type DateRangePickerProps } from '../types';
|
|
3
4
|
type UseLogicParams = DateRangePickerProps;
|
|
4
5
|
export declare const useLogic: ({ value, minDate, maxDate, mask, onChange, onOpen, onClose, onBlur, }: UseLogicParams, forwardedRef: ForwardedRef<HTMLDivElement>) => {
|
|
@@ -25,7 +26,7 @@ export declare const useLogic: ({ value, minDate, maxDate, mask, onChange, onOpe
|
|
|
25
26
|
anchorEl: HTMLDivElement | null;
|
|
26
27
|
onMouseEnter: () => void;
|
|
27
28
|
onMouseLeave: () => void;
|
|
28
|
-
onClose: () => void;
|
|
29
|
+
onClose: (event?: Event, reason?: CloseEventReason) => void;
|
|
29
30
|
};
|
|
30
31
|
minMaxDateContextProviderProps: {
|
|
31
32
|
minDate: Date;
|
|
@@ -88,10 +88,10 @@ export const useLogic = ({ value, minDate = DEFAULT_MIN_DATE, maxDate = DEFAULT_
|
|
|
88
88
|
onMaskedEndValueBlur();
|
|
89
89
|
}
|
|
90
90
|
};
|
|
91
|
-
const handleClose = () => {
|
|
91
|
+
const handleClose = (event, reason) => {
|
|
92
92
|
flushActiveMaskedValueOnClose();
|
|
93
93
|
onBlur?.();
|
|
94
|
-
onClose?.();
|
|
94
|
+
onClose?.(event, reason);
|
|
95
95
|
close();
|
|
96
96
|
};
|
|
97
97
|
const handleStartInputBlur = () => {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Tab } from '../../Tabs';
|
|
3
|
-
import { StyledTabs } from './styles';
|
|
2
|
+
import { Tabs as AstralUITabs, Tab } from '../../Tabs';
|
|
4
3
|
export const Tabs = ({ listType, notificationsCount, unreadNotificationsCount, onChange, }) => {
|
|
5
4
|
const handleChange = (_, value) => {
|
|
6
5
|
onChange(value);
|
|
7
6
|
};
|
|
8
|
-
return (_jsxs(
|
|
7
|
+
return (_jsxs(AstralUITabs, { value: listType, onChange: handleChange, children: [_jsx(Tab, { value: "unread", label: "\u041D\u0435\u043F\u0440\u043E\u0447\u0438\u0442\u0430\u043D\u043D\u044B\u0435", count: unreadNotificationsCount }), _jsx(Tab, { value: "all", label: "\u0412\u0441\u0435", count: notificationsCount })] }));
|
|
9
8
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import Tab from '@mui/material/Tab';
|
|
2
|
-
import { HOVER_MEDIA } from '../../constants';
|
|
2
|
+
import { HOVER_MEDIA, TABS_HEIGHT, TABS_HEIGHT_MOBILE } from '../../constants';
|
|
3
3
|
import { styled } from '../../styled';
|
|
4
4
|
export const StyledTab = styled(Tab) `
|
|
5
|
-
min-height:
|
|
5
|
+
min-height: ${TABS_HEIGHT};
|
|
6
6
|
padding: 0;
|
|
7
7
|
|
|
8
8
|
line-height: 20px;
|
|
@@ -10,6 +10,10 @@ export const StyledTab = styled(Tab) `
|
|
|
10
10
|
|
|
11
11
|
border: 2px solid transparent;
|
|
12
12
|
|
|
13
|
+
${({ theme }) => theme.breakpoints.down('mobile')} {
|
|
14
|
+
min-height: ${TABS_HEIGHT_MOBILE};
|
|
15
|
+
}
|
|
16
|
+
|
|
13
17
|
&:last-child {
|
|
14
18
|
margin-right: 0;
|
|
15
19
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import MuiTabs, { tabsClasses } from '@mui/material/Tabs';
|
|
2
|
+
import { TABS_HEIGHT, TABS_HEIGHT_MOBILE } from '../constants';
|
|
2
3
|
import { styled } from '../styled';
|
|
3
4
|
export const Container = styled.div `
|
|
4
5
|
overflow-x: auto;
|
|
@@ -20,8 +21,9 @@ export const Container = styled.div `
|
|
|
20
21
|
}
|
|
21
22
|
`;
|
|
22
23
|
export const Divider = styled.div `
|
|
23
|
-
position:
|
|
24
|
-
bottom:
|
|
24
|
+
position: absolute;
|
|
25
|
+
bottom: 0;
|
|
26
|
+
left: 0;
|
|
25
27
|
|
|
26
28
|
width: 100%;
|
|
27
29
|
height: 1px;
|
|
@@ -40,7 +42,14 @@ export const StyledTabs = styled(MuiTabs) `
|
|
|
40
42
|
}
|
|
41
43
|
`;
|
|
42
44
|
export const Wrapper = styled.div `
|
|
45
|
+
position: relative;
|
|
46
|
+
|
|
43
47
|
display: inline-block;
|
|
44
48
|
|
|
45
49
|
min-width: 100%;
|
|
50
|
+
height: ${TABS_HEIGHT};
|
|
51
|
+
|
|
52
|
+
${({ theme }) => theme.breakpoints.down('mobile')} {
|
|
53
|
+
height: ${TABS_HEIGHT_MOBILE};
|
|
54
|
+
}
|
|
46
55
|
`;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
export const MuiTabs = {
|
|
2
2
|
styleOverrides: {
|
|
3
|
-
root() {
|
|
3
|
+
root({ theme }) {
|
|
4
4
|
return {
|
|
5
|
-
minHeight:
|
|
6
|
-
height:
|
|
5
|
+
minHeight: 34,
|
|
6
|
+
height: 34,
|
|
7
|
+
[theme.breakpoints.down('mobile')]: {
|
|
8
|
+
minHeight: 40,
|
|
9
|
+
height: 40,
|
|
10
|
+
},
|
|
7
11
|
};
|
|
8
12
|
},
|
|
9
13
|
indicator({ theme }) {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { type PopperProps } from '@mui/material/Popper';
|
|
2
2
|
import { type PropsWithChildren } from 'react';
|
|
3
|
+
import { type CloseEventReason } from '../../types/CloseEventReason';
|
|
3
4
|
import { type WithoutEmotionSpecific } from '../../types/WithoutEmotionSpecific';
|
|
4
5
|
export type DatePickerPopperProps = PropsWithChildren<Omit<WithoutEmotionSpecific<PopperProps>, 'children' | 'disablePortal' | 'transition'> & {
|
|
5
6
|
/**
|
|
6
7
|
* Обработчик закрытия Popper
|
|
7
8
|
*/
|
|
8
|
-
onClose: () => void;
|
|
9
|
+
onClose: (event?: Event, reason?: CloseEventReason) => void;
|
|
9
10
|
}>;
|
|
10
11
|
export declare const DatePickerPopover: ({ children, onMouseEnter, onMouseLeave, onClose, anchorEl, title, open, ...props }: DatePickerPopperProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -8,14 +8,16 @@ const usePopoverAnimation_1 = require("../../usePopoverAnimation");
|
|
|
8
8
|
const useViewportType_1 = require("../../useViewportType");
|
|
9
9
|
const constants_1 = require("../constants");
|
|
10
10
|
const styles_1 = require("./styles");
|
|
11
|
+
const useLogic_1 = require("./useLogic");
|
|
11
12
|
const DatePickerPopover = ({ children, onMouseEnter, onMouseLeave, onClose, anchorEl, title, open, ...props }) => {
|
|
12
13
|
const { isMobile } = (0, useViewportType_1.useViewportType)();
|
|
13
14
|
const { shouldRender, handleAnimationEnd } = (0, usePopoverAnimation_1.usePopoverAnimation)(open);
|
|
15
|
+
const { handleClickAway, handleDrawerClose } = (0, useLogic_1.useLogic)({ onClose });
|
|
14
16
|
if (isMobile) {
|
|
15
|
-
return ((0, jsx_runtime_1.jsx)(BottomDrawer_1.BottomDrawer, { className: constants_1.datePickerClassnames.popover, title: title, open: open, onClose:
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)(BottomDrawer_1.BottomDrawer, { className: constants_1.datePickerClassnames.popover, title: title, open: open, onClose: handleDrawerClose,
|
|
16
18
|
// Отключает простановку фокуса в инпут при закрытии Drawer
|
|
17
19
|
disableRestoreFocus: true, children: children }));
|
|
18
20
|
}
|
|
19
|
-
return ((0, jsx_runtime_1.jsx)(styles_1.StyledPopper, { className: constants_1.datePickerClassnames.popover, open: shouldRender, anchorEl: anchorEl, ...props, children: (0, jsx_runtime_1.jsx)(styles_1.AnimatedWrapper, { "$isOpen": open, onAnimationEnd: handleAnimationEnd, children: (0, jsx_runtime_1.jsx)(ClickAwayListener_1.ClickAwayListener, { onClickAway:
|
|
21
|
+
return ((0, jsx_runtime_1.jsx)(styles_1.StyledPopper, { className: constants_1.datePickerClassnames.popover, open: shouldRender, anchorEl: anchorEl, ...props, children: (0, jsx_runtime_1.jsx)(styles_1.AnimatedWrapper, { "$isOpen": open, onAnimationEnd: handleAnimationEnd, children: (0, jsx_runtime_1.jsx)(ClickAwayListener_1.ClickAwayListener, { isActive: open, onClickAway: handleClickAway, children: (0, jsx_runtime_1.jsx)(styles_1.InnerContainer, { onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, className: constants_1.datePickerClassnames.popoverContainer, children: children }) }) }) }));
|
|
20
22
|
};
|
|
21
23
|
exports.DatePickerPopover = DatePickerPopover;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useLogic';
|
|
@@ -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("./useLogic"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type CloseEventReason } from '../../../types/CloseEventReason';
|
|
2
|
+
type UseLogicParams = {
|
|
3
|
+
onClose: (event?: Event, reason?: CloseEventReason) => void;
|
|
4
|
+
};
|
|
5
|
+
export declare const useLogic: ({ onClose }: UseLogicParams) => {
|
|
6
|
+
handleClickAway: (event: PointerEvent, reason: CloseEventReason) => void;
|
|
7
|
+
handleDrawerClose: () => void;
|
|
8
|
+
};
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useLogic = void 0;
|
|
4
|
+
const utils_1 = require("./utils");
|
|
5
|
+
const useLogic = ({ onClose }) => {
|
|
6
|
+
const handleClickAway = (event, reason) => {
|
|
7
|
+
(0, utils_1.stopNextMouseDownPropagation)();
|
|
8
|
+
onClose(event, reason);
|
|
9
|
+
};
|
|
10
|
+
const handleDrawerClose = () => onClose();
|
|
11
|
+
return { handleClickAway, handleDrawerClose };
|
|
12
|
+
};
|
|
13
|
+
exports.useLogic = useLogic;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './stopNextMouseDownPropagation';
|
|
@@ -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("./stopNextMouseDownPropagation"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './stopNextMouseDownPropagation';
|
|
@@ -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("./stopNextMouseDownPropagation"), exports);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stopNextMouseDownPropagation = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Останавливает всплытие следующего mousedown.
|
|
6
|
+
*/
|
|
7
|
+
const stopNextMouseDownPropagation = () => {
|
|
8
|
+
const stopMouseDown = (event) => {
|
|
9
|
+
event.stopPropagation();
|
|
10
|
+
removeListeners();
|
|
11
|
+
};
|
|
12
|
+
const removeListeners = () => {
|
|
13
|
+
window.removeEventListener('mousedown', stopMouseDown, true);
|
|
14
|
+
window.removeEventListener('pointerdown', removeListeners, true);
|
|
15
|
+
};
|
|
16
|
+
window.addEventListener('mousedown', stopMouseDown, true);
|
|
17
|
+
window.addEventListener('pointerdown', removeListeners, true);
|
|
18
|
+
};
|
|
19
|
+
exports.stopNextMouseDownPropagation = stopNextMouseDownPropagation;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { type Ref, type SyntheticEvent } from 'react';
|
|
2
|
+
import { type CloseEventReason } from '../../types/CloseEventReason';
|
|
2
3
|
import { type DatePickerProps } from '../types/props';
|
|
3
4
|
type UseLogicParams = DatePickerProps & {
|
|
4
5
|
forwardedRef: Ref<HTMLDivElement>;
|
|
5
6
|
};
|
|
6
7
|
export declare const useLogic: ({ label, value, maxDate, minDate, mask, onOpen, onClose, onBlur, onChange, forwardedRef, }: UseLogicParams) => {
|
|
7
8
|
handleOpen: (event: SyntheticEvent) => void;
|
|
8
|
-
handleClose: () => void;
|
|
9
|
+
handleClose: (event?: Event, reason?: CloseEventReason) => void;
|
|
9
10
|
confirmButtonProps: {
|
|
10
11
|
onClick: () => void;
|
|
11
12
|
disabled: boolean;
|
|
@@ -22,7 +23,7 @@ export declare const useLogic: ({ label, value, maxDate, minDate, mask, onOpen,
|
|
|
22
23
|
datePickerProps: {
|
|
23
24
|
open: boolean;
|
|
24
25
|
anchorEl: HTMLDivElement | null;
|
|
25
|
-
onClose: () => void;
|
|
26
|
+
onClose: (event?: Event, reason?: CloseEventReason) => void;
|
|
26
27
|
title: string | undefined;
|
|
27
28
|
};
|
|
28
29
|
};
|
|
@@ -44,11 +44,11 @@ const useLogic = ({ label, value, maxDate = MinMaxDateContext_1.DEFAULT_MAX_DATE
|
|
|
44
44
|
onMaskedValueBlur();
|
|
45
45
|
onBlur?.();
|
|
46
46
|
};
|
|
47
|
-
|
|
47
|
+
const handleClose = (event, reason) => {
|
|
48
48
|
flushMaskedValueAndCallOnBlur();
|
|
49
|
-
onClose?.();
|
|
49
|
+
onClose?.(event, reason);
|
|
50
50
|
close();
|
|
51
|
-
}
|
|
51
|
+
};
|
|
52
52
|
const handleInputBlur = () => {
|
|
53
53
|
if (isOpen) {
|
|
54
54
|
return;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ForwardedRef, type SyntheticEvent } from 'react';
|
|
2
|
+
import { type CloseEventReason } from '../../types/CloseEventReason';
|
|
2
3
|
import { type DateRangePickerProps } from '../types';
|
|
3
4
|
type UseLogicParams = DateRangePickerProps;
|
|
4
5
|
export declare const useLogic: ({ value, minDate, maxDate, mask, onChange, onOpen, onClose, onBlur, }: UseLogicParams, forwardedRef: ForwardedRef<HTMLDivElement>) => {
|
|
@@ -25,7 +26,7 @@ export declare const useLogic: ({ value, minDate, maxDate, mask, onChange, onOpe
|
|
|
25
26
|
anchorEl: HTMLDivElement | null;
|
|
26
27
|
onMouseEnter: () => void;
|
|
27
28
|
onMouseLeave: () => void;
|
|
28
|
-
onClose: () => void;
|
|
29
|
+
onClose: (event?: Event, reason?: CloseEventReason) => void;
|
|
29
30
|
};
|
|
30
31
|
minMaxDateContextProviderProps: {
|
|
31
32
|
minDate: Date;
|
|
@@ -91,10 +91,10 @@ const useLogic = ({ value, minDate = DatePicker_1.DEFAULT_MIN_DATE, maxDate = Da
|
|
|
91
91
|
onMaskedEndValueBlur();
|
|
92
92
|
}
|
|
93
93
|
};
|
|
94
|
-
const handleClose = () => {
|
|
94
|
+
const handleClose = (event, reason) => {
|
|
95
95
|
flushActiveMaskedValueOnClose();
|
|
96
96
|
onBlur?.();
|
|
97
|
-
onClose?.();
|
|
97
|
+
onClose?.(event, reason);
|
|
98
98
|
close();
|
|
99
99
|
};
|
|
100
100
|
const handleStartInputBlur = () => {
|
|
@@ -3,11 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Tabs = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const Tabs_1 = require("../../Tabs");
|
|
6
|
-
const styles_1 = require("./styles");
|
|
7
6
|
const Tabs = ({ listType, notificationsCount, unreadNotificationsCount, onChange, }) => {
|
|
8
7
|
const handleChange = (_, value) => {
|
|
9
8
|
onChange(value);
|
|
10
9
|
};
|
|
11
|
-
return ((0, jsx_runtime_1.jsxs)(
|
|
10
|
+
return ((0, jsx_runtime_1.jsxs)(Tabs_1.Tabs, { value: listType, onChange: handleChange, children: [(0, jsx_runtime_1.jsx)(Tabs_1.Tab, { value: "unread", label: "\u041D\u0435\u043F\u0440\u043E\u0447\u0438\u0442\u0430\u043D\u043D\u044B\u0435", count: unreadNotificationsCount }), (0, jsx_runtime_1.jsx)(Tabs_1.Tab, { value: "all", label: "\u0412\u0441\u0435", count: notificationsCount })] }));
|
|
12
11
|
};
|
|
13
12
|
exports.Tabs = Tabs;
|
|
@@ -8,7 +8,7 @@ const Tab_1 = __importDefault(require("@mui/material/Tab"));
|
|
|
8
8
|
const constants_1 = require("../../constants");
|
|
9
9
|
const styled_1 = require("../../styled");
|
|
10
10
|
exports.StyledTab = (0, styled_1.styled)(Tab_1.default) `
|
|
11
|
-
min-height:
|
|
11
|
+
min-height: ${constants_1.TABS_HEIGHT};
|
|
12
12
|
padding: 0;
|
|
13
13
|
|
|
14
14
|
line-height: 20px;
|
|
@@ -16,6 +16,10 @@ exports.StyledTab = (0, styled_1.styled)(Tab_1.default) `
|
|
|
16
16
|
|
|
17
17
|
border: 2px solid transparent;
|
|
18
18
|
|
|
19
|
+
${({ theme }) => theme.breakpoints.down('mobile')} {
|
|
20
|
+
min-height: ${constants_1.TABS_HEIGHT_MOBILE};
|
|
21
|
+
}
|
|
22
|
+
|
|
19
23
|
&:last-child {
|
|
20
24
|
margin-right: 0;
|
|
21
25
|
}
|
|
@@ -25,6 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.Wrapper = exports.StyledTabs = exports.Divider = exports.Container = void 0;
|
|
27
27
|
const Tabs_1 = __importStar(require("@mui/material/Tabs"));
|
|
28
|
+
const constants_1 = require("../constants");
|
|
28
29
|
const styled_1 = require("../styled");
|
|
29
30
|
exports.Container = styled_1.styled.div `
|
|
30
31
|
overflow-x: auto;
|
|
@@ -46,8 +47,9 @@ exports.Container = styled_1.styled.div `
|
|
|
46
47
|
}
|
|
47
48
|
`;
|
|
48
49
|
exports.Divider = styled_1.styled.div `
|
|
49
|
-
position:
|
|
50
|
-
bottom:
|
|
50
|
+
position: absolute;
|
|
51
|
+
bottom: 0;
|
|
52
|
+
left: 0;
|
|
51
53
|
|
|
52
54
|
width: 100%;
|
|
53
55
|
height: 1px;
|
|
@@ -66,7 +68,14 @@ exports.StyledTabs = (0, styled_1.styled)(Tabs_1.default) `
|
|
|
66
68
|
}
|
|
67
69
|
`;
|
|
68
70
|
exports.Wrapper = styled_1.styled.div `
|
|
71
|
+
position: relative;
|
|
72
|
+
|
|
69
73
|
display: inline-block;
|
|
70
74
|
|
|
71
75
|
min-width: 100%;
|
|
76
|
+
height: ${constants_1.TABS_HEIGHT};
|
|
77
|
+
|
|
78
|
+
${({ theme }) => theme.breakpoints.down('mobile')} {
|
|
79
|
+
height: ${constants_1.TABS_HEIGHT_MOBILE};
|
|
80
|
+
}
|
|
72
81
|
`;
|
|
@@ -3,10 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.MuiTabs = void 0;
|
|
4
4
|
exports.MuiTabs = {
|
|
5
5
|
styleOverrides: {
|
|
6
|
-
root() {
|
|
6
|
+
root({ theme }) {
|
|
7
7
|
return {
|
|
8
|
-
minHeight:
|
|
9
|
-
height:
|
|
8
|
+
minHeight: 34,
|
|
9
|
+
height: 34,
|
|
10
|
+
[theme.breakpoints.down('mobile')]: {
|
|
11
|
+
minHeight: 40,
|
|
12
|
+
height: 40,
|
|
13
|
+
},
|
|
10
14
|
};
|
|
11
15
|
},
|
|
12
16
|
indicator({ theme }) {
|
package/package.json
CHANGED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StyledTabs = void 0;
|
|
4
|
-
const styled_1 = require("../../styled");
|
|
5
|
-
const Tabs_1 = require("../../Tabs");
|
|
6
|
-
exports.StyledTabs = (0, styled_1.styled)(Tabs_1.Tabs) `
|
|
7
|
-
min-height: 36px;
|
|
8
|
-
`;
|