@elastic/eui 88.5.4 → 89.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/dist/eui_theme_dark.css +26 -526
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +26 -526
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/basic_table/basic_table.js +7 -2
- package/es/components/basic_table/in_memory_table.js +7 -2
- package/es/components/collapsible_nav/collapsible_nav.js +5 -0
- package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +4 -2
- package/es/components/color_picker/index.js +0 -4
- package/es/components/combo_box/combo_box.js +142 -304
- package/es/components/combo_box/combo_box_input/combo_box_input.js +0 -13
- package/es/components/combo_box/combo_box_options_list/combo_box_options_list.js +34 -118
- package/es/components/context_menu/context_menu_panel.js +6 -6
- package/es/components/flex/flex_grid.styles.js +1 -1
- package/es/components/flex/flex_group.styles.js +1 -1
- package/es/components/flyout/flyout.js +32 -33
- package/es/components/flyout/flyout.styles.js +13 -3
- package/es/components/form/range/dual_range.js +4 -0
- package/es/components/form/range/range.js +4 -0
- package/es/components/index.js +0 -1
- package/es/components/popover/input_popover.js +47 -3
- package/es/components/popover/popover.js +2 -2
- package/es/components/table/table_row_cell.js +27 -9
- package/es/components/text_truncate/index.js +1 -0
- package/es/components/text_truncate/text_block_truncate.js +78 -0
- package/es/global_styling/reset/global_styles.js +16 -2
- package/es/services/accessibility/index.js +0 -3
- package/es/services/index.js +1 -1
- package/es/test/rtl/component_helpers.d.ts +2 -0
- package/es/test/rtl/component_helpers.js +29 -1
- package/eui.d.ts +375 -667
- package/i18ntokens.json +52 -286
- package/lib/components/basic_table/basic_table.js +7 -2
- package/lib/components/basic_table/in_memory_table.js +7 -2
- package/lib/components/collapsible_nav/collapsible_nav.js +5 -0
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +4 -2
- package/lib/components/color_picker/index.js +0 -7
- package/lib/components/combo_box/combo_box.js +141 -303
- package/lib/components/combo_box/combo_box_input/combo_box_input.js +0 -13
- package/lib/components/combo_box/combo_box_options_list/combo_box_options_list.js +34 -118
- package/lib/components/context_menu/context_menu_panel.js +5 -5
- package/lib/components/flex/flex_grid.styles.js +1 -1
- package/lib/components/flex/flex_group.styles.js +1 -1
- package/lib/components/flyout/flyout.js +31 -32
- package/lib/components/flyout/flyout.styles.js +19 -10
- package/lib/components/form/range/dual_range.js +4 -0
- package/lib/components/index.js +0 -11
- package/lib/components/popover/input_popover.js +48 -3
- package/lib/components/popover/popover.js +1 -1
- package/lib/components/table/table_row_cell.js +26 -8
- package/lib/components/text_truncate/index.js +7 -0
- package/lib/components/text_truncate/text_block_truncate.js +85 -0
- package/lib/global_styling/reset/global_styles.js +16 -2
- package/lib/services/accessibility/index.js +0 -21
- package/lib/services/index.js +0 -21
- package/lib/test/rtl/component_helpers.d.ts +2 -0
- package/lib/test/rtl/component_helpers.js +31 -2
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +4 -2
- package/optimize/es/components/color_picker/index.js +0 -4
- package/optimize/es/components/combo_box/combo_box.js +137 -304
- package/optimize/es/components/combo_box/combo_box_input/combo_box_input.js +0 -12
- package/optimize/es/components/combo_box/combo_box_options_list/combo_box_options_list.js +28 -107
- package/optimize/es/components/context_menu/context_menu_panel.js +6 -6
- package/optimize/es/components/flex/flex_grid.styles.js +1 -1
- package/optimize/es/components/flex/flex_group.styles.js +1 -1
- package/optimize/es/components/flyout/flyout.js +32 -33
- package/optimize/es/components/flyout/flyout.styles.js +13 -3
- package/optimize/es/components/index.js +0 -1
- package/optimize/es/components/popover/input_popover.js +43 -3
- package/optimize/es/components/popover/popover.js +2 -2
- package/optimize/es/components/table/table_row_cell.js +13 -5
- package/optimize/es/components/text_truncate/index.js +1 -0
- package/optimize/es/components/text_truncate/text_block_truncate.js +58 -0
- package/optimize/es/global_styling/reset/global_styles.js +13 -2
- package/optimize/es/services/accessibility/index.js +0 -3
- package/optimize/es/services/index.js +1 -1
- package/optimize/es/test/rtl/component_helpers.d.ts +2 -0
- package/optimize/es/test/rtl/component_helpers.js +29 -1
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +4 -2
- package/optimize/lib/components/color_picker/index.js +0 -7
- package/optimize/lib/components/combo_box/combo_box.js +136 -303
- package/optimize/lib/components/combo_box/combo_box_input/combo_box_input.js +0 -12
- package/optimize/lib/components/combo_box/combo_box_options_list/combo_box_options_list.js +28 -107
- package/optimize/lib/components/context_menu/context_menu_panel.js +5 -5
- package/optimize/lib/components/flex/flex_grid.styles.js +1 -1
- package/optimize/lib/components/flex/flex_group.styles.js +1 -1
- package/optimize/lib/components/flyout/flyout.js +31 -32
- package/optimize/lib/components/flyout/flyout.styles.js +19 -10
- package/optimize/lib/components/index.js +0 -11
- package/optimize/lib/components/popover/input_popover.js +44 -3
- package/optimize/lib/components/popover/popover.js +1 -1
- package/optimize/lib/components/table/table_row_cell.js +12 -4
- package/optimize/lib/components/text_truncate/index.js +7 -0
- package/optimize/lib/components/text_truncate/text_block_truncate.js +66 -0
- package/optimize/lib/global_styling/reset/global_styles.js +19 -10
- package/optimize/lib/services/accessibility/index.js +0 -21
- package/optimize/lib/services/index.js +0 -21
- package/optimize/lib/test/rtl/component_helpers.d.ts +2 -0
- package/optimize/lib/test/rtl/component_helpers.js +31 -2
- package/package.json +1 -1
- package/src/components/combo_box/combo_box_options_list/_combo_box_options_list.scss +5 -15
- package/src/components/context_menu/_context_menu_panel.scss +4 -0
- package/src/components/index.scss +0 -1
- package/src/global_styling/mixins/_index.scss +0 -1
- package/src/global_styling/variables/_index.scss +0 -1
- package/src/test/README.md +0 -15
- package/src/themes/amsterdam/global_styling/mixins/_index.scss +0 -1
- package/test-env/components/basic_table/basic_table.js +7 -2
- package/test-env/components/basic_table/in_memory_table.js +7 -2
- package/test-env/components/collapsible_nav/collapsible_nav.js +5 -0
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +4 -2
- package/test-env/components/color_picker/index.js +0 -7
- package/test-env/components/combo_box/combo_box.js +141 -303
- package/test-env/components/combo_box/combo_box_input/combo_box_input.js +0 -13
- package/test-env/components/combo_box/combo_box_options_list/combo_box_options_list.js +33 -117
- package/test-env/components/context_menu/context_menu_panel.js +5 -5
- package/test-env/components/flex/flex_grid.styles.js +1 -1
- package/test-env/components/flex/flex_group.styles.js +1 -1
- package/test-env/components/flyout/flyout.styles.js +19 -10
- package/test-env/components/form/range/dual_range.js +4 -0
- package/test-env/components/index.js +0 -11
- package/test-env/components/popover/input_popover.js +48 -3
- package/test-env/components/popover/popover.js +1 -1
- package/test-env/components/table/table_row_cell.js +26 -8
- package/test-env/components/text_truncate/index.js +7 -0
- package/test-env/components/text_truncate/text_block_truncate.js +82 -0
- package/test-env/global_styling/reset/global_styles.js +19 -10
- package/test-env/services/accessibility/index.js +0 -21
- package/test-env/services/index.js +0 -21
- package/test-env/test/rtl/component_helpers.js +31 -2
- package/es/components/color_picker/color_stops/color_stop_thumb.js +0 -371
- package/es/components/color_picker/color_stops/color_stop_thumb.styles.js +0 -55
- package/es/components/color_picker/color_stops/color_stops.js +0 -499
- package/es/components/color_picker/color_stops/color_stops.styles.js +0 -61
- package/es/components/color_picker/color_stops/index.js +0 -9
- package/es/components/color_picker/color_stops/utils.js +0 -95
- package/es/components/suggest/index.js +0 -10
- package/es/components/suggest/suggest.a11y.js +0 -70
- package/es/components/suggest/suggest.js +0 -347
- package/es/components/suggest/suggest_item.js +0 -123
- package/es/components/suggest/types.js +0 -9
- package/es/services/accessibility/accessible_click_keys.js +0 -17
- package/es/services/accessibility/cascading_menu_keys.js +0 -28
- package/es/services/accessibility/combo_box_keys.js +0 -25
- package/lib/components/color_picker/color_stops/color_stop_thumb.js +0 -380
- package/lib/components/color_picker/color_stops/color_stop_thumb.styles.js +0 -62
- package/lib/components/color_picker/color_stops/color_stops.js +0 -505
- package/lib/components/color_picker/color_stops/color_stops.styles.js +0 -67
- package/lib/components/color_picker/color_stops/index.js +0 -12
- package/lib/components/color_picker/color_stops/utils.js +0 -108
- package/lib/components/suggest/index.js +0 -19
- package/lib/components/suggest/suggest.a11y.js +0 -73
- package/lib/components/suggest/suggest.js +0 -356
- package/lib/components/suggest/suggest_item.js +0 -130
- package/lib/components/suggest/types.js +0 -16
- package/lib/services/accessibility/accessible_click_keys.js +0 -21
- package/lib/services/accessibility/cascading_menu_keys.js +0 -35
- package/lib/services/accessibility/combo_box_keys.js +0 -32
- package/optimize/es/components/color_picker/color_stops/color_stop_thumb.js +0 -329
- package/optimize/es/components/color_picker/color_stops/color_stop_thumb.styles.js +0 -55
- package/optimize/es/components/color_picker/color_stops/color_stops.js +0 -444
- package/optimize/es/components/color_picker/color_stops/color_stops.styles.js +0 -61
- package/optimize/es/components/color_picker/color_stops/index.js +0 -9
- package/optimize/es/components/color_picker/color_stops/utils.js +0 -90
- package/optimize/es/components/suggest/index.js +0 -10
- package/optimize/es/components/suggest/suggest.a11y.js +0 -70
- package/optimize/es/components/suggest/suggest.js +0 -256
- package/optimize/es/components/suggest/suggest_item.js +0 -89
- package/optimize/es/components/suggest/types.js +0 -9
- package/optimize/es/services/accessibility/accessible_click_keys.js +0 -14
- package/optimize/es/services/accessibility/cascading_menu_keys.js +0 -28
- package/optimize/es/services/accessibility/combo_box_keys.js +0 -25
- package/optimize/lib/components/color_picker/color_stops/color_stop_thumb.js +0 -339
- package/optimize/lib/components/color_picker/color_stops/color_stop_thumb.styles.js +0 -62
- package/optimize/lib/components/color_picker/color_stops/color_stops.js +0 -451
- package/optimize/lib/components/color_picker/color_stops/color_stops.styles.js +0 -67
- package/optimize/lib/components/color_picker/color_stops/index.js +0 -12
- package/optimize/lib/components/color_picker/color_stops/utils.js +0 -106
- package/optimize/lib/components/suggest/index.js +0 -19
- package/optimize/lib/components/suggest/suggest.a11y.js +0 -73
- package/optimize/lib/components/suggest/suggest.js +0 -266
- package/optimize/lib/components/suggest/suggest_item.js +0 -96
- package/optimize/lib/components/suggest/types.js +0 -16
- package/optimize/lib/services/accessibility/accessible_click_keys.js +0 -20
- package/optimize/lib/services/accessibility/cascading_menu_keys.js +0 -35
- package/optimize/lib/services/accessibility/combo_box_keys.js +0 -32
- package/src/components/suggest/_index.scss +0 -5
- package/src/components/suggest/_suggest_input.scss +0 -4
- package/src/components/suggest/_suggest_item.scss +0 -103
- package/src/components/suggest/_variables.scss +0 -13
- package/src/global_styling/mixins/_header.scss +0 -29
- package/src/global_styling/variables/_header.scss +0 -3
- package/test-env/components/color_picker/color_stops/color_stop_thumb.js +0 -372
- package/test-env/components/color_picker/color_stops/color_stop_thumb.styles.js +0 -62
- package/test-env/components/color_picker/color_stops/color_stops.js +0 -494
- package/test-env/components/color_picker/color_stops/color_stops.styles.js +0 -67
- package/test-env/components/color_picker/color_stops/index.js +0 -12
- package/test-env/components/color_picker/color_stops/utils.js +0 -106
- package/test-env/components/suggest/index.js +0 -19
- package/test-env/components/suggest/suggest.a11y.js +0 -73
- package/test-env/components/suggest/suggest.js +0 -348
- package/test-env/components/suggest/suggest_item.js +0 -129
- package/test-env/components/suggest/types.js +0 -16
- package/test-env/services/accessibility/accessible_click_keys.js +0 -20
- package/test-env/services/accessibility/cascading_menu_keys.js +0 -35
- package/test-env/services/accessibility/combo_box_keys.js +0 -32
|
@@ -1,5 +1,5 @@
|
|
|
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
|
+
var _excluded = ["children", "className", "closePopover", "closeOnScroll", "disableFocusTrap", "focusTrapProps", "input", "fullWidth", "panelMinWidth", "onPanelResize", "inputRef", "panelRef"];
|
|
3
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
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
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; }
|
|
@@ -22,7 +22,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
22
22
|
* Side Public License, v 1.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
import React, { useState, useEffect, useCallback, useMemo, useRef } from 'react';
|
|
25
|
+
import React, { useState, useEffect, useCallback, useMemo, useRef, createContext } from 'react';
|
|
26
26
|
import PropTypes from "prop-types";
|
|
27
27
|
import { css } from '@emotion/react';
|
|
28
28
|
import classnames from 'classnames';
|
|
@@ -34,11 +34,15 @@ import { EuiFocusTrap } from '../focus_trap';
|
|
|
34
34
|
import { euiFormVariables } from '../form/form.styles';
|
|
35
35
|
import { EuiPopover } from './popover';
|
|
36
36
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
37
|
+
// Used by child components that want to know the parent popover width
|
|
38
|
+
export var EuiInputPopoverWidthContext = /*#__PURE__*/createContext(0);
|
|
37
39
|
export var EuiInputPopover = function EuiInputPopover(_ref) {
|
|
38
40
|
var _props$panelProps;
|
|
39
41
|
var children = _ref.children,
|
|
40
42
|
className = _ref.className,
|
|
41
43
|
closePopover = _ref.closePopover,
|
|
44
|
+
_ref$closeOnScroll = _ref.closeOnScroll,
|
|
45
|
+
closeOnScroll = _ref$closeOnScroll === void 0 ? false : _ref$closeOnScroll,
|
|
42
46
|
_ref$disableFocusTrap = _ref.disableFocusTrap,
|
|
43
47
|
disableFocusTrap = _ref$disableFocusTrap === void 0 ? false : _ref$disableFocusTrap,
|
|
44
48
|
focusTrapProps = _ref.focusTrapProps,
|
|
@@ -119,6 +123,40 @@ export var EuiInputPopover = function EuiInputPopover(_ref) {
|
|
|
119
123
|
}
|
|
120
124
|
}
|
|
121
125
|
}, [disableFocusTrap, closePopover, panelPropsOnKeyDown]);
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Optional close on scroll behavior
|
|
129
|
+
*/
|
|
130
|
+
|
|
131
|
+
useEffect(function () {
|
|
132
|
+
// When the popover opens, add a scroll listener to the page (& remove it after)
|
|
133
|
+
if (closeOnScroll && panelEl) {
|
|
134
|
+
// Close the popover, but only if the scroll event occurs outside the input or the popover itself
|
|
135
|
+
var closePopoverOnScroll = function closePopoverOnScroll(event) {
|
|
136
|
+
if (!panelEl || !inputEl || !event.target) return;
|
|
137
|
+
var scrollTarget = event.target;
|
|
138
|
+
if (panelEl.contains(scrollTarget) === false && inputEl.contains(scrollTarget) === false) {
|
|
139
|
+
closePopover();
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
// Firefox will trigger a scroll event in many common situations when the options list div is appended
|
|
144
|
+
// to the DOM; in testing it was always within 100ms, but setting a timeout here for 500ms to be safe
|
|
145
|
+
var timeoutId = setTimeout(function () {
|
|
146
|
+
window.addEventListener('scroll', closePopoverOnScroll, {
|
|
147
|
+
passive: true,
|
|
148
|
+
// for better performance as we won't call preventDefault
|
|
149
|
+
capture: true // scroll events don't bubble, they must be captured instead
|
|
150
|
+
});
|
|
151
|
+
}, 500);
|
|
152
|
+
return function () {
|
|
153
|
+
window.removeEventListener('scroll', closePopoverOnScroll, {
|
|
154
|
+
capture: true
|
|
155
|
+
});
|
|
156
|
+
clearTimeout(timeoutId);
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
}, [closeOnScroll, closePopover, panelEl, inputEl]);
|
|
122
160
|
return ___EmotionJSX(EuiPopover, _extends({
|
|
123
161
|
css: /*#__PURE__*/css(fullWidth ? undefined : logicalCSS('max-width', form.maxWidth), ";label:EuiInputPopover;"),
|
|
124
162
|
repositionToCrossAxis: false,
|
|
@@ -136,7 +174,9 @@ export var EuiInputPopover = function EuiInputPopover(_ref) {
|
|
|
136
174
|
}), ___EmotionJSX(EuiFocusTrap, _extends({
|
|
137
175
|
clickOutsideDisables: true,
|
|
138
176
|
disabled: disableFocusTrap
|
|
139
|
-
}, focusTrapProps),
|
|
177
|
+
}, focusTrapProps), ___EmotionJSX(EuiInputPopoverWidthContext.Provider, {
|
|
178
|
+
value: panelWidth
|
|
179
|
+
}, children)));
|
|
140
180
|
};
|
|
141
181
|
EuiInputPopover.propTypes = {
|
|
142
182
|
className: PropTypes.string,
|
|
@@ -148,6 +188,10 @@ EuiInputPopover.propTypes = {
|
|
|
148
188
|
*/
|
|
149
189
|
anchorPosition: PropTypes.oneOf(["downLeft", "downRight", "downCenter"]),
|
|
150
190
|
disableFocusTrap: PropTypes.bool,
|
|
191
|
+
/**
|
|
192
|
+
* Allows automatically closing the input popover on page scroll
|
|
193
|
+
*/
|
|
194
|
+
closeOnScroll: PropTypes.bool,
|
|
151
195
|
fullWidth: PropTypes.bool,
|
|
152
196
|
input: PropTypes.any.isRequired,
|
|
153
197
|
inputRef: PropTypes.any,
|
|
@@ -42,7 +42,7 @@ import React, { Component } from 'react';
|
|
|
42
42
|
import classNames from 'classnames';
|
|
43
43
|
import { focusable } from 'tabbable';
|
|
44
44
|
import { EuiFocusTrap } from '../focus_trap';
|
|
45
|
-
import {
|
|
45
|
+
import { keys, getTransitionTimings, getWaitDuration, performOnFrame, htmlIdGenerator } from '../../services';
|
|
46
46
|
import { EuiScreenReaderOnly } from '../accessibility';
|
|
47
47
|
import { EuiPortal } from '../portal';
|
|
48
48
|
import { EuiMutationObserver } from '../observer/mutation_observer';
|
|
@@ -139,7 +139,7 @@ export var EuiPopover = /*#__PURE__*/function (_Component) {
|
|
|
139
139
|
}, closingTransitionTime);
|
|
140
140
|
});
|
|
141
141
|
_defineProperty(_assertThisInitialized(_this), "onKeyDown", function (event) {
|
|
142
|
-
if (event.key ===
|
|
142
|
+
if (event.key === keys.ESCAPE) {
|
|
143
143
|
_this.onEscapeKey(event);
|
|
144
144
|
}
|
|
145
145
|
});
|
|
@@ -16,10 +16,12 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
16
16
|
* Side Public License, v 1.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import React, {
|
|
19
|
+
import React, { useCallback } from 'react';
|
|
20
20
|
import PropTypes from "prop-types";
|
|
21
21
|
import classNames from 'classnames';
|
|
22
22
|
import { LEFT_ALIGNMENT, RIGHT_ALIGNMENT, CENTER_ALIGNMENT, useIsWithinBreakpoints } from '../../services';
|
|
23
|
+
import { isObject } from '../../services/predicate';
|
|
24
|
+
import { EuiTextBlockTruncate } from '../text_truncate';
|
|
23
25
|
import { resolveWidthAsStyle } from './utils';
|
|
24
26
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
25
27
|
export var EuiTableRowCell = function EuiTableRowCell(_ref) {
|
|
@@ -54,7 +56,7 @@ export var EuiTableRowCell = function EuiTableRowCell(_ref) {
|
|
|
54
56
|
'euiTableCellContent--alignRight': align === RIGHT_ALIGNMENT,
|
|
55
57
|
'euiTableCellContent--alignCenter': align === CENTER_ALIGNMENT,
|
|
56
58
|
'euiTableCellContent--showOnHover': showOnHover,
|
|
57
|
-
'euiTableCellContent--truncateText': truncateText,
|
|
59
|
+
'euiTableCellContent--truncateText': truncateText === true,
|
|
58
60
|
// We're doing this rigamarole instead of creating `euiTableCellContent--textOnly` for BWC
|
|
59
61
|
// purposes for the time-being.
|
|
60
62
|
'euiTableCellContent--overflowingContent': textOnly !== true
|
|
@@ -74,7 +76,7 @@ export var EuiTableRowCell = function EuiTableRowCell(_ref) {
|
|
|
74
76
|
});
|
|
75
77
|
var widthValue = useIsWithinBreakpoints(['xs', 's']) && mobileOptions.width ? mobileOptions.width : width;
|
|
76
78
|
var styleObj = resolveWidthAsStyle(style, widthValue);
|
|
77
|
-
|
|
79
|
+
var modifyChildren = useCallback(function (children) {
|
|
78
80
|
var modifiedChildren = children;
|
|
79
81
|
if (textOnly === true) {
|
|
80
82
|
modifiedChildren = ___EmotionJSX("span", {
|
|
@@ -87,8 +89,14 @@ export var EuiTableRowCell = function EuiTableRowCell(_ref) {
|
|
|
87
89
|
});
|
|
88
90
|
});
|
|
89
91
|
}
|
|
92
|
+
if (isObject(truncateText) && truncateText.lines) {
|
|
93
|
+
modifiedChildren = ___EmotionJSX(EuiTextBlockTruncate, {
|
|
94
|
+
lines: truncateText.lines,
|
|
95
|
+
cloneElement: true
|
|
96
|
+
}, modifiedChildren);
|
|
97
|
+
}
|
|
90
98
|
return modifiedChildren;
|
|
91
|
-
}
|
|
99
|
+
}, [childClasses, textOnly, truncateText]);
|
|
92
100
|
var childrenNode = modifyChildren(children);
|
|
93
101
|
var hideForMobileClasses = 'euiTableRowCell--hideForMobile';
|
|
94
102
|
var showForMobileClasses = 'euiTableRowCell--hideForDesktop';
|
|
@@ -108,7 +116,7 @@ export var EuiTableRowCell = function EuiTableRowCell(_ref) {
|
|
|
108
116
|
className: cellClasses
|
|
109
117
|
}, sharedProps), mobileOptions.header && ___EmotionJSX("div", {
|
|
110
118
|
className: "euiTableRowCell__mobileHeader ".concat(showForMobileClasses)
|
|
111
|
-
}, mobileOptions.header), mobileOptions.render ? ___EmotionJSX(Fragment, null, ___EmotionJSX("div", {
|
|
119
|
+
}, mobileOptions.header), mobileOptions.render ? ___EmotionJSX(React.Fragment, null, ___EmotionJSX("div", {
|
|
112
120
|
className: "".concat(mobileContentClasses, " ").concat(showForMobileClasses)
|
|
113
121
|
}, modifyChildren(mobileOptions.render)), ___EmotionJSX("div", {
|
|
114
122
|
className: "".concat(contentClasses, " ").concat(hideForMobileClasses)
|
|
@@ -184,9 +192,14 @@ EuiTableRowCell.propTypes = {
|
|
|
184
192
|
*/
|
|
185
193
|
textOnly: PropTypes.bool,
|
|
186
194
|
/**
|
|
187
|
-
*
|
|
195
|
+
* Indicates whether this column should truncate overflowing text content.
|
|
196
|
+
* - Set to `true` to enable single-line truncation.
|
|
197
|
+
* - To enable multi-line truncation, use a configuration object with `lines`
|
|
198
|
+
* set to a number of lines to truncate to.
|
|
188
199
|
*/
|
|
189
|
-
truncateText: PropTypes.bool
|
|
200
|
+
truncateText: PropTypes.oneOfType([PropTypes.bool.isRequired, PropTypes.shape({
|
|
201
|
+
lines: PropTypes.number.isRequired
|
|
202
|
+
}).isRequired])
|
|
190
203
|
}),
|
|
191
204
|
/**
|
|
192
205
|
* Horizontal alignment of the text in the cell
|
|
@@ -202,8 +215,13 @@ EuiTableRowCell.propTypes = {
|
|
|
202
215
|
*/
|
|
203
216
|
textOnly: PropTypes.bool,
|
|
204
217
|
/**
|
|
205
|
-
*
|
|
218
|
+
* Indicates whether this column should truncate overflowing text content.
|
|
219
|
+
* - Set to `true` to enable single-line truncation.
|
|
220
|
+
* - To enable multi-line truncation, use a configuration object with `lines`
|
|
221
|
+
* set to a number of lines to truncate to.
|
|
206
222
|
*/
|
|
207
|
-
truncateText: PropTypes.bool,
|
|
223
|
+
truncateText: PropTypes.oneOfType([PropTypes.bool.isRequired, PropTypes.shape({
|
|
224
|
+
lines: PropTypes.number.isRequired
|
|
225
|
+
}).isRequired]),
|
|
208
226
|
width: PropTypes.any
|
|
209
227
|
};
|
|
@@ -0,0 +1,78 @@
|
|
|
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", "style", "lines", "cloneElement"];
|
|
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); }
|
|
9
|
+
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; }
|
|
10
|
+
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; }
|
|
11
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
12
|
+
import PropTypes from "prop-types";
|
|
13
|
+
/*
|
|
14
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
15
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
16
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
17
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
18
|
+
* Side Public License, v 1.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import React, { isValidElement, useMemo } from 'react';
|
|
22
|
+
import { css } from '@emotion/react';
|
|
23
|
+
import classNames from 'classnames';
|
|
24
|
+
import { cloneElementWithCss } from '../../services';
|
|
25
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
26
|
+
var styles = {
|
|
27
|
+
euiTextBlockTruncate: process.env.NODE_ENV === "production" ? {
|
|
28
|
+
name: "1cfm3ge-euiTextBlockTruncate",
|
|
29
|
+
styles: "display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:0;overflow:hidden;label:euiTextBlockTruncate;"
|
|
30
|
+
} : {
|
|
31
|
+
name: "1cfm3ge-euiTextBlockTruncate",
|
|
32
|
+
styles: "display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:0;overflow:hidden;label:euiTextBlockTruncate;",
|
|
33
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
export var EuiTextBlockTruncate = function EuiTextBlockTruncate(_ref) {
|
|
37
|
+
var children = _ref.children,
|
|
38
|
+
className = _ref.className,
|
|
39
|
+
style = _ref.style,
|
|
40
|
+
lines = _ref.lines,
|
|
41
|
+
cloneElement = _ref.cloneElement,
|
|
42
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
43
|
+
var classes = classNames('euiTextBlockTruncate', className);
|
|
44
|
+
var cssStyles = styles.euiTextBlockTruncate;
|
|
45
|
+
var inlineStyles = useMemo(function () {
|
|
46
|
+
return _objectSpread({
|
|
47
|
+
WebkitLineClamp: lines
|
|
48
|
+
}, style);
|
|
49
|
+
}, [lines, style]);
|
|
50
|
+
if ( /*#__PURE__*/isValidElement(children) && cloneElement) {
|
|
51
|
+
return cloneElementWithCss(children, {
|
|
52
|
+
css: cssStyles,
|
|
53
|
+
style: _objectSpread(_objectSpread({}, children.props.style), inlineStyles),
|
|
54
|
+
className: classNames(children.props.className, classes)
|
|
55
|
+
});
|
|
56
|
+
} else {
|
|
57
|
+
return ___EmotionJSX("div", _extends({
|
|
58
|
+
className: classes,
|
|
59
|
+
css: cssStyles,
|
|
60
|
+
style: inlineStyles
|
|
61
|
+
}, rest), children);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
EuiTextBlockTruncate.propTypes = {
|
|
65
|
+
className: PropTypes.string,
|
|
66
|
+
"aria-label": PropTypes.string,
|
|
67
|
+
"data-test-subj": PropTypes.string,
|
|
68
|
+
css: PropTypes.any,
|
|
69
|
+
/**
|
|
70
|
+
* Number of lines of text to truncate to
|
|
71
|
+
*/
|
|
72
|
+
lines: PropTypes.number.isRequired,
|
|
73
|
+
/**
|
|
74
|
+
* Applies styling to the child element instead of rendering a parent wrapper `div`.
|
|
75
|
+
* Can only be used when wrapping a *single* child element/tag, and not raw text.
|
|
76
|
+
*/
|
|
77
|
+
cloneElement: PropTypes.bool
|
|
78
|
+
};
|
|
@@ -1,3 +1,9 @@
|
|
|
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
|
+
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; }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
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); }
|
|
1
7
|
function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure " + obj); }
|
|
2
8
|
/*
|
|
3
9
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
@@ -37,12 +43,20 @@ export var EuiGlobalStyles = function EuiGlobalStyles(_ref) {
|
|
|
37
43
|
* This font reset sets all our base font/typography related properties
|
|
38
44
|
* that are needed to override browser-specific element settings.
|
|
39
45
|
*/
|
|
40
|
-
var
|
|
46
|
+
var fontBodyScale = font.scale[font.body.scale];
|
|
47
|
+
var fontReset = {
|
|
48
|
+
fontFamily: font.family,
|
|
49
|
+
fontSize: "".concat(font.defaultUnits === 'px' ? fontBodyScale * base : fontBodyScale).concat(font.defaultUnits),
|
|
50
|
+
lineHeight: base / (fontBodyScale * base),
|
|
51
|
+
fontWeight: font.weight[font.body.weight]
|
|
52
|
+
};
|
|
41
53
|
|
|
42
54
|
/**
|
|
43
55
|
* Final styles
|
|
44
56
|
*/
|
|
45
|
-
var styles = /*#__PURE__*/css(reset, " html{", scrollbarStyles, " ", fontReset, " text-size-adjust:100%;font-kerning:normal;", logicalCSS('height', '100%'), " background-color:", colors.body, ";color:", colors.text, ";}code,pre,kbd,samp{font-family:", font.familyCode, ";}input,textarea,select{",
|
|
57
|
+
var styles = /*#__PURE__*/css(reset, " html{", scrollbarStyles, " ", fontReset, " text-size-adjust:100%;font-kerning:normal;", logicalCSS('height', '100%'), " background-color:", colors.body, ";color:", colors.text, ";}code,pre,kbd,samp{font-family:", font.familyCode, ";}input,textarea,select{", _objectSpread(_objectSpread({}, fontReset), {}, {
|
|
58
|
+
fontSize: '1rem' // Inherit from html root
|
|
59
|
+
}), ";}select:disabled{opacity:1;}button{font-family:", font.family, ";}em{font-style:italic;}strong{font-weight:", font.weight.bold, ";}*:focus{", euiFocusRing(euiThemeContext), ";}::selection{background:", transparentize(colors.primary, colorMode === 'LIGHT' ? 0.1 : 0.2), ";}a{color:", colors.primaryText, ";&,&:hover,&:focus{text-decoration:none;}}.euiBody-hasPortalContent{position:relative;};label:styles;");
|
|
46
60
|
return ___EmotionJSX(Global, {
|
|
47
61
|
styles: styles
|
|
48
62
|
});
|
|
@@ -6,7 +6,4 @@
|
|
|
6
6
|
* Side Public License, v 1.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
export { accessibleClickKeys } from './accessible_click_keys';
|
|
10
|
-
export { cascadingMenuKeys } from './cascading_menu_keys';
|
|
11
|
-
export { comboBoxKeys } from './combo_box_keys';
|
|
12
9
|
export { htmlIdGenerator, useGeneratedHtmlId } from './html_id_generator';
|
package/es/services/index.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
// Export all keys under a `keys` named variable
|
|
10
10
|
import * as keys from './keys';
|
|
11
|
-
export {
|
|
11
|
+
export { htmlIdGenerator, useGeneratedHtmlId } from './accessibility';
|
|
12
12
|
export { CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT } from './alignment';
|
|
13
13
|
export { CurrentEuiBreakpointContext, CurrentEuiBreakpointProvider, useCurrentEuiBreakpoint, useIsWithinBreakpoints, useIsWithinMaxBreakpoint, useIsWithinMinBreakpoint } from './breakpoint';
|
|
14
14
|
export { CanvasTextUtils } from './canvas';
|
|
@@ -8,3 +8,5 @@ export declare const waitForEuiPopoverClose: () => Promise<void>;
|
|
|
8
8
|
|
|
9
9
|
export declare const waitForEuiToolTipVisible: () => Promise<void>;
|
|
10
10
|
export declare const waitForEuiToolTipHidden: () => Promise<void>;
|
|
11
|
+
|
|
12
|
+
export declare const showEuiComboBoxOptions: () => Promise<void>;
|
|
@@ -11,7 +11,8 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import '@testing-library/jest-dom';
|
|
14
|
-
import { waitFor } from '@testing-library/react';
|
|
14
|
+
import { waitFor, fireEvent } from '@testing-library/react';
|
|
15
|
+
import { screen } from './custom_render';
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* Ensure the EuiPopover being tested is open/closed before continuing
|
|
@@ -112,4 +113,31 @@ export var waitForEuiToolTipHidden = /*#__PURE__*/function () {
|
|
|
112
113
|
return function waitForEuiToolTipHidden() {
|
|
113
114
|
return _ref4.apply(this, arguments);
|
|
114
115
|
};
|
|
116
|
+
}();
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Doot doo
|
|
120
|
+
*/
|
|
121
|
+
export var showEuiComboBoxOptions = /*#__PURE__*/function () {
|
|
122
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
123
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
124
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
125
|
+
case 0:
|
|
126
|
+
fireEvent.click(screen.getByTestSubject('comboBoxToggleListButton'));
|
|
127
|
+
_context5.next = 3;
|
|
128
|
+
return waitForEuiPopoverOpen();
|
|
129
|
+
case 3:
|
|
130
|
+
_context5.next = 5;
|
|
131
|
+
return waitFor(function () {
|
|
132
|
+
expect(screen.getByRole('listbox')).toBeInTheDocument();
|
|
133
|
+
});
|
|
134
|
+
case 5:
|
|
135
|
+
case "end":
|
|
136
|
+
return _context5.stop();
|
|
137
|
+
}
|
|
138
|
+
}, _callee5);
|
|
139
|
+
}));
|
|
140
|
+
return function showEuiComboBoxOptions() {
|
|
141
|
+
return _ref5.apply(this, arguments);
|
|
142
|
+
};
|
|
115
143
|
}();
|