@elastic/eui 88.5.2 → 88.5.4
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/collapsible_nav_beta/collapsible_nav_beta.js +12 -2
- package/es/components/combo_box/combo_box_input/combo_box_input.js +38 -41
- package/es/components/popover/input_popover.js +79 -59
- package/es/components/text_truncate/text_truncate.js +5 -2
- package/eui.d.ts +64 -65
- package/i18ntokens.json +4 -4
- package/lib/components/collapsible_nav_beta/collapsible_nav_beta.js +11 -1
- package/lib/components/combo_box/combo_box_input/combo_box_input.js +38 -41
- package/lib/components/popover/input_popover.js +77 -58
- package/lib/components/text_truncate/text_truncate.js +5 -2
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_beta.js +12 -2
- package/optimize/es/components/combo_box/combo_box_input/combo_box_input.js +36 -39
- package/optimize/es/components/popover/input_popover.js +76 -59
- package/optimize/es/components/text_truncate/text_truncate.js +5 -2
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_beta.js +11 -1
- package/optimize/lib/components/combo_box/combo_box_input/combo_box_input.js +36 -39
- package/optimize/lib/components/popover/input_popover.js +75 -58
- package/optimize/lib/components/text_truncate/text_truncate.js +5 -2
- package/package.json +6 -5
- package/test-env/components/collapsible_nav_beta/collapsible_nav_beta.js +11 -1
- package/test-env/components/combo_box/combo_box_input/combo_box_input.js +38 -41
- package/test-env/components/popover/input_popover.js +75 -58
- package/test-env/components/text_truncate/text_truncate.js +5 -2
|
@@ -29,7 +29,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
29
29
|
import React, { useRef, useMemo, useState, useEffect, useCallback } from 'react';
|
|
30
30
|
import PropTypes from "prop-types";
|
|
31
31
|
import classNames from 'classnames';
|
|
32
|
-
import { useEuiTheme, useGeneratedHtmlId, throttle } from '../../services';
|
|
32
|
+
import { useEuiTheme, useEuiThemeCSSVariables, useGeneratedHtmlId, throttle } from '../../services';
|
|
33
33
|
import { EuiFlyout } from '../flyout';
|
|
34
34
|
import { useEuiI18n } from '../i18n';
|
|
35
35
|
import { euiHeaderVariables } from '../header/header.styles';
|
|
@@ -49,6 +49,8 @@ var _EuiCollapsibleNavBeta = function _EuiCollapsibleNavBeta(_ref) {
|
|
|
49
49
|
side = _ref$side === void 0 ? 'left' : _ref$side,
|
|
50
50
|
_focusTrapProps = _ref.focusTrapProps,
|
|
51
51
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
52
|
+
var _useEuiThemeCSSVariab = useEuiThemeCSSVariables(),
|
|
53
|
+
setGlobalCSSVariables = _useEuiThemeCSSVariab.setGlobalCSSVariables;
|
|
52
54
|
var euiTheme = useEuiTheme();
|
|
53
55
|
var headerHeight = euiHeaderVariables(euiTheme).height;
|
|
54
56
|
|
|
@@ -107,9 +109,17 @@ var _EuiCollapsibleNavBeta = function _EuiCollapsibleNavBeta(_ref) {
|
|
|
107
109
|
var width = useMemo(function () {
|
|
108
110
|
if (isOverlayFullWidth) return '100%';
|
|
109
111
|
if (isPush && isCollapsed) return headerHeight;
|
|
110
|
-
return _width;
|
|
112
|
+
return "".concat(_width, "px");
|
|
111
113
|
}, [_width, isOverlayFullWidth, isPush, isCollapsed, headerHeight]);
|
|
112
114
|
|
|
115
|
+
// Other UI elements may need to account for the nav width -
|
|
116
|
+
// set a global CSS variable that they can use
|
|
117
|
+
useEffect(function () {
|
|
118
|
+
setGlobalCSSVariables({
|
|
119
|
+
'--euiCollapsibleNavOffset': isOverlay ? '0' : width
|
|
120
|
+
});
|
|
121
|
+
}, [width, isOverlay, setGlobalCSSVariables]);
|
|
122
|
+
|
|
113
123
|
/**
|
|
114
124
|
* Prop setup
|
|
115
125
|
*/
|
|
@@ -104,56 +104,51 @@ export var EuiComboBoxInput = /*#__PURE__*/function (_Component) {
|
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
});
|
|
107
|
-
_defineProperty(_assertThisInitialized(_this), "inputOnChange", function (event) {
|
|
108
|
-
var _this$props$onChange, _this$props3;
|
|
109
|
-
var value = event.target.value;
|
|
110
|
-
_this.updateInputSize(value);
|
|
111
|
-
(_this$props$onChange = (_this$props3 = _this.props).onChange) === null || _this$props$onChange === void 0 ? void 0 : _this$props$onChange.call(_this$props3, value);
|
|
112
|
-
});
|
|
113
107
|
return _this;
|
|
114
108
|
}
|
|
115
109
|
_createClass(EuiComboBoxInput, [{
|
|
116
110
|
key: "componentDidUpdate",
|
|
117
111
|
value: function componentDidUpdate(prevProps) {
|
|
118
|
-
|
|
112
|
+
if (prevProps.searchValue !== this.props.searchValue) {
|
|
113
|
+
this.updateInputSize(this.props.searchValue);
|
|
119
114
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
if (searchValue !== this.props.searchValue) {
|
|
115
|
+
// We need to update the position of everything if the user enters enough input to change
|
|
116
|
+
// the size of the input.
|
|
123
117
|
this.updatePosition();
|
|
124
118
|
}
|
|
125
119
|
}
|
|
126
120
|
}, {
|
|
127
121
|
key: "render",
|
|
128
122
|
value: function render() {
|
|
129
|
-
var _this$
|
|
130
|
-
compressed = _this$
|
|
131
|
-
focusedOptionId = _this$
|
|
132
|
-
fullWidth = _this$
|
|
133
|
-
hasSelectedOptions = _this$
|
|
134
|
-
id = _this$
|
|
135
|
-
isDisabled = _this$
|
|
136
|
-
isListOpen = _this$
|
|
137
|
-
noIcon = _this$
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
123
|
+
var _this$props3 = this.props,
|
|
124
|
+
compressed = _this$props3.compressed,
|
|
125
|
+
focusedOptionId = _this$props3.focusedOptionId,
|
|
126
|
+
fullWidth = _this$props3.fullWidth,
|
|
127
|
+
hasSelectedOptions = _this$props3.hasSelectedOptions,
|
|
128
|
+
id = _this$props3.id,
|
|
129
|
+
isDisabled = _this$props3.isDisabled,
|
|
130
|
+
isListOpen = _this$props3.isListOpen,
|
|
131
|
+
noIcon = _this$props3.noIcon,
|
|
132
|
+
_onChange = _this$props3.onChange,
|
|
133
|
+
onClear = _this$props3.onClear,
|
|
134
|
+
onClick = _this$props3.onClick,
|
|
135
|
+
onCloseListClick = _this$props3.onCloseListClick,
|
|
136
|
+
onOpenListClick = _this$props3.onOpenListClick,
|
|
137
|
+
onRemoveOption = _this$props3.onRemoveOption,
|
|
138
|
+
placeholder = _this$props3.placeholder,
|
|
139
|
+
rootId = _this$props3.rootId,
|
|
140
|
+
searchValue = _this$props3.searchValue,
|
|
141
|
+
selectedOptions = _this$props3.selectedOptions,
|
|
142
|
+
singleSelectionProp = _this$props3.singleSelection,
|
|
143
|
+
toggleButtonRef = _this$props3.toggleButtonRef,
|
|
144
|
+
value = _this$props3.value,
|
|
145
|
+
prepend = _this$props3.prepend,
|
|
146
|
+
append = _this$props3.append,
|
|
147
|
+
isLoading = _this$props3.isLoading,
|
|
148
|
+
isInvalid = _this$props3.isInvalid,
|
|
149
|
+
autoFocus = _this$props3.autoFocus,
|
|
150
|
+
ariaLabel = _this$props3['aria-label'],
|
|
151
|
+
ariaLabelledby = _this$props3['aria-labelledby'];
|
|
157
152
|
var singleSelection = Boolean(singleSelectionProp);
|
|
158
153
|
var asPlainText = singleSelectionProp && _typeof(singleSelectionProp) === 'object' && singleSelectionProp.asPlainText || false;
|
|
159
154
|
var pills = selectedOptions ? selectedOptions.map(function (option) {
|
|
@@ -258,7 +253,9 @@ export var EuiComboBoxInput = /*#__PURE__*/function (_Component) {
|
|
|
258
253
|
disabled: isDisabled,
|
|
259
254
|
id: id,
|
|
260
255
|
onBlur: this.onBlur,
|
|
261
|
-
onChange:
|
|
256
|
+
onChange: function onChange(event) {
|
|
257
|
+
return _onChange(event.target.value);
|
|
258
|
+
},
|
|
262
259
|
onFocus: this.onFocus,
|
|
263
260
|
onKeyDown: this.onKeyDown,
|
|
264
261
|
ref: this.inputRefCallback,
|
|
@@ -284,9 +281,9 @@ EuiComboBoxInput.propTypes = {
|
|
|
284
281
|
isListOpen: PropTypes.bool.isRequired,
|
|
285
282
|
noIcon: PropTypes.bool.isRequired,
|
|
286
283
|
onBlur: PropTypes.any,
|
|
287
|
-
onChange: PropTypes.func,
|
|
284
|
+
onChange: PropTypes.func.isRequired,
|
|
288
285
|
onClear: PropTypes.func,
|
|
289
|
-
onClick: PropTypes.func,
|
|
286
|
+
onClick: PropTypes.func.isRequired,
|
|
290
287
|
onCloseListClick: PropTypes.func.isRequired,
|
|
291
288
|
onFocus: PropTypes.any.isRequired,
|
|
292
289
|
onOpenListClick: PropTypes.func.isRequired,
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
var _excluded = ["children", "className", "closePopover", "disableFocusTrap", "focusTrapProps", "input", "fullWidth", "panelMinWidth", "onPanelResize", "inputRef", "panelRef"];
|
|
2
3
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
7
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
8
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
3
9
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
10
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
5
11
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -16,21 +22,23 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
16
22
|
* Side Public License, v 1.
|
|
17
23
|
*/
|
|
18
24
|
|
|
19
|
-
import React, { useState, useEffect, useCallback, useRef } from 'react';
|
|
25
|
+
import React, { useState, useEffect, useCallback, useMemo, useRef } from 'react';
|
|
20
26
|
import PropTypes from "prop-types";
|
|
27
|
+
import { css } from '@emotion/react';
|
|
21
28
|
import classnames from 'classnames';
|
|
22
29
|
import { tabbable } from 'tabbable';
|
|
30
|
+
import { logicalCSS } from '../../global_styling';
|
|
31
|
+
import { keys, useCombinedRefs, useEuiTheme } from '../../services';
|
|
32
|
+
import { useResizeObserver } from '../observer/resize_observer';
|
|
23
33
|
import { EuiFocusTrap } from '../focus_trap';
|
|
24
|
-
import { EuiPopover } from './popover';
|
|
25
|
-
import { EuiResizeObserver } from '../observer/resize_observer';
|
|
26
|
-
import { cascadingMenuKeys, useCombinedRefs, useEuiTheme } from '../../services';
|
|
27
34
|
import { euiFormVariables } from '../form/form.styles';
|
|
28
|
-
import {
|
|
29
|
-
import { logicalCSS } from '../../global_styling';
|
|
35
|
+
import { EuiPopover } from './popover';
|
|
30
36
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
31
37
|
export var EuiInputPopover = function EuiInputPopover(_ref) {
|
|
38
|
+
var _props$panelProps;
|
|
32
39
|
var children = _ref.children,
|
|
33
40
|
className = _ref.className,
|
|
41
|
+
closePopover = _ref.closePopover,
|
|
34
42
|
_ref$disableFocusTrap = _ref.disableFocusTrap,
|
|
35
43
|
disableFocusTrap = _ref$disableFocusTrap === void 0 ? false : _ref$disableFocusTrap,
|
|
36
44
|
focusTrapProps = _ref.focusTrapProps,
|
|
@@ -43,80 +51,92 @@ export var EuiInputPopover = function EuiInputPopover(_ref) {
|
|
|
43
51
|
_inputRef = _ref.inputRef,
|
|
44
52
|
_panelRef = _ref.panelRef,
|
|
45
53
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
46
|
-
var
|
|
54
|
+
var classes = classnames('euiInputPopover', className);
|
|
55
|
+
var euiTheme = useEuiTheme();
|
|
56
|
+
var form = euiFormVariables(euiTheme);
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Ref setup
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
var popoverClassRef = useRef(null);
|
|
63
|
+
// The inputEl state ensures that width is correctly tracked on initial load
|
|
47
64
|
var _useState = useState(null),
|
|
48
65
|
_useState2 = _slicedToArray(_useState, 2),
|
|
49
66
|
inputEl = _useState2[0],
|
|
50
67
|
setInputEl = _useState2[1];
|
|
51
|
-
|
|
68
|
+
// The panelEl state ensures that width is correctly set every time the popover opens
|
|
69
|
+
var _useState3 = useState(null),
|
|
52
70
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
var _useState5 = useState(null),
|
|
56
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
57
|
-
panelEl = _useState6[0],
|
|
58
|
-
setPanelEl = _useState6[1];
|
|
59
|
-
var popoverClassRef = useRef(null);
|
|
71
|
+
panelEl = _useState4[0],
|
|
72
|
+
setPanelEl = _useState4[1];
|
|
60
73
|
var inputRef = useCombinedRefs([setInputEl, _inputRef]);
|
|
61
74
|
var panelRef = useCombinedRefs([setPanelEl, _panelRef]);
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Sizing/width logic
|
|
78
|
+
*/
|
|
79
|
+
|
|
80
|
+
var inputWidth = useResizeObserver(inputEl, 'width').width;
|
|
81
|
+
var panelWidth = useMemo(function () {
|
|
82
|
+
return inputWidth < panelMinWidth ? panelMinWidth : inputWidth;
|
|
83
|
+
}, [panelMinWidth, inputWidth]);
|
|
84
|
+
useEffect(function () {
|
|
85
|
+
if (panelEl) {
|
|
86
|
+
// We have to modify the popover panel DOM node directly instead of using
|
|
87
|
+
// `panelStyle`, as there's some weird positioning bugs on resize otherwise
|
|
88
|
+
panelEl.style.inlineSize = "".concat(panelWidth, "px");
|
|
68
89
|
}
|
|
69
|
-
}, [panelEl,
|
|
70
|
-
|
|
71
|
-
|
|
90
|
+
}, [panelEl, panelWidth]);
|
|
91
|
+
useEffect(function () {
|
|
92
|
+
// This fires on all input width changes regardless of minimum size, because on
|
|
93
|
+
// right/center anchored popovers, the input width affects the position of the popover
|
|
94
|
+
if (panelEl) {
|
|
72
95
|
var _popoverClassRef$curr;
|
|
73
|
-
var _width = inputEl.getBoundingClientRect().width;
|
|
74
|
-
setInputElWidth(_width);
|
|
75
|
-
setPanelWidth(_width);
|
|
76
96
|
(_popoverClassRef$curr = popoverClassRef.current) === null || _popoverClassRef$curr === void 0 ? void 0 : _popoverClassRef$curr.positionPopoverFluid();
|
|
77
97
|
}
|
|
78
|
-
}, [
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
var onKeyDown = function
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
98
|
+
}, [inputWidth, panelEl]);
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Popover tab to close logic
|
|
102
|
+
*/
|
|
103
|
+
|
|
104
|
+
var panelPropsOnKeyDown = (_props$panelProps = props.panelProps) === null || _props$panelProps === void 0 ? void 0 : _props$panelProps.onKeyDown;
|
|
105
|
+
var onKeyDown = useCallback(function (event) {
|
|
106
|
+
panelPropsOnKeyDown === null || panelPropsOnKeyDown === void 0 ? void 0 : panelPropsOnKeyDown(event);
|
|
107
|
+
if (event.key === keys.TAB) {
|
|
108
|
+
if (disableFocusTrap) {
|
|
109
|
+
closePopover();
|
|
110
|
+
} else {
|
|
111
|
+
var tabbableItems = tabbable(event.currentTarget).filter(function (el) {
|
|
112
|
+
return !el.hasAttribute('data-focus-guard');
|
|
113
|
+
});
|
|
114
|
+
if (!tabbableItems.length) return;
|
|
115
|
+
var tabbingFromLastItemInPopover = document.activeElement === tabbableItems[tabbableItems.length - 1];
|
|
116
|
+
if (tabbingFromLastItemInPopover) {
|
|
117
|
+
closePopover();
|
|
118
|
+
}
|
|
94
119
|
}
|
|
95
120
|
}
|
|
96
|
-
};
|
|
97
|
-
var classes = classnames('euiInputPopover', className);
|
|
98
|
-
var form = euiFormVariables(euiThemeContext);
|
|
121
|
+
}, [disableFocusTrap, closePopover, panelPropsOnKeyDown]);
|
|
99
122
|
return ___EmotionJSX(EuiPopover, _extends({
|
|
100
123
|
css: /*#__PURE__*/css(fullWidth ? undefined : logicalCSS('max-width', form.maxWidth), ";label:EuiInputPopover;"),
|
|
101
124
|
repositionToCrossAxis: false,
|
|
102
125
|
ownFocus: false,
|
|
103
|
-
button:
|
|
104
|
-
onResize: onResize
|
|
105
|
-
}, function (resizeRef) {
|
|
106
|
-
return ___EmotionJSX("div", {
|
|
107
|
-
ref: resizeRef
|
|
108
|
-
}, input);
|
|
109
|
-
}),
|
|
126
|
+
button: input,
|
|
110
127
|
buttonRef: inputRef,
|
|
111
128
|
panelRef: panelRef,
|
|
112
129
|
className: classes,
|
|
113
|
-
ref: popoverClassRef
|
|
114
|
-
|
|
130
|
+
ref: popoverClassRef,
|
|
131
|
+
closePopover: closePopover
|
|
132
|
+
}, props, {
|
|
133
|
+
panelProps: _objectSpread(_objectSpread({}, props.panelProps), {}, {
|
|
134
|
+
onKeyDown: onKeyDown
|
|
135
|
+
})
|
|
136
|
+
}), ___EmotionJSX(EuiFocusTrap, _extends({
|
|
115
137
|
clickOutsideDisables: true,
|
|
116
138
|
disabled: disableFocusTrap
|
|
117
|
-
}, focusTrapProps),
|
|
118
|
-
onKeyDown: onKeyDown
|
|
119
|
-
}, children)));
|
|
139
|
+
}, focusTrapProps), children));
|
|
120
140
|
};
|
|
121
141
|
EuiInputPopover.propTypes = {
|
|
122
142
|
className: PropTypes.string,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["width"],
|
|
1
|
+
var _excluded = ["width", "onResize"],
|
|
2
2
|
_excluded2 = ["width", "children", "text", "truncation", "truncationOffset", "truncationPosition", "ellipsis", "containerRef", "className"],
|
|
3
3
|
_excluded3 = ["onResize"];
|
|
4
4
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
@@ -29,10 +29,13 @@ import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
|
29
29
|
var TRUNCATION_TYPES = ['end', 'start', 'startEnd', 'middle'];
|
|
30
30
|
export var EuiTextTruncate = function EuiTextTruncate(_ref) {
|
|
31
31
|
var width = _ref.width,
|
|
32
|
+
onResize = _ref.onResize,
|
|
32
33
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
33
34
|
return width != null ? ___EmotionJSX(EuiTextTruncateWithWidth, _extends({
|
|
34
35
|
width: width
|
|
35
|
-
}, props)) : ___EmotionJSX(EuiTextTruncateWithResizeObserver,
|
|
36
|
+
}, props)) : ___EmotionJSX(EuiTextTruncateWithResizeObserver, _extends({
|
|
37
|
+
onResize: onResize
|
|
38
|
+
}, props));
|
|
36
39
|
};
|
|
37
40
|
EuiTextTruncate.propTypes = {
|
|
38
41
|
className: PropTypes.string,
|
package/eui.d.ts
CHANGED
|
@@ -4785,6 +4785,67 @@ declare module '@elastic/eui/src/services/number/number' {
|
|
|
4785
4785
|
declare module '@elastic/eui/src/services/number' {
|
|
4786
4786
|
export * from '@elastic/eui/src/services/number/number';
|
|
4787
4787
|
|
|
4788
|
+
}
|
|
4789
|
+
declare module '@elastic/eui/src/components/observer/observer' {
|
|
4790
|
+
import { Component, ReactNode } from 'react';
|
|
4791
|
+
interface BaseProps {
|
|
4792
|
+
/**
|
|
4793
|
+
* ReactNode to render as this component's content
|
|
4794
|
+
*/
|
|
4795
|
+
children: (ref: any) => ReactNode;
|
|
4796
|
+
}
|
|
4797
|
+
export interface Observer {
|
|
4798
|
+
disconnect: () => void;
|
|
4799
|
+
observe: (element: Element, options?: {
|
|
4800
|
+
[key: string]: any;
|
|
4801
|
+
}) => void;
|
|
4802
|
+
}
|
|
4803
|
+
export class EuiObserver<Props extends BaseProps> extends Component<Props> {
|
|
4804
|
+
protected name: string;
|
|
4805
|
+
protected childNode: null | Element;
|
|
4806
|
+
protected observer: null | Observer;
|
|
4807
|
+
componentDidMount(): void;
|
|
4808
|
+
componentWillUnmount(): void;
|
|
4809
|
+
updateChildNode: (ref: Element) => void;
|
|
4810
|
+
beginObserve: () => void;
|
|
4811
|
+
render(): ReactNode;
|
|
4812
|
+
}
|
|
4813
|
+
export {};
|
|
4814
|
+
|
|
4815
|
+
}
|
|
4816
|
+
declare module '@elastic/eui/src/components/observer/resize_observer/resize_observer' {
|
|
4817
|
+
import { ReactNode } from 'react';
|
|
4818
|
+
import { EuiObserver } from '@elastic/eui/src/components/observer/observer';
|
|
4819
|
+
export interface EuiResizeObserverProps {
|
|
4820
|
+
/**
|
|
4821
|
+
* ReactNode to render as this component's content
|
|
4822
|
+
*/
|
|
4823
|
+
children: (ref: (e: HTMLElement | null) => void) => ReactNode;
|
|
4824
|
+
onResize: (dimensions: {
|
|
4825
|
+
height: number;
|
|
4826
|
+
width: number;
|
|
4827
|
+
}) => void;
|
|
4828
|
+
}
|
|
4829
|
+
export const hasResizeObserver: boolean;
|
|
4830
|
+
export class EuiResizeObserver extends EuiObserver<EuiResizeObserverProps> {
|
|
4831
|
+
name: string;
|
|
4832
|
+
state: {
|
|
4833
|
+
height: number;
|
|
4834
|
+
width: number;
|
|
4835
|
+
};
|
|
4836
|
+
onResize: ResizeObserverCallback;
|
|
4837
|
+
beginObserve: () => void;
|
|
4838
|
+
}
|
|
4839
|
+
export const useResizeObserver: (container: Element | null, dimension?: "height" | "width" | undefined) => {
|
|
4840
|
+
width: number;
|
|
4841
|
+
height: number;
|
|
4842
|
+
};
|
|
4843
|
+
|
|
4844
|
+
}
|
|
4845
|
+
declare module '@elastic/eui/src/components/observer/resize_observer' {
|
|
4846
|
+
export type { EuiResizeObserverProps } from '@elastic/eui/src/components/observer/resize_observer/resize_observer';
|
|
4847
|
+
export { EuiResizeObserver, useResizeObserver } from '@elastic/eui/src/components/observer/resize_observer/resize_observer';
|
|
4848
|
+
|
|
4788
4849
|
}
|
|
4789
4850
|
declare module '@elastic/eui/src/components/portal/portal' {
|
|
4790
4851
|
/**
|
|
@@ -4951,67 +5012,6 @@ declare module '@elastic/eui/src/components/table/table_header_cell_checkbox' {
|
|
|
4951
5012
|
}
|
|
4952
5013
|
export const EuiTableHeaderCellCheckbox: FunctionComponent<CommonProps & ThHTMLAttributes<HTMLTableHeaderCellElement> & EuiTableHeaderCellCheckboxProps>;
|
|
4953
5014
|
|
|
4954
|
-
}
|
|
4955
|
-
declare module '@elastic/eui/src/components/observer/observer' {
|
|
4956
|
-
import { Component, ReactNode } from 'react';
|
|
4957
|
-
interface BaseProps {
|
|
4958
|
-
/**
|
|
4959
|
-
* ReactNode to render as this component's content
|
|
4960
|
-
*/
|
|
4961
|
-
children: (ref: any) => ReactNode;
|
|
4962
|
-
}
|
|
4963
|
-
export interface Observer {
|
|
4964
|
-
disconnect: () => void;
|
|
4965
|
-
observe: (element: Element, options?: {
|
|
4966
|
-
[key: string]: any;
|
|
4967
|
-
}) => void;
|
|
4968
|
-
}
|
|
4969
|
-
export class EuiObserver<Props extends BaseProps> extends Component<Props> {
|
|
4970
|
-
protected name: string;
|
|
4971
|
-
protected childNode: null | Element;
|
|
4972
|
-
protected observer: null | Observer;
|
|
4973
|
-
componentDidMount(): void;
|
|
4974
|
-
componentWillUnmount(): void;
|
|
4975
|
-
updateChildNode: (ref: Element) => void;
|
|
4976
|
-
beginObserve: () => void;
|
|
4977
|
-
render(): ReactNode;
|
|
4978
|
-
}
|
|
4979
|
-
export {};
|
|
4980
|
-
|
|
4981
|
-
}
|
|
4982
|
-
declare module '@elastic/eui/src/components/observer/resize_observer/resize_observer' {
|
|
4983
|
-
import { ReactNode } from 'react';
|
|
4984
|
-
import { EuiObserver } from '@elastic/eui/src/components/observer/observer';
|
|
4985
|
-
export interface EuiResizeObserverProps {
|
|
4986
|
-
/**
|
|
4987
|
-
* ReactNode to render as this component's content
|
|
4988
|
-
*/
|
|
4989
|
-
children: (ref: (e: HTMLElement | null) => void) => ReactNode;
|
|
4990
|
-
onResize: (dimensions: {
|
|
4991
|
-
height: number;
|
|
4992
|
-
width: number;
|
|
4993
|
-
}) => void;
|
|
4994
|
-
}
|
|
4995
|
-
export const hasResizeObserver: boolean;
|
|
4996
|
-
export class EuiResizeObserver extends EuiObserver<EuiResizeObserverProps> {
|
|
4997
|
-
name: string;
|
|
4998
|
-
state: {
|
|
4999
|
-
height: number;
|
|
5000
|
-
width: number;
|
|
5001
|
-
};
|
|
5002
|
-
onResize: ResizeObserverCallback;
|
|
5003
|
-
beginObserve: () => void;
|
|
5004
|
-
}
|
|
5005
|
-
export const useResizeObserver: (container: Element | null, dimension?: "height" | "width" | undefined) => {
|
|
5006
|
-
width: number;
|
|
5007
|
-
height: number;
|
|
5008
|
-
};
|
|
5009
|
-
|
|
5010
|
-
}
|
|
5011
|
-
declare module '@elastic/eui/src/components/observer/resize_observer' {
|
|
5012
|
-
export type { EuiResizeObserverProps } from '@elastic/eui/src/components/observer/resize_observer/resize_observer';
|
|
5013
|
-
export { EuiResizeObserver, useResizeObserver } from '@elastic/eui/src/components/observer/resize_observer/resize_observer';
|
|
5014
|
-
|
|
5015
5015
|
}
|
|
5016
5016
|
declare module '@elastic/eui/src/themes/amsterdam' {
|
|
5017
5017
|
export * from '@elastic/eui/src/themes/amsterdam/global_styling/mixins/shadow';
|
|
@@ -11690,7 +11690,7 @@ declare module '@elastic/eui/src/components/combo_box/combo_box_input/combo_box_
|
|
|
11690
11690
|
|
|
11691
11691
|
}
|
|
11692
11692
|
declare module '@elastic/eui/src/components/combo_box/combo_box_input/combo_box_input' {
|
|
11693
|
-
import React, { Component,
|
|
11693
|
+
import React, { Component, FocusEventHandler, KeyboardEventHandler, RefCallback } from 'react';
|
|
11694
11694
|
import { CommonProps } from '@elastic/eui/src/components/common';
|
|
11695
11695
|
import { htmlIdGenerator } from '@elastic/eui/src/services';
|
|
11696
11696
|
import { EuiFormControlLayoutProps } from '@elastic/eui/src/components/form/form_control_layout';
|
|
@@ -11706,9 +11706,9 @@ declare module '@elastic/eui/src/components/combo_box/combo_box_input/combo_box_
|
|
|
11706
11706
|
isListOpen: boolean;
|
|
11707
11707
|
noIcon: boolean;
|
|
11708
11708
|
onBlur?: FocusEventHandler<HTMLInputElement>;
|
|
11709
|
-
onChange
|
|
11709
|
+
onChange: (searchValue: string) => void;
|
|
11710
11710
|
onClear?: () => void;
|
|
11711
|
-
onClick
|
|
11711
|
+
onClick: () => void;
|
|
11712
11712
|
onCloseListClick: () => void;
|
|
11713
11713
|
onFocus: FocusEventHandler<HTMLInputElement>;
|
|
11714
11714
|
onOpenListClick: () => void;
|
|
@@ -11743,7 +11743,6 @@ declare module '@elastic/eui/src/components/combo_box/combo_box_input/combo_box_
|
|
|
11743
11743
|
onBlur: FocusEventHandler<HTMLInputElement>;
|
|
11744
11744
|
onKeyDown: KeyboardEventHandler<HTMLInputElement>;
|
|
11745
11745
|
componentDidUpdate(prevProps: EuiComboBoxInputProps<T>): void;
|
|
11746
|
-
inputOnChange: ChangeEventHandler<HTMLInputElement>;
|
|
11747
11746
|
render(): React.JSX.Element;
|
|
11748
11747
|
}
|
|
11749
11748
|
export {};
|
package/i18ntokens.json
CHANGED
|
@@ -455,14 +455,14 @@
|
|
|
455
455
|
"highlighting": "string",
|
|
456
456
|
"loc": {
|
|
457
457
|
"start": {
|
|
458
|
-
"line":
|
|
458
|
+
"line": 165,
|
|
459
459
|
"column": 27,
|
|
460
|
-
"index":
|
|
460
|
+
"index": 5469
|
|
461
461
|
},
|
|
462
462
|
"end": {
|
|
463
|
-
"line":
|
|
463
|
+
"line": 168,
|
|
464
464
|
"column": 3,
|
|
465
|
-
"index":
|
|
465
|
+
"index": 5539
|
|
466
466
|
}
|
|
467
467
|
},
|
|
468
468
|
"filepath": "src/components/collapsible_nav_beta/collapsible_nav_beta.tsx"
|
|
@@ -61,6 +61,8 @@ var _EuiCollapsibleNavBeta = function _EuiCollapsibleNavBeta(_ref) {
|
|
|
61
61
|
side = _ref$side === void 0 ? 'left' : _ref$side,
|
|
62
62
|
_focusTrapProps = _ref.focusTrapProps,
|
|
63
63
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
64
|
+
var _useEuiThemeCSSVariab = (0, _services.useEuiThemeCSSVariables)(),
|
|
65
|
+
setGlobalCSSVariables = _useEuiThemeCSSVariab.setGlobalCSSVariables;
|
|
64
66
|
var euiTheme = (0, _services.useEuiTheme)();
|
|
65
67
|
var headerHeight = (0, _header.euiHeaderVariables)(euiTheme).height;
|
|
66
68
|
|
|
@@ -119,9 +121,17 @@ var _EuiCollapsibleNavBeta = function _EuiCollapsibleNavBeta(_ref) {
|
|
|
119
121
|
var width = (0, _react.useMemo)(function () {
|
|
120
122
|
if (isOverlayFullWidth) return '100%';
|
|
121
123
|
if (isPush && isCollapsed) return headerHeight;
|
|
122
|
-
return _width;
|
|
124
|
+
return "".concat(_width, "px");
|
|
123
125
|
}, [_width, isOverlayFullWidth, isPush, isCollapsed, headerHeight]);
|
|
124
126
|
|
|
127
|
+
// Other UI elements may need to account for the nav width -
|
|
128
|
+
// set a global CSS variable that they can use
|
|
129
|
+
(0, _react.useEffect)(function () {
|
|
130
|
+
setGlobalCSSVariables({
|
|
131
|
+
'--euiCollapsibleNavOffset': isOverlay ? '0' : width
|
|
132
|
+
});
|
|
133
|
+
}, [width, isOverlay, setGlobalCSSVariables]);
|
|
134
|
+
|
|
125
135
|
/**
|
|
126
136
|
* Prop setup
|
|
127
137
|
*/
|