@apify/ui-library 1.138.0 → 1.138.1
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/README.md +3 -3
- package/dist/src/components/action_link.d.ts.map +1 -1
- package/dist/src/components/action_link.js +3 -3
- package/dist/src/components/action_link.js.map +1 -1
- package/dist/src/components/actor_template_card.d.ts.map +1 -1
- package/dist/src/components/actor_template_card.js +3 -3
- package/dist/src/components/actor_template_card.js.map +1 -1
- package/dist/src/components/avatar/actor_avatar.d.ts.map +1 -1
- package/dist/src/components/avatar/actor_avatar.js +3 -3
- package/dist/src/components/avatar/actor_avatar.js.map +1 -1
- package/dist/src/components/avatar/boring_avatar.d.ts.map +1 -1
- package/dist/src/components/avatar/boring_avatar.js +8 -7
- package/dist/src/components/avatar/boring_avatar.js.map +1 -1
- package/dist/src/components/avatar/user_avatar.d.ts.map +1 -1
- package/dist/src/components/avatar/user_avatar.js +1 -1
- package/dist/src/components/avatar/user_avatar.js.map +1 -1
- package/dist/src/components/badge.d.ts.map +1 -1
- package/dist/src/components/badge.js +10 -3
- package/dist/src/components/badge.js.map +1 -1
- package/dist/src/components/banner.d.ts.map +1 -1
- package/dist/src/components/banner.js +4 -3
- package/dist/src/components/banner.js.map +1 -1
- package/dist/src/components/blog_article.d.ts.map +1 -1
- package/dist/src/components/blog_article.js +2 -3
- package/dist/src/components/blog_article.js.map +1 -1
- package/dist/src/components/box.d.ts.map +1 -1
- package/dist/src/components/box.js +32 -24
- package/dist/src/components/box.js.map +1 -1
- package/dist/src/components/breadcrumb/breadcrumb.d.ts.map +1 -1
- package/dist/src/components/breadcrumb/breadcrumb.js +1 -1
- package/dist/src/components/breadcrumb/breadcrumb.js.map +1 -1
- package/dist/src/components/button.d.ts.map +1 -1
- package/dist/src/components/button.js +12 -9
- package/dist/src/components/button.js.map +1 -1
- package/dist/src/components/card_container.d.ts.map +1 -1
- package/dist/src/components/card_container.js +5 -3
- package/dist/src/components/card_container.js.map +1 -1
- package/dist/src/components/checkbox/checkbox.d.ts.map +1 -1
- package/dist/src/components/checkbox/checkbox.js +1 -1
- package/dist/src/components/checkbox/checkbox.js.map +1 -1
- package/dist/src/components/checkbox/checkbox.style.d.ts.map +1 -1
- package/dist/src/components/checkbox/checkbox.style.js +7 -4
- package/dist/src/components/checkbox/checkbox.style.js.map +1 -1
- package/dist/src/components/chip.d.ts.map +1 -1
- package/dist/src/components/chip.js +1 -1
- package/dist/src/components/chip.js.map +1 -1
- package/dist/src/components/code/action_button.d.ts.map +1 -1
- package/dist/src/components/code/action_button.js +5 -5
- package/dist/src/components/code/action_button.js.map +1 -1
- package/dist/src/components/code/code_block/code_block.d.ts.map +1 -1
- package/dist/src/components/code/code_block/code_block.js +19 -8
- package/dist/src/components/code/code_block/code_block.js.map +1 -1
- package/dist/src/components/code/code_block/code_block.styled.d.ts.map +1 -1
- package/dist/src/components/code/code_block/code_block.styled.js +18 -15
- package/dist/src/components/code/code_block/code_block.styled.js.map +1 -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 +10 -8
- package/dist/src/components/code/code_block/code_block_with_tabs.js.map +1 -1
- package/dist/src/components/code/code_block/utils.d.ts.map +1 -1
- package/dist/src/components/code/code_block/utils.js.map +1 -1
- package/dist/src/components/code/inline_code/inline_code.d.ts.map +1 -1
- package/dist/src/components/code/inline_code/inline_code.js +2 -2
- package/dist/src/components/code/inline_code/inline_code.js.map +1 -1
- package/dist/src/components/code/one_light_theme.d.ts.map +1 -1
- package/dist/src/components/code/one_light_theme.js +2 -17
- package/dist/src/components/code/one_light_theme.js.map +1 -1
- package/dist/src/components/code/one_line_code/one_line_code.d.ts.map +1 -1
- package/dist/src/components/code/one_line_code/one_line_code.js +11 -14
- package/dist/src/components/code/one_line_code/one_line_code.js.map +1 -1
- package/dist/src/components/code/prism_highlighter.d.ts.map +1 -1
- package/dist/src/components/code/prism_highlighter.js +35 -27
- package/dist/src/components/code/prism_highlighter.js.map +1 -1
- package/dist/src/components/code/prism_python.js.map +1 -1
- package/dist/src/components/collapsible_card/collapsible_card.d.ts.map +1 -1
- package/dist/src/components/collapsible_card/collapsible_card.js +7 -6
- package/dist/src/components/collapsible_card/collapsible_card.js.map +1 -1
- package/dist/src/components/color_wheel_gradient.d.ts.map +1 -1
- package/dist/src/components/color_wheel_gradient.js +4 -2
- package/dist/src/components/color_wheel_gradient.js.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/floating_component_base.js +3 -5
- package/dist/src/components/floating/floating_component_base.js.map +1 -1
- package/dist/src/components/floating/menu.d.ts.map +1 -1
- package/dist/src/components/floating/menu.js +11 -5
- package/dist/src/components/floating/menu.js.map +1 -1
- package/dist/src/components/floating/menu_common.d.ts +4 -4
- package/dist/src/components/floating/menu_common.d.ts.map +1 -1
- package/dist/src/components/floating/menu_common.js +1 -1
- package/dist/src/components/floating/menu_common.js.map +1 -1
- package/dist/src/components/floating/menu_components.d.ts.map +1 -1
- package/dist/src/components/floating/menu_components.js +9 -7
- package/dist/src/components/floating/menu_components.js.map +1 -1
- package/dist/src/components/floating/tooltip.d.ts +2 -2
- package/dist/src/components/floating/tooltip.d.ts.map +1 -1
- package/dist/src/components/floating/tooltip.js +10 -9
- package/dist/src/components/floating/tooltip.js.map +1 -1
- package/dist/src/components/floating/tooltip_content.d.ts.map +1 -1
- package/dist/src/components/floating/tooltip_content.js +3 -3
- package/dist/src/components/floating/tooltip_content.js.map +1 -1
- package/dist/src/components/icon_button.d.ts.map +1 -1
- package/dist/src/components/icon_button.js +10 -8
- package/dist/src/components/icon_button.js.map +1 -1
- package/dist/src/components/image.d.ts.map +1 -1
- package/dist/src/components/image.js +1 -1
- package/dist/src/components/image.js.map +1 -1
- package/dist/src/components/link.d.ts.map +1 -1
- package/dist/src/components/link.js +5 -5
- package/dist/src/components/link.js.map +1 -1
- package/dist/src/components/message.d.ts.map +1 -1
- package/dist/src/components/message.js +21 -21
- package/dist/src/components/message.js.map +1 -1
- package/dist/src/components/rating.d.ts.map +1 -1
- package/dist/src/components/rating.js +5 -6
- package/dist/src/components/rating.js.map +1 -1
- package/dist/src/components/readme_renderer/pythonize_value.d.ts.map +1 -1
- package/dist/src/components/readme_renderer/pythonize_value.js +10 -6
- package/dist/src/components/readme_renderer/pythonize_value.js.map +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 +16 -15
- package/dist/src/components/readme_renderer/table_of_contents.js.map +1 -1
- package/dist/src/components/readme_renderer/utils.d.ts.map +1 -1
- package/dist/src/components/readme_renderer/utils.js +6 -6
- package/dist/src/components/readme_renderer/utils.js.map +1 -1
- package/dist/src/components/select/select.d.ts.map +1 -1
- package/dist/src/components/select/select.js +14 -13
- package/dist/src/components/select/select.js.map +1 -1
- package/dist/src/components/shortcut.d.ts +1 -1
- package/dist/src/components/shortcut.d.ts.map +1 -1
- package/dist/src/components/shortcut.js +2 -2
- package/dist/src/components/shortcut.js.map +1 -1
- package/dist/src/components/simple_markdown/simple_markdown.d.ts.map +1 -1
- package/dist/src/components/simple_markdown/simple_markdown.js +32 -35
- package/dist/src/components/simple_markdown/simple_markdown.js.map +1 -1
- package/dist/src/components/simple_markdown/simple_markdown_components.d.ts.map +1 -1
- package/dist/src/components/simple_markdown/simple_markdown_components.js +26 -12
- package/dist/src/components/simple_markdown/simple_markdown_components.js.map +1 -1
- package/dist/src/components/spinner.d.ts.map +1 -1
- package/dist/src/components/spinner.js +3 -1
- package/dist/src/components/spinner.js.map +1 -1
- package/dist/src/components/store/store_actor_header.d.ts.map +1 -1
- package/dist/src/components/store/store_actor_header.js +1 -1
- package/dist/src/components/store/store_actor_header.js.map +1 -1
- package/dist/src/components/switch/switch.d.ts.map +1 -1
- package/dist/src/components/switch/switch.js +1 -1
- package/dist/src/components/switch/switch.js.map +1 -1
- package/dist/src/components/switch/switch.style.d.ts.map +1 -1
- package/dist/src/components/switch/switch.style.js +5 -3
- package/dist/src/components/switch/switch.style.js.map +1 -1
- package/dist/src/components/table/table.styled.js +3 -3
- package/dist/src/components/table/table.styled.js.map +1 -1
- package/dist/src/components/table/table_error_row.d.ts.map +1 -1
- package/dist/src/components/table/table_error_row.js +1 -1
- package/dist/src/components/table/table_error_row.js.map +1 -1
- package/dist/src/components/table/table_row.d.ts.map +1 -1
- package/dist/src/components/table/table_row.js +1 -1
- package/dist/src/components/table/table_row.js.map +1 -1
- package/dist/src/components/table/table_wrapper.d.ts.map +1 -1
- package/dist/src/components/table/table_wrapper.js +3 -3
- package/dist/src/components/table/table_wrapper.js.map +1 -1
- package/dist/src/components/tabs/tab.d.ts.map +1 -1
- package/dist/src/components/tabs/tab.js +7 -5
- package/dist/src/components/tabs/tab.js.map +1 -1
- package/dist/src/components/tabs/tabs.d.ts.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 +1 -1
- package/dist/src/components/tag.d.ts.map +1 -1
- package/dist/src/components/tag.js +1 -1
- package/dist/src/components/tag.js.map +1 -1
- package/dist/src/components/text/heading_content.d.ts.map +1 -1
- package/dist/src/components/text/heading_content.js +1 -1
- package/dist/src/components/text/heading_content.js.map +1 -1
- package/dist/src/components/text/heading_marketing.d.ts.map +1 -1
- package/dist/src/components/text/heading_marketing.js +1 -1
- package/dist/src/components/text/heading_marketing.js.map +1 -1
- package/dist/src/components/text/heading_shared.d.ts.map +1 -1
- package/dist/src/components/text/heading_shared.js +1 -1
- package/dist/src/components/text/heading_shared.js.map +1 -1
- package/dist/src/components/text/index.d.ts +1 -1
- package/dist/src/components/text/index.d.ts.map +1 -1
- package/dist/src/components/text/text_base.d.ts.map +1 -1
- package/dist/src/components/text/text_base.js +16 -12
- package/dist/src/components/text/text_base.js.map +1 -1
- package/dist/src/components/text/text_content.d.ts.map +1 -1
- package/dist/src/components/text/text_content.js +1 -1
- package/dist/src/components/text/text_content.js.map +1 -1
- package/dist/src/components/text/text_marketing.d.ts.map +1 -1
- package/dist/src/components/text/text_marketing.js +1 -1
- package/dist/src/components/text/text_marketing.js.map +1 -1
- package/dist/src/components/text/text_shared.d.ts +1 -1
- package/dist/src/components/text/text_shared.d.ts.map +1 -1
- package/dist/src/components/text/text_shared.js +1 -1
- package/dist/src/components/text/text_shared.js.map +1 -1
- package/dist/src/components/tile/horizontal_tile.d.ts.map +1 -1
- package/dist/src/components/tile/horizontal_tile.js +3 -2
- package/dist/src/components/tile/horizontal_tile.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/tile/vertical_tile.d.ts.map +1 -1
- package/dist/src/components/tile/vertical_tile.js +3 -2
- package/dist/src/components/tile/vertical_tile.js.map +1 -1
- package/dist/src/components/to_consolidate/card.d.ts.map +1 -1
- package/dist/src/components/to_consolidate/card.js +20 -15
- package/dist/src/components/to_consolidate/card.js.map +1 -1
- package/dist/src/components/to_consolidate/markdown.d.ts.map +1 -1
- package/dist/src/components/to_consolidate/markdown.js +36 -20
- package/dist/src/components/to_consolidate/markdown.js.map +1 -1
- package/dist/src/components/to_consolidate/pagination.d.ts.map +1 -1
- package/dist/src/components/to_consolidate/pagination.js +6 -6
- package/dist/src/components/to_consolidate/pagination.js.map +1 -1
- package/dist/src/components/to_consolidate/tab_number_chip.d.ts.map +1 -1
- package/dist/src/components/to_consolidate/tab_number_chip.js +1 -1
- package/dist/src/components/to_consolidate/tab_number_chip.js.map +1 -1
- package/dist/src/design_system/theme.d.ts.map +1 -1
- package/dist/src/design_system/theme.js +1 -1
- package/dist/src/design_system/theme.js.map +1 -1
- package/dist/src/design_system/typography_theme.d.ts.map +1 -1
- package/dist/src/design_system/typography_theme.js.map +1 -1
- package/dist/src/ui_dependency_provider.d.ts.map +1 -1
- package/dist/src/ui_dependency_provider.js +2 -2
- package/dist/src/ui_dependency_provider.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +8 -6
- package/src/codemods/generate_typograpy_tokens_files.mjs +23 -28
- package/src/components/action_link.tsx +13 -23
- package/src/components/actor_template_card.stories.tsx +20 -14
- package/src/components/actor_template_card.tsx +4 -21
- package/src/components/avatar/actor_avatar.tsx +3 -4
- package/src/components/avatar/boring_avatar.tsx +134 -167
- package/src/components/avatar/user_avatar.stories.tsx +1 -5
- package/src/components/avatar/user_avatar.tsx +6 -20
- package/src/components/badge.stories.jsx +26 -40
- package/src/components/badge.tsx +37 -26
- package/src/components/banner.stories.tsx +10 -28
- package/src/components/banner.tsx +11 -14
- package/src/components/blog_article.tsx +6 -4
- package/src/components/box.tsx +90 -89
- package/src/components/breadcrumb/breadcrumb.stories.tsx +2 -8
- package/src/components/breadcrumb/breadcrumb.tsx +7 -5
- package/src/components/button.stories.tsx +70 -66
- package/src/components/button.tsx +33 -39
- package/src/components/card_container.stories.tsx +28 -29
- package/src/components/card_container.tsx +15 -10
- package/src/components/checkbox/checkbox.stories.tsx +52 -17
- package/src/components/checkbox/checkbox.style.ts +7 -4
- package/src/components/checkbox/checkbox.tsx +6 -9
- package/src/components/chip.stories.tsx +15 -5
- package/src/components/chip.tsx +26 -16
- package/src/components/code/action_button.tsx +10 -12
- package/src/components/code/code_block/code_block.stories.jsx +7 -25
- package/src/components/code/code_block/code_block.styled.tsx +26 -19
- package/src/components/code/code_block/code_block.tsx +26 -24
- package/src/components/code/code_block/code_block_with_tabs.stories.tsx +12 -18
- package/src/components/code/code_block/code_block_with_tabs.tsx +30 -16
- package/src/components/code/code_block/utils.tsx +23 -15
- package/src/components/code/inline_code/inline_code.stories.tsx +18 -10
- package/src/components/code/inline_code/inline_code.tsx +16 -21
- package/src/components/code/one_light_theme.ts +2 -17
- package/src/components/code/one_line_code/one_line_code.stories.tsx +31 -19
- package/src/components/code/one_line_code/one_line_code.tsx +19 -30
- package/src/components/code/prism_highlighter.tsx +117 -109
- package/src/components/code/prism_python.ts +4 -2
- package/src/components/collapsible_card/collapsible_card.stories.tsx +2 -1
- package/src/components/collapsible_card/collapsible_card.tsx +30 -15
- package/src/components/color_wheel_gradient.tsx +9 -7
- package/src/components/floating/floating_component_base.tsx +16 -9
- package/src/components/floating/menu.tsx +37 -46
- package/src/components/floating/menu_common.tsx +24 -30
- package/src/components/floating/menu_components.tsx +24 -24
- package/src/components/floating/tooltip.stories.jsx +85 -68
- package/src/components/floating/tooltip.tsx +32 -39
- package/src/components/floating/tooltip_content.tsx +8 -16
- package/src/components/icon_button.stories.tsx +176 -188
- package/src/components/icon_button.tsx +72 -58
- package/src/components/image.tsx +5 -11
- package/src/components/link.stories.tsx +4 -2
- package/src/components/link.tsx +70 -70
- package/src/components/message.stories.jsx +35 -33
- package/src/components/message.tsx +45 -45
- package/src/components/rating.tsx +37 -44
- package/src/components/readme_renderer/pythonize_value.ts +19 -7
- package/src/components/readme_renderer/table_of_contents.stories.tsx +40 -15
- package/src/components/readme_renderer/table_of_contents.tsx +87 -85
- package/src/components/readme_renderer/utils.tsx +17 -13
- package/src/components/select/select.stories.tsx +19 -46
- package/src/components/select/select.tsx +103 -101
- package/src/components/shortcut.stories.jsx +23 -14
- package/src/components/shortcut.tsx +2 -13
- package/src/components/simple_markdown/simple_markdown.stories.tsx +5 -10
- package/src/components/simple_markdown/simple_markdown.tsx +152 -55
- package/src/components/simple_markdown/simple_markdown_components.tsx +49 -59
- package/src/components/spinner.stories.tsx +14 -8
- package/src/components/spinner.tsx +5 -3
- package/src/components/store/store_actor_header.stories.tsx +2 -11
- package/src/components/store/store_actor_header.tsx +20 -16
- package/src/components/switch/switch.stories.jsx +4 -12
- package/src/components/switch/switch.style.ts +5 -3
- package/src/components/switch/switch.tsx +3 -13
- package/src/components/table/table.stories.tsx +5 -2
- package/src/components/table/table.styled.ts +3 -3
- package/src/components/table/table_error_row.tsx +5 -1
- package/src/components/table/table_row.tsx +1 -5
- package/src/components/table/table_wrapper.tsx +12 -12
- package/src/components/tabs/tab.stories.tsx +1 -5
- package/src/components/tabs/tab.tsx +33 -13
- package/src/components/tabs/tabs.tsx +14 -18
- package/src/components/tag.stories.jsx +35 -45
- package/src/components/tag.tsx +18 -22
- package/src/components/text/heading_content.stories.tsx +13 -24
- package/src/components/text/heading_content.tsx +3 -7
- package/src/components/text/heading_marketing.stories.tsx +4 -3
- package/src/components/text/heading_marketing.tsx +12 -8
- package/src/components/text/heading_shared.stories.tsx +3 -2
- package/src/components/text/heading_shared.tsx +3 -7
- package/src/components/text/index.ts +1 -3
- package/src/components/text/text_base.tsx +29 -35
- package/src/components/text/text_content.stories.tsx +17 -13
- package/src/components/text/text_content.tsx +20 -23
- package/src/components/text/text_marketing.stories.tsx +4 -3
- package/src/components/text/text_marketing.tsx +20 -23
- package/src/components/text/text_shared.stories.tsx +4 -3
- package/src/components/text/text_shared.tsx +23 -27
- package/src/components/tile/horizontal_tile.stories.tsx +6 -2
- package/src/components/tile/horizontal_tile.tsx +5 -15
- package/src/components/tile/shared.ts +5 -5
- package/src/components/tile/vertical_tile.stories.tsx +10 -18
- package/src/components/tile/vertical_tile.tsx +4 -9
- package/src/components/to_consolidate/card.stories.tsx +3 -1
- package/src/components/to_consolidate/card.tsx +67 -58
- package/src/components/to_consolidate/markdown.tsx +76 -62
- package/src/components/to_consolidate/pagination.tsx +11 -15
- package/src/components/to_consolidate/tab_number_chip.tsx +5 -6
- package/src/design_system/colors/build_color_tokens.js +7 -15
- package/src/design_system/theme.ts +1 -8
- package/src/design_system/tokens/radiuses.stories.tsx +9 -1
- package/src/design_system/tokens/shadows.stories.tsx +3 -1
- package/src/design_system/typography_theme.ts +78 -39
- package/src/ui_dependency_provider.tsx +16 -23
|
@@ -34,7 +34,9 @@ const StoryWrapper = styled.div`
|
|
|
34
34
|
const ContentArea = styled.div`
|
|
35
35
|
padding: 2rem;
|
|
36
36
|
|
|
37
|
-
h1,
|
|
37
|
+
h1,
|
|
38
|
+
h2,
|
|
39
|
+
h3 {
|
|
38
40
|
margin-top: 3rem;
|
|
39
41
|
margin-bottom: 1rem;
|
|
40
42
|
}
|
|
@@ -285,7 +287,9 @@ export const Default: Story = {
|
|
|
285
287
|
<TOCContainer>
|
|
286
288
|
<TableOfContents {...args} />
|
|
287
289
|
</TOCContainer>
|
|
288
|
-
<ContentArea
|
|
290
|
+
<ContentArea
|
|
291
|
+
dangerouslySetInnerHTML={{
|
|
292
|
+
__html: `
|
|
289
293
|
<h1 id="getting-started">Getting Started</h1>
|
|
290
294
|
<p>This is the introduction section with some content.</p>
|
|
291
295
|
|
|
@@ -312,7 +316,9 @@ export const Default: Story = {
|
|
|
312
316
|
|
|
313
317
|
<h2 id="api-reference">API Reference</h2>
|
|
314
318
|
<p>Details about the API.</p>
|
|
315
|
-
|
|
319
|
+
`,
|
|
320
|
+
}}
|
|
321
|
+
/>
|
|
316
322
|
</StoryWrapper>
|
|
317
323
|
),
|
|
318
324
|
};
|
|
@@ -329,7 +335,9 @@ export const WithoutH1Heading: Story = {
|
|
|
329
335
|
<TOCContainer>
|
|
330
336
|
<TableOfContents {...args} />
|
|
331
337
|
</TOCContainer>
|
|
332
|
-
<ContentArea
|
|
338
|
+
<ContentArea
|
|
339
|
+
dangerouslySetInnerHTML={{
|
|
340
|
+
__html: `
|
|
333
341
|
<h2 id="overview">Overview</h2>
|
|
334
342
|
<p>This document starts with H2 headings.</p>
|
|
335
343
|
|
|
@@ -350,7 +358,9 @@ export const WithoutH1Heading: Story = {
|
|
|
350
358
|
|
|
351
359
|
<h3 id="steps">Steps</h3>
|
|
352
360
|
<p>Installation steps.</p>
|
|
353
|
-
|
|
361
|
+
`,
|
|
362
|
+
}}
|
|
363
|
+
/>
|
|
354
364
|
</StoryWrapper>
|
|
355
365
|
),
|
|
356
366
|
};
|
|
@@ -369,8 +379,8 @@ export const ManySection: Story = {
|
|
|
369
379
|
</TOCContainer>
|
|
370
380
|
<ContentArea>
|
|
371
381
|
<p style={{ marginBottom: '2rem' }}>
|
|
372
|
-
Scroll down to see the table of contents highlighting different sections.
|
|
373
|
-
|
|
382
|
+
Scroll down to see the table of contents highlighting different sections. The TOC stays sticky while
|
|
383
|
+
scrolling through content.
|
|
374
384
|
</p>
|
|
375
385
|
{Array.from({ length: 7 }, (_, i) => (
|
|
376
386
|
<div key={i}>
|
|
@@ -378,10 +388,17 @@ export const ManySection: Story = {
|
|
|
378
388
|
<p>Content for section {i + 1}.</p>
|
|
379
389
|
{Array.from({ length: 3 }, (__, j) => (
|
|
380
390
|
<div key={j}>
|
|
381
|
-
<h3 id={`subsection-${i + 1}-${j + 1}`}>
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
<p>
|
|
391
|
+
<h3 id={`subsection-${i + 1}-${j + 1}`}>
|
|
392
|
+
Subsection {i + 1}.{j + 1}
|
|
393
|
+
</h3>
|
|
394
|
+
<p>
|
|
395
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor
|
|
396
|
+
incididunt ut labore et dolore magna aliqua.
|
|
397
|
+
</p>
|
|
398
|
+
<p>
|
|
399
|
+
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
|
|
400
|
+
ex ea commodo consequat.
|
|
401
|
+
</p>
|
|
385
402
|
</div>
|
|
386
403
|
))}
|
|
387
404
|
</div>
|
|
@@ -403,7 +420,9 @@ export const WithCodeInHeadings: Story = {
|
|
|
403
420
|
<TOCContainer>
|
|
404
421
|
<TableOfContents {...args} />
|
|
405
422
|
</TOCContainer>
|
|
406
|
-
<ContentArea
|
|
423
|
+
<ContentArea
|
|
424
|
+
dangerouslySetInnerHTML={{
|
|
425
|
+
__html: `
|
|
407
426
|
<h1 id="api-documentation">API Documentation</h1>
|
|
408
427
|
<p>Documentation with code examples in headings.</p>
|
|
409
428
|
|
|
@@ -427,7 +446,9 @@ export const WithCodeInHeadings: Story = {
|
|
|
427
446
|
|
|
428
447
|
<h2 id="usage-examples">Usage Examples</h2>
|
|
429
448
|
<p>How to use the API.</p>
|
|
430
|
-
|
|
449
|
+
`,
|
|
450
|
+
}}
|
|
451
|
+
/>
|
|
431
452
|
</StoryWrapper>
|
|
432
453
|
),
|
|
433
454
|
};
|
|
@@ -444,7 +465,9 @@ export const SimpleFlat: Story = {
|
|
|
444
465
|
<TOCContainer>
|
|
445
466
|
<TableOfContents {...args} />
|
|
446
467
|
</TOCContainer>
|
|
447
|
-
<ContentArea
|
|
468
|
+
<ContentArea
|
|
469
|
+
dangerouslySetInnerHTML={{
|
|
470
|
+
__html: `
|
|
448
471
|
<h1 id="quick-start">Quick Start</h1>
|
|
449
472
|
<p>A simple document.</p>
|
|
450
473
|
|
|
@@ -456,7 +479,9 @@ export const SimpleFlat: Story = {
|
|
|
456
479
|
|
|
457
480
|
<h2 id="step-3">Step 3</h2>
|
|
458
481
|
<p>Third step.</p>
|
|
459
|
-
|
|
482
|
+
`,
|
|
483
|
+
}}
|
|
484
|
+
/>
|
|
460
485
|
</StoryWrapper>
|
|
461
486
|
),
|
|
462
487
|
};
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
|
-
import React, {
|
|
3
|
-
useCallback,
|
|
4
|
-
useMemo,
|
|
5
|
-
} from 'react';
|
|
2
|
+
import React, { useCallback, useMemo } from 'react';
|
|
6
3
|
import ReactMarkdown, { type AllowElement } from 'react-markdown';
|
|
7
4
|
import remarkToc from 'remark-toc';
|
|
8
5
|
import styled from 'styled-components';
|
|
@@ -13,7 +10,8 @@ import { Link } from '../link.js';
|
|
|
13
10
|
import { Text } from '../text/index.js';
|
|
14
11
|
import { cleanMarkdown, slugifyHeadingChildren } from './utils.js';
|
|
15
12
|
|
|
16
|
-
export const useShowTableOfContents = (markdown: string | null | undefined) =>
|
|
13
|
+
export const useShowTableOfContents = (markdown: string | null | undefined) =>
|
|
14
|
+
useMemo(() => markdown && !!markdown.match(/^(#{1,3})\s.+$/m), [markdown]);
|
|
17
15
|
|
|
18
16
|
const TOC_HEADING_ID = 'Contents';
|
|
19
17
|
|
|
@@ -29,12 +27,13 @@ const StyledTOCLink = styled(Text)`
|
|
|
29
27
|
font-weight: inherit !important;
|
|
30
28
|
}
|
|
31
29
|
|
|
32
|
-
&:hover,
|
|
30
|
+
&:hover,
|
|
31
|
+
&.selected {
|
|
33
32
|
color: ${theme.color.primary.text} !important;
|
|
34
33
|
}
|
|
35
34
|
|
|
36
35
|
&:before {
|
|
37
|
-
content:
|
|
36
|
+
content: ' ';
|
|
38
37
|
display: inline-block;
|
|
39
38
|
height: 100%;
|
|
40
39
|
left: 0;
|
|
@@ -71,7 +70,7 @@ const StyledTableOfContents = styled.div`
|
|
|
71
70
|
padding-left: ${theme.space.space16} !important;
|
|
72
71
|
max-height: 0;
|
|
73
72
|
overflow: hidden;
|
|
74
|
-
transition: all .3s ease-in-out;
|
|
73
|
+
transition: all 0.3s ease-in-out;
|
|
75
74
|
|
|
76
75
|
&.expanded {
|
|
77
76
|
max-height: 1000px;
|
|
@@ -92,7 +91,12 @@ interface CustomHTMLAnchorElement extends Omit<HTMLAnchorElement, 'children' | '
|
|
|
92
91
|
parentNode: any;
|
|
93
92
|
}
|
|
94
93
|
|
|
95
|
-
const handleScroll = (
|
|
94
|
+
const handleScroll = (
|
|
95
|
+
anchors: CustomHTMLAnchorElement[],
|
|
96
|
+
headlines: HTMLElement[],
|
|
97
|
+
anchorLists: HTMLUListElement[] | null,
|
|
98
|
+
headingOffsetPx: number,
|
|
99
|
+
) => {
|
|
96
100
|
if (!anchors || !headlines) return;
|
|
97
101
|
|
|
98
102
|
// Items that are past scroll
|
|
@@ -101,7 +105,8 @@ const handleScroll = (anchors: CustomHTMLAnchorElement[], headlines: HTMLElement
|
|
|
101
105
|
});
|
|
102
106
|
|
|
103
107
|
// Last item that is past the scroll is current in view. If no headline is past the scroll, let's select the first one
|
|
104
|
-
const currentHeadlineId =
|
|
108
|
+
const currentHeadlineId =
|
|
109
|
+
headlinesPastScrollPosition[headlinesPastScrollPosition.length - 1]?.id || headlines[0]?.id;
|
|
105
110
|
|
|
106
111
|
// Highlighting anchor of current headline
|
|
107
112
|
if (currentHeadlineId) {
|
|
@@ -121,7 +126,11 @@ const handleScroll = (anchors: CustomHTMLAnchorElement[], headlines: HTMLElement
|
|
|
121
126
|
// by tag and className of neighboring nodes. There are two cases:
|
|
122
127
|
|
|
123
128
|
// 1) If h2 is selected, we want to expand its section with h3 headings
|
|
124
|
-
if (
|
|
129
|
+
if (
|
|
130
|
+
grandparent?.tagName === 'LI' &&
|
|
131
|
+
grandparent.children[1]?.tagName === 'UL' &&
|
|
132
|
+
grandparent.children[1]?.classList.contains('level-3')
|
|
133
|
+
) {
|
|
125
134
|
grandparent.children[1].classList.add('expanded');
|
|
126
135
|
}
|
|
127
136
|
|
|
@@ -141,9 +150,9 @@ const assignHeadingLevelsRecursively = (
|
|
|
141
150
|
properties,
|
|
142
151
|
}: {
|
|
143
152
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
144
|
-
children: any[]
|
|
145
|
-
tagName: string
|
|
146
|
-
properties: { className: string }
|
|
153
|
+
children: any[];
|
|
154
|
+
tagName: string;
|
|
155
|
+
properties: { className: string };
|
|
147
156
|
},
|
|
148
157
|
level: number,
|
|
149
158
|
) => {
|
|
@@ -170,12 +179,7 @@ export interface TableOfContentsProps {
|
|
|
170
179
|
allowElement?: AllowElement;
|
|
171
180
|
}
|
|
172
181
|
|
|
173
|
-
const TableOfContentsComponent = ({
|
|
174
|
-
markdown,
|
|
175
|
-
headingOffsetPx = 10,
|
|
176
|
-
allowElement,
|
|
177
|
-
...rest
|
|
178
|
-
}: TableOfContentsProps) => {
|
|
182
|
+
const TableOfContentsComponent = ({ markdown, headingOffsetPx = 10, allowElement, ...rest }: TableOfContentsProps) => {
|
|
179
183
|
const cleanedMarkdown = useMemo(() => {
|
|
180
184
|
const cleanedMarkdownString = cleanMarkdown(markdown);
|
|
181
185
|
return `### ${TOC_HEADING_ID}\n${cleanedMarkdownString}`;
|
|
@@ -183,23 +187,26 @@ const TableOfContentsComponent = ({
|
|
|
183
187
|
|
|
184
188
|
const hasTopLevelHeading = useMemo(() => !!cleanedMarkdown.match(/^#\s.+$/m), [cleanedMarkdown]);
|
|
185
189
|
|
|
186
|
-
const tocRef = useCallback(
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
190
|
+
const tocRef = useCallback(
|
|
191
|
+
(node: HTMLElement | null) => {
|
|
192
|
+
const anchors = node ? Array.from(node.querySelectorAll('a')) : [];
|
|
193
|
+
const anchorLists = node ? Array.from(node.querySelectorAll('ul')) : null;
|
|
194
|
+
const headlines = anchors
|
|
195
|
+
.map((anchor) => document.getElementById(anchor.hash.substr(1)))
|
|
196
|
+
.filter((headline) => headline !== undefined && headline !== null) as HTMLElement[];
|
|
197
|
+
|
|
198
|
+
const scrollHandler = () => handleScroll(anchors, headlines, anchorLists, headingOffsetPx);
|
|
199
|
+
|
|
200
|
+
// Callback refs cannot return cleanup functions - but they are called again with null on unmount
|
|
201
|
+
if (node) {
|
|
202
|
+
window.addEventListener('scroll', scrollHandler);
|
|
203
|
+
} else {
|
|
204
|
+
window.removeEventListener('scroll', scrollHandler);
|
|
205
|
+
}
|
|
206
|
+
scrollHandler(); // call for the first time so we select the first heading without scrolling
|
|
207
|
+
},
|
|
208
|
+
[headingOffsetPx],
|
|
209
|
+
);
|
|
203
210
|
|
|
204
211
|
return (
|
|
205
212
|
<StyledTableOfContents ref={tocRef} {...rest}>
|
|
@@ -207,65 +214,58 @@ const TableOfContentsComponent = ({
|
|
|
207
214
|
allowElement={allowElement}
|
|
208
215
|
remarkPlugins={[
|
|
209
216
|
[remarkToc, { heading: TOC_HEADING_ID, maxDepth: 3 }],
|
|
210
|
-
() =>
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
tocContentNode,
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
217
|
+
() =>
|
|
218
|
+
({ children, ...nodeRest }) => {
|
|
219
|
+
// TOC plug-ins only inject content table to existing markdown documents - only generating it is not a common use-case
|
|
220
|
+
// To make is happen, we can just take the generated node where toc is located and throw away the rest.
|
|
221
|
+
// children[0] is the heading where toc is placed (that's plug-in's requirement)
|
|
222
|
+
// children[1] is the generated table of contents we can simply pick
|
|
223
|
+
|
|
224
|
+
let tocContentNode = children[1];
|
|
225
|
+
|
|
226
|
+
// If there is no H1 heading in the readme then assignHeadingLevelsRecursively does not work correctly.
|
|
227
|
+
// We need to 'normalize' the final node to have all the levels we expect
|
|
228
|
+
// - solution is to wrap the content in extra node that mimic this H1 group that remarkToc would normally create
|
|
229
|
+
if (!hasTopLevelHeading) {
|
|
230
|
+
tocContentNode = {
|
|
231
|
+
type: 'list',
|
|
232
|
+
ordered: false,
|
|
233
|
+
spread: false,
|
|
234
|
+
children: [
|
|
235
|
+
{
|
|
236
|
+
type: 'listItem',
|
|
237
|
+
spread: true,
|
|
238
|
+
children: [tocContentNode],
|
|
239
|
+
},
|
|
240
|
+
],
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
return {
|
|
245
|
+
...nodeRest,
|
|
246
|
+
children: [tocContentNode],
|
|
235
247
|
};
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
248
|
+
},
|
|
249
|
+
]}
|
|
250
|
+
rehypePlugins={[
|
|
251
|
+
() => (input) => {
|
|
252
|
+
// this plug-in already works with html node representation so we can assign classNames that we need
|
|
253
|
+
// in order to allow hiding blocks with h3 headings that are out of the viewport
|
|
254
|
+
assignHeadingLevelsRecursively(input.children[0], 1);
|
|
255
|
+
return input;
|
|
244
256
|
},
|
|
245
257
|
]}
|
|
246
|
-
rehypePlugins={[() => (input) => {
|
|
247
|
-
// this plug-in already works with html node representation so we can assign classNames that we need
|
|
248
|
-
// in order to allow hiding blocks with h3 headings that are out of the viewport
|
|
249
|
-
assignHeadingLevelsRecursively(input.children[0], 1);
|
|
250
|
-
return input;
|
|
251
|
-
}]}
|
|
252
258
|
components={{
|
|
253
259
|
a: ({ children }) => {
|
|
254
260
|
const { search } = window.location;
|
|
255
261
|
const hash = `#${slugifyHeadingChildren(children)}`;
|
|
256
262
|
return (
|
|
257
|
-
<StyledTOCLink
|
|
258
|
-
forwardedAs={Link}
|
|
259
|
-
to={`${search}${hash}`}
|
|
260
|
-
py={'space4'}
|
|
261
|
-
>
|
|
263
|
+
<StyledTOCLink forwardedAs={Link} to={`${search}${hash}`} py={'space4'}>
|
|
262
264
|
{children}
|
|
263
265
|
</StyledTOCLink>
|
|
264
266
|
);
|
|
265
267
|
},
|
|
266
|
-
code: ({ children }) =>
|
|
267
|
-
<code className="inline-code">{children}</code>
|
|
268
|
-
),
|
|
268
|
+
code: ({ children }) => <code className="inline-code">{children}</code>,
|
|
269
269
|
}}
|
|
270
270
|
>
|
|
271
271
|
{cleanedMarkdown}
|
|
@@ -274,4 +274,6 @@ const TableOfContentsComponent = ({
|
|
|
274
274
|
);
|
|
275
275
|
};
|
|
276
276
|
|
|
277
|
-
export const TableOfContents = React.memo(TableOfContentsComponent, (prevProps, nextProps) =>
|
|
277
|
+
export const TableOfContents = React.memo(TableOfContentsComponent, (prevProps, nextProps) =>
|
|
278
|
+
_.isEqual(prevProps, nextProps),
|
|
279
|
+
);
|
|
@@ -2,9 +2,7 @@ import React, { type ReactElement, type ReactNode, useCallback } from 'react';
|
|
|
2
2
|
import type { AllowElement } from 'react-markdown';
|
|
3
3
|
import slugify from 'slugify';
|
|
4
4
|
|
|
5
|
-
export const slugifyHeadingChildren = (
|
|
6
|
-
headingChildren: React.ReactNode,
|
|
7
|
-
): string | undefined => {
|
|
5
|
+
export const slugifyHeadingChildren = (headingChildren: React.ReactNode): string | undefined => {
|
|
8
6
|
if (!headingChildren) return undefined;
|
|
9
7
|
|
|
10
8
|
const slugs: string[] = [];
|
|
@@ -38,14 +36,20 @@ export const cleanMarkdown = (markdown: string, removeFirstH1?: boolean): string
|
|
|
38
36
|
// This removes the first element if it's a `h1` containing exactly the Actor title
|
|
39
37
|
// Allows undefined `actorTitle` for ease of use.
|
|
40
38
|
export const useActorTitleHeadingFilter = (actorTitle: string | undefined): AllowElement => {
|
|
41
|
-
return useCallback(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
39
|
+
return useCallback(
|
|
40
|
+
(element, index, parent) => {
|
|
41
|
+
if (!actorTitle) return true;
|
|
42
|
+
if (
|
|
43
|
+
parent?.type === 'root' &&
|
|
44
|
+
index === 0 &&
|
|
45
|
+
element.tagName === 'h1' &&
|
|
46
|
+
element.children.length === 1 &&
|
|
47
|
+
element.children[0].type === 'text' &&
|
|
48
|
+
element.children[0].value?.toLowerCase() === actorTitle.toLowerCase()
|
|
49
|
+
)
|
|
50
|
+
return false;
|
|
51
|
+
return true;
|
|
52
|
+
},
|
|
53
|
+
[actorTitle],
|
|
54
|
+
);
|
|
51
55
|
};
|
|
@@ -15,62 +15,35 @@ const Grid = styled.div`
|
|
|
15
15
|
grid-template-columns: repeat(2, auto);
|
|
16
16
|
gap: 1rem 5rem;
|
|
17
17
|
|
|
18
|
-
input{
|
|
18
|
+
input {
|
|
19
19
|
width: 100%;
|
|
20
20
|
}
|
|
21
21
|
`;
|
|
22
22
|
|
|
23
|
-
const options = [
|
|
23
|
+
const options = [
|
|
24
|
+
{ label: 'Ahoj', value: 1 },
|
|
25
|
+
{ label: 'Ondro!', value: 2 },
|
|
26
|
+
{ label: '🚲', value: 3 },
|
|
27
|
+
];
|
|
24
28
|
|
|
25
29
|
export const SelectPrimitive = () => {
|
|
26
30
|
const [multiValue, setMultiValue] = useState([1, 2]);
|
|
27
31
|
const [value, setValue] = useState(1);
|
|
28
32
|
return (
|
|
29
33
|
<Grid>
|
|
30
|
-
<Select options={options} value={value} setValue={setValue}/> <p>singleValue</p>
|
|
31
|
-
<Select isMulti
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
<Select
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
<Select
|
|
43
|
-
disabled
|
|
44
|
-
options={options}
|
|
45
|
-
value={multiValue}
|
|
46
|
-
setValue={setMultiValue}
|
|
47
|
-
/> <p>multiValue disabled</p>
|
|
48
|
-
<Select options={options}
|
|
49
|
-
value={value}
|
|
50
|
-
setValue={setValue}
|
|
51
|
-
indicatorsSlot={<EyeIcon size="16" />}
|
|
52
|
-
/> <p>withIcons</p>
|
|
53
|
-
<Select options={options}
|
|
54
|
-
value={value}
|
|
55
|
-
setValue={setValue}
|
|
56
|
-
disabled={true}
|
|
57
|
-
/> <p>disabled</p>
|
|
58
|
-
<Select options={options}
|
|
59
|
-
value={value}
|
|
60
|
-
setValue={setValue}
|
|
61
|
-
placeholder="Placeholder"
|
|
62
|
-
/> <p>placeholder</p>
|
|
63
|
-
<Select options={options}
|
|
64
|
-
value={value}
|
|
65
|
-
setValue={setValue}
|
|
66
|
-
error={true}
|
|
67
|
-
placeholder='Error select'
|
|
68
|
-
/> <p>error</p>
|
|
69
|
-
<Select options={options}
|
|
70
|
-
value={null}
|
|
71
|
-
setValue={setValue}
|
|
72
|
-
placeholder='Placeholder'
|
|
73
|
-
/> <p>placeholder</p>
|
|
34
|
+
<Select options={options} value={value} setValue={setValue} /> <p>singleValue</p>
|
|
35
|
+
<Select isMulti options={options} value={multiValue} setValue={setMultiValue} /> <p>multiValue</p>
|
|
36
|
+
<Select isMulti error="test Error" options={options} value={multiValue} setValue={setMultiValue} />{' '}
|
|
37
|
+
<p>multiValue error</p>
|
|
38
|
+
<Select isMulti disabled options={options} value={multiValue} setValue={setMultiValue} />{' '}
|
|
39
|
+
<p>multiValue disabled</p>
|
|
40
|
+
<Select options={options} value={value} setValue={setValue} indicatorsSlot={<EyeIcon size="16" />} />{' '}
|
|
41
|
+
<p>withIcons</p>
|
|
42
|
+
<Select options={options} value={value} setValue={setValue} disabled={true} /> <p>disabled</p>
|
|
43
|
+
<Select options={options} value={value} setValue={setValue} placeholder="Placeholder" /> <p>placeholder</p>
|
|
44
|
+
<Select options={options} value={value} setValue={setValue} error={true} placeholder="Error select" />{' '}
|
|
45
|
+
<p>error</p>
|
|
46
|
+
<Select options={options} value={null} setValue={setValue} placeholder="Placeholder" /> <p>placeholder</p>
|
|
74
47
|
</Grid>
|
|
75
48
|
);
|
|
76
49
|
};
|