@apify/ui-library 1.138.0 → 1.138.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/src/components/action_link.d.ts.map +1 -1
- package/dist/src/components/action_link.js +3 -3
- package/dist/src/components/action_link.js.map +1 -1
- package/dist/src/components/actor_template_card.d.ts.map +1 -1
- package/dist/src/components/actor_template_card.js +3 -3
- package/dist/src/components/actor_template_card.js.map +1 -1
- package/dist/src/components/avatar/actor_avatar.d.ts.map +1 -1
- package/dist/src/components/avatar/actor_avatar.js +3 -3
- package/dist/src/components/avatar/actor_avatar.js.map +1 -1
- package/dist/src/components/avatar/boring_avatar.d.ts.map +1 -1
- package/dist/src/components/avatar/boring_avatar.js +8 -7
- package/dist/src/components/avatar/boring_avatar.js.map +1 -1
- package/dist/src/components/avatar/user_avatar.d.ts.map +1 -1
- package/dist/src/components/avatar/user_avatar.js +1 -1
- package/dist/src/components/avatar/user_avatar.js.map +1 -1
- package/dist/src/components/badge.d.ts.map +1 -1
- package/dist/src/components/badge.js +10 -3
- package/dist/src/components/badge.js.map +1 -1
- package/dist/src/components/banner.d.ts.map +1 -1
- package/dist/src/components/banner.js +4 -3
- package/dist/src/components/banner.js.map +1 -1
- package/dist/src/components/blog_article.d.ts.map +1 -1
- package/dist/src/components/blog_article.js +2 -3
- package/dist/src/components/blog_article.js.map +1 -1
- package/dist/src/components/box.d.ts.map +1 -1
- package/dist/src/components/box.js +32 -24
- package/dist/src/components/box.js.map +1 -1
- package/dist/src/components/breadcrumb/breadcrumb.d.ts.map +1 -1
- package/dist/src/components/breadcrumb/breadcrumb.js +1 -1
- package/dist/src/components/breadcrumb/breadcrumb.js.map +1 -1
- package/dist/src/components/button.d.ts.map +1 -1
- package/dist/src/components/button.js +12 -9
- package/dist/src/components/button.js.map +1 -1
- package/dist/src/components/card_container.d.ts.map +1 -1
- package/dist/src/components/card_container.js +5 -3
- package/dist/src/components/card_container.js.map +1 -1
- package/dist/src/components/checkbox/checkbox.d.ts.map +1 -1
- package/dist/src/components/checkbox/checkbox.js +1 -1
- package/dist/src/components/checkbox/checkbox.js.map +1 -1
- package/dist/src/components/checkbox/checkbox.style.d.ts.map +1 -1
- package/dist/src/components/checkbox/checkbox.style.js +7 -4
- package/dist/src/components/checkbox/checkbox.style.js.map +1 -1
- package/dist/src/components/chip.d.ts.map +1 -1
- package/dist/src/components/chip.js +1 -1
- package/dist/src/components/chip.js.map +1 -1
- package/dist/src/components/code/action_button.d.ts.map +1 -1
- package/dist/src/components/code/action_button.js +5 -5
- package/dist/src/components/code/action_button.js.map +1 -1
- package/dist/src/components/code/code_block/code_block.d.ts.map +1 -1
- package/dist/src/components/code/code_block/code_block.js +19 -8
- package/dist/src/components/code/code_block/code_block.js.map +1 -1
- package/dist/src/components/code/code_block/code_block.styled.d.ts.map +1 -1
- package/dist/src/components/code/code_block/code_block.styled.js +18 -15
- package/dist/src/components/code/code_block/code_block.styled.js.map +1 -1
- package/dist/src/components/code/code_block/code_block_with_tabs.d.ts.map +1 -1
- package/dist/src/components/code/code_block/code_block_with_tabs.js +10 -8
- package/dist/src/components/code/code_block/code_block_with_tabs.js.map +1 -1
- package/dist/src/components/code/code_block/utils.d.ts.map +1 -1
- package/dist/src/components/code/code_block/utils.js.map +1 -1
- package/dist/src/components/code/inline_code/inline_code.d.ts.map +1 -1
- package/dist/src/components/code/inline_code/inline_code.js +2 -2
- package/dist/src/components/code/inline_code/inline_code.js.map +1 -1
- package/dist/src/components/code/one_light_theme.d.ts.map +1 -1
- package/dist/src/components/code/one_light_theme.js +2 -17
- package/dist/src/components/code/one_light_theme.js.map +1 -1
- package/dist/src/components/code/one_line_code/one_line_code.d.ts.map +1 -1
- package/dist/src/components/code/one_line_code/one_line_code.js +11 -14
- package/dist/src/components/code/one_line_code/one_line_code.js.map +1 -1
- package/dist/src/components/code/prism_highlighter.d.ts.map +1 -1
- package/dist/src/components/code/prism_highlighter.js +35 -27
- package/dist/src/components/code/prism_highlighter.js.map +1 -1
- package/dist/src/components/code/prism_python.js.map +1 -1
- package/dist/src/components/collapsible_card/collapsible_card.d.ts.map +1 -1
- package/dist/src/components/collapsible_card/collapsible_card.js +7 -6
- package/dist/src/components/collapsible_card/collapsible_card.js.map +1 -1
- package/dist/src/components/color_wheel_gradient.d.ts.map +1 -1
- package/dist/src/components/color_wheel_gradient.js +4 -2
- package/dist/src/components/color_wheel_gradient.js.map +1 -1
- package/dist/src/components/floating/floating_component_base.d.ts +1 -1
- package/dist/src/components/floating/floating_component_base.d.ts.map +1 -1
- package/dist/src/components/floating/floating_component_base.js +3 -5
- package/dist/src/components/floating/floating_component_base.js.map +1 -1
- package/dist/src/components/floating/menu.d.ts.map +1 -1
- package/dist/src/components/floating/menu.js +11 -5
- package/dist/src/components/floating/menu.js.map +1 -1
- package/dist/src/components/floating/menu_common.d.ts +4 -4
- package/dist/src/components/floating/menu_common.d.ts.map +1 -1
- package/dist/src/components/floating/menu_common.js +1 -1
- package/dist/src/components/floating/menu_common.js.map +1 -1
- package/dist/src/components/floating/menu_components.d.ts.map +1 -1
- package/dist/src/components/floating/menu_components.js +9 -7
- package/dist/src/components/floating/menu_components.js.map +1 -1
- package/dist/src/components/floating/tooltip.d.ts +2 -2
- package/dist/src/components/floating/tooltip.d.ts.map +1 -1
- package/dist/src/components/floating/tooltip.js +10 -9
- package/dist/src/components/floating/tooltip.js.map +1 -1
- package/dist/src/components/floating/tooltip_content.d.ts.map +1 -1
- package/dist/src/components/floating/tooltip_content.js +3 -3
- package/dist/src/components/floating/tooltip_content.js.map +1 -1
- package/dist/src/components/icon_button.d.ts.map +1 -1
- package/dist/src/components/icon_button.js +10 -8
- package/dist/src/components/icon_button.js.map +1 -1
- package/dist/src/components/image.d.ts.map +1 -1
- package/dist/src/components/image.js +1 -1
- package/dist/src/components/image.js.map +1 -1
- package/dist/src/components/link.d.ts.map +1 -1
- package/dist/src/components/link.js +5 -5
- package/dist/src/components/link.js.map +1 -1
- package/dist/src/components/message.d.ts.map +1 -1
- package/dist/src/components/message.js +21 -21
- package/dist/src/components/message.js.map +1 -1
- package/dist/src/components/rating.d.ts.map +1 -1
- package/dist/src/components/rating.js +5 -6
- package/dist/src/components/rating.js.map +1 -1
- package/dist/src/components/readme_renderer/pythonize_value.d.ts.map +1 -1
- package/dist/src/components/readme_renderer/pythonize_value.js +10 -6
- package/dist/src/components/readme_renderer/pythonize_value.js.map +1 -1
- package/dist/src/components/readme_renderer/table_of_contents.d.ts.map +1 -1
- package/dist/src/components/readme_renderer/table_of_contents.js +16 -15
- package/dist/src/components/readme_renderer/table_of_contents.js.map +1 -1
- package/dist/src/components/readme_renderer/utils.d.ts.map +1 -1
- package/dist/src/components/readme_renderer/utils.js +6 -6
- package/dist/src/components/readme_renderer/utils.js.map +1 -1
- package/dist/src/components/select/select.d.ts.map +1 -1
- package/dist/src/components/select/select.js +14 -13
- package/dist/src/components/select/select.js.map +1 -1
- package/dist/src/components/shortcut.d.ts +1 -1
- package/dist/src/components/shortcut.d.ts.map +1 -1
- package/dist/src/components/shortcut.js +2 -2
- package/dist/src/components/shortcut.js.map +1 -1
- package/dist/src/components/simple_markdown/simple_markdown.d.ts.map +1 -1
- package/dist/src/components/simple_markdown/simple_markdown.js +32 -35
- package/dist/src/components/simple_markdown/simple_markdown.js.map +1 -1
- package/dist/src/components/simple_markdown/simple_markdown_components.d.ts.map +1 -1
- package/dist/src/components/simple_markdown/simple_markdown_components.js +26 -12
- package/dist/src/components/simple_markdown/simple_markdown_components.js.map +1 -1
- package/dist/src/components/spinner.d.ts.map +1 -1
- package/dist/src/components/spinner.js +3 -1
- package/dist/src/components/spinner.js.map +1 -1
- package/dist/src/components/store/store_actor_header.d.ts.map +1 -1
- package/dist/src/components/store/store_actor_header.js +1 -1
- package/dist/src/components/store/store_actor_header.js.map +1 -1
- package/dist/src/components/switch/switch.d.ts.map +1 -1
- package/dist/src/components/switch/switch.js +1 -1
- package/dist/src/components/switch/switch.js.map +1 -1
- package/dist/src/components/switch/switch.style.d.ts.map +1 -1
- package/dist/src/components/switch/switch.style.js +5 -3
- package/dist/src/components/switch/switch.style.js.map +1 -1
- package/dist/src/components/table/table.styled.js +3 -3
- package/dist/src/components/table/table.styled.js.map +1 -1
- package/dist/src/components/table/table_error_row.d.ts.map +1 -1
- package/dist/src/components/table/table_error_row.js +1 -1
- package/dist/src/components/table/table_error_row.js.map +1 -1
- package/dist/src/components/table/table_row.d.ts.map +1 -1
- package/dist/src/components/table/table_row.js +1 -1
- package/dist/src/components/table/table_row.js.map +1 -1
- package/dist/src/components/table/table_wrapper.d.ts.map +1 -1
- package/dist/src/components/table/table_wrapper.js +3 -3
- package/dist/src/components/table/table_wrapper.js.map +1 -1
- package/dist/src/components/tabs/tab.d.ts.map +1 -1
- package/dist/src/components/tabs/tab.js +7 -5
- package/dist/src/components/tabs/tab.js.map +1 -1
- package/dist/src/components/tabs/tabs.d.ts.map +1 -1
- package/dist/src/components/tabs/tabs.js +3 -3
- package/dist/src/components/tabs/tabs.js.map +1 -1
- package/dist/src/components/tag.d.ts +1 -1
- package/dist/src/components/tag.d.ts.map +1 -1
- package/dist/src/components/tag.js +1 -1
- package/dist/src/components/tag.js.map +1 -1
- package/dist/src/components/text/heading_content.d.ts.map +1 -1
- package/dist/src/components/text/heading_content.js +1 -1
- package/dist/src/components/text/heading_content.js.map +1 -1
- package/dist/src/components/text/heading_marketing.d.ts.map +1 -1
- package/dist/src/components/text/heading_marketing.js +1 -1
- package/dist/src/components/text/heading_marketing.js.map +1 -1
- package/dist/src/components/text/heading_shared.d.ts.map +1 -1
- package/dist/src/components/text/heading_shared.js +1 -1
- package/dist/src/components/text/heading_shared.js.map +1 -1
- package/dist/src/components/text/index.d.ts +1 -1
- package/dist/src/components/text/index.d.ts.map +1 -1
- package/dist/src/components/text/text_base.d.ts.map +1 -1
- package/dist/src/components/text/text_base.js +16 -12
- package/dist/src/components/text/text_base.js.map +1 -1
- package/dist/src/components/text/text_content.d.ts.map +1 -1
- package/dist/src/components/text/text_content.js +1 -1
- package/dist/src/components/text/text_content.js.map +1 -1
- package/dist/src/components/text/text_marketing.d.ts.map +1 -1
- package/dist/src/components/text/text_marketing.js +1 -1
- package/dist/src/components/text/text_marketing.js.map +1 -1
- package/dist/src/components/text/text_shared.d.ts +1 -1
- package/dist/src/components/text/text_shared.d.ts.map +1 -1
- package/dist/src/components/text/text_shared.js +1 -1
- package/dist/src/components/text/text_shared.js.map +1 -1
- package/dist/src/components/tile/horizontal_tile.d.ts.map +1 -1
- package/dist/src/components/tile/horizontal_tile.js +3 -2
- package/dist/src/components/tile/horizontal_tile.js.map +1 -1
- package/dist/src/components/tile/shared.d.ts +1 -1
- package/dist/src/components/tile/shared.d.ts.map +1 -1
- package/dist/src/components/tile/vertical_tile.d.ts.map +1 -1
- package/dist/src/components/tile/vertical_tile.js +3 -2
- package/dist/src/components/tile/vertical_tile.js.map +1 -1
- package/dist/src/components/to_consolidate/card.d.ts.map +1 -1
- package/dist/src/components/to_consolidate/card.js +20 -15
- package/dist/src/components/to_consolidate/card.js.map +1 -1
- package/dist/src/components/to_consolidate/markdown.d.ts.map +1 -1
- package/dist/src/components/to_consolidate/markdown.js +36 -20
- package/dist/src/components/to_consolidate/markdown.js.map +1 -1
- package/dist/src/components/to_consolidate/pagination.d.ts.map +1 -1
- package/dist/src/components/to_consolidate/pagination.js +6 -6
- package/dist/src/components/to_consolidate/pagination.js.map +1 -1
- package/dist/src/components/to_consolidate/tab_number_chip.d.ts.map +1 -1
- package/dist/src/components/to_consolidate/tab_number_chip.js +1 -1
- package/dist/src/components/to_consolidate/tab_number_chip.js.map +1 -1
- package/dist/src/design_system/theme.d.ts.map +1 -1
- package/dist/src/design_system/theme.js +1 -1
- package/dist/src/design_system/theme.js.map +1 -1
- package/dist/src/design_system/typography_theme.d.ts.map +1 -1
- package/dist/src/design_system/typography_theme.js.map +1 -1
- package/dist/src/ui_dependency_provider.d.ts.map +1 -1
- package/dist/src/ui_dependency_provider.js +2 -2
- package/dist/src/ui_dependency_provider.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +8 -6
- package/src/codemods/generate_typograpy_tokens_files.mjs +23 -28
- package/src/components/action_link.tsx +13 -23
- package/src/components/actor_template_card.stories.tsx +20 -14
- package/src/components/actor_template_card.tsx +4 -21
- package/src/components/avatar/actor_avatar.tsx +3 -4
- package/src/components/avatar/boring_avatar.tsx +134 -167
- package/src/components/avatar/user_avatar.stories.tsx +1 -5
- package/src/components/avatar/user_avatar.tsx +6 -20
- package/src/components/badge.stories.jsx +26 -40
- package/src/components/badge.tsx +37 -26
- package/src/components/banner.stories.tsx +10 -28
- package/src/components/banner.tsx +11 -14
- package/src/components/blog_article.tsx +6 -4
- package/src/components/box.tsx +90 -89
- package/src/components/breadcrumb/breadcrumb.stories.tsx +2 -8
- package/src/components/breadcrumb/breadcrumb.tsx +7 -5
- package/src/components/button.stories.tsx +70 -66
- package/src/components/button.tsx +33 -39
- package/src/components/card_container.stories.tsx +28 -29
- package/src/components/card_container.tsx +15 -10
- package/src/components/checkbox/checkbox.stories.tsx +52 -17
- package/src/components/checkbox/checkbox.style.ts +7 -4
- package/src/components/checkbox/checkbox.tsx +6 -9
- package/src/components/chip.stories.tsx +15 -5
- package/src/components/chip.tsx +26 -16
- package/src/components/code/action_button.tsx +10 -12
- package/src/components/code/code_block/code_block.stories.jsx +7 -25
- package/src/components/code/code_block/code_block.styled.tsx +26 -19
- package/src/components/code/code_block/code_block.tsx +26 -24
- package/src/components/code/code_block/code_block_with_tabs.stories.tsx +12 -18
- package/src/components/code/code_block/code_block_with_tabs.tsx +30 -16
- package/src/components/code/code_block/utils.tsx +23 -15
- package/src/components/code/inline_code/inline_code.stories.tsx +18 -10
- package/src/components/code/inline_code/inline_code.tsx +16 -21
- package/src/components/code/one_light_theme.ts +2 -17
- package/src/components/code/one_line_code/one_line_code.stories.tsx +31 -19
- package/src/components/code/one_line_code/one_line_code.tsx +19 -30
- package/src/components/code/prism_highlighter.tsx +117 -109
- package/src/components/code/prism_python.ts +4 -2
- package/src/components/collapsible_card/collapsible_card.stories.tsx +2 -1
- package/src/components/collapsible_card/collapsible_card.tsx +30 -15
- package/src/components/color_wheel_gradient.tsx +9 -7
- package/src/components/floating/floating_component_base.tsx +16 -9
- package/src/components/floating/menu.tsx +37 -46
- package/src/components/floating/menu_common.tsx +24 -30
- package/src/components/floating/menu_components.tsx +24 -24
- package/src/components/floating/tooltip.stories.jsx +85 -68
- package/src/components/floating/tooltip.tsx +32 -39
- package/src/components/floating/tooltip_content.tsx +8 -16
- package/src/components/icon_button.stories.tsx +176 -188
- package/src/components/icon_button.tsx +72 -58
- package/src/components/image.tsx +5 -11
- package/src/components/link.stories.tsx +4 -2
- package/src/components/link.tsx +70 -70
- package/src/components/message.stories.jsx +35 -33
- package/src/components/message.tsx +45 -45
- package/src/components/rating.tsx +37 -44
- package/src/components/readme_renderer/pythonize_value.ts +19 -7
- package/src/components/readme_renderer/table_of_contents.stories.tsx +40 -15
- package/src/components/readme_renderer/table_of_contents.tsx +87 -85
- package/src/components/readme_renderer/utils.tsx +17 -13
- package/src/components/select/select.stories.tsx +19 -46
- package/src/components/select/select.tsx +103 -101
- package/src/components/shortcut.stories.jsx +23 -14
- package/src/components/shortcut.tsx +2 -13
- package/src/components/simple_markdown/simple_markdown.stories.tsx +5 -10
- package/src/components/simple_markdown/simple_markdown.tsx +152 -55
- package/src/components/simple_markdown/simple_markdown_components.tsx +49 -59
- package/src/components/spinner.stories.tsx +14 -8
- package/src/components/spinner.tsx +5 -3
- package/src/components/store/store_actor_header.stories.tsx +2 -11
- package/src/components/store/store_actor_header.tsx +20 -16
- package/src/components/switch/switch.stories.jsx +4 -12
- package/src/components/switch/switch.style.ts +5 -3
- package/src/components/switch/switch.tsx +3 -13
- package/src/components/table/table.stories.tsx +5 -2
- package/src/components/table/table.styled.ts +3 -3
- package/src/components/table/table_error_row.tsx +5 -1
- package/src/components/table/table_row.tsx +1 -5
- package/src/components/table/table_wrapper.tsx +12 -12
- package/src/components/tabs/tab.stories.tsx +1 -5
- package/src/components/tabs/tab.tsx +33 -13
- package/src/components/tabs/tabs.tsx +14 -18
- package/src/components/tag.stories.jsx +35 -45
- package/src/components/tag.tsx +18 -22
- package/src/components/text/heading_content.stories.tsx +13 -24
- package/src/components/text/heading_content.tsx +3 -7
- package/src/components/text/heading_marketing.stories.tsx +4 -3
- package/src/components/text/heading_marketing.tsx +12 -8
- package/src/components/text/heading_shared.stories.tsx +3 -2
- package/src/components/text/heading_shared.tsx +3 -7
- package/src/components/text/index.ts +1 -3
- package/src/components/text/text_base.tsx +29 -35
- package/src/components/text/text_content.stories.tsx +17 -13
- package/src/components/text/text_content.tsx +20 -23
- package/src/components/text/text_marketing.stories.tsx +4 -3
- package/src/components/text/text_marketing.tsx +20 -23
- package/src/components/text/text_shared.stories.tsx +4 -3
- package/src/components/text/text_shared.tsx +23 -27
- package/src/components/tile/horizontal_tile.stories.tsx +6 -2
- package/src/components/tile/horizontal_tile.tsx +5 -15
- package/src/components/tile/shared.ts +5 -5
- package/src/components/tile/vertical_tile.stories.tsx +10 -18
- package/src/components/tile/vertical_tile.tsx +4 -9
- package/src/components/to_consolidate/card.stories.tsx +3 -1
- package/src/components/to_consolidate/card.tsx +67 -58
- package/src/components/to_consolidate/markdown.tsx +76 -62
- package/src/components/to_consolidate/pagination.tsx +11 -15
- package/src/components/to_consolidate/tab_number_chip.tsx +5 -6
- package/src/design_system/colors/build_color_tokens.js +7 -15
- package/src/design_system/theme.ts +1 -8
- package/src/design_system/tokens/radiuses.stories.tsx +9 -1
- package/src/design_system/tokens/shadows.stories.tsx +3 -1
- package/src/design_system/typography_theme.ts +78 -39
- package/src/ui_dependency_provider.tsx +16 -23
|
@@ -23,10 +23,10 @@ export interface TransientButtonProps {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export interface RegularButtonProps {
|
|
26
|
-
trackingId?: string
|
|
27
|
-
trackingData?: Record<string, unknown
|
|
28
|
-
LeftIcon?: React.ElementType
|
|
29
|
-
RightIcon?: React.ElementType
|
|
26
|
+
trackingId?: string;
|
|
27
|
+
trackingData?: Record<string, unknown>;
|
|
28
|
+
LeftIcon?: React.ElementType;
|
|
29
|
+
RightIcon?: React.ElementType;
|
|
30
30
|
disabled?: boolean;
|
|
31
31
|
type?: ButtonType;
|
|
32
32
|
}
|
|
@@ -48,34 +48,34 @@ function isAnchorButton(props: ButtonProps | AnchorButtonProps): props is Anchor
|
|
|
48
48
|
type ButtonColorCombinations = {
|
|
49
49
|
[Type in ButtonVariant]: {
|
|
50
50
|
[Size in ButtonColor]: {
|
|
51
|
-
textColor: string
|
|
52
|
-
borderColor: string
|
|
53
|
-
backgroundColor: string
|
|
51
|
+
textColor: string;
|
|
52
|
+
borderColor: string;
|
|
53
|
+
backgroundColor: string;
|
|
54
54
|
|
|
55
55
|
// hover & active state effects
|
|
56
|
-
actionTextColor?: string
|
|
56
|
+
actionTextColor?: string;
|
|
57
57
|
// only exception is primary outlined button
|
|
58
|
-
actionBorderColor?: string
|
|
58
|
+
actionBorderColor?: string;
|
|
59
59
|
|
|
60
60
|
// hover state effects override
|
|
61
|
-
hoverColor?: string
|
|
61
|
+
hoverColor?: string;
|
|
62
62
|
// Optional gradient overlay on hover (e.g., for primaryBlack)
|
|
63
|
-
hoverGradient?: string
|
|
63
|
+
hoverGradient?: string;
|
|
64
64
|
|
|
65
65
|
// active state effects override
|
|
66
|
-
activeColor?: string
|
|
67
|
-
activeTextColor?: string
|
|
68
|
-
}
|
|
66
|
+
activeColor?: string;
|
|
67
|
+
activeTextColor?: string;
|
|
68
|
+
};
|
|
69
69
|
};
|
|
70
70
|
};
|
|
71
71
|
|
|
72
72
|
type ButtonSizeCombinations = {
|
|
73
73
|
[Size in ButtonSize]: {
|
|
74
|
-
typography: string
|
|
75
|
-
size: number
|
|
76
|
-
horizontalPadding: number
|
|
77
|
-
borderRadius: string
|
|
78
|
-
iconSize: IconSize
|
|
74
|
+
typography: string;
|
|
75
|
+
size: number;
|
|
76
|
+
horizontalPadding: number;
|
|
77
|
+
borderRadius: string;
|
|
78
|
+
iconSize: IconSize;
|
|
79
79
|
};
|
|
80
80
|
};
|
|
81
81
|
|
|
@@ -236,12 +236,13 @@ export const getButtonColorStyles = (variant: ButtonVariant = 'primary', color:
|
|
|
236
236
|
&:hover {
|
|
237
237
|
color: ${actionTextColor || textColor};
|
|
238
238
|
${hoverGradient
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
239
|
+
? css`
|
|
240
|
+
background-image: ${hoverGradient};
|
|
241
|
+
background-color: ${backgroundColor};
|
|
242
|
+
`
|
|
243
|
+
: css`
|
|
244
|
+
background-color: ${hoverColor};
|
|
245
|
+
`}
|
|
245
246
|
border-color: ${actionBorderColor || (hoverGradient ? borderColor : hoverColor)};
|
|
246
247
|
}
|
|
247
248
|
|
|
@@ -263,12 +264,7 @@ export const getButtonColorStyles = (variant: ButtonVariant = 'primary', color:
|
|
|
263
264
|
};
|
|
264
265
|
|
|
265
266
|
export const getButtonSizeStyles = (size: ButtonSize = 'medium') => {
|
|
266
|
-
const {
|
|
267
|
-
typography,
|
|
268
|
-
size: height,
|
|
269
|
-
horizontalPadding,
|
|
270
|
-
borderRadius,
|
|
271
|
-
} = BUTTON_SIZE_VARIANTS_CSS[size];
|
|
267
|
+
const { typography, size: height, horizontalPadding, borderRadius } = BUTTON_SIZE_VARIANTS_CSS[size];
|
|
272
268
|
|
|
273
269
|
return css`
|
|
274
270
|
${typography};
|
|
@@ -276,7 +272,6 @@ export const getButtonSizeStyles = (size: ButtonSize = 'medium') => {
|
|
|
276
272
|
/* We just want to ensure padding on the sides. Height is set the the hard way for simplicity */
|
|
277
273
|
padding: 0 ${horizontalPadding}px;
|
|
278
274
|
border-radius: ${borderRadius};
|
|
279
|
-
|
|
280
275
|
`;
|
|
281
276
|
};
|
|
282
277
|
|
|
@@ -292,7 +287,9 @@ const StyledButton = styled(Box)<WithTransientProps<Required<TransientButtonProp
|
|
|
292
287
|
/* Basic styles */
|
|
293
288
|
white-space: nowrap;
|
|
294
289
|
cursor: pointer;
|
|
295
|
-
transition:
|
|
290
|
+
transition:
|
|
291
|
+
border-color ${theme.transition.fastEaseOut},
|
|
292
|
+
background-color ${theme.transition.fastEaseOut};
|
|
296
293
|
|
|
297
294
|
/* Border is always defined, but it can be set to transparent */
|
|
298
295
|
border-style: solid;
|
|
@@ -322,10 +319,7 @@ export const Button = forwardRef<HTMLElement, ButtonProps | AnchorButtonProps>((
|
|
|
322
319
|
...rest
|
|
323
320
|
} = props;
|
|
324
321
|
|
|
325
|
-
const {
|
|
326
|
-
trackClick,
|
|
327
|
-
windowLocationHost,
|
|
328
|
-
} = useSharedUiDependencies();
|
|
322
|
+
const { trackClick, windowLocationHost } = useSharedUiDependencies();
|
|
329
323
|
const trackedOnClick = (e: React.MouseEvent) => {
|
|
330
324
|
if (trackClick && trackingId) trackClick(trackingId, trackingData);
|
|
331
325
|
if (onClick) onClick(e);
|
|
@@ -335,7 +329,7 @@ export const Button = forwardRef<HTMLElement, ButtonProps | AnchorButtonProps>((
|
|
|
335
329
|
|
|
336
330
|
if (isAnchorButton(props)) {
|
|
337
331
|
const isExternal = isUrlExternal(props.to, windowLocationHost);
|
|
338
|
-
const EffectiveRightIcon =
|
|
332
|
+
const EffectiveRightIcon = isExternal && !props.hideExternalIcon ? ExternalLinkIcon : RightIcon;
|
|
339
333
|
|
|
340
334
|
return (
|
|
341
335
|
<StyledButton
|
|
@@ -363,7 +357,7 @@ export const Button = forwardRef<HTMLElement, ButtonProps | AnchorButtonProps>((
|
|
|
363
357
|
$size={size}
|
|
364
358
|
$color={color}
|
|
365
359
|
$variant={variant}
|
|
366
|
-
forwardedAs={
|
|
360
|
+
forwardedAs={as || 'button'}
|
|
367
361
|
ref={ref}
|
|
368
362
|
onClick={trackedOnClick}
|
|
369
363
|
type={type}
|
|
@@ -40,35 +40,34 @@ export const Default: Story = {
|
|
|
40
40
|
header: 'Recently viewed',
|
|
41
41
|
},
|
|
42
42
|
render: (args: CardContainerProps) => {
|
|
43
|
-
return
|
|
44
|
-
<
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
</StoryWrapper>;
|
|
43
|
+
return (
|
|
44
|
+
<StoryWrapper>
|
|
45
|
+
<CardContainer {...args} />
|
|
46
|
+
<CardContainer {...args} headerPlacement="BOTTOM" />
|
|
47
|
+
<CardContainer
|
|
48
|
+
{...args}
|
|
49
|
+
header={
|
|
50
|
+
<>
|
|
51
|
+
<CardContainer.Heading>Test</CardContainer.Heading>
|
|
52
|
+
<IconButton Icon={DragIndicatorIcon} />
|
|
53
|
+
</>
|
|
54
|
+
}
|
|
55
|
+
/>
|
|
56
|
+
<CardContainer
|
|
57
|
+
{...args}
|
|
58
|
+
header={
|
|
59
|
+
<div>
|
|
60
|
+
<CardContainer.Heading># Videos with this hashtag</CardContainer.Heading>
|
|
61
|
+
<code style={{ marginLeft: 8 }}>Required</code>
|
|
62
|
+
</div>
|
|
63
|
+
}
|
|
64
|
+
/>
|
|
65
|
+
<CardContainer {...args} header={<>Completely custom header content</>} />
|
|
66
|
+
<CardContainer {...args} header={null}>
|
|
67
|
+
Content without header
|
|
68
|
+
</CardContainer>
|
|
69
|
+
</StoryWrapper>
|
|
70
|
+
);
|
|
72
71
|
},
|
|
73
72
|
play: async ({ canvasElement }) => {
|
|
74
73
|
const headers = canvasElement.querySelectorAll(`.${cardContainerClassNames.HEADER}`);
|
|
@@ -25,19 +25,24 @@ const getContentPadding = (contentPadding?: ContentPaddingValue) => {
|
|
|
25
25
|
return theme.space.space16;
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
const Wrapper = styled(Box)<{
|
|
28
|
+
const Wrapper = styled(Box)<{
|
|
29
|
+
$headerPlacement: ValueOf<typeof HEADER_PLACEMENT>;
|
|
30
|
+
$contentPadding?: ContentPaddingValue;
|
|
31
|
+
}>`
|
|
29
32
|
background-color: ${theme.color.neutral.backgroundSubtle};
|
|
30
33
|
border-radius: ${theme.radius.radius12};
|
|
31
34
|
|
|
32
35
|
padding: ${theme.space.space2};
|
|
33
36
|
|
|
34
37
|
display: flex;
|
|
35
|
-
flex-direction: ${({ $headerPlacement }) =>
|
|
38
|
+
flex-direction: ${({ $headerPlacement }) =>
|
|
39
|
+
$headerPlacement === HEADER_PLACEMENT.TOP ? 'column' : 'column-reverse'};
|
|
36
40
|
|
|
37
41
|
.${cardContainerClassNames.CONTENT} {
|
|
38
42
|
/* 11px inner radius to match Figma (outer 12px - 1px visual offset) */
|
|
39
43
|
border-radius: 1.1rem;
|
|
40
|
-
background-color: ${({ $contentPadding }) =>
|
|
44
|
+
background-color: ${({ $contentPadding }) =>
|
|
45
|
+
$contentPadding === 'none' ? 'transparent' : theme.color.neutral.background};
|
|
41
46
|
${({ $contentPadding }) => $contentPadding === 'none' && 'overflow: hidden;'}
|
|
42
47
|
|
|
43
48
|
padding: ${({ $contentPadding }) => getContentPadding($contentPadding)};
|
|
@@ -52,17 +57,19 @@ const Wrapper = styled(Box)<{ $headerPlacement: ValueOf<typeof HEADER_PLACEMENT>
|
|
|
52
57
|
}
|
|
53
58
|
`;
|
|
54
59
|
|
|
55
|
-
const CardContainerHeading = styled.span
|
|
60
|
+
const CardContainerHeading = styled.span`
|
|
61
|
+
${theme.typography.shared.desktop.bodyMMedium}
|
|
62
|
+
`;
|
|
56
63
|
|
|
57
64
|
export type CardContainerProps = BoxProps & {
|
|
58
65
|
/** The header can be placed on the bottom of the card or on the top. */
|
|
59
|
-
headerPlacement?: ValueOf<typeof HEADER_PLACEMENT
|
|
66
|
+
headerPlacement?: ValueOf<typeof HEADER_PLACEMENT>;
|
|
60
67
|
/**
|
|
61
68
|
* If string is passed, the correct styles are applied automatically.
|
|
62
69
|
* In case of custom component, use `CardContainer.Heading` component to get the same styles.
|
|
63
70
|
* Pass `null` to render without a header section.
|
|
64
71
|
*/
|
|
65
|
-
header: React.ReactNode
|
|
72
|
+
header: React.ReactNode;
|
|
66
73
|
/**
|
|
67
74
|
* Controls the padding of the content area. Accepts a space token or `'none'`.
|
|
68
75
|
* When set to `'none'`, padding is removed, the content background becomes transparent
|
|
@@ -70,7 +77,7 @@ export type CardContainerProps = BoxProps & {
|
|
|
70
77
|
* Other values (e.g. `'space8'`) change the padding but keep the white background.
|
|
71
78
|
* Defaults to `space16` with white background when not provided.
|
|
72
79
|
*/
|
|
73
|
-
contentPadding?: ContentPaddingValue
|
|
80
|
+
contentPadding?: ContentPaddingValue;
|
|
74
81
|
};
|
|
75
82
|
|
|
76
83
|
/**
|
|
@@ -91,9 +98,7 @@ export const CardContainer = ({
|
|
|
91
98
|
{typeof header === 'string' ? <CardContainerHeading>{header}</CardContainerHeading> : header}
|
|
92
99
|
</div>
|
|
93
100
|
)}
|
|
94
|
-
<div className={cardContainerClassNames.CONTENT}>
|
|
95
|
-
{children}
|
|
96
|
-
</div>
|
|
101
|
+
<div className={cardContainerClassNames.CONTENT}>{children}</div>
|
|
97
102
|
</Wrapper>
|
|
98
103
|
);
|
|
99
104
|
|
|
@@ -20,7 +20,10 @@ const Row = styled.div`
|
|
|
20
20
|
gap: 0.8rem;
|
|
21
21
|
`;
|
|
22
22
|
|
|
23
|
-
type ControlledCheckboxProps = { initialValue?: boolean } & Omit<
|
|
23
|
+
type ControlledCheckboxProps = { initialValue?: boolean } & Omit<
|
|
24
|
+
ComponentProps<typeof CheckboxPrimitive>,
|
|
25
|
+
'value' | 'setValue'
|
|
26
|
+
>;
|
|
24
27
|
|
|
25
28
|
const ControlledCheckbox = ({ initialValue = false, ...props }: ControlledCheckboxProps) => {
|
|
26
29
|
const [value, setValue] = useState(initialValue);
|
|
@@ -29,13 +32,27 @@ const ControlledCheckbox = ({ initialValue = false, ...props }: ControlledCheckb
|
|
|
29
32
|
|
|
30
33
|
export const States = () => (
|
|
31
34
|
<Grid>
|
|
32
|
-
<Row
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
<Row
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
<Row
|
|
35
|
+
<Row>
|
|
36
|
+
<ControlledCheckbox /> Unchecked
|
|
37
|
+
</Row>
|
|
38
|
+
<Row>
|
|
39
|
+
<ControlledCheckbox initialValue /> Checked
|
|
40
|
+
</Row>
|
|
41
|
+
<Row>
|
|
42
|
+
<ControlledCheckbox disabled /> Disabled
|
|
43
|
+
</Row>
|
|
44
|
+
<Row>
|
|
45
|
+
<ControlledCheckbox initialValue disabled /> Checked & disabled
|
|
46
|
+
</Row>
|
|
47
|
+
<Row>
|
|
48
|
+
<ControlledCheckbox readOnly initialValue /> Checked & readonly
|
|
49
|
+
</Row>
|
|
50
|
+
<Row>
|
|
51
|
+
<ControlledCheckbox error="Some error" /> Error
|
|
52
|
+
</Row>
|
|
53
|
+
<Row>
|
|
54
|
+
<ControlledCheckbox initialValue error="Some error" /> Checked + error
|
|
55
|
+
</Row>
|
|
39
56
|
</Grid>
|
|
40
57
|
);
|
|
41
58
|
|
|
@@ -59,19 +76,37 @@ export const Indeterminate = () => {
|
|
|
59
76
|
</Row>
|
|
60
77
|
|
|
61
78
|
<SectionLabel>Indeterminate</SectionLabel>
|
|
62
|
-
<Row
|
|
63
|
-
|
|
64
|
-
|
|
79
|
+
<Row>
|
|
80
|
+
<IndeterminateCheckbox value={null} setValue={() => {}} /> Default
|
|
81
|
+
</Row>
|
|
82
|
+
<Row>
|
|
83
|
+
<IndeterminateCheckbox value={null} setValue={() => {}} disabled /> Disabled
|
|
84
|
+
</Row>
|
|
85
|
+
<Row>
|
|
86
|
+
<IndeterminateCheckbox value={null} setValue={() => {}} error="Some error" /> Error
|
|
87
|
+
</Row>
|
|
65
88
|
|
|
66
89
|
<SectionLabel>Checked</SectionLabel>
|
|
67
|
-
<Row
|
|
68
|
-
|
|
69
|
-
|
|
90
|
+
<Row>
|
|
91
|
+
<IndeterminateCheckbox value={true} setValue={() => {}} /> Default
|
|
92
|
+
</Row>
|
|
93
|
+
<Row>
|
|
94
|
+
<IndeterminateCheckbox value={true} setValue={() => {}} disabled /> Disabled
|
|
95
|
+
</Row>
|
|
96
|
+
<Row>
|
|
97
|
+
<IndeterminateCheckbox value={true} setValue={() => {}} error="Some error" /> Error
|
|
98
|
+
</Row>
|
|
70
99
|
|
|
71
100
|
<SectionLabel>Unchecked</SectionLabel>
|
|
72
|
-
<Row
|
|
73
|
-
|
|
74
|
-
|
|
101
|
+
<Row>
|
|
102
|
+
<IndeterminateCheckbox value={false} setValue={() => {}} /> Default
|
|
103
|
+
</Row>
|
|
104
|
+
<Row>
|
|
105
|
+
<IndeterminateCheckbox value={false} setValue={() => {}} disabled /> Disabled
|
|
106
|
+
</Row>
|
|
107
|
+
<Row>
|
|
108
|
+
<IndeterminateCheckbox value={false} setValue={() => {}} error="Some error" /> Error
|
|
109
|
+
</Row>
|
|
75
110
|
</Grid>
|
|
76
111
|
);
|
|
77
112
|
};
|
|
@@ -14,9 +14,12 @@ export const checkboxStyle = css`
|
|
|
14
14
|
height: 16px;
|
|
15
15
|
position: relative;
|
|
16
16
|
box-sizing: border-box;
|
|
17
|
-
transition:
|
|
17
|
+
transition:
|
|
18
|
+
border-color 120ms ease-out,
|
|
19
|
+
background-color 120ms ease-out !important;
|
|
18
20
|
|
|
19
|
-
&:hover,
|
|
21
|
+
&:hover,
|
|
22
|
+
&:focus {
|
|
20
23
|
border-color: ${theme.color.primary.action};
|
|
21
24
|
cursor: pointer;
|
|
22
25
|
}
|
|
@@ -30,8 +33,8 @@ export const checkboxStyle = css`
|
|
|
30
33
|
border-color: ${theme.color.danger.text};
|
|
31
34
|
}
|
|
32
35
|
|
|
33
|
-
&[data-state=
|
|
34
|
-
&[data-state=
|
|
36
|
+
&[data-state='indeterminate'],
|
|
37
|
+
&[data-state='checked'] {
|
|
35
38
|
background-color: ${theme.color.primary.action};
|
|
36
39
|
border-color: ${theme.color.primary.action};
|
|
37
40
|
|
|
@@ -3,9 +3,7 @@ import clsx from 'clsx';
|
|
|
3
3
|
import { type ComponentPropsWithoutRef, type FC } from 'react';
|
|
4
4
|
import styled from 'styled-components';
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
CheckIcon, MinusIcon,
|
|
8
|
-
} from '@apify/ui-icons';
|
|
6
|
+
import { CheckIcon, MinusIcon } from '@apify/ui-icons';
|
|
9
7
|
|
|
10
8
|
import { theme } from '../../design_system/theme.js';
|
|
11
9
|
import { checkboxStyle } from './checkbox.style.js';
|
|
@@ -31,7 +29,10 @@ const IndeterminateIndicator = styled(StyledIndicator)`
|
|
|
31
29
|
color: ${theme.color.neutral.textOnPrimary};
|
|
32
30
|
`;
|
|
33
31
|
|
|
34
|
-
type CheckboxBaseProps = Omit<
|
|
32
|
+
type CheckboxBaseProps = Omit<
|
|
33
|
+
ComponentPropsWithoutRef<typeof CheckboxPrimitiveReact.Root>,
|
|
34
|
+
'checked' | 'onCheckedChange' | 'value'
|
|
35
|
+
> & {
|
|
35
36
|
setValue: (checked: boolean) => void;
|
|
36
37
|
error?: string;
|
|
37
38
|
disabled?: boolean;
|
|
@@ -56,11 +57,7 @@ const InternalCheckbox: FC<IndeterminateCheckboxProps> = ({
|
|
|
56
57
|
checked={value == null ? 'indeterminate' : value}
|
|
57
58
|
onCheckedChange={setValue}
|
|
58
59
|
disabled={disabled || readOnly}
|
|
59
|
-
className={clsx(
|
|
60
|
-
className,
|
|
61
|
-
error && 'error',
|
|
62
|
-
(disabled || readOnly) && 'disabled',
|
|
63
|
-
)}
|
|
60
|
+
className={clsx(className, error && 'error', (disabled || readOnly) && 'disabled')}
|
|
64
61
|
>
|
|
65
62
|
{children}
|
|
66
63
|
</StyledCheckbox>
|
|
@@ -291,11 +291,21 @@ export const AllSizes: Story = {
|
|
|
291
291
|
export const WithVariousIcons: Story = {
|
|
292
292
|
render: () => (
|
|
293
293
|
<div style={{ display: 'flex', gap: '8px', flexWrap: 'wrap' }}>
|
|
294
|
-
<Chip type={CHIP_TYPES.SUCCESS} icon={mockIcons.check}>
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
<Chip type={CHIP_TYPES.
|
|
298
|
-
|
|
294
|
+
<Chip type={CHIP_TYPES.SUCCESS} icon={mockIcons.check}>
|
|
295
|
+
Approved
|
|
296
|
+
</Chip>
|
|
297
|
+
<Chip type={CHIP_TYPES.WARNING} icon={mockIcons.warning}>
|
|
298
|
+
Pending
|
|
299
|
+
</Chip>
|
|
300
|
+
<Chip type={CHIP_TYPES.DANGER} icon={mockIcons.error}>
|
|
301
|
+
Failed
|
|
302
|
+
</Chip>
|
|
303
|
+
<Chip type={CHIP_TYPES.PRIMARY} icon={mockIcons.heart}>
|
|
304
|
+
Favorite
|
|
305
|
+
</Chip>
|
|
306
|
+
<Chip type={CHIP_TYPES.DEFAULT} icon={mockIcons.info}>
|
|
307
|
+
Info
|
|
308
|
+
</Chip>
|
|
299
309
|
</div>
|
|
300
310
|
),
|
|
301
311
|
};
|
package/src/components/chip.tsx
CHANGED
|
@@ -80,7 +80,7 @@ const chipTypeStyle = {
|
|
|
80
80
|
`,
|
|
81
81
|
} satisfies Record<CHIP_TYPES, unknown>;
|
|
82
82
|
|
|
83
|
-
const StyledChip = styled.span<{ size: CHIP_SIZES
|
|
83
|
+
const StyledChip = styled.span<{ size: CHIP_SIZES; type: CHIP_TYPES; clickable: boolean }>`
|
|
84
84
|
${({ size }) => chipSizeStyle[size]};
|
|
85
85
|
${({ type }) => chipTypeStyle[type]};
|
|
86
86
|
/* Static styles */
|
|
@@ -96,28 +96,38 @@ const StyledChip = styled.span<{ size: CHIP_SIZES, type: CHIP_TYPES, clickable:
|
|
|
96
96
|
`;
|
|
97
97
|
|
|
98
98
|
export type ChipProps = RegularBoxProps & {
|
|
99
|
-
type?: CHIP_TYPES
|
|
100
|
-
size?: CHIP_SIZES
|
|
101
|
-
icon?: React.ReactNode
|
|
102
|
-
clickable?: boolean
|
|
99
|
+
type?: CHIP_TYPES;
|
|
100
|
+
size?: CHIP_SIZES;
|
|
101
|
+
icon?: React.ReactNode;
|
|
102
|
+
clickable?: boolean;
|
|
103
103
|
};
|
|
104
104
|
|
|
105
105
|
/**
|
|
106
106
|
* Component for displaying status and for labelling other components.
|
|
107
107
|
* @deprecated Use Tag or Badge
|
|
108
108
|
*/
|
|
109
|
-
export const Chip = forwardRef(
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
109
|
+
export const Chip = forwardRef(
|
|
110
|
+
(
|
|
111
|
+
{
|
|
112
|
+
type = CHIP_TYPES.DEFAULT,
|
|
113
|
+
size = CHIP_SIZES.MEDIUM,
|
|
114
|
+
icon,
|
|
115
|
+
children,
|
|
116
|
+
className,
|
|
117
|
+
...passThroughProps
|
|
118
|
+
}: ChipProps,
|
|
119
|
+
ref,
|
|
120
|
+
) => {
|
|
121
|
+
const otherProps = { ...passThroughProps, type, size, className: clsx(className, classNames.BODY) };
|
|
118
122
|
|
|
119
|
-
|
|
120
|
-
}
|
|
123
|
+
return (
|
|
124
|
+
<StyledChip ref={ref} {...otherProps}>
|
|
125
|
+
{children}
|
|
126
|
+
{icon}
|
|
127
|
+
</StyledChip>
|
|
128
|
+
);
|
|
129
|
+
},
|
|
130
|
+
);
|
|
121
131
|
|
|
122
132
|
Chip.displayName = 'Chip';
|
|
123
133
|
|
|
@@ -38,8 +38,9 @@ const StyledButton = styled.button<StyledButtonProps>`
|
|
|
38
38
|
height: 2rem;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
${({ $hasText }) =>
|
|
42
|
-
&&
|
|
41
|
+
${({ $hasText }) =>
|
|
42
|
+
$hasText &&
|
|
43
|
+
css`
|
|
43
44
|
width: auto;
|
|
44
45
|
padding: ${theme.space.space4} ${theme.space.space8};
|
|
45
46
|
p {
|
|
@@ -47,8 +48,9 @@ const StyledButton = styled.button<StyledButtonProps>`
|
|
|
47
48
|
}
|
|
48
49
|
`}
|
|
49
50
|
|
|
50
|
-
${({ $successStyle }) =>
|
|
51
|
-
&&
|
|
51
|
+
${({ $successStyle }) =>
|
|
52
|
+
$successStyle &&
|
|
53
|
+
css`
|
|
52
54
|
background-color: ${theme.color.success.action};
|
|
53
55
|
color: ${theme.color.neutral.textOnPrimary};
|
|
54
56
|
border: none;
|
|
@@ -86,12 +88,7 @@ export const ActionButton = ({
|
|
|
86
88
|
};
|
|
87
89
|
|
|
88
90
|
return (
|
|
89
|
-
<StyledButton
|
|
90
|
-
$successStyle={successStyle}
|
|
91
|
-
$hasText={hasText}
|
|
92
|
-
onClick={trackedOnClick}
|
|
93
|
-
{...props}
|
|
94
|
-
>
|
|
91
|
+
<StyledButton $successStyle={successStyle} $hasText={hasText} onClick={trackedOnClick} {...props}>
|
|
95
92
|
{hasText ? <Text weight="bold">{children}</Text> : children}
|
|
96
93
|
</StyledButton>
|
|
97
94
|
);
|
|
@@ -108,9 +105,10 @@ export const CopyButton = ({ code, ...props }: CopyButtonProps) => {
|
|
|
108
105
|
return (
|
|
109
106
|
<ActionButton
|
|
110
107
|
onClick={async () => copyToClipboard(code)}
|
|
111
|
-
data-test=
|
|
108
|
+
data-test="copy_to_clipboard"
|
|
112
109
|
aria-label="Copy to clipboard"
|
|
113
|
-
{...props}
|
|
110
|
+
{...props}
|
|
111
|
+
>
|
|
114
112
|
{isCopied ? <CheckIcon size="16" /> : <CopyIcon size="16" />}
|
|
115
113
|
</ActionButton>
|
|
116
114
|
);
|
|
@@ -14,10 +14,9 @@ export default {
|
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
const Template = ({ content, ...args }) => {
|
|
17
|
-
const longCode = `${Array.from(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
).join(' ')}\n${Array.from({ length: 10 }, () => content).join('\n')}`;
|
|
17
|
+
const longCode = `${Array.from({ length: 20 }, () => content.split('\n')[1]).join(
|
|
18
|
+
' ',
|
|
19
|
+
)}\n${Array.from({ length: 10 }, () => content).join('\n')}`;
|
|
21
20
|
const multipleCodes = Array.from({ length: 5 }, (_, i) => ({
|
|
22
21
|
key: i,
|
|
23
22
|
label: `Code ${i}`,
|
|
@@ -43,11 +42,7 @@ const Template = ({ content, ...args }) => {
|
|
|
43
42
|
<h2>CodeBlock</h2>
|
|
44
43
|
<CodeBlock content={content} {...args} />
|
|
45
44
|
<h2>CodeBlock with title</h2>
|
|
46
|
-
<CodeBlock title="What a code"
|
|
47
|
-
|
|
48
|
-
content={content}
|
|
49
|
-
{...args}
|
|
50
|
-
/>
|
|
45
|
+
<CodeBlock title="What a code" content={content} {...args} />
|
|
51
46
|
<h2>CodeBlock with gradient, dots and action</h2>
|
|
52
47
|
<CodeBlock
|
|
53
48
|
content={content}
|
|
@@ -58,25 +53,12 @@ const Template = ({ content, ...args }) => {
|
|
|
58
53
|
{...args}
|
|
59
54
|
/>
|
|
60
55
|
<h2>CodeBlock with long lines, action and gradient</h2>
|
|
61
|
-
<CodeBlock
|
|
62
|
-
content={longCode}
|
|
63
|
-
showGradient
|
|
64
|
-
showActionButton
|
|
65
|
-
{...args}
|
|
66
|
-
/>
|
|
56
|
+
<CodeBlock content={longCode} showGradient showActionButton {...args} />
|
|
67
57
|
|
|
68
58
|
<h2>CodeBlock with multiple long codes, highlighted lines, action and gradient</h2>
|
|
69
|
-
<CodeBlock
|
|
70
|
-
content={multipleLongCodes}
|
|
71
|
-
showGradient
|
|
72
|
-
showActionButton
|
|
73
|
-
{...args}
|
|
74
|
-
/>
|
|
59
|
+
<CodeBlock content={multipleLongCodes} showGradient showActionButton {...args} />
|
|
75
60
|
<h2>CodeBlock with multiple codes</h2>
|
|
76
|
-
<CodeBlock
|
|
77
|
-
content={multipleCodes}
|
|
78
|
-
{...args}
|
|
79
|
-
/>
|
|
61
|
+
<CodeBlock content={multipleCodes} {...args} />
|
|
80
62
|
</div>
|
|
81
63
|
);
|
|
82
64
|
};
|