@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
|
@@ -11,21 +11,11 @@ exports.TOAST_FADE_OUT_MS = exports.SIDES = exports.EuiGlobalToastList = void 0;
|
|
|
11
11
|
|
|
12
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
13
|
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
17
|
-
|
|
18
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
19
|
-
|
|
20
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
21
|
-
|
|
22
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
23
|
-
|
|
24
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
14
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
15
|
|
|
26
|
-
var
|
|
16
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
27
17
|
|
|
28
|
-
var
|
|
18
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
29
19
|
|
|
30
20
|
var _react = _interopRequireWildcard(require("react"));
|
|
31
21
|
|
|
@@ -33,12 +23,16 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
33
23
|
|
|
34
24
|
var _common = require("../common");
|
|
35
25
|
|
|
26
|
+
var _services = require("../../services");
|
|
27
|
+
|
|
36
28
|
var _time = require("../../services/time");
|
|
37
29
|
|
|
38
30
|
var _global_toast_list_item = require("./global_toast_list_item");
|
|
39
31
|
|
|
40
32
|
var _toast = require("./toast");
|
|
41
33
|
|
|
34
|
+
var _global_toast_list = require("./global_toast_list.styles");
|
|
35
|
+
|
|
42
36
|
var _react2 = require("@emotion/react");
|
|
43
37
|
|
|
44
38
|
var _excluded = ["className", "toasts", "dismissToast", "toastLifeTimeMs", "side"],
|
|
@@ -52,10 +46,6 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
52
46
|
|
|
53
47
|
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) { (0, _defineProperty2.default)(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; }
|
|
54
48
|
|
|
55
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
56
|
-
|
|
57
|
-
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; } }
|
|
58
|
-
|
|
59
49
|
var sideToClassNameMap = {
|
|
60
50
|
left: 'euiGlobalToastList--left',
|
|
61
51
|
right: 'euiGlobalToastList--right'
|
|
@@ -65,234 +55,230 @@ exports.SIDES = SIDES;
|
|
|
65
55
|
var TOAST_FADE_OUT_MS = 250;
|
|
66
56
|
exports.TOAST_FADE_OUT_MS = TOAST_FADE_OUT_MS;
|
|
67
57
|
|
|
68
|
-
var EuiGlobalToastList =
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
if (_this.toastIdToTimerMap.hasOwnProperty(_toastId2)) {
|
|
112
|
-
var timer = _this.toastIdToTimerMap[_toastId2];
|
|
113
|
-
timer.resume();
|
|
114
|
-
}
|
|
58
|
+
var EuiGlobalToastList = function EuiGlobalToastList(_ref) {
|
|
59
|
+
var className = _ref.className,
|
|
60
|
+
_ref$toasts = _ref.toasts,
|
|
61
|
+
toasts = _ref$toasts === void 0 ? [] : _ref$toasts,
|
|
62
|
+
dismissToastProp = _ref.dismissToast,
|
|
63
|
+
toastLifeTimeMs = _ref.toastLifeTimeMs,
|
|
64
|
+
_ref$side = _ref.side,
|
|
65
|
+
side = _ref$side === void 0 ? 'right' : _ref$side,
|
|
66
|
+
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
67
|
+
|
|
68
|
+
var _useState = (0, _react.useState)({}),
|
|
69
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
70
|
+
toastIdToDismissedMap = _useState2[0],
|
|
71
|
+
setToastIdToDismissedMap = _useState2[1];
|
|
72
|
+
|
|
73
|
+
var _useState3 = (0, _react.useState)(),
|
|
74
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
75
|
+
toastToDismiss = _useState4[0],
|
|
76
|
+
setToastToDismiss = _useState4[1];
|
|
77
|
+
|
|
78
|
+
var prevToasts = (0, _react.useRef)([]);
|
|
79
|
+
var dismissTimeoutIds = (0, _react.useRef)([]);
|
|
80
|
+
var toastIdToTimerMap = (0, _react.useRef)({});
|
|
81
|
+
var isScrollingToBottom = (0, _react.useRef)(false);
|
|
82
|
+
var isScrolledToBottom = (0, _react.useRef)(true);
|
|
83
|
+
var isUserInteracting = (0, _react.useRef)(false); // See [Return Value](https://developer.mozilla.org/en-US/docs/Web/API/Window/requestAnimationFrame#Return_value)
|
|
84
|
+
// for information on initial value of 0
|
|
85
|
+
|
|
86
|
+
var isScrollingAnimationFrame = (0, _react.useRef)(0);
|
|
87
|
+
var startScrollingAnimationFrame = (0, _react.useRef)(0);
|
|
88
|
+
var listElement = (0, _react.useRef)(null);
|
|
89
|
+
var euiTheme = (0, _services.useEuiTheme)();
|
|
90
|
+
var styles = (0, _global_toast_list.euiGlobalToastListStyles)(euiTheme);
|
|
91
|
+
var cssStyles = [styles.euiGlobalToastList, styles[side]];
|
|
92
|
+
|
|
93
|
+
var startScrollingToBottom = function startScrollingToBottom() {
|
|
94
|
+
isScrollingToBottom.current = true;
|
|
95
|
+
|
|
96
|
+
var scrollToBottom = function scrollToBottom() {
|
|
97
|
+
// Although we cancel the requestAnimationFrame in componentWillUnmount,
|
|
98
|
+
// it's possible for this.listElement to become null in the meantime
|
|
99
|
+
if (!listElement.current) {
|
|
100
|
+
return;
|
|
115
101
|
}
|
|
116
|
-
});
|
|
117
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onScroll", function () {
|
|
118
|
-
if (_this.listElement) {
|
|
119
|
-
_this.isScrolledToBottom = _this.listElement.scrollHeight - _this.listElement.scrollTop === _this.listElement.clientHeight;
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "scheduleAllToastsForDismissal", function () {
|
|
123
|
-
_this.props.toasts.forEach(function (toast) {
|
|
124
|
-
if (!_this.toastIdToTimerMap[toast.id]) {
|
|
125
|
-
_this.scheduleToastForDismissal(toast);
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "scheduleToastForDismissal", function (toast) {
|
|
130
|
-
// Start fading the toast out once its lifetime elapses.
|
|
131
|
-
_this.toastIdToTimerMap[toast.id] = new _time.Timer(_this.dismissToast.bind((0, _assertThisInitialized2.default)(_this), toast), toast.toastLifeTimeMs != null ? toast.toastLifeTimeMs : _this.props.toastLifeTimeMs);
|
|
132
|
-
});
|
|
133
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "dismissToast", function (toast) {
|
|
134
|
-
// Remove the toast after it's done fading out.
|
|
135
|
-
_this.dismissTimeoutIds.push(window.setTimeout(function () {
|
|
136
|
-
// Because this is wrapped in a setTimeout, and because React does not guarantee when
|
|
137
|
-
// state updates happen, it is possible to double-dismiss a toast
|
|
138
|
-
// including by double-clicking the "x" button on the toast
|
|
139
|
-
// so, first check to make sure we haven't already dismissed this toast
|
|
140
|
-
if (_this.toastIdToTimerMap.hasOwnProperty(toast.id)) {
|
|
141
|
-
_this.props.dismissToast.apply((0, _assertThisInitialized2.default)(_this), [toast]);
|
|
142
|
-
|
|
143
|
-
_this.toastIdToTimerMap[toast.id].clear();
|
|
144
|
-
|
|
145
|
-
delete _this.toastIdToTimerMap[toast.id];
|
|
146
|
-
|
|
147
|
-
_this.setState(function (prevState) {
|
|
148
|
-
var toastIdToDismissedMap = _objectSpread({}, prevState.toastIdToDismissedMap);
|
|
149
|
-
|
|
150
|
-
delete toastIdToDismissedMap[toast.id];
|
|
151
|
-
return {
|
|
152
|
-
toastIdToDismissedMap: toastIdToDismissedMap
|
|
153
|
-
};
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
}, TOAST_FADE_OUT_MS));
|
|
157
102
|
|
|
158
|
-
|
|
159
|
-
|
|
103
|
+
var position = listElement.current.scrollTop;
|
|
104
|
+
var destination = listElement.current.scrollHeight - listElement.current.clientHeight;
|
|
105
|
+
var distanceToDestination = destination - position;
|
|
160
106
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
107
|
+
if (distanceToDestination < 5) {
|
|
108
|
+
listElement.current.scrollTop = destination;
|
|
109
|
+
isScrollingToBottom.current = false;
|
|
110
|
+
isScrolledToBottom.current = true;
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
168
113
|
|
|
169
|
-
|
|
170
|
-
key: "startScrollingToBottom",
|
|
171
|
-
value: function startScrollingToBottom() {
|
|
172
|
-
var _this2 = this;
|
|
114
|
+
listElement.current.scrollTop = position + distanceToDestination * 0.25;
|
|
173
115
|
|
|
174
|
-
|
|
116
|
+
if (isScrollingToBottom) {
|
|
117
|
+
isScrollingAnimationFrame.current = window.requestAnimationFrame(scrollToBottom);
|
|
118
|
+
}
|
|
119
|
+
};
|
|
175
120
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
// it's possible for this.listElement to become null in the meantime
|
|
179
|
-
if (!_this2.listElement) {
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
121
|
+
startScrollingAnimationFrame.current = window.requestAnimationFrame(scrollToBottom);
|
|
122
|
+
};
|
|
182
123
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
124
|
+
var onMouseEnter = function onMouseEnter() {
|
|
125
|
+
// Stop scrolling to bottom if we're in mid-scroll, because the user wants to interact with
|
|
126
|
+
// the list.
|
|
127
|
+
isScrollingToBottom.current = false;
|
|
128
|
+
isUserInteracting.current = true; // Don't let toasts dismiss themselves while the user is interacting with them.
|
|
186
129
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
130
|
+
for (var _toastId in toastIdToTimerMap.current) {
|
|
131
|
+
if (toastIdToTimerMap.current.hasOwnProperty(_toastId)) {
|
|
132
|
+
var timer = toastIdToTimerMap.current[_toastId];
|
|
133
|
+
timer.pause();
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
};
|
|
193
137
|
|
|
194
|
-
|
|
138
|
+
var onMouseLeave = function onMouseLeave() {
|
|
139
|
+
isUserInteracting.current = false;
|
|
195
140
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
141
|
+
for (var _toastId2 in toastIdToTimerMap.current) {
|
|
142
|
+
if (toastIdToTimerMap.current.hasOwnProperty(_toastId2)) {
|
|
143
|
+
var timer = toastIdToTimerMap.current[_toastId2];
|
|
144
|
+
timer.resume();
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
};
|
|
200
148
|
|
|
201
|
-
|
|
149
|
+
var onScroll = function onScroll() {
|
|
150
|
+
if (listElement.current) {
|
|
151
|
+
isScrolledToBottom.current = listElement.current.scrollHeight - listElement.current.scrollTop === listElement.current.clientHeight;
|
|
202
152
|
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
var dismissToast = (0, _react.useCallback)(function (toast) {
|
|
156
|
+
// Remove the toast after it's done fading out.
|
|
157
|
+
dismissTimeoutIds.current.push(window.setTimeout(function () {
|
|
158
|
+
setToastToDismiss(toast);
|
|
159
|
+
}, TOAST_FADE_OUT_MS));
|
|
160
|
+
setToastIdToDismissedMap(function (prev) {
|
|
161
|
+
return _objectSpread(_objectSpread({}, prev), {}, (0, _defineProperty2.default)({}, toast.id, true));
|
|
162
|
+
});
|
|
163
|
+
}, []);
|
|
164
|
+
var scheduleToastForDismissal = (0, _react.useCallback)(function (toast) {
|
|
165
|
+
// Start fading the toast out once its lifetime elapses.
|
|
166
|
+
toastIdToTimerMap.current[toast.id] = new _time.Timer(function () {
|
|
167
|
+
return dismissToast(toast);
|
|
168
|
+
}, toast.toastLifeTimeMs != null ? toast.toastLifeTimeMs : toastLifeTimeMs);
|
|
169
|
+
}, [dismissToast, toastLifeTimeMs]);
|
|
170
|
+
var scheduleAllToastsForDismissal = (0, _react.useCallback)(function () {
|
|
171
|
+
toasts.forEach(function (toast) {
|
|
172
|
+
if (!toastIdToTimerMap.current[toast.id]) {
|
|
173
|
+
scheduleToastForDismissal(toast);
|
|
210
174
|
}
|
|
175
|
+
});
|
|
176
|
+
}, [scheduleToastForDismissal, toasts]);
|
|
211
177
|
|
|
212
|
-
|
|
178
|
+
var addListeners = function addListeners() {
|
|
179
|
+
if (listElement.current) {
|
|
180
|
+
listElement.current.addEventListener('scroll', onScroll);
|
|
181
|
+
listElement.current.addEventListener('mouseenter', onMouseEnter);
|
|
182
|
+
listElement.current.addEventListener('mouseleave', onMouseLeave);
|
|
213
183
|
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
// all the way back to the bottom.
|
|
222
|
-
if (this.isScrolledToBottom) {
|
|
223
|
-
if (prevProps.toasts.length < this.props.toasts.length) {
|
|
224
|
-
this.startScrollingToBottom();
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
}
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
var removeListeners = function removeListeners() {
|
|
187
|
+
if (listElement.current) {
|
|
188
|
+
listElement.current.removeEventListener('scroll', onScroll);
|
|
189
|
+
listElement.current.removeEventListener('mouseenter', onMouseEnter);
|
|
190
|
+
listElement.current.removeEventListener('mouseleave', onMouseLeave);
|
|
228
191
|
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
value: function componentWillUnmount() {
|
|
232
|
-
if (this.isScrollingAnimationFrame !== 0) {
|
|
233
|
-
window.cancelAnimationFrame(this.isScrollingAnimationFrame);
|
|
234
|
-
}
|
|
192
|
+
}; // componentDidMount
|
|
193
|
+
|
|
235
194
|
|
|
236
|
-
|
|
237
|
-
|
|
195
|
+
(0, _react.useEffect)(function () {
|
|
196
|
+
addListeners(); // componentWillUnmount
|
|
197
|
+
|
|
198
|
+
return function () {
|
|
199
|
+
if (isScrollingAnimationFrame.current !== 0) {
|
|
200
|
+
window.cancelAnimationFrame(isScrollingAnimationFrame.current);
|
|
238
201
|
}
|
|
239
202
|
|
|
240
|
-
if (
|
|
241
|
-
|
|
242
|
-
this.listElement.removeEventListener('mouseenter', this.onMouseEnter);
|
|
243
|
-
this.listElement.removeEventListener('mouseleave', this.onMouseLeave);
|
|
203
|
+
if (startScrollingAnimationFrame.current !== 0) {
|
|
204
|
+
window.cancelAnimationFrame(startScrollingAnimationFrame.current);
|
|
244
205
|
}
|
|
245
206
|
|
|
246
|
-
|
|
207
|
+
removeListeners();
|
|
208
|
+
dismissTimeoutIds.current.forEach(clearTimeout); // eslint-disable-line react-hooks/exhaustive-deps
|
|
209
|
+
|
|
210
|
+
for (var _toastId3 in toastIdToTimerMap.current) {
|
|
211
|
+
if (toastIdToTimerMap.current.hasOwnProperty(_toastId3)) {
|
|
212
|
+
var timer = toastIdToTimerMap.current[_toastId3]; // eslint-disable-line react-hooks/exhaustive-deps
|
|
247
213
|
|
|
248
|
-
for (var _toastId3 in this.toastIdToTimerMap) {
|
|
249
|
-
if (this.toastIdToTimerMap.hasOwnProperty(_toastId3)) {
|
|
250
|
-
var timer = this.toastIdToTimerMap[_toastId3];
|
|
251
214
|
timer.clear();
|
|
252
215
|
}
|
|
253
216
|
}
|
|
217
|
+
};
|
|
218
|
+
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
219
|
+
// componentDidUpdate
|
|
220
|
+
|
|
221
|
+
(0, _react.useEffect)(function () {
|
|
222
|
+
scheduleAllToastsForDismissal();
|
|
223
|
+
|
|
224
|
+
if (!isUserInteracting.current) {
|
|
225
|
+
// If the user has scrolled up the toast list then we don't want to annoy them by scrolling
|
|
226
|
+
// all the way back to the bottom.
|
|
227
|
+
if (isScrolledToBottom.current) {
|
|
228
|
+
if (prevToasts.current.length < toasts.length) {
|
|
229
|
+
startScrollingToBottom();
|
|
230
|
+
}
|
|
231
|
+
}
|
|
254
232
|
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
onClose: _this3.dismissToast.bind(_this3, toast),
|
|
276
|
-
onFocus: _this3.onMouseEnter,
|
|
277
|
-
onBlur: _this3.onMouseLeave
|
|
278
|
-
}, rest), text));
|
|
233
|
+
|
|
234
|
+
prevToasts.current = toasts;
|
|
235
|
+
}, [toasts, scheduleAllToastsForDismissal]); // Toast dismissal side effect
|
|
236
|
+
// Ensure the callback has correct state by not enclosing it in `setTimeout`
|
|
237
|
+
|
|
238
|
+
(0, _react.useEffect)(function () {
|
|
239
|
+
var toast = toastToDismiss; // Because this is triggered by a setTimeout, and because React does not guarantee when
|
|
240
|
+
// state updates happen, it is possible to double-dismiss a toast
|
|
241
|
+
// including by double-clicking the "x" button on the toast
|
|
242
|
+
// so, first check to make sure we haven't already dismissed this toast
|
|
243
|
+
|
|
244
|
+
if (toast && toastIdToTimerMap.current.hasOwnProperty(toast.id)) {
|
|
245
|
+
dismissToastProp(toast);
|
|
246
|
+
toastIdToTimerMap.current[toast.id].clear();
|
|
247
|
+
delete toastIdToTimerMap.current[toast.id];
|
|
248
|
+
setToastIdToDismissedMap(function (prev) {
|
|
249
|
+
var toastIdToDismissedMap = _objectSpread({}, prev);
|
|
250
|
+
|
|
251
|
+
delete toastIdToDismissedMap[toast.id];
|
|
252
|
+
return toastIdToDismissedMap;
|
|
279
253
|
});
|
|
280
|
-
var classes = (0, _classnames.default)('euiGlobalToastList', side ? sideToClassNameMap[side] : null, className);
|
|
281
|
-
return (0, _react2.jsx)("div", (0, _extends2.default)({
|
|
282
|
-
"aria-live": "polite",
|
|
283
|
-
role: "region",
|
|
284
|
-
ref: function ref(element) {
|
|
285
|
-
_this3.listElement = element;
|
|
286
|
-
},
|
|
287
|
-
className: classes
|
|
288
|
-
}, rest), renderedToasts);
|
|
289
254
|
}
|
|
290
|
-
}]);
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
}
|
|
255
|
+
}, [toastToDismiss, dismissToastProp]);
|
|
256
|
+
var renderedToasts = toasts.map(function (toast) {
|
|
257
|
+
var text = toast.text,
|
|
258
|
+
toastLifeTimeMs = toast.toastLifeTimeMs,
|
|
259
|
+
rest = (0, _objectWithoutProperties2.default)(toast, _excluded2);
|
|
260
|
+
|
|
261
|
+
var onClose = function onClose() {
|
|
262
|
+
return dismissToast(toast);
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
return (0, _react2.jsx)(_global_toast_list_item.EuiGlobalToastListItem, {
|
|
266
|
+
key: toast.id,
|
|
267
|
+
isDismissed: toastIdToDismissedMap[toast.id]
|
|
268
|
+
}, (0, _react2.jsx)(_toast.EuiToast, (0, _extends2.default)({
|
|
269
|
+
onClose: onClose,
|
|
270
|
+
onFocus: onMouseEnter,
|
|
271
|
+
onBlur: onMouseLeave
|
|
272
|
+
}, rest), text));
|
|
273
|
+
});
|
|
274
|
+
var classes = (0, _classnames.default)('euiGlobalToastList', className);
|
|
275
|
+
return (0, _react2.jsx)("div", (0, _extends2.default)({
|
|
276
|
+
"aria-live": "polite",
|
|
277
|
+
role: "region",
|
|
278
|
+
ref: listElement,
|
|
279
|
+
css: cssStyles,
|
|
280
|
+
className: classes
|
|
281
|
+
}, rest), renderedToasts);
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
exports.EuiGlobalToastList = EuiGlobalToastList;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.euiGlobalToastListStyles = exports.euiGlobalToastListItemStyles = void 0;
|
|
9
|
+
|
|
10
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
11
|
+
|
|
12
|
+
var _react = require("@emotion/react");
|
|
13
|
+
|
|
14
|
+
var _global_styling = require("../../global_styling");
|
|
15
|
+
|
|
16
|
+
var _templateObject;
|
|
17
|
+
|
|
18
|
+
var euiGlobalToastListStyles = function euiGlobalToastListStyles(euiThemeContext) {
|
|
19
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
20
|
+
var euiToastWidth = euiTheme.base * 20;
|
|
21
|
+
return {
|
|
22
|
+
/**
|
|
23
|
+
* 1. Allow list to expand as items are added, but cap it at the screen height.
|
|
24
|
+
* 2. Allow some padding for shadow
|
|
25
|
+
*/
|
|
26
|
+
// Base
|
|
27
|
+
euiGlobalToastList: /*#__PURE__*/(0, _react.css)((0, _global_styling.euiScrollBarStyles)(euiThemeContext), " display:flex;flex-direction:column;align-items:stretch;position:fixed;z-index:", euiTheme.levels.toast, ";", (0, _global_styling.logicalCSS)('bottom', 0), ";", (0, _global_styling.logicalCSS)('width', "".concat(euiToastWidth + euiTheme.base * 5, "px")), ";", (0, _global_styling.logicalCSS)('max-height', '100vh'), ";overflow-y:auto;", (0, _global_styling.logicalCSS)('overflow-y', 'auto'), ";scrollbar-width:none;&::-webkit-scrollbar{", (0, _global_styling.logicalSizeCSS)(0, 0), ";}&:not(:empty){", (0, _global_styling.logicalCSS)('padding-left', euiTheme.size.base), ";", (0, _global_styling.logicalCSS)('padding-right', euiTheme.size.base), ";", (0, _global_styling.logicalCSS)('padding-vertical', euiTheme.size.base), ";}", (0, _global_styling.euiBreakpoint)(euiThemeContext, ['xs', 's']), "{&:not(:empty){", (0, _global_styling.logicalCSS)('left', 0), ";", (0, _global_styling.logicalCSS)('width', '100%'), ";}};label:euiGlobalToastList;"),
|
|
28
|
+
// Variants
|
|
29
|
+
right: /*#__PURE__*/(0, _react.css)("&:not(:empty){", (0, _global_styling.logicalCSS)('right', 0), ";", (0, _global_styling.logicalCSS)('padding-left', "".concat(euiTheme.base * 4, "px")), ";}", (0, _global_styling.euiBreakpoint)(euiThemeContext, ['xs', 's']), "{&:not(:empty){", (0, _global_styling.logicalCSS)('padding-left', euiTheme.size.base), ";}};label:right;"),
|
|
30
|
+
left: /*#__PURE__*/(0, _react.css)("&:not(:empty){", (0, _global_styling.logicalCSS)('left', 0), ";", (0, _global_styling.logicalCSS)('padding-right', "".concat(euiTheme.base * 4, "px")), ";}", (0, _global_styling.euiBreakpoint)(euiThemeContext, ['xs', 's']), "{&:not(:empty){", (0, _global_styling.logicalCSS)('padding-right', euiTheme.size.base), ";}};label:left;")
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
exports.euiGlobalToastListStyles = euiGlobalToastListStyles;
|
|
35
|
+
|
|
36
|
+
var euiGlobalToastListItemStyles = function euiGlobalToastListItemStyles(_ref) {
|
|
37
|
+
var euiTheme = _ref.euiTheme;
|
|
38
|
+
var euiShowToast = (0, _react.keyframes)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\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);
|
|
39
|
+
return {
|
|
40
|
+
// Base
|
|
41
|
+
euiGlobalToastListItem: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('margin-bottom', euiTheme.size.base), ";animation:", euiTheme.animation.normal, " ", euiShowToast, " ", euiTheme.animation.resistance, ";opacity:1;&:first-child{", (0, _global_styling.logicalCSS)('margin-top', 'auto'), ";}&:last-child{", (0, _global_styling.logicalCSS)('margin-bottom', 0), ";};label:euiGlobalToastListItem;"),
|
|
42
|
+
// States
|
|
43
|
+
dismissed: /*#__PURE__*/(0, _react.css)("transition:opacity ", euiTheme.animation.normal, ";opacity:0;;label:dismissed;")
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
exports.euiGlobalToastListItemStyles = euiGlobalToastListItemStyles;
|
|
@@ -9,27 +9,34 @@ exports.EuiGlobalToastListItem = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
|
|
12
|
-
var _react = require("react");
|
|
13
|
-
|
|
14
12
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
13
|
|
|
14
|
+
var _services = require("../../services");
|
|
15
|
+
|
|
16
|
+
var _clone_element = require("../../services/theme/clone_element");
|
|
17
|
+
|
|
18
|
+
var _global_toast_list = require("./global_toast_list.styles");
|
|
19
|
+
|
|
16
20
|
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; }
|
|
17
21
|
|
|
18
22
|
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) { (0, _defineProperty2.default)(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; }
|
|
19
23
|
|
|
20
24
|
var EuiGlobalToastListItem = function EuiGlobalToastListItem(_ref) {
|
|
21
25
|
var children = _ref.children,
|
|
26
|
+
className = _ref.className,
|
|
22
27
|
isDismissed = _ref.isDismissed;
|
|
28
|
+
var euiTheme = (0, _services.useEuiTheme)();
|
|
23
29
|
|
|
24
30
|
if (!children) {
|
|
25
31
|
return null;
|
|
26
32
|
}
|
|
27
33
|
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return
|
|
32
|
-
className: classes
|
|
34
|
+
var styles = (0, _global_toast_list.euiGlobalToastListItemStyles)(euiTheme);
|
|
35
|
+
var cssStyles = [styles.euiGlobalToastListItem, isDismissed && styles.dismissed];
|
|
36
|
+
var classes = (0, _classnames.default)('euiGlobalToastListItem', children.props.className, className);
|
|
37
|
+
return (0, _clone_element.cloneElementWithCss)(children, _objectSpread(_objectSpread({}, children.props), {
|
|
38
|
+
className: classes,
|
|
39
|
+
css: cssStyles
|
|
33
40
|
}));
|
|
34
41
|
};
|
|
35
42
|
|