@alfalab/core-components-pure-cell 6.0.3 → 6.0.4
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 +34 -36
- package/component.js.map +1 -1
- package/components/addon/component.d.ts +1 -1
- package/components/addon/index.css +12 -12
- package/components/addon/index.module.css.js +1 -1
- package/components/amount/component.d.ts +1 -1
- package/components/amount/component.js.map +1 -1
- package/components/amount/index.css +3 -3
- package/components/amount/index.module.css.js +1 -1
- package/components/amount/index.module.css.js.map +1 -1
- package/components/amount-title/component.d.ts +1 -1
- package/components/amount-title/component.js.map +1 -1
- package/components/amount-title/index.css +13 -13
- package/components/amount-title/index.module.css.js +1 -1
- package/components/amount-title/index.module.css.js.map +1 -1
- package/components/category/component.d.ts +1 -1
- package/components/category/index.css +4 -4
- package/components/category/index.module.css.js +1 -1
- package/components/category/index.module.css.js.map +1 -1
- package/components/content/component.d.ts +1 -1
- package/components/content/index.css +2 -2
- package/components/content/index.module.css.js +1 -1
- package/components/content/index.module.css.js.map +1 -1
- package/components/footer/component.d.ts +1 -1
- package/components/footer/index.css +3 -3
- package/components/footer/index.module.css.js +1 -1
- package/components/footer/index.module.css.js.map +1 -1
- package/components/footer-button/component.d.ts +3 -3
- package/components/footer-button/index.css +1 -1
- package/components/footer-button/index.module.css.js +1 -1
- package/components/footer-button/index.module.css.js.map +1 -1
- package/components/footer-text/component.d.ts +1 -1
- package/components/graphics/component.d.ts +1 -1
- package/components/graphics/index.css +19 -19
- package/components/graphics/index.module.css.js +1 -1
- package/components/main/component.d.ts +1 -1
- package/components/main/index.css +6 -6
- package/components/main/index.module.css.js +1 -1
- package/components/text/component.d.ts +1 -1
- package/components/text/index.css +6 -6
- package/components/text/index.module.css.js +1 -1
- package/components/text/index.module.css.js.map +1 -1
- package/components/types.d.ts +12 -12
- package/components/typesProps.d.ts +1 -1
- package/context.d.ts +1 -2
- package/cssm/component.d.ts +33 -35
- package/cssm/component.js.map +1 -1
- package/cssm/components/addon/component.d.ts +1 -1
- package/cssm/components/amount/component.d.ts +1 -1
- package/cssm/components/amount/component.js.map +1 -1
- package/cssm/components/amount-title/component.d.ts +1 -1
- package/cssm/components/amount-title/component.js.map +1 -1
- package/cssm/components/category/component.d.ts +1 -1
- package/cssm/components/content/component.d.ts +1 -1
- package/cssm/components/footer/component.d.ts +1 -1
- package/cssm/components/footer-button/component.d.ts +2 -2
- package/cssm/components/footer-text/component.d.ts +1 -1
- package/cssm/components/graphics/component.d.ts +1 -1
- package/cssm/components/main/component.d.ts +1 -1
- package/cssm/components/text/component.d.ts +1 -1
- package/cssm/components/types.d.ts +12 -12
- package/cssm/components/typesProps.d.ts +1 -1
- package/cssm/context.d.ts +1 -2
- package/esm/component.d.ts +33 -35
- package/esm/component.js.map +1 -1
- package/esm/components/addon/component.d.ts +1 -1
- package/esm/components/addon/index.css +12 -12
- package/esm/components/addon/index.module.css.js +1 -1
- package/esm/components/amount/component.d.ts +1 -1
- package/esm/components/amount/component.js.map +1 -1
- package/esm/components/amount/index.css +3 -3
- package/esm/components/amount/index.module.css.js +1 -1
- package/esm/components/amount/index.module.css.js.map +1 -1
- package/esm/components/amount-title/component.d.ts +1 -1
- package/esm/components/amount-title/component.js.map +1 -1
- package/esm/components/amount-title/index.css +13 -13
- package/esm/components/amount-title/index.module.css.js +1 -1
- package/esm/components/amount-title/index.module.css.js.map +1 -1
- package/esm/components/category/component.d.ts +1 -1
- package/esm/components/category/index.css +4 -4
- package/esm/components/category/index.module.css.js +1 -1
- package/esm/components/category/index.module.css.js.map +1 -1
- package/esm/components/content/component.d.ts +1 -1
- package/esm/components/content/index.css +2 -2
- package/esm/components/content/index.module.css.js +1 -1
- package/esm/components/content/index.module.css.js.map +1 -1
- package/esm/components/footer/component.d.ts +1 -1
- package/esm/components/footer/index.css +3 -3
- package/esm/components/footer/index.module.css.js +1 -1
- package/esm/components/footer/index.module.css.js.map +1 -1
- package/esm/components/footer-button/component.d.ts +2 -2
- package/esm/components/footer-button/index.css +1 -1
- package/esm/components/footer-button/index.module.css.js +1 -1
- package/esm/components/footer-button/index.module.css.js.map +1 -1
- package/esm/components/footer-text/component.d.ts +1 -1
- package/esm/components/graphics/component.d.ts +1 -1
- package/esm/components/graphics/index.css +19 -19
- package/esm/components/graphics/index.module.css.js +1 -1
- package/esm/components/main/component.d.ts +1 -1
- package/esm/components/main/index.css +6 -6
- package/esm/components/main/index.module.css.js +1 -1
- package/esm/components/text/component.d.ts +1 -1
- package/esm/components/text/index.css +6 -6
- package/esm/components/text/index.module.css.js +1 -1
- package/esm/components/text/index.module.css.js.map +1 -1
- package/esm/components/types.d.ts +12 -12
- package/esm/components/typesProps.d.ts +1 -1
- package/esm/context.d.ts +1 -2
- package/esm/index.css +28 -28
- package/esm/index.module.css.js +1 -1
- package/esm/index.module.css.js.map +1 -1
- package/index.css +28 -28
- package/index.module.css.js +1 -1
- package/index.module.css.js.map +1 -1
- package/modern/component.d.ts +33 -35
- package/modern/component.js.map +1 -1
- package/modern/components/addon/component.d.ts +1 -1
- package/modern/components/addon/index.css +12 -12
- package/modern/components/addon/index.module.css.js +1 -1
- package/modern/components/amount/component.d.ts +1 -1
- package/modern/components/amount/component.js.map +1 -1
- package/modern/components/amount/index.css +3 -3
- package/modern/components/amount/index.module.css.js +1 -1
- package/modern/components/amount/index.module.css.js.map +1 -1
- package/modern/components/amount-title/component.d.ts +1 -1
- package/modern/components/amount-title/component.js.map +1 -1
- package/modern/components/amount-title/index.css +13 -13
- package/modern/components/amount-title/index.module.css.js +1 -1
- package/modern/components/amount-title/index.module.css.js.map +1 -1
- package/modern/components/category/component.d.ts +1 -1
- package/modern/components/category/index.css +4 -4
- package/modern/components/category/index.module.css.js +1 -1
- package/modern/components/category/index.module.css.js.map +1 -1
- package/modern/components/content/component.d.ts +1 -1
- package/modern/components/content/index.css +2 -2
- package/modern/components/content/index.module.css.js +1 -1
- package/modern/components/content/index.module.css.js.map +1 -1
- package/modern/components/footer/component.d.ts +1 -1
- package/modern/components/footer/index.css +3 -3
- package/modern/components/footer/index.module.css.js +1 -1
- package/modern/components/footer/index.module.css.js.map +1 -1
- package/modern/components/footer-button/component.d.ts +2 -2
- package/modern/components/footer-button/index.css +1 -1
- package/modern/components/footer-button/index.module.css.js +1 -1
- package/modern/components/footer-button/index.module.css.js.map +1 -1
- package/modern/components/footer-text/component.d.ts +1 -1
- package/modern/components/graphics/component.d.ts +1 -1
- package/modern/components/graphics/index.css +19 -19
- package/modern/components/graphics/index.module.css.js +1 -1
- package/modern/components/main/component.d.ts +1 -1
- package/modern/components/main/index.css +6 -6
- package/modern/components/main/index.module.css.js +1 -1
- package/modern/components/text/component.d.ts +1 -1
- package/modern/components/text/index.css +6 -6
- package/modern/components/text/index.module.css.js +1 -1
- package/modern/components/text/index.module.css.js.map +1 -1
- package/modern/components/types.d.ts +12 -12
- package/modern/components/typesProps.d.ts +1 -1
- package/modern/context.d.ts +1 -2
- package/modern/index.css +28 -28
- package/modern/index.module.css.js +1 -1
- package/modern/index.module.css.js.map +1 -1
- package/moderncssm/component.d.ts +33 -35
- package/moderncssm/component.js.map +1 -1
- package/moderncssm/components/addon/component.d.ts +1 -1
- package/moderncssm/components/amount/component.d.ts +1 -1
- package/moderncssm/components/amount/component.js.map +1 -1
- package/moderncssm/components/amount-title/component.d.ts +1 -1
- package/moderncssm/components/amount-title/component.js.map +1 -1
- package/moderncssm/components/category/component.d.ts +1 -1
- package/moderncssm/components/content/component.d.ts +1 -1
- package/moderncssm/components/footer/component.d.ts +1 -1
- package/moderncssm/components/footer-button/component.d.ts +2 -2
- package/moderncssm/components/footer-text/component.d.ts +1 -1
- package/moderncssm/components/graphics/component.d.ts +1 -1
- package/moderncssm/components/main/component.d.ts +1 -1
- package/moderncssm/components/text/component.d.ts +1 -1
- package/moderncssm/components/types.d.ts +12 -12
- package/moderncssm/components/typesProps.d.ts +1 -1
- package/moderncssm/context.d.ts +1 -2
- package/package.json +7 -7
- package/src/components/amount/index.module.css +1 -1
- package/src/components/amount-title/index.module.css +1 -1
- package/src/components/category/index.module.css +1 -1
- package/src/components/content/index.module.css +1 -1
- package/src/components/footer/index.module.css +1 -1
- package/src/components/footer-button/index.module.css +1 -1
- package/src/components/text/index.module.css +1 -1
- package/src/index.module.css +1 -1
- package/src/vars.css +1 -1
|
@@ -13,7 +13,7 @@ import { Text } from './components/text';
|
|
|
13
13
|
import { type PureCellElement } from './components/types';
|
|
14
14
|
import { PureCellContext } from './context';
|
|
15
15
|
export { PureCellContext };
|
|
16
|
-
|
|
16
|
+
type BasePureCellProps = {
|
|
17
17
|
/**
|
|
18
18
|
* Направление
|
|
19
19
|
*/
|
|
@@ -56,10 +56,10 @@ declare type BasePureCellProps = {
|
|
|
56
56
|
*/
|
|
57
57
|
dataTestId?: string;
|
|
58
58
|
};
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
export
|
|
59
|
+
type AnchorPureCellProps = BasePureCellProps & AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
60
|
+
type ButtonPureCellProps = BasePureCellProps & ButtonHTMLAttributes<HTMLButtonElement>;
|
|
61
|
+
type ElementPureCellProps = BasePureCellProps & HTMLAttributes<HTMLElement>;
|
|
62
|
+
export type PureCellProps = Partial<AnchorPureCellProps | ButtonPureCellProps | ElementPureCellProps>;
|
|
63
63
|
declare const PureCellComponent: React.ForwardRefExoticComponent<PureCellProps & React.RefAttributes<HTMLElement>>;
|
|
64
64
|
declare const ExtraSubtitle: React.FC<import("./components/footer-text").FooterTextProps>;
|
|
65
65
|
/**
|
|
@@ -70,62 +70,60 @@ declare const ExtraSubtitle: React.FC<import("./components/footer-text").FooterT
|
|
|
70
70
|
declare const PureCell: React.ForwardRefExoticComponent<PureCellProps & React.RefAttributes<HTMLElement>> & {
|
|
71
71
|
Main: React.FC<{
|
|
72
72
|
children: import("./components/types").MainElement;
|
|
73
|
-
isReverse?: boolean
|
|
74
|
-
className?: string
|
|
75
|
-
dataTestId?: string
|
|
76
|
-
onClick?: (
|
|
73
|
+
isReverse?: boolean;
|
|
74
|
+
className?: string;
|
|
75
|
+
dataTestId?: string;
|
|
76
|
+
onClick?: () => void;
|
|
77
77
|
}>;
|
|
78
78
|
Graphics: React.FC<import("./components/graphics").Props>;
|
|
79
79
|
Content: React.FC<{
|
|
80
80
|
children: import("./components/types").ContentElement;
|
|
81
|
-
dataTestId?: string
|
|
81
|
+
dataTestId?: string;
|
|
82
82
|
}>;
|
|
83
83
|
Text: React.FC<{
|
|
84
84
|
children?: React.ReactNode;
|
|
85
|
-
rowLimit?: 1 | 2
|
|
86
|
-
view?: "
|
|
87
|
-
titleWeight?: "
|
|
88
|
-
titleColor: "
|
|
85
|
+
rowLimit?: 1 | 2;
|
|
86
|
+
view?: "primary-large" | "primary-medium" | "primary-small" | "component-primary" | "component-secondary" | "secondary-large";
|
|
87
|
+
titleWeight?: "regular" | "bold";
|
|
88
|
+
titleColor: import("@alfalab/core-components-typography").Color;
|
|
89
89
|
value?: React.ReactNode;
|
|
90
|
-
valueColor?: "
|
|
91
|
-
dataTestId?: string
|
|
92
|
-
* Направление
|
|
93
|
-
*/
|
|
90
|
+
valueColor?: import("@alfalab/core-components-typography").Color;
|
|
91
|
+
dataTestId?: string;
|
|
94
92
|
}>;
|
|
95
93
|
Amount: React.FC<{
|
|
96
|
-
weight?: "bold" | "normal"
|
|
97
|
-
textView?: "component-primary" | "primary-small"
|
|
98
|
-
color?: "
|
|
99
|
-
hidden?: boolean
|
|
100
|
-
dataTestId?: string
|
|
94
|
+
weight?: "bold" | "normal";
|
|
95
|
+
textView?: "component-primary" | "primary-small";
|
|
96
|
+
color?: import("@alfalab/core-components-typography").Color;
|
|
97
|
+
hidden?: boolean;
|
|
98
|
+
dataTestId?: string;
|
|
101
99
|
} & Omit<import("./components/typesProps").AmountProps, "dataTestId">>;
|
|
102
100
|
AmountTitle: React.FC<{
|
|
103
|
-
titleProps?: import("@alfalab/core-components-typography").TitleProps
|
|
104
|
-
hidden?: boolean
|
|
105
|
-
dataTestId?: string
|
|
101
|
+
titleProps?: import("@alfalab/core-components-typography").TitleProps;
|
|
102
|
+
hidden?: boolean;
|
|
103
|
+
dataTestId?: string;
|
|
106
104
|
} & Omit<import("./components/typesProps").AmountProps, "dataTestId">>;
|
|
107
105
|
Addon: React.FC<{
|
|
108
|
-
verticalAlign?: "
|
|
109
|
-
addonPadding?: "default" | "none"
|
|
106
|
+
verticalAlign?: "auto" | "top" | "center" | "bottom";
|
|
107
|
+
addonPadding?: "default" | "none";
|
|
110
108
|
children: import("./components/types").AddonElement;
|
|
111
|
-
dataTestId?: string
|
|
112
|
-
onClick?: (
|
|
109
|
+
dataTestId?: string;
|
|
110
|
+
onClick?: () => void;
|
|
113
111
|
}>;
|
|
114
112
|
Footer: React.FC<{
|
|
115
113
|
children: import("./components/types").FooterElement;
|
|
116
|
-
footerPadding?: "default" | "none"
|
|
117
|
-
dataTestId?: string
|
|
114
|
+
footerPadding?: "default" | "none";
|
|
115
|
+
dataTestId?: string;
|
|
118
116
|
}>;
|
|
119
117
|
ExtraSubtitle: React.FC<import("./components/footer-text").FooterTextProps>;
|
|
120
118
|
FooterButton: React.ForwardRefExoticComponent<(Omit<import("@alfalab/core-components-button").ButtonProps, "dataTestId"> & {
|
|
121
|
-
dataTestId?: string
|
|
119
|
+
dataTestId?: string;
|
|
122
120
|
} & Partial<React.AnchorHTMLAttributes<HTMLAnchorElement> | React.ButtonHTMLAttributes<HTMLButtonElement>>) & React.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
|
|
123
121
|
Comment: React.FC<import("@alfalab/core-components-comment").CommentProps>;
|
|
124
122
|
Category: React.FC<{
|
|
125
123
|
categoryName: string;
|
|
126
|
-
categoryPercent?: number
|
|
124
|
+
categoryPercent?: number;
|
|
127
125
|
rightAddons?: React.ReactNode;
|
|
128
|
-
dataTestId?: string
|
|
126
|
+
dataTestId?: string;
|
|
129
127
|
}>;
|
|
130
128
|
};
|
|
131
129
|
export { PureCell, PureCellComponent, Main, Graphics, Content, Text, Amount, AmountTitle, Addon, Footer, ExtraSubtitle, FooterButton, Comment, Category, };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../src/component.tsx"],"sourcesContent":["import React, {\n type AnchorHTMLAttributes,\n type ButtonHTMLAttributes,\n type ElementType,\n forwardRef,\n type HTMLAttributes,\n useRef,\n useState,\n} from 'react';\nimport mergeRefs from 'react-merge-refs';\nimport cn from 'classnames';\n\nimport { Comment } from '@alfalab/core-components-comment';\nimport { useFocus } from '@alfalab/hooks';\n\nimport { Addon } from './components/addon';\nimport { Amount } from './components/amount';\nimport { AmountTitle } from './components/amount-title';\nimport { Category } from './components/category';\nimport { Content } from './components/content';\nimport { Footer } from './components/footer';\nimport { FooterButton } from './components/footer-button';\nimport { FooterText } from './components/footer-text';\nimport { Graphics } from './components/graphics';\nimport { Main } from './components/main';\nimport { Text } from './components/text';\nimport { type PureCellElement } from './components/types';\nimport { PureCellContext, type PureCellContextValue } from './context';\n\nimport styles from './index.module.css';\n\nexport { PureCellContext };\n\ntype BasePureCellProps = {\n /**\n * Направление\n */\n direction?: 'horizontal' | 'vertical';\n\n /**\n * Сss класс для стилизации общей обёртки\n */\n className?: string;\n\n /**\n * Выводит ссылку в виде ячейки\n */\n href?: string;\n\n /**\n * Вертикальные отступы\n */\n verticalPadding?:\n | 'airy'\n | 'default'\n | 'compact'\n | 'tiny'\n | 'none'\n | {\n /**\n * Вертикальный отступ сверху\n */\n top?: 'airy' | 'default' | 'compact' | 'tiny' | 'none';\n /**\n * Вертикальный отступ снизу\n */\n bottom?: 'airy' | 'default' | 'compact' | 'tiny' | 'none';\n };\n\n /**\n * Горизонтальные отступы\n */\n horizontalPadding?: 'left' | 'right' | 'both' | 'none';\n\n /**\n * Позволяет использовать кастомный компонент для кнопки (например Link из роутера)\n */\n tag?: ElementType;\n\n /**\n * Компоненты\n */\n children: PureCellElement;\n\n /**\n * Идентификатор для систем автоматизированного тестирования\n */\n dataTestId?: string;\n};\ntype AnchorPureCellProps = BasePureCellProps & AnchorHTMLAttributes<HTMLAnchorElement>;\ntype ButtonPureCellProps = BasePureCellProps & ButtonHTMLAttributes<HTMLButtonElement>;\ntype ElementPureCellProps = BasePureCellProps & HTMLAttributes<HTMLElement>;\nexport type PureCellProps = Partial<\n AnchorPureCellProps | ButtonPureCellProps | ElementPureCellProps\n>;\n\nconst PureCellComponent = forwardRef<HTMLElement, PureCellProps>(\n (\n {\n className,\n dataTestId,\n onClick,\n href,\n tag: Component = (href && 'a') || (onClick && 'button') || 'section',\n children,\n horizontalPadding = 'none',\n verticalPadding = 'none',\n direction = 'horizontal',\n ...restProps\n },\n ref,\n ) => {\n const cellRef = useRef<HTMLDivElement>(null);\n const [focused] = useFocus(cellRef, 'keyboard');\n const [hoverState, setHoverState] = useState<boolean>(false);\n const [activeState, setActiveState] = useState<boolean>(false);\n\n const setHover = () => setHoverState(true);\n const unsetHover = () => setHoverState(false);\n const setActive = () => setActiveState(true);\n\n const unsetActive = () => setActiveState(false);\n\n const mouseEvents = {\n onMouseEnter: setHover,\n onMouseLeave: () => {\n unsetHover();\n // Убираем на случай, если уводим курсор за пределы компонента при сработавшем onMouseDown\n unsetActive();\n },\n onMouseDown: setActive,\n onMouseUp: unsetActive,\n };\n\n const addClasses = {\n [styles.component]: true,\n [styles.focused]: focused,\n [styles[direction]]: true,\n [styles[horizontalPadding]]: true,\n [styles.hover]: hoverState,\n [styles.active]: activeState,\n };\n\n // eslint-disable-next-line react/jsx-no-constructed-context-values\n const contextState: PureCellContextValue = {\n direction,\n dataTestId,\n setMainHover: setHover,\n unsetMainHover: unsetHover,\n };\n\n if (typeof verticalPadding === 'string') {\n addClasses[styles[verticalPadding as string]] = typeof verticalPadding === 'string';\n }\n\n if (typeof verticalPadding === 'object') {\n addClasses[styles[`${verticalPadding.top}Top`]] = !!verticalPadding.top;\n addClasses[styles[`${verticalPadding.bottom}Bottom`]] = !!verticalPadding.bottom;\n }\n\n if (href) {\n const { target } = restProps as AnchorHTMLAttributes<HTMLAnchorElement>;\n\n // Для совместимости с react-router-dom, меняем href на to\n const hrefProps = { [typeof Component === 'string' ? 'href' : 'to']: href };\n\n return (\n <Component\n rel={target === '_blank' ? 'noreferrer noopener' : undefined}\n {...(restProps as AnchorHTMLAttributes<HTMLAnchorElement>)}\n {...hrefProps}\n ref={mergeRefs([cellRef, ref])}\n className={cn(styles.link, addClasses, className)}\n data-test-id={dataTestId}\n onClick={onClick}\n {...mouseEvents}\n >\n <PureCellContext.Provider value={contextState}>\n {children}\n </PureCellContext.Provider>\n </Component>\n );\n }\n\n if (onClick) {\n return (\n <Component\n {...(restProps as AnchorHTMLAttributes<HTMLAnchorElement>)}\n ref={mergeRefs([cellRef, ref])}\n className={cn(styles.button, addClasses, className)}\n data-test-id={dataTestId}\n onClick={onClick}\n {...mouseEvents}\n >\n <PureCellContext.Provider value={contextState}>\n {children}\n </PureCellContext.Provider>\n </Component>\n );\n }\n\n return (\n <Component\n {...(restProps as AnchorHTMLAttributes<HTMLAnchorElement>)}\n ref={ref}\n tabIndex={0}\n className={cn(addClasses, className)}\n data-test-id={dataTestId}\n >\n <PureCellContext.Provider value={contextState}>{children}</PureCellContext.Provider>\n </Component>\n );\n },\n);\n\nconst ExtraSubtitle = FooterText;\n\n/**\n * Универсальный конструктор для сборки любой ячейки.\n *\n * [Макет](https://www.figma.com/file/KlFOLLkKO8rtvvQE3RXuhq/Click-Library?node-id=43525%3A240018)\n */\nconst PureCell = Object.assign(PureCellComponent, {\n Main,\n Graphics,\n Content,\n Text,\n Amount,\n AmountTitle,\n Addon,\n Footer,\n ExtraSubtitle,\n FooterButton,\n Comment,\n Category,\n});\n\nPureCellComponent.displayName = 'PureCellComponent';\n\nexport {\n PureCell,\n PureCellComponent,\n Main,\n Graphics,\n Content,\n Text,\n Amount,\n AmountTitle,\n Addon,\n Footer,\n ExtraSubtitle,\n FooterButton,\n Comment,\n Category,\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAgGM,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React, {\n type AnchorHTMLAttributes,\n type ButtonHTMLAttributes,\n type ElementType,\n forwardRef,\n type HTMLAttributes,\n useRef,\n useState,\n} from 'react';\nimport mergeRefs from 'react-merge-refs';\nimport cn from 'classnames';\n\nimport { Comment } from '@alfalab/core-components-comment';\nimport { useFocus } from '@alfalab/hooks';\n\nimport { Addon } from './components/addon';\nimport { Amount } from './components/amount';\nimport { AmountTitle } from './components/amount-title';\nimport { Category } from './components/category';\nimport { Content } from './components/content';\nimport { Footer } from './components/footer';\nimport { FooterButton } from './components/footer-button';\nimport { FooterText } from './components/footer-text';\nimport { Graphics } from './components/graphics';\nimport { Main } from './components/main';\nimport { Text } from './components/text';\nimport { type PureCellElement } from './components/types';\nimport { PureCellContext, type PureCellContextValue } from './context';\n\nimport styles from './index.module.css';\n\nexport { PureCellContext };\n\ntype BasePureCellProps = {\n /**\n * Направление\n */\n direction?: 'horizontal' | 'vertical';\n\n /**\n * Сss класс для стилизации общей обёртки\n */\n className?: string;\n\n /**\n * Выводит ссылку в виде ячейки\n */\n href?: string;\n\n /**\n * Вертикальные отступы\n */\n verticalPadding?:\n | 'airy'\n | 'default'\n | 'compact'\n | 'tiny'\n | 'none'\n | {\n /**\n * Вертикальный отступ сверху\n */\n top?: 'airy' | 'default' | 'compact' | 'tiny' | 'none';\n /**\n * Вертикальный отступ снизу\n */\n bottom?: 'airy' | 'default' | 'compact' | 'tiny' | 'none';\n };\n\n /**\n * Горизонтальные отступы\n */\n horizontalPadding?: 'left' | 'right' | 'both' | 'none';\n\n /**\n * Позволяет использовать кастомный компонент для кнопки (например Link из роутера)\n */\n tag?: ElementType;\n\n /**\n * Компоненты\n */\n children: PureCellElement;\n\n /**\n * Идентификатор для систем автоматизированного тестирования\n */\n dataTestId?: string;\n};\ntype AnchorPureCellProps = BasePureCellProps & AnchorHTMLAttributes<HTMLAnchorElement>;\ntype ButtonPureCellProps = BasePureCellProps & ButtonHTMLAttributes<HTMLButtonElement>;\ntype ElementPureCellProps = BasePureCellProps & HTMLAttributes<HTMLElement>;\nexport type PureCellProps = Partial<\n AnchorPureCellProps | ButtonPureCellProps | ElementPureCellProps\n>;\n\nconst PureCellComponent = forwardRef<HTMLElement, PureCellProps>(\n (\n {\n className,\n dataTestId,\n onClick,\n href,\n tag: Component = (href && 'a') || (onClick && 'button') || 'section',\n children,\n horizontalPadding = 'none',\n verticalPadding = 'none',\n direction = 'horizontal',\n ...restProps\n },\n ref,\n ) => {\n const cellRef = useRef<HTMLDivElement>(null);\n const [focused] = useFocus(cellRef, 'keyboard');\n const [hoverState, setHoverState] = useState<boolean>(false);\n const [activeState, setActiveState] = useState<boolean>(false);\n\n const setHover = () => setHoverState(true);\n const unsetHover = () => setHoverState(false);\n const setActive = () => setActiveState(true);\n\n const unsetActive = () => setActiveState(false);\n\n const mouseEvents = {\n onMouseEnter: setHover,\n onMouseLeave: () => {\n unsetHover();\n // Убираем на случай, если уводим курсор за пределы компонента при сработавшем onMouseDown\n unsetActive();\n },\n onMouseDown: setActive,\n onMouseUp: unsetActive,\n };\n\n const addClasses = {\n [styles.component]: true,\n [styles.focused]: focused,\n [styles[direction]]: true,\n [styles[horizontalPadding]]: true,\n [styles.hover]: hoverState,\n [styles.active]: activeState,\n };\n\n // eslint-disable-next-line react/jsx-no-constructed-context-values\n const contextState: PureCellContextValue = {\n direction,\n dataTestId,\n setMainHover: setHover,\n unsetMainHover: unsetHover,\n };\n\n if (typeof verticalPadding === 'string') {\n addClasses[styles[verticalPadding as string]] = typeof verticalPadding === 'string';\n }\n\n if (typeof verticalPadding === 'object') {\n addClasses[styles[`${verticalPadding.top}Top`]] = !!verticalPadding.top;\n addClasses[styles[`${verticalPadding.bottom}Bottom`]] = !!verticalPadding.bottom;\n }\n\n if (href) {\n const { target } = restProps as AnchorHTMLAttributes<HTMLAnchorElement>;\n\n // Для совместимости с react-router-dom, меняем href на to\n const hrefProps = { [typeof Component === 'string' ? 'href' : 'to']: href };\n\n return (\n <Component\n rel={target === '_blank' ? 'noreferrer noopener' : undefined}\n {...(restProps as AnchorHTMLAttributes<HTMLAnchorElement>)}\n {...hrefProps}\n ref={mergeRefs([cellRef, ref])}\n className={cn(styles.link, addClasses, className)}\n data-test-id={dataTestId}\n onClick={onClick}\n {...mouseEvents}\n >\n <PureCellContext.Provider value={contextState}>\n {children}\n </PureCellContext.Provider>\n </Component>\n );\n }\n\n if (onClick) {\n return (\n <Component\n {...(restProps as AnchorHTMLAttributes<HTMLAnchorElement>)}\n ref={mergeRefs([cellRef, ref])}\n className={cn(styles.button, addClasses, className)}\n data-test-id={dataTestId}\n onClick={onClick}\n {...mouseEvents}\n >\n <PureCellContext.Provider value={contextState}>\n {children}\n </PureCellContext.Provider>\n </Component>\n );\n }\n\n return (\n <Component\n {...(restProps as AnchorHTMLAttributes<HTMLAnchorElement>)}\n ref={ref}\n tabIndex={0}\n className={cn(addClasses, className)}\n data-test-id={dataTestId}\n >\n <PureCellContext.Provider value={contextState}>{children}</PureCellContext.Provider>\n </Component>\n );\n },\n);\n\nconst ExtraSubtitle = FooterText;\n\n/**\n * Универсальный конструктор для сборки любой ячейки.\n *\n * [Макет](https://www.figma.com/file/KlFOLLkKO8rtvvQE3RXuhq/Click-Library?node-id=43525%3A240018)\n */\nconst PureCell = Object.assign(PureCellComponent, {\n Main,\n Graphics,\n Content,\n Text,\n Amount,\n AmountTitle,\n Addon,\n Footer,\n ExtraSubtitle,\n FooterButton,\n Comment,\n Category,\n});\n\nPureCellComponent.displayName = 'PureCellComponent';\n\nexport {\n PureCell,\n PureCellComponent,\n Main,\n Graphics,\n Content,\n Text,\n Amount,\n AmountTitle,\n Addon,\n Footer,\n ExtraSubtitle,\n FooterButton,\n Comment,\n Category,\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAgGM,MAAA,iBAAiB,GAAG,UAAU,CAChC,CACI,EACI,SAAS,EACT,UAAU,EACV,OAAO,EACP,IAAI,EACJ,GAAG,EAAE,SAAS,GAAG,CAAC,IAAI,IAAI,GAAG,MA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AACT,QAAA,QACI,KAAC,CAAA,aAAA,CAAA,SAAS,EACD,EAAA,GAAA,SAAqD,EAC1D,GAAG,EAAE,SAAS,CAAC,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,EAC9B,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,CAAC,EAAA,cAAA,EACrC,UAAU,EACxB,OAAO,EAAE,OAAO,KACZ,WAAW,EAAA;AAEf,YAAA,KAAA,CAAA,aAAA,CAAC,eAAe,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,YAAY,EAAA,EACxC,QAAQ,CACc,CACnB;;IAIpB,QACI,oBAAC,SAAS,EAAA,EAAA,GACD,SAAqD,EAC1D,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE,CAAC,EACX,SAAS,EAAE,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC,EAAA,cAAA,EACtB,UAAU,EAAA;AAExB,QAAA,KAAA,CAAA,aAAA,CAAC,eAAe,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,YAAY,EAAA,EAAG,QAAQ,CAA4B,CAC5E;AAEpB,CAAC;AAGC,MAAA,aAAa,GAAG;AAEtB;;;;AAIG;AACH,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,iBAAiB,EAAE;IAC9C,IAAI;IACJ,QAAQ;IACR,OAAO;IACP,IAAI;IACJ,MAAM;IACN,WAAW;IACX,KAAK;IACL,MAAM;IACN,aAAa;IACb,YAAY;IACZ,OAAO;IACP,QAAQ;AACX,CAAA;AAED,iBAAiB,CAAC,WAAW,GAAG,mBAAmB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../../src/components/amount/component.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport cn from 'classnames';\n\nimport { Amount as CoreAmount } from '@alfalab/core-components-amount';\nimport { getDataTestId } from '@alfalab/core-components-shared';\nimport { type Color, TypographyText } from '@alfalab/core-components-typography';\n\nimport { PureCellContext } from '../../context';\nimport { type AmountProps as AmountType } from '../typesProps';\n\nimport styles from './index.module.css';\n\ntype Props = {\n /**\n * Начертание шрифта денежного значения\n */\n weight?: 'bold' | 'normal';\n\n /**\n * Размер денежного значения\n */\n textView?: 'component-primary' | 'primary-small';\n\n /**\n * Цвет денежного значения\n */\n color?: Color;\n\n /**\n * Скрыть денежное значение\n */\n hidden?: boolean;\n\n /**\n * Идентификатор для систем автоматизированного тестирования.\n * Для typography используется модификатор -amount-text, для компонента Amount -amount\n */\n dataTestId?: string;\n} & Omit<AmountType, 'dataTestId'>;\n\nexport const Amount: React.FC<Props> = ({\n weight = 'normal',\n textView = 'component-primary',\n color = 'primary',\n minority,\n minorUnits = 100,\n hidden,\n dataTestId,\n ...restProps\n}) => {\n const pureCellContext = useContext(PureCellContext);\n\n if (hidden) {\n return (\n <div className={styles.hiddenWrapper}>\n <div className={styles.hidden} />\n </div>\n );\n }\n\n return (\n <TypographyText\n view={textView}\n dataTestId={getDataTestId(dataTestId || pureCellContext.dataTestId, 'amount-text')}\n className={cn(styles.component)}\n color={color}\n >\n <CoreAmount\n minority={minority || minorUnits}\n bold={weight === 'bold' ? 'full' : 'none'}\n dataTestId={getDataTestId(dataTestId || pureCellContext.dataTestId, 'amount')}\n {...restProps}\n />\n </TypographyText>\n );\n};\n"],"names":["CoreAmount"],"mappings":";;;;;;;;AAwCO,MAAM,MAAM,GAAoB,CAAC,EACpC,MAAM,GAAG,QAAQ,EACjB,QAAQ,GAAG,mBAAmB,EAC9B,KAAK,GAAG,SAAS,EACjB,QAAQ,EACR,UAAU,GAAG,GAAG,EAChB,MAAM,EACN,UAAU,EACV,GAAG,SAAS,EACf,KAAI;AACD,IAAA,MAAM,eAAe,GAAG,UAAU,CAAC,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../src/components/amount/component.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport cn from 'classnames';\n\nimport { Amount as CoreAmount } from '@alfalab/core-components-amount';\nimport { getDataTestId } from '@alfalab/core-components-shared';\nimport { type Color, TypographyText } from '@alfalab/core-components-typography';\n\nimport { PureCellContext } from '../../context';\nimport { type AmountProps as AmountType } from '../typesProps';\n\nimport styles from './index.module.css';\n\ntype Props = {\n /**\n * Начертание шрифта денежного значения\n */\n weight?: 'bold' | 'normal';\n\n /**\n * Размер денежного значения\n */\n textView?: 'component-primary' | 'primary-small';\n\n /**\n * Цвет денежного значения\n */\n color?: Color;\n\n /**\n * Скрыть денежное значение\n */\n hidden?: boolean;\n\n /**\n * Идентификатор для систем автоматизированного тестирования.\n * Для typography используется модификатор -amount-text, для компонента Amount -amount\n */\n dataTestId?: string;\n} & Omit<AmountType, 'dataTestId'>;\n\nexport const Amount: React.FC<Props> = ({\n weight = 'normal',\n textView = 'component-primary',\n color = 'primary',\n minority,\n minorUnits = 100,\n hidden,\n dataTestId,\n ...restProps\n}) => {\n const pureCellContext = useContext(PureCellContext);\n\n if (hidden) {\n return (\n <div className={styles.hiddenWrapper}>\n <div className={styles.hidden} />\n </div>\n );\n }\n\n return (\n <TypographyText\n view={textView}\n dataTestId={getDataTestId(dataTestId || pureCellContext.dataTestId, 'amount-text')}\n className={cn(styles.component)}\n color={color}\n >\n <CoreAmount\n minority={minority || minorUnits}\n bold={weight === 'bold' ? 'full' : 'none'}\n dataTestId={getDataTestId(dataTestId || pureCellContext.dataTestId, 'amount')}\n {...restProps}\n />\n </TypographyText>\n );\n};\n"],"names":["CoreAmount"],"mappings":";;;;;;;;AAwCO,MAAM,MAAM,GAAoB,CAAC,EACpC,MAAM,GAAG,QAAQ,EACjB,QAAQ,GAAG,mBAAmB,EAC9B,KAAK,GAAG,SAAS,EACjB,QAAQ,EACR,UAAU,GAAG,GAAG,EAChB,MAAM,EACN,UAAU,EACV,GAAG,SAAS,EACf,KAAI;AACD,IAAA,MAAM,eAAe,GAAG,UAAU,CAAC,eAAe,CAAC;IAEnD,IAAI,MAAM,EAAE;AACR,QAAA,QACI,KAAK,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,SAAS,EAAE,MAAM,CAAC,aAAa,EAAA;YAChC,KAAK,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,SAAS,EAAE,MAAM,CAAC,MAAM,EAAI,CAAA,CAC/B;;AAId,IAAA,QACI,KAAA,CAAA,aAAA,CAAC,cAAc,EAAA,EACX,IAAI,EAAE,QAAQ,EACd,UAAU,EAAE,aAAa,CAAC,UAAU,IAAI,eAAe,CAAC,UAAU,EAAE,aAAa,CAAC,EAClF,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,EAC/B,KAAK,EAAE,KAAK,EAAA;AAEZ,QAAA,KAAA,CAAA,aAAA,CAACA,QAAU,EACP,EAAA,QAAQ,EAAE,QAAQ,IAAI,UAAU,EAChC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,MAAM,GAAG,MAAM,EACzC,UAAU,EAAE,aAAa,CAAC,UAAU,IAAI,eAAe,CAAC,UAAU,EAAE,QAAQ,CAAC,EAAA,GACzE,SAAS,EACf,CAAA,CACW;AAEzB;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type TitleProps } from '@alfalab/core-components-typography/moderncssm';
|
|
3
3
|
import { type AmountProps as AmountType } from '../typesProps';
|
|
4
|
-
|
|
4
|
+
type Props = {
|
|
5
5
|
/**
|
|
6
6
|
* Пропсы, которые будут прокинуты в компонент типографики
|
|
7
7
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../../src/components/amount-title/component.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport cn from 'classnames';\n\nimport { Amount as CoreAmount } from '@alfalab/core-components-amount';\nimport { getDataTestId } from '@alfalab/core-components-shared';\nimport { type TitleProps, TypographyTitleResponsive } from '@alfalab/core-components-typography';\n\nimport { PureCellContext } from '../../context';\nimport { type AmountProps as AmountType } from '../typesProps';\n\nimport styles from './index.module.css';\n\ntype Props = {\n /**\n * Пропсы, которые будут прокинуты в компонент типографики\n */\n titleProps?: TitleProps;\n\n /**\n * Скрыть денежное значение\n */\n hidden?: boolean;\n\n /**\n * Идентификатор для систем автоматизированного тестирования.\n * Для typography используется модификатор -amount-title, для компонента Amount -core-amount-title\n */\n dataTestId?: string;\n} & Omit<AmountType, 'dataTestId'>;\n\nexport const AmountTitle: React.FC<Props> = ({\n minority,\n minorUnits = 100,\n hidden,\n className,\n dataTestId,\n titleProps: titlePropsFromProps,\n ...restProps\n}) => {\n const pureCellContext = useContext(PureCellContext);\n\n const titleProps = {\n tag: 'h4',\n view: 'small',\n ...titlePropsFromProps,\n } as Omit<TitleProps, 'className' | 'dataTestId'>;\n\n if (hidden) {\n return (\n <div className={cn(styles.hiddenWrapper, styles[`hiddenWrapper-${titleProps.view}`])}>\n <div className={cn(styles.hidden, styles[`hidden-${titleProps.view}`])} />\n </div>\n );\n }\n\n return (\n <TypographyTitleResponsive\n {...titleProps}\n dataTestId={getDataTestId(dataTestId || pureCellContext.dataTestId, 'amount-title')}\n className={cn(styles.component, titlePropsFromProps?.className)}\n >\n <CoreAmount\n minority={minority || minorUnits}\n className={className}\n dataTestId={getDataTestId(\n dataTestId || pureCellContext.dataTestId,\n 'core-amount-title',\n )}\n {...restProps}\n bold='none'\n />\n </TypographyTitleResponsive>\n );\n};\n"],"names":["CoreAmount"],"mappings":";;;;;;;;AA8Ba,MAAA,WAAW,GAAoB,CAAC,EACzC,QAAQ,EACR,UAAU,GAAG,GAAG,EAChB,MAAM,EACN,SAAS,EACT,UAAU,EACV,UAAU,EAAE,mBAAmB,EAC/B,GAAG,SAAS,EACf,KAAI;AACD,IAAA,MAAM,eAAe,GAAG,UAAU,CAAC,eAAe,CAAC;AAEnD,IAAA,MAAM,UAAU,GAAG;AACf,QAAA,GAAG,EAAE,IAAI;AACT,QAAA,IAAI,EAAE,OAAO;AACb,QAAA,GAAG,mBAAmB;KACuB;
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../src/components/amount-title/component.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport cn from 'classnames';\n\nimport { Amount as CoreAmount } from '@alfalab/core-components-amount';\nimport { getDataTestId } from '@alfalab/core-components-shared';\nimport { type TitleProps, TypographyTitleResponsive } from '@alfalab/core-components-typography';\n\nimport { PureCellContext } from '../../context';\nimport { type AmountProps as AmountType } from '../typesProps';\n\nimport styles from './index.module.css';\n\ntype Props = {\n /**\n * Пропсы, которые будут прокинуты в компонент типографики\n */\n titleProps?: TitleProps;\n\n /**\n * Скрыть денежное значение\n */\n hidden?: boolean;\n\n /**\n * Идентификатор для систем автоматизированного тестирования.\n * Для typography используется модификатор -amount-title, для компонента Amount -core-amount-title\n */\n dataTestId?: string;\n} & Omit<AmountType, 'dataTestId'>;\n\nexport const AmountTitle: React.FC<Props> = ({\n minority,\n minorUnits = 100,\n hidden,\n className,\n dataTestId,\n titleProps: titlePropsFromProps,\n ...restProps\n}) => {\n const pureCellContext = useContext(PureCellContext);\n\n const titleProps = {\n tag: 'h4',\n view: 'small',\n ...titlePropsFromProps,\n } as Omit<TitleProps, 'className' | 'dataTestId'>;\n\n if (hidden) {\n return (\n <div className={cn(styles.hiddenWrapper, styles[`hiddenWrapper-${titleProps.view}`])}>\n <div className={cn(styles.hidden, styles[`hidden-${titleProps.view}`])} />\n </div>\n );\n }\n\n return (\n <TypographyTitleResponsive\n {...titleProps}\n dataTestId={getDataTestId(dataTestId || pureCellContext.dataTestId, 'amount-title')}\n className={cn(styles.component, titlePropsFromProps?.className)}\n >\n <CoreAmount\n minority={minority || minorUnits}\n className={className}\n dataTestId={getDataTestId(\n dataTestId || pureCellContext.dataTestId,\n 'core-amount-title',\n )}\n {...restProps}\n bold='none'\n />\n </TypographyTitleResponsive>\n );\n};\n"],"names":["CoreAmount"],"mappings":";;;;;;;;AA8Ba,MAAA,WAAW,GAAoB,CAAC,EACzC,QAAQ,EACR,UAAU,GAAG,GAAG,EAChB,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2
|
import { type ButtonProps } from '@alfalab/core-components-button/moderncssm';
|
|
3
|
-
|
|
3
|
+
type ComponentProps = Omit<ButtonProps, 'dataTestId'> & {
|
|
4
4
|
/**
|
|
5
5
|
* Идентификатор для систем автоматизированного тестирования.
|
|
6
6
|
* Используется модификатор -button
|
|
7
7
|
*/
|
|
8
8
|
dataTestId?: string;
|
|
9
9
|
};
|
|
10
|
-
|
|
10
|
+
type FooterButtonProps = ComponentProps & Partial<AnchorHTMLAttributes<HTMLAnchorElement> | ButtonHTMLAttributes<HTMLButtonElement>>;
|
|
11
11
|
export declare const FooterButton: React.ForwardRefExoticComponent<FooterButtonProps & React.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
|
|
12
12
|
export {};
|
|
@@ -6,16 +6,16 @@ import { type FooterButton } from './footer-button';
|
|
|
6
6
|
import { type FooterText } from './footer-text';
|
|
7
7
|
import { type Graphics } from './graphics';
|
|
8
8
|
import { type Text } from './text';
|
|
9
|
-
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export
|
|
20
|
-
export
|
|
9
|
+
type TextElement = ReactElement<typeof Text>;
|
|
10
|
+
export type GraphicsElement = ReactElement<typeof Graphics> | boolean | null;
|
|
11
|
+
type AmountElement = ReactElement<typeof Amount>;
|
|
12
|
+
type AmountTitleElement = ReactElement<typeof AmountTitle>;
|
|
13
|
+
export type CommentElement = ReactElement<typeof Comment>;
|
|
14
|
+
type FooterButtonElement = ReactElement<typeof FooterButton>;
|
|
15
|
+
type FooterTitleElement = ReactElement<typeof FooterText>;
|
|
16
|
+
export type FooterElement = Array<ReactElement<FooterButtonElement> | FooterTitleElement | boolean | null> | CommentElement | boolean | null;
|
|
17
|
+
export type MainElement = Array<undefined | '' | boolean | null | TextElement | AmountElement | AmountTitleElement> | (TextElement | AmountElement | AmountTitleElement | boolean | null);
|
|
18
|
+
export type ContentElement = Array<MainElement | AddonElement | FooterElement> | MainElement;
|
|
19
|
+
export type AddonElement = Array<TextElement | ReactNode> | TextElement | ReactNode;
|
|
20
|
+
export type PureCellElement = Array<GraphicsElement | ContentElement> | ContentElement;
|
|
21
21
|
export {};
|
package/moderncssm/context.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alfalab/core-components-pure-cell",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
"main": "index.js",
|
|
11
11
|
"module": "./esm/index.js",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@alfalab/core-components-amount": "^5.1.
|
|
14
|
-
"@alfalab/core-components-button": "^13.1.
|
|
15
|
-
"@alfalab/core-components-comment": "^4.0.
|
|
16
|
-
"@alfalab/core-components-shared": "^2.1.
|
|
17
|
-
"@alfalab/core-components-typography": "^6.0.
|
|
13
|
+
"@alfalab/core-components-amount": "^5.1.1",
|
|
14
|
+
"@alfalab/core-components-button": "^13.1.1",
|
|
15
|
+
"@alfalab/core-components-comment": "^4.0.3",
|
|
16
|
+
"@alfalab/core-components-shared": "^2.1.1",
|
|
17
|
+
"@alfalab/core-components-typography": "^6.0.3",
|
|
18
18
|
"@alfalab/data": "^1.9.2",
|
|
19
19
|
"@alfalab/hooks": "^1.13.1",
|
|
20
20
|
"classnames": "^2.5.1",
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"directory": "dist"
|
|
31
31
|
},
|
|
32
32
|
"themesVersion": "15.0.2",
|
|
33
|
-
"varsVersion": "11.0.
|
|
33
|
+
"varsVersion": "11.0.2"
|
|
34
34
|
}
|
package/src/index.module.css
CHANGED
package/src/vars.css
CHANGED