@apify/ui-library 1.109.2 → 1.109.3-featurereact19upgrade-8b5553.119
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/card_container.d.ts +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 +19 -6
- 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 +3 -7
- 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 +8 -5
- package/dist/src/components/readme_renderer/utils.js.map +1 -1
- package/dist/src/components/shortcut.d.ts +2 -1
- 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 +7 -3
- package/dist/src/components/simple_markdown/simple_markdown.d.ts.map +1 -1
- package/dist/src/components/simple_markdown/simple_markdown.js +25 -14
- package/dist/src/components/simple_markdown/simple_markdown.js.map +1 -1
- package/dist/src/components/simple_markdown/simple_markdown_components.d.ts +9 -11
- package/dist/src/components/simple_markdown/simple_markdown_components.d.ts.map +1 -1
- package/dist/src/components/simple_markdown/simple_markdown_components.js +5 -4
- 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 +60 -50
- 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 +1 -0
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/index.js +1 -0
- package/dist/src/utils/index.js.map +1 -1
- package/dist/src/utils/type_utils.d.ts +3 -0
- package/dist/src/utils/type_utils.d.ts.map +1 -0
- package/dist/src/utils/type_utils.js +2 -0
- package/dist/src/utils/type_utils.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +15 -15
- package/src/components/badge.tsx +2 -1
- 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 +1 -2
- package/src/components/readme_renderer/utils.tsx +9 -6
- package/src/components/shortcut.tsx +2 -1
- package/src/components/simple_markdown/simple_markdown.tsx +50 -28
- package/src/components/simple_markdown/simple_markdown_components.tsx +13 -7
- package/src/components/tabs/tab.tsx +1 -1
- package/src/components/tabs/tabs.tsx +4 -4
- package/src/components/tag.tsx +2 -1
- 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 +91 -77
- package/src/utils/index.ts +1 -0
- package/src/utils/type_utils.ts +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apify/ui-library",
|
|
3
|
-
"version": "1.109.
|
|
3
|
+
"version": "1.109.3-featurereact19upgrade-8b5553.119+12676e2e930",
|
|
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.23.
|
|
29
|
+
"@apify/ui-icons": "^1.23.1-featurereact19upgrade-8b5553.153+12676e2e930",
|
|
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": "^10.1.0",
|
|
41
|
+
"rehype-raw": "^7.0.0",
|
|
42
42
|
"rehype-sanitize": "^6.0.0",
|
|
43
|
-
"remark-gfm": "^
|
|
44
|
-
"remark-toc": "
|
|
43
|
+
"remark-gfm": "^4.0.1",
|
|
44
|
+
"remark-toc": "9.0.0",
|
|
45
45
|
"slugify": "^1.6.6",
|
|
46
|
-
"
|
|
46
|
+
"unist-util-visit": "^5.0.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"react": "17.x || 18.x",
|
|
50
|
-
"react-dom": "17.x || 18.x",
|
|
51
|
-
"styled-components": "^
|
|
52
|
-
"unist-util-visit": "^5.0.0"
|
|
49
|
+
"react": "17.x || 18.x || 19.x",
|
|
50
|
+
"react-dom": "17.x || 18.x || 19.x",
|
|
51
|
+
"styled-components": "^6.1.19"
|
|
53
52
|
},
|
|
54
53
|
"devDependencies": {
|
|
55
54
|
"@storybook/react-vite": "^9.0.16",
|
|
55
|
+
"@types/hast": "^3.0.4",
|
|
56
56
|
"@types/lodash": "^4.14.200",
|
|
57
|
-
"@types/react": "
|
|
58
|
-
"@types/styled-components": "^5.1.34",
|
|
57
|
+
"@types/react": "19.2.2",
|
|
59
58
|
"recast": "^0.23.9",
|
|
60
|
-
"style-dictionary": "^4.4.0"
|
|
59
|
+
"style-dictionary": "^4.4.0",
|
|
60
|
+
"styled-components": "^6.1.19"
|
|
61
61
|
},
|
|
62
62
|
"files": [
|
|
63
63
|
"dist",
|
|
64
64
|
"src",
|
|
65
65
|
"style"
|
|
66
66
|
],
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "12676e2e930ec972e722721878005ad8dc198dbc"
|
|
68
68
|
}
|
package/src/components/badge.tsx
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
|
-
import styled, { css
|
|
3
|
+
import styled, { css } 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';
|
|
9
10
|
import { Box, type MarginSpacingProps, type RegularBoxProps } from './box.js';
|
|
10
11
|
import { Text } from './text/index.js';
|
|
11
12
|
import type { SharedTextSize, SharedTextType } from './text/text_shared.js';
|
|
@@ -147,7 +147,7 @@ export type OneLineCodeTrackingBundle = Record<
|
|
|
147
147
|
TrackingBundleDataObject
|
|
148
148
|
>;
|
|
149
149
|
|
|
150
|
-
export type OneLineCodeProps = BoxProps & {
|
|
150
|
+
export type OneLineCodeProps = Omit<BoxProps, 'children'> & {
|
|
151
151
|
children: string;
|
|
152
152
|
language?: string;
|
|
153
153
|
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;
|
|
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, forwardRef, useState } from 'react';
|
|
6
|
+
import { type ComponentType, type ElementType, forwardRef, type ReactNode, 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?: ElementType;
|
|
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): ReactNode => {
|
|
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}
|
|
111
111
|
className={className}
|
|
112
112
|
ref={refs.setReference}
|
|
113
113
|
{...getReferenceProps()}
|
|
@@ -3,8 +3,7 @@ import React, {
|
|
|
3
3
|
useCallback,
|
|
4
4
|
useMemo,
|
|
5
5
|
} from 'react';
|
|
6
|
-
import ReactMarkdown from 'react-markdown';
|
|
7
|
-
import type { AllowElement } from 'react-markdown/lib/rehype-filter.js';
|
|
6
|
+
import ReactMarkdown, { type AllowElement } from 'react-markdown';
|
|
8
7
|
import remarkToc from 'remark-toc';
|
|
9
8
|
import styled from 'styled-components';
|
|
10
9
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { useCallback } from 'react';
|
|
2
|
-
import type { AllowElement } from 'react-markdown
|
|
1
|
+
import React, { type ReactElement, type ReactNode, useCallback } from 'react';
|
|
2
|
+
import type { AllowElement } from 'react-markdown';
|
|
3
3
|
import slugify from 'slugify';
|
|
4
4
|
|
|
5
5
|
export const slugifyHeadingChildren = (
|
|
@@ -11,9 +11,12 @@ 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 (
|
|
14
|
+
} else if (React.isValidElement(child)) {
|
|
15
|
+
const element = child as ReactElement<{ children?: ReactNode }>;
|
|
16
|
+
if (element.props.children) {
|
|
17
|
+
const nestedSlugs = slugifyHeadingChildren(element.props.children);
|
|
18
|
+
if (nestedSlugs) slugs.push(nestedSlugs);
|
|
19
|
+
}
|
|
17
20
|
}
|
|
18
21
|
});
|
|
19
22
|
|
|
@@ -35,7 +38,7 @@ export const cleanMarkdown = (markdown: string, removeFirstH1?: boolean): string
|
|
|
35
38
|
// This removes the first element if it's a `h1` containing exactly the Actor title
|
|
36
39
|
export const useActorTitleHeadingFilter = (actorTitle: string): AllowElement => {
|
|
37
40
|
return useCallback((element, index, parent) => {
|
|
38
|
-
if (parent
|
|
41
|
+
if (parent?.type === 'root'
|
|
39
42
|
&& index === 0
|
|
40
43
|
&& element.tagName === 'h1'
|
|
41
44
|
&& element.children.length === 1
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import type { ElementType } from 'react';
|
|
1
2
|
import styled, { css } from 'styled-components';
|
|
2
3
|
|
|
3
4
|
import { theme } from '../design_system/theme.js';
|
|
4
5
|
import { Text } from './text/index.js';
|
|
5
6
|
|
|
6
7
|
interface ShortcutProps {
|
|
7
|
-
as?:
|
|
8
|
+
as?: ElementType;
|
|
8
9
|
className?: string;
|
|
9
10
|
children: React.ReactNode;
|
|
10
11
|
/* If true, always use dark mode colors */
|
|
@@ -1,14 +1,12 @@
|
|
|
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 } from 'react-markdown';
|
|
5
|
-
import ReactMarkdown
|
|
6
|
-
import type { ReactMarkdownOptions } from 'react-markdown/lib/react-markdown.js';
|
|
4
|
+
import type { Components, Options as ReactMarkdownOptions, UrlTransform } from 'react-markdown';
|
|
5
|
+
import ReactMarkdown from 'react-markdown';
|
|
7
6
|
import rehypeRaw from 'rehype-raw';
|
|
8
7
|
import rehypeSanitize from 'rehype-sanitize';
|
|
9
8
|
import remarkGfm from 'remark-gfm';
|
|
10
9
|
import styled from 'styled-components';
|
|
11
|
-
import type { Pluggable, PluggableList } from 'unified';
|
|
12
10
|
import { visit } from 'unist-util-visit';
|
|
13
11
|
|
|
14
12
|
import { theme } from '../../design_system/theme.js';
|
|
@@ -61,7 +59,7 @@ export const defaultAllowedElements = [
|
|
|
61
59
|
'ul',
|
|
62
60
|
];
|
|
63
61
|
|
|
64
|
-
const
|
|
62
|
+
const StyledMarkdownWrapper = styled(Box)`
|
|
65
63
|
scroll-margin-top: 10px;
|
|
66
64
|
|
|
67
65
|
overflow: auto;
|
|
@@ -101,7 +99,7 @@ const unwrapUnsupportedElement = (node: Element): (Element | TextNode)[] => {
|
|
|
101
99
|
|
|
102
100
|
const getUnsupportedRehypeTagsSanitationPlugIn = (
|
|
103
101
|
allowedElements: string[],
|
|
104
|
-
)
|
|
102
|
+
) => () => (tree: Root) => {
|
|
105
103
|
visit(tree, 'element', (node, index, parent) => {
|
|
106
104
|
if (!allowedElements.includes(node.tagName) && parent && typeof index === 'number') {
|
|
107
105
|
// Replace unsupported element with its valid children
|
|
@@ -153,7 +151,7 @@ const regularMarkdownSizeComponents: Components = {
|
|
|
153
151
|
ol: ({ children, start }) => <TextContent as='ol' pl='space32' start={start}>{children}</TextContent>,
|
|
154
152
|
li: ({ children }) => <TextContent as='li' mt='space4'>{children}</TextContent>,
|
|
155
153
|
a: ({ children, href }) => <MarkdownLink to={href}>{children}</MarkdownLink>,
|
|
156
|
-
code: ({ children,
|
|
154
|
+
code: ({ children, node }) => <MarkdownCode node={node} size='regular'>{children}</MarkdownCode>,
|
|
157
155
|
img: ({ src, alt, height, width }) => <MarkdownImage src={src} alt={alt} height={height} width={width} />,
|
|
158
156
|
};
|
|
159
157
|
|
|
@@ -174,17 +172,23 @@ const smallMarkdownSizeComponents: Components = {
|
|
|
174
172
|
ol: ({ children, start }) => <Text as='ol' pl='space32' start={start}>{children}</Text>,
|
|
175
173
|
li: ({ children }) => <Text as='li' mt='space4'>{children}</Text>,
|
|
176
174
|
a: ({ children, href }) => <MarkdownLink to={href}>{children}</MarkdownLink>,
|
|
177
|
-
code: ({ children,
|
|
175
|
+
code: ({ children, node }) => <MarkdownCode node={node} size='small'>{children}</MarkdownCode>,
|
|
178
176
|
img: ({ src, alt, height, width }) => <MarkdownImage src={src} alt={alt} height={height} width={width} />,
|
|
179
177
|
};
|
|
180
178
|
|
|
181
179
|
type MarkdownSize = 'regular' | 'small';
|
|
182
180
|
|
|
183
|
-
export type SimpleMarkdownProps = ReactMarkdownOptions & {
|
|
181
|
+
export type SimpleMarkdownProps = Omit<ReactMarkdownOptions, 'urlTransform' | 'children'> & {
|
|
182
|
+
// @deprecated use urlTransform instead
|
|
183
|
+
transformLinkUri?: UrlTransform,
|
|
184
|
+
// @deprecated use urlTransform instead
|
|
185
|
+
transformImageUri?: UrlTransform,
|
|
184
186
|
size?: MarkdownSize,
|
|
187
|
+
children: string,
|
|
188
|
+
className?: string,
|
|
185
189
|
}
|
|
186
190
|
|
|
187
|
-
const useDefaultUrlTransform = () => {
|
|
191
|
+
export const useDefaultUrlTransform = () => {
|
|
188
192
|
const { windowLocationHost } = useSharedUiDependencies();
|
|
189
193
|
|
|
190
194
|
return useCallback((url: string) => {
|
|
@@ -204,7 +208,9 @@ export const SimpleMarkdown: React.FC<SimpleMarkdownProps> = ({
|
|
|
204
208
|
rehypePlugins,
|
|
205
209
|
remarkPlugins,
|
|
206
210
|
transformLinkUri,
|
|
211
|
+
transformImageUri,
|
|
207
212
|
allowedElements,
|
|
213
|
+
className,
|
|
208
214
|
...rest
|
|
209
215
|
}) => {
|
|
210
216
|
const cleanedMarkdown = useMemo(() => cleanMarkdown(markdown), [markdown]);
|
|
@@ -216,26 +222,42 @@ export const SimpleMarkdown: React.FC<SimpleMarkdownProps> = ({
|
|
|
216
222
|
...components,
|
|
217
223
|
});
|
|
218
224
|
|
|
219
|
-
const rehypePluginsRef = useRef<PluggableList>([
|
|
220
|
-
...(rehypePlugins || [...defaultRehypePlugins, getUnsupportedRehypeTagsSanitationPlugIn(effectiveAllowedElements.current)]),
|
|
221
|
-
rehypeSanitize, // lets always sanitize the output
|
|
222
|
-
]);
|
|
223
|
-
|
|
224
225
|
const defaultUrlTransform = useDefaultUrlTransform();
|
|
225
226
|
|
|
227
|
+
const effectiveRehypePlugins = useMemo(() => {
|
|
228
|
+
const plugins = rehypePlugins ?? [
|
|
229
|
+
...defaultRehypePlugins,
|
|
230
|
+
getUnsupportedRehypeTagsSanitationPlugIn(effectiveAllowedElements.current as string[]),
|
|
231
|
+
];
|
|
232
|
+
|
|
233
|
+
return [
|
|
234
|
+
...plugins,
|
|
235
|
+
rehypeSanitize,
|
|
236
|
+
];
|
|
237
|
+
}, [rehypePlugins]);
|
|
238
|
+
|
|
226
239
|
return (
|
|
227
|
-
<
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
+
<StyledMarkdownWrapper className={className}>
|
|
241
|
+
<ReactMarkdown
|
|
242
|
+
components={effectiveComponents.current}
|
|
243
|
+
rehypePlugins={effectiveRehypePlugins}
|
|
244
|
+
remarkPlugins={remarkPlugins || defaultRemarkPlugins}
|
|
245
|
+
allowedElements={effectiveAllowedElements.current}
|
|
246
|
+
urlTransform={(href, children, node) => {
|
|
247
|
+
if (node.tagName === 'img') {
|
|
248
|
+
return transformImageUri ? transformImageUri(href, children, node) : href;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
if (node.tagName === 'a') {
|
|
252
|
+
return transformLinkUri ? transformLinkUri(href, children, node) : defaultUrlTransform(href);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
return href;
|
|
256
|
+
}}
|
|
257
|
+
{...rest}
|
|
258
|
+
>
|
|
259
|
+
{cleanedMarkdown}
|
|
260
|
+
</ReactMarkdown>
|
|
261
|
+
</StyledMarkdownWrapper>
|
|
240
262
|
);
|
|
241
263
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import qs from 'query-string';
|
|
2
2
|
import type React from 'react';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ExtraProps as MarkdownComponentExtraProps } from 'react-markdown';
|
|
4
4
|
import styled from 'styled-components';
|
|
5
5
|
|
|
6
6
|
import { CheckIcon, LinkIcon } from '@apify/ui-icons';
|
|
@@ -121,15 +121,21 @@ const StyledInlineCode = styled(InlineCode)`
|
|
|
121
121
|
}
|
|
122
122
|
`;
|
|
123
123
|
|
|
124
|
-
type MarkdownCodeProps =
|
|
124
|
+
type MarkdownCodeProps = {
|
|
125
|
+
size: SharedTextSize,
|
|
126
|
+
className?: string,
|
|
127
|
+
children: React.ReactNode,
|
|
128
|
+
} & MarkdownComponentExtraProps;
|
|
125
129
|
|
|
126
|
-
export const MarkdownCode: React.FC<MarkdownCodeProps
|
|
127
|
-
inline,
|
|
130
|
+
export const MarkdownCode: React.FC<MarkdownCodeProps> = ({
|
|
128
131
|
className,
|
|
129
132
|
children,
|
|
130
133
|
size,
|
|
134
|
+
node,
|
|
131
135
|
}) => {
|
|
132
|
-
|
|
136
|
+
const isInline = node?.position?.start?.line === node?.position?.end?.line;
|
|
137
|
+
|
|
138
|
+
if (isInline) {
|
|
133
139
|
return <StyledInlineCode size={size} className={className}>{children}</StyledInlineCode>;
|
|
134
140
|
}
|
|
135
141
|
|
|
@@ -276,11 +282,11 @@ export const MarkdownTable = styled.table`
|
|
|
276
282
|
`;
|
|
277
283
|
|
|
278
284
|
// TODO: This should be used for readmes
|
|
279
|
-
export const MarkdownParagraphContent: React.FC<SharedTextProps &
|
|
285
|
+
export const MarkdownParagraphContent: React.FC<SharedTextProps & MarkdownComponentExtraProps> = async ({
|
|
280
286
|
children,
|
|
281
287
|
node,
|
|
282
288
|
}) => {
|
|
283
|
-
const child = node
|
|
289
|
+
const child = node?.children[0];
|
|
284
290
|
const isText = child?.type === 'text';
|
|
285
291
|
|
|
286
292
|
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';
|
|
5
4
|
import styled, { css } from 'styled-components';
|
|
6
5
|
|
|
7
6
|
import type { IconComponent } from '@apify/ui-icons';
|
|
8
7
|
|
|
9
8
|
import { theme } from '../../design_system/theme.js';
|
|
10
9
|
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';
|
|
4
3
|
import styled, { css } from 'styled-components';
|
|
5
4
|
|
|
6
5
|
import { theme } from '../../design_system/theme.js';
|
|
7
6
|
import type { WithTransientProps } from '../../type_utils.js';
|
|
8
7
|
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,11 +1,12 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import { type ForwardedRef, forwardRef } from 'react';
|
|
3
|
-
import styled, { css
|
|
3
|
+
import styled, { css } 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';
|
|
9
10
|
import { Box, type MarginSpacingProps, type RegularBoxProps } from './box.js';
|
|
10
11
|
import type { RegularButtonProps } from './button.js';
|
|
11
12
|
import { Link, type RegularLinkProps } from './link.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { forwardRef } from 'react';
|
|
2
|
-
import type { FlattenSimpleInterpolation } from 'styled-components';
|
|
3
2
|
import styled, { css } from 'styled-components';
|
|
4
3
|
|
|
5
4
|
import { theme } from '../../design_system/theme.js';
|
|
6
5
|
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';
|
|
3
2
|
import styled, { css } from 'styled-components';
|
|
4
3
|
|
|
5
4
|
import { theme } from '../../design_system/theme.js';
|
|
6
5
|
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
|
|