@apify/ui-library 1.127.5 → 1.127.6
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/code/code_block/code_block_with_tabs.d.ts +4 -1
- package/dist/src/components/code/code_block/code_block_with_tabs.d.ts.map +1 -1
- package/dist/src/components/code/code_block/code_block_with_tabs.js +8 -5
- package/dist/src/components/code/code_block/code_block_with_tabs.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/components/code/code_block/code_block_with_tabs.tsx +13 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apify/ui-library",
|
|
3
|
-
"version": "1.127.
|
|
3
|
+
"version": "1.127.6",
|
|
4
4
|
"description": "React UI library used by apify.com",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"It's not nice, but helps us to get around the problem of multiple react instances."
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@apify/ui-icons": "^1.29.
|
|
30
|
+
"@apify/ui-icons": "^1.29.2",
|
|
31
31
|
"@floating-ui/react": "^0.26.2",
|
|
32
32
|
"@radix-ui/react-checkbox": "^1.3.3",
|
|
33
33
|
"@react-hook/resize-observer": "^2.0.2",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"src",
|
|
68
68
|
"style"
|
|
69
69
|
],
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "0fae65b571f8b1e6feedc7201a9b635e8e9212b4"
|
|
71
71
|
}
|
|
@@ -3,6 +3,8 @@ import _ from 'lodash';
|
|
|
3
3
|
import type React from 'react';
|
|
4
4
|
import styled from 'styled-components';
|
|
5
5
|
|
|
6
|
+
import { CodeIcon, HttpIcon, type IconComponent, McpIcon } from '@apify/ui-icons';
|
|
7
|
+
|
|
6
8
|
import { theme } from '../../../design_system/theme.js';
|
|
7
9
|
import { useSharedUiDependencies } from '../../../ui_dependency_provider.js';
|
|
8
10
|
import { Box, type MarginSpacingProps, type RegularBoxProps } from '../../box.js';
|
|
@@ -14,19 +16,21 @@ export type CodeBlockTabKey = 'cli' | 'http' | 'javascript' | 'mcp' | 'openapi'
|
|
|
14
16
|
type CodeBlockTabConfig = {
|
|
15
17
|
label: string;
|
|
16
18
|
language: string;
|
|
17
|
-
|
|
19
|
+
Icon?: IconComponent;
|
|
20
|
+
/** Fallback image URL for tabs that don't have an Icon component yet */
|
|
21
|
+
src?: string;
|
|
18
22
|
};
|
|
19
23
|
|
|
20
24
|
export const CODE_BLOCK_TAB_CATALOG: Record<CodeBlockTabKey, CodeBlockTabConfig> = {
|
|
21
25
|
cli: {
|
|
22
26
|
label: 'CLI',
|
|
23
27
|
language: 'bash',
|
|
24
|
-
|
|
28
|
+
Icon: CodeIcon,
|
|
25
29
|
},
|
|
26
30
|
http: {
|
|
27
31
|
label: 'HTTP',
|
|
28
32
|
language: 'bash',
|
|
29
|
-
|
|
33
|
+
Icon: HttpIcon,
|
|
30
34
|
},
|
|
31
35
|
javascript: {
|
|
32
36
|
label: 'JavaScript',
|
|
@@ -37,7 +41,7 @@ export const CODE_BLOCK_TAB_CATALOG: Record<CodeBlockTabKey, CodeBlockTabConfig>
|
|
|
37
41
|
mcp: {
|
|
38
42
|
label: 'MCP',
|
|
39
43
|
language: 'bash',
|
|
40
|
-
|
|
44
|
+
Icon: McpIcon,
|
|
41
45
|
},
|
|
42
46
|
openapi: {
|
|
43
47
|
label: 'OpenAPI',
|
|
@@ -201,7 +205,7 @@ export const CodeBlockWithTabs = ({ className, codeBlockProps, currentTabKey, ta
|
|
|
201
205
|
<CodeBlockWithTabsWrapper className={clsx(CODE_BLOCK_WITH_TABS_CLASSNAMES.WRAPPER, className)} {...props}>
|
|
202
206
|
<div className={CODE_BLOCK_WITH_TABS_CLASSNAMES.TABS}>
|
|
203
207
|
{tabs.map((tab) => {
|
|
204
|
-
const { label, src } = CODE_BLOCK_TAB_CATALOG[tab.key];
|
|
208
|
+
const { label, src, Icon } = CODE_BLOCK_TAB_CATALOG[tab.key];
|
|
205
209
|
const selected = (optimisticCurrentTabKey ?? currentTabKey) === tab.key;
|
|
206
210
|
|
|
207
211
|
const commonProps = {
|
|
@@ -211,7 +215,10 @@ export const CodeBlockWithTabs = ({ className, codeBlockProps, currentTabKey, ta
|
|
|
211
215
|
};
|
|
212
216
|
const children = (
|
|
213
217
|
<>
|
|
214
|
-
|
|
218
|
+
{Icon
|
|
219
|
+
? <Icon size="20" />
|
|
220
|
+
: <img src={src && (generateProxyImageUrl?.(src, { resize: IMG_RESIZE }) ?? src)} alt={label} />
|
|
221
|
+
}
|
|
215
222
|
<HeadingShared type="titleS" as="p">
|
|
216
223
|
{label}
|
|
217
224
|
</HeadingShared>
|