@astral/ui 4.42.0 → 4.43.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 +1 -1
- package/components/BottomDrawer/constants.d.ts +1 -0
- package/components/BottomDrawer/constants.js +1 -0
- package/components/DatePicker/hooks/useMaskedValue/useMaskedValue.d.ts +1 -1
- package/components/DatePicker/hooks/useMaskedValue/useMaskedValue.js +5 -4
- package/components/DateRangePicker/useLogic/useLogic.js +17 -5
- package/components/DateRangePicker/useLogic/utils/index.d.ts +1 -0
- package/components/DateRangePicker/useLogic/utils/index.js +1 -0
- package/components/DateRangePicker/useLogic/utils/isMaskedDateSyntacticallyComplete/index.d.ts +1 -0
- package/components/DateRangePicker/useLogic/utils/isMaskedDateSyntacticallyComplete/index.js +1 -0
- package/components/DateRangePicker/useLogic/utils/isMaskedDateSyntacticallyComplete/isMaskedDateSyntacticallyComplete.d.ts +5 -0
- package/components/DateRangePicker/useLogic/utils/isMaskedDateSyntacticallyComplete/isMaskedDateSyntacticallyComplete.js +17 -0
- package/components/SideDialog/SideDialog.js +6 -1
- package/components/SideDialog/styles.d.ts +8 -0
- package/components/SideDialog/styles.js +13 -0
- package/components/SideDialogActions/styles.js +7 -0
- package/components/SideDialogHeader/SideDialogHeader.js +2 -1
- package/components/SideDialogHeader/constants.d.ts +3 -0
- package/components/SideDialogHeader/constants.js +4 -0
- package/components/SideDialogHeader/styles.js +8 -0
- package/node/components/BottomDrawer/BottomDrawer.js +1 -1
- package/node/components/BottomDrawer/constants.d.ts +1 -0
- package/node/components/BottomDrawer/constants.js +1 -0
- package/node/components/DatePicker/hooks/useMaskedValue/useMaskedValue.d.ts +1 -1
- package/node/components/DatePicker/hooks/useMaskedValue/useMaskedValue.js +5 -4
- package/node/components/DateRangePicker/useLogic/useLogic.js +16 -4
- package/node/components/DateRangePicker/useLogic/utils/index.d.ts +1 -0
- package/node/components/DateRangePicker/useLogic/utils/index.js +1 -0
- package/node/components/DateRangePicker/useLogic/utils/isMaskedDateSyntacticallyComplete/index.d.ts +1 -0
- package/node/components/DateRangePicker/useLogic/utils/isMaskedDateSyntacticallyComplete/index.js +17 -0
- package/node/components/DateRangePicker/useLogic/utils/isMaskedDateSyntacticallyComplete/isMaskedDateSyntacticallyComplete.d.ts +5 -0
- package/node/components/DateRangePicker/useLogic/utils/isMaskedDateSyntacticallyComplete/isMaskedDateSyntacticallyComplete.js +21 -0
- package/node/components/SideDialog/SideDialog.js +5 -0
- package/node/components/SideDialog/styles.d.ts +8 -0
- package/node/components/SideDialog/styles.js +17 -4
- package/node/components/SideDialogActions/styles.js +7 -0
- package/node/components/SideDialogHeader/SideDialogHeader.js +2 -1
- package/node/components/SideDialogHeader/constants.d.ts +3 -0
- package/node/components/SideDialogHeader/constants.js +7 -0
- package/node/components/SideDialogHeader/styles.js +8 -0
- package/package.json +1 -1
|
@@ -9,5 +9,5 @@ export const BottomDrawer = ({ title, drawerHeaderHeight = DEFAULT_HEADER_HEIGHT
|
|
|
9
9
|
onClose(event, 'escapeKeyDown');
|
|
10
10
|
}
|
|
11
11
|
};
|
|
12
|
-
return (_jsxs(StyledDrawer, { ...props, anchor: "bottom", onClose: onClose, children: [_jsxs(Header, { drawerHeaderHeight: drawerHeaderHeight, children: [_jsx(HeaderTitle, { variant: "h6", noWrap: true, children: title }), headerContent, _jsx(IconButton, { variant: "text", onClick: handleClose, size: "medium", children: _jsx(CrossOutlineMd, {}) })] }), _jsx(Body, { className: bottomDrawerClassnames.content, children: children })] }));
|
|
12
|
+
return (_jsxs(StyledDrawer, { ...props, anchor: "bottom", onClose: onClose, children: [_jsxs(Header, { drawerHeaderHeight: drawerHeaderHeight, className: bottomDrawerClassnames.header, children: [_jsx(HeaderTitle, { variant: "h6", noWrap: true, children: title }), headerContent, _jsx(IconButton, { variant: "text", onClick: handleClose, size: "medium", children: _jsx(CrossOutlineMd, {}) })] }), _jsx(Body, { className: bottomDrawerClassnames.content, children: children })] }));
|
|
13
13
|
};
|
|
@@ -2,5 +2,6 @@ import { createUIKitClassname } from '../utils/createUIKitClassname';
|
|
|
2
2
|
export const OFFSET_TOP_SCREEN = '16px';
|
|
3
3
|
export const DEFAULT_HEADER_HEIGHT = 56;
|
|
4
4
|
export const bottomDrawerClassnames = {
|
|
5
|
+
header: createUIKitClassname('bottom-drawer__header'),
|
|
5
6
|
content: createUIKitClassname('bottom-drawer__content'),
|
|
6
7
|
};
|
|
@@ -10,15 +10,16 @@ export const useMaskedValue = ({ currentValue, mask, onChangeValue, }) => {
|
|
|
10
10
|
setMaskedValue(value);
|
|
11
11
|
// При отсутствии value указываем null, так как если задать undefined, то отобразится defaultValue при наличии
|
|
12
12
|
if (!value) {
|
|
13
|
-
onChangeValue?.(null);
|
|
13
|
+
onChangeValue?.(null, value);
|
|
14
14
|
}
|
|
15
15
|
else {
|
|
16
|
-
onChangeValue?.(parseDate(value, mask));
|
|
16
|
+
onChangeValue?.(parseDate(value, mask), value);
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
const handleChangeMaskedDate = (date) => {
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
const formatted = formatDate(date, mask);
|
|
21
|
+
setMaskedValue(formatted);
|
|
22
|
+
onChangeValue?.(date, formatted);
|
|
22
23
|
};
|
|
23
24
|
// здесь происходит реакция на изменение value из вне (управляемый компонент)
|
|
24
25
|
useEffect(() => {
|
|
@@ -3,7 +3,7 @@ import { DEFAULT_DATE_MASK, DEFAULT_MAX_DATE, DEFAULT_MIN_DATE, useMaskedValue,
|
|
|
3
3
|
import { useForwardedRef } from '../../useForwardedRef';
|
|
4
4
|
import { usePopover } from '../../usePopover';
|
|
5
5
|
import { useBaseRangeDates } from './hooks';
|
|
6
|
-
import { getBoundaryDate } from './utils';
|
|
6
|
+
import { getBoundaryDate, isMaskedDateSyntacticallyComplete } from './utils';
|
|
7
7
|
export const useLogic = ({ value, minDate = DEFAULT_MIN_DATE, maxDate = DEFAULT_MAX_DATE, mask = DEFAULT_DATE_MASK, onChange, onOpen, onClose, onBlur, }, forwardedRef) => {
|
|
8
8
|
const ref = useForwardedRef(forwardedRef);
|
|
9
9
|
const startInputRef = useRef(null);
|
|
@@ -39,15 +39,27 @@ export const useLogic = ({ value, minDate = DEFAULT_MIN_DATE, maxDate = DEFAULT_
|
|
|
39
39
|
selectedStartDate: selectedStartBaseDate,
|
|
40
40
|
selectedEndDate: selectedEndBaseDate,
|
|
41
41
|
});
|
|
42
|
-
const handleChangeStartDate = (startDateValue) => {
|
|
43
|
-
|
|
42
|
+
const handleChangeStartDate = (startDateValue, startMaskString) => {
|
|
43
|
+
const isStartComplete = startDateValue != null &&
|
|
44
|
+
startMaskString != null &&
|
|
45
|
+
isMaskedDateSyntacticallyComplete(startMaskString, mask);
|
|
46
|
+
if (isStartComplete &&
|
|
47
|
+
value?.end &&
|
|
48
|
+
startDateValue &&
|
|
49
|
+
startDateValue > value.end) {
|
|
44
50
|
onChange?.({ start: startDateValue, end: undefined });
|
|
45
51
|
return;
|
|
46
52
|
}
|
|
47
53
|
onChange?.({ ...value, start: startDateValue });
|
|
48
54
|
};
|
|
49
|
-
const handleChangeEndDate = (endDateValue) => {
|
|
50
|
-
|
|
55
|
+
const handleChangeEndDate = (endDateValue, endMaskString) => {
|
|
56
|
+
const isEndComplete = endDateValue != null &&
|
|
57
|
+
endMaskString != null &&
|
|
58
|
+
isMaskedDateSyntacticallyComplete(endMaskString, mask);
|
|
59
|
+
if (isEndComplete &&
|
|
60
|
+
value?.start &&
|
|
61
|
+
endDateValue &&
|
|
62
|
+
endDateValue < value.start) {
|
|
51
63
|
onChange?.({ start: undefined, end: endDateValue });
|
|
52
64
|
return;
|
|
53
65
|
}
|
package/components/DateRangePicker/useLogic/utils/isMaskedDateSyntacticallyComplete/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './isMaskedDateSyntacticallyComplete';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './isMaskedDateSyntacticallyComplete';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type DateMask } from '../../../../utils/date/format';
|
|
2
|
+
/**
|
|
3
|
+
* Все ли части строки по маске заполнены цифрами полностью (без промежуточных состояний IMask).
|
|
4
|
+
*/
|
|
5
|
+
export declare const isMaskedDateSyntacticallyComplete: (value: string, mask: DateMask, separator?: string) => boolean;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Все ли части строки по маске заполнены цифрами полностью (без промежуточных состояний IMask).
|
|
3
|
+
*/
|
|
4
|
+
export const isMaskedDateSyntacticallyComplete = (value, mask, separator = '.') => {
|
|
5
|
+
if (!value) {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
const maskParts = mask.split(separator);
|
|
9
|
+
const valueParts = value.split(separator);
|
|
10
|
+
if (maskParts.length !== valueParts.length) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
return maskParts.every((maskPart, index) => {
|
|
14
|
+
const part = valueParts[index];
|
|
15
|
+
return (part.length === maskPart.length && part.length > 0 && /^\d+$/.test(part));
|
|
16
|
+
});
|
|
17
|
+
};
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { SideDialogTitle } from '../SideDialogTitle';
|
|
3
|
-
import {
|
|
3
|
+
import { useViewportType } from '../useViewportType';
|
|
4
|
+
import { StyledBottomDrawer, StyledDrawer } from './styles';
|
|
4
5
|
export const SideDialog = ({ children, title, onClose, open, size = 'sm', ...props }) => {
|
|
6
|
+
const { isMobile } = useViewportType();
|
|
7
|
+
if (isMobile) {
|
|
8
|
+
return (_jsx(StyledBottomDrawer, { onClose: onClose, title: title, open: open, ...props, children: children }));
|
|
9
|
+
}
|
|
5
10
|
return (_jsxs(StyledDrawer, { "$size": size, anchor: "right", open: open, onClose: onClose, ...props, children: [title && _jsx(SideDialogTitle, { onClose: onClose, children: title }), children] }));
|
|
6
11
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import type { DrawerProps } from '@mui/material/Drawer';
|
|
2
3
|
import { type WithoutEmotionSpecific } from '../types/WithoutEmotionSpecific';
|
|
3
4
|
type SideDialogSize = 'xs' | 'sm' | 'md' | 'lg';
|
|
@@ -6,4 +7,11 @@ export declare const StyledDrawer: import("../styled").StyledComponent<DrawerPro
|
|
|
6
7
|
} & {
|
|
7
8
|
$size: SideDialogSize;
|
|
8
9
|
} & WithoutEmotionSpecific<DrawerProps>, {}, {}>;
|
|
10
|
+
export declare const StyledBottomDrawer: import("../styled").StyledComponent<{
|
|
11
|
+
title?: string | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>[] | undefined;
|
|
12
|
+
drawerHeaderHeight?: number | undefined;
|
|
13
|
+
headerContent?: import("react").ReactNode;
|
|
14
|
+
} & WithoutEmotionSpecific<Omit<DrawerProps, "title" | "anchor" | "variant">> & {
|
|
15
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
16
|
+
}, {}, {}>;
|
|
9
17
|
export {};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { dialogContentClasses } from '@mui/material/DialogContent';
|
|
2
2
|
import { dialogTitleClasses } from '@mui/material/DialogTitle';
|
|
3
3
|
import Drawer, { drawerClasses } from '@mui/material/Drawer';
|
|
4
|
+
import { BottomDrawer, bottomDrawerClassnames } from '../BottomDrawer';
|
|
5
|
+
import { sideDialogHeaderClassnames } from '../SideDialogHeader/constants';
|
|
4
6
|
import { styled } from '../styled';
|
|
5
7
|
import { SIDE_DIALOG_SCREEN_OFFSET, SIZES } from './constants';
|
|
6
8
|
const getSize = (size) => {
|
|
@@ -31,3 +33,14 @@ export const StyledDrawer = styled(Drawer, {
|
|
|
31
33
|
padding-top: ${({ theme }) => theme.spacing(4)};
|
|
32
34
|
}
|
|
33
35
|
`;
|
|
36
|
+
export const StyledBottomDrawer = styled(BottomDrawer) `
|
|
37
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
38
|
+
/* Причина игнора: Не критично для отображения */
|
|
39
|
+
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
40
|
+
&:has(.${sideDialogHeaderClassnames.root}) {
|
|
41
|
+
& .${bottomDrawerClassnames.header} {
|
|
42
|
+
display: none;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
`;
|
|
@@ -17,4 +17,11 @@ export const StyledDialogActions = styled(DialogActions) `
|
|
|
17
17
|
|
|
18
18
|
border-bottom: 1px solid ${({ theme }) => theme.palette.grey[300]};
|
|
19
19
|
}
|
|
20
|
+
|
|
21
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
22
|
+
position: sticky;
|
|
23
|
+
bottom: 0;
|
|
24
|
+
|
|
25
|
+
background-color: ${({ theme }) => theme.palette.background.paper};
|
|
26
|
+
}
|
|
20
27
|
`;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { sideDialogHeaderClassnames } from './constants';
|
|
2
3
|
import { StyledDialogHeader } from './styles';
|
|
3
4
|
export const SideDialogHeader = (props) => {
|
|
4
|
-
return _jsx(StyledDialogHeader, { ...props });
|
|
5
|
+
return (_jsx(StyledDialogHeader, { className: sideDialogHeaderClassnames.root, ...props }));
|
|
5
6
|
};
|
|
@@ -17,4 +17,12 @@ export const StyledDialogHeader = styled(DialogHeader) `
|
|
|
17
17
|
|
|
18
18
|
border-bottom: 1px solid ${({ theme }) => theme.palette.grey[300]};
|
|
19
19
|
}
|
|
20
|
+
|
|
21
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
22
|
+
position: sticky;
|
|
23
|
+
z-index: +1;
|
|
24
|
+
top: 0;
|
|
25
|
+
|
|
26
|
+
background-color: ${({ theme }) => theme.palette.background.paper};
|
|
27
|
+
}
|
|
20
28
|
`;
|
|
@@ -12,6 +12,6 @@ const BottomDrawer = ({ title, drawerHeaderHeight = constants_1.DEFAULT_HEADER_H
|
|
|
12
12
|
onClose(event, 'escapeKeyDown');
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
|
-
return ((0, jsx_runtime_1.jsxs)(styles_1.StyledDrawer, { ...props, anchor: "bottom", onClose: onClose, children: [(0, jsx_runtime_1.jsxs)(styles_1.Header, { drawerHeaderHeight: drawerHeaderHeight, children: [(0, jsx_runtime_1.jsx)(styles_1.HeaderTitle, { variant: "h6", noWrap: true, children: title }), headerContent, (0, jsx_runtime_1.jsx)(IconButton_1.IconButton, { variant: "text", onClick: handleClose, size: "medium", children: (0, jsx_runtime_1.jsx)(CrossOutlineMd_1.CrossOutlineMd, {}) })] }), (0, jsx_runtime_1.jsx)(styles_1.Body, { className: constants_1.bottomDrawerClassnames.content, children: children })] }));
|
|
15
|
+
return ((0, jsx_runtime_1.jsxs)(styles_1.StyledDrawer, { ...props, anchor: "bottom", onClose: onClose, children: [(0, jsx_runtime_1.jsxs)(styles_1.Header, { drawerHeaderHeight: drawerHeaderHeight, className: constants_1.bottomDrawerClassnames.header, children: [(0, jsx_runtime_1.jsx)(styles_1.HeaderTitle, { variant: "h6", noWrap: true, children: title }), headerContent, (0, jsx_runtime_1.jsx)(IconButton_1.IconButton, { variant: "text", onClick: handleClose, size: "medium", children: (0, jsx_runtime_1.jsx)(CrossOutlineMd_1.CrossOutlineMd, {}) })] }), (0, jsx_runtime_1.jsx)(styles_1.Body, { className: constants_1.bottomDrawerClassnames.content, children: children })] }));
|
|
16
16
|
};
|
|
17
17
|
exports.BottomDrawer = BottomDrawer;
|
|
@@ -5,5 +5,6 @@ const createUIKitClassname_1 = require("../utils/createUIKitClassname");
|
|
|
5
5
|
exports.OFFSET_TOP_SCREEN = '16px';
|
|
6
6
|
exports.DEFAULT_HEADER_HEIGHT = 56;
|
|
7
7
|
exports.bottomDrawerClassnames = {
|
|
8
|
+
header: (0, createUIKitClassname_1.createUIKitClassname)('bottom-drawer__header'),
|
|
8
9
|
content: (0, createUIKitClassname_1.createUIKitClassname)('bottom-drawer__content'),
|
|
9
10
|
};
|
|
@@ -13,15 +13,16 @@ const useMaskedValue = ({ currentValue, mask, onChangeValue, }) => {
|
|
|
13
13
|
setMaskedValue(value);
|
|
14
14
|
// При отсутствии value указываем null, так как если задать undefined, то отобразится defaultValue при наличии
|
|
15
15
|
if (!value) {
|
|
16
|
-
onChangeValue?.(null);
|
|
16
|
+
onChangeValue?.(null, value);
|
|
17
17
|
}
|
|
18
18
|
else {
|
|
19
|
-
onChangeValue?.((0, date_1.parseDate)(value, mask));
|
|
19
|
+
onChangeValue?.((0, date_1.parseDate)(value, mask), value);
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
22
|
const handleChangeMaskedDate = (date) => {
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
const formatted = (0, date_1.formatDate)(date, mask);
|
|
24
|
+
setMaskedValue(formatted);
|
|
25
|
+
onChangeValue?.(date, formatted);
|
|
25
26
|
};
|
|
26
27
|
// здесь происходит реакция на изменение value из вне (управляемый компонент)
|
|
27
28
|
(0, react_1.useEffect)(() => {
|
|
@@ -42,15 +42,27 @@ const useLogic = ({ value, minDate = DatePicker_1.DEFAULT_MIN_DATE, maxDate = Da
|
|
|
42
42
|
selectedStartDate: selectedStartBaseDate,
|
|
43
43
|
selectedEndDate: selectedEndBaseDate,
|
|
44
44
|
});
|
|
45
|
-
const handleChangeStartDate = (startDateValue) => {
|
|
46
|
-
|
|
45
|
+
const handleChangeStartDate = (startDateValue, startMaskString) => {
|
|
46
|
+
const isStartComplete = startDateValue != null &&
|
|
47
|
+
startMaskString != null &&
|
|
48
|
+
(0, utils_1.isMaskedDateSyntacticallyComplete)(startMaskString, mask);
|
|
49
|
+
if (isStartComplete &&
|
|
50
|
+
value?.end &&
|
|
51
|
+
startDateValue &&
|
|
52
|
+
startDateValue > value.end) {
|
|
47
53
|
onChange?.({ start: startDateValue, end: undefined });
|
|
48
54
|
return;
|
|
49
55
|
}
|
|
50
56
|
onChange?.({ ...value, start: startDateValue });
|
|
51
57
|
};
|
|
52
|
-
const handleChangeEndDate = (endDateValue) => {
|
|
53
|
-
|
|
58
|
+
const handleChangeEndDate = (endDateValue, endMaskString) => {
|
|
59
|
+
const isEndComplete = endDateValue != null &&
|
|
60
|
+
endMaskString != null &&
|
|
61
|
+
(0, utils_1.isMaskedDateSyntacticallyComplete)(endMaskString, mask);
|
|
62
|
+
if (isEndComplete &&
|
|
63
|
+
value?.start &&
|
|
64
|
+
endDateValue &&
|
|
65
|
+
endDateValue < value.start) {
|
|
54
66
|
onChange?.({ start: undefined, end: endDateValue });
|
|
55
67
|
return;
|
|
56
68
|
}
|
|
@@ -15,3 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./getBoundaryDate"), exports);
|
|
18
|
+
__exportStar(require("./isMaskedDateSyntacticallyComplete"), exports);
|
package/node/components/DateRangePicker/useLogic/utils/isMaskedDateSyntacticallyComplete/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './isMaskedDateSyntacticallyComplete';
|
package/node/components/DateRangePicker/useLogic/utils/isMaskedDateSyntacticallyComplete/index.js
ADDED
|
@@ -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("./isMaskedDateSyntacticallyComplete"), exports);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type DateMask } from '../../../../utils/date/format';
|
|
2
|
+
/**
|
|
3
|
+
* Все ли части строки по маске заполнены цифрами полностью (без промежуточных состояний IMask).
|
|
4
|
+
*/
|
|
5
|
+
export declare const isMaskedDateSyntacticallyComplete: (value: string, mask: DateMask, separator?: string) => boolean;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isMaskedDateSyntacticallyComplete = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Все ли части строки по маске заполнены цифрами полностью (без промежуточных состояний IMask).
|
|
6
|
+
*/
|
|
7
|
+
const isMaskedDateSyntacticallyComplete = (value, mask, separator = '.') => {
|
|
8
|
+
if (!value) {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
const maskParts = mask.split(separator);
|
|
12
|
+
const valueParts = value.split(separator);
|
|
13
|
+
if (maskParts.length !== valueParts.length) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
return maskParts.every((maskPart, index) => {
|
|
17
|
+
const part = valueParts[index];
|
|
18
|
+
return (part.length === maskPart.length && part.length > 0 && /^\d+$/.test(part));
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
exports.isMaskedDateSyntacticallyComplete = isMaskedDateSyntacticallyComplete;
|
|
@@ -3,8 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SideDialog = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const SideDialogTitle_1 = require("../SideDialogTitle");
|
|
6
|
+
const useViewportType_1 = require("../useViewportType");
|
|
6
7
|
const styles_1 = require("./styles");
|
|
7
8
|
const SideDialog = ({ children, title, onClose, open, size = 'sm', ...props }) => {
|
|
9
|
+
const { isMobile } = (0, useViewportType_1.useViewportType)();
|
|
10
|
+
if (isMobile) {
|
|
11
|
+
return ((0, jsx_runtime_1.jsx)(styles_1.StyledBottomDrawer, { onClose: onClose, title: title, open: open, ...props, children: children }));
|
|
12
|
+
}
|
|
8
13
|
return ((0, jsx_runtime_1.jsxs)(styles_1.StyledDrawer, { "$size": size, anchor: "right", open: open, onClose: onClose, ...props, children: [title && (0, jsx_runtime_1.jsx)(SideDialogTitle_1.SideDialogTitle, { onClose: onClose, children: title }), children] }));
|
|
9
14
|
};
|
|
10
15
|
exports.SideDialog = SideDialog;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import type { DrawerProps } from '@mui/material/Drawer';
|
|
2
3
|
import { type WithoutEmotionSpecific } from '../types/WithoutEmotionSpecific';
|
|
3
4
|
type SideDialogSize = 'xs' | 'sm' | 'md' | 'lg';
|
|
@@ -6,4 +7,11 @@ export declare const StyledDrawer: import("@emotion/styled/dist/declarations/src
|
|
|
6
7
|
} & {
|
|
7
8
|
$size: SideDialogSize;
|
|
8
9
|
} & WithoutEmotionSpecific<DrawerProps>, {}, {}>;
|
|
10
|
+
export declare const StyledBottomDrawer: import("@emotion/styled/dist/declarations/src/types").StyledComponent<{
|
|
11
|
+
title?: string | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>[] | undefined;
|
|
12
|
+
drawerHeaderHeight?: number | undefined;
|
|
13
|
+
headerContent?: import("react").ReactNode;
|
|
14
|
+
} & WithoutEmotionSpecific<Omit<DrawerProps, "title" | "anchor" | "variant">> & {
|
|
15
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
16
|
+
}, {}, {}>;
|
|
9
17
|
export {};
|
|
@@ -23,14 +23,16 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.StyledDrawer = void 0;
|
|
26
|
+
exports.StyledBottomDrawer = exports.StyledDrawer = void 0;
|
|
27
27
|
const DialogContent_1 = require("@mui/material/DialogContent");
|
|
28
28
|
const DialogTitle_1 = require("@mui/material/DialogTitle");
|
|
29
29
|
const Drawer_1 = __importStar(require("@mui/material/Drawer"));
|
|
30
|
+
const BottomDrawer_1 = require("../BottomDrawer");
|
|
31
|
+
const constants_1 = require("../SideDialogHeader/constants");
|
|
30
32
|
const styled_1 = require("../styled");
|
|
31
|
-
const
|
|
33
|
+
const constants_2 = require("./constants");
|
|
32
34
|
const getSize = (size) => {
|
|
33
|
-
return
|
|
35
|
+
return constants_2.SIZES[size] || constants_2.SIZES.sm;
|
|
34
36
|
};
|
|
35
37
|
exports.StyledDrawer = (0, styled_1.styled)(Drawer_1.default, {
|
|
36
38
|
shouldForwardProp: (prop) => !['$size'].includes(prop),
|
|
@@ -46,7 +48,7 @@ exports.StyledDrawer = (0, styled_1.styled)(Drawer_1.default, {
|
|
|
46
48
|
|
|
47
49
|
.${Drawer_1.drawerClasses.paper} {
|
|
48
50
|
width: ${({ $size }) => getSize($size)};
|
|
49
|
-
height: calc(100% - ${
|
|
51
|
+
height: calc(100% - ${constants_2.SIDE_DIALOG_SCREEN_OFFSET});
|
|
50
52
|
margin: ${({ theme }) => theme.spacing(4)};
|
|
51
53
|
|
|
52
54
|
border-radius: calc(${({ theme }) => theme.shape.medium} * 2);
|
|
@@ -57,3 +59,14 @@ exports.StyledDrawer = (0, styled_1.styled)(Drawer_1.default, {
|
|
|
57
59
|
padding-top: ${({ theme }) => theme.spacing(4)};
|
|
58
60
|
}
|
|
59
61
|
`;
|
|
62
|
+
exports.StyledBottomDrawer = (0, styled_1.styled)(BottomDrawer_1.BottomDrawer) `
|
|
63
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
64
|
+
/* Причина игнора: Не критично для отображения */
|
|
65
|
+
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
66
|
+
&:has(.${constants_1.sideDialogHeaderClassnames.root}) {
|
|
67
|
+
& .${BottomDrawer_1.bottomDrawerClassnames.header} {
|
|
68
|
+
display: none;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
`;
|
|
@@ -20,4 +20,11 @@ exports.StyledDialogActions = (0, styled_1.styled)(DialogActions_1.DialogActions
|
|
|
20
20
|
|
|
21
21
|
border-bottom: 1px solid ${({ theme }) => theme.palette.grey[300]};
|
|
22
22
|
}
|
|
23
|
+
|
|
24
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
25
|
+
position: sticky;
|
|
26
|
+
bottom: 0;
|
|
27
|
+
|
|
28
|
+
background-color: ${({ theme }) => theme.palette.background.paper};
|
|
29
|
+
}
|
|
23
30
|
`;
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SideDialogHeader = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const constants_1 = require("./constants");
|
|
5
6
|
const styles_1 = require("./styles");
|
|
6
7
|
const SideDialogHeader = (props) => {
|
|
7
|
-
return (0, jsx_runtime_1.jsx)(styles_1.StyledDialogHeader, { ...props });
|
|
8
|
+
return ((0, jsx_runtime_1.jsx)(styles_1.StyledDialogHeader, { className: constants_1.sideDialogHeaderClassnames.root, ...props }));
|
|
8
9
|
};
|
|
9
10
|
exports.SideDialogHeader = SideDialogHeader;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sideDialogHeaderClassnames = void 0;
|
|
4
|
+
const createUIKitClassname_1 = require("../utils/createUIKitClassname");
|
|
5
|
+
exports.sideDialogHeaderClassnames = {
|
|
6
|
+
root: (0, createUIKitClassname_1.createUIKitClassname)('side-dialog__header'),
|
|
7
|
+
};
|
|
@@ -20,4 +20,12 @@ exports.StyledDialogHeader = (0, styled_1.styled)(DialogHeader_1.DialogHeader) `
|
|
|
20
20
|
|
|
21
21
|
border-bottom: 1px solid ${({ theme }) => theme.palette.grey[300]};
|
|
22
22
|
}
|
|
23
|
+
|
|
24
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
25
|
+
position: sticky;
|
|
26
|
+
z-index: +1;
|
|
27
|
+
top: 0;
|
|
28
|
+
|
|
29
|
+
background-color: ${({ theme }) => theme.palette.background.paper};
|
|
30
|
+
}
|
|
23
31
|
`;
|