@elastic/eui 70.2.4 → 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/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/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/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/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/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
package/i18ntokens.json
CHANGED
|
@@ -93,15 +93,16 @@ var EuiSkipLink = function EuiSkipLink(_ref) {
|
|
|
93
93
|
|
|
94
94
|
setHasValidId(false); // If no valid element via ID is available, use the fallback query selectors
|
|
95
95
|
|
|
96
|
-
|
|
96
|
+
if (fallbackDestination) {
|
|
97
|
+
var fallbackEl = document.querySelector(fallbackDestination);
|
|
97
98
|
|
|
98
|
-
|
|
99
|
-
|
|
99
|
+
if (fallbackEl) {
|
|
100
|
+
setDestinationEl(fallbackEl);
|
|
101
|
+
}
|
|
100
102
|
}
|
|
101
103
|
}, [destinationId, fallbackDestination]);
|
|
102
104
|
var onClick = (0, _react.useCallback)(function (e) {
|
|
103
|
-
if (overrideLinkBehavior || !hasValidId) {
|
|
104
|
-
if (!destinationEl) return;
|
|
105
|
+
if ((overrideLinkBehavior || !hasValidId) && destinationEl) {
|
|
105
106
|
e.preventDefault(); // Scroll to the top of the destination content only if it's ~mostly out of view
|
|
106
107
|
|
|
107
108
|
var destinationY = destinationEl.getBoundingClientRect().top;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.SIZES = exports.EuiBetaBadge = exports.COLORS = void 0;
|
|
6
|
+
exports.SIZES = exports.EuiBetaBadge = exports.COLORS = exports.ALIGNMENTS = void 0;
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
|
@@ -21,7 +21,7 @@ var _beta_badge = require("./beta_badge.styles");
|
|
|
21
21
|
|
|
22
22
|
var _react2 = require("@emotion/react");
|
|
23
23
|
|
|
24
|
-
var _excluded = ["className", "label", "color", "tooltipContent", "tooltipPosition", "anchorProps", "title", "iconType", "onClick", "onClickAriaLabel", "href", "rel", "target", "size"];
|
|
24
|
+
var _excluded = ["className", "label", "color", "tooltipContent", "tooltipPosition", "anchorProps", "title", "iconType", "onClick", "onClickAriaLabel", "href", "rel", "target", "size", "alignment"];
|
|
25
25
|
|
|
26
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
27
|
|
|
@@ -37,6 +37,8 @@ var COLORS = ['accent', 'subdued', 'hollow'];
|
|
|
37
37
|
exports.COLORS = COLORS;
|
|
38
38
|
var SIZES = ['s', 'm'];
|
|
39
39
|
exports.SIZES = SIZES;
|
|
40
|
+
var ALIGNMENTS = ['baseline', 'middle'];
|
|
41
|
+
exports.ALIGNMENTS = ALIGNMENTS;
|
|
40
42
|
|
|
41
43
|
var EuiBetaBadge = function EuiBetaBadge(_ref) {
|
|
42
44
|
var className = _ref.className,
|
|
@@ -56,6 +58,8 @@ var EuiBetaBadge = function EuiBetaBadge(_ref) {
|
|
|
56
58
|
target = _ref.target,
|
|
57
59
|
_ref$size = _ref.size,
|
|
58
60
|
size = _ref$size === void 0 ? 'm' : _ref$size,
|
|
61
|
+
_ref$alignment = _ref.alignment,
|
|
62
|
+
alignment = _ref$alignment === void 0 ? 'baseline' : _ref$alignment,
|
|
59
63
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
60
64
|
|
|
61
65
|
var euiTheme = (0, _services.useEuiTheme)();
|
|
@@ -63,7 +67,7 @@ var EuiBetaBadge = function EuiBetaBadge(_ref) {
|
|
|
63
67
|
var isCircular = iconType || singleLetter;
|
|
64
68
|
var classes = (0, _classnames.default)('euiBetaBadge', className);
|
|
65
69
|
var styles = (0, _beta_badge.euiBetaBadgeStyles)(euiTheme);
|
|
66
|
-
var cssStyles = [styles.euiBetaBadge, styles[color], styles[size], isCircular ? styles.badgeSizes.circle[size] : styles.badgeSizes.default[size]];
|
|
70
|
+
var cssStyles = [styles.euiBetaBadge, styles[color], styles[size], styles[alignment], isCircular ? styles.badgeSizes.circle[size] : styles.badgeSizes.default[size]];
|
|
67
71
|
var icon;
|
|
68
72
|
|
|
69
73
|
if (iconType) {
|
|
@@ -208,5 +212,10 @@ EuiBetaBadge.propTypes = {
|
|
|
208
212
|
* Accepts accent, subdued and hollow.
|
|
209
213
|
*/
|
|
210
214
|
color: _propTypes.default.any,
|
|
211
|
-
size: _propTypes.default.any
|
|
215
|
+
size: _propTypes.default.any,
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Sets the `vertical-align` CSS property
|
|
219
|
+
*/
|
|
220
|
+
alignment: _propTypes.default.any
|
|
212
221
|
};
|
|
@@ -26,6 +26,24 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
26
26
|
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)."; }
|
|
27
27
|
|
|
28
28
|
var _ref = process.env.NODE_ENV === "production" ? {
|
|
29
|
+
name: "l1nme7-middle",
|
|
30
|
+
styles: "vertical-align:middle;label:middle;"
|
|
31
|
+
} : {
|
|
32
|
+
name: "l1nme7-middle",
|
|
33
|
+
styles: "vertical-align:middle;label:middle;",
|
|
34
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
var _ref2 = process.env.NODE_ENV === "production" ? {
|
|
38
|
+
name: "19hexhy-baseline",
|
|
39
|
+
styles: "vertical-align:baseline;label:baseline;"
|
|
40
|
+
} : {
|
|
41
|
+
name: "19hexhy-baseline",
|
|
42
|
+
styles: "vertical-align:baseline;label:baseline;",
|
|
43
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
var _ref3 = process.env.NODE_ENV === "production" ? {
|
|
29
47
|
name: "pzpqqg-euiBetaBadge__icon",
|
|
30
48
|
styles: "position:relative;transform:translate(0, -1px);label:euiBetaBadge__icon;"
|
|
31
49
|
} : {
|
|
@@ -38,7 +56,7 @@ var euiBetaBadgeStyles = function euiBetaBadgeStyles(euiThemeContext) {
|
|
|
38
56
|
var euiTheme = euiThemeContext.euiTheme,
|
|
39
57
|
colorMode = euiThemeContext.colorMode;
|
|
40
58
|
return {
|
|
41
|
-
euiBetaBadge: /*#__PURE__*/(0, _react.css)("display:inline-block;
|
|
59
|
+
euiBetaBadge: /*#__PURE__*/(0, _react.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;", (0, _global_styling.euiTextTruncate)(), " &:focus{", (0, _global_styling.euiFocusRing)(euiThemeContext, 'outset', {
|
|
42
60
|
color: colorMode === 'DARK' ? euiTheme.colors.ghost : euiTheme.colors.ink
|
|
43
61
|
}), ";};label:euiBetaBadge;"),
|
|
44
62
|
// Colors
|
|
@@ -64,15 +82,18 @@ var euiBetaBadgeStyles = function euiBetaBadgeStyles(euiThemeContext) {
|
|
|
64
82
|
})), "\n ")
|
|
65
83
|
}
|
|
66
84
|
},
|
|
67
|
-
euiBetaBadge__icon:
|
|
85
|
+
euiBetaBadge__icon: _ref3,
|
|
86
|
+
// Alignments
|
|
87
|
+
baseline: _ref2,
|
|
88
|
+
middle: _ref
|
|
68
89
|
};
|
|
69
90
|
}; // Util for detecting text color based on badge bg color
|
|
70
91
|
|
|
71
92
|
|
|
72
93
|
exports.euiBetaBadgeStyles = euiBetaBadgeStyles;
|
|
73
94
|
|
|
74
|
-
var getBadgeColors = function getBadgeColors(backgroundColor,
|
|
75
|
-
var euiTheme =
|
|
95
|
+
var getBadgeColors = function getBadgeColors(backgroundColor, _ref4) {
|
|
96
|
+
var euiTheme = _ref4.euiTheme;
|
|
76
97
|
var textColor = _services.isColorDark.apply(void 0, _toConsumableArray((0, _services.hexToRgb)(backgroundColor))) ? euiTheme.colors.ghost : euiTheme.colors.ink;
|
|
77
98
|
return "\n background-color: ".concat(backgroundColor, ";\n color: ").concat(textColor, ";\n ");
|
|
78
99
|
};
|
|
@@ -448,7 +448,12 @@ EuiCard.propTypes = {
|
|
|
448
448
|
* Accepts accent, subdued and hollow.
|
|
449
449
|
*/
|
|
450
450
|
color: _propTypes.default.any,
|
|
451
|
-
size: _propTypes.default.any
|
|
451
|
+
size: _propTypes.default.any,
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* Sets the `vertical-align` CSS property
|
|
455
|
+
*/
|
|
456
|
+
alignment: _propTypes.default.any
|
|
452
457
|
}),
|
|
453
458
|
|
|
454
459
|
/**
|
|
@@ -58,11 +58,11 @@ var _ref5 = process.env.NODE_ENV === "production" ? {
|
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
var _ref6 = process.env.NODE_ENV === "production" ? {
|
|
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
|
} : {
|
|
64
|
-
name: "
|
|
65
|
-
styles: "display:flex;label:euiCard__main;",
|
|
64
|
+
name: "31kq8f-euiCard__main",
|
|
65
|
+
styles: "display:flex;inline-size:100%;label:euiCard__main;",
|
|
66
66
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
67
67
|
};
|
|
68
68
|
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
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
|
+
|
|
5
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
6
|
+
|
|
7
|
+
var _super_date_picker = require("./super_date_picker");
|
|
8
|
+
|
|
9
|
+
var _react2 = require("@emotion/react");
|
|
10
|
+
|
|
11
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
|
+
|
|
13
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
|
+
|
|
15
|
+
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); }
|
|
16
|
+
|
|
17
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
18
|
+
|
|
19
|
+
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."); }
|
|
20
|
+
|
|
21
|
+
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); }
|
|
22
|
+
|
|
23
|
+
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; }
|
|
24
|
+
|
|
25
|
+
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; }
|
|
26
|
+
|
|
27
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
28
|
+
|
|
29
|
+
var SuperDatePicker = function SuperDatePicker() {
|
|
30
|
+
var _useState = (0, _react.useState)(false),
|
|
31
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
32
|
+
isLoading = _useState2[0],
|
|
33
|
+
setIsLoading = _useState2[1];
|
|
34
|
+
|
|
35
|
+
var _useState3 = (0, _react.useState)(true),
|
|
36
|
+
_useState4 = _slicedToArray(_useState3, 1),
|
|
37
|
+
showUpdateButton = _useState4[0];
|
|
38
|
+
|
|
39
|
+
var _useState5 = (0, _react.useState)('now-30m'),
|
|
40
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
41
|
+
start = _useState6[0],
|
|
42
|
+
setStart = _useState6[1];
|
|
43
|
+
|
|
44
|
+
var _useState7 = (0, _react.useState)('now'),
|
|
45
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
46
|
+
end = _useState8[0],
|
|
47
|
+
setEnd = _useState8[1];
|
|
48
|
+
|
|
49
|
+
var _useState9 = (0, _react.useState)(true),
|
|
50
|
+
_useState10 = _slicedToArray(_useState9, 1),
|
|
51
|
+
showFill = _useState10[0];
|
|
52
|
+
|
|
53
|
+
var onTimeChange = function onTimeChange(_ref) {
|
|
54
|
+
var start = _ref.start,
|
|
55
|
+
end = _ref.end;
|
|
56
|
+
setStart(start);
|
|
57
|
+
setEnd(end);
|
|
58
|
+
setIsLoading(true);
|
|
59
|
+
startLoading();
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
var startLoading = function startLoading() {
|
|
63
|
+
setTimeout(stopLoading, 1000);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
var stopLoading = function stopLoading() {
|
|
67
|
+
setIsLoading(false);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
var datepickerProps = {
|
|
71
|
+
isLoading: isLoading,
|
|
72
|
+
start: start,
|
|
73
|
+
end: end,
|
|
74
|
+
onTimeChange: onTimeChange,
|
|
75
|
+
showUpdateButton: showUpdateButton
|
|
76
|
+
};
|
|
77
|
+
return (0, _react2.jsx)(_super_date_picker.EuiSuperDatePicker, _extends({}, datepickerProps, {
|
|
78
|
+
updateButtonProps: {
|
|
79
|
+
fill: showFill
|
|
80
|
+
}
|
|
81
|
+
}));
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
beforeEach(function () {
|
|
85
|
+
cy.mount((0, _react2.jsx)(SuperDatePicker, null));
|
|
86
|
+
cy.get('div.euiSuperDatePicker__flexWrapper').should('exist');
|
|
87
|
+
});
|
|
88
|
+
describe('EuiSuperDatePicker', function () {
|
|
89
|
+
describe('Automated accessibility check', function () {
|
|
90
|
+
it('has zero violations on render', function () {
|
|
91
|
+
cy.checkAxe();
|
|
92
|
+
});
|
|
93
|
+
it('has zero violations when quick select menu is open', function () {
|
|
94
|
+
cy.get('button.euiFormControlLayout__prepend').click();
|
|
95
|
+
cy.get('div.euiPanel').contains('Quick select').should('exist');
|
|
96
|
+
cy.checkAxe();
|
|
97
|
+
});
|
|
98
|
+
it('has zero violations when start / end date menus are open', function () {
|
|
99
|
+
cy.get('button.euiSuperDatePicker__prettyFormat').click();
|
|
100
|
+
cy.get('div.euiDatePopoverContent').should('exist');
|
|
101
|
+
cy.checkAxe();
|
|
102
|
+
cy.get('button.euiDatePopoverButton--start').click();
|
|
103
|
+
cy.get('button.euiDatePopoverButton--end').click();
|
|
104
|
+
cy.get('div.euiDatePopoverContent').should('exist');
|
|
105
|
+
cy.checkAxe();
|
|
106
|
+
cy.get('button.euiDatePopoverButton--end').click();
|
|
107
|
+
cy.get('div.euiDatePopoverContent').should('not.exist');
|
|
108
|
+
cy.checkAxe();
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
});
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
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
|
+
|
|
5
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
6
|
+
|
|
7
|
+
var _flyout = require("./flyout");
|
|
8
|
+
|
|
9
|
+
var _button = require("../button");
|
|
10
|
+
|
|
11
|
+
var _react2 = require("@emotion/react");
|
|
12
|
+
|
|
13
|
+
var _excluded = ["children"];
|
|
14
|
+
|
|
15
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
|
+
|
|
17
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
18
|
+
|
|
19
|
+
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); }
|
|
20
|
+
|
|
21
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
22
|
+
|
|
23
|
+
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."); }
|
|
24
|
+
|
|
25
|
+
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); }
|
|
26
|
+
|
|
27
|
+
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; }
|
|
28
|
+
|
|
29
|
+
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; }
|
|
30
|
+
|
|
31
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
32
|
+
|
|
33
|
+
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; }
|
|
34
|
+
|
|
35
|
+
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; }
|
|
36
|
+
|
|
37
|
+
var childrenDefault = (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)("button", {
|
|
38
|
+
"data-test-subj": "itemA"
|
|
39
|
+
}, "Item A"), (0, _react2.jsx)("button", {
|
|
40
|
+
"data-test-subj": "itemB"
|
|
41
|
+
}, "Item B"), (0, _react2.jsx)("button", {
|
|
42
|
+
"data-test-subj": "itemC"
|
|
43
|
+
}, "Item C"), (0, _react2.jsx)("input", {
|
|
44
|
+
"data-test-subj": "itemD"
|
|
45
|
+
}));
|
|
46
|
+
|
|
47
|
+
var Flyout = function Flyout(_ref) {
|
|
48
|
+
var _ref$children = _ref.children,
|
|
49
|
+
children = _ref$children === void 0 ? childrenDefault : _ref$children,
|
|
50
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
51
|
+
|
|
52
|
+
var _useState = (0, _react.useState)(false),
|
|
53
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
54
|
+
isOpen = _useState2[0],
|
|
55
|
+
setIsOpen = _useState2[1];
|
|
56
|
+
|
|
57
|
+
var onButtonClick = function onButtonClick() {
|
|
58
|
+
return setIsOpen(!isOpen);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
var button = (0, _react2.jsx)(_button.EuiButtonEmpty, {
|
|
62
|
+
onClick: onButtonClick
|
|
63
|
+
}, "Toggle flyout");
|
|
64
|
+
return (0, _react2.jsx)("div", null, button, isOpen ? (0, _react2.jsx)(_flyout.EuiFlyout, _extends({
|
|
65
|
+
"data-test-subj": "flyoutSpec",
|
|
66
|
+
onClose: function onClose() {
|
|
67
|
+
return setIsOpen(false);
|
|
68
|
+
}
|
|
69
|
+
}, rest), children) : null);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
beforeEach(function () {
|
|
73
|
+
cy.mount((0, _react2.jsx)(Flyout, null));
|
|
74
|
+
cy.get('div.euiFlyout').should('not.exist');
|
|
75
|
+
});
|
|
76
|
+
describe('EuiFlyout', function () {
|
|
77
|
+
describe('Automated accessibility check', function () {
|
|
78
|
+
it('has zero violations on render', function () {
|
|
79
|
+
cy.checkAxe();
|
|
80
|
+
});
|
|
81
|
+
it('has zero violations when flyout is opened', function () {
|
|
82
|
+
cy.get('button.euiButtonEmpty').click();
|
|
83
|
+
cy.get('div.euiFlyout').should('exist');
|
|
84
|
+
cy.checkAxe();
|
|
85
|
+
});
|
|
86
|
+
it('has zero violations when flyout is closed', function () {
|
|
87
|
+
cy.get('button.euiButtonEmpty').click();
|
|
88
|
+
cy.get('div.euiFlyout').should('exist');
|
|
89
|
+
cy.get('button.euiFlyout__closeButton').click();
|
|
90
|
+
cy.get('div.euiFlyout').should('not.exist');
|
|
91
|
+
cy.checkAxe();
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
});
|
|
@@ -9,22 +9,21 @@ var _react = require("@emotion/react");
|
|
|
9
9
|
|
|
10
10
|
var _global_styling = require("../../global_styling");
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
/*
|
|
13
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
14
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
15
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
16
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
17
|
+
* Side Public License, v 1.
|
|
18
|
+
*/
|
|
16
19
|
var euiImageFullscreenWrapperStyles = function euiImageFullscreenWrapperStyles(euiThemeContext) {
|
|
17
20
|
var euiTheme = euiThemeContext.euiTheme;
|
|
18
21
|
return {
|
|
19
22
|
// Base
|
|
20
|
-
euiImageFullscreenWrapper: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('max-height', '80vh'), ";", (0, _global_styling.logicalCSS)('max-width', '80vw'), ";", (0, _global_styling.logicalTextAlignCSS)('center'), ";line-height:0;", _global_styling.euiCanAnimate, "{animation:",
|
|
23
|
+
euiImageFullscreenWrapper: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('max-height', '80vh'), ";", (0, _global_styling.logicalCSS)('max-width', '80vw'), ";", (0, _global_styling.logicalTextAlignCSS)('center'), ";line-height:0;", _global_styling.euiCanAnimate, "{animation:", (0, _global_styling.euiAnimSlideInUp)(euiTheme.size.xxxxl), " ", euiTheme.animation.extraSlow, " ", euiTheme.animation.bounce, ";}&:hover [class*='euiImageCaption']{text-decoration:underline;};label:euiImageFullscreenWrapper;"),
|
|
21
24
|
// Sizes
|
|
22
25
|
fullWidth: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('width', '100%'), ";;label:fullWidth;")
|
|
23
26
|
};
|
|
24
27
|
};
|
|
25
28
|
|
|
26
|
-
exports.euiImageFullscreenWrapperStyles = euiImageFullscreenWrapperStyles;
|
|
27
|
-
|
|
28
|
-
var euiImageFullScreen = function euiImageFullScreen(size) {
|
|
29
|
-
return (0, _react.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);
|
|
30
|
-
};
|
|
29
|
+
exports.euiImageFullscreenWrapperStyles = euiImageFullscreenWrapperStyles;
|
|
@@ -23,6 +23,10 @@ var _modal_header_title = require("./modal_header_title");
|
|
|
23
23
|
|
|
24
24
|
var _modal_body = require("./modal_body");
|
|
25
25
|
|
|
26
|
+
var _services = require("../../services");
|
|
27
|
+
|
|
28
|
+
var _modal2 = require("./modal.styles");
|
|
29
|
+
|
|
26
30
|
var _button = require("../button");
|
|
27
31
|
|
|
28
32
|
var _text = require("../text");
|
|
@@ -108,6 +112,9 @@ var EuiConfirmModal = function EuiConfirmModal(_ref) {
|
|
|
108
112
|
};
|
|
109
113
|
|
|
110
114
|
var classes = (0, _classnames.default)('euiModal--confirmation', className);
|
|
115
|
+
var euiTheme = (0, _services.useEuiTheme)();
|
|
116
|
+
var styles = (0, _modal2.euiModalStyles)(euiTheme);
|
|
117
|
+
var cssStyles = [styles.confirmation];
|
|
111
118
|
var modalTitle;
|
|
112
119
|
|
|
113
120
|
if (title) {
|
|
@@ -126,6 +133,7 @@ var EuiConfirmModal = function EuiConfirmModal(_ref) {
|
|
|
126
133
|
|
|
127
134
|
return (0, _react2.jsx)(_modal.EuiModal, _extends({
|
|
128
135
|
className: classes,
|
|
136
|
+
css: cssStyles,
|
|
129
137
|
onClose: onCancel
|
|
130
138
|
}, rest), modalTitle, message && (0, _react2.jsx)(_modal_body.EuiModalBody, null, (0, _react2.jsx)(_text.EuiText, {
|
|
131
139
|
"data-test-subj": "confirmModalBodyText"
|
|
@@ -157,6 +165,11 @@ EuiConfirmModal.propTypes = {
|
|
|
157
165
|
onConfirm: _propTypes.default.func,
|
|
158
166
|
confirmButtonDisabled: _propTypes.default.bool,
|
|
159
167
|
className: _propTypes.default.string,
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Allows focusing either the confirm or cancel button on modal initialization.
|
|
171
|
+
* Will take precedence over `initialFocus`, if `initialFocus` is passed.
|
|
172
|
+
*/
|
|
160
173
|
defaultFocusedButton: _propTypes.default.oneOfType([_propTypes.default.any.isRequired, _propTypes.default.any.isRequired]),
|
|
161
174
|
buttonColor: _propTypes.default.oneOfType([_propTypes.default.any.isRequired, _propTypes.default.oneOf(["ghost"])]),
|
|
162
175
|
// For docs only, will get passed with ...rest
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
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
|
+
|
|
5
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
6
|
+
|
|
7
|
+
var _index = require("./index");
|
|
8
|
+
|
|
9
|
+
var _button = require("../button");
|
|
10
|
+
|
|
11
|
+
var _react2 = require("@emotion/react");
|
|
12
|
+
|
|
13
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
|
+
|
|
15
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
16
|
+
|
|
17
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
18
|
+
|
|
19
|
+
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."); }
|
|
20
|
+
|
|
21
|
+
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); }
|
|
22
|
+
|
|
23
|
+
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; }
|
|
24
|
+
|
|
25
|
+
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; }
|
|
26
|
+
|
|
27
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
28
|
+
|
|
29
|
+
var Modal = function Modal() {
|
|
30
|
+
var _useState = (0, _react.useState)(false),
|
|
31
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
32
|
+
isModalVisible = _useState2[0],
|
|
33
|
+
setIsModalVisible = _useState2[1];
|
|
34
|
+
|
|
35
|
+
var closeModal = function closeModal() {
|
|
36
|
+
return setIsModalVisible(false);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
var showModal = function showModal() {
|
|
40
|
+
return setIsModalVisible(true);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
var modalProps = {
|
|
44
|
+
title: 'Do this thing',
|
|
45
|
+
onClose: closeModal,
|
|
46
|
+
children: _react.default
|
|
47
|
+
};
|
|
48
|
+
return (0, _react2.jsx)("div", null, (0, _react2.jsx)(_button.EuiButton, {
|
|
49
|
+
onClick: showModal
|
|
50
|
+
}, "Show confirm modal"), isModalVisible && (0, _react2.jsx)(_index.EuiModal, modalProps, (0, _react2.jsx)(_index.EuiModalHeader, null, (0, _react2.jsx)(_index.EuiModalHeaderTitle, null, (0, _react2.jsx)("h1", null, "Title of modal"))), (0, _react2.jsx)(_index.EuiModalBody, null, (0, _react2.jsx)("p", null, "This is a simple modal body")), (0, _react2.jsx)(_index.EuiModalFooter, null, (0, _react2.jsx)(_button.EuiButton, {
|
|
51
|
+
onClick: closeModal,
|
|
52
|
+
fill: true
|
|
53
|
+
}, "Close"))));
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
beforeEach(function () {
|
|
57
|
+
cy.mount((0, _react2.jsx)(Modal, null));
|
|
58
|
+
cy.get('div.euiModal').should('not.exist');
|
|
59
|
+
cy.get('button.euiButton').click();
|
|
60
|
+
cy.get('div.euiModal').should('exist');
|
|
61
|
+
});
|
|
62
|
+
describe('EuiModal', function () {
|
|
63
|
+
describe('Automated accessibility check', function () {
|
|
64
|
+
it('has zero violations when modal is open', function () {
|
|
65
|
+
cy.checkAxe();
|
|
66
|
+
});
|
|
67
|
+
it('has zero violations when modal is closed', function () {
|
|
68
|
+
cy.get('div.euiModalFooter button.euiButton').click();
|
|
69
|
+
cy.get('div.euiModal').should('not.exist');
|
|
70
|
+
cy.checkAxe();
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
});
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
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
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports.EuiModal = void 0;
|
|
9
7
|
|
|
10
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
9
|
|
|
12
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
11
|
|
|
@@ -23,16 +21,14 @@ var _overlay_mask = require("../overlay_mask");
|
|
|
23
21
|
|
|
24
22
|
var _i18n = require("../i18n");
|
|
25
23
|
|
|
24
|
+
var _modal = require("./modal.styles");
|
|
25
|
+
|
|
26
26
|
var _react2 = require("@emotion/react");
|
|
27
27
|
|
|
28
28
|
var _excluded = ["className", "children", "initialFocus", "onClose", "maxWidth", "style"];
|
|
29
29
|
|
|
30
30
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
31
|
|
|
32
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
33
|
-
|
|
34
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
35
|
-
|
|
36
32
|
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); }
|
|
37
33
|
|
|
38
34
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -55,19 +51,6 @@ var EuiModal = function EuiModal(_ref) {
|
|
|
55
51
|
style = _ref.style,
|
|
56
52
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
57
53
|
|
|
58
|
-
// TODO: Remove this onFocus scroll workaround after react-focus-on supports focusOptions
|
|
59
|
-
// @see https://github.com/elastic/eui/issues/6304
|
|
60
|
-
var bodyScrollTop = (0, _react.useRef)(typeof window === 'undefined' ? undefined : window.scrollY // Account for SSR
|
|
61
|
-
);
|
|
62
|
-
var onFocus = (0, _react.useCallback)(function () {
|
|
63
|
-
if (bodyScrollTop.current != null) {
|
|
64
|
-
window.scrollTo({
|
|
65
|
-
top: bodyScrollTop.current
|
|
66
|
-
});
|
|
67
|
-
bodyScrollTop.current = undefined; // Unset after first auto focus
|
|
68
|
-
}
|
|
69
|
-
}, []);
|
|
70
|
-
|
|
71
54
|
var onKeyDown = function onKeyDown(event) {
|
|
72
55
|
if (event.key === _services.keys.ESCAPE) {
|
|
73
56
|
event.preventDefault();
|
|
@@ -76,28 +59,29 @@ var EuiModal = function EuiModal(_ref) {
|
|
|
76
59
|
}
|
|
77
60
|
};
|
|
78
61
|
|
|
79
|
-
var newStyle;
|
|
80
|
-
var widthClassName;
|
|
62
|
+
var newStyle = style;
|
|
81
63
|
|
|
82
|
-
if (maxWidth
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
var value = typeof maxWidth === 'number' ? "".concat(maxWidth, "px") : maxWidth;
|
|
86
|
-
newStyle = _objectSpread(_objectSpread({}, style), {}, {
|
|
87
|
-
maxWidth: value
|
|
64
|
+
if (typeof maxWidth !== 'boolean') {
|
|
65
|
+
newStyle = _objectSpread(_objectSpread({}, newStyle), {}, {
|
|
66
|
+
maxInlineSize: maxWidth
|
|
88
67
|
});
|
|
89
68
|
}
|
|
90
69
|
|
|
91
|
-
var classes = (0, _classnames.default)('euiModal',
|
|
70
|
+
var classes = (0, _classnames.default)('euiModal', className);
|
|
71
|
+
var euiTheme = (0, _services.useEuiTheme)();
|
|
72
|
+
var styles = (0, _modal.euiModalStyles)(euiTheme);
|
|
73
|
+
var cssStyles = [styles.euiModal, maxWidth === true && styles.defaultMaxWidth];
|
|
74
|
+
var cssCloseIconStyles = [styles.euiModal__closeIcon];
|
|
92
75
|
return (0, _react2.jsx)(_overlay_mask.EuiOverlayMask, null, (0, _react2.jsx)(_focus_trap.EuiFocusTrap, {
|
|
93
76
|
initialFocus: initialFocus,
|
|
94
|
-
scrollLock: true
|
|
77
|
+
scrollLock: true,
|
|
78
|
+
preventScrollOnFocus: true
|
|
95
79
|
}, (0, _react2.jsx)("div", _extends({
|
|
80
|
+
css: cssStyles,
|
|
96
81
|
className: classes,
|
|
97
82
|
onKeyDown: onKeyDown,
|
|
98
83
|
tabIndex: 0,
|
|
99
|
-
|
|
100
|
-
style: newStyle || style
|
|
84
|
+
style: newStyle
|
|
101
85
|
}, rest), (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
102
86
|
token: "euiModal.closeModal",
|
|
103
87
|
default: "Closes this modal window"
|
|
@@ -105,6 +89,7 @@ var EuiModal = function EuiModal(_ref) {
|
|
|
105
89
|
return (0, _react2.jsx)(_button.EuiButtonIcon, {
|
|
106
90
|
iconType: "cross",
|
|
107
91
|
onClick: onClose,
|
|
92
|
+
css: cssCloseIconStyles,
|
|
108
93
|
className: "euiModal__closeIcon",
|
|
109
94
|
color: "text",
|
|
110
95
|
"aria-label": closeModal
|