@apify/ui-library 1.106.2-featurereact19upgrade-8b5553.51 → 1.106.3
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/src/components/badge.d.ts.map +1 -1
- package/dist/src/components/badge.js.map +1 -1
- package/dist/src/components/button.d.ts +2 -2
- package/dist/src/components/button.d.ts.map +1 -1
- package/dist/src/components/code/code_block/code_block.styled.d.ts +3 -3
- package/dist/src/components/code/code_block/code_block.styled.d.ts.map +1 -1
- package/dist/src/components/code/inline_code/inline_code.d.ts +1 -1
- package/dist/src/components/code/inline_code/inline_code.d.ts.map +1 -1
- package/dist/src/components/code/one_line_code/one_line_code.d.ts +1 -1
- package/dist/src/components/code/one_line_code/one_line_code.d.ts.map +1 -1
- package/dist/src/components/code/prism_highlighter.d.ts +6 -19
- package/dist/src/components/code/prism_highlighter.d.ts.map +1 -1
- package/dist/src/components/color_wheel_gradient.d.ts +1 -1
- package/dist/src/components/color_wheel_gradient.d.ts.map +1 -1
- package/dist/src/components/floating/floating_component_base.d.ts +1 -1
- package/dist/src/components/floating/floating_component_base.d.ts.map +1 -1
- package/dist/src/components/floating/menu_components.d.ts +7 -3
- package/dist/src/components/floating/menu_components.d.ts.map +1 -1
- package/dist/src/components/floating/tooltip.d.ts +3 -3
- package/dist/src/components/floating/tooltip.d.ts.map +1 -1
- package/dist/src/components/floating/tooltip.js.map +1 -1
- package/dist/src/components/readme_renderer/table_of_contents.d.ts +1 -1
- package/dist/src/components/readme_renderer/table_of_contents.d.ts.map +1 -1
- package/dist/src/components/readme_renderer/table_of_contents.js +1 -1
- package/dist/src/components/readme_renderer/table_of_contents.js.map +1 -1
- package/dist/src/components/readme_renderer/utils.d.ts +1 -1
- package/dist/src/components/readme_renderer/utils.d.ts.map +1 -1
- package/dist/src/components/readme_renderer/utils.js +5 -8
- package/dist/src/components/readme_renderer/utils.js.map +1 -1
- package/dist/src/components/shortcut.d.ts +1 -2
- package/dist/src/components/shortcut.d.ts.map +1 -1
- package/dist/src/components/shortcut.js.map +1 -1
- package/dist/src/components/simple_markdown/simple_markdown.d.ts +3 -7
- package/dist/src/components/simple_markdown/simple_markdown.d.ts.map +1 -1
- package/dist/src/components/simple_markdown/simple_markdown.js +14 -25
- package/dist/src/components/simple_markdown/simple_markdown.js.map +1 -1
- package/dist/src/components/simple_markdown/simple_markdown_components.d.ts +11 -9
- package/dist/src/components/simple_markdown/simple_markdown_components.d.ts.map +1 -1
- package/dist/src/components/simple_markdown/simple_markdown_components.js +4 -5
- package/dist/src/components/simple_markdown/simple_markdown_components.js.map +1 -1
- package/dist/src/components/spinner.d.ts +3 -3
- package/dist/src/components/spinner.d.ts.map +1 -1
- package/dist/src/components/tabs/tab.d.ts.map +1 -1
- package/dist/src/components/tabs/tab.js.map +1 -1
- package/dist/src/components/tabs/tabs.js +3 -3
- package/dist/src/components/tabs/tabs.js.map +1 -1
- package/dist/src/components/tag.d.ts.map +1 -1
- package/dist/src/components/tag.js.map +1 -1
- package/dist/src/components/text/text_content.js.map +1 -1
- package/dist/src/components/text/text_marketing.js.map +1 -1
- package/dist/src/components/tile/shared.d.ts +1 -1
- package/dist/src/components/tile/shared.d.ts.map +1 -1
- package/dist/src/components/to_consolidate/card.d.ts +1 -1
- package/dist/src/components/to_consolidate/card.d.ts.map +1 -1
- package/dist/src/components/to_consolidate/markdown.d.ts +2 -2
- package/dist/src/components/to_consolidate/markdown.d.ts.map +1 -1
- package/dist/src/components/to_consolidate/markdown.js +50 -60
- package/dist/src/components/to_consolidate/markdown.js.map +1 -1
- package/dist/src/utils/css_utils.d.ts +1 -1
- package/dist/src/utils/css_utils.d.ts.map +1 -1
- package/dist/src/utils/index.d.ts +0 -1
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/index.js +0 -1
- package/dist/src/utils/index.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +15 -15
- package/src/components/badge.tsx +1 -2
- package/src/components/code/one_line_code/one_line_code.tsx +1 -1
- package/src/components/floating/floating_component_base.tsx +1 -1
- package/src/components/floating/tooltip.tsx +4 -4
- package/src/components/readme_renderer/table_of_contents.tsx +2 -1
- package/src/components/readme_renderer/utils.tsx +6 -9
- package/src/components/shortcut.tsx +1 -2
- package/src/components/simple_markdown/simple_markdown.tsx +28 -50
- package/src/components/simple_markdown/simple_markdown_components.tsx +7 -13
- package/src/components/tabs/tab.tsx +1 -1
- package/src/components/tabs/tabs.tsx +4 -4
- package/src/components/tag.tsx +1 -2
- package/src/components/text/text_content.tsx +1 -1
- package/src/components/text/text_marketing.tsx +1 -1
- package/src/components/to_consolidate/markdown.tsx +77 -91
- package/src/utils/index.ts +0 -1
- package/dist/src/utils/type_utils.d.ts +0 -3
- package/dist/src/utils/type_utils.d.ts.map +0 -1
- package/dist/src/utils/type_utils.js +0 -2
- package/dist/src/utils/type_utils.js.map +0 -1
- package/src/utils/type_utils.ts +0 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apify/ui-library",
|
|
3
|
-
"version": "1.106.
|
|
3
|
+
"version": "1.106.3",
|
|
4
4
|
"description": "React UI library used by apify.com",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"It's not nice, but helps us to get around the problem of multiple react instances."
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@apify/ui-icons": "^1.21.3
|
|
29
|
+
"@apify/ui-icons": "^1.21.3",
|
|
30
30
|
"@floating-ui/react": "^0.26.2",
|
|
31
31
|
"@react-hook/resize-observer": "^2.0.2",
|
|
32
32
|
"clsx": "^2.0.0",
|
|
@@ -37,32 +37,32 @@
|
|
|
37
37
|
"prism-react-renderer": "^2.4.1",
|
|
38
38
|
"prismjs": "^1.30.0",
|
|
39
39
|
"query-string": "^8.1.0",
|
|
40
|
-
"react-markdown": "^
|
|
41
|
-
"rehype-raw": "^
|
|
40
|
+
"react-markdown": "^8.0.5",
|
|
41
|
+
"rehype-raw": "^6.1.1",
|
|
42
42
|
"rehype-sanitize": "^6.0.0",
|
|
43
|
-
"remark-gfm": "^
|
|
44
|
-
"remark-toc": "
|
|
43
|
+
"remark-gfm": "^3.0.1",
|
|
44
|
+
"remark-toc": "8.0.1",
|
|
45
45
|
"slugify": "^1.6.6",
|
|
46
|
-
"
|
|
46
|
+
"unified": "^10.0.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"react": "17.x || 18.x
|
|
50
|
-
"react-dom": "17.x || 18.x
|
|
51
|
-
"styled-components": "^
|
|
49
|
+
"react": "17.x || 18.x",
|
|
50
|
+
"react-dom": "17.x || 18.x",
|
|
51
|
+
"styled-components": "^5.3.3",
|
|
52
|
+
"unist-util-visit": "^5.0.0"
|
|
52
53
|
},
|
|
53
54
|
"devDependencies": {
|
|
54
55
|
"@storybook/react-vite": "^9.0.16",
|
|
55
|
-
"@types/hast": "^3.0.4",
|
|
56
56
|
"@types/lodash": "^4.14.200",
|
|
57
|
-
"@types/react": "
|
|
57
|
+
"@types/react": "^18.2.74",
|
|
58
|
+
"@types/styled-components": "^5.1.34",
|
|
58
59
|
"recast": "^0.23.9",
|
|
59
|
-
"style-dictionary": "^4.4.0"
|
|
60
|
-
"styled-components": "^6.1.19"
|
|
60
|
+
"style-dictionary": "^4.4.0"
|
|
61
61
|
},
|
|
62
62
|
"files": [
|
|
63
63
|
"dist",
|
|
64
64
|
"src",
|
|
65
65
|
"style"
|
|
66
66
|
],
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "7d292c5fdb03d052a601a8ce7265ce97b5f5b824"
|
|
68
68
|
}
|
package/src/components/badge.tsx
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
|
-
import styled, { css } from 'styled-components';
|
|
3
|
+
import styled, { css, type FlattenSimpleInterpolation } from 'styled-components';
|
|
4
4
|
|
|
5
5
|
import type { IconComponent, IconSize } from '@apify/ui-icons';
|
|
6
6
|
|
|
7
7
|
import { theme } from '../design_system/theme.js';
|
|
8
8
|
import type { WithTransientProps } from '../type_utils.js';
|
|
9
|
-
import type { FlattenSimpleInterpolation } from '../utils/type_utils.js';
|
|
10
9
|
import { Box, type MarginSpacingProps, type RegularBoxProps } from './box.js';
|
|
11
10
|
import { Text } from './text/index.js';
|
|
12
11
|
import type { SharedTextSize, SharedTextType } from './text/text_shared.js';
|
|
@@ -137,7 +137,7 @@ const OneLineCodeWrapper = styled(SyntaxHighlighterBaseStylesWrapper)<OneLineCod
|
|
|
137
137
|
}
|
|
138
138
|
`;
|
|
139
139
|
|
|
140
|
-
export type OneLineCodeProps =
|
|
140
|
+
export type OneLineCodeProps = BoxProps & {
|
|
141
141
|
children: string;
|
|
142
142
|
language?: string;
|
|
143
143
|
size?: SharedTextSize;
|
|
@@ -49,7 +49,7 @@ export interface FloatingComponentBaseProps {
|
|
|
49
49
|
placement?: FloatingPlacement;
|
|
50
50
|
autoPlacements?: FloatingPlacement[];
|
|
51
51
|
strategy?: Strategy;
|
|
52
|
-
content?: ReactNode;
|
|
52
|
+
content?: ReactNode | string;
|
|
53
53
|
children?: ReactNode;
|
|
54
54
|
isOpen?: boolean;
|
|
55
55
|
triggerRef?: RefObject<HTMLDivElement>;
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
useHover,
|
|
4
4
|
useInteractions,
|
|
5
5
|
} from '@floating-ui/react';
|
|
6
|
-
import { type ComponentType,
|
|
6
|
+
import { type ComponentType, forwardRef, useState } from 'react';
|
|
7
7
|
import styled, { css } from 'styled-components';
|
|
8
8
|
|
|
9
9
|
import { theme } from '../../design_system/theme.js';
|
|
@@ -29,7 +29,7 @@ export const TOOLTIP_SIZES = {
|
|
|
29
29
|
export type TooltipSize = typeof TOOLTIP_SIZES[keyof typeof TOOLTIP_SIZES];
|
|
30
30
|
|
|
31
31
|
export interface TooltipProps extends Omit<FloatingComponentBaseProps, 'isOpen' | 'size'> {
|
|
32
|
-
as?:
|
|
32
|
+
as?: keyof JSX.IntrinsicElements | ComponentType<unknown>;
|
|
33
33
|
className?: string;
|
|
34
34
|
delayShow?: number;
|
|
35
35
|
delayHide?: number;
|
|
@@ -72,7 +72,7 @@ export const Tooltip = ({
|
|
|
72
72
|
size = TOOLTIP_SIZES.SMALL,
|
|
73
73
|
textAlign = TOOLTIP_TEXT_ALIGNS.LEFT,
|
|
74
74
|
...rest
|
|
75
|
-
}: TooltipProps)
|
|
75
|
+
}: TooltipProps) => {
|
|
76
76
|
const { uiTheme, tooltipSafeHtml } = useSharedUiDependencies();
|
|
77
77
|
const [open, setOpen] = useState(false);
|
|
78
78
|
|
|
@@ -107,7 +107,7 @@ export const Tooltip = ({
|
|
|
107
107
|
|
|
108
108
|
return (
|
|
109
109
|
<TooltipFocusArea
|
|
110
|
-
as={as}
|
|
110
|
+
as={as as keyof JSX.IntrinsicElements}
|
|
111
111
|
className={className}
|
|
112
112
|
ref={refs.setReference}
|
|
113
113
|
{...getReferenceProps()}
|
|
@@ -3,7 +3,8 @@ import React, {
|
|
|
3
3
|
useCallback,
|
|
4
4
|
useMemo,
|
|
5
5
|
} from 'react';
|
|
6
|
-
import ReactMarkdown
|
|
6
|
+
import ReactMarkdown from 'react-markdown';
|
|
7
|
+
import type { AllowElement } from 'react-markdown/lib/rehype-filter.js';
|
|
7
8
|
import remarkToc from 'remark-toc';
|
|
8
9
|
import styled from 'styled-components';
|
|
9
10
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import type { AllowElement } from 'react-markdown';
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import type { AllowElement } from 'react-markdown/lib/rehype-filter.js';
|
|
3
3
|
import slugify from 'slugify';
|
|
4
4
|
|
|
5
5
|
export const slugifyHeadingChildren = (
|
|
@@ -11,12 +11,9 @@ export const slugifyHeadingChildren = (
|
|
|
11
11
|
React.Children.forEach(headingChildren, (child) => {
|
|
12
12
|
if (typeof child === 'string') {
|
|
13
13
|
slugs.push(slugify(child, { lower: true, strict: true }));
|
|
14
|
-
} else if (React.isValidElement(child)) {
|
|
15
|
-
const
|
|
16
|
-
if (
|
|
17
|
-
const nestedSlugs = slugifyHeadingChildren(element.props.children);
|
|
18
|
-
if (nestedSlugs) slugs.push(nestedSlugs);
|
|
19
|
-
}
|
|
14
|
+
} else if (React.isValidElement(child) && child.props.children) {
|
|
15
|
+
const nestedSlugs = slugifyHeadingChildren(child.props.children);
|
|
16
|
+
if (nestedSlugs) slugs.push(nestedSlugs);
|
|
20
17
|
}
|
|
21
18
|
});
|
|
22
19
|
|
|
@@ -38,7 +35,7 @@ export const cleanMarkdown = (markdown: string, removeFirstH1?: boolean): string
|
|
|
38
35
|
// This removes the first element if it's a `h1` containing exactly the Actor title
|
|
39
36
|
export const useActorTitleHeadingFilter = (actorTitle: string): AllowElement => {
|
|
40
37
|
return useCallback((element, index, parent) => {
|
|
41
|
-
if (parent
|
|
38
|
+
if (parent.type === 'root'
|
|
42
39
|
&& index === 0
|
|
43
40
|
&& element.tagName === 'h1'
|
|
44
41
|
&& element.children.length === 1
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import type { ElementType } from 'react';
|
|
2
1
|
import styled, { css } from 'styled-components';
|
|
3
2
|
|
|
4
3
|
import { theme } from '../design_system/theme.js';
|
|
5
4
|
import { Text } from './text/index.js';
|
|
6
5
|
|
|
7
6
|
interface ShortcutProps {
|
|
8
|
-
as?:
|
|
7
|
+
as?: keyof JSX.IntrinsicElements;
|
|
9
8
|
className?: string;
|
|
10
9
|
children: React.ReactNode;
|
|
11
10
|
/* If true, always use dark mode colors */
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { Element, Root, Text as TextNode } from 'hast';
|
|
2
2
|
import type React from 'react';
|
|
3
3
|
import { useCallback, useMemo, useRef } from 'react';
|
|
4
|
-
import type { Components
|
|
5
|
-
import ReactMarkdown from 'react-markdown';
|
|
4
|
+
import type { Components } from 'react-markdown';
|
|
5
|
+
import ReactMarkdown, { uriTransformer } from 'react-markdown';
|
|
6
|
+
import type { ReactMarkdownOptions } from 'react-markdown/lib/react-markdown.js';
|
|
6
7
|
import rehypeRaw from 'rehype-raw';
|
|
7
8
|
import rehypeSanitize from 'rehype-sanitize';
|
|
8
9
|
import remarkGfm from 'remark-gfm';
|
|
9
10
|
import styled from 'styled-components';
|
|
11
|
+
import type { Pluggable, PluggableList } from 'unified';
|
|
10
12
|
import { visit } from 'unist-util-visit';
|
|
11
13
|
|
|
12
14
|
import { theme } from '../../design_system/theme.js';
|
|
@@ -59,7 +61,7 @@ export const defaultAllowedElements = [
|
|
|
59
61
|
'ul',
|
|
60
62
|
];
|
|
61
63
|
|
|
62
|
-
const
|
|
64
|
+
const StyledMarkdown = styled(ReactMarkdown)`
|
|
63
65
|
scroll-margin-top: 10px;
|
|
64
66
|
|
|
65
67
|
overflow: auto;
|
|
@@ -99,7 +101,7 @@ const unwrapUnsupportedElement = (node: Element): (Element | TextNode)[] => {
|
|
|
99
101
|
|
|
100
102
|
const getUnsupportedRehypeTagsSanitationPlugIn = (
|
|
101
103
|
allowedElements: string[],
|
|
102
|
-
) => () => (tree: Root) => {
|
|
104
|
+
): Pluggable<unknown[]> => () => (tree: Root) => {
|
|
103
105
|
visit(tree, 'element', (node, index, parent) => {
|
|
104
106
|
if (!allowedElements.includes(node.tagName) && parent && typeof index === 'number') {
|
|
105
107
|
// Replace unsupported element with its valid children
|
|
@@ -151,7 +153,7 @@ const regularMarkdownSizeComponents: Components = {
|
|
|
151
153
|
ol: ({ children, start }) => <TextContent as='ol' pl='space32' start={start}>{children}</TextContent>,
|
|
152
154
|
li: ({ children }) => <TextContent as='li' mt='space4'>{children}</TextContent>,
|
|
153
155
|
a: ({ children, href }) => <MarkdownLink to={href}>{children}</MarkdownLink>,
|
|
154
|
-
code: ({ children,
|
|
156
|
+
code: ({ children, inline }) => <MarkdownCode inline={inline} size='regular'>{children}</MarkdownCode>,
|
|
155
157
|
img: ({ src, alt, height, width }) => <MarkdownImage src={src} alt={alt} height={height} width={width} />,
|
|
156
158
|
};
|
|
157
159
|
|
|
@@ -172,23 +174,17 @@ const smallMarkdownSizeComponents: Components = {
|
|
|
172
174
|
ol: ({ children, start }) => <Text as='ol' pl='space32' start={start}>{children}</Text>,
|
|
173
175
|
li: ({ children }) => <Text as='li' mt='space4'>{children}</Text>,
|
|
174
176
|
a: ({ children, href }) => <MarkdownLink to={href}>{children}</MarkdownLink>,
|
|
175
|
-
code: ({ children,
|
|
177
|
+
code: ({ children, inline }) => <MarkdownCode inline={inline} size='small'>{children}</MarkdownCode>,
|
|
176
178
|
img: ({ src, alt, height, width }) => <MarkdownImage src={src} alt={alt} height={height} width={width} />,
|
|
177
179
|
};
|
|
178
180
|
|
|
179
181
|
type MarkdownSize = 'regular' | 'small';
|
|
180
182
|
|
|
181
|
-
export type SimpleMarkdownProps =
|
|
182
|
-
// @deprecated use urlTransform instead
|
|
183
|
-
transformLinkUri?: UrlTransform,
|
|
184
|
-
// @deprecated use urlTransform instead
|
|
185
|
-
transformImageUri?: UrlTransform,
|
|
183
|
+
export type SimpleMarkdownProps = ReactMarkdownOptions & {
|
|
186
184
|
size?: MarkdownSize,
|
|
187
|
-
children: string,
|
|
188
|
-
className?: string,
|
|
189
185
|
}
|
|
190
186
|
|
|
191
|
-
|
|
187
|
+
const useDefaultUrlTransform = () => {
|
|
192
188
|
const { windowLocationHost } = useSharedUiDependencies();
|
|
193
189
|
|
|
194
190
|
return useCallback((url: string) => {
|
|
@@ -208,9 +204,7 @@ export const SimpleMarkdown: React.FC<SimpleMarkdownProps> = ({
|
|
|
208
204
|
rehypePlugins,
|
|
209
205
|
remarkPlugins,
|
|
210
206
|
transformLinkUri,
|
|
211
|
-
transformImageUri,
|
|
212
207
|
allowedElements,
|
|
213
|
-
className,
|
|
214
208
|
...rest
|
|
215
209
|
}) => {
|
|
216
210
|
const cleanedMarkdown = useMemo(() => cleanMarkdown(markdown), [markdown]);
|
|
@@ -222,42 +216,26 @@ export const SimpleMarkdown: React.FC<SimpleMarkdownProps> = ({
|
|
|
222
216
|
...components,
|
|
223
217
|
});
|
|
224
218
|
|
|
225
|
-
const
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
...defaultRehypePlugins,
|
|
230
|
-
getUnsupportedRehypeTagsSanitationPlugIn(effectiveAllowedElements.current as string[]),
|
|
231
|
-
];
|
|
219
|
+
const rehypePluginsRef = useRef<PluggableList>([
|
|
220
|
+
...(rehypePlugins || [...defaultRehypePlugins, getUnsupportedRehypeTagsSanitationPlugIn(effectiveAllowedElements.current)]),
|
|
221
|
+
rehypeSanitize, // lets always sanitize the output
|
|
222
|
+
]);
|
|
232
223
|
|
|
233
|
-
|
|
234
|
-
...plugins,
|
|
235
|
-
rehypeSanitize,
|
|
236
|
-
];
|
|
237
|
-
}, [rehypePlugins]);
|
|
224
|
+
const defaultUrlTransform = useDefaultUrlTransform();
|
|
238
225
|
|
|
239
226
|
return (
|
|
240
|
-
<
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
return href;
|
|
256
|
-
}}
|
|
257
|
-
{...rest}
|
|
258
|
-
>
|
|
259
|
-
{cleanedMarkdown}
|
|
260
|
-
</ReactMarkdown>
|
|
261
|
-
</StyledMarkdownWrapper>
|
|
227
|
+
<StyledMarkdown
|
|
228
|
+
components={effectiveComponents.current}
|
|
229
|
+
rehypePlugins={rehypePluginsRef.current}
|
|
230
|
+
remarkPlugins={remarkPlugins || defaultRemarkPlugins}
|
|
231
|
+
allowedElements={effectiveAllowedElements.current}
|
|
232
|
+
transformLinkUri={(href, children, title) => {
|
|
233
|
+
const transformed = transformLinkUri ? transformLinkUri(href, children, title) : defaultUrlTransform(href);
|
|
234
|
+
return uriTransformer(transformed);
|
|
235
|
+
}}
|
|
236
|
+
{...rest}
|
|
237
|
+
>
|
|
238
|
+
{cleanedMarkdown}
|
|
239
|
+
</StyledMarkdown>
|
|
262
240
|
);
|
|
263
241
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import qs from 'query-string';
|
|
2
2
|
import type React from 'react';
|
|
3
|
-
import type {
|
|
3
|
+
import type { CodeProps, ReactMarkdownProps } from 'react-markdown/lib/ast-to-react.js';
|
|
4
4
|
import styled from 'styled-components';
|
|
5
5
|
|
|
6
6
|
import { CheckIcon, LinkIcon } from '@apify/ui-icons';
|
|
@@ -121,21 +121,15 @@ const StyledInlineCode = styled(InlineCode)`
|
|
|
121
121
|
}
|
|
122
122
|
`;
|
|
123
123
|
|
|
124
|
-
type MarkdownCodeProps =
|
|
125
|
-
size: SharedTextSize,
|
|
126
|
-
className?: string,
|
|
127
|
-
children: React.ReactNode,
|
|
128
|
-
} & MarkdownComponentExtraProps;
|
|
124
|
+
type MarkdownCodeProps = Pick<CodeProps, 'inline' | 'className' | 'children'>
|
|
129
125
|
|
|
130
|
-
export const MarkdownCode: React.FC<MarkdownCodeProps> = ({
|
|
126
|
+
export const MarkdownCode: React.FC<MarkdownCodeProps & { size: SharedTextSize }> = ({
|
|
127
|
+
inline,
|
|
131
128
|
className,
|
|
132
129
|
children,
|
|
133
130
|
size,
|
|
134
|
-
node,
|
|
135
131
|
}) => {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
if (isInline) {
|
|
132
|
+
if (inline) {
|
|
139
133
|
return <StyledInlineCode size={size} className={className}>{children}</StyledInlineCode>;
|
|
140
134
|
}
|
|
141
135
|
|
|
@@ -282,11 +276,11 @@ export const MarkdownTable = styled.table`
|
|
|
282
276
|
`;
|
|
283
277
|
|
|
284
278
|
// TODO: This should be used for readmes
|
|
285
|
-
export const MarkdownParagraphContent: React.FC<SharedTextProps &
|
|
279
|
+
export const MarkdownParagraphContent: React.FC<SharedTextProps & Pick<ReactMarkdownProps, 'node'>> = ({
|
|
286
280
|
children,
|
|
287
281
|
node,
|
|
288
282
|
}) => {
|
|
289
|
-
const child = node
|
|
283
|
+
const child = node.children[0];
|
|
290
284
|
const isText = child?.type === 'text';
|
|
291
285
|
|
|
292
286
|
const videoSrc = isText && getVideoSrc(child.value);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
2
|
import { createPath } from 'history';
|
|
3
3
|
import type React from 'react';
|
|
4
|
+
import type { FlattenSimpleInterpolation } from 'styled-components';
|
|
4
5
|
import styled, { css } from 'styled-components';
|
|
5
6
|
|
|
6
7
|
import type { IconComponent } from '@apify/ui-icons';
|
|
7
8
|
|
|
8
9
|
import { theme } from '../../design_system/theme.js';
|
|
9
10
|
import type { WithTransientProps } from '../../type_utils.js';
|
|
10
|
-
import type { FlattenSimpleInterpolation } from '../../utils/type_utils.js';
|
|
11
11
|
import type { BadgeSize } from '../badge.js';
|
|
12
12
|
import { Badge } from '../badge.js';
|
|
13
13
|
import type { MarginSpacingProps, RegularBoxProps } from '../box.js';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import { useCallback, useRef, useState } from 'react';
|
|
3
|
+
import type { FlattenSimpleInterpolation } from 'styled-components';
|
|
3
4
|
import styled, { css } from 'styled-components';
|
|
4
5
|
|
|
5
6
|
import { theme } from '../../design_system/theme.js';
|
|
6
7
|
import type { WithTransientProps } from '../../type_utils.js';
|
|
7
8
|
import { useResizeObserverSsr } from '../../utils/resize_observer.js';
|
|
8
|
-
import type { FlattenSimpleInterpolation } from '../../utils/type_utils.js';
|
|
9
9
|
import type { MarginSpacingProps, RegularBoxProps } from '../box.js';
|
|
10
10
|
import { Box } from '../box.js';
|
|
11
11
|
import type { TabData, TabVariant } from './tab.js';
|
|
@@ -77,7 +77,7 @@ const TabsWrapper = styled(Box)<TabsWrapperProps>`
|
|
|
77
77
|
/* Scrollbar */
|
|
78
78
|
-ms-overflow-style: none;
|
|
79
79
|
scrollbar-width: none;
|
|
80
|
-
|
|
80
|
+
|
|
81
81
|
&::-webkit-scrollbar {
|
|
82
82
|
display: none; /* Chrome, Safari, Opera */
|
|
83
83
|
}
|
|
@@ -107,7 +107,7 @@ const TabsWrapper = styled(Box)<TabsWrapperProps>`
|
|
|
107
107
|
|
|
108
108
|
&:first-of-type {
|
|
109
109
|
left: 0;
|
|
110
|
-
|
|
110
|
+
|
|
111
111
|
&::after {
|
|
112
112
|
left: 0;
|
|
113
113
|
background: linear-gradient(90deg, ${theme.color.neutral.background} 0%, rgba(255, 255, 255, 0) 100%);
|
|
@@ -116,7 +116,7 @@ const TabsWrapper = styled(Box)<TabsWrapperProps>`
|
|
|
116
116
|
|
|
117
117
|
&:last-of-type {
|
|
118
118
|
right: 0;
|
|
119
|
-
|
|
119
|
+
|
|
120
120
|
&::after {
|
|
121
121
|
right: 0;
|
|
122
122
|
background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, ${theme.color.neutral.background} 100%);
|
package/src/components/tag.tsx
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import { type ForwardedRef, forwardRef } from 'react';
|
|
3
|
-
import styled, { css } from 'styled-components';
|
|
3
|
+
import styled, { css, type FlattenSimpleInterpolation } from 'styled-components';
|
|
4
4
|
|
|
5
5
|
import type { IconComponent, IconSize } from '@apify/ui-icons';
|
|
6
6
|
|
|
7
7
|
import { theme } from '../design_system/theme.js';
|
|
8
8
|
import type { WithTransientProps } from '../type_utils.js';
|
|
9
|
-
import type { FlattenSimpleInterpolation } from '../utils/type_utils.js';
|
|
10
9
|
import { Box, type MarginSpacingProps, type RegularBoxProps } from './box.js';
|
|
11
10
|
import type { RegularButtonProps } from './button.js';
|
|
12
11
|
import { Link, type RegularLinkProps } from './link.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { forwardRef } from 'react';
|
|
2
|
+
import type { FlattenSimpleInterpolation } from 'styled-components';
|
|
2
3
|
import styled, { css } from 'styled-components';
|
|
3
4
|
|
|
4
5
|
import { theme } from '../../design_system/theme.js';
|
|
5
6
|
import type { WithTransientProps } from '../../type_utils.js';
|
|
6
|
-
import type { FlattenSimpleInterpolation } from '../../utils/type_utils.js';
|
|
7
7
|
import type { TextBaseProps } from './text_base.js';
|
|
8
8
|
import { TextBaseComponent } from './text_base.js';
|
|
9
9
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { forwardRef } from 'react';
|
|
2
|
+
import type { FlattenSimpleInterpolation } from 'styled-components';
|
|
2
3
|
import styled, { css } from 'styled-components';
|
|
3
4
|
|
|
4
5
|
import { theme } from '../../design_system/theme.js';
|
|
5
6
|
import type { WithTransientProps } from '../../type_utils.js';
|
|
6
|
-
import type { FlattenSimpleInterpolation } from '../../utils/type_utils.js';
|
|
7
7
|
import type { TextBaseProps } from './text_base.js';
|
|
8
8
|
import { TextBaseComponent } from './text_base.js';
|
|
9
9
|
|