@elastic/eui 94.4.0 → 94.5.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/LICENSE.txt +6 -0
- package/NOTICE.txt +54 -0
- package/README.md +69 -0
- package/es/components/flyout/flyout_resizable.js +14 -3
- package/es/components/popover/input_popover.js +10 -5
- package/es/components/text_diff/text_diff.js +7 -4
- package/es/components/tool_tip/tool_tip.js +10 -1
- package/eui.d.ts +6 -5
- package/lib/components/flyout/flyout_resizable.js +14 -3
- package/lib/components/popover/input_popover.js +10 -5
- package/lib/components/text_diff/text_diff.js +7 -4
- package/lib/components/tool_tip/tool_tip.js +9 -0
- package/licenses/ELASTIC-LICENSE-2.0.md +93 -0
- package/licenses/SSPL-LICENSE.md +557 -0
- package/optimize/es/components/flyout/flyout_resizable.js +14 -3
- package/optimize/es/components/popover/input_popover.js +10 -5
- package/optimize/es/components/text_diff/text_diff.js +7 -4
- package/optimize/es/components/tool_tip/tool_tip.js +10 -1
- package/optimize/lib/components/flyout/flyout_resizable.js +14 -3
- package/optimize/lib/components/popover/input_popover.js +10 -5
- package/optimize/lib/components/text_diff/text_diff.js +7 -4
- package/optimize/lib/components/tool_tip/tool_tip.js +9 -0
- package/package.json +1 -1
- package/test-env/components/flyout/flyout_resizable.js +14 -3
- package/test-env/components/popover/input_popover.js +10 -5
- package/test-env/components/text_diff/text_diff.js +7 -4
- package/test-env/components/tool_tip/tool_tip.js +9 -0
- package/src/components/date_picker/react-datepicker/LICENSE +0 -21
- package/src/components/date_picker/react-datepicker/README.md +0 -168
- package/src/services/theme/README.md +0 -153
- package/src/test/README.md +0 -44
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
Source code in this repository is covered by (i) a dual license under the Server
|
|
2
|
+
Side Public License, v 1 and the Elastic License 2.0 or (ii) an Apache License
|
|
3
|
+
2.0 compatible license or (iii) solely under the Elastic License 2.0, in each
|
|
4
|
+
case, as noted in the applicable header. The default throughout the repository
|
|
5
|
+
is a dual license under the Server Side Public License, v 1 and the Elastic
|
|
6
|
+
License 2.0, unless the header specifies another license.
|
package/NOTICE.txt
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
EUI
|
|
2
|
+
Copyright 2012-2021 Elasticsearch B.V.
|
|
3
|
+
|
|
4
|
+
---
|
|
5
|
+
This product bundles code based on react-datepicker@2.0.0 which is
|
|
6
|
+
available under a "MIT" license.
|
|
7
|
+
|
|
8
|
+
The MIT License (MIT)
|
|
9
|
+
|
|
10
|
+
Copyright (c) 2018 HackerOne Inc and individual contributors
|
|
11
|
+
|
|
12
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
in the Software without restriction, including without limitation the rights
|
|
15
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
furnished to do so, subject to the following conditions:
|
|
18
|
+
|
|
19
|
+
The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
copies or substantial portions of the Software.
|
|
21
|
+
|
|
22
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
SOFTWARE.
|
|
29
|
+
|
|
30
|
+
--
|
|
31
|
+
This product bundles code based on @types/react-datepicker@1.8.0 which is
|
|
32
|
+
available under a "MIT" license.
|
|
33
|
+
|
|
34
|
+
MIT License
|
|
35
|
+
|
|
36
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
37
|
+
|
|
38
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
39
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
40
|
+
in the Software without restriction, including without limitation the rights
|
|
41
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
42
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
43
|
+
furnished to do so, subject to the following conditions:
|
|
44
|
+
|
|
45
|
+
The above copyright notice and this permission notice shall be included in all
|
|
46
|
+
copies or substantial portions of the Software.
|
|
47
|
+
|
|
48
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
49
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
50
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
51
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
52
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
53
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
54
|
+
SOFTWARE
|
package/README.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<img src="https://repository-images.githubusercontent.com/107422373/b6180480-a1d7-11eb-8a3c-902086232aa7" alt="" />
|
|
2
|
+
|
|
3
|
+
# Elastic UI Framework
|
|
4
|
+
|
|
5
|
+
**The Elastic UI Framework is a collection of React UI components for quickly building user interfaces at Elastic.**
|
|
6
|
+
|
|
7
|
+
Check out our [full documentation site][docs] which contains many examples of components in the EUI framework aesthetic, and how to use them in your products. Our FAQ below covers common usage questions — for other general questions regarding EUI, check out the [Discussions tab](https://github.com/elastic/eui/discussions).
|
|
8
|
+
|
|
9
|
+
> [!NOTE]
|
|
10
|
+
> We're in the process of migrating this repository to a monorepo structure. You can find `@elastic/eui` files in the [packages/eui](https://github.com/elastic/eui/tree/main/packages/eui) directory.
|
|
11
|
+
|
|
12
|
+
## Frequently Asked Questions
|
|
13
|
+
|
|
14
|
+
### What is the Elastic UI Framework?
|
|
15
|
+
|
|
16
|
+
The Elastic UI Framework (EUI) is a design library in use at Elastic to build React applications that need to share our branding and aesthetics. It distributes typed UI React components and static assets for use in building web layouts. Alongside the React components, we ship theme & style utilities that can be used independently on their own.
|
|
17
|
+
|
|
18
|
+
The primary goal of this library is to provide reusable UI components that can be used throughout Elastic's web products. As React components, they remove CSS from the process of building UIs. As a single source of truth, the framework allows our designers to make changes to our aesthetic directly in the code. And unit test coverage for the UI components allows us to deliver a stable "API for user interfaces".
|
|
19
|
+
|
|
20
|
+
### Can I use EUI?
|
|
21
|
+
|
|
22
|
+
Please see Elastic's licensing FAQ: [I’m using EUI or Elastic Charts in my application outside of Kibana, how does this affect me?][licensing-faq]
|
|
23
|
+
|
|
24
|
+
### Why is EUI open source?
|
|
25
|
+
|
|
26
|
+
Many of Elastic's products are open source and rely upon this library to function. The Elastic UI Framework began as a folder of code in Kibana and we decided it could be used beyond that codebase. It exists as an independent library so that patterns can be shared across teams and design standards can be scaled across our organization. Since most of our products are open source, we treat this one similarly as far as public publishing and conversation even if its usage tends to focus more inward towards Elastic itself.
|
|
27
|
+
|
|
28
|
+
### What is the versioning, release, and upgrade strategy?
|
|
29
|
+
|
|
30
|
+
We use [semver](https://semver.org/) for versioning and use that to denote breaking changes in EUI upgrades. Traditionally we consider API changes in our prop names or existing component functionality to be a reason for a breaking change, but do not track the renaming of CSS selectors, mixins or other style changes under this same rigor.
|
|
31
|
+
|
|
32
|
+
Traditionally releases are made weekly against whatever is in the `main` branch and you can upgrade from NPM as you see fit.
|
|
33
|
+
|
|
34
|
+
### Can I contribute to EUI?
|
|
35
|
+
|
|
36
|
+
Yes! We welcome community-contributed PRs, especially around feature requests that the EUI team may not have bandwidth to carry out alone. You can find documentation around creating and submitting new components in [our wiki](wiki/contributing-to-eui/).
|
|
37
|
+
|
|
38
|
+
### What about reporting bugs and feature requests?
|
|
39
|
+
|
|
40
|
+
Bug reports and feature requests are most welcome, but our roadmap and prioritization are driven primarily by [internal Elastic usage](wiki/contributing-to-eui#how-we-assign-work-and-define-our-roadmap).
|
|
41
|
+
|
|
42
|
+
Please note that in order to keep our backlog manageable and focused on tasks we intend to complete, feature requests & tech debt issues that are inactive for a year will be auto-closed (bugs will remain open if determined to be reproducible and valid).
|
|
43
|
+
|
|
44
|
+
This activity counter can be soft reset by commenting on the issue directly, but please do so mindfully. We would ask that you proactively let the EUI team know why this request matters to you or how it impacts you or your users, in order to help us prioritize accordingly.
|
|
45
|
+
|
|
46
|
+
The EUI team, like everyone else, has a finite amount of time and resources, and it is not humanly possible for us to implement every task or feature requested of us. However, that's where the beauty of open source comes in - if your request is important to you, we strongly encourage you to [contribute code directly to EUI](wiki/contributing-to-eui/) that addresses your issue or request!
|
|
47
|
+
|
|
48
|
+
<!-- TODO: Delete this question once the Emotion migration is complete -->
|
|
49
|
+
### What is the status of EUI's theming?
|
|
50
|
+
|
|
51
|
+
The EUI library was previously built upon Sass and is in the process of migrating to CSS-in-JS (specifically [Emotion](https://emotion.sh)). While this work is in progress, we ask for your patience with our in-between state in areas such as documentation and setup.
|
|
52
|
+
|
|
53
|
+
If you're a Kibana developer with questions around CSS-in-JS usage in Kibana, please check out our [FAQ discussion](https://github.com/elastic/eui/discussions/6828)!
|
|
54
|
+
|
|
55
|
+
## Wiki
|
|
56
|
+
|
|
57
|
+
Our wiki docs contain instructions and guidelines on multiple areas of EUI usage and development that are too detailed for an initial README. For more information, see:
|
|
58
|
+
|
|
59
|
+
- [Consuming EUI](wiki/consuming-eui)
|
|
60
|
+
- [Contributing to EUI](wiki/contributing-to-eui/)
|
|
61
|
+
- [Running EUI locally](wiki/contributing-to-eui/running-eui-locally.md)
|
|
62
|
+
|
|
63
|
+
## License
|
|
64
|
+
|
|
65
|
+
[Dual-licensed under Elastic v2 and Server Side Public License, v1][license]. See Elastic's [licensing FAQ][licensing-faq] for details.
|
|
66
|
+
|
|
67
|
+
[license]: LICENSE.txt
|
|
68
|
+
[licensing-faq]: https://www.elastic.co/pricing/faq/licensing#im-using-eui-or-elastic-charts-in-my-application-outside-of-kibana-how-does-this-affect-me
|
|
69
|
+
[docs]: https://elastic.github.io/eui/
|
|
@@ -23,6 +23,8 @@ import { getPosition } from '../resizable_container/helpers';
|
|
|
23
23
|
import { EuiFlyout } from './flyout';
|
|
24
24
|
import { euiFlyoutResizableButtonStyles } from './flyout_resizable.styles';
|
|
25
25
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
26
|
+
// If not omitted, the correct props don't show up in the docs prop table
|
|
27
|
+
|
|
26
28
|
export var EuiFlyoutResizable = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
27
29
|
var size = _ref.size,
|
|
28
30
|
maxWidth = _ref.maxWidth,
|
|
@@ -57,9 +59,18 @@ export var EuiFlyoutResizable = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
57
59
|
setFlyoutRef = _useState6[1];
|
|
58
60
|
var setRefs = useCombinedRefs([setFlyoutRef, ref]);
|
|
59
61
|
useEffect(function () {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
if (!flyoutWidth && flyoutRef) {
|
|
63
|
+
setCallOnResize(false); // Don't call `onResize` for non-user width changes
|
|
64
|
+
setFlyoutWidth(getFlyoutMinMaxWidth(flyoutRef.offsetWidth));
|
|
65
|
+
}
|
|
66
|
+
}, [flyoutWidth, flyoutRef, getFlyoutMinMaxWidth]);
|
|
67
|
+
|
|
68
|
+
// Update flyout width when consumers pass in a new `size`
|
|
69
|
+
useEffect(function () {
|
|
70
|
+
setCallOnResize(false);
|
|
71
|
+
// For string `size`s, resetting flyoutWidth to 0 will trigger the above useEffect's recalculation
|
|
72
|
+
setFlyoutWidth(typeof size === 'number' ? getFlyoutMinMaxWidth(size) : 0);
|
|
73
|
+
}, [size, getFlyoutMinMaxWidth]);
|
|
63
74
|
|
|
64
75
|
// Initial numbers to calculate from, on resize drag start
|
|
65
76
|
var initialWidth = useRef(0);
|
|
@@ -169,16 +169,21 @@ export var EuiInputPopover = function EuiInputPopover(_ref) {
|
|
|
169
169
|
}
|
|
170
170
|
closePopover();
|
|
171
171
|
};
|
|
172
|
-
window.addEventListener('scroll', closePopoverOnScroll, {
|
|
173
|
-
passive: true,
|
|
174
|
-
// for better performance as we won't call preventDefault
|
|
175
|
-
capture: true // scroll events don't bubble, they must be captured instead
|
|
176
|
-
});
|
|
177
172
|
|
|
173
|
+
// Kibana Cypress tests trigger a scroll event in many common situations when the options list div is appended
|
|
174
|
+
// to the DOM; in testing it was always within 100ms, but setting a timeout here for 500ms to be safe
|
|
175
|
+
var timeoutId = setTimeout(function () {
|
|
176
|
+
window.addEventListener('scroll', closePopoverOnScroll, {
|
|
177
|
+
passive: true,
|
|
178
|
+
// for better performance as we won't call preventDefault
|
|
179
|
+
capture: true // scroll events don't bubble, they must be captured instead
|
|
180
|
+
});
|
|
181
|
+
}, 500);
|
|
178
182
|
return function () {
|
|
179
183
|
window.removeEventListener('scroll', closePopoverOnScroll, {
|
|
180
184
|
capture: true
|
|
181
185
|
});
|
|
186
|
+
clearTimeout(timeoutId);
|
|
182
187
|
};
|
|
183
188
|
}
|
|
184
189
|
}, [closeOnScroll, closePopover, panelEl, inputEl]);
|
|
@@ -44,18 +44,21 @@ export var useEuiTextDiff = function useEuiTextDiff(_ref) {
|
|
|
44
44
|
var rendereredHtml = useMemo(function () {
|
|
45
45
|
var html = [];
|
|
46
46
|
if (textDiff) for (var i = 0; i < textDiff.length; i++) {
|
|
47
|
-
var
|
|
47
|
+
var _Element = void 0;
|
|
48
48
|
var el = textDiff[i];
|
|
49
|
-
if (el[0] === 1)
|
|
50
|
-
if (
|
|
49
|
+
if (el[0] === 1) _Element = insertComponent;else if (el[0] === -1) _Element = deleteComponent;else if (sameComponent) _Element = sameComponent;
|
|
50
|
+
if (_Element) html.push(___EmotionJSX(_Element, {
|
|
51
51
|
key: i
|
|
52
52
|
}, el[1]));else html.push(el[1]);
|
|
53
53
|
}
|
|
54
54
|
return html;
|
|
55
55
|
}, [textDiff, deleteComponent, insertComponent, sameComponent]); // produces diff array
|
|
56
56
|
|
|
57
|
-
return
|
|
57
|
+
// specifically defining the return type here as the
|
|
58
|
+
// inferred type is not correct: array vs tuple
|
|
59
|
+
var textDiffResult = [___EmotionJSX("span", _extends({
|
|
58
60
|
css: styles.euiTextDiff,
|
|
59
61
|
className: classes
|
|
60
62
|
}, rest), rendereredHtml), textDiff];
|
|
63
|
+
return textDiffResult;
|
|
61
64
|
};
|
|
@@ -27,7 +27,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
27
27
|
import React, { Component } from 'react';
|
|
28
28
|
import PropTypes from "prop-types";
|
|
29
29
|
import classNames from 'classnames';
|
|
30
|
-
import { findPopoverPosition, htmlIdGenerator } from '../../services';
|
|
30
|
+
import { findPopoverPosition, htmlIdGenerator, keys } from '../../services';
|
|
31
31
|
import { enqueueStateChange } from '../../services/react';
|
|
32
32
|
import { EuiResizeObserver } from '../observer/resize_observer';
|
|
33
33
|
import { EuiPortal } from '../portal';
|
|
@@ -179,6 +179,14 @@ export var EuiToolTip = /*#__PURE__*/function (_Component) {
|
|
|
179
179
|
});
|
|
180
180
|
_this.hideToolTip();
|
|
181
181
|
});
|
|
182
|
+
_defineProperty(_assertThisInitialized(_this), "onEscapeKey", function (event) {
|
|
183
|
+
if (event.key === keys.ESCAPE) {
|
|
184
|
+
_this.setState({
|
|
185
|
+
hasFocus: false
|
|
186
|
+
}); // Allows mousing over back into the tooltip to work correctly
|
|
187
|
+
_this.hideToolTip();
|
|
188
|
+
}
|
|
189
|
+
});
|
|
182
190
|
_defineProperty(_assertThisInitialized(_this), "onMouseOut", function (event) {
|
|
183
191
|
// Prevent mousing over children from hiding the tooltip by testing for whether the mouse has
|
|
184
192
|
// left the anchor for a non-child.
|
|
@@ -250,6 +258,7 @@ export var EuiToolTip = /*#__PURE__*/function (_Component) {
|
|
|
250
258
|
ref: this.setAnchorRef,
|
|
251
259
|
onBlur: this.onBlur,
|
|
252
260
|
onFocus: this.onFocus,
|
|
261
|
+
onKeyDown: this.onEscapeKey,
|
|
253
262
|
onMouseOver: this.showToolTip,
|
|
254
263
|
onMouseOut: this.onMouseOut,
|
|
255
264
|
id: id,
|
package/eui.d.ts
CHANGED
|
@@ -6150,6 +6150,7 @@ declare module '@elastic/eui/src/components/tool_tip/tool_tip' {
|
|
|
6150
6150
|
hideToolTip: () => void;
|
|
6151
6151
|
onFocus: () => void;
|
|
6152
6152
|
onBlur: () => void;
|
|
6153
|
+
onEscapeKey: (event: React.KeyboardEvent<HTMLSpanElement>) => void;
|
|
6153
6154
|
onMouseOut: (event: ReactMouseEvent<HTMLSpanElement, MouseEvent>) => void;
|
|
6154
6155
|
render(): React.JSX.Element;
|
|
6155
6156
|
}
|
|
@@ -11739,14 +11740,14 @@ declare module '@elastic/eui/src/components/flyout/flyout_resizable.styles' {
|
|
|
11739
11740
|
declare module '@elastic/eui/src/components/flyout/flyout_resizable' {
|
|
11740
11741
|
import React from 'react';
|
|
11741
11742
|
import { EuiFlyoutProps } from '@elastic/eui/src/components/flyout/flyout';
|
|
11742
|
-
export type EuiFlyoutResizableProps =
|
|
11743
|
+
export type EuiFlyoutResizableProps = {
|
|
11743
11744
|
maxWidth?: number;
|
|
11744
11745
|
minWidth?: number;
|
|
11745
11746
|
/**
|
|
11746
11747
|
* Optional callback that fires on user resize with the new flyout width
|
|
11747
11748
|
*/
|
|
11748
11749
|
onResize?: (width: number) => void;
|
|
11749
|
-
}
|
|
11750
|
+
} & Omit<EuiFlyoutProps, 'maxWidth' | 'onResize'>;
|
|
11750
11751
|
export const EuiFlyoutResizable: React.ForwardRefExoticComponent<Omit<EuiFlyoutResizableProps, "ref"> & React.RefAttributes<unknown>>;
|
|
11751
11752
|
|
|
11752
11753
|
}
|
|
@@ -16234,7 +16235,7 @@ declare module '@elastic/eui/src/components/tabs/tabbed_content/tabbed_content'
|
|
|
16234
16235
|
};
|
|
16235
16236
|
export class EuiTabbedContent extends Component<EuiTabbedContentProps, EuiTabbedContentState> {
|
|
16236
16237
|
static defaultProps: {
|
|
16237
|
-
autoFocus:
|
|
16238
|
+
autoFocus: EuiTabbedContentProps['autoFocus'];
|
|
16238
16239
|
};
|
|
16239
16240
|
private readonly rootId;
|
|
16240
16241
|
private readonly tabsRef;
|
|
@@ -23603,7 +23604,7 @@ declare module '@elastic/eui/src/components/text_diff/text_diff.styles' {
|
|
|
23603
23604
|
|
|
23604
23605
|
}
|
|
23605
23606
|
declare module '@elastic/eui/src/components/text_diff/text_diff' {
|
|
23606
|
-
import
|
|
23607
|
+
import { HTMLAttributes, ElementType } from 'react';
|
|
23607
23608
|
import { CommonProps } from '@elastic/eui/src/components/common';
|
|
23608
23609
|
interface Props {
|
|
23609
23610
|
/**
|
|
@@ -23635,7 +23636,7 @@ declare module '@elastic/eui/src/components/text_diff/text_diff' {
|
|
|
23635
23636
|
timeout?: number;
|
|
23636
23637
|
}
|
|
23637
23638
|
export type EuiTextDiffProps = CommonProps & Props & HTMLAttributes<HTMLElement>;
|
|
23638
|
-
export const useEuiTextDiff: ({ className, insertComponent, deleteComponent, sameComponent, beforeText, afterText, timeout, ...rest }: EuiTextDiffProps) =>
|
|
23639
|
+
export const useEuiTextDiff: ({ className, insertComponent, deleteComponent, sameComponent, beforeText, afterText, timeout, ...rest }: EuiTextDiffProps) => [JSX.Element, [0 | 1 | -1, string][]];
|
|
23639
23640
|
export {};
|
|
23640
23641
|
|
|
23641
23642
|
}
|
|
@@ -31,6 +31,8 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
|
|
|
31
31
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
32
32
|
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; }
|
|
33
33
|
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; }
|
|
34
|
+
// If not omitted, the correct props don't show up in the docs prop table
|
|
35
|
+
|
|
34
36
|
var EuiFlyoutResizable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
35
37
|
var size = _ref.size,
|
|
36
38
|
maxWidth = _ref.maxWidth,
|
|
@@ -65,9 +67,18 @@ var EuiFlyoutResizable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref
|
|
|
65
67
|
setFlyoutRef = _useState6[1];
|
|
66
68
|
var setRefs = (0, _services.useCombinedRefs)([setFlyoutRef, ref]);
|
|
67
69
|
(0, _react.useEffect)(function () {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
if (!flyoutWidth && flyoutRef) {
|
|
71
|
+
setCallOnResize(false); // Don't call `onResize` for non-user width changes
|
|
72
|
+
setFlyoutWidth(getFlyoutMinMaxWidth(flyoutRef.offsetWidth));
|
|
73
|
+
}
|
|
74
|
+
}, [flyoutWidth, flyoutRef, getFlyoutMinMaxWidth]);
|
|
75
|
+
|
|
76
|
+
// Update flyout width when consumers pass in a new `size`
|
|
77
|
+
(0, _react.useEffect)(function () {
|
|
78
|
+
setCallOnResize(false);
|
|
79
|
+
// For string `size`s, resetting flyoutWidth to 0 will trigger the above useEffect's recalculation
|
|
80
|
+
setFlyoutWidth(typeof size === 'number' ? getFlyoutMinMaxWidth(size) : 0);
|
|
81
|
+
}, [size, getFlyoutMinMaxWidth]);
|
|
71
82
|
|
|
72
83
|
// Initial numbers to calculate from, on resize drag start
|
|
73
84
|
var initialWidth = (0, _react.useRef)(0);
|
|
@@ -177,16 +177,21 @@ var EuiInputPopover = function EuiInputPopover(_ref) {
|
|
|
177
177
|
}
|
|
178
178
|
closePopover();
|
|
179
179
|
};
|
|
180
|
-
window.addEventListener('scroll', closePopoverOnScroll, {
|
|
181
|
-
passive: true,
|
|
182
|
-
// for better performance as we won't call preventDefault
|
|
183
|
-
capture: true // scroll events don't bubble, they must be captured instead
|
|
184
|
-
});
|
|
185
180
|
|
|
181
|
+
// Kibana Cypress tests trigger a scroll event in many common situations when the options list div is appended
|
|
182
|
+
// to the DOM; in testing it was always within 100ms, but setting a timeout here for 500ms to be safe
|
|
183
|
+
var timeoutId = setTimeout(function () {
|
|
184
|
+
window.addEventListener('scroll', closePopoverOnScroll, {
|
|
185
|
+
passive: true,
|
|
186
|
+
// for better performance as we won't call preventDefault
|
|
187
|
+
capture: true // scroll events don't bubble, they must be captured instead
|
|
188
|
+
});
|
|
189
|
+
}, 500);
|
|
186
190
|
return function () {
|
|
187
191
|
window.removeEventListener('scroll', closePopoverOnScroll, {
|
|
188
192
|
capture: true
|
|
189
193
|
});
|
|
194
|
+
clearTimeout(timeoutId);
|
|
190
195
|
};
|
|
191
196
|
}
|
|
192
197
|
}, [closeOnScroll, closePopover, panelEl, inputEl]);
|
|
@@ -53,19 +53,22 @@ var useEuiTextDiff = function useEuiTextDiff(_ref) {
|
|
|
53
53
|
var rendereredHtml = (0, _react.useMemo)(function () {
|
|
54
54
|
var html = [];
|
|
55
55
|
if (textDiff) for (var i = 0; i < textDiff.length; i++) {
|
|
56
|
-
var
|
|
56
|
+
var _Element = void 0;
|
|
57
57
|
var el = textDiff[i];
|
|
58
|
-
if (el[0] === 1)
|
|
59
|
-
if (
|
|
58
|
+
if (el[0] === 1) _Element = insertComponent;else if (el[0] === -1) _Element = deleteComponent;else if (sameComponent) _Element = sameComponent;
|
|
59
|
+
if (_Element) html.push((0, _react2.jsx)(_Element, {
|
|
60
60
|
key: i
|
|
61
61
|
}, el[1]));else html.push(el[1]);
|
|
62
62
|
}
|
|
63
63
|
return html;
|
|
64
64
|
}, [textDiff, deleteComponent, insertComponent, sameComponent]); // produces diff array
|
|
65
65
|
|
|
66
|
-
return
|
|
66
|
+
// specifically defining the return type here as the
|
|
67
|
+
// inferred type is not correct: array vs tuple
|
|
68
|
+
var textDiffResult = [(0, _react2.jsx)("span", _extends({
|
|
67
69
|
css: styles.euiTextDiff,
|
|
68
70
|
className: classes
|
|
69
71
|
}, rest), rendereredHtml), textDiff];
|
|
72
|
+
return textDiffResult;
|
|
70
73
|
};
|
|
71
74
|
exports.useEuiTextDiff = useEuiTextDiff;
|
|
@@ -187,6 +187,14 @@ var EuiToolTip = /*#__PURE__*/function (_Component) {
|
|
|
187
187
|
});
|
|
188
188
|
_this.hideToolTip();
|
|
189
189
|
});
|
|
190
|
+
_defineProperty(_assertThisInitialized(_this), "onEscapeKey", function (event) {
|
|
191
|
+
if (event.key === _services.keys.ESCAPE) {
|
|
192
|
+
_this.setState({
|
|
193
|
+
hasFocus: false
|
|
194
|
+
}); // Allows mousing over back into the tooltip to work correctly
|
|
195
|
+
_this.hideToolTip();
|
|
196
|
+
}
|
|
197
|
+
});
|
|
190
198
|
_defineProperty(_assertThisInitialized(_this), "onMouseOut", function (event) {
|
|
191
199
|
// Prevent mousing over children from hiding the tooltip by testing for whether the mouse has
|
|
192
200
|
// left the anchor for a non-child.
|
|
@@ -258,6 +266,7 @@ var EuiToolTip = /*#__PURE__*/function (_Component) {
|
|
|
258
266
|
ref: this.setAnchorRef,
|
|
259
267
|
onBlur: this.onBlur,
|
|
260
268
|
onFocus: this.onFocus,
|
|
269
|
+
onKeyDown: this.onEscapeKey,
|
|
261
270
|
onMouseOver: this.showToolTip,
|
|
262
271
|
onMouseOut: this.onMouseOut,
|
|
263
272
|
id: id,
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Elastic License 2.0
|
|
2
|
+
|
|
3
|
+
URL: https://www.elastic.co/licensing/elastic-license
|
|
4
|
+
|
|
5
|
+
## Acceptance
|
|
6
|
+
|
|
7
|
+
By using the software, you agree to all of the terms and conditions below.
|
|
8
|
+
|
|
9
|
+
## Copyright License
|
|
10
|
+
|
|
11
|
+
The licensor grants you a non-exclusive, royalty-free, worldwide,
|
|
12
|
+
non-sublicensable, non-transferable license to use, copy, distribute, make
|
|
13
|
+
available, and prepare derivative works of the software, in each case subject to
|
|
14
|
+
the limitations and conditions below.
|
|
15
|
+
|
|
16
|
+
## Limitations
|
|
17
|
+
|
|
18
|
+
You may not provide the software to third parties as a hosted or managed
|
|
19
|
+
service, where the service provides users with access to any substantial set of
|
|
20
|
+
the features or functionality of the software.
|
|
21
|
+
|
|
22
|
+
You may not move, change, disable, or circumvent the license key functionality
|
|
23
|
+
in the software, and you may not remove or obscure any functionality in the
|
|
24
|
+
software that is protected by the license key.
|
|
25
|
+
|
|
26
|
+
You may not alter, remove, or obscure any licensing, copyright, or other notices
|
|
27
|
+
of the licensor in the software. Any use of the licensor’s trademarks is subject
|
|
28
|
+
to applicable law.
|
|
29
|
+
|
|
30
|
+
## Patents
|
|
31
|
+
|
|
32
|
+
The licensor grants you a license, under any patent claims the licensor can
|
|
33
|
+
license, or becomes able to license, to make, have made, use, sell, offer for
|
|
34
|
+
sale, import and have imported the software, in each case subject to the
|
|
35
|
+
limitations and conditions in this license. This license does not cover any
|
|
36
|
+
patent claims that you cause to be infringed by modifications or additions to
|
|
37
|
+
the software. If you or your company make any written claim that the software
|
|
38
|
+
infringes or contributes to infringement of any patent, your patent license for
|
|
39
|
+
the software granted under these terms ends immediately. If your company makes
|
|
40
|
+
such a claim, your patent license ends immediately for work on behalf of your
|
|
41
|
+
company.
|
|
42
|
+
|
|
43
|
+
## Notices
|
|
44
|
+
|
|
45
|
+
You must ensure that anyone who gets a copy of any part of the software from you
|
|
46
|
+
also gets a copy of these terms.
|
|
47
|
+
|
|
48
|
+
If you modify the software, you must include in any modified copies of the
|
|
49
|
+
software prominent notices stating that you have modified the software.
|
|
50
|
+
|
|
51
|
+
## No Other Rights
|
|
52
|
+
|
|
53
|
+
These terms do not imply any licenses other than those expressly granted in
|
|
54
|
+
these terms.
|
|
55
|
+
|
|
56
|
+
## Termination
|
|
57
|
+
|
|
58
|
+
If you use the software in violation of these terms, such use is not licensed,
|
|
59
|
+
and your licenses will automatically terminate. If the licensor provides you
|
|
60
|
+
with a notice of your violation, and you cease all violation of this license no
|
|
61
|
+
later than 30 days after you receive that notice, your licenses will be
|
|
62
|
+
reinstated retroactively. However, if you violate these terms after such
|
|
63
|
+
reinstatement, any additional violation of these terms will cause your licenses
|
|
64
|
+
to terminate automatically and permanently.
|
|
65
|
+
|
|
66
|
+
## No Liability
|
|
67
|
+
|
|
68
|
+
*As far as the law allows, the software comes as is, without any warranty or
|
|
69
|
+
condition, and the licensor will not be liable to you for any damages arising
|
|
70
|
+
out of these terms or the use or nature of the software, under any kind of
|
|
71
|
+
legal claim.*
|
|
72
|
+
|
|
73
|
+
## Definitions
|
|
74
|
+
|
|
75
|
+
The **licensor** is the entity offering these terms, and the **software** is the
|
|
76
|
+
software the licensor makes available under these terms, including any portion
|
|
77
|
+
of it.
|
|
78
|
+
|
|
79
|
+
**you** refers to the individual or entity agreeing to these terms.
|
|
80
|
+
|
|
81
|
+
**your company** is any legal entity, sole proprietorship, or other kind of
|
|
82
|
+
organization that you work for, plus all organizations that have control over,
|
|
83
|
+
are under the control of, or are under common control with that
|
|
84
|
+
organization. **control** means ownership of substantially all the assets of an
|
|
85
|
+
entity, or the power to direct its management and policies by vote, contract, or
|
|
86
|
+
otherwise. Control can be direct or indirect.
|
|
87
|
+
|
|
88
|
+
**your licenses** are all the licenses granted to you for the software under
|
|
89
|
+
these terms.
|
|
90
|
+
|
|
91
|
+
**use** means anything you do with the software requiring one of your licenses.
|
|
92
|
+
|
|
93
|
+
**trademark** means trademarks, service marks, and similar rights.
|