@apify/ui-library 0.71.1-featcolortokens-178953.63 → 0.71.1-featcolortokens-178953.67
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/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +3 -2
- package/src/codemods/generate_typograpy_tokens_files.mjs +137 -0
- package/src/components/action_link.tsx +60 -0
- package/src/components/actor_template_card.tsx +116 -0
- package/src/components/badge.tsx +148 -0
- package/src/components/banner.tsx +94 -0
- package/src/components/blog_article.tsx +85 -0
- package/src/components/box.tsx +127 -0
- package/src/components/button.tsx +305 -0
- package/src/components/chip.tsx +128 -0
- package/src/components/code/action_button.tsx +96 -0
- package/src/components/code/code_block/code_block.styled.tsx +180 -0
- package/src/components/code/code_block/code_block.tsx +224 -0
- package/src/components/code/code_block/code_block_with_tabs.tsx +257 -0
- package/src/components/code/code_block/utils.tsx +67 -0
- package/src/components/code/index.ts +5 -0
- package/src/components/code/inline_code/inline_code.tsx +62 -0
- package/src/components/code/one_line_code/one_line_code.tsx +228 -0
- package/src/components/code/prism_highlighter.tsx +180 -0
- package/src/components/color_wheel_gradient.tsx +31 -0
- package/src/components/floating/index.ts +3 -0
- package/src/components/floating/menu.tsx +189 -0
- package/src/components/floating/menu_common.tsx +31 -0
- package/src/components/floating/menu_components.tsx +99 -0
- package/src/components/image.tsx +24 -0
- package/src/components/index.ts +22 -0
- package/src/components/link.tsx +114 -0
- package/src/components/message.tsx +153 -0
- package/src/components/rating.tsx +106 -0
- package/src/components/readme_renderer/index.ts +3 -0
- package/src/components/readme_renderer/pythonize_value.ts +76 -0
- package/src/components/readme_renderer/table_of_contents.tsx +272 -0
- package/src/components/readme_renderer/utils.tsx +46 -0
- package/src/components/simple_markdown/index.ts +2 -0
- package/src/components/simple_markdown/simple_markdown.tsx +214 -0
- package/src/components/simple_markdown/simple_markdown_components.tsx +293 -0
- package/src/components/tabs/index.ts +2 -0
- package/src/components/tabs/tab.tsx +217 -0
- package/src/components/tabs/tabs.tsx +169 -0
- package/src/components/tag.tsx +196 -0
- package/src/components/text/heading_content.tsx +56 -0
- package/src/components/text/heading_marketing.tsx +55 -0
- package/src/components/text/heading_shared.tsx +55 -0
- package/src/components/text/index.ts +19 -0
- package/src/components/text/text_base.tsx +52 -0
- package/src/components/text/text_content.tsx +104 -0
- package/src/components/text/text_marketing.tsx +152 -0
- package/src/components/text/text_shared.tsx +95 -0
- package/src/components/tile/horizontal_tile.tsx +77 -0
- package/src/components/tile/index.ts +2 -0
- package/src/components/tile/shared.ts +27 -0
- package/src/components/tile/vertical_tile.tsx +59 -0
- package/src/components/to_consolidate/card.tsx +141 -0
- package/src/components/to_consolidate/index.ts +4 -0
- package/src/components/to_consolidate/markdown.tsx +609 -0
- package/src/components/to_consolidate/pagination.tsx +136 -0
- package/src/components/to_consolidate/tab_number_chip.tsx +31 -0
- package/src/design_system/colors/build_color_tokens.js +183 -0
- package/src/design_system/colors/figma_color_tokens.dark.json +886 -0
- package/src/design_system/colors/figma_color_tokens.light.json +886 -0
- package/src/design_system/colors/generated/colors_theme.dark.ts +110 -0
- package/src/design_system/colors/generated/colors_theme.light.ts +110 -0
- package/src/design_system/colors/generated/css_variables.dark.ts +147 -0
- package/src/design_system/colors/generated/css_variables.light.ts +147 -0
- package/src/design_system/colors/generated/css_variables_palette.dark.ts +74 -0
- package/src/design_system/colors/generated/css_variables_palette.light.ts +74 -0
- package/src/design_system/colors/generated/properties_theme.ts +179 -0
- package/src/design_system/colors/index.ts +7 -0
- package/src/design_system/supernova_typography_tokens.json +657 -0
- package/src/design_system/theme.ts +25 -0
- package/src/design_system/tokens/index.ts +5 -0
- package/src/design_system/tokens/layouts.ts +29 -0
- package/src/design_system/tokens/radiuses.ts +22 -0
- package/src/design_system/tokens/shadows.ts +22 -0
- package/src/design_system/tokens/spaces.ts +15 -0
- package/src/design_system/tokens/transitions.ts +19 -0
- package/src/design_system/typography_theme.ts +197 -0
- package/src/index.ts +8 -0
- package/src/type_utils.ts +7 -0
- package/src/ui_dependency_provider.tsx +58 -0
- package/src/utils/copy_to_clipboard.ts +24 -0
- package/src/utils/image_color.ts +42 -0
- package/src/utils/index.ts +4 -0
- package/src/utils/resize_observer.ts +18 -0
- package/src/utils/sanitization.ts +14 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { theme } from '../../design_system/theme.js';
|
|
5
|
+
import type { WithTransientProps } from '../../type_utils.js';
|
|
6
|
+
import type { TextBaseProps } from './text_base.js';
|
|
7
|
+
import { TextBaseComponent } from './text_base.js';
|
|
8
|
+
|
|
9
|
+
type HeadingSharedType = 'titleXs' | 'titleS' | 'titleM' | 'titleL' | 'titleXl' | 'title2xl' | 'title3xl';
|
|
10
|
+
|
|
11
|
+
interface HeadingSharedTransientProps {
|
|
12
|
+
type?: HeadingSharedType,
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
type StyledHeadingSharedProps = WithTransientProps<HeadingSharedTransientProps>;
|
|
16
|
+
export type HeadingSharedProps = HeadingSharedTransientProps & TextBaseProps;
|
|
17
|
+
|
|
18
|
+
const HEADING_SHARED_DEFAULT_ELEMENTS: { [Type in HeadingSharedType]: string } = {
|
|
19
|
+
titleXs: 'h6',
|
|
20
|
+
titleS: 'h5',
|
|
21
|
+
titleM: 'h4',
|
|
22
|
+
titleL: 'h3',
|
|
23
|
+
titleXl: 'h2',
|
|
24
|
+
title2xl: 'h1',
|
|
25
|
+
title3xl: 'h1',
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const StyledHeadingShared = styled(TextBaseComponent)<StyledHeadingSharedProps>`
|
|
29
|
+
${(props) => `
|
|
30
|
+
${theme.typography.shared.mobile[props.$type || 'titleL']}
|
|
31
|
+
|
|
32
|
+
@media (${theme.device.tablet}) {
|
|
33
|
+
${theme.typography.shared.tablet[props.$type || 'titleL']}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@media (${theme.device.desktop}) {
|
|
37
|
+
${theme.typography.shared.desktop[props.$type || 'titleL']}
|
|
38
|
+
}
|
|
39
|
+
`}
|
|
40
|
+
`;
|
|
41
|
+
|
|
42
|
+
export const HeadingShared: React.FC<HeadingSharedProps> = ({
|
|
43
|
+
type,
|
|
44
|
+
as,
|
|
45
|
+
...rest
|
|
46
|
+
}) => {
|
|
47
|
+
return (
|
|
48
|
+
<StyledHeadingShared
|
|
49
|
+
$type={type}
|
|
50
|
+
forwardedAs={as || HEADING_SHARED_DEFAULT_ELEMENTS[type || 'titleL']}
|
|
51
|
+
m='none'
|
|
52
|
+
{...rest}
|
|
53
|
+
/>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { HeadingShared } from './heading_shared.js';
|
|
2
|
+
import type { SharedTextProps } from './text_shared.js';
|
|
3
|
+
import { SHARED_TEXT_TYPES, TextShared } from './text_shared.js';
|
|
4
|
+
|
|
5
|
+
export * from './text_base.js';
|
|
6
|
+
export * from './text_content.js';
|
|
7
|
+
export * from './text_marketing.js';
|
|
8
|
+
export * from './heading_content.js';
|
|
9
|
+
export * from './heading_marketing.js';
|
|
10
|
+
|
|
11
|
+
export {
|
|
12
|
+
TextShared as Text, // Shared typography is the default
|
|
13
|
+
HeadingShared as Heading, // Shared typography is the default
|
|
14
|
+
SHARED_TEXT_TYPES,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type {
|
|
18
|
+
SharedTextProps,
|
|
19
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import type { WithTransientProps } from '../../type_utils.js';
|
|
5
|
+
import type { BoxProps } from '../box.js';
|
|
6
|
+
import { Box } from '../box.js';
|
|
7
|
+
|
|
8
|
+
export interface TransientTextBaseProps {
|
|
9
|
+
italic?: boolean
|
|
10
|
+
uppercase?: boolean
|
|
11
|
+
align?: 'left' | 'right' | 'center'
|
|
12
|
+
color?: string,
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type StyledTextBaseProps = WithTransientProps<TransientTextBaseProps>;
|
|
16
|
+
export type TextBaseProps = TransientTextBaseProps & BoxProps;
|
|
17
|
+
|
|
18
|
+
const StyledText = styled(Box)<StyledTextBaseProps>`
|
|
19
|
+
${(props) => props.$italic && css`
|
|
20
|
+
font-style: italic;
|
|
21
|
+
`}
|
|
22
|
+
|
|
23
|
+
${(props) => props.$uppercase && css`
|
|
24
|
+
text-transform: uppercase;
|
|
25
|
+
`}
|
|
26
|
+
|
|
27
|
+
${(props) => props.$align && css`
|
|
28
|
+
text-align: ${props.$align};
|
|
29
|
+
`}
|
|
30
|
+
|
|
31
|
+
${(props) => props.$color && css`
|
|
32
|
+
color: ${props.$color};
|
|
33
|
+
`}
|
|
34
|
+
`;
|
|
35
|
+
|
|
36
|
+
export const TextBaseComponent: React.FC<TextBaseProps> = ({
|
|
37
|
+
italic,
|
|
38
|
+
align,
|
|
39
|
+
color,
|
|
40
|
+
uppercase,
|
|
41
|
+
as,
|
|
42
|
+
...rest
|
|
43
|
+
}) => (
|
|
44
|
+
<StyledText
|
|
45
|
+
$italic={italic}
|
|
46
|
+
$align={align}
|
|
47
|
+
$color={color}
|
|
48
|
+
$uppercase={uppercase}
|
|
49
|
+
forwardedAs={as}
|
|
50
|
+
{...rest}
|
|
51
|
+
/>
|
|
52
|
+
);
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import type { FlattenSimpleInterpolation } from 'styled-components';
|
|
3
|
+
import styled, { css } from 'styled-components';
|
|
4
|
+
|
|
5
|
+
import { theme } from '../../design_system/theme.js';
|
|
6
|
+
import type { WithTransientProps } from '../../type_utils.js';
|
|
7
|
+
import type { TextBaseProps } from './text_base.js';
|
|
8
|
+
import { TextBaseComponent } from './text_base.js';
|
|
9
|
+
|
|
10
|
+
export type ContentTextType = 'paragraph' | 'snippet';
|
|
11
|
+
export type ContentTextWeight = 'normal' | 'bold';
|
|
12
|
+
|
|
13
|
+
export interface TransientContentTextProps {
|
|
14
|
+
type?: ContentTextType,
|
|
15
|
+
weight?: ContentTextWeight,
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
type StyledContentTextProps = WithTransientProps<TransientContentTextProps>;
|
|
19
|
+
export type ContentTextProps = TransientContentTextProps & TextBaseProps;
|
|
20
|
+
|
|
21
|
+
type TextContentVariants = {
|
|
22
|
+
[Type in ContentTextType]: {
|
|
23
|
+
[Weight in ContentTextWeight]: FlattenSimpleInterpolation;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const TEXT_SHARED_VARIANTS_CSS: TextContentVariants = {
|
|
28
|
+
paragraph: {
|
|
29
|
+
normal: css`
|
|
30
|
+
${theme.typography.content.mobile.paragraph}
|
|
31
|
+
|
|
32
|
+
@media (min-width: ${theme.layout.tablet}) {
|
|
33
|
+
${theme.typography.content.tablet.paragraph}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@media (min-width: ${theme.layout.desktop}) {
|
|
37
|
+
${theme.typography.content.desktop.paragraph}
|
|
38
|
+
}
|
|
39
|
+
`,
|
|
40
|
+
bold: css`
|
|
41
|
+
${theme.typography.content.mobile.paragraphStrong}
|
|
42
|
+
|
|
43
|
+
@media (min-width: ${theme.layout.tablet}) {
|
|
44
|
+
${theme.typography.content.tablet.paragraphStrong}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@media (min-width: ${theme.layout.desktop}) {
|
|
48
|
+
${theme.typography.content.desktop.paragraphStrong}
|
|
49
|
+
}
|
|
50
|
+
`,
|
|
51
|
+
},
|
|
52
|
+
snippet: {
|
|
53
|
+
normal: css`
|
|
54
|
+
${theme.typography.content.mobile.snippet}
|
|
55
|
+
|
|
56
|
+
@media (min-width: ${theme.layout.tablet}) {
|
|
57
|
+
${theme.typography.content.tablet.snippet}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@media (min-width: ${theme.layout.desktop}) {
|
|
61
|
+
${theme.typography.content.desktop.snippet}
|
|
62
|
+
}
|
|
63
|
+
`,
|
|
64
|
+
bold: css`
|
|
65
|
+
${theme.typography.content.mobile.snippetStrong}
|
|
66
|
+
|
|
67
|
+
@media (min-width: ${theme.layout.tablet}) {
|
|
68
|
+
${theme.typography.content.tablet.snippetStrong}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@media (min-width: ${theme.layout.desktop}) {
|
|
72
|
+
${theme.typography.content.desktop.snippetStrong}
|
|
73
|
+
}
|
|
74
|
+
`,
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const StyledTextContent = styled(TextBaseComponent)<StyledContentTextProps>`
|
|
79
|
+
${(props) => TEXT_SHARED_VARIANTS_CSS[props.$type || 'paragraph'][props.$weight || 'normal']}
|
|
80
|
+
`;
|
|
81
|
+
|
|
82
|
+
export const TextContent = forwardRef<HTMLElement | undefined, ContentTextProps>(({
|
|
83
|
+
type,
|
|
84
|
+
weight,
|
|
85
|
+
as,
|
|
86
|
+
...rest
|
|
87
|
+
}, ref) => {
|
|
88
|
+
return (
|
|
89
|
+
<StyledTextContent
|
|
90
|
+
$type={type}
|
|
91
|
+
$weight={weight}
|
|
92
|
+
forwardedAs={as || 'p'}
|
|
93
|
+
ref={ref}
|
|
94
|
+
// We have global CSS file that defines margins for p and h to some 'normalized' value
|
|
95
|
+
// But at the same time we want to have default margin set to 0 for Text and Headings
|
|
96
|
+
// In perfect world, all texts would be rendered using Text/Heading components and we could have 0 margin set globally
|
|
97
|
+
// Until then we have to set default 0 margin here
|
|
98
|
+
m='none'
|
|
99
|
+
{...rest}
|
|
100
|
+
/>
|
|
101
|
+
);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
TextContent.displayName = 'TextContent';
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import type { FlattenSimpleInterpolation } from 'styled-components';
|
|
3
|
+
import styled, { css } from 'styled-components';
|
|
4
|
+
|
|
5
|
+
import { theme } from '../../design_system/theme.js';
|
|
6
|
+
import type { WithTransientProps } from '../../type_utils.js';
|
|
7
|
+
import type { TextBaseProps } from './text_base.js';
|
|
8
|
+
import { TextBaseComponent } from './text_base.js';
|
|
9
|
+
|
|
10
|
+
export type MarketingTextSize = 'large' | 'regular' | 'small' | 'extraSmall';
|
|
11
|
+
export type MarketingTextWeight = 'normal' | 'bold';
|
|
12
|
+
|
|
13
|
+
export interface TransientMarketingTextProps {
|
|
14
|
+
size?: MarketingTextSize,
|
|
15
|
+
weight?: MarketingTextWeight,
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
type StyledMarketingTextProps = WithTransientProps<TransientMarketingTextProps>;
|
|
19
|
+
export type MarketingTextProps = TransientMarketingTextProps & TextBaseProps;
|
|
20
|
+
|
|
21
|
+
type TextMarketingVariants = {
|
|
22
|
+
[Size in MarketingTextSize]: {
|
|
23
|
+
[Weight in MarketingTextWeight]: FlattenSimpleInterpolation;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const TEXT_MARKETING_VARIANTS_CSS: TextMarketingVariants = {
|
|
28
|
+
large: {
|
|
29
|
+
normal: css`
|
|
30
|
+
${theme.typography.marketing.mobile.bodyL}
|
|
31
|
+
|
|
32
|
+
@media (${theme.device.tablet}) {
|
|
33
|
+
${theme.typography.marketing.tablet.bodyL}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@media (${theme.device.desktop}) {
|
|
37
|
+
${theme.typography.marketing.desktop.bodyL}
|
|
38
|
+
}
|
|
39
|
+
`,
|
|
40
|
+
bold: css`
|
|
41
|
+
${theme.typography.marketing.mobile.bodyLStrong}
|
|
42
|
+
|
|
43
|
+
@media (${theme.device.tablet}) {
|
|
44
|
+
${theme.typography.marketing.tablet.bodyLStrong}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@media (${theme.device.desktop}) {
|
|
48
|
+
${theme.typography.marketing.desktop.bodyLStrong}
|
|
49
|
+
}
|
|
50
|
+
`,
|
|
51
|
+
},
|
|
52
|
+
regular: {
|
|
53
|
+
normal: css`
|
|
54
|
+
${theme.typography.marketing.mobile.bodyM}
|
|
55
|
+
|
|
56
|
+
@media (${theme.device.tablet}) {
|
|
57
|
+
${theme.typography.marketing.tablet.bodyM}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@media (${theme.device.desktop}) {
|
|
61
|
+
${theme.typography.marketing.desktop.bodyM}
|
|
62
|
+
}
|
|
63
|
+
`,
|
|
64
|
+
bold: css`
|
|
65
|
+
${theme.typography.marketing.mobile.bodyMStrong}
|
|
66
|
+
|
|
67
|
+
@media (${theme.device.tablet}) {
|
|
68
|
+
${theme.typography.marketing.tablet.bodyMStrong}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@media (${theme.device.desktop}) {
|
|
72
|
+
${theme.typography.marketing.desktop.bodyMStrong}
|
|
73
|
+
}
|
|
74
|
+
`,
|
|
75
|
+
},
|
|
76
|
+
small: {
|
|
77
|
+
normal: css`
|
|
78
|
+
${theme.typography.marketing.mobile.bodyS}
|
|
79
|
+
|
|
80
|
+
@media (${theme.device.tablet}) {
|
|
81
|
+
${theme.typography.marketing.tablet.bodyS}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@media (${theme.device.desktop}) {
|
|
85
|
+
${theme.typography.marketing.desktop.bodyS}
|
|
86
|
+
}
|
|
87
|
+
`,
|
|
88
|
+
bold: css`
|
|
89
|
+
${theme.typography.marketing.mobile.bodySStrong}
|
|
90
|
+
|
|
91
|
+
@media (${theme.device.tablet}) {
|
|
92
|
+
${theme.typography.marketing.tablet.bodySStrong}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
@media (${theme.device.desktop}) {
|
|
96
|
+
${theme.typography.marketing.desktop.bodySStrong}
|
|
97
|
+
}
|
|
98
|
+
`,
|
|
99
|
+
},
|
|
100
|
+
extraSmall: {
|
|
101
|
+
normal: css`
|
|
102
|
+
${theme.typography.marketing.mobile.bodyXs}
|
|
103
|
+
|
|
104
|
+
@media (${theme.device.tablet}) {
|
|
105
|
+
${theme.typography.marketing.tablet.bodyXs}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
@media (${theme.device.desktop}) {
|
|
109
|
+
${theme.typography.marketing.desktop.bodyXs}
|
|
110
|
+
}
|
|
111
|
+
`,
|
|
112
|
+
bold: css`
|
|
113
|
+
${theme.typography.marketing.mobile.bodyXsStrong}
|
|
114
|
+
|
|
115
|
+
@media (${theme.device.tablet}) {
|
|
116
|
+
${theme.typography.marketing.tablet.bodyXsStrong}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
@media (${theme.device.desktop}) {
|
|
120
|
+
${theme.typography.marketing.desktop.bodyXsStrong}
|
|
121
|
+
}
|
|
122
|
+
`,
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const StyledTextMarketing = styled(TextBaseComponent)<StyledMarketingTextProps>`
|
|
127
|
+
${(props) => TEXT_MARKETING_VARIANTS_CSS[props.$size || 'regular'][props.$weight || 'normal']}
|
|
128
|
+
`;
|
|
129
|
+
|
|
130
|
+
export const TextMarketing = forwardRef<HTMLElement | undefined, MarketingTextProps>(({
|
|
131
|
+
weight,
|
|
132
|
+
size,
|
|
133
|
+
as,
|
|
134
|
+
...rest
|
|
135
|
+
}, ref) => {
|
|
136
|
+
return (
|
|
137
|
+
<StyledTextMarketing
|
|
138
|
+
$weight={weight}
|
|
139
|
+
$size={size}
|
|
140
|
+
forwardedAs={as || 'p'}
|
|
141
|
+
ref={ref}
|
|
142
|
+
// We have global CSS file that defines margins for p and h to some 'normalized' value
|
|
143
|
+
// But at the same time we want to have default margin set to 0 for Text and Headings
|
|
144
|
+
// In perfect world, all texts would be rendered using Text/Heading components and we could have 0 margin set globally
|
|
145
|
+
// Until then we have to set default 0 margin here
|
|
146
|
+
m='none'
|
|
147
|
+
{...rest}
|
|
148
|
+
/>
|
|
149
|
+
);
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
TextMarketing.displayName = 'TextMarketing';
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { theme } from '../../design_system/theme.js';
|
|
5
|
+
import type { WithTransientProps } from '../../type_utils.js';
|
|
6
|
+
import type { TextBaseProps } from './text_base.js';
|
|
7
|
+
import { TextBaseComponent } from './text_base.js';
|
|
8
|
+
|
|
9
|
+
export const SHARED_TEXT_TYPES = ['body', 'code'] as const;
|
|
10
|
+
export type SharedTextType = typeof SHARED_TEXT_TYPES[number];
|
|
11
|
+
|
|
12
|
+
export type SharedTextSize = 'regular' | 'small' | 'big';
|
|
13
|
+
export type SharedTextWeight = 'normal' | 'medium' | 'bold';
|
|
14
|
+
|
|
15
|
+
export interface TransientSharedTextProps {
|
|
16
|
+
type?: SharedTextType,
|
|
17
|
+
size?: SharedTextSize,
|
|
18
|
+
weight?: SharedTextWeight,
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
type StyledSharedTextProps = WithTransientProps<TransientSharedTextProps>;
|
|
22
|
+
export type SharedTextProps = TransientSharedTextProps & TextBaseProps;
|
|
23
|
+
|
|
24
|
+
type TextSharedVariants = {
|
|
25
|
+
[Type in SharedTextType]: {
|
|
26
|
+
[Size in SharedTextSize]: {
|
|
27
|
+
[Weight in SharedTextWeight]: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const TEXT_SHARED_VARIANTS_CSS: TextSharedVariants = {
|
|
33
|
+
body: {
|
|
34
|
+
regular: {
|
|
35
|
+
normal: theme.typography.shared.tablet.bodyM,
|
|
36
|
+
medium: theme.typography.shared.tablet.bodyMMedium,
|
|
37
|
+
bold: theme.typography.shared.tablet.bodyMStrong,
|
|
38
|
+
},
|
|
39
|
+
small: {
|
|
40
|
+
normal: theme.typography.shared.tablet.bodyS,
|
|
41
|
+
medium: theme.typography.shared.tablet.bodySMedium,
|
|
42
|
+
bold: theme.typography.shared.tablet.bodySStrong,
|
|
43
|
+
},
|
|
44
|
+
big: {
|
|
45
|
+
normal: theme.typography.shared.tablet.bodyL,
|
|
46
|
+
medium: theme.typography.shared.tablet.bodyLMedium,
|
|
47
|
+
bold: theme.typography.shared.tablet.bodyLStrong,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
code: {
|
|
51
|
+
regular: {
|
|
52
|
+
normal: theme.typography.shared.tablet.codeM,
|
|
53
|
+
medium: theme.typography.shared.tablet.codeMMedium,
|
|
54
|
+
bold: theme.typography.shared.tablet.codeMStrong,
|
|
55
|
+
},
|
|
56
|
+
small: {
|
|
57
|
+
normal: theme.typography.shared.tablet.codeS,
|
|
58
|
+
medium: theme.typography.shared.tablet.codeSMedium,
|
|
59
|
+
bold: theme.typography.shared.tablet.codeSStrong,
|
|
60
|
+
},
|
|
61
|
+
big: {
|
|
62
|
+
normal: theme.typography.shared.tablet.codeL,
|
|
63
|
+
medium: theme.typography.shared.tablet.codeLMedium,
|
|
64
|
+
bold: theme.typography.shared.tablet.codeLStrong,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const StyledTextShared = styled(TextBaseComponent)<StyledSharedTextProps>`
|
|
70
|
+
${(props) => TEXT_SHARED_VARIANTS_CSS[props.$type || 'body'][props.$size || 'regular'][props.$weight || 'normal']}
|
|
71
|
+
`;
|
|
72
|
+
|
|
73
|
+
export const TextShared = forwardRef<HTMLElement | undefined, SharedTextProps>(({
|
|
74
|
+
type,
|
|
75
|
+
size,
|
|
76
|
+
weight,
|
|
77
|
+
as,
|
|
78
|
+
...rest
|
|
79
|
+
}, ref) => {
|
|
80
|
+
return (
|
|
81
|
+
<StyledTextShared
|
|
82
|
+
$type={type}
|
|
83
|
+
$size={size}
|
|
84
|
+
$weight={weight}
|
|
85
|
+
forwardedAs={as || 'p'}
|
|
86
|
+
ref={ref}
|
|
87
|
+
// We have global CSS file that defines margins for p and h to some 'normalized' value
|
|
88
|
+
// But at the same time we want to have default margin set to 0 for Text and Headings
|
|
89
|
+
// In perfect world, all texts would be rendered using Text/Heading components and we could have 0 margin set globally
|
|
90
|
+
// Until then we have to set default 0 margin here
|
|
91
|
+
m='none'
|
|
92
|
+
{...rest}
|
|
93
|
+
/>
|
|
94
|
+
);
|
|
95
|
+
});
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { theme } from '../../design_system/theme.js';
|
|
5
|
+
import type {
|
|
6
|
+
TileSharedProps,
|
|
7
|
+
TileSizesType,
|
|
8
|
+
} from './shared.js';
|
|
9
|
+
import {
|
|
10
|
+
TILE_SIZES,
|
|
11
|
+
tileStyle,
|
|
12
|
+
} from './shared.js';
|
|
13
|
+
|
|
14
|
+
interface HorizontalTileProps extends TileSharedProps {
|
|
15
|
+
icon?: React.ReactNode;
|
|
16
|
+
action?: React.ReactNode;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface StyledTileWrapperProps {
|
|
20
|
+
$hasIcon?: boolean;
|
|
21
|
+
$size?: TileSizesType;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const WrapperClasses = {
|
|
25
|
+
TILE_CONTENT: 'Tile-Content',
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const StyledTileWrapper = styled.div<StyledTileWrapperProps>`
|
|
29
|
+
${tileStyle}
|
|
30
|
+
padding: ${({ $size }) => ($size === TILE_SIZES.SMALL ? theme.space.space16 : theme.space.space24)};
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-direction: row;
|
|
33
|
+
align-items: center;
|
|
34
|
+
|
|
35
|
+
cursor: pointer;
|
|
36
|
+
transition: box-shadow ${theme.transition.smoothEaseOut},
|
|
37
|
+
background-color ${theme.transition.smoothEaseOut},
|
|
38
|
+
border-color ${theme.transition.smoothEaseOut};
|
|
39
|
+
|
|
40
|
+
&:hover {
|
|
41
|
+
box-shadow: ${theme.shadow.shadow1};
|
|
42
|
+
background-color: ${theme.color.neutral.hover};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&:active,
|
|
46
|
+
&:focus {
|
|
47
|
+
border-color: ${theme.color.primary.action};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
${({ $hasIcon }) => $hasIcon && `gap: ${theme.space.space8};`}
|
|
51
|
+
|
|
52
|
+
.${WrapperClasses.TILE_CONTENT} {
|
|
53
|
+
flex-grow: 1;
|
|
54
|
+
}
|
|
55
|
+
`;
|
|
56
|
+
|
|
57
|
+
export const HorizontalTile: React.FC<HorizontalTileProps> = ({
|
|
58
|
+
content,
|
|
59
|
+
icon,
|
|
60
|
+
action,
|
|
61
|
+
size = TILE_SIZES.SMALL,
|
|
62
|
+
onClick,
|
|
63
|
+
...otherProps
|
|
64
|
+
}) => {
|
|
65
|
+
return (
|
|
66
|
+
<StyledTileWrapper
|
|
67
|
+
$hasIcon={!!icon}
|
|
68
|
+
$size={size}
|
|
69
|
+
onClick={onClick}
|
|
70
|
+
{...otherProps}
|
|
71
|
+
>
|
|
72
|
+
<div>{icon}</div>
|
|
73
|
+
<div className={WrapperClasses.TILE_CONTENT}>{content}</div>
|
|
74
|
+
<div>{action}</div>
|
|
75
|
+
</StyledTileWrapper>
|
|
76
|
+
);
|
|
77
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { css } from 'styled-components';
|
|
2
|
+
|
|
3
|
+
import { theme } from '../../design_system/theme.js';
|
|
4
|
+
|
|
5
|
+
export const TILE_SIZES = {
|
|
6
|
+
SMALL: 'S',
|
|
7
|
+
LARGE: 'L',
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type TileSizesType = typeof TILE_SIZES[keyof typeof TILE_SIZES];
|
|
11
|
+
|
|
12
|
+
export const tileStyle = css`
|
|
13
|
+
background-color: ${theme.color.neutral.background};
|
|
14
|
+
border: 1px solid ${theme.color.neutral.border};
|
|
15
|
+
border-radius: ${theme.radius.radius12};
|
|
16
|
+
`;
|
|
17
|
+
|
|
18
|
+
export type TileSharedProps = {
|
|
19
|
+
content: React.ReactNode,
|
|
20
|
+
size?: TileSizesType,
|
|
21
|
+
isClickable?: boolean,
|
|
22
|
+
onClick?: () => void,
|
|
23
|
+
id?: string;
|
|
24
|
+
className?: string;
|
|
25
|
+
style?: React.CSSProperties;
|
|
26
|
+
as?: React.ElementType;
|
|
27
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { theme } from '../../design_system/theme.js';
|
|
5
|
+
import type {
|
|
6
|
+
TileSharedProps,
|
|
7
|
+
TileSizesType,
|
|
8
|
+
} from './shared.js';
|
|
9
|
+
import {
|
|
10
|
+
TILE_SIZES,
|
|
11
|
+
tileStyle,
|
|
12
|
+
} from './shared.js';
|
|
13
|
+
|
|
14
|
+
interface VerticalTileProps extends TileSharedProps {
|
|
15
|
+
content: React.ReactNode;
|
|
16
|
+
icon?: React.ReactNode;
|
|
17
|
+
action?: React.ReactNode;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface StyledTileWrapperProps {
|
|
21
|
+
$size?: TileSizesType;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const WrapperClasses = {
|
|
25
|
+
TILE_CONTENT: 'Tile-Content',
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const StyledTileWrapper = styled.div<StyledTileWrapperProps>`
|
|
29
|
+
${tileStyle}
|
|
30
|
+
padding: ${({ $size }) => ($size === TILE_SIZES.SMALL ? theme.space.space16 : theme.space.space24)};
|
|
31
|
+
width: 100%;
|
|
32
|
+
cursor: pointer;
|
|
33
|
+
transition: box-shadow ${theme.transition.smoothEaseOut},
|
|
34
|
+
background-color ${theme.transition.smoothEaseOut},
|
|
35
|
+
border-color ${theme.transition.smoothEaseOut};
|
|
36
|
+
|
|
37
|
+
&:hover {
|
|
38
|
+
box-shadow: ${theme.shadow.shadow1};
|
|
39
|
+
background-color: ${theme.color.neutral.hover};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&:active,
|
|
43
|
+
&:focus {
|
|
44
|
+
border-color: ${theme.color.primary.action};
|
|
45
|
+
}
|
|
46
|
+
`;
|
|
47
|
+
|
|
48
|
+
export const VerticalTile: React.FC<VerticalTileProps> = ({
|
|
49
|
+
content,
|
|
50
|
+
size = TILE_SIZES.LARGE,
|
|
51
|
+
onClick,
|
|
52
|
+
...otherProps
|
|
53
|
+
}) => {
|
|
54
|
+
return (
|
|
55
|
+
<StyledTileWrapper $size={size} onClick={onClick} {...otherProps}>
|
|
56
|
+
<div className={WrapperClasses.TILE_CONTENT}>{content}</div>
|
|
57
|
+
</StyledTileWrapper>
|
|
58
|
+
);
|
|
59
|
+
};
|