@snack-uikit/drawer 0.7.3-preview-b7b8cddc.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 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,11 +42,10 @@
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
- | truncate | `{ title?: number; subtitle?: number; }` | '{ <br>title: 1; <br>subtitle: 2; }' | Максимальное кол-во строк <br> - `title` - в заголовке <br> - `subtitle` - в подзаголовке |
50
49
 
51
50
 
52
51
  [//]: DOCUMENTATION_SECTION_END
@@ -12,29 +12,19 @@ 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 */
27
27
  nestedDrawer?: ReactElement<DrawerProps>;
28
- /**
29
- * Максимальное кол-во строк
30
- * <br> - `title` - в заголовке
31
- * <br> - `subtitle` - в подзаголовке
32
- * @default '{ <br>title: 1; <br>subtitle: 2; }'
33
- */
34
- truncate?: {
35
- title?: number;
36
- subtitle?: number;
37
- };
38
28
  };
39
29
  /** Готовый компонент Drawer */
40
- export declare function Drawer({ title, titleTooltip, subtitle, image, content, approveButton, cancelButton, additionalButton, nestedDrawer, truncate, ...rest }: DrawerProps): import("react/jsx-runtime").JSX.Element;
30
+ export declare function Drawer({ title, titleTooltip, subtitle, image, content, approveButton, cancelButton, additionalButton, nestedDrawer, ...rest }: DrawerProps): import("react/jsx-runtime").JSX.Element;
@@ -17,7 +17,7 @@ import { WithTooltip } from '../../helperComponents/WithTooltip';
17
17
  import { DrawerCustom } from '../DrawerCustom';
18
18
  /** Готовый компонент Drawer */
19
19
  export function Drawer(_a) {
20
- var { title, titleTooltip, subtitle, image, content, approveButton, cancelButton, additionalButton, nestedDrawer, truncate } = _a, rest = __rest(_a, ["title", "titleTooltip", "subtitle", "image", "content", "approveButton", "cancelButton", "additionalButton", "nestedDrawer", "truncate"]);
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, maxLines: (truncate === null || truncate === void 0 ? void 0 : truncate.title) || 1 }), titleTooltip: titleTooltip, subtitle: subtitle ? _jsx(TruncateString, { text: subtitle, maxLines: (truncate === null || truncate === void 0 ? void 0 : truncate.subtitle) || 2 }) : undefined, 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] })));
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', barHideStrategy: 'never', className: cn(styles.drawerBody, className) }, extractSupportProps(rest), { children: content })));
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-preview-b7b8cddc.0",
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.1",
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": "51fcb0a1cb316542cb346cf07448b9acf6fb9215"
45
+ "gitHead": "d19da5dedbb93af1e6d86330b6f2590ef117a7c9"
46
46
  }
@@ -27,23 +27,13 @@ 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
- /**
38
- * Максимальное кол-во строк
39
- * <br> - `title` - в заголовке
40
- * <br> - `subtitle` - в подзаголовке
41
- * @default '{ <br>title: 1; <br>subtitle: 2; }'
42
- */
43
- truncate?: {
44
- title?: number;
45
- subtitle?: number;
46
- };
47
37
  };
48
38
 
49
39
  /** Готовый компонент Drawer */
@@ -57,7 +47,6 @@ export function Drawer({
57
47
  cancelButton,
58
48
  additionalButton,
59
49
  nestedDrawer,
60
- truncate,
61
50
  ...rest
62
51
  }: DrawerProps) {
63
52
  const needFooter = Boolean(approveButton) || Boolean(cancelButton) || Boolean(additionalButton);
@@ -65,9 +54,9 @@ export function Drawer({
65
54
  return (
66
55
  <DrawerCustom {...rest} push={Boolean(nestedDrawer) && { distance: NESTED_DRAWER_PUSH_DISTANCE }}>
67
56
  <DrawerCustom.Header
68
- title={<TruncateString text={title} maxLines={truncate?.title || 1} />}
57
+ title={<TruncateString text={title} />}
69
58
  titleTooltip={titleTooltip}
70
- subtitle={subtitle ? <TruncateString text={subtitle} maxLines={truncate?.subtitle || 2} /> : undefined}
59
+ subtitle={subtitle}
71
60
  image={image}
72
61
  data-test-id={TEST_IDS.header}
73
62
  />
@@ -81,29 +70,19 @@ export function Drawer({
81
70
  <>
82
71
  {approveButton && (
83
72
  <WithTooltip tooltip={approveButton.tooltip}>
84
- <ButtonFilled
85
- appearance='primary'
86
- size='m'
87
- data-test-id={TEST_IDS.approveButton}
88
- {...approveButton}
89
- />
73
+ <ButtonFilled {...approveButton} size='m' data-test-id={TEST_IDS.approveButton} />
90
74
  </WithTooltip>
91
75
  )}
92
76
 
93
77
  {cancelButton && (
94
78
  <WithTooltip tooltip={cancelButton.tooltip}>
95
- <ButtonOutline appearance='neutral' size='m' data-test-id={TEST_IDS.cancelButton} {...cancelButton} />
79
+ <ButtonOutline {...cancelButton} size='m' data-test-id={TEST_IDS.cancelButton} />
96
80
  </WithTooltip>
97
81
  )}
98
82
 
99
83
  {additionalButton && (
100
84
  <WithTooltip tooltip={additionalButton.tooltip}>
101
- <ButtonSimple
102
- appearance='neutral'
103
- size='m'
104
- data-test-id={TEST_IDS.additionalButton}
105
- {...additionalButton}
106
- />
85
+ <ButtonSimple {...additionalButton} size='m' data-test-id={TEST_IDS.additionalButton} />
107
86
  </WithTooltip>
108
87
  )}
109
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
  );