@apify/ui-library 0.67.3 → 0.67.5-featoutputschemacomponent-327312.42
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/code/inline_code/inline_code.d.ts +1 -0
- package/dist/src/components/code/inline_code/inline_code.d.ts.map +1 -1
- package/dist/src/components/code/inline_code/inline_code.js +14 -2
- package/dist/src/components/code/inline_code/inline_code.js.map +1 -1
- package/dist/src/components/simple_markdown/simple_markdown.js +4 -4
- package/dist/src/components/simple_markdown/simple_markdown.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/components/code/inline_code/inline_code.tsx +29 -11
- package/src/components/simple_markdown/simple_markdown.tsx +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apify/ui-library",
|
|
3
|
-
"version": "0.67.
|
|
3
|
+
"version": "0.67.5-featoutputschemacomponent-327312.42+35425759a07",
|
|
4
4
|
"description": "React UI library used by apify.com",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"typescript": "^5.1.6",
|
|
66
66
|
"typescript-eslint": "^8.24.0"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "35425759a07209a8230bf5afb9bfd6dc28c326d6"
|
|
69
69
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled, { css } from 'styled-components';
|
|
3
3
|
|
|
4
|
+
import { CheckIcon, CopyIcon } from '@apify/ui-icons';
|
|
5
|
+
|
|
4
6
|
import { theme } from '../../../design_system/theme.js';
|
|
7
|
+
import { useCopyToClipboard } from '../../../utils/copy_to_clipboard.js';
|
|
5
8
|
import type { RegularBoxProps } from '../../box.js';
|
|
6
9
|
import { Text } from '../../text/index.js';
|
|
7
10
|
import type { SharedTextSize } from '../../text/text_shared.js';
|
|
@@ -15,6 +18,20 @@ export const inlineCodeStyles = css`
|
|
|
15
18
|
border: 1px solid ${theme.color.neutral.border};
|
|
16
19
|
`;
|
|
17
20
|
|
|
21
|
+
const CopyButtonWrapper = styled.div`
|
|
22
|
+
display: inline-flex;
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
vertical-align: text-top;
|
|
25
|
+
margin-left: ${theme.space.space4};
|
|
26
|
+
`;
|
|
27
|
+
|
|
28
|
+
const CopyButton: React.FC<{ text: string }> = ({ text }) => {
|
|
29
|
+
const [isCopied, copyToClipboard] = useCopyToClipboard({ text });
|
|
30
|
+
return <CopyButtonWrapper role='button' onClick={copyToClipboard} title='Copy to clipboard'>
|
|
31
|
+
{isCopied ? <CheckIcon size="16" /> : <CopyIcon size="16" />}
|
|
32
|
+
</CopyButtonWrapper>;
|
|
33
|
+
};
|
|
34
|
+
|
|
18
35
|
const Wrapper = styled.span`
|
|
19
36
|
code {
|
|
20
37
|
${inlineCodeStyles}
|
|
@@ -24,21 +41,22 @@ const Wrapper = styled.span`
|
|
|
24
41
|
export type InlineCodeProps = RegularBoxProps & {
|
|
25
42
|
children: React.ReactNode,
|
|
26
43
|
size?: SharedTextSize,
|
|
44
|
+
withCopyButton?: boolean,
|
|
27
45
|
}
|
|
28
46
|
|
|
29
47
|
// This might be just a Chip component
|
|
30
48
|
export const InlineCode: React.FC<InlineCodeProps> = ({
|
|
31
49
|
children,
|
|
32
50
|
size,
|
|
51
|
+
withCopyButton,
|
|
33
52
|
...props
|
|
34
|
-
}) =>
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
);
|
|
53
|
+
}) => <Wrapper {...props}>
|
|
54
|
+
<Text
|
|
55
|
+
type="code"
|
|
56
|
+
as="code"
|
|
57
|
+
size={size}
|
|
58
|
+
>
|
|
59
|
+
{children}
|
|
60
|
+
{withCopyButton && <CopyButton text={children?.toString() ?? ''} />}
|
|
61
|
+
</Text>
|
|
62
|
+
</Wrapper>;
|
|
@@ -125,8 +125,8 @@ const regularMarkdownSizeComponents: Components = {
|
|
|
125
125
|
blockquote: ({ children }) => <MarkdownBlockQuote>{children}</MarkdownBlockQuote>,
|
|
126
126
|
table: ({ children }) => <MarkdownTable>{children}</MarkdownTable>,
|
|
127
127
|
ul: ({ children }) => <Box as='ul' pl='space32'>{children}</Box>,
|
|
128
|
-
ol: ({ children, start }) => <
|
|
129
|
-
li: ({ children }) => <
|
|
128
|
+
ol: ({ children, start }) => <TextContent as='ol' pl='space32' start={start}>{children}</TextContent>,
|
|
129
|
+
li: ({ children }) => <TextContent as='li' mt='space4'>{children}</TextContent>,
|
|
130
130
|
a: ({ children, href }) => <MarkdownLink to={href}>{children}</MarkdownLink>,
|
|
131
131
|
code: ({ children, inline }) => <MarkdownCode inline={inline} size='regular'>{children}</MarkdownCode>,
|
|
132
132
|
};
|
|
@@ -145,8 +145,8 @@ const smallMarkdownSizeComponents: Components = {
|
|
|
145
145
|
blockquote: ({ children }) => <MarkdownBlockQuote>{children}</MarkdownBlockQuote>,
|
|
146
146
|
table: ({ children }) => <MarkdownTable>{children}</MarkdownTable>,
|
|
147
147
|
ul: ({ children }) => <Box as='ul' pl='space32'>{children}</Box>,
|
|
148
|
-
ol: ({ children, start }) => <
|
|
149
|
-
li: ({ children }) => <
|
|
148
|
+
ol: ({ children, start }) => <Text as='ol' pl='space32' start={start}>{children}</Text>,
|
|
149
|
+
li: ({ children }) => <Text as='li' mt='space4'>{children}</Text>,
|
|
150
150
|
a: ({ children, href }) => <MarkdownLink to={href}>{children}</MarkdownLink>,
|
|
151
151
|
code: ({ children, inline }) => <MarkdownCode inline={inline} size='small'>{children}</MarkdownCode>,
|
|
152
152
|
};
|