@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,7 @@ export const oneLineCodeClassNames = {
|
|
|
23
23
|
buttons: 'OneLineCode-Buttons',
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
type ThemeType = keyof Pick<
|
|
27
|
-
(typeof theme)['color'],
|
|
28
|
-
'primary' | 'success' | 'warning' | 'danger' | 'neutral'
|
|
29
|
-
>;
|
|
26
|
+
type ThemeType = keyof Pick<(typeof theme)['color'], 'primary' | 'success' | 'warning' | 'danger' | 'neutral'>;
|
|
30
27
|
|
|
31
28
|
const HTML_METHOD_CHIP_STYLES: Record<HttpMethod, ThemeType> = {
|
|
32
29
|
GET: 'primary',
|
|
@@ -56,14 +53,18 @@ type OneLineCodeWrapperProps = SyntaxHighlighterBaseStylesWrapperProps & {
|
|
|
56
53
|
const OneLineCodeWrapper = styled(SyntaxHighlighterBaseStylesWrapper)<OneLineCodeWrapperProps>`
|
|
57
54
|
display: flex;
|
|
58
55
|
padding-right: ${theme.space.space16} !important;
|
|
59
|
-
${({ $fitContent }) =>
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
56
|
+
${({ $fitContent }) =>
|
|
57
|
+
$fitContent &&
|
|
58
|
+
css`
|
|
59
|
+
width: fit-content;
|
|
60
|
+
`}
|
|
61
|
+
|
|
62
|
+
${({ $disabled }) =>
|
|
63
|
+
$disabled &&
|
|
64
|
+
css`
|
|
65
|
+
opacity: 0.5;
|
|
66
|
+
cursor: not-allowed;
|
|
67
|
+
`}
|
|
67
68
|
|
|
68
69
|
height: 4.6rem;
|
|
69
70
|
|
|
@@ -95,11 +96,7 @@ const OneLineCodeWrapper = styled(SyntaxHighlighterBaseStylesWrapper)<OneLineCod
|
|
|
95
96
|
bottom: 0;
|
|
96
97
|
width: 4rem;
|
|
97
98
|
z-index: 5;
|
|
98
|
-
background: linear-gradient(
|
|
99
|
-
to right,
|
|
100
|
-
transparent,
|
|
101
|
-
${theme.color.neutral.backgroundMuted} 3rem
|
|
102
|
-
);
|
|
99
|
+
background: linear-gradient(to right, transparent, ${theme.color.neutral.backgroundMuted} 3rem);
|
|
103
100
|
}
|
|
104
101
|
}
|
|
105
102
|
|
|
@@ -117,7 +114,6 @@ const OneLineCodeWrapper = styled(SyntaxHighlighterBaseStylesWrapper)<OneLineCod
|
|
|
117
114
|
scrollbar-width: thin;
|
|
118
115
|
scrollbar-color: ${theme.color.neutral.border} transparent;
|
|
119
116
|
|
|
120
|
-
|
|
121
117
|
pre {
|
|
122
118
|
display: flex;
|
|
123
119
|
flex: 1;
|
|
@@ -142,10 +138,7 @@ export type TrackingBundleDataObject = {
|
|
|
142
138
|
trackingData?: Record<string, unknown>;
|
|
143
139
|
};
|
|
144
140
|
|
|
145
|
-
export type OneLineCodeTrackingBundle = Record<
|
|
146
|
-
'secret' | 'copy' | 'action',
|
|
147
|
-
TrackingBundleDataObject
|
|
148
|
-
>;
|
|
141
|
+
export type OneLineCodeTrackingBundle = Record<'secret' | 'copy' | 'action', TrackingBundleDataObject>;
|
|
149
142
|
|
|
150
143
|
export type OneLineCodeProps = Omit<BoxProps, 'children'> & {
|
|
151
144
|
children: string;
|
|
@@ -203,7 +196,7 @@ export function OneLineCode({
|
|
|
203
196
|
<div className={oneLineCodeClassNames.gradientWrapper}>
|
|
204
197
|
<div className={oneLineCodeClassNames.scrollableWrapper}>
|
|
205
198
|
{httpMethod && (
|
|
206
|
-
<Text className={oneLineCodeClassNames.methodChip} as=
|
|
199
|
+
<Text className={oneLineCodeClassNames.methodChip} as="div">
|
|
207
200
|
{httpMethod}
|
|
208
201
|
</Text>
|
|
209
202
|
)}
|
|
@@ -223,13 +216,9 @@ export function OneLineCode({
|
|
|
223
216
|
onClick={() => setShowSecret((prev) => !prev)}
|
|
224
217
|
trackingId={trackingBundle?.secret?.trackingId}
|
|
225
218
|
trackingData={trackingBundle?.secret?.trackingData}
|
|
226
|
-
data-test=
|
|
219
|
+
data-test="toggle-visibility-button"
|
|
227
220
|
>
|
|
228
|
-
{showSecret ?
|
|
229
|
-
<EyeOffIcon size="16" />
|
|
230
|
-
) : (
|
|
231
|
-
<EyeIcon size="16" />
|
|
232
|
-
)}
|
|
221
|
+
{showSecret ? <EyeOffIcon size="16" /> : <EyeIcon size="16" />}
|
|
233
222
|
</ActionButton>
|
|
234
223
|
)}
|
|
235
224
|
{!hideCopyButton && (
|
|
@@ -249,6 +238,6 @@ export function OneLineCode({
|
|
|
249
238
|
</ActionButton>
|
|
250
239
|
)}
|
|
251
240
|
</div>
|
|
252
|
-
</OneLineCodeWrapper
|
|
241
|
+
</OneLineCodeWrapper>
|
|
253
242
|
);
|
|
254
243
|
}
|
|
@@ -51,38 +51,39 @@ void loadLanguages();
|
|
|
51
51
|
* Detects the language of the code based on common keywords. We need it for user-generated content
|
|
52
52
|
* @param code The code to analyze.
|
|
53
53
|
*/
|
|
54
|
-
const useDetectedLanguage = (code: string, passedLanguage?: string) =>
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
54
|
+
const useDetectedLanguage = (code: string, passedLanguage?: string) =>
|
|
55
|
+
useMemo(() => {
|
|
56
|
+
if (passedLanguage) return passedLanguage;
|
|
57
|
+
const tests = [
|
|
58
|
+
{ lang: 'rust', keywords: ['fn main()', 'let mut', 'println!', 'pub struct', 'use std::'] },
|
|
59
|
+
{ lang: 'http', keywords: ['GET /', 'POST /', 'HTTP/1.1', 'Host:', 'Content-Type:'] },
|
|
60
|
+
{ lang: 'bash', keywords: ['#!/bin/bash', 'echo ', 'cd ', 'ls'] },
|
|
61
|
+
{ lang: 'markup', keywords: ['<div', '<span', '<html', '<!DOCTYPE', '</'] },
|
|
62
|
+
{ lang: 'xml-doc', keywords: ['<?xml', '<doc', '<summary', '</doc>'] },
|
|
63
|
+
{ lang: 'yaml', keywords: ['version:', 'services:', 'name:'] },
|
|
64
|
+
{ lang: 'docker', keywords: ['FROM ', 'RUN ', 'CMD ', 'ENTRYPOINT', 'EXPOSE'] },
|
|
65
|
+
{ lang: 'python', keywords: ['def ', 'import ', 'print(', 'self', 'None'] },
|
|
66
|
+
{ lang: 'javascript', keywords: ['function', 'const', 'let', '=>', 'console.log', 'var'] },
|
|
67
|
+
{ lang: 'typescript', keywords: ['interface ', 'type ', ': string', ': number', 'as const'] },
|
|
68
|
+
];
|
|
69
|
+
|
|
70
|
+
const scored = tests.map((test) => {
|
|
71
|
+
let score = 0;
|
|
72
|
+
for (const kw of test.keywords) {
|
|
73
|
+
if (code.includes(kw)) score += 1;
|
|
74
|
+
}
|
|
75
|
+
return { lang: test.lang, score };
|
|
76
|
+
});
|
|
76
77
|
|
|
77
|
-
|
|
78
|
+
const max = _.maxBy(scored, 'score');
|
|
78
79
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}, [code, passedLanguage]);
|
|
80
|
+
if (max?.score && max.score > 0) return max.lang;
|
|
81
|
+
return undefined;
|
|
82
|
+
}, [code, passedLanguage]);
|
|
82
83
|
|
|
83
84
|
type PreWrapperProps = {
|
|
84
|
-
$hasLinePrefixes: boolean
|
|
85
|
-
$isSingleLine: boolean
|
|
85
|
+
$hasLinePrefixes: boolean;
|
|
86
|
+
$isSingleLine: boolean;
|
|
86
87
|
};
|
|
87
88
|
|
|
88
89
|
const PreWrapper = styled.pre<PreWrapperProps>`
|
|
@@ -99,13 +100,16 @@ const PreWrapper = styled.pre<PreWrapperProps>`
|
|
|
99
100
|
vertical-align: middle;
|
|
100
101
|
|
|
101
102
|
/* The following CSS deal with https://github.com/apify/apify-core/issues/20920 */
|
|
102
|
-
${({ $isSingleLine }) =>
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
103
|
+
${({ $isSingleLine }) =>
|
|
104
|
+
$isSingleLine
|
|
105
|
+
? css`
|
|
106
|
+
overflow-y: hidden;
|
|
107
|
+
scrollbar-width: none;
|
|
108
|
+
`
|
|
109
|
+
: css`
|
|
110
|
+
scrollbar-width: thin;
|
|
111
|
+
overflow: hidden;
|
|
112
|
+
`};
|
|
109
113
|
|
|
110
114
|
*,
|
|
111
115
|
*::before,
|
|
@@ -128,27 +132,33 @@ const PreWrapper = styled.pre<PreWrapperProps>`
|
|
|
128
132
|
padding-left: ${({ $hasLinePrefixes }) => ($hasLinePrefixes ? '0.2' : '1')}rem;
|
|
129
133
|
}
|
|
130
134
|
|
|
131
|
-
${({ $isSingleLine }) =>
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
135
|
+
${({ $isSingleLine }) =>
|
|
136
|
+
!$isSingleLine &&
|
|
137
|
+
css<{ $hasLinePrefixes: boolean }>`
|
|
138
|
+
&:hover {
|
|
139
|
+
background-color: ${HIGHLIGHT_BACKGROUND_COLOR} !important;
|
|
140
|
+
border-left: 6px solid ${theme.color.neutral.border} !important;
|
|
141
|
+
padding-left: ${({ $hasLinePrefixes }) => ($hasLinePrefixes ? '0.2' : '1')}rem;
|
|
142
|
+
}
|
|
143
|
+
`}
|
|
144
|
+
|
|
145
|
+
${({ $isSingleLine }) =>
|
|
146
|
+
$isSingleLine
|
|
147
|
+
? css<PreWrapperProps>`
|
|
148
|
+
white-space: nowrap;
|
|
149
|
+
vertical-align: text-top;
|
|
150
|
+
`
|
|
151
|
+
: css<PreWrapperProps>`
|
|
152
|
+
padding-left: ${({ $hasLinePrefixes }) =>
|
|
153
|
+
$hasLinePrefixes ? theme.space.space8 : theme.space.space16};
|
|
154
|
+
padding-right: ${theme.space.space16};
|
|
155
|
+
|
|
156
|
+
&:hover {
|
|
157
|
+
background-color: ${HIGHLIGHT_BACKGROUND_COLOR} !important;
|
|
158
|
+
border-left: 6px solid ${theme.color.neutral.border} !important;
|
|
159
|
+
padding-left: ${({ $hasLinePrefixes }) => ($hasLinePrefixes ? '0.2' : '1')}rem;
|
|
160
|
+
}
|
|
161
|
+
`}
|
|
152
162
|
}
|
|
153
163
|
}
|
|
154
164
|
`;
|
|
@@ -168,59 +178,57 @@ export const CodeHighlighterLineBashPrefix = styled(CodeHighlighterLinePrefix)<{
|
|
|
168
178
|
`;
|
|
169
179
|
|
|
170
180
|
type SyntaxHighlighterProps = Omit<HighlightProps, 'children' | 'language'> & {
|
|
171
|
-
size?: SharedTextSize
|
|
172
|
-
linePrefixes?: Record<string, ReactNode
|
|
173
|
-
highlightLines?: number[]
|
|
174
|
-
language?: string
|
|
175
|
-
className?: string
|
|
176
|
-
isSingleLine: boolean
|
|
181
|
+
size?: SharedTextSize;
|
|
182
|
+
linePrefixes?: Record<string, ReactNode>;
|
|
183
|
+
highlightLines?: number[];
|
|
184
|
+
language?: string;
|
|
185
|
+
className?: string;
|
|
186
|
+
isSingleLine: boolean;
|
|
177
187
|
};
|
|
178
188
|
|
|
179
|
-
export const PrismSyntaxHighlighter = forwardRef<HTMLPreElement, SyntaxHighlighterProps>(
|
|
180
|
-
size = 'regular',
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
tabIndex={0}
|
|
203
|
-
className={clsx(className, prismClassName)}
|
|
204
|
-
$hasLinePrefixes={hasLinePrefixes}
|
|
205
|
-
$isSingleLine={isSingleLine}
|
|
206
|
-
ref={ref}
|
|
207
|
-
>
|
|
208
|
-
<Text
|
|
209
|
-
size={size}
|
|
210
|
-
type='code'
|
|
211
|
-
as='code'
|
|
189
|
+
export const PrismSyntaxHighlighter = forwardRef<HTMLPreElement, SyntaxHighlighterProps>(
|
|
190
|
+
({ size = 'regular', linePrefixes = {}, highlightLines = [], language, className, isSingleLine, ...rest }, ref) => {
|
|
191
|
+
const { uiTheme } = useSharedUiDependencies();
|
|
192
|
+
const hasLinePrefixes = !_.isEmpty(linePrefixes);
|
|
193
|
+
const highlightedLinesObject = useRef<Record<number, boolean>>(
|
|
194
|
+
Object.fromEntries(highlightLines.map((e) => [e, true])),
|
|
195
|
+
);
|
|
196
|
+
|
|
197
|
+
const effectiveLanguage = useDetectedLanguage(rest.code || '', language) ?? 'javascript';
|
|
198
|
+
|
|
199
|
+
return (
|
|
200
|
+
<Highlight
|
|
201
|
+
theme={uiTheme === 'DARK' ? themes.nightOwl : oneLightTheme}
|
|
202
|
+
language={effectiveLanguage}
|
|
203
|
+
{...rest}
|
|
204
|
+
>
|
|
205
|
+
{({ className: prismClassName, tokens, getLineProps, getTokenProps }) => (
|
|
206
|
+
<PreWrapper
|
|
207
|
+
tabIndex={0}
|
|
208
|
+
className={clsx(className, prismClassName)}
|
|
209
|
+
$hasLinePrefixes={hasLinePrefixes}
|
|
210
|
+
$isSingleLine={isSingleLine}
|
|
211
|
+
ref={ref}
|
|
212
212
|
>
|
|
213
|
-
{
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
213
|
+
<Text size={size} type="code" as="code">
|
|
214
|
+
{tokens.map((line, i) => (
|
|
215
|
+
<div
|
|
216
|
+
key={i}
|
|
217
|
+
{...getLineProps({
|
|
218
|
+
line,
|
|
219
|
+
className: highlightedLinesObject.current[i + 1] ? 'highlighted' : '',
|
|
220
|
+
})}
|
|
221
|
+
>
|
|
222
|
+
{hasLinePrefixes && (linePrefixes[i + 1] || <CodeHighlighterLinePrefix />)}
|
|
223
|
+
{line.map((token, key) => (
|
|
224
|
+
<span key={key} {...getTokenProps({ token })} />
|
|
225
|
+
))}
|
|
226
|
+
</div>
|
|
227
|
+
))}
|
|
228
|
+
</Text>
|
|
229
|
+
</PreWrapper>
|
|
230
|
+
)}
|
|
231
|
+
</Highlight>
|
|
232
|
+
);
|
|
233
|
+
},
|
|
234
|
+
);
|
|
@@ -61,9 +61,11 @@ Prism.languages.python = {
|
|
|
61
61
|
},
|
|
62
62
|
},
|
|
63
63
|
// eslint-disable-next-line @stylistic/max-len
|
|
64
|
-
keyword:
|
|
64
|
+
keyword:
|
|
65
|
+
/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,
|
|
65
66
|
// eslint-disable-next-line @stylistic/max-len
|
|
66
|
-
builtin:
|
|
67
|
+
builtin:
|
|
68
|
+
/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,
|
|
67
69
|
boolean: /\b(?:False|None|True)\b/,
|
|
68
70
|
number: /\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,
|
|
69
71
|
operator: /[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
|
|
@@ -109,7 +109,8 @@ export const GreyHeaderWhenClosed: Story = {
|
|
|
109
109
|
args: {
|
|
110
110
|
header: 'Muted background when closed, more prominent on hover',
|
|
111
111
|
isClosedHeaderGrey: true,
|
|
112
|
-
children:
|
|
112
|
+
children:
|
|
113
|
+
'The header has a muted background when the card is collapsed, which becomes more prominent on hover.',
|
|
113
114
|
},
|
|
114
115
|
};
|
|
115
116
|
|
|
@@ -34,7 +34,8 @@ export type CollapsibleCardProps = {
|
|
|
34
34
|
isClosedHeaderGrey?: boolean;
|
|
35
35
|
isHeaderGreyOnHover?: boolean;
|
|
36
36
|
as?: React.ElementType;
|
|
37
|
-
} & TransientWrapperProps &
|
|
37
|
+
} & TransientWrapperProps &
|
|
38
|
+
Omit<React.HTMLAttributes<HTMLElement>, 'children'>;
|
|
38
39
|
|
|
39
40
|
export const collapsibleCardClassNames = {
|
|
40
41
|
TOP_SECTION: 'CollapsibleCard-TopSection',
|
|
@@ -42,7 +43,7 @@ export const collapsibleCardClassNames = {
|
|
|
42
43
|
CONTENT: 'Card-content',
|
|
43
44
|
};
|
|
44
45
|
|
|
45
|
-
const StyledCardWrapper = styled(Box)
|
|
46
|
+
const StyledCardWrapper = styled(Box)<StyledWrapperProps>`
|
|
46
47
|
/* consoleStyle.partialStyle.card — TODO: reuse from Card once moved out of to_consolidate */
|
|
47
48
|
background-color: ${theme.color.neutral.cardBackground};
|
|
48
49
|
border: 1px solid ${theme.color.neutral.border};
|
|
@@ -50,10 +51,12 @@ const StyledCardWrapper = styled(Box) <StyledWrapperProps>`
|
|
|
50
51
|
border-radius: ${theme.radius.radius8};
|
|
51
52
|
box-sizing: border-box;
|
|
52
53
|
|
|
53
|
-
${({ $hideOuterBorder }) =>
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
${({ $hideOuterBorder }) =>
|
|
55
|
+
$hideOuterBorder &&
|
|
56
|
+
css`
|
|
57
|
+
border: none;
|
|
58
|
+
border-radius: unset;
|
|
59
|
+
`};
|
|
57
60
|
/* Reset padding, it is dealt with within header and content styles */
|
|
58
61
|
padding: 0;
|
|
59
62
|
${({ $hasShadow }) => ($hasShadow ? '' : 'box-shadow: initial;')}
|
|
@@ -81,7 +84,8 @@ const StyledHeader = styled.header<StyledHeaderProps>`
|
|
|
81
84
|
${({ $hideOuterBorder }) => ($hideOuterBorder ? '' : `border-radius: ${theme.radius.radius8};`)}
|
|
82
85
|
|
|
83
86
|
&:hover {
|
|
84
|
-
background-color: ${({ $isHeaderGrey, $isHeaderGreyOnHover }) =>
|
|
87
|
+
background-color: ${({ $isHeaderGrey, $isHeaderGreyOnHover }) =>
|
|
88
|
+
$isHeaderGrey || $isHeaderGreyOnHover ? theme.color.neutral.hover : 'initial'};
|
|
85
89
|
}
|
|
86
90
|
|
|
87
91
|
.chevron {
|
|
@@ -135,22 +139,33 @@ export const CollapsibleCard: FC<CollapsibleCardProps> = ({
|
|
|
135
139
|
$hasShadow={hasShadow}
|
|
136
140
|
{...rest}
|
|
137
141
|
>
|
|
138
|
-
{topSection &&
|
|
139
|
-
|
|
140
|
-
|
|
142
|
+
{topSection && (
|
|
143
|
+
<StyledTopSection
|
|
144
|
+
className={collapsibleCardClassNames.TOP_SECTION}
|
|
145
|
+
data-test="collapsible-card-top-section"
|
|
146
|
+
>
|
|
147
|
+
{topSection}
|
|
148
|
+
</StyledTopSection>
|
|
149
|
+
)}
|
|
141
150
|
<StyledHeader
|
|
142
151
|
$hideOuterBorder={hideOuterBorder}
|
|
143
152
|
$isHeaderGrey={isClosedHeaderGrey && !isOpen && !isExpanded}
|
|
144
153
|
$isHeaderGreyOnHover={isHeaderGreyOnHover}
|
|
145
154
|
onClick={onHeaderClick}
|
|
146
155
|
>
|
|
147
|
-
{!noChevron &&
|
|
156
|
+
{!noChevron && (
|
|
157
|
+
<ChevronDownIcon
|
|
158
|
+
size="16"
|
|
159
|
+
className={clsx('chevron', (isExpanded ?? isOpen) ? 'chevron-open' : 'chevron-closed')}
|
|
160
|
+
/>
|
|
161
|
+
)}
|
|
148
162
|
{header}
|
|
149
163
|
</StyledHeader>
|
|
150
|
-
<Collapsible.Root
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
164
|
+
<Collapsible.Root open={isUncontrolled ? isOpen : isExpanded}>
|
|
165
|
+
<CollapsibleContent
|
|
166
|
+
$noDivider={noDivider}
|
|
167
|
+
className={collapsibleCardClassNames.COLLAPSIBLE_CONTENT_WRAPPER}
|
|
168
|
+
>
|
|
154
169
|
<StyledCardContent className={collapsibleCardClassNames.CONTENT} data-test="card-content">
|
|
155
170
|
{children}
|
|
156
171
|
</StyledCardContent>
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
2
|
|
|
3
3
|
export interface ColorWheelGradientProps {
|
|
4
|
-
translateX?: number
|
|
5
|
-
translateY?: number
|
|
6
|
-
rotation?: number
|
|
7
|
-
radius?: number
|
|
8
|
-
blurSize?: number
|
|
4
|
+
translateX?: number;
|
|
5
|
+
translateY?: number;
|
|
6
|
+
rotation?: number;
|
|
7
|
+
radius?: number;
|
|
8
|
+
blurSize?: number;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export const ColorWheelGradient = styled.div<ColorWheelGradientProps
|
|
11
|
+
export const ColorWheelGradient = styled.div<ColorWheelGradientProps>`
|
|
12
|
+
${({ radius, rotation = 0, blurSize = 40, translateX = 0, translateY = 0 }) => `
|
|
12
13
|
z-index: 1;
|
|
13
14
|
position: absolute;
|
|
14
15
|
width: ${radius ? `${radius}px` : 'auto'};
|
|
@@ -28,4 +29,5 @@ export const ColorWheelGradient = styled.div<ColorWheelGradientProps>`${({ radiu
|
|
|
28
29
|
|
|
29
30
|
border-radius: 50%;
|
|
30
31
|
filter: blur(${blurSize}px)
|
|
31
|
-
`}
|
|
32
|
+
`}
|
|
33
|
+
`;
|
|
@@ -11,7 +11,14 @@ import {
|
|
|
11
11
|
useTransitionStyles,
|
|
12
12
|
} from '@floating-ui/react';
|
|
13
13
|
import clsx from 'clsx';
|
|
14
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
type ComponentType,
|
|
16
|
+
type CSSProperties,
|
|
17
|
+
forwardRef,
|
|
18
|
+
type MouseEvent,
|
|
19
|
+
type ReactNode,
|
|
20
|
+
type RefObject,
|
|
21
|
+
} from 'react';
|
|
15
22
|
import styled from 'styled-components';
|
|
16
23
|
|
|
17
24
|
import { theme } from '../../design_system/theme.js';
|
|
@@ -35,7 +42,7 @@ export const FLOATING_PLACEMENT = {
|
|
|
35
42
|
LEFT_END: 'left-end',
|
|
36
43
|
} as const;
|
|
37
44
|
|
|
38
|
-
export type FloatingPlacement = typeof FLOATING_PLACEMENT[keyof typeof FLOATING_PLACEMENT];
|
|
45
|
+
export type FloatingPlacement = (typeof FLOATING_PLACEMENT)[keyof typeof FLOATING_PLACEMENT];
|
|
39
46
|
|
|
40
47
|
interface FloatingComponentWrapProps {
|
|
41
48
|
showInPortal?: boolean;
|
|
@@ -125,9 +132,7 @@ export const FloatingComponentBase = ({
|
|
|
125
132
|
y,
|
|
126
133
|
refs: { setReference, setFloating },
|
|
127
134
|
strategy: effectiveStrategy,
|
|
128
|
-
middlewareData: {
|
|
129
|
-
hide: refHidden,
|
|
130
|
-
},
|
|
135
|
+
middlewareData: { hide: refHidden },
|
|
131
136
|
context,
|
|
132
137
|
} = useFloating({
|
|
133
138
|
open: isOpen,
|
|
@@ -169,7 +174,7 @@ export const FloatingComponentBase = ({
|
|
|
169
174
|
<ChildrenWrap className={clsx(classNames.CHILDREN, contentWrapClassName)} ref={setReference}>
|
|
170
175
|
{children}
|
|
171
176
|
</ChildrenWrap>
|
|
172
|
-
{
|
|
177
|
+
{isMounted && (
|
|
173
178
|
<FloatingComponentWrap
|
|
174
179
|
className={className}
|
|
175
180
|
ref={setFloating}
|
|
@@ -185,12 +190,14 @@ export const FloatingComponentBase = ({
|
|
|
185
190
|
showInPortal={showInPortal}
|
|
186
191
|
>
|
|
187
192
|
<div ref={triggerRef}>
|
|
188
|
-
{CloseButtonComponent
|
|
189
|
-
|
|
193
|
+
{CloseButtonComponent ? (
|
|
194
|
+
<StyledPopoverBox>
|
|
190
195
|
{content}
|
|
191
196
|
<CloseButtonComponent />
|
|
192
197
|
</StyledPopoverBox>
|
|
193
|
-
|
|
198
|
+
) : (
|
|
199
|
+
content
|
|
200
|
+
)}
|
|
194
201
|
</div>
|
|
195
202
|
</FloatingComponentWrap>
|
|
196
203
|
)}
|