@apify/ui-library 0.60.2 → 0.61.1-feataddaiagentcategories-114da5.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/CHANGELOG.md +11 -0
- package/dist/src/components/actor_template_card.d.ts +1 -0
- package/dist/src/components/actor_template_card.d.ts.map +1 -1
- package/dist/src/components/actor_template_card.js +31 -32
- package/dist/src/components/actor_template_card.js.map +1 -1
- package/dist/src/components/badge.d.ts +3 -3
- package/dist/src/components/badge.d.ts.map +1 -1
- package/dist/src/components/badge.js +32 -32
- package/dist/src/components/badge.js.map +1 -1
- package/dist/src/components/banner.d.ts.map +1 -1
- package/dist/src/components/banner.js +0 -2
- package/dist/src/components/banner.js.map +1 -1
- package/dist/src/components/button.d.ts +1 -1
- package/dist/src/components/button.d.ts.map +1 -1
- package/dist/src/components/button.js +1 -3
- package/dist/src/components/button.js.map +1 -1
- package/dist/src/components/code/code_block/code_block.d.ts +2 -2
- package/dist/src/components/code/code_block/code_block.d.ts.map +1 -1
- package/dist/src/components/code/code_block/code_block.js +2 -2
- package/dist/src/components/code/code_block/code_block.js.map +1 -1
- package/dist/src/components/code/one_line_code/one_line_code.js +1 -1
- package/dist/src/components/code/one_line_code/one_line_code.js.map +1 -1
- package/dist/src/components/code/syntax_highlighter.d.ts +2 -2
- package/dist/src/components/code/syntax_highlighter.d.ts.map +1 -1
- package/dist/src/components/code/syntax_highlighter.js +0 -1
- package/dist/src/components/code/syntax_highlighter.js.map +1 -1
- package/dist/src/components/floating/menu.js +2 -2
- package/dist/src/components/floating/menu.js.map +1 -1
- package/dist/src/components/floating/menu_common.js +1 -1
- package/dist/src/components/floating/menu_common.js.map +1 -1
- package/dist/src/components/floating/menu_components.d.ts +9 -5
- package/dist/src/components/floating/menu_components.d.ts.map +1 -1
- package/dist/src/components/floating/menu_components.js.map +1 -1
- package/dist/src/components/readme_renderer/index.d.ts +2 -2
- package/dist/src/components/readme_renderer/index.d.ts.map +1 -1
- package/dist/src/components/readme_renderer/index.js +2 -2
- package/dist/src/components/readme_renderer/index.js.map +1 -1
- package/dist/src/components/readme_renderer/pythonize_value.d.ts +1 -2
- package/dist/src/components/readme_renderer/pythonize_value.d.ts.map +1 -1
- package/dist/src/components/readme_renderer/pythonize_value.js +2 -3
- package/dist/src/components/readme_renderer/pythonize_value.js.map +1 -1
- package/dist/src/components/readme_renderer/table_of_contents.d.ts +1 -2
- package/dist/src/components/readme_renderer/table_of_contents.d.ts.map +1 -1
- package/dist/src/components/readme_renderer/table_of_contents.js +11 -9
- package/dist/src/components/readme_renderer/table_of_contents.js.map +1 -1
- package/dist/src/components/simple_markdown/simple_markdown.d.ts.map +1 -1
- package/dist/src/components/simple_markdown/simple_markdown.js +33 -33
- package/dist/src/components/simple_markdown/simple_markdown.js.map +1 -1
- package/dist/src/components/simple_markdown/simple_markdown_components.d.ts +1 -1
- package/dist/src/components/simple_markdown/simple_markdown_components.d.ts.map +1 -1
- package/dist/src/components/simple_markdown/simple_markdown_components.js +11 -13
- package/dist/src/components/simple_markdown/simple_markdown_components.js.map +1 -1
- package/dist/src/components/tag.d.ts +2 -2
- package/dist/src/components/tag.d.ts.map +1 -1
- package/dist/src/components/tag.js +1 -2
- package/dist/src/components/tag.js.map +1 -1
- package/dist/src/components/text/heading_content.js +0 -1
- package/dist/src/components/text/heading_content.js.map +1 -1
- package/dist/src/components/text/heading_marketing.js +0 -1
- package/dist/src/components/text/heading_marketing.js.map +1 -1
- package/dist/src/components/text/heading_shared.d.ts +2 -2
- package/dist/src/components/text/heading_shared.d.ts.map +1 -1
- package/dist/src/components/text/heading_shared.js +1 -3
- package/dist/src/components/text/heading_shared.js.map +1 -1
- package/dist/src/components/text/index.d.ts +2 -2
- package/dist/src/components/text/index.d.ts.map +1 -1
- package/dist/src/components/text/index.js +2 -2
- package/dist/src/components/text/index.js.map +1 -1
- package/dist/src/components/text/text_base.js +0 -1
- package/dist/src/components/text/text_base.js.map +1 -1
- package/dist/src/components/text/text_content.js +0 -1
- package/dist/src/components/text/text_content.js.map +1 -1
- package/dist/src/components/text/text_marketing.js +0 -1
- package/dist/src/components/text/text_marketing.js.map +1 -1
- package/dist/src/components/text/text_shared.d.ts +1 -2
- package/dist/src/components/text/text_shared.d.ts.map +1 -1
- package/dist/src/components/text/text_shared.js +1 -4
- package/dist/src/components/text/text_shared.js.map +1 -1
- package/dist/src/components/to_consolidate/card.js +0 -2
- package/dist/src/components/to_consolidate/card.js.map +1 -1
- package/dist/src/components/to_consolidate/markdown.d.ts.map +1 -1
- package/dist/src/components/to_consolidate/markdown.js +2 -1
- package/dist/src/components/to_consolidate/markdown.js.map +1 -1
- package/dist/src/design_system/theme.js +1 -1
- package/dist/src/design_system/theme.js.map +1 -1
- package/dist/src/design_system/tokens/spaces.d.ts +1 -1
- package/dist/src/design_system/tokens/spaces.d.ts.map +1 -1
- package/dist/src/design_system/tokens/spaces.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/eslint.config.mjs +36 -0
- package/package.json +8 -9
- package/src/codemods/generate_color_property_tokens.mjs +2 -1
- package/src/codemods/generate_color_theme_files.mjs +2 -1
- package/src/codemods/generate_typograpy_tokens_files.mjs +2 -1
- package/src/components/actor_template_card.tsx +54 -37
- package/src/components/badge.tsx +47 -47
- package/src/components/banner.tsx +1 -2
- package/src/components/button.tsx +4 -4
- package/src/components/code/code_block/code_block.tsx +22 -22
- package/src/components/code/one_line_code/one_line_code.tsx +1 -1
- package/src/components/code/syntax_highlighter.tsx +3 -5
- package/src/components/floating/menu.tsx +8 -8
- package/src/components/floating/menu_common.tsx +2 -2
- package/src/components/floating/menu_components.tsx +7 -2
- package/src/components/readme_renderer/index.ts +2 -2
- package/src/components/readme_renderer/pythonize_value.ts +2 -4
- package/src/components/readme_renderer/table_of_contents.tsx +26 -11
- package/src/components/simple_markdown/simple_markdown.tsx +36 -36
- package/src/components/simple_markdown/simple_markdown_components.tsx +26 -28
- package/src/components/tag.tsx +29 -28
- package/src/components/text/heading_content.tsx +1 -1
- package/src/components/text/heading_marketing.tsx +1 -1
- package/src/components/text/heading_shared.tsx +2 -4
- package/src/components/text/index.ts +2 -2
- package/src/components/text/text_base.tsx +1 -1
- package/src/components/text/text_content.tsx +1 -1
- package/src/components/text/text_marketing.tsx +1 -1
- package/src/components/text/text_shared.tsx +2 -5
- package/src/components/to_consolidate/card.tsx +2 -2
- package/src/components/to_consolidate/markdown.tsx +2 -1
- package/src/design_system/generate_color_definitions.js +4 -3
- package/src/design_system/theme.ts +4 -4
- package/src/design_system/tokens/spaces.ts +2 -2
- package/.eslintrc +0 -41
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
2
|
import React, {
|
|
3
|
-
useMemo,
|
|
4
3
|
useCallback,
|
|
4
|
+
useMemo,
|
|
5
5
|
} from 'react';
|
|
6
6
|
import ReactMarkdown from 'react-markdown';
|
|
7
7
|
import type { AllowElement } from 'react-markdown/lib/rehype-filter';
|
|
@@ -87,10 +87,11 @@ interface CustomHTMLAnchorElement extends Omit<HTMLAnchorElement, 'children' | '
|
|
|
87
87
|
hash: string;
|
|
88
88
|
tagName: string;
|
|
89
89
|
type: string;
|
|
90
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
90
91
|
parentNode: any;
|
|
91
92
|
}
|
|
92
93
|
|
|
93
|
-
const handleScroll = (anchors: CustomHTMLAnchorElement[]
|
|
94
|
+
const handleScroll = (anchors: CustomHTMLAnchorElement[], headlines: HTMLElement[], anchorLists: HTMLUListElement[] | null, headingOffsetPx: number) => {
|
|
94
95
|
if (!anchors || !headlines) return;
|
|
95
96
|
|
|
96
97
|
// Items that are past scroll
|
|
@@ -132,17 +133,31 @@ const handleScroll = (anchors: CustomHTMLAnchorElement[] | null, headlines: HTML
|
|
|
132
133
|
}
|
|
133
134
|
};
|
|
134
135
|
|
|
135
|
-
const assignHeadingLevelsRecursively = (
|
|
136
|
+
const assignHeadingLevelsRecursively = (
|
|
137
|
+
{
|
|
138
|
+
children,
|
|
139
|
+
tagName,
|
|
140
|
+
properties,
|
|
141
|
+
}: {
|
|
142
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
143
|
+
children: any[],
|
|
144
|
+
tagName: string,
|
|
145
|
+
properties: { className: string }
|
|
146
|
+
},
|
|
147
|
+
level: number,
|
|
148
|
+
) => {
|
|
136
149
|
if (level > 3) return;
|
|
150
|
+
let currentLevel = level;
|
|
137
151
|
if (tagName === 'ul') {
|
|
138
|
-
|
|
139
|
-
|
|
152
|
+
// eslint-disable-next-line no-param-reassign
|
|
153
|
+
properties.className = `level-${currentLevel}`; // assign level className
|
|
154
|
+
currentLevel += 1; // increase current heading level;
|
|
140
155
|
}
|
|
141
156
|
|
|
142
|
-
children?.forEach((child
|
|
157
|
+
children?.forEach((child) => {
|
|
143
158
|
// We only care about ul and li elements - we don't need to traverse any other
|
|
144
159
|
if (child.type === 'element' && (tagName === 'ul' || tagName === 'li')) {
|
|
145
|
-
assignHeadingLevelsRecursively(child,
|
|
160
|
+
assignHeadingLevelsRecursively(child, currentLevel);
|
|
146
161
|
}
|
|
147
162
|
});
|
|
148
163
|
};
|
|
@@ -154,7 +169,7 @@ export interface TableOfContentsProps {
|
|
|
154
169
|
allowElement?: AllowElement;
|
|
155
170
|
}
|
|
156
171
|
|
|
157
|
-
const
|
|
172
|
+
const TableOfContentsComponent = ({
|
|
158
173
|
markdown,
|
|
159
174
|
headingOffsetPx = 10,
|
|
160
175
|
allowElement,
|
|
@@ -168,9 +183,9 @@ const TableOfContents = ({
|
|
|
168
183
|
const hasTopLevelHeading = useMemo(() => !!cleanedMarkdown.match(/^#\s.+$/m), [cleanedMarkdown]);
|
|
169
184
|
|
|
170
185
|
const tocRef = useCallback((node: HTMLElement | null) => {
|
|
171
|
-
const anchors = node ? Array.from(node.querySelectorAll('a')) :
|
|
186
|
+
const anchors = node ? Array.from(node.querySelectorAll('a')) : [];
|
|
172
187
|
const anchorLists = node ? Array.from(node.querySelectorAll('ul')) : null;
|
|
173
|
-
const headlines = (anchors
|
|
188
|
+
const headlines = (anchors)
|
|
174
189
|
.map((anchor) => document.getElementById(anchor.hash.substr(1)))
|
|
175
190
|
.filter((headline) => headline !== undefined && headline !== null) as HTMLElement[];
|
|
176
191
|
|
|
@@ -254,4 +269,4 @@ const TableOfContents = ({
|
|
|
254
269
|
);
|
|
255
270
|
};
|
|
256
271
|
|
|
257
|
-
export
|
|
272
|
+
export const TableOfContents = React.memo(TableOfContentsComponent, (prevProps, nextProps) => _.isEqual(prevProps, nextProps));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Element, Root, Text as TextNode } from 'hast';
|
|
2
2
|
import React, { useCallback, useMemo, useRef } from 'react';
|
|
3
3
|
import type { Components } from 'react-markdown';
|
|
4
4
|
import ReactMarkdown, { uriTransformer } from 'react-markdown';
|
|
@@ -27,6 +27,40 @@ import {
|
|
|
27
27
|
|
|
28
28
|
export type SimpleMarkdownComponents = Components;
|
|
29
29
|
|
|
30
|
+
export const defaultAllowedElements = [
|
|
31
|
+
'a',
|
|
32
|
+
'b',
|
|
33
|
+
'blockquote',
|
|
34
|
+
'br',
|
|
35
|
+
'center',
|
|
36
|
+
'code',
|
|
37
|
+
'del',
|
|
38
|
+
'em',
|
|
39
|
+
'h1',
|
|
40
|
+
'h2',
|
|
41
|
+
'h3',
|
|
42
|
+
'h4',
|
|
43
|
+
'h5',
|
|
44
|
+
'hr',
|
|
45
|
+
'i',
|
|
46
|
+
'img',
|
|
47
|
+
'li',
|
|
48
|
+
'ol',
|
|
49
|
+
'p',
|
|
50
|
+
'pre',
|
|
51
|
+
'span',
|
|
52
|
+
'strong',
|
|
53
|
+
'table',
|
|
54
|
+
'tbody',
|
|
55
|
+
'td',
|
|
56
|
+
'tfoot',
|
|
57
|
+
'th',
|
|
58
|
+
'thead',
|
|
59
|
+
'tr',
|
|
60
|
+
'u',
|
|
61
|
+
'ul',
|
|
62
|
+
];
|
|
63
|
+
|
|
30
64
|
const StyledMarkdown = styled(ReactMarkdown)`
|
|
31
65
|
scroll-margin-top: 10px;
|
|
32
66
|
|
|
@@ -64,7 +98,7 @@ const unwrapUnsupportedElement = (node: Element): (Element | TextNode)[] => {
|
|
|
64
98
|
|
|
65
99
|
const getUnsupportedRehypeTagsSanitationPlugIn = (
|
|
66
100
|
allowedElements: string[],
|
|
67
|
-
): Pluggable<
|
|
101
|
+
): Pluggable<unknown[]> => () => (tree: Root) => {
|
|
68
102
|
visit(tree, 'element', (node, index, parent) => {
|
|
69
103
|
if (!allowedElements.includes(node.tagName) && parent && typeof index === 'number') {
|
|
70
104
|
// Replace unsupported element with its valid children
|
|
@@ -73,40 +107,6 @@ const getUnsupportedRehypeTagsSanitationPlugIn = (
|
|
|
73
107
|
});
|
|
74
108
|
};
|
|
75
109
|
|
|
76
|
-
export const defaultAllowedElements = [
|
|
77
|
-
'a',
|
|
78
|
-
'b',
|
|
79
|
-
'blockquote',
|
|
80
|
-
'br',
|
|
81
|
-
'center',
|
|
82
|
-
'code',
|
|
83
|
-
'del',
|
|
84
|
-
'em',
|
|
85
|
-
'h1',
|
|
86
|
-
'h2',
|
|
87
|
-
'h3',
|
|
88
|
-
'h4',
|
|
89
|
-
'h5',
|
|
90
|
-
'hr',
|
|
91
|
-
'i',
|
|
92
|
-
'img',
|
|
93
|
-
'li',
|
|
94
|
-
'ol',
|
|
95
|
-
'p',
|
|
96
|
-
'pre',
|
|
97
|
-
'span',
|
|
98
|
-
'strong',
|
|
99
|
-
'table',
|
|
100
|
-
'tbody',
|
|
101
|
-
'td',
|
|
102
|
-
'tfoot',
|
|
103
|
-
'th',
|
|
104
|
-
'thead',
|
|
105
|
-
'tr',
|
|
106
|
-
'u',
|
|
107
|
-
'ul',
|
|
108
|
-
];
|
|
109
|
-
|
|
110
110
|
export const defaultRehypePlugins = [rehypeRaw];
|
|
111
111
|
export const defaultRemarkPlugins = [remarkGfm];
|
|
112
112
|
|
|
@@ -110,21 +110,6 @@ export const MarkdownHeadingWrapper: React.FC<HeadingSharedProps> = ({
|
|
|
110
110
|
);
|
|
111
111
|
};
|
|
112
112
|
|
|
113
|
-
// TODO: This should be used for readmes
|
|
114
|
-
export const MarkdownParagraphContent: React.FC<SharedTextProps & Pick<ReactMarkdownProps, 'node'>> = ({
|
|
115
|
-
children,
|
|
116
|
-
node,
|
|
117
|
-
}) => {
|
|
118
|
-
const child = node.children[0];
|
|
119
|
-
const isText = child?.type === 'text';
|
|
120
|
-
|
|
121
|
-
const videoSrc = isText && getVideoSrc(child.value);
|
|
122
|
-
if (videoSrc) return <MarkdownVideo src={videoSrc} />;
|
|
123
|
-
|
|
124
|
-
// the || null part is important because non-supported elements will fall back to this paragraph component;
|
|
125
|
-
return children || null;
|
|
126
|
-
};
|
|
127
|
-
|
|
128
113
|
const StyledInlineCode = styled(InlineCode)`
|
|
129
114
|
/* If code is rendered within heading, it should inherit its font styles */
|
|
130
115
|
/* TODO: Look at implementation of InlineCode - maybe we can live without it */
|
|
@@ -167,19 +152,17 @@ export const MarkdownCode: React.FC<MarkdownCodeProps & { size: SharedTextSize }
|
|
|
167
152
|
);
|
|
168
153
|
}
|
|
169
154
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
);
|
|
182
|
-
}
|
|
155
|
+
return (
|
|
156
|
+
<CodeBlock
|
|
157
|
+
content={code}
|
|
158
|
+
language={language}
|
|
159
|
+
size={size}
|
|
160
|
+
hideLineNumbers
|
|
161
|
+
fullWidth
|
|
162
|
+
hideBashHeader
|
|
163
|
+
hideBashPromptPrefixes
|
|
164
|
+
/>
|
|
165
|
+
);
|
|
183
166
|
};
|
|
184
167
|
|
|
185
168
|
const youtubeRegex = /^(?:https?:\/\/)?(?:www\.)?(?:m\.)?(?:youtube(?:-nocookie)?\.com|youtu\.be)\/(?:watch\?v=|embed\/|v\/)?([a-zA-Z0-9\-_]+)(?:\S*)?$/;
|
|
@@ -293,3 +276,18 @@ export const MarkdownTable = styled.table`
|
|
|
293
276
|
}
|
|
294
277
|
}
|
|
295
278
|
`;
|
|
279
|
+
|
|
280
|
+
// TODO: This should be used for readmes
|
|
281
|
+
export const MarkdownParagraphContent: React.FC<SharedTextProps & Pick<ReactMarkdownProps, 'node'>> = ({
|
|
282
|
+
children,
|
|
283
|
+
node,
|
|
284
|
+
}) => {
|
|
285
|
+
const child = node.children[0];
|
|
286
|
+
const isText = child?.type === 'text';
|
|
287
|
+
|
|
288
|
+
const videoSrc = isText && getVideoSrc(child.value);
|
|
289
|
+
if (videoSrc) return <MarkdownVideo src={videoSrc} />;
|
|
290
|
+
|
|
291
|
+
// the || null part is important because non-supported elements will fall back to this paragraph component;
|
|
292
|
+
return children || null;
|
|
293
|
+
};
|
package/src/components/tag.tsx
CHANGED
|
@@ -8,16 +8,40 @@ import type { WithTransientProps } from '../type_utils.js';
|
|
|
8
8
|
import { Box, type MarginSpacingProps, type RegularBoxProps } from './box.js';
|
|
9
9
|
import { Link, type RegularLinkProps } from './link.js';
|
|
10
10
|
|
|
11
|
-
type TagSize = typeof TAG_SIZES[number];
|
|
12
|
-
|
|
13
11
|
export const TAG_SIZES = ['large', 'medium', 'small'] as const;
|
|
14
12
|
|
|
13
|
+
type TagSize = typeof TAG_SIZES[number];
|
|
14
|
+
|
|
15
15
|
const TAG_ICON_SIZES = {
|
|
16
16
|
large: '20',
|
|
17
17
|
medium: '16',
|
|
18
18
|
small: '12',
|
|
19
19
|
} satisfies Record<TagSize, IconSize>;
|
|
20
20
|
|
|
21
|
+
export const TAG_VARIANTS = ['primary', 'secondary', 'accent', 'success', 'warning', 'error'] as const;
|
|
22
|
+
|
|
23
|
+
type TagVariant = typeof TAG_VARIANTS[number];
|
|
24
|
+
|
|
25
|
+
type TagNodeType = Extract<React.ElementType, 'a' | 'button'>;
|
|
26
|
+
type TagNodePropsMap = {
|
|
27
|
+
a: {
|
|
28
|
+
element: HTMLAnchorElement;
|
|
29
|
+
props: RegularLinkProps;
|
|
30
|
+
};
|
|
31
|
+
button: {
|
|
32
|
+
element: HTMLButtonElement;
|
|
33
|
+
props: React.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export type TagProps<T extends TagNodeType> = RegularBoxProps & MarginSpacingProps & ({
|
|
38
|
+
as?: T;
|
|
39
|
+
size?: TagSize;
|
|
40
|
+
variant?: TagVariant;
|
|
41
|
+
LeadingIcon?: IconComponent;
|
|
42
|
+
TrailingIcon?: IconComponent;
|
|
43
|
+
} & Omit<TagNodePropsMap[T]['props'], 'size'>);
|
|
44
|
+
|
|
21
45
|
const tagSizeStyle = {
|
|
22
46
|
large: css`
|
|
23
47
|
height: 4rem;
|
|
@@ -43,10 +67,6 @@ const tagSizeStyle = {
|
|
|
43
67
|
`,
|
|
44
68
|
} satisfies Record<TagSize, FlattenSimpleInterpolation>;
|
|
45
69
|
|
|
46
|
-
type TagVariant = typeof TAG_VARIANTS[number];
|
|
47
|
-
|
|
48
|
-
export const TAG_VARIANTS = ['primary', 'secondary', 'accent', 'success', 'warning', 'error'] as const;
|
|
49
|
-
|
|
50
70
|
const tagVariantStyle = {
|
|
51
71
|
primary: css`
|
|
52
72
|
color: ${theme.color.neutral.text};
|
|
@@ -106,7 +126,7 @@ const tagVariantStyle = {
|
|
|
106
126
|
} satisfies Record<TagVariant, FlattenSimpleInterpolation>;
|
|
107
127
|
|
|
108
128
|
type StyledTagProps = WithTransientProps<
|
|
109
|
-
Required<Pick<TagProps<
|
|
129
|
+
Required<Pick<TagProps<TagNodeType>, 'size' | 'variant'>>
|
|
110
130
|
>;
|
|
111
131
|
|
|
112
132
|
const StyledTag = styled(Box)<StyledTagProps>`
|
|
@@ -127,26 +147,6 @@ const StyledTag = styled(Box)<StyledTagProps>`
|
|
|
127
147
|
transition: background ${theme.transition.fastEaseOut};
|
|
128
148
|
`;
|
|
129
149
|
|
|
130
|
-
type TagNodeType = Extract<React.ElementType, 'a' | 'button'>;
|
|
131
|
-
type TagNodePropsMap = {
|
|
132
|
-
a: {
|
|
133
|
-
element: HTMLAnchorElement;
|
|
134
|
-
props: RegularLinkProps;
|
|
135
|
-
};
|
|
136
|
-
button: {
|
|
137
|
-
element: HTMLButtonElement;
|
|
138
|
-
props: React.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
export type TagProps<T extends TagNodeType> = RegularBoxProps & MarginSpacingProps & ({
|
|
143
|
-
as?: T;
|
|
144
|
-
size?: TagSize;
|
|
145
|
-
variant?: TagVariant;
|
|
146
|
-
LeadingIcon?: IconComponent;
|
|
147
|
-
TrailingIcon?: IconComponent;
|
|
148
|
-
} & Omit<TagNodePropsMap[T]['props'], 'size'>);
|
|
149
|
-
|
|
150
150
|
/**
|
|
151
151
|
* Component for displaying inherenly interactive chip descendant
|
|
152
152
|
*/
|
|
@@ -176,10 +176,11 @@ ref: ForwardedRef<TagNodePropsMap[T]['element']>,
|
|
|
176
176
|
{TrailingIcon && <TrailingIcon size={TAG_ICON_SIZES[size]} />}
|
|
177
177
|
</StyledTag>
|
|
178
178
|
);
|
|
179
|
-
}
|
|
179
|
+
}
|
|
180
180
|
TagWrapper.displayName = 'Tag';
|
|
181
181
|
|
|
182
182
|
// `forwardRef` can't handle generic types, should be fixable with React 19
|
|
183
183
|
export const Tag = forwardRef(TagWrapper) as <T extends TagNodeType>(
|
|
184
|
+
// eslint-disable-next-line no-use-before-define -- see comment above 👆
|
|
184
185
|
props: TagProps<T> & { ref?: ForwardedRef<TagNodePropsMap[T]['element']> },
|
|
185
186
|
) => ReturnType<typeof TagWrapper>;
|
|
@@ -10,7 +10,7 @@ type HeadingContentType = 'heading1' | 'heading2' | 'heading3' | 'heading4' | 'h
|
|
|
10
10
|
|
|
11
11
|
interface HeadingContentTransientProps {
|
|
12
12
|
type?: HeadingContentType,
|
|
13
|
-
}
|
|
13
|
+
}
|
|
14
14
|
|
|
15
15
|
const getContentHeadingStyles = (headingType: HeadingContentType) => css`
|
|
16
16
|
${theme.typography.content.mobile[headingType]}
|
|
@@ -10,7 +10,7 @@ type HeadingMarketingType = 'titleXs' | 'titleS' | 'titleM' | 'titleL' | 'titleX
|
|
|
10
10
|
|
|
11
11
|
interface HeadingMarketingTransientProps {
|
|
12
12
|
type?: HeadingMarketingType,
|
|
13
|
-
}
|
|
13
|
+
}
|
|
14
14
|
|
|
15
15
|
type StyledHeadingMarketingProps = WithTransientProps<HeadingMarketingTransientProps>;
|
|
16
16
|
export type HeadingMarketingProps = HeadingMarketingTransientProps & TextBaseProps;
|
|
@@ -10,7 +10,7 @@ type HeadingSharedType = 'titleXs' | 'titleS' | 'titleM' | 'titleL' | 'titleXl'
|
|
|
10
10
|
|
|
11
11
|
interface HeadingSharedTransientProps {
|
|
12
12
|
type?: HeadingSharedType,
|
|
13
|
-
}
|
|
13
|
+
}
|
|
14
14
|
|
|
15
15
|
type StyledHeadingSharedProps = WithTransientProps<HeadingSharedTransientProps>;
|
|
16
16
|
export type HeadingSharedProps = HeadingSharedTransientProps & TextBaseProps;
|
|
@@ -39,7 +39,7 @@ const StyledHeadingShared = styled(TextBaseComponent)<StyledHeadingSharedProps>`
|
|
|
39
39
|
`}
|
|
40
40
|
`;
|
|
41
41
|
|
|
42
|
-
const HeadingShared: React.FC<HeadingSharedProps> = ({
|
|
42
|
+
export const HeadingShared: React.FC<HeadingSharedProps> = ({
|
|
43
43
|
type,
|
|
44
44
|
as,
|
|
45
45
|
...rest
|
|
@@ -53,5 +53,3 @@ const HeadingShared: React.FC<HeadingSharedProps> = ({
|
|
|
53
53
|
/>
|
|
54
54
|
);
|
|
55
55
|
};
|
|
56
|
-
|
|
57
|
-
export default HeadingShared;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import HeadingShared from './heading_shared.js';
|
|
1
|
+
import { HeadingShared } from './heading_shared.js';
|
|
2
2
|
import type { SharedTextProps } from './text_shared.js';
|
|
3
|
-
import TextShared from './text_shared.js';
|
|
3
|
+
import { TextShared } from './text_shared.js';
|
|
4
4
|
|
|
5
5
|
export * from './text_base.js';
|
|
6
6
|
export * from './text_content.js';
|
|
@@ -10,7 +10,7 @@ export interface TransientTextBaseProps {
|
|
|
10
10
|
uppercase?: boolean
|
|
11
11
|
align?: 'left' | 'right' | 'center'
|
|
12
12
|
color?: string,
|
|
13
|
-
}
|
|
13
|
+
}
|
|
14
14
|
|
|
15
15
|
export type StyledTextBaseProps = WithTransientProps<TransientTextBaseProps>;
|
|
16
16
|
export type TextBaseProps = TransientTextBaseProps & BoxProps;
|
|
@@ -13,7 +13,7 @@ export type ContentTextWeight = 'normal' | 'bold';
|
|
|
13
13
|
export interface TransientContentTextProps {
|
|
14
14
|
type?: ContentTextType,
|
|
15
15
|
weight?: ContentTextWeight,
|
|
16
|
-
}
|
|
16
|
+
}
|
|
17
17
|
|
|
18
18
|
type StyledContentTextProps = WithTransientProps<TransientContentTextProps>;
|
|
19
19
|
export type ContentTextProps = TransientContentTextProps & TextBaseProps;
|
|
@@ -13,7 +13,7 @@ export type MarketingTextWeight = 'normal' | 'bold';
|
|
|
13
13
|
export interface TransientMarketingTextProps {
|
|
14
14
|
size?: MarketingTextSize,
|
|
15
15
|
weight?: MarketingTextWeight,
|
|
16
|
-
}
|
|
16
|
+
}
|
|
17
17
|
|
|
18
18
|
type StyledMarketingTextProps = WithTransientProps<TransientMarketingTextProps>;
|
|
19
19
|
export type MarketingTextProps = TransientMarketingTextProps & TextBaseProps;
|
|
@@ -14,7 +14,7 @@ export interface TransientSharedTextProps {
|
|
|
14
14
|
type?: SharedTextType,
|
|
15
15
|
size?: SharedTextSize,
|
|
16
16
|
weight?: SharedTextWeight,
|
|
17
|
-
}
|
|
17
|
+
}
|
|
18
18
|
|
|
19
19
|
type StyledSharedTextProps = WithTransientProps<TransientSharedTextProps>;
|
|
20
20
|
export type SharedTextProps = TransientSharedTextProps & TextBaseProps;
|
|
@@ -68,7 +68,7 @@ const StyledTextShared = styled(TextBaseComponent)<StyledSharedTextProps>`
|
|
|
68
68
|
${(props) => TEXT_SHARED_VARIANTS_CSS[props.$type || 'body'][props.$size || 'regular'][props.$weight || 'normal']}
|
|
69
69
|
`;
|
|
70
70
|
|
|
71
|
-
const TextShared = forwardRef<HTMLElement | undefined, SharedTextProps>(({
|
|
71
|
+
export const TextShared = forwardRef<HTMLElement | undefined, SharedTextProps>(({
|
|
72
72
|
type,
|
|
73
73
|
size,
|
|
74
74
|
weight,
|
|
@@ -91,6 +91,3 @@ const TextShared = forwardRef<HTMLElement | undefined, SharedTextProps>(({
|
|
|
91
91
|
/>
|
|
92
92
|
);
|
|
93
93
|
});
|
|
94
|
-
|
|
95
|
-
TextShared.displayName = 'TextShared';
|
|
96
|
-
export default TextShared;
|
|
@@ -20,14 +20,14 @@ export const cardClassNames = {
|
|
|
20
20
|
interface TransientCardProps {
|
|
21
21
|
disabled?: boolean,
|
|
22
22
|
shadowless?: boolean,
|
|
23
|
-
}
|
|
23
|
+
}
|
|
24
24
|
|
|
25
25
|
interface RegularCardProps {
|
|
26
26
|
caption?: React.ReactNode;
|
|
27
27
|
description?: React.ReactNode;
|
|
28
28
|
actions?: React.ReactNode;
|
|
29
29
|
children: React.ReactNode;
|
|
30
|
-
}
|
|
30
|
+
}
|
|
31
31
|
|
|
32
32
|
export type StyledCardProps = WithTransientProps<TransientCardProps>;
|
|
33
33
|
export type CardProps = TransientCardProps & RegularCardProps & BoxProps;
|
|
@@ -14,7 +14,7 @@ import { LinkIcon } from '@apify/ui-icons';
|
|
|
14
14
|
import type { UiThemeOption } from '../../design_system/theme.js';
|
|
15
15
|
import { theme } from '../../design_system/theme.js';
|
|
16
16
|
import { useCopyToClipboard } from '../../utils/index.js';
|
|
17
|
-
import { CodeBlock,
|
|
17
|
+
import { CodeBlock, inlineCodeStyles, OneLineCode } from '../code/index.js';
|
|
18
18
|
import { cleanMarkdown, slugifyHeadingChildren } from '../readme_renderer/utils.js';
|
|
19
19
|
|
|
20
20
|
interface StyledReadmeProps {
|
|
@@ -460,6 +460,7 @@ interface ParagraphRendererProps extends React.HTMLAttributes<HTMLParagraphEleme
|
|
|
460
460
|
const ParagraphRenderer = ({ node, ...props }: ParagraphRendererProps) => {
|
|
461
461
|
// We enable embedded video only is surrounded by new lines (will be rendered as only child in paragraph)
|
|
462
462
|
node?.children.forEach((child) => {
|
|
463
|
+
// eslint-disable-next-line no-param-reassign
|
|
463
464
|
if (child.tagName === 'a') child.properties.enableEmbeddedVideo = node.children.length === 1; // This means the link is the only child
|
|
464
465
|
});
|
|
465
466
|
const child = node?.children[0];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { readFileSync } from 'fs';
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
2
|
|
|
3
3
|
const code = readFileSync('./src/design_system/supernova_color_tokens.json', 'utf-8');
|
|
4
4
|
|
|
@@ -29,7 +29,7 @@ const generateColorDefinitions = (themeVariant) => {
|
|
|
29
29
|
for (const [semanticCategory, palette] of Object.entries(mergedPalette)) {
|
|
30
30
|
for (const [key, { value }] of Object.entries(palette)) {
|
|
31
31
|
colorDefinitions.push(
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
`${getColorPropertyName(semanticCategory, key)}: ${value.startsWith('#') ? value : getObjectValueByPath(colorsDefinitions[themeVariant], value.slice(1, -1)).value};`,
|
|
34
34
|
);
|
|
35
35
|
}
|
|
@@ -39,5 +39,6 @@ const generateColorDefinitions = (themeVariant) => {
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
['light', 'dark'].forEach((themeVariant) => {
|
|
42
|
-
|
|
42
|
+
// eslint-disable-next-line no-console
|
|
43
|
+
console.log(`\n*** CSS variables from ${themeVariant} mode ***\n`, generateColorDefinitions(themeVariant));
|
|
43
44
|
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { darkTheme, lightTheme } from './colors_theme.js';
|
|
2
2
|
import { colorProperties } from './properties_theme.js';
|
|
3
3
|
import {
|
|
4
|
-
spaces,
|
|
5
|
-
radiuses,
|
|
6
|
-
layouts,
|
|
7
4
|
devices,
|
|
8
|
-
|
|
5
|
+
layouts,
|
|
6
|
+
radiuses,
|
|
9
7
|
shadows,
|
|
8
|
+
spaces,
|
|
9
|
+
transitions,
|
|
10
10
|
} from './tokens/index.js';
|
|
11
11
|
import { typographyTokens } from './typography_theme.js';
|
|
12
12
|
|
package/.eslintrc
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": [
|
|
3
|
-
"@apify/ts",
|
|
4
|
-
"plugin:react/recommended",
|
|
5
|
-
"plugin:react-hooks/recommended"
|
|
6
|
-
],
|
|
7
|
-
"ignorePatterns": ["dist/**/*"],
|
|
8
|
-
"rules": {
|
|
9
|
-
"react/react-in-jsx-scope": "off",
|
|
10
|
-
"no-void": "off",
|
|
11
|
-
"import/extensions": ["error", "always"],
|
|
12
|
-
"@typescript-eslint/no-explicit-any": "off",
|
|
13
|
-
"import/no-named-default": "off",
|
|
14
|
-
"react/display-name": "off",
|
|
15
|
-
"react-hooks/exhaustive-deps": "error",
|
|
16
|
-
"@typescript-eslint/consistent-type-imports": "error",
|
|
17
|
-
"import/order": ["error", {
|
|
18
|
-
"groups": ["builtin", "external", ["parent", "sibling"], "index", "object"],
|
|
19
|
-
"alphabetize": { "order": "asc", "caseInsensitive": true },
|
|
20
|
-
"newlines-between": "always",
|
|
21
|
-
"pathGroups": [
|
|
22
|
-
{
|
|
23
|
-
"pattern": "@apify/**",
|
|
24
|
-
"group": "external",
|
|
25
|
-
"position": "after"
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
"pattern": "@apify-packages/**",
|
|
29
|
-
"group": "external",
|
|
30
|
-
"position": "after"
|
|
31
|
-
}
|
|
32
|
-
],
|
|
33
|
-
"pathGroupsExcludedImportTypes": ["builtin"]
|
|
34
|
-
}]
|
|
35
|
-
},
|
|
36
|
-
"parser": "@typescript-eslint/parser",
|
|
37
|
-
"plugins": ["@typescript-eslint", "sonarjs"],
|
|
38
|
-
"parserOptions": {
|
|
39
|
-
"project": "./tsconfig.json"
|
|
40
|
-
}
|
|
41
|
-
}
|