@apify/ui-library 0.71.1-featcolortokens-178953.63 → 0.71.1-featcolortokens-178953.70
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,141 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
import React, { forwardRef } from 'react';
|
|
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 { BoxProps } from '../box.js';
|
|
8
|
+
import { Box } from '../box.js';
|
|
9
|
+
import { Text } from '../text/index.js';
|
|
10
|
+
|
|
11
|
+
export const cardClassNames = {
|
|
12
|
+
WRAPPER: 'Card',
|
|
13
|
+
HEADER: 'Card-header',
|
|
14
|
+
CAPTION: 'Card-caption',
|
|
15
|
+
ACTIONS: 'Card-actions',
|
|
16
|
+
DESCRIPTION: 'Card-description',
|
|
17
|
+
CONTENT: 'Card-content',
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
interface TransientCardProps {
|
|
21
|
+
disabled?: boolean,
|
|
22
|
+
shadowless?: boolean,
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface RegularCardProps {
|
|
26
|
+
caption?: React.ReactNode;
|
|
27
|
+
description?: React.ReactNode;
|
|
28
|
+
actions?: React.ReactNode;
|
|
29
|
+
children: React.ReactNode;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export type StyledCardProps = WithTransientProps<TransientCardProps>;
|
|
33
|
+
export type CardProps = TransientCardProps & RegularCardProps & BoxProps;
|
|
34
|
+
|
|
35
|
+
export const StyledCardWrapper = styled(Box)<StyledCardProps>`
|
|
36
|
+
/* 👇 this is consoleStyle.partialStyle.card */
|
|
37
|
+
background-color: ${theme.color.neutral.cardBackground};
|
|
38
|
+
border: 1px solid ${theme.color.neutral.border};
|
|
39
|
+
border-radius: ${theme.radius.radius8};
|
|
40
|
+
box-shadow: var(--shadow-1);
|
|
41
|
+
padding: 2rem;
|
|
42
|
+
box-sizing: border-box;
|
|
43
|
+
|
|
44
|
+
/* Reset padding, it is dealt with within header and content styles */
|
|
45
|
+
padding: 0;
|
|
46
|
+
width: 100%;
|
|
47
|
+
font-size: 1.4rem;
|
|
48
|
+
position: relative;
|
|
49
|
+
|
|
50
|
+
& > .${cardClassNames.HEADER} {
|
|
51
|
+
display: flex;
|
|
52
|
+
flex-direction: row;
|
|
53
|
+
justify-content: space-between;
|
|
54
|
+
align-items: center; /* so it aligns nicely with various content in corner, eg. button */
|
|
55
|
+
padding: ${theme.space.space16} ${theme.space.space16} ${theme.space.space8};
|
|
56
|
+
border-radius: ${theme.radius.radius8} ${theme.radius.radius8} 0 0;
|
|
57
|
+
|
|
58
|
+
.${cardClassNames.ACTIONS} {
|
|
59
|
+
margin-left: 2rem;
|
|
60
|
+
|
|
61
|
+
button {
|
|
62
|
+
font-size: 1.4rem;
|
|
63
|
+
line-height: 1.4rem;
|
|
64
|
+
font-weight: 500;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
& > .${cardClassNames.DESCRIPTION} {
|
|
70
|
+
padding: 0rem ${theme.space.space16} ${theme.space.space16} ${theme.space.space16};
|
|
71
|
+
color: ${theme.color.neutral.textSubtle};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
& > .${cardClassNames.CONTENT} {
|
|
75
|
+
position: relative;
|
|
76
|
+
display: block;
|
|
77
|
+
padding: ${theme.space.space16};
|
|
78
|
+
border-bottom-right-radius: ${theme.radius.radius8};
|
|
79
|
+
border-bottom-left-radius: ${theme.radius.radius8};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
${({ $shadowless }) => ($shadowless && css`
|
|
83
|
+
box-shadow: none;
|
|
84
|
+
`)}
|
|
85
|
+
|
|
86
|
+
${({ $disabled }) => ($disabled && css`
|
|
87
|
+
.${cardClassNames.CONTENT} {
|
|
88
|
+
&::after {
|
|
89
|
+
content: '';
|
|
90
|
+
position: absolute;
|
|
91
|
+
top: 0; bottom: 0; left: 0; right: 0; /* stretch full */
|
|
92
|
+
background: ${theme.color.neutral.backgroundSubtle} !important;
|
|
93
|
+
opacity: 0.4;
|
|
94
|
+
pointer-events: all;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
`)}
|
|
98
|
+
`;
|
|
99
|
+
|
|
100
|
+
export const Card = forwardRef<HTMLElement, CardProps>(({
|
|
101
|
+
as,
|
|
102
|
+
className,
|
|
103
|
+
caption,
|
|
104
|
+
description,
|
|
105
|
+
actions,
|
|
106
|
+
children,
|
|
107
|
+
disabled,
|
|
108
|
+
shadowless,
|
|
109
|
+
...rest
|
|
110
|
+
}, ref) => {
|
|
111
|
+
return (
|
|
112
|
+
<StyledCardWrapper
|
|
113
|
+
$disabled={disabled}
|
|
114
|
+
$shadowless={shadowless}
|
|
115
|
+
forwardedAs={ as || 'section'}
|
|
116
|
+
className={clsx(cardClassNames.WRAPPER, className)}
|
|
117
|
+
data-test='card'
|
|
118
|
+
{...rest}
|
|
119
|
+
ref={ref}
|
|
120
|
+
>
|
|
121
|
+
{(!!caption || !!actions) && (
|
|
122
|
+
<header className={cardClassNames.HEADER} data-test='card-header'>
|
|
123
|
+
{caption && (
|
|
124
|
+
<Text
|
|
125
|
+
as='div'
|
|
126
|
+
size='big'
|
|
127
|
+
weight='bold'
|
|
128
|
+
className={cardClassNames.CAPTION}
|
|
129
|
+
data-test='card-caption'
|
|
130
|
+
>
|
|
131
|
+
{caption}
|
|
132
|
+
</Text>
|
|
133
|
+
)}
|
|
134
|
+
{actions && (<div className={cardClassNames.ACTIONS} data-test='card-actions'>{actions}</div>)}
|
|
135
|
+
</header>
|
|
136
|
+
)}
|
|
137
|
+
{description && (<div className={cardClassNames.DESCRIPTION} data-test='card-description'>{description}</div>)}
|
|
138
|
+
<div className={cardClassNames.CONTENT} data-test='card-content'>{children}</div>
|
|
139
|
+
</StyledCardWrapper>
|
|
140
|
+
);
|
|
141
|
+
});
|