@elastic/eui 62.0.2 → 62.2.0
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_charts_theme.js +330 -330
- package/dist/eui_charts_theme.js.map +1 -1
- package/dist/eui_theme_dark.css +1 -783
- package/dist/eui_theme_dark.json +0 -57
- package/dist/eui_theme_dark.json.d.ts +0 -57
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +1 -783
- package/dist/eui_theme_light.json +0 -57
- package/dist/eui_theme_light.json.d.ts +0 -57
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/breadcrumbs/breadcrumb.js +199 -0
- package/es/components/breadcrumbs/breadcrumb.styles.js +61 -0
- package/es/components/breadcrumbs/breadcrumbs.js +115 -187
- package/es/components/breadcrumbs/breadcrumbs.styles.js +30 -0
- package/es/components/code/code_block.js +119 -107
- package/es/components/collapsible_nav/collapsible_nav.js +2 -2
- package/es/components/control_bar/control_bar.js +13 -0
- package/es/components/datagrid/body/data_grid_body.js +12 -2
- package/es/components/datagrid/body/data_grid_cell.js +31 -3
- package/es/components/datagrid/body/header/data_grid_header_row.js +1 -1
- package/es/components/datagrid/controls/column_sorting_draggable.js +1 -1
- package/es/components/datagrid/data_grid.js +10 -2
- package/es/components/datagrid/utils/row_heights.js +33 -4
- package/es/components/date_picker/super_date_picker/super_date_picker.js +2 -2
- package/es/components/date_picker/super_date_picker/super_update_button.js +1 -1
- package/es/components/description_list/description_list.js +22 -26
- package/es/components/description_list/description_list.styles.js +25 -0
- package/es/components/description_list/description_list_context.js +14 -0
- package/es/components/description_list/description_list_description.js +43 -2
- package/es/components/description_list/description_list_description.styles.js +47 -0
- package/es/components/description_list/description_list_title.js +43 -2
- package/es/components/description_list/description_list_title.styles.js +37 -0
- package/es/components/description_list/description_list_types.js +10 -0
- package/es/components/header/header.js +1 -27
- package/es/components/header/header_breadcrumbs/header_breadcrumbs.js +22 -2
- package/es/components/header/header_breadcrumbs/header_breadcrumbs.styles.js +15 -0
- package/es/components/header/header_links/header_links.js +9 -9
- package/es/components/icon/assets/tokenStruct.js +1 -1
- package/es/components/page/page_header/page_header.js +1 -0
- package/es/components/page/page_header/page_header_content.js +2 -1
- package/es/components/page/page_template.js +1 -0
- package/es/components/pagination/pagination.js +1 -1
- package/es/components/panel/split_panel/split_panel.js +2 -2
- package/es/components/popover/wrapping_popover.js +88 -45
- package/es/components/portal/portal.js +84 -38
- package/es/components/provider/provider.js +2 -2
- package/es/components/responsive/hide_for.js +6 -38
- package/es/components/responsive/show_for.js +6 -38
- package/es/components/selectable/selectable_templates/selectable_template_sitewide.js +17 -36
- package/es/components/side_nav/side_nav.js +1 -1
- package/es/components/table/table_row_cell.js +1 -2
- package/es/components/toast/global_toast_list.js +208 -241
- package/es/components/toast/global_toast_list.styles.js +38 -0
- package/es/components/toast/global_toast_list_item.js +12 -7
- package/es/components/toast/toast.js +25 -25
- package/es/components/toast/toast.styles.js +55 -0
- package/es/components/token/index.js +2 -1
- package/es/components/token/token.js +48 -112
- package/es/components/token/token.styles.js +93 -0
- package/es/components/token/token_map.js +6 -9
- package/es/components/token/token_types.js +11 -0
- package/es/global_styling/reset/global_styles.js +1 -1
- package/es/services/{breakpoint.js → breakpoint/breakpoint.js} +4 -9
- package/es/services/{hooks/useIsWithinBreakpoints.js → breakpoint/currentEuiBreakpoint.js} +36 -28
- package/es/services/breakpoint/index.js +10 -0
- package/es/services/breakpoint/useIsWithinBreakpoints.js +24 -0
- package/es/services/hooks/index.js +0 -1
- package/es/services/index.js +1 -1
- package/es/test/rtl/component_helpers.js +60 -1
- package/eui.d.ts +1787 -1550
- package/i18ntokens.json +36 -36
- package/lib/components/breadcrumbs/breadcrumb.js +225 -0
- package/lib/components/breadcrumbs/breadcrumb.styles.js +68 -0
- package/lib/components/breadcrumbs/breadcrumbs.js +125 -188
- package/lib/components/breadcrumbs/breadcrumbs.styles.js +33 -0
- package/lib/components/code/code_block.js +118 -106
- package/lib/components/collapsible_nav/collapsible_nav.js +2 -2
- package/lib/components/control_bar/control_bar.js +13 -0
- package/lib/components/datagrid/body/data_grid_body.js +12 -2
- package/lib/components/datagrid/body/data_grid_cell.js +31 -3
- package/lib/components/datagrid/body/header/data_grid_header_row.js +1 -1
- package/lib/components/datagrid/controls/column_sorting_draggable.js +1 -1
- package/lib/components/datagrid/data_grid.js +10 -2
- package/lib/components/datagrid/utils/row_heights.js +33 -4
- package/lib/components/date_picker/super_date_picker/super_date_picker.js +2 -2
- package/lib/components/date_picker/super_date_picker/super_update_button.js +1 -1
- package/lib/components/description_list/description_list.js +25 -31
- package/lib/components/description_list/description_list.styles.js +36 -0
- package/lib/components/description_list/description_list_context.js +24 -0
- package/lib/components/description_list/description_list_description.js +52 -2
- package/lib/components/description_list/description_list_description.styles.js +51 -0
- package/lib/components/description_list/description_list_title.js +52 -2
- package/lib/components/description_list/description_list_title.styles.js +50 -0
- package/lib/components/description_list/description_list_types.js +20 -0
- package/lib/components/header/header.js +1 -27
- package/lib/components/header/header_breadcrumbs/header_breadcrumbs.js +24 -2
- package/lib/components/header/header_breadcrumbs/header_breadcrumbs.styles.js +26 -0
- package/lib/components/header/header_links/header_links.js +8 -8
- package/lib/components/icon/assets/tokenStruct.js +1 -1
- package/lib/components/icon/svgs/tokens/tokenStruct.svg +1 -1
- package/lib/components/page/page_header/page_header.js +1 -0
- package/lib/components/page/page_header/page_header_content.js +3 -2
- package/lib/components/page/page_template.js +1 -0
- package/lib/components/pagination/pagination.js +1 -1
- package/lib/components/panel/split_panel/split_panel.js +3 -3
- package/lib/components/popover/wrapping_popover.js +85 -44
- package/lib/components/portal/portal.js +87 -39
- package/lib/components/provider/provider.js +1 -1
- package/lib/components/responsive/hide_for.js +12 -44
- package/lib/components/responsive/show_for.js +12 -44
- package/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +15 -35
- package/lib/components/side_nav/side_nav.js +1 -1
- package/lib/components/table/table_row_cell.js +1 -3
- package/lib/components/toast/global_toast_list.js +209 -238
- package/lib/components/toast/global_toast_list.styles.js +45 -0
- package/lib/components/toast/global_toast_list_item.js +14 -7
- package/lib/components/toast/toast.js +27 -25
- package/lib/components/toast/toast.styles.js +66 -0
- package/lib/components/token/index.js +5 -3
- package/lib/components/token/token.js +50 -120
- package/lib/components/token/token.styles.js +101 -0
- package/lib/components/token/token_map.js +6 -9
- package/lib/components/token/token_types.js +22 -0
- package/lib/global_styling/reset/global_styles.js +1 -1
- package/{test-env/services → lib/services/breakpoint}/breakpoint.js +5 -9
- package/lib/services/breakpoint/currentEuiBreakpoint.js +80 -0
- package/lib/services/breakpoint/index.js +44 -0
- package/lib/services/breakpoint/useIsWithinBreakpoints.js +34 -0
- package/lib/services/hooks/index.js +0 -13
- package/lib/services/index.js +28 -0
- package/lib/test/rtl/component_helpers.js +69 -3
- package/optimize/es/components/breadcrumbs/breadcrumb.js +136 -0
- package/optimize/es/components/breadcrumbs/breadcrumb.styles.js +61 -0
- package/optimize/es/components/breadcrumbs/breadcrumbs.js +92 -165
- package/optimize/es/components/breadcrumbs/breadcrumbs.styles.js +30 -0
- package/optimize/es/components/code/code_block.js +106 -107
- package/optimize/es/components/datagrid/body/data_grid_body.js +2 -0
- package/optimize/es/components/datagrid/body/data_grid_cell.js +13 -1
- package/optimize/es/components/datagrid/utils/row_heights.js +33 -4
- package/optimize/es/components/description_list/description_list.js +20 -24
- package/optimize/es/components/description_list/description_list.styles.js +25 -0
- package/optimize/es/components/description_list/description_list_context.js +14 -0
- package/optimize/es/components/description_list/description_list_description.js +32 -2
- package/optimize/es/components/description_list/description_list_description.styles.js +47 -0
- package/optimize/es/components/description_list/description_list_title.js +32 -2
- package/optimize/es/components/description_list/description_list_title.styles.js +37 -0
- package/optimize/es/components/description_list/description_list_types.js +10 -0
- package/optimize/es/components/header/header_breadcrumbs/header_breadcrumbs.js +8 -1
- package/optimize/es/components/header/header_breadcrumbs/header_breadcrumbs.styles.js +15 -0
- package/optimize/es/components/header/header_links/header_links.js +8 -8
- package/optimize/es/components/icon/assets/tokenStruct.js +1 -1
- package/optimize/es/components/page/page_header/page_header_content.js +1 -1
- package/optimize/es/components/panel/split_panel/split_panel.js +1 -1
- package/optimize/es/components/popover/wrapping_popover.js +79 -38
- package/optimize/es/components/portal/portal.js +66 -34
- package/optimize/es/components/provider/provider.js +2 -2
- package/optimize/es/components/responsive/hide_for.js +5 -27
- package/optimize/es/components/responsive/show_for.js +5 -27
- package/optimize/es/components/selectable/selectable_templates/selectable_template_sitewide.js +16 -35
- package/optimize/es/components/table/table_row_cell.js +1 -2
- package/optimize/es/components/toast/global_toast_list.js +199 -230
- package/optimize/es/components/toast/global_toast_list.styles.js +38 -0
- package/optimize/es/components/toast/global_toast_list_item.js +11 -6
- package/optimize/es/components/toast/toast.js +24 -24
- package/optimize/es/components/toast/toast.styles.js +55 -0
- package/optimize/es/components/token/index.js +2 -1
- package/optimize/es/components/token/token.js +46 -69
- package/optimize/es/components/token/token.styles.js +83 -0
- package/optimize/es/components/token/token_map.js +6 -9
- package/optimize/es/components/token/token_types.js +11 -0
- package/optimize/es/global_styling/reset/global_styles.js +1 -1
- package/optimize/es/services/{breakpoint.js → breakpoint/breakpoint.js} +4 -9
- package/optimize/es/services/breakpoint/currentEuiBreakpoint.js +53 -0
- package/optimize/es/services/breakpoint/index.js +10 -0
- package/optimize/es/services/breakpoint/useIsWithinBreakpoints.js +24 -0
- package/optimize/es/services/hooks/index.js +0 -1
- package/optimize/es/services/index.js +1 -1
- package/optimize/es/test/rtl/component_helpers.js +60 -1
- package/optimize/lib/components/breadcrumbs/breadcrumb.js +162 -0
- package/optimize/lib/components/breadcrumbs/breadcrumb.styles.js +68 -0
- package/optimize/lib/components/breadcrumbs/breadcrumbs.js +99 -164
- package/optimize/lib/components/breadcrumbs/breadcrumbs.styles.js +33 -0
- package/optimize/lib/components/code/code_block.js +105 -106
- package/optimize/lib/components/datagrid/body/data_grid_body.js +2 -0
- package/optimize/lib/components/datagrid/body/data_grid_cell.js +13 -1
- package/optimize/lib/components/datagrid/utils/row_heights.js +33 -4
- package/optimize/lib/components/description_list/description_list.js +23 -28
- package/optimize/lib/components/description_list/description_list.styles.js +36 -0
- package/optimize/lib/components/description_list/description_list_context.js +24 -0
- package/optimize/lib/components/description_list/description_list_description.js +43 -2
- package/optimize/lib/components/description_list/description_list_description.styles.js +51 -0
- package/optimize/lib/components/description_list/description_list_title.js +43 -2
- package/optimize/lib/components/description_list/description_list_title.styles.js +50 -0
- package/optimize/lib/components/description_list/description_list_types.js +20 -0
- package/optimize/lib/components/header/header_breadcrumbs/header_breadcrumbs.js +10 -1
- package/optimize/lib/components/header/header_breadcrumbs/header_breadcrumbs.styles.js +26 -0
- package/optimize/lib/components/header/header_links/header_links.js +7 -7
- package/optimize/lib/components/icon/assets/tokenStruct.js +1 -1
- package/optimize/lib/components/icon/svgs/tokens/tokenStruct.svg +1 -1
- package/optimize/lib/components/page/page_header/page_header_content.js +2 -2
- package/optimize/lib/components/panel/split_panel/split_panel.js +2 -2
- package/optimize/lib/components/popover/wrapping_popover.js +78 -38
- package/optimize/lib/components/portal/portal.js +65 -44
- package/optimize/lib/components/provider/provider.js +1 -1
- package/optimize/lib/components/responsive/hide_for.js +4 -33
- package/optimize/lib/components/responsive/show_for.js +4 -33
- package/optimize/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +14 -34
- package/optimize/lib/components/table/table_row_cell.js +1 -3
- package/optimize/lib/components/toast/global_toast_list.js +206 -220
- package/optimize/lib/components/toast/global_toast_list.styles.js +47 -0
- package/optimize/lib/components/toast/global_toast_list_item.js +14 -7
- package/optimize/lib/components/toast/toast.js +26 -24
- package/optimize/lib/components/toast/toast.styles.js +66 -0
- package/optimize/lib/components/token/index.js +5 -3
- package/optimize/lib/components/token/token.js +50 -76
- package/optimize/lib/components/token/token.styles.js +91 -0
- package/optimize/lib/components/token/token_map.js +6 -9
- package/optimize/lib/components/token/token_types.js +22 -0
- package/optimize/lib/global_styling/reset/global_styles.js +1 -1
- package/optimize/lib/services/{breakpoint.js → breakpoint/breakpoint.js} +5 -9
- package/optimize/lib/services/breakpoint/currentEuiBreakpoint.js +81 -0
- package/optimize/lib/services/breakpoint/index.js +44 -0
- package/optimize/lib/services/breakpoint/useIsWithinBreakpoints.js +34 -0
- package/optimize/lib/services/hooks/index.js +0 -13
- package/optimize/lib/services/index.js +28 -0
- package/optimize/lib/test/rtl/component_helpers.js +69 -3
- package/package.json +2 -2
- package/src/components/control_bar/_control_bar.scss +1 -1
- package/src/components/header/_index.scss +0 -1
- package/src/components/index.scss +0 -5
- package/src/themes/amsterdam/overrides/_breadcrumbs.scss +0 -12
- package/src/themes/amsterdam/overrides/_index.scss +0 -4
- package/test-env/components/breadcrumbs/breadcrumb.js +211 -0
- package/test-env/components/breadcrumbs/breadcrumb.styles.js +68 -0
- package/test-env/components/breadcrumbs/breadcrumbs.js +122 -174
- package/test-env/components/breadcrumbs/breadcrumbs.styles.js +33 -0
- package/test-env/components/collapsible_nav/collapsible_nav.js +2 -2
- package/test-env/components/control_bar/control_bar.js +13 -0
- package/test-env/components/datagrid/body/data_grid_body.js +12 -2
- package/test-env/components/datagrid/body/data_grid_cell.js +31 -3
- package/test-env/components/datagrid/body/header/data_grid_header_row.js +1 -1
- package/test-env/components/datagrid/controls/column_sorting_draggable.js +1 -1
- package/test-env/components/datagrid/data_grid.js +10 -2
- package/test-env/components/datagrid/utils/row_heights.js +33 -4
- package/test-env/components/date_picker/super_date_picker/super_date_picker.js +2 -2
- package/test-env/components/date_picker/super_date_picker/super_update_button.js +1 -1
- package/test-env/components/description_list/description_list.js +25 -30
- package/test-env/components/description_list/description_list.styles.js +36 -0
- package/test-env/components/description_list/description_list_context.js +24 -0
- package/test-env/components/description_list/description_list_description.js +43 -2
- package/test-env/components/description_list/description_list_description.styles.js +51 -0
- package/test-env/components/description_list/description_list_title.js +43 -2
- package/test-env/components/description_list/description_list_title.styles.js +50 -0
- package/test-env/components/description_list/description_list_types.js +20 -0
- package/test-env/components/header/header.js +1 -27
- package/test-env/components/header/header_breadcrumbs/header_breadcrumbs.js +24 -2
- package/test-env/components/header/header_breadcrumbs/header_breadcrumbs.styles.js +26 -0
- package/test-env/components/header/header_links/header_links.js +8 -8
- package/test-env/components/icon/assets/tokenStruct.js +1 -1
- package/test-env/components/observer/resize_observer/resize_observer.js +43 -126
- package/test-env/components/page/page_header/page_header.js +1 -0
- package/test-env/components/page/page_header/page_header_content.js +3 -2
- package/test-env/components/page/page_template.js +1 -0
- package/test-env/components/pagination/pagination.js +1 -1
- package/test-env/components/panel/split_panel/split_panel.js +3 -3
- package/test-env/components/popover/wrapping_popover.js +78 -38
- package/test-env/components/portal/portal.js +79 -45
- package/test-env/components/provider/provider.js +1 -1
- package/test-env/components/responsive/hide_for.js +5 -34
- package/test-env/components/responsive/show_for.js +5 -34
- package/test-env/components/selectable/selectable_templates/selectable_template_sitewide.js +15 -35
- package/test-env/components/side_nav/side_nav.js +1 -1
- package/test-env/components/table/table_row_cell.js +1 -3
- package/test-env/components/toast/global_toast_list.js +206 -220
- package/test-env/components/toast/global_toast_list.styles.js +47 -0
- package/test-env/components/toast/global_toast_list_item.js +14 -7
- package/test-env/components/toast/toast.js +27 -25
- package/test-env/components/toast/toast.styles.js +66 -0
- package/test-env/components/token/index.js +5 -3
- package/test-env/components/token/token.js +51 -120
- package/test-env/components/token/token.styles.js +91 -0
- package/test-env/components/token/token_map.js +6 -9
- package/test-env/components/token/token_types.js +22 -0
- package/test-env/global_styling/reset/global_styles.js +1 -1
- package/{lib/services → test-env/services/breakpoint}/breakpoint.js +5 -9
- package/test-env/services/breakpoint/currentEuiBreakpoint.js +37 -0
- package/test-env/services/breakpoint/index.js +44 -0
- package/test-env/services/breakpoint/useIsWithinBreakpoints.js +34 -0
- package/test-env/services/hooks/index.js +0 -13
- package/test-env/services/index.js +28 -0
- package/test-env/test/rtl/component_helpers.js +69 -3
- package/lib/services/hooks/useIsWithinBreakpoints.js +0 -57
- package/optimize/es/services/hooks/useIsWithinBreakpoints.js +0 -46
- package/optimize/lib/services/hooks/useIsWithinBreakpoints.js +0 -57
- package/src/components/breadcrumbs/_breadcrumbs.scss +0 -79
- package/src/components/breadcrumbs/_index.scss +0 -2
- package/src/components/breadcrumbs/_variables.scss +0 -2
- package/src/components/description_list/_description_list.scss +0 -211
- package/src/components/description_list/_index.scss +0 -1
- package/src/components/header/header_breadcrumbs/_header_breadcrumbs.scss +0 -8
- package/src/components/header/header_breadcrumbs/_index.scss +0 -1
- package/src/components/portal/_index.scss +0 -1
- package/src/components/portal/_portal.scss +0 -6
- package/src/components/toast/_global_toast_list.scss +0 -90
- package/src/components/toast/_index.scss +0 -4
- package/src/components/toast/_toast.scss +0 -103
- package/src/components/token/_index.scss +0 -2
- package/src/components/token/_token.scss +0 -85
- package/src/components/token/_variables.scss +0 -13
- package/src/themes/amsterdam/overrides/_header_breadcrumbs.scss +0 -71
- package/src/themes/amsterdam/overrides/_toast.scss +0 -21
- package/src/themes/amsterdam/overrides/_token.scss +0 -4
- package/test-env/services/hooks/useIsWithinBreakpoints.js +0 -57
|
@@ -1,39 +1,29 @@
|
|
|
1
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
2
|
-
|
|
3
1
|
var _excluded = ["className", "toasts", "dismissToast", "toastLifeTimeMs", "side"],
|
|
4
2
|
_excluded2 = ["text", "toastLifeTimeMs"];
|
|
5
3
|
|
|
6
4
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
7
5
|
|
|
8
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
9
|
-
|
|
10
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
11
|
-
|
|
12
6
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
13
7
|
|
|
14
8
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
15
9
|
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
19
|
-
|
|
20
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
10
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
21
11
|
|
|
22
|
-
function
|
|
12
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
23
13
|
|
|
24
|
-
function
|
|
14
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
25
15
|
|
|
26
|
-
function
|
|
16
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
27
17
|
|
|
28
|
-
function
|
|
18
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
29
19
|
|
|
30
|
-
function
|
|
20
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
31
21
|
|
|
32
|
-
function
|
|
22
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
33
23
|
|
|
34
|
-
function
|
|
24
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
35
25
|
|
|
36
|
-
function
|
|
26
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
37
27
|
|
|
38
28
|
/*
|
|
39
29
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
@@ -42,13 +32,15 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
42
32
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
43
33
|
* Side Public License, v 1.
|
|
44
34
|
*/
|
|
45
|
-
import React, {
|
|
35
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
46
36
|
import PropTypes from "prop-types";
|
|
47
37
|
import classNames from 'classnames';
|
|
48
38
|
import { keysOf } from '../common';
|
|
39
|
+
import { useEuiTheme } from '../../services';
|
|
49
40
|
import { Timer } from '../../services/time';
|
|
50
41
|
import { EuiGlobalToastListItem } from './global_toast_list_item';
|
|
51
42
|
import { EuiToast } from './toast';
|
|
43
|
+
import { euiGlobalToastListStyles } from './global_toast_list.styles';
|
|
52
44
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
53
45
|
var sideToClassNameMap = {
|
|
54
46
|
left: 'euiGlobalToastList--left',
|
|
@@ -56,269 +48,244 @@ var sideToClassNameMap = {
|
|
|
56
48
|
};
|
|
57
49
|
export var SIDES = keysOf(sideToClassNameMap);
|
|
58
50
|
export var TOAST_FADE_OUT_MS = 250;
|
|
59
|
-
export var EuiGlobalToastList =
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
51
|
+
export var EuiGlobalToastList = function EuiGlobalToastList(_ref) {
|
|
52
|
+
var className = _ref.className,
|
|
53
|
+
_ref$toasts = _ref.toasts,
|
|
54
|
+
toasts = _ref$toasts === void 0 ? [] : _ref$toasts,
|
|
55
|
+
dismissToastProp = _ref.dismissToast,
|
|
56
|
+
toastLifeTimeMs = _ref.toastLifeTimeMs,
|
|
57
|
+
_ref$side = _ref.side,
|
|
58
|
+
side = _ref$side === void 0 ? 'right' : _ref$side,
|
|
59
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
60
|
+
|
|
61
|
+
var _useState = useState({}),
|
|
62
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
63
|
+
toastIdToDismissedMap = _useState2[0],
|
|
64
|
+
setToastIdToDismissedMap = _useState2[1];
|
|
65
|
+
|
|
66
|
+
var _useState3 = useState(),
|
|
67
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
68
|
+
toastToDismiss = _useState4[0],
|
|
69
|
+
setToastToDismiss = _useState4[1];
|
|
70
|
+
|
|
71
|
+
var prevToasts = useRef([]);
|
|
72
|
+
var dismissTimeoutIds = useRef([]);
|
|
73
|
+
var toastIdToTimerMap = useRef({});
|
|
74
|
+
var isScrollingToBottom = useRef(false);
|
|
75
|
+
var isScrolledToBottom = useRef(true);
|
|
76
|
+
var isUserInteracting = useRef(false); // See [Return Value](https://developer.mozilla.org/en-US/docs/Web/API/Window/requestAnimationFrame#Return_value)
|
|
77
|
+
// for information on initial value of 0
|
|
78
|
+
|
|
79
|
+
var isScrollingAnimationFrame = useRef(0);
|
|
80
|
+
var startScrollingAnimationFrame = useRef(0);
|
|
81
|
+
var listElement = useRef(null);
|
|
82
|
+
var euiTheme = useEuiTheme();
|
|
83
|
+
var styles = euiGlobalToastListStyles(euiTheme);
|
|
84
|
+
var cssStyles = [styles.euiGlobalToastList, styles[side]];
|
|
85
|
+
|
|
86
|
+
var startScrollingToBottom = function startScrollingToBottom() {
|
|
87
|
+
isScrollingToBottom.current = true;
|
|
88
|
+
|
|
89
|
+
var scrollToBottom = function scrollToBottom() {
|
|
90
|
+
// Although we cancel the requestAnimationFrame in componentWillUnmount,
|
|
91
|
+
// it's possible for this.listElement to become null in the meantime
|
|
92
|
+
if (!listElement.current) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
84
95
|
|
|
85
|
-
|
|
96
|
+
var position = listElement.current.scrollTop;
|
|
97
|
+
var destination = listElement.current.scrollHeight - listElement.current.clientHeight;
|
|
98
|
+
var distanceToDestination = destination - position;
|
|
86
99
|
|
|
87
|
-
|
|
100
|
+
if (distanceToDestination < 5) {
|
|
101
|
+
listElement.current.scrollTop = destination;
|
|
102
|
+
isScrollingToBottom.current = false;
|
|
103
|
+
isScrolledToBottom.current = true;
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
88
106
|
|
|
89
|
-
|
|
107
|
+
listElement.current.scrollTop = position + distanceToDestination * 0.25;
|
|
90
108
|
|
|
91
|
-
|
|
109
|
+
if (isScrollingToBottom) {
|
|
110
|
+
isScrollingAnimationFrame.current = window.requestAnimationFrame(scrollToBottom);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
92
113
|
|
|
93
|
-
|
|
114
|
+
startScrollingAnimationFrame.current = window.requestAnimationFrame(scrollToBottom);
|
|
115
|
+
};
|
|
94
116
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
117
|
+
var onMouseEnter = function onMouseEnter() {
|
|
118
|
+
// Stop scrolling to bottom if we're in mid-scroll, because the user wants to interact with
|
|
119
|
+
// the list.
|
|
120
|
+
isScrollingToBottom.current = false;
|
|
121
|
+
isUserInteracting.current = true; // Don't let toasts dismiss themselves while the user is interacting with them.
|
|
100
122
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
123
|
+
for (var _toastId in toastIdToTimerMap.current) {
|
|
124
|
+
if (toastIdToTimerMap.current.hasOwnProperty(_toastId)) {
|
|
125
|
+
var timer = toastIdToTimerMap.current[_toastId];
|
|
126
|
+
timer.pause();
|
|
106
127
|
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
_defineProperty(_assertThisInitialized(_this), "onMouseLeave", function () {
|
|
110
|
-
_this.isUserInteracting = false;
|
|
128
|
+
}
|
|
129
|
+
};
|
|
111
130
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
var timer = _this.toastIdToTimerMap[_toastId2];
|
|
115
|
-
timer.resume();
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
});
|
|
131
|
+
var onMouseLeave = function onMouseLeave() {
|
|
132
|
+
isUserInteracting.current = false;
|
|
119
133
|
|
|
120
|
-
|
|
121
|
-
if (
|
|
122
|
-
|
|
134
|
+
for (var _toastId2 in toastIdToTimerMap.current) {
|
|
135
|
+
if (toastIdToTimerMap.current.hasOwnProperty(_toastId2)) {
|
|
136
|
+
var timer = toastIdToTimerMap.current[_toastId2];
|
|
137
|
+
timer.resume();
|
|
123
138
|
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
_defineProperty(_assertThisInitialized(_this), "scheduleAllToastsForDismissal", function () {
|
|
127
|
-
_this.props.toasts.forEach(function (toast) {
|
|
128
|
-
if (!_this.toastIdToTimerMap[toast.id]) {
|
|
129
|
-
_this.scheduleToastForDismissal(toast);
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
});
|
|
139
|
+
}
|
|
140
|
+
};
|
|
133
141
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
142
|
+
var onScroll = function onScroll() {
|
|
143
|
+
if (listElement.current) {
|
|
144
|
+
isScrolledToBottom.current = listElement.current.scrollHeight - listElement.current.scrollTop === listElement.current.clientHeight;
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
var dismissToast = useCallback(function (toast) {
|
|
149
|
+
// Remove the toast after it's done fading out.
|
|
150
|
+
dismissTimeoutIds.current.push(window.setTimeout(function () {
|
|
151
|
+
setToastToDismiss(toast);
|
|
152
|
+
}, TOAST_FADE_OUT_MS));
|
|
153
|
+
setToastIdToDismissedMap(function (prev) {
|
|
154
|
+
return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, toast.id, true));
|
|
137
155
|
});
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
delete _this.toastIdToTimerMap[toast.id];
|
|
152
|
-
|
|
153
|
-
_this.setState(function (prevState) {
|
|
154
|
-
var toastIdToDismissedMap = _objectSpread({}, prevState.toastIdToDismissedMap);
|
|
155
|
-
|
|
156
|
-
delete toastIdToDismissedMap[toast.id];
|
|
157
|
-
return {
|
|
158
|
-
toastIdToDismissedMap: toastIdToDismissedMap
|
|
159
|
-
};
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
}, TOAST_FADE_OUT_MS));
|
|
163
|
-
|
|
164
|
-
_this.setState(function (prevState) {
|
|
165
|
-
var toastIdToDismissedMap = _objectSpread(_objectSpread({}, prevState.toastIdToDismissedMap), {}, _defineProperty({}, toast.id, true));
|
|
166
|
-
|
|
167
|
-
return {
|
|
168
|
-
toastIdToDismissedMap: toastIdToDismissedMap
|
|
169
|
-
};
|
|
170
|
-
});
|
|
156
|
+
}, []);
|
|
157
|
+
var scheduleToastForDismissal = useCallback(function (toast) {
|
|
158
|
+
// Start fading the toast out once its lifetime elapses.
|
|
159
|
+
toastIdToTimerMap.current[toast.id] = new Timer(function () {
|
|
160
|
+
return dismissToast(toast);
|
|
161
|
+
}, toast.toastLifeTimeMs != null ? toast.toastLifeTimeMs : toastLifeTimeMs);
|
|
162
|
+
}, [dismissToast, toastLifeTimeMs]);
|
|
163
|
+
var scheduleAllToastsForDismissal = useCallback(function () {
|
|
164
|
+
toasts.forEach(function (toast) {
|
|
165
|
+
if (!toastIdToTimerMap.current[toast.id]) {
|
|
166
|
+
scheduleToastForDismissal(toast);
|
|
167
|
+
}
|
|
171
168
|
});
|
|
169
|
+
}, [scheduleToastForDismissal, toasts]);
|
|
172
170
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
this.isScrollingToBottom = true;
|
|
182
|
-
|
|
183
|
-
var scrollToBottom = function scrollToBottom() {
|
|
184
|
-
// Although we cancel the requestAnimationFrame in componentWillUnmount,
|
|
185
|
-
// it's possible for this.listElement to become null in the meantime
|
|
186
|
-
if (!_this2.listElement) {
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
var position = _this2.listElement.scrollTop;
|
|
191
|
-
var destination = _this2.listElement.scrollHeight - _this2.listElement.clientHeight;
|
|
192
|
-
var distanceToDestination = destination - position;
|
|
193
|
-
|
|
194
|
-
if (distanceToDestination < 5) {
|
|
195
|
-
_this2.listElement.scrollTop = destination;
|
|
196
|
-
_this2.isScrollingToBottom = false;
|
|
197
|
-
_this2.isScrolledToBottom = true;
|
|
198
|
-
return;
|
|
199
|
-
}
|
|
171
|
+
var addListeners = function addListeners() {
|
|
172
|
+
if (listElement.current) {
|
|
173
|
+
listElement.current.addEventListener('scroll', onScroll);
|
|
174
|
+
listElement.current.addEventListener('mouseenter', onMouseEnter);
|
|
175
|
+
listElement.current.addEventListener('mouseleave', onMouseLeave);
|
|
176
|
+
}
|
|
177
|
+
};
|
|
200
178
|
|
|
201
|
-
|
|
179
|
+
var removeListeners = function removeListeners() {
|
|
180
|
+
if (listElement.current) {
|
|
181
|
+
listElement.current.removeEventListener('scroll', onScroll);
|
|
182
|
+
listElement.current.removeEventListener('mouseenter', onMouseEnter);
|
|
183
|
+
listElement.current.removeEventListener('mouseleave', onMouseLeave);
|
|
184
|
+
}
|
|
185
|
+
}; // componentDidMount
|
|
202
186
|
|
|
203
|
-
if (_this2.isScrollingToBottom) {
|
|
204
|
-
_this2.isScrollingAnimationFrame = window.requestAnimationFrame(scrollToBottom);
|
|
205
|
-
}
|
|
206
|
-
};
|
|
207
187
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
}, {
|
|
211
|
-
key: "componentDidMount",
|
|
212
|
-
value: function componentDidMount() {
|
|
213
|
-
if (this.listElement) {
|
|
214
|
-
this.listElement.addEventListener('scroll', this.onScroll);
|
|
215
|
-
this.listElement.addEventListener('mouseenter', this.onMouseEnter);
|
|
216
|
-
this.listElement.addEventListener('mouseleave', this.onMouseLeave);
|
|
217
|
-
}
|
|
188
|
+
useEffect(function () {
|
|
189
|
+
addListeners(); // componentWillUnmount
|
|
218
190
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
key: "componentDidUpdate",
|
|
223
|
-
value: function componentDidUpdate(prevProps) {
|
|
224
|
-
this.scheduleAllToastsForDismissal();
|
|
225
|
-
|
|
226
|
-
if (!this.isUserInteracting) {
|
|
227
|
-
// If the user has scrolled up the toast list then we don't want to annoy them by scrolling
|
|
228
|
-
// all the way back to the bottom.
|
|
229
|
-
if (this.isScrolledToBottom) {
|
|
230
|
-
if (prevProps.toasts.length < this.props.toasts.length) {
|
|
231
|
-
this.startScrollingToBottom();
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
}, {
|
|
237
|
-
key: "componentWillUnmount",
|
|
238
|
-
value: function componentWillUnmount() {
|
|
239
|
-
if (this.isScrollingAnimationFrame !== 0) {
|
|
240
|
-
window.cancelAnimationFrame(this.isScrollingAnimationFrame);
|
|
191
|
+
return function () {
|
|
192
|
+
if (isScrollingAnimationFrame.current !== 0) {
|
|
193
|
+
window.cancelAnimationFrame(isScrollingAnimationFrame.current);
|
|
241
194
|
}
|
|
242
195
|
|
|
243
|
-
if (
|
|
244
|
-
window.cancelAnimationFrame(
|
|
196
|
+
if (startScrollingAnimationFrame.current !== 0) {
|
|
197
|
+
window.cancelAnimationFrame(startScrollingAnimationFrame.current);
|
|
245
198
|
}
|
|
246
199
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
this.listElement.removeEventListener('mouseenter', this.onMouseEnter);
|
|
250
|
-
this.listElement.removeEventListener('mouseleave', this.onMouseLeave);
|
|
251
|
-
}
|
|
200
|
+
removeListeners();
|
|
201
|
+
dismissTimeoutIds.current.forEach(clearTimeout); // eslint-disable-line react-hooks/exhaustive-deps
|
|
252
202
|
|
|
253
|
-
|
|
203
|
+
for (var _toastId3 in toastIdToTimerMap.current) {
|
|
204
|
+
if (toastIdToTimerMap.current.hasOwnProperty(_toastId3)) {
|
|
205
|
+
var timer = toastIdToTimerMap.current[_toastId3]; // eslint-disable-line react-hooks/exhaustive-deps
|
|
254
206
|
|
|
255
|
-
for (var _toastId3 in this.toastIdToTimerMap) {
|
|
256
|
-
if (this.toastIdToTimerMap.hasOwnProperty(_toastId3)) {
|
|
257
|
-
var timer = this.toastIdToTimerMap[_toastId3];
|
|
258
207
|
timer.clear();
|
|
259
208
|
}
|
|
260
209
|
}
|
|
210
|
+
};
|
|
211
|
+
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
212
|
+
// componentDidUpdate
|
|
213
|
+
|
|
214
|
+
useEffect(function () {
|
|
215
|
+
scheduleAllToastsForDismissal();
|
|
216
|
+
|
|
217
|
+
if (!isUserInteracting.current) {
|
|
218
|
+
// If the user has scrolled up the toast list then we don't want to annoy them by scrolling
|
|
219
|
+
// all the way back to the bottom.
|
|
220
|
+
if (isScrolledToBottom.current) {
|
|
221
|
+
if (prevToasts.current.length < toasts.length) {
|
|
222
|
+
startScrollingToBottom();
|
|
223
|
+
}
|
|
224
|
+
}
|
|
261
225
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
isDismissed: _this3.state.toastIdToDismissedMap[toast.id]
|
|
283
|
-
}, ___EmotionJSX(EuiToast, _extends({
|
|
284
|
-
onClose: _this3.dismissToast.bind(_this3, toast),
|
|
285
|
-
onFocus: _this3.onMouseEnter,
|
|
286
|
-
onBlur: _this3.onMouseLeave
|
|
287
|
-
}, rest), text));
|
|
226
|
+
|
|
227
|
+
prevToasts.current = toasts;
|
|
228
|
+
}, [toasts, scheduleAllToastsForDismissal]); // Toast dismissal side effect
|
|
229
|
+
// Ensure the callback has correct state by not enclosing it in `setTimeout`
|
|
230
|
+
|
|
231
|
+
useEffect(function () {
|
|
232
|
+
var toast = toastToDismiss; // Because this is triggered by a setTimeout, and because React does not guarantee when
|
|
233
|
+
// state updates happen, it is possible to double-dismiss a toast
|
|
234
|
+
// including by double-clicking the "x" button on the toast
|
|
235
|
+
// so, first check to make sure we haven't already dismissed this toast
|
|
236
|
+
|
|
237
|
+
if (toast && toastIdToTimerMap.current.hasOwnProperty(toast.id)) {
|
|
238
|
+
dismissToastProp(toast);
|
|
239
|
+
toastIdToTimerMap.current[toast.id].clear();
|
|
240
|
+
delete toastIdToTimerMap.current[toast.id];
|
|
241
|
+
setToastIdToDismissedMap(function (prev) {
|
|
242
|
+
var toastIdToDismissedMap = _objectSpread({}, prev);
|
|
243
|
+
|
|
244
|
+
delete toastIdToDismissedMap[toast.id];
|
|
245
|
+
return toastIdToDismissedMap;
|
|
288
246
|
});
|
|
289
|
-
var classes = classNames('euiGlobalToastList', side ? sideToClassNameMap[side] : null, className);
|
|
290
|
-
return ___EmotionJSX("div", _extends({
|
|
291
|
-
"aria-live": "polite",
|
|
292
|
-
role: "region",
|
|
293
|
-
ref: function ref(element) {
|
|
294
|
-
_this3.listElement = element;
|
|
295
|
-
},
|
|
296
|
-
className: classes
|
|
297
|
-
}, rest), renderedToasts);
|
|
298
247
|
}
|
|
299
|
-
}]);
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
}
|
|
308
|
-
|
|
248
|
+
}, [toastToDismiss, dismissToastProp]);
|
|
249
|
+
var renderedToasts = toasts.map(function (toast) {
|
|
250
|
+
var text = toast.text,
|
|
251
|
+
toastLifeTimeMs = toast.toastLifeTimeMs,
|
|
252
|
+
rest = _objectWithoutProperties(toast, _excluded2);
|
|
253
|
+
|
|
254
|
+
var onClose = function onClose() {
|
|
255
|
+
return dismissToast(toast);
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
return ___EmotionJSX(EuiGlobalToastListItem, {
|
|
259
|
+
key: toast.id,
|
|
260
|
+
isDismissed: toastIdToDismissedMap[toast.id]
|
|
261
|
+
}, ___EmotionJSX(EuiToast, _extends({
|
|
262
|
+
onClose: onClose,
|
|
263
|
+
onFocus: onMouseEnter,
|
|
264
|
+
onBlur: onMouseLeave
|
|
265
|
+
}, rest), text));
|
|
266
|
+
});
|
|
267
|
+
var classes = classNames('euiGlobalToastList', className);
|
|
268
|
+
return ___EmotionJSX("div", _extends({
|
|
269
|
+
"aria-live": "polite",
|
|
270
|
+
role: "region",
|
|
271
|
+
ref: listElement,
|
|
272
|
+
css: cssStyles,
|
|
273
|
+
className: classes
|
|
274
|
+
}, rest), renderedToasts);
|
|
275
|
+
};
|
|
309
276
|
EuiGlobalToastList.propTypes = {
|
|
310
277
|
toasts: PropTypes.arrayOf(PropTypes.shape({
|
|
311
278
|
id: PropTypes.string.isRequired,
|
|
312
279
|
text: PropTypes.node,
|
|
313
280
|
toastLifeTimeMs: PropTypes.number,
|
|
314
281
|
title: PropTypes.node,
|
|
315
|
-
color: PropTypes.
|
|
282
|
+
color: PropTypes.any,
|
|
316
283
|
iconType: PropTypes.oneOfType([PropTypes.oneOf(["accessibility", "addDataApp", "advancedSettingsApp", "agentApp", "aggregate", "alert", "analyzeEvent", "annotation", "apmApp", "apmTrace", "appSearchApp", "apps", "arrowDown", "arrowLeft", "arrowRight", "arrowUp", "arrowStart", "arrowEnd", "asterisk", "auditbeatApp", "beaker", "bell", "bellSlash", "bolt", "boxesHorizontal", "boxesVertical", "branch", "branchUser", "broom", "brush", "bug", "bullseye", "calendar", "canvasApp", "casesApp", "check", "checkInCircleFilled", "cheer", "classificationJob", "clock", "cloudDrizzle", "cloudStormy", "cloudSunny", "cluster", "codeApp", "color", "compute", "console", "consoleApp", "container", "continuityAbove", "continuityAboveBelow", "continuityBelow", "continuityWithin", "controlsHorizontal", "controlsVertical", "copy", "copyClipboard", "createAdvancedJob", "createMultiMetricJob", "createPopulationJob", "createSingleMetricJob", "cross", "crossClusterReplicationApp", "crossInACircleFilled", "crosshairs", "currency", "cut", "dashboardApp", "dataVisualizer", "database", "desktop", "devToolsApp", "discoverApp", "document", "documentEdit", "documentation", "documents", "dot", "doubleArrowLeft", "doubleArrowRight", "download", "editorAlignCenter", "editorAlignLeft", "editorAlignRight", "editorBold", "editorChecklist", "editorCodeBlock", "editorComment", "editorDistributeHorizontal", "editorDistributeVertical", "editorHeading", "editorItalic", "editorItemAlignBottom", "editorItemAlignCenter", "editorItemAlignLeft", "editorItemAlignMiddle", "editorItemAlignRight", "editorItemAlignTop", "editorLink", "editorOrderedList", "editorPositionBottomLeft", "editorPositionBottomRight", "editorPositionTopLeft", "editorPositionTopRight", "editorRedo", "editorStrike", "editorTable", "editorUnderline", "editorUndo", "editorUnorderedList", "email", "empty", "emsApp", "eql", "eraser", "exit", "expand", "expandMini", "exportAction", "eye", "eyeClosed", "faceHappy", "faceNeutral", "faceSad", "filebeatApp", "filter", "flag", "fleetApp", "fold", "folderCheck", "folderClosed", "folderExclamation", "folderOpen", "frameNext", "framePrevious", "fullScreen", "fullScreenExit", "function", "gear", "gisApp", "glasses", "globe", "grab", "grabHorizontal", "graphApp", "grid", "grokApp", "heart", "heartbeatApp", "heatmap", "help", "home", "iInCircle", "image", "importAction", "indexClose", "indexEdit", "indexFlush", "indexManagementApp", "indexMapping", "indexOpen", "indexPatternApp", "indexRollupApp", "indexRuntime", "indexSettings", "inputOutput", "inspect", "invert", "ip", "keyboard", "kqlField", "kqlFunction", "kqlOperand", "kqlSelector", "kqlValue", "kubernetesNode", "kubernetesPod", "layers", "lensApp", "lettering", "lineDashed", "lineDotted", "lineSolid", "link", "list", "listAdd", "lock", "lockOpen", "logoAWS", "logoAWSMono", "logoAerospike", "logoApache", "logoAppSearch", "logoAzure", "logoAzureMono", "logoBeats", "logoBusinessAnalytics", "logoCeph", "logoCloud", "logoCloudEnterprise", "logoCode", "logoCodesandbox", "logoCouchbase", "logoDocker", "logoDropwizard", "logoElastic", "logoElasticStack", "logoElasticsearch", "logoEnterpriseSearch", "logoEtcd", "logoGCP", "logoGCPMono", "logoGithub", "logoGmail", "logoGolang", "logoGoogleG", "logoHAproxy", "logoIBM", "logoIBMMono", "logoKafka", "logoKibana", "logoKubernetes", "logoLogging", "logoLogstash", "logoMaps", "logoMemcached", "logoMetrics", "logoMongodb", "logoMySQL", "logoNginx", "logoObservability", "logoOsquery", "logoPhp", "logoPostgres", "logoPrometheus", "logoRabbitmq", "logoRedis", "logoSecurity", "logoSiteSearch", "logoSketch", "logoSlack", "logoUptime", "logoWebhook", "logoWindows", "logoWorkplaceSearch", "logsApp", "logstashFilter", "logstashIf", "logstashInput", "logstashOutput", "logstashQueue", "machineLearningApp", "magnet", "magnifyWithExclamation", "magnifyWithMinus", "magnifyWithPlus", "managementApp", "mapMarker", "memory", "menu", "menuDown", "menuLeft", "menuRight", "menuUp", "merge", "metricbeatApp", "metricsApp", "minimize", "minus", "minusInCircle", "minusInCircleFilled", "mobile", "monitoringApp", "moon", "namespace", "nested", "node", "notebookApp", "number", "offline", "online", "outlierDetectionJob", "package", "packetbeatApp", "pageSelect", "pagesSelect", "paperClip", "partial", "pause", "payment", "pencil", "percent", "pin", "pinFilled", "pipelineApp", "play", "playFilled", "plus", "plusInCircle", "plusInCircleFilled", "popout", "push", "questionInCircle", "quote", "recentlyViewedApp", "refresh", "regressionJob", "reporter", "reportingApp", "returnKey", "save", "savedObjectsApp", "scale", "search", "searchProfilerApp", "securityAnalyticsApp", "securityApp", "securitySignal", "securitySignalDetected", "securitySignalResolved", "sessionViewer", "shard", "share", "snowflake", "sortDown", "sortLeft", "sortRight", "sortUp", "sortable", "spacesApp", "sqlApp", "starEmpty", "starEmptySpace", "starFilled", "starFilledSpace", "starMinusEmpty", "starMinusFilled", "starPlusEmpty", "starPlusFilled", "stats", "stop", "stopFilled", "stopSlash", "storage", "string", "submodule", "sun", "swatchInput", "symlink", "tableDensityCompact", "tableDensityExpanded", "tableDensityNormal", "tableOfContents", "tag", "tear", "temperature", "timeline", "timelionApp", "timeRefresh", "timeslider", "training", "trash", "unfold", "unlink", "upgradeAssistantApp", "uptimeApp", "user", "userAvatar", "users", "usersRolesApp", "vector", "videoPlayer", "visArea", "visAreaStacked", "visBarHorizontal", "visBarHorizontalStacked", "visBarVertical", "visBarVerticalStacked", "visGauge", "visGoal", "visLine", "visMapCoordinate", "visMapRegion", "visMetric", "visPie", "visTable", "visTagCloud", "visText", "visTimelion", "visVega", "visVisualBuilder", "visualizeApp", "watchesApp", "wordWrap", "wordWrapDisabled", "workplaceSearchApp", "wrench", "tokenAlias", "tokenAnnotation", "tokenArray", "tokenBinary", "tokenBoolean", "tokenClass", "tokenCompletionSuggester", "tokenConstant", "tokenDate", "tokenDenseVector", "tokenElement", "tokenEnum", "tokenEnumMember", "tokenEvent", "tokenException", "tokenField", "tokenFile", "tokenFlattened", "tokenFunction", "tokenGeo", "tokenHistogram", "tokenInterface", "tokenIP", "tokenJoin", "tokenKey", "tokenKeyword", "tokenMethod", "tokenMetricCounter", "tokenMetricGauge", "tokenModule", "tokenNamespace", "tokenNested", "tokenNull", "tokenNumber", "tokenObject", "tokenOperator", "tokenPackage", "tokenParameter", "tokenPercolator", "tokenProperty", "tokenRange", "tokenRankFeature", "tokenRankFeatures", "tokenRepo", "tokenSearchType", "tokenShape", "tokenString", "tokenStruct", "tokenSymbol", "tokenTag", "tokenText", "tokenTokenCount", "tokenVariable"]).isRequired, PropTypes.string.isRequired, PropTypes.elementType.isRequired]),
|
|
317
284
|
onClose: PropTypes.func,
|
|
318
285
|
className: PropTypes.string,
|
|
319
286
|
"aria-label": PropTypes.string,
|
|
320
287
|
"data-test-subj": PropTypes.string
|
|
321
|
-
}).isRequired)
|
|
288
|
+
}).isRequired),
|
|
322
289
|
dismissToast: PropTypes.func.isRequired,
|
|
323
290
|
toastLifeTimeMs: PropTypes.number.isRequired,
|
|
324
291
|
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
var _templateObject;
|
|
2
|
+
|
|
3
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
7
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
8
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
9
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
10
|
+
* Side Public License, v 1.
|
|
11
|
+
*/
|
|
12
|
+
import { css, keyframes } from '@emotion/react';
|
|
13
|
+
import { euiBreakpoint, euiScrollBarStyles, logicalCSS, logicalSizeCSS } from '../../global_styling';
|
|
14
|
+
export var euiGlobalToastListStyles = function euiGlobalToastListStyles(euiThemeContext) {
|
|
15
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
16
|
+
var euiToastWidth = euiTheme.base * 20;
|
|
17
|
+
return {
|
|
18
|
+
/**
|
|
19
|
+
* 1. Allow list to expand as items are added, but cap it at the screen height.
|
|
20
|
+
* 2. Allow some padding for shadow
|
|
21
|
+
*/
|
|
22
|
+
// Base
|
|
23
|
+
euiGlobalToastList: /*#__PURE__*/css(euiScrollBarStyles(euiThemeContext), " display:flex;flex-direction:column;align-items:stretch;position:fixed;z-index:", euiTheme.levels.toast, ";", logicalCSS('bottom', 0), ";", logicalCSS('width', "".concat(euiToastWidth + euiTheme.base * 5, "px")), ";", logicalCSS('max-height', '100vh'), ";overflow-y:auto;", logicalCSS('overflow-y', 'auto'), ";scrollbar-width:none;&::-webkit-scrollbar{", logicalSizeCSS(0, 0), ";}&:not(:empty){", logicalCSS('padding-left', euiTheme.size.base), ";", logicalCSS('padding-right', euiTheme.size.base), ";", logicalCSS('padding-vertical', euiTheme.size.base), ";}", euiBreakpoint(euiThemeContext, ['xs', 's']), "{&:not(:empty){", logicalCSS('left', 0), ";", logicalCSS('width', '100%'), ";}};label:euiGlobalToastList;"),
|
|
24
|
+
// Variants
|
|
25
|
+
right: /*#__PURE__*/css("&:not(:empty){", logicalCSS('right', 0), ";", logicalCSS('padding-left', "".concat(euiTheme.base * 4, "px")), ";}", euiBreakpoint(euiThemeContext, ['xs', 's']), "{&:not(:empty){", logicalCSS('padding-left', euiTheme.size.base), ";}};label:right;"),
|
|
26
|
+
left: /*#__PURE__*/css("&:not(:empty){", logicalCSS('left', 0), ";", logicalCSS('padding-right', "".concat(euiTheme.base * 4, "px")), ";}", euiBreakpoint(euiThemeContext, ['xs', 's']), "{&:not(:empty){", logicalCSS('padding-right', euiTheme.size.base), ";}};label:left;")
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export var euiGlobalToastListItemStyles = function euiGlobalToastListItemStyles(_ref) {
|
|
30
|
+
var euiTheme = _ref.euiTheme;
|
|
31
|
+
var euiShowToast = keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n from {\n transform: translateY(", ") scale(.9);\n opacity: 0;\n }\n\n to {\n transform: translateY(0) scale(1);\n opacity: 1;\n }\n"])), euiTheme.size.l);
|
|
32
|
+
return {
|
|
33
|
+
// Base
|
|
34
|
+
euiGlobalToastListItem: /*#__PURE__*/css(logicalCSS('margin-bottom', euiTheme.size.base), ";animation:", euiTheme.animation.normal, " ", euiShowToast, " ", euiTheme.animation.resistance, ";opacity:1;&:first-child{", logicalCSS('margin-top', 'auto'), ";}&:last-child{", logicalCSS('margin-bottom', 0), ";};label:euiGlobalToastListItem;"),
|
|
35
|
+
// States
|
|
36
|
+
dismissed: /*#__PURE__*/css("transition:opacity ", euiTheme.animation.normal, ";opacity:0;;label:dismissed;")
|
|
37
|
+
};
|
|
38
|
+
};
|