@elastic/eui 116.3.0 → 116.3.1-snapshot.1782218964187
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/es/components/avatar/avatar.js +4 -0
- package/es/components/avatar/avatar.styles.js +16 -16
- package/es/components/banner/banner.js +1 -2
- package/es/components/banner/banner.styles.js +1 -1
- package/es/components/basic_table/basic_table.js +35 -5
- package/es/components/basic_table/basic_table.styles.js +19 -1
- package/es/components/basic_table/in_memory_table.js +17 -0
- package/es/components/basic_table/index.js +2 -1
- package/es/components/basic_table/pagination_bar.js +19 -4
- package/es/components/basic_table/pagination_bar.styles.js +21 -0
- package/es/components/basic_table/panel.styles.js +14 -0
- package/es/components/basic_table/use_panel_props.js +28 -0
- package/es/components/date_picker/auto_refresh/refresh_interval.js +176 -229
- package/es/components/flyout/flyout.component.js +10 -6
- package/es/components/flyout/flyout_menu.js +122 -19
- package/es/components/flyout/flyout_menu.styles.js +2 -1
- package/es/components/flyout/manager/actions.js +20 -0
- package/es/components/flyout/manager/flyout_child.js +23 -1
- package/es/components/flyout/manager/flyout_managed.js +65 -19
- package/es/components/flyout/manager/hooks.js +1 -1
- package/es/components/flyout/manager/index.js +2 -2
- package/es/components/flyout/manager/reducer.js +32 -8
- package/es/components/flyout/manager/selectors.js +8 -2
- package/es/components/flyout/manager/store.js +35 -2
- package/es/components/flyout/use_flyout_menu.js +2 -2
- package/es/components/form/form_control_layout/form_control_layout_icons.js +95 -143
- package/es/components/notification_icon/assets/info_fill.js +34 -0
- package/es/components/notification_icon/assets/warning_static.js +40 -0
- package/es/components/notification_icon/notification_icon.js +87 -0
- package/es/components/notification_icon/notification_icon.styles.js +22 -0
- package/es/components/table/mobile/table_sort_mobile.js +64 -103
- package/es/components/table/store/use_unique_column_id.js +25 -0
- package/es/components/table/table_header_cell.js +7 -8
- package/es/components/table/table_header_cell_checkbox.js +5 -6
- package/es/components/toast/global_toast_list.js +132 -6
- package/es/components/toast/global_toast_list.styles.js +31 -7
- package/es/components/toast/toast.js +242 -47
- package/es/components/toast/toast.styles.js +35 -47
- package/es/components/toast/toast_action.js +34 -0
- package/es/components/toast/types.js +9 -0
- package/es/components/tool_tip/tool_tip.js +61 -30
- package/es/components/tool_tip/tool_tip_anchor.js +5 -5
- package/es/components/tool_tip/tool_tip_manager.js +27 -2
- package/eui.d.ts +811 -552
- package/i18ntokens.json +981 -927
- package/lib/components/avatar/avatar.js +4 -0
- package/lib/components/avatar/avatar.styles.js +16 -16
- package/lib/components/banner/banner.js +1 -2
- package/lib/components/banner/banner.styles.js +1 -1
- package/lib/components/basic_table/basic_table.js +34 -4
- package/lib/components/basic_table/basic_table.styles.js +19 -1
- package/lib/components/basic_table/in_memory_table.js +17 -0
- package/lib/components/basic_table/index.js +8 -1
- package/lib/components/basic_table/pagination_bar.js +19 -4
- package/lib/components/basic_table/pagination_bar.styles.js +26 -0
- package/lib/components/basic_table/panel.styles.js +20 -0
- package/lib/components/basic_table/use_panel_props.js +33 -0
- package/lib/components/date_picker/auto_refresh/refresh_interval.js +175 -229
- package/lib/components/flyout/flyout.component.js +10 -6
- package/lib/components/flyout/flyout_menu.js +120 -19
- package/lib/components/flyout/flyout_menu.styles.js +2 -1
- package/lib/components/flyout/manager/actions.js +21 -1
- package/lib/components/flyout/manager/flyout_child.js +23 -1
- package/lib/components/flyout/manager/flyout_managed.js +41 -17
- package/lib/components/flyout/manager/hooks.js +6 -0
- package/lib/components/flyout/manager/index.js +12 -0
- package/lib/components/flyout/manager/reducer.js +31 -7
- package/lib/components/flyout/manager/selectors.js +9 -3
- package/lib/components/flyout/manager/store.js +34 -1
- package/lib/components/flyout/use_flyout_menu.js +2 -2
- package/lib/components/form/form_control_layout/form_control_layout_icons.js +95 -145
- package/lib/components/notification_icon/assets/info_fill.js +41 -0
- package/lib/components/notification_icon/assets/warning_static.js +47 -0
- package/lib/components/notification_icon/notification_icon.js +93 -0
- package/lib/components/notification_icon/notification_icon.styles.js +28 -0
- package/lib/components/notification_icon/svgs/info_fill.svg +3 -0
- package/lib/components/notification_icon/svgs/warning_static.svg +5 -0
- package/lib/components/table/mobile/table_sort_mobile.js +71 -108
- package/lib/components/table/store/use_unique_column_id.js +34 -0
- package/lib/components/table/table_header_cell.js +7 -8
- package/lib/components/table/table_header_cell_checkbox.js +5 -6
- package/lib/components/toast/global_toast_list.js +132 -6
- package/lib/components/toast/global_toast_list.styles.js +31 -8
- package/lib/components/toast/toast.js +244 -47
- package/lib/components/toast/toast.styles.js +32 -45
- package/lib/components/toast/toast_action.js +40 -0
- package/lib/components/toast/types.js +15 -0
- package/lib/components/tool_tip/tool_tip.js +59 -29
- package/lib/components/tool_tip/tool_tip_anchor.js +5 -5
- package/lib/components/tool_tip/tool_tip_manager.js +27 -2
- package/optimize/es/components/avatar/avatar.js +4 -0
- package/optimize/es/components/avatar/avatar.styles.js +16 -16
- package/optimize/es/components/banner/banner.js +1 -2
- package/optimize/es/components/banner/banner.styles.js +1 -1
- package/optimize/es/components/basic_table/basic_table.js +18 -5
- package/optimize/es/components/basic_table/basic_table.styles.js +19 -1
- package/optimize/es/components/basic_table/index.js +2 -1
- package/optimize/es/components/basic_table/pagination_bar.js +19 -4
- package/optimize/es/components/basic_table/pagination_bar.styles.js +21 -0
- package/optimize/es/components/basic_table/panel.styles.js +14 -0
- package/optimize/es/components/basic_table/use_panel_props.js +28 -0
- package/optimize/es/components/date_picker/auto_refresh/refresh_interval.js +172 -196
- package/optimize/es/components/flyout/flyout.component.js +10 -6
- package/optimize/es/components/flyout/flyout_menu.js +99 -18
- package/optimize/es/components/flyout/flyout_menu.styles.js +2 -1
- package/optimize/es/components/flyout/manager/actions.js +20 -0
- package/optimize/es/components/flyout/manager/flyout_managed.js +42 -18
- package/optimize/es/components/flyout/manager/hooks.js +1 -1
- package/optimize/es/components/flyout/manager/index.js +2 -2
- package/optimize/es/components/flyout/manager/reducer.js +32 -8
- package/optimize/es/components/flyout/manager/selectors.js +8 -2
- package/optimize/es/components/flyout/manager/store.js +35 -2
- package/optimize/es/components/flyout/use_flyout_menu.js +2 -2
- package/optimize/es/components/form/form_control_layout/form_control_layout_icons.js +96 -115
- package/optimize/es/components/notification_icon/assets/info_fill.js +33 -0
- package/optimize/es/components/notification_icon/assets/warning_static.js +39 -0
- package/optimize/es/components/notification_icon/notification_icon.js +77 -0
- package/optimize/es/components/notification_icon/notification_icon.styles.js +22 -0
- package/optimize/es/components/table/mobile/table_sort_mobile.js +59 -82
- package/optimize/es/components/table/store/use_unique_column_id.js +25 -0
- package/optimize/es/components/table/table_header_cell.js +7 -8
- package/optimize/es/components/table/table_header_cell_checkbox.js +5 -6
- package/optimize/es/components/toast/global_toast_list.js +31 -6
- package/optimize/es/components/toast/global_toast_list.styles.js +31 -7
- package/optimize/es/components/toast/toast.js +143 -47
- package/optimize/es/components/toast/toast.styles.js +35 -47
- package/optimize/es/components/toast/toast_action.js +33 -0
- package/optimize/es/components/toast/types.js +9 -0
- package/optimize/es/components/tool_tip/tool_tip.js +58 -30
- package/optimize/es/components/tool_tip/tool_tip_anchor.js +5 -5
- package/optimize/es/components/tool_tip/tool_tip_manager.js +27 -2
- package/optimize/lib/components/avatar/avatar.js +4 -0
- package/optimize/lib/components/avatar/avatar.styles.js +16 -16
- package/optimize/lib/components/banner/banner.js +1 -2
- package/optimize/lib/components/banner/banner.styles.js +1 -1
- package/optimize/lib/components/basic_table/basic_table.js +17 -4
- package/optimize/lib/components/basic_table/basic_table.styles.js +19 -1
- package/optimize/lib/components/basic_table/index.js +8 -1
- package/optimize/lib/components/basic_table/pagination_bar.js +19 -4
- package/optimize/lib/components/basic_table/pagination_bar.styles.js +26 -0
- package/optimize/lib/components/basic_table/panel.styles.js +20 -0
- package/optimize/lib/components/basic_table/use_panel_props.js +33 -0
- package/optimize/lib/components/date_picker/auto_refresh/refresh_interval.js +170 -194
- package/optimize/lib/components/flyout/flyout.component.js +10 -6
- package/optimize/lib/components/flyout/flyout_menu.js +98 -18
- package/optimize/lib/components/flyout/flyout_menu.styles.js +2 -1
- package/optimize/lib/components/flyout/manager/actions.js +21 -1
- package/optimize/lib/components/flyout/manager/flyout_managed.js +41 -17
- package/optimize/lib/components/flyout/manager/hooks.js +6 -0
- package/optimize/lib/components/flyout/manager/index.js +12 -0
- package/optimize/lib/components/flyout/manager/reducer.js +31 -7
- package/optimize/lib/components/flyout/manager/selectors.js +9 -3
- package/optimize/lib/components/flyout/manager/store.js +34 -1
- package/optimize/lib/components/flyout/use_flyout_menu.js +2 -2
- package/optimize/lib/components/form/form_control_layout/form_control_layout_icons.js +96 -117
- package/optimize/lib/components/notification_icon/assets/info_fill.js +41 -0
- package/optimize/lib/components/notification_icon/assets/warning_static.js +47 -0
- package/optimize/lib/components/notification_icon/notification_icon.js +83 -0
- package/optimize/lib/components/notification_icon/notification_icon.styles.js +28 -0
- package/optimize/lib/components/notification_icon/svgs/info_fill.svg +3 -0
- package/optimize/lib/components/notification_icon/svgs/warning_static.svg +5 -0
- package/optimize/lib/components/table/mobile/table_sort_mobile.js +61 -83
- package/optimize/lib/components/table/store/use_unique_column_id.js +34 -0
- package/optimize/lib/components/table/table_header_cell.js +7 -8
- package/optimize/lib/components/table/table_header_cell_checkbox.js +5 -6
- package/optimize/lib/components/toast/global_toast_list.js +31 -6
- package/optimize/lib/components/toast/global_toast_list.styles.js +30 -7
- package/optimize/lib/components/toast/toast.js +146 -47
- package/optimize/lib/components/toast/toast.styles.js +33 -45
- package/optimize/lib/components/toast/toast_action.js +39 -0
- package/optimize/lib/components/toast/types.js +15 -0
- package/optimize/lib/components/tool_tip/tool_tip.js +57 -29
- package/optimize/lib/components/tool_tip/tool_tip_anchor.js +5 -5
- package/optimize/lib/components/tool_tip/tool_tip_manager.js +27 -2
- package/package.json +9 -6
- package/test-env/components/avatar/avatar.js +4 -0
- package/test-env/components/avatar/avatar.styles.js +16 -16
- package/test-env/components/banner/banner.js +1 -2
- package/test-env/components/banner/banner.styles.js +1 -1
- package/test-env/components/basic_table/basic_table.js +34 -4
- package/test-env/components/basic_table/basic_table.styles.js +19 -1
- package/test-env/components/basic_table/in_memory_table.js +17 -0
- package/test-env/components/basic_table/index.js +8 -1
- package/test-env/components/basic_table/pagination_bar.js +19 -4
- package/test-env/components/basic_table/pagination_bar.styles.js +26 -0
- package/test-env/components/basic_table/panel.styles.js +20 -0
- package/test-env/components/basic_table/use_panel_props.js +33 -0
- package/test-env/components/date_picker/auto_refresh/refresh_interval.js +170 -220
- package/test-env/components/flyout/flyout.component.js +10 -6
- package/test-env/components/flyout/flyout_menu.js +121 -19
- package/test-env/components/flyout/flyout_menu.styles.js +2 -1
- package/test-env/components/flyout/manager/actions.js +21 -1
- package/test-env/components/flyout/manager/flyout_child.js +23 -1
- package/test-env/components/flyout/manager/flyout_managed.js +41 -17
- package/test-env/components/flyout/manager/hooks.js +6 -0
- package/test-env/components/flyout/manager/index.js +12 -0
- package/test-env/components/flyout/manager/reducer.js +31 -7
- package/test-env/components/flyout/manager/selectors.js +9 -3
- package/test-env/components/flyout/manager/store.js +34 -1
- package/test-env/components/flyout/use_flyout_menu.js +2 -2
- package/test-env/components/form/form_control_layout/form_control_layout_icons.js +95 -139
- package/test-env/components/notification_icon/assets/info_fill.js +41 -0
- package/test-env/components/notification_icon/assets/warning_static.js +47 -0
- package/test-env/components/notification_icon/notification_icon.js +46 -0
- package/test-env/components/notification_icon/notification_icon.styles.js +28 -0
- package/test-env/components/table/mobile/table_sort_mobile.js +61 -98
- package/test-env/components/table/store/use_unique_column_id.js +34 -0
- package/test-env/components/table/table_header_cell.js +7 -8
- package/test-env/components/table/table_header_cell_checkbox.js +5 -6
- package/test-env/components/toast/global_toast_list.js +132 -6
- package/test-env/components/toast/global_toast_list.styles.js +30 -7
- package/test-env/components/toast/toast.js +242 -47
- package/test-env/components/toast/toast.styles.js +33 -45
- package/test-env/components/toast/toast_action.js +39 -0
- package/test-env/components/toast/types.js +15 -0
- package/test-env/components/tool_tip/tool_tip.js +57 -29
- package/test-env/components/tool_tip/tool_tip_anchor.js +5 -5
- package/test-env/components/tool_tip/tool_tip_manager.js +27 -2
|
@@ -8,33 +8,56 @@ exports.euiGlobalToastListStyles = exports.euiGlobalToastListItemStyles = void 0
|
|
|
8
8
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
9
|
var _react = require("@emotion/react");
|
|
10
10
|
var _global_styling = require("../../global_styling");
|
|
11
|
-
var _templateObject;
|
|
12
|
-
/*
|
|
11
|
+
var _templateObject, _templateObject2;
|
|
12
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /*
|
|
13
13
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
14
14
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
15
15
|
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
16
16
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
17
17
|
* Side Public License, v 1.
|
|
18
18
|
*/
|
|
19
|
+
var _ref = process.env.NODE_ENV === "production" ? {
|
|
20
|
+
name: "ox3d1t-hasFadeOut",
|
|
21
|
+
styles: "opacity:0;label:hasFadeOut;"
|
|
22
|
+
} : {
|
|
23
|
+
name: "ox3d1t-hasFadeOut",
|
|
24
|
+
styles: "opacity:0;label:hasFadeOut;",
|
|
25
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
26
|
+
};
|
|
27
|
+
var _ref2 = process.env.NODE_ENV === "production" ? {
|
|
28
|
+
name: "19mjubd-content",
|
|
29
|
+
styles: "position:relative;label:content;"
|
|
30
|
+
} : {
|
|
31
|
+
name: "19mjubd-content",
|
|
32
|
+
styles: "position:relative;label:content;",
|
|
33
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
34
|
+
};
|
|
19
35
|
var euiGlobalToastListStyles = exports.euiGlobalToastListStyles = function euiGlobalToastListStyles(euiThemeContext) {
|
|
20
36
|
var euiTheme = euiThemeContext.euiTheme;
|
|
21
|
-
var euiToastWidth = euiTheme.base *
|
|
37
|
+
var euiToastWidth = euiTheme.base * 27.5; // 440px -> results in 360px toast width
|
|
38
|
+
|
|
39
|
+
var showNotificationBadge = (0, _react.keyframes)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n from { opacity: 0; }\n to { opacity: 1; }\n "])));
|
|
22
40
|
return {
|
|
23
41
|
/**
|
|
24
42
|
* 1. Allow list to expand as items are added, but cap it at the screen height.
|
|
25
43
|
* 2. Allow some padding for shadow
|
|
26
44
|
*/
|
|
27
45
|
// Base
|
|
28
|
-
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, "px")), (0, _global_styling.logicalCSS)('max-height', '100vh'), (0, _global_styling.logicalCSSWithFallback)('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.euiMaxBreakpoint)(euiThemeContext, 'm'), "{&:not(:empty){", (0, _global_styling.logicalCSS)('left', 0), " ", (0, _global_styling.logicalCSS)('width', '100%'), ";}};label:euiGlobalToastList;"),
|
|
46
|
+
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, "px")), (0, _global_styling.logicalCSS)('max-height', '100vh'), (0, _global_styling.logicalCSSWithFallback)('overflow-y', 'auto'), "scrollbar-width:none;&::-webkit-scrollbar{", (0, _global_styling.logicalSizeCSS)(0, 0), ";}&:hover .euiToastDecor::before,&:focus-within .euiToastDecor::before{animation-play-state:paused;}&: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.euiMaxBreakpoint)(euiThemeContext, 'm'), "{&:not(:empty){", (0, _global_styling.logicalCSS)('left', 0), " ", (0, _global_styling.logicalCSS)('width', '100%'), ";}};label:euiGlobalToastList;"),
|
|
47
|
+
content: _ref2,
|
|
48
|
+
notificationBadge: {
|
|
49
|
+
notificationBadge: /*#__PURE__*/(0, _react.css)("position:absolute;inset-block-start:-", euiTheme.size.s, ";inset-inline-start:-", euiTheme.size.s, ";z-index:", Number(euiTheme.levels.content) + 1, ";", _global_styling.euiCanAnimate, "{animation:", euiTheme.animation.normal, " ", showNotificationBadge, " ", euiTheme.animation.resistance, ";transition:opacity ", euiTheme.animation.fast, ";};label:notificationBadge;"),
|
|
50
|
+
hasFadeOut: _ref
|
|
51
|
+
},
|
|
29
52
|
// Variants
|
|
30
53
|
right: /*#__PURE__*/(0, _react.css)("&:not(:empty){", (0, _global_styling.logicalCSS)('right', 0), ";", (0, _global_styling.euiMinBreakpoint)(euiThemeContext, 'm'), "{", (0, _global_styling.logicalCSS)('padding-left', "".concat(euiTheme.base * 4, "px")), ";}};label:right;"),
|
|
31
54
|
left: /*#__PURE__*/(0, _react.css)("&:not(:empty){", (0, _global_styling.logicalCSS)('left', 0), ";", (0, _global_styling.euiMinBreakpoint)(euiThemeContext, 'm'), "{", (0, _global_styling.logicalCSS)('padding-right', "".concat(euiTheme.base * 4, "px")), ";}};label:left;"),
|
|
32
55
|
euiGlobalToastListDismissButton: /*#__PURE__*/(0, _react.css)("position:sticky;", (0, _global_styling.logicalCSS)('bottom', '0%'), ";;label:euiGlobalToastListDismissButton;")
|
|
33
56
|
};
|
|
34
57
|
};
|
|
35
|
-
var euiGlobalToastListItemStyles = exports.euiGlobalToastListItemStyles = function euiGlobalToastListItemStyles(
|
|
36
|
-
var euiTheme =
|
|
37
|
-
var euiShowToast = (0, _react.keyframes)(
|
|
58
|
+
var euiGlobalToastListItemStyles = exports.euiGlobalToastListItemStyles = function euiGlobalToastListItemStyles(_ref3) {
|
|
59
|
+
var euiTheme = _ref3.euiTheme;
|
|
60
|
+
var euiShowToast = (0, _react.keyframes)(_templateObject2 || (_templateObject2 = (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);
|
|
38
61
|
return {
|
|
39
62
|
// Base
|
|
40
63
|
euiGlobalToastListItem: /*#__PURE__*/(0, _react.css)("flex-shrink:0;", (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;"),
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
|
-
exports.EuiToast = exports.
|
|
8
|
+
exports.EuiToast = exports.COLOR_TO_NOTIFICATION_ICON_MAP = void 0;
|
|
8
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
11
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
|
-
var _react =
|
|
12
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
13
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
14
|
+
var _euiThemeCommon = require("@elastic/eui-theme-common");
|
|
12
15
|
var _services = require("../../services");
|
|
13
16
|
var _accessibility = require("../accessibility");
|
|
14
17
|
var _button = require("../button");
|
|
@@ -16,8 +19,12 @@ var _i18n = require("../i18n");
|
|
|
16
19
|
var _icon = require("../icon");
|
|
17
20
|
var _text = require("../text");
|
|
18
21
|
var _toast = require("./toast.styles");
|
|
22
|
+
var _notification_icon = require("../notification_icon/notification_icon");
|
|
23
|
+
var _notification_icon2 = require("../notification_icon/notification_icon.styles");
|
|
24
|
+
var _toast_action = require("./toast_action");
|
|
25
|
+
var _title = require("../title");
|
|
19
26
|
var _react2 = require("@emotion/react");
|
|
20
|
-
var _excluded = ["title", "
|
|
27
|
+
var _excluded = ["title", "text", "color", "iconType", "children", "className", "actionProps", "style", "onClose", "animationMs"];
|
|
21
28
|
/*
|
|
22
29
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
23
30
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -25,58 +32,150 @@ var _excluded = ["title", "color", "iconType", "onClose", "children", "className
|
|
|
25
32
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
26
33
|
* Side Public License, v 1.
|
|
27
34
|
*/
|
|
28
|
-
var
|
|
35
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
36
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
37
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
38
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
39
|
+
var COLOR_TO_NOTIFICATION_ICON_MAP = exports.COLOR_TO_NOTIFICATION_ICON_MAP = {
|
|
40
|
+
primary: 'info',
|
|
41
|
+
success: 'success',
|
|
42
|
+
warning: 'warning',
|
|
43
|
+
danger: 'error'
|
|
44
|
+
};
|
|
29
45
|
var EuiToast = exports.EuiToast = function EuiToast(_ref) {
|
|
30
46
|
var title = _ref.title,
|
|
31
|
-
|
|
47
|
+
text = _ref.text,
|
|
48
|
+
_ref$color = _ref.color,
|
|
49
|
+
color = _ref$color === void 0 ? 'primary' : _ref$color,
|
|
32
50
|
iconType = _ref.iconType,
|
|
33
|
-
onClose = _ref.onClose,
|
|
34
51
|
children = _ref.children,
|
|
35
52
|
className = _ref.className,
|
|
53
|
+
actionProps = _ref.actionProps,
|
|
54
|
+
style = _ref.style,
|
|
55
|
+
onClose = _ref.onClose,
|
|
56
|
+
animationMs = _ref.animationMs,
|
|
36
57
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
37
|
-
var
|
|
38
|
-
|
|
58
|
+
var _useEuiTheme = (0, _services.useEuiTheme)(),
|
|
59
|
+
euiTheme = _useEuiTheme.euiTheme;
|
|
60
|
+
var styles = (0, _services.useEuiMemoizedStyles)(_toast.euiToastStyles);
|
|
61
|
+
var iconStyles = (0, _services.useEuiMemoizedStyles)(_notification_icon2.euiNotificationIconStyles);
|
|
39
62
|
var headerStyles = (0, _services.useEuiMemoizedStyles)(_toast.euiToastHeaderStyles);
|
|
40
|
-
var
|
|
41
|
-
var
|
|
63
|
+
var cssStyles = [styles.euiToast];
|
|
64
|
+
var decorCssStyles = [styles.decor, animationMs && styles.hasAnimation];
|
|
65
|
+
var classes = (0, _classnames.default)('euiToast', className, (0, _defineProperty2.default)({}, "euiToast--".concat(color), color));
|
|
66
|
+
var highlightColorToken = (0, _euiThemeCommon.getTokenName)('borderStrong', color);
|
|
67
|
+
var typeColor = euiTheme.colors[highlightColorToken];
|
|
68
|
+
var backgroundLightToken = (0, _euiThemeCommon.getTokenName)('backgroundLight', color);
|
|
69
|
+
var backgroundLightColor = euiTheme.colors[backgroundLightToken];
|
|
70
|
+
var cssVariables = (0, _react.useMemo)(function () {
|
|
71
|
+
return _objectSpread({
|
|
72
|
+
'--euiToastTypeColor': typeColor,
|
|
73
|
+
'--euiToastTypeBackgroundColor': backgroundLightColor
|
|
74
|
+
}, animationMs && {
|
|
75
|
+
'--euiToastAnimationMs': "".concat(animationMs, "ms")
|
|
76
|
+
});
|
|
77
|
+
}, [typeColor, backgroundLightColor, animationMs]);
|
|
78
|
+
var dismissButton = (0, _react.useMemo)(function () {
|
|
79
|
+
if (!onClose) return;
|
|
80
|
+
return (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
81
|
+
token: "euiToast.dismissToast",
|
|
82
|
+
default: "Dismiss toast"
|
|
83
|
+
}, function (dismissToast) {
|
|
84
|
+
return (0, _react2.jsx)(_button.EuiButtonIcon, {
|
|
85
|
+
css: styles.dismissButton,
|
|
86
|
+
iconType: "cross",
|
|
87
|
+
color: "text",
|
|
88
|
+
size: "xs",
|
|
89
|
+
"aria-label": dismissToast,
|
|
90
|
+
onClick: onClose,
|
|
91
|
+
"data-test-subj": "toastCloseButton"
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
}, [onClose, styles]);
|
|
95
|
+
var header = (0, _react.useMemo)(function () {
|
|
96
|
+
if (!title) return;
|
|
97
|
+
var headerCssStyles = [headerStyles.euiToastHeader, onClose && headerStyles.hasDismissButton];
|
|
98
|
+
return (0, _react2.jsx)(_title.EuiTitle, {
|
|
99
|
+
size: "xs",
|
|
100
|
+
css: headerCssStyles,
|
|
101
|
+
"data-test-subj": "euiToastHeader__title"
|
|
102
|
+
}, (0, _react2.jsx)("p", null, title));
|
|
103
|
+
}, [title, headerStyles, onClose]);
|
|
104
|
+
var icon = (0, _react.useMemo)(function () {
|
|
105
|
+
if (!iconType) {
|
|
106
|
+
var _COLOR_TO_NOTIFICATIO;
|
|
107
|
+
var defaultIconType = (_COLOR_TO_NOTIFICATIO = COLOR_TO_NOTIFICATION_ICON_MAP[color]) !== null && _COLOR_TO_NOTIFICATIO !== void 0 ? _COLOR_TO_NOTIFICATIO : 'info';
|
|
108
|
+
return (0, _react2.jsx)(_notification_icon.EuiNotificationIcon, {
|
|
109
|
+
css: styles.icon,
|
|
110
|
+
type: defaultIconType,
|
|
111
|
+
size: "l"
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
return (0, _react2.jsx)(_icon.EuiIcon, {
|
|
115
|
+
css: [styles.icon, iconStyles.size.l, ";label:icon;"],
|
|
116
|
+
type: iconType,
|
|
117
|
+
size: "l",
|
|
118
|
+
"aria-hidden": "true",
|
|
119
|
+
color: typeColor
|
|
120
|
+
});
|
|
121
|
+
}, [iconType, color, typeColor, styles, iconStyles]);
|
|
122
|
+
var optionalChildren = (0, _react.useMemo)(function () {
|
|
123
|
+
if (!text && !children) return null;
|
|
124
|
+
return (0, _react2.jsx)("div", {
|
|
125
|
+
css: styles.text,
|
|
126
|
+
"data-test-subj": "euiToastBody"
|
|
127
|
+
}, text && (0, _react2.jsx)(_text.EuiText, {
|
|
128
|
+
size: "s",
|
|
129
|
+
color: "default",
|
|
130
|
+
className: "euiToast__text",
|
|
131
|
+
"data-test-subj": "euiToastText"
|
|
132
|
+
}, text), children && (0, _react2.jsx)(_text.EuiText, {
|
|
133
|
+
className: "euiToast__additionalContent",
|
|
134
|
+
size: "s",
|
|
135
|
+
color: "default",
|
|
136
|
+
"data-test-subj": "euiToastAdditionalContent"
|
|
137
|
+
}, children));
|
|
138
|
+
}, [text, children, styles]);
|
|
139
|
+
var actionControls = (0, _react.useMemo)(function () {
|
|
140
|
+
var actionPrimaryProps = _objectSpread(_objectSpread({}, actionProps === null || actionProps === void 0 ? void 0 : actionProps.primary), {}, {
|
|
141
|
+
color: color
|
|
142
|
+
});
|
|
143
|
+
var actionSecondaryProps = _objectSpread(_objectSpread({}, actionProps === null || actionProps === void 0 ? void 0 : actionProps.secondary), {}, {
|
|
144
|
+
color: color
|
|
145
|
+
});
|
|
146
|
+
var hasActionPrimary = Boolean(actionProps === null || actionProps === void 0 ? void 0 : actionProps.primary);
|
|
147
|
+
var hasActionSecondary = Boolean(actionProps === null || actionProps === void 0 ? void 0 : actionProps.secondary);
|
|
148
|
+
if (!hasActionPrimary && !hasActionSecondary) return null;
|
|
149
|
+
var actionPrimary = hasActionPrimary && (0, _react2.jsx)(_toast_action.EuiToastAction, (0, _extends2.default)({
|
|
150
|
+
actionType: "primary"
|
|
151
|
+
}, actionPrimaryProps));
|
|
152
|
+
var actionSecondary = hasActionSecondary && (0, _react2.jsx)(_toast_action.EuiToastAction, (0, _extends2.default)({
|
|
153
|
+
actionType: "secondary"
|
|
154
|
+
}, actionSecondaryProps));
|
|
155
|
+
return (0, _react2.jsx)("div", {
|
|
156
|
+
css: styles.actions
|
|
157
|
+
}, actionPrimary, actionSecondary);
|
|
158
|
+
}, [actionProps, color, styles]);
|
|
42
159
|
return (0, _react2.jsx)("div", (0, _extends2.default)({
|
|
43
|
-
css:
|
|
44
|
-
className: classes
|
|
45
|
-
|
|
160
|
+
css: cssStyles,
|
|
161
|
+
className: classes,
|
|
162
|
+
style: _objectSpread(_objectSpread({}, cssVariables), style)
|
|
163
|
+
}, rest), (0, _react2.jsx)("div", {
|
|
164
|
+
className: "euiToastDecor",
|
|
165
|
+
css: decorCssStyles,
|
|
166
|
+
role: "presentation"
|
|
167
|
+
}), (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("p", null, (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
46
168
|
token: "euiToast.newNotification",
|
|
47
169
|
default: "A new notification appears"
|
|
48
|
-
}))), (0, _react2.jsx)(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
size: "m",
|
|
60
|
-
"aria-hidden": "true"
|
|
61
|
-
}), (0, _react2.jsx)("span", {
|
|
62
|
-
css: headerStyles.euiToastHeader__title,
|
|
63
|
-
"data-test-subj": "euiToastHeader__title"
|
|
64
|
-
}, title));
|
|
65
|
-
}), onClose && (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
66
|
-
token: "euiToast.dismissToast",
|
|
67
|
-
default: "Dismiss toast"
|
|
68
|
-
}, function (dismissToast) {
|
|
69
|
-
return (0, _react2.jsx)(_button.EuiButtonIcon, {
|
|
70
|
-
css: baseStyles.euiToast__closeButton,
|
|
71
|
-
iconType: "cross",
|
|
72
|
-
color: "text",
|
|
73
|
-
size: "xs",
|
|
74
|
-
"aria-label": dismissToast,
|
|
75
|
-
onClick: onClose,
|
|
76
|
-
"data-test-subj": "toastCloseButton"
|
|
77
|
-
});
|
|
78
|
-
}), children && (0, _react2.jsx)(_text.EuiText, {
|
|
79
|
-
size: "s",
|
|
80
|
-
"data-test-subj": "euiToastBody"
|
|
81
|
-
}, children));
|
|
170
|
+
}))), (0, _react2.jsx)("div", {
|
|
171
|
+
css: styles.wrapper
|
|
172
|
+
}, (0, _react2.jsx)("div", {
|
|
173
|
+
css: styles.body
|
|
174
|
+
}, icon, (0, _react2.jsx)("div", {
|
|
175
|
+
css: styles.content
|
|
176
|
+
},
|
|
177
|
+
// Note: the DOM position of the dismiss button matters to screen reader users.
|
|
178
|
+
// We generally want them to have some context of _what_ they're dismissing,
|
|
179
|
+
// instead of navigating to the dismiss button first before the content
|
|
180
|
+
header && optionalChildren ? (0, _react2.jsx)(_react.default.Fragment, null, header, dismissButton, optionalChildren) : (0, _react2.jsx)(_react.default.Fragment, null, header || optionalChildren, dismissButton))), actionControls));
|
|
82
181
|
};
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.euiToastStyles = exports.euiToastHeaderStyles = void 0;
|
|
8
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
7
9
|
var _react = require("@emotion/react");
|
|
8
10
|
var _euiThemeCommon = require("@elastic/eui-theme-common");
|
|
9
11
|
var _global_styling = require("../../global_styling");
|
|
10
12
|
var _high_contrast = require("../../global_styling/functions/high_contrast");
|
|
11
13
|
var _title = require("../title/title.styles");
|
|
12
14
|
var _panel = require("../panel/panel.styles");
|
|
15
|
+
var _templateObject;
|
|
13
16
|
/*
|
|
14
17
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
15
18
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -17,60 +20,45 @@ var _panel = require("../panel/panel.styles");
|
|
|
17
20
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
18
21
|
* Side Public License, v 1.
|
|
19
22
|
*/
|
|
20
|
-
|
|
23
|
+
var TEXT_MAX_WIDTH = 1200;
|
|
24
|
+
var CONTAINER_NAME = 'euiToast';
|
|
25
|
+
var CQC_BREAKPOINT_NARROWEST = '(max-width: 320px)';
|
|
26
|
+
var euiToastAnimation = (0, _react.keyframes)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n from {\n transform: scaleX(1);\n }\n to {\n transform: scaleX(0);\n }\n"])));
|
|
21
27
|
var euiToastStyles = exports.euiToastStyles = function euiToastStyles(euiThemeContext) {
|
|
22
|
-
var euiTheme = euiThemeContext.euiTheme
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
29
|
+
var highlightSize = (0, _euiThemeCommon.mathWithUnits)([euiTheme.border.width.thin, euiTheme.border.width.thick], function (x, y) {
|
|
30
|
+
return x + y;
|
|
31
|
+
});
|
|
32
|
+
var paddingTop = (0, _euiThemeCommon.mathWithUnits)([euiTheme.size.base, highlightSize], function (x, y) {
|
|
33
|
+
return x + y;
|
|
34
|
+
});
|
|
35
|
+
var offsetTop = (0, _euiThemeCommon.mathWithUnits)([euiTheme.size.s, highlightSize], function (x, y) {
|
|
36
|
+
return x + y;
|
|
37
|
+
});
|
|
27
38
|
return {
|
|
28
39
|
// Base
|
|
29
|
-
euiToast: /*#__PURE__*/(0, _react.css)("border-radius:", euiTheme.border.radius.medium, ";", (0, _euiThemeCommon.euiShadowLarge)(euiThemeContext, {
|
|
40
|
+
euiToast: /*#__PURE__*/(0, _react.css)("container-type:inline-size;container-name:", CONTAINER_NAME, ";position:relative;overflow:hidden;border-radius:", euiTheme.border.radius.medium, ";", (0, _euiThemeCommon.euiShadowLarge)(euiThemeContext, {
|
|
30
41
|
borderAllInHighContrastMode: true
|
|
31
|
-
}), "
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return x * 2;
|
|
45
|
-
}), ")")), "\n ").concat((0, _global_styling.logicalCSS)('margin-top', "-".concat(euiTheme.border.width.thin)), "\n ").concat((0, _global_styling.logicalCSS)('margin-left', "-".concat(euiTheme.border.width.thin)), "\n }\n "),
|
|
46
|
-
// Windows high contrast mode ignores/overrides border colors, which have semantic meaning here. To get around this, we'll use a pseudo element that ignores forced colors
|
|
47
|
-
forced: "\n overflow: hidden;\n\n &::before {\n content: '';\n position: absolute;\n ".concat((0, _global_styling.logicalCSS)('top', 0), "\n ").concat((0, _global_styling.logicalCSS)('horizontal', 0), "\n ").concat((0, _global_styling.logicalCSS)('height', borderWidth), "\n background-color: ").concat(color, ";\n ").concat((0, _high_contrast.preventForcedColors)(euiThemeContext), "\n pointer-events: none;\n }\n ")
|
|
48
|
-
});
|
|
49
|
-
},
|
|
50
|
-
get primary() {
|
|
51
|
-
return /*#__PURE__*/(0, _react.css)(this._getStyles(euiTheme.colors.primary), ";label:primary;");
|
|
52
|
-
},
|
|
53
|
-
get success() {
|
|
54
|
-
return /*#__PURE__*/(0, _react.css)(this._getStyles(euiTheme.colors.success), ";label:success;");
|
|
55
|
-
},
|
|
56
|
-
get warning() {
|
|
57
|
-
return /*#__PURE__*/(0, _react.css)(this._getStyles(euiTheme.colors.warning), ";label:warning;");
|
|
58
|
-
},
|
|
59
|
-
get danger() {
|
|
60
|
-
return /*#__PURE__*/(0, _react.css)(this._getStyles(euiTheme.colors.danger), ";label:danger;");
|
|
61
|
-
}
|
|
62
|
-
}
|
|
42
|
+
}), " ", (0, _global_styling.logicalCSS)('padding-top', paddingTop), " ", (0, _global_styling.logicalCSS)('padding-bottom', euiTheme.size.base), " ", (0, _global_styling.logicalCSS)('padding-horizontal', euiTheme.size.base), " background-color:", euiTheme.colors.backgroundBasePlain, ";", (0, _global_styling.logicalCSS)('width', '100%'), " ", (0, _global_styling.euiTextBreakWord)(), (0, _panel.euiPanelBorderStyles)(euiThemeContext), ";;label:euiToast;"),
|
|
43
|
+
decor: /*#__PURE__*/(0, _react.css)("position:absolute;inset-block-start:0;inset-inline:0;", (0, _global_styling.logicalCSS)('height', highlightSize), " background-color:var(--euiToastTypeBackgroundColor);", (0, _high_contrast.preventForcedColors)(euiThemeContext), " &::before{content:'';position:absolute;z-index:", euiTheme.levels.content, ";inset-block-start:0;inset-inline:0;", (0, _global_styling.logicalCSS)('height', '100%'), " background-color:var(--euiToastTypeColor);pointer-events:none;", (0, _high_contrast.preventForcedColors)(euiThemeContext), " transform-origin:left center;[dir='rtl'] &{transform-origin:right center;}};label:decor;"),
|
|
44
|
+
// handles content + actions layout
|
|
45
|
+
wrapper: /*#__PURE__*/(0, _react.css)("display:flex;flex-direction:column;gap:", euiTheme.size.m, ";inline-size:100%;;label:wrapper;"),
|
|
46
|
+
// handles icon + text layout
|
|
47
|
+
body: /*#__PURE__*/(0, _react.css)("display:flex;flex-direction:row;align-self:center;gap:", euiTheme.size.m, ";inline-size:100%;;label:body;"),
|
|
48
|
+
// handles text layout
|
|
49
|
+
content: /*#__PURE__*/(0, _react.css)("display:flex;flex-direction:column;gap:", euiTheme.size.xs, ";align-self:center;inline-size:100%;max-inline-size:", TEXT_MAX_WIDTH, "px;.euiToast__text+.euiToast__additionalContent{", (0, _global_styling.logicalCSS)('margin-top', euiTheme.size.s), ";};label:content;"),
|
|
50
|
+
text: /*#__PURE__*/(0, _react.css)("display:flex;flex-direction:column;gap:", euiTheme.size.xs, ";;label:text;"),
|
|
51
|
+
icon: /*#__PURE__*/(0, _react.css)("grid-area:icon;position:relative;", (0, _global_styling.logicalCSS)('margin-vertical', euiTheme.size.xxs), ";;label:icon;"),
|
|
52
|
+
actions: /*#__PURE__*/(0, _react.css)("grid-area:actions;display:flex;gap:", euiTheme.size.s, ";", (0, _global_styling.logicalCSS)('margin-left', euiTheme.size.xl), "@container ", CONTAINER_NAME, " ", CQC_BREAKPOINT_NARROWEST, "{flex-wrap:wrap;>*{inline-size:100%;}};label:actions;"),
|
|
53
|
+
dismissButton: /*#__PURE__*/(0, _react.css)("position:absolute;", (0, _global_styling.logicalCSS)('top', offsetTop), ";", (0, _global_styling.logicalCSS)('right', euiTheme.size.s), ";;label:dismissButton;"),
|
|
54
|
+
hasAnimation: /*#__PURE__*/(0, _react.css)("&::before{", _euiThemeCommon.euiCanAnimate, "{animation:", euiToastAnimation, " var(--euiToastAnimationMs) linear forwards;}};label:hasAnimation;")
|
|
63
55
|
};
|
|
64
56
|
};
|
|
65
57
|
var euiToastHeaderStyles = exports.euiToastHeaderStyles = function euiToastHeaderStyles(euiThemeContext) {
|
|
66
58
|
var euiTheme = euiThemeContext.euiTheme;
|
|
67
59
|
return {
|
|
68
60
|
// Base
|
|
69
|
-
euiToastHeader: /*#__PURE__*/(0, _react.css)("display:flex;align-items:baseline;", (0,
|
|
70
|
-
|
|
71
|
-
euiToastHeader__icon: /*#__PURE__*/(0, _react.css)("flex:0 0 auto;fill:", euiTheme.colors.textHeading, ";transform:translateY(2px);;label:euiToastHeader__icon;"),
|
|
72
|
-
euiToastHeader__title: /*#__PURE__*/(0, _react.css)((0, _title.euiTitle)(euiThemeContext, 'xs'), " font-weight:", euiTheme.font.weight.bold, ";;label:euiToastHeader__title;"),
|
|
73
|
-
// Variants
|
|
74
|
-
withBody: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('margin-bottom', euiTheme.size.s), ";;label:withBody;")
|
|
61
|
+
euiToastHeader: /*#__PURE__*/(0, _react.css)("display:flex;align-items:baseline;", (0, _title.euiTitle)(euiThemeContext, 'xs'), " font-weight:", euiTheme.font.weight.bold, ";;label:euiToastHeader;"),
|
|
62
|
+
hasDismissButton: /*#__PURE__*/(0, _react.css)("padding-inline-end:", euiTheme.size.l, ";;label:hasDismissButton;")
|
|
75
63
|
};
|
|
76
64
|
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.EuiToastAction = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
var _button = require("../button");
|
|
12
|
+
var _react2 = require("@emotion/react");
|
|
13
|
+
var _excluded = ["children", "actionType", "color"];
|
|
14
|
+
/*
|
|
15
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
16
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
17
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
18
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
19
|
+
* Side Public License, v 1.
|
|
20
|
+
*/
|
|
21
|
+
var EuiToastAction = exports.EuiToastAction = function EuiToastAction(_ref) {
|
|
22
|
+
var children = _ref.children,
|
|
23
|
+
_ref$actionType = _ref.actionType,
|
|
24
|
+
actionType = _ref$actionType === void 0 ? 'primary' : _ref$actionType,
|
|
25
|
+
_ref$color = _ref.color,
|
|
26
|
+
color = _ref$color === void 0 ? 'primary' : _ref$color,
|
|
27
|
+
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
28
|
+
if (actionType === 'primary') {
|
|
29
|
+
return (0, _react2.jsx)(_button.EuiButton, (0, _extends2.default)({
|
|
30
|
+
size: "s",
|
|
31
|
+
color: color
|
|
32
|
+
}, rest), children);
|
|
33
|
+
} else {
|
|
34
|
+
return (0, _react2.jsx)(_button.EuiButtonEmpty, (0, _extends2.default)({
|
|
35
|
+
size: "s",
|
|
36
|
+
color: color
|
|
37
|
+
}, rest), children);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.COLORS = void 0;
|
|
7
|
+
/*
|
|
8
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
9
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
10
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
11
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
12
|
+
* Side Public License, v 1.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
var COLORS = exports.COLORS = ['primary', 'success', 'warning', 'danger'];
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.POSITIONS = exports.EuiToolTip = exports.DEFAULT_TOOLTIP_OFFSET = void 0;
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
12
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
@@ -31,6 +32,8 @@ var _excluded = ["children", "className", "anchorClassName", "anchorProps", "con
|
|
|
31
32
|
*/
|
|
32
33
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
33
34
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
35
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
36
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
34
37
|
var POSITIONS = exports.POSITIONS = ['top', 'right', 'bottom', 'left'];
|
|
35
38
|
var DISPLAYS = ['inlineBlock', 'block', 'flex'];
|
|
36
39
|
var DEFAULT_TOOLTIP_OFFSET = exports.DEFAULT_TOOLTIP_OFFSET = 16;
|
|
@@ -84,22 +87,26 @@ var EuiToolTip = exports.EuiToolTip = /*#__PURE__*/(0, _react.forwardRef)(functi
|
|
|
84
87
|
setVisible = _useState2[1];
|
|
85
88
|
var _useState3 = (0, _react.useState)(false),
|
|
86
89
|
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
var _useState5 = (0, _react.useState)(
|
|
90
|
+
skipAnimation = _useState4[0],
|
|
91
|
+
setSkipAnimation = _useState4[1];
|
|
92
|
+
var _useState5 = (0, _react.useState)(false),
|
|
90
93
|
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
var _useState7 = (0, _react.useState)(
|
|
94
|
+
hasFocus = _useState6[0],
|
|
95
|
+
setHasFocus = _useState6[1];
|
|
96
|
+
var _useState7 = (0, _react.useState)(positionProp),
|
|
94
97
|
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
var _useState9 = (0, _react.useState)(
|
|
98
|
+
calculatedPosition = _useState8[0],
|
|
99
|
+
setCalculatedPosition = _useState8[1];
|
|
100
|
+
var _useState9 = (0, _react.useState)(DEFAULT_TOOLTIP_STYLES),
|
|
98
101
|
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
var
|
|
102
|
-
|
|
102
|
+
toolTipStyles = _useState10[0],
|
|
103
|
+
setToolTipStyles = _useState10[1];
|
|
104
|
+
var _useState11 = (0, _react.useState)(undefined),
|
|
105
|
+
_useState12 = (0, _slicedToArray2.default)(_useState11, 2),
|
|
106
|
+
arrowStyles = _useState12[0],
|
|
107
|
+
setArrowStyles = _useState12[1];
|
|
108
|
+
var generatedId = (0, _services.useGeneratedHtmlId)();
|
|
109
|
+
var id = idProp !== null && idProp !== void 0 ? idProp : generatedId;
|
|
103
110
|
var anchorRef = (0, _react.useRef)(null);
|
|
104
111
|
var popoverRef = (0, _react.useRef)(null);
|
|
105
112
|
var positionToolTip = (0, _react.useCallback)(function () {
|
|
@@ -151,10 +158,19 @@ var EuiToolTip = exports.EuiToolTip = /*#__PURE__*/(0, _react.forwardRef)(functi
|
|
|
151
158
|
setArrowStyles(undefined);
|
|
152
159
|
_tool_tip_manager.toolTipManager.deregisterToolTip(hideToolTip);
|
|
153
160
|
}, []);
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Show the tooltip.
|
|
164
|
+
*
|
|
165
|
+
* Uses the tooltip manager's `skipAnimation` signal to optionally skip the entry
|
|
166
|
+
* animation when another tooltip is already open or was just closed.
|
|
167
|
+
*/
|
|
154
168
|
var showToolTip = (0, _react.useCallback)(function () {
|
|
155
169
|
if (!content && !title) return;
|
|
170
|
+
var result = _tool_tip_manager.toolTipManager.registerTooltip(hideToolTip);
|
|
171
|
+
if (!result) return;
|
|
172
|
+
setSkipAnimation(result.skipAnimation);
|
|
156
173
|
setVisible(true);
|
|
157
|
-
_tool_tip_manager.toolTipManager.registerTooltip(hideToolTip);
|
|
158
174
|
}, [content, title, hideToolTip]);
|
|
159
175
|
(0, _react.useImperativeHandle)(ref, function () {
|
|
160
176
|
return {
|
|
@@ -234,18 +250,24 @@ var EuiToolTip = exports.EuiToolTip = /*#__PURE__*/(0, _react.forwardRef)(functi
|
|
|
234
250
|
hideToolTip();
|
|
235
251
|
}
|
|
236
252
|
}, [disableScreenReaderOutput, visible, hideToolTip]);
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Show the tooltip on enter.
|
|
256
|
+
*/
|
|
257
|
+
var onMouseEnter = (0, _react.useCallback)(function (event) {
|
|
258
|
+
var _anchorProps$onMouseE;
|
|
259
|
+
showToolTip();
|
|
260
|
+
anchorProps === null || anchorProps === void 0 || (_anchorProps$onMouseE = anchorProps.onMouseEnter) === null || _anchorProps$onMouseE === void 0 || _anchorProps$onMouseE.call(anchorProps, event);
|
|
261
|
+
}, [showToolTip, anchorProps === null || anchorProps === void 0 ? void 0 : anchorProps.onMouseEnter]);
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Hide the tooltip if the mouse is not over the trigger.
|
|
265
|
+
*/
|
|
266
|
+
var onMouseLeave = (0, _react.useCallback)(function (event) {
|
|
267
|
+
var _anchorProps$onMouseL;
|
|
268
|
+
if (!hasFocus) hideToolTip();
|
|
269
|
+
anchorProps === null || anchorProps === void 0 || (_anchorProps$onMouseL = anchorProps.onMouseLeave) === null || _anchorProps$onMouseL === void 0 || _anchorProps$onMouseL.call(anchorProps, event);
|
|
270
|
+
}, [hasFocus, hideToolTip, anchorProps === null || anchorProps === void 0 ? void 0 : anchorProps.onMouseLeave]);
|
|
249
271
|
var classes = (0, _classnames.default)('euiToolTip', className);
|
|
250
272
|
var anchorClasses = (0, _classnames.default)(anchorClassName, anchorProps === null || anchorProps === void 0 ? void 0 : anchorProps.className);
|
|
251
273
|
return (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)(_tool_tip_anchor.EuiToolTipAnchor, (0, _extends2.default)({}, anchorProps, {
|
|
@@ -253,8 +275,9 @@ var EuiToolTip = exports.EuiToolTip = /*#__PURE__*/(0, _react.forwardRef)(functi
|
|
|
253
275
|
onBlur: onBlur,
|
|
254
276
|
onFocus: onFocus,
|
|
255
277
|
onKeyDown: onEscapeKey,
|
|
256
|
-
|
|
257
|
-
|
|
278
|
+
onMouseEnter: onMouseEnter,
|
|
279
|
+
onMouseLeave: onMouseLeave,
|
|
280
|
+
onMouseOut: onMouseOutProp
|
|
258
281
|
// `id` defines if the trigger and tooltip are automatically linked via `aria-describedby`.
|
|
259
282
|
,
|
|
260
283
|
id: !disableScreenReaderOutput ? id : undefined,
|
|
@@ -263,7 +286,12 @@ var EuiToolTip = exports.EuiToolTip = /*#__PURE__*/(0, _react.forwardRef)(functi
|
|
|
263
286
|
isVisible: visible
|
|
264
287
|
}), children), visible && (content || title) && (0, _react2.jsx)(_portal.EuiPortal, null, (0, _react2.jsx)(_tool_tip_popover.EuiToolTipPopover, (0, _extends2.default)({
|
|
265
288
|
className: classes,
|
|
266
|
-
style: toolTipStyles,
|
|
289
|
+
style: _objectSpread(_objectSpread({}, toolTipStyles), {}, {
|
|
290
|
+
// Inline `animation: none` overrides the keyframes fade-in
|
|
291
|
+
// shorthand on the base `.euiToolTip` class, so a tooltip
|
|
292
|
+
// shown right after another closes appears instantly.
|
|
293
|
+
animation: skipAnimation ? 'none' : undefined
|
|
294
|
+
}),
|
|
267
295
|
positionToolTip: positionToolTip,
|
|
268
296
|
popoverRef: setPopoverRef,
|
|
269
297
|
title: title,
|