@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
package/src/components/link.tsx
CHANGED
|
@@ -12,23 +12,23 @@ import { Box, type BoxProps } from './box.js';
|
|
|
12
12
|
|
|
13
13
|
export type To = string | Partial<Path>;
|
|
14
14
|
export interface RegularLinkProps {
|
|
15
|
-
to: To
|
|
16
|
-
hideExternalIcon?: boolean
|
|
17
|
-
showExternalIcon?: boolean
|
|
18
|
-
rel?: string
|
|
19
|
-
target?: string
|
|
20
|
-
trackingId?: string
|
|
21
|
-
trackingData?: object
|
|
22
|
-
tabIndex?: number
|
|
23
|
-
ariaHidden?: boolean
|
|
24
|
-
ariaLabel?: string
|
|
15
|
+
to: To;
|
|
16
|
+
hideExternalIcon?: boolean;
|
|
17
|
+
showExternalIcon?: boolean;
|
|
18
|
+
rel?: string;
|
|
19
|
+
target?: string;
|
|
20
|
+
trackingId?: string;
|
|
21
|
+
trackingData?: object;
|
|
22
|
+
tabIndex?: number;
|
|
23
|
+
ariaHidden?: boolean;
|
|
24
|
+
ariaLabel?: string;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* Checks if passed url is external
|
|
29
29
|
*/
|
|
30
30
|
export const isUrlExternal = (url: To, windowLocationHost: string) => {
|
|
31
|
-
if (!url || typeof
|
|
31
|
+
if (!url || typeof url !== 'string') return false;
|
|
32
32
|
const domainMatch = url.match(/^https?:\/\/([^/?#]+)(?:[/?#]|$)/i);
|
|
33
33
|
return !!(domainMatch && domainMatch[1] !== windowLocationHost);
|
|
34
34
|
};
|
|
@@ -37,7 +37,7 @@ export const isUrlExternal = (url: To, windowLocationHost: string) => {
|
|
|
37
37
|
* Checks if passed url is email
|
|
38
38
|
*/
|
|
39
39
|
export const isUrlEmail = (url: To) => {
|
|
40
|
-
if (!url || typeof
|
|
40
|
+
if (!url || typeof url !== 'string') return false;
|
|
41
41
|
return url.startsWith('mailto:');
|
|
42
42
|
};
|
|
43
43
|
/**
|
|
@@ -97,61 +97,61 @@ export const StyledAsLink = styled(Box)`
|
|
|
97
97
|
|
|
98
98
|
export type LinkProps = RegularLinkProps & BoxProps;
|
|
99
99
|
|
|
100
|
-
export const Link = forwardRef<HTMLElement, LinkProps>(
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
InternalLink
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
100
|
+
export const Link = forwardRef<HTMLElement, LinkProps>(
|
|
101
|
+
(
|
|
102
|
+
{
|
|
103
|
+
to,
|
|
104
|
+
children,
|
|
105
|
+
rel,
|
|
106
|
+
target,
|
|
107
|
+
hideExternalIcon,
|
|
108
|
+
showExternalIcon,
|
|
109
|
+
onClick,
|
|
110
|
+
trackingId,
|
|
111
|
+
trackingData,
|
|
112
|
+
tabIndex,
|
|
113
|
+
ariaHidden,
|
|
114
|
+
ariaLabel,
|
|
115
|
+
...rest
|
|
116
|
+
},
|
|
117
|
+
ref,
|
|
118
|
+
) => {
|
|
119
|
+
const { windowLocationHost, isHrefTrusted, trackClick, InternalLink } = useSharedUiDependencies();
|
|
120
|
+
const isExternal = isUrlExternal(to, windowLocationHost);
|
|
121
|
+
const href = getHref(to, isExternal);
|
|
122
|
+
const isEmail = isUrlEmail(to);
|
|
123
|
+
const isTrusted = isHrefTrusted(href);
|
|
124
|
+
|
|
125
|
+
const trackedOnClick = (e: React.MouseEvent) => {
|
|
126
|
+
if (trackingId && trackClick) trackClick(trackingId, trackingData);
|
|
127
|
+
if (onClick) onClick(e);
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
const uniqRel = new Set([
|
|
131
|
+
...(rel?.split(' ') || []),
|
|
132
|
+
isExternal && 'external',
|
|
133
|
+
(isExternal || target === '_blank') && 'noopener',
|
|
134
|
+
isExternal && !isTrusted && 'nofollow',
|
|
135
|
+
]);
|
|
136
|
+
const effectiveRel = clsx(Array.from(uniqRel));
|
|
137
|
+
|
|
138
|
+
return (
|
|
139
|
+
<StyledAsLink
|
|
140
|
+
// We use the InternalLink only for internal navigation
|
|
141
|
+
forwardedAs={isEmail || isExternal ? 'a' : InternalLink}
|
|
142
|
+
href={href}
|
|
143
|
+
rel={effectiveRel}
|
|
144
|
+
target={target || (isExternal ? '_blank' : '_self')}
|
|
145
|
+
onClick={trackedOnClick}
|
|
146
|
+
ref={ref}
|
|
147
|
+
tabIndex={tabIndex}
|
|
148
|
+
aria-hidden={ariaHidden}
|
|
149
|
+
aria-label={ariaLabel}
|
|
150
|
+
{...rest}
|
|
151
|
+
>
|
|
152
|
+
{children}
|
|
153
|
+
{((isExternal && !hideExternalIcon) || showExternalIcon) && <ExternalLinkIcon size="16" />}
|
|
154
|
+
</StyledAsLink>
|
|
155
|
+
);
|
|
156
|
+
},
|
|
157
|
+
);
|
|
@@ -35,40 +35,39 @@ export default {
|
|
|
35
35
|
},
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
-
const Template = (args) =>
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
const Template = (args) => (
|
|
39
|
+
<StyledWrapper>
|
|
40
|
+
{MESSAGE_TYPES.map((type) => (
|
|
41
|
+
<Fragment key={type}>
|
|
42
|
+
<Message {...args} type={type} />
|
|
43
|
+
</Fragment>
|
|
44
|
+
))}
|
|
45
|
+
</StyledWrapper>
|
|
46
|
+
);
|
|
43
47
|
|
|
44
48
|
const StyledWrapper = styled.div`
|
|
45
49
|
display: flex;
|
|
46
50
|
flex-direction: column;
|
|
47
51
|
`;
|
|
48
52
|
|
|
49
|
-
export const Index = (args) =>
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
onDismissClick={() => console.log('dismiss clicked')}
|
|
68
|
-
actions={[{ label: 'Action', onClick: () => console.log('Action clicked') }]}
|
|
69
|
-
/>
|
|
70
|
-
</Fragment>)}
|
|
71
|
-
</StyledWrapper>;
|
|
53
|
+
export const Index = (args) => (
|
|
54
|
+
<StyledWrapper>
|
|
55
|
+
{MESSAGE_TYPES.map((type) => (
|
|
56
|
+
<Fragment key={type}>
|
|
57
|
+
<Message {...args} type={type} />
|
|
58
|
+
<Message {...args} caption="" type={type} />
|
|
59
|
+
<Message {...args} type={type} onDismissClick={() => console.log('dismiss clicked')} />
|
|
60
|
+
<Message {...args} type={type} caption="" onDismissClick={() => console.log('dismiss clicked')} />
|
|
61
|
+
<Message
|
|
62
|
+
{...args}
|
|
63
|
+
type={type}
|
|
64
|
+
onDismissClick={() => console.log('dismiss clicked')}
|
|
65
|
+
actions={[{ label: 'Action', onClick: () => console.log('Action clicked') }]}
|
|
66
|
+
/>
|
|
67
|
+
</Fragment>
|
|
68
|
+
))}
|
|
69
|
+
</StyledWrapper>
|
|
70
|
+
);
|
|
72
71
|
|
|
73
72
|
export const OneLine = Template.bind({});
|
|
74
73
|
OneLine.args = {
|
|
@@ -77,11 +76,14 @@ OneLine.args = {
|
|
|
77
76
|
|
|
78
77
|
export const MultiLine = Template.bind({});
|
|
79
78
|
MultiLine.args = {
|
|
80
|
-
children:
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
79
|
+
children: (
|
|
80
|
+
<>
|
|
81
|
+
Hello, friends, <br />
|
|
82
|
+
I am a very very very very very very very very very very very very very very long message
|
|
83
|
+
<br />
|
|
84
|
+
and I have some <Link to="https://www.youtube.com/watch?v=dQw4w9WgXcQ">and links!</Link>
|
|
85
|
+
</>
|
|
86
|
+
),
|
|
85
87
|
};
|
|
86
88
|
|
|
87
89
|
export const CustomIcon = Template.bind({});
|
|
@@ -22,7 +22,7 @@ export const messageClassNames = {
|
|
|
22
22
|
actionsWrapper: 'actionsWrapper',
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
const StyledMessage = styled(Box)<{ $boxless?: boolean
|
|
25
|
+
const StyledMessage = styled(Box)<{ $boxless?: boolean; $hasCaption?: boolean }>`
|
|
26
26
|
display: flex;
|
|
27
27
|
align-items: center;
|
|
28
28
|
gap: ${theme.space.space8};
|
|
@@ -58,26 +58,28 @@ const StyledMessage = styled(Box)<{ $boxless?: boolean, $hasCaption?: boolean }>
|
|
|
58
58
|
text-decoration: underline;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
${({ $hasCaption }) =>
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
61
|
+
${({ $hasCaption }) =>
|
|
62
|
+
$hasCaption
|
|
63
|
+
? css`
|
|
64
|
+
grid-template-areas:
|
|
65
|
+
'iconArea captionArea'
|
|
66
|
+
'descriptionArea descriptionArea';
|
|
67
|
+
`
|
|
68
|
+
: css`
|
|
69
|
+
grid-template-areas: 'iconArea descriptionArea';
|
|
70
|
+
`}
|
|
70
71
|
}
|
|
71
72
|
|
|
73
|
+
${({ $boxless }) =>
|
|
74
|
+
!$boxless &&
|
|
75
|
+
css`
|
|
76
|
+
/* the dismiss button is bigger than text so we apply smaller padding on wrapper & some on the content and icon */
|
|
77
|
+
padding: ${theme.space.space8} ${theme.space.space16};
|
|
72
78
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
.${messageClassNames.content} {
|
|
78
|
-
padding: ${theme.space.space4} 0;
|
|
79
|
-
}
|
|
80
|
-
`)}
|
|
79
|
+
.${messageClassNames.content} {
|
|
80
|
+
padding: ${theme.space.space4} 0;
|
|
81
|
+
}
|
|
82
|
+
`}
|
|
81
83
|
|
|
82
84
|
.${messageClassNames.actionsWrapper} {
|
|
83
85
|
display: flex;
|
|
@@ -137,21 +139,21 @@ const typeToIcon: { [key in MessageType]: React.ElementType } = {
|
|
|
137
139
|
};
|
|
138
140
|
|
|
139
141
|
type ActionButtonProps = Omit<ButtonProps, 'children'> & {
|
|
140
|
-
label: ReactNode
|
|
142
|
+
label: ReactNode;
|
|
141
143
|
};
|
|
142
144
|
|
|
143
145
|
type MessageProps = BoxProps & {
|
|
144
|
-
type: MessageType
|
|
145
|
-
caption?: string
|
|
146
|
+
type: MessageType;
|
|
147
|
+
caption?: string;
|
|
146
148
|
/** @deprecated Use `Icon` instead. */
|
|
147
|
-
icon?: IconComponentType
|
|
148
|
-
Icon?: IconComponentType
|
|
149
|
-
onDismissClick?: () => void
|
|
150
|
-
borderless?: boolean
|
|
151
|
-
boxless?: boolean
|
|
152
|
-
as?: React.ElementType
|
|
153
|
-
dismissTrackingId?: string
|
|
154
|
-
actions?: ActionButtonProps[]
|
|
149
|
+
icon?: IconComponentType;
|
|
150
|
+
Icon?: IconComponentType;
|
|
151
|
+
onDismissClick?: () => void;
|
|
152
|
+
borderless?: boolean;
|
|
153
|
+
boxless?: boolean;
|
|
154
|
+
as?: React.ElementType;
|
|
155
|
+
dismissTrackingId?: string;
|
|
156
|
+
actions?: ActionButtonProps[];
|
|
155
157
|
};
|
|
156
158
|
|
|
157
159
|
/**
|
|
@@ -185,8 +187,12 @@ export const Message: React.FC<MessageProps> = ({
|
|
|
185
187
|
{...rest}
|
|
186
188
|
>
|
|
187
189
|
<div className={messageClassNames.content}>
|
|
188
|
-
<IconComponent className={messageClassNames.icon} size=
|
|
189
|
-
{hasCaption &&
|
|
190
|
+
<IconComponent className={messageClassNames.icon} size="16" />
|
|
191
|
+
{hasCaption && (
|
|
192
|
+
<Text weight="bold" className={messageClassNames.caption}>
|
|
193
|
+
{caption}
|
|
194
|
+
</Text>
|
|
195
|
+
)}
|
|
190
196
|
<div className={messageClassNames.description}>{children}</div>
|
|
191
197
|
</div>
|
|
192
198
|
{(actions.length > 0 || onDismissClick) && (
|
|
@@ -194,12 +200,7 @@ export const Message: React.FC<MessageProps> = ({
|
|
|
194
200
|
{actions.length > 0 && (
|
|
195
201
|
<>
|
|
196
202
|
{actions.map(({ label, ...action }, index) => (
|
|
197
|
-
<Button
|
|
198
|
-
key={index}
|
|
199
|
-
size='small'
|
|
200
|
-
variant='primary'
|
|
201
|
-
{...action}
|
|
202
|
-
>
|
|
203
|
+
<Button key={index} size="small" variant="primary" {...action}>
|
|
203
204
|
{label}
|
|
204
205
|
</Button>
|
|
205
206
|
))}
|
|
@@ -207,16 +208,15 @@ export const Message: React.FC<MessageProps> = ({
|
|
|
207
208
|
)}
|
|
208
209
|
{onDismissClick && (
|
|
209
210
|
<Button
|
|
210
|
-
size=
|
|
211
|
-
variant=
|
|
211
|
+
size="small"
|
|
212
|
+
variant="tertiary"
|
|
212
213
|
trackingId={dismissTrackingId}
|
|
213
214
|
onClick={onDismissClick}
|
|
214
215
|
className={messageClassNames.dismiss}
|
|
215
216
|
>
|
|
216
|
-
<CrossIcon size="16" color={theme.color.neutral.icon}/>
|
|
217
|
+
<CrossIcon size="16" color={theme.color.neutral.icon} />
|
|
217
218
|
</Button>
|
|
218
219
|
)}
|
|
219
|
-
|
|
220
220
|
</div>
|
|
221
221
|
)}
|
|
222
222
|
</StyledMessage>
|
|
@@ -225,7 +225,7 @@ export const Message: React.FC<MessageProps> = ({
|
|
|
225
225
|
|
|
226
226
|
type SpecificMessageProps = Omit<MessageProps, 'type'>;
|
|
227
227
|
// Semantic classes for all the message types
|
|
228
|
-
export const InfoMessage = (props: SpecificMessageProps) =>
|
|
229
|
-
export const WarningMessage = (props: SpecificMessageProps) =>
|
|
230
|
-
export const SuccessMessage = (props: SpecificMessageProps) =>
|
|
231
|
-
export const DangerMessage = (props: SpecificMessageProps) =>
|
|
228
|
+
export const InfoMessage = (props: SpecificMessageProps) => <Message {...props} type="info" />;
|
|
229
|
+
export const WarningMessage = (props: SpecificMessageProps) => <Message {...props} type="warning" />;
|
|
230
|
+
export const SuccessMessage = (props: SpecificMessageProps) => <Message {...props} type="success" />;
|
|
231
|
+
export const DangerMessage = (props: SpecificMessageProps) => <Message {...props} type="danger" />;
|
|
@@ -12,7 +12,7 @@ import { Box } from './box.js';
|
|
|
12
12
|
import { Text } from './text/index.js';
|
|
13
13
|
|
|
14
14
|
type RatingStatsProps = {
|
|
15
|
-
ratingStats: Record<ReviewRating, number
|
|
15
|
+
ratingStats: Record<ReviewRating, number>;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
const StyledRating = styled(Box)`
|
|
@@ -42,7 +42,7 @@ const StyledRatingBar = styled(Box)<{ $widthPercent: number }>`
|
|
|
42
42
|
overflow: hidden;
|
|
43
43
|
|
|
44
44
|
&::after {
|
|
45
|
-
content:
|
|
45
|
+
content: '';
|
|
46
46
|
position: absolute;
|
|
47
47
|
display: block;
|
|
48
48
|
height: 100%;
|
|
@@ -51,7 +51,6 @@ const StyledRatingBar = styled(Box)<{ $widthPercent: number }>`
|
|
|
51
51
|
border-radius: 10px;
|
|
52
52
|
background: ${theme.color.neutral.icon};
|
|
53
53
|
width: ${({ $widthPercent }) => $widthPercent}%;
|
|
54
|
-
|
|
55
54
|
}
|
|
56
55
|
`;
|
|
57
56
|
|
|
@@ -59,10 +58,7 @@ type SingleStarRatingProps = BoxProps & {
|
|
|
59
58
|
color?: string;
|
|
60
59
|
};
|
|
61
60
|
|
|
62
|
-
export const SingleStarRating: FC<SingleStarRatingProps> = ({
|
|
63
|
-
color = theme.color.neutral.icon,
|
|
64
|
-
...rest
|
|
65
|
-
}) => {
|
|
61
|
+
export const SingleStarRating: FC<SingleStarRatingProps> = ({ color = theme.color.neutral.icon, ...rest }) => {
|
|
66
62
|
return (
|
|
67
63
|
<StyledRating {...rest}>
|
|
68
64
|
<StarFullIcon size="12" color={color} />
|
|
@@ -76,47 +72,44 @@ type RatingProps = BoxProps & {
|
|
|
76
72
|
color?: string;
|
|
77
73
|
};
|
|
78
74
|
|
|
79
|
-
export const Rating: FC<RatingProps> = ({
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
return (
|
|
94
|
-
<StyledRating {...rest}>
|
|
95
|
-
{ratingStatsContent}
|
|
96
|
-
</StyledRating>
|
|
75
|
+
export const Rating: FC<RatingProps> = ({ rating = 0, color = theme.color.neutral.icon, ...rest }) => {
|
|
76
|
+
const ratingStatsContent = useMemo(
|
|
77
|
+
() =>
|
|
78
|
+
[1, 2, 3, 4, 5].map((rate) => {
|
|
79
|
+
const ratingFloor = Math.floor(rating);
|
|
80
|
+
const ratingDecimals = rating % 1;
|
|
81
|
+
|
|
82
|
+
if (ratingFloor >= rate || (ratingFloor === rate - 1 && ratingDecimals > 0.75))
|
|
83
|
+
return <StarFullIcon size="12" color={color} key={rate} />;
|
|
84
|
+
if (ratingFloor === rate - 1 && ratingDecimals > 0.25)
|
|
85
|
+
return <StarHalfIcon size="12" color={color} key={rate} />;
|
|
86
|
+
return <StarEmptyIcon size="12" color={color} key={rate} />;
|
|
87
|
+
}),
|
|
88
|
+
[rating, color],
|
|
97
89
|
);
|
|
90
|
+
|
|
91
|
+
return <StyledRating {...rest}>{ratingStatsContent}</StyledRating>;
|
|
98
92
|
};
|
|
99
93
|
|
|
100
|
-
export const RatingStats: FC<RatingStatsProps & BoxProps> = ({
|
|
101
|
-
ratingStats,
|
|
102
|
-
...rest
|
|
103
|
-
}) => {
|
|
94
|
+
export const RatingStats: FC<RatingStatsProps & BoxProps> = ({ ratingStats, ...rest }) => {
|
|
104
95
|
const totalRates = ratingStats[1] + ratingStats[2] + ratingStats[3] + ratingStats[4] + ratingStats[5];
|
|
105
96
|
|
|
106
|
-
const ratingStatsContent = useMemo(
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
97
|
+
const ratingStatsContent = useMemo(
|
|
98
|
+
() =>
|
|
99
|
+
([5, 4, 3, 2, 1] as const).map((rate) => {
|
|
100
|
+
const widthPercent = totalRates > 0 ? (ratingStats[rate] / totalRates) * 100 : 0;
|
|
101
|
+
|
|
102
|
+
return (
|
|
103
|
+
<Fragment key={rate}>
|
|
104
|
+
<Text align="center" color={theme.color.neutral.textSubtle}>
|
|
105
|
+
{rate}
|
|
106
|
+
</Text>
|
|
107
|
+
<StyledRatingBar $widthPercent={widthPercent} />
|
|
108
|
+
</Fragment>
|
|
109
|
+
);
|
|
110
|
+
}),
|
|
111
|
+
[totalRates, ratingStats],
|
|
121
112
|
);
|
|
113
|
+
|
|
114
|
+
return <StyledRatingStats {...rest}>{ratingStatsContent}</StyledRatingStats>;
|
|
122
115
|
};
|
|
@@ -56,19 +56,31 @@ export const pythonizeValue = <T>(value: T, depth = 0): string | T => {
|
|
|
56
56
|
if (Array.isArray(value)) {
|
|
57
57
|
if (value.length === 0) return '[]';
|
|
58
58
|
if (value.length === 1) return '[' + pythonizeValue(value[0], depth + 1) + ']';
|
|
59
|
-
return
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
return (
|
|
60
|
+
'[\n' +
|
|
61
|
+
value.map((v) => INDENT.repeat(depth + 1) + pythonizeValue(v, depth + 1) + ',\n').join('') +
|
|
62
|
+
INDENT.repeat(depth) +
|
|
63
|
+
']'
|
|
64
|
+
);
|
|
62
65
|
}
|
|
63
66
|
|
|
64
67
|
// Object values
|
|
65
68
|
if (typeof value === 'object') {
|
|
66
69
|
const entries = Object.entries(value);
|
|
67
70
|
if (entries.length === 0) return '{}';
|
|
68
|
-
if (entries.length === 1)
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
if (entries.length === 1)
|
|
72
|
+
return '{ ' + pythonQuoteString(entries[0][0]) + ': ' + pythonizeValue(entries[0][1], depth + 1) + ' }';
|
|
73
|
+
return (
|
|
74
|
+
'{\n' +
|
|
75
|
+
entries
|
|
76
|
+
.map(
|
|
77
|
+
([k, v]) =>
|
|
78
|
+
INDENT.repeat(depth + 1) + pythonQuoteString(k) + ': ' + pythonizeValue(v, depth + 1) + ',\n',
|
|
79
|
+
)
|
|
80
|
+
.join('') +
|
|
81
|
+
INDENT.repeat(depth) +
|
|
82
|
+
'}'
|
|
83
|
+
);
|
|
72
84
|
}
|
|
73
85
|
|
|
74
86
|
// This should never happen, if it did, something went wrong
|