@cloud-ru/uikit-product-mobile-drawer 0.9.15

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.
Files changed (32) hide show
  1. package/CHANGELOG.md +927 -0
  2. package/LICENSE +201 -0
  3. package/README.md +8 -0
  4. package/package.json +54 -0
  5. package/src/components/MobileDrawer/MobileDrawer.tsx +118 -0
  6. package/src/components/MobileDrawer/index.ts +1 -0
  7. package/src/components/MobileDrawer/styles.module.scss +5 -0
  8. package/src/components/MobileDrawerCustom/MobileDrawerCustom.tsx +186 -0
  9. package/src/components/MobileDrawerCustom/constants.ts +35 -0
  10. package/src/components/MobileDrawerCustom/hooks.ts +196 -0
  11. package/src/components/MobileDrawerCustom/index.ts +1 -0
  12. package/src/components/MobileDrawerCustom/motion.css +117 -0
  13. package/src/components/MobileDrawerCustom/styles.module.scss +219 -0
  14. package/src/components/index.ts +2 -0
  15. package/src/constants.ts +42 -0
  16. package/src/helperComponents/Body/Body.tsx +28 -0
  17. package/src/helperComponents/Body/index.ts +1 -0
  18. package/src/helperComponents/Body/styles.module.scss +11 -0
  19. package/src/helperComponents/ButtonClose/ButtonClose.tsx +22 -0
  20. package/src/helperComponents/ButtonClose/index.ts +1 -0
  21. package/src/helperComponents/ButtonClose/styles.module.scss +44 -0
  22. package/src/helperComponents/Footer/Footer.tsx +25 -0
  23. package/src/helperComponents/Footer/index.ts +1 -0
  24. package/src/helperComponents/Footer/styles.module.scss +18 -0
  25. package/src/helperComponents/Header/Header.tsx +50 -0
  26. package/src/helperComponents/Header/index.ts +1 -0
  27. package/src/helperComponents/Header/styles.module.scss +37 -0
  28. package/src/helperComponents/WithTooltip/WithTooltip.tsx +16 -0
  29. package/src/helperComponents/WithTooltip/index.ts +1 -0
  30. package/src/helperComponents/index.ts +4 -0
  31. package/src/index.ts +1 -0
  32. package/src/types.ts +11 -0
@@ -0,0 +1,25 @@
1
+ import cn from 'classnames';
2
+ import { ReactNode } from 'react';
3
+
4
+ import { extractSupportProps, WithSupportProps } from '@snack-uikit/utils';
5
+
6
+ import { TEST_IDS } from '../../constants';
7
+ import styles from './styles.module.scss';
8
+
9
+ export type DrawerFooterProps = WithSupportProps<{
10
+ /** Слот для добавления кнопок-действий */
11
+ actions: ReactNode;
12
+ /** CSS-класс */
13
+ className?: string;
14
+ }>;
15
+
16
+ /** Вспомогательный компонент для добавления "футера" в DrawerCustom */
17
+ export function DrawerFooter({ actions, className, ...rest }: DrawerFooterProps) {
18
+ return (
19
+ <div className={cn(styles.footer, className)} {...extractSupportProps(rest)}>
20
+ <div className={styles.footerActions} data-test-id={TEST_IDS.footerActions}>
21
+ {actions}
22
+ </div>
23
+ </div>
24
+ );
25
+ }
@@ -0,0 +1 @@
1
+ export * from './Footer';
@@ -0,0 +1,18 @@
1
+ @use '@sbercloud/figma-tokens-cloud-platform/build/scss/components/styles-tokens-drawer';
2
+
3
+ .footer {
4
+ padding: styles-tokens-drawer.$dimension-2m;
5
+ gap: styles-tokens-drawer.$dimension-1m;
6
+
7
+ display: flex;
8
+ flex-direction: column;
9
+ }
10
+
11
+ .footerActions {
12
+ @include styles-tokens-drawer.composite-var(styles-tokens-drawer.$drawer-action-row);
13
+
14
+ display: flex;
15
+ flex-direction: row-reverse;
16
+ flex-wrap: wrap-reverse;
17
+ align-items: center;
18
+ }
@@ -0,0 +1,50 @@
1
+ import cn from 'classnames';
2
+ import { ReactNode } from 'react';
3
+
4
+ import { MobileQuestionTooltip, MobileQuestionTooltipProps } from '@cloud-ru/uikit-product-mobile-tooltip';
5
+ import { Typography } from '@snack-uikit/typography';
6
+ import { extractSupportProps, WithSupportProps } from '@snack-uikit/utils';
7
+
8
+ import { TEST_IDS } from '../../constants';
9
+ import styles from './styles.module.scss';
10
+
11
+ export type DrawerHeaderProps = WithSupportProps<{
12
+ /** Изображение */
13
+ image?: {
14
+ src: string;
15
+ alt: string;
16
+ };
17
+ /** Заголовок */
18
+ title: ReactNode;
19
+ /** Тултип для заголовка */
20
+ titleTooltip?: MobileQuestionTooltipProps['tip'];
21
+ /** Подзаголовок */
22
+ subtitle?: ReactNode;
23
+ /** CSS-класс */
24
+ className?: string;
25
+ }>;
26
+
27
+ /** Вспомогательный компонент для добавления "шапки" в DrawerCustom */
28
+ export function DrawerHeader({ title, titleTooltip, subtitle, image, className, ...rest }: DrawerHeaderProps) {
29
+ return (
30
+ <div className={cn(styles.drawerHeader, className)} {...extractSupportProps(rest)}>
31
+ {image && <img src={image.src} alt={image.alt} className={styles.image} data-test-id={TEST_IDS.image} />}
32
+
33
+ <div className={styles.headlineLayout}>
34
+ <div className={styles.headline}>
35
+ <Typography.SansHeadlineS className={styles.title} data-test-id={TEST_IDS.title}>
36
+ {title}
37
+ </Typography.SansHeadlineS>
38
+
39
+ {titleTooltip && <MobileQuestionTooltip tip={titleTooltip} size='s' data-test-id={TEST_IDS.tooltip} />}
40
+ </div>
41
+
42
+ {subtitle && (
43
+ <Typography.SansBodyM className={styles.subtitle} data-test-id={TEST_IDS.subtitle}>
44
+ {subtitle}
45
+ </Typography.SansBodyM>
46
+ )}
47
+ </div>
48
+ </div>
49
+ );
50
+ }
@@ -0,0 +1 @@
1
+ export * from './Header';
@@ -0,0 +1,37 @@
1
+ @use '@sbercloud/figma-tokens-cloud-platform/build/scss/components/styles-tokens-drawer';
2
+
3
+ .drawerHeader {
4
+ /* stub for proper typings */
5
+ }
6
+
7
+ .image {
8
+ @include styles-tokens-drawer.composite-var(styles-tokens-drawer.$drawer-image);
9
+
10
+ display: block;
11
+ width: 100%;
12
+ object-fit: cover;
13
+ }
14
+
15
+ .headlineLayout {
16
+ padding: styles-tokens-drawer.$dimension-2m;
17
+ gap: styles-tokens-drawer.$dimension-1m;
18
+
19
+ display: flex;
20
+ flex-direction: column;
21
+ }
22
+
23
+ .headline {
24
+ @include styles-tokens-drawer.composite-var(styles-tokens-drawer.$drawer-headline);
25
+
26
+ display: flex;
27
+ align-items: center;
28
+ }
29
+
30
+ .title {
31
+ display: grid;
32
+ color: styles-tokens-drawer.$sys-neutral-text-main;
33
+ }
34
+
35
+ .subtitle {
36
+ color: styles-tokens-drawer.$sys-neutral-text-support;
37
+ }
@@ -0,0 +1,16 @@
1
+ import { PropsWithChildren } from 'react';
2
+
3
+ import { MobileTooltip, MobileTooltipProps } from '@cloud-ru/uikit-product-mobile-tooltip';
4
+
5
+ type WithTooltipProps = PropsWithChildren<{
6
+ /** Тултип над кнопкой */
7
+ tooltip?: MobileTooltipProps;
8
+ }>;
9
+
10
+ export function WithTooltip({ tooltip, children }: WithTooltipProps) {
11
+ if (!tooltip) {
12
+ return <>{children}</>;
13
+ }
14
+
15
+ return <MobileTooltip {...tooltip}>{children}</MobileTooltip>;
16
+ }
@@ -0,0 +1 @@
1
+ export * from './WithTooltip';
@@ -0,0 +1,4 @@
1
+ export * from './Body';
2
+ export * from './ButtonClose';
3
+ export * from './Footer';
4
+ export * from './Header';
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './components';
package/src/types.ts ADDED
@@ -0,0 +1,11 @@
1
+ import { ValueOf } from '@snack-uikit/utils';
2
+
3
+ import { MODAL_MODE, 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 ModalMode = ValueOf<typeof MODAL_MODE>;
10
+
11
+ export type Position = ValueOf<typeof POSITION>;