@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,12 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
6
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
7
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
8
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
9
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
10
5
|
var _excluded = ["className", "toasts", "dismissToast", "toastLifeTimeMs", "side"],
|
|
11
6
|
_excluded2 = ["text", "toastLifeTimeMs"];
|
|
12
7
|
|
|
@@ -14,10 +9,6 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
14
9
|
|
|
15
10
|
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; }
|
|
16
11
|
|
|
17
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
18
|
-
|
|
19
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
20
|
-
|
|
21
12
|
/*
|
|
22
13
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
23
14
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -25,12 +16,14 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
25
16
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
26
17
|
* Side Public License, v 1.
|
|
27
18
|
*/
|
|
28
|
-
import React, {
|
|
19
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
29
20
|
import classNames from 'classnames';
|
|
30
21
|
import { keysOf } from '../common';
|
|
22
|
+
import { useEuiTheme } from '../../services';
|
|
31
23
|
import { Timer } from '../../services/time';
|
|
32
24
|
import { EuiGlobalToastListItem } from './global_toast_list_item';
|
|
33
25
|
import { EuiToast } from './toast';
|
|
26
|
+
import { euiGlobalToastListStyles } from './global_toast_list.styles';
|
|
34
27
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
35
28
|
var sideToClassNameMap = {
|
|
36
29
|
left: 'euiGlobalToastList--left',
|
|
@@ -38,252 +31,228 @@ var sideToClassNameMap = {
|
|
|
38
31
|
};
|
|
39
32
|
export var SIDES = keysOf(sideToClassNameMap);
|
|
40
33
|
export var TOAST_FADE_OUT_MS = 250;
|
|
41
|
-
export var EuiGlobalToastList =
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
34
|
+
export var EuiGlobalToastList = function EuiGlobalToastList(_ref) {
|
|
35
|
+
var className = _ref.className,
|
|
36
|
+
_ref$toasts = _ref.toasts,
|
|
37
|
+
toasts = _ref$toasts === void 0 ? [] : _ref$toasts,
|
|
38
|
+
dismissToastProp = _ref.dismissToast,
|
|
39
|
+
toastLifeTimeMs = _ref.toastLifeTimeMs,
|
|
40
|
+
_ref$side = _ref.side,
|
|
41
|
+
side = _ref$side === void 0 ? 'right' : _ref$side,
|
|
42
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
43
|
+
|
|
44
|
+
var _useState = useState({}),
|
|
45
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
46
|
+
toastIdToDismissedMap = _useState2[0],
|
|
47
|
+
setToastIdToDismissedMap = _useState2[1];
|
|
48
|
+
|
|
49
|
+
var _useState3 = useState(),
|
|
50
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
51
|
+
toastToDismiss = _useState4[0],
|
|
52
|
+
setToastToDismiss = _useState4[1];
|
|
53
|
+
|
|
54
|
+
var prevToasts = useRef([]);
|
|
55
|
+
var dismissTimeoutIds = useRef([]);
|
|
56
|
+
var toastIdToTimerMap = useRef({});
|
|
57
|
+
var isScrollingToBottom = useRef(false);
|
|
58
|
+
var isScrolledToBottom = useRef(true);
|
|
59
|
+
var isUserInteracting = useRef(false); // See [Return Value](https://developer.mozilla.org/en-US/docs/Web/API/Window/requestAnimationFrame#Return_value)
|
|
60
|
+
// for information on initial value of 0
|
|
61
|
+
|
|
62
|
+
var isScrollingAnimationFrame = useRef(0);
|
|
63
|
+
var startScrollingAnimationFrame = useRef(0);
|
|
64
|
+
var listElement = useRef(null);
|
|
65
|
+
var euiTheme = useEuiTheme();
|
|
66
|
+
var styles = euiGlobalToastListStyles(euiTheme);
|
|
67
|
+
var cssStyles = [styles.euiGlobalToastList, styles[side]];
|
|
68
|
+
|
|
69
|
+
var startScrollingToBottom = function startScrollingToBottom() {
|
|
70
|
+
isScrollingToBottom.current = true;
|
|
71
|
+
|
|
72
|
+
var scrollToBottom = function scrollToBottom() {
|
|
73
|
+
// Although we cancel the requestAnimationFrame in componentWillUnmount,
|
|
74
|
+
// it's possible for this.listElement to become null in the meantime
|
|
75
|
+
if (!listElement.current) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
66
78
|
|
|
67
|
-
|
|
79
|
+
var position = listElement.current.scrollTop;
|
|
80
|
+
var destination = listElement.current.scrollHeight - listElement.current.clientHeight;
|
|
81
|
+
var distanceToDestination = destination - position;
|
|
68
82
|
|
|
69
|
-
|
|
83
|
+
if (distanceToDestination < 5) {
|
|
84
|
+
listElement.current.scrollTop = destination;
|
|
85
|
+
isScrollingToBottom.current = false;
|
|
86
|
+
isScrolledToBottom.current = true;
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
70
89
|
|
|
71
|
-
|
|
90
|
+
listElement.current.scrollTop = position + distanceToDestination * 0.25;
|
|
72
91
|
|
|
73
|
-
|
|
92
|
+
if (isScrollingToBottom) {
|
|
93
|
+
isScrollingAnimationFrame.current = window.requestAnimationFrame(scrollToBottom);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
74
96
|
|
|
75
|
-
|
|
97
|
+
startScrollingAnimationFrame.current = window.requestAnimationFrame(scrollToBottom);
|
|
98
|
+
};
|
|
76
99
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
100
|
+
var onMouseEnter = function onMouseEnter() {
|
|
101
|
+
// Stop scrolling to bottom if we're in mid-scroll, because the user wants to interact with
|
|
102
|
+
// the list.
|
|
103
|
+
isScrollingToBottom.current = false;
|
|
104
|
+
isUserInteracting.current = true; // Don't let toasts dismiss themselves while the user is interacting with them.
|
|
82
105
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
106
|
+
for (var _toastId in toastIdToTimerMap.current) {
|
|
107
|
+
if (toastIdToTimerMap.current.hasOwnProperty(_toastId)) {
|
|
108
|
+
var timer = toastIdToTimerMap.current[_toastId];
|
|
109
|
+
timer.pause();
|
|
88
110
|
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
_defineProperty(_assertThisInitialized(_this), "onMouseLeave", function () {
|
|
92
|
-
_this.isUserInteracting = false;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
93
113
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
var timer = _this.toastIdToTimerMap[_toastId2];
|
|
97
|
-
timer.resume();
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
});
|
|
114
|
+
var onMouseLeave = function onMouseLeave() {
|
|
115
|
+
isUserInteracting.current = false;
|
|
101
116
|
|
|
102
|
-
|
|
103
|
-
if (
|
|
104
|
-
|
|
117
|
+
for (var _toastId2 in toastIdToTimerMap.current) {
|
|
118
|
+
if (toastIdToTimerMap.current.hasOwnProperty(_toastId2)) {
|
|
119
|
+
var timer = toastIdToTimerMap.current[_toastId2];
|
|
120
|
+
timer.resume();
|
|
105
121
|
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
_defineProperty(_assertThisInitialized(_this), "scheduleAllToastsForDismissal", function () {
|
|
109
|
-
_this.props.toasts.forEach(function (toast) {
|
|
110
|
-
if (!_this.toastIdToTimerMap[toast.id]) {
|
|
111
|
-
_this.scheduleToastForDismissal(toast);
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
});
|
|
122
|
+
}
|
|
123
|
+
};
|
|
115
124
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
125
|
+
var onScroll = function onScroll() {
|
|
126
|
+
if (listElement.current) {
|
|
127
|
+
isScrolledToBottom.current = listElement.current.scrollHeight - listElement.current.scrollTop === listElement.current.clientHeight;
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
var dismissToast = useCallback(function (toast) {
|
|
132
|
+
// Remove the toast after it's done fading out.
|
|
133
|
+
dismissTimeoutIds.current.push(window.setTimeout(function () {
|
|
134
|
+
setToastToDismiss(toast);
|
|
135
|
+
}, TOAST_FADE_OUT_MS));
|
|
136
|
+
setToastIdToDismissedMap(function (prev) {
|
|
137
|
+
return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, toast.id, true));
|
|
119
138
|
});
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
delete _this.toastIdToTimerMap[toast.id];
|
|
134
|
-
|
|
135
|
-
_this.setState(function (prevState) {
|
|
136
|
-
var toastIdToDismissedMap = _objectSpread({}, prevState.toastIdToDismissedMap);
|
|
137
|
-
|
|
138
|
-
delete toastIdToDismissedMap[toast.id];
|
|
139
|
-
return {
|
|
140
|
-
toastIdToDismissedMap: toastIdToDismissedMap
|
|
141
|
-
};
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
}, TOAST_FADE_OUT_MS));
|
|
145
|
-
|
|
146
|
-
_this.setState(function (prevState) {
|
|
147
|
-
var toastIdToDismissedMap = _objectSpread(_objectSpread({}, prevState.toastIdToDismissedMap), {}, _defineProperty({}, toast.id, true));
|
|
148
|
-
|
|
149
|
-
return {
|
|
150
|
-
toastIdToDismissedMap: toastIdToDismissedMap
|
|
151
|
-
};
|
|
152
|
-
});
|
|
139
|
+
}, []);
|
|
140
|
+
var scheduleToastForDismissal = useCallback(function (toast) {
|
|
141
|
+
// Start fading the toast out once its lifetime elapses.
|
|
142
|
+
toastIdToTimerMap.current[toast.id] = new Timer(function () {
|
|
143
|
+
return dismissToast(toast);
|
|
144
|
+
}, toast.toastLifeTimeMs != null ? toast.toastLifeTimeMs : toastLifeTimeMs);
|
|
145
|
+
}, [dismissToast, toastLifeTimeMs]);
|
|
146
|
+
var scheduleAllToastsForDismissal = useCallback(function () {
|
|
147
|
+
toasts.forEach(function (toast) {
|
|
148
|
+
if (!toastIdToTimerMap.current[toast.id]) {
|
|
149
|
+
scheduleToastForDismissal(toast);
|
|
150
|
+
}
|
|
153
151
|
});
|
|
152
|
+
}, [scheduleToastForDismissal, toasts]);
|
|
154
153
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
this.isScrollingToBottom = true;
|
|
164
|
-
|
|
165
|
-
var scrollToBottom = function scrollToBottom() {
|
|
166
|
-
// Although we cancel the requestAnimationFrame in componentWillUnmount,
|
|
167
|
-
// it's possible for this.listElement to become null in the meantime
|
|
168
|
-
if (!_this2.listElement) {
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
var position = _this2.listElement.scrollTop;
|
|
173
|
-
var destination = _this2.listElement.scrollHeight - _this2.listElement.clientHeight;
|
|
174
|
-
var distanceToDestination = destination - position;
|
|
175
|
-
|
|
176
|
-
if (distanceToDestination < 5) {
|
|
177
|
-
_this2.listElement.scrollTop = destination;
|
|
178
|
-
_this2.isScrollingToBottom = false;
|
|
179
|
-
_this2.isScrolledToBottom = true;
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
154
|
+
var addListeners = function addListeners() {
|
|
155
|
+
if (listElement.current) {
|
|
156
|
+
listElement.current.addEventListener('scroll', onScroll);
|
|
157
|
+
listElement.current.addEventListener('mouseenter', onMouseEnter);
|
|
158
|
+
listElement.current.addEventListener('mouseleave', onMouseLeave);
|
|
159
|
+
}
|
|
160
|
+
};
|
|
182
161
|
|
|
183
|
-
|
|
162
|
+
var removeListeners = function removeListeners() {
|
|
163
|
+
if (listElement.current) {
|
|
164
|
+
listElement.current.removeEventListener('scroll', onScroll);
|
|
165
|
+
listElement.current.removeEventListener('mouseenter', onMouseEnter);
|
|
166
|
+
listElement.current.removeEventListener('mouseleave', onMouseLeave);
|
|
167
|
+
}
|
|
168
|
+
}; // componentDidMount
|
|
184
169
|
|
|
185
|
-
if (_this2.isScrollingToBottom) {
|
|
186
|
-
_this2.isScrollingAnimationFrame = window.requestAnimationFrame(scrollToBottom);
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
170
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
}, {
|
|
193
|
-
key: "componentDidMount",
|
|
194
|
-
value: function componentDidMount() {
|
|
195
|
-
if (this.listElement) {
|
|
196
|
-
this.listElement.addEventListener('scroll', this.onScroll);
|
|
197
|
-
this.listElement.addEventListener('mouseenter', this.onMouseEnter);
|
|
198
|
-
this.listElement.addEventListener('mouseleave', this.onMouseLeave);
|
|
199
|
-
}
|
|
171
|
+
useEffect(function () {
|
|
172
|
+
addListeners(); // componentWillUnmount
|
|
200
173
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
key: "componentDidUpdate",
|
|
205
|
-
value: function componentDidUpdate(prevProps) {
|
|
206
|
-
this.scheduleAllToastsForDismissal();
|
|
207
|
-
|
|
208
|
-
if (!this.isUserInteracting) {
|
|
209
|
-
// If the user has scrolled up the toast list then we don't want to annoy them by scrolling
|
|
210
|
-
// all the way back to the bottom.
|
|
211
|
-
if (this.isScrolledToBottom) {
|
|
212
|
-
if (prevProps.toasts.length < this.props.toasts.length) {
|
|
213
|
-
this.startScrollingToBottom();
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
}, {
|
|
219
|
-
key: "componentWillUnmount",
|
|
220
|
-
value: function componentWillUnmount() {
|
|
221
|
-
if (this.isScrollingAnimationFrame !== 0) {
|
|
222
|
-
window.cancelAnimationFrame(this.isScrollingAnimationFrame);
|
|
174
|
+
return function () {
|
|
175
|
+
if (isScrollingAnimationFrame.current !== 0) {
|
|
176
|
+
window.cancelAnimationFrame(isScrollingAnimationFrame.current);
|
|
223
177
|
}
|
|
224
178
|
|
|
225
|
-
if (
|
|
226
|
-
window.cancelAnimationFrame(
|
|
179
|
+
if (startScrollingAnimationFrame.current !== 0) {
|
|
180
|
+
window.cancelAnimationFrame(startScrollingAnimationFrame.current);
|
|
227
181
|
}
|
|
228
182
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
this.listElement.removeEventListener('mouseenter', this.onMouseEnter);
|
|
232
|
-
this.listElement.removeEventListener('mouseleave', this.onMouseLeave);
|
|
233
|
-
}
|
|
183
|
+
removeListeners();
|
|
184
|
+
dismissTimeoutIds.current.forEach(clearTimeout); // eslint-disable-line react-hooks/exhaustive-deps
|
|
234
185
|
|
|
235
|
-
|
|
186
|
+
for (var _toastId3 in toastIdToTimerMap.current) {
|
|
187
|
+
if (toastIdToTimerMap.current.hasOwnProperty(_toastId3)) {
|
|
188
|
+
var timer = toastIdToTimerMap.current[_toastId3]; // eslint-disable-line react-hooks/exhaustive-deps
|
|
236
189
|
|
|
237
|
-
for (var _toastId3 in this.toastIdToTimerMap) {
|
|
238
|
-
if (this.toastIdToTimerMap.hasOwnProperty(_toastId3)) {
|
|
239
|
-
var timer = this.toastIdToTimerMap[_toastId3];
|
|
240
190
|
timer.clear();
|
|
241
191
|
}
|
|
242
192
|
}
|
|
193
|
+
};
|
|
194
|
+
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
195
|
+
// componentDidUpdate
|
|
196
|
+
|
|
197
|
+
useEffect(function () {
|
|
198
|
+
scheduleAllToastsForDismissal();
|
|
199
|
+
|
|
200
|
+
if (!isUserInteracting.current) {
|
|
201
|
+
// If the user has scrolled up the toast list then we don't want to annoy them by scrolling
|
|
202
|
+
// all the way back to the bottom.
|
|
203
|
+
if (isScrolledToBottom.current) {
|
|
204
|
+
if (prevToasts.current.length < toasts.length) {
|
|
205
|
+
startScrollingToBottom();
|
|
206
|
+
}
|
|
207
|
+
}
|
|
243
208
|
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
isDismissed: _this3.state.toastIdToDismissedMap[toast.id]
|
|
265
|
-
}, ___EmotionJSX(EuiToast, _extends({
|
|
266
|
-
onClose: _this3.dismissToast.bind(_this3, toast),
|
|
267
|
-
onFocus: _this3.onMouseEnter,
|
|
268
|
-
onBlur: _this3.onMouseLeave
|
|
269
|
-
}, rest), text));
|
|
209
|
+
|
|
210
|
+
prevToasts.current = toasts;
|
|
211
|
+
}, [toasts, scheduleAllToastsForDismissal]); // Toast dismissal side effect
|
|
212
|
+
// Ensure the callback has correct state by not enclosing it in `setTimeout`
|
|
213
|
+
|
|
214
|
+
useEffect(function () {
|
|
215
|
+
var toast = toastToDismiss; // Because this is triggered by a setTimeout, and because React does not guarantee when
|
|
216
|
+
// state updates happen, it is possible to double-dismiss a toast
|
|
217
|
+
// including by double-clicking the "x" button on the toast
|
|
218
|
+
// so, first check to make sure we haven't already dismissed this toast
|
|
219
|
+
|
|
220
|
+
if (toast && toastIdToTimerMap.current.hasOwnProperty(toast.id)) {
|
|
221
|
+
dismissToastProp(toast);
|
|
222
|
+
toastIdToTimerMap.current[toast.id].clear();
|
|
223
|
+
delete toastIdToTimerMap.current[toast.id];
|
|
224
|
+
setToastIdToDismissedMap(function (prev) {
|
|
225
|
+
var toastIdToDismissedMap = _objectSpread({}, prev);
|
|
226
|
+
|
|
227
|
+
delete toastIdToDismissedMap[toast.id];
|
|
228
|
+
return toastIdToDismissedMap;
|
|
270
229
|
});
|
|
271
|
-
var classes = classNames('euiGlobalToastList', side ? sideToClassNameMap[side] : null, className);
|
|
272
|
-
return ___EmotionJSX("div", _extends({
|
|
273
|
-
"aria-live": "polite",
|
|
274
|
-
role: "region",
|
|
275
|
-
ref: function ref(element) {
|
|
276
|
-
_this3.listElement = element;
|
|
277
|
-
},
|
|
278
|
-
className: classes
|
|
279
|
-
}, rest), renderedToasts);
|
|
280
230
|
}
|
|
281
|
-
}]);
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
}
|
|
231
|
+
}, [toastToDismiss, dismissToastProp]);
|
|
232
|
+
var renderedToasts = toasts.map(function (toast) {
|
|
233
|
+
var text = toast.text,
|
|
234
|
+
toastLifeTimeMs = toast.toastLifeTimeMs,
|
|
235
|
+
rest = _objectWithoutProperties(toast, _excluded2);
|
|
236
|
+
|
|
237
|
+
var onClose = function onClose() {
|
|
238
|
+
return dismissToast(toast);
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
return ___EmotionJSX(EuiGlobalToastListItem, {
|
|
242
|
+
key: toast.id,
|
|
243
|
+
isDismissed: toastIdToDismissedMap[toast.id]
|
|
244
|
+
}, ___EmotionJSX(EuiToast, _extends({
|
|
245
|
+
onClose: onClose,
|
|
246
|
+
onFocus: onMouseEnter,
|
|
247
|
+
onBlur: onMouseLeave
|
|
248
|
+
}, rest), text));
|
|
249
|
+
});
|
|
250
|
+
var classes = classNames('euiGlobalToastList', className);
|
|
251
|
+
return ___EmotionJSX("div", _extends({
|
|
252
|
+
"aria-live": "polite",
|
|
253
|
+
role: "region",
|
|
254
|
+
ref: listElement,
|
|
255
|
+
css: cssStyles,
|
|
256
|
+
className: classes
|
|
257
|
+
}, rest), renderedToasts);
|
|
258
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
|
|
3
|
+
var _templateObject;
|
|
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
|
+
};
|
|
@@ -11,20 +11,25 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
11
11
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
12
12
|
* Side Public License, v 1.
|
|
13
13
|
*/
|
|
14
|
-
import { cloneElement } from 'react';
|
|
15
14
|
import classNames from 'classnames';
|
|
15
|
+
import { useEuiTheme } from '../../services';
|
|
16
|
+
import { cloneElementWithCss } from '../../services/theme/clone_element';
|
|
17
|
+
import { euiGlobalToastListItemStyles } from './global_toast_list.styles';
|
|
16
18
|
export var EuiGlobalToastListItem = function EuiGlobalToastListItem(_ref) {
|
|
17
19
|
var children = _ref.children,
|
|
20
|
+
className = _ref.className,
|
|
18
21
|
isDismissed = _ref.isDismissed;
|
|
22
|
+
var euiTheme = useEuiTheme();
|
|
19
23
|
|
|
20
24
|
if (!children) {
|
|
21
25
|
return null;
|
|
22
26
|
}
|
|
23
27
|
|
|
24
|
-
var
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return
|
|
28
|
-
className: classes
|
|
28
|
+
var styles = euiGlobalToastListItemStyles(euiTheme);
|
|
29
|
+
var cssStyles = [styles.euiGlobalToastListItem, isDismissed && styles.dismissed];
|
|
30
|
+
var classes = classNames('euiGlobalToastListItem', children.props.className, className);
|
|
31
|
+
return cloneElementWithCss(children, _objectSpread(_objectSpread({}, children.props), {
|
|
32
|
+
className: classes,
|
|
33
|
+
css: cssStyles
|
|
29
34
|
}));
|
|
30
35
|
};
|