@apify/ui-library 0.74.2-featCodeBlockWithTabsoptimis-e30911.3 → 0.75.0
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/code_block/code_block_with_tabs.d.ts +1 -2
- 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 +2 -2
- package/dist/src/components/code/code_block/code_block_with_tabs.js.map +1 -1
- package/dist/src/components/readme_renderer/index.d.ts +1 -1
- package/dist/src/components/readme_renderer/index.d.ts.map +1 -1
- package/dist/src/components/readme_renderer/index.js +1 -1
- package/dist/src/components/readme_renderer/index.js.map +1 -1
- package/dist/src/components/readme_renderer/table_of_contents.d.ts +1 -0
- 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 -0
- package/dist/src/components/readme_renderer/table_of_contents.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/components/code/code_block/code_block_with_tabs.tsx +2 -4
- package/src/components/readme_renderer/index.ts +1 -1
- package/src/components/readme_renderer/table_of_contents.tsx +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apify/ui-library",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.75.0",
|
|
4
4
|
"description": "React UI library used by apify.com",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"typescript": "^5.1.6",
|
|
67
67
|
"typescript-eslint": "^8.24.0"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "a4c4ceee13ae2580b5fc2257759fc60eadf010c9"
|
|
70
70
|
}
|
|
@@ -74,8 +74,6 @@ type CodeBlockWithTabsProps = SharedBoxProps & {
|
|
|
74
74
|
codeBlockProps: SharedCodeBlockProps;
|
|
75
75
|
currentTabKey: CodeBlockTabKey;
|
|
76
76
|
tabs: CodeBlockTabProps[];
|
|
77
|
-
// Optional prop to set the selected tab, does not influence the content of the code block, used to improve interactivity
|
|
78
|
-
optimisticCurrentTabKey?: CodeBlockTabKey;
|
|
79
77
|
};
|
|
80
78
|
|
|
81
79
|
export const CODE_BLOCK_WITH_TABS_CLASSNAMES = {
|
|
@@ -192,7 +190,7 @@ const IMG_RESIZE = {
|
|
|
192
190
|
height: 20,
|
|
193
191
|
};
|
|
194
192
|
|
|
195
|
-
export const CodeBlockWithTabs = ({ className, codeBlockProps, currentTabKey, tabs,
|
|
193
|
+
export const CodeBlockWithTabs = ({ className, codeBlockProps, currentTabKey, tabs, ...props }: CodeBlockWithTabsProps) => {
|
|
196
194
|
const { generateProxyImageUrl } = useSharedUiDependencies();
|
|
197
195
|
const currentTab = tabs.find((tab) => tab.key === currentTabKey) ?? tabs[0];
|
|
198
196
|
|
|
@@ -201,7 +199,7 @@ export const CodeBlockWithTabs = ({ className, codeBlockProps, currentTabKey, ta
|
|
|
201
199
|
<div className={CODE_BLOCK_WITH_TABS_CLASSNAMES.TABS}>
|
|
202
200
|
{tabs.map((tab) => {
|
|
203
201
|
const { label, src } = CODE_BLOCK_TAB_CATALOG[tab.key];
|
|
204
|
-
const selected =
|
|
202
|
+
const selected = tab.key === currentTab?.key;
|
|
205
203
|
|
|
206
204
|
const commonProps = {
|
|
207
205
|
className: clsx(CODE_BLOCK_WITH_TABS_CLASSNAMES.TAB, { selected }),
|
|
@@ -14,6 +14,8 @@ import { Link } from '../link.js';
|
|
|
14
14
|
import { Text } from '../text/index.js';
|
|
15
15
|
import { cleanMarkdown, slugifyHeadingChildren } from './utils.js';
|
|
16
16
|
|
|
17
|
+
export const useShowTableOfContents = (markdown: string | null | undefined) => useMemo(() => markdown && !!markdown.match(/^(#{1,3})\s.+$/m), [markdown]);
|
|
18
|
+
|
|
17
19
|
const TOC_HEADING_ID = 'Contents';
|
|
18
20
|
|
|
19
21
|
const StyledTOCLink = styled(Text)`
|