@apify/ui-library 0.71.1-featcolortokens-178953.56 → 0.71.1-featcolortokens-178953.63

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/dist/src/design_system/colors/generated/{dark.d.ts → css_variables.dark.d.ts} +1 -1
  2. package/dist/src/design_system/colors/generated/css_variables.dark.d.ts.map +1 -0
  3. package/dist/src/design_system/colors/generated/{dark.js → css_variables.dark.js} +1 -1
  4. package/dist/src/design_system/colors/generated/css_variables.dark.js.map +1 -0
  5. package/dist/src/design_system/colors/generated/{light.d.ts → css_variables.light.d.ts} +1 -1
  6. package/dist/src/design_system/colors/generated/css_variables.light.d.ts.map +1 -0
  7. package/{src/design_system/colors/generated/light.ts → dist/src/design_system/colors/generated/css_variables.light.js} +1 -1
  8. package/dist/src/design_system/colors/generated/css_variables.light.js.map +1 -0
  9. package/dist/src/design_system/colors/generated/{palette.dark.d.ts → css_variables_palette.dark.d.ts} +1 -1
  10. package/dist/src/design_system/colors/generated/css_variables_palette.dark.d.ts.map +1 -0
  11. package/dist/src/design_system/colors/generated/{palette.dark.js → css_variables_palette.dark.js} +1 -1
  12. package/dist/src/design_system/colors/generated/css_variables_palette.dark.js.map +1 -0
  13. package/dist/src/design_system/colors/generated/{palette.light.d.ts → css_variables_palette.light.d.ts} +1 -1
  14. package/dist/src/design_system/colors/generated/css_variables_palette.light.d.ts.map +1 -0
  15. package/{src/design_system/colors/generated/palette.light.ts → dist/src/design_system/colors/generated/css_variables_palette.light.js} +1 -1
  16. package/dist/src/design_system/colors/generated/css_variables_palette.light.js.map +1 -0
  17. package/dist/src/design_system/colors/index.d.ts +4 -4
  18. package/dist/src/design_system/colors/index.d.ts.map +1 -1
  19. package/dist/src/design_system/colors/index.js +4 -4
  20. package/dist/src/design_system/colors/index.js.map +1 -1
  21. package/dist/tsconfig.build.tsbuildinfo +1 -0
  22. package/package.json +7 -5
  23. package/.stylelintrc +0 -12
  24. package/CHANGELOG.md +0 -3334
  25. package/CODEOWNERS +0 -7
  26. package/dist/src/design_system/colors/generated/dark.d.ts.map +0 -1
  27. package/dist/src/design_system/colors/generated/dark.js.map +0 -1
  28. package/dist/src/design_system/colors/generated/light.d.ts.map +0 -1
  29. package/dist/src/design_system/colors/generated/light.js +0 -147
  30. package/dist/src/design_system/colors/generated/light.js.map +0 -1
  31. package/dist/src/design_system/colors/generated/palette.dark.d.ts.map +0 -1
  32. package/dist/src/design_system/colors/generated/palette.dark.js.map +0 -1
  33. package/dist/src/design_system/colors/generated/palette.light.d.ts.map +0 -1
  34. package/dist/src/design_system/colors/generated/palette.light.js +0 -74
  35. package/dist/src/design_system/colors/generated/palette.light.js.map +0 -1
  36. package/dist/src/design_system/colors_theme.d.ts +0 -213
  37. package/dist/src/design_system/colors_theme.d.ts.map +0 -1
  38. package/dist/src/design_system/colors_theme.js +0 -213
  39. package/dist/src/design_system/colors_theme.js.map +0 -1
  40. package/dist/src/design_system/properties_theme.d.ts +0 -175
  41. package/dist/src/design_system/properties_theme.d.ts.map +0 -1
  42. package/dist/src/design_system/properties_theme.js +0 -315
  43. package/dist/src/design_system/properties_theme.js.map +0 -1
  44. package/eslint.config.mjs +0 -44
  45. package/src/codemods/generate_typograpy_tokens_files.mjs +0 -137
  46. package/src/components/action_link.tsx +0 -60
  47. package/src/components/actor_template_card.tsx +0 -116
  48. package/src/components/badge.tsx +0 -148
  49. package/src/components/banner.tsx +0 -94
  50. package/src/components/blog_article.tsx +0 -85
  51. package/src/components/box.tsx +0 -127
  52. package/src/components/button.tsx +0 -305
  53. package/src/components/chip.tsx +0 -128
  54. package/src/components/code/action_button.tsx +0 -96
  55. package/src/components/code/code_block/code_block.styled.tsx +0 -180
  56. package/src/components/code/code_block/code_block.tsx +0 -224
  57. package/src/components/code/code_block/code_block_with_tabs.tsx +0 -257
  58. package/src/components/code/code_block/utils.tsx +0 -67
  59. package/src/components/code/index.ts +0 -5
  60. package/src/components/code/inline_code/inline_code.tsx +0 -62
  61. package/src/components/code/one_line_code/one_line_code.tsx +0 -228
  62. package/src/components/code/prism_highlighter.tsx +0 -180
  63. package/src/components/color_wheel_gradient.tsx +0 -31
  64. package/src/components/floating/index.ts +0 -3
  65. package/src/components/floating/menu.tsx +0 -189
  66. package/src/components/floating/menu_common.tsx +0 -31
  67. package/src/components/floating/menu_components.tsx +0 -99
  68. package/src/components/image.tsx +0 -24
  69. package/src/components/index.ts +0 -22
  70. package/src/components/link.tsx +0 -114
  71. package/src/components/message.tsx +0 -153
  72. package/src/components/rating.tsx +0 -106
  73. package/src/components/readme_renderer/index.ts +0 -3
  74. package/src/components/readme_renderer/pythonize_value.ts +0 -76
  75. package/src/components/readme_renderer/table_of_contents.tsx +0 -272
  76. package/src/components/readme_renderer/utils.tsx +0 -46
  77. package/src/components/simple_markdown/index.ts +0 -2
  78. package/src/components/simple_markdown/simple_markdown.tsx +0 -214
  79. package/src/components/simple_markdown/simple_markdown_components.tsx +0 -293
  80. package/src/components/tabs/index.ts +0 -2
  81. package/src/components/tabs/tab.tsx +0 -217
  82. package/src/components/tabs/tabs.tsx +0 -169
  83. package/src/components/tag.tsx +0 -196
  84. package/src/components/text/heading_content.tsx +0 -56
  85. package/src/components/text/heading_marketing.tsx +0 -55
  86. package/src/components/text/heading_shared.tsx +0 -55
  87. package/src/components/text/index.ts +0 -19
  88. package/src/components/text/text_base.tsx +0 -52
  89. package/src/components/text/text_content.tsx +0 -104
  90. package/src/components/text/text_marketing.tsx +0 -152
  91. package/src/components/text/text_shared.tsx +0 -95
  92. package/src/components/tile/horizontal_tile.tsx +0 -77
  93. package/src/components/tile/index.ts +0 -2
  94. package/src/components/tile/shared.ts +0 -27
  95. package/src/components/tile/vertical_tile.tsx +0 -59
  96. package/src/components/to_consolidate/card.tsx +0 -141
  97. package/src/components/to_consolidate/index.ts +0 -4
  98. package/src/components/to_consolidate/markdown.tsx +0 -609
  99. package/src/components/to_consolidate/pagination.tsx +0 -136
  100. package/src/components/to_consolidate/tab_number_chip.tsx +0 -31
  101. package/src/design_system/colors/build_color_tokens.js +0 -175
  102. package/src/design_system/colors/figma_color_tokens.dark.json +0 -886
  103. package/src/design_system/colors/figma_color_tokens.light.json +0 -886
  104. package/src/design_system/colors/generated/colors_theme.dark.ts +0 -110
  105. package/src/design_system/colors/generated/colors_theme.light.ts +0 -110
  106. package/src/design_system/colors/generated/dark.ts +0 -147
  107. package/src/design_system/colors/generated/palette.dark.ts +0 -74
  108. package/src/design_system/colors/generated/properties_theme.ts +0 -179
  109. package/src/design_system/colors/index.ts +0 -7
  110. package/src/design_system/colors_theme.ts +0 -213
  111. package/src/design_system/properties_theme.ts +0 -453
  112. package/src/design_system/supernova_typography_tokens.json +0 -657
  113. package/src/design_system/theme.ts +0 -25
  114. package/src/design_system/tokens/index.ts +0 -5
  115. package/src/design_system/tokens/layouts.ts +0 -29
  116. package/src/design_system/tokens/radiuses.ts +0 -22
  117. package/src/design_system/tokens/shadows.ts +0 -22
  118. package/src/design_system/tokens/spaces.ts +0 -15
  119. package/src/design_system/tokens/transitions.ts +0 -19
  120. package/src/design_system/typography_theme.ts +0 -197
  121. package/src/index.ts +0 -8
  122. package/src/type_utils.ts +0 -7
  123. package/src/ui_dependency_provider.tsx +0 -58
  124. package/src/utils/copy_to_clipboard.ts +0 -24
  125. package/src/utils/image_color.ts +0 -42
  126. package/src/utils/index.ts +0 -4
  127. package/src/utils/resize_observer.ts +0 -18
  128. package/src/utils/sanitization.ts +0 -14
  129. package/tsconfig.build.json +0 -17
  130. package/tsconfig.json +0 -10
  131. /package/{src/design_system/colors/generated → style/colors}/dark.scss +0 -0
  132. /package/{src/design_system/colors/generated → style/colors}/light.scss +0 -0
  133. /package/{src/design_system/colors/generated → style/colors}/palette.dark.scss +0 -0
  134. /package/{src/design_system/colors/generated → style/colors}/palette.light.scss +0 -0
@@ -1,196 +0,0 @@
1
- import React, { type ForwardedRef, forwardRef } from 'react';
2
- import styled, { css, type FlattenSimpleInterpolation } from 'styled-components';
3
-
4
- import type { IconComponent, IconSize } from '@apify/ui-icons';
5
-
6
- import { theme } from '../design_system/theme.js';
7
- import type { WithTransientProps } from '../type_utils.js';
8
- import { Box, type MarginSpacingProps, type RegularBoxProps } from './box.js';
9
- import type { RegularButtonProps } from './button.js';
10
- import { Link, type RegularLinkProps } from './link.js';
11
- import { Text } from './text/index.js';
12
- import { type SharedTextSize, type SharedTextType } from './text/text_shared.js';
13
-
14
- type TagSize = SharedTextSize;
15
- export const TAG_SIZES: TagSize[] = ['big', 'regular', 'small'];
16
-
17
- const TAG_ICON_SIZES = {
18
- big: '20',
19
- regular: '16',
20
- small: '12',
21
- } satisfies Record<TagSize, IconSize>;
22
-
23
- export const TAG_VARIANTS = ['primary', 'secondary', 'subtle', 'accent', 'success', 'warning', 'error'] as const;
24
- type TagVariant = typeof TAG_VARIANTS[number];
25
-
26
- type TagNodeType = Extract<React.ElementType, 'a' | 'button'>;
27
- type TagNodePropsMap = {
28
- a: {
29
- element: HTMLAnchorElement;
30
- props: RegularLinkProps;
31
- };
32
- button: {
33
- element: HTMLButtonElement;
34
- props: RegularButtonProps;
35
- };
36
- }
37
-
38
- type SharedTagProps = Omit<RegularBoxProps, 'as'> & MarginSpacingProps;
39
- export type TagProps<T extends TagNodeType> = SharedTagProps & ({
40
- as?: T;
41
- size?: TagSize;
42
- type?: SharedTextType;
43
- variant?: TagVariant;
44
- LeadingIcon?: IconComponent;
45
- TrailingIcon?: IconComponent;
46
- } & Omit<TagNodePropsMap[T]['props'], 'size'>);
47
-
48
- const tagSizeStyle = {
49
- big: css`
50
- height: 4rem;
51
- padding: ${theme.space.space8} ${theme.space.space12};
52
- border-radius: ${theme.radius.radius12};
53
- `,
54
- regular: css`
55
- height: 2.8rem;
56
- padding: ${theme.space.space4} ${theme.space.space8};
57
- border-radius: ${theme.radius.radius8};
58
- `,
59
- small: css`
60
- height: 2rem;
61
- padding: ${theme.space.space2} ${theme.space.space6};
62
- border-radius: ${theme.radius.radius4};
63
-
64
- &:has(> svg:last-child:nth-child(1)) {
65
- padding: ${theme.space.space2} ${theme.space.space4};
66
- }
67
- `,
68
- } satisfies Record<TagSize, FlattenSimpleInterpolation>;
69
-
70
- const tagVariantStyle = {
71
- primary: css`
72
- color: ${theme.color.neutral.text};
73
- fill: ${theme.color.neutral.icon};
74
- background: transparent;
75
- box-shadow: inset 0 0 0 1px ${theme.color.neutral.border};
76
-
77
- &:hover {
78
- background: ${theme.color.neutral.hover};
79
- }
80
- `,
81
- secondary: css`
82
- color: ${theme.color.neutral.text};
83
- fill: ${theme.color.neutral.icon};
84
- background: transparent;
85
-
86
- &:hover {
87
- background: ${theme.color.neutral.hover};
88
- }
89
- `,
90
- subtle: css`
91
- color: ${theme.color.neutral.text};
92
- fill: ${theme.color.neutral.icon};
93
- background: ${theme.color.neutral.backgroundSubtle};
94
-
95
- &:hover {
96
- background: ${theme.color.neutral.hover};
97
- }
98
- `,
99
- accent: css`
100
- color: ${theme.color.primary.chipText};
101
- fill: ${theme.color.primary.chipText};
102
- background: ${theme.color.primary.background};
103
-
104
- &:hover {
105
- background: ${theme.color.primary.backgroundHover};
106
- }
107
- `,
108
- success: css`
109
- color: ${theme.color.success.chipText};
110
- fill: ${theme.color.success.chipText};
111
- background: ${theme.color.success.background};
112
-
113
- &:hover {
114
- background: ${theme.color.success.backgroundHover};
115
- }
116
- `,
117
- warning: css`
118
- color: ${theme.color.warning.chipText};
119
- fill: ${theme.color.warning.chipText};
120
- background: ${theme.color.warning.background};
121
-
122
- &:hover {
123
- background: ${theme.color.warning.backgroundHover};
124
- }
125
- `,
126
- error: css`
127
- color: ${theme.color.danger.chipText};
128
- fill: ${theme.color.danger.chipText};
129
- background: ${theme.color.danger.background};
130
-
131
- &:hover {
132
- background: ${theme.color.danger.backgroundHover};
133
- }
134
- `,
135
- } satisfies Record<TagVariant, FlattenSimpleInterpolation>;
136
-
137
- type StyledTagProps = WithTransientProps<
138
- Required<Pick<TagProps<TagNodeType>, 'size' | 'variant'>>
139
- >;
140
-
141
- const StyledTag = styled(Box)<StyledTagProps>`
142
- ${({ $size }) => tagSizeStyle[$size]};
143
- ${({ $variant }) => tagVariantStyle[$variant]};
144
-
145
- /* Static styles */
146
- width: fit-content;
147
- border: none;
148
- outline: none;
149
- display: flex;
150
- flex-direction: row;
151
- justify-content: center;
152
- align-items: center;
153
- white-space: nowrap;
154
- gap: ${theme.space.space4};
155
- cursor: pointer;
156
- transition: background ${theme.transition.fastEaseOut};
157
- `;
158
-
159
- /**
160
- * Component for displaying inherenly interactive chip descendant
161
- */
162
- function TagWrapper<T extends TagNodeType>({
163
- as,
164
- size = 'small',
165
- type = 'body',
166
- variant = 'primary',
167
- LeadingIcon,
168
- TrailingIcon,
169
- children,
170
- ...props
171
- }: TagProps<T>,
172
- ref: ForwardedRef<TagNodePropsMap[T]['element']>,
173
- ) {
174
- const component: React.ElementType = (as === 'a' ? Link : as ?? 'button');
175
-
176
- return (
177
- <StyledTag
178
- as={component}
179
- ref={ref}
180
- $variant={variant}
181
- $size={size}
182
- {...props}
183
- >
184
- {LeadingIcon && <LeadingIcon size={TAG_ICON_SIZES[size]} />}
185
- {children && (<Text size={size} type={type} weight="medium">{children}</Text>)}
186
- {TrailingIcon && <TrailingIcon size={TAG_ICON_SIZES[size]} />}
187
- </StyledTag>
188
- );
189
- }
190
- TagWrapper.displayName = 'Tag';
191
-
192
- // `forwardRef` can't handle generic types, should be fixable with React 19
193
- export const Tag = forwardRef(TagWrapper) as <T extends TagNodeType>(
194
- // eslint-disable-next-line no-use-before-define -- see comment above 👆
195
- props: TagProps<T> & { ref?: ForwardedRef<TagNodePropsMap[T]['element']> },
196
- ) => ReturnType<typeof TagWrapper>;
@@ -1,56 +0,0 @@
1
- import React from 'react';
2
- import styled, { css } 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 HeadingContentType = 'heading1' | 'heading2' | 'heading3' | 'heading4' | 'heading5' | 'heading6';
10
-
11
- interface HeadingContentTransientProps {
12
- type?: HeadingContentType,
13
- }
14
-
15
- const getContentHeadingStyles = (headingType: HeadingContentType) => css`
16
- ${theme.typography.content.mobile[headingType]}
17
-
18
- @media (min-width: ${theme.layout.tablet}) {
19
- ${theme.typography.content.tablet[headingType]}
20
- }
21
-
22
- @media (min-width: ${theme.layout.desktop}) {
23
- ${theme.typography.content.desktop[headingType]}
24
- }
25
- `;
26
-
27
- type StyledHeadingContentProps = WithTransientProps<HeadingContentTransientProps>;
28
- export type HeadingContentProps = HeadingContentTransientProps & TextBaseProps;
29
-
30
- const HEADING_CONTENT_DEFAULT_ELEMENTS = {
31
- heading1: 'h1',
32
- heading2: 'h2',
33
- heading3: 'h3',
34
- heading4: 'h4',
35
- heading5: 'h5',
36
- heading6: 'h6',
37
- } as const;
38
-
39
- const StyledHeadingContent = styled(TextBaseComponent)<StyledHeadingContentProps>`
40
- ${(props) => getContentHeadingStyles(props.$type || 'heading1')}
41
- `;
42
-
43
- export const HeadingContent: React.FC<HeadingContentProps> = ({
44
- type,
45
- as,
46
- ...rest
47
- }) => {
48
- return (
49
- <StyledHeadingContent
50
- $type={type}
51
- forwardedAs={as || HEADING_CONTENT_DEFAULT_ELEMENTS[type || 'heading1']}
52
- m='none'
53
- {...rest}
54
- />
55
- );
56
- };
@@ -1,55 +0,0 @@
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 HeadingMarketingType = 'titleXs' | 'titleS' | 'titleM' | 'titleL' | 'titleXl' | 'title2xl' | 'title3xl';
10
-
11
- interface HeadingMarketingTransientProps {
12
- type?: HeadingMarketingType,
13
- }
14
-
15
- type StyledHeadingMarketingProps = WithTransientProps<HeadingMarketingTransientProps>;
16
- export type HeadingMarketingProps = HeadingMarketingTransientProps & TextBaseProps;
17
-
18
- const HEADING_MARKETING_DEFAULT_ELEMENTS: { [Type in HeadingMarketingType]: 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 StyledHeadingMarketing = styled(TextBaseComponent)<StyledHeadingMarketingProps>`
29
- ${(props) => `
30
- ${theme.typography.marketing.mobile[props.$type || 'titleL']}
31
-
32
- @media (${theme.device.tablet}) {
33
- ${theme.typography.marketing.tablet[props.$type || 'titleL']}
34
- }
35
-
36
- @media (${theme.device.desktop}) {
37
- ${theme.typography.marketing.desktop[props.$type || 'titleL']}
38
- }
39
- `}
40
- `;
41
-
42
- export const HeadingMarketing: React.FC<HeadingMarketingProps> = ({
43
- type,
44
- as,
45
- ...rest
46
- }) => {
47
- return (
48
- <StyledHeadingMarketing
49
- $type={type}
50
- forwardedAs={as || HEADING_MARKETING_DEFAULT_ELEMENTS[type || 'titleL']}
51
- m='none'
52
- {...rest}
53
- />
54
- );
55
- };
@@ -1,55 +0,0 @@
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
- };
@@ -1,19 +0,0 @@
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
- };
@@ -1,52 +0,0 @@
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
- );
@@ -1,104 +0,0 @@
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';
@@ -1,152 +0,0 @@
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';