@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,95 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { theme } from '../design_system/theme';
|
|
5
|
+
|
|
6
|
+
/* eslint-disable max-len */
|
|
7
|
+
const BANNER_GRADIENT_BACKGROUND_SVG = `<svg width="1200" height="148" viewBox="0 0 1200 148" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
8
|
+
<g clip-path="url(#clip0_2285_34756)">
|
|
9
|
+
<g filter="url(#filter0_f_2285_34756)">
|
|
10
|
+
<path d="M-39.7702 191.085C-55.0622 193.205 -68.8864 201.311 -78.2029 213.621C-87.5194 225.932 -91.5654 241.438 -89.4512 256.731L-55.0077 502.652L89.8852 173L-39.7702 191.085Z" fill="url(#paint0_linear_2285_34756)"/>
|
|
11
|
+
</g>
|
|
12
|
+
<g filter="url(#filter1_f_2285_34756)">
|
|
13
|
+
<path d="M1267.53 398.062L1253.99 209.002C1252.85 193.626 1245.67 179.327 1234.01 169.234C1222.36 159.14 1207.18 154.073 1191.8 155.14C1190.5 155.19 1189.2 155.331 1187.92 155.564L1132 163.289L1254.84 438.685C1264.05 427.236 1268.59 412.721 1267.53 398.062Z" fill="url(#paint1_linear_2285_34756)"/>
|
|
14
|
+
</g>
|
|
15
|
+
<g filter="url(#filter2_f_2285_34756)">
|
|
16
|
+
<path d="M561 29.7691C570.917 30.4746 580.956 29.5571 590.142 27.1057L801.075 -28.7862L700.682 -170L561 29.7691Z" fill="url(#paint2_linear_2285_34756)"/>
|
|
17
|
+
</g>
|
|
18
|
+
</g>
|
|
19
|
+
<defs>
|
|
20
|
+
<filter id="filter0_f_2285_34756" x="-170" y="93" width="339.885" height="489.652" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
|
21
|
+
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
|
22
|
+
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
|
|
23
|
+
<feGaussianBlur stdDeviation="40" result="effect1_foregroundBlur_2285_34756"/>
|
|
24
|
+
</filter>
|
|
25
|
+
<filter id="filter1_f_2285_34756" x="1052" y="75" width="295.683" height="443.686" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
|
26
|
+
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
|
27
|
+
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
|
|
28
|
+
<feGaussianBlur stdDeviation="40" result="effect1_foregroundBlur_2285_34756"/>
|
|
29
|
+
</filter>
|
|
30
|
+
<filter id="filter2_f_2285_34756" x="481" y="-250" width="400.074" height="360" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
|
31
|
+
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
|
32
|
+
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
|
|
33
|
+
<feGaussianBlur stdDeviation="40" result="effect1_foregroundBlur_2285_34756"/>
|
|
34
|
+
</filter>
|
|
35
|
+
<linearGradient id="paint0_linear_2285_34756" x1="-0.0574112" y1="173" x2="-0.0574112" y2="502.652" gradientUnits="userSpaceOnUse">
|
|
36
|
+
<stop stop-color="#00FF85"/>
|
|
37
|
+
<stop offset="1" stop-color="#00FF47" stop-opacity="0"/>
|
|
38
|
+
</linearGradient>
|
|
39
|
+
<linearGradient id="paint1_linear_2285_34756" x1="1146.02" y1="174.549" x2="1333.1" y2="293.915" gradientUnits="userSpaceOnUse">
|
|
40
|
+
<stop stop-color="#00FFF0"/>
|
|
41
|
+
<stop offset="1" stop-color="#1672EB"/>
|
|
42
|
+
</linearGradient>
|
|
43
|
+
<linearGradient id="paint2_linear_2285_34756" x1="681.037" y1="-170" x2="681.037" y2="30" gradientUnits="userSpaceOnUse">
|
|
44
|
+
<stop stop-color="#F5B315"/>
|
|
45
|
+
<stop offset="1" stop-color="#FF2CC4"/>
|
|
46
|
+
</linearGradient>
|
|
47
|
+
<clipPath id="clip0_2285_34756">
|
|
48
|
+
<rect width="1200" height="1791.08" rx="16" fill="white"/>
|
|
49
|
+
</clipPath>
|
|
50
|
+
</defs>
|
|
51
|
+
</svg>
|
|
52
|
+
`;
|
|
53
|
+
|
|
54
|
+
interface BannerProps {
|
|
55
|
+
background?: string,
|
|
56
|
+
useGradientBackground?: boolean,
|
|
57
|
+
width?: string,
|
|
58
|
+
className?: string,
|
|
59
|
+
children: React.ReactNode,
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const getBannerBackground = (background?: string, useGradientBackground?: boolean) => {
|
|
63
|
+
return css`
|
|
64
|
+
background-color: ${background || theme.color.neutral.backgroundSubtle};
|
|
65
|
+
${useGradientBackground && `
|
|
66
|
+
background-image: url("data:image/svg+xml,${encodeURIComponent(BANNER_GRADIENT_BACKGROUND_SVG)}");
|
|
67
|
+
background-position: center;
|
|
68
|
+
background-repeat: no-repeat;
|
|
69
|
+
background-size: cover;
|
|
70
|
+
`}
|
|
71
|
+
`;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const StyledBanner = styled.div<{ $background?: string, $useGradientBackground?: boolean, width?: string }>`
|
|
75
|
+
width: ${(props) => props.width || '100%'};
|
|
76
|
+
padding: ${theme.space.space40} ${theme.space.space80};
|
|
77
|
+
border-radius: ${theme.radius.radius16};
|
|
78
|
+
|
|
79
|
+
${({ $background, $useGradientBackground }) => getBannerBackground($background, $useGradientBackground)};
|
|
80
|
+
`;
|
|
81
|
+
|
|
82
|
+
export const Banner: React.FC<BannerProps> = ({
|
|
83
|
+
useGradientBackground = true,
|
|
84
|
+
background,
|
|
85
|
+
children,
|
|
86
|
+
...otherProps
|
|
87
|
+
}) => (
|
|
88
|
+
<StyledBanner
|
|
89
|
+
$background={background}
|
|
90
|
+
$useGradientBackground={useGradientBackground}
|
|
91
|
+
{...otherProps}
|
|
92
|
+
>
|
|
93
|
+
{children}
|
|
94
|
+
</StyledBanner>
|
|
95
|
+
);
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { ArrowRight16 } from '@apify/icons';
|
|
5
|
+
|
|
6
|
+
import { theme } from '../design_system/theme';
|
|
7
|
+
|
|
8
|
+
const classNames = {
|
|
9
|
+
IMAGE_WRAPPER: 'ImageWrapper',
|
|
10
|
+
TEXT: 'Text',
|
|
11
|
+
READ_POST: 'ReadPost',
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const BlogArticleWrapper = styled.div`
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
|
|
18
|
+
&:hover {
|
|
19
|
+
.${classNames.READ_POST} {
|
|
20
|
+
color: ${theme.color.primary.action};
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.${classNames.IMAGE_WRAPPER} {
|
|
25
|
+
margin-bottom: ${theme.space.space16};
|
|
26
|
+
border-radius: ${theme.radius.radius12};
|
|
27
|
+
border: 1px solid ${theme.color.neutral.backgroundSubtle};
|
|
28
|
+
aspect-ratio: 16/9;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.${classNames.TEXT} {
|
|
32
|
+
padding-bottom: ${theme.space.space16};
|
|
33
|
+
color: ${theme.color.neutral.text};
|
|
34
|
+
${theme.typography.shared.mobile.titleL}
|
|
35
|
+
|
|
36
|
+
@media (min-width: ${theme.layout.tablet}) {
|
|
37
|
+
${theme.typography.shared.tablet.titleL}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@media (min-width: ${theme.layout.desktop}) {
|
|
41
|
+
${theme.typography.shared.desktop.titleL}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.${classNames.READ_POST} {
|
|
46
|
+
display: flex;
|
|
47
|
+
align-items: center;
|
|
48
|
+
gap: ${theme.space.space4};
|
|
49
|
+
color: ${theme.color.neutral.textMuted};
|
|
50
|
+
${theme.typography.shared.mobile.titleM}
|
|
51
|
+
|
|
52
|
+
@media (min-width: ${theme.layout.tablet}) {
|
|
53
|
+
${theme.typography.shared.tablet.titleM}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@media (min-width: ${theme.layout.desktop}) {
|
|
57
|
+
${theme.typography.shared.desktop.titleM}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
svg {
|
|
62
|
+
transition: margin-right .5s;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&:hover svg {
|
|
66
|
+
margin-right: ${theme.space.space4};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
`;
|
|
70
|
+
|
|
71
|
+
interface BlogArticleProps {
|
|
72
|
+
imageNode: React.ReactNode;
|
|
73
|
+
title: string;
|
|
74
|
+
ctaTitle?: string;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function BlogArticle({ imageNode, title, ctaTitle = 'Read more' }: BlogArticleProps) {
|
|
78
|
+
return (
|
|
79
|
+
<BlogArticleWrapper>
|
|
80
|
+
<div className={classNames.IMAGE_WRAPPER}>{imageNode}</div>
|
|
81
|
+
<div className={classNames.TEXT}>{title}</div>
|
|
82
|
+
<div className={classNames.READ_POST}>{ctaTitle}<ArrowRight16 title="" titleId="" /></div>
|
|
83
|
+
</BlogArticleWrapper>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { theme } from '../design_system/theme';
|
|
5
|
+
import type { Size } from '../design_system/tokens';
|
|
6
|
+
import type { WithTransientProps } from '../type_utils';
|
|
7
|
+
|
|
8
|
+
type ExtendedSize = Size | 'none' | 'auto';
|
|
9
|
+
|
|
10
|
+
export interface MarginSpacingProps {
|
|
11
|
+
m?: ExtendedSize,
|
|
12
|
+
mt?: ExtendedSize,
|
|
13
|
+
mb?: ExtendedSize,
|
|
14
|
+
ml?: ExtendedSize,
|
|
15
|
+
mr?: ExtendedSize,
|
|
16
|
+
mx?: ExtendedSize,
|
|
17
|
+
my?: ExtendedSize,
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface PaddingSpacingProps {
|
|
21
|
+
p?: ExtendedSize,
|
|
22
|
+
pt?: ExtendedSize,
|
|
23
|
+
pb?: ExtendedSize,
|
|
24
|
+
pl?: ExtendedSize,
|
|
25
|
+
pr?: ExtendedSize,
|
|
26
|
+
px?: ExtendedSize,
|
|
27
|
+
py?: ExtendedSize,
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
type SharedBoxProps = {
|
|
31
|
+
children?: React.ReactNode,
|
|
32
|
+
className?: string,
|
|
33
|
+
style?: React.CSSProperties
|
|
34
|
+
onClick?: (e: React.MouseEvent) => void,
|
|
35
|
+
id?: string,
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// This should be renamed - these props are global for any element not just Boxes
|
|
39
|
+
export type RegularBoxProps = SharedBoxProps & { as?: React.ElementType };
|
|
40
|
+
|
|
41
|
+
type OlBoxProps = SharedBoxProps & { as: 'ol', start?: number };
|
|
42
|
+
|
|
43
|
+
/** Combines together RegularBoxProps and props for specific elements. */
|
|
44
|
+
type AnyBoxProps = RegularBoxProps | OlBoxProps;
|
|
45
|
+
|
|
46
|
+
export type BoxProps = MarginSpacingProps & PaddingSpacingProps & AnyBoxProps;
|
|
47
|
+
|
|
48
|
+
const getSizeValue = (token?: ExtendedSize) => {
|
|
49
|
+
if (!token || token === 'none') return 0;
|
|
50
|
+
if (token === 'auto') return 'auto';
|
|
51
|
+
return theme.space[token] || 0;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const StyledBox = styled.div<WithTransientProps<MarginSpacingProps & PaddingSpacingProps>>`
|
|
55
|
+
${({ $mt, $my, $m }) => ($mt || $my || $m) && css`
|
|
56
|
+
margin-top: ${getSizeValue($mt || $my || $m)};
|
|
57
|
+
`}
|
|
58
|
+
|
|
59
|
+
${({ $mb, $my, $m }) => ($mb || $my || $m) && css`
|
|
60
|
+
margin-bottom: ${getSizeValue($mb || $my || $m)};
|
|
61
|
+
`}
|
|
62
|
+
|
|
63
|
+
${({ $mr, $mx, $m }) => ($mr || $mx || $m) && css`
|
|
64
|
+
margin-right: ${getSizeValue($mr || $mx || $m)};
|
|
65
|
+
`}
|
|
66
|
+
|
|
67
|
+
${({ $ml, $mx, $m }) => ($ml || $mx || $m) && css`
|
|
68
|
+
margin-left: ${getSizeValue($ml || $mx || $m)};
|
|
69
|
+
`}
|
|
70
|
+
|
|
71
|
+
${({ $pt, $py, $p }) => ($pt || $py || $p) && css`
|
|
72
|
+
padding-top: ${getSizeValue($pt || $py || $p)};
|
|
73
|
+
`}
|
|
74
|
+
|
|
75
|
+
${({ $pb, $py, $p }) => ($pb || $py || $p) && css`
|
|
76
|
+
padding-bottom: ${getSizeValue($pb || $py || $p)};
|
|
77
|
+
`}
|
|
78
|
+
|
|
79
|
+
${({ $pr, $px, $p }) => ($pr || $px || $p) && css`
|
|
80
|
+
padding-right: ${getSizeValue($pr || $px || $p)};
|
|
81
|
+
`}
|
|
82
|
+
|
|
83
|
+
${({ $pl, $px, $p }) => ($pl || $px || $p) && css`
|
|
84
|
+
padding-left: ${getSizeValue($pl || $px || $p)};
|
|
85
|
+
`}
|
|
86
|
+
`;
|
|
87
|
+
// This component should work as a base component for all low level components (Heading, Message, Card, ...) to make it easy to define spacing.
|
|
88
|
+
// Right now, it's quite common to define some sort of spacing on these components already using css. Card = styled.div`margin-bottom: theme.space.space8`
|
|
89
|
+
// We should get rid of it and define it using props for Box component Card = styled(Box).attrs({mb: 'space8'})
|
|
90
|
+
export const Box = forwardRef<HTMLElement, BoxProps>(({
|
|
91
|
+
m,
|
|
92
|
+
mt,
|
|
93
|
+
mb,
|
|
94
|
+
ml,
|
|
95
|
+
mr,
|
|
96
|
+
mx,
|
|
97
|
+
my,
|
|
98
|
+
p,
|
|
99
|
+
pt,
|
|
100
|
+
pb,
|
|
101
|
+
pl,
|
|
102
|
+
pr,
|
|
103
|
+
px,
|
|
104
|
+
py,
|
|
105
|
+
as,
|
|
106
|
+
...rest
|
|
107
|
+
}: BoxProps, ref) => (
|
|
108
|
+
<StyledBox
|
|
109
|
+
$m={m}
|
|
110
|
+
$mt={mt}
|
|
111
|
+
$mb={mb}
|
|
112
|
+
$ml={ml}
|
|
113
|
+
$mr={mr}
|
|
114
|
+
$mx={mx}
|
|
115
|
+
$my={my}
|
|
116
|
+
$p={p}
|
|
117
|
+
$pt={pt}
|
|
118
|
+
$pb={pb}
|
|
119
|
+
$pl={pl}
|
|
120
|
+
$pr={pr}
|
|
121
|
+
$px={px}
|
|
122
|
+
$py={py}
|
|
123
|
+
as={as}
|
|
124
|
+
ref={ref}
|
|
125
|
+
{...rest}
|
|
126
|
+
/>
|
|
127
|
+
));
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { ExternalLink16 } from '@apify/icons';
|
|
5
|
+
|
|
6
|
+
import { theme } from '../design_system/theme';
|
|
7
|
+
import { type WithRequired, type WithTransientProps } from '../type_utils';
|
|
8
|
+
import { useSharedUiDependencies } from '../ui_dependency_provider';
|
|
9
|
+
import { Box, type RegularBoxProps, type MarginSpacingProps } from './box';
|
|
10
|
+
import { Link, isUrlExternal, type LinkProps } from './link';
|
|
11
|
+
|
|
12
|
+
type ButtonSize = 'medium' | 'small';
|
|
13
|
+
type ButtonColor = 'default' | 'success' | 'danger';
|
|
14
|
+
type ButtonVariant = 'primary' | 'secondary' | 'text';
|
|
15
|
+
|
|
16
|
+
export interface TransientButtonProps {
|
|
17
|
+
size?: ButtonSize;
|
|
18
|
+
color?: ButtonColor;
|
|
19
|
+
variant?: ButtonVariant;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export interface RegularButtonProps {
|
|
23
|
+
trackingId?: string,
|
|
24
|
+
trackingData?: object,
|
|
25
|
+
LeftIcon?: React.ElementType,
|
|
26
|
+
RightIcon?: React.ElementType,
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
// Props shared for both types of the button
|
|
31
|
+
export type CommonButtonProps = RegularButtonProps & TransientButtonProps & MarginSpacingProps;
|
|
32
|
+
// Regular button must have onClick defined
|
|
33
|
+
export type ButtonProps = CommonButtonProps & WithRequired<RegularBoxProps, 'onClick'>;
|
|
34
|
+
// OR it can pass to to become anchor link - in that case onClick is not needed
|
|
35
|
+
export type AnchorButtonProps = CommonButtonProps & RegularBoxProps & LinkProps;
|
|
36
|
+
|
|
37
|
+
// typeguard to distinguish between the two options for props
|
|
38
|
+
function isAnchorButton(props: ButtonProps | AnchorButtonProps): props is AnchorButtonProps {
|
|
39
|
+
return (props as AnchorButtonProps).to !== undefined;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
type ButtonColorCombinations = {
|
|
43
|
+
[Type in ButtonVariant]: {
|
|
44
|
+
[Size in ButtonColor]: {
|
|
45
|
+
textColor: string,
|
|
46
|
+
borderColor: string
|
|
47
|
+
backgroundColor: string,
|
|
48
|
+
|
|
49
|
+
// hover & active state affects both border & background.
|
|
50
|
+
hoverColor?: string,
|
|
51
|
+
activeColor?: string,
|
|
52
|
+
actionTextColor?: string,
|
|
53
|
+
|
|
54
|
+
// only exception is primary outlined button
|
|
55
|
+
actionBorderColor?: string
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
type ButtonSizeCombinations = {
|
|
61
|
+
[Size in ButtonSize]: {
|
|
62
|
+
fontSize: number,
|
|
63
|
+
horizontalPadding: number,
|
|
64
|
+
height: number,
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const BUTTON_COLOR_VARIANTS_CSS: ButtonColorCombinations = {
|
|
69
|
+
primary: {
|
|
70
|
+
default: {
|
|
71
|
+
textColor: theme.color.neutral.backgroundSubtle,
|
|
72
|
+
backgroundColor: theme.color.primary.action,
|
|
73
|
+
borderColor: theme.color.primary.action,
|
|
74
|
+
hoverColor: theme.color.primary.actionHover,
|
|
75
|
+
activeColor: theme.color.primary.actionActive,
|
|
76
|
+
},
|
|
77
|
+
success: {
|
|
78
|
+
textColor: theme.color.neutral.backgroundSubtle,
|
|
79
|
+
backgroundColor: theme.color.success.action,
|
|
80
|
+
borderColor: theme.color.success.action,
|
|
81
|
+
hoverColor: theme.color.success.actionHover,
|
|
82
|
+
activeColor: theme.color.success.actionActive,
|
|
83
|
+
},
|
|
84
|
+
danger: {
|
|
85
|
+
textColor: theme.color.neutral.backgroundSubtle,
|
|
86
|
+
backgroundColor: theme.color.danger.action,
|
|
87
|
+
borderColor: theme.color.danger.action,
|
|
88
|
+
hoverColor: theme.color.danger.actionHover,
|
|
89
|
+
activeColor: theme.color.danger.actionActive,
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
secondary: {
|
|
93
|
+
default: {
|
|
94
|
+
textColor: theme.color.neutral.text,
|
|
95
|
+
backgroundColor: theme.color.neutral.backgroundMuted,
|
|
96
|
+
borderColor: theme.color.neutral.border,
|
|
97
|
+
hoverColor: theme.color.neutral.actionSecondaryHover,
|
|
98
|
+
activeColor: theme.color.neutral.actionSecondaryActive,
|
|
99
|
+
actionBorderColor: theme.color.neutral.border,
|
|
100
|
+
},
|
|
101
|
+
success: {
|
|
102
|
+
textColor: theme.color.success.text,
|
|
103
|
+
backgroundColor: theme.color.neutral.backgroundMuted,
|
|
104
|
+
borderColor: theme.color.neutral.border,
|
|
105
|
+
hoverColor: theme.color.success.actionHover,
|
|
106
|
+
activeColor: theme.color.success.actionActive,
|
|
107
|
+
actionTextColor: theme.color.neutral.background,
|
|
108
|
+
},
|
|
109
|
+
danger: {
|
|
110
|
+
textColor: theme.color.danger.text,
|
|
111
|
+
backgroundColor: theme.color.neutral.backgroundMuted,
|
|
112
|
+
borderColor: theme.color.neutral.border,
|
|
113
|
+
hoverColor: theme.color.danger.actionHover,
|
|
114
|
+
activeColor: theme.color.danger.actionActive,
|
|
115
|
+
actionTextColor: theme.color.neutral.background,
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
text: {
|
|
119
|
+
default: {
|
|
120
|
+
textColor: theme.color.neutral.text,
|
|
121
|
+
backgroundColor: 'transparent',
|
|
122
|
+
borderColor: 'transparent',
|
|
123
|
+
// TODO: Not sure about these
|
|
124
|
+
hoverColor: theme.color.neutral.hover,
|
|
125
|
+
activeColor: theme.color.neutral.actionSecondaryActive,
|
|
126
|
+
},
|
|
127
|
+
success: {
|
|
128
|
+
textColor: theme.color.success.text,
|
|
129
|
+
backgroundColor: 'transparent',
|
|
130
|
+
borderColor: 'transparent',
|
|
131
|
+
hoverColor: theme.color.success.backgroundSubtleHover,
|
|
132
|
+
activeColor: theme.color.success.backgroundSubtleActive,
|
|
133
|
+
},
|
|
134
|
+
danger: {
|
|
135
|
+
textColor: theme.color.danger.text,
|
|
136
|
+
backgroundColor: 'transparent',
|
|
137
|
+
borderColor: 'transparent',
|
|
138
|
+
hoverColor: theme.color.danger.backgroundSubtleHover,
|
|
139
|
+
activeColor: theme.color.danger.backgroundSubtleActive,
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
export const BUTTON_SIZE_VARIANTS_CSS: ButtonSizeCombinations = {
|
|
145
|
+
medium: {
|
|
146
|
+
fontSize: 14,
|
|
147
|
+
height: 36,
|
|
148
|
+
horizontalPadding: 12,
|
|
149
|
+
},
|
|
150
|
+
small: {
|
|
151
|
+
fontSize: 14,
|
|
152
|
+
height: 28,
|
|
153
|
+
horizontalPadding: 8,
|
|
154
|
+
},
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
export const getButtonColorStyles = (variant: ButtonVariant = 'primary', color: ButtonColor = 'default') => {
|
|
158
|
+
const {
|
|
159
|
+
backgroundColor,
|
|
160
|
+
borderColor,
|
|
161
|
+
textColor,
|
|
162
|
+
actionTextColor,
|
|
163
|
+
activeColor,
|
|
164
|
+
hoverColor,
|
|
165
|
+
actionBorderColor,
|
|
166
|
+
} = BUTTON_COLOR_VARIANTS_CSS[variant][color];
|
|
167
|
+
|
|
168
|
+
return css`
|
|
169
|
+
color: ${textColor};
|
|
170
|
+
background-color: ${backgroundColor};
|
|
171
|
+
border-color: ${borderColor};
|
|
172
|
+
|
|
173
|
+
&:hover {
|
|
174
|
+
color: ${actionTextColor || textColor};
|
|
175
|
+
background-color: ${hoverColor};
|
|
176
|
+
border-color: ${actionBorderColor || hoverColor};
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
&:active {
|
|
180
|
+
color: ${actionTextColor || textColor};
|
|
181
|
+
background-color: ${activeColor};
|
|
182
|
+
border-color: ${actionBorderColor || activeColor};
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
&:disabled {
|
|
186
|
+
color: ${theme.color.neutral.textDisabled};
|
|
187
|
+
background-color: ${theme.color.neutral.disabled};
|
|
188
|
+
border-color: ${variant === 'text' ? 'transparent' : theme.color.neutral.disabled};
|
|
189
|
+
|
|
190
|
+
cursor: default;
|
|
191
|
+
}
|
|
192
|
+
`;
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
export const getButtonSizeStyles = (size: ButtonSize = 'medium') => {
|
|
196
|
+
const {
|
|
197
|
+
fontSize,
|
|
198
|
+
height,
|
|
199
|
+
horizontalPadding,
|
|
200
|
+
} = BUTTON_SIZE_VARIANTS_CSS[size];
|
|
201
|
+
|
|
202
|
+
return css`
|
|
203
|
+
height: ${height}px;
|
|
204
|
+
font-size: ${fontSize}px;
|
|
205
|
+
/* We just want to ensure padding on the sides. Height is set the the hard way for simplicity */
|
|
206
|
+
padding: 0 ${horizontalPadding}px;
|
|
207
|
+
`;
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
const StyledButton = styled(Box)<WithTransientProps<TransientButtonProps>>`
|
|
211
|
+
/* Basic positioning */
|
|
212
|
+
display: inline-flex;
|
|
213
|
+
align-items: center;
|
|
214
|
+
/* NOT sure about this. It needs to be set when we want 100% width button */
|
|
215
|
+
/* Maybe we can add block property */
|
|
216
|
+
justify-content: center;
|
|
217
|
+
gap: ${theme.space.space8};
|
|
218
|
+
|
|
219
|
+
/* Basic styles */
|
|
220
|
+
font-weight: 500;
|
|
221
|
+
white-space: nowrap;
|
|
222
|
+
cursor: pointer;
|
|
223
|
+
transition: border-color ${theme.transition.fastEaseOut}, background-color ${theme.transition.fastEaseOut};
|
|
224
|
+
|
|
225
|
+
/* Border is always defined, but it can be set to transparent */
|
|
226
|
+
border-style: solid;
|
|
227
|
+
border-width: 1px;
|
|
228
|
+
border-radius: ${theme.radius.radius6};
|
|
229
|
+
border-color: transparent;
|
|
230
|
+
|
|
231
|
+
/* Colors */
|
|
232
|
+
${(props) => getButtonColorStyles(props.$variant, props.$color)}
|
|
233
|
+
|
|
234
|
+
/* Paddings & font size */
|
|
235
|
+
${(props) => getButtonSizeStyles(props.$size)}
|
|
236
|
+
`;
|
|
237
|
+
|
|
238
|
+
export const Button = forwardRef<HTMLElement, ButtonProps | AnchorButtonProps>((props, ref) => {
|
|
239
|
+
const {
|
|
240
|
+
as,
|
|
241
|
+
children,
|
|
242
|
+
size,
|
|
243
|
+
color,
|
|
244
|
+
variant,
|
|
245
|
+
LeftIcon,
|
|
246
|
+
RightIcon,
|
|
247
|
+
onClick,
|
|
248
|
+
trackingId,
|
|
249
|
+
trackingData,
|
|
250
|
+
...rest
|
|
251
|
+
} = props;
|
|
252
|
+
|
|
253
|
+
const {
|
|
254
|
+
trackClick,
|
|
255
|
+
windowLocationHost,
|
|
256
|
+
} = useSharedUiDependencies();
|
|
257
|
+
const trackedOnClick = (e: React.MouseEvent) => {
|
|
258
|
+
if (trackClick && trackingId) trackClick(trackingId, trackingData);
|
|
259
|
+
if (onClick) onClick(e);
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
if (isAnchorButton(props)) {
|
|
263
|
+
const isExternal = isUrlExternal(props.to, windowLocationHost);
|
|
264
|
+
const EffectiveRightIcon = (isExternal && !props.hideExternalIcon) ? ExternalLink16 : RightIcon;
|
|
265
|
+
|
|
266
|
+
return (
|
|
267
|
+
<StyledButton
|
|
268
|
+
$size={size}
|
|
269
|
+
$color={color}
|
|
270
|
+
$variant={variant}
|
|
271
|
+
// If anchor is undefined, we just render it as a regular button
|
|
272
|
+
forwardedAs={props.disabled ? 'button' : Link}
|
|
273
|
+
ref={ref}
|
|
274
|
+
onClick={trackedOnClick}
|
|
275
|
+
to={props.to}
|
|
276
|
+
{...rest}
|
|
277
|
+
// If we want to show external icon, we use button's slot for icon
|
|
278
|
+
hideExternalIcon={true}
|
|
279
|
+
>
|
|
280
|
+
{LeftIcon && <LeftIcon />}
|
|
281
|
+
{children}
|
|
282
|
+
{EffectiveRightIcon && <EffectiveRightIcon />}
|
|
283
|
+
</StyledButton>
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
return (
|
|
288
|
+
<StyledButton
|
|
289
|
+
$size={size}
|
|
290
|
+
$color={color}
|
|
291
|
+
$variant={variant}
|
|
292
|
+
forwardedAs={ as || 'button'}
|
|
293
|
+
ref={ref}
|
|
294
|
+
onClick={trackedOnClick}
|
|
295
|
+
type='button'
|
|
296
|
+
{...rest}
|
|
297
|
+
>
|
|
298
|
+
{LeftIcon && <LeftIcon />}
|
|
299
|
+
{children}
|
|
300
|
+
{RightIcon && <RightIcon />}
|
|
301
|
+
</StyledButton>
|
|
302
|
+
);
|
|
303
|
+
});
|