@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
|
@@ -111,56 +111,51 @@ var EuiComboBoxInput = /*#__PURE__*/function (_Component) {
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
});
|
|
114
|
-
_defineProperty(_assertThisInitialized(_this), "inputOnChange", function (event) {
|
|
115
|
-
var _this$props$onChange, _this$props3;
|
|
116
|
-
var value = event.target.value;
|
|
117
|
-
_this.updateInputSize(value);
|
|
118
|
-
(_this$props$onChange = (_this$props3 = _this.props).onChange) === null || _this$props$onChange === void 0 ? void 0 : _this$props$onChange.call(_this$props3, value);
|
|
119
|
-
});
|
|
120
114
|
return _this;
|
|
121
115
|
}
|
|
122
116
|
_createClass(EuiComboBoxInput, [{
|
|
123
117
|
key: "componentDidUpdate",
|
|
124
118
|
value: function componentDidUpdate(prevProps) {
|
|
125
|
-
|
|
119
|
+
if (prevProps.searchValue !== this.props.searchValue) {
|
|
120
|
+
this.updateInputSize(this.props.searchValue);
|
|
126
121
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
if (searchValue !== this.props.searchValue) {
|
|
122
|
+
// We need to update the position of everything if the user enters enough input to change
|
|
123
|
+
// the size of the input.
|
|
130
124
|
this.updatePosition();
|
|
131
125
|
}
|
|
132
126
|
}
|
|
133
127
|
}, {
|
|
134
128
|
key: "render",
|
|
135
129
|
value: function render() {
|
|
136
|
-
var _this$
|
|
137
|
-
compressed = _this$
|
|
138
|
-
focusedOptionId = _this$
|
|
139
|
-
fullWidth = _this$
|
|
140
|
-
hasSelectedOptions = _this$
|
|
141
|
-
id = _this$
|
|
142
|
-
isDisabled = _this$
|
|
143
|
-
isListOpen = _this$
|
|
144
|
-
noIcon = _this$
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
130
|
+
var _this$props3 = this.props,
|
|
131
|
+
compressed = _this$props3.compressed,
|
|
132
|
+
focusedOptionId = _this$props3.focusedOptionId,
|
|
133
|
+
fullWidth = _this$props3.fullWidth,
|
|
134
|
+
hasSelectedOptions = _this$props3.hasSelectedOptions,
|
|
135
|
+
id = _this$props3.id,
|
|
136
|
+
isDisabled = _this$props3.isDisabled,
|
|
137
|
+
isListOpen = _this$props3.isListOpen,
|
|
138
|
+
noIcon = _this$props3.noIcon,
|
|
139
|
+
_onChange = _this$props3.onChange,
|
|
140
|
+
onClear = _this$props3.onClear,
|
|
141
|
+
onClick = _this$props3.onClick,
|
|
142
|
+
onCloseListClick = _this$props3.onCloseListClick,
|
|
143
|
+
onOpenListClick = _this$props3.onOpenListClick,
|
|
144
|
+
onRemoveOption = _this$props3.onRemoveOption,
|
|
145
|
+
placeholder = _this$props3.placeholder,
|
|
146
|
+
rootId = _this$props3.rootId,
|
|
147
|
+
searchValue = _this$props3.searchValue,
|
|
148
|
+
selectedOptions = _this$props3.selectedOptions,
|
|
149
|
+
singleSelectionProp = _this$props3.singleSelection,
|
|
150
|
+
toggleButtonRef = _this$props3.toggleButtonRef,
|
|
151
|
+
value = _this$props3.value,
|
|
152
|
+
prepend = _this$props3.prepend,
|
|
153
|
+
append = _this$props3.append,
|
|
154
|
+
isLoading = _this$props3.isLoading,
|
|
155
|
+
isInvalid = _this$props3.isInvalid,
|
|
156
|
+
autoFocus = _this$props3.autoFocus,
|
|
157
|
+
ariaLabel = _this$props3['aria-label'],
|
|
158
|
+
ariaLabelledby = _this$props3['aria-labelledby'];
|
|
164
159
|
var singleSelection = Boolean(singleSelectionProp);
|
|
165
160
|
var asPlainText = singleSelectionProp && _typeof(singleSelectionProp) === 'object' && singleSelectionProp.asPlainText || false;
|
|
166
161
|
var pills = selectedOptions ? selectedOptions.map(function (option) {
|
|
@@ -265,7 +260,9 @@ var EuiComboBoxInput = /*#__PURE__*/function (_Component) {
|
|
|
265
260
|
disabled: isDisabled,
|
|
266
261
|
id: id,
|
|
267
262
|
onBlur: this.onBlur,
|
|
268
|
-
onChange:
|
|
263
|
+
onChange: function onChange(event) {
|
|
264
|
+
return _onChange(event.target.value);
|
|
265
|
+
},
|
|
269
266
|
onFocus: this.onFocus,
|
|
270
267
|
onKeyDown: this.onKeyDown,
|
|
271
268
|
ref: this.inputRefCallback,
|
|
@@ -292,9 +289,9 @@ EuiComboBoxInput.propTypes = {
|
|
|
292
289
|
isListOpen: _propTypes.default.bool.isRequired,
|
|
293
290
|
noIcon: _propTypes.default.bool.isRequired,
|
|
294
291
|
onBlur: _propTypes.default.any,
|
|
295
|
-
onChange: _propTypes.default.func,
|
|
292
|
+
onChange: _propTypes.default.func.isRequired,
|
|
296
293
|
onClear: _propTypes.default.func,
|
|
297
|
-
onClick: _propTypes.default.func,
|
|
294
|
+
onClick: _propTypes.default.func.isRequired,
|
|
298
295
|
onCloseListClick: _propTypes.default.func.isRequired,
|
|
299
296
|
onFocus: _propTypes.default.any.isRequired,
|
|
300
297
|
onOpenListClick: _propTypes.default.func.isRequired,
|
|
@@ -7,16 +7,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.EuiInputPopover = void 0;
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _react2 = require("@emotion/react");
|
|
10
11
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
12
|
var _tabbable = require("tabbable");
|
|
12
|
-
var
|
|
13
|
-
var _popover = require("./popover");
|
|
14
|
-
var _resize_observer = require("../observer/resize_observer");
|
|
13
|
+
var _global_styling = require("../../global_styling");
|
|
15
14
|
var _services = require("../../services");
|
|
15
|
+
var _resize_observer = require("../observer/resize_observer");
|
|
16
|
+
var _focus_trap = require("../focus_trap");
|
|
16
17
|
var _form = require("../form/form.styles");
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var _excluded = ["children", "className", "disableFocusTrap", "focusTrapProps", "input", "fullWidth", "panelMinWidth", "onPanelResize", "inputRef", "panelRef"];
|
|
18
|
+
var _popover = require("./popover");
|
|
19
|
+
var _excluded = ["children", "className", "closePopover", "disableFocusTrap", "focusTrapProps", "input", "fullWidth", "panelMinWidth", "onPanelResize", "inputRef", "panelRef"];
|
|
20
20
|
/*
|
|
21
21
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
22
22
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -28,6 +28,11 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
28
28
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
29
29
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
30
30
|
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); }
|
|
31
|
+
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; }
|
|
32
|
+
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; }
|
|
33
|
+
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; }
|
|
34
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
35
|
+
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); }
|
|
31
36
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
32
37
|
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."); }
|
|
33
38
|
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); }
|
|
@@ -37,8 +42,10 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
37
42
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
38
43
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
39
44
|
var EuiInputPopover = function EuiInputPopover(_ref) {
|
|
45
|
+
var _props$panelProps;
|
|
40
46
|
var children = _ref.children,
|
|
41
47
|
className = _ref.className,
|
|
48
|
+
closePopover = _ref.closePopover,
|
|
42
49
|
_ref$disableFocusTrap = _ref.disableFocusTrap,
|
|
43
50
|
disableFocusTrap = _ref$disableFocusTrap === void 0 ? false : _ref$disableFocusTrap,
|
|
44
51
|
focusTrapProps = _ref.focusTrapProps,
|
|
@@ -51,80 +58,92 @@ var EuiInputPopover = function EuiInputPopover(_ref) {
|
|
|
51
58
|
_inputRef = _ref.inputRef,
|
|
52
59
|
_panelRef = _ref.panelRef,
|
|
53
60
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
54
|
-
var
|
|
61
|
+
var classes = (0, _classnames.default)('euiInputPopover', className);
|
|
62
|
+
var euiTheme = (0, _services.useEuiTheme)();
|
|
63
|
+
var form = (0, _form.euiFormVariables)(euiTheme);
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Ref setup
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
var popoverClassRef = (0, _react.useRef)(null);
|
|
70
|
+
// The inputEl state ensures that width is correctly tracked on initial load
|
|
55
71
|
var _useState = (0, _react.useState)(null),
|
|
56
72
|
_useState2 = _slicedToArray(_useState, 2),
|
|
57
73
|
inputEl = _useState2[0],
|
|
58
74
|
setInputEl = _useState2[1];
|
|
59
|
-
|
|
75
|
+
// The panelEl state ensures that width is correctly set every time the popover opens
|
|
76
|
+
var _useState3 = (0, _react.useState)(null),
|
|
60
77
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
var _useState5 = (0, _react.useState)(null),
|
|
64
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
65
|
-
panelEl = _useState6[0],
|
|
66
|
-
setPanelEl = _useState6[1];
|
|
67
|
-
var popoverClassRef = (0, _react.useRef)(null);
|
|
78
|
+
panelEl = _useState4[0],
|
|
79
|
+
setPanelEl = _useState4[1];
|
|
68
80
|
var inputRef = (0, _services.useCombinedRefs)([setInputEl, _inputRef]);
|
|
69
81
|
var panelRef = (0, _services.useCombinedRefs)([setPanelEl, _panelRef]);
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Sizing/width logic
|
|
85
|
+
*/
|
|
86
|
+
|
|
87
|
+
var inputWidth = (0, _resize_observer.useResizeObserver)(inputEl, 'width').width;
|
|
88
|
+
var panelWidth = (0, _react.useMemo)(function () {
|
|
89
|
+
return inputWidth < panelMinWidth ? panelMinWidth : inputWidth;
|
|
90
|
+
}, [panelMinWidth, inputWidth]);
|
|
91
|
+
(0, _react.useEffect)(function () {
|
|
92
|
+
if (panelEl) {
|
|
93
|
+
// We have to modify the popover panel DOM node directly instead of using
|
|
94
|
+
// `panelStyle`, as there's some weird positioning bugs on resize otherwise
|
|
95
|
+
panelEl.style.inlineSize = "".concat(panelWidth, "px");
|
|
76
96
|
}
|
|
77
|
-
}, [panelEl,
|
|
78
|
-
|
|
79
|
-
|
|
97
|
+
}, [panelEl, panelWidth]);
|
|
98
|
+
(0, _react.useEffect)(function () {
|
|
99
|
+
// This fires on all input width changes regardless of minimum size, because on
|
|
100
|
+
// right/center anchored popovers, the input width affects the position of the popover
|
|
101
|
+
if (panelEl) {
|
|
80
102
|
var _popoverClassRef$curr;
|
|
81
|
-
var _width = inputEl.getBoundingClientRect().width;
|
|
82
|
-
setInputElWidth(_width);
|
|
83
|
-
setPanelWidth(_width);
|
|
84
103
|
(_popoverClassRef$curr = popoverClassRef.current) === null || _popoverClassRef$curr === void 0 ? void 0 : _popoverClassRef$curr.positionPopoverFluid();
|
|
85
104
|
}
|
|
86
|
-
}, [
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
var onKeyDown = function
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
105
|
+
}, [inputWidth, panelEl]);
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Popover tab to close logic
|
|
109
|
+
*/
|
|
110
|
+
|
|
111
|
+
var panelPropsOnKeyDown = (_props$panelProps = props.panelProps) === null || _props$panelProps === void 0 ? void 0 : _props$panelProps.onKeyDown;
|
|
112
|
+
var onKeyDown = (0, _react.useCallback)(function (event) {
|
|
113
|
+
panelPropsOnKeyDown === null || panelPropsOnKeyDown === void 0 ? void 0 : panelPropsOnKeyDown(event);
|
|
114
|
+
if (event.key === _services.keys.TAB) {
|
|
115
|
+
if (disableFocusTrap) {
|
|
116
|
+
closePopover();
|
|
117
|
+
} else {
|
|
118
|
+
var tabbableItems = (0, _tabbable.tabbable)(event.currentTarget).filter(function (el) {
|
|
119
|
+
return !el.hasAttribute('data-focus-guard');
|
|
120
|
+
});
|
|
121
|
+
if (!tabbableItems.length) return;
|
|
122
|
+
var tabbingFromLastItemInPopover = document.activeElement === tabbableItems[tabbableItems.length - 1];
|
|
123
|
+
if (tabbingFromLastItemInPopover) {
|
|
124
|
+
closePopover();
|
|
125
|
+
}
|
|
102
126
|
}
|
|
103
127
|
}
|
|
104
|
-
};
|
|
105
|
-
var classes = (0, _classnames.default)('euiInputPopover', className);
|
|
106
|
-
var form = (0, _form.euiFormVariables)(euiThemeContext);
|
|
128
|
+
}, [disableFocusTrap, closePopover, panelPropsOnKeyDown]);
|
|
107
129
|
return (0, _react2.jsx)(_popover.EuiPopover, _extends({
|
|
108
130
|
css: /*#__PURE__*/(0, _react2.css)(fullWidth ? undefined : (0, _global_styling.logicalCSS)('max-width', form.maxWidth), ";label:EuiInputPopover;"),
|
|
109
131
|
repositionToCrossAxis: false,
|
|
110
132
|
ownFocus: false,
|
|
111
|
-
button:
|
|
112
|
-
onResize: onResize
|
|
113
|
-
}, function (resizeRef) {
|
|
114
|
-
return (0, _react2.jsx)("div", {
|
|
115
|
-
ref: resizeRef
|
|
116
|
-
}, input);
|
|
117
|
-
}),
|
|
133
|
+
button: input,
|
|
118
134
|
buttonRef: inputRef,
|
|
119
135
|
panelRef: panelRef,
|
|
120
136
|
className: classes,
|
|
121
|
-
ref: popoverClassRef
|
|
122
|
-
|
|
137
|
+
ref: popoverClassRef,
|
|
138
|
+
closePopover: closePopover
|
|
139
|
+
}, props, {
|
|
140
|
+
panelProps: _objectSpread(_objectSpread({}, props.panelProps), {}, {
|
|
141
|
+
onKeyDown: onKeyDown
|
|
142
|
+
})
|
|
143
|
+
}), (0, _react2.jsx)(_focus_trap.EuiFocusTrap, _extends({
|
|
123
144
|
clickOutsideDisables: true,
|
|
124
145
|
disabled: disableFocusTrap
|
|
125
|
-
}, focusTrapProps),
|
|
126
|
-
onKeyDown: onKeyDown
|
|
127
|
-
}, children)));
|
|
146
|
+
}, focusTrapProps), children));
|
|
128
147
|
};
|
|
129
148
|
exports.EuiInputPopover = EuiInputPopover;
|
|
130
149
|
EuiInputPopover.propTypes = {
|
|
@@ -13,7 +13,7 @@ var _resize_observer = require("../observer/resize_observer");
|
|
|
13
13
|
var _utils = require("./utils");
|
|
14
14
|
var _text_truncate = require("./text_truncate.styles");
|
|
15
15
|
var _react2 = require("@emotion/react");
|
|
16
|
-
var _excluded = ["width"],
|
|
16
|
+
var _excluded = ["width", "onResize"],
|
|
17
17
|
_excluded2 = ["width", "children", "text", "truncation", "truncationOffset", "truncationPosition", "ellipsis", "containerRef", "className"],
|
|
18
18
|
_excluded3 = ["onResize"];
|
|
19
19
|
/*
|
|
@@ -38,10 +38,13 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
38
38
|
var TRUNCATION_TYPES = ['end', 'start', 'startEnd', 'middle'];
|
|
39
39
|
var EuiTextTruncate = function EuiTextTruncate(_ref) {
|
|
40
40
|
var width = _ref.width,
|
|
41
|
+
onResize = _ref.onResize,
|
|
41
42
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
42
43
|
return width != null ? (0, _react2.jsx)(EuiTextTruncateWithWidth, _extends({
|
|
43
44
|
width: width
|
|
44
|
-
}, props)) : (0, _react2.jsx)(EuiTextTruncateWithResizeObserver,
|
|
45
|
+
}, props)) : (0, _react2.jsx)(EuiTextTruncateWithResizeObserver, _extends({
|
|
46
|
+
onResize: onResize
|
|
47
|
+
}, props));
|
|
45
48
|
};
|
|
46
49
|
exports.EuiTextTruncate = EuiTextTruncate;
|
|
47
50
|
EuiTextTruncate.propTypes = {
|
|
@@ -16,7 +16,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
16
16
|
|
|
17
17
|
import React, { useRef, useMemo, useState, useEffect, useCallback } from 'react';
|
|
18
18
|
import classNames from 'classnames';
|
|
19
|
-
import { useEuiTheme, useGeneratedHtmlId, throttle } from '../../services';
|
|
19
|
+
import { useEuiTheme, useEuiThemeCSSVariables, useGeneratedHtmlId, throttle } from '../../services';
|
|
20
20
|
import { EuiFlyout } from '../flyout';
|
|
21
21
|
import { useEuiI18n } from '../i18n';
|
|
22
22
|
import { euiHeaderVariables } from '../header/header.styles';
|
|
@@ -36,6 +36,8 @@ var _EuiCollapsibleNavBeta = function _EuiCollapsibleNavBeta(_ref) {
|
|
|
36
36
|
side = _ref$side === void 0 ? 'left' : _ref$side,
|
|
37
37
|
_focusTrapProps = _ref.focusTrapProps,
|
|
38
38
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
39
|
+
var _useEuiThemeCSSVariab = useEuiThemeCSSVariables(),
|
|
40
|
+
setGlobalCSSVariables = _useEuiThemeCSSVariab.setGlobalCSSVariables;
|
|
39
41
|
var euiTheme = useEuiTheme();
|
|
40
42
|
var headerHeight = euiHeaderVariables(euiTheme).height;
|
|
41
43
|
|
|
@@ -94,9 +96,17 @@ var _EuiCollapsibleNavBeta = function _EuiCollapsibleNavBeta(_ref) {
|
|
|
94
96
|
var width = useMemo(function () {
|
|
95
97
|
if (isOverlayFullWidth) return '100%';
|
|
96
98
|
if (isPush && isCollapsed) return headerHeight;
|
|
97
|
-
return _width;
|
|
99
|
+
return "".concat(_width, "px");
|
|
98
100
|
}, [_width, isOverlayFullWidth, isPush, isCollapsed, headerHeight]);
|
|
99
101
|
|
|
102
|
+
// Other UI elements may need to account for the nav width -
|
|
103
|
+
// set a global CSS variable that they can use
|
|
104
|
+
useEffect(function () {
|
|
105
|
+
setGlobalCSSVariables({
|
|
106
|
+
'--euiCollapsibleNavOffset': isOverlay ? '0' : width
|
|
107
|
+
});
|
|
108
|
+
}, [width, isOverlay, setGlobalCSSVariables]);
|
|
109
|
+
|
|
100
110
|
/**
|
|
101
111
|
* Prop setup
|
|
102
112
|
*/
|
|
@@ -98,56 +98,51 @@ export var EuiComboBoxInput = /*#__PURE__*/function (_Component) {
|
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
});
|
|
101
|
-
_defineProperty(_assertThisInitialized(_this), "inputOnChange", function (event) {
|
|
102
|
-
var _this$props$onChange, _this$props3;
|
|
103
|
-
var value = event.target.value;
|
|
104
|
-
_this.updateInputSize(value);
|
|
105
|
-
(_this$props$onChange = (_this$props3 = _this.props).onChange) === null || _this$props$onChange === void 0 ? void 0 : _this$props$onChange.call(_this$props3, value);
|
|
106
|
-
});
|
|
107
101
|
return _this;
|
|
108
102
|
}
|
|
109
103
|
_createClass(EuiComboBoxInput, [{
|
|
110
104
|
key: "componentDidUpdate",
|
|
111
105
|
value: function componentDidUpdate(prevProps) {
|
|
112
|
-
|
|
106
|
+
if (prevProps.searchValue !== this.props.searchValue) {
|
|
107
|
+
this.updateInputSize(this.props.searchValue);
|
|
113
108
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
if (searchValue !== this.props.searchValue) {
|
|
109
|
+
// We need to update the position of everything if the user enters enough input to change
|
|
110
|
+
// the size of the input.
|
|
117
111
|
this.updatePosition();
|
|
118
112
|
}
|
|
119
113
|
}
|
|
120
114
|
}, {
|
|
121
115
|
key: "render",
|
|
122
116
|
value: function render() {
|
|
123
|
-
var _this$
|
|
124
|
-
compressed = _this$
|
|
125
|
-
focusedOptionId = _this$
|
|
126
|
-
fullWidth = _this$
|
|
127
|
-
hasSelectedOptions = _this$
|
|
128
|
-
id = _this$
|
|
129
|
-
isDisabled = _this$
|
|
130
|
-
isListOpen = _this$
|
|
131
|
-
noIcon = _this$
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
117
|
+
var _this$props3 = this.props,
|
|
118
|
+
compressed = _this$props3.compressed,
|
|
119
|
+
focusedOptionId = _this$props3.focusedOptionId,
|
|
120
|
+
fullWidth = _this$props3.fullWidth,
|
|
121
|
+
hasSelectedOptions = _this$props3.hasSelectedOptions,
|
|
122
|
+
id = _this$props3.id,
|
|
123
|
+
isDisabled = _this$props3.isDisabled,
|
|
124
|
+
isListOpen = _this$props3.isListOpen,
|
|
125
|
+
noIcon = _this$props3.noIcon,
|
|
126
|
+
_onChange = _this$props3.onChange,
|
|
127
|
+
onClear = _this$props3.onClear,
|
|
128
|
+
onClick = _this$props3.onClick,
|
|
129
|
+
onCloseListClick = _this$props3.onCloseListClick,
|
|
130
|
+
onOpenListClick = _this$props3.onOpenListClick,
|
|
131
|
+
onRemoveOption = _this$props3.onRemoveOption,
|
|
132
|
+
placeholder = _this$props3.placeholder,
|
|
133
|
+
rootId = _this$props3.rootId,
|
|
134
|
+
searchValue = _this$props3.searchValue,
|
|
135
|
+
selectedOptions = _this$props3.selectedOptions,
|
|
136
|
+
singleSelectionProp = _this$props3.singleSelection,
|
|
137
|
+
toggleButtonRef = _this$props3.toggleButtonRef,
|
|
138
|
+
value = _this$props3.value,
|
|
139
|
+
prepend = _this$props3.prepend,
|
|
140
|
+
append = _this$props3.append,
|
|
141
|
+
isLoading = _this$props3.isLoading,
|
|
142
|
+
isInvalid = _this$props3.isInvalid,
|
|
143
|
+
autoFocus = _this$props3.autoFocus,
|
|
144
|
+
ariaLabel = _this$props3['aria-label'],
|
|
145
|
+
ariaLabelledby = _this$props3['aria-labelledby'];
|
|
151
146
|
var singleSelection = Boolean(singleSelectionProp);
|
|
152
147
|
var asPlainText = singleSelectionProp && _typeof(singleSelectionProp) === 'object' && singleSelectionProp.asPlainText || false;
|
|
153
148
|
var pills = selectedOptions ? selectedOptions.map(function (option) {
|
|
@@ -252,7 +247,9 @@ export var EuiComboBoxInput = /*#__PURE__*/function (_Component) {
|
|
|
252
247
|
disabled: isDisabled,
|
|
253
248
|
id: id,
|
|
254
249
|
onBlur: this.onBlur,
|
|
255
|
-
onChange:
|
|
250
|
+
onChange: function onChange(event) {
|
|
251
|
+
return _onChange(event.target.value);
|
|
252
|
+
},
|
|
256
253
|
onFocus: this.onFocus,
|
|
257
254
|
onKeyDown: this.onKeyDown,
|
|
258
255
|
ref: this.inputRefCallback,
|