@elastic/eui 98.2.0 → 98.2.1-borealis.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/dist/{eui_theme_dark.json.d.ts → eui_theme_amsterdam_dark.json.d.ts} +1 -1
- package/dist/{eui_theme_light.json.d.ts → eui_theme_amsterdam_light.json.d.ts} +1 -1
- package/dist/eui_theme_borealis_dark.json +314 -0
- package/dist/eui_theme_borealis_dark.json.d.ts +317 -0
- package/dist/eui_theme_borealis_light.json +314 -0
- package/dist/eui_theme_borealis_light.json.d.ts +317 -0
- package/es/components/avatar/avatar.js +10 -4
- package/es/components/badge/badge.styles.js +1 -2
- package/es/components/badge/beta_badge/beta_badge.styles.js +3 -1
- package/es/components/badge/color_utils.js +9 -8
- package/es/components/beacon/beacon.styles.js +2 -2
- package/es/components/bottom_bar/bottom_bar.styles.js +1 -2
- package/es/components/breadcrumbs/_breadcrumb_content.styles.js +5 -7
- package/es/components/button/button.js +1 -1
- package/es/components/button/button_display/_button_display.styles.js +1 -1
- package/es/components/button/button_empty/button_empty.js +1 -1
- package/es/components/button/button_group/button_group_button.js +1 -1
- package/es/components/button/button_group/button_group_button.styles.js +6 -6
- package/es/components/button/button_icon/button_icon.js +1 -1
- package/es/components/card/card.js +1 -1
- package/es/components/card/card.styles.js +6 -3
- package/es/components/code/code_block_annotations.js +1 -1
- package/es/components/code/code_block_line.styles.js +1 -2
- package/es/components/code/code_syntax.styles.js +23 -27
- package/es/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.styles.js +3 -5
- package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.styles.js +1 -1
- package/es/components/color_picker/color_palette_display/color_palette_display.styles.js +1 -2
- package/es/components/color_picker/color_picker.js +9 -3
- package/es/components/color_picker/color_picker.styles.js +1 -2
- package/es/components/color_picker/color_picker_swatch.styles.js +1 -1
- package/es/components/comment_list/comment.js +1 -1
- package/es/components/comment_list/comment_event.js +5 -4
- package/es/components/comment_list/comment_list.js +1 -1
- package/es/components/common.js +0 -28
- package/es/components/datagrid/data_grid.styles.js +6 -7
- package/es/components/date_picker/react_date_picker.styles.js +2 -1
- package/es/components/date_picker/super_date_picker/super_date_picker.styles.js +3 -4
- package/es/components/drag_and_drop/droppable.styles.js +2 -4
- package/es/components/empty_prompt/empty_prompt.js +1 -1
- package/es/components/empty_prompt/empty_prompt.styles.js +6 -2
- package/es/components/filter_group/filter_select_item.styles.js +1 -2
- package/es/components/flyout/_flyout_close_button.styles.js +1 -2
- package/es/components/flyout/flyout.js +1 -1
- package/es/components/flyout/flyout.styles.js +7 -2
- package/es/components/flyout/flyout_footer.styles.js +1 -1
- package/es/components/form/form.styles.js +28 -32
- package/es/components/form/range/range_tooltip.styles.js +11 -13
- package/es/components/form/switch/switch.js +3 -7
- package/es/components/form/switch/switch.styles.js +16 -19
- package/es/components/header/header.styles.js +6 -7
- package/es/components/icon/icon.styles.js +9 -8
- package/es/components/icon/named_colors.js +1 -1
- package/es/components/inline_edit/inline_edit_form.styles.js +1 -2
- package/es/components/key_pad_menu/key_pad_menu_item.styles.js +1 -2
- package/es/components/list_group/list_group_item.styles.js +9 -11
- package/es/components/loading/loading_chart.styles.js +18 -5
- package/es/components/mark/mark.styles.js +2 -9
- package/es/components/markdown_editor/markdown_editor_drop_zone.styles.js +2 -3
- package/es/components/markdown_editor/markdown_format.styles.js +2 -2
- package/es/components/modal/modal.styles.js +1 -1
- package/es/components/overlay_mask/overlay_mask.styles.js +1 -2
- package/es/components/page_template/inner/page_inner.styles.js +2 -2
- package/es/components/panel/panel.js +1 -1
- package/es/components/panel/panel.styles.js +1 -1
- package/es/components/panel/split_panel/split_panel.js +1 -1
- package/es/components/popover/popover.js +1 -1
- package/es/components/popover/popover_arrow/_popover_arrow.js +8 -3
- package/es/components/popover/popover_arrow/_popover_arrow.styles.js +18 -13
- package/es/components/popover/popover_footer.styles.js +1 -1
- package/es/components/popover/popover_panel/_popover_panel.styles.js +4 -4
- package/es/components/progress/progress.js +1 -1
- package/es/components/progress/progress.styles.js +30 -28
- package/es/components/resizable_container/resizable_panel.js +1 -1
- package/es/components/selectable/selectable_list/selectable_list_item.styles.js +1 -2
- package/es/components/side_nav/side_nav_item.styles.js +1 -2
- package/es/components/skeleton/utils.js +5 -7
- package/es/components/steps/step_number.styles.js +1 -1
- package/es/components/table/table_cells_shared.styles.js +2 -7
- package/es/components/table/table_row.styles.js +8 -10
- package/es/components/text/text.styles.js +2 -2
- package/es/components/text/text_color.js +1 -1
- package/es/components/text/text_color.styles.js +6 -5
- package/es/components/toast/toast.styles.js +1 -1
- package/es/components/token/token.js +10 -4
- package/es/components/token/token.styles.js +12 -3
- package/es/components/token/token_map.js +243 -1
- package/es/components/tool_tip/tool_tip.styles.js +12 -24
- package/es/components/tour/_tour_footer.styles.js +2 -4
- package/es/components/tour/tour.styles.js +8 -12
- package/es/components/tree_view/tree_view_item.styles.js +1 -2
- package/es/global_styling/functions/math.js +1 -49
- package/es/global_styling/functions/size.js +1 -17
- package/es/global_styling/mixins/_button.js +159 -0
- package/es/global_styling/mixins/_color.js +39 -31
- package/es/global_styling/mixins/index.js +2 -1
- package/es/global_styling/reset/global_styles.js +2 -2
- package/es/global_styling/variables/_colors_vis.js +1 -53
- package/es/global_styling/variables/animations.js +1 -22
- package/es/global_styling/variables/breakpoint.js +1 -7
- package/es/global_styling/variables/levels.js +1 -17
- package/es/global_styling/variables/shadow.js +1 -11
- package/es/global_styling/variables/size.js +1 -1
- package/es/global_styling/variables/typography.js +1 -32
- package/es/services/color/eui_palettes.js +116 -47
- package/es/services/color/index.js +1 -0
- package/es/services/color/vis_color_store.js +13 -0
- package/es/services/index.js +1 -1
- package/es/services/popover/index.js +4 -1
- package/es/services/popover/popover_arrow.styles.js +31 -0
- package/es/services/popover/popover_positioning.js +6 -17
- package/es/services/theme/provider.js +26 -2
- package/es/services/theme/types.js +1 -6
- package/es/services/theme/utils.js +1 -303
- package/es/themes/amsterdam/global_styling/mixins/button.js +1 -203
- package/es/themes/amsterdam/global_styling/variables/_borders.js +3 -3
- package/es/themes/amsterdam/global_styling/variables/_buttons.js +281 -0
- package/es/themes/amsterdam/global_styling/variables/_colors.js +618 -25
- package/es/themes/amsterdam/global_styling/variables/_colors_vis.js +109 -0
- package/es/themes/amsterdam/global_styling/variables/_components.js +604 -0
- package/es/themes/amsterdam/global_styling/variables/_forms.js +161 -0
- package/es/themes/amsterdam/theme.js +7 -1
- package/es/themes/index.js +1 -1
- package/es/themes/themes.js +9 -6
- package/eui.d.ts +2382 -2830
- package/lib/components/avatar/avatar.js +8 -2
- package/lib/components/badge/badge.styles.js +1 -2
- package/lib/components/badge/beta_badge/beta_badge.styles.js +3 -1
- package/lib/components/badge/color_utils.js +14 -13
- package/lib/components/beacon/beacon.styles.js +2 -2
- package/lib/components/bottom_bar/bottom_bar.styles.js +1 -2
- package/lib/components/breadcrumbs/_breadcrumb_content.styles.js +5 -7
- package/lib/components/button/button.js +1 -1
- package/lib/components/button/button_display/_button_display.styles.js +1 -1
- package/lib/components/button/button_empty/button_empty.js +1 -1
- package/lib/components/button/button_group/button_group_button.js +1 -1
- package/lib/components/button/button_group/button_group_button.styles.js +5 -5
- package/lib/components/button/button_icon/button_icon.js +1 -1
- package/lib/components/card/card.js +1 -1
- package/lib/components/card/card.styles.js +5 -2
- package/lib/components/code/code_block_annotations.js +1 -1
- package/lib/components/code/code_block_line.styles.js +1 -2
- package/lib/components/code/code_syntax.styles.js +23 -27
- package/lib/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.styles.js +3 -5
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.styles.js +1 -1
- package/lib/components/color_picker/color_palette_display/color_palette_display.styles.js +1 -2
- package/lib/components/color_picker/color_picker.js +8 -2
- package/lib/components/color_picker/color_picker.styles.js +1 -2
- package/lib/components/color_picker/color_picker_swatch.styles.js +1 -1
- package/lib/components/comment_list/comment.js +1 -1
- package/lib/components/comment_list/comment_event.js +5 -4
- package/lib/components/comment_list/comment_list.js +1 -1
- package/lib/components/common.js +0 -28
- package/lib/components/datagrid/data_grid.styles.js +6 -7
- package/lib/components/date_picker/react_date_picker.styles.js +3 -2
- package/lib/components/date_picker/super_date_picker/super_date_picker.styles.js +2 -3
- package/lib/components/drag_and_drop/droppable.styles.js +2 -4
- package/lib/components/empty_prompt/empty_prompt.js +1 -1
- package/lib/components/empty_prompt/empty_prompt.styles.js +5 -1
- package/lib/components/filter_group/filter_select_item.styles.js +1 -2
- package/lib/components/flyout/_flyout_close_button.styles.js +1 -2
- package/lib/components/flyout/flyout.js +1 -1
- package/lib/components/flyout/flyout.styles.js +7 -2
- package/lib/components/flyout/flyout_footer.styles.js +1 -1
- package/lib/components/form/form.styles.js +27 -31
- package/lib/components/form/range/range_tooltip.styles.js +11 -13
- package/lib/components/form/switch/switch.js +3 -7
- package/lib/components/form/switch/switch.styles.js +16 -19
- package/lib/components/header/header.styles.js +5 -6
- package/lib/components/icon/icon.styles.js +9 -8
- package/lib/components/icon/named_colors.js +1 -1
- package/lib/components/inline_edit/inline_edit_form.styles.js +1 -2
- package/lib/components/key_pad_menu/key_pad_menu_item.styles.js +1 -2
- package/lib/components/list_group/list_group_item.styles.js +8 -10
- package/lib/components/loading/loading_chart.styles.js +18 -5
- package/lib/components/mark/mark.styles.js +2 -9
- package/lib/components/markdown_editor/markdown_editor_drop_zone.styles.js +2 -3
- package/lib/components/markdown_editor/markdown_format.styles.js +2 -2
- package/lib/components/modal/modal.styles.js +1 -1
- package/lib/components/overlay_mask/overlay_mask.styles.js +1 -2
- package/lib/components/page_template/inner/page_inner.styles.js +1 -1
- package/lib/components/panel/panel.js +1 -1
- package/lib/components/panel/panel.styles.js +1 -1
- package/lib/components/panel/split_panel/split_panel.js +1 -1
- package/lib/components/popover/popover.js +1 -1
- package/lib/components/popover/popover_arrow/_popover_arrow.js +8 -3
- package/lib/components/popover/popover_arrow/_popover_arrow.styles.js +18 -15
- package/lib/components/popover/popover_footer.styles.js +1 -1
- package/lib/components/popover/popover_panel/_popover_panel.styles.js +4 -4
- package/lib/components/progress/progress.js +1 -1
- package/lib/components/progress/progress.styles.js +29 -27
- package/lib/components/resizable_container/resizable_panel.js +1 -1
- package/lib/components/selectable/selectable_list/selectable_list_item.styles.js +1 -2
- package/lib/components/side_nav/side_nav_item.styles.js +1 -2
- package/lib/components/skeleton/utils.js +4 -6
- package/lib/components/steps/step_number.styles.js +1 -1
- package/lib/components/table/table_cells_shared.styles.js +2 -7
- package/lib/components/table/table_row.styles.js +7 -9
- package/lib/components/text/text.styles.js +1 -1
- package/lib/components/text/text_color.js +1 -1
- package/lib/components/text/text_color.styles.js +6 -5
- package/lib/components/toast/toast.styles.js +1 -1
- package/lib/components/token/token.js +12 -4
- package/lib/components/token/token.styles.js +12 -3
- package/lib/components/token/token_map.js +244 -2
- package/lib/components/tool_tip/tool_tip.styles.js +11 -23
- package/lib/components/tour/_tour_footer.styles.js +2 -4
- package/lib/components/tour/tour.styles.js +8 -12
- package/lib/components/tree_view/tree_view_item.styles.js +1 -2
- package/lib/global_styling/functions/math.js +7 -58
- package/lib/global_styling/functions/size.js +7 -26
- package/lib/global_styling/mixins/_button.js +164 -0
- package/lib/global_styling/mixins/_color.js +38 -30
- package/lib/global_styling/mixins/index.js +11 -0
- package/lib/global_styling/reset/global_styles.js +1 -1
- package/lib/global_styling/variables/_colors_vis.js +6 -61
- package/lib/global_styling/variables/animations.js +25 -31
- package/lib/global_styling/variables/breakpoint.js +7 -16
- package/lib/global_styling/variables/levels.js +7 -26
- package/lib/global_styling/variables/shadow.js +13 -20
- package/lib/global_styling/variables/size.js +7 -10
- package/lib/global_styling/variables/typography.js +19 -41
- package/lib/services/color/eui_palettes.js +116 -47
- package/lib/services/color/index.js +8 -0
- package/lib/services/color/vis_color_store.js +18 -0
- package/lib/services/index.js +7 -0
- package/lib/services/popover/index.js +8 -1
- package/lib/services/popover/popover_arrow.styles.js +37 -0
- package/lib/services/popover/popover_positioning.js +6 -17
- package/lib/services/theme/provider.js +26 -2
- package/lib/services/theme/types.js +13 -14
- package/lib/services/theme/utils.js +54 -303
- package/lib/themes/amsterdam/global_styling/mixins/button.js +45 -206
- package/lib/themes/amsterdam/global_styling/variables/_borders.js +3 -3
- package/lib/themes/amsterdam/global_styling/variables/_buttons.js +285 -0
- package/lib/themes/amsterdam/global_styling/variables/_colors.js +617 -25
- package/lib/themes/amsterdam/global_styling/variables/_colors_vis.js +115 -0
- package/lib/themes/amsterdam/global_styling/variables/_components.js +608 -0
- package/lib/themes/amsterdam/global_styling/variables/_forms.js +165 -0
- package/lib/themes/amsterdam/theme.js +7 -1
- package/lib/themes/index.js +7 -0
- package/lib/themes/themes.js +10 -7
- package/optimize/es/components/avatar/avatar.js +10 -4
- package/optimize/es/components/badge/badge.styles.js +1 -2
- package/optimize/es/components/badge/beta_badge/beta_badge.styles.js +3 -1
- package/optimize/es/components/badge/color_utils.js +9 -8
- package/optimize/es/components/beacon/beacon.styles.js +2 -2
- package/optimize/es/components/bottom_bar/bottom_bar.styles.js +1 -2
- package/optimize/es/components/breadcrumbs/_breadcrumb_content.styles.js +5 -7
- package/optimize/es/components/button/button.js +1 -1
- package/optimize/es/components/button/button_display/_button_display.styles.js +1 -1
- package/optimize/es/components/button/button_empty/button_empty.js +1 -1
- package/optimize/es/components/button/button_group/button_group_button.js +1 -1
- package/optimize/es/components/button/button_group/button_group_button.styles.js +6 -6
- package/optimize/es/components/button/button_icon/button_icon.js +1 -1
- package/optimize/es/components/card/card.styles.js +6 -3
- package/optimize/es/components/code/code_block_annotations.js +1 -1
- package/optimize/es/components/code/code_block_line.styles.js +1 -2
- package/optimize/es/components/code/code_syntax.styles.js +23 -27
- package/optimize/es/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.styles.js +3 -5
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.styles.js +1 -1
- package/optimize/es/components/color_picker/color_palette_display/color_palette_display.styles.js +1 -2
- package/optimize/es/components/color_picker/color_picker.js +9 -3
- package/optimize/es/components/color_picker/color_picker.styles.js +1 -2
- package/optimize/es/components/color_picker/color_picker_swatch.styles.js +1 -1
- package/optimize/es/components/comment_list/comment_event.js +4 -3
- package/optimize/es/components/common.js +0 -28
- package/optimize/es/components/datagrid/data_grid.styles.js +6 -7
- package/optimize/es/components/date_picker/react_date_picker.styles.js +2 -1
- package/optimize/es/components/date_picker/super_date_picker/super_date_picker.styles.js +3 -4
- package/optimize/es/components/drag_and_drop/droppable.styles.js +2 -4
- package/optimize/es/components/empty_prompt/empty_prompt.styles.js +6 -2
- package/optimize/es/components/filter_group/filter_select_item.styles.js +1 -2
- package/optimize/es/components/flyout/_flyout_close_button.styles.js +1 -2
- package/optimize/es/components/flyout/flyout.js +1 -1
- package/optimize/es/components/flyout/flyout.styles.js +7 -2
- package/optimize/es/components/flyout/flyout_footer.styles.js +1 -1
- package/optimize/es/components/form/form.styles.js +28 -32
- package/optimize/es/components/form/range/range_tooltip.styles.js +11 -13
- package/optimize/es/components/form/switch/switch.js +3 -2
- package/optimize/es/components/form/switch/switch.styles.js +16 -19
- package/optimize/es/components/header/header.styles.js +6 -7
- package/optimize/es/components/icon/icon.styles.js +9 -8
- package/optimize/es/components/icon/named_colors.js +1 -1
- package/optimize/es/components/inline_edit/inline_edit_form.styles.js +1 -2
- package/optimize/es/components/key_pad_menu/key_pad_menu_item.styles.js +1 -2
- package/optimize/es/components/list_group/list_group_item.styles.js +9 -11
- package/optimize/es/components/loading/loading_chart.styles.js +13 -5
- package/optimize/es/components/mark/mark.styles.js +2 -9
- package/optimize/es/components/markdown_editor/markdown_editor_drop_zone.styles.js +2 -3
- package/optimize/es/components/markdown_editor/markdown_format.styles.js +2 -2
- package/optimize/es/components/modal/modal.styles.js +1 -1
- package/optimize/es/components/overlay_mask/overlay_mask.styles.js +1 -2
- package/optimize/es/components/page_template/inner/page_inner.styles.js +2 -2
- package/optimize/es/components/panel/panel.styles.js +1 -1
- package/optimize/es/components/popover/popover.js +1 -1
- package/optimize/es/components/popover/popover_arrow/_popover_arrow.js +8 -3
- package/optimize/es/components/popover/popover_arrow/_popover_arrow.styles.js +15 -13
- package/optimize/es/components/popover/popover_footer.styles.js +1 -1
- package/optimize/es/components/popover/popover_panel/_popover_panel.styles.js +4 -4
- package/optimize/es/components/progress/progress.js +1 -1
- package/optimize/es/components/progress/progress.styles.js +30 -28
- package/optimize/es/components/selectable/selectable_list/selectable_list_item.styles.js +1 -2
- package/optimize/es/components/side_nav/side_nav_item.styles.js +1 -2
- package/optimize/es/components/skeleton/utils.js +5 -7
- package/optimize/es/components/steps/step_number.styles.js +1 -1
- package/optimize/es/components/table/table_cells_shared.styles.js +2 -7
- package/optimize/es/components/table/table_row.styles.js +8 -10
- package/optimize/es/components/text/text.styles.js +2 -2
- package/optimize/es/components/text/text_color.js +1 -1
- package/optimize/es/components/text/text_color.styles.js +6 -5
- package/optimize/es/components/toast/toast.styles.js +1 -1
- package/optimize/es/components/token/token.js +10 -4
- package/optimize/es/components/token/token.styles.js +12 -3
- package/optimize/es/components/token/token_map.js +243 -1
- package/optimize/es/components/tool_tip/tool_tip.styles.js +12 -24
- package/optimize/es/components/tour/_tour_footer.styles.js +2 -4
- package/optimize/es/components/tour/tour.styles.js +8 -12
- package/optimize/es/components/tree_view/tree_view_item.styles.js +1 -2
- package/optimize/es/global_styling/functions/math.js +1 -49
- package/optimize/es/global_styling/functions/size.js +1 -17
- package/optimize/es/global_styling/mixins/_button.js +159 -0
- package/optimize/es/global_styling/mixins/_color.js +39 -31
- package/optimize/es/global_styling/mixins/index.js +2 -1
- package/optimize/es/global_styling/reset/global_styles.js +2 -2
- package/optimize/es/global_styling/variables/_colors_vis.js +1 -53
- package/optimize/es/global_styling/variables/animations.js +1 -22
- package/optimize/es/global_styling/variables/breakpoint.js +1 -7
- package/optimize/es/global_styling/variables/levels.js +1 -17
- package/optimize/es/global_styling/variables/shadow.js +1 -11
- package/optimize/es/global_styling/variables/size.js +1 -1
- package/optimize/es/global_styling/variables/typography.js +1 -32
- package/optimize/es/services/color/eui_palettes.js +116 -47
- package/optimize/es/services/color/index.js +1 -0
- package/optimize/es/services/color/vis_color_store.js +13 -0
- package/optimize/es/services/index.js +1 -1
- package/optimize/es/services/popover/index.js +4 -1
- package/optimize/es/services/popover/popover_arrow.styles.js +31 -0
- package/optimize/es/services/popover/popover_positioning.js +6 -17
- package/optimize/es/services/theme/provider.js +26 -2
- package/optimize/es/services/theme/types.js +1 -6
- package/optimize/es/services/theme/utils.js +1 -295
- package/optimize/es/themes/amsterdam/global_styling/mixins/button.js +1 -198
- package/optimize/es/themes/amsterdam/global_styling/variables/_borders.js +3 -3
- package/optimize/es/themes/amsterdam/global_styling/variables/_buttons.js +270 -0
- package/optimize/es/themes/amsterdam/global_styling/variables/_colors.js +618 -25
- package/optimize/es/themes/amsterdam/global_styling/variables/_colors_vis.js +109 -0
- package/optimize/es/themes/amsterdam/global_styling/variables/_components.js +596 -0
- package/optimize/es/themes/amsterdam/global_styling/variables/_forms.js +153 -0
- package/optimize/es/themes/amsterdam/theme.js +7 -1
- package/optimize/es/themes/index.js +1 -1
- package/optimize/es/themes/themes.js +9 -6
- package/optimize/lib/components/avatar/avatar.js +8 -2
- package/optimize/lib/components/badge/badge.styles.js +1 -2
- package/optimize/lib/components/badge/beta_badge/beta_badge.styles.js +3 -1
- package/optimize/lib/components/badge/color_utils.js +14 -13
- package/optimize/lib/components/beacon/beacon.styles.js +2 -2
- package/optimize/lib/components/bottom_bar/bottom_bar.styles.js +1 -2
- package/optimize/lib/components/breadcrumbs/_breadcrumb_content.styles.js +5 -7
- package/optimize/lib/components/button/button.js +1 -1
- package/optimize/lib/components/button/button_display/_button_display.styles.js +1 -1
- package/optimize/lib/components/button/button_empty/button_empty.js +1 -1
- package/optimize/lib/components/button/button_group/button_group_button.js +1 -1
- package/optimize/lib/components/button/button_group/button_group_button.styles.js +5 -5
- package/optimize/lib/components/button/button_icon/button_icon.js +1 -1
- package/optimize/lib/components/card/card.styles.js +5 -2
- package/optimize/lib/components/code/code_block_annotations.js +1 -1
- package/optimize/lib/components/code/code_block_line.styles.js +1 -2
- package/optimize/lib/components/code/code_syntax.styles.js +23 -27
- package/optimize/lib/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.styles.js +3 -5
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.styles.js +1 -1
- package/optimize/lib/components/color_picker/color_palette_display/color_palette_display.styles.js +1 -2
- package/optimize/lib/components/color_picker/color_picker.js +8 -2
- package/optimize/lib/components/color_picker/color_picker.styles.js +1 -2
- package/optimize/lib/components/color_picker/color_picker_swatch.styles.js +1 -1
- package/optimize/lib/components/comment_list/comment_event.js +4 -3
- package/optimize/lib/components/common.js +0 -28
- package/optimize/lib/components/datagrid/data_grid.styles.js +6 -7
- package/optimize/lib/components/date_picker/react_date_picker.styles.js +3 -2
- package/optimize/lib/components/date_picker/super_date_picker/super_date_picker.styles.js +2 -3
- package/optimize/lib/components/drag_and_drop/droppable.styles.js +2 -4
- package/optimize/lib/components/empty_prompt/empty_prompt.styles.js +5 -1
- package/optimize/lib/components/filter_group/filter_select_item.styles.js +1 -2
- package/optimize/lib/components/flyout/_flyout_close_button.styles.js +1 -2
- package/optimize/lib/components/flyout/flyout.js +1 -1
- package/optimize/lib/components/flyout/flyout.styles.js +7 -2
- package/optimize/lib/components/flyout/flyout_footer.styles.js +1 -1
- package/optimize/lib/components/form/form.styles.js +27 -31
- package/optimize/lib/components/form/range/range_tooltip.styles.js +11 -13
- package/optimize/lib/components/form/switch/switch.js +3 -2
- package/optimize/lib/components/form/switch/switch.styles.js +16 -19
- package/optimize/lib/components/header/header.styles.js +5 -6
- package/optimize/lib/components/icon/icon.styles.js +9 -8
- package/optimize/lib/components/icon/named_colors.js +1 -1
- package/optimize/lib/components/inline_edit/inline_edit_form.styles.js +1 -2
- package/optimize/lib/components/key_pad_menu/key_pad_menu_item.styles.js +1 -2
- package/optimize/lib/components/list_group/list_group_item.styles.js +8 -10
- package/optimize/lib/components/loading/loading_chart.styles.js +13 -5
- package/optimize/lib/components/mark/mark.styles.js +2 -9
- package/optimize/lib/components/markdown_editor/markdown_editor_drop_zone.styles.js +2 -3
- package/optimize/lib/components/markdown_editor/markdown_format.styles.js +2 -2
- package/optimize/lib/components/modal/modal.styles.js +1 -1
- package/optimize/lib/components/overlay_mask/overlay_mask.styles.js +1 -2
- package/optimize/lib/components/page_template/inner/page_inner.styles.js +1 -1
- package/optimize/lib/components/panel/panel.styles.js +1 -1
- package/optimize/lib/components/popover/popover.js +1 -1
- package/optimize/lib/components/popover/popover_arrow/_popover_arrow.js +8 -3
- package/optimize/lib/components/popover/popover_arrow/_popover_arrow.styles.js +16 -15
- package/optimize/lib/components/popover/popover_footer.styles.js +1 -1
- package/optimize/lib/components/popover/popover_panel/_popover_panel.styles.js +4 -4
- package/optimize/lib/components/progress/progress.js +1 -1
- package/optimize/lib/components/progress/progress.styles.js +29 -27
- package/optimize/lib/components/selectable/selectable_list/selectable_list_item.styles.js +1 -2
- package/optimize/lib/components/side_nav/side_nav_item.styles.js +1 -2
- package/optimize/lib/components/skeleton/utils.js +4 -6
- package/optimize/lib/components/steps/step_number.styles.js +1 -1
- package/optimize/lib/components/table/table_cells_shared.styles.js +2 -7
- package/optimize/lib/components/table/table_row.styles.js +7 -9
- package/optimize/lib/components/text/text.styles.js +1 -1
- package/optimize/lib/components/text/text_color.js +1 -1
- package/optimize/lib/components/text/text_color.styles.js +6 -5
- package/optimize/lib/components/toast/toast.styles.js +1 -1
- package/optimize/lib/components/token/token.js +13 -4
- package/optimize/lib/components/token/token.styles.js +12 -3
- package/optimize/lib/components/token/token_map.js +244 -2
- package/optimize/lib/components/tool_tip/tool_tip.styles.js +11 -23
- package/optimize/lib/components/tour/_tour_footer.styles.js +2 -4
- package/optimize/lib/components/tour/tour.styles.js +8 -12
- package/optimize/lib/components/tree_view/tree_view_item.styles.js +1 -2
- package/optimize/lib/global_styling/functions/math.js +7 -59
- package/optimize/lib/global_styling/functions/size.js +7 -27
- package/optimize/lib/global_styling/mixins/_button.js +165 -0
- package/optimize/lib/global_styling/mixins/_color.js +38 -30
- package/optimize/lib/global_styling/mixins/index.js +11 -0
- package/optimize/lib/global_styling/reset/global_styles.js +1 -1
- package/optimize/lib/global_styling/variables/_colors_vis.js +6 -61
- package/optimize/lib/global_styling/variables/animations.js +25 -31
- package/optimize/lib/global_styling/variables/breakpoint.js +7 -16
- package/optimize/lib/global_styling/variables/levels.js +7 -26
- package/optimize/lib/global_styling/variables/shadow.js +13 -20
- package/optimize/lib/global_styling/variables/size.js +7 -10
- package/optimize/lib/global_styling/variables/typography.js +19 -41
- package/optimize/lib/services/color/eui_palettes.js +116 -47
- package/optimize/lib/services/color/index.js +8 -0
- package/optimize/lib/services/color/vis_color_store.js +18 -0
- package/optimize/lib/services/index.js +7 -0
- package/optimize/lib/services/popover/index.js +8 -1
- package/optimize/lib/services/popover/popover_arrow.styles.js +37 -0
- package/optimize/lib/services/popover/popover_positioning.js +6 -17
- package/optimize/lib/services/theme/provider.js +26 -2
- package/optimize/lib/services/theme/types.js +13 -14
- package/optimize/lib/services/theme/utils.js +54 -296
- package/optimize/lib/themes/amsterdam/global_styling/mixins/button.js +45 -203
- package/optimize/lib/themes/amsterdam/global_styling/variables/_borders.js +3 -3
- package/optimize/lib/themes/amsterdam/global_styling/variables/_buttons.js +275 -0
- package/optimize/lib/themes/amsterdam/global_styling/variables/_colors.js +617 -25
- package/optimize/lib/themes/amsterdam/global_styling/variables/_colors_vis.js +115 -0
- package/optimize/lib/themes/amsterdam/global_styling/variables/_components.js +601 -0
- package/optimize/lib/themes/amsterdam/global_styling/variables/_forms.js +158 -0
- package/optimize/lib/themes/amsterdam/theme.js +7 -1
- package/optimize/lib/themes/index.js +7 -0
- package/optimize/lib/themes/themes.js +10 -7
- package/package.json +7 -3
- package/src/global_styling/functions/_index.scss +1 -5
- package/src/global_styling/index.scss +1 -10
- package/src/global_styling/variables/_animations.scss +1 -8
- package/src/global_styling/variables/_borders.scss +1 -9
- package/src/global_styling/variables/_buttons.scss +1 -18
- package/src/global_styling/variables/_colors_vis.scss +1 -70
- package/src/global_styling/variables/_font_weight.scss +1 -7
- package/src/global_styling/variables/_form.scss +2 -21
- package/src/global_styling/variables/_responsive.scss +1 -9
- package/src/global_styling/variables/_shadows.scss +1 -1
- package/src/global_styling/variables/_size.scss +1 -13
- package/src/global_styling/variables/_states.scss +1 -14
- package/src/global_styling/variables/_typography.scss +1 -75
- package/src/global_styling/variables/_z_index.scss +1 -33
- package/src/themes/amsterdam/_colors_dark.scss +80 -8
- package/src/themes/amsterdam/_colors_light.scss +80 -8
- package/src/themes/amsterdam/global_styling/variables/_colors_vis.scss +72 -0
- package/src/themes/amsterdam/global_styling/variables/_forms.scss +12 -0
- package/src/themes/amsterdam/global_styling/variables/_index.scss +2 -0
- package/test-env/components/avatar/avatar.js +8 -2
- package/test-env/components/badge/badge.styles.js +1 -2
- package/test-env/components/badge/beta_badge/beta_badge.styles.js +3 -1
- package/test-env/components/badge/color_utils.js +14 -13
- package/test-env/components/beacon/beacon.styles.js +2 -2
- package/test-env/components/bottom_bar/bottom_bar.styles.js +1 -2
- package/test-env/components/breadcrumbs/_breadcrumb_content.styles.js +5 -7
- package/test-env/components/button/button.js +1 -1
- package/test-env/components/button/button_display/_button_display.styles.js +1 -1
- package/test-env/components/button/button_empty/button_empty.js +1 -1
- package/test-env/components/button/button_group/button_group_button.js +1 -1
- package/test-env/components/button/button_group/button_group_button.styles.js +5 -5
- package/test-env/components/button/button_icon/button_icon.js +1 -1
- package/test-env/components/card/card.js +1 -1
- package/test-env/components/card/card.styles.js +5 -2
- package/test-env/components/code/code_block_annotations.js +1 -1
- package/test-env/components/code/code_block_line.styles.js +1 -2
- package/test-env/components/code/code_syntax.styles.js +23 -27
- package/test-env/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.styles.js +3 -5
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.styles.js +1 -1
- package/test-env/components/color_picker/color_palette_display/color_palette_display.styles.js +1 -2
- package/test-env/components/color_picker/color_picker.js +8 -2
- package/test-env/components/color_picker/color_picker.styles.js +1 -2
- package/test-env/components/color_picker/color_picker_swatch.styles.js +1 -1
- package/test-env/components/comment_list/comment.js +1 -1
- package/test-env/components/comment_list/comment_event.js +5 -4
- package/test-env/components/comment_list/comment_list.js +1 -1
- package/test-env/components/common.js +0 -28
- package/test-env/components/datagrid/data_grid.styles.js +6 -7
- package/test-env/components/date_picker/react_date_picker.styles.js +3 -2
- package/test-env/components/date_picker/super_date_picker/super_date_picker.styles.js +2 -3
- package/test-env/components/drag_and_drop/droppable.styles.js +2 -4
- package/test-env/components/empty_prompt/empty_prompt.js +1 -1
- package/test-env/components/empty_prompt/empty_prompt.styles.js +5 -1
- package/test-env/components/filter_group/filter_select_item.styles.js +1 -2
- package/test-env/components/flyout/_flyout_close_button.styles.js +1 -2
- package/test-env/components/flyout/flyout.styles.js +7 -2
- package/test-env/components/flyout/flyout_footer.styles.js +1 -1
- package/test-env/components/form/form.styles.js +27 -31
- package/test-env/components/form/range/range_tooltip.styles.js +11 -13
- package/test-env/components/form/switch/switch.js +3 -2
- package/test-env/components/form/switch/switch.styles.js +16 -19
- package/test-env/components/header/header.styles.js +5 -6
- package/test-env/components/icon/icon.styles.js +9 -8
- package/test-env/components/icon/named_colors.js +1 -1
- package/test-env/components/inline_edit/inline_edit_form.styles.js +1 -2
- package/test-env/components/key_pad_menu/key_pad_menu_item.styles.js +1 -2
- package/test-env/components/list_group/list_group_item.styles.js +8 -10
- package/test-env/components/loading/loading_chart.styles.js +13 -5
- package/test-env/components/mark/mark.styles.js +2 -9
- package/test-env/components/markdown_editor/markdown_editor_drop_zone.styles.js +2 -3
- package/test-env/components/markdown_editor/markdown_format.styles.js +2 -2
- package/test-env/components/modal/modal.styles.js +1 -1
- package/test-env/components/overlay_mask/overlay_mask.styles.js +1 -2
- package/test-env/components/page_template/inner/page_inner.styles.js +1 -1
- package/test-env/components/panel/panel.js +1 -1
- package/test-env/components/panel/panel.styles.js +1 -1
- package/test-env/components/panel/split_panel/split_panel.js +1 -1
- package/test-env/components/popover/popover.js +1 -1
- package/test-env/components/popover/popover_arrow/_popover_arrow.js +8 -3
- package/test-env/components/popover/popover_arrow/_popover_arrow.styles.js +16 -15
- package/test-env/components/popover/popover_footer.styles.js +1 -1
- package/test-env/components/popover/popover_panel/_popover_panel.styles.js +4 -4
- package/test-env/components/progress/progress.js +1 -1
- package/test-env/components/progress/progress.styles.js +29 -27
- package/test-env/components/resizable_container/resizable_panel.js +1 -1
- package/test-env/components/selectable/selectable_list/selectable_list_item.styles.js +1 -2
- package/test-env/components/side_nav/side_nav_item.styles.js +1 -2
- package/test-env/components/skeleton/utils.js +4 -6
- package/test-env/components/steps/step_number.styles.js +1 -1
- package/test-env/components/table/table_cells_shared.styles.js +2 -7
- package/test-env/components/table/table_row.styles.js +7 -9
- package/test-env/components/text/text.styles.js +1 -1
- package/test-env/components/text/text_color.js +1 -1
- package/test-env/components/text/text_color.styles.js +6 -5
- package/test-env/components/toast/toast.styles.js +1 -1
- package/test-env/components/token/token.js +13 -4
- package/test-env/components/token/token.styles.js +12 -3
- package/test-env/components/token/token_map.js +244 -2
- package/test-env/components/tool_tip/tool_tip.styles.js +11 -23
- package/test-env/components/tour/_tour_footer.styles.js +2 -4
- package/test-env/components/tour/tour.styles.js +8 -12
- package/test-env/components/tree_view/tree_view_item.styles.js +1 -2
- package/test-env/global_styling/functions/math.js +7 -59
- package/test-env/global_styling/functions/size.js +7 -27
- package/test-env/global_styling/mixins/_button.js +165 -0
- package/test-env/global_styling/mixins/_color.js +38 -30
- package/test-env/global_styling/mixins/index.js +11 -0
- package/test-env/global_styling/reset/global_styles.js +1 -1
- package/test-env/global_styling/variables/_colors_vis.js +6 -61
- package/test-env/global_styling/variables/animations.js +25 -31
- package/test-env/global_styling/variables/breakpoint.js +7 -16
- package/test-env/global_styling/variables/levels.js +7 -26
- package/test-env/global_styling/variables/shadow.js +13 -20
- package/test-env/global_styling/variables/size.js +7 -10
- package/test-env/global_styling/variables/typography.js +19 -41
- package/test-env/services/color/eui_palettes.js +116 -47
- package/test-env/services/color/index.js +8 -0
- package/test-env/services/color/vis_color_store.js +18 -0
- package/test-env/services/index.js +7 -0
- package/test-env/services/popover/index.js +8 -1
- package/test-env/services/popover/popover_arrow.styles.js +37 -0
- package/test-env/services/popover/popover_positioning.js +6 -17
- package/test-env/services/theme/provider.js +26 -2
- package/test-env/services/theme/types.js +13 -14
- package/test-env/services/theme/utils.js +54 -296
- package/test-env/themes/amsterdam/global_styling/mixins/button.js +45 -203
- package/test-env/themes/amsterdam/global_styling/variables/_borders.js +3 -3
- package/test-env/themes/amsterdam/global_styling/variables/_buttons.js +275 -0
- package/test-env/themes/amsterdam/global_styling/variables/_colors.js +617 -25
- package/test-env/themes/amsterdam/global_styling/variables/_colors_vis.js +115 -0
- package/test-env/themes/amsterdam/global_styling/variables/_components.js +601 -0
- package/test-env/themes/amsterdam/global_styling/variables/_forms.js +158 -0
- package/test-env/themes/amsterdam/theme.js +7 -1
- package/test-env/themes/index.js +7 -0
- package/test-env/themes/themes.js +10 -7
- /package/dist/{eui_theme_dark.json → eui_theme_amsterdam_dark.json} +0 -0
- /package/dist/{eui_theme_light.json → eui_theme_amsterdam_light.json} +0 -0
|
@@ -285,11 +285,9 @@ export function getPopoverScreenCoordinates(_ref2) {
|
|
|
285
285
|
position: position,
|
|
286
286
|
offset: offset,
|
|
287
287
|
popoverBoundingBox: popoverBoundingBox,
|
|
288
|
-
anchorBoundingBox: anchorBoundingBox
|
|
289
|
-
arrowConfig: arrowConfig
|
|
288
|
+
anchorBoundingBox: anchorBoundingBox
|
|
290
289
|
}),
|
|
291
|
-
primaryAxisPosition = _getPrimaryAxisPositi.primaryAxisPosition
|
|
292
|
-
primaryAxisArrowPosition = _getPrimaryAxisPositi.primaryAxisArrowPosition;
|
|
290
|
+
primaryAxisPosition = _getPrimaryAxisPositi.primaryAxisPosition;
|
|
293
291
|
var popoverPlacement = _defineProperty(_defineProperty({}, crossAxisFirstSide, crossAxisPosition), primaryAxisPositionName, primaryAxisPosition);
|
|
294
292
|
|
|
295
293
|
// calculate the fit of the popover in this location
|
|
@@ -310,15 +308,12 @@ export function getPopoverScreenCoordinates(_ref2) {
|
|
|
310
308
|
width: popoverBoundingBox.width,
|
|
311
309
|
height: popoverBoundingBox.height
|
|
312
310
|
}, combinedBoundingBox);
|
|
313
|
-
var arrow = arrowConfig ? _defineProperty(_defineProperty({}, crossAxisFirstSide, crossAxisArrowPosition - popoverPlacement[crossAxisFirstSide]),
|
|
311
|
+
var arrow = arrowConfig ? _defineProperty(_defineProperty({}, crossAxisFirstSide, crossAxisArrowPosition - popoverPlacement[crossAxisFirstSide] - 1), position, '100%') : undefined;
|
|
314
312
|
return {
|
|
315
313
|
fit: fit,
|
|
316
314
|
top: popoverPlacement.top,
|
|
317
315
|
left: popoverPlacement.left,
|
|
318
|
-
arrow: arrow
|
|
319
|
-
left: arrow.left,
|
|
320
|
-
top: arrow.top
|
|
321
|
-
} : undefined
|
|
316
|
+
arrow: arrow
|
|
322
317
|
};
|
|
323
318
|
}
|
|
324
319
|
function getCrossAxisPosition(_ref4) {
|
|
@@ -410,8 +405,7 @@ function getPrimaryAxisPosition(_ref5) {
|
|
|
410
405
|
var position = _ref5.position,
|
|
411
406
|
offset = _ref5.offset,
|
|
412
407
|
popoverBoundingBox = _ref5.popoverBoundingBox,
|
|
413
|
-
anchorBoundingBox = _ref5.anchorBoundingBox
|
|
414
|
-
arrowConfig = _ref5.arrowConfig;
|
|
408
|
+
anchorBoundingBox = _ref5.anchorBoundingBox;
|
|
415
409
|
// if positioning to the top or left, the target position decreases
|
|
416
410
|
// from the anchor's top or left, otherwise the position adds to the anchor's
|
|
417
411
|
var isOffsetDecreasing = position === 'top' || position === 'left';
|
|
@@ -427,13 +421,8 @@ function getPrimaryAxisPosition(_ref5) {
|
|
|
427
421
|
var primaryAxisOffset = isOffsetDecreasing ? popoverSizeOnPrimaryAxis : anchorSizeOnPrimaryAxis;
|
|
428
422
|
var contentOffset = (offset + primaryAxisOffset) * (isOffsetDecreasing ? -1 : 1);
|
|
429
423
|
var primaryAxisPosition = anchorEdgeOrigin + contentOffset;
|
|
430
|
-
var primaryAxisArrowPosition;
|
|
431
|
-
if (arrowConfig) {
|
|
432
|
-
primaryAxisArrowPosition = isOffsetDecreasing ? popoverSizeOnPrimaryAxis : 0;
|
|
433
|
-
}
|
|
434
424
|
return {
|
|
435
|
-
primaryAxisPosition: primaryAxisPosition
|
|
436
|
-
primaryAxisArrowPosition: primaryAxisArrowPosition
|
|
425
|
+
primaryAxisPosition: primaryAxisPosition
|
|
437
426
|
};
|
|
438
427
|
}
|
|
439
428
|
|
|
@@ -19,6 +19,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
19
19
|
import React, { useContext, useEffect, useRef, useMemo, useState, useCallback, Fragment } from 'react';
|
|
20
20
|
import { Global } from '@emotion/react';
|
|
21
21
|
import isEqual from 'lodash/isEqual';
|
|
22
|
+
import { EUI_EXPERIMENTAL_THEME_ENABLED_KEY } from '../../themes/themes';
|
|
22
23
|
import { cloneElementWithCss } from '../emotion';
|
|
23
24
|
import { css, cx } from '../emotion/css';
|
|
24
25
|
import { CurrentEuiBreakpointProvider } from '../breakpoint/current_breakpoint';
|
|
@@ -26,6 +27,7 @@ import { EuiSystemContext, EuiThemeContext, EuiNestedThemeContext, EuiModificati
|
|
|
26
27
|
import { EuiEmotionThemeProvider } from './emotion';
|
|
27
28
|
import { EuiThemeMemoizedStylesProvider } from './style_memoization';
|
|
28
29
|
import { buildTheme, getColorMode, getComputed, mergeDeep } from './utils';
|
|
30
|
+
import { EUI_VIS_COLOR_STORE } from '../color';
|
|
29
31
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
30
32
|
export var EuiThemeProvider = function EuiThemeProvider(_ref) {
|
|
31
33
|
var _system = _ref.theme,
|
|
@@ -65,19 +67,41 @@ export var EuiThemeProvider = function EuiThemeProvider(_ref) {
|
|
|
65
67
|
setColorMode = _useState6[1];
|
|
66
68
|
var prevColorMode = useRef(colorMode);
|
|
67
69
|
var isParentTheme = useRef(prevSystemKey.current === parentSystem.key && colorMode === parentColorMode && isEqual(parentModifications, modifications));
|
|
70
|
+
var updateVisColorStore = useCallback(function (theme) {
|
|
71
|
+
var _theme$flags$hasVisCo, _theme$flags;
|
|
72
|
+
EUI_VIS_COLOR_STORE.setVisColors(theme.colors.vis, (_theme$flags$hasVisCo = (_theme$flags = theme.flags) === null || _theme$flags === void 0 ? void 0 : _theme$flags.hasVisColorAdjustment) !== null && _theme$flags$hasVisCo !== void 0 ? _theme$flags$hasVisCo : true);
|
|
73
|
+
}, []);
|
|
74
|
+
var getInitialTheme = function getInitialTheme() {
|
|
75
|
+
var theme = getComputed(system, buildTheme(modifications, "_".concat(system.key)), colorMode);
|
|
76
|
+
setTimeout(function () {
|
|
77
|
+
updateVisColorStore(theme);
|
|
78
|
+
});
|
|
79
|
+
return theme;
|
|
80
|
+
};
|
|
68
81
|
var _useState7 = useState(isParentTheme.current && Object.keys(parentTheme).length ? _objectSpread({}, parentTheme) // Intentionally create a new object to break referential equality
|
|
69
|
-
:
|
|
82
|
+
: getInitialTheme()),
|
|
70
83
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
71
84
|
theme = _useState8[0],
|
|
72
85
|
setTheme = _useState8[1];
|
|
86
|
+
|
|
87
|
+
// TODO: temp. testing code only, remove once obsolete
|
|
88
|
+
useEffect(function () {
|
|
89
|
+
if (process.env.NODE_ENV === 'development') {
|
|
90
|
+
var isEnabled = localStorage.getItem(EUI_EXPERIMENTAL_THEME_ENABLED_KEY) != null;
|
|
91
|
+
if (!isEnabled) {
|
|
92
|
+
localStorage.setItem(EUI_EXPERIMENTAL_THEME_ENABLED_KEY, 'true');
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}, []);
|
|
73
96
|
useEffect(function () {
|
|
74
97
|
var newSystem = _system || parentSystem;
|
|
75
98
|
if (prevSystemKey.current !== newSystem.key) {
|
|
76
99
|
setSystem(newSystem);
|
|
77
100
|
prevSystemKey.current = newSystem.key;
|
|
78
101
|
isParentTheme.current = false;
|
|
102
|
+
updateVisColorStore(theme);
|
|
79
103
|
}
|
|
80
|
-
}, [_system, parentSystem]);
|
|
104
|
+
}, [_system, parentSystem, theme, updateVisColorStore]);
|
|
81
105
|
useEffect(function () {
|
|
82
106
|
var newModifications = mergeDeep(parentModifications, _modifications);
|
|
83
107
|
if (!isEqual(prevModifications.current, newModifications)) {
|
|
@@ -5,9 +5,4 @@
|
|
|
5
5
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
6
6
|
* Side Public License, v 1.
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
export var COLOR_MODES_STANDARD = {
|
|
10
|
-
light: 'LIGHT',
|
|
11
|
-
dark: 'DARK'
|
|
12
|
-
};
|
|
13
|
-
export var COLOR_MODES_INVERSE = 'INVERSE';
|
|
8
|
+
export { COLOR_MODES_STANDARD, COLOR_MODES_INVERSE } from '@elastic/eui-theme-common';
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
|
-
import _typeof from "@babel/runtime/helpers/typeof";
|
|
6
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
1
|
/*
|
|
9
2
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
10
3
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -13,291 +6,4 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
13
6
|
* Side Public License, v 1.
|
|
14
7
|
*/
|
|
15
8
|
|
|
16
|
-
|
|
17
|
-
export var DEFAULT_COLOR_MODE = COLOR_MODES_STANDARD.light;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Returns whether the parameter is an object
|
|
21
|
-
* @param {any} obj - Anything
|
|
22
|
-
*/
|
|
23
|
-
var isObject = function isObject(obj) {
|
|
24
|
-
return obj && _typeof(obj) === 'object';
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Returns whether the provided color mode is `inverse`
|
|
29
|
-
* @param {string} colorMode - `light`, `dark`, or `inverse`
|
|
30
|
-
*/
|
|
31
|
-
export var isInverseColorMode = function isInverseColorMode(colorMode) {
|
|
32
|
-
return colorMode === COLOR_MODES_INVERSE;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Returns the color mode configured in the current EuiThemeProvider.
|
|
37
|
-
* Returns the parent color mode if none is explicity set.
|
|
38
|
-
* @param {string} colorMode - `light`, `dark`, or `inverse`
|
|
39
|
-
* @param {string} parentColorMode - `LIGHT` or `DARK`; used as the fallback
|
|
40
|
-
*/
|
|
41
|
-
export var getColorMode = function getColorMode(colorMode, parentColorMode) {
|
|
42
|
-
if (colorMode == null) {
|
|
43
|
-
return parentColorMode || DEFAULT_COLOR_MODE;
|
|
44
|
-
}
|
|
45
|
-
var mode = colorMode.toUpperCase();
|
|
46
|
-
if (isInverseColorMode(mode)) {
|
|
47
|
-
return parentColorMode === COLOR_MODES_STANDARD.dark || parentColorMode === undefined ? COLOR_MODES_STANDARD.light : COLOR_MODES_STANDARD.dark;
|
|
48
|
-
} else {
|
|
49
|
-
return mode;
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Returns a value at a given path on an object.
|
|
55
|
-
* If `colorMode` is provided, will scope the value to the appropriate color mode key (LIGHT\DARK)
|
|
56
|
-
* @param {object} model - Object
|
|
57
|
-
* @param {string} _path - Dot-notated string to a path on the object
|
|
58
|
-
* @param {string} colorMode - `light` or `dark`
|
|
59
|
-
*/
|
|
60
|
-
export var getOn = function getOn(model, _path, colorMode) {
|
|
61
|
-
var path = _path.split('.');
|
|
62
|
-
var node = model;
|
|
63
|
-
while (path.length) {
|
|
64
|
-
var segment = path.shift();
|
|
65
|
-
if (node.hasOwnProperty(segment) === false) {
|
|
66
|
-
if (colorMode && node.hasOwnProperty(colorMode) === true && node[colorMode].hasOwnProperty(segment) === true) {
|
|
67
|
-
if (node[colorMode][segment] instanceof Computed) {
|
|
68
|
-
node = node[colorMode][segment].getValue(null, null, node, colorMode);
|
|
69
|
-
} else {
|
|
70
|
-
node = node[colorMode][segment];
|
|
71
|
-
}
|
|
72
|
-
} else {
|
|
73
|
-
return undefined;
|
|
74
|
-
}
|
|
75
|
-
} else {
|
|
76
|
-
if (node[segment] instanceof Computed) {
|
|
77
|
-
node = node[segment].getValue(null, null, node, colorMode);
|
|
78
|
-
} else {
|
|
79
|
-
node = node[segment];
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
return node;
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Sets a value at a given path on an object.
|
|
88
|
-
* @param {object} model - Object
|
|
89
|
-
* @param {string} _path - Dot-notated string to a path on the object
|
|
90
|
-
* @param {any} string - The value to set
|
|
91
|
-
*/
|
|
92
|
-
export var setOn = function setOn(model, _path, value) {
|
|
93
|
-
var path = _path.split('.');
|
|
94
|
-
var propertyName = path.pop();
|
|
95
|
-
var node = model;
|
|
96
|
-
while (path.length) {
|
|
97
|
-
var segment = path.shift();
|
|
98
|
-
if (node.hasOwnProperty(segment) === false) {
|
|
99
|
-
node[segment] = {};
|
|
100
|
-
}
|
|
101
|
-
node = node[segment];
|
|
102
|
-
}
|
|
103
|
-
node[propertyName] = value;
|
|
104
|
-
return true;
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Creates a class to store the `computer` method and its eventual parameters.
|
|
109
|
-
* Allows for on-demand computation with up-to-date parameters via `getValue` method.
|
|
110
|
-
* @constructor
|
|
111
|
-
* @param {function} computer - Function to be computed
|
|
112
|
-
* @param {string | array} dependencies - Dependencies passed to the `computer` as parameters
|
|
113
|
-
*/
|
|
114
|
-
export var Computed = /*#__PURE__*/function () {
|
|
115
|
-
function Computed(computer) {
|
|
116
|
-
var dependencies = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
117
|
-
_classCallCheck(this, Computed);
|
|
118
|
-
this.computer = computer;
|
|
119
|
-
this.dependencies = dependencies;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Executes the `computer` method with the current state of the theme
|
|
124
|
-
* by taking into account previously computed values and modifications.
|
|
125
|
-
* @param {Proxy | object} base - Computed or uncomputed theme
|
|
126
|
-
* @param {Proxy | object} modifications - Theme value overrides
|
|
127
|
-
* @param {object} working - Partially computed theme
|
|
128
|
-
* @param {string} colorMode - `light` or `dark`
|
|
129
|
-
*/
|
|
130
|
-
return _createClass(Computed, [{
|
|
131
|
-
key: "getValue",
|
|
132
|
-
value: function getValue(base) {
|
|
133
|
-
var modifications = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
134
|
-
var working = arguments.length > 2 ? arguments[2] : undefined;
|
|
135
|
-
var colorMode = arguments.length > 3 ? arguments[3] : undefined;
|
|
136
|
-
if (!this.dependencies.length) {
|
|
137
|
-
return this.computer(working);
|
|
138
|
-
}
|
|
139
|
-
if (!Array.isArray(this.dependencies)) {
|
|
140
|
-
var _ref, _getOn;
|
|
141
|
-
return this.computer((_ref = (_getOn = getOn(working, this.dependencies)) !== null && _getOn !== void 0 ? _getOn : getOn(modifications, this.dependencies, colorMode)) !== null && _ref !== void 0 ? _ref : getOn(base, this.dependencies, colorMode));
|
|
142
|
-
}
|
|
143
|
-
return this.computer(this.dependencies.map(function (dependency) {
|
|
144
|
-
var _ref2, _getOn2;
|
|
145
|
-
return (_ref2 = (_getOn2 = getOn(working, dependency)) !== null && _getOn2 !== void 0 ? _getOn2 : getOn(modifications, dependency, colorMode)) !== null && _ref2 !== void 0 ? _ref2 : getOn(base, dependency, colorMode);
|
|
146
|
-
}));
|
|
147
|
-
}
|
|
148
|
-
}]);
|
|
149
|
-
}();
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Returns a Class (`Computed`) that stores the arbitrary computer method
|
|
153
|
-
* and references to its optional dependecies.
|
|
154
|
-
* @param {function} computer - Arbitrary method to be called at compute time.
|
|
155
|
-
* @param {string | array} dependencies - Values that will be provided to `computer` at compute time.
|
|
156
|
-
*/
|
|
157
|
-
|
|
158
|
-
export function computed(comp, dep) {
|
|
159
|
-
return new Computed(comp, dep);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Takes an uncomputed theme, and computes and returns all values taking
|
|
164
|
-
* into consideration value overrides and configured color mode.
|
|
165
|
-
* Overrides take precedence, and only values in the current color mode
|
|
166
|
-
* are computed and returned.
|
|
167
|
-
* @param {Proxy} base - Object to transform into Proxy
|
|
168
|
-
* @param {Proxy | object} over - Unique identifier or name
|
|
169
|
-
* @param {string} colorMode - `light` or `dark`
|
|
170
|
-
*/
|
|
171
|
-
export var getComputed = function getComputed(base, over, colorMode) {
|
|
172
|
-
var output = {
|
|
173
|
-
themeName: base.key
|
|
174
|
-
};
|
|
175
|
-
function loop(base, over) {
|
|
176
|
-
var checkExisting = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
177
|
-
var path = arguments.length > 3 ? arguments[3] : undefined;
|
|
178
|
-
Object.keys(base).forEach(function (key) {
|
|
179
|
-
var newPath = path ? "".concat(path, ".").concat(key) : "".concat(key);
|
|
180
|
-
// @ts-expect-error `key` is not necessarily a colorMode key
|
|
181
|
-
if ([].concat(_toConsumableArray(Object.values(COLOR_MODES_STANDARD)), [colorMode]).includes(key)) {
|
|
182
|
-
if (key !== colorMode) {
|
|
183
|
-
return;
|
|
184
|
-
} else {
|
|
185
|
-
var colorModeSegment = new RegExp("(\\.".concat(colorMode, "\\b)|(\\b").concat(colorMode, "\\.)"));
|
|
186
|
-
newPath = newPath.replace(colorModeSegment, '');
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
var existing = checkExisting && getOn(output, newPath);
|
|
190
|
-
if (!existing || isObject(existing)) {
|
|
191
|
-
var baseValue = base[key] instanceof Computed ? base[key].getValue(base.root, over.root, output, colorMode) : base[key];
|
|
192
|
-
var overValue = over[key] instanceof Computed ? over[key].getValue(base.root, over.root, output, colorMode) : over[key];
|
|
193
|
-
if (isObject(baseValue) && !Array.isArray(baseValue)) {
|
|
194
|
-
loop(baseValue, overValue !== null && overValue !== void 0 ? overValue : {}, checkExisting, newPath);
|
|
195
|
-
} else {
|
|
196
|
-
setOn(output, newPath, overValue !== null && overValue !== void 0 ? overValue : baseValue);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
// Compute standard theme values and apply overrides
|
|
202
|
-
loop(base, over);
|
|
203
|
-
// Compute and apply extension values only
|
|
204
|
-
loop(over, {}, true);
|
|
205
|
-
return output;
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
/**
|
|
209
|
-
* Builds a Proxy with a custom `handler` designed to self-reference values
|
|
210
|
-
* and prevent arbitrary value overrides.
|
|
211
|
-
* @param {object} model - Object to transform into Proxy
|
|
212
|
-
* @param {string} key - Unique identifier or name
|
|
213
|
-
*/
|
|
214
|
-
export var buildTheme = function buildTheme(model, key) {
|
|
215
|
-
var handler = {
|
|
216
|
-
getPrototypeOf: function getPrototypeOf(target) {
|
|
217
|
-
return Reflect.getPrototypeOf(target.model);
|
|
218
|
-
},
|
|
219
|
-
setPrototypeOf: function setPrototypeOf(target, prototype) {
|
|
220
|
-
return Reflect.setPrototypeOf(target.model, prototype);
|
|
221
|
-
},
|
|
222
|
-
isExtensible: function isExtensible(target) {
|
|
223
|
-
return Reflect.isExtensible(target);
|
|
224
|
-
},
|
|
225
|
-
preventExtensions: function preventExtensions(target) {
|
|
226
|
-
return Reflect.preventExtensions(target.model);
|
|
227
|
-
},
|
|
228
|
-
getOwnPropertyDescriptor: function getOwnPropertyDescriptor(target, key) {
|
|
229
|
-
return Reflect.getOwnPropertyDescriptor(target.model, key);
|
|
230
|
-
},
|
|
231
|
-
defineProperty: function defineProperty(target, property, attributes) {
|
|
232
|
-
return Reflect.defineProperty(target.model, property, attributes);
|
|
233
|
-
},
|
|
234
|
-
has: function has(target, property) {
|
|
235
|
-
return Reflect.has(target.model, property);
|
|
236
|
-
},
|
|
237
|
-
get: function get(_target, property) {
|
|
238
|
-
if (property === 'key') {
|
|
239
|
-
return _target[property];
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
// prevent Safari from locking up when the proxy is used in dev tools
|
|
243
|
-
// as it doesn't support getPrototypeOf
|
|
244
|
-
if (property === '__proto__') return {};
|
|
245
|
-
var target = property === 'root' ? _target : _target.model || _target;
|
|
246
|
-
// @ts-ignore `string` index signature
|
|
247
|
-
var value = target[property];
|
|
248
|
-
if (isObject(value) && !Array.isArray(value)) {
|
|
249
|
-
return new Proxy({
|
|
250
|
-
model: value,
|
|
251
|
-
root: _target.root,
|
|
252
|
-
key: "_".concat(_target.key)
|
|
253
|
-
}, handler);
|
|
254
|
-
} else {
|
|
255
|
-
return value;
|
|
256
|
-
}
|
|
257
|
-
},
|
|
258
|
-
set: function set(target) {
|
|
259
|
-
return target;
|
|
260
|
-
},
|
|
261
|
-
deleteProperty: function deleteProperty(target) {
|
|
262
|
-
return target;
|
|
263
|
-
},
|
|
264
|
-
ownKeys: function ownKeys(target) {
|
|
265
|
-
return Reflect.ownKeys(target.model);
|
|
266
|
-
},
|
|
267
|
-
apply: function apply(target) {
|
|
268
|
-
return target;
|
|
269
|
-
},
|
|
270
|
-
construct: function construct(target) {
|
|
271
|
-
return target;
|
|
272
|
-
}
|
|
273
|
-
};
|
|
274
|
-
var themeProxy = new Proxy({
|
|
275
|
-
model: model,
|
|
276
|
-
root: model,
|
|
277
|
-
key: key
|
|
278
|
-
}, handler);
|
|
279
|
-
return themeProxy;
|
|
280
|
-
};
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* Deeply merges two objects, using `source` values whenever possible.
|
|
284
|
-
* @param {object} _target - Object with fallback values
|
|
285
|
-
* @param {object} source - Object with desired values
|
|
286
|
-
*/
|
|
287
|
-
export var mergeDeep = function mergeDeep(_target) {
|
|
288
|
-
var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
289
|
-
var target = _objectSpread({}, _target);
|
|
290
|
-
if (!isObject(target) || !isObject(source)) {
|
|
291
|
-
return source;
|
|
292
|
-
}
|
|
293
|
-
Object.keys(source).forEach(function (key) {
|
|
294
|
-
var targetValue = target[key];
|
|
295
|
-
var sourceValue = source[key];
|
|
296
|
-
if (isObject(targetValue) && isObject(sourceValue)) {
|
|
297
|
-
target[key] = mergeDeep(_objectSpread({}, targetValue), _objectSpread({}, sourceValue));
|
|
298
|
-
} else {
|
|
299
|
-
target[key] = sourceValue;
|
|
300
|
-
}
|
|
301
|
-
});
|
|
302
|
-
return target;
|
|
303
|
-
};
|
|
9
|
+
export { DEFAULT_COLOR_MODE, isInverseColorMode, getColorMode, getOn, setOn, Computed, computed, getComputed, buildTheme, mergeDeep } from '@elastic/eui-theme-common';
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
-
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
|
-
var _templateObject;
|
|
4
1
|
/*
|
|
5
2
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
6
3
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -9,198 +6,4 @@ var _templateObject;
|
|
|
9
6
|
* Side Public License, v 1.
|
|
10
7
|
*/
|
|
11
8
|
|
|
12
|
-
|
|
13
|
-
import { euiBackgroundColor, euiCanAnimate } from '../../../../global_styling';
|
|
14
|
-
import { hexToRgb, isColorDark, makeHighContrastColor, shade, tint, transparentize, useEuiMemoizedStyles } from '../../../../services';
|
|
15
|
-
export var BUTTON_COLORS = ['text', 'accent', 'primary', 'success', 'warning', 'danger'];
|
|
16
|
-
export var BUTTON_DISPLAYS = ['base', 'fill', 'empty'];
|
|
17
|
-
/**
|
|
18
|
-
* Creates the `base` version of button styles with proper text contrast.
|
|
19
|
-
* @param euiThemeContext
|
|
20
|
-
* @param color One of the named button colors or 'disabled'
|
|
21
|
-
* @returns Style object `{ backgroundColor, color }`
|
|
22
|
-
*/
|
|
23
|
-
export var euiButtonColor = function euiButtonColor(euiThemeContext, color) {
|
|
24
|
-
var euiTheme = euiThemeContext.euiTheme,
|
|
25
|
-
colorMode = euiThemeContext.colorMode;
|
|
26
|
-
function tintOrShade(color) {
|
|
27
|
-
return colorMode === 'DARK' ? shade(color, 0.7) : tint(color, 0.8);
|
|
28
|
-
}
|
|
29
|
-
var foreground;
|
|
30
|
-
var background;
|
|
31
|
-
switch (color) {
|
|
32
|
-
case 'disabled':
|
|
33
|
-
return {
|
|
34
|
-
color: euiTheme.colors.disabledText,
|
|
35
|
-
backgroundColor: transparentize(euiTheme.colors.lightShade, 0.15)
|
|
36
|
-
};
|
|
37
|
-
case 'text':
|
|
38
|
-
foreground = euiTheme.colors[color];
|
|
39
|
-
background = colorMode === 'DARK' ? shade(euiTheme.colors.lightShade, 0.2) : tint(euiTheme.colors.lightShade, 0.5);
|
|
40
|
-
break;
|
|
41
|
-
default:
|
|
42
|
-
foreground = euiTheme.colors["".concat(color, "Text")];
|
|
43
|
-
background = tintOrShade(euiTheme.colors[color]);
|
|
44
|
-
break;
|
|
45
|
-
}
|
|
46
|
-
return {
|
|
47
|
-
color: makeHighContrastColor(foreground)(background),
|
|
48
|
-
backgroundColor: background
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Creates the `fill` version of buttons styles with proper text contrast.
|
|
54
|
-
* @param euiThemeContext
|
|
55
|
-
* @param color One of the named button colors or 'disabled'
|
|
56
|
-
* @returns Style object `{ backgroundColor, color }`
|
|
57
|
-
*/
|
|
58
|
-
export var euiButtonFillColor = function euiButtonFillColor(euiThemeContext, color) {
|
|
59
|
-
var euiTheme = euiThemeContext.euiTheme,
|
|
60
|
-
colorMode = euiThemeContext.colorMode;
|
|
61
|
-
var getForegroundColor = function getForegroundColor(background) {
|
|
62
|
-
return isColorDark.apply(void 0, _toConsumableArray(hexToRgb(background))) ? euiTheme.colors.ghost : euiTheme.colors.ink;
|
|
63
|
-
};
|
|
64
|
-
var background;
|
|
65
|
-
var foreground;
|
|
66
|
-
switch (color) {
|
|
67
|
-
case 'disabled':
|
|
68
|
-
background = euiButtonColor(euiThemeContext, color).backgroundColor;
|
|
69
|
-
foreground = euiButtonColor(euiThemeContext, color).color;
|
|
70
|
-
break;
|
|
71
|
-
case 'text':
|
|
72
|
-
background = colorMode === 'DARK' ? euiTheme.colors.text : euiTheme.colors.darkShade;
|
|
73
|
-
foreground = getForegroundColor(background);
|
|
74
|
-
break;
|
|
75
|
-
case 'success':
|
|
76
|
-
case 'accent':
|
|
77
|
-
// Success / accent fills are hard to read on light mode even though they pass color contrast ratios
|
|
78
|
-
// TODO: If WCAG 3 gets adopted (which would calculates luminosity & would allow us to use white text instead),
|
|
79
|
-
// we can get rid of this case (https://blog.datawrapper.de/color-contrast-check-data-vis-wcag-apca/)
|
|
80
|
-
background = colorMode === 'LIGHT' ? tint(euiTheme.colors[color], 0.3) : euiTheme.colors[color];
|
|
81
|
-
foreground = getForegroundColor(background);
|
|
82
|
-
break;
|
|
83
|
-
default:
|
|
84
|
-
background = euiTheme.colors[color];
|
|
85
|
-
foreground = getForegroundColor(background);
|
|
86
|
-
break;
|
|
87
|
-
}
|
|
88
|
-
return {
|
|
89
|
-
color: foreground,
|
|
90
|
-
backgroundColor: background
|
|
91
|
-
};
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Creates the `empty` version of button styles using the text-variant and adding interactive styles.
|
|
96
|
-
* @param euiThemeContext
|
|
97
|
-
* @param color One of the named button colors or 'disabled'
|
|
98
|
-
* @returns Style object `{ backgroundColor, color }` where `background` is typically used for interactive states
|
|
99
|
-
*/
|
|
100
|
-
export var euiButtonEmptyColor = function euiButtonEmptyColor(euiThemeContext, color) {
|
|
101
|
-
var foreground;
|
|
102
|
-
var background;
|
|
103
|
-
switch (color) {
|
|
104
|
-
case 'disabled':
|
|
105
|
-
foreground = euiButtonColor(euiThemeContext, color).color;
|
|
106
|
-
background = 'transparent';
|
|
107
|
-
break;
|
|
108
|
-
case 'text':
|
|
109
|
-
foreground = euiButtonColor(euiThemeContext, color).color;
|
|
110
|
-
background = euiBackgroundColor(euiThemeContext, 'subdued', {
|
|
111
|
-
method: 'transparent'
|
|
112
|
-
});
|
|
113
|
-
break;
|
|
114
|
-
default:
|
|
115
|
-
foreground = euiButtonColor(euiThemeContext, color).color;
|
|
116
|
-
background = euiBackgroundColor(euiThemeContext, color, {
|
|
117
|
-
method: 'transparent'
|
|
118
|
-
});
|
|
119
|
-
break;
|
|
120
|
-
}
|
|
121
|
-
return {
|
|
122
|
-
color: foreground,
|
|
123
|
-
backgroundColor: background
|
|
124
|
-
};
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Given the button display type, returns the Emotion based color keys.
|
|
129
|
-
* @param options Button display type
|
|
130
|
-
* @returns An object of `_EuiButtonColor` keys including `disabled`
|
|
131
|
-
*/
|
|
132
|
-
export var useEuiButtonColorCSS = function useEuiButtonColorCSS() {
|
|
133
|
-
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
134
|
-
var _options$display = options.display,
|
|
135
|
-
display = _options$display === void 0 ? 'base' : _options$display;
|
|
136
|
-
var colorsDisplaysMap = useEuiMemoizedStyles(euiButtonDisplaysColors);
|
|
137
|
-
return colorsDisplaysMap[display];
|
|
138
|
-
};
|
|
139
|
-
var euiButtonDisplaysColors = function euiButtonDisplaysColors(euiThemeContext) {
|
|
140
|
-
var COLORS = [].concat(BUTTON_COLORS, ['disabled']);
|
|
141
|
-
var displaysColorsMap = {};
|
|
142
|
-
BUTTON_DISPLAYS.forEach(function (display) {
|
|
143
|
-
displaysColorsMap[display] = {};
|
|
144
|
-
COLORS.forEach(function (color) {
|
|
145
|
-
switch (display) {
|
|
146
|
-
case 'base':
|
|
147
|
-
displaysColorsMap[display][color] = /*#__PURE__*/css(euiButtonColor(euiThemeContext, color), ";;label:displaysColorsMap-display-color;");
|
|
148
|
-
break;
|
|
149
|
-
case 'fill':
|
|
150
|
-
displaysColorsMap[display][color] = /*#__PURE__*/css(euiButtonFillColor(euiThemeContext, color), "outline-color:", euiThemeContext.colorMode === 'DARK' && color === 'text' ? 'currentColor' : euiThemeContext.euiTheme.colors.fullShade, ";;label:displaysColorsMap-display-color;");
|
|
151
|
-
break;
|
|
152
|
-
case 'empty':
|
|
153
|
-
displaysColorsMap[display][color] = /*#__PURE__*/css("color:", euiButtonEmptyColor(euiThemeContext, color).color, ";&:focus,&:active{background-color:", euiButtonEmptyColor(euiThemeContext, color).backgroundColor, ";};label:displaysColorsMap-display-color;");
|
|
154
|
-
break;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
// Tweak auto-generated Emotion label/className output
|
|
158
|
-
var emotionOutput = displaysColorsMap[display][color];
|
|
159
|
-
emotionOutput.styles = emotionOutput.styles.replace('label:displaysColorsMap-display-color;', "label:".concat(display, "-").concat(color, ";"));
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
return displaysColorsMap;
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* Creates the translate animation when button is in focus.
|
|
167
|
-
* @returns string
|
|
168
|
-
*/
|
|
169
|
-
export var useEuiButtonFocusCSS = function useEuiButtonFocusCSS() {
|
|
170
|
-
return useEuiMemoizedStyles(euiButtonFocusCSS);
|
|
171
|
-
};
|
|
172
|
-
var euiButtonFocusAnimation = keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n 50% {\n transform: translateY(1px);\n }\n"])));
|
|
173
|
-
var euiButtonFocusCSS = function euiButtonFocusCSS(_ref) {
|
|
174
|
-
var euiTheme = _ref.euiTheme;
|
|
175
|
-
var focusCSS = /*#__PURE__*/css(euiCanAnimate, "{transition:transform ", euiTheme.animation.normal, " ease-in-out,background-color ", euiTheme.animation.normal, " ease-in-out;&:hover:not(:disabled){transform:translateY(-1px);}&:focus{animation:", euiButtonFocusAnimation, " ", euiTheme.animation.normal, " ", euiTheme.animation.bounce, ";}&:active:not(:disabled){transform:translateY(1px);}};label:focusCSS;");
|
|
176
|
-
// Remove the auto-generated label.
|
|
177
|
-
// We could typically avoid a label by using a plain string `` instead of css``,
|
|
178
|
-
// but we need css`` for keyframes`` to work for the focus animation
|
|
179
|
-
focusCSS.styles = focusCSS.styles.replace('label:focusCSS;', '');
|
|
180
|
-
return focusCSS;
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Map of `size` props to various sizings/scales
|
|
185
|
-
* that should remain consistent across all buttons
|
|
186
|
-
*/
|
|
187
|
-
export var euiButtonSizeMap = function euiButtonSizeMap(_ref2) {
|
|
188
|
-
var euiTheme = _ref2.euiTheme;
|
|
189
|
-
return {
|
|
190
|
-
xs: {
|
|
191
|
-
height: euiTheme.size.l,
|
|
192
|
-
radius: euiTheme.border.radius.small,
|
|
193
|
-
fontScale: 'xs'
|
|
194
|
-
},
|
|
195
|
-
s: {
|
|
196
|
-
height: euiTheme.size.xl,
|
|
197
|
-
radius: euiTheme.border.radius.small,
|
|
198
|
-
fontScale: 's'
|
|
199
|
-
},
|
|
200
|
-
m: {
|
|
201
|
-
height: euiTheme.size.xxl,
|
|
202
|
-
radius: euiTheme.border.radius.medium,
|
|
203
|
-
fontScale: 's'
|
|
204
|
-
}
|
|
205
|
-
};
|
|
206
|
-
};
|
|
9
|
+
export { BUTTON_COLORS, BUTTON_DISPLAYS, euiButtonColor, euiButtonFillColor, euiButtonEmptyColor, useEuiButtonColorCSS, useEuiButtonFocusCSS, euiButtonSizeMap } from '../../../../global_styling/mixins/_button';
|
|
@@ -12,9 +12,9 @@ import { computed } from '../../../../services/theme/utils';
|
|
|
12
12
|
export var border = {
|
|
13
13
|
color: computed(function (_ref) {
|
|
14
14
|
var _ref2 = _slicedToArray(_ref, 1),
|
|
15
|
-
|
|
16
|
-
return
|
|
17
|
-
}, ['colors.
|
|
15
|
+
borderBaseSubdued = _ref2[0];
|
|
16
|
+
return borderBaseSubdued;
|
|
17
|
+
}, ['colors.borderBaseSubdued']),
|
|
18
18
|
width: {
|
|
19
19
|
thin: '1px',
|
|
20
20
|
thick: '2px'
|