@elastic/eui 116.0.0 → 116.1.0-snapshot.1779110362015
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/components/accordion/accordion.js +95 -134
- package/es/components/basic_table/basic_table.js +6 -0
- package/es/components/basic_table/in_memory_table.js +6 -0
- package/es/components/color_picker/color_picker_swatch.js +4 -0
- package/es/components/context_menu/context_menu_panel.js +2 -2
- package/es/components/copy/copy.js +36 -13
- package/es/components/datagrid/body/cell/data_grid_cell_popover.js +10 -7
- package/es/components/datagrid/data_grid.styles.js +6 -5
- package/es/components/focus_trap/focus_trap.js +110 -177
- package/es/components/observer/mutation_observer/mutation_observer.js +32 -35
- package/es/components/observer/resize_observer/resize_observer.js +46 -60
- package/es/components/observer/use_observer.js +62 -0
- package/es/components/table/table_header_cell.js +4 -0
- package/es/components/tool_tip/icon_tip.js +4 -0
- package/es/components/tool_tip/tool_tip.js +8 -2
- package/eui.d.ts +26 -69
- package/lib/components/accordion/accordion.js +102 -139
- package/lib/components/basic_table/basic_table.js +6 -0
- package/lib/components/basic_table/in_memory_table.js +6 -0
- package/lib/components/color_picker/color_picker_swatch.js +4 -0
- package/lib/components/context_menu/context_menu_panel.js +2 -2
- package/lib/components/copy/copy.js +35 -12
- package/lib/components/datagrid/body/cell/data_grid_cell_popover.js +10 -7
- package/lib/components/datagrid/data_grid.styles.js +6 -5
- package/lib/components/focus_trap/focus_trap.js +117 -183
- package/lib/components/observer/mutation_observer/mutation_observer.js +32 -34
- package/lib/components/observer/resize_observer/resize_observer.js +48 -61
- package/lib/components/observer/use_observer.js +68 -0
- package/lib/components/table/table_header_cell.js +4 -0
- package/lib/components/tool_tip/icon_tip.js +4 -0
- package/lib/components/tool_tip/tool_tip.js +8 -2
- package/optimize/es/components/accordion/accordion.js +88 -126
- package/optimize/es/components/context_menu/context_menu_panel.js +2 -2
- package/optimize/es/components/copy/copy.js +36 -13
- package/optimize/es/components/datagrid/body/cell/data_grid_cell_popover.js +10 -7
- package/optimize/es/components/datagrid/data_grid.styles.js +6 -5
- package/optimize/es/components/focus_trap/focus_trap.js +103 -122
- package/optimize/es/components/observer/mutation_observer/mutation_observer.js +23 -32
- package/optimize/es/components/observer/resize_observer/resize_observer.js +38 -54
- package/optimize/es/components/observer/use_observer.js +62 -0
- package/optimize/es/components/tool_tip/tool_tip.js +4 -2
- package/optimize/lib/components/accordion/accordion.js +90 -127
- package/optimize/lib/components/context_menu/context_menu_panel.js +2 -2
- package/optimize/lib/components/copy/copy.js +35 -12
- package/optimize/lib/components/datagrid/body/cell/data_grid_cell_popover.js +10 -7
- package/optimize/lib/components/datagrid/data_grid.styles.js +6 -5
- package/optimize/lib/components/focus_trap/focus_trap.js +106 -124
- package/optimize/lib/components/observer/mutation_observer/mutation_observer.js +23 -32
- package/optimize/lib/components/observer/resize_observer/resize_observer.js +40 -54
- package/optimize/lib/components/observer/use_observer.js +68 -0
- package/optimize/lib/components/tool_tip/tool_tip.js +4 -2
- package/package.json +4 -3
- package/test-env/components/accordion/accordion.js +92 -129
- package/test-env/components/basic_table/basic_table.js +6 -0
- package/test-env/components/basic_table/in_memory_table.js +6 -0
- package/test-env/components/color_picker/color_picker_swatch.js +4 -0
- package/test-env/components/context_menu/context_menu_panel.js +2 -2
- package/test-env/components/copy/copy.js +35 -12
- package/test-env/components/datagrid/body/cell/data_grid_cell_popover.js +10 -7
- package/test-env/components/datagrid/data_grid.styles.js +6 -5
- package/test-env/components/observer/mutation_observer/mutation_observer.js +32 -32
- package/test-env/components/observer/use_observer.js +68 -0
- package/test-env/components/table/table_header_cell.js +4 -0
- package/test-env/components/tool_tip/icon_tip.js +4 -0
- package/test-env/components/tool_tip/tool_tip.js +8 -2
- package/es/components/observer/observer.js +0 -75
- package/lib/components/observer/observer.js +0 -79
- package/optimize/es/components/observer/observer.js +0 -69
- package/optimize/lib/components/observer/observer.js +0 -74
- package/test-env/components/observer/observer.js +0 -74
|
@@ -1,21 +1,13 @@
|
|
|
1
|
-
var _excluded = ["children", "className", "id", "role", "element", "buttonElement", "buttonProps", "buttonClassName", "buttonContentClassName", "buttonContent", "arrowDisplay", "arrowProps", "extraAction", "paddingSize", "borders", "initialIsOpen", "forceState", "isLoading", "isLoadingMessage", "isDisabled", "
|
|
2
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
1
|
+
var _excluded = ["children", "className", "id", "role", "element", "buttonElement", "buttonProps", "buttonClassName", "buttonContentClassName", "buttonContent", "arrowDisplay", "arrowProps", "extraAction", "paddingSize", "borders", "initialIsOpen", "forceState", "isLoading", "isLoadingMessage", "isDisabled", "onToggle"];
|
|
3
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
4
|
+
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."); }
|
|
5
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
6
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
7
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
8
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
4
9
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
5
10
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
|
|
6
|
-
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
7
|
-
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
8
|
-
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
9
|
-
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
10
|
-
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
11
|
-
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
12
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
13
|
-
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
14
|
-
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
15
|
-
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
16
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
17
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
18
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
19
11
|
/*
|
|
20
12
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
21
13
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -24,132 +16,102 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
24
16
|
* Side Public License, v 1.
|
|
25
17
|
*/
|
|
26
18
|
|
|
27
|
-
import React, {
|
|
19
|
+
import React, { useState } from 'react';
|
|
28
20
|
import PropTypes from "prop-types";
|
|
29
21
|
import classNames from 'classnames';
|
|
30
|
-
import {
|
|
22
|
+
import { useEuiMemoizedStyles, useGeneratedHtmlId } from '../../services';
|
|
31
23
|
import { EuiLoadingSpinner } from '../loading';
|
|
32
24
|
import { EuiAccordionTrigger } from './accordion_trigger';
|
|
33
25
|
import { EuiAccordionChildren } from './accordion_children';
|
|
34
26
|
import { euiAccordionStyles } from './accordion.styles';
|
|
35
27
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
36
28
|
export var PADDING_SIZES = ['none', 'xs', 's', 'm', 'l', 'xl'];
|
|
37
|
-
export var
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
29
|
+
export var EuiAccordion = function EuiAccordion(_ref) {
|
|
30
|
+
var _buttonProps$id;
|
|
31
|
+
var children = _ref.children,
|
|
32
|
+
className = _ref.className,
|
|
33
|
+
id = _ref.id,
|
|
34
|
+
_ref$role = _ref.role,
|
|
35
|
+
role = _ref$role === void 0 ? 'group' : _ref$role,
|
|
36
|
+
_ref$element = _ref.element,
|
|
37
|
+
Element = _ref$element === void 0 ? 'div' : _ref$element,
|
|
38
|
+
_ref$buttonElement = _ref.buttonElement,
|
|
39
|
+
buttonElement = _ref$buttonElement === void 0 ? 'button' : _ref$buttonElement,
|
|
40
|
+
buttonProps = _ref.buttonProps,
|
|
41
|
+
buttonClassName = _ref.buttonClassName,
|
|
42
|
+
buttonContentClassName = _ref.buttonContentClassName,
|
|
43
|
+
buttonContent = _ref.buttonContent,
|
|
44
|
+
_ref$arrowDisplay = _ref.arrowDisplay,
|
|
45
|
+
arrowDisplay = _ref$arrowDisplay === void 0 ? 'left' : _ref$arrowDisplay,
|
|
46
|
+
arrowProps = _ref.arrowProps,
|
|
47
|
+
extraAction = _ref.extraAction,
|
|
48
|
+
_ref$paddingSize = _ref.paddingSize,
|
|
49
|
+
paddingSize = _ref$paddingSize === void 0 ? 'none' : _ref$paddingSize,
|
|
50
|
+
_ref$borders = _ref.borders,
|
|
51
|
+
borders = _ref$borders === void 0 ? 'none' : _ref$borders,
|
|
52
|
+
_ref$initialIsOpen = _ref.initialIsOpen,
|
|
53
|
+
initialIsOpen = _ref$initialIsOpen === void 0 ? false : _ref$initialIsOpen,
|
|
54
|
+
forceState = _ref.forceState,
|
|
55
|
+
_ref$isLoading = _ref.isLoading,
|
|
56
|
+
isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
|
|
57
|
+
_ref$isLoadingMessage = _ref.isLoadingMessage,
|
|
58
|
+
isLoadingMessage = _ref$isLoadingMessage === void 0 ? false : _ref$isLoadingMessage,
|
|
59
|
+
_ref$isDisabled = _ref.isDisabled,
|
|
60
|
+
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
61
|
+
onToggle = _ref.onToggle,
|
|
62
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
63
|
+
var _useState = useState(forceState ? forceState === 'open' : initialIsOpen),
|
|
64
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
65
|
+
isOpenState = _useState2[0],
|
|
66
|
+
setIsOpenState = _useState2[1];
|
|
67
|
+
var isOpen = forceState ? forceState === 'open' : isOpenState;
|
|
68
|
+
var onAccordionToggle = function onAccordionToggle() {
|
|
69
|
+
if (forceState) {
|
|
70
|
+
onToggle === null || onToggle === void 0 || onToggle(!isOpen);
|
|
71
|
+
} else {
|
|
72
|
+
var nextState = !isOpenState;
|
|
73
|
+
setIsOpenState(nextState);
|
|
74
|
+
onToggle === null || onToggle === void 0 || onToggle(nextState);
|
|
43
75
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
_this$props3$element = _this$props3.element,
|
|
84
|
-
Element = _this$props3$element === void 0 ? 'div' : _this$props3$element,
|
|
85
|
-
buttonElement = _this$props3.buttonElement,
|
|
86
|
-
buttonProps = _this$props3.buttonProps,
|
|
87
|
-
buttonClassName = _this$props3.buttonClassName,
|
|
88
|
-
buttonContentClassName = _this$props3.buttonContentClassName,
|
|
89
|
-
buttonContent = _this$props3.buttonContent,
|
|
90
|
-
arrowDisplay = _this$props3.arrowDisplay,
|
|
91
|
-
arrowProps = _this$props3.arrowProps,
|
|
92
|
-
extraAction = _this$props3.extraAction,
|
|
93
|
-
paddingSize = _this$props3.paddingSize,
|
|
94
|
-
borders = _this$props3.borders,
|
|
95
|
-
initialIsOpen = _this$props3.initialIsOpen,
|
|
96
|
-
forceState = _this$props3.forceState,
|
|
97
|
-
isLoading = _this$props3.isLoading,
|
|
98
|
-
isLoadingMessage = _this$props3.isLoadingMessage,
|
|
99
|
-
isDisabled = _this$props3.isDisabled,
|
|
100
|
-
theme = _this$props3.theme,
|
|
101
|
-
rest = _objectWithoutProperties(_this$props3, _excluded);
|
|
102
|
-
var classes = classNames('euiAccordion', {
|
|
103
|
-
'euiAccordion-isOpen': this.isOpen
|
|
104
|
-
}, className);
|
|
105
|
-
var styles = euiAccordionStyles(theme);
|
|
106
|
-
var cssStyles = [styles.euiAccordion, borders !== 'none' && styles.borders.borders, borders !== 'none' && styles.borders[borders]];
|
|
107
|
-
var buttonId = (_buttonProps$id = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.id) !== null && _buttonProps$id !== void 0 ? _buttonProps$id : this.generatedId;
|
|
108
|
-
return ___EmotionJSX(Element, _extends({
|
|
109
|
-
className: classes,
|
|
110
|
-
css: cssStyles
|
|
111
|
-
}, rest), ___EmotionJSX(EuiAccordionTrigger, {
|
|
112
|
-
ariaControlsId: id,
|
|
113
|
-
buttonId: buttonId
|
|
114
|
-
// Force button element to be a legend if the element is a fieldset
|
|
115
|
-
,
|
|
116
|
-
buttonElement: Element === 'fieldset' ? 'legend' : buttonElement,
|
|
117
|
-
buttonClassName: buttonClassName,
|
|
118
|
-
buttonContent: buttonContent,
|
|
119
|
-
buttonContentClassName: buttonContentClassName,
|
|
120
|
-
buttonProps: buttonProps,
|
|
121
|
-
arrowProps: arrowProps,
|
|
122
|
-
arrowDisplay: arrowDisplay,
|
|
123
|
-
isDisabled: isDisabled,
|
|
124
|
-
isOpen: this.isOpen,
|
|
125
|
-
onToggle: this.onToggle,
|
|
126
|
-
extraAction: isLoading ? ___EmotionJSX(EuiLoadingSpinner, null) : extraAction
|
|
127
|
-
}), ___EmotionJSX(EuiAccordionChildren, {
|
|
128
|
-
role: role,
|
|
129
|
-
id: id,
|
|
130
|
-
"aria-labelledby": buttonId,
|
|
131
|
-
paddingSize: paddingSize,
|
|
132
|
-
isLoading: isLoading,
|
|
133
|
-
isLoadingMessage: isLoadingMessage,
|
|
134
|
-
isOpen: this.isOpen,
|
|
135
|
-
initialIsOpen: initialIsOpen
|
|
136
|
-
}, children));
|
|
137
|
-
}
|
|
138
|
-
}]);
|
|
139
|
-
}(Component);
|
|
140
|
-
_defineProperty(EuiAccordionClass, "defaultProps", {
|
|
141
|
-
initialIsOpen: false,
|
|
142
|
-
borders: 'none',
|
|
143
|
-
paddingSize: 'none',
|
|
144
|
-
arrowDisplay: 'left',
|
|
145
|
-
isLoading: false,
|
|
146
|
-
isDisabled: false,
|
|
147
|
-
isLoadingMessage: false,
|
|
148
|
-
element: 'div',
|
|
149
|
-
buttonElement: 'button',
|
|
150
|
-
role: 'group'
|
|
151
|
-
});
|
|
152
|
-
EuiAccordionClass.propTypes = {
|
|
76
|
+
};
|
|
77
|
+
var generatedId = useGeneratedHtmlId();
|
|
78
|
+
var buttonId = (_buttonProps$id = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.id) !== null && _buttonProps$id !== void 0 ? _buttonProps$id : generatedId;
|
|
79
|
+
var classes = classNames('euiAccordion', {
|
|
80
|
+
'euiAccordion-isOpen': isOpen
|
|
81
|
+
}, className);
|
|
82
|
+
var styles = useEuiMemoizedStyles(euiAccordionStyles);
|
|
83
|
+
var cssStyles = [styles.euiAccordion, borders !== 'none' && styles.borders.borders, borders !== 'none' && styles.borders[borders]];
|
|
84
|
+
return ___EmotionJSX(Element, _extends({
|
|
85
|
+
className: classes,
|
|
86
|
+
css: cssStyles
|
|
87
|
+
}, rest), ___EmotionJSX(EuiAccordionTrigger, {
|
|
88
|
+
ariaControlsId: id,
|
|
89
|
+
buttonId: buttonId
|
|
90
|
+
// Force button element to be a legend if the element is a fieldset
|
|
91
|
+
,
|
|
92
|
+
buttonElement: Element === 'fieldset' ? 'legend' : buttonElement,
|
|
93
|
+
buttonClassName: buttonClassName,
|
|
94
|
+
buttonContent: buttonContent,
|
|
95
|
+
buttonContentClassName: buttonContentClassName,
|
|
96
|
+
buttonProps: buttonProps,
|
|
97
|
+
arrowProps: arrowProps,
|
|
98
|
+
arrowDisplay: arrowDisplay,
|
|
99
|
+
isDisabled: isDisabled,
|
|
100
|
+
isOpen: isOpen,
|
|
101
|
+
onToggle: onAccordionToggle,
|
|
102
|
+
extraAction: isLoading ? ___EmotionJSX(EuiLoadingSpinner, null) : extraAction
|
|
103
|
+
}), ___EmotionJSX(EuiAccordionChildren, {
|
|
104
|
+
role: role,
|
|
105
|
+
id: id,
|
|
106
|
+
"aria-labelledby": buttonId,
|
|
107
|
+
paddingSize: paddingSize,
|
|
108
|
+
isLoading: isLoading,
|
|
109
|
+
isLoadingMessage: isLoadingMessage,
|
|
110
|
+
isOpen: isOpen,
|
|
111
|
+
initialIsOpen: initialIsOpen
|
|
112
|
+
}, children));
|
|
113
|
+
};
|
|
114
|
+
EuiAccordion.propTypes = {
|
|
153
115
|
className: PropTypes.string,
|
|
154
116
|
"aria-label": PropTypes.string,
|
|
155
117
|
"data-test-subj": PropTypes.string,
|
|
@@ -242,5 +204,4 @@ EuiAccordionClass.propTypes = {
|
|
|
242
204
|
* Disable the open/close interaction and visually subdues the trigger
|
|
243
205
|
*/
|
|
244
206
|
isDisabled: PropTypes.bool
|
|
245
|
-
};
|
|
246
|
-
export var EuiAccordion = withEuiTheme(EuiAccordionClass);
|
|
207
|
+
};
|
|
@@ -1141,6 +1141,10 @@ EuiBasicTable.propTypes = {
|
|
|
1141
1141
|
* hidden.
|
|
1142
1142
|
*/
|
|
1143
1143
|
onMouseOut: PropTypes.func,
|
|
1144
|
+
/**
|
|
1145
|
+
* If supplied, called when the trigger loses focus.
|
|
1146
|
+
*/
|
|
1147
|
+
onBlur: PropTypes.func,
|
|
1144
1148
|
/**
|
|
1145
1149
|
* Offset in pixels from the anchor. Defaults to 16.
|
|
1146
1150
|
*/
|
|
@@ -1285,6 +1289,7 @@ EuiBasicTable.propTypes = {
|
|
|
1285
1289
|
repositionOnScroll: PropTypes.bool,
|
|
1286
1290
|
disableScreenReaderOutput: PropTypes.bool,
|
|
1287
1291
|
onMouseOut: PropTypes.func,
|
|
1292
|
+
onBlur: PropTypes.func,
|
|
1288
1293
|
offset: PropTypes.number,
|
|
1289
1294
|
"aria-label": PropTypes.string,
|
|
1290
1295
|
"data-test-subj": PropTypes.string,
|
|
@@ -1426,6 +1431,7 @@ EuiBasicTable.propTypes = {
|
|
|
1426
1431
|
repositionOnScroll: PropTypes.bool,
|
|
1427
1432
|
disableScreenReaderOutput: PropTypes.bool,
|
|
1428
1433
|
onMouseOut: PropTypes.func,
|
|
1434
|
+
onBlur: PropTypes.func,
|
|
1429
1435
|
offset: PropTypes.number,
|
|
1430
1436
|
"aria-label": PropTypes.string,
|
|
1431
1437
|
"data-test-subj": PropTypes.string,
|
|
@@ -668,6 +668,10 @@ EuiInMemoryTable.propTypes = {
|
|
|
668
668
|
* hidden.
|
|
669
669
|
*/
|
|
670
670
|
onMouseOut: PropTypes.func,
|
|
671
|
+
/**
|
|
672
|
+
* If supplied, called when the trigger loses focus.
|
|
673
|
+
*/
|
|
674
|
+
onBlur: PropTypes.func,
|
|
671
675
|
/**
|
|
672
676
|
* Offset in pixels from the anchor. Defaults to 16.
|
|
673
677
|
*/
|
|
@@ -812,6 +816,7 @@ EuiInMemoryTable.propTypes = {
|
|
|
812
816
|
repositionOnScroll: PropTypes.bool,
|
|
813
817
|
disableScreenReaderOutput: PropTypes.bool,
|
|
814
818
|
onMouseOut: PropTypes.func,
|
|
819
|
+
onBlur: PropTypes.func,
|
|
815
820
|
offset: PropTypes.number,
|
|
816
821
|
"aria-label": PropTypes.string,
|
|
817
822
|
"data-test-subj": PropTypes.string,
|
|
@@ -953,6 +958,7 @@ EuiInMemoryTable.propTypes = {
|
|
|
953
958
|
repositionOnScroll: PropTypes.bool,
|
|
954
959
|
disableScreenReaderOutput: PropTypes.bool,
|
|
955
960
|
onMouseOut: PropTypes.func,
|
|
961
|
+
onBlur: PropTypes.func,
|
|
956
962
|
offset: PropTypes.number,
|
|
957
963
|
"aria-label": PropTypes.string,
|
|
958
964
|
"data-test-subj": PropTypes.string,
|
|
@@ -133,6 +133,10 @@ EuiColorPickerSwatch.propTypes = {
|
|
|
133
133
|
* hidden.
|
|
134
134
|
*/
|
|
135
135
|
onMouseOut: PropTypes.func,
|
|
136
|
+
/**
|
|
137
|
+
* If supplied, called when the trigger loses focus.
|
|
138
|
+
*/
|
|
139
|
+
onBlur: PropTypes.func,
|
|
136
140
|
/**
|
|
137
141
|
* Offset in pixels from the anchor. Defaults to 16.
|
|
138
142
|
*/
|
|
@@ -269,8 +269,8 @@ export var EuiContextMenuPanelClass = /*#__PURE__*/function (_Component) {
|
|
|
269
269
|
}
|
|
270
270
|
}, {
|
|
271
271
|
key: "componentDidUpdate",
|
|
272
|
-
value: function componentDidUpdate(
|
|
273
|
-
if (
|
|
272
|
+
value: function componentDidUpdate(prevProps) {
|
|
273
|
+
if (prevProps.items !== this.props.items) {
|
|
274
274
|
this.findMenuItems();
|
|
275
275
|
}
|
|
276
276
|
// Focus isn't always ready to be taken on mount, so we need to call it
|
|
@@ -21,9 +21,10 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
21
21
|
* Side Public License, v 1.
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
import React, { Component } from 'react';
|
|
24
|
+
import React, { Component, createRef } from 'react';
|
|
25
25
|
import PropTypes from "prop-types";
|
|
26
26
|
import { copyToClipboard } from '../../services';
|
|
27
|
+
import { EuiScreenReaderOnly } from '../accessibility';
|
|
27
28
|
import { EuiToolTip } from '../tool_tip';
|
|
28
29
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
29
30
|
export var EuiCopy = /*#__PURE__*/function (_Component) {
|
|
@@ -31,21 +32,31 @@ export var EuiCopy = /*#__PURE__*/function (_Component) {
|
|
|
31
32
|
var _this;
|
|
32
33
|
_classCallCheck(this, EuiCopy);
|
|
33
34
|
_this = _callSuper(this, EuiCopy, [props]);
|
|
35
|
+
_defineProperty(_this, "tooltipRef", /*#__PURE__*/createRef());
|
|
34
36
|
_defineProperty(_this, "copy", function () {
|
|
35
37
|
var isCopied = copyToClipboard(_this.props.textToCopy);
|
|
36
38
|
if (isCopied) {
|
|
37
39
|
_this.setState({
|
|
38
|
-
tooltipText: _this.props.afterMessage
|
|
40
|
+
tooltipText: _this.props.afterMessage,
|
|
41
|
+
isCopied: true
|
|
42
|
+
},
|
|
43
|
+
// `EuiToolTip` suppresses showing when content is empty, so `EuiCopy`
|
|
44
|
+
// imperatively shows the tooltip after the post-copy state update.
|
|
45
|
+
function () {
|
|
46
|
+
var _this$tooltipRef$curr;
|
|
47
|
+
(_this$tooltipRef$curr = _this.tooltipRef.current) === null || _this$tooltipRef$curr === void 0 || _this$tooltipRef$curr.showToolTip();
|
|
39
48
|
});
|
|
40
49
|
}
|
|
41
50
|
});
|
|
42
51
|
_defineProperty(_this, "resetTooltipText", function () {
|
|
43
52
|
_this.setState({
|
|
44
|
-
tooltipText: _this.props.beforeMessage
|
|
53
|
+
tooltipText: _this.props.beforeMessage,
|
|
54
|
+
isCopied: false
|
|
45
55
|
});
|
|
46
56
|
});
|
|
47
57
|
_this.state = {
|
|
48
|
-
tooltipText: _this.props.beforeMessage
|
|
58
|
+
tooltipText: _this.props.beforeMessage,
|
|
59
|
+
isCopied: false
|
|
49
60
|
};
|
|
50
61
|
return _this;
|
|
51
62
|
}
|
|
@@ -53,17 +64,29 @@ export var EuiCopy = /*#__PURE__*/function (_Component) {
|
|
|
53
64
|
return _createClass(EuiCopy, [{
|
|
54
65
|
key: "render",
|
|
55
66
|
value: function render() {
|
|
67
|
+
var _this2 = this;
|
|
56
68
|
var _this$props = this.props,
|
|
57
69
|
children = _this$props.children,
|
|
58
|
-
tooltipProps = _this$props.tooltipProps
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
70
|
+
tooltipProps = _this$props.tooltipProps,
|
|
71
|
+
afterMessage = _this$props.afterMessage;
|
|
72
|
+
var _this$state = this.state,
|
|
73
|
+
tooltipText = _this$state.tooltipText,
|
|
74
|
+
isCopied = _this$state.isCopied;
|
|
75
|
+
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(EuiToolTip, _extends({
|
|
76
|
+
ref: this.tooltipRef,
|
|
77
|
+
content: tooltipText,
|
|
78
|
+
onMouseOut: this.resetTooltipText
|
|
79
|
+
}, tooltipProps, {
|
|
80
|
+
onBlur: function onBlur() {
|
|
81
|
+
var _tooltipProps$onBlur;
|
|
82
|
+
tooltipProps === null || tooltipProps === void 0 || (_tooltipProps$onBlur = tooltipProps.onBlur) === null || _tooltipProps$onBlur === void 0 || _tooltipProps$onBlur.call(tooltipProps);
|
|
83
|
+
if (isCopied) _this2.resetTooltipText();
|
|
84
|
+
},
|
|
85
|
+
disableScreenReaderOutput: isCopied || !!(tooltipProps !== null && tooltipProps !== void 0 && tooltipProps.disableScreenReaderOutput)
|
|
86
|
+
}), children(this.copy)), ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("div", {
|
|
87
|
+
"aria-live": "assertive",
|
|
88
|
+
"aria-atomic": "true"
|
|
89
|
+
}, isCopied ? afterMessage : '')));
|
|
67
90
|
}
|
|
68
91
|
}]);
|
|
69
92
|
}(Component);
|
|
@@ -23,7 +23,6 @@ import React, { createContext, useState, useCallback, useMemo } from 'react';
|
|
|
23
23
|
import classNames from 'classnames';
|
|
24
24
|
import { keys, useEuiMemoizedStyles } from '../../../../services';
|
|
25
25
|
import { EuiWrappingPopover } from '../../../popover';
|
|
26
|
-
import { euiDataGridVariables } from '../../data_grid.styles';
|
|
27
26
|
import { euiDataGridCellPopoverStyles } from './data_grid_cell_popover.styles';
|
|
28
27
|
export var DataGridCellPopoverContext = /*#__PURE__*/createContext({
|
|
29
28
|
popoverIsOpen: false,
|
|
@@ -128,14 +127,19 @@ export var useCellPopover = function useCellPopover() {
|
|
|
128
127
|
};
|
|
129
128
|
}, [popoverIsOpen, closeCellPopover, openCellPopover, cellLocation]);
|
|
130
129
|
var styles = useEuiMemoizedStyles(euiDataGridCellPopoverStyles);
|
|
131
|
-
var _useEuiMemoizedStyles = useEuiMemoizedStyles(euiDataGridVariables),
|
|
132
|
-
levels = _useEuiMemoizedStyles.levels;
|
|
133
130
|
var cellPopover = useMemo(function () {
|
|
134
131
|
var _cellPopoverProps$pan, _cell$offsetWidth;
|
|
135
132
|
if (!popoverIsOpen || !popoverAnchor) return null;
|
|
136
133
|
var cell = popoverAnchor.closest('.euiDataGridRowCell');
|
|
137
134
|
|
|
138
|
-
// Note that this popover is rendered once at the top grid level, rather than one popover per cell
|
|
135
|
+
// Note that this popover is rendered once at the top grid level, rather than one popover per cell.
|
|
136
|
+
//
|
|
137
|
+
// We intentionally do NOT pass `zIndex` here. Letting `EuiPopover` derive the
|
|
138
|
+
// panel's z-index from the anchor's stacking context (`getElementZIndex(button) + 2000`)
|
|
139
|
+
// keeps cell popovers above their host flyout — including when sibling/nested
|
|
140
|
+
// flyouts push the host's z-index above `levels.header`. See
|
|
141
|
+
// https://github.com/elastic/eui/issues/8801. Consumers that need a fixed
|
|
142
|
+
// value can still override via `setCellPopoverProps({ zIndex })`.
|
|
139
143
|
return ___EmotionJSX(EuiWrappingPopover, _extends({
|
|
140
144
|
isOpen: popoverIsOpen,
|
|
141
145
|
display: "block",
|
|
@@ -144,8 +148,7 @@ export var useCellPopover = function useCellPopover() {
|
|
|
144
148
|
,
|
|
145
149
|
panelPaddingSize: "s",
|
|
146
150
|
anchorPosition: popoverAnchorPosition,
|
|
147
|
-
repositionToCrossAxis: false
|
|
148
|
-
zIndex: levels.cellPopover
|
|
151
|
+
repositionToCrossAxis: false
|
|
149
152
|
}, cellPopoverProps, {
|
|
150
153
|
focusTrapProps: {
|
|
151
154
|
onClickOutside: onClickOutside,
|
|
@@ -165,7 +168,7 @@ export var useCellPopover = function useCellPopover() {
|
|
|
165
168
|
button: popoverAnchor,
|
|
166
169
|
closePopover: closeCellPopover
|
|
167
170
|
}), popoverContent);
|
|
168
|
-
}, [styles,
|
|
171
|
+
}, [styles, popoverIsOpen, popoverAnchor, popoverContent, cellPopoverProps, closeCellPopover, onClickOutside, onKeyDown, popoverAnchorPosition]);
|
|
169
172
|
return useMemo(function () {
|
|
170
173
|
return {
|
|
171
174
|
cellPopoverContext: cellPopoverContext,
|
|
@@ -29,11 +29,12 @@ export var euiDataGridVariables = function euiDataGridVariables(euiThemeContext)
|
|
|
29
29
|
m: euiFontSize(euiThemeContext, 's').fontSize
|
|
30
30
|
},
|
|
31
31
|
levels: {
|
|
32
|
-
|
|
33
|
-
//
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
// Sits above content and cell focus outlines/actions, but below cell
|
|
33
|
+
// expansion popovers. Cell popovers no longer use a fixed z-index — they
|
|
34
|
+
// derive theirs from their anchor's stacking context (see
|
|
35
|
+
// data_grid_cell_popover.tsx) — so this only needs to clear the grid's
|
|
36
|
+
// own internal layers.
|
|
37
|
+
stickyHeader: Number(euiTheme.levels.header) - 1
|
|
37
38
|
}
|
|
38
39
|
};
|
|
39
40
|
};
|