@elastic/eui 87.0.0 → 87.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/eui_theme_dark.css +0 -234
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +0 -234
- package/dist/eui_theme_light.min.css +1 -1
- 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 +14 -5
- package/es/components/popover/input_popover.js +24 -9
- package/es/components/popover/popover.js +4 -6
- package/es/components/resizable_container/index.js +2 -1
- package/es/components/resizable_container/resizable_button.js +81 -50
- package/es/components/resizable_container/resizable_button.styles.js +66 -0
- package/es/components/resizable_container/resizable_collapse_button.js +24 -14
- package/es/components/resizable_container/resizable_collapse_button.styles.js +85 -0
- package/es/components/selectable/selectable_list/selectable_list.js +97 -79
- package/es/components/steps/step.styles.js +5 -5
- 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/es/services/accessibility/html_id_generator.js +19 -3
- package/es/themes/amsterdam/global_styling/mixins/shadow.js +0 -1
- package/eui.d.ts +198 -56
- package/i18ntokens.json +64 -46
- 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 +14 -5
- package/lib/components/popover/input_popover.js +23 -8
- package/lib/components/popover/popover.js +4 -6
- package/lib/components/resizable_container/index.js +8 -1
- package/lib/components/resizable_container/resizable_button.js +83 -51
- package/lib/components/resizable_container/resizable_button.styles.js +71 -0
- package/lib/components/resizable_container/resizable_collapse_button.js +24 -14
- package/lib/components/resizable_container/resizable_collapse_button.styles.js +90 -0
- package/lib/components/selectable/selectable_list/selectable_list.js +97 -79
- package/lib/components/steps/step.styles.js +5 -5
- 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/lib/services/accessibility/html_id_generator.js +21 -2
- package/lib/themes/amsterdam/global_styling/mixins/shadow.js +0 -1
- 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 +14 -5
- package/optimize/es/components/popover/input_popover.js +13 -8
- package/optimize/es/components/popover/popover.js +2 -3
- package/optimize/es/components/resizable_container/index.js +2 -1
- package/optimize/es/components/resizable_container/resizable_button.js +61 -44
- package/optimize/es/components/resizable_container/resizable_button.styles.js +66 -0
- package/optimize/es/components/resizable_container/resizable_collapse_button.js +19 -11
- package/optimize/es/components/resizable_container/resizable_collapse_button.styles.js +85 -0
- package/optimize/es/components/selectable/selectable_list/selectable_list.js +97 -79
- package/optimize/es/components/steps/step.styles.js +5 -5
- 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/es/services/accessibility/html_id_generator.js +19 -3
- package/optimize/es/themes/amsterdam/global_styling/mixins/shadow.js +0 -1
- 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 +14 -5
- package/optimize/lib/components/popover/input_popover.js +12 -7
- package/optimize/lib/components/popover/popover.js +2 -3
- package/optimize/lib/components/resizable_container/index.js +8 -1
- package/optimize/lib/components/resizable_container/resizable_button.js +63 -45
- package/optimize/lib/components/resizable_container/resizable_button.styles.js +71 -0
- package/optimize/lib/components/resizable_container/resizable_collapse_button.js +19 -11
- package/optimize/lib/components/resizable_container/resizable_collapse_button.styles.js +90 -0
- package/optimize/lib/components/selectable/selectable_list/selectable_list.js +97 -79
- package/optimize/lib/components/steps/step.styles.js +5 -5
- package/optimize/lib/components/tool_tip/tool_tip.js +3 -13
- package/optimize/lib/components/tool_tip/tool_tip_anchor.js +4 -8
- package/optimize/lib/services/accessibility/html_id_generator.js +21 -2
- package/optimize/lib/themes/amsterdam/global_styling/mixins/shadow.js +0 -1
- package/package.json +19 -21
- package/src/components/index.scss +0 -1
- 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 +14 -5
- package/test-env/components/popover/input_popover.js +23 -8
- package/test-env/components/popover/popover.js +4 -6
- package/test-env/components/resizable_container/index.js +8 -1
- package/test-env/components/resizable_container/resizable_button.js +83 -51
- package/test-env/components/resizable_container/resizable_button.styles.js +71 -0
- package/test-env/components/resizable_container/resizable_collapse_button.js +19 -14
- package/test-env/components/resizable_container/resizable_collapse_button.styles.js +90 -0
- package/test-env/components/selectable/selectable_list/selectable_list.js +97 -79
- package/test-env/components/steps/step.styles.js +5 -5
- 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
- package/test-env/themes/amsterdam/global_styling/mixins/shadow.js +0 -1
- package/src/components/resizable_container/_index.scss +0 -3
- package/src/components/resizable_container/_resizable_button.scss +0 -129
- package/src/components/resizable_container/_resizable_collapse_button.scss +0 -145
- package/src/components/resizable_container/_variables.scss +0 -2
|
@@ -44,26 +44,34 @@ export var EuiCodeBlockVirtualized = function EuiCodeBlockVirtualized(_ref) {
|
|
|
44
44
|
}, codeProps));
|
|
45
45
|
});
|
|
46
46
|
}, [codeProps]);
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
var virtualizationProps = {
|
|
48
|
+
itemData: data,
|
|
49
|
+
itemSize: rowHeight,
|
|
50
|
+
itemCount: data.length,
|
|
51
|
+
outerElementType: VirtualizedOuterElement,
|
|
52
|
+
innerElementType: VirtualizedInnerElement
|
|
53
|
+
};
|
|
54
|
+
return typeof overflowHeight === 'number' ? ___EmotionJSX(EuiAutoSizer, {
|
|
55
|
+
disableHeight: true
|
|
49
56
|
}, function (_ref4) {
|
|
50
|
-
var
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
var width = _ref4.width;
|
|
58
|
+
return ___EmotionJSX(FixedSizeList, _extends({
|
|
59
|
+
height: overflowHeight,
|
|
60
|
+
width: width
|
|
61
|
+
}, virtualizationProps), ListRow);
|
|
62
|
+
}) : ___EmotionJSX(EuiAutoSizer, null, function (_ref5) {
|
|
63
|
+
var height = _ref5.height,
|
|
64
|
+
width = _ref5.width;
|
|
65
|
+
return ___EmotionJSX(FixedSizeList, _extends({
|
|
66
|
+
height: height,
|
|
67
|
+
width: width
|
|
68
|
+
}, virtualizationProps), ListRow);
|
|
61
69
|
});
|
|
62
70
|
};
|
|
63
|
-
var ListRow = function ListRow(
|
|
64
|
-
var data =
|
|
65
|
-
index =
|
|
66
|
-
style =
|
|
71
|
+
var ListRow = function ListRow(_ref6) {
|
|
72
|
+
var data = _ref6.data,
|
|
73
|
+
index = _ref6.index,
|
|
74
|
+
style = _ref6.style;
|
|
67
75
|
var row = data[index];
|
|
68
76
|
row.properties.style = logicalStyles(style);
|
|
69
77
|
return nodeToHtml(row, index, data, 0);
|
|
@@ -19,6 +19,7 @@ import classNames from 'classnames';
|
|
|
19
19
|
import { useEuiTheme, useGeneratedHtmlId, throttle } from '../../services';
|
|
20
20
|
import { mathWithUnits, logicalStyle } from '../../global_styling';
|
|
21
21
|
import { EuiFlyout } from '../flyout';
|
|
22
|
+
import { useEuiI18n } from '../i18n';
|
|
22
23
|
import { euiHeaderVariables } from '../header/header.styles';
|
|
23
24
|
import { EuiCollapsibleNavContext } from './context';
|
|
24
25
|
import { EuiCollapsibleNavButton } from './collapsible_nav_button';
|
|
@@ -122,6 +123,7 @@ export var EuiCollapsibleNavBeta = function EuiCollapsibleNavBeta(_ref) {
|
|
|
122
123
|
conditionalId: id,
|
|
123
124
|
suffix: 'euiCollapsibleNav'
|
|
124
125
|
});
|
|
126
|
+
var defaultAriaLabel = useEuiI18n('euiCollapsibleNavBeta.ariaLabel', 'Site menu');
|
|
125
127
|
var buttonRef = useRef(null);
|
|
126
128
|
var focusTrapProps = useMemo(function () {
|
|
127
129
|
return _objectSpread(_objectSpread({}, _focusTrapProps), {}, {
|
|
@@ -133,7 +135,9 @@ export var EuiCollapsibleNavBeta = function EuiCollapsibleNavBeta(_ref) {
|
|
|
133
135
|
var cssStyles = [styles.euiCollapsibleNavBeta, styles[side], isPush && styles.isPush, isPush && isCollapsed && styles.isPushCollapsed, isOverlayFullWidth && styles.isOverlayFullWidth];
|
|
134
136
|
|
|
135
137
|
// Wait for any fixed headers to be queried before rendering (prevents position jumping)
|
|
136
|
-
var flyout = fixedHeadersCount !== false && ___EmotionJSX(EuiFlyout, _extends({
|
|
138
|
+
var flyout = fixedHeadersCount !== false && ___EmotionJSX(EuiFlyout, _extends({
|
|
139
|
+
"aria-label": defaultAriaLabel
|
|
140
|
+
}, rest, {
|
|
137
141
|
// EuiCollapsibleNav is significantly less permissive than EuiFlyout
|
|
138
142
|
id: flyoutID,
|
|
139
143
|
css: cssStyles,
|
|
@@ -49,7 +49,8 @@ export var EuiCollapsedNavButton = function EuiCollapsedNavButton(_ref) {
|
|
|
49
49
|
size: "s",
|
|
50
50
|
color: "text",
|
|
51
51
|
href: href,
|
|
52
|
-
onClick: onClick
|
|
52
|
+
onClick: onClick,
|
|
53
|
+
"aria-label": title
|
|
53
54
|
}, linkProps, {
|
|
54
55
|
// Exclusive union shenanigans
|
|
55
56
|
className: buttonClassName,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["children", "className", "startDateControl", "endDateControl", "iconType", "inline", "shadow", "fullWidth", "isCustom", "readOnly", "isLoading", "isInvalid", "disabled", "onFocus", "onBlur", "append", "prepend"];
|
|
3
|
+
var _excluded = ["children", "className", "startDateControl", "endDateControl", "iconType", "inline", "shadow", "fullWidth", "compressed", "isCustom", "readOnly", "isLoading", "isInvalid", "disabled", "onFocus", "onBlur", "append", "prepend"];
|
|
4
4
|
/*
|
|
5
5
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
6
6
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -26,6 +26,7 @@ export var EuiDatePickerRange = function EuiDatePickerRange(_ref) {
|
|
|
26
26
|
_ref$shadow = _ref.shadow,
|
|
27
27
|
shadow = _ref$shadow === void 0 ? true : _ref$shadow,
|
|
28
28
|
_fullWidth = _ref.fullWidth,
|
|
29
|
+
_compressed = _ref.compressed,
|
|
29
30
|
isCustom = _ref.isCustom,
|
|
30
31
|
readOnly = _ref.readOnly,
|
|
31
32
|
isLoading = _ref.isLoading,
|
|
@@ -36,8 +37,9 @@ export var EuiDatePickerRange = function EuiDatePickerRange(_ref) {
|
|
|
36
37
|
append = _ref.append,
|
|
37
38
|
prepend = _ref.prepend,
|
|
38
39
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
39
|
-
// `fullWidth` should not affect inline datepickers (matches non-range behavior)
|
|
40
|
+
// `fullWidth` and `compressed` should not affect inline datepickers (matches non-range behavior)
|
|
40
41
|
var fullWidth = _fullWidth && !inline;
|
|
42
|
+
var compressed = _compressed && !inline;
|
|
41
43
|
var classes = classNames('euiDatePickerRange', className);
|
|
42
44
|
var euiTheme = useEuiTheme();
|
|
43
45
|
var styles = euiDatePickerRangeStyles(euiTheme);
|
|
@@ -109,6 +111,7 @@ export var EuiDatePickerRange = function EuiDatePickerRange(_ref) {
|
|
|
109
111
|
startControl: startControl,
|
|
110
112
|
endControl: endControl,
|
|
111
113
|
fullWidth: fullWidth,
|
|
114
|
+
compressed: compressed,
|
|
112
115
|
readOnly: readOnly,
|
|
113
116
|
isDisabled: disabled,
|
|
114
117
|
isInvalid: isInvalid,
|
|
@@ -3,7 +3,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
4
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
5
5
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
6
|
-
var _excluded = ["className", "children", "as", "hideCloseButton", "closeButtonProps", "closeButtonPosition", "onClose", "ownFocus", "side", "size", "paddingSize", "maxWidth", "style", "maskProps", "type", "outsideClickCloses", "pushMinBreakpoint", "focusTrapProps", "includeFixedHeadersInFocusTrap"];
|
|
6
|
+
var _excluded = ["className", "children", "as", "hideCloseButton", "closeButtonProps", "closeButtonPosition", "onClose", "ownFocus", "side", "size", "paddingSize", "maxWidth", "style", "maskProps", "type", "outsideClickCloses", "pushMinBreakpoint", "focusTrapProps", "includeFixedHeadersInFocusTrap", "aria-describedby"];
|
|
7
7
|
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; }
|
|
8
8
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
9
9
|
/*
|
|
@@ -70,6 +70,7 @@ export var EuiFlyout = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
70
70
|
_focusTrapProps = _ref$focusTrapProps === void 0 ? {} : _ref$focusTrapProps,
|
|
71
71
|
_ref$includeFixedHead = _ref.includeFixedHeadersInFocusTrap,
|
|
72
72
|
includeFixedHeadersInFocusTrap = _ref$includeFixedHead === void 0 ? true : _ref$includeFixedHead,
|
|
73
|
+
_ariaDescribedBy = _ref['aria-describedby'],
|
|
73
74
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
74
75
|
var Element = as || defaultElement;
|
|
75
76
|
var maskRef = useRef(null);
|
|
@@ -203,6 +204,7 @@ export var EuiFlyout = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
203
204
|
*/
|
|
204
205
|
var hasOverlayMask = ownFocus && !isPushed;
|
|
205
206
|
var descriptionId = useGeneratedHtmlId();
|
|
207
|
+
var ariaDescribedBy = classnames(descriptionId, _ariaDescribedBy);
|
|
206
208
|
var screenReaderDescription = ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("p", {
|
|
207
209
|
id: descriptionId
|
|
208
210
|
}, hasOverlayMask ? ___EmotionJSX(EuiI18n, {
|
|
@@ -247,15 +249,15 @@ export var EuiFlyout = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
247
249
|
clickOutsideDisables: !ownFocus,
|
|
248
250
|
onClickOutside: onClickOutside
|
|
249
251
|
}, focusTrapProps), ___EmotionJSX(Element, _extends({
|
|
250
|
-
css: cssStyles
|
|
251
|
-
}, rest, {
|
|
252
|
-
role: "dialog",
|
|
253
252
|
className: classes,
|
|
254
|
-
|
|
255
|
-
"data-autofocus": true,
|
|
256
|
-
"aria-describedby": !isPushed ? descriptionId : undefined,
|
|
253
|
+
css: cssStyles,
|
|
257
254
|
style: newStyle,
|
|
258
255
|
ref: setRef
|
|
256
|
+
}, rest, {
|
|
257
|
+
role: !isPushed ? 'dialog' : rest.role,
|
|
258
|
+
tabIndex: !isPushed ? 0 : rest.tabIndex,
|
|
259
|
+
"aria-describedby": !isPushed ? ariaDescribedBy : _ariaDescribedBy,
|
|
260
|
+
"data-autofocus": !isPushed || undefined
|
|
259
261
|
}), !isPushed && screenReaderDescription, closeButton, children));
|
|
260
262
|
|
|
261
263
|
// If ownFocus is set, wrap with an overlay and allow the user to click it to close it.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["children", "className", "banner"];
|
|
3
|
+
var _excluded = ["children", "className", "banner", "scrollableTabIndex"];
|
|
4
4
|
/*
|
|
5
5
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
6
6
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -18,6 +18,8 @@ export var EuiFlyoutBody = function EuiFlyoutBody(_ref) {
|
|
|
18
18
|
var children = _ref.children,
|
|
19
19
|
className = _ref.className,
|
|
20
20
|
banner = _ref.banner,
|
|
21
|
+
_ref$scrollableTabInd = _ref.scrollableTabIndex,
|
|
22
|
+
scrollableTabIndex = _ref$scrollableTabInd === void 0 ? 0 : _ref$scrollableTabInd,
|
|
21
23
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
22
24
|
var classes = classNames('euiFlyoutBody', className);
|
|
23
25
|
var euiTheme = useEuiTheme();
|
|
@@ -29,7 +31,7 @@ export var EuiFlyoutBody = function EuiFlyoutBody(_ref) {
|
|
|
29
31
|
className: classes,
|
|
30
32
|
css: cssStyles
|
|
31
33
|
}, rest), ___EmotionJSX("div", {
|
|
32
|
-
tabIndex:
|
|
34
|
+
tabIndex: scrollableTabIndex,
|
|
33
35
|
className: "euiFlyoutBody__overflow",
|
|
34
36
|
css: overflowCssStyles
|
|
35
37
|
}, banner && ___EmotionJSX("div", {
|
|
@@ -7,7 +7,7 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
7
7
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
8
8
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
9
9
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
10
|
-
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"];
|
|
10
|
+
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"];
|
|
11
11
|
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; }
|
|
12
12
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
13
13
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
@@ -259,9 +259,11 @@ export var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
259
259
|
});
|
|
260
260
|
});
|
|
261
261
|
_defineProperty(_assertThisInitialized(_this), "onResize", function (width) {
|
|
262
|
+
var _this$props$inputPopo, _this$props$inputPopo2;
|
|
262
263
|
_this.setState({
|
|
263
264
|
rangeWidth: width
|
|
264
265
|
});
|
|
266
|
+
(_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);
|
|
265
267
|
});
|
|
266
268
|
_defineProperty(_assertThisInitialized(_this), "getNearestStep", function (value) {
|
|
267
269
|
var min = _this.props.min;
|
|
@@ -378,6 +380,7 @@ export var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
378
380
|
prepend = _this$props.prepend,
|
|
379
381
|
minInputProps = _this$props.minInputProps,
|
|
380
382
|
maxInputProps = _this$props.maxInputProps,
|
|
383
|
+
inputPopoverProps = _this$props.inputPopoverProps,
|
|
381
384
|
isDraggable = _this$props.isDraggable,
|
|
382
385
|
theme = _this$props.theme,
|
|
383
386
|
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
@@ -618,8 +621,8 @@ export var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
618
621
|
className: showTicks || ticks ? 'euiRange__slimHorizontalSpacer' : 'euiRange__horizontalSpacer',
|
|
619
622
|
css: showTicks || ticks ? rangeStyles.euiRange__slimHorizontalSpacer : rangeStyles.euiRange__horizontalSpacer
|
|
620
623
|
}), maxInput));
|
|
621
|
-
var thePopover = showInputOnly ? ___EmotionJSX(EuiInputPopover, {
|
|
622
|
-
className:
|
|
624
|
+
var thePopover = showInputOnly ? ___EmotionJSX(EuiInputPopover, _extends({}, inputPopoverProps, {
|
|
625
|
+
className: classNames('euiDualRange__popover', inputPopoverProps === null || inputPopoverProps === void 0 ? void 0 : inputPopoverProps.className),
|
|
623
626
|
input: ___EmotionJSX(EuiFormControlLayoutDelimited, {
|
|
624
627
|
startControl: minInput,
|
|
625
628
|
endControl: maxInput,
|
|
@@ -638,7 +641,7 @@ export var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
638
641
|
disableFocusTrap: true,
|
|
639
642
|
onPanelResize: this.onResize,
|
|
640
643
|
popoverScreenReaderText: dualSliderScreenReaderInstructions
|
|
641
|
-
}, theRange) : undefined;
|
|
644
|
+
}), theRange) : undefined;
|
|
642
645
|
return thePopover || theRange;
|
|
643
646
|
}
|
|
644
647
|
}]);
|
|
@@ -7,7 +7,7 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
7
7
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
8
8
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
9
9
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
10
|
-
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"];
|
|
10
|
+
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"];
|
|
11
11
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
12
12
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
13
13
|
/*
|
|
@@ -114,6 +114,7 @@ export var EuiRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
114
114
|
step = _this$props.step,
|
|
115
115
|
showLabels = _this$props.showLabels,
|
|
116
116
|
showInput = _this$props.showInput,
|
|
117
|
+
inputPopoverProps = _this$props.inputPopoverProps,
|
|
117
118
|
showTicks = _this$props.showTicks,
|
|
118
119
|
tickInterval = _this$props.tickInterval,
|
|
119
120
|
ticks = _this$props.ticks,
|
|
@@ -226,8 +227,8 @@ export var EuiRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
226
227
|
className: showTicks || ticks ? 'euiRange__slimHorizontalSpacer' : 'euiRange__horizontalSpacer',
|
|
227
228
|
css: showTicks || ticks ? styles.euiRange__slimHorizontalSpacer : styles.euiRange__horizontalSpacer
|
|
228
229
|
}), theInput));
|
|
229
|
-
var thePopover = showInputOnly ? ___EmotionJSX(EuiInputPopover, {
|
|
230
|
-
className:
|
|
230
|
+
var thePopover = showInputOnly ? ___EmotionJSX(EuiInputPopover, _extends({}, inputPopoverProps, {
|
|
231
|
+
className: classNames('euiRange__popover', inputPopoverProps === null || inputPopoverProps === void 0 ? void 0 : inputPopoverProps.className),
|
|
231
232
|
input: theInput // `showInputOnly` confirms existence
|
|
232
233
|
,
|
|
233
234
|
fullWidth: fullWidth,
|
|
@@ -235,7 +236,7 @@ export var EuiRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
235
236
|
closePopover: this.closePopover,
|
|
236
237
|
disableFocusTrap: true,
|
|
237
238
|
popoverScreenReaderText: sliderScreenReaderInstructions
|
|
238
|
-
}, theRange) : undefined;
|
|
239
|
+
}), theRange) : undefined;
|
|
239
240
|
return thePopover ? thePopover : theRange;
|
|
240
241
|
}
|
|
241
242
|
}]);
|
|
@@ -14,7 +14,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
14
14
|
* Side Public License, v 1.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import React, {
|
|
17
|
+
import React, { useLayoutEffect, useState } from 'react';
|
|
18
18
|
import { logicalStyle, useEuiPaddingCSS } from '../../../global_styling';
|
|
19
19
|
import { useEuiTheme, useIsWithinBreakpoints } from '../../../services';
|
|
20
20
|
import { euiPageSidebarStyles } from './page_sidebar.styles';
|
|
@@ -42,7 +42,7 @@ export var EuiPageSidebar = function EuiPageSidebar(_ref) {
|
|
|
42
42
|
_useState2 = _slicedToArray(_useState, 2),
|
|
43
43
|
inlineStyles = _useState2[0],
|
|
44
44
|
setInlineStyles = _useState2[1];
|
|
45
|
-
|
|
45
|
+
useLayoutEffect(function () {
|
|
46
46
|
var updatedStyles = _objectSpread(_objectSpread({}, style), logicalStyle('min-width', isResponding ? '100%' : minWidth));
|
|
47
47
|
if (sticky) {
|
|
48
48
|
var _document$body$datase;
|
|
@@ -29,6 +29,14 @@ export var TemplateContext = /*#__PURE__*/createContext({
|
|
|
29
29
|
emptyPrompt: {},
|
|
30
30
|
bottomBar: {}
|
|
31
31
|
});
|
|
32
|
+
var calculateOffset = function calculateOffset(base) {
|
|
33
|
+
var _document$body$datase;
|
|
34
|
+
if (typeof document === 'undefined') return 0; // SSR catch
|
|
35
|
+
|
|
36
|
+
var euiHeaderFixedCounter = Number((_document$body$datase = document.body.dataset.fixedHeaders) !== null && _document$body$datase !== void 0 ? _document$body$datase : 0);
|
|
37
|
+
return base * 3 * euiHeaderFixedCounter;
|
|
38
|
+
};
|
|
39
|
+
|
|
32
40
|
/**
|
|
33
41
|
* Consumed via `EuiPageTemplate`,
|
|
34
42
|
* it controls and propogates most of the shared props per direct child
|
|
@@ -55,7 +63,9 @@ export var _EuiPageTemplate = function _EuiPageTemplate(_ref) {
|
|
|
55
63
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
56
64
|
var _useEuiTheme = useEuiTheme(),
|
|
57
65
|
euiTheme = _useEuiTheme.euiTheme;
|
|
58
|
-
var _useState = useState(
|
|
66
|
+
var _useState = useState(function () {
|
|
67
|
+
return _offset !== null && _offset !== void 0 ? _offset : calculateOffset(euiTheme.base);
|
|
68
|
+
}),
|
|
59
69
|
_useState2 = _slicedToArray(_useState, 2),
|
|
60
70
|
offset = _useState2[0],
|
|
61
71
|
setOffset = _useState2[1];
|
|
@@ -68,9 +78,7 @@ export var _EuiPageTemplate = function _EuiPageTemplate(_ref) {
|
|
|
68
78
|
});
|
|
69
79
|
useEffect(function () {
|
|
70
80
|
if (_offset === undefined) {
|
|
71
|
-
|
|
72
|
-
var euiHeaderFixedCounter = Number((_document$body$datase = document.body.dataset.fixedHeaders) !== null && _document$body$datase !== void 0 ? _document$body$datase : 0);
|
|
73
|
-
setOffset(euiTheme.base * 3 * euiHeaderFixedCounter);
|
|
81
|
+
setOffset(calculateOffset(euiTheme.base));
|
|
74
82
|
}
|
|
75
83
|
}, [_offset, euiTheme.base]);
|
|
76
84
|
|
|
@@ -108,7 +116,8 @@ export var _EuiPageTemplate = function _EuiPageTemplate(_ref) {
|
|
|
108
116
|
return {
|
|
109
117
|
restrictWidth: restrictWidth,
|
|
110
118
|
paddingSize: paddingSize,
|
|
111
|
-
|
|
119
|
+
// pageInnerId may contain colons that are parsed as pseudo-elements if not escaped
|
|
120
|
+
parent: "#".concat(CSS.escape(pageInnerId))
|
|
112
121
|
};
|
|
113
122
|
};
|
|
114
123
|
var innerPanelled = function innerPanelled() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["children", "className", "disableFocusTrap", "focusTrapProps", "input", "fullWidth", "onPanelResize", "inputRef", "panelRef"];
|
|
4
|
+
var _excluded = ["children", "className", "disableFocusTrap", "focusTrapProps", "input", "fullWidth", "panelMinWidth", "onPanelResize", "inputRef", "panelRef"];
|
|
5
5
|
/*
|
|
6
6
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
7
7
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -10,7 +10,7 @@ var _excluded = ["children", "className", "disableFocusTrap", "focusTrapProps",
|
|
|
10
10
|
* Side Public License, v 1.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import React, { useState, useEffect, useCallback } from 'react';
|
|
13
|
+
import React, { useState, useEffect, useCallback, useRef } from 'react';
|
|
14
14
|
import classnames from 'classnames';
|
|
15
15
|
import { tabbable } from 'tabbable';
|
|
16
16
|
import { EuiFocusTrap } from '../focus_trap';
|
|
@@ -30,6 +30,8 @@ export var EuiInputPopover = function EuiInputPopover(_ref) {
|
|
|
30
30
|
input = _ref.input,
|
|
31
31
|
_ref$fullWidth = _ref.fullWidth,
|
|
32
32
|
fullWidth = _ref$fullWidth === void 0 ? false : _ref$fullWidth,
|
|
33
|
+
_ref$panelMinWidth = _ref.panelMinWidth,
|
|
34
|
+
panelMinWidth = _ref$panelMinWidth === void 0 ? 0 : _ref$panelMinWidth,
|
|
33
35
|
onPanelResize = _ref.onPanelResize,
|
|
34
36
|
_inputRef = _ref.inputRef,
|
|
35
37
|
_panelRef = _ref.panelRef,
|
|
@@ -47,22 +49,24 @@ export var EuiInputPopover = function EuiInputPopover(_ref) {
|
|
|
47
49
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
48
50
|
panelEl = _useState6[0],
|
|
49
51
|
setPanelEl = _useState6[1];
|
|
52
|
+
var popoverClassRef = useRef(null);
|
|
50
53
|
var inputRef = useCombinedRefs([setInputEl, _inputRef]);
|
|
51
54
|
var panelRef = useCombinedRefs([setPanelEl, _panelRef]);
|
|
52
55
|
var setPanelWidth = useCallback(function (width) {
|
|
53
56
|
if (panelEl && (!!inputElWidth || !!width)) {
|
|
54
57
|
var newWidth = !!width ? width : inputElWidth;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
58
|
+
var widthToSet = newWidth && newWidth > panelMinWidth ? newWidth : panelMinWidth;
|
|
59
|
+
panelEl.style.width = "".concat(widthToSet, "px");
|
|
60
|
+
onPanelResize === null || onPanelResize === void 0 ? void 0 : onPanelResize(widthToSet);
|
|
59
61
|
}
|
|
60
|
-
}, [panelEl, inputElWidth, onPanelResize]);
|
|
62
|
+
}, [panelEl, inputElWidth, onPanelResize, panelMinWidth]);
|
|
61
63
|
var onResize = useCallback(function () {
|
|
62
64
|
if (inputEl) {
|
|
65
|
+
var _popoverClassRef$curr;
|
|
63
66
|
var _width = inputEl.getBoundingClientRect().width;
|
|
64
67
|
setInputElWidth(_width);
|
|
65
68
|
setPanelWidth(_width);
|
|
69
|
+
(_popoverClassRef$curr = popoverClassRef.current) === null || _popoverClassRef$curr === void 0 ? void 0 : _popoverClassRef$curr.positionPopoverFluid();
|
|
66
70
|
}
|
|
67
71
|
}, [inputEl, setPanelWidth]);
|
|
68
72
|
useEffect(function () {
|
|
@@ -97,7 +101,8 @@ export var EuiInputPopover = function EuiInputPopover(_ref) {
|
|
|
97
101
|
}),
|
|
98
102
|
buttonRef: inputRef,
|
|
99
103
|
panelRef: panelRef,
|
|
100
|
-
className: classes
|
|
104
|
+
className: classes,
|
|
105
|
+
ref: popoverClassRef
|
|
101
106
|
}, props), ___EmotionJSX(EuiFocusTrap, _extends({
|
|
102
107
|
clickOutsideDisables: true,
|
|
103
108
|
disabled: disableFocusTrap
|
|
@@ -206,8 +206,7 @@ export var EuiPopover = /*#__PURE__*/function (_Component) {
|
|
|
206
206
|
top = _findPopoverPosition.top,
|
|
207
207
|
left = _findPopoverPosition.left,
|
|
208
208
|
foundPosition = _findPopoverPosition.position,
|
|
209
|
-
arrow = _findPopoverPosition.arrow
|
|
210
|
-
anchorBoundingBox = _findPopoverPosition.anchorBoundingBox;
|
|
209
|
+
arrow = _findPopoverPosition.arrow;
|
|
211
210
|
|
|
212
211
|
// the popover's z-index must inherit from the button
|
|
213
212
|
// this keeps a button's popover under a flyout that would cover the button
|
|
@@ -216,7 +215,7 @@ export var EuiPopover = /*#__PURE__*/function (_Component) {
|
|
|
216
215
|
var zIndex = zIndexProp == null ? getElementZIndex(_this.button, _this.panel) + 2000 : zIndexProp;
|
|
217
216
|
var popoverStyles = _objectSpread(_objectSpread({}, _this.props.panelStyle), {}, {
|
|
218
217
|
top: top,
|
|
219
|
-
left:
|
|
218
|
+
left: left,
|
|
220
219
|
zIndex: zIndex
|
|
221
220
|
});
|
|
222
221
|
var willRenderArrow = !_this.props.attachToAnchor && _this.props.hasArrow;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["isHorizontal", "
|
|
4
|
+
var _excluded = ["isHorizontal", "alignIndicator", "className"],
|
|
5
|
+
_excluded2 = ["registration", "id", "disabled", "onFocus"];
|
|
5
6
|
/*
|
|
6
7
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
7
8
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -10,21 +11,56 @@ var _excluded = ["isHorizontal", "className", "id", "registration", "disabled",
|
|
|
10
11
|
* Side Public License, v 1.
|
|
11
12
|
*/
|
|
12
13
|
|
|
13
|
-
import React, { useCallback, useMemo, useRef } from 'react';
|
|
14
|
+
import React, { useCallback, useMemo, useRef, forwardRef } from 'react';
|
|
14
15
|
import classNames from 'classnames';
|
|
15
16
|
import { EuiI18n } from '../i18n';
|
|
16
|
-
import { useGeneratedHtmlId } from '../../services';
|
|
17
|
+
import { useEuiTheme, useGeneratedHtmlId } from '../../services';
|
|
17
18
|
import { useEuiResizableContainerContext } from './context';
|
|
19
|
+
import { euiResizableButtonStyles } from './resizable_button.styles';
|
|
18
20
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
19
|
-
|
|
21
|
+
/**
|
|
22
|
+
* A generic button for indicating/facilitating resizable content,
|
|
23
|
+
* usable outside of the EuiResizableContainer context
|
|
24
|
+
*/
|
|
25
|
+
export var EuiResizableButton = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
20
26
|
var isHorizontal = _ref.isHorizontal,
|
|
27
|
+
_ref$alignIndicator = _ref.alignIndicator,
|
|
28
|
+
alignIndicator = _ref$alignIndicator === void 0 ? 'center' : _ref$alignIndicator,
|
|
21
29
|
className = _ref.className,
|
|
22
|
-
id = _ref.id,
|
|
23
|
-
registration = _ref.registration,
|
|
24
|
-
disabled = _ref.disabled,
|
|
25
|
-
onFocus = _ref.onFocus,
|
|
26
|
-
onBlur = _ref.onBlur,
|
|
27
30
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
31
|
+
var classes = classNames('euiResizableButton', className);
|
|
32
|
+
var euiTheme = useEuiTheme();
|
|
33
|
+
var styles = euiResizableButtonStyles(euiTheme);
|
|
34
|
+
var cssStyles = [styles.euiResizableButton, isHorizontal ? styles.horizontal : styles.vertical, styles.alignIndicator[alignIndicator]];
|
|
35
|
+
return ___EmotionJSX(EuiI18n, {
|
|
36
|
+
tokens: ['euiResizableButton.horizontalResizerAriaLabel', 'euiResizableButton.verticalResizerAriaLabel'],
|
|
37
|
+
defaults: ['Press the left or right arrow keys to adjust panels size', 'Press the up or down arrow keys to adjust panels size']
|
|
38
|
+
}, function (_ref2) {
|
|
39
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
40
|
+
horizontalResizerAriaLabel = _ref3[0],
|
|
41
|
+
verticalResizerAriaLabel = _ref3[1];
|
|
42
|
+
return ___EmotionJSX("button", _extends({
|
|
43
|
+
ref: ref,
|
|
44
|
+
"aria-label": isHorizontal ? horizontalResizerAriaLabel : verticalResizerAriaLabel,
|
|
45
|
+
className: classes,
|
|
46
|
+
css: cssStyles,
|
|
47
|
+
"data-test-subj": "euiResizableButton",
|
|
48
|
+
type: "button"
|
|
49
|
+
}, rest));
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
EuiResizableButton.displayName = 'EuiResizableButton';
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Resizer button specific to controlled EuiResizableContainer usage
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
export var EuiResizableButtonControlled = function EuiResizableButtonControlled(_ref4) {
|
|
59
|
+
var registration = _ref4.registration,
|
|
60
|
+
id = _ref4.id,
|
|
61
|
+
disabled = _ref4.disabled,
|
|
62
|
+
_onFocus = _ref4.onFocus,
|
|
63
|
+
rest = _objectWithoutProperties(_ref4, _excluded2);
|
|
28
64
|
var resizerId = useGeneratedHtmlId({
|
|
29
65
|
prefix: 'resizable-button',
|
|
30
66
|
conditionalId: id
|
|
@@ -36,13 +72,9 @@ export var EuiResizableButton = function EuiResizableButton(_ref) {
|
|
|
36
72
|
} : _useEuiResizableConta2,
|
|
37
73
|
resizers = _useEuiResizableConta3.resizers;
|
|
38
74
|
var isDisabled = useMemo(function () {
|
|
39
|
-
|
|
75
|
+
var _resizers$resizerId;
|
|
76
|
+
return disabled || ((_resizers$resizerId = resizers[resizerId]) === null || _resizers$resizerId === void 0 ? void 0 : _resizers$resizerId.isDisabled);
|
|
40
77
|
}, [resizers, resizerId, disabled]);
|
|
41
|
-
var classes = classNames('euiResizableButton', {
|
|
42
|
-
'euiResizableButton--vertical': !isHorizontal,
|
|
43
|
-
'euiResizableButton--horizontal': isHorizontal,
|
|
44
|
-
'euiResizableButton--disabled': isDisabled
|
|
45
|
-
}, className);
|
|
46
78
|
var previousRef = useRef();
|
|
47
79
|
var onRef = useCallback(function (ref) {
|
|
48
80
|
if (!registration) return;
|
|
@@ -61,35 +93,20 @@ export var EuiResizableButton = function EuiResizableButton(_ref) {
|
|
|
61
93
|
}
|
|
62
94
|
}
|
|
63
95
|
}, [registration, resizerId, disabled]);
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
horizontalResizerAriaLabel = _ref3[0],
|
|
76
|
-
verticalResizerAriaLabel = _ref3[1];
|
|
77
|
-
return ___EmotionJSX("button", _extends({
|
|
78
|
-
id: resizerId,
|
|
79
|
-
ref: onRef,
|
|
80
|
-
"aria-label": isHorizontal ? horizontalResizerAriaLabel : verticalResizerAriaLabel,
|
|
81
|
-
className: classes,
|
|
82
|
-
"data-test-subj": "euiResizableButton",
|
|
83
|
-
type: "button",
|
|
84
|
-
onClick: setFocus,
|
|
85
|
-
onFocus: handleFocus,
|
|
86
|
-
onBlur: onBlur,
|
|
87
|
-
disabled: isDisabled
|
|
88
|
-
}, rest));
|
|
89
|
-
});
|
|
96
|
+
return ___EmotionJSX(EuiResizableButton, _extends({
|
|
97
|
+
id: resizerId,
|
|
98
|
+
ref: onRef,
|
|
99
|
+
disabled: isDisabled,
|
|
100
|
+
onClick: function onClick(e) {
|
|
101
|
+
return e.currentTarget.focus();
|
|
102
|
+
},
|
|
103
|
+
onFocus: function onFocus() {
|
|
104
|
+
return _onFocus === null || _onFocus === void 0 ? void 0 : _onFocus(resizerId);
|
|
105
|
+
}
|
|
106
|
+
}, rest));
|
|
90
107
|
};
|
|
91
|
-
export function euiResizableButtonWithControls(controls) {
|
|
108
|
+
export var euiResizableButtonWithControls = function euiResizableButtonWithControls(controls) {
|
|
92
109
|
return function (props) {
|
|
93
|
-
return ___EmotionJSX(
|
|
110
|
+
return ___EmotionJSX(EuiResizableButtonControlled, _extends({}, controls, props));
|
|
94
111
|
};
|
|
95
|
-
}
|
|
112
|
+
};
|