@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
|
@@ -18,7 +18,7 @@ var _portal = require("../portal");
|
|
|
18
18
|
var _accessibility = require("../accessibility");
|
|
19
19
|
var _flyout = require("./flyout.styles");
|
|
20
20
|
var _react2 = require("@emotion/react");
|
|
21
|
-
var _excluded = ["className", "children", "as", "hideCloseButton", "closeButtonProps", "closeButtonPosition", "onClose", "ownFocus", "side", "size", "paddingSize", "maxWidth", "style", "maskProps", "type", "outsideClickCloses", "pushMinBreakpoint", "focusTrapProps", "includeFixedHeadersInFocusTrap"];
|
|
21
|
+
var _excluded = ["className", "children", "as", "hideCloseButton", "closeButtonProps", "closeButtonPosition", "onClose", "ownFocus", "side", "size", "paddingSize", "maxWidth", "style", "maskProps", "type", "outsideClickCloses", "pushMinBreakpoint", "focusTrapProps", "includeFixedHeadersInFocusTrap", "aria-describedby"];
|
|
22
22
|
/*
|
|
23
23
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
24
24
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -94,6 +94,7 @@ var EuiFlyout = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
94
94
|
_focusTrapProps = _ref$focusTrapProps === void 0 ? {} : _ref$focusTrapProps,
|
|
95
95
|
_ref$includeFixedHead = _ref.includeFixedHeadersInFocusTrap,
|
|
96
96
|
includeFixedHeadersInFocusTrap = _ref$includeFixedHead === void 0 ? true : _ref$includeFixedHead,
|
|
97
|
+
_ariaDescribedBy = _ref['aria-describedby'],
|
|
97
98
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
98
99
|
var Element = as || defaultElement;
|
|
99
100
|
var maskRef = (0, _react.useRef)(null);
|
|
@@ -227,6 +228,7 @@ var EuiFlyout = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
227
228
|
*/
|
|
228
229
|
var hasOverlayMask = ownFocus && !isPushed;
|
|
229
230
|
var descriptionId = (0, _services.useGeneratedHtmlId)();
|
|
231
|
+
var ariaDescribedBy = (0, _classnames.default)(descriptionId, _ariaDescribedBy);
|
|
230
232
|
var screenReaderDescription = (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("p", {
|
|
231
233
|
id: descriptionId
|
|
232
234
|
}, hasOverlayMask ? (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
@@ -271,15 +273,15 @@ var EuiFlyout = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
271
273
|
clickOutsideDisables: !ownFocus,
|
|
272
274
|
onClickOutside: onClickOutside
|
|
273
275
|
}, focusTrapProps), (0, _react2.jsx)(Element, _extends({
|
|
274
|
-
css: cssStyles
|
|
275
|
-
}, rest, {
|
|
276
|
-
role: "dialog",
|
|
277
276
|
className: classes,
|
|
278
|
-
|
|
279
|
-
"data-autofocus": true,
|
|
280
|
-
"aria-describedby": !isPushed ? descriptionId : undefined,
|
|
277
|
+
css: cssStyles,
|
|
281
278
|
style: newStyle,
|
|
282
279
|
ref: setRef
|
|
280
|
+
}, rest, {
|
|
281
|
+
role: !isPushed ? 'dialog' : rest.role,
|
|
282
|
+
tabIndex: !isPushed ? 0 : rest.tabIndex,
|
|
283
|
+
"aria-describedby": !isPushed ? ariaDescribedBy : _ariaDescribedBy,
|
|
284
|
+
"data-autofocus": !isPushed || undefined
|
|
283
285
|
}), !isPushed && screenReaderDescription, closeButton, children));
|
|
284
286
|
|
|
285
287
|
// If ownFocus is set, wrap with an overlay and allow the user to click it to close it.
|
|
@@ -10,7 +10,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
10
10
|
var _services = require("../../services");
|
|
11
11
|
var _flyout_body = require("./flyout_body.styles");
|
|
12
12
|
var _react2 = require("@emotion/react");
|
|
13
|
-
var _excluded = ["children", "className", "banner"];
|
|
13
|
+
var _excluded = ["children", "className", "banner", "scrollableTabIndex"];
|
|
14
14
|
/*
|
|
15
15
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
16
16
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -26,6 +26,8 @@ var EuiFlyoutBody = function EuiFlyoutBody(_ref) {
|
|
|
26
26
|
var children = _ref.children,
|
|
27
27
|
className = _ref.className,
|
|
28
28
|
banner = _ref.banner,
|
|
29
|
+
_ref$scrollableTabInd = _ref.scrollableTabIndex,
|
|
30
|
+
scrollableTabIndex = _ref$scrollableTabInd === void 0 ? 0 : _ref$scrollableTabInd,
|
|
29
31
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
30
32
|
var classes = (0, _classnames.default)('euiFlyoutBody', className);
|
|
31
33
|
var euiTheme = (0, _services.useEuiTheme)();
|
|
@@ -37,7 +39,7 @@ var EuiFlyoutBody = function EuiFlyoutBody(_ref) {
|
|
|
37
39
|
className: classes,
|
|
38
40
|
css: cssStyles
|
|
39
41
|
}, rest), (0, _react2.jsx)("div", {
|
|
40
|
-
tabIndex:
|
|
42
|
+
tabIndex: scrollableTabIndex,
|
|
41
43
|
className: "euiFlyoutBody__overflow",
|
|
42
44
|
css: overflowCssStyles
|
|
43
45
|
}, banner && (0, _react2.jsx)("div", {
|
|
@@ -56,5 +58,15 @@ EuiFlyoutBody.propTypes = {
|
|
|
56
58
|
/**
|
|
57
59
|
* Use to display a banner at the top of the body. It is suggested to use `EuiCallOut` for it.
|
|
58
60
|
*/
|
|
59
|
-
banner: _propTypes.default.node
|
|
61
|
+
banner: _propTypes.default.node,
|
|
62
|
+
/**
|
|
63
|
+
* [Scrollable regions (or their children) should be focusable](https://dequeuniversity.com/rules/axe/4.0/scrollable-region-focusable)
|
|
64
|
+
* to allow keyboard users to scroll the region via arrow keys.
|
|
65
|
+
*
|
|
66
|
+
* By default, EuiFlyoutBody's scroll overflow wrapper sets a `tabIndex` of `0`.
|
|
67
|
+
* If you know your flyout body content already contains focusable children
|
|
68
|
+
* that satisfy keyboard accessibility requirements, you can use this prop
|
|
69
|
+
* to override this default.
|
|
70
|
+
*/
|
|
71
|
+
scrollableTabIndex: _propTypes.default.number
|
|
60
72
|
};
|
|
@@ -27,7 +27,7 @@ var _range = require("./range.styles");
|
|
|
27
27
|
var _dual_range = require("./dual_range.styles");
|
|
28
28
|
var _i18n = require("../../i18n");
|
|
29
29
|
var _react2 = require("@emotion/react");
|
|
30
|
-
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"];
|
|
30
|
+
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"];
|
|
31
31
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
32
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
33
|
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; }
|
|
@@ -273,9 +273,11 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
273
273
|
});
|
|
274
274
|
});
|
|
275
275
|
_defineProperty(_assertThisInitialized(_this), "onResize", function (width) {
|
|
276
|
+
var _this$props$inputPopo, _this$props$inputPopo2;
|
|
276
277
|
_this.setState({
|
|
277
278
|
rangeWidth: width
|
|
278
279
|
});
|
|
280
|
+
(_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);
|
|
279
281
|
});
|
|
280
282
|
_defineProperty(_assertThisInitialized(_this), "getNearestStep", function (value) {
|
|
281
283
|
var min = _this.props.min;
|
|
@@ -392,6 +394,7 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
392
394
|
prepend = _this$props.prepend,
|
|
393
395
|
minInputProps = _this$props.minInputProps,
|
|
394
396
|
maxInputProps = _this$props.maxInputProps,
|
|
397
|
+
inputPopoverProps = _this$props.inputPopoverProps,
|
|
395
398
|
isDraggable = _this$props.isDraggable,
|
|
396
399
|
theme = _this$props.theme,
|
|
397
400
|
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
@@ -632,8 +635,8 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
632
635
|
className: showTicks || ticks ? 'euiRange__slimHorizontalSpacer' : 'euiRange__horizontalSpacer',
|
|
633
636
|
css: showTicks || ticks ? rangeStyles.euiRange__slimHorizontalSpacer : rangeStyles.euiRange__horizontalSpacer
|
|
634
637
|
}), maxInput));
|
|
635
|
-
var thePopover = showInputOnly ? (0, _react2.jsx)(_popover.EuiInputPopover, {
|
|
636
|
-
className:
|
|
638
|
+
var thePopover = showInputOnly ? (0, _react2.jsx)(_popover.EuiInputPopover, _extends({}, inputPopoverProps, {
|
|
639
|
+
className: (0, _classnames.default)('euiDualRange__popover', inputPopoverProps === null || inputPopoverProps === void 0 ? void 0 : inputPopoverProps.className),
|
|
637
640
|
input: (0, _react2.jsx)(_form_control_layout.EuiFormControlLayoutDelimited, {
|
|
638
641
|
startControl: minInput,
|
|
639
642
|
endControl: maxInput,
|
|
@@ -652,7 +655,7 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
652
655
|
disableFocusTrap: true,
|
|
653
656
|
onPanelResize: this.onResize,
|
|
654
657
|
popoverScreenReaderText: dualSliderScreenReaderInstructions
|
|
655
|
-
}, theRange) : undefined;
|
|
658
|
+
}), theRange) : undefined;
|
|
656
659
|
return thePopover || theRange;
|
|
657
660
|
}
|
|
658
661
|
}]);
|
|
@@ -773,14 +776,38 @@ EuiDualRangeClass.propTypes = {
|
|
|
773
776
|
* @default false
|
|
774
777
|
*/
|
|
775
778
|
fullWidth: _propTypes.default.bool,
|
|
779
|
+
/**
|
|
780
|
+
* Only impacts inputs rendered by the `showInput` prop
|
|
781
|
+
*/
|
|
782
|
+
isInvalid: _propTypes.default.bool,
|
|
776
783
|
/**
|
|
777
784
|
* Only impacts inputs rendered when the `showInput` prop is set to `"inputWithPopover"`
|
|
778
785
|
*/
|
|
779
786
|
isLoading: _propTypes.default.bool,
|
|
780
787
|
/**
|
|
781
|
-
* Only impacts
|
|
788
|
+
* Only impacts input popovers rendered when the `showInput` prop is set to `"inputWithPopover"`
|
|
789
|
+
*
|
|
790
|
+
* Allows customizing the underlying [EuiInputPopover](/#/layout/popover#popover-attached-to-input-element),
|
|
791
|
+
* except for props controlled by the range component
|
|
782
792
|
*/
|
|
783
|
-
|
|
793
|
+
inputPopoverProps: _propTypes.default.shape({
|
|
794
|
+
className: _propTypes.default.string,
|
|
795
|
+
"aria-label": _propTypes.default.string,
|
|
796
|
+
"data-test-subj": _propTypes.default.string,
|
|
797
|
+
css: _propTypes.default.any,
|
|
798
|
+
/**
|
|
799
|
+
* Alignment of the popover relative to the input
|
|
800
|
+
*/
|
|
801
|
+
anchorPosition: _propTypes.default.oneOf(["downLeft", "downRight", "downCenter"]),
|
|
802
|
+
inputRef: _propTypes.default.any,
|
|
803
|
+
onPanelResize: _propTypes.default.func,
|
|
804
|
+
/**
|
|
805
|
+
* By default, **EuiInputPopovers** inherit the same width as the passed input element.
|
|
806
|
+
* However, if the input width is too small, you can pass a minimum panel width
|
|
807
|
+
* (that should be based on the popover content).
|
|
808
|
+
*/
|
|
809
|
+
panelMinWidth: _propTypes.default.number
|
|
810
|
+
})
|
|
784
811
|
};
|
|
785
812
|
var EuiDualRange = (0, _services.withEuiTheme)(EuiDualRangeClass);
|
|
786
813
|
exports.EuiDualRange = EuiDualRange;
|
|
@@ -22,7 +22,7 @@ var _range_wrapper = require("./range_wrapper");
|
|
|
22
22
|
var _range = require("./range.styles");
|
|
23
23
|
var _i18n = require("../../i18n");
|
|
24
24
|
var _react2 = require("@emotion/react");
|
|
25
|
-
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"];
|
|
25
|
+
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"];
|
|
26
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
27
|
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); }
|
|
28
28
|
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; }
|
|
@@ -128,6 +128,7 @@ var EuiRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
128
128
|
step = _this$props.step,
|
|
129
129
|
showLabels = _this$props.showLabels,
|
|
130
130
|
showInput = _this$props.showInput,
|
|
131
|
+
inputPopoverProps = _this$props.inputPopoverProps,
|
|
131
132
|
showTicks = _this$props.showTicks,
|
|
132
133
|
tickInterval = _this$props.tickInterval,
|
|
133
134
|
ticks = _this$props.ticks,
|
|
@@ -240,8 +241,8 @@ var EuiRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
240
241
|
className: showTicks || ticks ? 'euiRange__slimHorizontalSpacer' : 'euiRange__horizontalSpacer',
|
|
241
242
|
css: showTicks || ticks ? styles.euiRange__slimHorizontalSpacer : styles.euiRange__horizontalSpacer
|
|
242
243
|
}), theInput));
|
|
243
|
-
var thePopover = showInputOnly ? (0, _react2.jsx)(_popover.EuiInputPopover, {
|
|
244
|
-
className:
|
|
244
|
+
var thePopover = showInputOnly ? (0, _react2.jsx)(_popover.EuiInputPopover, _extends({}, inputPopoverProps, {
|
|
245
|
+
className: (0, _classnames.default)('euiRange__popover', inputPopoverProps === null || inputPopoverProps === void 0 ? void 0 : inputPopoverProps.className),
|
|
245
246
|
input: theInput // `showInputOnly` confirms existence
|
|
246
247
|
,
|
|
247
248
|
fullWidth: fullWidth,
|
|
@@ -249,7 +250,7 @@ var EuiRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
249
250
|
closePopover: this.closePopover,
|
|
250
251
|
disableFocusTrap: true,
|
|
251
252
|
popoverScreenReaderText: sliderScreenReaderInstructions
|
|
252
|
-
}, theRange) : undefined;
|
|
253
|
+
}), theRange) : undefined;
|
|
253
254
|
return thePopover ? thePopover : theRange;
|
|
254
255
|
}
|
|
255
256
|
}]);
|
|
@@ -369,14 +370,21 @@ EuiRangeClass.propTypes = {
|
|
|
369
370
|
* @default false
|
|
370
371
|
*/
|
|
371
372
|
fullWidth: _propTypes.default.bool,
|
|
373
|
+
/**
|
|
374
|
+
* Only impacts inputs rendered by the `showInput` prop
|
|
375
|
+
*/
|
|
376
|
+
isInvalid: _propTypes.default.bool,
|
|
372
377
|
/**
|
|
373
378
|
* Only impacts inputs rendered when the `showInput` prop is set to `"inputWithPopover"`
|
|
374
379
|
*/
|
|
375
380
|
isLoading: _propTypes.default.bool,
|
|
376
381
|
/**
|
|
377
|
-
* Only impacts
|
|
382
|
+
* Only impacts input popovers rendered when the `showInput` prop is set to `"inputWithPopover"`
|
|
383
|
+
*
|
|
384
|
+
* Allows customizing the underlying [EuiInputPopover](/#/layout/popover#popover-attached-to-input-element),
|
|
385
|
+
* except for props controlled by the range component
|
|
378
386
|
*/
|
|
379
|
-
|
|
387
|
+
inputPopoverProps: _propTypes.default.any
|
|
380
388
|
};
|
|
381
389
|
var EuiRange = (0, _services.withEuiTheme)(EuiRangeClass);
|
|
382
390
|
exports.EuiRange = EuiRange;
|
|
@@ -360,7 +360,7 @@ EuiSuperSelect.propTypes = {
|
|
|
360
360
|
*/
|
|
361
361
|
isOpen: _propTypes.default.bool,
|
|
362
362
|
/**
|
|
363
|
-
* Optional props to pass to the underlying [
|
|
363
|
+
* Optional props to pass to the underlying [EuiInputPopover](/#/layout/popover#popover-attached-to-input-element).
|
|
364
364
|
* Allows fine-grained control of the popover dropdown menu, including
|
|
365
365
|
* `repositionOnScroll` for EuiSuperSelects used within scrollable containers,
|
|
366
366
|
* and customizing popover panel styling.
|
|
@@ -59,7 +59,7 @@ var EuiPageSidebar = function EuiPageSidebar(_ref) {
|
|
|
59
59
|
_useState2 = _slicedToArray(_useState, 2),
|
|
60
60
|
inlineStyles = _useState2[0],
|
|
61
61
|
setInlineStyles = _useState2[1];
|
|
62
|
-
(0, _react.
|
|
62
|
+
(0, _react.useLayoutEffect)(function () {
|
|
63
63
|
var updatedStyles = _objectSpread(_objectSpread({}, style), (0, _global_styling.logicalStyle)('min-width', isResponding ? '100%' : minWidth));
|
|
64
64
|
if (sticky) {
|
|
65
65
|
var _document$body$datase;
|
|
@@ -48,6 +48,14 @@ var TemplateContext = /*#__PURE__*/(0, _react.createContext)({
|
|
|
48
48
|
bottomBar: {}
|
|
49
49
|
});
|
|
50
50
|
exports.TemplateContext = TemplateContext;
|
|
51
|
+
var calculateOffset = function calculateOffset(base) {
|
|
52
|
+
var _document$body$datase;
|
|
53
|
+
if (typeof document === 'undefined') return 0; // SSR catch
|
|
54
|
+
|
|
55
|
+
var euiHeaderFixedCounter = Number((_document$body$datase = document.body.dataset.fixedHeaders) !== null && _document$body$datase !== void 0 ? _document$body$datase : 0);
|
|
56
|
+
return base * 3 * euiHeaderFixedCounter;
|
|
57
|
+
};
|
|
58
|
+
|
|
51
59
|
/**
|
|
52
60
|
* Consumed via `EuiPageTemplate`,
|
|
53
61
|
* it controls and propogates most of the shared props per direct child
|
|
@@ -74,7 +82,9 @@ var _EuiPageTemplate = function _EuiPageTemplate(_ref) {
|
|
|
74
82
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
75
83
|
var _useEuiTheme = (0, _services.useEuiTheme)(),
|
|
76
84
|
euiTheme = _useEuiTheme.euiTheme;
|
|
77
|
-
var _useState = (0, _react.useState)(
|
|
85
|
+
var _useState = (0, _react.useState)(function () {
|
|
86
|
+
return _offset !== null && _offset !== void 0 ? _offset : calculateOffset(euiTheme.base);
|
|
87
|
+
}),
|
|
78
88
|
_useState2 = _slicedToArray(_useState, 2),
|
|
79
89
|
offset = _useState2[0],
|
|
80
90
|
setOffset = _useState2[1];
|
|
@@ -87,9 +97,7 @@ var _EuiPageTemplate = function _EuiPageTemplate(_ref) {
|
|
|
87
97
|
});
|
|
88
98
|
(0, _react.useEffect)(function () {
|
|
89
99
|
if (_offset === undefined) {
|
|
90
|
-
|
|
91
|
-
var euiHeaderFixedCounter = Number((_document$body$datase = document.body.dataset.fixedHeaders) !== null && _document$body$datase !== void 0 ? _document$body$datase : 0);
|
|
92
|
-
setOffset(euiTheme.base * 3 * euiHeaderFixedCounter);
|
|
100
|
+
setOffset(calculateOffset(euiTheme.base));
|
|
93
101
|
}
|
|
94
102
|
}, [_offset, euiTheme.base]);
|
|
95
103
|
|
|
@@ -16,7 +16,7 @@ var _services = require("../../services");
|
|
|
16
16
|
var _form = require("../form/form.styles");
|
|
17
17
|
var _react2 = require("@emotion/react");
|
|
18
18
|
var _global_styling = require("../../global_styling");
|
|
19
|
-
var _excluded = ["children", "className", "disableFocusTrap", "focusTrapProps", "input", "fullWidth", "onPanelResize", "inputRef", "panelRef"];
|
|
19
|
+
var _excluded = ["children", "className", "disableFocusTrap", "focusTrapProps", "input", "fullWidth", "panelMinWidth", "onPanelResize", "inputRef", "panelRef"];
|
|
20
20
|
/*
|
|
21
21
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
22
22
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -45,6 +45,8 @@ var EuiInputPopover = function EuiInputPopover(_ref) {
|
|
|
45
45
|
input = _ref.input,
|
|
46
46
|
_ref$fullWidth = _ref.fullWidth,
|
|
47
47
|
fullWidth = _ref$fullWidth === void 0 ? false : _ref$fullWidth,
|
|
48
|
+
_ref$panelMinWidth = _ref.panelMinWidth,
|
|
49
|
+
panelMinWidth = _ref$panelMinWidth === void 0 ? 0 : _ref$panelMinWidth,
|
|
48
50
|
onPanelResize = _ref.onPanelResize,
|
|
49
51
|
_inputRef = _ref.inputRef,
|
|
50
52
|
_panelRef = _ref.panelRef,
|
|
@@ -62,22 +64,24 @@ var EuiInputPopover = function EuiInputPopover(_ref) {
|
|
|
62
64
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
63
65
|
panelEl = _useState6[0],
|
|
64
66
|
setPanelEl = _useState6[1];
|
|
67
|
+
var popoverClassRef = (0, _react.useRef)(null);
|
|
65
68
|
var inputRef = (0, _services.useCombinedRefs)([setInputEl, _inputRef]);
|
|
66
69
|
var panelRef = (0, _services.useCombinedRefs)([setPanelEl, _panelRef]);
|
|
67
70
|
var setPanelWidth = (0, _react.useCallback)(function (width) {
|
|
68
71
|
if (panelEl && (!!inputElWidth || !!width)) {
|
|
69
72
|
var newWidth = !!width ? width : inputElWidth;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
73
|
+
var widthToSet = newWidth && newWidth > panelMinWidth ? newWidth : panelMinWidth;
|
|
74
|
+
panelEl.style.width = "".concat(widthToSet, "px");
|
|
75
|
+
onPanelResize === null || onPanelResize === void 0 ? void 0 : onPanelResize(widthToSet);
|
|
74
76
|
}
|
|
75
|
-
}, [panelEl, inputElWidth, onPanelResize]);
|
|
77
|
+
}, [panelEl, inputElWidth, onPanelResize, panelMinWidth]);
|
|
76
78
|
var onResize = (0, _react.useCallback)(function () {
|
|
77
79
|
if (inputEl) {
|
|
80
|
+
var _popoverClassRef$curr;
|
|
78
81
|
var _width = inputEl.getBoundingClientRect().width;
|
|
79
82
|
setInputElWidth(_width);
|
|
80
83
|
setPanelWidth(_width);
|
|
84
|
+
(_popoverClassRef$curr = popoverClassRef.current) === null || _popoverClassRef$curr === void 0 ? void 0 : _popoverClassRef$curr.positionPopoverFluid();
|
|
81
85
|
}
|
|
82
86
|
}, [inputEl, setPanelWidth]);
|
|
83
87
|
(0, _react.useEffect)(function () {
|
|
@@ -112,7 +116,8 @@ var EuiInputPopover = function EuiInputPopover(_ref) {
|
|
|
112
116
|
}),
|
|
113
117
|
buttonRef: inputRef,
|
|
114
118
|
panelRef: panelRef,
|
|
115
|
-
className: classes
|
|
119
|
+
className: classes,
|
|
120
|
+
ref: popoverClassRef
|
|
116
121
|
}, props), (0, _react2.jsx)(_focus_trap.EuiFocusTrap, _extends({
|
|
117
122
|
clickOutsideDisables: true,
|
|
118
123
|
disabled: disableFocusTrap
|
|
@@ -126,11 +131,21 @@ EuiInputPopover.propTypes = {
|
|
|
126
131
|
"aria-label": _propTypes.default.string,
|
|
127
132
|
"data-test-subj": _propTypes.default.string,
|
|
128
133
|
css: _propTypes.default.any,
|
|
134
|
+
/**
|
|
135
|
+
* Alignment of the popover relative to the input
|
|
136
|
+
*/
|
|
137
|
+
anchorPosition: _propTypes.default.oneOf(["downLeft", "downRight", "downCenter"]),
|
|
129
138
|
disableFocusTrap: _propTypes.default.bool,
|
|
130
139
|
fullWidth: _propTypes.default.bool,
|
|
131
140
|
input: _propTypes.default.any.isRequired,
|
|
132
141
|
inputRef: _propTypes.default.any,
|
|
133
|
-
onPanelResize: _propTypes.default.func
|
|
142
|
+
onPanelResize: _propTypes.default.func,
|
|
143
|
+
/**
|
|
144
|
+
* By default, **EuiInputPopovers** inherit the same width as the passed input element.
|
|
145
|
+
* However, if the input width is too small, you can pass a minimum panel width
|
|
146
|
+
* (that should be based on the popover content).
|
|
147
|
+
*/
|
|
148
|
+
panelMinWidth: _propTypes.default.number
|
|
134
149
|
};
|
|
135
150
|
EuiInputPopover.defaultProps = {
|
|
136
151
|
anchorPosition: 'downLeft',
|
|
@@ -230,8 +230,7 @@ var EuiPopover = /*#__PURE__*/function (_Component) {
|
|
|
230
230
|
top = _findPopoverPosition.top,
|
|
231
231
|
left = _findPopoverPosition.left,
|
|
232
232
|
foundPosition = _findPopoverPosition.position,
|
|
233
|
-
arrow = _findPopoverPosition.arrow
|
|
234
|
-
anchorBoundingBox = _findPopoverPosition.anchorBoundingBox;
|
|
233
|
+
arrow = _findPopoverPosition.arrow;
|
|
235
234
|
|
|
236
235
|
// the popover's z-index must inherit from the button
|
|
237
236
|
// this keeps a button's popover under a flyout that would cover the button
|
|
@@ -240,7 +239,7 @@ var EuiPopover = /*#__PURE__*/function (_Component) {
|
|
|
240
239
|
var zIndex = zIndexProp == null ? (0, _popover.getElementZIndex)(_this.button, _this.panel) + 2000 : zIndexProp;
|
|
241
240
|
var popoverStyles = _objectSpread(_objectSpread({}, _this.props.panelStyle), {}, {
|
|
242
241
|
top: top,
|
|
243
|
-
left:
|
|
242
|
+
left: left,
|
|
244
243
|
zIndex: zIndex
|
|
245
244
|
});
|
|
246
245
|
var willRenderArrow = !_this.props.attachToAnchor && _this.props.hasArrow;
|
|
@@ -562,9 +561,8 @@ EuiPopover.propTypes = {
|
|
|
562
561
|
*/
|
|
563
562
|
anchorPosition: _propTypes.default.any,
|
|
564
563
|
/**
|
|
565
|
-
* Style and position alteration for arrow-less
|
|
566
|
-
*
|
|
567
|
-
* EuiInputPopover
|
|
564
|
+
* Style and position alteration for arrow-less attachment.
|
|
565
|
+
* Intended for use with inputs as anchors, e.g. EuiInputPopover
|
|
568
566
|
*/
|
|
569
567
|
attachToAnchor: _propTypes.default.bool,
|
|
570
568
|
/**
|
|
@@ -176,17 +176,67 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
176
176
|
search: searchValue
|
|
177
177
|
}, label));
|
|
178
178
|
}, _reactWindow.areEqual));
|
|
179
|
+
_defineProperty(_assertThisInitialized(_this), "renderVirtualizedList", function (heightIsFull, optionArray) {
|
|
180
|
+
if (!_this.props.isVirtualized) return null;
|
|
181
|
+
var _this$props3 = _this.props,
|
|
182
|
+
windowProps = _this$props3.windowProps,
|
|
183
|
+
forcedHeight = _this$props3.height,
|
|
184
|
+
rowHeight = _this$props3.rowHeight;
|
|
185
|
+
var virtualizationProps = _objectSpread({
|
|
186
|
+
className: 'euiSelectableList__list',
|
|
187
|
+
ref: _this.setListRef,
|
|
188
|
+
outerRef: _this.removeScrollableTabStop,
|
|
189
|
+
innerRef: _this.setListBoxRef,
|
|
190
|
+
innerElementType: 'ul',
|
|
191
|
+
itemCount: optionArray.length,
|
|
192
|
+
itemData: optionArray,
|
|
193
|
+
itemSize: rowHeight,
|
|
194
|
+
'data-skip-axe': 'scrollable-region-focusable'
|
|
195
|
+
}, windowProps);
|
|
196
|
+
|
|
197
|
+
// Calculated height is only used if height is not full
|
|
198
|
+
var calculatedHeight = !heightIsFull ? forcedHeight || 0 : 0;
|
|
199
|
+
|
|
200
|
+
// If calculatedHeight is still falsy, then calculate it
|
|
201
|
+
if (!heightIsFull && !calculatedHeight) {
|
|
202
|
+
var maxVisibleOptions = 7;
|
|
203
|
+
var numVisibleOptions = optionArray.length;
|
|
204
|
+
var numVisibleMoreThanMax = optionArray.length > maxVisibleOptions;
|
|
205
|
+
if (numVisibleMoreThanMax) {
|
|
206
|
+
// Show only half of the last one to indicate there's more to scroll to
|
|
207
|
+
calculatedHeight = (maxVisibleOptions - 0.5) * rowHeight;
|
|
208
|
+
} else {
|
|
209
|
+
calculatedHeight = numVisibleOptions * rowHeight;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return heightIsFull ? (0, _react2.jsx)(_auto_sizer.EuiAutoSizer, null, function (_ref2) {
|
|
213
|
+
var width = _ref2.width,
|
|
214
|
+
height = _ref2.height;
|
|
215
|
+
return (0, _react2.jsx)(_reactWindow.FixedSizeList, _extends({
|
|
216
|
+
width: width,
|
|
217
|
+
height: height
|
|
218
|
+
}, virtualizationProps), _this.ListRow);
|
|
219
|
+
}) : (0, _react2.jsx)(_auto_sizer.EuiAutoSizer, {
|
|
220
|
+
disableHeight: true
|
|
221
|
+
}, function (_ref3) {
|
|
222
|
+
var width = _ref3.width;
|
|
223
|
+
return (0, _react2.jsx)(_reactWindow.FixedSizeList, _extends({
|
|
224
|
+
width: width,
|
|
225
|
+
height: calculatedHeight
|
|
226
|
+
}, virtualizationProps), _this.ListRow);
|
|
227
|
+
});
|
|
228
|
+
});
|
|
179
229
|
_defineProperty(_assertThisInitialized(_this), "onAddOrRemoveOption", function (option, event) {
|
|
180
230
|
if (option.disabled) {
|
|
181
231
|
return;
|
|
182
232
|
}
|
|
183
|
-
var _this$
|
|
184
|
-
allowExclusions = _this$
|
|
185
|
-
options = _this$
|
|
186
|
-
_this$
|
|
187
|
-
visibleOptions = _this$
|
|
188
|
-
_this.props.setActiveOptionIndex(visibleOptions.findIndex(function (
|
|
189
|
-
var label =
|
|
233
|
+
var _this$props4 = _this.props,
|
|
234
|
+
allowExclusions = _this$props4.allowExclusions,
|
|
235
|
+
options = _this$props4.options,
|
|
236
|
+
_this$props4$visibleO = _this$props4.visibleOptions,
|
|
237
|
+
visibleOptions = _this$props4$visibleO === void 0 ? options : _this$props4$visibleO;
|
|
238
|
+
_this.props.setActiveOptionIndex(visibleOptions.findIndex(function (_ref4) {
|
|
239
|
+
var label = _ref4.label;
|
|
190
240
|
return label === option.label;
|
|
191
241
|
}), function () {
|
|
192
242
|
if (option.checked === 'on' && allowExclusions) {
|
|
@@ -199,10 +249,10 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
199
249
|
});
|
|
200
250
|
});
|
|
201
251
|
_defineProperty(_assertThisInitialized(_this), "onAddOption", function (addedOption, event) {
|
|
202
|
-
var _this$
|
|
203
|
-
onOptionClick = _this$
|
|
204
|
-
options = _this$
|
|
205
|
-
singleSelection = _this$
|
|
252
|
+
var _this$props5 = _this.props,
|
|
253
|
+
onOptionClick = _this$props5.onOptionClick,
|
|
254
|
+
options = _this$props5.options,
|
|
255
|
+
singleSelection = _this$props5.singleSelection;
|
|
206
256
|
var changedOption = _objectSpread({}, addedOption);
|
|
207
257
|
var updatedOptions = options.map(function (option) {
|
|
208
258
|
// if singleSelection is enabled, uncheck any selected option(s)
|
|
@@ -221,10 +271,10 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
221
271
|
onOptionClick(updatedOptions, event, changedOption);
|
|
222
272
|
});
|
|
223
273
|
_defineProperty(_assertThisInitialized(_this), "onRemoveOption", function (removedOption, event) {
|
|
224
|
-
var _this$
|
|
225
|
-
onOptionClick = _this$
|
|
226
|
-
singleSelection = _this$
|
|
227
|
-
options = _this$
|
|
274
|
+
var _this$props6 = _this.props,
|
|
275
|
+
onOptionClick = _this$props6.onOptionClick,
|
|
276
|
+
singleSelection = _this$props6.singleSelection,
|
|
277
|
+
options = _this$props6.options;
|
|
228
278
|
var changedOption = _objectSpread({}, removedOption);
|
|
229
279
|
var updatedOptions = options.map(function (option) {
|
|
230
280
|
var updatedOption = _objectSpread({}, option);
|
|
@@ -237,9 +287,9 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
237
287
|
onOptionClick(updatedOptions, event, changedOption);
|
|
238
288
|
});
|
|
239
289
|
_defineProperty(_assertThisInitialized(_this), "onExcludeOption", function (excludedOption, event) {
|
|
240
|
-
var _this$
|
|
241
|
-
onOptionClick = _this$
|
|
242
|
-
options = _this$
|
|
290
|
+
var _this$props7 = _this.props,
|
|
291
|
+
onOptionClick = _this$props7.onOptionClick,
|
|
292
|
+
options = _this$props7.options;
|
|
243
293
|
var changedOption = _objectSpread({}, excludedOption);
|
|
244
294
|
var updatedOptions = options.map(function (option) {
|
|
245
295
|
var updatedOption = _objectSpread({}, option);
|
|
@@ -268,76 +318,44 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
268
318
|
key: "render",
|
|
269
319
|
value: function render() {
|
|
270
320
|
var _this2 = this;
|
|
271
|
-
var _this$
|
|
272
|
-
className = _this$
|
|
273
|
-
options = _this$
|
|
274
|
-
searchValue = _this$
|
|
275
|
-
onOptionClick = _this$
|
|
276
|
-
renderOption = _this$
|
|
277
|
-
forcedHeight = _this$
|
|
278
|
-
windowProps = _this$
|
|
279
|
-
rowHeight = _this$
|
|
280
|
-
activeOptionIndex = _this$
|
|
281
|
-
makeOptionId = _this$
|
|
282
|
-
showIcons = _this$
|
|
283
|
-
singleSelection = _this$
|
|
284
|
-
visibleOptions = _this$
|
|
285
|
-
allowExclusions = _this$
|
|
286
|
-
bordered = _this$
|
|
287
|
-
paddingSize = _this$
|
|
288
|
-
searchable = _this$
|
|
289
|
-
onFocusBadge = _this$
|
|
290
|
-
listId = _this$
|
|
291
|
-
setActiveOptionIndex = _this$
|
|
292
|
-
ariaLabel = _this$
|
|
293
|
-
ariaLabelledby = _this$
|
|
294
|
-
ariaDescribedby = _this$
|
|
295
|
-
role = _this$
|
|
296
|
-
isVirtualized = _this$
|
|
297
|
-
textWrap = _this$
|
|
298
|
-
rest = _objectWithoutProperties(_this$
|
|
321
|
+
var _this$props8 = this.props,
|
|
322
|
+
className = _this$props8.className,
|
|
323
|
+
options = _this$props8.options,
|
|
324
|
+
searchValue = _this$props8.searchValue,
|
|
325
|
+
onOptionClick = _this$props8.onOptionClick,
|
|
326
|
+
renderOption = _this$props8.renderOption,
|
|
327
|
+
forcedHeight = _this$props8.height,
|
|
328
|
+
windowProps = _this$props8.windowProps,
|
|
329
|
+
rowHeight = _this$props8.rowHeight,
|
|
330
|
+
activeOptionIndex = _this$props8.activeOptionIndex,
|
|
331
|
+
makeOptionId = _this$props8.makeOptionId,
|
|
332
|
+
showIcons = _this$props8.showIcons,
|
|
333
|
+
singleSelection = _this$props8.singleSelection,
|
|
334
|
+
visibleOptions = _this$props8.visibleOptions,
|
|
335
|
+
allowExclusions = _this$props8.allowExclusions,
|
|
336
|
+
bordered = _this$props8.bordered,
|
|
337
|
+
paddingSize = _this$props8.paddingSize,
|
|
338
|
+
searchable = _this$props8.searchable,
|
|
339
|
+
onFocusBadge = _this$props8.onFocusBadge,
|
|
340
|
+
listId = _this$props8.listId,
|
|
341
|
+
setActiveOptionIndex = _this$props8.setActiveOptionIndex,
|
|
342
|
+
ariaLabel = _this$props8['aria-label'],
|
|
343
|
+
ariaLabelledby = _this$props8['aria-labelledby'],
|
|
344
|
+
ariaDescribedby = _this$props8['aria-describedby'],
|
|
345
|
+
role = _this$props8.role,
|
|
346
|
+
isVirtualized = _this$props8.isVirtualized,
|
|
347
|
+
textWrap = _this$props8.textWrap,
|
|
348
|
+
rest = _objectWithoutProperties(_this$props8, _excluded3);
|
|
299
349
|
var optionArray = visibleOptions || options;
|
|
300
350
|
this.calculateAriaSetAttrs(optionArray);
|
|
301
351
|
var heightIsFull = forcedHeight === 'full';
|
|
302
|
-
var calculatedHeight = heightIsFull ? false : forcedHeight;
|
|
303
|
-
|
|
304
|
-
// If calculatedHeight is still undefined, then calculate it
|
|
305
|
-
if (calculatedHeight === undefined) {
|
|
306
|
-
var maxVisibleOptions = 7;
|
|
307
|
-
var numVisibleOptions = optionArray.length;
|
|
308
|
-
var numVisibleMoreThanMax = optionArray.length > maxVisibleOptions;
|
|
309
|
-
if (numVisibleMoreThanMax) {
|
|
310
|
-
// Show only half of the last one to indicate there's more to scroll to
|
|
311
|
-
calculatedHeight = (maxVisibleOptions - 0.5) * rowHeight;
|
|
312
|
-
} else {
|
|
313
|
-
calculatedHeight = numVisibleOptions * rowHeight;
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
352
|
var classes = (0, _classnames.default)('euiSelectableList', {
|
|
317
353
|
'euiSelectableList-fullHeight': heightIsFull,
|
|
318
354
|
'euiSelectableList-bordered': bordered
|
|
319
355
|
}, className);
|
|
320
356
|
return (0, _react2.jsx)("div", _extends({
|
|
321
357
|
className: classes
|
|
322
|
-
}, rest), isVirtualized ? (0, _react2.jsx)(
|
|
323
|
-
disableHeight: !heightIsFull
|
|
324
|
-
}, function (_ref3) {
|
|
325
|
-
var width = _ref3.width,
|
|
326
|
-
height = _ref3.height;
|
|
327
|
-
return (0, _react2.jsx)(_reactWindow.FixedSizeList, _extends({
|
|
328
|
-
ref: _this2.setListRef,
|
|
329
|
-
outerRef: _this2.removeScrollableTabStop,
|
|
330
|
-
className: "euiSelectableList__list",
|
|
331
|
-
"data-skip-axe": "scrollable-region-focusable",
|
|
332
|
-
width: width,
|
|
333
|
-
height: calculatedHeight || height,
|
|
334
|
-
itemCount: optionArray.length,
|
|
335
|
-
itemData: optionArray,
|
|
336
|
-
itemSize: rowHeight,
|
|
337
|
-
innerElementType: "ul",
|
|
338
|
-
innerRef: _this2.setListBoxRef
|
|
339
|
-
}, windowProps), _this2.ListRow);
|
|
340
|
-
}) : (0, _react2.jsx)("div", {
|
|
358
|
+
}, rest), isVirtualized ? this.renderVirtualizedList(heightIsFull, optionArray) : (0, _react2.jsx)("div", {
|
|
341
359
|
className: "euiSelectableList__list",
|
|
342
360
|
ref: this.removeScrollableTabStop
|
|
343
361
|
}, (0, _react2.jsx)("ul", {
|