@alfalab/core-components-product-cover 1.0.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/Component.d.ts +8 -0
- package/Component.js +21 -0
- package/components/image-card/Component.d.ts +32 -0
- package/components/image-card/Component.js +41 -0
- package/components/image-card/index.css +32 -0
- package/components/image-card/index.d.ts +1 -0
- package/components/image-card/index.js +9 -0
- package/components/index.d.ts +3 -0
- package/components/index.js +13 -0
- package/components/overlay/Component.d.ts +4 -0
- package/components/overlay/Component.js +24 -0
- package/components/overlay/index.css +35 -0
- package/components/overlay/index.d.ts +1 -0
- package/components/overlay/index.js +9 -0
- package/components/text/Component.d.ts +47 -0
- package/components/text/Component.js +40 -0
- package/components/text/index.css +48 -0
- package/components/text/index.d.ts +1 -0
- package/components/text/index.js +9 -0
- package/consts.d.ts +5 -0
- package/consts.js +32 -0
- package/cssm/Component.d.ts +8 -0
- package/cssm/Component.js +21 -0
- package/cssm/components/image-card/Component.d.ts +32 -0
- package/cssm/components/image-card/Component.js +40 -0
- package/cssm/components/image-card/index.d.ts +1 -0
- package/cssm/components/image-card/index.js +9 -0
- package/cssm/components/image-card/index.module.css +31 -0
- package/cssm/components/index.d.ts +3 -0
- package/cssm/components/index.js +13 -0
- package/cssm/components/overlay/Component.d.ts +4 -0
- package/cssm/components/overlay/Component.js +23 -0
- package/cssm/components/overlay/index.d.ts +1 -0
- package/cssm/components/overlay/index.js +9 -0
- package/cssm/components/overlay/index.module.css +34 -0
- package/cssm/components/text/Component.d.ts +47 -0
- package/cssm/components/text/Component.js +39 -0
- package/cssm/components/text/index.d.ts +1 -0
- package/cssm/components/text/index.js +9 -0
- package/cssm/components/text/index.module.css +46 -0
- package/cssm/consts.d.ts +5 -0
- package/cssm/consts.js +32 -0
- package/cssm/index.d.ts +2 -0
- package/cssm/index.js +10 -0
- package/cssm/shared/index.d.ts +1 -0
- package/cssm/shared/index.js +10 -0
- package/cssm/single/Component.d.ts +4 -0
- package/cssm/single/Component.js +39 -0
- package/cssm/single/index.d.ts +1 -0
- package/cssm/single/index.js +9 -0
- package/cssm/single/index.module.css +71 -0
- package/cssm/stack/Component.d.ts +4 -0
- package/cssm/stack/Component.js +34 -0
- package/cssm/stack/index.d.ts +1 -0
- package/cssm/stack/index.js +9 -0
- package/cssm/stack/index.module.css +68 -0
- package/cssm/typings.d.ts +144 -0
- package/cssm/typings.js +2 -0
- package/cssm/utils/index.d.ts +15 -0
- package/cssm/utils/index.js +39 -0
- package/esm/Component.d.ts +8 -0
- package/esm/Component.js +12 -0
- package/esm/components/image-card/Component.d.ts +32 -0
- package/esm/components/image-card/Component.js +33 -0
- package/esm/components/image-card/index.css +32 -0
- package/esm/components/image-card/index.d.ts +1 -0
- package/esm/components/image-card/index.js +1 -0
- package/esm/components/index.d.ts +3 -0
- package/esm/components/index.js +3 -0
- package/esm/components/overlay/Component.d.ts +4 -0
- package/esm/components/overlay/Component.js +15 -0
- package/esm/components/overlay/index.css +35 -0
- package/esm/components/overlay/index.d.ts +1 -0
- package/esm/components/overlay/index.js +1 -0
- package/esm/components/text/Component.d.ts +47 -0
- package/esm/components/text/Component.js +31 -0
- package/esm/components/text/index.css +48 -0
- package/esm/components/text/index.d.ts +1 -0
- package/esm/components/text/index.js +1 -0
- package/esm/consts.d.ts +5 -0
- package/esm/consts.js +26 -0
- package/esm/index.d.ts +2 -0
- package/esm/index.js +1 -0
- package/esm/shared/index.d.ts +1 -0
- package/esm/shared/index.js +1 -0
- package/esm/single/Component.d.ts +4 -0
- package/esm/single/Component.js +31 -0
- package/esm/single/index.css +72 -0
- package/esm/single/index.d.ts +1 -0
- package/esm/single/index.js +1 -0
- package/esm/stack/Component.d.ts +4 -0
- package/esm/stack/Component.js +26 -0
- package/esm/stack/index.css +69 -0
- package/esm/stack/index.d.ts +1 -0
- package/esm/stack/index.js +1 -0
- package/esm/typings.d.ts +144 -0
- package/esm/typings.js +1 -0
- package/esm/utils/index.d.ts +15 -0
- package/esm/utils/index.js +32 -0
- package/index.d.ts +2 -0
- package/index.js +10 -0
- package/modern/Component.d.ts +8 -0
- package/modern/Component.js +11 -0
- package/modern/components/image-card/Component.d.ts +32 -0
- package/modern/components/image-card/Component.js +32 -0
- package/modern/components/image-card/index.css +32 -0
- package/modern/components/image-card/index.d.ts +1 -0
- package/modern/components/image-card/index.js +1 -0
- package/modern/components/index.d.ts +3 -0
- package/modern/components/index.js +3 -0
- package/modern/components/overlay/Component.d.ts +4 -0
- package/modern/components/overlay/Component.js +11 -0
- package/modern/components/overlay/index.css +35 -0
- package/modern/components/overlay/index.d.ts +1 -0
- package/modern/components/overlay/index.js +1 -0
- package/modern/components/text/Component.d.ts +47 -0
- package/modern/components/text/Component.js +31 -0
- package/modern/components/text/index.css +48 -0
- package/modern/components/text/index.d.ts +1 -0
- package/modern/components/text/index.js +1 -0
- package/modern/consts.d.ts +5 -0
- package/modern/consts.js +26 -0
- package/modern/index.d.ts +2 -0
- package/modern/index.js +1 -0
- package/modern/shared/index.d.ts +1 -0
- package/modern/shared/index.js +1 -0
- package/modern/single/Component.d.ts +4 -0
- package/modern/single/Component.js +29 -0
- package/modern/single/index.css +72 -0
- package/modern/single/index.d.ts +1 -0
- package/modern/single/index.js +1 -0
- package/modern/stack/Component.d.ts +4 -0
- package/modern/stack/Component.js +23 -0
- package/modern/stack/index.css +69 -0
- package/modern/stack/index.d.ts +1 -0
- package/modern/stack/index.js +1 -0
- package/modern/typings.d.ts +144 -0
- package/modern/typings.js +1 -0
- package/modern/utils/index.d.ts +15 -0
- package/modern/utils/index.js +32 -0
- package/package.json +27 -0
- package/shared/index.d.ts +1 -0
- package/shared/index.js +10 -0
- package/shared/package.json +3 -0
- package/single/Component.d.ts +4 -0
- package/single/Component.js +40 -0
- package/single/index.css +72 -0
- package/single/index.d.ts +1 -0
- package/single/index.js +9 -0
- package/src/Component.tsx +15 -0
- package/src/components/image-card/Component.tsx +110 -0
- package/src/components/image-card/index.module.css +18 -0
- package/src/components/image-card/index.ts +1 -0
- package/src/components/index.ts +3 -0
- package/src/components/overlay/Component.tsx +14 -0
- package/src/components/overlay/index.module.css +25 -0
- package/src/components/overlay/index.ts +1 -0
- package/src/components/text/Component.tsx +134 -0
- package/src/components/text/index.module.css +39 -0
- package/src/components/text/index.ts +1 -0
- package/src/consts.ts +28 -0
- package/src/index.ts +2 -0
- package/src/shared/index.ts +1 -0
- package/src/shared/package.json +3 -0
- package/src/single/Component.tsx +92 -0
- package/src/single/index.module.css +60 -0
- package/src/single/index.ts +1 -0
- package/src/stack/Component.tsx +51 -0
- package/src/stack/index.module.css +84 -0
- package/src/stack/index.ts +1 -0
- package/src/typings.ts +179 -0
- package/src/utils/index.ts +35 -0
- package/stack/Component.d.ts +4 -0
- package/stack/Component.js +35 -0
- package/stack/index.css +69 -0
- package/stack/index.d.ts +1 -0
- package/stack/index.js +9 -0
- package/typings.d.ts +144 -0
- package/typings.js +2 -0
- package/utils/index.d.ts +15 -0
- package/utils/index.js +39 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Size } from "../../typings";
|
|
4
|
+
type TextProps = {
|
|
5
|
+
/**
|
|
6
|
+
* Кнопка показать номер карты
|
|
7
|
+
*/
|
|
8
|
+
eyeButton?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Размер
|
|
11
|
+
*/
|
|
12
|
+
size?: Size;
|
|
13
|
+
/**
|
|
14
|
+
* Дополнительный класс
|
|
15
|
+
*/
|
|
16
|
+
className?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Имя владельца карты в верхнем регистре
|
|
19
|
+
*/
|
|
20
|
+
cardholderNameUppercase?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Имя владельца карты
|
|
23
|
+
*/
|
|
24
|
+
cardholderName?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Номер карты
|
|
27
|
+
*/
|
|
28
|
+
cardNumber?: number;
|
|
29
|
+
/**
|
|
30
|
+
* Количество карт
|
|
31
|
+
*/
|
|
32
|
+
numberOfСards?: number;
|
|
33
|
+
/**
|
|
34
|
+
* Управление ориентацией стопки карт компонента
|
|
35
|
+
*/
|
|
36
|
+
align?: 'bottom' | 'default';
|
|
37
|
+
/**
|
|
38
|
+
* Обработчик клика по иконке 'показать номер карты'
|
|
39
|
+
*/
|
|
40
|
+
onEyeIconClick?: () => void;
|
|
41
|
+
/**
|
|
42
|
+
* Идентификатор для систем автоматизированного тестирования.
|
|
43
|
+
*/
|
|
44
|
+
dataTestId?: string;
|
|
45
|
+
};
|
|
46
|
+
declare const Text: React.FC<TextProps>;
|
|
47
|
+
export { TextProps, Text };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
import { ButtonDesktop } from '@alfalab/core-components-button/modern/desktop';
|
|
4
|
+
import { getDataTestId } from '@alfalab/core-components-shared/modern';
|
|
5
|
+
import { Typography } from '@alfalab/core-components-typography/modern';
|
|
6
|
+
import { EyeMIcon } from '@alfalab/icons-glyph/EyeMIcon';
|
|
7
|
+
import { pluralize } from '@alfalab/utils';
|
|
8
|
+
import { TYPOGRAPHY_VIEW_FOR_SIZE } from '../../consts.js';
|
|
9
|
+
import { showNumberOfСards } from '../../utils/index.js';
|
|
10
|
+
|
|
11
|
+
const styles = {"component":"product-cover__component_15nup","cardholderName":"product-cover__cardholderName_15nup","cardNumber":"product-cover__cardNumber_15nup","buttonEye":"product-cover__buttonEye_15nup"};
|
|
12
|
+
require('./index.css')
|
|
13
|
+
|
|
14
|
+
const Text = ({ cardholderNameUppercase, cardholderName, cardNumber, numberOfСards, align, eyeButton, dataTestId, size = 164, onEyeIconClick, }) => {
|
|
15
|
+
const maxSize = size === 164;
|
|
16
|
+
const visibleNumberOfСards = showNumberOfСards(size, numberOfСards, align);
|
|
17
|
+
return (React.createElement("div", { className: cn(styles.component), "data-test-id": dataTestId },
|
|
18
|
+
maxSize && cardholderName ? (React.createElement(Typography.Text, { tag: 'div', view: 'secondary-medium', weight: 'medium', color: 'static-primary-light', className: styles.cardholderName }, cardholderNameUppercase ? cardholderName?.toUpperCase() : cardholderName)) : null,
|
|
19
|
+
cardNumber && !visibleNumberOfСards ? (React.createElement("div", { className: styles.cardNumber },
|
|
20
|
+
React.createElement(Typography.Text, { view: TYPOGRAPHY_VIEW_FOR_SIZE[size], weight: 'medium', color: 'static-primary-light' },
|
|
21
|
+
[164, 128].includes(size) && '··\u2009',
|
|
22
|
+
String(cardNumber).slice(-4)),
|
|
23
|
+
eyeButton && maxSize && (React.createElement(ButtonDesktop, { view: 'text', className: cn(styles.buttonEye), dataTestId: getDataTestId(dataTestId, 'eye-btn'), onClick: onEyeIconClick, colors: 'inverted' },
|
|
24
|
+
React.createElement(EyeMIcon, null))))) : null,
|
|
25
|
+
visibleNumberOfСards && (React.createElement("div", { className: styles.cardNumber },
|
|
26
|
+
React.createElement(Typography.Text, { view: TYPOGRAPHY_VIEW_FOR_SIZE[size], weight: 'medium', color: 'static-primary-dark' },
|
|
27
|
+
`+${numberOfСards}\u00A0`,
|
|
28
|
+
pluralize(numberOfСards || 0, 'карта', 'карты', 'карт'))))));
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export { Text };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/* hash: nlylc */
|
|
2
|
+
:root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
3
|
+
} /* deprecated */ :root {
|
|
4
|
+
--color-static-text-primary-light: #fff; /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
5
|
+
} :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
6
|
+
} :root {
|
|
7
|
+
} :root {
|
|
8
|
+
|
|
9
|
+
/* Hard */
|
|
10
|
+
|
|
11
|
+
/* Up */
|
|
12
|
+
|
|
13
|
+
/* Hard up */
|
|
14
|
+
} :root {
|
|
15
|
+
} :root {
|
|
16
|
+
--gap-3xs: 2px;
|
|
17
|
+
} :root {
|
|
18
|
+
} :root {
|
|
19
|
+
} .product-cover__component_15nup {
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
z-index: 2;
|
|
23
|
+
grid-gap: var(--gap-3xs);
|
|
24
|
+
grid-gap: var(--gap-3xs);
|
|
25
|
+
gap: var(--gap-3xs);
|
|
26
|
+
} .product-cover__cardholderName_15nup {
|
|
27
|
+
-webkit-line-clamp: 1;
|
|
28
|
+
display: -webkit-box;
|
|
29
|
+
-webkit-box-orient: vertical;
|
|
30
|
+
overflow: hidden;
|
|
31
|
+
word-break: break-all;
|
|
32
|
+
} .product-cover__cardNumber_15nup {
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
} .product-cover__buttonEye_15nup.product-cover__buttonEye_15nup {
|
|
36
|
+
margin-left: 5px;
|
|
37
|
+
width: 24px;
|
|
38
|
+
height: 24px;
|
|
39
|
+
cursor: pointer;
|
|
40
|
+
color: var(--color-static-text-primary-light)
|
|
41
|
+
} .product-cover__buttonEye_15nup.product-cover__buttonEye_15nup:hover {
|
|
42
|
+
color: var(--color-static-text-primary-light);
|
|
43
|
+
} .product-cover__buttonEye_15nup.product-cover__buttonEye_15nup:active {
|
|
44
|
+
color: var(--color-static-text-primary-light);
|
|
45
|
+
} .product-cover__buttonEye_15nup.product-cover__buttonEye_15nup > span {
|
|
46
|
+
display: flex;
|
|
47
|
+
align-items: center;
|
|
48
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Component";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Text } from './Component.js';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { TextProps } from "@alfalab/core-components-typography";
|
|
2
|
+
declare const WIDTH_TO_SIZE: Record<number, number>;
|
|
3
|
+
declare const TYPOGRAPHY_VIEW_FOR_SIZE: Record<number, TextProps['view']>;
|
|
4
|
+
declare const SECOND_CARD_SIZE: Record<number, number>;
|
|
5
|
+
export { WIDTH_TO_SIZE, TYPOGRAPHY_VIEW_FOR_SIZE, SECOND_CARD_SIZE };
|
package/modern/consts.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const WIDTH_TO_SIZE = {
|
|
2
|
+
16: 24,
|
|
3
|
+
32: 51,
|
|
4
|
+
40: 65,
|
|
5
|
+
48: 76,
|
|
6
|
+
96: 152,
|
|
7
|
+
128: 205,
|
|
8
|
+
164: 264,
|
|
9
|
+
};
|
|
10
|
+
const TYPOGRAPHY_VIEW_FOR_SIZE = {
|
|
11
|
+
16: 'secondary-small',
|
|
12
|
+
32: 'secondary-small',
|
|
13
|
+
40: 'secondary-medium',
|
|
14
|
+
48: 'secondary-medium',
|
|
15
|
+
96: 'secondary-medium',
|
|
16
|
+
128: 'primary-small',
|
|
17
|
+
164: 'primary-medium',
|
|
18
|
+
};
|
|
19
|
+
const SECOND_CARD_SIZE = {
|
|
20
|
+
16: 16,
|
|
21
|
+
32: 32,
|
|
22
|
+
40: 40,
|
|
23
|
+
128: 96,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export { SECOND_CARD_SIZE, TYPOGRAPHY_VIEW_FOR_SIZE, WIDTH_TO_SIZE };
|
package/modern/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ProductCover, Single } from './Component.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getProductCoverSingleTestIds, getProductCoverStackTestIds } from "../utils/index";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getProductCoverSingleTestIds, getProductCoverStackTestIds } from '../utils/index.js';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
import { getDataTestId } from '@alfalab/core-components-shared/modern';
|
|
4
|
+
import { Overlay } from '../components/overlay/Component.js';
|
|
5
|
+
import { Text } from '../components/text/Component.js';
|
|
6
|
+
import { ImageCard } from '../components/image-card/Component.js';
|
|
7
|
+
import { WIDTH_TO_SIZE } from '../consts.js';
|
|
8
|
+
|
|
9
|
+
const styles = {"component":"product-cover__component_6zdwr","size-164":"product-cover__size-164_6zdwr","size-128":"product-cover__size-128_6zdwr","size-96":"product-cover__size-96_6zdwr","size-48":"product-cover__size-48_6zdwr","size-40":"product-cover__size-40_6zdwr","size-32":"product-cover__size-32_6zdwr","size-16":"product-cover__size-16_6zdwr","icon":"product-cover__icon_6zdwr","border":"product-cover__border_6zdwr","contentAddons":"product-cover__contentAddons_6zdwr"};
|
|
10
|
+
require('./index.css')
|
|
11
|
+
|
|
12
|
+
const Single = ({ size = 164, icon: Icon, cardId, layers, baseUrl, shadow, iconColor, backgroundColor, borderColor, overlayProps = { colors: 'default', visible: false }, eyeButton, cardholderNameUppercase, cardholderName, numberOfСards, align, cardNumber, className, contentAddons, contentAddonsProps, onEyeIconClick, dataTestId, }) => {
|
|
13
|
+
const hasContent = Boolean(cardNumber || cardholderName || numberOfСards);
|
|
14
|
+
const showContent = hasContent && size !== 16 && !contentAddons;
|
|
15
|
+
return (React.createElement("div", { className: cn(styles.component, styles[`size-${size}`], className), style: {
|
|
16
|
+
width: WIDTH_TO_SIZE[size],
|
|
17
|
+
height: size,
|
|
18
|
+
boxShadow: shadow,
|
|
19
|
+
backgroundColor,
|
|
20
|
+
}, "data-test-id": dataTestId },
|
|
21
|
+
Icon && React.createElement(Icon, { color: iconColor, className: styles.icon }),
|
|
22
|
+
React.createElement(Overlay, { colors: overlayProps.colors, visible: overlayProps.visible }),
|
|
23
|
+
borderColor && (React.createElement("div", { className: cn(styles.border), style: { boxShadow: `inset 0 0 0 1px ${borderColor}` } })),
|
|
24
|
+
React.createElement(ImageCard, { width: WIDTH_TO_SIZE[size], height: size, cardId: cardId, layers: layers, baseUrl: baseUrl, "numberOf\u0421ards": numberOfСards }),
|
|
25
|
+
showContent && (React.createElement(Text, { cardNumber: cardNumber, eyeButton: eyeButton, cardholderNameUppercase: cardholderNameUppercase, cardholderName: cardholderName, "numberOf\u0421ards": numberOfСards, align: align, size: size, onEyeIconClick: onEyeIconClick, dataTestId: getDataTestId(dataTestId, 'user-info') })),
|
|
26
|
+
contentAddons && (React.createElement("div", { ...contentAddonsProps, className: cn(styles.contentAddons, contentAddonsProps?.className) }, contentAddons))));
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export { Single };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/* hash: 7n3ug */
|
|
2
|
+
:root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
3
|
+
} /* deprecated */ :root {
|
|
4
|
+
--color-light-graphic-tertiary: #b8b9c0; /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
5
|
+
} :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
6
|
+
} :root {
|
|
7
|
+
} :root {
|
|
8
|
+
|
|
9
|
+
/* Hard */
|
|
10
|
+
|
|
11
|
+
/* Up */
|
|
12
|
+
|
|
13
|
+
/* Hard up */
|
|
14
|
+
} :root {
|
|
15
|
+
--border-radius-xs: 2px;
|
|
16
|
+
--border-radius-s: 4px;
|
|
17
|
+
--border-radius-l: 12px;
|
|
18
|
+
--border-radius-xl: 16px;
|
|
19
|
+
--border-radius-xxl: 20px;
|
|
20
|
+
} :root {
|
|
21
|
+
--gap-3xs: 2px;
|
|
22
|
+
--gap-2xs: 4px;
|
|
23
|
+
--gap-xs: 8px;
|
|
24
|
+
--gap-s: 12px;
|
|
25
|
+
--gap-m: 16px;
|
|
26
|
+
} :root {
|
|
27
|
+
} :root {
|
|
28
|
+
} .product-cover__component_6zdwr {
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: end;
|
|
31
|
+
position: relative;
|
|
32
|
+
background-color: var(--color-light-graphic-tertiary);
|
|
33
|
+
box-sizing: border-box
|
|
34
|
+
} .product-cover__component_6zdwr.product-cover__size-164_6zdwr {
|
|
35
|
+
border-radius: var(--border-radius-xxl);
|
|
36
|
+
padding: var(--gap-s) var(--gap-m);
|
|
37
|
+
} .product-cover__component_6zdwr.product-cover__size-128_6zdwr {
|
|
38
|
+
border-radius: var(--border-radius-xl);
|
|
39
|
+
padding: var(--gap-xs) var(--gap-s);
|
|
40
|
+
} .product-cover__component_6zdwr.product-cover__size-96_6zdwr {
|
|
41
|
+
border-radius: var(--border-radius-l);
|
|
42
|
+
padding: 6px var(--gap-s);
|
|
43
|
+
} .product-cover__component_6zdwr.product-cover__size-48_6zdwr,
|
|
44
|
+
.product-cover__component_6zdwr.product-cover__size-40_6zdwr {
|
|
45
|
+
border-radius: 6px;
|
|
46
|
+
padding: var(--gap-3xs) var(--gap-2xs);
|
|
47
|
+
} .product-cover__component_6zdwr.product-cover__size-32_6zdwr {
|
|
48
|
+
border-radius: var(--border-radius-s);
|
|
49
|
+
padding: 0 var(--gap-3xs);
|
|
50
|
+
} .product-cover__component_6zdwr.product-cover__size-16_6zdwr {
|
|
51
|
+
border-radius: var(--border-radius-xs);
|
|
52
|
+
} .product-cover__icon_6zdwr {
|
|
53
|
+
position: absolute;
|
|
54
|
+
top: 50%;
|
|
55
|
+
left: 50%;
|
|
56
|
+
transform: translate(-50%, -50%);
|
|
57
|
+
z-index: 4;
|
|
58
|
+
} .product-cover__border_6zdwr {
|
|
59
|
+
position: absolute;
|
|
60
|
+
top: 0;
|
|
61
|
+
bottom: 0;
|
|
62
|
+
left: 0;
|
|
63
|
+
right: 0;
|
|
64
|
+
border-radius: inherit;
|
|
65
|
+
pointer-events: none;
|
|
66
|
+
z-index: 3;
|
|
67
|
+
} .product-cover__contentAddons_6zdwr {
|
|
68
|
+
width: 100%;
|
|
69
|
+
height: 100%;
|
|
70
|
+
z-index: 2;
|
|
71
|
+
overflow: hidden;
|
|
72
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Component";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Single } from './Component.js';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
import { getDataTestId } from '@alfalab/core-components-shared/modern';
|
|
4
|
+
import { Single } from '../single/Component.js';
|
|
5
|
+
import { getSizeSecondCard } from '../utils/index.js';
|
|
6
|
+
|
|
7
|
+
const styles = {"wrapper":"product-cover__wrapper_pkwq0","size-128":"product-cover__size-128_pkwq0","size-40":"product-cover__size-40_pkwq0","size-32":"product-cover__size-32_pkwq0","size-16":"product-cover__size-16_pkwq0","bottom":"product-cover__bottom_pkwq0","componentImage":"product-cover__componentImage_pkwq0","componentStack":"product-cover__componentStack_pkwq0","firstCard":"product-cover__firstCard_pkwq0","wrapperSecondCard":"product-cover__wrapperSecondCard_pkwq0"};
|
|
8
|
+
require('./index.css')
|
|
9
|
+
|
|
10
|
+
const Stack = ({ firstCard, secondCard, size = 128, numberOfСards, className, align = 'default', dataTestId, }) => {
|
|
11
|
+
const sizeClassNames = `size-${size}`;
|
|
12
|
+
const secondCardSize = getSizeSecondCard(size, align);
|
|
13
|
+
const commonClassName = {
|
|
14
|
+
[styles[sizeClassNames]]: true,
|
|
15
|
+
[styles[align]]: Boolean(styles[align]),
|
|
16
|
+
};
|
|
17
|
+
return (React.createElement("div", { className: cn(styles.wrapper, styles.componentStack, commonClassName, className), "data-test-id": dataTestId },
|
|
18
|
+
React.createElement(Single, { ...firstCard, className: cn(styles.firstCard, commonClassName), size: size, dataTestId: getDataTestId(dataTestId, 'first-card') }),
|
|
19
|
+
React.createElement("div", { className: cn(styles.wrapperSecondCard, commonClassName) },
|
|
20
|
+
React.createElement(Single, { ...secondCard, size: secondCardSize, align: align, "numberOf\u0421ards": numberOfСards, dataTestId: getDataTestId(dataTestId, 'second-card') }))));
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { Stack };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/* hash: 1s8sj */
|
|
2
|
+
:root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
3
|
+
} /* deprecated */ :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
4
|
+
} :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
5
|
+
} :root {
|
|
6
|
+
} :root {
|
|
7
|
+
|
|
8
|
+
/* Hard */
|
|
9
|
+
|
|
10
|
+
/* Up */
|
|
11
|
+
|
|
12
|
+
/* Hard up */
|
|
13
|
+
} :root {
|
|
14
|
+
} :root {
|
|
15
|
+
--gap-2xs: 4px;
|
|
16
|
+
--gap-xs: 8px;
|
|
17
|
+
--gap-s: 12px;
|
|
18
|
+
--gap-m: 16px;
|
|
19
|
+
--gap-l-neg: -20px;
|
|
20
|
+
} :root {
|
|
21
|
+
} :root {
|
|
22
|
+
} .product-cover__wrapper_pkwq0 {
|
|
23
|
+
display: flex;
|
|
24
|
+
justify-content: center;
|
|
25
|
+
box-sizing: border-box
|
|
26
|
+
} .product-cover__wrapper_pkwq0.product-cover__size-128_pkwq0 {
|
|
27
|
+
width: 213px;
|
|
28
|
+
height: 128px;
|
|
29
|
+
} .product-cover__wrapper_pkwq0.product-cover__size-40_pkwq0 {
|
|
30
|
+
width: 76px;
|
|
31
|
+
height: 56px;
|
|
32
|
+
} .product-cover__wrapper_pkwq0.product-cover__size-32_pkwq0 {
|
|
33
|
+
width: 55px;
|
|
34
|
+
height: 48px;
|
|
35
|
+
} .product-cover__wrapper_pkwq0.product-cover__size-16_pkwq0 {
|
|
36
|
+
width: 28px;
|
|
37
|
+
height: 20px;
|
|
38
|
+
} .product-cover__wrapper_pkwq0.product-cover__size-40_pkwq0.product-cover__bottom_pkwq0 {
|
|
39
|
+
width: 65px;
|
|
40
|
+
height: 48px;
|
|
41
|
+
} .product-cover__componentImage_pkwq0 {
|
|
42
|
+
align-items: center;
|
|
43
|
+
} .product-cover__componentStack_pkwq0.product-cover__size-128_pkwq0 {
|
|
44
|
+
padding-left: var(--gap-xs);
|
|
45
|
+
} .product-cover__firstCard_pkwq0 {
|
|
46
|
+
z-index: 4
|
|
47
|
+
} .product-cover__firstCard_pkwq0.product-cover__size-32_pkwq0 {
|
|
48
|
+
margin-top: var(--gap-2xs);
|
|
49
|
+
} .product-cover__firstCard_pkwq0.product-cover__size-40_pkwq0.product-cover__bottom_pkwq0 {
|
|
50
|
+
margin-left: -7px;
|
|
51
|
+
margin-top: var(--gap-2xs);
|
|
52
|
+
} .product-cover__wrapperSecondCard_pkwq0.product-cover__size-128_pkwq0 {
|
|
53
|
+
width: 213px;
|
|
54
|
+
padding-left: var(--gap-xs);
|
|
55
|
+
margin-top: 18px;
|
|
56
|
+
margin-left: -221px;
|
|
57
|
+
} .product-cover__wrapperSecondCard_pkwq0.product-cover__size-40_pkwq0 {
|
|
58
|
+
margin-top: var(--gap-m);
|
|
59
|
+
margin-left: -54px;
|
|
60
|
+
} .product-cover__wrapperSecondCard_pkwq0.product-cover__size-32_pkwq0 {
|
|
61
|
+
margin-top: var(--gap-s);
|
|
62
|
+
margin-left: -47px;
|
|
63
|
+
} .product-cover__wrapperSecondCard_pkwq0.product-cover__size-16_pkwq0 {
|
|
64
|
+
margin-top: var(--gap-2xs);
|
|
65
|
+
margin-left: var(--gap-l-neg);
|
|
66
|
+
} .product-cover__wrapperSecondCard_pkwq0.product-cover__size-40_pkwq0.product-cover__bottom_pkwq0 {
|
|
67
|
+
margin-top: var(--gap-m);
|
|
68
|
+
margin-left: -58px;
|
|
69
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Component";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Stack } from './Component.js';
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { ElementType, HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
type Size = 16 | 32 | 40 | 48 | 96 | 128 | 164;
|
|
3
|
+
type OverlayProps = {
|
|
4
|
+
/**
|
|
5
|
+
* Набор цветов для компонента
|
|
6
|
+
*/
|
|
7
|
+
colors?: 'default' | 'inverted';
|
|
8
|
+
/**
|
|
9
|
+
* Управление видимостью
|
|
10
|
+
*/
|
|
11
|
+
visible?: boolean;
|
|
12
|
+
};
|
|
13
|
+
type SingleCommonProps = {
|
|
14
|
+
/**
|
|
15
|
+
* Размер
|
|
16
|
+
*/
|
|
17
|
+
size?: Size;
|
|
18
|
+
/**
|
|
19
|
+
* Идентификатор карты
|
|
20
|
+
* (например: RM,SQ,SR)
|
|
21
|
+
*/
|
|
22
|
+
cardId?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Базовый URL сервиса с изображениями
|
|
25
|
+
* (например: https://online.alfabank.ru/cards-images/cards/)
|
|
26
|
+
*/
|
|
27
|
+
baseUrl?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Какие слои показывать, через запятую без пробелов
|
|
30
|
+
* (полный набор: BACKGROUND,CARD_NUMBER,CARD_HOLDER,PAY_PASS,CHIP,LOGO,PAYMENT_SYSTEM,RESERVED_1,RESERVED_2,VALID_DATE)
|
|
31
|
+
*/
|
|
32
|
+
layers?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Слот для иконки с оверлеем
|
|
35
|
+
*/
|
|
36
|
+
icon?: ElementType;
|
|
37
|
+
/**
|
|
38
|
+
* Тень для компонента
|
|
39
|
+
*/
|
|
40
|
+
shadow?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Цвет иконки
|
|
43
|
+
*/
|
|
44
|
+
iconColor?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Фон для компонента
|
|
47
|
+
*/
|
|
48
|
+
backgroundColor?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Бордер для компонента
|
|
51
|
+
*/
|
|
52
|
+
borderColor?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Настройки оверлея
|
|
55
|
+
*/
|
|
56
|
+
overlayProps?: OverlayProps;
|
|
57
|
+
/**
|
|
58
|
+
* Кнопка показать номер карты
|
|
59
|
+
*/
|
|
60
|
+
eyeButton?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Дополнительный класс
|
|
63
|
+
*/
|
|
64
|
+
className?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Имя владельца карты в верхнем регистре
|
|
67
|
+
*/
|
|
68
|
+
cardholderNameUppercase?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Имя владельца карты
|
|
71
|
+
*/
|
|
72
|
+
cardholderName?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Номер карты
|
|
75
|
+
*/
|
|
76
|
+
cardNumber?: number;
|
|
77
|
+
/**
|
|
78
|
+
* Количество карт
|
|
79
|
+
*/
|
|
80
|
+
numberOfСards?: number;
|
|
81
|
+
/**
|
|
82
|
+
* Управление ориентацией стопки карт компонента
|
|
83
|
+
*/
|
|
84
|
+
align?: 'bottom' | 'default';
|
|
85
|
+
/**
|
|
86
|
+
* Слот для кастомного контента компонента
|
|
87
|
+
*/
|
|
88
|
+
contentAddons?: ReactNode;
|
|
89
|
+
/**
|
|
90
|
+
* Свойства для обертки кастомного контента
|
|
91
|
+
*/
|
|
92
|
+
contentAddonsProps?: HTMLAttributes<HTMLDivElement>;
|
|
93
|
+
/**
|
|
94
|
+
* Обработчик клика по кнопке 'показать номер карты'
|
|
95
|
+
*/
|
|
96
|
+
onEyeIconClick?: () => void;
|
|
97
|
+
/**
|
|
98
|
+
* Идентификатор для систем автоматизированного тестирования
|
|
99
|
+
*/
|
|
100
|
+
dataTestId?: string;
|
|
101
|
+
};
|
|
102
|
+
type SingleProps = Omit<SingleCommonProps, 'numberOfСards' | 'align'>;
|
|
103
|
+
type BankCardImageProps = Omit<SingleCommonProps, 'size' | 'numberOfСards' | 'className' | 'dataTestId' | 'align'>;
|
|
104
|
+
type SizeStack = Exclude<Size, 48 | 96 | 164>;
|
|
105
|
+
type ConditionalProps = {
|
|
106
|
+
/**
|
|
107
|
+
* Размер
|
|
108
|
+
*/
|
|
109
|
+
size?: SizeStack;
|
|
110
|
+
/**
|
|
111
|
+
* Управление ориентацией стопки карт компонента
|
|
112
|
+
* для размеров 16, 32 - default (ориентация только вправо и вниз)
|
|
113
|
+
* для размера 40 - default или bottom (ориентация вправо и вниз или вниз)
|
|
114
|
+
* для размера 164 - default (ориентация только влево)
|
|
115
|
+
* @default default
|
|
116
|
+
*/
|
|
117
|
+
align?: 'default';
|
|
118
|
+
} | {
|
|
119
|
+
size?: 40;
|
|
120
|
+
align?: 'bottom' | 'default';
|
|
121
|
+
};
|
|
122
|
+
type StackProps = ConditionalProps & {
|
|
123
|
+
/**
|
|
124
|
+
* Дополнительный класс
|
|
125
|
+
*/
|
|
126
|
+
className?: string;
|
|
127
|
+
/**
|
|
128
|
+
* Свойства для первой карты
|
|
129
|
+
*/
|
|
130
|
+
firstCard?: BankCardImageProps;
|
|
131
|
+
/**
|
|
132
|
+
* Свойства для второй карты
|
|
133
|
+
*/
|
|
134
|
+
secondCard?: BankCardImageProps;
|
|
135
|
+
/**
|
|
136
|
+
* Количество карт
|
|
137
|
+
*/
|
|
138
|
+
numberOfСards?: number;
|
|
139
|
+
/**
|
|
140
|
+
* Идентификатор для систем автоматизированного тестирования
|
|
141
|
+
*/
|
|
142
|
+
dataTestId?: string;
|
|
143
|
+
};
|
|
144
|
+
export { Size, OverlayProps, SingleCommonProps, SingleProps, BankCardImageProps, SizeStack, ConditionalProps, StackProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare function getProductCoverSingleTestIds(dataTestId: string): {
|
|
2
|
+
productCoverSingle: string;
|
|
3
|
+
userInfo: string;
|
|
4
|
+
userInfoEye: string;
|
|
5
|
+
};
|
|
6
|
+
declare function getProductCoverStackTestIds(dataTestId: string): {
|
|
7
|
+
productCoverStack: string;
|
|
8
|
+
firstCard: string;
|
|
9
|
+
secondCard: string;
|
|
10
|
+
userInfoFirstCard: string;
|
|
11
|
+
userInfoSecondCard: string;
|
|
12
|
+
};
|
|
13
|
+
declare const showNumberOfСards: (sizeCard: number, numberOfСards?: number, align?: string) => boolean;
|
|
14
|
+
declare const getSizeSecondCard: (size: number, align: string) => number;
|
|
15
|
+
export { getProductCoverSingleTestIds, getProductCoverStackTestIds, showNumberOfСards, getSizeSecondCard };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { getDataTestId } from '@alfalab/core-components-shared/modern';
|
|
2
|
+
import { SECOND_CARD_SIZE } from '../consts.js';
|
|
3
|
+
|
|
4
|
+
function getProductCoverSingleTestIds(dataTestId) {
|
|
5
|
+
return {
|
|
6
|
+
productCoverSingle: dataTestId,
|
|
7
|
+
userInfo: getDataTestId(dataTestId, 'user-info'),
|
|
8
|
+
userInfoEye: getDataTestId(dataTestId, 'user-info-eye-btn'),
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
function getProductCoverStackTestIds(dataTestId) {
|
|
12
|
+
return {
|
|
13
|
+
productCoverStack: dataTestId,
|
|
14
|
+
firstCard: getDataTestId(dataTestId, 'first-card'),
|
|
15
|
+
secondCard: getDataTestId(dataTestId, 'second-card'),
|
|
16
|
+
userInfoFirstCard: getDataTestId(dataTestId, 'first-card-user-info'),
|
|
17
|
+
userInfoSecondCard: getDataTestId(dataTestId, 'second-card-user-info'),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
const showNumberOfСards = (sizeCard, numberOfСards, align) => {
|
|
21
|
+
if (numberOfСards) {
|
|
22
|
+
return numberOfСards >= 2 && numberOfСards < 10 && sizeCard === 40 && align === 'default';
|
|
23
|
+
}
|
|
24
|
+
return false;
|
|
25
|
+
};
|
|
26
|
+
const getSizeSecondCard = (size, align) => {
|
|
27
|
+
if (align === 'bottom' && size === 40)
|
|
28
|
+
return 32;
|
|
29
|
+
return SECOND_CARD_SIZE[size];
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { getProductCoverSingleTestIds, getProductCoverStackTestIds, getSizeSecondCard, showNumberOfСards };
|
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@alfalab/core-components-product-cover",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "ProductCover component",
|
|
5
|
+
"keywords": [],
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"main": "index.js",
|
|
8
|
+
"module": "./esm/index.js",
|
|
9
|
+
"publishConfig": {
|
|
10
|
+
"access": "public",
|
|
11
|
+
"directory": "dist"
|
|
12
|
+
},
|
|
13
|
+
"peerDependencies": {
|
|
14
|
+
"react": "^16.9.0 || ^17.0.1 || ^18.0.0",
|
|
15
|
+
"react-dom": "^16.9.0 || ^17.0.1 || ^18.0.0"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@alfalab/core-components-button": "^11.4.1",
|
|
19
|
+
"@alfalab/core-components-typography": "^4.5.0",
|
|
20
|
+
"@alfalab/core-components-shared": "^0.9.1",
|
|
21
|
+
"@alfalab/icons-glyph": "^2.139.0",
|
|
22
|
+
"@alfalab/hooks": "^1.13.0",
|
|
23
|
+
"@alfalab/utils": "^1.15.2",
|
|
24
|
+
"classnames": "^2.3.1",
|
|
25
|
+
"tslib": "^2.4.0"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getProductCoverSingleTestIds, getProductCoverStackTestIds } from "../utils/index";
|