@elastic/eui 70.2.3 → 70.3.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_theme_dark.css +0 -198
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +0 -198
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/accessibility/skip_link/skip_link.js +6 -5
- package/es/components/badge/beta_badge/beta_badge.js +11 -3
- package/es/components/badge/beta_badge/beta_badge.styles.js +25 -4
- package/es/components/card/card.js +6 -1
- package/es/components/card/card.styles.js +4 -4
- package/es/components/date_picker/super_date_picker/super_date_picker.a11y.js +109 -0
- package/es/components/flex/flex_group.styles.js +1 -1
- package/es/components/flyout/flyout.a11y.js +92 -0
- package/es/components/image/image_fullscreen_wrapper.styles.js +3 -11
- package/es/components/modal/confirm_modal.js +11 -0
- package/es/components/modal/modal.a11y.js +70 -0
- package/es/components/modal/modal.js +17 -27
- package/es/components/modal/modal.styles.js +23 -0
- package/es/components/modal/modal_body.js +8 -0
- package/es/components/modal/modal_body.styles.js +16 -0
- package/es/components/modal/modal_footer.js +6 -0
- package/es/components/modal/modal_footer.styles.js +15 -0
- package/es/components/modal/modal_header.js +6 -0
- package/es/components/modal/modal_header.styles.js +14 -0
- package/es/components/modal/modal_header_title.js +3 -1
- package/es/components/page_template/outer/page_outer.js +1 -1
- package/es/components/page_template/page_template.js +28 -6
- package/es/components/popover/popover.a11y.js +83 -0
- package/es/components/search_bar/query/default_syntax.js +2 -1
- package/es/components/tabs/tabs.a11y.js +97 -0
- package/es/components/tree_view/tree_view.a11y.js +74 -0
- package/es/global_styling/utility/animations.js +5 -2
- package/eui.d.ts +58 -7
- package/i18ntokens.json +2 -2
- package/lib/components/accessibility/skip_link/skip_link.js +6 -5
- package/lib/components/badge/beta_badge/beta_badge.js +13 -4
- package/lib/components/badge/beta_badge/beta_badge.styles.js +25 -4
- package/lib/components/card/card.js +6 -1
- package/lib/components/card/card.styles.js +4 -4
- package/lib/components/date_picker/super_date_picker/super_date_picker.a11y.js +111 -0
- package/lib/components/flex/flex_group.styles.js +1 -1
- package/lib/components/flyout/flyout.a11y.js +94 -0
- package/lib/components/image/image_fullscreen_wrapper.styles.js +9 -10
- package/lib/components/modal/confirm_modal.js +13 -0
- package/lib/components/modal/modal.a11y.js +73 -0
- package/lib/components/modal/modal.js +17 -32
- package/lib/components/modal/modal.styles.js +36 -0
- package/lib/components/modal/modal_body.js +10 -0
- package/lib/components/modal/modal_body.styles.js +27 -0
- package/lib/components/modal/modal_footer.js +8 -0
- package/lib/components/modal/modal_footer.styles.js +26 -0
- package/lib/components/modal/modal_header.js +8 -0
- package/lib/components/modal/modal_header.styles.js +24 -0
- package/lib/components/modal/modal_header_title.js +4 -1
- package/lib/components/page_template/outer/page_outer.js +1 -1
- package/lib/components/page_template/page_template.js +32 -10
- package/lib/components/popover/popover.a11y.js +86 -0
- package/lib/components/search_bar/query/default_syntax.js +2 -1
- package/lib/components/tabs/tabs.a11y.js +98 -0
- package/lib/components/tree_view/tree_view.a11y.js +80 -0
- package/lib/global_styling/utility/animations.js +9 -3
- package/optimize/es/components/accessibility/skip_link/skip_link.js +6 -5
- package/optimize/es/components/badge/beta_badge/beta_badge.js +5 -2
- package/optimize/es/components/badge/beta_badge/beta_badge.styles.js +25 -4
- package/optimize/es/components/card/card.styles.js +4 -4
- package/optimize/es/components/date_picker/super_date_picker/super_date_picker.a11y.js +98 -0
- package/optimize/es/components/flex/flex_group.styles.js +1 -1
- package/optimize/es/components/flyout/flyout.a11y.js +77 -0
- package/optimize/es/components/image/image_fullscreen_wrapper.styles.js +3 -11
- package/optimize/es/components/modal/confirm_modal.js +6 -0
- package/optimize/es/components/modal/modal.a11y.js +60 -0
- package/optimize/es/components/modal/modal.js +17 -27
- package/optimize/es/components/modal/modal.styles.js +23 -0
- package/optimize/es/components/modal/modal_body.js +8 -0
- package/optimize/es/components/modal/modal_body.styles.js +16 -0
- package/optimize/es/components/modal/modal_footer.js +6 -0
- package/optimize/es/components/modal/modal_footer.styles.js +15 -0
- package/optimize/es/components/modal/modal_header.js +6 -0
- package/optimize/es/components/modal/modal_header.styles.js +14 -0
- package/optimize/es/components/modal/modal_header_title.js +3 -1
- package/optimize/es/components/page_template/page_template.js +5 -3
- package/optimize/es/components/popover/popover.a11y.js +73 -0
- package/optimize/es/components/search_bar/query/default_syntax.js +2 -1
- package/optimize/es/components/tabs/tabs.a11y.js +97 -0
- package/optimize/es/components/tree_view/tree_view.a11y.js +74 -0
- package/optimize/es/global_styling/utility/animations.js +5 -2
- package/optimize/lib/components/accessibility/skip_link/skip_link.js +6 -5
- package/optimize/lib/components/badge/beta_badge/beta_badge.js +7 -3
- package/optimize/lib/components/badge/beta_badge/beta_badge.styles.js +25 -4
- package/optimize/lib/components/card/card.styles.js +4 -4
- package/optimize/lib/components/date_picker/super_date_picker/super_date_picker.a11y.js +111 -0
- package/optimize/lib/components/flex/flex_group.styles.js +1 -1
- package/optimize/lib/components/flyout/flyout.a11y.js +84 -0
- package/optimize/lib/components/image/image_fullscreen_wrapper.styles.js +9 -12
- package/optimize/lib/components/modal/confirm_modal.js +8 -0
- package/optimize/lib/components/modal/modal.a11y.js +73 -0
- package/optimize/lib/components/modal/modal.js +17 -31
- package/optimize/lib/components/modal/modal.styles.js +36 -0
- package/optimize/lib/components/modal/modal_body.js +10 -0
- package/optimize/lib/components/modal/modal_body.styles.js +27 -0
- package/optimize/lib/components/modal/modal_footer.js +8 -0
- package/optimize/lib/components/modal/modal_footer.styles.js +26 -0
- package/optimize/lib/components/modal/modal_header.js +8 -0
- package/optimize/lib/components/modal/modal_header.styles.js +24 -0
- package/optimize/lib/components/modal/modal_header_title.js +4 -1
- package/optimize/lib/components/page_template/page_template.js +5 -3
- package/optimize/lib/components/popover/popover.a11y.js +86 -0
- package/optimize/lib/components/search_bar/query/default_syntax.js +2 -1
- package/optimize/lib/components/tabs/tabs.a11y.js +98 -0
- package/optimize/lib/components/tree_view/tree_view.a11y.js +80 -0
- package/optimize/lib/global_styling/utility/animations.js +9 -3
- package/package.json +5 -4
- package/src/components/index.scss +0 -1
- package/src/themes/amsterdam/overrides/_index.scss +0 -1
- package/test-env/components/accessibility/skip_link/skip_link.js +6 -5
- package/test-env/components/badge/beta_badge/beta_badge.js +13 -4
- package/test-env/components/badge/beta_badge/beta_badge.styles.js +25 -4
- package/test-env/components/card/card.js +6 -1
- package/test-env/components/card/card.styles.js +4 -4
- package/test-env/components/date_picker/super_date_picker/super_date_picker.a11y.js +111 -0
- package/test-env/components/flex/flex_group.styles.js +1 -1
- package/test-env/components/flyout/flyout.a11y.js +84 -0
- package/test-env/components/image/image_fullscreen_wrapper.styles.js +9 -12
- package/test-env/components/modal/confirm_modal.js +13 -0
- package/test-env/components/modal/modal.a11y.js +73 -0
- package/test-env/components/modal/modal.js +17 -31
- package/test-env/components/modal/modal.styles.js +36 -0
- package/test-env/components/modal/modal_body.js +10 -0
- package/test-env/components/modal/modal_body.styles.js +27 -0
- package/test-env/components/modal/modal_footer.js +8 -0
- package/test-env/components/modal/modal_footer.styles.js +26 -0
- package/test-env/components/modal/modal_header.js +8 -0
- package/test-env/components/modal/modal_header.styles.js +24 -0
- package/test-env/components/modal/modal_header_title.js +4 -1
- package/test-env/components/page_template/outer/page_outer.js +1 -1
- package/test-env/components/page_template/page_template.js +32 -10
- package/test-env/components/popover/popover.a11y.js +86 -0
- package/test-env/components/search_bar/query/default_syntax.js +2 -1
- package/test-env/components/tabs/tabs.a11y.js +98 -0
- package/test-env/components/tree_view/tree_view.a11y.js +80 -0
- package/test-env/global_styling/utility/animations.js +9 -3
- package/src/components/modal/_index.scss +0 -1
- package/src/components/modal/_modal.scss +0 -156
- package/src/themes/amsterdam/overrides/_modal.scss +0 -3
|
@@ -74,15 +74,16 @@ export var EuiSkipLink = function EuiSkipLink(_ref) {
|
|
|
74
74
|
|
|
75
75
|
setHasValidId(false); // If no valid element via ID is available, use the fallback query selectors
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
if (fallbackDestination) {
|
|
78
|
+
var fallbackEl = document.querySelector(fallbackDestination);
|
|
78
79
|
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
if (fallbackEl) {
|
|
81
|
+
setDestinationEl(fallbackEl);
|
|
82
|
+
}
|
|
81
83
|
}
|
|
82
84
|
}, [destinationId, fallbackDestination]);
|
|
83
85
|
var onClick = useCallback(function (e) {
|
|
84
|
-
if (overrideLinkBehavior || !hasValidId) {
|
|
85
|
-
if (!destinationEl) return;
|
|
86
|
+
if ((overrideLinkBehavior || !hasValidId) && destinationEl) {
|
|
86
87
|
e.preventDefault(); // Scroll to the top of the destination content only if it's ~mostly out of view
|
|
87
88
|
|
|
88
89
|
var destinationY = destinationEl.getBoundingClientRect().top;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["className", "label", "color", "tooltipContent", "tooltipPosition", "anchorProps", "title", "iconType", "onClick", "onClickAriaLabel", "href", "rel", "target", "size"];
|
|
1
|
+
var _excluded = ["className", "label", "color", "tooltipContent", "tooltipPosition", "anchorProps", "title", "iconType", "onClick", "onClickAriaLabel", "href", "rel", "target", "size", "alignment"];
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
4
|
|
|
@@ -25,6 +25,7 @@ import { euiBetaBadgeStyles } from './beta_badge.styles';
|
|
|
25
25
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
26
26
|
export var COLORS = ['accent', 'subdued', 'hollow'];
|
|
27
27
|
export var SIZES = ['s', 'm'];
|
|
28
|
+
export var ALIGNMENTS = ['baseline', 'middle'];
|
|
28
29
|
export var EuiBetaBadge = function EuiBetaBadge(_ref) {
|
|
29
30
|
var className = _ref.className,
|
|
30
31
|
label = _ref.label,
|
|
@@ -43,6 +44,8 @@ export var EuiBetaBadge = function EuiBetaBadge(_ref) {
|
|
|
43
44
|
target = _ref.target,
|
|
44
45
|
_ref$size = _ref.size,
|
|
45
46
|
size = _ref$size === void 0 ? 'm' : _ref$size,
|
|
47
|
+
_ref$alignment = _ref.alignment,
|
|
48
|
+
alignment = _ref$alignment === void 0 ? 'baseline' : _ref$alignment,
|
|
46
49
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
47
50
|
|
|
48
51
|
var euiTheme = useEuiTheme();
|
|
@@ -50,7 +53,7 @@ export var EuiBetaBadge = function EuiBetaBadge(_ref) {
|
|
|
50
53
|
var isCircular = iconType || singleLetter;
|
|
51
54
|
var classes = classNames('euiBetaBadge', className);
|
|
52
55
|
var styles = euiBetaBadgeStyles(euiTheme);
|
|
53
|
-
var cssStyles = [styles.euiBetaBadge, styles[color], styles[size], isCircular ? styles.badgeSizes.circle[size] : styles.badgeSizes.default[size]];
|
|
56
|
+
var cssStyles = [styles.euiBetaBadge, styles[color], styles[size], styles[alignment], isCircular ? styles.badgeSizes.circle[size] : styles.badgeSizes.default[size]];
|
|
54
57
|
var icon;
|
|
55
58
|
|
|
56
59
|
if (iconType) {
|
|
@@ -193,5 +196,10 @@ EuiBetaBadge.propTypes = {
|
|
|
193
196
|
* Accepts accent, subdued and hollow.
|
|
194
197
|
*/
|
|
195
198
|
color: PropTypes.any,
|
|
196
|
-
size: PropTypes.any
|
|
199
|
+
size: PropTypes.any,
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Sets the `vertical-align` CSS property
|
|
203
|
+
*/
|
|
204
|
+
alignment: PropTypes.any
|
|
197
205
|
};
|
|
@@ -24,6 +24,24 @@ import { logicalCSS, euiFocusRing, euiFontSizeFromScale, euiTextTruncate, mathWi
|
|
|
24
24
|
import { tint, isColorDark, hexToRgb } from '../../../services';
|
|
25
25
|
|
|
26
26
|
var _ref = process.env.NODE_ENV === "production" ? {
|
|
27
|
+
name: "l1nme7-middle",
|
|
28
|
+
styles: "vertical-align:middle;label:middle;"
|
|
29
|
+
} : {
|
|
30
|
+
name: "l1nme7-middle",
|
|
31
|
+
styles: "vertical-align:middle;label:middle;",
|
|
32
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
var _ref2 = process.env.NODE_ENV === "production" ? {
|
|
36
|
+
name: "19hexhy-baseline",
|
|
37
|
+
styles: "vertical-align:baseline;label:baseline;"
|
|
38
|
+
} : {
|
|
39
|
+
name: "19hexhy-baseline",
|
|
40
|
+
styles: "vertical-align:baseline;label:baseline;",
|
|
41
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
var _ref3 = process.env.NODE_ENV === "production" ? {
|
|
27
45
|
name: "pzpqqg-euiBetaBadge__icon",
|
|
28
46
|
styles: "position:relative;transform:translate(0, -1px);label:euiBetaBadge__icon;"
|
|
29
47
|
} : {
|
|
@@ -36,7 +54,7 @@ export var euiBetaBadgeStyles = function euiBetaBadgeStyles(euiThemeContext) {
|
|
|
36
54
|
var euiTheme = euiThemeContext.euiTheme,
|
|
37
55
|
colorMode = euiThemeContext.colorMode;
|
|
38
56
|
return {
|
|
39
|
-
euiBetaBadge: /*#__PURE__*/css("display:inline-block;
|
|
57
|
+
euiBetaBadge: /*#__PURE__*/css("display:inline-block;border-radius:", euiTheme.size.l, ";cursor:default;font-weight:", euiTheme.font.weight.bold, ";text-transform:uppercase;letter-spacing:0.05em;text-align:center;", euiTextTruncate(), " &:focus{", euiFocusRing(euiThemeContext, 'outset', {
|
|
40
58
|
color: colorMode === 'DARK' ? euiTheme.colors.ghost : euiTheme.colors.ink
|
|
41
59
|
}), ";};label:euiBetaBadge;"),
|
|
42
60
|
// Colors
|
|
@@ -62,12 +80,15 @@ export var euiBetaBadgeStyles = function euiBetaBadgeStyles(euiThemeContext) {
|
|
|
62
80
|
})), "\n ")
|
|
63
81
|
}
|
|
64
82
|
},
|
|
65
|
-
euiBetaBadge__icon:
|
|
83
|
+
euiBetaBadge__icon: _ref3,
|
|
84
|
+
// Alignments
|
|
85
|
+
baseline: _ref2,
|
|
86
|
+
middle: _ref
|
|
66
87
|
};
|
|
67
88
|
}; // Util for detecting text color based on badge bg color
|
|
68
89
|
|
|
69
|
-
export var getBadgeColors = function getBadgeColors(backgroundColor,
|
|
70
|
-
var euiTheme =
|
|
90
|
+
export var getBadgeColors = function getBadgeColors(backgroundColor, _ref4) {
|
|
91
|
+
var euiTheme = _ref4.euiTheme;
|
|
71
92
|
var textColor = isColorDark.apply(void 0, _toConsumableArray(hexToRgb(backgroundColor))) ? euiTheme.colors.ghost : euiTheme.colors.ink;
|
|
72
93
|
return "\n background-color: ".concat(backgroundColor, ";\n color: ").concat(textColor, ";\n ");
|
|
73
94
|
};
|
|
@@ -421,7 +421,12 @@ EuiCard.propTypes = {
|
|
|
421
421
|
* Accepts accent, subdued and hollow.
|
|
422
422
|
*/
|
|
423
423
|
color: PropTypes.any,
|
|
424
|
-
size: PropTypes.any
|
|
424
|
+
size: PropTypes.any,
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* Sets the `vertical-align` CSS property
|
|
428
|
+
*/
|
|
429
|
+
alignment: PropTypes.any
|
|
425
430
|
}),
|
|
426
431
|
|
|
427
432
|
/**
|
|
@@ -55,11 +55,11 @@ var _ref5 = process.env.NODE_ENV === "production" ? {
|
|
|
55
55
|
};
|
|
56
56
|
|
|
57
57
|
var _ref6 = process.env.NODE_ENV === "production" ? {
|
|
58
|
-
name: "
|
|
59
|
-
styles: "display:flex;label:euiCard__main;"
|
|
58
|
+
name: "31kq8f-euiCard__main",
|
|
59
|
+
styles: "display:flex;inline-size:100%;label:euiCard__main;"
|
|
60
60
|
} : {
|
|
61
|
-
name: "
|
|
62
|
-
styles: "display:flex;label:euiCard__main;",
|
|
61
|
+
name: "31kq8f-euiCard__main",
|
|
62
|
+
styles: "display:flex;inline-size:100%;label:euiCard__main;",
|
|
63
63
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
64
64
|
};
|
|
65
65
|
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
3
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
+
|
|
5
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
|
+
|
|
7
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
|
+
|
|
9
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
10
|
+
|
|
11
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
12
|
+
|
|
13
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
|
+
|
|
15
|
+
/*
|
|
16
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
17
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
18
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
19
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
20
|
+
* Side Public License, v 1.
|
|
21
|
+
*/
|
|
22
|
+
/// <reference types="../../../../cypress/support"/>
|
|
23
|
+
import React, { useState } from 'react';
|
|
24
|
+
import { EuiSuperDatePicker } from './super_date_picker';
|
|
25
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
26
|
+
|
|
27
|
+
var SuperDatePicker = function SuperDatePicker() {
|
|
28
|
+
var _useState = useState(false),
|
|
29
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
30
|
+
isLoading = _useState2[0],
|
|
31
|
+
setIsLoading = _useState2[1];
|
|
32
|
+
|
|
33
|
+
var _useState3 = useState(true),
|
|
34
|
+
_useState4 = _slicedToArray(_useState3, 1),
|
|
35
|
+
showUpdateButton = _useState4[0];
|
|
36
|
+
|
|
37
|
+
var _useState5 = useState('now-30m'),
|
|
38
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
39
|
+
start = _useState6[0],
|
|
40
|
+
setStart = _useState6[1];
|
|
41
|
+
|
|
42
|
+
var _useState7 = useState('now'),
|
|
43
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
44
|
+
end = _useState8[0],
|
|
45
|
+
setEnd = _useState8[1];
|
|
46
|
+
|
|
47
|
+
var _useState9 = useState(true),
|
|
48
|
+
_useState10 = _slicedToArray(_useState9, 1),
|
|
49
|
+
showFill = _useState10[0];
|
|
50
|
+
|
|
51
|
+
var onTimeChange = function onTimeChange(_ref) {
|
|
52
|
+
var start = _ref.start,
|
|
53
|
+
end = _ref.end;
|
|
54
|
+
setStart(start);
|
|
55
|
+
setEnd(end);
|
|
56
|
+
setIsLoading(true);
|
|
57
|
+
startLoading();
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
var startLoading = function startLoading() {
|
|
61
|
+
setTimeout(stopLoading, 1000);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
var stopLoading = function stopLoading() {
|
|
65
|
+
setIsLoading(false);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
var datepickerProps = {
|
|
69
|
+
isLoading: isLoading,
|
|
70
|
+
start: start,
|
|
71
|
+
end: end,
|
|
72
|
+
onTimeChange: onTimeChange,
|
|
73
|
+
showUpdateButton: showUpdateButton
|
|
74
|
+
};
|
|
75
|
+
return ___EmotionJSX(EuiSuperDatePicker, _extends({}, datepickerProps, {
|
|
76
|
+
updateButtonProps: {
|
|
77
|
+
fill: showFill
|
|
78
|
+
}
|
|
79
|
+
}));
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
beforeEach(function () {
|
|
83
|
+
cy.mount(___EmotionJSX(SuperDatePicker, null));
|
|
84
|
+
cy.get('div.euiSuperDatePicker__flexWrapper').should('exist');
|
|
85
|
+
});
|
|
86
|
+
describe('EuiSuperDatePicker', function () {
|
|
87
|
+
describe('Automated accessibility check', function () {
|
|
88
|
+
it('has zero violations on render', function () {
|
|
89
|
+
cy.checkAxe();
|
|
90
|
+
});
|
|
91
|
+
it('has zero violations when quick select menu is open', function () {
|
|
92
|
+
cy.get('button.euiFormControlLayout__prepend').click();
|
|
93
|
+
cy.get('div.euiPanel').contains('Quick select').should('exist');
|
|
94
|
+
cy.checkAxe();
|
|
95
|
+
});
|
|
96
|
+
it('has zero violations when start / end date menus are open', function () {
|
|
97
|
+
cy.get('button.euiSuperDatePicker__prettyFormat').click();
|
|
98
|
+
cy.get('div.euiDatePopoverContent').should('exist');
|
|
99
|
+
cy.checkAxe();
|
|
100
|
+
cy.get('button.euiDatePopoverButton--start').click();
|
|
101
|
+
cy.get('button.euiDatePopoverButton--end').click();
|
|
102
|
+
cy.get('div.euiDatePopoverContent').should('exist');
|
|
103
|
+
cy.checkAxe();
|
|
104
|
+
cy.get('button.euiDatePopoverButton--end').click();
|
|
105
|
+
cy.get('div.euiDatePopoverContent').should('not.exist');
|
|
106
|
+
cy.checkAxe();
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
});
|
|
@@ -167,7 +167,7 @@ export var euiFlexGroupStyles = function euiFlexGroupStyles(euiThemeContext) {
|
|
|
167
167
|
var euiTheme = euiThemeContext.euiTheme;
|
|
168
168
|
return {
|
|
169
169
|
euiFlexGroup: _ref17,
|
|
170
|
-
responsive: /*#__PURE__*/css(euiBreakpoint(euiThemeContext, ['xs', 's']), "{flex-wrap:wrap
|
|
170
|
+
responsive: /*#__PURE__*/css(euiBreakpoint(euiThemeContext, ['xs', 's']), "{flex-wrap:wrap;&>.euiFlexItem{", logicalCSS('width', '100%'), " flex-basis:100%;}};label:responsive;"),
|
|
171
171
|
wrap: _ref16,
|
|
172
172
|
gutterSizes: {
|
|
173
173
|
none: /*#__PURE__*/css(";label:none;"),
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
var _excluded = ["children"];
|
|
2
|
+
|
|
3
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
+
|
|
5
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
|
+
|
|
7
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
8
|
+
|
|
9
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
|
+
|
|
11
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
12
|
+
|
|
13
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
14
|
+
|
|
15
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
|
+
|
|
17
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
18
|
+
|
|
19
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
20
|
+
|
|
21
|
+
/*
|
|
22
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
23
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
24
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
25
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
26
|
+
* Side Public License, v 1.
|
|
27
|
+
*/
|
|
28
|
+
/// <reference types="../../../cypress/support"/>
|
|
29
|
+
import React, { useState } from 'react';
|
|
30
|
+
import { EuiFlyout } from './flyout';
|
|
31
|
+
import { EuiButtonEmpty } from '../button';
|
|
32
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
33
|
+
|
|
34
|
+
var childrenDefault = ___EmotionJSX(React.Fragment, null, ___EmotionJSX("button", {
|
|
35
|
+
"data-test-subj": "itemA"
|
|
36
|
+
}, "Item A"), ___EmotionJSX("button", {
|
|
37
|
+
"data-test-subj": "itemB"
|
|
38
|
+
}, "Item B"), ___EmotionJSX("button", {
|
|
39
|
+
"data-test-subj": "itemC"
|
|
40
|
+
}, "Item C"), ___EmotionJSX("input", {
|
|
41
|
+
"data-test-subj": "itemD"
|
|
42
|
+
}));
|
|
43
|
+
|
|
44
|
+
var Flyout = function Flyout(_ref) {
|
|
45
|
+
var _ref$children = _ref.children,
|
|
46
|
+
children = _ref$children === void 0 ? childrenDefault : _ref$children,
|
|
47
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
48
|
+
|
|
49
|
+
var _useState = useState(false),
|
|
50
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
51
|
+
isOpen = _useState2[0],
|
|
52
|
+
setIsOpen = _useState2[1];
|
|
53
|
+
|
|
54
|
+
var onButtonClick = function onButtonClick() {
|
|
55
|
+
return setIsOpen(!isOpen);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
var button = ___EmotionJSX(EuiButtonEmpty, {
|
|
59
|
+
onClick: onButtonClick
|
|
60
|
+
}, "Toggle flyout");
|
|
61
|
+
|
|
62
|
+
return ___EmotionJSX("div", null, button, isOpen ? ___EmotionJSX(EuiFlyout, _extends({
|
|
63
|
+
"data-test-subj": "flyoutSpec",
|
|
64
|
+
onClose: function onClose() {
|
|
65
|
+
return setIsOpen(false);
|
|
66
|
+
}
|
|
67
|
+
}, rest), children) : null);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
beforeEach(function () {
|
|
71
|
+
cy.mount(___EmotionJSX(Flyout, null));
|
|
72
|
+
cy.get('div.euiFlyout').should('not.exist');
|
|
73
|
+
});
|
|
74
|
+
describe('EuiFlyout', function () {
|
|
75
|
+
describe('Automated accessibility check', function () {
|
|
76
|
+
it('has zero violations on render', function () {
|
|
77
|
+
cy.checkAxe();
|
|
78
|
+
});
|
|
79
|
+
it('has zero violations when flyout is opened', function () {
|
|
80
|
+
cy.get('button.euiButtonEmpty').click();
|
|
81
|
+
cy.get('div.euiFlyout').should('exist');
|
|
82
|
+
cy.checkAxe();
|
|
83
|
+
});
|
|
84
|
+
it('has zero violations when flyout is closed', function () {
|
|
85
|
+
cy.get('button.euiButtonEmpty').click();
|
|
86
|
+
cy.get('div.euiFlyout').should('exist');
|
|
87
|
+
cy.get('button.euiFlyout__closeButton').click();
|
|
88
|
+
cy.get('div.euiFlyout').should('not.exist');
|
|
89
|
+
cy.checkAxe();
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
});
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
var _templateObject;
|
|
2
|
-
|
|
3
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
4
|
-
|
|
5
1
|
/*
|
|
6
2
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
7
3
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -9,18 +5,14 @@ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(
|
|
|
9
5
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
10
6
|
* Side Public License, v 1.
|
|
11
7
|
*/
|
|
12
|
-
import { css
|
|
13
|
-
import { logicalCSS, logicalTextAlignCSS, euiCanAnimate } from '../../global_styling';
|
|
8
|
+
import { css } from '@emotion/react';
|
|
9
|
+
import { logicalCSS, logicalTextAlignCSS, euiCanAnimate, euiAnimSlideInUp } from '../../global_styling';
|
|
14
10
|
export var euiImageFullscreenWrapperStyles = function euiImageFullscreenWrapperStyles(euiThemeContext) {
|
|
15
11
|
var euiTheme = euiThemeContext.euiTheme;
|
|
16
12
|
return {
|
|
17
13
|
// Base
|
|
18
|
-
euiImageFullscreenWrapper: /*#__PURE__*/css(logicalCSS('max-height', '80vh'), ";", logicalCSS('max-width', '80vw'), ";", logicalTextAlignCSS('center'), ";line-height:0;", euiCanAnimate, "{animation:",
|
|
14
|
+
euiImageFullscreenWrapper: /*#__PURE__*/css(logicalCSS('max-height', '80vh'), ";", logicalCSS('max-width', '80vw'), ";", logicalTextAlignCSS('center'), ";line-height:0;", euiCanAnimate, "{animation:", euiAnimSlideInUp(euiTheme.size.xxxxl), " ", euiTheme.animation.extraSlow, " ", euiTheme.animation.bounce, ";}&:hover [class*='euiImageCaption']{text-decoration:underline;};label:euiImageFullscreenWrapper;"),
|
|
19
15
|
// Sizes
|
|
20
16
|
fullWidth: /*#__PURE__*/css(logicalCSS('width', '100%'), ";;label:fullWidth;")
|
|
21
17
|
};
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
var euiImageFullScreen = function euiImageFullScreen(size) {
|
|
25
|
-
return keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n 0% {\n opacity: 0;\n transform: translateY(", ");\n }\n\n 100% {\n opacity: 1;\n transform: translateY(0);\n }\n"])), size);
|
|
26
18
|
};
|
|
@@ -33,6 +33,8 @@ import { EuiModalFooter } from './modal_footer';
|
|
|
33
33
|
import { EuiModalHeader } from './modal_header';
|
|
34
34
|
import { EuiModalHeaderTitle } from './modal_header_title';
|
|
35
35
|
import { EuiModalBody } from './modal_body';
|
|
36
|
+
import { useEuiTheme } from '../../services';
|
|
37
|
+
import { euiModalStyles } from './modal.styles';
|
|
36
38
|
import { EuiButton, EuiButtonEmpty } from '../button';
|
|
37
39
|
import { EuiText } from '../text';
|
|
38
40
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
@@ -86,6 +88,9 @@ export var EuiConfirmModal = function EuiConfirmModal(_ref) {
|
|
|
86
88
|
};
|
|
87
89
|
|
|
88
90
|
var classes = classnames('euiModal--confirmation', className);
|
|
91
|
+
var euiTheme = useEuiTheme();
|
|
92
|
+
var styles = euiModalStyles(euiTheme);
|
|
93
|
+
var cssStyles = [styles.confirmation];
|
|
89
94
|
var modalTitle;
|
|
90
95
|
|
|
91
96
|
if (title) {
|
|
@@ -104,6 +109,7 @@ export var EuiConfirmModal = function EuiConfirmModal(_ref) {
|
|
|
104
109
|
|
|
105
110
|
return ___EmotionJSX(EuiModal, _extends({
|
|
106
111
|
className: classes,
|
|
112
|
+
css: cssStyles,
|
|
107
113
|
onClose: onCancel
|
|
108
114
|
}, rest), modalTitle, message && ___EmotionJSX(EuiModalBody, null, ___EmotionJSX(EuiText, {
|
|
109
115
|
"data-test-subj": "confirmModalBodyText"
|
|
@@ -133,6 +139,11 @@ EuiConfirmModal.propTypes = {
|
|
|
133
139
|
onConfirm: PropTypes.func,
|
|
134
140
|
confirmButtonDisabled: PropTypes.bool,
|
|
135
141
|
className: PropTypes.string,
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Allows focusing either the confirm or cancel button on modal initialization.
|
|
145
|
+
* Will take precedence over `initialFocus`, if `initialFocus` is passed.
|
|
146
|
+
*/
|
|
136
147
|
defaultFocusedButton: PropTypes.oneOfType([PropTypes.any.isRequired, PropTypes.any.isRequired]),
|
|
137
148
|
buttonColor: PropTypes.oneOfType([PropTypes.any.isRequired, PropTypes.oneOf(["ghost"])]),
|
|
138
149
|
// For docs only, will get passed with ...rest
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
|
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
|
|
5
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
+
|
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
8
|
+
|
|
9
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
10
|
+
|
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
+
|
|
13
|
+
/*
|
|
14
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
15
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
16
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
17
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
18
|
+
* Side Public License, v 1.
|
|
19
|
+
*/
|
|
20
|
+
/// <reference types="../../../cypress/support"/>
|
|
21
|
+
import React, { useState } from 'react';
|
|
22
|
+
import { EuiModal, EuiModalHeader, EuiModalHeaderTitle, EuiModalBody, EuiModalFooter } from './index';
|
|
23
|
+
import { EuiButton } from '../button';
|
|
24
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
25
|
+
|
|
26
|
+
var Modal = function Modal() {
|
|
27
|
+
var _useState = useState(false),
|
|
28
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
29
|
+
isModalVisible = _useState2[0],
|
|
30
|
+
setIsModalVisible = _useState2[1];
|
|
31
|
+
|
|
32
|
+
var closeModal = function closeModal() {
|
|
33
|
+
return setIsModalVisible(false);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
var showModal = function showModal() {
|
|
37
|
+
return setIsModalVisible(true);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
var modalProps = {
|
|
41
|
+
title: 'Do this thing',
|
|
42
|
+
onClose: closeModal,
|
|
43
|
+
children: React
|
|
44
|
+
};
|
|
45
|
+
return ___EmotionJSX("div", null, ___EmotionJSX(EuiButton, {
|
|
46
|
+
onClick: showModal
|
|
47
|
+
}, "Show confirm modal"), isModalVisible && ___EmotionJSX(EuiModal, modalProps, ___EmotionJSX(EuiModalHeader, null, ___EmotionJSX(EuiModalHeaderTitle, null, ___EmotionJSX("h1", null, "Title of modal"))), ___EmotionJSX(EuiModalBody, null, ___EmotionJSX("p", null, "This is a simple modal body")), ___EmotionJSX(EuiModalFooter, null, ___EmotionJSX(EuiButton, {
|
|
48
|
+
onClick: closeModal,
|
|
49
|
+
fill: true
|
|
50
|
+
}, "Close"))));
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
beforeEach(function () {
|
|
54
|
+
cy.mount(___EmotionJSX(Modal, null));
|
|
55
|
+
cy.get('div.euiModal').should('not.exist');
|
|
56
|
+
cy.get('button.euiButton').click();
|
|
57
|
+
cy.get('div.euiModal').should('exist');
|
|
58
|
+
});
|
|
59
|
+
describe('EuiModal', function () {
|
|
60
|
+
describe('Automated accessibility check', function () {
|
|
61
|
+
it('has zero violations when modal is open', function () {
|
|
62
|
+
cy.checkAxe();
|
|
63
|
+
});
|
|
64
|
+
it('has zero violations when modal is closed', function () {
|
|
65
|
+
cy.get('div.euiModalFooter button.euiButton').click();
|
|
66
|
+
cy.get('div.euiModal').should('not.exist');
|
|
67
|
+
cy.checkAxe();
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
});
|
|
@@ -19,14 +19,15 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
19
19
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
20
20
|
* Side Public License, v 1.
|
|
21
21
|
*/
|
|
22
|
-
import React
|
|
22
|
+
import React from 'react';
|
|
23
23
|
import PropTypes from "prop-types";
|
|
24
24
|
import classnames from 'classnames';
|
|
25
|
-
import { keys } from '../../services';
|
|
25
|
+
import { keys, useEuiTheme } from '../../services';
|
|
26
26
|
import { EuiButtonIcon } from '../button';
|
|
27
27
|
import { EuiFocusTrap } from '../focus_trap';
|
|
28
28
|
import { EuiOverlayMask } from '../overlay_mask';
|
|
29
29
|
import { EuiI18n } from '../i18n';
|
|
30
|
+
import { euiModalStyles } from './modal.styles';
|
|
30
31
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
31
32
|
export var EuiModal = function EuiModal(_ref) {
|
|
32
33
|
var className = _ref.className,
|
|
@@ -38,19 +39,6 @@ export var EuiModal = function EuiModal(_ref) {
|
|
|
38
39
|
style = _ref.style,
|
|
39
40
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
40
41
|
|
|
41
|
-
// TODO: Remove this onFocus scroll workaround after react-focus-on supports focusOptions
|
|
42
|
-
// @see https://github.com/elastic/eui/issues/6304
|
|
43
|
-
var bodyScrollTop = useRef(typeof window === 'undefined' ? undefined : window.scrollY // Account for SSR
|
|
44
|
-
);
|
|
45
|
-
var onFocus = useCallback(function () {
|
|
46
|
-
if (bodyScrollTop.current != null) {
|
|
47
|
-
window.scrollTo({
|
|
48
|
-
top: bodyScrollTop.current
|
|
49
|
-
});
|
|
50
|
-
bodyScrollTop.current = undefined; // Unset after first auto focus
|
|
51
|
-
}
|
|
52
|
-
}, []);
|
|
53
|
-
|
|
54
42
|
var onKeyDown = function onKeyDown(event) {
|
|
55
43
|
if (event.key === keys.ESCAPE) {
|
|
56
44
|
event.preventDefault();
|
|
@@ -59,28 +47,29 @@ export var EuiModal = function EuiModal(_ref) {
|
|
|
59
47
|
}
|
|
60
48
|
};
|
|
61
49
|
|
|
62
|
-
var newStyle;
|
|
63
|
-
var widthClassName;
|
|
50
|
+
var newStyle = style;
|
|
64
51
|
|
|
65
|
-
if (maxWidth
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
var value = typeof maxWidth === 'number' ? "".concat(maxWidth, "px") : maxWidth;
|
|
69
|
-
newStyle = _objectSpread(_objectSpread({}, style), {}, {
|
|
70
|
-
maxWidth: value
|
|
52
|
+
if (typeof maxWidth !== 'boolean') {
|
|
53
|
+
newStyle = _objectSpread(_objectSpread({}, newStyle), {}, {
|
|
54
|
+
maxInlineSize: maxWidth
|
|
71
55
|
});
|
|
72
56
|
}
|
|
73
57
|
|
|
74
|
-
var classes = classnames('euiModal',
|
|
58
|
+
var classes = classnames('euiModal', className);
|
|
59
|
+
var euiTheme = useEuiTheme();
|
|
60
|
+
var styles = euiModalStyles(euiTheme);
|
|
61
|
+
var cssStyles = [styles.euiModal, maxWidth === true && styles.defaultMaxWidth];
|
|
62
|
+
var cssCloseIconStyles = [styles.euiModal__closeIcon];
|
|
75
63
|
return ___EmotionJSX(EuiOverlayMask, null, ___EmotionJSX(EuiFocusTrap, {
|
|
76
64
|
initialFocus: initialFocus,
|
|
77
|
-
scrollLock: true
|
|
65
|
+
scrollLock: true,
|
|
66
|
+
preventScrollOnFocus: true
|
|
78
67
|
}, ___EmotionJSX("div", _extends({
|
|
68
|
+
css: cssStyles,
|
|
79
69
|
className: classes,
|
|
80
70
|
onKeyDown: onKeyDown,
|
|
81
71
|
tabIndex: 0,
|
|
82
|
-
|
|
83
|
-
style: newStyle || style
|
|
72
|
+
style: newStyle
|
|
84
73
|
}, rest), ___EmotionJSX(EuiI18n, {
|
|
85
74
|
token: "euiModal.closeModal",
|
|
86
75
|
default: "Closes this modal window"
|
|
@@ -88,6 +77,7 @@ export var EuiModal = function EuiModal(_ref) {
|
|
|
88
77
|
return ___EmotionJSX(EuiButtonIcon, {
|
|
89
78
|
iconType: "cross",
|
|
90
79
|
onClick: onClose,
|
|
80
|
+
css: cssCloseIconStyles,
|
|
91
81
|
className: "euiModal__closeIcon",
|
|
92
82
|
color: "text",
|
|
93
83
|
"aria-label": closeModal
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
5
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
6
|
+
* Side Public License, v 1.
|
|
7
|
+
*/
|
|
8
|
+
import { css } from '@emotion/react';
|
|
9
|
+
import { euiShadowXLarge } from '../../themes/amsterdam/global_styling/mixins';
|
|
10
|
+
import { euiCanAnimate, euiBreakpoint, euiAnimSlideInUp } from '../../global_styling';
|
|
11
|
+
import { euiFormVariables } from '../form/form.styles';
|
|
12
|
+
export var euiModalStyles = function euiModalStyles(euiThemeContext) {
|
|
13
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
14
|
+
return {
|
|
15
|
+
euiModal: /*#__PURE__*/css(euiShadowXLarge(euiThemeContext), " display:flex;flex-direction:column;max-block-size:75vh;position:relative;background-color:", euiTheme.colors.emptyShade, ";border-radius:", euiTheme.border.radius.medium, ";z-index:", euiTheme.levels.modal, ";min-inline-size:", euiFormVariables(euiThemeContext).maxWidth, ";max-inline-size:calc(100vw - ", euiTheme.size.base, ");", euiCanAnimate, "{animation:", euiAnimSlideInUp(euiTheme.size.xxl), " ", euiTheme.animation.slow, " ", euiTheme.animation.bounce, ";}", euiBreakpoint(euiThemeContext, ['xs', 's']), "{position:fixed;inset:0;border-radius:0;inline-size:100vw!important;min-inline-size:0!important;max-inline-size:none!important;max-block-size:100vh!important;}&:focus{outline:none;};label:euiModal;"),
|
|
16
|
+
// Variants
|
|
17
|
+
defaultMaxWidth: /*#__PURE__*/css("max-inline-size:min(\n ", euiTheme.breakpoint.m, "px,\n calc(100vw - ", euiTheme.size.base, ")\n );;label:defaultMaxWidth;"),
|
|
18
|
+
confirmation: /*#__PURE__*/css("min-inline-size:", euiFormVariables(euiThemeContext).maxWidth, ";", euiBreakpoint(euiThemeContext, ['xs', 's']), "{", euiShadowXLarge(euiThemeContext, {
|
|
19
|
+
reverse: true
|
|
20
|
+
}), " inset-block-start:auto;};label:confirmation;"),
|
|
21
|
+
euiModal__closeIcon: /*#__PURE__*/css("position:absolute;inset-inline-end:", euiTheme.size.xs, ";inset-block-start:", euiTheme.size.xs, ";z-index:3;;label:euiModal__closeIcon;")
|
|
22
|
+
};
|
|
23
|
+
};
|
|
@@ -16,6 +16,8 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
16
16
|
import React from 'react';
|
|
17
17
|
import PropTypes from "prop-types";
|
|
18
18
|
import classnames from 'classnames';
|
|
19
|
+
import { useEuiTheme } from '../../services';
|
|
20
|
+
import { euiModalBodyStyles } from './modal_body.styles';
|
|
19
21
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
20
22
|
export var EuiModalBody = function EuiModalBody(_ref) {
|
|
21
23
|
var className = _ref.className,
|
|
@@ -23,9 +25,15 @@ export var EuiModalBody = function EuiModalBody(_ref) {
|
|
|
23
25
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
24
26
|
|
|
25
27
|
var classes = classnames('euiModalBody', className);
|
|
28
|
+
var euiTheme = useEuiTheme();
|
|
29
|
+
var styles = euiModalBodyStyles(euiTheme);
|
|
30
|
+
var cssStyles = [styles.euiModalBody];
|
|
31
|
+
var cssOverflowStyles = [styles.euiModalBody__overflow];
|
|
26
32
|
return ___EmotionJSX("div", _extends({
|
|
33
|
+
css: cssStyles,
|
|
27
34
|
className: classes
|
|
28
35
|
}, rest), ___EmotionJSX("div", {
|
|
36
|
+
css: cssOverflowStyles,
|
|
29
37
|
className: "euiModalBody__overflow"
|
|
30
38
|
}, children));
|
|
31
39
|
};
|