@astral/ui 4.42.1 → 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.
@@ -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
  };
@@ -1,5 +1,6 @@
1
1
  export declare const OFFSET_TOP_SCREEN = "16px";
2
2
  export declare const DEFAULT_HEADER_HEIGHT = 56;
3
3
  export declare const bottomDrawerClassnames: {
4
+ header: string;
4
5
  content: string;
5
6
  };
@@ -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
  };
@@ -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 { StyledDrawer } from './styles';
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
  };
@@ -0,0 +1,3 @@
1
+ export declare const sideDialogHeaderClassnames: {
2
+ root: string;
3
+ };
@@ -0,0 +1,4 @@
1
+ import { createUIKitClassname } from '../utils/createUIKitClassname';
2
+ export const sideDialogHeaderClassnames = {
3
+ root: createUIKitClassname('side-dialog__header'),
4
+ };
@@ -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;
@@ -1,5 +1,6 @@
1
1
  export declare const OFFSET_TOP_SCREEN = "16px";
2
2
  export declare const DEFAULT_HEADER_HEIGHT = 56;
3
3
  export declare const bottomDrawerClassnames: {
4
+ header: string;
4
5
  content: string;
5
6
  };
@@ -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
  };
@@ -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 constants_1 = require("./constants");
33
+ const constants_2 = require("./constants");
32
34
  const getSize = (size) => {
33
- return constants_1.SIZES[size] || constants_1.SIZES.sm;
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% - ${constants_1.SIDE_DIALOG_SCREEN_OFFSET});
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,3 @@
1
+ export declare const sideDialogHeaderClassnames: {
2
+ root: string;
3
+ };
@@ -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
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astral/ui",
3
- "version": "4.42.1",
3
+ "version": "4.43.0",
4
4
  "browser": "./index.js",
5
5
  "main": "./node/index.js",
6
6
  "dependencies": {