@apify/ui-library 0.51.6-featurepublishuilibrary-0a4729.38266
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/.eslintrc +39 -0
- package/.stylelintrc +12 -0
- package/CHANGELOG.md +2804 -0
- package/README.md +15 -0
- package/dist/src/components/action_link.d.ts +5 -0
- package/dist/src/components/action_link.d.ts.map +1 -0
- package/dist/src/components/action_link.jsx +35 -0
- package/dist/src/components/action_link.jsx.map +1 -0
- package/dist/src/components/actor_template_card.d.ts +10 -0
- package/dist/src/components/actor_template_card.d.ts.map +1 -0
- package/dist/src/components/actor_template_card.jsx +73 -0
- package/dist/src/components/actor_template_card.jsx.map +1 -0
- package/dist/src/components/badge.d.ts +26 -0
- package/dist/src/components/badge.d.ts.map +1 -0
- package/dist/src/components/badge.jsx +96 -0
- package/dist/src/components/badge.jsx.map +1 -0
- package/dist/src/components/banner.d.ts +11 -0
- package/dist/src/components/banner.d.ts.map +1 -0
- package/dist/src/components/banner.jsx +73 -0
- package/dist/src/components/banner.jsx.map +1 -0
- package/dist/src/components/blog_article.d.ts +9 -0
- package/dist/src/components/blog_article.d.ts.map +1 -0
- package/dist/src/components/blog_article.jsx +73 -0
- package/dist/src/components/blog_article.jsx.map +1 -0
- package/dist/src/components/box.d.ts +41 -0
- package/dist/src/components/box.d.ts.map +1 -0
- package/dist/src/components/box.jsx +48 -0
- package/dist/src/components/box.jsx.map +1 -0
- package/dist/src/components/button.d.ts +35 -0
- package/dist/src/components/button.d.ts.map +1 -0
- package/dist/src/components/button.jsx +193 -0
- package/dist/src/components/button.jsx.map +1 -0
- package/dist/src/components/chip.d.ts +52 -0
- package/dist/src/components/chip.d.ts.map +1 -0
- package/dist/src/components/chip.jsx +89 -0
- package/dist/src/components/chip.jsx.map +1 -0
- package/dist/src/components/code/action_button.d.ts +11 -0
- package/dist/src/components/code/action_button.d.ts.map +1 -0
- package/dist/src/components/code/action_button.jsx +67 -0
- package/dist/src/components/code/action_button.jsx.map +1 -0
- package/dist/src/components/code/code_block/code_block.d.ts +38 -0
- package/dist/src/components/code/code_block/code_block.d.ts.map +1 -0
- package/dist/src/components/code/code_block/code_block.jsx +99 -0
- package/dist/src/components/code/code_block/code_block.jsx.map +1 -0
- package/dist/src/components/code/code_block/code_block.styled.d.ts +13 -0
- package/dist/src/components/code/code_block/code_block.styled.d.ts.map +1 -0
- package/dist/src/components/code/code_block/code_block.styled.jsx +215 -0
- package/dist/src/components/code/code_block/code_block.styled.jsx.map +1 -0
- package/dist/src/components/code/code_block/utils.d.ts +2 -0
- package/dist/src/components/code/code_block/utils.d.ts.map +1 -0
- package/dist/src/components/code/code_block/utils.js +20 -0
- package/dist/src/components/code/code_block/utils.js.map +1 -0
- package/dist/src/components/code/index.d.ts +4 -0
- package/dist/src/components/code/index.d.ts.map +1 -0
- package/dist/src/components/code/index.js +4 -0
- package/dist/src/components/code/index.js.map +1 -0
- package/dist/src/components/code/inline_code/inline_code.d.ts +11 -0
- package/dist/src/components/code/inline_code/inline_code.d.ts.map +1 -0
- package/dist/src/components/code/inline_code/inline_code.jsx +24 -0
- package/dist/src/components/code/inline_code/inline_code.jsx.map +1 -0
- package/dist/src/components/code/one_line_code/one_line_code.d.ts +27 -0
- package/dist/src/components/code/one_line_code/one_line_code.d.ts.map +1 -0
- package/dist/src/components/code/one_line_code/one_line_code.jsx +157 -0
- package/dist/src/components/code/one_line_code/one_line_code.jsx.map +1 -0
- package/dist/src/components/code/syntax_highlighter.d.ts +16 -0
- package/dist/src/components/code/syntax_highlighter.d.ts.map +1 -0
- package/dist/src/components/code/syntax_highlighter.jsx +94 -0
- package/dist/src/components/code/syntax_highlighter.jsx.map +1 -0
- package/dist/src/components/color_wheel_gradient.d.ts +9 -0
- package/dist/src/components/color_wheel_gradient.d.ts.map +1 -0
- package/dist/src/components/color_wheel_gradient.jsx +23 -0
- package/dist/src/components/color_wheel_gradient.jsx.map +1 -0
- package/dist/src/components/floating/index.d.ts +4 -0
- package/dist/src/components/floating/index.d.ts.map +1 -0
- package/dist/src/components/floating/index.js +4 -0
- package/dist/src/components/floating/index.js.map +1 -0
- package/dist/src/components/floating/menu.d.ts +33 -0
- package/dist/src/components/floating/menu.d.ts.map +1 -0
- package/dist/src/components/floating/menu.jsx +95 -0
- package/dist/src/components/floating/menu.jsx.map +1 -0
- package/dist/src/components/floating/menu_common.d.ts +42 -0
- package/dist/src/components/floating/menu_common.d.ts.map +1 -0
- package/dist/src/components/floating/menu_common.jsx +20 -0
- package/dist/src/components/floating/menu_common.jsx.map +1 -0
- package/dist/src/components/floating/menu_components.d.ts +29 -0
- package/dist/src/components/floating/menu_components.d.ts.map +1 -0
- package/dist/src/components/floating/menu_components.jsx +73 -0
- package/dist/src/components/floating/menu_components.jsx.map +1 -0
- package/dist/src/components/image.d.ts +12 -0
- package/dist/src/components/image.d.ts.map +1 -0
- package/dist/src/components/image.jsx +8 -0
- package/dist/src/components/image.jsx.map +1 -0
- package/dist/src/components/index.d.ts +21 -0
- package/dist/src/components/index.d.ts.map +1 -0
- package/dist/src/components/index.js +21 -0
- package/dist/src/components/index.js.map +1 -0
- package/dist/src/components/link.d.ts +24 -0
- package/dist/src/components/link.d.ts.map +1 -0
- package/dist/src/components/link.jsx +67 -0
- package/dist/src/components/link.jsx.map +1 -0
- package/dist/src/components/message.d.ts +31 -0
- package/dist/src/components/message.d.ts.map +1 -0
- package/dist/src/components/message.jsx +105 -0
- package/dist/src/components/message.jsx.map +1 -0
- package/dist/src/components/readme_renderer/index.d.ts +4 -0
- package/dist/src/components/readme_renderer/index.d.ts.map +1 -0
- package/dist/src/components/readme_renderer/index.js +4 -0
- package/dist/src/components/readme_renderer/index.js.map +1 -0
- package/dist/src/components/readme_renderer/pythonize_value.d.ts +3 -0
- package/dist/src/components/readme_renderer/pythonize_value.d.ts.map +1 -0
- package/dist/src/components/readme_renderer/pythonize_value.js +81 -0
- package/dist/src/components/readme_renderer/pythonize_value.js.map +1 -0
- package/dist/src/components/readme_renderer/table_of_contents.d.ts +10 -0
- package/dist/src/components/readme_renderer/table_of_contents.d.ts.map +1 -0
- package/dist/src/components/readme_renderer/table_of_contents.jsx +197 -0
- package/dist/src/components/readme_renderer/table_of_contents.jsx.map +1 -0
- package/dist/src/components/readme_renderer/utils.d.ts +6 -0
- package/dist/src/components/readme_renderer/utils.d.ts.map +1 -0
- package/dist/src/components/readme_renderer/utils.jsx +42 -0
- package/dist/src/components/readme_renderer/utils.jsx.map +1 -0
- package/dist/src/components/simple_markdown/index.d.ts +3 -0
- package/dist/src/components/simple_markdown/index.d.ts.map +1 -0
- package/dist/src/components/simple_markdown/index.jsx +3 -0
- package/dist/src/components/simple_markdown/index.jsx.map +1 -0
- package/dist/src/components/simple_markdown/simple_markdown.d.ts +16 -0
- package/dist/src/components/simple_markdown/simple_markdown.d.ts.map +1 -0
- package/dist/src/components/simple_markdown/simple_markdown.jsx +137 -0
- package/dist/src/components/simple_markdown/simple_markdown.jsx.map +1 -0
- package/dist/src/components/simple_markdown/simple_markdown_components.d.ts +26 -0
- package/dist/src/components/simple_markdown/simple_markdown_components.d.ts.map +1 -0
- package/dist/src/components/simple_markdown/simple_markdown_components.jsx +193 -0
- package/dist/src/components/simple_markdown/simple_markdown_components.jsx.map +1 -0
- package/dist/src/components/tag.d.ts +38 -0
- package/dist/src/components/tag.d.ts.map +1 -0
- package/dist/src/components/tag.jsx +126 -0
- package/dist/src/components/tag.jsx.map +1 -0
- package/dist/src/components/text/heading_content.d.ts +10 -0
- package/dist/src/components/text/heading_content.d.ts.map +1 -0
- package/dist/src/components/text/heading_content.jsx +31 -0
- package/dist/src/components/text/heading_content.jsx.map +1 -0
- package/dist/src/components/text/heading_marketing.d.ts +10 -0
- package/dist/src/components/text/heading_marketing.d.ts.map +1 -0
- package/dist/src/components/text/heading_marketing.jsx +31 -0
- package/dist/src/components/text/heading_marketing.jsx.map +1 -0
- package/dist/src/components/text/heading_shared.d.ts +10 -0
- package/dist/src/components/text/heading_shared.d.ts.map +1 -0
- package/dist/src/components/text/heading_shared.jsx +32 -0
- package/dist/src/components/text/heading_shared.jsx.map +1 -0
- package/dist/src/components/text/index.d.ts +12 -0
- package/dist/src/components/text/index.d.ts.map +1 -0
- package/dist/src/components/text/index.js +11 -0
- package/dist/src/components/text/index.js.map +1 -0
- package/dist/src/components/text/text_base.d.ts +13 -0
- package/dist/src/components/text/text_base.d.ts.map +1 -0
- package/dist/src/components/text/text_base.jsx +23 -0
- package/dist/src/components/text/text_base.jsx.map +1 -0
- package/dist/src/components/text/text_content.d.ts +11 -0
- package/dist/src/components/text/text_content.d.ts.map +1 -0
- package/dist/src/components/text/text_content.jsx +68 -0
- package/dist/src/components/text/text_content.jsx.map +1 -0
- package/dist/src/components/text/text_marketing.d.ts +11 -0
- package/dist/src/components/text/text_marketing.d.ts.map +1 -0
- package/dist/src/components/text/text_marketing.jsx +116 -0
- package/dist/src/components/text/text_marketing.jsx.map +1 -0
- package/dist/src/components/text/text_shared.d.ts +14 -0
- package/dist/src/components/text/text_shared.d.ts.map +1 -0
- package/dist/src/components/text/text_shared.jsx +55 -0
- package/dist/src/components/text/text_shared.jsx.map +1 -0
- package/dist/src/components/tile/horizontal_tile.d.ts +9 -0
- package/dist/src/components/tile/horizontal_tile.d.ts.map +1 -0
- package/dist/src/components/tile/horizontal_tile.jsx +43 -0
- package/dist/src/components/tile/horizontal_tile.jsx.map +1 -0
- package/dist/src/components/tile/index.d.ts +3 -0
- package/dist/src/components/tile/index.d.ts.map +1 -0
- package/dist/src/components/tile/index.js +3 -0
- package/dist/src/components/tile/index.js.map +1 -0
- package/dist/src/components/tile/shared.d.ts +17 -0
- package/dist/src/components/tile/shared.d.ts.map +1 -0
- package/dist/src/components/tile/shared.js +12 -0
- package/dist/src/components/tile/shared.js.map +1 -0
- package/dist/src/components/tile/vertical_tile.d.ts +10 -0
- package/dist/src/components/tile/vertical_tile.d.ts.map +1 -0
- package/dist/src/components/tile/vertical_tile.jsx +32 -0
- package/dist/src/components/tile/vertical_tile.jsx.map +1 -0
- package/dist/src/components/to_consolidate/card.d.ts +27 -0
- package/dist/src/components/to_consolidate/card.d.ts.map +1 -0
- package/dist/src/components/to_consolidate/card.jsx +93 -0
- package/dist/src/components/to_consolidate/card.jsx.map +1 -0
- package/dist/src/components/to_consolidate/index.d.ts +5 -0
- package/dist/src/components/to_consolidate/index.d.ts.map +1 -0
- package/dist/src/components/to_consolidate/index.js +5 -0
- package/dist/src/components/to_consolidate/index.js.map +1 -0
- package/dist/src/components/to_consolidate/markdown.d.ts +40 -0
- package/dist/src/components/to_consolidate/markdown.d.ts.map +1 -0
- package/dist/src/components/to_consolidate/markdown.jsx +454 -0
- package/dist/src/components/to_consolidate/markdown.jsx.map +1 -0
- package/dist/src/components/to_consolidate/pagination.d.ts +8 -0
- package/dist/src/components/to_consolidate/pagination.d.ts.map +1 -0
- package/dist/src/components/to_consolidate/pagination.jsx +88 -0
- package/dist/src/components/to_consolidate/pagination.jsx.map +1 -0
- package/dist/src/components/to_consolidate/tab_number_chip.d.ts +7 -0
- package/dist/src/components/to_consolidate/tab_number_chip.d.ts.map +1 -0
- package/dist/src/components/to_consolidate/tab_number_chip.jsx +22 -0
- package/dist/src/components/to_consolidate/tab_number_chip.jsx.map +1 -0
- package/dist/src/design_system/colors_theme.d.ts +213 -0
- package/dist/src/design_system/colors_theme.d.ts.map +1 -0
- package/dist/src/design_system/colors_theme.js +213 -0
- package/dist/src/design_system/colors_theme.js.map +1 -0
- package/dist/src/design_system/properties_theme.d.ts +175 -0
- package/dist/src/design_system/properties_theme.d.ts.map +1 -0
- package/dist/src/design_system/properties_theme.js +315 -0
- package/dist/src/design_system/properties_theme.js.map +1 -0
- package/dist/src/design_system/theme.d.ts +630 -0
- package/dist/src/design_system/theme.d.ts.map +1 -0
- package/dist/src/design_system/theme.js +17 -0
- package/dist/src/design_system/theme.js.map +1 -0
- package/dist/src/design_system/tokens/index.d.ts +6 -0
- package/dist/src/design_system/tokens/index.d.ts.map +1 -0
- package/dist/src/design_system/tokens/index.js +6 -0
- package/dist/src/design_system/tokens/index.js.map +1 -0
- package/dist/src/design_system/tokens/layouts.d.ts +29 -0
- package/dist/src/design_system/tokens/layouts.d.ts.map +1 -0
- package/dist/src/design_system/tokens/layouts.js +29 -0
- package/dist/src/design_system/tokens/layouts.js.map +1 -0
- package/dist/src/design_system/tokens/radiuses.d.ts +23 -0
- package/dist/src/design_system/tokens/radiuses.d.ts.map +1 -0
- package/dist/src/design_system/tokens/radiuses.js +23 -0
- package/dist/src/design_system/tokens/radiuses.js.map +1 -0
- package/dist/src/design_system/tokens/shadows.d.ts +23 -0
- package/dist/src/design_system/tokens/shadows.d.ts.map +1 -0
- package/dist/src/design_system/tokens/shadows.js +23 -0
- package/dist/src/design_system/tokens/shadows.js.map +1 -0
- package/dist/src/design_system/tokens/spaces.d.ts +15 -0
- package/dist/src/design_system/tokens/spaces.d.ts.map +1 -0
- package/dist/src/design_system/tokens/spaces.js +14 -0
- package/dist/src/design_system/tokens/spaces.js.map +1 -0
- package/dist/src/design_system/tokens/transitions.d.ts +20 -0
- package/dist/src/design_system/tokens/transitions.d.ts.map +1 -0
- package/dist/src/design_system/tokens/transitions.js +20 -0
- package/dist/src/design_system/tokens/transitions.js.map +1 -0
- package/dist/src/design_system/typography_theme.d.ts +189 -0
- package/dist/src/design_system/typography_theme.d.ts.map +1 -0
- package/dist/src/design_system/typography_theme.js +190 -0
- package/dist/src/design_system/typography_theme.js.map +1 -0
- package/dist/src/index.d.ts +7 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +7 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/type_utils.d.ts +6 -0
- package/dist/src/type_utils.d.ts.map +1 -0
- package/dist/src/type_utils.js +2 -0
- package/dist/src/type_utils.js.map +1 -0
- package/dist/src/ui_dependency_provider.d.ts +29 -0
- package/dist/src/ui_dependency_provider.d.ts.map +1 -0
- package/dist/src/ui_dependency_provider.jsx +14 -0
- package/dist/src/ui_dependency_provider.jsx.map +1 -0
- package/dist/src/utils/copy_to_clipboard.d.ts +7 -0
- package/dist/src/utils/copy_to_clipboard.d.ts.map +1 -0
- package/dist/src/utils/copy_to_clipboard.js +16 -0
- package/dist/src/utils/copy_to_clipboard.js.map +1 -0
- package/dist/src/utils/image_color.d.ts +7 -0
- package/dist/src/utils/image_color.d.ts.map +1 -0
- package/dist/src/utils/image_color.js +35 -0
- package/dist/src/utils/image_color.js.map +1 -0
- package/dist/src/utils/index.d.ts +4 -0
- package/dist/src/utils/index.d.ts.map +1 -0
- package/dist/src/utils/index.js +4 -0
- package/dist/src/utils/index.js.map +1 -0
- package/dist/src/utils/sanitization.d.ts +11 -0
- package/dist/src/utils/sanitization.d.ts.map +1 -0
- package/dist/src/utils/sanitization.js +16 -0
- package/dist/src/utils/sanitization.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +71 -0
- package/src/codemods/generate_color_property_tokens.mjs +97 -0
- package/src/codemods/generate_color_theme_files.mjs +46 -0
- package/src/codemods/generate_typograpy_tokens_files.mjs +136 -0
- package/src/components/action_link.tsx +59 -0
- package/src/components/actor_template_card.tsx +99 -0
- package/src/components/badge.tsx +144 -0
- package/src/components/banner.tsx +95 -0
- package/src/components/blog_article.tsx +85 -0
- package/src/components/box.tsx +127 -0
- package/src/components/button.tsx +303 -0
- package/src/components/chip.tsx +121 -0
- package/src/components/code/action_button.tsx +96 -0
- package/src/components/code/code_block/code_block.styled.tsx +228 -0
- package/src/components/code/code_block/code_block.tsx +235 -0
- package/src/components/code/code_block/utils.ts +19 -0
- package/src/components/code/index.ts +3 -0
- package/src/components/code/inline_code/inline_code.tsx +44 -0
- package/src/components/code/one_line_code/one_line_code.tsx +232 -0
- package/src/components/code/syntax_highlighter.tsx +125 -0
- package/src/components/color_wheel_gradient.tsx +31 -0
- package/src/components/floating/index.ts +3 -0
- package/src/components/floating/menu.tsx +191 -0
- package/src/components/floating/menu_common.tsx +31 -0
- package/src/components/floating/menu_components.tsx +94 -0
- package/src/components/image.tsx +23 -0
- package/src/components/index.ts +20 -0
- package/src/components/link.tsx +114 -0
- package/src/components/message.tsx +157 -0
- package/src/components/readme_renderer/index.ts +3 -0
- package/src/components/readme_renderer/pythonize_value.ts +78 -0
- package/src/components/readme_renderer/table_of_contents.tsx +257 -0
- package/src/components/readme_renderer/utils.tsx +46 -0
- package/src/components/simple_markdown/index.tsx +2 -0
- package/src/components/simple_markdown/simple_markdown.tsx +181 -0
- package/src/components/simple_markdown/simple_markdown_components.tsx +295 -0
- package/src/components/tag.tsx +185 -0
- package/src/components/text/heading_content.tsx +56 -0
- package/src/components/text/heading_marketing.tsx +55 -0
- package/src/components/text/heading_shared.tsx +57 -0
- package/src/components/text/index.ts +18 -0
- package/src/components/text/text_base.tsx +52 -0
- package/src/components/text/text_content.tsx +104 -0
- package/src/components/text/text_marketing.tsx +152 -0
- package/src/components/text/text_shared.tsx +96 -0
- package/src/components/tile/horizontal_tile.tsx +76 -0
- package/src/components/tile/index.ts +2 -0
- package/src/components/tile/shared.ts +27 -0
- package/src/components/tile/vertical_tile.tsx +58 -0
- package/src/components/to_consolidate/card.tsx +141 -0
- package/src/components/to_consolidate/index.ts +4 -0
- package/src/components/to_consolidate/markdown.tsx +593 -0
- package/src/components/to_consolidate/pagination.tsx +139 -0
- package/src/components/to_consolidate/tab_number_chip.tsx +31 -0
- package/src/design_system/colors_theme.ts +213 -0
- package/src/design_system/generate_color_definitions.js +43 -0
- package/src/design_system/properties_theme.ts +453 -0
- package/src/design_system/supernova_color_tokens.json +1766 -0
- package/src/design_system/supernova_typography_tokens.json +657 -0
- package/src/design_system/theme.ts +26 -0
- package/src/design_system/tokens/index.ts +5 -0
- package/src/design_system/tokens/layouts.ts +29 -0
- package/src/design_system/tokens/radiuses.ts +22 -0
- package/src/design_system/tokens/shadows.ts +22 -0
- package/src/design_system/tokens/spaces.ts +15 -0
- package/src/design_system/tokens/transitions.ts +19 -0
- package/src/design_system/typography_theme.ts +197 -0
- package/src/index.ts +7 -0
- package/src/type_utils.ts +7 -0
- package/src/ui_dependency_provider.tsx +50 -0
- package/src/utils/copy_to_clipboard.ts +24 -0
- package/src/utils/image_color.ts +44 -0
- package/src/utils/index.ts +3 -0
- package/src/utils/sanitization.ts +14 -0
- package/tsconfig.build.json +18 -0
- package/tsconfig.json +10 -0
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
import { theme } from '../../../design_system/theme';
|
|
3
|
+
import { SyntaxHighlighterBaseStylesWrapper } from '../syntax_highlighter';
|
|
4
|
+
const HIGHLIGHT_BACKGROUND_COLOR = 'rgba(22, 114, 235, 0.05)';
|
|
5
|
+
export const CodeBlockWrapper = styled(SyntaxHighlighterBaseStylesWrapper) `
|
|
6
|
+
position: relative;
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
min-width: 266px;
|
|
10
|
+
|
|
11
|
+
.CodeBlock-Header {
|
|
12
|
+
padding-top: 7px; /* only 7 due to transform translateY(1px) */
|
|
13
|
+
gap: ${theme.space.space4};
|
|
14
|
+
background-color: ${theme.color.neutral.backgroundSubtle};
|
|
15
|
+
border-bottom: 1px solid ${theme.color.neutral.border};
|
|
16
|
+
z-index: 3;
|
|
17
|
+
position: relative;
|
|
18
|
+
display: flex;
|
|
19
|
+
height: 4rem;
|
|
20
|
+
|
|
21
|
+
.CodeBlock-HeaderTitle {
|
|
22
|
+
margin-left: ${theme.space.space16};
|
|
23
|
+
margin-bottom: ${theme.space.space8};
|
|
24
|
+
margin-top: 0.5rem;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.CodeBlock-HeaderTabsWrapper {
|
|
28
|
+
display: flex;
|
|
29
|
+
transform: translateY(1px);
|
|
30
|
+
padding-right: ${theme.space.space32};
|
|
31
|
+
padding-left: ${theme.space.space8};
|
|
32
|
+
overflow-x: auto;
|
|
33
|
+
overflow-y: hidden;
|
|
34
|
+
gap: ${theme.space.space4};
|
|
35
|
+
|
|
36
|
+
margin-right: ${({ $hasActionButton }) => ($hasActionButton ? '128' : '20')}px;
|
|
37
|
+
|
|
38
|
+
.CodeBlock-Tab {
|
|
39
|
+
border-radius: ${theme.radius.radius8};
|
|
40
|
+
background-color: transparent;
|
|
41
|
+
border: 1px solid transparent;
|
|
42
|
+
border-bottom-left-radius: 0;
|
|
43
|
+
border-bottom-right-radius: 0;
|
|
44
|
+
border-bottom: none;
|
|
45
|
+
cursor: pointer;
|
|
46
|
+
height: 3.2rem;
|
|
47
|
+
max-width: 26rem;
|
|
48
|
+
|
|
49
|
+
color: ${theme.color.neutral.textMuted};
|
|
50
|
+
|
|
51
|
+
text-align: center;
|
|
52
|
+
white-space: nowrap;
|
|
53
|
+
|
|
54
|
+
padding: 0.2rem ${theme.space.space8} 0.6rem ${theme.space.space8};
|
|
55
|
+
p {
|
|
56
|
+
padding-top: 0.2rem;
|
|
57
|
+
text-overflow: ellipsis;
|
|
58
|
+
overflow: hidden;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
&.selected {
|
|
63
|
+
color: ${theme.color.neutral.text};
|
|
64
|
+
border: 1px solid ${theme.color.neutral.border};
|
|
65
|
+
background-color: ${theme.color.neutral.backgroundMuted};
|
|
66
|
+
border-bottom: none;
|
|
67
|
+
padding: 0.6rem ${theme.space.space8};
|
|
68
|
+
p {
|
|
69
|
+
padding-top: 0;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&:hover {
|
|
74
|
+
border: 1px solid ${theme.color.neutral.border};
|
|
75
|
+
border-bottom: none;
|
|
76
|
+
text-decoration: none;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&::after {
|
|
80
|
+
/* ensures same width of text when switching tabs and making it bold */
|
|
81
|
+
${theme.typography.shared.tablet.bodyMStrong}
|
|
82
|
+
display: block;
|
|
83
|
+
content: attr(title);
|
|
84
|
+
font-weight: bold;
|
|
85
|
+
height: 0px;
|
|
86
|
+
color: transparent;
|
|
87
|
+
overflow: hidden;
|
|
88
|
+
visibility: hidden;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.CodePre {
|
|
95
|
+
z-index: 2;
|
|
96
|
+
padding: ${theme.space.space16} 0 !important;
|
|
97
|
+
|
|
98
|
+
code {
|
|
99
|
+
& > span {
|
|
100
|
+
display: block;
|
|
101
|
+
padding-left: ${({ $showLineNumbers }) => ($showLineNumbers ? theme.space.space8 : theme.space.space16)};
|
|
102
|
+
padding-right: ${theme.space.space16};
|
|
103
|
+
&:hover {
|
|
104
|
+
background-color: ${HIGHLIGHT_BACKGROUND_COLOR} !important;
|
|
105
|
+
border-left: 6px solid ${theme.color.neutral.border} !important;
|
|
106
|
+
padding-left: ${({ $showLineNumbers }) => ($showLineNumbers ? '0.2' : '1')}rem;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Common styles
|
|
111
|
+
[data*='bash']{
|
|
112
|
+
&::before {
|
|
113
|
+
color: ${theme.color.lavender.base};
|
|
114
|
+
padding-right: ${theme.space.space16};
|
|
115
|
+
min-width: ${theme.space.space24};
|
|
116
|
+
user-select: none;
|
|
117
|
+
-webkit-user-select: none;
|
|
118
|
+
font-size: 1em;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
[data*='bashStartCommand'] {
|
|
123
|
+
&::before {
|
|
124
|
+
content: '$';
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
[data*='bashCommand'] {
|
|
129
|
+
&::before {
|
|
130
|
+
content: '>';
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
[data*='bashEmptyLine'] {
|
|
135
|
+
&::before {
|
|
136
|
+
content: ' ';
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
[data*='highlighted'] {
|
|
141
|
+
background-color: ${HIGHLIGHT_BACKGROUND_COLOR} !important;
|
|
142
|
+
border-left: 6px solid ${theme.color.neutral.border} !important;
|
|
143
|
+
padding-left: ${({ $showLineNumbers }) => ($showLineNumbers ? '0.2' : '1')}rem;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
.linenumber {
|
|
148
|
+
color: ${theme.color.neutral.textSubtle} !important;
|
|
149
|
+
padding-right: ${theme.space.space16} !important;
|
|
150
|
+
min-width: ${theme.space.space24} !important;
|
|
151
|
+
box-sizing: unset !important;
|
|
152
|
+
user-select: none;
|
|
153
|
+
-webkit-user-select: none;
|
|
154
|
+
|
|
155
|
+
${({ $showLineNumbers }) => (!$showLineNumbers && css `display: none !important;`)}
|
|
156
|
+
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.CodeBlock-TopRightActionsWrapper {
|
|
162
|
+
position: absolute;
|
|
163
|
+
top: 0;
|
|
164
|
+
right: 0;
|
|
165
|
+
${({ $hasHeader }) => ($hasHeader
|
|
166
|
+
? css `
|
|
167
|
+
padding-top: 6px;
|
|
168
|
+
padding-right: ${theme.space.space8};`
|
|
169
|
+
: css `
|
|
170
|
+
padding-top: ${theme.space.space16};
|
|
171
|
+
padding-right: ${theme.space.space16};`)}
|
|
172
|
+
|
|
173
|
+
display: flex;
|
|
174
|
+
gap: ${theme.space.space8};
|
|
175
|
+
z-index: 3;
|
|
176
|
+
height: 3.9rem;
|
|
177
|
+
|
|
178
|
+
${({ $hasHeader }) => $hasHeader && css `
|
|
179
|
+
padding-left: ${theme.space.space32};
|
|
180
|
+
background: linear-gradient(
|
|
181
|
+
to right,
|
|
182
|
+
transparent,
|
|
183
|
+
${theme.color.neutral.backgroundSubtle} 20px
|
|
184
|
+
);
|
|
185
|
+
`}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.CodeBlock-Gradient {
|
|
189
|
+
right: 0px;
|
|
190
|
+
bottom: 0px;
|
|
191
|
+
|
|
192
|
+
aspect-ratio: 1/1;
|
|
193
|
+
height: 250%;
|
|
194
|
+
|
|
195
|
+
transform: translate(50%, 70%) rotate(${({ $gradientRotation }) => $gradientRotation ?? 0}deg) scaleX(-1);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.CodeBlock-HederDotsWrapper {
|
|
199
|
+
display: flex;
|
|
200
|
+
padding: ${theme.space.space8};
|
|
201
|
+
align-items: flex-start;
|
|
202
|
+
gap: ${theme.space.space8};
|
|
203
|
+
margin-bottom: 0.5rem;
|
|
204
|
+
margin-left: ${theme.space.space8};
|
|
205
|
+
background: transparent;
|
|
206
|
+
|
|
207
|
+
.CodeBlock-HeaderDot {
|
|
208
|
+
width: 1.2rem;
|
|
209
|
+
height: 1.2rem;
|
|
210
|
+
border-radius: 50%;
|
|
211
|
+
background-color: ${theme.color.neutral.iconSubtle};
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
`;
|
|
215
|
+
//# sourceMappingURL=code_block.styled.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code_block.styled.jsx","sourceRoot":"","sources":["../../../../../src/components/code/code_block/code_block.styled.tsx"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAErD,OAAO,EAAE,kCAAkC,EAAE,MAAM,uBAAuB,CAAC;AAE3E,MAAM,0BAA0B,GAAG,0BAA0B,CAAC;AAE9D,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,kCAAkC,CAAC,CAUxE;;;;;;;;eAQa,KAAK,CAAC,KAAK,CAAC,MAAM;4BACL,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,gBAAgB;mCAC7B,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM;;;;;;;2BAOlC,KAAK,CAAC,KAAK,CAAC,OAAO;6BACjB,KAAK,CAAC,K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AEV,KAAK,CAAC,KAAK,CAAC,MAAM;;;;;;;gCAOT,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU;;;CAG7D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/components/code/code_block/utils.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,mBAAmB,SAAU,MAAM,sBAAqB,MAAM,EAAE,6DAa5E,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// input: [2, 4, 5, 6, 8, 10, 11, 12]
|
|
2
|
+
// returns string indicating what type of line it is (bashStartCommand, bashCommand, bashEmptyLine)
|
|
3
|
+
// commands start -> bashStartCommand
|
|
4
|
+
// every next line after command start until next command start or empty line -> bashCommand
|
|
5
|
+
// empty line or comment -> bashEmptyLine
|
|
6
|
+
export const mapPrefixToBashLine = (code, bashCommandsStart = []) => {
|
|
7
|
+
const lines = code.split('\n').map((line) => line.trim());
|
|
8
|
+
// by default each line that is not empty or comment is a command start
|
|
9
|
+
if (bashCommandsStart.length === 0) {
|
|
10
|
+
return lines.map((line) => ((line.startsWith('#') || !line) ? 'bashEmptyLine' : 'bashStartCommand'));
|
|
11
|
+
}
|
|
12
|
+
return lines.map((line, i) => {
|
|
13
|
+
if (bashCommandsStart.includes(i + 1))
|
|
14
|
+
return 'bashStartCommand';
|
|
15
|
+
if (line.startsWith('#') || !line)
|
|
16
|
+
return 'bashEmptyLine';
|
|
17
|
+
return 'bashCommand';
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../src/components/code/code_block/utils.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,mGAAmG;AACnG,qCAAqC;AACrC,4FAA4F;AAC5F,yCAAyC;AACzC,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,IAAY,EAAE,oBAA8B,EAAE,EAAE,EAAE;IAClF,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IAE1D,uEAAuE;IACvE,IAAI,iBAAiB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACjC,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC;IACzG,CAAC;IAED,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE;QACzB,IAAI,iBAAiB,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC;YAAE,OAAO,kBAAkB,CAAC;QACjE,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI;YAAE,OAAO,eAAe,CAAC;QAC1D,OAAO,aAAa,CAAC;IACzB,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/code/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/code/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { RegularBoxProps } from '../../box';
|
|
3
|
+
import type { SharedTextSize } from '../../text/text_shared';
|
|
4
|
+
export declare const inlineCodeStyles: import("styled-components").FlattenSimpleInterpolation;
|
|
5
|
+
type InlineCodeProps = RegularBoxProps & {
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
size?: SharedTextSize;
|
|
8
|
+
};
|
|
9
|
+
export declare const InlineCode: React.FC<InlineCodeProps>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=inline_code.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inline_code.d.ts","sourceRoot":"","sources":["../../../../../src/components/code/inline_code/inline_code.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAG7D,eAAO,MAAM,gBAAgB,wDAM5B,CAAC;AAQF,KAAK,eAAe,GAAG,eAAe,GAAG;IACrC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,IAAI,CAAC,EAAE,cAAc,CAAC;CACzB,CAAA;AAGD,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAchD,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
|
+
import { theme } from '../../../design_system/theme';
|
|
4
|
+
import { Text } from '../../text';
|
|
5
|
+
// TODO: We should not need to export these once we consolidate Markdown
|
|
6
|
+
export const inlineCodeStyles = css `
|
|
7
|
+
width: fit-content;
|
|
8
|
+
padding: ${theme.space.space2} 0.6rem;
|
|
9
|
+
background-color: ${theme.color.neutral.backgroundMuted};
|
|
10
|
+
border-radius: ${theme.radius.radius8};
|
|
11
|
+
border: 1px solid ${theme.color.neutral.border};
|
|
12
|
+
`;
|
|
13
|
+
const Wrapper = styled.span `
|
|
14
|
+
code {
|
|
15
|
+
${inlineCodeStyles}
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
18
|
+
// This might be just a Chip component
|
|
19
|
+
export const InlineCode = ({ children, size, ...props }) => (<Wrapper {...props}>
|
|
20
|
+
<Text type="code" as="code" size={size}>
|
|
21
|
+
{children}
|
|
22
|
+
</Text>
|
|
23
|
+
</Wrapper>);
|
|
24
|
+
//# sourceMappingURL=inline_code.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inline_code.jsx","sourceRoot":"","sources":["../../../../../src/components/code/inline_code/inline_code.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAErD,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAGlC,wEAAwE;AACxE,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAA;;eAEpB,KAAK,CAAC,KAAK,CAAC,MAAM;wBACT,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe;qBACtC,KAAK,CAAC,MAAM,CAAC,OAAO;wBACjB,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM;CACjD,CAAC;AAEF,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAA;;UAEjB,gBAAgB;;CAEzB,CAAC;AAOF,sCAAsC;AACtC,MAAM,CAAC,MAAM,UAAU,GAA8B,CAAC,EAClD,QAAQ,EACR,IAAI,EACJ,GAAG,KAAK,EACX,EAAE,EAAE,CAAC,CACF,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,CACf;QAAA,CAAC,IAAI,CACD,IAAI,CAAC,MAAM,CACX,EAAE,CAAC,MAAM,CACT,IAAI,CAAC,CAAC,IAAI,CAAC,CAEX;YAAA,CAAC,QAAQ,CACb;QAAA,EAAE,IAAI,CACV;IAAA,EAAE,OAAO,CAAC,CACb,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { BoxProps } from '../../box';
|
|
3
|
+
import type { SharedTextSize } from '../../text/text_shared';
|
|
4
|
+
export declare const oneLineCodeClassNames: {
|
|
5
|
+
gradientWrapper: string;
|
|
6
|
+
scrollableWrapper: string;
|
|
7
|
+
methodChip: string;
|
|
8
|
+
gradient: string;
|
|
9
|
+
buttons: string;
|
|
10
|
+
};
|
|
11
|
+
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'HEAD' | 'PATCH';
|
|
12
|
+
export type OneLineCodeProps = BoxProps & {
|
|
13
|
+
children: string;
|
|
14
|
+
language?: string;
|
|
15
|
+
size?: SharedTextSize;
|
|
16
|
+
httpMethod?: HttpMethod;
|
|
17
|
+
actionButtonLabel?: string;
|
|
18
|
+
onActionButtonClick?: () => Promise<void> | void;
|
|
19
|
+
fullWidth?: boolean;
|
|
20
|
+
secretPlaceholder?: string;
|
|
21
|
+
secret?: string;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
hideCopyButton?: boolean;
|
|
24
|
+
};
|
|
25
|
+
export declare function OneLineCode({ children, language, size, httpMethod, actionButtonLabel, onActionButtonClick, fullWidth, secretPlaceholder, secret, disabled, hideCopyButton, ...rest }: OneLineCodeProps): React.JSX.Element;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=one_line_code.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"one_line_code.d.ts","sourceRoot":"","sources":["../../../../../src/components/code/one_line_code/one_line_code.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAMjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAK7D,eAAO,MAAM,qBAAqB;;;;;;CAMjC,CAAC;AAEF,KAAK,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;AA6HvE,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACjD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAA;AAED,wBAAgB,WAAW,CAAC,EACxB,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EACnB,SAAS,EACT,iBAAyB,EACzB,MAAM,EACN,QAAQ,EACR,cAAc,EACd,GAAG,IAAI,EACV,EAAE,gBAAgB,qBA0DlB"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import React, { useMemo, useState } from 'react';
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
|
+
import { Eye16, EyeOff16 } from '@apify/icons';
|
|
4
|
+
import { theme } from '../../../design_system/theme';
|
|
5
|
+
import { Text } from '../../text';
|
|
6
|
+
import { ActionButton, CopyButton } from '../action_button';
|
|
7
|
+
import SyntaxHighlighter, { SyntaxHighlighterBaseStylesWrapper } from '../syntax_highlighter';
|
|
8
|
+
export const oneLineCodeClassNames = {
|
|
9
|
+
gradientWrapper: 'OneLineCode-GradientWrapper',
|
|
10
|
+
scrollableWrapper: 'OneLineCode-ScrollableWrapper',
|
|
11
|
+
methodChip: 'OneLineCode-MethodChip',
|
|
12
|
+
gradient: 'OneLineCode-Gradient',
|
|
13
|
+
buttons: 'OneLineCode-Buttons',
|
|
14
|
+
};
|
|
15
|
+
const HTML_METHOD_CHIP_STYLES = {
|
|
16
|
+
GET: 'primary',
|
|
17
|
+
POST: 'success',
|
|
18
|
+
PUT: 'warning',
|
|
19
|
+
DELETE: 'danger',
|
|
20
|
+
HEAD: 'neutral',
|
|
21
|
+
PATCH: 'neutral',
|
|
22
|
+
};
|
|
23
|
+
function getChipStyles(httpMethod) {
|
|
24
|
+
const styles = theme.color[HTML_METHOD_CHIP_STYLES[httpMethod]];
|
|
25
|
+
return css `
|
|
26
|
+
background-color: ${styles.chipBackground};
|
|
27
|
+
color: ${'chipText' in styles ? styles.chipText : styles.text};
|
|
28
|
+
`;
|
|
29
|
+
}
|
|
30
|
+
const OneLineCodeWrapper = styled(SyntaxHighlighterBaseStylesWrapper) `
|
|
31
|
+
display: flex;
|
|
32
|
+
padding-right: ${theme.space.space16} !important;
|
|
33
|
+
${({ $fitContent }) => $fitContent && css `
|
|
34
|
+
width: fit-content;
|
|
35
|
+
`}
|
|
36
|
+
|
|
37
|
+
${({ $disabled }) => $disabled && css `
|
|
38
|
+
opacity: 0.5;
|
|
39
|
+
cursor: not-allowed;
|
|
40
|
+
`}
|
|
41
|
+
|
|
42
|
+
height: 4.6rem;
|
|
43
|
+
|
|
44
|
+
.${oneLineCodeClassNames.buttons} {
|
|
45
|
+
display: flex;
|
|
46
|
+
align-items: center;
|
|
47
|
+
gap: ${theme.space.space8};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.${oneLineCodeClassNames.methodChip} {
|
|
51
|
+
padding: 0 ${theme.space.space4};
|
|
52
|
+
margin-top: ${theme.space.space2};
|
|
53
|
+
border-radius: ${theme.radius.radius6};
|
|
54
|
+
height: 2.4rem;
|
|
55
|
+
${({ $httpMethod }) => $httpMethod && getChipStyles($httpMethod)}
|
|
56
|
+
display: flex;
|
|
57
|
+
align-items: center;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.${oneLineCodeClassNames.gradientWrapper} {
|
|
61
|
+
position: relative;
|
|
62
|
+
flex: 1;
|
|
63
|
+
min-width: 0;
|
|
64
|
+
padding-top: ${theme.space.space8};
|
|
65
|
+
display: flex;
|
|
66
|
+
|
|
67
|
+
.${oneLineCodeClassNames.gradient} {
|
|
68
|
+
position: absolute;
|
|
69
|
+
right: 0;
|
|
70
|
+
top: 0;
|
|
71
|
+
bottom: 0;
|
|
72
|
+
width: 4rem;
|
|
73
|
+
background: linear-gradient(
|
|
74
|
+
to right,
|
|
75
|
+
transparent,
|
|
76
|
+
${theme.color.neutral.backgroundMuted} 3rem
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.${oneLineCodeClassNames.scrollableWrapper} {
|
|
82
|
+
flex: 1;
|
|
83
|
+
overflow-x: auto;
|
|
84
|
+
overflow-y: hidden;
|
|
85
|
+
display: flex;
|
|
86
|
+
gap: ${theme.space.space16};
|
|
87
|
+
padding: 0 ${theme.space.space8} !important;
|
|
88
|
+
margin-left: ${theme.space.space8} !important;
|
|
89
|
+
height: 100%;
|
|
90
|
+
|
|
91
|
+
scrollbar-width: thin;
|
|
92
|
+
scrollbar-color: ${theme.color.neutral.border} transparent;
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
.CodePre {
|
|
96
|
+
overflow: unset !important;
|
|
97
|
+
display: flex;
|
|
98
|
+
flex: 1;
|
|
99
|
+
align-items: center;
|
|
100
|
+
height: 2.8rem;
|
|
101
|
+
|
|
102
|
+
code {
|
|
103
|
+
& > span {
|
|
104
|
+
text-overflow: ellipsis;
|
|
105
|
+
overflow: hidden;
|
|
106
|
+
white-space: nowrap;
|
|
107
|
+
vertical-align: text-top;
|
|
108
|
+
${({ $showBashPrefixes }) => $showBashPrefixes && css `
|
|
109
|
+
&::before {
|
|
110
|
+
color: ${theme.color.lavender.base};
|
|
111
|
+
padding-right: ${theme.space.space16};
|
|
112
|
+
min-width: ${theme.space.space24};
|
|
113
|
+
user-select: none;
|
|
114
|
+
-webkit-user-select: none;
|
|
115
|
+
content: "$";
|
|
116
|
+
font-size: 1em;
|
|
117
|
+
}
|
|
118
|
+
`}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
`;
|
|
124
|
+
export function OneLineCode({ children, language, size, httpMethod, actionButtonLabel, onActionButtonClick, fullWidth, secretPlaceholder = '***', secret, disabled, hideCopyButton, ...rest }) {
|
|
125
|
+
const hasSecret = secret !== undefined;
|
|
126
|
+
const [showSecret, setShowSecret] = useState(false);
|
|
127
|
+
const codeWithSecret = useMemo(() => {
|
|
128
|
+
if (!hasSecret)
|
|
129
|
+
return children;
|
|
130
|
+
return children.replace(secretPlaceholder, secret);
|
|
131
|
+
}, [children, secret, hasSecret, secretPlaceholder]);
|
|
132
|
+
const code = showSecret ? codeWithSecret : children;
|
|
133
|
+
const showBashPrefixes = language === 'bash';
|
|
134
|
+
return (<OneLineCodeWrapper $httpMethod={httpMethod} $fullWidth={fullWidth} $showBashPrefixes={showBashPrefixes} $disabled={disabled} {...rest}>
|
|
135
|
+
<div className={oneLineCodeClassNames.gradientWrapper}>
|
|
136
|
+
<div className={oneLineCodeClassNames.scrollableWrapper}>
|
|
137
|
+
{httpMethod && (<Text className={oneLineCodeClassNames.methodChip} as='div'>
|
|
138
|
+
{httpMethod}
|
|
139
|
+
</Text>)}
|
|
140
|
+
<SyntaxHighlighter language={language} size={size} wrapLines>
|
|
141
|
+
{code}
|
|
142
|
+
</SyntaxHighlighter>
|
|
143
|
+
</div>
|
|
144
|
+
<div className={oneLineCodeClassNames.gradient}/>
|
|
145
|
+
</div>
|
|
146
|
+
<div className={oneLineCodeClassNames.buttons}>
|
|
147
|
+
{hasSecret && (<ActionButton onClick={() => setShowSecret((prev) => !prev)} data-test='toggle-visibility-button'>
|
|
148
|
+
{showSecret ? (<EyeOff16 viewBox="0 0 16 16"/>) : (<Eye16 viewBox="0 0 16 16"/>)}
|
|
149
|
+
</ActionButton>)}
|
|
150
|
+
{!hideCopyButton && <CopyButton code={codeWithSecret}/>}
|
|
151
|
+
{!!onActionButtonClick && (<ActionButton onClick={onActionButtonClick}>
|
|
152
|
+
{actionButtonLabel}
|
|
153
|
+
</ActionButton>)}
|
|
154
|
+
</div>
|
|
155
|
+
</OneLineCodeWrapper>);
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=one_line_code.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"one_line_code.jsx","sourceRoot":"","sources":["../../../../../src/components/code/one_line_code/one_line_code.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAErD,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,iBAAiB,EAAE,EAAE,kCAAkC,EAAE,MAAM,uBAAuB,CAAC;AAG9F,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACjC,eAAe,EAAE,6BAA6B;IAC9C,iBAAiB,EAAE,+BAA+B;IAClD,UAAU,EAAE,wBAAwB;IACpC,QAAQ,EAAE,sBAAsB;IAChC,OAAO,EAAE,qBAAqB;CACjC,CAAC;AAQF,MAAM,uBAAuB,GAAkC;IAC3D,GAAG,EAAE,SAAS;IACd,IAAI,EAAE,SAAS;IACf,GAAG,EAAE,SAA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B,IAAI,CACtB,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,mBAAmB,CAAC,CACvC;wBAAA,CAAC,iBAAiB,CACtB;oBAAA,EAAE,YAAY,CAAC,CAClB,CACL;YAAA,EAAE,GAAG,CACT;QAAA,EAAE,kBAAkB,CAAE,CACzB,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { SyntaxHighlighterProps as ReactSyntaxHighlighterProps } from 'react-syntax-highlighter';
|
|
3
|
+
import { type SharedTextProps } from '../text';
|
|
4
|
+
import type { SharedTextSize } from '../text/text_shared';
|
|
5
|
+
type SyntaxHighlighterProps = ReactSyntaxHighlighterProps & {
|
|
6
|
+
size: SharedTextSize;
|
|
7
|
+
};
|
|
8
|
+
export declare const SyntaxHighlighter: React.ForwardRefExoticComponent<Omit<SyntaxHighlighterProps, "ref"> & React.RefAttributes<HTMLPreElement>>;
|
|
9
|
+
export type SyntaxHighlighterBaseStylesWrapperProps = SharedTextProps & {
|
|
10
|
+
$fullWidth?: boolean;
|
|
11
|
+
$fullHeight?: boolean;
|
|
12
|
+
$showLineNumbers?: boolean;
|
|
13
|
+
};
|
|
14
|
+
export declare const SyntaxHighlighterBaseStylesWrapper: import("styled-components").StyledComponent<React.ForwardRefExoticComponent<import("../box").BoxProps & React.RefAttributes<HTMLElement>>, any, SyntaxHighlighterBaseStylesWrapperProps, never>;
|
|
15
|
+
export default SyntaxHighlighter;
|
|
16
|
+
//# sourceMappingURL=syntax_highlighter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"syntax_highlighter.d.ts","sourceRoot":"","sources":["../../../../src/components/code/syntax_highlighter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,KAAK,EAAE,sBAAsB,IAAI,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAuBtG,OAAO,EAAQ,KAAK,eAAe,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAoD1D,KAAK,sBAAsB,GAAG,2BAA2B,GAAG;IAAE,IAAI,EAAE,cAAc,CAAA;CAAE,CAAC;AAErF,eAAO,MAAM,iBAAiB,4GAsB5B,CAAC;AAEH,MAAM,MAAM,uCAAuC,GAAG,eAAe,GAAG;IACpE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC9B,CAAA;AAED,eAAO,MAAM,kCAAkC,iMAY9C,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3
|
+
// @ts-ignore The library is badly typed and does not export the type
|
|
4
|
+
import bash from 'react-syntax-highlighter/dist/esm/languages/prism/bash';
|
|
5
|
+
import dockerFile from 'react-syntax-highlighter/dist/esm/languages/prism/docker';
|
|
6
|
+
import http from 'react-syntax-highlighter/dist/esm/languages/prism/http';
|
|
7
|
+
import js from 'react-syntax-highlighter/dist/esm/languages/prism/javascript';
|
|
8
|
+
import json from 'react-syntax-highlighter/dist/esm/languages/prism/json';
|
|
9
|
+
import html from 'react-syntax-highlighter/dist/esm/languages/prism/markup';
|
|
10
|
+
import python from 'react-syntax-highlighter/dist/esm/languages/prism/python';
|
|
11
|
+
import ts from 'react-syntax-highlighter/dist/esm/languages/prism/typescript';
|
|
12
|
+
import xml from 'react-syntax-highlighter/dist/esm/languages/prism/xml-doc';
|
|
13
|
+
import yaml from 'react-syntax-highlighter/dist/esm/languages/prism/yaml';
|
|
14
|
+
import ReactSyntaxHighlighter from 'react-syntax-highlighter/dist/esm/prism-light';
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
16
|
+
// @ts-ignore The library is badly typed and does not export the type
|
|
17
|
+
import dark from 'react-syntax-highlighter/dist/esm/styles/prism/night-owl';
|
|
18
|
+
import light from 'react-syntax-highlighter/dist/esm/styles/prism/prism';
|
|
19
|
+
import styled, { css } from 'styled-components';
|
|
20
|
+
import { theme } from '../../design_system/theme';
|
|
21
|
+
import { useSharedUiDependencies } from '../../ui_dependency_provider';
|
|
22
|
+
import { Box } from '../box';
|
|
23
|
+
import { Text } from '../text';
|
|
24
|
+
ReactSyntaxHighlighter.registerLanguage('typescript', ts);
|
|
25
|
+
ReactSyntaxHighlighter.registerLanguage('javascript', js);
|
|
26
|
+
ReactSyntaxHighlighter.registerLanguage('json', json);
|
|
27
|
+
ReactSyntaxHighlighter.registerLanguage('bash', bash);
|
|
28
|
+
ReactSyntaxHighlighter.registerLanguage('docker', dockerFile);
|
|
29
|
+
ReactSyntaxHighlighter.registerLanguage('html', html);
|
|
30
|
+
ReactSyntaxHighlighter.registerLanguage('xml', xml);
|
|
31
|
+
ReactSyntaxHighlighter.registerLanguage('yaml', yaml);
|
|
32
|
+
ReactSyntaxHighlighter.registerLanguage('python', python);
|
|
33
|
+
ReactSyntaxHighlighter.registerLanguage('http', http);
|
|
34
|
+
ReactSyntaxHighlighter.registerLanguage('jsonp', json);
|
|
35
|
+
ReactSyntaxHighlighter.registerLanguage('jsonl', json);
|
|
36
|
+
ReactSyntaxHighlighter.registerLanguage('rss', xml);
|
|
37
|
+
const StyledPre = styled(Text) `
|
|
38
|
+
width: 100%;
|
|
39
|
+
position: relative;
|
|
40
|
+
|
|
41
|
+
*,
|
|
42
|
+
*::before,
|
|
43
|
+
*::after {
|
|
44
|
+
text-shadow: none !important;
|
|
45
|
+
font-style: normal !important;
|
|
46
|
+
font-family: inherit !important;
|
|
47
|
+
font-size: inherit !important;
|
|
48
|
+
font-weight: inherit !important;
|
|
49
|
+
line-height: inherit !important;
|
|
50
|
+
background-color: transparent !important;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
code {
|
|
54
|
+
min-width: 100%;
|
|
55
|
+
display: inline-block;
|
|
56
|
+
vertical-align: middle;
|
|
57
|
+
overflow: hidden;
|
|
58
|
+
}
|
|
59
|
+
`;
|
|
60
|
+
// Syntax highlighter uses inline style a lot which makes it hard to override them. To do so, we make the library not
|
|
61
|
+
// use styles that we wish to set on our own (font-based styles, spacing, background, ...),
|
|
62
|
+
const inlineCssReset = {
|
|
63
|
+
fontFamily: undefined,
|
|
64
|
+
fontSize: undefined,
|
|
65
|
+
fontWeight: undefined,
|
|
66
|
+
lineHeight: undefined,
|
|
67
|
+
background: undefined,
|
|
68
|
+
margin: undefined,
|
|
69
|
+
padding: undefined,
|
|
70
|
+
};
|
|
71
|
+
export const SyntaxHighlighter = forwardRef(({ size, children, ...rest }, ref) => {
|
|
72
|
+
const { uiTheme } = useSharedUiDependencies();
|
|
73
|
+
const PreTag = (preProps) => {
|
|
74
|
+
return <StyledPre {...preProps} size={size} forwardedAs='pre' type='code' ref={ref}/>;
|
|
75
|
+
};
|
|
76
|
+
return (<ReactSyntaxHighlighter PreTag={PreTag} customStyle={inlineCssReset} className="CodePre" style={uiTheme === 'DARK' ? dark : light} {...rest}>
|
|
77
|
+
{children}
|
|
78
|
+
</ReactSyntaxHighlighter>);
|
|
79
|
+
});
|
|
80
|
+
export const SyntaxHighlighterBaseStylesWrapper = styled(Box) `
|
|
81
|
+
background-color: ${theme.color.neutral.backgroundMuted} !important;
|
|
82
|
+
border: 1px solid ${theme.color.neutral.border};
|
|
83
|
+
border-radius: ${theme.radius.radius12};
|
|
84
|
+
overflow: hidden;
|
|
85
|
+
|
|
86
|
+
width: 100%;
|
|
87
|
+
${({ $fullWidth }) => !$fullWidth && css `max-width: 860px;`}
|
|
88
|
+
${({ $fullHeight }) => !$fullHeight && css `max-height: 600px;`}
|
|
89
|
+
|
|
90
|
+
background-color: transparent;
|
|
91
|
+
position: relative;
|
|
92
|
+
`;
|
|
93
|
+
export default SyntaxHighlighter;
|
|
94
|
+
//# sourceMappingURL=syntax_highlighter.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"syntax_highlighter.jsx","sourceRoot":"","sources":["../../../../src/components/code/syntax_highlighter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAG1C,6DAA6D;AAC7D,qEAAqE;AACrE,OAAO,IAAI,MAAM,wDAAwD,CAAC;AAC1E,OAAO,UAAU,MAAM,0DAA0D,CAAC;AAClF,OAAO,IAAI,MAAM,wDAAwD,CAAC;AAC1E,OAAO,EAAE,MAAM,8DAA8D,CAAC;AAC9E,OAAO,IAAI,MAAM,wDAAwD,CAAC;AAC1E,OAAO,IAAI,MAAM,0DAA0D,CAAC;AAC5E,OAAO,MAAM,MAAM,0DAA0D,CAAC;AAC9E,OAAO,EAAE,MAAM,8DAA8D,CAAC;AAC9E,OAAO,GAAG,MAAM,2DAA2D,CAAC;AAC5E,OAAO,IAAI,MAAM,wDAAwD,CAAC;AAC1E,OAAO,sBAAsB,MAAM,+CAA+C,CAAC;AACnF,6DAA6D;AAC7D,qEAAqE;AACrE,OAAO,IAAI,MAAM,0DAA0D,CAAC;AAC5E,OAAO,KAAK,MAAM,sDAAsD,CAAC;AACzE,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAwB,MAAM,SAAS,CAAC;AAGrD,sBAAsB,CAAC,gBAAgB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AAC1D,sBAAsB,CAAC,gBAAgB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AAC1D,sBAAsB,CAAC,gBAAgB,CAAC,MAAM,EAAE,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AAE;QAC7B,OAAO,CAAC,SAAS,CAAC,IAAI,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;IAC1F,CAAC,CAAC;IAEF,OAAO,CACH,CAAC,sBAAsB,CACnB,MAAM,CAAC,CAAC,MAAM,CAAC,CACf,WAAW,CAAC,CAAC,cAAc,CAAC,CAC5B,SAAS,CAAC,SAAS,CACnB,KAAK,CAAC,CAAC,OAAO,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CACzC,IAAI,IAAI,CAAC,CAET;YAAA,CAAC,QAAQ,CACb;QAAA,EAAE,sBAAsB,CAAC,CAC5B,CAAC;AACN,CAAC,CAAC,CAAC;AAQH,MAAM,CAAC,MAAM,kCAAkC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAyC;wBAC9E,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe;wBACnC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM;qBAC7B,KAAK,CAAC,MAAM,CAAC,QAAQ;;;;MAIpC,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC,UAAU,IAAI,GAAG,CAAA,mBAAmB;MACzD,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,CAAC,WAAW,IAAI,GAAG,CAAA,oBAAoB;;;;CAIjE,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface ColorWheelGradientProps {
|
|
2
|
+
translateX?: number;
|
|
3
|
+
translateY?: number;
|
|
4
|
+
rotation?: number;
|
|
5
|
+
radius?: number;
|
|
6
|
+
blurSize?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare const ColorWheelGradient: import("styled-components").StyledComponent<"div", any, ColorWheelGradientProps, never>;
|
|
9
|
+
//# sourceMappingURL=color_wheel_gradient.d.ts.map
|