@elastic/eui 87.0.0 → 87.1.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/es/components/accordion/accordion.js +82 -35
- package/es/components/auto_sizer/index.js +1 -1
- package/es/components/breadcrumbs/breadcrumb.js +2 -3
- package/es/components/breadcrumbs/breadcrumbs.js +2 -3
- package/es/components/code/code_block_virtualized.js +25 -17
- package/es/components/collapsible_nav_beta/collapsible_nav_beta.js +14 -1
- package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +8 -7
- package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_item.js +6 -6
- package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_popover.js +7 -7
- package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.js +6 -6
- package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +9 -9
- package/es/components/color_picker/color_palette_picker/color_palette_picker.js +1 -1
- package/es/components/control_bar/control_bar.js +2 -3
- package/es/components/date_picker/date_picker_range.js +5 -2
- package/es/components/date_picker/super_date_picker/super_date_picker.js +2 -2
- package/es/components/date_picker/super_date_picker/super_update_button.js +1 -1
- package/es/components/empty_prompt/empty_prompt.js +0 -1
- package/es/components/flyout/flyout.js +9 -7
- package/es/components/flyout/flyout_body.js +15 -3
- package/es/components/form/range/dual_range.js +33 -6
- package/es/components/form/range/range.js +31 -6
- package/es/components/form/super_select/super_select.js +1 -1
- package/es/components/header/header_breadcrumbs/header_breadcrumbs.js +2 -3
- package/es/components/header/header_links/header_links.js +2 -3
- package/es/components/page/page_header/page_header_content.js +2 -3
- package/es/components/page/page_sidebar/page_sidebar.js +2 -2
- package/es/components/page_template/page_template.js +12 -4
- package/es/components/popover/input_popover.js +24 -9
- package/es/components/popover/popover.js +4 -6
- package/es/components/selectable/selectable_list/selectable_list.js +97 -79
- package/es/components/tool_tip/icon_tip.js +1 -1
- package/es/components/tool_tip/tool_tip.js +4 -14
- package/es/components/tool_tip/tool_tip_anchor.js +5 -14
- package/es/components/tour/tour_step.js +2 -3
- package/eui.d.ts +85 -37
- package/i18ntokens.json +54 -36
- package/lib/components/accordion/accordion.js +82 -35
- package/lib/components/auto_sizer/index.js +11 -7
- package/lib/components/breadcrumbs/breadcrumb.js +2 -3
- package/lib/components/code/code_block_virtualized.js +25 -17
- package/lib/components/collapsible_nav_beta/collapsible_nav_beta.js +14 -1
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +8 -7
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_item.js +6 -6
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_popover.js +7 -7
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.js +6 -6
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +9 -9
- package/lib/components/color_picker/color_palette_picker/color_palette_picker.js +1 -1
- package/lib/components/date_picker/date_picker_range.js +5 -2
- package/lib/components/date_picker/super_date_picker/super_date_picker.js +2 -2
- package/lib/components/date_picker/super_date_picker/super_update_button.js +1 -1
- package/lib/components/empty_prompt/empty_prompt.js +0 -1
- package/lib/components/flyout/flyout.js +9 -7
- package/lib/components/flyout/flyout_body.js +15 -3
- package/lib/components/form/range/dual_range.js +33 -6
- package/lib/components/form/range/range.js +14 -6
- package/lib/components/form/super_select/super_select.js +1 -1
- package/lib/components/page/page_sidebar/page_sidebar.js +1 -1
- package/lib/components/page_template/page_template.js +12 -4
- package/lib/components/popover/input_popover.js +23 -8
- package/lib/components/popover/popover.js +4 -6
- package/lib/components/selectable/selectable_list/selectable_list.js +97 -79
- package/lib/components/tool_tip/icon_tip.js +1 -1
- package/lib/components/tool_tip/tool_tip.js +4 -14
- package/lib/components/tool_tip/tool_tip_anchor.js +5 -13
- package/optimize/es/components/accordion/accordion.js +82 -35
- package/optimize/es/components/auto_sizer/index.js +1 -1
- package/optimize/es/components/code/code_block_virtualized.js +25 -17
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_beta.js +5 -1
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +2 -1
- package/optimize/es/components/date_picker/date_picker_range.js +5 -2
- package/optimize/es/components/flyout/flyout.js +9 -7
- package/optimize/es/components/flyout/flyout_body.js +4 -2
- package/optimize/es/components/form/range/dual_range.js +7 -4
- package/optimize/es/components/form/range/range.js +5 -4
- package/optimize/es/components/page/page_sidebar/page_sidebar.js +2 -2
- package/optimize/es/components/page_template/page_template.js +12 -4
- package/optimize/es/components/popover/input_popover.js +13 -8
- package/optimize/es/components/popover/popover.js +2 -3
- package/optimize/es/components/selectable/selectable_list/selectable_list.js +97 -79
- package/optimize/es/components/tool_tip/tool_tip.js +3 -13
- package/optimize/es/components/tool_tip/tool_tip_anchor.js +4 -8
- package/optimize/lib/components/accordion/accordion.js +82 -35
- package/optimize/lib/components/auto_sizer/index.js +11 -7
- package/optimize/lib/components/code/code_block_virtualized.js +25 -17
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_beta.js +5 -1
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +2 -1
- package/optimize/lib/components/date_picker/date_picker_range.js +5 -2
- package/optimize/lib/components/flyout/flyout.js +9 -7
- package/optimize/lib/components/flyout/flyout_body.js +4 -2
- package/optimize/lib/components/form/range/dual_range.js +7 -4
- package/optimize/lib/components/form/range/range.js +5 -4
- package/optimize/lib/components/page/page_sidebar/page_sidebar.js +1 -1
- package/optimize/lib/components/page_template/page_template.js +12 -4
- package/optimize/lib/components/popover/input_popover.js +12 -7
- package/optimize/lib/components/popover/popover.js +2 -3
- package/optimize/lib/components/selectable/selectable_list/selectable_list.js +97 -79
- package/optimize/lib/components/tool_tip/tool_tip.js +3 -13
- package/optimize/lib/components/tool_tip/tool_tip_anchor.js +4 -8
- package/package.json +7 -9
- package/test-env/components/accordion/accordion.js +82 -35
- package/test-env/components/auto_sizer/index.js +11 -7
- package/test-env/components/breadcrumbs/breadcrumb.js +2 -3
- package/test-env/components/code/code_block_virtualized.js +25 -17
- package/test-env/components/collapsible_nav_beta/collapsible_nav_beta.js +14 -1
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +8 -7
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_item.js +6 -6
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_popover.js +7 -7
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.js +6 -6
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +9 -9
- package/test-env/components/color_picker/color_palette_picker/color_palette_picker.js +1 -1
- package/test-env/components/date_picker/date_picker_range.js +5 -2
- package/test-env/components/date_picker/super_date_picker/super_date_picker.js +2 -2
- package/test-env/components/date_picker/super_date_picker/super_update_button.js +1 -1
- package/test-env/components/empty_prompt/empty_prompt.js +0 -1
- package/test-env/components/flyout/flyout_body.js +15 -3
- package/test-env/components/form/range/dual_range.js +33 -6
- package/test-env/components/form/range/range.js +14 -6
- package/test-env/components/form/super_select/super_select.js +1 -1
- package/test-env/components/page/page_sidebar/page_sidebar.js +1 -1
- package/test-env/components/page_template/page_template.js +12 -4
- package/test-env/components/popover/input_popover.js +23 -8
- package/test-env/components/popover/popover.js +4 -6
- package/test-env/components/selectable/selectable_list/selectable_list.js +97 -79
- package/test-env/components/tool_tip/icon_tip.js +1 -1
- package/test-env/components/tool_tip/tool_tip.js +4 -14
- package/test-env/components/tool_tip/tool_tip_anchor.js +5 -11
|
@@ -53,27 +53,35 @@ var EuiCodeBlockVirtualized = function EuiCodeBlockVirtualized(_ref) {
|
|
|
53
53
|
}, codeProps));
|
|
54
54
|
});
|
|
55
55
|
}, [codeProps]);
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
var virtualizationProps = {
|
|
57
|
+
itemData: data,
|
|
58
|
+
itemSize: rowHeight,
|
|
59
|
+
itemCount: data.length,
|
|
60
|
+
outerElementType: VirtualizedOuterElement,
|
|
61
|
+
innerElementType: VirtualizedInnerElement
|
|
62
|
+
};
|
|
63
|
+
return typeof overflowHeight === 'number' ? (0, _react2.jsx)(_auto_sizer.EuiAutoSizer, {
|
|
64
|
+
disableHeight: true
|
|
58
65
|
}, function (_ref4) {
|
|
59
|
-
var
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
var width = _ref4.width;
|
|
67
|
+
return (0, _react2.jsx)(_reactWindow.FixedSizeList, (0, _extends2.default)({
|
|
68
|
+
height: overflowHeight,
|
|
69
|
+
width: width
|
|
70
|
+
}, virtualizationProps), ListRow);
|
|
71
|
+
}) : (0, _react2.jsx)(_auto_sizer.EuiAutoSizer, null, function (_ref5) {
|
|
72
|
+
var height = _ref5.height,
|
|
73
|
+
width = _ref5.width;
|
|
74
|
+
return (0, _react2.jsx)(_reactWindow.FixedSizeList, (0, _extends2.default)({
|
|
75
|
+
height: height,
|
|
76
|
+
width: width
|
|
77
|
+
}, virtualizationProps), ListRow);
|
|
70
78
|
});
|
|
71
79
|
};
|
|
72
80
|
exports.EuiCodeBlockVirtualized = EuiCodeBlockVirtualized;
|
|
73
|
-
var ListRow = function ListRow(
|
|
74
|
-
var data =
|
|
75
|
-
index =
|
|
76
|
-
style =
|
|
81
|
+
var ListRow = function ListRow(_ref6) {
|
|
82
|
+
var data = _ref6.data,
|
|
83
|
+
index = _ref6.index,
|
|
84
|
+
style = _ref6.style;
|
|
77
85
|
var row = data[index];
|
|
78
86
|
row.properties.style = (0, _global_styling.logicalStyles)(style);
|
|
79
87
|
return (0, _utils.nodeToHtml)(row, index, data, 0);
|
|
@@ -16,6 +16,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
16
16
|
var _services = require("../../services");
|
|
17
17
|
var _global_styling = require("../../global_styling");
|
|
18
18
|
var _flyout = require("../flyout");
|
|
19
|
+
var _i18n = require("../i18n");
|
|
19
20
|
var _header = require("../header/header.styles");
|
|
20
21
|
var _context = require("./context");
|
|
21
22
|
var _collapsible_nav_button = require("./collapsible_nav_button");
|
|
@@ -131,6 +132,7 @@ var EuiCollapsibleNavBeta = function EuiCollapsibleNavBeta(_ref) {
|
|
|
131
132
|
conditionalId: id,
|
|
132
133
|
suffix: 'euiCollapsibleNav'
|
|
133
134
|
});
|
|
135
|
+
var defaultAriaLabel = (0, _i18n.useEuiI18n)('euiCollapsibleNavBeta.ariaLabel', 'Site menu');
|
|
134
136
|
var buttonRef = (0, _react.useRef)(null);
|
|
135
137
|
var focusTrapProps = (0, _react.useMemo)(function () {
|
|
136
138
|
return _objectSpread(_objectSpread({}, _focusTrapProps), {}, {
|
|
@@ -142,7 +144,9 @@ var EuiCollapsibleNavBeta = function EuiCollapsibleNavBeta(_ref) {
|
|
|
142
144
|
var cssStyles = [styles.euiCollapsibleNavBeta, styles[side], isPush && styles.isPush, isPush && isCollapsed && styles.isPushCollapsed, isOverlayFullWidth && styles.isOverlayFullWidth];
|
|
143
145
|
|
|
144
146
|
// Wait for any fixed headers to be queried before rendering (prevents position jumping)
|
|
145
|
-
var flyout = fixedHeadersCount !== false && (0, _react2.jsx)(_flyout.EuiFlyout, (0, _extends2.default)({
|
|
147
|
+
var flyout = fixedHeadersCount !== false && (0, _react2.jsx)(_flyout.EuiFlyout, (0, _extends2.default)({
|
|
148
|
+
"aria-label": defaultAriaLabel
|
|
149
|
+
}, rest, {
|
|
146
150
|
// EuiCollapsibleNav is significantly less permissive than EuiFlyout
|
|
147
151
|
id: flyoutID,
|
|
148
152
|
css: cssStyles,
|
|
@@ -58,7 +58,8 @@ var EuiCollapsedNavButton = function EuiCollapsedNavButton(_ref) {
|
|
|
58
58
|
size: "s",
|
|
59
59
|
color: "text",
|
|
60
60
|
href: href,
|
|
61
|
-
onClick: onClick
|
|
61
|
+
onClick: onClick,
|
|
62
|
+
"aria-label": title
|
|
62
63
|
}, linkProps, {
|
|
63
64
|
// Exclusive union shenanigans
|
|
64
65
|
className: buttonClassName,
|
|
@@ -14,7 +14,7 @@ var _form = require("../form");
|
|
|
14
14
|
var _services = require("../../services");
|
|
15
15
|
var _date_picker_range = require("./date_picker_range.styles");
|
|
16
16
|
var _react2 = require("@emotion/react");
|
|
17
|
-
var _excluded = ["children", "className", "startDateControl", "endDateControl", "iconType", "inline", "shadow", "fullWidth", "isCustom", "readOnly", "isLoading", "isInvalid", "disabled", "onFocus", "onBlur", "append", "prepend"];
|
|
17
|
+
var _excluded = ["children", "className", "startDateControl", "endDateControl", "iconType", "inline", "shadow", "fullWidth", "compressed", "isCustom", "readOnly", "isLoading", "isInvalid", "disabled", "onFocus", "onBlur", "append", "prepend"];
|
|
18
18
|
/*
|
|
19
19
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
20
20
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -35,6 +35,7 @@ var EuiDatePickerRange = function EuiDatePickerRange(_ref) {
|
|
|
35
35
|
_ref$shadow = _ref.shadow,
|
|
36
36
|
shadow = _ref$shadow === void 0 ? true : _ref$shadow,
|
|
37
37
|
_fullWidth = _ref.fullWidth,
|
|
38
|
+
_compressed = _ref.compressed,
|
|
38
39
|
isCustom = _ref.isCustom,
|
|
39
40
|
readOnly = _ref.readOnly,
|
|
40
41
|
isLoading = _ref.isLoading,
|
|
@@ -45,8 +46,9 @@ var EuiDatePickerRange = function EuiDatePickerRange(_ref) {
|
|
|
45
46
|
append = _ref.append,
|
|
46
47
|
prepend = _ref.prepend,
|
|
47
48
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
48
|
-
// `fullWidth` should not affect inline datepickers (matches non-range behavior)
|
|
49
|
+
// `fullWidth` and `compressed` should not affect inline datepickers (matches non-range behavior)
|
|
49
50
|
var fullWidth = _fullWidth && !inline;
|
|
51
|
+
var compressed = _compressed && !inline;
|
|
50
52
|
var classes = (0, _classnames.default)('euiDatePickerRange', className);
|
|
51
53
|
var euiTheme = (0, _services.useEuiTheme)();
|
|
52
54
|
var styles = (0, _date_picker_range.euiDatePickerRangeStyles)(euiTheme);
|
|
@@ -118,6 +120,7 @@ var EuiDatePickerRange = function EuiDatePickerRange(_ref) {
|
|
|
118
120
|
startControl: startControl,
|
|
119
121
|
endControl: endControl,
|
|
120
122
|
fullWidth: fullWidth,
|
|
123
|
+
compressed: compressed,
|
|
121
124
|
readOnly: readOnly,
|
|
122
125
|
isDisabled: disabled,
|
|
123
126
|
isInvalid: isInvalid,
|
|
@@ -24,7 +24,7 @@ var _portal = require("../portal");
|
|
|
24
24
|
var _accessibility = require("../accessibility");
|
|
25
25
|
var _flyout = require("./flyout.styles");
|
|
26
26
|
var _react2 = require("@emotion/react");
|
|
27
|
-
var _excluded = ["className", "children", "as", "hideCloseButton", "closeButtonProps", "closeButtonPosition", "onClose", "ownFocus", "side", "size", "paddingSize", "maxWidth", "style", "maskProps", "type", "outsideClickCloses", "pushMinBreakpoint", "focusTrapProps", "includeFixedHeadersInFocusTrap"];
|
|
27
|
+
var _excluded = ["className", "children", "as", "hideCloseButton", "closeButtonProps", "closeButtonPosition", "onClose", "ownFocus", "side", "size", "paddingSize", "maxWidth", "style", "maskProps", "type", "outsideClickCloses", "pushMinBreakpoint", "focusTrapProps", "includeFixedHeadersInFocusTrap", "aria-describedby"];
|
|
28
28
|
/*
|
|
29
29
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
30
30
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -83,6 +83,7 @@ var EuiFlyout = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
83
83
|
_focusTrapProps = _ref$focusTrapProps === void 0 ? {} : _ref$focusTrapProps,
|
|
84
84
|
_ref$includeFixedHead = _ref.includeFixedHeadersInFocusTrap,
|
|
85
85
|
includeFixedHeadersInFocusTrap = _ref$includeFixedHead === void 0 ? true : _ref$includeFixedHead,
|
|
86
|
+
_ariaDescribedBy = _ref['aria-describedby'],
|
|
86
87
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
87
88
|
var Element = as || defaultElement;
|
|
88
89
|
var maskRef = (0, _react.useRef)(null);
|
|
@@ -216,6 +217,7 @@ var EuiFlyout = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
216
217
|
*/
|
|
217
218
|
var hasOverlayMask = ownFocus && !isPushed;
|
|
218
219
|
var descriptionId = (0, _services.useGeneratedHtmlId)();
|
|
220
|
+
var ariaDescribedBy = (0, _classnames.default)(descriptionId, _ariaDescribedBy);
|
|
219
221
|
var screenReaderDescription = (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("p", {
|
|
220
222
|
id: descriptionId
|
|
221
223
|
}, hasOverlayMask ? (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
@@ -260,15 +262,15 @@ var EuiFlyout = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
260
262
|
clickOutsideDisables: !ownFocus,
|
|
261
263
|
onClickOutside: onClickOutside
|
|
262
264
|
}, focusTrapProps), (0, _react2.jsx)(Element, (0, _extends2.default)({
|
|
263
|
-
css: cssStyles
|
|
264
|
-
}, rest, {
|
|
265
|
-
role: "dialog",
|
|
266
265
|
className: classes,
|
|
267
|
-
|
|
268
|
-
"data-autofocus": true,
|
|
269
|
-
"aria-describedby": !isPushed ? descriptionId : undefined,
|
|
266
|
+
css: cssStyles,
|
|
270
267
|
style: newStyle,
|
|
271
268
|
ref: setRef
|
|
269
|
+
}, rest, {
|
|
270
|
+
role: !isPushed ? 'dialog' : rest.role,
|
|
271
|
+
tabIndex: !isPushed ? 0 : rest.tabIndex,
|
|
272
|
+
"aria-describedby": !isPushed ? ariaDescribedBy : _ariaDescribedBy,
|
|
273
|
+
"data-autofocus": !isPushed || undefined
|
|
272
274
|
}), !isPushed && screenReaderDescription, closeButton, children));
|
|
273
275
|
|
|
274
276
|
// If ownFocus is set, wrap with an overlay and allow the user to click it to close it.
|
|
@@ -12,7 +12,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
12
12
|
var _services = require("../../services");
|
|
13
13
|
var _flyout_body = require("./flyout_body.styles");
|
|
14
14
|
var _react2 = require("@emotion/react");
|
|
15
|
-
var _excluded = ["children", "className", "banner"];
|
|
15
|
+
var _excluded = ["children", "className", "banner", "scrollableTabIndex"];
|
|
16
16
|
/*
|
|
17
17
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
18
18
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -24,6 +24,8 @@ var EuiFlyoutBody = function EuiFlyoutBody(_ref) {
|
|
|
24
24
|
var children = _ref.children,
|
|
25
25
|
className = _ref.className,
|
|
26
26
|
banner = _ref.banner,
|
|
27
|
+
_ref$scrollableTabInd = _ref.scrollableTabIndex,
|
|
28
|
+
scrollableTabIndex = _ref$scrollableTabInd === void 0 ? 0 : _ref$scrollableTabInd,
|
|
27
29
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
28
30
|
var classes = (0, _classnames.default)('euiFlyoutBody', className);
|
|
29
31
|
var euiTheme = (0, _services.useEuiTheme)();
|
|
@@ -35,7 +37,7 @@ var EuiFlyoutBody = function EuiFlyoutBody(_ref) {
|
|
|
35
37
|
className: classes,
|
|
36
38
|
css: cssStyles
|
|
37
39
|
}, rest), (0, _react2.jsx)("div", {
|
|
38
|
-
tabIndex:
|
|
40
|
+
tabIndex: scrollableTabIndex,
|
|
39
41
|
className: "euiFlyoutBody__overflow",
|
|
40
42
|
css: overflowCssStyles
|
|
41
43
|
}, banner && (0, _react2.jsx)("div", {
|
|
@@ -37,7 +37,7 @@ var _range = require("./range.styles");
|
|
|
37
37
|
var _dual_range = require("./dual_range.styles");
|
|
38
38
|
var _i18n = require("../../i18n");
|
|
39
39
|
var _react2 = require("@emotion/react");
|
|
40
|
-
var _excluded = ["className", "css", "compressed", "disabled", "fullWidth", "isLoading", "readOnly", "id", "max", "min", "name", "step", "showLabels", "showInput", "showTicks", "tickInterval", "ticks", "levels", "onBlur", "onChange", "onFocus", "showRange", "value", "isInvalid", "append", "prepend", "minInputProps", "maxInputProps", "isDraggable", "theme"];
|
|
40
|
+
var _excluded = ["className", "css", "compressed", "disabled", "fullWidth", "isLoading", "readOnly", "id", "max", "min", "name", "step", "showLabels", "showInput", "showTicks", "tickInterval", "ticks", "levels", "onBlur", "onChange", "onFocus", "showRange", "value", "isInvalid", "append", "prepend", "minInputProps", "maxInputProps", "inputPopoverProps", "isDraggable", "theme"];
|
|
41
41
|
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); }
|
|
42
42
|
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; }
|
|
43
43
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -267,9 +267,11 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
267
267
|
});
|
|
268
268
|
});
|
|
269
269
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onResize", function (width) {
|
|
270
|
+
var _this$props$inputPopo, _this$props$inputPopo2;
|
|
270
271
|
_this.setState({
|
|
271
272
|
rangeWidth: width
|
|
272
273
|
});
|
|
274
|
+
(_this$props$inputPopo = _this.props.inputPopoverProps) === null || _this$props$inputPopo === void 0 ? void 0 : (_this$props$inputPopo2 = _this$props$inputPopo.onPanelResize) === null || _this$props$inputPopo2 === void 0 ? void 0 : _this$props$inputPopo2.call(_this$props$inputPopo, width);
|
|
273
275
|
});
|
|
274
276
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getNearestStep", function (value) {
|
|
275
277
|
var min = _this.props.min;
|
|
@@ -386,6 +388,7 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
386
388
|
prepend = _this$props.prepend,
|
|
387
389
|
minInputProps = _this$props.minInputProps,
|
|
388
390
|
maxInputProps = _this$props.maxInputProps,
|
|
391
|
+
inputPopoverProps = _this$props.inputPopoverProps,
|
|
389
392
|
isDraggable = _this$props.isDraggable,
|
|
390
393
|
theme = _this$props.theme,
|
|
391
394
|
rest = (0, _objectWithoutProperties2.default)(_this$props, _excluded);
|
|
@@ -626,8 +629,8 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
626
629
|
className: showTicks || ticks ? 'euiRange__slimHorizontalSpacer' : 'euiRange__horizontalSpacer',
|
|
627
630
|
css: showTicks || ticks ? rangeStyles.euiRange__slimHorizontalSpacer : rangeStyles.euiRange__horizontalSpacer
|
|
628
631
|
}), maxInput));
|
|
629
|
-
var thePopover = showInputOnly ? (0, _react2.jsx)(_popover.EuiInputPopover, {
|
|
630
|
-
className:
|
|
632
|
+
var thePopover = showInputOnly ? (0, _react2.jsx)(_popover.EuiInputPopover, (0, _extends2.default)({}, inputPopoverProps, {
|
|
633
|
+
className: (0, _classnames.default)('euiDualRange__popover', inputPopoverProps === null || inputPopoverProps === void 0 ? void 0 : inputPopoverProps.className),
|
|
631
634
|
input: (0, _react2.jsx)(_form_control_layout.EuiFormControlLayoutDelimited, {
|
|
632
635
|
startControl: minInput,
|
|
633
636
|
endControl: maxInput,
|
|
@@ -646,7 +649,7 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
646
649
|
disableFocusTrap: true,
|
|
647
650
|
onPanelResize: this.onResize,
|
|
648
651
|
popoverScreenReaderText: dualSliderScreenReaderInstructions
|
|
649
|
-
}, theRange) : undefined;
|
|
652
|
+
}), theRange) : undefined;
|
|
650
653
|
return thePopover || theRange;
|
|
651
654
|
}
|
|
652
655
|
}]);
|
|
@@ -32,7 +32,7 @@ var _range_wrapper = require("./range_wrapper");
|
|
|
32
32
|
var _range = require("./range.styles");
|
|
33
33
|
var _i18n = require("../../i18n");
|
|
34
34
|
var _react2 = require("@emotion/react");
|
|
35
|
-
var _excluded = ["className", "compressed", "disabled", "fullWidth", "isLoading", "readOnly", "id", "max", "min", "name", "step", "showLabels", "showInput", "showTicks", "tickInterval", "ticks", "levels", "showRange", "showValue", "valueAppend", "valuePrepend", "onBlur", "onChange", "onFocus", "value", "tabIndex", "isInvalid", "theme"];
|
|
35
|
+
var _excluded = ["className", "compressed", "disabled", "fullWidth", "isLoading", "readOnly", "id", "max", "min", "name", "step", "showLabels", "showInput", "inputPopoverProps", "showTicks", "tickInterval", "ticks", "levels", "showRange", "showValue", "valueAppend", "valuePrepend", "onBlur", "onChange", "onFocus", "value", "tabIndex", "isInvalid", "theme"];
|
|
36
36
|
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); }
|
|
37
37
|
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; }
|
|
38
38
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
@@ -122,6 +122,7 @@ var EuiRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
122
122
|
step = _this$props.step,
|
|
123
123
|
showLabels = _this$props.showLabels,
|
|
124
124
|
showInput = _this$props.showInput,
|
|
125
|
+
inputPopoverProps = _this$props.inputPopoverProps,
|
|
125
126
|
showTicks = _this$props.showTicks,
|
|
126
127
|
tickInterval = _this$props.tickInterval,
|
|
127
128
|
ticks = _this$props.ticks,
|
|
@@ -234,8 +235,8 @@ var EuiRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
234
235
|
className: showTicks || ticks ? 'euiRange__slimHorizontalSpacer' : 'euiRange__horizontalSpacer',
|
|
235
236
|
css: showTicks || ticks ? styles.euiRange__slimHorizontalSpacer : styles.euiRange__horizontalSpacer
|
|
236
237
|
}), theInput));
|
|
237
|
-
var thePopover = showInputOnly ? (0, _react2.jsx)(_popover.EuiInputPopover, {
|
|
238
|
-
className:
|
|
238
|
+
var thePopover = showInputOnly ? (0, _react2.jsx)(_popover.EuiInputPopover, (0, _extends2.default)({}, inputPopoverProps, {
|
|
239
|
+
className: (0, _classnames.default)('euiRange__popover', inputPopoverProps === null || inputPopoverProps === void 0 ? void 0 : inputPopoverProps.className),
|
|
239
240
|
input: theInput // `showInputOnly` confirms existence
|
|
240
241
|
,
|
|
241
242
|
fullWidth: fullWidth,
|
|
@@ -243,7 +244,7 @@ var EuiRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
243
244
|
closePopover: this.closePopover,
|
|
244
245
|
disableFocusTrap: true,
|
|
245
246
|
popoverScreenReaderText: sliderScreenReaderInstructions
|
|
246
|
-
}, theRange) : undefined;
|
|
247
|
+
}), theRange) : undefined;
|
|
247
248
|
return thePopover ? thePopover : theRange;
|
|
248
249
|
}
|
|
249
250
|
}]);
|
|
@@ -51,7 +51,7 @@ var EuiPageSidebar = function EuiPageSidebar(_ref) {
|
|
|
51
51
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
52
52
|
inlineStyles = _useState2[0],
|
|
53
53
|
setInlineStyles = _useState2[1];
|
|
54
|
-
(0, _react.
|
|
54
|
+
(0, _react.useLayoutEffect)(function () {
|
|
55
55
|
var updatedStyles = _objectSpread(_objectSpread({}, style), (0, _global_styling.logicalStyle)('min-width', isResponding ? '100%' : minWidth));
|
|
56
56
|
if (sticky) {
|
|
57
57
|
var _document$body$datase;
|
|
@@ -39,6 +39,14 @@ var TemplateContext = /*#__PURE__*/(0, _react.createContext)({
|
|
|
39
39
|
bottomBar: {}
|
|
40
40
|
});
|
|
41
41
|
exports.TemplateContext = TemplateContext;
|
|
42
|
+
var calculateOffset = function calculateOffset(base) {
|
|
43
|
+
var _document$body$datase;
|
|
44
|
+
if (typeof document === 'undefined') return 0; // SSR catch
|
|
45
|
+
|
|
46
|
+
var euiHeaderFixedCounter = Number((_document$body$datase = document.body.dataset.fixedHeaders) !== null && _document$body$datase !== void 0 ? _document$body$datase : 0);
|
|
47
|
+
return base * 3 * euiHeaderFixedCounter;
|
|
48
|
+
};
|
|
49
|
+
|
|
42
50
|
/**
|
|
43
51
|
* Consumed via `EuiPageTemplate`,
|
|
44
52
|
* it controls and propogates most of the shared props per direct child
|
|
@@ -65,7 +73,9 @@ var _EuiPageTemplate = function _EuiPageTemplate(_ref) {
|
|
|
65
73
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
66
74
|
var _useEuiTheme = (0, _services.useEuiTheme)(),
|
|
67
75
|
euiTheme = _useEuiTheme.euiTheme;
|
|
68
|
-
var _useState = (0, _react.useState)(
|
|
76
|
+
var _useState = (0, _react.useState)(function () {
|
|
77
|
+
return _offset !== null && _offset !== void 0 ? _offset : calculateOffset(euiTheme.base);
|
|
78
|
+
}),
|
|
69
79
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
70
80
|
offset = _useState2[0],
|
|
71
81
|
setOffset = _useState2[1];
|
|
@@ -78,9 +88,7 @@ var _EuiPageTemplate = function _EuiPageTemplate(_ref) {
|
|
|
78
88
|
});
|
|
79
89
|
(0, _react.useEffect)(function () {
|
|
80
90
|
if (_offset === undefined) {
|
|
81
|
-
|
|
82
|
-
var euiHeaderFixedCounter = Number((_document$body$datase = document.body.dataset.fixedHeaders) !== null && _document$body$datase !== void 0 ? _document$body$datase : 0);
|
|
83
|
-
setOffset(euiTheme.base * 3 * euiHeaderFixedCounter);
|
|
91
|
+
setOffset(calculateOffset(euiTheme.base));
|
|
84
92
|
}
|
|
85
93
|
}, [_offset, euiTheme.base]);
|
|
86
94
|
|
|
@@ -19,7 +19,7 @@ var _services = require("../../services");
|
|
|
19
19
|
var _form = require("../form/form.styles");
|
|
20
20
|
var _react2 = require("@emotion/react");
|
|
21
21
|
var _global_styling = require("../../global_styling");
|
|
22
|
-
var _excluded = ["children", "className", "disableFocusTrap", "focusTrapProps", "input", "fullWidth", "onPanelResize", "inputRef", "panelRef"];
|
|
22
|
+
var _excluded = ["children", "className", "disableFocusTrap", "focusTrapProps", "input", "fullWidth", "panelMinWidth", "onPanelResize", "inputRef", "panelRef"];
|
|
23
23
|
/*
|
|
24
24
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
25
25
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -38,6 +38,8 @@ var EuiInputPopover = function EuiInputPopover(_ref) {
|
|
|
38
38
|
input = _ref.input,
|
|
39
39
|
_ref$fullWidth = _ref.fullWidth,
|
|
40
40
|
fullWidth = _ref$fullWidth === void 0 ? false : _ref$fullWidth,
|
|
41
|
+
_ref$panelMinWidth = _ref.panelMinWidth,
|
|
42
|
+
panelMinWidth = _ref$panelMinWidth === void 0 ? 0 : _ref$panelMinWidth,
|
|
41
43
|
onPanelResize = _ref.onPanelResize,
|
|
42
44
|
_inputRef = _ref.inputRef,
|
|
43
45
|
_panelRef = _ref.panelRef,
|
|
@@ -55,22 +57,24 @@ var EuiInputPopover = function EuiInputPopover(_ref) {
|
|
|
55
57
|
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
56
58
|
panelEl = _useState6[0],
|
|
57
59
|
setPanelEl = _useState6[1];
|
|
60
|
+
var popoverClassRef = (0, _react.useRef)(null);
|
|
58
61
|
var inputRef = (0, _services.useCombinedRefs)([setInputEl, _inputRef]);
|
|
59
62
|
var panelRef = (0, _services.useCombinedRefs)([setPanelEl, _panelRef]);
|
|
60
63
|
var setPanelWidth = (0, _react.useCallback)(function (width) {
|
|
61
64
|
if (panelEl && (!!inputElWidth || !!width)) {
|
|
62
65
|
var newWidth = !!width ? width : inputElWidth;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
66
|
+
var widthToSet = newWidth && newWidth > panelMinWidth ? newWidth : panelMinWidth;
|
|
67
|
+
panelEl.style.width = "".concat(widthToSet, "px");
|
|
68
|
+
onPanelResize === null || onPanelResize === void 0 ? void 0 : onPanelResize(widthToSet);
|
|
67
69
|
}
|
|
68
|
-
}, [panelEl, inputElWidth, onPanelResize]);
|
|
70
|
+
}, [panelEl, inputElWidth, onPanelResize, panelMinWidth]);
|
|
69
71
|
var onResize = (0, _react.useCallback)(function () {
|
|
70
72
|
if (inputEl) {
|
|
73
|
+
var _popoverClassRef$curr;
|
|
71
74
|
var _width = inputEl.getBoundingClientRect().width;
|
|
72
75
|
setInputElWidth(_width);
|
|
73
76
|
setPanelWidth(_width);
|
|
77
|
+
(_popoverClassRef$curr = popoverClassRef.current) === null || _popoverClassRef$curr === void 0 ? void 0 : _popoverClassRef$curr.positionPopoverFluid();
|
|
74
78
|
}
|
|
75
79
|
}, [inputEl, setPanelWidth]);
|
|
76
80
|
(0, _react.useEffect)(function () {
|
|
@@ -105,7 +109,8 @@ var EuiInputPopover = function EuiInputPopover(_ref) {
|
|
|
105
109
|
}),
|
|
106
110
|
buttonRef: inputRef,
|
|
107
111
|
panelRef: panelRef,
|
|
108
|
-
className: classes
|
|
112
|
+
className: classes,
|
|
113
|
+
ref: popoverClassRef
|
|
109
114
|
}, props), (0, _react2.jsx)(_focus_trap.EuiFocusTrap, (0, _extends2.default)({
|
|
110
115
|
clickOutsideDisables: true,
|
|
111
116
|
disabled: disableFocusTrap
|
|
@@ -216,8 +216,7 @@ var EuiPopover = /*#__PURE__*/function (_Component) {
|
|
|
216
216
|
top = _findPopoverPosition.top,
|
|
217
217
|
left = _findPopoverPosition.left,
|
|
218
218
|
foundPosition = _findPopoverPosition.position,
|
|
219
|
-
arrow = _findPopoverPosition.arrow
|
|
220
|
-
anchorBoundingBox = _findPopoverPosition.anchorBoundingBox;
|
|
219
|
+
arrow = _findPopoverPosition.arrow;
|
|
221
220
|
|
|
222
221
|
// the popover's z-index must inherit from the button
|
|
223
222
|
// this keeps a button's popover under a flyout that would cover the button
|
|
@@ -226,7 +225,7 @@ var EuiPopover = /*#__PURE__*/function (_Component) {
|
|
|
226
225
|
var zIndex = zIndexProp == null ? (0, _popover.getElementZIndex)(_this.button, _this.panel) + 2000 : zIndexProp;
|
|
227
226
|
var popoverStyles = _objectSpread(_objectSpread({}, _this.props.panelStyle), {}, {
|
|
228
227
|
top: top,
|
|
229
|
-
left:
|
|
228
|
+
left: left,
|
|
230
229
|
zIndex: zIndex
|
|
231
230
|
});
|
|
232
231
|
var willRenderArrow = !_this.props.attachToAnchor && _this.props.hasArrow;
|
|
@@ -170,17 +170,67 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
170
170
|
search: searchValue
|
|
171
171
|
}, label));
|
|
172
172
|
}, _reactWindow.areEqual));
|
|
173
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderVirtualizedList", function (heightIsFull, optionArray) {
|
|
174
|
+
if (!_this.props.isVirtualized) return null;
|
|
175
|
+
var _this$props3 = _this.props,
|
|
176
|
+
windowProps = _this$props3.windowProps,
|
|
177
|
+
forcedHeight = _this$props3.height,
|
|
178
|
+
rowHeight = _this$props3.rowHeight;
|
|
179
|
+
var virtualizationProps = _objectSpread({
|
|
180
|
+
className: 'euiSelectableList__list',
|
|
181
|
+
ref: _this.setListRef,
|
|
182
|
+
outerRef: _this.removeScrollableTabStop,
|
|
183
|
+
innerRef: _this.setListBoxRef,
|
|
184
|
+
innerElementType: 'ul',
|
|
185
|
+
itemCount: optionArray.length,
|
|
186
|
+
itemData: optionArray,
|
|
187
|
+
itemSize: rowHeight,
|
|
188
|
+
'data-skip-axe': 'scrollable-region-focusable'
|
|
189
|
+
}, windowProps);
|
|
190
|
+
|
|
191
|
+
// Calculated height is only used if height is not full
|
|
192
|
+
var calculatedHeight = !heightIsFull ? forcedHeight || 0 : 0;
|
|
193
|
+
|
|
194
|
+
// If calculatedHeight is still falsy, then calculate it
|
|
195
|
+
if (!heightIsFull && !calculatedHeight) {
|
|
196
|
+
var maxVisibleOptions = 7;
|
|
197
|
+
var numVisibleOptions = optionArray.length;
|
|
198
|
+
var numVisibleMoreThanMax = optionArray.length > maxVisibleOptions;
|
|
199
|
+
if (numVisibleMoreThanMax) {
|
|
200
|
+
// Show only half of the last one to indicate there's more to scroll to
|
|
201
|
+
calculatedHeight = (maxVisibleOptions - 0.5) * rowHeight;
|
|
202
|
+
} else {
|
|
203
|
+
calculatedHeight = numVisibleOptions * rowHeight;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
return heightIsFull ? (0, _react2.jsx)(_auto_sizer.EuiAutoSizer, null, function (_ref2) {
|
|
207
|
+
var width = _ref2.width,
|
|
208
|
+
height = _ref2.height;
|
|
209
|
+
return (0, _react2.jsx)(_reactWindow.FixedSizeList, (0, _extends2.default)({
|
|
210
|
+
width: width,
|
|
211
|
+
height: height
|
|
212
|
+
}, virtualizationProps), _this.ListRow);
|
|
213
|
+
}) : (0, _react2.jsx)(_auto_sizer.EuiAutoSizer, {
|
|
214
|
+
disableHeight: true
|
|
215
|
+
}, function (_ref3) {
|
|
216
|
+
var width = _ref3.width;
|
|
217
|
+
return (0, _react2.jsx)(_reactWindow.FixedSizeList, (0, _extends2.default)({
|
|
218
|
+
width: width,
|
|
219
|
+
height: calculatedHeight
|
|
220
|
+
}, virtualizationProps), _this.ListRow);
|
|
221
|
+
});
|
|
222
|
+
});
|
|
173
223
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onAddOrRemoveOption", function (option, event) {
|
|
174
224
|
if (option.disabled) {
|
|
175
225
|
return;
|
|
176
226
|
}
|
|
177
|
-
var _this$
|
|
178
|
-
allowExclusions = _this$
|
|
179
|
-
options = _this$
|
|
180
|
-
_this$
|
|
181
|
-
visibleOptions = _this$
|
|
182
|
-
_this.props.setActiveOptionIndex(visibleOptions.findIndex(function (
|
|
183
|
-
var label =
|
|
227
|
+
var _this$props4 = _this.props,
|
|
228
|
+
allowExclusions = _this$props4.allowExclusions,
|
|
229
|
+
options = _this$props4.options,
|
|
230
|
+
_this$props4$visibleO = _this$props4.visibleOptions,
|
|
231
|
+
visibleOptions = _this$props4$visibleO === void 0 ? options : _this$props4$visibleO;
|
|
232
|
+
_this.props.setActiveOptionIndex(visibleOptions.findIndex(function (_ref4) {
|
|
233
|
+
var label = _ref4.label;
|
|
184
234
|
return label === option.label;
|
|
185
235
|
}), function () {
|
|
186
236
|
if (option.checked === 'on' && allowExclusions) {
|
|
@@ -193,10 +243,10 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
193
243
|
});
|
|
194
244
|
});
|
|
195
245
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onAddOption", function (addedOption, event) {
|
|
196
|
-
var _this$
|
|
197
|
-
onOptionClick = _this$
|
|
198
|
-
options = _this$
|
|
199
|
-
singleSelection = _this$
|
|
246
|
+
var _this$props5 = _this.props,
|
|
247
|
+
onOptionClick = _this$props5.onOptionClick,
|
|
248
|
+
options = _this$props5.options,
|
|
249
|
+
singleSelection = _this$props5.singleSelection;
|
|
200
250
|
var changedOption = _objectSpread({}, addedOption);
|
|
201
251
|
var updatedOptions = options.map(function (option) {
|
|
202
252
|
// if singleSelection is enabled, uncheck any selected option(s)
|
|
@@ -215,10 +265,10 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
215
265
|
onOptionClick(updatedOptions, event, changedOption);
|
|
216
266
|
});
|
|
217
267
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onRemoveOption", function (removedOption, event) {
|
|
218
|
-
var _this$
|
|
219
|
-
onOptionClick = _this$
|
|
220
|
-
singleSelection = _this$
|
|
221
|
-
options = _this$
|
|
268
|
+
var _this$props6 = _this.props,
|
|
269
|
+
onOptionClick = _this$props6.onOptionClick,
|
|
270
|
+
singleSelection = _this$props6.singleSelection,
|
|
271
|
+
options = _this$props6.options;
|
|
222
272
|
var changedOption = _objectSpread({}, removedOption);
|
|
223
273
|
var updatedOptions = options.map(function (option) {
|
|
224
274
|
var updatedOption = _objectSpread({}, option);
|
|
@@ -231,9 +281,9 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
231
281
|
onOptionClick(updatedOptions, event, changedOption);
|
|
232
282
|
});
|
|
233
283
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onExcludeOption", function (excludedOption, event) {
|
|
234
|
-
var _this$
|
|
235
|
-
onOptionClick = _this$
|
|
236
|
-
options = _this$
|
|
284
|
+
var _this$props7 = _this.props,
|
|
285
|
+
onOptionClick = _this$props7.onOptionClick,
|
|
286
|
+
options = _this$props7.options;
|
|
237
287
|
var changedOption = _objectSpread({}, excludedOption);
|
|
238
288
|
var updatedOptions = options.map(function (option) {
|
|
239
289
|
var updatedOption = _objectSpread({}, option);
|
|
@@ -262,76 +312,44 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
262
312
|
key: "render",
|
|
263
313
|
value: function render() {
|
|
264
314
|
var _this2 = this;
|
|
265
|
-
var _this$
|
|
266
|
-
className = _this$
|
|
267
|
-
options = _this$
|
|
268
|
-
searchValue = _this$
|
|
269
|
-
onOptionClick = _this$
|
|
270
|
-
renderOption = _this$
|
|
271
|
-
forcedHeight = _this$
|
|
272
|
-
windowProps = _this$
|
|
273
|
-
rowHeight = _this$
|
|
274
|
-
activeOptionIndex = _this$
|
|
275
|
-
makeOptionId = _this$
|
|
276
|
-
showIcons = _this$
|
|
277
|
-
singleSelection = _this$
|
|
278
|
-
visibleOptions = _this$
|
|
279
|
-
allowExclusions = _this$
|
|
280
|
-
bordered = _this$
|
|
281
|
-
paddingSize = _this$
|
|
282
|
-
searchable = _this$
|
|
283
|
-
onFocusBadge = _this$
|
|
284
|
-
listId = _this$
|
|
285
|
-
setActiveOptionIndex = _this$
|
|
286
|
-
ariaLabel = _this$
|
|
287
|
-
ariaLabelledby = _this$
|
|
288
|
-
ariaDescribedby = _this$
|
|
289
|
-
role = _this$
|
|
290
|
-
isVirtualized = _this$
|
|
291
|
-
textWrap = _this$
|
|
292
|
-
rest = (0, _objectWithoutProperties2.default)(_this$
|
|
315
|
+
var _this$props8 = this.props,
|
|
316
|
+
className = _this$props8.className,
|
|
317
|
+
options = _this$props8.options,
|
|
318
|
+
searchValue = _this$props8.searchValue,
|
|
319
|
+
onOptionClick = _this$props8.onOptionClick,
|
|
320
|
+
renderOption = _this$props8.renderOption,
|
|
321
|
+
forcedHeight = _this$props8.height,
|
|
322
|
+
windowProps = _this$props8.windowProps,
|
|
323
|
+
rowHeight = _this$props8.rowHeight,
|
|
324
|
+
activeOptionIndex = _this$props8.activeOptionIndex,
|
|
325
|
+
makeOptionId = _this$props8.makeOptionId,
|
|
326
|
+
showIcons = _this$props8.showIcons,
|
|
327
|
+
singleSelection = _this$props8.singleSelection,
|
|
328
|
+
visibleOptions = _this$props8.visibleOptions,
|
|
329
|
+
allowExclusions = _this$props8.allowExclusions,
|
|
330
|
+
bordered = _this$props8.bordered,
|
|
331
|
+
paddingSize = _this$props8.paddingSize,
|
|
332
|
+
searchable = _this$props8.searchable,
|
|
333
|
+
onFocusBadge = _this$props8.onFocusBadge,
|
|
334
|
+
listId = _this$props8.listId,
|
|
335
|
+
setActiveOptionIndex = _this$props8.setActiveOptionIndex,
|
|
336
|
+
ariaLabel = _this$props8['aria-label'],
|
|
337
|
+
ariaLabelledby = _this$props8['aria-labelledby'],
|
|
338
|
+
ariaDescribedby = _this$props8['aria-describedby'],
|
|
339
|
+
role = _this$props8.role,
|
|
340
|
+
isVirtualized = _this$props8.isVirtualized,
|
|
341
|
+
textWrap = _this$props8.textWrap,
|
|
342
|
+
rest = (0, _objectWithoutProperties2.default)(_this$props8, _excluded3);
|
|
293
343
|
var optionArray = visibleOptions || options;
|
|
294
344
|
this.calculateAriaSetAttrs(optionArray);
|
|
295
345
|
var heightIsFull = forcedHeight === 'full';
|
|
296
|
-
var calculatedHeight = heightIsFull ? false : forcedHeight;
|
|
297
|
-
|
|
298
|
-
// If calculatedHeight is still undefined, then calculate it
|
|
299
|
-
if (calculatedHeight === undefined) {
|
|
300
|
-
var maxVisibleOptions = 7;
|
|
301
|
-
var numVisibleOptions = optionArray.length;
|
|
302
|
-
var numVisibleMoreThanMax = optionArray.length > maxVisibleOptions;
|
|
303
|
-
if (numVisibleMoreThanMax) {
|
|
304
|
-
// Show only half of the last one to indicate there's more to scroll to
|
|
305
|
-
calculatedHeight = (maxVisibleOptions - 0.5) * rowHeight;
|
|
306
|
-
} else {
|
|
307
|
-
calculatedHeight = numVisibleOptions * rowHeight;
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
346
|
var classes = (0, _classnames.default)('euiSelectableList', {
|
|
311
347
|
'euiSelectableList-fullHeight': heightIsFull,
|
|
312
348
|
'euiSelectableList-bordered': bordered
|
|
313
349
|
}, className);
|
|
314
350
|
return (0, _react2.jsx)("div", (0, _extends2.default)({
|
|
315
351
|
className: classes
|
|
316
|
-
}, rest), isVirtualized ? (0, _react2.jsx)(
|
|
317
|
-
disableHeight: !heightIsFull
|
|
318
|
-
}, function (_ref3) {
|
|
319
|
-
var width = _ref3.width,
|
|
320
|
-
height = _ref3.height;
|
|
321
|
-
return (0, _react2.jsx)(_reactWindow.FixedSizeList, (0, _extends2.default)({
|
|
322
|
-
ref: _this2.setListRef,
|
|
323
|
-
outerRef: _this2.removeScrollableTabStop,
|
|
324
|
-
className: "euiSelectableList__list",
|
|
325
|
-
"data-skip-axe": "scrollable-region-focusable",
|
|
326
|
-
width: width,
|
|
327
|
-
height: calculatedHeight || height,
|
|
328
|
-
itemCount: optionArray.length,
|
|
329
|
-
itemData: optionArray,
|
|
330
|
-
itemSize: rowHeight,
|
|
331
|
-
innerElementType: "ul",
|
|
332
|
-
innerRef: _this2.setListBoxRef
|
|
333
|
-
}, windowProps), _this2.ListRow);
|
|
334
|
-
}) : (0, _react2.jsx)("div", {
|
|
352
|
+
}, rest), isVirtualized ? this.renderVirtualizedList(heightIsFull, optionArray) : (0, _react2.jsx)("div", {
|
|
335
353
|
className: "euiSelectableList__list",
|
|
336
354
|
ref: this.removeScrollableTabStop
|
|
337
355
|
}, (0, _react2.jsx)("ul", {
|