@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
|
@@ -17,14 +17,22 @@ export const SyntaxHighlighterBaseStylesWrapper = styled(Box)<SyntaxHighlighterB
|
|
|
17
17
|
overflow: hidden;
|
|
18
18
|
|
|
19
19
|
width: 100%;
|
|
20
|
-
${({ $fullWidth }) =>
|
|
21
|
-
|
|
20
|
+
${({ $fullWidth }) =>
|
|
21
|
+
!$fullWidth &&
|
|
22
|
+
css`
|
|
23
|
+
max-width: 860px;
|
|
24
|
+
`}
|
|
25
|
+
${({ $fullHeight }) =>
|
|
26
|
+
!$fullHeight &&
|
|
27
|
+
css`
|
|
28
|
+
max-height: 600px;
|
|
29
|
+
`}
|
|
22
30
|
|
|
23
31
|
background-color: transparent;
|
|
24
32
|
position: relative;
|
|
25
33
|
`;
|
|
26
34
|
|
|
27
|
-
export const CodeBlockWrapper = styled(SyntaxHighlighterBaseStylesWrapper)
|
|
35
|
+
export const CodeBlockWrapper = styled(SyntaxHighlighterBaseStylesWrapper)<{
|
|
28
36
|
$hasHeader: boolean;
|
|
29
37
|
$gradientRotation?: number;
|
|
30
38
|
$highlightLines?: number[];
|
|
@@ -33,7 +41,7 @@ export const CodeBlockWrapper = styled(SyntaxHighlighterBaseStylesWrapper) <{
|
|
|
33
41
|
$fullWidth?: boolean;
|
|
34
42
|
$showLineNumbers?: boolean;
|
|
35
43
|
$fullHeight?: boolean;
|
|
36
|
-
size?: SharedTextSize
|
|
44
|
+
size?: SharedTextSize;
|
|
37
45
|
}>`
|
|
38
46
|
position: relative;
|
|
39
47
|
display: flex;
|
|
@@ -91,7 +99,6 @@ export const CodeBlockWrapper = styled(SyntaxHighlighterBaseStylesWrapper) <{
|
|
|
91
99
|
overflow: hidden;
|
|
92
100
|
}
|
|
93
101
|
|
|
94
|
-
|
|
95
102
|
&.selected {
|
|
96
103
|
color: ${theme.color.neutral.text};
|
|
97
104
|
border: 1px solid ${theme.color.neutral.border};
|
|
@@ -124,31 +131,31 @@ export const CodeBlockWrapper = styled(SyntaxHighlighterBaseStylesWrapper) <{
|
|
|
124
131
|
}
|
|
125
132
|
}
|
|
126
133
|
|
|
127
|
-
|
|
128
134
|
.CodeBlock-TopRightActionsWrapper {
|
|
129
135
|
position: absolute;
|
|
130
136
|
top: 0;
|
|
131
137
|
right: 0;
|
|
132
|
-
${({ $hasHeader }) =>
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
138
|
+
${({ $hasHeader }) =>
|
|
139
|
+
$hasHeader
|
|
140
|
+
? css`
|
|
141
|
+
padding-top: 6px;
|
|
142
|
+
padding-right: ${theme.space.space8};
|
|
143
|
+
`
|
|
144
|
+
: css`
|
|
145
|
+
padding-top: ${theme.space.space16};
|
|
146
|
+
padding-right: ${theme.space.space16};
|
|
147
|
+
`}
|
|
139
148
|
|
|
140
149
|
display: flex;
|
|
141
150
|
gap: ${theme.space.space8};
|
|
142
151
|
z-index: 3;
|
|
143
152
|
height: 3.9rem;
|
|
144
153
|
|
|
145
|
-
${({ $hasHeader }) =>
|
|
154
|
+
${({ $hasHeader }) =>
|
|
155
|
+
$hasHeader &&
|
|
156
|
+
css`
|
|
146
157
|
padding-left: ${theme.space.space32};
|
|
147
|
-
background: linear-gradient(
|
|
148
|
-
to right,
|
|
149
|
-
transparent,
|
|
150
|
-
${theme.color.neutral.backgroundSubtle} 20px
|
|
151
|
-
);
|
|
158
|
+
background: linear-gradient(to right, transparent, ${theme.color.neutral.backgroundSubtle} 20px);
|
|
152
159
|
`}
|
|
153
160
|
}
|
|
154
161
|
|
|
@@ -31,7 +31,19 @@ type HeaderProps = {
|
|
|
31
31
|
showBashHeader?: boolean;
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
const LANGUAGES_WITHOUT_LINE_NUMBERS = [
|
|
34
|
+
const LANGUAGES_WITHOUT_LINE_NUMBERS = [
|
|
35
|
+
'json',
|
|
36
|
+
'jsonp',
|
|
37
|
+
'jsonp',
|
|
38
|
+
'rss',
|
|
39
|
+
'yaml',
|
|
40
|
+
'xml',
|
|
41
|
+
'html',
|
|
42
|
+
'bash',
|
|
43
|
+
'text',
|
|
44
|
+
'dockerfile',
|
|
45
|
+
'http',
|
|
46
|
+
];
|
|
35
47
|
|
|
36
48
|
const HeaderDots = () => {
|
|
37
49
|
return (
|
|
@@ -43,15 +55,9 @@ const HeaderDots = () => {
|
|
|
43
55
|
);
|
|
44
56
|
};
|
|
45
57
|
|
|
46
|
-
const Header = ({
|
|
47
|
-
tabs,
|
|
48
|
-
currentTab,
|
|
49
|
-
showBashHeader,
|
|
50
|
-
onTabChange,
|
|
51
|
-
title,
|
|
52
|
-
}: HeaderProps) => {
|
|
58
|
+
const Header = ({ tabs, currentTab, showBashHeader, onTabChange, title }: HeaderProps) => {
|
|
53
59
|
return (
|
|
54
|
-
<div className="CodeBlock-Header">
|
|
60
|
+
<div className="CodeBlock-Header" data-test="code-block-header">
|
|
55
61
|
{showBashHeader && <HeaderDots />}
|
|
56
62
|
{title && (
|
|
57
63
|
<Text weight="bold" className="CodeBlock-HeaderTitle">
|
|
@@ -63,14 +69,13 @@ const Header = ({
|
|
|
63
69
|
const selected = tab.key === currentTab?.key;
|
|
64
70
|
const props = {
|
|
65
71
|
className: clsx('CodeBlock-Tab', { selected }),
|
|
72
|
+
'data-test': `code-block-tab-${tab.key}`,
|
|
66
73
|
onClick: (e: React.MouseEvent) => onTabChange(tab, e),
|
|
67
74
|
title: tab.label,
|
|
68
75
|
id: tab.id ?? tab.key,
|
|
69
76
|
};
|
|
70
77
|
|
|
71
|
-
const label = <Text weight={tab.key === currentTab?.key ? 'bold' : 'normal'}>
|
|
72
|
-
{tab.label}
|
|
73
|
-
</Text>;
|
|
78
|
+
const label = <Text weight={tab.key === currentTab?.key ? 'bold' : 'normal'}>{tab.label}</Text>;
|
|
74
79
|
|
|
75
80
|
if (tab.to) {
|
|
76
81
|
return (
|
|
@@ -136,15 +141,13 @@ export const CodeBlock = ({
|
|
|
136
141
|
...rest
|
|
137
142
|
}: CodeBlockProps) => {
|
|
138
143
|
const isMultiTab = content instanceof Array;
|
|
139
|
-
const defaultTab = isMultiTab
|
|
140
|
-
? content.find((tab) => tab.key === defaultTabKey) ?? content[0]
|
|
141
|
-
: null;
|
|
144
|
+
const defaultTab = isMultiTab ? (content.find((tab) => tab.key === defaultTabKey) ?? content[0]) : null;
|
|
142
145
|
const [currentTab, setCurrentTab] = useState<CodeTab | null>(defaultTab);
|
|
143
146
|
const currentCode = (isMultiTab ? currentTab?.code : content)?.trim() ?? '';
|
|
144
147
|
const currentLanguage = language ?? currentTab?.language;
|
|
145
148
|
|
|
146
149
|
const currentHighlightLines = useMemo(
|
|
147
|
-
() => (isMultiTab ? currentTab?.highlightLines ?? [] : highlightLines),
|
|
150
|
+
() => (isMultiTab ? (currentTab?.highlightLines ?? []) : highlightLines),
|
|
148
151
|
[isMultiTab, currentTab, highlightLines],
|
|
149
152
|
);
|
|
150
153
|
|
|
@@ -210,16 +213,15 @@ export const CodeBlock = ({
|
|
|
210
213
|
/>
|
|
211
214
|
|
|
212
215
|
<div className="CodeBlock-TopRightActionsWrapper">
|
|
213
|
-
{showActionButton &&
|
|
216
|
+
{showActionButton && (
|
|
217
|
+
<ActionButton successStyle onClick={onActionButtonClick}>
|
|
218
|
+
{actionButtonLabel ?? 'Run on Apify'}
|
|
219
|
+
</ActionButton>
|
|
220
|
+
)}
|
|
214
221
|
{!hideCopyButton && <CopyButton code={currentCode} />}
|
|
215
222
|
</div>
|
|
216
223
|
|
|
217
|
-
{showGradient &&
|
|
218
|
-
|
|
219
|
-
className="CodeBlock-Gradient"
|
|
220
|
-
blurSize={69}
|
|
221
|
-
/>
|
|
222
|
-
)}
|
|
223
|
-
</CodeBlockWrapper >
|
|
224
|
+
{showGradient && <ColorWheelGradient className="CodeBlock-Gradient" blurSize={69} />}
|
|
225
|
+
</CodeBlockWrapper>
|
|
224
226
|
);
|
|
225
227
|
};
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { useMemo, useState } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
} from '../../../design_system/theme.js';
|
|
7
|
-
import {
|
|
8
|
-
type CodeBlockTabKey,
|
|
9
|
-
CodeBlockWithTabs, type CodeBlockWithTabsProps,
|
|
10
|
-
} from './code_block_with_tabs.js';
|
|
4
|
+
import { theme } from '../../../design_system/theme.js';
|
|
5
|
+
import { type CodeBlockTabKey, CodeBlockWithTabs, type CodeBlockWithTabsProps } from './code_block_with_tabs.js';
|
|
11
6
|
|
|
12
7
|
export default {
|
|
13
8
|
title: 'UI-Library/Code/CodeBlockWithTabs',
|
|
@@ -34,18 +29,18 @@ const Container = styled.div`
|
|
|
34
29
|
|
|
35
30
|
export const Default = ({ tabs, ...args }: Omit<CodeBlockWithTabsProps, 'currentTabKey'>) => {
|
|
36
31
|
const [currentTabKey, setCurrentTabKey] = useState(tabs[0]?.key);
|
|
37
|
-
const extendedTabs = useMemo(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
const extendedTabs = useMemo(
|
|
33
|
+
() =>
|
|
34
|
+
tabs.map((tab) => ({
|
|
35
|
+
...tab,
|
|
36
|
+
onClick: () => setCurrentTabKey(tab.key),
|
|
37
|
+
})),
|
|
38
|
+
[tabs],
|
|
39
|
+
);
|
|
41
40
|
|
|
42
41
|
return (
|
|
43
42
|
<Container>
|
|
44
|
-
<CodeBlockWithTabs
|
|
45
|
-
currentTabKey={currentTabKey as CodeBlockTabKey}
|
|
46
|
-
tabs={extendedTabs}
|
|
47
|
-
{...args}
|
|
48
|
-
/>
|
|
43
|
+
<CodeBlockWithTabs currentTabKey={currentTabKey as CodeBlockTabKey} tabs={extendedTabs} {...args} />
|
|
49
44
|
</Container>
|
|
50
45
|
);
|
|
51
46
|
};
|
|
@@ -74,8 +69,7 @@ console.log(c);`,
|
|
|
74
69
|
const a: number = 1;
|
|
75
70
|
const b: number = 2;
|
|
76
71
|
const c: number = a + b;
|
|
77
|
-
console.log(c)
|
|
78
|
-
,
|
|
72
|
+
console.log(c);`,
|
|
79
73
|
},
|
|
80
74
|
],
|
|
81
75
|
};
|
|
@@ -64,7 +64,10 @@ export const CODE_BLOCK_TAB_CATALOG: Record<CodeBlockTabKey, CodeBlockTabConfig>
|
|
|
64
64
|
|
|
65
65
|
type SharedBoxProps = Omit<RegularBoxProps, 'as' | 'children' | 'onClick'> & MarginSpacingProps;
|
|
66
66
|
|
|
67
|
-
type SharedCodeBlockProps = Omit<
|
|
67
|
+
type SharedCodeBlockProps = Omit<
|
|
68
|
+
CodeBlockProps,
|
|
69
|
+
'bashCommandsStart' | 'content' | 'language' | 'defaultTabKey' | 'onTabChange'
|
|
70
|
+
>;
|
|
68
71
|
type SharedLinkProps = Pick<RegularLinkProps, 'to' | 'rel' | 'target'>;
|
|
69
72
|
|
|
70
73
|
export type CodeBlockTabProps = {
|
|
@@ -105,7 +108,7 @@ const CodeBlockWithTabsWrapper = styled(Box)`
|
|
|
105
108
|
border-top-left-radius: ${theme.radius.radius12};
|
|
106
109
|
position: relative;
|
|
107
110
|
|
|
108
|
-
& > [role=
|
|
111
|
+
& > [role='tabpanel'] {
|
|
109
112
|
position: sticky;
|
|
110
113
|
right: 0;
|
|
111
114
|
top: 0;
|
|
@@ -117,7 +120,11 @@ const CodeBlockWithTabsWrapper = styled(Box)`
|
|
|
117
120
|
right: -${theme.space.space8};
|
|
118
121
|
height: 100%;
|
|
119
122
|
width: ${theme.space.space16};
|
|
120
|
-
background: linear-gradient(
|
|
123
|
+
background: linear-gradient(
|
|
124
|
+
90deg,
|
|
125
|
+
rgba(255, 255, 255, 0) 0%,
|
|
126
|
+
${theme.color.neutral.backgroundSubtle} 100%
|
|
127
|
+
);
|
|
121
128
|
content: ' ';
|
|
122
129
|
pointer-events: none;
|
|
123
130
|
position: absolute;
|
|
@@ -130,7 +137,7 @@ const CodeBlockWithTabsWrapper = styled(Box)`
|
|
|
130
137
|
gap: ${theme.space.space24};
|
|
131
138
|
padding-inline: ${theme.space.space24};
|
|
132
139
|
|
|
133
|
-
& > [role=
|
|
140
|
+
& > [role='tabpanel'] {
|
|
134
141
|
margin-left: unset;
|
|
135
142
|
|
|
136
143
|
&::after {
|
|
@@ -159,7 +166,7 @@ const CodeBlockWithTabsWrapper = styled(Box)`
|
|
|
159
166
|
height: 20px;
|
|
160
167
|
}
|
|
161
168
|
|
|
162
|
-
[role=
|
|
169
|
+
[role='tabpanel'] {
|
|
163
170
|
bottom: 0;
|
|
164
171
|
width: 100%;
|
|
165
172
|
height: 2px;
|
|
@@ -174,7 +181,7 @@ const CodeBlockWithTabsWrapper = styled(Box)`
|
|
|
174
181
|
&.selected {
|
|
175
182
|
color: ${theme.color.neutral.text};
|
|
176
183
|
|
|
177
|
-
[role=
|
|
184
|
+
[role='tabpanel'] {
|
|
178
185
|
display: block;
|
|
179
186
|
}
|
|
180
187
|
}
|
|
@@ -197,7 +204,14 @@ const IMG_RESIZE = {
|
|
|
197
204
|
height: 20,
|
|
198
205
|
};
|
|
199
206
|
|
|
200
|
-
export const CodeBlockWithTabs = ({
|
|
207
|
+
export const CodeBlockWithTabs = ({
|
|
208
|
+
className,
|
|
209
|
+
codeBlockProps,
|
|
210
|
+
currentTabKey,
|
|
211
|
+
tabs,
|
|
212
|
+
optimisticCurrentTabKey,
|
|
213
|
+
...props
|
|
214
|
+
}: CodeBlockWithTabsProps) => {
|
|
201
215
|
const { generateProxyImageUrl } = useSharedUiDependencies();
|
|
202
216
|
const currentTab = tabs.find((tab) => tab.key === currentTabKey) ?? tabs[0];
|
|
203
217
|
|
|
@@ -215,10 +229,14 @@ export const CodeBlockWithTabs = ({ className, codeBlockProps, currentTabKey, ta
|
|
|
215
229
|
};
|
|
216
230
|
const children = (
|
|
217
231
|
<>
|
|
218
|
-
{Icon
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
232
|
+
{Icon ? (
|
|
233
|
+
<Icon size="20" />
|
|
234
|
+
) : (
|
|
235
|
+
<img
|
|
236
|
+
src={src && (generateProxyImageUrl?.(src, { resize: IMG_RESIZE }) ?? src)}
|
|
237
|
+
alt={label}
|
|
238
|
+
/>
|
|
239
|
+
)}
|
|
222
240
|
<HeadingShared type="titleS" as="p">
|
|
223
241
|
{label}
|
|
224
242
|
</HeadingShared>
|
|
@@ -236,11 +254,7 @@ export const CodeBlockWithTabs = ({ className, codeBlockProps, currentTabKey, ta
|
|
|
236
254
|
}
|
|
237
255
|
|
|
238
256
|
return (
|
|
239
|
-
<div
|
|
240
|
-
{...commonProps}
|
|
241
|
-
role="button"
|
|
242
|
-
key={tab.key}
|
|
243
|
-
>
|
|
257
|
+
<div {...commonProps} role="button" key={tab.key}>
|
|
244
258
|
{children}
|
|
245
259
|
</div>
|
|
246
260
|
);
|
|
@@ -7,10 +7,7 @@ import { CodeHighlighterLineBashPrefix, CodeHighlighterLinePrefix } from '../pri
|
|
|
7
7
|
// returns string indicating what type of line it is (bashStartCommand, bashCommand, bashEmptyLine)
|
|
8
8
|
// commands start -> bashStartCommand
|
|
9
9
|
// every next line after command start until next command start or empty line -> bashCommand
|
|
10
|
-
export const getBashLinePrefixes = (
|
|
11
|
-
code: string,
|
|
12
|
-
bashCommandsStart: number[] = [],
|
|
13
|
-
isOneLine?: boolean) => {
|
|
10
|
+
export const getBashLinePrefixes = (code: string, bashCommandsStart: number[] = [], isOneLine?: boolean) => {
|
|
14
11
|
const lines = code.split('\n').map((line) => line.trim());
|
|
15
12
|
|
|
16
13
|
const bashLinePrefixesArray = lines.map((line, i) => {
|
|
@@ -21,7 +18,13 @@ export const getBashLinePrefixes = (
|
|
|
21
18
|
return isEmptyLine ? (
|
|
22
19
|
<CodeHighlighterLineBashPrefix $isOneLine={isOneLine} key={`code-highlighter-line-bash-prefix-${i}`} />
|
|
23
20
|
) : (
|
|
24
|
-
<CodeHighlighterLineBashPrefix
|
|
21
|
+
<CodeHighlighterLineBashPrefix
|
|
22
|
+
$isOneLine={isOneLine}
|
|
23
|
+
color={theme.color.lavender.base}
|
|
24
|
+
key={`code-highlighter-line-bash-prefix-${i}`}
|
|
25
|
+
>
|
|
26
|
+
$
|
|
27
|
+
</CodeHighlighterLineBashPrefix>
|
|
25
28
|
);
|
|
26
29
|
}
|
|
27
30
|
|
|
@@ -31,16 +34,15 @@ export const getBashLinePrefixes = (
|
|
|
31
34
|
$isOneLine={isOneLine}
|
|
32
35
|
color={theme.color.lavender.base}
|
|
33
36
|
key={`code-highlighter-line-bash-prefix-${i}`}
|
|
34
|
-
|
|
37
|
+
>
|
|
38
|
+
$
|
|
39
|
+
</CodeHighlighterLineBashPrefix>
|
|
35
40
|
);
|
|
36
41
|
}
|
|
37
42
|
|
|
38
43
|
if (isEmptyLine) {
|
|
39
44
|
return (
|
|
40
|
-
<CodeHighlighterLineBashPrefix
|
|
41
|
-
$isOneLine={isOneLine}
|
|
42
|
-
key={`code-highlighter-line-bash-prefix-${i}`}
|
|
43
|
-
/>
|
|
45
|
+
<CodeHighlighterLineBashPrefix $isOneLine={isOneLine} key={`code-highlighter-line-bash-prefix-${i}`} />
|
|
44
46
|
);
|
|
45
47
|
}
|
|
46
48
|
|
|
@@ -49,7 +51,9 @@ export const getBashLinePrefixes = (
|
|
|
49
51
|
$isOneLine={isOneLine}
|
|
50
52
|
color={theme.color.lavender.base}
|
|
51
53
|
key={`code-highlighter-line-bash-prefix-${i}`}
|
|
52
|
-
|
|
54
|
+
>
|
|
55
|
+
<
|
|
56
|
+
</CodeHighlighterLineBashPrefix>
|
|
53
57
|
);
|
|
54
58
|
});
|
|
55
59
|
|
|
@@ -60,8 +64,12 @@ export const getNumberLinePrefixes = (code: string): Record<number, ReactNode> =
|
|
|
60
64
|
const numberOfLines = code.split('\n').length;
|
|
61
65
|
const numbersArray = Array.from({ length: numberOfLines }, (_, i) => i + 1);
|
|
62
66
|
|
|
63
|
-
return Object.fromEntries(
|
|
64
|
-
number
|
|
65
|
-
|
|
66
|
-
|
|
67
|
+
return Object.fromEntries(
|
|
68
|
+
numbersArray.map((number) => [
|
|
69
|
+
number,
|
|
70
|
+
<CodeHighlighterLinePrefix key={`code-highlighter-line-prefix-${number}`}>
|
|
71
|
+
{number}
|
|
72
|
+
</CodeHighlighterLinePrefix>,
|
|
73
|
+
]),
|
|
74
|
+
);
|
|
67
75
|
};
|
|
@@ -43,13 +43,15 @@ type Story = StoryObj<InlineCodeProps>;
|
|
|
43
43
|
*/
|
|
44
44
|
export const AllVariants: Story = {
|
|
45
45
|
render: () => (
|
|
46
|
-
<div
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
<div
|
|
47
|
+
style={{
|
|
48
|
+
display: 'grid',
|
|
49
|
+
gridTemplateColumns: 'repeat(auto-fit, minmax(300px, 1fr))',
|
|
50
|
+
gap: '24px',
|
|
51
|
+
padding: '24px',
|
|
52
|
+
maxWidth: '1200px',
|
|
53
|
+
}}
|
|
54
|
+
>
|
|
53
55
|
{/* Size variants without copy button */}
|
|
54
56
|
<div style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}>
|
|
55
57
|
<h3 style={{ margin: '0 0 8px 0', fontSize: '16px', fontWeight: '600' }}>Size Variants</h3>
|
|
@@ -72,15 +74,21 @@ export const AllVariants: Story = {
|
|
|
72
74
|
<h3 style={{ margin: '0 0 8px 0', fontSize: '16px', fontWeight: '600' }}>With Copy Button</h3>
|
|
73
75
|
<div>
|
|
74
76
|
<p style={{ margin: '0 0 4px 0', fontSize: '14px', color: '#666' }}>Small</p>
|
|
75
|
-
<InlineCode size="small" withCopyButton>
|
|
77
|
+
<InlineCode size="small" withCopyButton>
|
|
78
|
+
npm install @apify/ui-library
|
|
79
|
+
</InlineCode>
|
|
76
80
|
</div>
|
|
77
81
|
<div>
|
|
78
82
|
<p style={{ margin: '0 0 4px 0', fontSize: '14px', color: '#666' }}>Regular</p>
|
|
79
|
-
<InlineCode size="regular" withCopyButton>
|
|
83
|
+
<InlineCode size="regular" withCopyButton>
|
|
84
|
+
npm install @apify/ui-library
|
|
85
|
+
</InlineCode>
|
|
80
86
|
</div>
|
|
81
87
|
<div>
|
|
82
88
|
<p style={{ margin: '0 0 4px 0', fontSize: '14px', color: '#666' }}>Big</p>
|
|
83
|
-
<InlineCode size="big" withCopyButton>
|
|
89
|
+
<InlineCode size="big" withCopyButton>
|
|
90
|
+
npm install @apify/ui-library
|
|
91
|
+
</InlineCode>
|
|
84
92
|
</div>
|
|
85
93
|
</div>
|
|
86
94
|
</div>
|
|
@@ -27,9 +27,11 @@ const CopyButtonWrapper = styled.div`
|
|
|
27
27
|
|
|
28
28
|
const CopyButton: React.FC<{ text: string }> = ({ text }) => {
|
|
29
29
|
const { isCopied, copyToClipboard } = useCopyToClipboard();
|
|
30
|
-
return
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
return (
|
|
31
|
+
<CopyButtonWrapper role="button" onClick={async () => copyToClipboard(text)} title="Copy to clipboard">
|
|
32
|
+
{isCopied ? <CheckIcon size="16" /> : <CopyIcon size="16" />}
|
|
33
|
+
</CopyButtonWrapper>
|
|
34
|
+
);
|
|
33
35
|
};
|
|
34
36
|
|
|
35
37
|
const Wrapper = styled.span`
|
|
@@ -39,24 +41,17 @@ const Wrapper = styled.span`
|
|
|
39
41
|
`;
|
|
40
42
|
|
|
41
43
|
export type InlineCodeProps = RegularBoxProps & {
|
|
42
|
-
children: React.ReactNode
|
|
43
|
-
size?: SharedTextSize
|
|
44
|
-
withCopyButton?: boolean
|
|
44
|
+
children: React.ReactNode;
|
|
45
|
+
size?: SharedTextSize;
|
|
46
|
+
withCopyButton?: boolean;
|
|
45
47
|
};
|
|
46
48
|
|
|
47
49
|
// This might be just a Chip component
|
|
48
|
-
export const InlineCode: React.FC<InlineCodeProps> = ({
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
as="code"
|
|
57
|
-
size={size}
|
|
58
|
-
>
|
|
59
|
-
{children}
|
|
60
|
-
{withCopyButton && <CopyButton text={children?.toString() ?? ''} />}
|
|
61
|
-
</Text>
|
|
62
|
-
</Wrapper>;
|
|
50
|
+
export const InlineCode: React.FC<InlineCodeProps> = ({ children, size, withCopyButton, ...props }) => (
|
|
51
|
+
<Wrapper {...props}>
|
|
52
|
+
<Text type="code" as="code" size={size}>
|
|
53
|
+
{children}
|
|
54
|
+
{withCopyButton && <CopyButton text={children?.toString() ?? ''} />}
|
|
55
|
+
</Text>
|
|
56
|
+
</Wrapper>
|
|
57
|
+
);
|
|
@@ -19,14 +19,7 @@ export const oneLightTheme: PrismTheme = {
|
|
|
19
19
|
},
|
|
20
20
|
},
|
|
21
21
|
{
|
|
22
|
-
types: [
|
|
23
|
-
'attr-name',
|
|
24
|
-
'class-name',
|
|
25
|
-
'boolean',
|
|
26
|
-
'constant',
|
|
27
|
-
'number',
|
|
28
|
-
'atrule',
|
|
29
|
-
],
|
|
22
|
+
types: ['attr-name', 'class-name', 'boolean', 'constant', 'number', 'atrule'],
|
|
30
23
|
style: {
|
|
31
24
|
color: 'hsl(35, 99%, 36%)',
|
|
32
25
|
},
|
|
@@ -51,15 +44,7 @@ export const oneLightTheme: PrismTheme = {
|
|
|
51
44
|
},
|
|
52
45
|
},
|
|
53
46
|
{
|
|
54
|
-
types: [
|
|
55
|
-
'selector',
|
|
56
|
-
'string',
|
|
57
|
-
'char',
|
|
58
|
-
'builtin',
|
|
59
|
-
'inserted',
|
|
60
|
-
'regex',
|
|
61
|
-
'attr-value',
|
|
62
|
-
],
|
|
47
|
+
types: ['selector', 'string', 'char', 'builtin', 'inserted', 'regex', 'attr-value'],
|
|
63
48
|
style: {
|
|
64
49
|
color: 'hsl(119, 34%, 47%)',
|
|
65
50
|
},
|
|
@@ -76,13 +76,15 @@ type Story = StoryObj<OneLineCodeProps>;
|
|
|
76
76
|
*/
|
|
77
77
|
export const AllVariants: Story = {
|
|
78
78
|
render: () => (
|
|
79
|
-
<div
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
79
|
+
<div
|
|
80
|
+
style={{
|
|
81
|
+
display: 'flex',
|
|
82
|
+
flexDirection: 'column',
|
|
83
|
+
padding: '24px',
|
|
84
|
+
gap: '24px',
|
|
85
|
+
maxWidth: '1200px',
|
|
86
|
+
}}
|
|
87
|
+
>
|
|
86
88
|
{/* Basic examples */}
|
|
87
89
|
<div style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}>
|
|
88
90
|
<h3 style={{ margin: '0 0 8px 0', fontSize: '16px', fontWeight: '600' }}>Basic Examples</h3>
|
|
@@ -105,19 +107,27 @@ export const AllVariants: Story = {
|
|
|
105
107
|
<h3 style={{ margin: '0 0 8px 0', fontSize: '16px', fontWeight: '600' }}>HTTP Methods</h3>
|
|
106
108
|
<div>
|
|
107
109
|
<p style={{ margin: '0 0 4px 0', fontSize: '14px', color: '#666' }}>GET</p>
|
|
108
|
-
<OneLineCode language="http" httpMethod="GET">
|
|
110
|
+
<OneLineCode language="http" httpMethod="GET">
|
|
111
|
+
https://api.example.com/users
|
|
112
|
+
</OneLineCode>
|
|
109
113
|
</div>
|
|
110
114
|
<div>
|
|
111
115
|
<p style={{ margin: '0 0 4px 0', fontSize: '14px', color: '#666' }}>POST</p>
|
|
112
|
-
<OneLineCode language="http" httpMethod="POST">
|
|
116
|
+
<OneLineCode language="http" httpMethod="POST">
|
|
117
|
+
https://api.example.com/users
|
|
118
|
+
</OneLineCode>
|
|
113
119
|
</div>
|
|
114
120
|
<div>
|
|
115
121
|
<p style={{ margin: '0 0 4px 0', fontSize: '14px', color: '#666' }}>PUT</p>
|
|
116
|
-
<OneLineCode language="http" httpMethod="PUT">
|
|
122
|
+
<OneLineCode language="http" httpMethod="PUT">
|
|
123
|
+
https://api.example.com/users/123
|
|
124
|
+
</OneLineCode>
|
|
117
125
|
</div>
|
|
118
126
|
<div>
|
|
119
127
|
<p style={{ margin: '0 0 4px 0', fontSize: '14px', color: '#666' }}>DELETE</p>
|
|
120
|
-
<OneLineCode language="http" httpMethod="DELETE">
|
|
128
|
+
<OneLineCode language="http" httpMethod="DELETE">
|
|
129
|
+
https://api.example.com/users/123
|
|
130
|
+
</OneLineCode>
|
|
121
131
|
</div>
|
|
122
132
|
</div>
|
|
123
133
|
|
|
@@ -136,11 +146,7 @@ export const AllVariants: Story = {
|
|
|
136
146
|
</div>
|
|
137
147
|
<div>
|
|
138
148
|
<p style={{ margin: '0 0 4px 0', fontSize: '14px', color: '#666' }}>With Secret</p>
|
|
139
|
-
<OneLineCode
|
|
140
|
-
language="http"
|
|
141
|
-
secret="VERY_SECRET_TOKEN"
|
|
142
|
-
httpMethod="GET"
|
|
143
|
-
>
|
|
149
|
+
<OneLineCode language="http" secret="VERY_SECRET_TOKEN" httpMethod="GET">
|
|
144
150
|
https://api.example.com?token=***
|
|
145
151
|
</OneLineCode>
|
|
146
152
|
</div>
|
|
@@ -157,15 +163,21 @@ export const AllVariants: Story = {
|
|
|
157
163
|
<h3 style={{ margin: '0 0 8px 0', fontSize: '16px', fontWeight: '600' }}>Size Variants</h3>
|
|
158
164
|
<div>
|
|
159
165
|
<p style={{ margin: '0 0 4px 0', fontSize: '14px', color: '#666' }}>Small</p>
|
|
160
|
-
<OneLineCode language="javascript" size="small">
|
|
166
|
+
<OneLineCode language="javascript" size="small">
|
|
167
|
+
const foo = 'bar';
|
|
168
|
+
</OneLineCode>
|
|
161
169
|
</div>
|
|
162
170
|
<div>
|
|
163
171
|
<p style={{ margin: '0 0 4px 0', fontSize: '14px', color: '#666' }}>Regular</p>
|
|
164
|
-
<OneLineCode language="javascript" size="regular">
|
|
172
|
+
<OneLineCode language="javascript" size="regular">
|
|
173
|
+
const foo = 'bar';
|
|
174
|
+
</OneLineCode>
|
|
165
175
|
</div>
|
|
166
176
|
<div>
|
|
167
177
|
<p style={{ margin: '0 0 4px 0', fontSize: '14px', color: '#666' }}>Big</p>
|
|
168
|
-
<OneLineCode language="javascript" size="big">
|
|
178
|
+
<OneLineCode language="javascript" size="big">
|
|
179
|
+
const foo = 'bar';
|
|
180
|
+
</OneLineCode>
|
|
169
181
|
</div>
|
|
170
182
|
</div>
|
|
171
183
|
</div>
|