@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
|
@@ -54,25 +54,14 @@ function generateProperties(name: string, colors: string[]) {
|
|
|
54
54
|
return elementsProperties;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
function generateFill(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
) {
|
|
61
|
-
const {
|
|
62
|
-
translateX: translateX1,
|
|
63
|
-
translateY: translateY1,
|
|
64
|
-
rotate: rotate1,
|
|
65
|
-
} = properties[1];
|
|
66
|
-
const {
|
|
67
|
-
translateX: translateX2,
|
|
68
|
-
translateY: translateY2,
|
|
69
|
-
rotate: rotate2,
|
|
70
|
-
scale,
|
|
71
|
-
} = properties[2];
|
|
57
|
+
function generateFill(properties: ReturnType<typeof generateProperties>, name: string) {
|
|
58
|
+
const { translateX: translateX1, translateY: translateY1, rotate: rotate1 } = properties[1];
|
|
59
|
+
const { translateX: translateX2, translateY: translateY2, rotate: rotate2, scale } = properties[2];
|
|
72
60
|
|
|
73
61
|
let nameParts = name
|
|
74
62
|
.replace(emojiRegexPattern, ' ') // Remove emojis from the name
|
|
75
|
-
.trim()
|
|
63
|
+
.trim()
|
|
64
|
+
.replace(/\s+/g, ' ') // Remove multiple spaces
|
|
76
65
|
.toUpperCase()
|
|
77
66
|
.split(' '); // Ideally if the Actor has a name with spaces, we take words separated by spaces
|
|
78
67
|
|
|
@@ -82,7 +71,9 @@ function generateFill(
|
|
|
82
71
|
if (nameParts.length <= 1) nameParts = nameParts[0].split(''); // In the end we take the first word and separate it by letter
|
|
83
72
|
|
|
84
73
|
// Nice to have: remove ignored words from the name if the name has more than 2 words
|
|
85
|
-
if (nameParts.length > 2) {
|
|
74
|
+
if (nameParts.length > 2) {
|
|
75
|
+
nameParts = nameParts.filter((part) => !IGNORED_WORDS.includes(part));
|
|
76
|
+
}
|
|
86
77
|
|
|
87
78
|
return {
|
|
88
79
|
fill0: properties[0].color,
|
|
@@ -104,159 +95,135 @@ interface BoringAvatarProps {
|
|
|
104
95
|
alt?: string;
|
|
105
96
|
}
|
|
106
97
|
|
|
107
|
-
export const BoringAvatarMarble = React.memo(
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
<mask
|
|
132
|
-
id="mask__marble"
|
|
133
|
-
maskUnits="userSpaceOnUse"
|
|
134
|
-
x={0}
|
|
135
|
-
y={0}
|
|
136
|
-
width={SIZE}
|
|
137
|
-
height={SIZE}
|
|
98
|
+
export const BoringAvatarMarble = React.memo(
|
|
99
|
+
({
|
|
100
|
+
name = '',
|
|
101
|
+
colors = ['#12966F', '#5D85E1', '#E44467', '#F0B21B', '#FA8136', '#30C0BB'],
|
|
102
|
+
square = false,
|
|
103
|
+
className,
|
|
104
|
+
size = 24,
|
|
105
|
+
alt = 'Avatar image',
|
|
106
|
+
}: BoringAvatarProps) => {
|
|
107
|
+
const fill = useMemo(() => {
|
|
108
|
+
const properties = generateProperties(name ?? '', colors);
|
|
109
|
+
return generateFill(properties, name ?? '');
|
|
110
|
+
}, [name, colors]);
|
|
111
|
+
|
|
112
|
+
return (
|
|
113
|
+
<svg
|
|
114
|
+
viewBox={`0 0 ${SIZE} ${SIZE}`}
|
|
115
|
+
fill="none"
|
|
116
|
+
role="img"
|
|
117
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
118
|
+
width={size}
|
|
119
|
+
height={size}
|
|
120
|
+
className={className}
|
|
121
|
+
aria-label={alt}
|
|
138
122
|
>
|
|
139
|
-
<
|
|
140
|
-
width={SIZE}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
fill=
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
colors = ['#B8487B', '#E5B557', '#58BCC4', '#6D85CA', '#8690BF', '#F08848', '#8148C9', '#439274'],
|
|
199
|
-
square = false,
|
|
200
|
-
className,
|
|
201
|
-
size = 24,
|
|
202
|
-
}: BoringAvatarProps) => {
|
|
203
|
-
/**
|
|
123
|
+
<mask id="mask__marble" maskUnits="userSpaceOnUse" x={0} y={0} width={SIZE} height={SIZE}>
|
|
124
|
+
<rect width={SIZE} height={SIZE} rx={square ? undefined : SIZE * 2} fill="#FFFFFF" />
|
|
125
|
+
</mask>
|
|
126
|
+
<g mask="url(#mask__marble)">
|
|
127
|
+
<rect width={SIZE} height={SIZE} fill={fill.fill0} />
|
|
128
|
+
<path
|
|
129
|
+
filter="url(#prefix__filter0_f)"
|
|
130
|
+
d="M32.414 59.35L50.376 70.5H72.5v-71H33.728L26.5 13.381l19.057 27.08L32.414 59.35z"
|
|
131
|
+
fill={fill.fill1}
|
|
132
|
+
transform={fill.transform1}
|
|
133
|
+
/>
|
|
134
|
+
<path
|
|
135
|
+
filter="url(#prefix__filter0_f)"
|
|
136
|
+
style={{
|
|
137
|
+
mixBlendMode: 'overlay',
|
|
138
|
+
}}
|
|
139
|
+
d="M22.216 24L0 46.75l14.108 38.129L78 86l-3.081-59.276-22.378 4.005 12.972 20.186-23.35 27.395L22.215 24z"
|
|
140
|
+
fill={fill.fill2}
|
|
141
|
+
transform={fill.transform2}
|
|
142
|
+
/>
|
|
143
|
+
</g>
|
|
144
|
+
<g>
|
|
145
|
+
{fill.letter1 && (
|
|
146
|
+
<text
|
|
147
|
+
style={{ fontSize: '50px' }}
|
|
148
|
+
x="50"
|
|
149
|
+
y="50"
|
|
150
|
+
dy="7"
|
|
151
|
+
textAnchor="middle"
|
|
152
|
+
alignmentBaseline="middle"
|
|
153
|
+
dominantBaseline="middle"
|
|
154
|
+
>
|
|
155
|
+
{fill.letter1}
|
|
156
|
+
{fill.letter2}
|
|
157
|
+
</text>
|
|
158
|
+
)}
|
|
159
|
+
</g>
|
|
160
|
+
<defs>
|
|
161
|
+
<filter id="prefix__filter0_f" filterUnits="userSpaceOnUse" colorInterpolationFilters="sRGB">
|
|
162
|
+
<feFlood floodOpacity={0} result="BackgroundImageFix" />
|
|
163
|
+
<feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape" />
|
|
164
|
+
<feGaussianBlur stdDeviation={7} result="effect1_foregroundBlur" />
|
|
165
|
+
</filter>
|
|
166
|
+
</defs>
|
|
167
|
+
</svg>
|
|
168
|
+
);
|
|
169
|
+
},
|
|
170
|
+
);
|
|
171
|
+
|
|
172
|
+
export const BoringAvatarSolid = React.memo(
|
|
173
|
+
({
|
|
174
|
+
name = '',
|
|
175
|
+
alt = 'Avatar image',
|
|
176
|
+
colors = ['#B8487B', '#E5B557', '#58BCC4', '#6D85CA', '#8690BF', '#F08848', '#8148C9', '#439274'],
|
|
177
|
+
square = false,
|
|
178
|
+
className,
|
|
179
|
+
size = 24,
|
|
180
|
+
}: BoringAvatarProps) => {
|
|
181
|
+
/**
|
|
204
182
|
* Name must be lowercased to avoid irregularities caused by caps.
|
|
205
183
|
* This is an issue in the Actor detail header, where the username comes from the Actor object,
|
|
206
184
|
* while in the user selector it comes from the user object, where it can have capitals.
|
|
207
185
|
*/
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
>
|
|
226
|
-
<mask
|
|
227
|
-
id="mask__solid"
|
|
228
|
-
maskUnits="userSpaceOnUse"
|
|
229
|
-
x={0}
|
|
230
|
-
y={0}
|
|
231
|
-
width={SIZE}
|
|
232
|
-
height={SIZE}
|
|
186
|
+
const nameLowercase = name.toLowerCase();
|
|
187
|
+
|
|
188
|
+
const fill = useMemo(() => {
|
|
189
|
+
const properties = generateProperties(nameLowercase, colors);
|
|
190
|
+
return generateFill(properties, nameLowercase);
|
|
191
|
+
}, [nameLowercase, colors]);
|
|
192
|
+
|
|
193
|
+
return (
|
|
194
|
+
<svg
|
|
195
|
+
viewBox={`0 0 ${SIZE} ${SIZE}`}
|
|
196
|
+
fill="none"
|
|
197
|
+
role="img"
|
|
198
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
199
|
+
width={size}
|
|
200
|
+
height={size}
|
|
201
|
+
className={className}
|
|
202
|
+
aria-label={alt}
|
|
233
203
|
>
|
|
234
|
-
<
|
|
235
|
-
width={SIZE}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
fill=
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
</svg>
|
|
261
|
-
);
|
|
262
|
-
});
|
|
204
|
+
<mask id="mask__solid" maskUnits="userSpaceOnUse" x={0} y={0} width={SIZE} height={SIZE}>
|
|
205
|
+
<rect width={SIZE} height={SIZE} rx={square ? undefined : SIZE * 2} fill="#FFFFFF" />
|
|
206
|
+
</mask>
|
|
207
|
+
<g mask="url(#mask__solid)">
|
|
208
|
+
<rect width={SIZE} height={SIZE} fill={fill.fill0} />
|
|
209
|
+
</g>
|
|
210
|
+
<g>
|
|
211
|
+
{fill.letter1 && (
|
|
212
|
+
<text
|
|
213
|
+
style={{ fontSize: '50px' }}
|
|
214
|
+
x="50"
|
|
215
|
+
y="50"
|
|
216
|
+
dy="7"
|
|
217
|
+
textAnchor="middle"
|
|
218
|
+
alignmentBaseline="middle"
|
|
219
|
+
dominantBaseline="middle"
|
|
220
|
+
>
|
|
221
|
+
{fill.letter1}
|
|
222
|
+
{fill.letter2}
|
|
223
|
+
</text>
|
|
224
|
+
)}
|
|
225
|
+
</g>
|
|
226
|
+
</svg>
|
|
227
|
+
);
|
|
228
|
+
},
|
|
229
|
+
);
|
|
@@ -90,11 +90,7 @@ export const WithImageUrl: Story = {
|
|
|
90
90
|
<small>With image</small>
|
|
91
91
|
</div>
|
|
92
92
|
<div>
|
|
93
|
-
<UserAvatar
|
|
94
|
-
name="John Doe"
|
|
95
|
-
url="https://wrong-url-to-trigger-error.com/avatar.png"
|
|
96
|
-
size={64}
|
|
97
|
-
/>
|
|
93
|
+
<UserAvatar name="John Doe" url="https://wrong-url-to-trigger-error.com/avatar.png" size={64} />
|
|
98
94
|
<small>With broken image URL</small>
|
|
99
95
|
</div>
|
|
100
96
|
<div>
|
|
@@ -49,15 +49,7 @@ interface UserAvatarProps extends React.ImgHTMLAttributes<HTMLImageElement> {
|
|
|
49
49
|
asOrganization?: boolean;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
const UserAvatarInner: FC<UserAvatarProps> = ({
|
|
53
|
-
name,
|
|
54
|
-
className,
|
|
55
|
-
url,
|
|
56
|
-
size,
|
|
57
|
-
alt,
|
|
58
|
-
asOrganization,
|
|
59
|
-
...rest
|
|
60
|
-
}) => {
|
|
52
|
+
const UserAvatarInner: FC<UserAvatarProps> = ({ name, className, url, size, alt, asOrganization, ...rest }) => {
|
|
61
53
|
const [imgError, setImgError] = React.useState(false);
|
|
62
54
|
const { generateProxyImageUrl } = useSharedUiDependencies();
|
|
63
55
|
|
|
@@ -86,9 +78,10 @@ const UserAvatarInner: FC<UserAvatarProps> = ({
|
|
|
86
78
|
return (
|
|
87
79
|
<StyledImg
|
|
88
80
|
className={fullClassName}
|
|
89
|
-
src={
|
|
90
|
-
|
|
91
|
-
|
|
81
|
+
src={
|
|
82
|
+
generateProxyImageUrl
|
|
83
|
+
? generateProxyImageUrl(url, { resize: { height: size * 2, width: size * 2 } })
|
|
84
|
+
: url
|
|
92
85
|
}
|
|
93
86
|
width={size}
|
|
94
87
|
height={size}
|
|
@@ -98,14 +91,7 @@ const UserAvatarInner: FC<UserAvatarProps> = ({
|
|
|
98
91
|
/>
|
|
99
92
|
);
|
|
100
93
|
}
|
|
101
|
-
return
|
|
102
|
-
<StyledBoringAvatarSolid
|
|
103
|
-
alt={altText}
|
|
104
|
-
size={size}
|
|
105
|
-
className={fullClassName}
|
|
106
|
-
name={name}
|
|
107
|
-
/>
|
|
108
|
-
);
|
|
94
|
+
return <StyledBoringAvatarSolid alt={altText} size={size} className={fullClassName} name={name} />;
|
|
109
95
|
};
|
|
110
96
|
|
|
111
97
|
export const UserAvatar = React.memo(UserAvatarInner);
|
|
@@ -21,7 +21,7 @@ export default {
|
|
|
21
21
|
|
|
22
22
|
const Table = styled.table`
|
|
23
23
|
td {
|
|
24
|
-
padding: 8px
|
|
24
|
+
padding: 8px;
|
|
25
25
|
}
|
|
26
26
|
`;
|
|
27
27
|
|
|
@@ -29,53 +29,39 @@ export const Default = () => {
|
|
|
29
29
|
return (
|
|
30
30
|
<Table>
|
|
31
31
|
<tbody>
|
|
32
|
-
{BADGE_VARIANTS.map((variant) =>
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
<
|
|
37
|
-
<
|
|
38
|
-
size={size}
|
|
39
|
-
variant={variant}
|
|
40
|
-
LeadingIcon={PeopleIcon}
|
|
41
|
-
>
|
|
32
|
+
{BADGE_VARIANTS.map((variant) => (
|
|
33
|
+
<tr key={variant}>
|
|
34
|
+
{BADGE_SIZES.map((size) => {
|
|
35
|
+
return (
|
|
36
|
+
<React.Fragment key={size}>
|
|
37
|
+
<td>
|
|
38
|
+
<Badge size={size} variant={variant} LeadingIcon={PeopleIcon}>
|
|
42
39
|
Badge
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
size={size}
|
|
54
|
-
type="code"
|
|
55
|
-
variant={variant}
|
|
56
|
-
LeadingIcon={PeopleIcon}
|
|
57
|
-
>
|
|
40
|
+
</Badge>
|
|
41
|
+
</td>
|
|
42
|
+
</React.Fragment>
|
|
43
|
+
);
|
|
44
|
+
})}
|
|
45
|
+
{BADGE_SIZES.map((size) => {
|
|
46
|
+
return (
|
|
47
|
+
<React.Fragment key={`code-${size}`}>
|
|
48
|
+
<td>
|
|
49
|
+
<Badge size={size} type="code" variant={variant} LeadingIcon={PeopleIcon}>
|
|
58
50
|
Badge
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
)}
|
|
51
|
+
</Badge>
|
|
52
|
+
</td>
|
|
53
|
+
</React.Fragment>
|
|
54
|
+
);
|
|
55
|
+
})}
|
|
56
|
+
</tr>
|
|
57
|
+
))}
|
|
66
58
|
</tbody>
|
|
67
59
|
</Table>
|
|
68
60
|
);
|
|
69
61
|
};
|
|
70
62
|
|
|
71
63
|
export const Playground = ({ size, LeadingIcon, ...props }) => {
|
|
72
|
-
return
|
|
73
|
-
<Badge
|
|
74
|
-
size={size}
|
|
75
|
-
LeadingIcon={LeadingIcon ? PeopleIcon : undefined}
|
|
76
|
-
{...props}
|
|
77
|
-
/>
|
|
78
|
-
);
|
|
64
|
+
return <Badge size={size} LeadingIcon={LeadingIcon ? PeopleIcon : undefined} {...props} />;
|
|
79
65
|
};
|
|
80
66
|
|
|
81
67
|
Playground.propTypes = {
|
package/src/components/badge.tsx
CHANGED
|
@@ -28,9 +28,24 @@ const BADGE_TEXT_SIZES = {
|
|
|
28
28
|
extra_small: 'small',
|
|
29
29
|
} satisfies Record<BadgeSize, SharedTextSize>;
|
|
30
30
|
|
|
31
|
-
export type BadgeVariant =
|
|
31
|
+
export type BadgeVariant =
|
|
32
|
+
| 'neutral'
|
|
33
|
+
| 'neutral_muted'
|
|
34
|
+
| 'neutral_subtle'
|
|
35
|
+
| 'primary_black'
|
|
36
|
+
| 'primary_blue'
|
|
37
|
+
| 'success'
|
|
38
|
+
| 'warning'
|
|
39
|
+
| 'danger';
|
|
32
40
|
export const BADGE_VARIANTS: BadgeVariant[] = [
|
|
33
|
-
'neutral',
|
|
41
|
+
'neutral',
|
|
42
|
+
'neutral_muted',
|
|
43
|
+
'neutral_subtle',
|
|
44
|
+
'primary_black',
|
|
45
|
+
'primary_blue',
|
|
46
|
+
'success',
|
|
47
|
+
'warning',
|
|
48
|
+
'danger',
|
|
34
49
|
] as const;
|
|
35
50
|
|
|
36
51
|
type SharedBadgeProps = Omit<RegularBoxProps, 'as' | 'onClick'> & MarginSpacingProps;
|
|
@@ -108,15 +123,13 @@ const badgeVariantStyle = {
|
|
|
108
123
|
`,
|
|
109
124
|
} satisfies Record<BadgeVariant, FlattenSimpleInterpolation>;
|
|
110
125
|
|
|
111
|
-
type StyledBadgeProps = WithTransientProps<
|
|
112
|
-
Required<Pick<BadgeProps, 'size' | 'variant' | 'inline'>>
|
|
113
|
-
>;
|
|
126
|
+
type StyledBadgeProps = WithTransientProps<Required<Pick<BadgeProps, 'size' | 'variant' | 'inline'>>>;
|
|
114
127
|
|
|
115
128
|
const StyledBadge = styled(Box)<StyledBadgeProps>`
|
|
116
129
|
${({ $size }) => badgeSizeStyle[$size]};
|
|
117
130
|
${({ $variant }) => badgeVariantStyle[$variant]};
|
|
118
131
|
|
|
119
|
-
|
|
132
|
+
/* Static styles */
|
|
120
133
|
width: fit-content;
|
|
121
134
|
border: none;
|
|
122
135
|
outline: none;
|
|
@@ -136,29 +149,27 @@ const StyledBadge = styled(Box)<StyledBadgeProps>`
|
|
|
136
149
|
* Component for displaying non-interactive chip descendant.
|
|
137
150
|
*/
|
|
138
151
|
export const Badge = forwardRef(
|
|
139
|
-
(
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
152
|
+
(
|
|
153
|
+
{
|
|
154
|
+
size = 'small',
|
|
155
|
+
type = 'body',
|
|
156
|
+
variant = 'neutral',
|
|
157
|
+
inline = false,
|
|
158
|
+
LeadingIcon,
|
|
159
|
+
TrailingIcon,
|
|
160
|
+
children,
|
|
161
|
+
...props
|
|
162
|
+
}: BadgeProps,
|
|
163
|
+
ref,
|
|
150
164
|
) => {
|
|
151
165
|
return (
|
|
152
|
-
<StyledBadge
|
|
153
|
-
ref={ref}
|
|
154
|
-
$size={size}
|
|
155
|
-
$variant={variant}
|
|
156
|
-
$inline={inline}
|
|
157
|
-
forwardedAs='span'
|
|
158
|
-
{...props}
|
|
159
|
-
>
|
|
166
|
+
<StyledBadge ref={ref} $size={size} $variant={variant} $inline={inline} forwardedAs="span" {...props}>
|
|
160
167
|
{LeadingIcon && <LeadingIcon size={BADGE_ICON_SIZES[size]} />}
|
|
161
|
-
{children && (
|
|
168
|
+
{children && (
|
|
169
|
+
<Text size={BADGE_TEXT_SIZES[size]} type={type} weight="medium" as="span">
|
|
170
|
+
{children}
|
|
171
|
+
</Text>
|
|
172
|
+
)}
|
|
162
173
|
{TrailingIcon && <TrailingIcon size={BADGE_ICON_SIZES[size]} />}
|
|
163
174
|
</StyledBadge>
|
|
164
175
|
);
|