@snack-uikit/drawer 0.5.1 → 0.6.1

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,28 @@
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.6.1 (2023-12-14)
7
+
8
+ ### Only dependencies have been changed
9
+ * [@snack-uikit/icons@0.19.1](https://git.sbercloud.tech/sbercloud-ui/tokens-design-system/snack-uikit/-/blob/master/packages/icons/CHANGELOG.md)
10
+ * [@snack-uikit/tooltip@0.10.1](https://git.sbercloud.tech/sbercloud-ui/tokens-design-system/snack-uikit/-/blob/master/packages/tooltip/CHANGELOG.md)
11
+ * [@snack-uikit/truncate-string@0.4.1](https://git.sbercloud.tech/sbercloud-ui/tokens-design-system/snack-uikit/-/blob/master/packages/truncate-string/CHANGELOG.md)
12
+
13
+
14
+
15
+
16
+
17
+ # 0.6.0 (2023-12-14)
18
+
19
+
20
+ ### BREAKING CHANGES
21
+
22
+
23
+ * **FF-3729:** replace enum with unions ([910db4a](https://github.com/cloud-ru-tech/snack-uikit/commit/910db4aa8231ccbc58e538e5c5c1f461b1dec275))
24
+
25
+
26
+
27
+
6
28
  ## 0.5.1 (2023-12-06)
7
29
 
8
30
  ### Only dependencies have been changed
@@ -1,7 +1,7 @@
1
1
  import { ReactElement } from 'react';
2
2
  import { ButtonFilledProps, ButtonOutlineProps, ButtonSimpleProps } from '@snack-uikit/button';
3
- import { Mode, Position, Size } from '../../constants';
4
3
  import { DrawerBodyProps, DrawerHeaderProps } from '../../helperComponents';
4
+ import { Size } from '../../types';
5
5
  import { DrawerCustomProps } from '../DrawerCustom';
6
6
  export type DrawerProps = Omit<DrawerCustomProps, 'size' | 'children' | 'nestedDrawer' | 'push'> & Pick<DrawerHeaderProps, 'titleTooltip' | 'image'> & Pick<DrawerBodyProps, 'content'> & {
7
7
  /** Заголовок */
@@ -21,8 +21,3 @@ export type DrawerProps = Omit<DrawerCustomProps, 'size' | 'children' | 'nestedD
21
21
  };
22
22
  /** Готовый компонент Drawer */
23
23
  export declare function Drawer({ title, titleTooltip, subtitle, image, content, approveButton, cancelButton, additionalButton, nestedDrawer, ...rest }: DrawerProps): import("react/jsx-runtime").JSX.Element;
24
- export declare namespace Drawer {
25
- var modes: typeof Mode;
26
- var sizes: typeof Size;
27
- var positions: typeof Position;
28
- }
@@ -12,14 +12,11 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import { ButtonFilled, ButtonOutline, ButtonSimple, } from '@snack-uikit/button';
14
14
  import { TruncateString } from '@snack-uikit/truncate-string';
15
- import { Mode, NESTED_DRAWER_PUSH_DISTANCE, Position, Size, TEST_IDS } from '../../constants';
15
+ import { NESTED_DRAWER_PUSH_DISTANCE, TEST_IDS } from '../../constants';
16
16
  import { DrawerCustom } from '../DrawerCustom';
17
17
  /** Готовый компонент Drawer */
18
18
  export function Drawer(_a) {
19
19
  var { title, titleTooltip, subtitle, image, content, approveButton, cancelButton, additionalButton, nestedDrawer } = _a, rest = __rest(_a, ["title", "titleTooltip", "subtitle", "image", "content", "approveButton", "cancelButton", "additionalButton", "nestedDrawer"]);
20
20
  const needFooter = Boolean(approveButton) || Boolean(cancelButton) || Boolean(additionalButton);
21
- 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(ButtonFilled, Object.assign({}, approveButton, { size: ButtonFilled.sizes.M, "data-test-id": TEST_IDS.approveButton }))), cancelButton && (_jsx(ButtonOutline, Object.assign({}, cancelButton, { size: ButtonOutline.sizes.M, "data-test-id": TEST_IDS.cancelButton }))), additionalButton && (_jsx(ButtonSimple, Object.assign({}, additionalButton, { size: ButtonSimple.sizes.M, "data-test-id": TEST_IDS.additionalButton })))] }) })), nestedDrawer] })));
21
+ 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(ButtonFilled, Object.assign({}, approveButton, { size: 'm', "data-test-id": TEST_IDS.approveButton })), cancelButton && _jsx(ButtonOutline, Object.assign({}, cancelButton, { size: 'm', "data-test-id": TEST_IDS.cancelButton })), additionalButton && (_jsx(ButtonSimple, Object.assign({}, additionalButton, { size: 'm', "data-test-id": TEST_IDS.additionalButton })))] }) })), nestedDrawer] })));
22
22
  }
23
- Drawer.modes = Mode;
24
- Drawer.sizes = Size;
25
- Drawer.positions = Position;
@@ -2,8 +2,8 @@ import 'rc-drawer/assets/index.css';
2
2
  import { DrawerProps as RcDrawerProps } from 'rc-drawer';
3
3
  import { PropsWithChildren, ReactElement } from 'react';
4
4
  import { WithSupportProps } from '@snack-uikit/utils';
5
- import { Mode, Position, Size } from '../../constants';
6
5
  import { DrawerBody, DrawerBodyProps, DrawerFooter, DrawerFooterProps, DrawerHeader, DrawerHeaderProps } from '../../helperComponents';
6
+ import { Mode, Position, Size } from '../../types';
7
7
  export type DrawerCustomProps = WithSupportProps<PropsWithChildren<{
8
8
  /** Управление состоянием показан/не показан. */
9
9
  open: boolean;
@@ -29,9 +29,6 @@ export type DrawerCustomProps = WithSupportProps<PropsWithChildren<{
29
29
  declare function DrawerCustomComponent({ open, mode, position, onClose, rootClassName, className, size, push, container, children, nestedDrawer, ...rest }: DrawerCustomProps): import("react/jsx-runtime").JSX.Element;
30
30
  /** Компонент-конструктор */
31
31
  export declare const DrawerCustom: typeof DrawerCustomComponent & {
32
- modes: typeof Mode;
33
- positions: typeof Position;
34
- sizes: typeof Size;
35
32
  Header: typeof DrawerHeader;
36
33
  Body: typeof DrawerBody;
37
34
  Footer: typeof DrawerFooter;
@@ -14,21 +14,18 @@ import 'rc-drawer/assets/index.css';
14
14
  import cn from 'classnames';
15
15
  import RcDrawer from 'rc-drawer';
16
16
  import { extractSupportProps } from '@snack-uikit/utils';
17
- import { Mode, Position, Size, SIZE_AS_VALUES } from '../../constants';
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';
20
20
  import styles from './styles.module.css';
21
21
  function DrawerCustomComponent(_a) {
22
- var { open, mode = Mode.Regular, position = Position.Right, onClose, rootClassName, className, size = Size.S, push, container, children, nestedDrawer } = _a, rest = __rest(_a, ["open", "mode", "position", "onClose", "rootClassName", "className", "size", "push", "container", "children", "nestedDrawer"]);
23
- const isRegular = mode === Mode.Regular;
22
+ var { open, mode = MODE.Regular, position = POSITION.Right, onClose, rootClassName, className, size = SIZE.S, push, container, children, nestedDrawer } = _a, rest = __rest(_a, ["open", "mode", "position", "onClose", "rootClassName", "className", "size", "push", "container", "children", "nestedDrawer"]);
23
+ const isRegular = mode === MODE.Regular;
24
24
  const isPredefinedSize = typeof size === 'string' && SIZE_AS_VALUES.includes(size);
25
- 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", Object.assign({ className: styles.headerElements }, { children: _jsx(ButtonClose, { onClick: onClose }) })), children, nestedDrawer] })));
25
+ 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] })));
26
26
  }
27
27
  /** Компонент-конструктор */
28
28
  export const DrawerCustom = DrawerCustomComponent;
29
- DrawerCustom.modes = Mode;
30
- DrawerCustom.positions = Position;
31
- DrawerCustom.sizes = Size;
32
29
  DrawerCustom.Header = DrawerHeader;
33
30
  DrawerCustom.Body = DrawerBody;
34
31
  DrawerCustom.Footer = DrawerFooter;
@@ -1,17 +1,17 @@
1
- export declare enum Size {
2
- S = "s",
3
- M = "m",
4
- L = "l"
5
- }
1
+ export declare const SIZE: {
2
+ readonly S: "s";
3
+ readonly M: "m";
4
+ readonly L: "l";
5
+ };
6
6
  export declare const SIZE_AS_VALUES: string[];
7
- export declare enum Mode {
8
- Regular = "regular",
9
- Soft = "soft"
10
- }
11
- export declare enum Position {
12
- Right = "right",
13
- Left = "left"
14
- }
7
+ export declare const MODE: {
8
+ readonly Regular: "regular";
9
+ readonly Soft: "soft";
10
+ };
11
+ export declare const POSITION: {
12
+ readonly Right: "right";
13
+ readonly Left: "left";
14
+ };
15
15
  export declare const NESTED_DRAWER_PUSH_DISTANCE = 24;
16
16
  export declare const TEST_IDS: {
17
17
  closeButton: string;
package/dist/constants.js CHANGED
@@ -1,20 +1,17 @@
1
- export var Size;
2
- (function (Size) {
3
- Size["S"] = "s";
4
- Size["M"] = "m";
5
- Size["L"] = "l";
6
- })(Size || (Size = {}));
7
- export const SIZE_AS_VALUES = Object.values(Size);
8
- export var Mode;
9
- (function (Mode) {
10
- Mode["Regular"] = "regular";
11
- Mode["Soft"] = "soft";
12
- })(Mode || (Mode = {}));
13
- export var Position;
14
- (function (Position) {
15
- Position["Right"] = "right";
16
- Position["Left"] = "left";
17
- })(Position || (Position = {}));
1
+ export const SIZE = {
2
+ S: 's',
3
+ M: 'm',
4
+ L: 'l',
5
+ };
6
+ export const SIZE_AS_VALUES = Object.values(SIZE);
7
+ export const MODE = {
8
+ Regular: 'regular',
9
+ Soft: 'soft',
10
+ };
11
+ export const POSITION = {
12
+ Right: 'right',
13
+ Left: 'left',
14
+ };
18
15
  export const NESTED_DRAWER_PUSH_DISTANCE = 24;
19
16
  export const TEST_IDS = {
20
17
  closeButton: 'drawer__close-button',
@@ -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: Scroll.sizes.M, 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
  }
@@ -3,5 +3,5 @@ import { CrossSVG } from '@snack-uikit/icons';
3
3
  import { TEST_IDS } from '../../constants';
4
4
  import styles from './styles.module.css';
5
5
  export function ButtonClose({ onClick }) {
6
- return (_jsx("button", Object.assign({ className: styles.buttonClose, onClick: onClick, "aria-label": 'close drawer', "data-test-id": TEST_IDS.closeButton }, { children: _jsx(CrossSVG, {}) })));
6
+ return (_jsx("button", { className: styles.buttonClose, onClick: onClick, "aria-label": 'close drawer', "data-test-id": TEST_IDS.closeButton, children: _jsx(CrossSVG, {}) }));
7
7
  }
@@ -17,5 +17,5 @@ import styles from './styles.module.css';
17
17
  /** Вспомогательный компонент для добавления "футера" в DrawerCustom */
18
18
  export function DrawerFooter(_a) {
19
19
  var { actions, className } = _a, rest = __rest(_a, ["actions", "className"]);
20
- return (_jsx("div", Object.assign({ className: cn(styles.footer, className) }, extractSupportProps(rest), { children: _jsx("div", Object.assign({ className: styles.footerActions, "data-test-id": TEST_IDS.footerActions }, { children: actions })) })));
20
+ return (_jsx("div", Object.assign({ className: cn(styles.footer, className) }, extractSupportProps(rest), { children: _jsx("div", { className: styles.footerActions, "data-test-id": TEST_IDS.footerActions, children: actions }) })));
21
21
  }
@@ -19,5 +19,5 @@ import styles from './styles.module.css';
19
19
  /** Вспомогательный компонент для добавления "шапки" в DrawerCustom */
20
20
  export function DrawerHeader(_a) {
21
21
  var { title, titleTooltip, subtitle, image, className } = _a, rest = __rest(_a, ["title", "titleTooltip", "subtitle", "image", "className"]);
22
- return (_jsxs("div", Object.assign({ className: cn(styles.drawerHeader, className) }, extractSupportProps(rest), { children: [image && _jsx("img", { src: image.src, alt: image.alt, className: styles.image, "data-test-id": TEST_IDS.image }), _jsxs("div", Object.assign({ className: styles.headlineLayout }, { children: [_jsxs("div", Object.assign({ className: styles.headline }, { children: [_jsx(Typography, Object.assign({ family: Typography.families.Sans, role: Typography.roles.Headline, size: Typography.sizes.S, className: styles.title, "data-test-id": TEST_IDS.title }, { children: title })), titleTooltip && (_jsx(QuestionTooltip, { tip: titleTooltip, size: QuestionTooltip.sizes.S, "data-test-id": TEST_IDS.tooltip }))] })), subtitle && (_jsx(Typography, Object.assign({ family: Typography.families.Sans, role: Typography.roles.Body, size: Typography.sizes.M, className: styles.subtitle, "data-test-id": TEST_IDS.subtitle }, { children: subtitle })))] }))] })));
22
+ return (_jsxs("div", Object.assign({ className: cn(styles.drawerHeader, className) }, extractSupportProps(rest), { children: [image && _jsx("img", { src: image.src, alt: image.alt, className: styles.image, "data-test-id": TEST_IDS.image }), _jsxs("div", { className: styles.headlineLayout, children: [_jsxs("div", { className: styles.headline, children: [_jsx(Typography.SansHeadlineS, { className: styles.title, "data-test-id": TEST_IDS.title, children: title }), titleTooltip && _jsx(QuestionTooltip, { tip: titleTooltip, size: 's', "data-test-id": TEST_IDS.tooltip })] }), subtitle && (_jsx(Typography.SansBodyM, { className: styles.subtitle, "data-test-id": TEST_IDS.subtitle, children: subtitle }))] })] })));
23
23
  }
@@ -0,0 +1,5 @@
1
+ import { ValueOf } from '@snack-uikit/utils';
2
+ import { MODE, POSITION, SIZE } from './constants';
3
+ export type Size = ValueOf<typeof SIZE>;
4
+ export type Mode = ValueOf<typeof MODE>;
5
+ export type Position = ValueOf<typeof POSITION>;
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "title": "Drawer",
7
- "version": "0.5.1",
7
+ "version": "0.6.1",
8
8
  "sideEffects": [
9
9
  "*.css",
10
10
  "*.woff",
@@ -32,15 +32,15 @@
32
32
  "license": "Apache-2.0",
33
33
  "scripts": {},
34
34
  "dependencies": {
35
- "@snack-uikit/button": "0.14.1",
36
- "@snack-uikit/icons": "0.19.0",
37
- "@snack-uikit/scroll": "0.4.1",
38
- "@snack-uikit/tooltip": "0.9.1",
39
- "@snack-uikit/truncate-string": "0.3.1",
40
- "@snack-uikit/typography": "0.5.1",
41
- "@snack-uikit/utils": "3.1.0",
35
+ "@snack-uikit/button": "0.15.0",
36
+ "@snack-uikit/icons": "0.19.1",
37
+ "@snack-uikit/scroll": "0.5.0",
38
+ "@snack-uikit/tooltip": "0.10.1",
39
+ "@snack-uikit/truncate-string": "0.4.1",
40
+ "@snack-uikit/typography": "0.6.0",
41
+ "@snack-uikit/utils": "3.2.0",
42
42
  "classnames": "2.3.2",
43
43
  "rc-drawer": "6.4.1"
44
44
  },
45
- "gitHead": "76a159dde7baccf49dc7b11e1fd7abc31424b42f"
45
+ "gitHead": "62f43bf0cbfd611d0b746117400f67096b1790f6"
46
46
  }
@@ -10,8 +10,9 @@ import {
10
10
  } from '@snack-uikit/button';
11
11
  import { TruncateString } from '@snack-uikit/truncate-string';
12
12
 
13
- import { Mode, NESTED_DRAWER_PUSH_DISTANCE, Position, Size, TEST_IDS } from '../../constants';
13
+ import { NESTED_DRAWER_PUSH_DISTANCE, TEST_IDS } from '../../constants';
14
14
  import { DrawerBodyProps, DrawerHeaderProps } from '../../helperComponents';
15
+ import { Size } from '../../types';
15
16
  import { DrawerCustom, DrawerCustomProps } from '../DrawerCustom';
16
17
 
17
18
  export type DrawerProps = Omit<DrawerCustomProps, 'size' | 'children' | 'nestedDrawer' | 'push'> &
@@ -65,20 +66,12 @@ export function Drawer({
65
66
  data-test-id={TEST_IDS.footer}
66
67
  actions={
67
68
  <>
68
- {approveButton && (
69
- <ButtonFilled {...approveButton} size={ButtonFilled.sizes.M} data-test-id={TEST_IDS.approveButton} />
70
- )}
69
+ {approveButton && <ButtonFilled {...approveButton} size='m' data-test-id={TEST_IDS.approveButton} />}
71
70
 
72
- {cancelButton && (
73
- <ButtonOutline {...cancelButton} size={ButtonOutline.sizes.M} data-test-id={TEST_IDS.cancelButton} />
74
- )}
71
+ {cancelButton && <ButtonOutline {...cancelButton} size='m' data-test-id={TEST_IDS.cancelButton} />}
75
72
 
76
73
  {additionalButton && (
77
- <ButtonSimple
78
- {...additionalButton}
79
- size={ButtonSimple.sizes.M}
80
- data-test-id={TEST_IDS.additionalButton}
81
- />
74
+ <ButtonSimple {...additionalButton} size='m' data-test-id={TEST_IDS.additionalButton} />
82
75
  )}
83
76
  </>
84
77
  }
@@ -89,7 +82,3 @@ export function Drawer({
89
82
  </DrawerCustom>
90
83
  );
91
84
  }
92
-
93
- Drawer.modes = Mode;
94
- Drawer.sizes = Size;
95
- Drawer.positions = Position;
@@ -6,7 +6,7 @@ import { PropsWithChildren, ReactElement } from 'react';
6
6
 
7
7
  import { extractSupportProps, WithSupportProps } from '@snack-uikit/utils';
8
8
 
9
- import { Mode, Position, Size, SIZE_AS_VALUES } from '../../constants';
9
+ import { MODE, POSITION, SIZE, SIZE_AS_VALUES } from '../../constants';
10
10
  import {
11
11
  ButtonClose,
12
12
  DrawerBody,
@@ -16,6 +16,7 @@ import {
16
16
  DrawerHeader,
17
17
  DrawerHeaderProps,
18
18
  } from '../../helperComponents';
19
+ import { Mode, Position, Size } from '../../types';
19
20
  import { motionProps } from './constants';
20
21
  import styles from './styles.module.scss';
21
22
 
@@ -46,19 +47,19 @@ export type DrawerCustomProps = WithSupportProps<
46
47
 
47
48
  function DrawerCustomComponent({
48
49
  open,
49
- mode = Mode.Regular,
50
- position = Position.Right,
50
+ mode = MODE.Regular,
51
+ position = POSITION.Right,
51
52
  onClose,
52
53
  rootClassName,
53
54
  className,
54
- size = Size.S,
55
+ size = SIZE.S,
55
56
  push,
56
57
  container,
57
58
  children,
58
59
  nestedDrawer,
59
60
  ...rest
60
61
  }: DrawerCustomProps) {
61
- const isRegular = mode === Mode.Regular;
62
+ const isRegular = mode === MODE.Regular;
62
63
  const isPredefinedSize = typeof size === 'string' && SIZE_AS_VALUES.includes(size);
63
64
 
64
65
  return (
@@ -95,17 +96,11 @@ function DrawerCustomComponent({
95
96
 
96
97
  /** Компонент-конструктор */
97
98
  export const DrawerCustom = DrawerCustomComponent as typeof DrawerCustomComponent & {
98
- modes: typeof Mode;
99
- positions: typeof Position;
100
- sizes: typeof Size;
101
99
  Header: typeof DrawerHeader;
102
100
  Body: typeof DrawerBody;
103
101
  Footer: typeof DrawerFooter;
104
102
  };
105
103
 
106
- DrawerCustom.modes = Mode;
107
- DrawerCustom.positions = Position;
108
- DrawerCustom.sizes = Size;
109
104
  DrawerCustom.Header = DrawerHeader;
110
105
  DrawerCustom.Body = DrawerBody;
111
106
  DrawerCustom.Footer = DrawerFooter;
package/src/constants.ts CHANGED
@@ -1,20 +1,20 @@
1
- export enum Size {
2
- S = 's',
3
- M = 'm',
4
- L = 'l',
5
- }
1
+ export const SIZE = {
2
+ S: 's',
3
+ M: 'm',
4
+ L: 'l',
5
+ } as const;
6
6
 
7
- export const SIZE_AS_VALUES: string[] = Object.values(Size);
7
+ export const SIZE_AS_VALUES: string[] = Object.values(SIZE);
8
8
 
9
- export enum Mode {
10
- Regular = 'regular',
11
- Soft = 'soft',
12
- }
9
+ export const MODE = {
10
+ Regular: 'regular',
11
+ Soft: 'soft',
12
+ } as const;
13
13
 
14
- export enum Position {
15
- Right = 'right',
16
- Left = 'left',
17
- }
14
+ export const POSITION = {
15
+ Right: 'right',
16
+ Left: 'left',
17
+ } as const;
18
18
 
19
19
  export const NESTED_DRAWER_PUSH_DISTANCE = 24;
20
20
 
@@ -16,7 +16,7 @@ export type DrawerBodyProps = WithSupportProps<{
16
16
  /** Вспомогательный компонент для добавления "тела" в DrawerCustom */
17
17
  export function DrawerBody({ content, className, ...rest }: DrawerBodyProps) {
18
18
  return (
19
- <Scroll size={Scroll.sizes.M} className={cn(styles.drawerBody, className)} {...extractSupportProps(rest)}>
19
+ <Scroll size='m' className={cn(styles.drawerBody, className)} {...extractSupportProps(rest)}>
20
20
  {content}
21
21
  </Scroll>
22
22
  );
@@ -32,31 +32,17 @@ export function DrawerHeader({ title, titleTooltip, subtitle, image, className,
32
32
 
33
33
  <div className={styles.headlineLayout}>
34
34
  <div className={styles.headline}>
35
- <Typography
36
- family={Typography.families.Sans}
37
- role={Typography.roles.Headline}
38
- size={Typography.sizes.S}
39
- className={styles.title}
40
- data-test-id={TEST_IDS.title}
41
- >
35
+ <Typography.SansHeadlineS className={styles.title} data-test-id={TEST_IDS.title}>
42
36
  {title}
43
- </Typography>
37
+ </Typography.SansHeadlineS>
44
38
 
45
- {titleTooltip && (
46
- <QuestionTooltip tip={titleTooltip} size={QuestionTooltip.sizes.S} data-test-id={TEST_IDS.tooltip} />
47
- )}
39
+ {titleTooltip && <QuestionTooltip tip={titleTooltip} size='s' data-test-id={TEST_IDS.tooltip} />}
48
40
  </div>
49
41
 
50
42
  {subtitle && (
51
- <Typography
52
- family={Typography.families.Sans}
53
- role={Typography.roles.Body}
54
- size={Typography.sizes.M}
55
- className={styles.subtitle}
56
- data-test-id={TEST_IDS.subtitle}
57
- >
43
+ <Typography.SansBodyM className={styles.subtitle} data-test-id={TEST_IDS.subtitle}>
58
44
  {subtitle}
59
- </Typography>
45
+ </Typography.SansBodyM>
60
46
  )}
61
47
  </div>
62
48
  </div>
package/src/types.ts ADDED
@@ -0,0 +1,9 @@
1
+ import { ValueOf } from '@snack-uikit/utils';
2
+
3
+ import { MODE, POSITION, SIZE } from './constants';
4
+
5
+ export type Size = ValueOf<typeof SIZE>;
6
+
7
+ export type Mode = ValueOf<typeof MODE>;
8
+
9
+ export type Position = ValueOf<typeof POSITION>;