@snack-uikit/drawer 0.12.0 → 0.12.1-preview-09106514.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/README.md
CHANGED
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
| push | `boolean \| PushConfig` | - | Смещение при открытии "вложенного" компонента |
|
|
24
24
|
| container | `string \| HTMLElement` | - | Контейнер в котором будет рендерится Drawer. По-умолчанию - body |
|
|
25
25
|
| nestedDrawer | `ReactElement<DrawerCustomProps, string \| JSXElementConstructor<any>>` | - | Вложенный Drawer |
|
|
26
|
+
| closeOnPopstate | `boolean` | - | Закрывать дровер при перемещении по истории браузера |
|
|
26
27
|
## DrawerCustom.Header
|
|
27
28
|
### Props
|
|
28
29
|
| name | type | default value | description |
|
|
@@ -58,6 +59,7 @@
|
|
|
58
59
|
| className | `string` | - | CSS-класс для элемента с контентом |
|
|
59
60
|
| rootClassName | `string` | - | CSS-класс для корневого элемента |
|
|
60
61
|
| container | `string \| HTMLElement` | - | Контейнер в котором будет рендерится Drawer. По-умолчанию - body |
|
|
62
|
+
| closeOnPopstate | `boolean` | - | Закрывать дровер при перемещении по истории браузера |
|
|
61
63
|
| image | `{ src: string; alt: string; }` | - | Изображение |
|
|
62
64
|
| titleTooltip | `ReactNode` | - | Тултип для заголовка |
|
|
63
65
|
| subtitle | `string` | - | Подзаголовок |
|
|
@@ -44,7 +44,9 @@ function DrawerCustom(_a) {
|
|
|
44
44
|
rest = __rest(_a, ["open", "mode", "position", "onClose", "rootClassName", "className", "size", "push", "container", "children", "nestedDrawer", "closeOnPopstate"]);
|
|
45
45
|
const isRegular = mode === constants_1.MODE.Regular;
|
|
46
46
|
const isPredefinedSize = typeof size === 'string' && constants_1.SIZE_AS_VALUES.includes(size);
|
|
47
|
-
(0, utils_1.
|
|
47
|
+
(0, utils_1.useModalOpenState)(open, onClose, {
|
|
48
|
+
closeOnPopstate
|
|
49
|
+
});
|
|
48
50
|
return (0, jsx_runtime_1.jsxs)(rc_drawer_1.default, Object.assign({
|
|
49
51
|
mask: isRegular,
|
|
50
52
|
maskClosable: isRegular,
|
|
@@ -13,7 +13,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
13
13
|
import 'rc-drawer/assets/index.css';
|
|
14
14
|
import cn from 'classnames';
|
|
15
15
|
import RcDrawer from 'rc-drawer';
|
|
16
|
-
import { extractSupportProps,
|
|
16
|
+
import { extractSupportProps, useModalOpenState } from '@snack-uikit/utils';
|
|
17
17
|
import { MODE, POSITION, SIZE, SIZE_AS_VALUES } from '../../constants';
|
|
18
18
|
import { ButtonClose, DrawerBody, DrawerFooter, DrawerHeader, } from '../../helperComponents';
|
|
19
19
|
import { motionProps } from './constants';
|
|
@@ -22,7 +22,7 @@ export function DrawerCustom(_a) {
|
|
|
22
22
|
var { open, mode = MODE.Regular, position = POSITION.Right, onClose, rootClassName, className, size = SIZE.S, push, container, children, nestedDrawer, closeOnPopstate } = _a, rest = __rest(_a, ["open", "mode", "position", "onClose", "rootClassName", "className", "size", "push", "container", "children", "nestedDrawer", "closeOnPopstate"]);
|
|
23
23
|
const isRegular = mode === MODE.Regular;
|
|
24
24
|
const isPredefinedSize = typeof size === 'string' && SIZE_AS_VALUES.includes(size);
|
|
25
|
-
|
|
25
|
+
useModalOpenState(open, onClose, { closeOnPopstate });
|
|
26
26
|
return (_jsxs(RcDrawer, Object.assign({ mask: isRegular, maskClosable: isRegular, maskClassName: styles.mask, keyboard: isRegular, width: isPredefinedSize ? 'null' : size, open: open, placement: position, destroyOnClose: true, push: push, onClose: onClose, getContainer: container, className: cn(styles.drawer, className), rootClassName: cn(styles.drawerRoot, rootClassName) }, extractSupportProps(rest), { "data-content-wrapper": true, "data-size": isPredefinedSize ? size : undefined, "data-mode": mode }, motionProps, { children: [_jsx("div", { className: styles.headerElements, children: _jsx(ButtonClose, { onClick: onClose }) }), children, nestedDrawer] })));
|
|
27
27
|
}
|
|
28
28
|
(function (DrawerCustom) {
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"title": "Drawer",
|
|
7
|
-
"version": "0.12.0",
|
|
7
|
+
"version": "0.12.1-preview-09106514.0",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"*.css",
|
|
10
10
|
"*.woff",
|
|
@@ -36,15 +36,15 @@
|
|
|
36
36
|
"license": "Apache-2.0",
|
|
37
37
|
"scripts": {},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@snack-uikit/button": "0.19.
|
|
40
|
-
"@snack-uikit/icons": "0.27.
|
|
41
|
-
"@snack-uikit/scroll": "0.10.
|
|
42
|
-
"@snack-uikit/tooltip": "0.18.0",
|
|
43
|
-
"@snack-uikit/truncate-string": "0.6.
|
|
44
|
-
"@snack-uikit/typography": "0.8.
|
|
45
|
-
"@snack-uikit/utils": "3.9.0",
|
|
39
|
+
"@snack-uikit/button": "0.19.13-preview-09106514.0",
|
|
40
|
+
"@snack-uikit/icons": "0.27.2-preview-09106514.0",
|
|
41
|
+
"@snack-uikit/scroll": "0.10.3-preview-09106514.0",
|
|
42
|
+
"@snack-uikit/tooltip": "0.18.1-preview-09106514.0",
|
|
43
|
+
"@snack-uikit/truncate-string": "0.6.24-preview-09106514.0",
|
|
44
|
+
"@snack-uikit/typography": "0.8.9-preview-09106514.0",
|
|
45
|
+
"@snack-uikit/utils": "3.9.1-preview-09106514.0",
|
|
46
46
|
"classnames": "2.5.1",
|
|
47
47
|
"rc-drawer": "6.4.1"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "46d1e0103764bd1f5a509559a0c3f169d66151f7"
|
|
50
50
|
}
|
|
@@ -4,7 +4,7 @@ import cn from 'classnames';
|
|
|
4
4
|
import RcDrawer, { DrawerProps as RcDrawerProps } from 'rc-drawer';
|
|
5
5
|
import { PropsWithChildren, ReactElement } from 'react';
|
|
6
6
|
|
|
7
|
-
import { extractSupportProps,
|
|
7
|
+
import { extractSupportProps, useModalOpenState, WithSupportProps } from '@snack-uikit/utils';
|
|
8
8
|
|
|
9
9
|
import { MODE, POSITION, SIZE, SIZE_AS_VALUES } from '../../constants';
|
|
10
10
|
import {
|
|
@@ -65,7 +65,7 @@ export function DrawerCustom({
|
|
|
65
65
|
const isRegular = mode === MODE.Regular;
|
|
66
66
|
const isPredefinedSize = typeof size === 'string' && SIZE_AS_VALUES.includes(size);
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
useModalOpenState(open, onClose, { closeOnPopstate });
|
|
69
69
|
|
|
70
70
|
return (
|
|
71
71
|
<RcDrawer
|