@apify/ui-library 0.71.1-featcolortokens-178953.55 → 0.71.1-featcolortokens-178953.58
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 -0
- package/package.json +7 -5
- package/.stylelintrc +0 -12
- package/CHANGELOG.md +0 -3334
- package/CODEOWNERS +0 -7
- package/eslint.config.mjs +0 -44
- package/src/codemods/generate_typograpy_tokens_files.mjs +0 -137
- package/src/components/action_link.tsx +0 -60
- package/src/components/actor_template_card.tsx +0 -116
- package/src/components/badge.tsx +0 -148
- package/src/components/banner.tsx +0 -94
- package/src/components/blog_article.tsx +0 -85
- package/src/components/box.tsx +0 -127
- package/src/components/button.tsx +0 -305
- package/src/components/chip.tsx +0 -128
- package/src/components/code/action_button.tsx +0 -96
- package/src/components/code/code_block/code_block.styled.tsx +0 -180
- package/src/components/code/code_block/code_block.tsx +0 -224
- package/src/components/code/code_block/code_block_with_tabs.tsx +0 -257
- package/src/components/code/code_block/utils.tsx +0 -67
- package/src/components/code/index.ts +0 -5
- package/src/components/code/inline_code/inline_code.tsx +0 -62
- package/src/components/code/one_line_code/one_line_code.tsx +0 -228
- package/src/components/code/prism_highlighter.tsx +0 -180
- package/src/components/color_wheel_gradient.tsx +0 -31
- package/src/components/floating/index.ts +0 -3
- package/src/components/floating/menu.tsx +0 -189
- package/src/components/floating/menu_common.tsx +0 -31
- package/src/components/floating/menu_components.tsx +0 -99
- package/src/components/image.tsx +0 -24
- package/src/components/index.ts +0 -22
- package/src/components/link.tsx +0 -114
- package/src/components/message.tsx +0 -153
- package/src/components/rating.tsx +0 -106
- package/src/components/readme_renderer/index.ts +0 -3
- package/src/components/readme_renderer/pythonize_value.ts +0 -76
- package/src/components/readme_renderer/table_of_contents.tsx +0 -272
- package/src/components/readme_renderer/utils.tsx +0 -46
- package/src/components/simple_markdown/index.ts +0 -2
- package/src/components/simple_markdown/simple_markdown.tsx +0 -214
- package/src/components/simple_markdown/simple_markdown_components.tsx +0 -293
- package/src/components/tabs/index.ts +0 -2
- package/src/components/tabs/tab.tsx +0 -217
- package/src/components/tabs/tabs.tsx +0 -169
- package/src/components/tag.tsx +0 -196
- package/src/components/text/heading_content.tsx +0 -56
- package/src/components/text/heading_marketing.tsx +0 -55
- package/src/components/text/heading_shared.tsx +0 -55
- package/src/components/text/index.ts +0 -19
- package/src/components/text/text_base.tsx +0 -52
- package/src/components/text/text_content.tsx +0 -104
- package/src/components/text/text_marketing.tsx +0 -152
- package/src/components/text/text_shared.tsx +0 -95
- package/src/components/tile/horizontal_tile.tsx +0 -77
- package/src/components/tile/index.ts +0 -2
- package/src/components/tile/shared.ts +0 -27
- package/src/components/tile/vertical_tile.tsx +0 -59
- package/src/components/to_consolidate/card.tsx +0 -141
- package/src/components/to_consolidate/index.ts +0 -4
- package/src/components/to_consolidate/markdown.tsx +0 -609
- package/src/components/to_consolidate/pagination.tsx +0 -136
- package/src/components/to_consolidate/tab_number_chip.tsx +0 -31
- package/src/design_system/colors/build_color_tokens.js +0 -169
- package/src/design_system/colors/figma_color_tokens.dark.json +0 -886
- package/src/design_system/colors/figma_color_tokens.light.json +0 -886
- package/src/design_system/colors/generated/colors_theme.dark.ts +0 -110
- package/src/design_system/colors/generated/colors_theme.light.ts +0 -110
- package/src/design_system/colors/generated/dark.ts +0 -147
- package/src/design_system/colors/generated/light.ts +0 -147
- package/src/design_system/colors/generated/palette.dark.ts +0 -74
- package/src/design_system/colors/generated/palette.light.ts +0 -74
- package/src/design_system/colors/generated/properties_theme.ts +0 -179
- package/src/design_system/colors/index.ts +0 -7
- package/src/design_system/colors_theme.ts +0 -213
- package/src/design_system/properties_theme.ts +0 -453
- package/src/design_system/supernova_typography_tokens.json +0 -657
- package/src/design_system/theme.ts +0 -25
- package/src/design_system/tokens/index.ts +0 -5
- package/src/design_system/tokens/layouts.ts +0 -29
- package/src/design_system/tokens/radiuses.ts +0 -22
- package/src/design_system/tokens/shadows.ts +0 -22
- package/src/design_system/tokens/spaces.ts +0 -15
- package/src/design_system/tokens/transitions.ts +0 -19
- package/src/design_system/typography_theme.ts +0 -197
- package/src/index.ts +0 -8
- package/src/type_utils.ts +0 -7
- package/src/ui_dependency_provider.tsx +0 -58
- package/src/utils/copy_to_clipboard.ts +0 -24
- package/src/utils/image_color.ts +0 -42
- package/src/utils/index.ts +0 -4
- package/src/utils/resize_observer.ts +0 -18
- package/src/utils/sanitization.ts +0 -14
- package/style-dictionary.config.json +0 -29
- package/tsconfig.build.json +0 -17
- package/tsconfig.json +0 -10
- /package/{src/design_system/colors/generated → style/colors}/dark.scss +0 -0
- /package/{src/design_system/colors/generated → style/colors}/light.scss +0 -0
- /package/{src/design_system/colors/generated → style/colors}/palette.dark.scss +0 -0
- /package/{src/design_system/colors/generated → style/colors}/palette.light.scss +0 -0
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import type { FC } from 'react';
|
|
2
|
-
import { useMemo } from 'react';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
|
|
5
|
-
import { ChevronLeftIcon, ChevronRightIcon } from '@apify/ui-icons';
|
|
6
|
-
|
|
7
|
-
import { theme } from '../../design_system/theme.js';
|
|
8
|
-
import { Box } from '../box.js';
|
|
9
|
-
import { Button } from '../button.js';
|
|
10
|
-
|
|
11
|
-
const LEADING_THREE_DOTS_PAGE_KEY = -1;
|
|
12
|
-
const TRAILING_THREE_DOTS_PAGE_KEY = -2;
|
|
13
|
-
|
|
14
|
-
const PaginationButtonBase = styled(Button).attrs({ variant: 'text' })`
|
|
15
|
-
padding: 0;
|
|
16
|
-
height: 28px;
|
|
17
|
-
min-width: 28px;
|
|
18
|
-
font-weight: 400 !important; /* default for button is medium, force regular to all page selection buttons */
|
|
19
|
-
|
|
20
|
-
&:disabled {
|
|
21
|
-
background: transparent;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
&.currentPage {
|
|
25
|
-
background-color: ${theme.color.neutral.chipBackground};
|
|
26
|
-
|
|
27
|
-
&:hover {
|
|
28
|
-
background-color: ${theme.color.neutral.hover};
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
`;
|
|
32
|
-
|
|
33
|
-
const StyledPageSelectionButtons = styled(Box)`
|
|
34
|
-
display: inline-flex;
|
|
35
|
-
gap: ${theme.space.space8};
|
|
36
|
-
`;
|
|
37
|
-
|
|
38
|
-
export type PaginationButtonsProps = {
|
|
39
|
-
page: number;
|
|
40
|
-
totalPages: number;
|
|
41
|
-
onPageChange: (page: number) => void;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// TODO: Consolidate and move to /library
|
|
45
|
-
export const PaginationButtons: FC<PaginationButtonsProps> = ({
|
|
46
|
-
page,
|
|
47
|
-
totalPages,
|
|
48
|
-
onPageChange,
|
|
49
|
-
}) => {
|
|
50
|
-
// Pages to display buttons for (counting from 0, -1 and -2 will mean a special '...' disabled button)
|
|
51
|
-
const pagesToDisplay = useMemo(() => {
|
|
52
|
-
const result = [];
|
|
53
|
-
if (totalPages <= 8) {
|
|
54
|
-
for (let i = 0; i < totalPages; i++) {
|
|
55
|
-
result.push(i);
|
|
56
|
-
}
|
|
57
|
-
} else if (page < 5) {
|
|
58
|
-
for (let i = 0; i < 7; i++) {
|
|
59
|
-
result.push(i);
|
|
60
|
-
}
|
|
61
|
-
result.push(TRAILING_THREE_DOTS_PAGE_KEY);
|
|
62
|
-
} else if (page < totalPages - 4) {
|
|
63
|
-
result.push(0);
|
|
64
|
-
result.push(LEADING_THREE_DOTS_PAGE_KEY);
|
|
65
|
-
for (let i = page - 2; i <= page + 2; i++) {
|
|
66
|
-
result.push(i);
|
|
67
|
-
}
|
|
68
|
-
result.push(TRAILING_THREE_DOTS_PAGE_KEY);
|
|
69
|
-
} else {
|
|
70
|
-
result.push(0);
|
|
71
|
-
result.push(LEADING_THREE_DOTS_PAGE_KEY);
|
|
72
|
-
for (let i = totalPages - 6; i < totalPages; i++) {
|
|
73
|
-
result.push(i);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return result;
|
|
77
|
-
}, [page, totalPages]);
|
|
78
|
-
|
|
79
|
-
return (
|
|
80
|
-
<StyledPageSelectionButtons>
|
|
81
|
-
<PaginationButtonBase
|
|
82
|
-
data-test='page-prev-button'
|
|
83
|
-
disabled={page <= 0}
|
|
84
|
-
onClick={() => onPageChange(page - 1)}
|
|
85
|
-
trackingId='PaginationPrevPage'
|
|
86
|
-
>
|
|
87
|
-
<ChevronLeftIcon size="16" />
|
|
88
|
-
</PaginationButtonBase>
|
|
89
|
-
{pagesToDisplay.map((pageToDisplay) => {
|
|
90
|
-
if (pageToDisplay === LEADING_THREE_DOTS_PAGE_KEY || pageToDisplay === TRAILING_THREE_DOTS_PAGE_KEY) {
|
|
91
|
-
return (
|
|
92
|
-
<PaginationButtonBase
|
|
93
|
-
trackingId='ThreeDots'
|
|
94
|
-
key={pageToDisplay}
|
|
95
|
-
onClick={() => undefined}
|
|
96
|
-
disabled
|
|
97
|
-
>
|
|
98
|
-
...
|
|
99
|
-
</PaginationButtonBase>
|
|
100
|
-
);
|
|
101
|
-
}
|
|
102
|
-
if (pageToDisplay === page) {
|
|
103
|
-
return (
|
|
104
|
-
<PaginationButtonBase
|
|
105
|
-
key={pageToDisplay}
|
|
106
|
-
data-test='current-page-button'
|
|
107
|
-
trackingId='PaginationCurrentPage'
|
|
108
|
-
className='currentPage'
|
|
109
|
-
onClick={() => undefined}
|
|
110
|
-
>
|
|
111
|
-
{pageToDisplay + 1}
|
|
112
|
-
</PaginationButtonBase>
|
|
113
|
-
);
|
|
114
|
-
}
|
|
115
|
-
return (
|
|
116
|
-
<PaginationButtonBase
|
|
117
|
-
key={pageToDisplay}
|
|
118
|
-
data-test='page-number-button'
|
|
119
|
-
onClick={() => onPageChange(pageToDisplay)}
|
|
120
|
-
trackingId='PaginationNumberedPage'
|
|
121
|
-
>
|
|
122
|
-
{pageToDisplay + 1}
|
|
123
|
-
</PaginationButtonBase>
|
|
124
|
-
);
|
|
125
|
-
})}
|
|
126
|
-
<PaginationButtonBase
|
|
127
|
-
data-test='page-next-button'
|
|
128
|
-
disabled={page >= totalPages - 1}
|
|
129
|
-
onClick={() => onPageChange(page + 1)}
|
|
130
|
-
trackingId='PaginationNextPage'
|
|
131
|
-
>
|
|
132
|
-
<ChevronRightIcon size="16" />
|
|
133
|
-
</PaginationButtonBase>
|
|
134
|
-
</StyledPageSelectionButtons>
|
|
135
|
-
);
|
|
136
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import styled from 'styled-components';
|
|
3
|
-
|
|
4
|
-
import { theme } from '../../design_system/theme.js';
|
|
5
|
-
import { Text } from '../text/index.js';
|
|
6
|
-
|
|
7
|
-
const StyledChip = styled(Text)`
|
|
8
|
-
color: ${theme.color.neutral.text};
|
|
9
|
-
background-color: ${theme.color.neutral.chipBackground};
|
|
10
|
-
line-height: 1;
|
|
11
|
-
padding: ${theme.space.space2} ${theme.space.space4};
|
|
12
|
-
border-radius: ${theme.radius.radius8};
|
|
13
|
-
|
|
14
|
-
._disabled & {
|
|
15
|
-
background-color: ${theme.color.neutral.backgroundSubtle};
|
|
16
|
-
color: ${theme.color.neutral.textDisabled};
|
|
17
|
-
}
|
|
18
|
-
`;
|
|
19
|
-
|
|
20
|
-
interface ChipProps {
|
|
21
|
-
children: React.ReactNode;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export const TabNumberChip: React.FC<ChipProps> = ({ children, ...rest }) => {
|
|
25
|
-
return <StyledChip
|
|
26
|
-
size='small'
|
|
27
|
-
{...rest}
|
|
28
|
-
>
|
|
29
|
-
{children}
|
|
30
|
-
</StyledChip>;
|
|
31
|
-
};
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
import StyleDictionary from 'style-dictionary';
|
|
2
|
-
|
|
3
|
-
function toCamelCase(str) {
|
|
4
|
-
return str
|
|
5
|
-
.toLowerCase()
|
|
6
|
-
.replace(/[^a-zA-Z0-9]+(.)/g, (_, chr) => chr.toUpperCase());
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
function objectToTSLiteral(obj, indentLevel = 0) {
|
|
10
|
-
const indent = (level) => ' '.repeat(level); // 2-space indent
|
|
11
|
-
|
|
12
|
-
if (Array.isArray(obj)) {
|
|
13
|
-
if (obj.length === 0) return '[]';
|
|
14
|
-
return `[\n${obj
|
|
15
|
-
.map((item) => indent(indentLevel + 1) + objectToTSLiteral(item, indentLevel + 1))
|
|
16
|
-
.join(',\n')}\n${indent(indentLevel)}]`;
|
|
17
|
-
} if (obj && typeof obj === 'object') {
|
|
18
|
-
const entries = Object.entries(obj);
|
|
19
|
-
if (entries.length === 0) return '{}';
|
|
20
|
-
return `{\n${entries
|
|
21
|
-
.map(
|
|
22
|
-
([key, value]) => `${indent(indentLevel + 1)}${key}: ${objectToTSLiteral(value, indentLevel + 1)}`,
|
|
23
|
-
)
|
|
24
|
-
.join('\n')}\n${indent(indentLevel)}}${indentLevel > 0 ? ',' : ''}`;
|
|
25
|
-
} if (typeof obj === 'string') {
|
|
26
|
-
return `'${obj}',`; // add quotes and escape
|
|
27
|
-
}
|
|
28
|
-
return String(obj);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
async function buildTheme(theme) {
|
|
32
|
-
StyleDictionary.registerTransform({
|
|
33
|
-
name: 'name/prefix-color-name',
|
|
34
|
-
type: 'name',
|
|
35
|
-
transform: (prop) => {
|
|
36
|
-
// replace 'semantic' and 'decorative' with 'color' in the full token name
|
|
37
|
-
return prop.name
|
|
38
|
-
.replace(/^semantic/, 'color')
|
|
39
|
-
.replace(/^decorative/, 'color');
|
|
40
|
-
},
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
StyleDictionary.registerFormat({
|
|
44
|
-
name: 'typescript/css-variables-string',
|
|
45
|
-
format: ({ dictionary, options }) => {
|
|
46
|
-
const lines = dictionary.allTokens.map((token) => ` --${token.name}: ${token.$value};`);
|
|
47
|
-
return `/**
|
|
48
|
-
* Do not edit directly, this file was auto-generated.
|
|
49
|
-
*/
|
|
50
|
-
|
|
51
|
-
export const ${options.varName ?? 'tokens'} = \`\n${lines.join('\n')}\n\`;\n`;
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
StyleDictionary.registerFormat({
|
|
56
|
-
name: 'typescript/css-properties',
|
|
57
|
-
format: ({ dictionary, options }) => {
|
|
58
|
-
const properties = {};
|
|
59
|
-
dictionary.allTokens.forEach((token) => {
|
|
60
|
-
const path = token.path.slice(1).map(toCamelCase);
|
|
61
|
-
let current = properties;
|
|
62
|
-
for (let i = 0; i < path.length - 1; i++) {
|
|
63
|
-
const key = path[i];
|
|
64
|
-
if (!(key in current)) {
|
|
65
|
-
current[key] = {};
|
|
66
|
-
}
|
|
67
|
-
current = current[key];
|
|
68
|
-
}
|
|
69
|
-
current[path[path.length - 1]] = `var(--${token.name})`;
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
return `/**
|
|
73
|
-
* Do not edit directly, this file was auto-generated.
|
|
74
|
-
*/
|
|
75
|
-
|
|
76
|
-
export const ${options.varName ?? 'tokens'} = ${objectToTSLiteral(properties)} as const;\n`;
|
|
77
|
-
},
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
StyleDictionary.registerFormat({
|
|
81
|
-
name: 'typescript/css-colors',
|
|
82
|
-
format: ({ dictionary, options }) => {
|
|
83
|
-
const properties = {};
|
|
84
|
-
dictionary.allTokens.forEach((token) => {
|
|
85
|
-
const path = token.path.slice(1);
|
|
86
|
-
const name = toCamelCase(path.join(' '));
|
|
87
|
-
properties[name] = token.$value;
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
return `/**
|
|
91
|
-
* Do not edit directly, this file was auto-generated.
|
|
92
|
-
*/
|
|
93
|
-
|
|
94
|
-
export const ${options.varName ?? 'tokens'} = ${objectToTSLiteral(properties)} as const;\n`;
|
|
95
|
-
},
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
StyleDictionary.registerFilter({
|
|
99
|
-
name: 'only-colors',
|
|
100
|
-
filter: (token) => ['Semantic', 'Decorative'].includes(token.path[0]),
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
StyleDictionary.registerFilter({
|
|
104
|
-
name: 'only-palette',
|
|
105
|
-
filter: (token) => ['Palette'].includes(token.path[0]),
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
StyleDictionary.registerFilter({
|
|
109
|
-
name: 'only-theme',
|
|
110
|
-
filter: (token) => ['Decorative', 'Palette'].includes(token.path[0]),
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
const sd = await (new StyleDictionary()).extend({
|
|
114
|
-
source: [`src/design_system/colors/figma_color_tokens.${theme}.json`],
|
|
115
|
-
platforms: {
|
|
116
|
-
main: {
|
|
117
|
-
transformGroup: 'scss',
|
|
118
|
-
transforms: ['name/prefix-color-name'],
|
|
119
|
-
buildPath: 'src/design_system/colors/generated/',
|
|
120
|
-
files: [
|
|
121
|
-
{
|
|
122
|
-
destination: `${theme}.scss`,
|
|
123
|
-
format: 'scss/map-flat',
|
|
124
|
-
mapName: 'tokens',
|
|
125
|
-
filter: 'only-colors',
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
destination: `palette.${theme}.scss`,
|
|
129
|
-
format: 'scss/map-flat',
|
|
130
|
-
mapName: 'tokens',
|
|
131
|
-
filter: 'only-palette',
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
destination: `${theme}.ts`,
|
|
135
|
-
format: 'typescript/css-variables-string',
|
|
136
|
-
filter: 'only-colors',
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
destination: `palette.${theme}.ts`,
|
|
140
|
-
format: 'typescript/css-variables-string',
|
|
141
|
-
filter: 'only-palette',
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
destination: `properties_theme.ts`,
|
|
145
|
-
format: 'typescript/css-properties',
|
|
146
|
-
filter: 'only-colors',
|
|
147
|
-
options: {
|
|
148
|
-
varName: 'colorProperties',
|
|
149
|
-
},
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
destination: `colors_theme.${theme}.ts`,
|
|
153
|
-
format: 'typescript/css-colors',
|
|
154
|
-
filter: 'only-theme',
|
|
155
|
-
options: {
|
|
156
|
-
varName: `${theme}Theme`,
|
|
157
|
-
},
|
|
158
|
-
},
|
|
159
|
-
],
|
|
160
|
-
},
|
|
161
|
-
},
|
|
162
|
-
});
|
|
163
|
-
await sd.buildPlatform('main');
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
await Promise.all([
|
|
167
|
-
buildTheme('light'),
|
|
168
|
-
buildTheme('dark'),
|
|
169
|
-
]);
|