@snack-uikit/drawer 0.7.3-preview-47f53a8c.0 → 0.7.3
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/CHANGELOG.md +9 -0
- package/README.md +3 -3
- package/dist/components/Drawer/Drawer.d.ts +3 -3
- package/dist/components/Drawer/Drawer.js +1 -1
- package/dist/helperComponents/Body/Body.js +1 -1
- package/package.json +3 -3
- package/src/components/Drawer/Drawer.tsx +6 -16
- package/src/helperComponents/Body/Body.tsx +1 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,15 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 0.7.3 (2024-06-11)
|
|
7
|
+
|
|
8
|
+
### Only dependencies have been changed
|
|
9
|
+
* [@snack-uikit/button@0.17.2](https://github.com/cloud-ru-tech/snack-uikit/blob/master/packages/button/CHANGELOG.md)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
6
15
|
## 0.7.2 (2024-05-31)
|
|
7
16
|
|
|
8
17
|
### Only dependencies have been changed
|
package/README.md
CHANGED
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
| image | `{ src: string; alt: string; }` | - | Изображение |
|
|
43
43
|
| subtitle | `string` | - | Подзаголовок |
|
|
44
44
|
| size | enum Size: `"s"`, `"m"`, `"l"` | - | Размер |
|
|
45
|
-
| approveButton | `Omit<ButtonFilledProps, "size"> & { tooltip?: TooltipProps; }` | - | Основная кнопка |
|
|
46
|
-
| cancelButton | `Omit<ButtonOutlineProps, "size"> & { tooltip?: TooltipProps; }` | - | Кнопка отмены |
|
|
47
|
-
| additionalButton | `Omit<ButtonSimpleProps, "size"> & { tooltip?: TooltipProps; }` | - | Дополнительная кнопка |
|
|
45
|
+
| approveButton | `Omit<ButtonFilledProps, "data-test-id" \| "size"> & { tooltip?: TooltipProps; }` | - | Основная кнопка |
|
|
46
|
+
| cancelButton | `Omit<ButtonOutlineProps, "data-test-id" \| "size"> & { tooltip?: TooltipProps; }` | - | Кнопка отмены |
|
|
47
|
+
| additionalButton | `Omit<ButtonSimpleProps, "data-test-id" \| "size"> & { tooltip?: TooltipProps; }` | - | Дополнительная кнопка |
|
|
48
48
|
| nestedDrawer | `ReactElement<DrawerProps, string \| JSXElementConstructor<any>>` | - | Вложенный Drawer |
|
|
49
49
|
|
|
50
50
|
|
|
@@ -12,15 +12,15 @@ export type DrawerProps = Omit<DrawerCustomProps, 'size' | 'children' | 'nestedD
|
|
|
12
12
|
/** Размер */
|
|
13
13
|
size?: Size;
|
|
14
14
|
/** Основная кнопка */
|
|
15
|
-
approveButton?: Omit<ButtonFilledProps, 'size'> & {
|
|
15
|
+
approveButton?: Omit<ButtonFilledProps, 'size' | 'data-test-id'> & {
|
|
16
16
|
tooltip?: TooltipProps;
|
|
17
17
|
};
|
|
18
18
|
/** Кнопка отмены */
|
|
19
|
-
cancelButton?: Omit<ButtonOutlineProps, 'size'> & {
|
|
19
|
+
cancelButton?: Omit<ButtonOutlineProps, 'size' | 'data-test-id'> & {
|
|
20
20
|
tooltip?: TooltipProps;
|
|
21
21
|
};
|
|
22
22
|
/** Дополнительная кнопка */
|
|
23
|
-
additionalButton?: Omit<ButtonSimpleProps, 'size'> & {
|
|
23
|
+
additionalButton?: Omit<ButtonSimpleProps, 'size' | 'data-test-id'> & {
|
|
24
24
|
tooltip?: TooltipProps;
|
|
25
25
|
};
|
|
26
26
|
/** Вложенный Drawer */
|
|
@@ -19,5 +19,5 @@ import { DrawerCustom } from '../DrawerCustom';
|
|
|
19
19
|
export function Drawer(_a) {
|
|
20
20
|
var { title, titleTooltip, subtitle, image, content, approveButton, cancelButton, additionalButton, nestedDrawer } = _a, rest = __rest(_a, ["title", "titleTooltip", "subtitle", "image", "content", "approveButton", "cancelButton", "additionalButton", "nestedDrawer"]);
|
|
21
21
|
const needFooter = Boolean(approveButton) || Boolean(cancelButton) || Boolean(additionalButton);
|
|
22
|
-
return (_jsxs(DrawerCustom, Object.assign({}, rest, { push: Boolean(nestedDrawer) && { distance: NESTED_DRAWER_PUSH_DISTANCE }, children: [_jsx(DrawerCustom.Header, { title: _jsx(TruncateString, { text: title }), titleTooltip: titleTooltip, subtitle: subtitle, image: image, "data-test-id": TEST_IDS.header }), _jsx(DrawerCustom.Body, { content: content, "data-test-id": TEST_IDS.content }), needFooter && (_jsx(DrawerCustom.Footer, { "data-test-id": TEST_IDS.footer, actions: _jsxs(_Fragment, { children: [approveButton && (_jsx(WithTooltip, { tooltip: approveButton.tooltip, children: _jsx(ButtonFilled, Object.assign({
|
|
22
|
+
return (_jsxs(DrawerCustom, Object.assign({}, rest, { push: Boolean(nestedDrawer) && { distance: NESTED_DRAWER_PUSH_DISTANCE }, children: [_jsx(DrawerCustom.Header, { title: _jsx(TruncateString, { text: title }), titleTooltip: titleTooltip, subtitle: subtitle, image: image, "data-test-id": TEST_IDS.header }), _jsx(DrawerCustom.Body, { content: content, "data-test-id": TEST_IDS.content }), needFooter && (_jsx(DrawerCustom.Footer, { "data-test-id": TEST_IDS.footer, actions: _jsxs(_Fragment, { children: [approveButton && (_jsx(WithTooltip, { tooltip: approveButton.tooltip, children: _jsx(ButtonFilled, Object.assign({}, approveButton, { size: 'm', "data-test-id": TEST_IDS.approveButton })) })), cancelButton && (_jsx(WithTooltip, { tooltip: cancelButton.tooltip, children: _jsx(ButtonOutline, Object.assign({}, cancelButton, { size: 'm', "data-test-id": TEST_IDS.cancelButton })) })), additionalButton && (_jsx(WithTooltip, { tooltip: additionalButton.tooltip, children: _jsx(ButtonSimple, Object.assign({}, additionalButton, { size: 'm', "data-test-id": TEST_IDS.additionalButton })) }))] }) })), nestedDrawer] })));
|
|
23
23
|
}
|
|
@@ -17,5 +17,5 @@ import styles from './styles.module.css';
|
|
|
17
17
|
/** Вспомогательный компонент для добавления "тела" в DrawerCustom */
|
|
18
18
|
export function DrawerBody(_a) {
|
|
19
19
|
var { content, className } = _a, rest = __rest(_a, ["content", "className"]);
|
|
20
|
-
return (_jsx(Scroll, Object.assign({ size: 'm',
|
|
20
|
+
return (_jsx(Scroll, Object.assign({ size: 'm', className: cn(styles.drawerBody, className) }, extractSupportProps(rest), { children: content })));
|
|
21
21
|
}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"title": "Drawer",
|
|
7
|
-
"version": "0.7.3
|
|
7
|
+
"version": "0.7.3",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"*.css",
|
|
10
10
|
"*.woff",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"license": "Apache-2.0",
|
|
33
33
|
"scripts": {},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@snack-uikit/button": "0.17.
|
|
35
|
+
"@snack-uikit/button": "0.17.2",
|
|
36
36
|
"@snack-uikit/icons": "0.21.0",
|
|
37
37
|
"@snack-uikit/scroll": "0.6.0",
|
|
38
38
|
"@snack-uikit/tooltip": "0.13.4",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"classnames": "2.3.2",
|
|
43
43
|
"rc-drawer": "6.4.1"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "d19da5dedbb93af1e6d86330b6f2590ef117a7c9"
|
|
46
46
|
}
|
|
@@ -27,11 +27,11 @@ export type DrawerProps = Omit<DrawerCustomProps, 'size' | 'children' | 'nestedD
|
|
|
27
27
|
/** Размер */
|
|
28
28
|
size?: Size;
|
|
29
29
|
/** Основная кнопка */
|
|
30
|
-
approveButton?: Omit<ButtonFilledProps, 'size'> & { tooltip?: TooltipProps };
|
|
30
|
+
approveButton?: Omit<ButtonFilledProps, 'size' | 'data-test-id'> & { tooltip?: TooltipProps };
|
|
31
31
|
/** Кнопка отмены */
|
|
32
|
-
cancelButton?: Omit<ButtonOutlineProps, 'size'> & { tooltip?: TooltipProps };
|
|
32
|
+
cancelButton?: Omit<ButtonOutlineProps, 'size' | 'data-test-id'> & { tooltip?: TooltipProps };
|
|
33
33
|
/** Дополнительная кнопка */
|
|
34
|
-
additionalButton?: Omit<ButtonSimpleProps, 'size'> & { tooltip?: TooltipProps };
|
|
34
|
+
additionalButton?: Omit<ButtonSimpleProps, 'size' | 'data-test-id'> & { tooltip?: TooltipProps };
|
|
35
35
|
/** Вложенный Drawer */
|
|
36
36
|
nestedDrawer?: ReactElement<DrawerProps>;
|
|
37
37
|
};
|
|
@@ -70,29 +70,19 @@ export function Drawer({
|
|
|
70
70
|
<>
|
|
71
71
|
{approveButton && (
|
|
72
72
|
<WithTooltip tooltip={approveButton.tooltip}>
|
|
73
|
-
<ButtonFilled
|
|
74
|
-
appearance='primary'
|
|
75
|
-
size='m'
|
|
76
|
-
data-test-id={TEST_IDS.approveButton}
|
|
77
|
-
{...approveButton}
|
|
78
|
-
/>
|
|
73
|
+
<ButtonFilled {...approveButton} size='m' data-test-id={TEST_IDS.approveButton} />
|
|
79
74
|
</WithTooltip>
|
|
80
75
|
)}
|
|
81
76
|
|
|
82
77
|
{cancelButton && (
|
|
83
78
|
<WithTooltip tooltip={cancelButton.tooltip}>
|
|
84
|
-
<ButtonOutline
|
|
79
|
+
<ButtonOutline {...cancelButton} size='m' data-test-id={TEST_IDS.cancelButton} />
|
|
85
80
|
</WithTooltip>
|
|
86
81
|
)}
|
|
87
82
|
|
|
88
83
|
{additionalButton && (
|
|
89
84
|
<WithTooltip tooltip={additionalButton.tooltip}>
|
|
90
|
-
<ButtonSimple
|
|
91
|
-
appearance='neutral'
|
|
92
|
-
size='m'
|
|
93
|
-
data-test-id={TEST_IDS.additionalButton}
|
|
94
|
-
{...additionalButton}
|
|
95
|
-
/>
|
|
85
|
+
<ButtonSimple {...additionalButton} size='m' data-test-id={TEST_IDS.additionalButton} />
|
|
96
86
|
</WithTooltip>
|
|
97
87
|
)}
|
|
98
88
|
</>
|
|
@@ -16,12 +16,7 @@ export type DrawerBodyProps = WithSupportProps<{
|
|
|
16
16
|
/** Вспомогательный компонент для добавления "тела" в DrawerCustom */
|
|
17
17
|
export function DrawerBody({ content, className, ...rest }: DrawerBodyProps) {
|
|
18
18
|
return (
|
|
19
|
-
<Scroll
|
|
20
|
-
size='m'
|
|
21
|
-
barHideStrategy='never'
|
|
22
|
-
className={cn(styles.drawerBody, className)}
|
|
23
|
-
{...extractSupportProps(rest)}
|
|
24
|
-
>
|
|
19
|
+
<Scroll size='m' className={cn(styles.drawerBody, className)} {...extractSupportProps(rest)}>
|
|
25
20
|
{content}
|
|
26
21
|
</Scroll>
|
|
27
22
|
);
|