@snack-uikit/drawer 0.7.2 → 0.7.3-preview-47f53a8c.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
|
@@ -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, "
|
|
46
|
-
| cancelButton | `Omit<ButtonOutlineProps, "
|
|
47
|
-
| additionalButton | `Omit<ButtonSimpleProps, "
|
|
45
|
+
| approveButton | `Omit<ButtonFilledProps, "size"> & { tooltip?: TooltipProps; }` | - | Основная кнопка |
|
|
46
|
+
| cancelButton | `Omit<ButtonOutlineProps, "size"> & { tooltip?: TooltipProps; }` | - | Кнопка отмены |
|
|
47
|
+
| additionalButton | `Omit<ButtonSimpleProps, "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'> & {
|
|
16
16
|
tooltip?: TooltipProps;
|
|
17
17
|
};
|
|
18
18
|
/** Кнопка отмены */
|
|
19
|
-
cancelButton?: Omit<ButtonOutlineProps, 'size'
|
|
19
|
+
cancelButton?: Omit<ButtonOutlineProps, 'size'> & {
|
|
20
20
|
tooltip?: TooltipProps;
|
|
21
21
|
};
|
|
22
22
|
/** Дополнительная кнопка */
|
|
23
|
-
additionalButton?: Omit<ButtonSimpleProps, 'size'
|
|
23
|
+
additionalButton?: Omit<ButtonSimpleProps, 'size'> & {
|
|
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({ appearance: 'primary', size: 'm', "data-test-id": TEST_IDS.approveButton }, approveButton)) })), cancelButton && (_jsx(WithTooltip, { tooltip: cancelButton.tooltip, children: _jsx(ButtonOutline, Object.assign({ appearance: 'neutral', size: 'm', "data-test-id": TEST_IDS.cancelButton }, cancelButton)) })), additionalButton && (_jsx(WithTooltip, { tooltip: additionalButton.tooltip, children: _jsx(ButtonSimple, Object.assign({ appearance: 'neutral', size: 'm', "data-test-id": TEST_IDS.additionalButton }, 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', className: cn(styles.drawerBody, className) }, extractSupportProps(rest), { children: content })));
|
|
20
|
+
return (_jsx(Scroll, Object.assign({ size: 'm', barHideStrategy: 'never', 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.
|
|
7
|
+
"version": "0.7.3-preview-47f53a8c.0",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"*.css",
|
|
10
10
|
"*.woff",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"classnames": "2.3.2",
|
|
43
43
|
"rc-drawer": "6.4.1"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "723f99961ed1419c6740e0c7d3b2c4728e816886"
|
|
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'
|
|
30
|
+
approveButton?: Omit<ButtonFilledProps, 'size'> & { tooltip?: TooltipProps };
|
|
31
31
|
/** Кнопка отмены */
|
|
32
|
-
cancelButton?: Omit<ButtonOutlineProps, 'size'
|
|
32
|
+
cancelButton?: Omit<ButtonOutlineProps, 'size'> & { tooltip?: TooltipProps };
|
|
33
33
|
/** Дополнительная кнопка */
|
|
34
|
-
additionalButton?: Omit<ButtonSimpleProps, 'size'
|
|
34
|
+
additionalButton?: Omit<ButtonSimpleProps, 'size'> & { tooltip?: TooltipProps };
|
|
35
35
|
/** Вложенный Drawer */
|
|
36
36
|
nestedDrawer?: ReactElement<DrawerProps>;
|
|
37
37
|
};
|
|
@@ -70,19 +70,29 @@ export function Drawer({
|
|
|
70
70
|
<>
|
|
71
71
|
{approveButton && (
|
|
72
72
|
<WithTooltip tooltip={approveButton.tooltip}>
|
|
73
|
-
<ButtonFilled
|
|
73
|
+
<ButtonFilled
|
|
74
|
+
appearance='primary'
|
|
75
|
+
size='m'
|
|
76
|
+
data-test-id={TEST_IDS.approveButton}
|
|
77
|
+
{...approveButton}
|
|
78
|
+
/>
|
|
74
79
|
</WithTooltip>
|
|
75
80
|
)}
|
|
76
81
|
|
|
77
82
|
{cancelButton && (
|
|
78
83
|
<WithTooltip tooltip={cancelButton.tooltip}>
|
|
79
|
-
<ButtonOutline
|
|
84
|
+
<ButtonOutline appearance='neutral' size='m' data-test-id={TEST_IDS.cancelButton} {...cancelButton} />
|
|
80
85
|
</WithTooltip>
|
|
81
86
|
)}
|
|
82
87
|
|
|
83
88
|
{additionalButton && (
|
|
84
89
|
<WithTooltip tooltip={additionalButton.tooltip}>
|
|
85
|
-
<ButtonSimple
|
|
90
|
+
<ButtonSimple
|
|
91
|
+
appearance='neutral'
|
|
92
|
+
size='m'
|
|
93
|
+
data-test-id={TEST_IDS.additionalButton}
|
|
94
|
+
{...additionalButton}
|
|
95
|
+
/>
|
|
86
96
|
</WithTooltip>
|
|
87
97
|
)}
|
|
88
98
|
</>
|
|
@@ -16,7 +16,12 @@ export type DrawerBodyProps = WithSupportProps<{
|
|
|
16
16
|
/** Вспомогательный компонент для добавления "тела" в DrawerCustom */
|
|
17
17
|
export function DrawerBody({ content, className, ...rest }: DrawerBodyProps) {
|
|
18
18
|
return (
|
|
19
|
-
<Scroll
|
|
19
|
+
<Scroll
|
|
20
|
+
size='m'
|
|
21
|
+
barHideStrategy='never'
|
|
22
|
+
className={cn(styles.drawerBody, className)}
|
|
23
|
+
{...extractSupportProps(rest)}
|
|
24
|
+
>
|
|
20
25
|
{content}
|
|
21
26
|
</Scroll>
|
|
22
27
|
);
|