@elastic/eui 113.2.1 → 114.0.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/basic_table/collapsed_item_actions.js +2 -0
- package/es/components/button/split_button/split_button.js +13 -0
- package/es/components/button/split_button/split_button_actions.js +15 -0
- package/es/components/collapsible_nav/collapsible_nav.js +5 -0
- package/es/components/color_picker/color_picker.js +31 -8
- package/es/components/context_menu/context_menu_item.js +9 -3
- package/es/components/context_menu/context_menu_item.styles.js +6 -2
- package/es/components/datagrid/utils/scrolling.js +39 -10
- package/es/components/date_picker/super_date_picker/time_window_buttons.js +17 -3
- package/es/components/flyout/_flyout_overlay.js +34 -4
- package/es/components/flyout/const.js +10 -0
- package/es/components/flyout/flyout.component.js +49 -57
- package/es/components/flyout/flyout.js +10 -2
- package/es/components/flyout/flyout.styles.js +2 -2
- package/es/components/flyout/flyout_menu.js +19 -5
- package/es/components/flyout/flyout_resizable.js +5 -0
- package/es/components/flyout/manager/actions.js +12 -5
- package/es/components/flyout/manager/flyout_child.js +9 -2
- package/es/components/flyout/manager/flyout_managed.js +27 -14
- package/es/components/flyout/manager/reducer.js +251 -54
- package/es/components/flyout/manager/store.js +74 -12
- package/es/components/flyout/use_flyout_menu.js +70 -0
- package/es/components/form/file_picker/file_picker.js +46 -18
- package/es/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
- package/es/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +172 -0
- package/es/components/overlay_mask/overlay_mask.js +10 -3
- package/es/components/tree_view/tree_view_item.styles.js +1 -1
- package/es/services/hooks/index.js +8 -8
- package/es/services/hooks/useIsPointerDown.js +6 -15
- package/es/services/index.js +1 -1
- package/eui.d.ts +477 -63
- package/i18ntokens.json +661 -643
- package/lib/components/basic_table/collapsed_item_actions.js +2 -0
- package/lib/components/button/split_button/split_button.js +13 -0
- package/lib/components/button/split_button/split_button_actions.js +15 -0
- package/lib/components/collapsible_nav/collapsible_nav.js +5 -0
- package/lib/components/color_picker/color_picker.js +30 -7
- package/lib/components/context_menu/context_menu_item.js +9 -3
- package/lib/components/context_menu/context_menu_item.styles.js +5 -1
- package/lib/components/datagrid/utils/scrolling.js +37 -8
- package/lib/components/date_picker/super_date_picker/time_window_buttons.js +17 -3
- package/lib/components/flyout/_flyout_overlay.js +33 -3
- package/lib/components/flyout/const.js +11 -1
- package/lib/components/flyout/flyout.component.js +48 -56
- package/lib/components/flyout/flyout.js +15 -1
- package/lib/components/flyout/flyout.styles.js +2 -2
- package/lib/components/flyout/flyout_menu.js +19 -5
- package/lib/components/flyout/flyout_resizable.js +5 -0
- package/lib/components/flyout/manager/actions.js +12 -5
- package/lib/components/flyout/manager/flyout_child.js +9 -2
- package/lib/components/flyout/manager/flyout_managed.js +19 -12
- package/lib/components/flyout/manager/reducer.js +250 -53
- package/lib/components/flyout/manager/store.js +74 -14
- package/lib/components/flyout/use_flyout_menu.js +75 -0
- package/lib/components/form/file_picker/file_picker.js +46 -18
- package/lib/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
- package/lib/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +179 -0
- package/lib/components/overlay_mask/overlay_mask.js +10 -3
- package/lib/components/tree_view/tree_view_item.styles.js +1 -1
- package/lib/services/hooks/index.js +60 -91
- package/lib/services/hooks/useIsPointerDown.js +7 -14
- package/lib/services/index.js +70 -11
- package/optimize/es/components/basic_table/collapsed_item_actions.js +2 -0
- package/optimize/es/components/color_picker/color_picker.js +31 -8
- package/optimize/es/components/context_menu/context_menu_item.js +3 -2
- package/optimize/es/components/context_menu/context_menu_item.styles.js +6 -2
- package/optimize/es/components/datagrid/utils/scrolling.js +39 -10
- package/optimize/es/components/date_picker/super_date_picker/time_window_buttons.js +17 -3
- package/optimize/es/components/flyout/_flyout_overlay.js +34 -4
- package/optimize/es/components/flyout/const.js +10 -0
- package/optimize/es/components/flyout/flyout.component.js +49 -57
- package/optimize/es/components/flyout/flyout.js +5 -2
- package/optimize/es/components/flyout/flyout.styles.js +2 -2
- package/optimize/es/components/flyout/flyout_menu.js +7 -3
- package/optimize/es/components/flyout/manager/actions.js +12 -5
- package/optimize/es/components/flyout/manager/flyout_managed.js +18 -12
- package/optimize/es/components/flyout/manager/reducer.js +251 -54
- package/optimize/es/components/flyout/manager/store.js +69 -12
- package/optimize/es/components/flyout/use_flyout_menu.js +69 -0
- package/optimize/es/components/form/file_picker/file_picker.js +35 -18
- package/optimize/es/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
- package/optimize/es/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +172 -0
- package/optimize/es/components/overlay_mask/overlay_mask.js +4 -2
- package/optimize/es/components/tree_view/tree_view_item.styles.js +1 -1
- package/optimize/es/services/hooks/index.js +8 -8
- package/optimize/es/services/hooks/useIsPointerDown.js +6 -10
- package/optimize/es/services/index.js +1 -1
- package/optimize/lib/components/basic_table/collapsed_item_actions.js +2 -0
- package/optimize/lib/components/color_picker/color_picker.js +30 -7
- package/optimize/lib/components/context_menu/context_menu_item.js +3 -2
- package/optimize/lib/components/context_menu/context_menu_item.styles.js +5 -1
- package/optimize/lib/components/datagrid/utils/scrolling.js +37 -8
- package/optimize/lib/components/date_picker/super_date_picker/time_window_buttons.js +17 -3
- package/optimize/lib/components/flyout/_flyout_overlay.js +33 -3
- package/optimize/lib/components/flyout/const.js +11 -1
- package/optimize/lib/components/flyout/flyout.component.js +48 -56
- package/optimize/lib/components/flyout/flyout.js +10 -1
- package/optimize/lib/components/flyout/flyout.styles.js +2 -2
- package/optimize/lib/components/flyout/flyout_menu.js +7 -3
- package/optimize/lib/components/flyout/manager/actions.js +12 -5
- package/optimize/lib/components/flyout/manager/flyout_managed.js +18 -12
- package/optimize/lib/components/flyout/manager/reducer.js +250 -53
- package/optimize/lib/components/flyout/manager/store.js +70 -12
- package/optimize/lib/components/flyout/use_flyout_menu.js +74 -0
- package/optimize/lib/components/form/file_picker/file_picker.js +35 -18
- package/optimize/lib/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
- package/optimize/lib/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +179 -0
- package/optimize/lib/components/overlay_mask/overlay_mask.js +4 -2
- package/optimize/lib/components/tree_view/tree_view_item.styles.js +1 -1
- package/optimize/lib/services/hooks/index.js +60 -91
- package/optimize/lib/services/hooks/useIsPointerDown.js +5 -10
- package/optimize/lib/services/index.js +70 -11
- package/package.json +4 -4
- package/test-env/components/basic_table/collapsed_item_actions.js +2 -0
- package/test-env/components/button/split_button/split_button.js +13 -0
- package/test-env/components/button/split_button/split_button_actions.js +15 -0
- package/test-env/components/collapsible_nav/collapsible_nav.js +5 -0
- package/test-env/components/color_picker/color_picker.js +30 -7
- package/test-env/components/context_menu/context_menu_item.js +9 -3
- package/test-env/components/context_menu/context_menu_item.styles.js +5 -1
- package/test-env/components/datagrid/utils/scrolling.js +37 -8
- package/test-env/components/date_picker/super_date_picker/time_window_buttons.js +17 -3
- package/test-env/components/flyout/_flyout_overlay.js +33 -3
- package/test-env/components/flyout/const.js +11 -1
- package/test-env/components/flyout/flyout.component.js +48 -56
- package/test-env/components/flyout/flyout.styles.js +2 -2
- package/test-env/components/flyout/flyout_menu.js +19 -5
- package/test-env/components/flyout/flyout_resizable.js +5 -0
- package/test-env/components/flyout/manager/actions.js +12 -5
- package/test-env/components/flyout/manager/flyout_child.js +9 -2
- package/test-env/components/flyout/manager/flyout_managed.js +19 -12
- package/test-env/components/flyout/manager/reducer.js +250 -53
- package/test-env/components/flyout/manager/store.js +70 -12
- package/test-env/components/flyout/use_flyout_menu.js +74 -0
- package/test-env/components/form/file_picker/file_picker.js +46 -18
- package/test-env/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
- package/test-env/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +179 -0
- package/test-env/components/overlay_mask/overlay_mask.js +10 -3
- package/test-env/components/tree_view/tree_view_item.styles.js +1 -1
- package/test-env/services/hooks/index.js +60 -91
- package/test-env/services/hooks/useIsPointerDown.js +5 -10
- package/test-env/services/index.js +70 -11
|
@@ -64,6 +64,7 @@ export var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
64
64
|
var toolTipContent = callWithItemIfFunction(item)(action.description);
|
|
65
65
|
var href = callWithItemIfFunction(item)(action.href);
|
|
66
66
|
var dataTestSubj = callWithItemIfFunction(item)(action['data-test-subj']);
|
|
67
|
+
var color = action.color ? callWithItemIfFunction(item)(action.color) : undefined;
|
|
67
68
|
var _onClick = action.onClick,
|
|
68
69
|
target = action.target;
|
|
69
70
|
controls.push(___EmotionJSX(EuiContextMenuItem, {
|
|
@@ -73,6 +74,7 @@ export var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
73
74
|
href: href,
|
|
74
75
|
target: target,
|
|
75
76
|
icon: icon,
|
|
77
|
+
color: color,
|
|
76
78
|
"data-test-subj": dataTestSubj,
|
|
77
79
|
onClick: function onClick(event) {
|
|
78
80
|
event.persist();
|
|
@@ -97,6 +97,19 @@ _EuiSplitButton.propTypes = {
|
|
|
97
97
|
"aria-label": PropTypes.string,
|
|
98
98
|
"data-test-subj": PropTypes.string,
|
|
99
99
|
css: PropTypes.any,
|
|
100
|
+
/**
|
|
101
|
+
* Controls the disabled behavior via the native `disabled` attribute.
|
|
102
|
+
*/
|
|
103
|
+
isDisabled: PropTypes.bool,
|
|
104
|
+
/**
|
|
105
|
+
* NOTE: Beta feature, may be changed or removed in the future
|
|
106
|
+
*
|
|
107
|
+
* Changes the native `disabled` attribute to `aria-disabled` to preserve focusability.
|
|
108
|
+
* This results in a semantically disabled button without the default browser handling of the disabled state.
|
|
109
|
+
*
|
|
110
|
+
* Use e.g. when a disabled button should have a tooltip.
|
|
111
|
+
*/
|
|
112
|
+
hasAriaDisabled: PropTypes.bool,
|
|
100
113
|
size: PropTypes.any,
|
|
101
114
|
color: PropTypes.any,
|
|
102
115
|
fill: PropTypes.bool,
|
|
@@ -61,6 +61,19 @@ export var EuiSplitButtonActionPrimary = function EuiSplitButtonActionPrimary(_r
|
|
|
61
61
|
return tooltipProps ? ___EmotionJSX(EuiToolTip, tooltipProps, button) : button;
|
|
62
62
|
};
|
|
63
63
|
EuiSplitButtonActionPrimary.propTypes = {
|
|
64
|
+
/**
|
|
65
|
+
* Controls the disabled behavior via the native `disabled` attribute.
|
|
66
|
+
*/
|
|
67
|
+
isDisabled: PropTypes.bool,
|
|
68
|
+
/**
|
|
69
|
+
* NOTE: Beta feature, may be changed or removed in the future
|
|
70
|
+
*
|
|
71
|
+
* Changes the native `disabled` attribute to `aria-disabled` to preserve focusability.
|
|
72
|
+
* This results in a semantically disabled button without the default browser handling of the disabled state.
|
|
73
|
+
*
|
|
74
|
+
* Use e.g. when a disabled button should have a tooltip.
|
|
75
|
+
*/
|
|
76
|
+
hasAriaDisabled: PropTypes.bool,
|
|
64
77
|
/**
|
|
65
78
|
* Enables rendering an `EuiToolTip` with the passed props.
|
|
66
79
|
*/
|
|
@@ -103,6 +116,8 @@ export var EuiSplitButtonActionSecondary = function EuiSplitButtonActionSecondar
|
|
|
103
116
|
})) : action;
|
|
104
117
|
};
|
|
105
118
|
EuiSplitButtonActionSecondary.propTypes = {
|
|
119
|
+
isDisabled: PropTypes.bool,
|
|
120
|
+
hasAriaDisabled: PropTypes.bool,
|
|
106
121
|
/**
|
|
107
122
|
* Enables rendering an `EuiToolTip` with the passed props.
|
|
108
123
|
*/
|
|
@@ -130,6 +130,11 @@ EuiCollapsibleNav.propTypes = {
|
|
|
130
130
|
* @default undefined (auto-inherit when nested, otherwise 'never')
|
|
131
131
|
*/
|
|
132
132
|
session: PropTypes.oneOfType([PropTypes.any.isRequired, PropTypes.any.isRequired, PropTypes.any.isRequired]),
|
|
133
|
+
/**
|
|
134
|
+
* Optional Symbol to scope flyout history. Only flyouts that receive the same Symbol reference share Back button and history; omit to get a unique group per session.
|
|
135
|
+
* @default undefined (each session gets a unique key and does not share history)
|
|
136
|
+
*/
|
|
137
|
+
historyKey: PropTypes.any,
|
|
133
138
|
/**
|
|
134
139
|
* Callback fired when the flyout becomes active/visible, which may happen programmatically from history navigation.
|
|
135
140
|
*/
|
|
@@ -21,7 +21,7 @@ import PropTypes from "prop-types";
|
|
|
21
21
|
import React, { cloneElement, useEffect, useMemo, useRef, useState } from 'react';
|
|
22
22
|
import classNames from 'classnames';
|
|
23
23
|
import chroma from 'chroma-js';
|
|
24
|
-
import { useEuiMemoizedStyles, keys, useEuiPaletteColorBlind } from '../../services';
|
|
24
|
+
import { useEuiMemoizedStyles, keys, useEuiPaletteColorBlind, useGeneratedHtmlId } from '../../services';
|
|
25
25
|
import { EuiFieldText, EuiFormControlLayout, EuiFormRow, EuiRange } from '../form';
|
|
26
26
|
import { useEuiI18n } from '../i18n';
|
|
27
27
|
import { EuiPopover } from '../popover';
|
|
@@ -94,9 +94,12 @@ export var EuiColorPicker = function EuiColorPicker(_ref) {
|
|
|
94
94
|
_ref$isClearable = _ref.isClearable,
|
|
95
95
|
isClearable = _ref$isClearable === void 0 ? false : _ref$isClearable,
|
|
96
96
|
placeholder = _ref.placeholder,
|
|
97
|
-
dataTestSubj = _ref['data-test-subj']
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
dataTestSubj = _ref['data-test-subj'],
|
|
98
|
+
_ariaLabel = _ref['aria-label'],
|
|
99
|
+
ariaLabelledby = _ref['aria-labelledby'],
|
|
100
|
+
ariaDescribedby = _ref['aria-describedby'];
|
|
101
|
+
var _useEuiI18n = useEuiI18n(['euiColorPicker.popoverLabel', 'euiColorPicker.colorLabel', 'euiColorPicker.selectedColorLabel', 'euiColorPicker.colorErrorMessage', 'euiColorPicker.transparent', 'euiColorPicker.alphaLabel', 'euiColorPicker.openLabel', 'euiColorPicker.closeLabel', 'euiColorPicker.ariaLabel'], ['Color selection dialog', 'Color value', 'Selected color', 'Invalid color value', 'Transparent', 'Alpha channel (opacity) value', 'Press the escape key to close the popover', 'Press the down key to open a popover containing color options', 'Select a color']),
|
|
102
|
+
_useEuiI18n2 = _slicedToArray(_useEuiI18n, 9),
|
|
100
103
|
popoverLabel = _useEuiI18n2[0],
|
|
101
104
|
colorLabel = _useEuiI18n2[1],
|
|
102
105
|
selectedColorLabel = _useEuiI18n2[2],
|
|
@@ -104,7 +107,16 @@ export var EuiColorPicker = function EuiColorPicker(_ref) {
|
|
|
104
107
|
transparent = _useEuiI18n2[4],
|
|
105
108
|
alphaLabel = _useEuiI18n2[5],
|
|
106
109
|
openLabel = _useEuiI18n2[6],
|
|
107
|
-
closeLabel = _useEuiI18n2[7]
|
|
110
|
+
closeLabel = _useEuiI18n2[7],
|
|
111
|
+
ariaLabel = _useEuiI18n2[8];
|
|
112
|
+
var openLabelId = useGeneratedHtmlId({
|
|
113
|
+
prefix: 'colorPicker',
|
|
114
|
+
suffix: 'openLabel'
|
|
115
|
+
});
|
|
116
|
+
var closeLabelId = useGeneratedHtmlId({
|
|
117
|
+
prefix: 'colorPicker',
|
|
118
|
+
suffix: 'closeLabel'
|
|
119
|
+
});
|
|
108
120
|
var defaultSwatches = useEuiPaletteColorBlind();
|
|
109
121
|
var swatches = _swatches !== null && _swatches !== void 0 ? _swatches : defaultSwatches;
|
|
110
122
|
var preferredFormat = useMemo(function () {
|
|
@@ -433,10 +445,21 @@ export var EuiColorPicker = function EuiColorPicker(_ref) {
|
|
|
433
445
|
readOnly: readOnly,
|
|
434
446
|
fullWidth: fullWidth,
|
|
435
447
|
autoComplete: "off",
|
|
436
|
-
"data-test-subj": testSubjAnchor
|
|
437
|
-
|
|
448
|
+
"data-test-subj": testSubjAnchor
|
|
449
|
+
// if an id is provided it might be used in combination with `htmlFor` on a label,
|
|
450
|
+
// so we don't want to override it with a fallback `aria-label`
|
|
451
|
+
,
|
|
452
|
+
"aria-label": _ariaLabel ? _ariaLabel : id || ariaLabelledby ? undefined : ariaLabel,
|
|
453
|
+
"aria-labelledby": ariaLabelledby,
|
|
454
|
+
"aria-describedby": classNames(isColorSelectorShown ? openLabelId : closeLabelId, ariaDescribedby),
|
|
438
455
|
controlOnly: true // Don't need two EuiFormControlwrappers
|
|
439
|
-
})
|
|
456
|
+
}), ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("span", null, ___EmotionJSX("span", {
|
|
457
|
+
id: openLabelId,
|
|
458
|
+
"aria-hidden": !isColorSelectorShown
|
|
459
|
+
}, openLabel), ___EmotionJSX("span", {
|
|
460
|
+
id: closeLabelId,
|
|
461
|
+
"aria-hidden": isColorSelectorShown
|
|
462
|
+
}, closeLabel))));
|
|
440
463
|
}
|
|
441
464
|
return display === 'inline' ? ___EmotionJSX("div", {
|
|
442
465
|
css: styles.euiColorPicker,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["children", "className", "hasPanel", "icon", "buttonRef", "disabled", "layoutAlign", "toolTipContent", "toolTipProps", "href", "target", "rel", "size"];
|
|
1
|
+
var _excluded = ["children", "className", "hasPanel", "icon", "buttonRef", "disabled", "layoutAlign", "toolTipContent", "toolTipProps", "href", "target", "rel", "size", "color"];
|
|
2
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
3
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
4
4
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
|
|
@@ -43,12 +43,13 @@ export var EuiContextMenuItem = function EuiContextMenuItem(_ref) {
|
|
|
43
43
|
rel = _ref.rel,
|
|
44
44
|
_ref$size = _ref.size,
|
|
45
45
|
size = _ref$size === void 0 ? 'm' : _ref$size,
|
|
46
|
+
color = _ref.color,
|
|
46
47
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
47
48
|
var isHrefValid = !href || validateHref(href);
|
|
48
49
|
var disabled = _disabled || !isHrefValid;
|
|
49
50
|
var classes = classNames('euiContextMenuItem', className);
|
|
50
51
|
var styles = useEuiMemoizedStyles(euiContextMenuItemStyles);
|
|
51
|
-
var cssStyles = [styles.euiContextMenuItem, styles.sizes[size], styles.layoutAlign[layoutAlign], disabled && styles.disabled];
|
|
52
|
+
var cssStyles = [styles.euiContextMenuItem, styles.sizes[size], styles.layoutAlign[layoutAlign], disabled && styles.disabled, !disabled && color && styles.colors[color]];
|
|
52
53
|
var iconInstance = icon && (typeof icon === 'string' ? ___EmotionJSX(EuiIcon, {
|
|
53
54
|
type: icon,
|
|
54
55
|
size: "m",
|
|
@@ -144,5 +145,10 @@ EuiContextMenuItem.propTypes = {
|
|
|
144
145
|
/**
|
|
145
146
|
* Reduce the size to `s` when in need of a more compressed menu
|
|
146
147
|
*/
|
|
147
|
-
size: PropTypes.any
|
|
148
|
+
size: PropTypes.any,
|
|
149
|
+
/**
|
|
150
|
+
* Applies a color to the text and icon of the item.
|
|
151
|
+
* Accepts the same color values as `EuiButtonEmpty`.
|
|
152
|
+
*/
|
|
153
|
+
color: PropTypes.any
|
|
148
154
|
};
|
|
@@ -8,7 +8,7 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { css } from '@emotion/react';
|
|
11
|
-
import { logicalCSS, logicalTextAlignCSS, euiFontSize } from '../../global_styling';
|
|
11
|
+
import { logicalCSS, logicalTextAlignCSS, euiFontSize, EXTENDED_BUTTON_COLORS, euiButtonEmptyColor } from '../../global_styling';
|
|
12
12
|
var _ref = process.env.NODE_ENV === "production" ? {
|
|
13
13
|
name: "4ak4s8-euiContextMenuItem__arrow",
|
|
14
14
|
styles: "align-self:flex-end;label:euiContextMenuItem__arrow;"
|
|
@@ -77,6 +77,10 @@ export var euiContextMenuItemStyles = function euiContextMenuItemStyles(euiTheme
|
|
|
77
77
|
euiContextMenuItem__text: _ref2,
|
|
78
78
|
s: /*#__PURE__*/css(euiFontSize(euiThemeContext, 's'), ";;label:s;")
|
|
79
79
|
},
|
|
80
|
-
euiContextMenuItem__arrow: _ref
|
|
80
|
+
euiContextMenuItem__arrow: _ref,
|
|
81
|
+
// Colors - maps button color names to text color overrides
|
|
82
|
+
colors: Object.fromEntries(EXTENDED_BUTTON_COLORS.map(function (color) {
|
|
83
|
+
return [color, /*#__PURE__*/css("color:", euiButtonEmptyColor(euiThemeContext, color).color, ";;label:colors;")];
|
|
84
|
+
}))
|
|
81
85
|
};
|
|
82
86
|
};
|
|
@@ -10,8 +10,9 @@ function _asyncToGenerator(n) { return function () { var t = this, e = arguments
|
|
|
10
10
|
* Side Public License, v 1.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import React, { useContext, useEffect, useCallback, useMemo } from 'react';
|
|
14
|
-
import { useEuiMemoizedStyles
|
|
13
|
+
import React, { useContext, useEffect, useCallback, useMemo, useRef } from 'react';
|
|
14
|
+
import { useEuiMemoizedStyles } from '../../../services';
|
|
15
|
+
import { useIsPointerDown } from '../../../services/hooks';
|
|
15
16
|
import { logicalStyles } from '../../../global_styling';
|
|
16
17
|
import { DataGridCellPopoverContext } from '../body/cell';
|
|
17
18
|
import { DataGridFocusContext } from './focus';
|
|
@@ -29,20 +30,48 @@ export var useScroll = function useScroll(args) {
|
|
|
29
30
|
scrollCellIntoView = _useScrollCellIntoVie.scrollCellIntoView;
|
|
30
31
|
var _useContext = useContext(DataGridFocusContext),
|
|
31
32
|
focusedCell = _useContext.focusedCell;
|
|
32
|
-
var
|
|
33
|
+
var isPointerDownRef = useIsPointerDown(args.outerGridRef);
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Set when `focusedCell` changes while the pointer is held down (e.g. clicking a cell).
|
|
37
|
+
* Allows the `pointerup` listener below to scroll on release without
|
|
38
|
+
* causing snap-back when the user scrolls the grid without changing focus.
|
|
39
|
+
*/
|
|
40
|
+
var pendingScrollRef = useRef(false);
|
|
41
|
+
useEffect(function () {
|
|
42
|
+
if (!focusedCell) return;
|
|
43
|
+
if (isPointerDownRef.current) {
|
|
44
|
+
// Pointer is down - defer scroll decision to the pointerup listener
|
|
45
|
+
pendingScrollRef.current = true;
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
scrollCellIntoView({
|
|
49
|
+
rowIndex: focusedCell[1],
|
|
50
|
+
colIndex: focusedCell[0]
|
|
51
|
+
});
|
|
52
|
+
}, [focusedCell, scrollCellIntoView, isPointerDownRef]);
|
|
33
53
|
useEffect(function () {
|
|
34
|
-
|
|
54
|
+
var handlePointerUp = function handlePointerUp() {
|
|
35
55
|
var _window;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
56
|
+
if (!pendingScrollRef.current || !focusedCell) return;
|
|
57
|
+
pendingScrollRef.current = false;
|
|
58
|
+
|
|
59
|
+
// Skip if the interaction resulted in text being selected
|
|
60
|
+
if (((_window = window) === null || _window === void 0 || (_window = _window.getSelection()) === null || _window === void 0 ? void 0 : _window.type) === 'Range') return;
|
|
40
61
|
scrollCellIntoView({
|
|
41
62
|
rowIndex: focusedCell[1],
|
|
42
63
|
colIndex: focusedCell[0]
|
|
43
64
|
});
|
|
44
|
-
}
|
|
45
|
-
|
|
65
|
+
};
|
|
66
|
+
document.addEventListener('pointerup', handlePointerUp, {
|
|
67
|
+
capture: true
|
|
68
|
+
});
|
|
69
|
+
return function () {
|
|
70
|
+
return document.removeEventListener('pointerup', handlePointerUp, {
|
|
71
|
+
capture: true
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
}, [focusedCell, scrollCellIntoView]);
|
|
46
75
|
var _useContext2 = useContext(DataGridCellPopoverContext),
|
|
47
76
|
popoverIsOpen = _useContext2.popoverIsOpen,
|
|
48
77
|
cellLocation = _useContext2.cellLocation;
|
|
@@ -152,11 +152,20 @@ export var EuiTimeWindowButtons = function EuiTimeWindowButtons(_ref) {
|
|
|
152
152
|
export function useEuiTimeWindow(start, end, apply, options) {
|
|
153
153
|
var _options$zoomFactor;
|
|
154
154
|
var min = dateMath.parse(start);
|
|
155
|
+
|
|
156
|
+
/* `roundUp: true` will result in an "inclusive" time (e.g. 23:59:59.999 for 'now/d').
|
|
157
|
+
It only changes the value for relative expressions (e.g. 'now/d') but not absolute ISO strings. */
|
|
155
158
|
var max = dateMath.parse(end, {
|
|
156
159
|
roundUp: true
|
|
157
160
|
});
|
|
158
161
|
var isInvalid = !min || !min.isValid() || !max || !max.isValid();
|
|
159
|
-
|
|
162
|
+
/* An end at .999ms is always considered an inclusive boundary (either as result of `roundUp: true`
|
|
163
|
+
or entered manually).
|
|
164
|
+
To avoid a 1ms drift on every time window or zoom step, windowDuration has to be increased by 1ms.
|
|
165
|
+
This ensures the window is always at a clean boundary (e.g. 00:00:00.000 - 23:59:59.999). */
|
|
166
|
+
var isInclusiveBoundary = !isInvalid && max.milliseconds() === 999;
|
|
167
|
+
var endBoundary = !isInvalid ? isInclusiveBoundary ? moment(max).add(1, 'ms') : moment(max) : null;
|
|
168
|
+
var windowDuration = isInvalid || !endBoundary ? -1 : endBoundary.diff(min);
|
|
160
169
|
var isWindowDurationZero = windowDuration === 0;
|
|
161
170
|
var zoomFactor = getPercentageMultiplier((_options$zoomFactor = options === null || options === void 0 ? void 0 : options.zoomFactor) !== null && _options$zoomFactor !== void 0 ? _options$zoomFactor : ZOOM_FACTOR_DEFAULT);
|
|
162
171
|
var zoomDelta = windowDuration * (zoomFactor / 2); // Gets added to each end, that's why it's split in half
|
|
@@ -177,7 +186,10 @@ export function useEuiTimeWindow(start, end, apply, options) {
|
|
|
177
186
|
function stepForward() {
|
|
178
187
|
if (isInvalid || isWindowDurationZero) return;
|
|
179
188
|
apply({
|
|
180
|
-
|
|
189
|
+
/* Prevent 1ms drifts for inclusive boundaries by using the exclusive max (+ 1ms)
|
|
190
|
+
as the start of the next window (e.g. 00:00:00.000 instead of 23:59:59.999) */
|
|
191
|
+
start: (isInclusiveBoundary ? endBoundary // `!` is safe here because we early return on `isInvalid`
|
|
192
|
+
: moment(max)).toISOString(),
|
|
181
193
|
end: moment(max).add(windowDuration, 'ms').toISOString()
|
|
182
194
|
});
|
|
183
195
|
}
|
|
@@ -185,7 +197,9 @@ export function useEuiTimeWindow(start, end, apply, options) {
|
|
|
185
197
|
if (isInvalid || isWindowDurationZero) return;
|
|
186
198
|
apply({
|
|
187
199
|
start: moment(min).subtract(windowDuration, 'ms').toISOString(),
|
|
188
|
-
|
|
200
|
+
/* Prevent 1ms drifts for inclusive boundaries by using the exclusive min (- 1ms)
|
|
201
|
+
as the end of the previous window (e.g. 23:59:59.999 instead of 00:00:00.000) */
|
|
202
|
+
end: (isInclusiveBoundary ? moment(min).subtract(1, 'ms') : moment(min)).toISOString()
|
|
189
203
|
});
|
|
190
204
|
}
|
|
191
205
|
function expandWindow() {
|
|
@@ -7,8 +7,9 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
|
|
|
7
7
|
* Side Public License, v 1.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import React, { useMemo } from 'react';
|
|
10
|
+
import React, { useEffect, useMemo, useRef } from 'react';
|
|
11
11
|
import { css, cx } from '@emotion/css';
|
|
12
|
+
import { useCombinedRefs } from '../../services';
|
|
12
13
|
import { EuiOverlayMask } from '../overlay_mask';
|
|
13
14
|
import { EuiPortal } from '../portal';
|
|
14
15
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
@@ -16,8 +17,7 @@ var getEuiFlyoutOverlayStyles = function getEuiFlyoutOverlayStyles(zIndex) {
|
|
|
16
17
|
/*
|
|
17
18
|
This needs to have !important to override the default EuiOverlayMask
|
|
18
19
|
z-index based on the headerZindexLocation prop. Using the style attribute
|
|
19
|
-
doesn't work since EuiOverlayMask requires
|
|
20
|
-
causes React errors in the test environment.
|
|
20
|
+
doesn't work since EuiOverlayMask requires the styles to be provided via className
|
|
21
21
|
*/
|
|
22
22
|
return /*#__PURE__*/css("z-index:", zIndex, "!important;;label:getEuiFlyoutOverlayStyles;");
|
|
23
23
|
};
|
|
@@ -38,10 +38,39 @@ export var EuiFlyoutOverlay = function EuiFlyoutOverlay(_ref) {
|
|
|
38
38
|
hasOverlayMask = _ref.hasOverlayMask,
|
|
39
39
|
maskZIndex = _ref.maskZIndex,
|
|
40
40
|
_ref$headerZindexLoca = _ref.headerZindexLocation,
|
|
41
|
-
headerZindexLocation = _ref$headerZindexLoca === void 0 ? 'below' : _ref$headerZindexLoca
|
|
41
|
+
headerZindexLocation = _ref$headerZindexLoca === void 0 ? 'below' : _ref$headerZindexLoca,
|
|
42
|
+
containerRect = _ref.containerRect;
|
|
42
43
|
var styles = useMemo(function () {
|
|
43
44
|
return getEuiFlyoutOverlayStyles(maskZIndex);
|
|
44
45
|
}, [maskZIndex]);
|
|
46
|
+
|
|
47
|
+
// Internal ref so we can apply containerRect positioning directly on the DOM
|
|
48
|
+
// node, avoiding new Emotion CSS class generation on every scroll/resize.
|
|
49
|
+
var internalMaskRef = useRef(null);
|
|
50
|
+
var combinedMaskRef = useCombinedRefs([internalMaskRef, maskProps === null || maskProps === void 0 ? void 0 : maskProps.maskRef]);
|
|
51
|
+
useEffect(function () {
|
|
52
|
+
var node = internalMaskRef.current;
|
|
53
|
+
if (!node) return;
|
|
54
|
+
|
|
55
|
+
// containerRect positioning must be applied via node.style.setProperty rather than
|
|
56
|
+
// through the style prop - EuiOverlayMask requires styles to be passed via className
|
|
57
|
+
if (containerRect) {
|
|
58
|
+
node.style.setProperty('inset-block-start', "".concat(containerRect.top, "px"));
|
|
59
|
+
node.style.setProperty('inset-inline-start', "".concat(containerRect.left, "px"));
|
|
60
|
+
node.style.setProperty('inline-size', "".concat(containerRect.width, "px"));
|
|
61
|
+
node.style.setProperty('block-size', "".concat(containerRect.height, "px"));
|
|
62
|
+
node.style.setProperty('inset-inline-end', 'auto');
|
|
63
|
+
node.style.setProperty('inset-block-end', 'auto');
|
|
64
|
+
} else {
|
|
65
|
+
node.style.removeProperty('inset-block-start');
|
|
66
|
+
node.style.removeProperty('inset-inline-start');
|
|
67
|
+
node.style.removeProperty('inline-size');
|
|
68
|
+
node.style.removeProperty('block-size');
|
|
69
|
+
node.style.removeProperty('inset-inline-end');
|
|
70
|
+
node.style.removeProperty('inset-block-end');
|
|
71
|
+
}
|
|
72
|
+
}, [containerRect, hasOverlayMask]); // toggling ownFocus while the flyout is already open should cause re-render
|
|
73
|
+
|
|
45
74
|
var content = children;
|
|
46
75
|
if (!isPushed || hasOverlayMask) {
|
|
47
76
|
content = ___EmotionJSX(EuiPortal, null, content);
|
|
@@ -50,6 +79,7 @@ export var EuiFlyoutOverlay = function EuiFlyoutOverlay(_ref) {
|
|
|
50
79
|
return ___EmotionJSX(React.Fragment, null, hasOverlayMask && ___EmotionJSX(EuiOverlayMask, _extends({
|
|
51
80
|
headerZindexLocation: (_maskProps$headerZind = maskProps === null || maskProps === void 0 ? void 0 : maskProps.headerZindexLocation) !== null && _maskProps$headerZind !== void 0 ? _maskProps$headerZind : headerZindexLocation
|
|
52
81
|
}, maskProps, {
|
|
82
|
+
maskRef: combinedMaskRef,
|
|
53
83
|
className: classes
|
|
54
84
|
})), content);
|
|
55
85
|
};
|
|
@@ -18,6 +18,14 @@ export var FLYOUT_SIDES = ['left', 'right'];
|
|
|
18
18
|
export var FLYOUT_SIZES = ['s', 'm', 'l', 'fill'];
|
|
19
19
|
/** Type representing a supported named flyout size. */
|
|
20
20
|
|
|
21
|
+
/** Menu display mode: always render menu when flyoutMenuProps is provided. */
|
|
22
|
+
export var MENU_DISPLAY_ALWAYS = 'always';
|
|
23
|
+
/** Menu display mode: only render menu when it has content (back button, history, title, or custom actions). */
|
|
24
|
+
export var MENU_DISPLAY_AUTO = 'auto';
|
|
25
|
+
/** Allowed flyout menu display modes. */
|
|
26
|
+
export var FLYOUT_MENU_DISPLAY_MODES = [MENU_DISPLAY_ALWAYS, MENU_DISPLAY_AUTO];
|
|
27
|
+
/** Type representing a supported flyout menu display mode. */
|
|
28
|
+
|
|
21
29
|
/** Allowed padding sizes for flyout content. */
|
|
22
30
|
export var FLYOUT_PADDING_SIZES = ['none', 's', 'm', 'l'];
|
|
23
31
|
/** Type representing a supported flyout padding size. */
|
|
@@ -32,6 +40,8 @@ export var DEFAULT_SIDE = 'right';
|
|
|
32
40
|
export var DEFAULT_SIZE = 'm';
|
|
33
41
|
/** Default padding size inside flyouts. */
|
|
34
42
|
export var DEFAULT_PADDING_SIZE = 'l';
|
|
43
|
+
/** Default flyout menu display mode. */
|
|
44
|
+
export var DEFAULT_MENU_DISPLAY_MODE = MENU_DISPLAY_AUTO;
|
|
35
45
|
|
|
36
46
|
/**
|
|
37
47
|
* Custom type checker for named flyout sizes since the prop
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
var _excluded = ["className", "children", "as", "hideCloseButton", "flyoutMenuProps", "closeButtonProps", "closeButtonPosition", "onClose", "ownFocus", "side", "size", "paddingSize", "maxWidth", "style", "hasChildBackground", "maskProps", "type", "outsideClickCloses", "pushMinBreakpoint", "pushAnimation", "focusTrapProps", "includeFixedHeadersInFocusTrap", "includeSelectorInFocusTrap", "aria-describedby", "aria-labelledby", "id", "resizable", "minWidth", "onResize", "onAnimationEnd", "container"]
|
|
3
|
-
_excluded2 = ["titleId"];
|
|
2
|
+
var _excluded = ["className", "children", "as", "hideCloseButton", "flyoutMenuProps", "flyoutMenuDisplayMode", "closeButtonProps", "closeButtonPosition", "onClose", "ownFocus", "side", "size", "paddingSize", "maxWidth", "style", "hasChildBackground", "maskProps", "type", "outsideClickCloses", "pushMinBreakpoint", "pushAnimation", "hasAnimation", "focusTrapProps", "includeFixedHeadersInFocusTrap", "includeSelectorInFocusTrap", "aria-describedby", "aria-labelledby", "id", "resizable", "minWidth", "onResize", "onAnimationEnd", "container"];
|
|
4
3
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
5
4
|
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
6
5
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -41,7 +40,7 @@ import { EuiScreenReaderOnly } from '../accessibility';
|
|
|
41
40
|
import { EuiFlyoutCloseButton } from './_flyout_close_button';
|
|
42
41
|
import { euiFlyoutStyles, composeFlyoutInlineStyles } from './flyout.styles';
|
|
43
42
|
import { usePropsWithComponentDefaults } from '../provider/component_defaults';
|
|
44
|
-
import { DEFAULT_PADDING_SIZE, DEFAULT_PUSH_MIN_BREAKPOINT, DEFAULT_SIDE, DEFAULT_SIZE, DEFAULT_TYPE, isEuiFlyoutSizeNamed } from './const';
|
|
43
|
+
import { DEFAULT_MENU_DISPLAY_MODE, DEFAULT_PADDING_SIZE, DEFAULT_PUSH_MIN_BREAKPOINT, DEFAULT_SIDE, DEFAULT_SIZE, DEFAULT_TYPE, isEuiFlyoutSizeNamed } from './const';
|
|
45
44
|
import { useIsPushed } from './hooks';
|
|
46
45
|
import { EuiFlyoutMenu } from './flyout_menu';
|
|
47
46
|
import { EuiFlyoutOverlay } from './_flyout_overlay';
|
|
@@ -49,6 +48,7 @@ import { EuiFlyoutResizeButton } from './_flyout_resize_button';
|
|
|
49
48
|
import { useEuiFlyoutResizable } from './use_flyout_resizable';
|
|
50
49
|
import { useEuiFlyoutZIndex } from './use_flyout_z_index';
|
|
51
50
|
import { EuiFlyoutParentProvider } from './flyout_parent_context';
|
|
51
|
+
import { useEuiFlyoutMenu } from './use_flyout_menu';
|
|
52
52
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
53
53
|
/**
|
|
54
54
|
* Resolves the container prop (element, getter, or selector string) to an
|
|
@@ -75,31 +75,33 @@ export var EuiFlyoutComponent = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
75
75
|
_usePropsWithComponen2 = _usePropsWithComponen.hideCloseButton,
|
|
76
76
|
hideCloseButton = _usePropsWithComponen2 === void 0 ? false : _usePropsWithComponen2,
|
|
77
77
|
_flyoutMenuProps = _usePropsWithComponen.flyoutMenuProps,
|
|
78
|
+
_usePropsWithComponen3 = _usePropsWithComponen.flyoutMenuDisplayMode,
|
|
79
|
+
flyoutMenuDisplayMode = _usePropsWithComponen3 === void 0 ? DEFAULT_MENU_DISPLAY_MODE : _usePropsWithComponen3,
|
|
78
80
|
closeButtonProps = _usePropsWithComponen.closeButtonProps,
|
|
79
|
-
|
|
80
|
-
closeButtonPosition =
|
|
81
|
+
_usePropsWithComponen4 = _usePropsWithComponen.closeButtonPosition,
|
|
82
|
+
closeButtonPosition = _usePropsWithComponen4 === void 0 ? 'inside' : _usePropsWithComponen4,
|
|
81
83
|
onClose = _usePropsWithComponen.onClose,
|
|
82
|
-
|
|
83
|
-
ownFocus =
|
|
84
|
-
|
|
85
|
-
side =
|
|
86
|
-
|
|
87
|
-
_size =
|
|
88
|
-
|
|
89
|
-
paddingSize =
|
|
90
|
-
|
|
91
|
-
maxWidth =
|
|
84
|
+
_usePropsWithComponen5 = _usePropsWithComponen.ownFocus,
|
|
85
|
+
ownFocus = _usePropsWithComponen5 === void 0 ? true : _usePropsWithComponen5,
|
|
86
|
+
_usePropsWithComponen6 = _usePropsWithComponen.side,
|
|
87
|
+
side = _usePropsWithComponen6 === void 0 ? DEFAULT_SIDE : _usePropsWithComponen6,
|
|
88
|
+
_usePropsWithComponen7 = _usePropsWithComponen.size,
|
|
89
|
+
_size = _usePropsWithComponen7 === void 0 ? DEFAULT_SIZE : _usePropsWithComponen7,
|
|
90
|
+
_usePropsWithComponen8 = _usePropsWithComponen.paddingSize,
|
|
91
|
+
paddingSize = _usePropsWithComponen8 === void 0 ? DEFAULT_PADDING_SIZE : _usePropsWithComponen8,
|
|
92
|
+
_usePropsWithComponen9 = _usePropsWithComponen.maxWidth,
|
|
93
|
+
maxWidth = _usePropsWithComponen9 === void 0 ? false : _usePropsWithComponen9,
|
|
92
94
|
style = _usePropsWithComponen.style,
|
|
93
|
-
|
|
94
|
-
hasChildBackground =
|
|
95
|
+
_usePropsWithComponen10 = _usePropsWithComponen.hasChildBackground,
|
|
96
|
+
hasChildBackground = _usePropsWithComponen10 === void 0 ? false : _usePropsWithComponen10,
|
|
95
97
|
maskProps = _usePropsWithComponen.maskProps,
|
|
96
|
-
|
|
97
|
-
type =
|
|
98
|
+
_usePropsWithComponen11 = _usePropsWithComponen.type,
|
|
99
|
+
type = _usePropsWithComponen11 === void 0 ? DEFAULT_TYPE : _usePropsWithComponen11,
|
|
98
100
|
outsideClickCloses = _usePropsWithComponen.outsideClickCloses,
|
|
99
|
-
|
|
100
|
-
pushMinBreakpoint =
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
_usePropsWithComponen12 = _usePropsWithComponen.pushMinBreakpoint,
|
|
102
|
+
pushMinBreakpoint = _usePropsWithComponen12 === void 0 ? DEFAULT_PUSH_MIN_BREAKPOINT : _usePropsWithComponen12,
|
|
103
|
+
_pushAnimation = _usePropsWithComponen.pushAnimation,
|
|
104
|
+
_hasAnimation = _usePropsWithComponen.hasAnimation,
|
|
103
105
|
_focusTrapProps = _usePropsWithComponen.focusTrapProps,
|
|
104
106
|
_usePropsWithComponen13 = _usePropsWithComponen.includeFixedHeadersInFocusTrap,
|
|
105
107
|
includeFixedHeadersInFocusTrap = _usePropsWithComponen13 === void 0 ? true : _usePropsWithComponen13,
|
|
@@ -115,6 +117,8 @@ export var EuiFlyoutComponent = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
115
117
|
containerProp = _usePropsWithComponen.container,
|
|
116
118
|
rest = _objectWithoutProperties(_usePropsWithComponen, _excluded);
|
|
117
119
|
var container = resolveContainer(containerProp);
|
|
120
|
+
var hasAnimationDefault = type === 'overlay';
|
|
121
|
+
var hasAnimation = _hasAnimation !== null && _hasAnimation !== void 0 ? _hasAnimation : hasAnimationDefault;
|
|
118
122
|
var _useEuiThemeCSSVariab = useEuiThemeCSSVariables(),
|
|
119
123
|
setGlobalCSSVariables = _useEuiThemeCSSVariab.setGlobalCSSVariables;
|
|
120
124
|
var Element = as || defaultElement;
|
|
@@ -166,6 +170,21 @@ export var EuiFlyoutComponent = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
166
170
|
var layoutMode = (_managerState$layoutM = managerState === null || managerState === void 0 ? void 0 : managerState.layoutMode) !== null && _managerState$layoutM !== void 0 ? _managerState$layoutM : LAYOUT_MODE_SIDE_BY_SIDE;
|
|
167
171
|
var isActiveManagedFlyout = (currentSession === null || currentSession === void 0 ? void 0 : currentSession.mainFlyoutId) === flyoutId || (currentSession === null || currentSession === void 0 ? void 0 : currentSession.childFlyoutId) === flyoutId;
|
|
168
172
|
var currentZIndexRef = useRef((_managerState$current = managerState === null || managerState === void 0 ? void 0 : managerState.currentZIndex) !== null && _managerState$current !== void 0 ? _managerState$current : 0);
|
|
173
|
+
var _useEuiFlyoutMenu = useEuiFlyoutMenu({
|
|
174
|
+
flyoutMenuProps: _flyoutMenuProps,
|
|
175
|
+
flyoutMenuDisplayMode: flyoutMenuDisplayMode,
|
|
176
|
+
ariaLabelledBy: _ariaLabelledBy
|
|
177
|
+
}),
|
|
178
|
+
flyoutMenuId = _useEuiFlyoutMenu.flyoutMenuId,
|
|
179
|
+
flyoutMenuProps = _useEuiFlyoutMenu.flyoutMenuProps,
|
|
180
|
+
shouldRenderMenu = _useEuiFlyoutMenu.shouldRenderMenu,
|
|
181
|
+
ariaLabelledBy = _useEuiFlyoutMenu.ariaLabelledBy;
|
|
182
|
+
useEffect(function () {
|
|
183
|
+
if (process.env.NODE_ENV === 'development' && _flyoutMenuProps && 'hideTitle' in _flyoutMenuProps) {
|
|
184
|
+
console.warn('EuiFlyout: `flyoutMenuProps.hideTitle` is deprecated. Use `EuiFlyoutHeader` for visible titles instead.');
|
|
185
|
+
}
|
|
186
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
187
|
+
}, []);
|
|
169
188
|
|
|
170
189
|
// Use a ref to access the latest flyoutManager without triggering effect re-runs
|
|
171
190
|
var flyoutManagerRef = useRef(flyoutManager);
|
|
@@ -520,7 +539,7 @@ export var EuiFlyoutComponent = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
520
539
|
return _objectSpread(_objectSpread(_objectSpread({}, style), composedStyles), containerPositionStyles);
|
|
521
540
|
}, [style, size, layoutMode, siblingFlyoutId, siblingFlyoutWidth, maxWidth, flyoutZIndex, containerRect, side, isChildFlyout]);
|
|
522
541
|
var styles = useEuiMemoizedStyles(euiFlyoutStyles);
|
|
523
|
-
var cssStyles = [styles.euiFlyout, styles.paddingSizes[paddingSize], isEuiFlyoutSizeNamed(size) && styles[size], maxWidth === false && styles.noMaxWidth, isPushed ? styles.push.push : styles.overlay.overlay, isPushed ? styles.push[side] : styles.overlay[side],
|
|
542
|
+
var cssStyles = [styles.euiFlyout, styles.paddingSizes[paddingSize], isEuiFlyoutSizeNamed(size) && styles[size], maxWidth === false && styles.noMaxWidth, isPushed ? styles.push.push : styles.overlay.overlay, isPushed ? styles.push[side] : styles.overlay[side], !hasAnimation && styles.noAnimation, styles[side]];
|
|
524
543
|
var classes = classnames('euiFlyout', isChildFlyout && hasChildBackground && 'euiFlyout--hasChildBackground', className);
|
|
525
544
|
var flyoutToggle = useRef(document.activeElement);
|
|
526
545
|
var _useState5 = useState([]),
|
|
@@ -614,34 +633,6 @@ export var EuiFlyoutComponent = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
614
633
|
})));
|
|
615
634
|
}, [hasOverlayMask, descriptionId, focusTrapShards.length]);
|
|
616
635
|
|
|
617
|
-
/*
|
|
618
|
-
* If the flyout menu is to be rendered, ensure the flyout has aria-labelledby referencing the menu's titleId
|
|
619
|
-
*/
|
|
620
|
-
var generatedMenuId = useGeneratedHtmlId();
|
|
621
|
-
var _ref = _flyoutMenuProps || {},
|
|
622
|
-
_titleId = _ref.titleId,
|
|
623
|
-
flyoutMenuProps = _objectWithoutProperties(_ref, _excluded2);
|
|
624
|
-
var hasMenu = !!_flyoutMenuProps;
|
|
625
|
-
var flyoutMenuId = useMemo(function () {
|
|
626
|
-
if (!hasMenu) return undefined;
|
|
627
|
-
return _titleId || generatedMenuId;
|
|
628
|
-
}, [hasMenu, _titleId, generatedMenuId]);
|
|
629
|
-
|
|
630
|
-
// If the flyout level is LEVEL_MAIN, the title should be hidden by default
|
|
631
|
-
var flyoutMenuHideTitle = useMemo(function () {
|
|
632
|
-
if (!hasMenu) return undefined;
|
|
633
|
-
if ((_flyoutMenuProps === null || _flyoutMenuProps === void 0 ? void 0 : _flyoutMenuProps.hideTitle) !== undefined) {
|
|
634
|
-
return _flyoutMenuProps.hideTitle;
|
|
635
|
-
}
|
|
636
|
-
return (currentSession === null || currentSession === void 0 ? void 0 : currentSession.mainFlyoutId) === flyoutId;
|
|
637
|
-
}, [hasMenu, _flyoutMenuProps, currentSession, flyoutId]);
|
|
638
|
-
var ariaLabelledBy = useMemo(function () {
|
|
639
|
-
if (flyoutMenuId) {
|
|
640
|
-
return classnames(flyoutMenuId, _ariaLabelledBy);
|
|
641
|
-
}
|
|
642
|
-
return _ariaLabelledBy;
|
|
643
|
-
}, [flyoutMenuId, _ariaLabelledBy]);
|
|
644
|
-
|
|
645
636
|
/*
|
|
646
637
|
* Trap focus even when `ownFocus={false}`, otherwise closing
|
|
647
638
|
* the flyout won't return focus to the originating button.
|
|
@@ -684,8 +675,10 @@ export var EuiFlyoutComponent = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
684
675
|
isPushed: isPushed,
|
|
685
676
|
maskZIndex: maskZIndex,
|
|
686
677
|
headerZindexLocation: effectiveHeaderZindexLocation,
|
|
678
|
+
containerRect: containerRect,
|
|
687
679
|
maskProps: _objectSpread(_objectSpread({}, maskProps), {}, {
|
|
688
|
-
maskRef: maskCombinedRefs
|
|
680
|
+
maskRef: maskCombinedRefs,
|
|
681
|
+
hasAnimation: hasAnimation
|
|
689
682
|
})
|
|
690
683
|
}, ___EmotionJSX(EuiWindowEvent, {
|
|
691
684
|
event: "keydown",
|
|
@@ -709,13 +702,12 @@ export var EuiFlyoutComponent = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
709
702
|
"aria-labelledby": ariaLabelledBy,
|
|
710
703
|
"data-autofocus": !isPushed || undefined,
|
|
711
704
|
onAnimationEnd: onAnimationEnd
|
|
712
|
-
}), !isPushed && screenReaderDescription,
|
|
705
|
+
}), !isPushed && screenReaderDescription, shouldRenderMenu ? ___EmotionJSX(EuiFlyoutMenu, _extends({}, flyoutMenuProps, {
|
|
706
|
+
titleId: flyoutMenuId
|
|
707
|
+
})) : !hideCloseButton && ___EmotionJSX(EuiFlyoutCloseButton, _extends({}, closeButtonProps, {
|
|
713
708
|
onClose: handleClose,
|
|
714
709
|
closeButtonPosition: closeButtonPosition,
|
|
715
710
|
side: side
|
|
716
|
-
})), _flyoutMenuProps && ___EmotionJSX(EuiFlyoutMenu, _extends({}, flyoutMenuProps, {
|
|
717
|
-
hideTitle: flyoutMenuHideTitle,
|
|
718
|
-
titleId: flyoutMenuId
|
|
719
711
|
})), resizable && ___EmotionJSX(EuiFlyoutResizeButton, {
|
|
720
712
|
type: type,
|
|
721
713
|
side: side,
|