@elastic/eui 70.0.0 → 70.2.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 +11 -180
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +11 -180
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/accessibility/screen_reader_only/screen_reader_only.js +1 -1
- package/es/components/accessibility/screen_reader_only/screen_reader_only.styles.js +1 -1
- package/es/components/accordion/accordion.a11y.js +35 -0
- package/es/components/badge/beta_badge/beta_badge.js +6 -6
- package/es/components/basic_table/in_memory_table.js +8 -0
- package/es/components/button/button_display/_button_display.js +7 -6
- package/es/components/button/button_display/_button_display.styles.js +4 -4
- package/es/components/button/button_display/_button_display_content.js +6 -9
- package/es/components/button/button_display/_button_display_content.styles.js +3 -41
- package/es/components/card/card.js +13 -31
- package/es/components/card/card.styles.js +15 -3
- package/es/components/card/card_select/card_select.styles.js +4 -4
- package/es/components/card/checkable_card/checkable_card.js +3 -2
- package/es/components/context_menu/context_menu_panel.a11y.js +34 -0
- package/es/components/datagrid/controls/column_selector.js +1 -1
- package/es/components/datagrid/controls/column_sorting.js +1 -1
- package/es/components/datagrid/controls/data_grid_toolbar.js +6 -2
- package/es/components/datagrid/controls/index.js +1 -0
- package/es/components/datagrid/controls/keyboard_shortcuts.js +191 -0
- package/es/components/datagrid/data_grid.js +12 -2
- package/es/components/date_picker/super_date_picker/super_date_picker.js +22 -4
- package/es/components/header/header_links/header_links.js +6 -0
- package/es/components/loading/loading_spinner.js +14 -3
- package/es/components/loading/loading_spinner.styles.js +11 -7
- package/es/components/modal/modal.js +17 -2
- package/es/components/page_template/page_template.js +6 -9
- package/es/components/popover/popover.js +13 -3
- package/es/components/popover/popover_arrow/_popover_arrow.js +1 -0
- package/es/components/popover/popover_panel/_popover_panel.js +8 -2
- package/es/components/popover/popover_panel/_popover_panel.styles.js +15 -1
- package/es/components/search_bar/search_bar.js +39 -5
- package/es/components/search_bar/search_box.js +37 -4
- package/es/components/selectable/selectable.a11y.js +118 -0
- package/es/components/selectable/selectable.js +9 -6
- package/es/components/tabs/tab.js +31 -7
- package/es/components/tabs/tab.styles.js +63 -0
- package/es/components/tabs/tabbed_content/tabbed_content.js +17 -1
- package/es/components/tabs/tabs.js +20 -14
- package/es/components/tabs/tabs.styles.js +21 -0
- package/es/components/tour/tour_step.js +6 -0
- package/es/services/string/to_initials.js +1 -1
- package/eui.d.ts +305 -198
- package/i18ntokens.json +442 -10
- package/lib/components/accessibility/screen_reader_only/screen_reader_only.js +1 -1
- package/lib/components/accessibility/screen_reader_only/screen_reader_only.styles.js +1 -1
- package/lib/components/accordion/accordion.a11y.js +44 -0
- package/lib/components/badge/beta_badge/beta_badge.js +6 -10
- package/lib/components/basic_table/in_memory_table.js +8 -0
- package/lib/components/button/button_display/_button_display.js +7 -6
- package/lib/components/button/button_display/_button_display.styles.js +4 -4
- package/lib/components/button/button_display/_button_display_content.js +6 -9
- package/lib/components/button/button_display/_button_display_content.styles.js +10 -40
- package/lib/components/card/card.js +14 -33
- package/lib/components/card/card.styles.js +15 -3
- package/lib/components/card/card_select/card_select.styles.js +4 -4
- package/lib/components/card/checkable_card/checkable_card.js +3 -2
- package/lib/components/context_menu/context_menu_panel.a11y.js +42 -0
- package/lib/components/datagrid/controls/column_selector.js +1 -1
- package/lib/components/datagrid/controls/column_sorting.js +1 -1
- package/lib/components/datagrid/controls/data_grid_toolbar.js +7 -2
- package/lib/components/datagrid/controls/index.js +8 -0
- package/lib/components/datagrid/controls/keyboard_shortcuts.js +208 -0
- package/lib/components/datagrid/data_grid.js +11 -1
- package/lib/components/date_picker/super_date_picker/super_date_picker.js +22 -4
- package/lib/components/header/header_links/header_links.js +6 -0
- package/lib/components/loading/loading_spinner.js +13 -2
- package/lib/components/loading/loading_spinner.styles.js +14 -6
- package/lib/components/modal/modal.js +23 -2
- package/lib/components/page_template/page_template.js +6 -9
- package/lib/components/popover/popover.js +13 -3
- package/lib/components/popover/popover_arrow/_popover_arrow.js +1 -0
- package/lib/components/popover/popover_panel/_popover_panel.js +8 -2
- package/lib/components/popover/popover_panel/_popover_panel.styles.js +16 -1
- package/lib/components/search_bar/search_bar.js +40 -5
- package/lib/components/search_bar/search_box.js +38 -4
- package/lib/components/selectable/selectable.a11y.js +122 -0
- package/lib/components/selectable/selectable.js +9 -6
- package/lib/components/tabs/tab.js +31 -6
- package/lib/components/tabs/tab.styles.js +69 -0
- package/lib/components/tabs/tabbed_content/tabbed_content.js +17 -1
- package/lib/components/tabs/tabs.js +24 -14
- package/lib/components/tabs/tabs.styles.js +32 -0
- package/lib/services/string/to_initials.js +1 -1
- package/optimize/es/components/accessibility/screen_reader_only/screen_reader_only.styles.js +1 -1
- package/optimize/es/components/accordion/accordion.a11y.js +35 -0
- package/optimize/es/components/badge/beta_badge/beta_badge.js +6 -6
- package/optimize/es/components/button/button_display/_button_display.js +6 -5
- package/optimize/es/components/button/button_display/_button_display.styles.js +4 -4
- package/optimize/es/components/button/button_display/_button_display_content.js +6 -9
- package/optimize/es/components/button/button_display/_button_display_content.styles.js +3 -41
- package/optimize/es/components/card/card.js +12 -30
- package/optimize/es/components/card/card.styles.js +15 -3
- package/optimize/es/components/card/card_select/card_select.styles.js +4 -4
- package/optimize/es/components/card/checkable_card/checkable_card.js +3 -2
- package/optimize/es/components/context_menu/context_menu_panel.a11y.js +34 -0
- package/optimize/es/components/datagrid/controls/column_selector.js +1 -1
- package/optimize/es/components/datagrid/controls/column_sorting.js +1 -1
- package/optimize/es/components/datagrid/controls/data_grid_toolbar.js +6 -2
- package/optimize/es/components/datagrid/controls/index.js +1 -0
- package/optimize/es/components/datagrid/controls/keyboard_shortcuts.js +181 -0
- package/optimize/es/components/datagrid/data_grid.js +6 -2
- package/optimize/es/components/date_picker/super_date_picker/super_date_picker.js +12 -4
- package/optimize/es/components/loading/loading_spinner.js +13 -3
- package/optimize/es/components/loading/loading_spinner.styles.js +11 -7
- package/optimize/es/components/modal/modal.js +17 -2
- package/optimize/es/components/page_template/page_template.js +6 -9
- package/optimize/es/components/popover/popover.js +7 -3
- package/optimize/es/components/popover/popover_arrow/_popover_arrow.js +1 -0
- package/optimize/es/components/popover/popover_panel/_popover_panel.js +6 -1
- package/optimize/es/components/popover/popover_panel/_popover_panel.styles.js +15 -1
- package/optimize/es/components/search_bar/search_bar.js +31 -5
- package/optimize/es/components/search_bar/search_box.js +29 -3
- package/optimize/es/components/selectable/selectable.a11y.js +107 -0
- package/optimize/es/components/selectable/selectable.js +9 -6
- package/optimize/es/components/tabs/tab.js +19 -7
- package/optimize/es/components/tabs/tab.styles.js +63 -0
- package/optimize/es/components/tabs/tabs.js +20 -14
- package/optimize/es/components/tabs/tabs.styles.js +21 -0
- package/optimize/es/services/string/to_initials.js +1 -1
- package/optimize/lib/components/accessibility/screen_reader_only/screen_reader_only.styles.js +1 -1
- package/optimize/lib/components/accordion/accordion.a11y.js +44 -0
- package/optimize/lib/components/badge/beta_badge/beta_badge.js +6 -13
- package/optimize/lib/components/button/button_display/_button_display.js +7 -6
- package/optimize/lib/components/button/button_display/_button_display.styles.js +4 -4
- package/optimize/lib/components/button/button_display/_button_display_content.js +6 -9
- package/optimize/lib/components/button/button_display/_button_display_content.styles.js +10 -40
- package/optimize/lib/components/card/card.js +13 -32
- package/optimize/lib/components/card/card.styles.js +15 -3
- package/optimize/lib/components/card/card_select/card_select.styles.js +4 -4
- package/optimize/lib/components/card/checkable_card/checkable_card.js +3 -2
- package/optimize/lib/components/context_menu/context_menu_panel.a11y.js +42 -0
- package/optimize/lib/components/datagrid/controls/column_selector.js +1 -1
- package/optimize/lib/components/datagrid/controls/column_sorting.js +1 -1
- package/optimize/lib/components/datagrid/controls/data_grid_toolbar.js +7 -2
- package/optimize/lib/components/datagrid/controls/index.js +8 -0
- package/optimize/lib/components/datagrid/controls/keyboard_shortcuts.js +207 -0
- package/optimize/lib/components/datagrid/data_grid.js +5 -1
- package/optimize/lib/components/date_picker/super_date_picker/super_date_picker.js +12 -4
- package/optimize/lib/components/loading/loading_spinner.js +14 -2
- package/optimize/lib/components/loading/loading_spinner.styles.js +14 -6
- package/optimize/lib/components/modal/modal.js +22 -2
- package/optimize/lib/components/page_template/page_template.js +6 -9
- package/optimize/lib/components/popover/popover.js +7 -3
- package/optimize/lib/components/popover/popover_arrow/_popover_arrow.js +1 -0
- package/optimize/lib/components/popover/popover_panel/_popover_panel.js +6 -1
- package/optimize/lib/components/popover/popover_panel/_popover_panel.styles.js +16 -1
- package/optimize/lib/components/search_bar/search_bar.js +31 -5
- package/optimize/lib/components/search_bar/search_box.js +30 -3
- package/optimize/lib/components/selectable/selectable.a11y.js +122 -0
- package/optimize/lib/components/selectable/selectable.js +9 -6
- package/optimize/lib/components/tabs/tab.js +19 -6
- package/optimize/lib/components/tabs/tab.styles.js +69 -0
- package/optimize/lib/components/tabs/tabs.js +24 -14
- package/optimize/lib/components/tabs/tabs.styles.js +32 -0
- package/optimize/lib/services/string/to_initials.js +1 -1
- package/package.json +5 -4
- package/src/components/datagrid/_index.scss +1 -0
- package/src/components/datagrid/controls/_data_grid_keyboard_shortcuts.scss +17 -0
- package/src/components/datagrid/controls/_data_grid_toolbar.scss +0 -8
- package/src/components/index.scss +0 -1
- package/src/components/modal/_modal.scss +3 -1
- package/src/themes/amsterdam/overrides/_index.scss +0 -1
- package/test-env/components/accessibility/screen_reader_only/screen_reader_only.js +1 -1
- package/test-env/components/accessibility/screen_reader_only/screen_reader_only.styles.js +1 -1
- package/test-env/components/accordion/accordion.a11y.js +44 -0
- package/test-env/components/badge/beta_badge/beta_badge.js +6 -13
- package/test-env/components/basic_table/in_memory_table.js +8 -0
- package/test-env/components/button/button_display/_button_display.js +7 -6
- package/test-env/components/button/button_display/_button_display.styles.js +4 -4
- package/test-env/components/button/button_display/_button_display_content.js +6 -9
- package/test-env/components/button/button_display/_button_display_content.styles.js +10 -40
- package/test-env/components/card/card.js +14 -33
- package/test-env/components/card/card.styles.js +15 -3
- package/test-env/components/card/card_select/card_select.styles.js +4 -4
- package/test-env/components/card/checkable_card/checkable_card.js +3 -2
- package/test-env/components/context_menu/context_menu_panel.a11y.js +42 -0
- package/test-env/components/datagrid/controls/column_selector.js +1 -1
- package/test-env/components/datagrid/controls/column_sorting.js +1 -1
- package/test-env/components/datagrid/controls/data_grid_toolbar.js +7 -2
- package/test-env/components/datagrid/controls/index.js +8 -0
- package/test-env/components/datagrid/controls/keyboard_shortcuts.js +207 -0
- package/test-env/components/datagrid/data_grid.js +11 -1
- package/test-env/components/date_picker/super_date_picker/super_date_picker.js +22 -4
- package/test-env/components/header/header_links/header_links.js +6 -0
- package/test-env/components/loading/loading_spinner.js +14 -2
- package/test-env/components/loading/loading_spinner.styles.js +14 -6
- package/test-env/components/modal/modal.js +22 -2
- package/test-env/components/page_template/page_template.js +6 -9
- package/test-env/components/popover/popover.js +13 -3
- package/test-env/components/popover/popover_arrow/_popover_arrow.js +1 -0
- package/test-env/components/popover/popover_panel/_popover_panel.js +8 -2
- package/test-env/components/popover/popover_panel/_popover_panel.styles.js +16 -1
- package/test-env/components/search_bar/search_bar.js +39 -5
- package/test-env/components/search_bar/search_box.js +38 -4
- package/test-env/components/selectable/selectable.a11y.js +122 -0
- package/test-env/components/selectable/selectable.js +9 -6
- package/test-env/components/tabs/tab.js +31 -6
- package/test-env/components/tabs/tab.styles.js +69 -0
- package/test-env/components/tabs/tabbed_content/tabbed_content.js +17 -1
- package/test-env/components/tabs/tabs.js +24 -14
- package/test-env/components/tabs/tabs.styles.js +32 -0
- package/test-env/services/string/to_initials.js +1 -1
- package/src/components/tabs/_index.scss +0 -1
- package/src/components/tabs/_tabs.scss +0 -110
- package/src/themes/amsterdam/overrides/_tabs.scss +0 -80
|
@@ -2,6 +2,10 @@ var _excluded = ["schema"];
|
|
|
2
2
|
|
|
3
3
|
function _extends() { _extends = Object.assign || 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
|
|
|
5
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
6
|
+
|
|
7
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
8
|
+
|
|
5
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; }
|
|
6
10
|
|
|
7
11
|
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; }
|
|
@@ -40,6 +44,7 @@ import PropTypes from "prop-types";
|
|
|
40
44
|
* Side Public License, v 1.
|
|
41
45
|
*/
|
|
42
46
|
import React, { Component } from 'react';
|
|
47
|
+
import { htmlIdGenerator } from '../../services/accessibility';
|
|
43
48
|
import { isString } from '../../services/predicate';
|
|
44
49
|
import { EuiFlexGroup, EuiFlexItem } from '../flex';
|
|
45
50
|
import { EuiSearchBox } from './search_box';
|
|
@@ -80,6 +85,8 @@ export var EuiSearchBar = /*#__PURE__*/function (_Component) {
|
|
|
80
85
|
|
|
81
86
|
_this = _super.call(this, props);
|
|
82
87
|
|
|
88
|
+
_defineProperty(_assertThisInitialized(_this), "hintId", htmlIdGenerator('__hint')());
|
|
89
|
+
|
|
83
90
|
_defineProperty(_assertThisInitialized(_this), "onSearch", function (queryText) {
|
|
84
91
|
try {
|
|
85
92
|
var query = parseQuery(queryText, _this.props);
|
|
@@ -136,7 +143,8 @@ export var EuiSearchBar = /*#__PURE__*/function (_Component) {
|
|
|
136
143
|
_this.state = {
|
|
137
144
|
query: _query,
|
|
138
145
|
queryText: _query.text,
|
|
139
|
-
error: null
|
|
146
|
+
error: null,
|
|
147
|
+
isHintVisible: false
|
|
140
148
|
};
|
|
141
149
|
return _this;
|
|
142
150
|
}
|
|
@@ -198,10 +206,15 @@ export var EuiSearchBar = /*#__PURE__*/function (_Component) {
|
|
|
198
206
|
}, {
|
|
199
207
|
key: "render",
|
|
200
208
|
value: function render() {
|
|
209
|
+
var _hint$popoverProps$is,
|
|
210
|
+
_hint$popoverProps,
|
|
211
|
+
_this2 = this;
|
|
212
|
+
|
|
201
213
|
var _this$state = this.state,
|
|
202
214
|
query = _this$state.query,
|
|
203
215
|
queryText = _this$state.queryText,
|
|
204
|
-
error = _this$state.error
|
|
216
|
+
error = _this$state.error,
|
|
217
|
+
isHintVisibleState = _this$state.isHintVisible;
|
|
205
218
|
var _this$props = this.props,
|
|
206
219
|
_this$props$box = _this$props.box;
|
|
207
220
|
_this$props$box = _this$props$box === void 0 ? {
|
|
@@ -212,7 +225,8 @@ export var EuiSearchBar = /*#__PURE__*/function (_Component) {
|
|
|
212
225
|
box = _objectWithoutProperties(_this$props$box, _excluded),
|
|
213
226
|
filters = _this$props.filters,
|
|
214
227
|
toolsLeft = _this$props.toolsLeft,
|
|
215
|
-
toolsRight = _this$props.toolsRight
|
|
228
|
+
toolsRight = _this$props.toolsRight,
|
|
229
|
+
hint = _this$props.hint;
|
|
216
230
|
|
|
217
231
|
var toolsLeftEl = this.renderTools(toolsLeft);
|
|
218
232
|
var filtersBar = !filters ? undefined : ___EmotionJSX(EuiFlexItem, {
|
|
@@ -224,6 +238,7 @@ export var EuiSearchBar = /*#__PURE__*/function (_Component) {
|
|
|
224
238
|
onChange: this.onFiltersChange
|
|
225
239
|
}));
|
|
226
240
|
var toolsRightEl = this.renderTools(toolsRight);
|
|
241
|
+
var isHintVisible = (_hint$popoverProps$is = hint === null || hint === void 0 ? void 0 : (_hint$popoverProps = hint.popoverProps) === null || _hint$popoverProps === void 0 ? void 0 : _hint$popoverProps.isOpen) !== null && _hint$popoverProps$is !== void 0 ? _hint$popoverProps$is : isHintVisibleState;
|
|
227
242
|
return ___EmotionJSX(EuiFlexGroup, {
|
|
228
243
|
gutterSize: "m",
|
|
229
244
|
alignItems: "center",
|
|
@@ -235,7 +250,17 @@ export var EuiSearchBar = /*#__PURE__*/function (_Component) {
|
|
|
235
250
|
query: queryText,
|
|
236
251
|
onSearch: this.onSearch,
|
|
237
252
|
isInvalid: error != null,
|
|
238
|
-
title: error ? error.message : undefined
|
|
253
|
+
title: error ? error.message : undefined,
|
|
254
|
+
"aria-describedby": isHintVisible ? "".concat(this.hintId) : undefined,
|
|
255
|
+
hint: hint ? _objectSpread({
|
|
256
|
+
isVisible: isHintVisible,
|
|
257
|
+
setIsVisible: function setIsVisible(isVisible) {
|
|
258
|
+
_this2.setState({
|
|
259
|
+
isHintVisible: isVisible
|
|
260
|
+
});
|
|
261
|
+
},
|
|
262
|
+
id: this.hintId
|
|
263
|
+
}, hint) : undefined
|
|
239
264
|
}))), filtersBar, toolsRightEl);
|
|
240
265
|
}
|
|
241
266
|
}], [{
|
|
@@ -246,7 +271,8 @@ export var EuiSearchBar = /*#__PURE__*/function (_Component) {
|
|
|
246
271
|
return {
|
|
247
272
|
query: query,
|
|
248
273
|
queryText: query.text,
|
|
249
|
-
error: null
|
|
274
|
+
error: null,
|
|
275
|
+
isHintVisible: prevState.isHintVisible
|
|
250
276
|
};
|
|
251
277
|
}
|
|
252
278
|
|
|
@@ -438,6 +464,14 @@ EuiSearchBar.propTypes = {
|
|
|
438
464
|
* Date formatter to use when parsing date values
|
|
439
465
|
*/
|
|
440
466
|
dateFormat: PropTypes.any,
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* Hint to render below the search bar
|
|
470
|
+
*/
|
|
471
|
+
hint: PropTypes.shape({
|
|
472
|
+
content: PropTypes.node.isRequired,
|
|
473
|
+
popoverProps: PropTypes.any
|
|
474
|
+
}),
|
|
441
475
|
className: PropTypes.string,
|
|
442
476
|
"aria-label": PropTypes.string,
|
|
443
477
|
"data-test-subj": PropTypes.string,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
2
2
|
|
|
3
|
-
var _excluded = ["query", "incremental"];
|
|
3
|
+
var _excluded = ["query", "incremental", "hint"];
|
|
4
4
|
|
|
5
5
|
function _extends() { _extends = Object.assign || 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); }
|
|
6
6
|
|
|
@@ -40,6 +40,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
40
40
|
import React, { Component } from 'react';
|
|
41
41
|
import PropTypes from "prop-types";
|
|
42
42
|
import { EuiFieldSearch } from '../form';
|
|
43
|
+
import { EuiInputPopover } from '../popover';
|
|
43
44
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
44
45
|
export var EuiSearchBox = /*#__PURE__*/function (_Component) {
|
|
45
46
|
_inherits(EuiSearchBox, _Component);
|
|
@@ -78,6 +79,7 @@ export var EuiSearchBox = /*#__PURE__*/function (_Component) {
|
|
|
78
79
|
var _this$props = this.props,
|
|
79
80
|
query = _this$props.query,
|
|
80
81
|
incremental = _this$props.incremental,
|
|
82
|
+
hint = _this$props.hint,
|
|
81
83
|
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
82
84
|
|
|
83
85
|
var ariaLabel;
|
|
@@ -88,15 +90,39 @@ export var EuiSearchBox = /*#__PURE__*/function (_Component) {
|
|
|
88
90
|
ariaLabel = 'This is a search bar. After typing your query, hit enter to filter the results lower in the page.';
|
|
89
91
|
}
|
|
90
92
|
|
|
91
|
-
|
|
93
|
+
var search = ___EmotionJSX(EuiFieldSearch, _extends({
|
|
92
94
|
inputRef: function inputRef(input) {
|
|
93
95
|
return _this2.inputElement = input;
|
|
94
96
|
},
|
|
95
97
|
fullWidth: true,
|
|
96
98
|
defaultValue: query,
|
|
97
99
|
incremental: incremental,
|
|
98
|
-
"aria-label": ariaLabel
|
|
100
|
+
"aria-label": ariaLabel,
|
|
101
|
+
onFocus: function onFocus() {
|
|
102
|
+
hint === null || hint === void 0 ? void 0 : hint.setIsVisible(true);
|
|
103
|
+
}
|
|
99
104
|
}, rest));
|
|
105
|
+
|
|
106
|
+
if (hint) {
|
|
107
|
+
return ___EmotionJSX(EuiInputPopover, _extends({
|
|
108
|
+
disableFocusTrap: true,
|
|
109
|
+
input: search,
|
|
110
|
+
isOpen: hint.isVisible,
|
|
111
|
+
fullWidth: true,
|
|
112
|
+
closePopover: function closePopover() {
|
|
113
|
+
hint.setIsVisible(false);
|
|
114
|
+
},
|
|
115
|
+
panelProps: {
|
|
116
|
+
'aria-live': undefined,
|
|
117
|
+
'aria-modal': undefined,
|
|
118
|
+
role: undefined,
|
|
119
|
+
tabIndex: -1,
|
|
120
|
+
id: hint.id
|
|
121
|
+
}
|
|
122
|
+
}, hint.popoverProps), hint.content);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return search;
|
|
100
126
|
}
|
|
101
127
|
}]);
|
|
102
128
|
|
|
@@ -111,5 +137,12 @@ _defineProperty(EuiSearchBox, "defaultProps", {
|
|
|
111
137
|
EuiSearchBox.propTypes = {
|
|
112
138
|
query: PropTypes.string.isRequired,
|
|
113
139
|
// This is optional in EuiFieldSearchProps
|
|
114
|
-
onSearch: PropTypes.func.isRequired
|
|
140
|
+
onSearch: PropTypes.func.isRequired,
|
|
141
|
+
hint: PropTypes.shape({
|
|
142
|
+
id: PropTypes.string.isRequired,
|
|
143
|
+
isVisible: PropTypes.bool.isRequired,
|
|
144
|
+
setIsVisible: PropTypes.func.isRequired,
|
|
145
|
+
content: PropTypes.node.isRequired,
|
|
146
|
+
popoverProps: PropTypes.any
|
|
147
|
+
})
|
|
115
148
|
};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
|
|
3
|
+
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."); }
|
|
4
|
+
|
|
5
|
+
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); }
|
|
6
|
+
|
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
8
|
+
|
|
9
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
10
|
+
|
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
+
|
|
13
|
+
function _extends() { _extends = Object.assign || 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); }
|
|
14
|
+
|
|
15
|
+
/*
|
|
16
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
17
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
18
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
19
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
20
|
+
* Side Public License, v 1.
|
|
21
|
+
*/
|
|
22
|
+
/// <reference types="../../../cypress/support"/>
|
|
23
|
+
import React, { useState } from 'react';
|
|
24
|
+
import { EuiButton } from '../button';
|
|
25
|
+
import { EuiPopover } from '../popover';
|
|
26
|
+
import { EuiSelectable } from './selectable';
|
|
27
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
28
|
+
var options = [{
|
|
29
|
+
label: 'Titan',
|
|
30
|
+
'data-test-subj': 'titanOption'
|
|
31
|
+
}, {
|
|
32
|
+
label: 'Enceladus'
|
|
33
|
+
}, {
|
|
34
|
+
label: "Pandora is one of Saturn's moons, named for a Titaness of Greek mythology"
|
|
35
|
+
}];
|
|
36
|
+
|
|
37
|
+
var EuiSelectableListboxOnly = function EuiSelectableListboxOnly(args) {
|
|
38
|
+
return ___EmotionJSX(EuiSelectable, _extends({
|
|
39
|
+
options: options
|
|
40
|
+
}, args), function (list) {
|
|
41
|
+
return ___EmotionJSX(React.Fragment, null, list);
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
var EuiSelectableWithSearchInput = function EuiSelectableWithSearchInput(args) {
|
|
46
|
+
return ___EmotionJSX(EuiSelectable, _extends({
|
|
47
|
+
searchable: true,
|
|
48
|
+
options: options
|
|
49
|
+
}, args), function (list, search) {
|
|
50
|
+
return ___EmotionJSX(React.Fragment, null, search, list);
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
describe('EuiSelectable', function () {
|
|
55
|
+
describe('with a `searchable` configuration', function () {
|
|
56
|
+
it('has no accessibility errors', function () {
|
|
57
|
+
var onChange = cy.stub();
|
|
58
|
+
cy.realMount(___EmotionJSX(EuiSelectableWithSearchInput, {
|
|
59
|
+
onChange: onChange
|
|
60
|
+
}));
|
|
61
|
+
cy.checkAxe();
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
describe('without a `searchable` configuration', function () {
|
|
65
|
+
it('has no accessibility errors', function () {
|
|
66
|
+
var onChange = cy.stub();
|
|
67
|
+
cy.realMount(___EmotionJSX(EuiSelectableListboxOnly, {
|
|
68
|
+
"aria-label": "No search box",
|
|
69
|
+
onChange: onChange
|
|
70
|
+
}));
|
|
71
|
+
cy.checkAxe();
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
describe('nested in `EuiPopover` component', function () {
|
|
75
|
+
var EuiSelectableNested = function EuiSelectableNested() {
|
|
76
|
+
var _useState = useState(false),
|
|
77
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
78
|
+
isPopoverOpen = _useState2[0],
|
|
79
|
+
setIsPopoverOpen = _useState2[1];
|
|
80
|
+
|
|
81
|
+
var onChange = function onChange() {};
|
|
82
|
+
|
|
83
|
+
var onClosePopover = function onClosePopover() {};
|
|
84
|
+
|
|
85
|
+
var onButtonClick = function onButtonClick() {
|
|
86
|
+
setIsPopoverOpen(!isPopoverOpen);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
var button = ___EmotionJSX(EuiButton, {
|
|
90
|
+
iconType: "arrowDown",
|
|
91
|
+
iconSide: "right",
|
|
92
|
+
onClick: onButtonClick
|
|
93
|
+
}, "Show popover");
|
|
94
|
+
|
|
95
|
+
return ___EmotionJSX(EuiPopover, {
|
|
96
|
+
id: "data-cy-popover-1",
|
|
97
|
+
panelPaddingSize: "s",
|
|
98
|
+
button: button,
|
|
99
|
+
isOpen: isPopoverOpen,
|
|
100
|
+
closePopover: onClosePopover
|
|
101
|
+
}, ___EmotionJSX(EuiSelectableWithSearchInput, {
|
|
102
|
+
"aria-label": "With popover",
|
|
103
|
+
options: options,
|
|
104
|
+
onChange: onChange
|
|
105
|
+
}, function (list) {
|
|
106
|
+
return ___EmotionJSX(React.Fragment, null, list);
|
|
107
|
+
}));
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
it('has no accessibility errors', function () {
|
|
111
|
+
cy.realMount(___EmotionJSX(EuiSelectableNested, null));
|
|
112
|
+
cy.get('button').realClick();
|
|
113
|
+
cy.get('li[role=option]').first(); // Make sure the EuiSelectable is rendered before a11y check
|
|
114
|
+
|
|
115
|
+
cy.checkAxe();
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
});
|
|
@@ -604,25 +604,28 @@ export var EuiSelectable = /*#__PURE__*/function (_Component) {
|
|
|
604
604
|
}], [{
|
|
605
605
|
key: "getDerivedStateFromProps",
|
|
606
606
|
value: function getDerivedStateFromProps(nextProps, prevState) {
|
|
607
|
+
var _stateUpdate$searchVa;
|
|
608
|
+
|
|
607
609
|
var options = nextProps.options,
|
|
608
610
|
isPreFiltered = nextProps.isPreFiltered,
|
|
609
611
|
searchProps = nextProps.searchProps;
|
|
610
612
|
var activeOptionIndex = prevState.activeOptionIndex,
|
|
611
613
|
searchValue = prevState.searchValue;
|
|
612
|
-
var matchingOptions = getMatchingOptions(options, searchValue, isPreFiltered);
|
|
613
614
|
var stateUpdate = {
|
|
614
|
-
|
|
615
|
+
searchValue: searchValue,
|
|
615
616
|
activeOptionIndex: activeOptionIndex
|
|
616
617
|
};
|
|
617
618
|
|
|
618
|
-
if (activeOptionIndex != null && activeOptionIndex >= matchingOptions.length) {
|
|
619
|
-
stateUpdate.activeOptionIndex = -1;
|
|
620
|
-
}
|
|
621
|
-
|
|
622
619
|
if ((searchProps === null || searchProps === void 0 ? void 0 : searchProps.value) != null && searchProps.value !== searchValue) {
|
|
623
620
|
stateUpdate.searchValue = searchProps.value;
|
|
624
621
|
}
|
|
625
622
|
|
|
623
|
+
stateUpdate.visibleOptions = getMatchingOptions(options, (_stateUpdate$searchVa = stateUpdate.searchValue) !== null && _stateUpdate$searchVa !== void 0 ? _stateUpdate$searchVa : '', isPreFiltered);
|
|
624
|
+
|
|
625
|
+
if (activeOptionIndex != null && activeOptionIndex >= stateUpdate.visibleOptions.length) {
|
|
626
|
+
stateUpdate.activeOptionIndex = -1;
|
|
627
|
+
}
|
|
628
|
+
|
|
626
629
|
return stateUpdate;
|
|
627
630
|
}
|
|
628
631
|
}]);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["isSelected", "children", "className", "disabled", "href", "target", "rel", "prepend", "append"];
|
|
1
|
+
var _excluded = ["isSelected", "children", "className", "disabled", "href", "target", "rel", "prepend", "append", "size", "expand"];
|
|
2
2
|
|
|
3
3
|
function _extends() { _extends = Object.assign || 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
|
|
|
@@ -16,8 +16,9 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
16
16
|
import React from 'react';
|
|
17
17
|
import PropTypes from "prop-types";
|
|
18
18
|
import classNames from 'classnames';
|
|
19
|
-
import { getSecureRelForTarget } from '../../services';
|
|
19
|
+
import { getSecureRelForTarget, useEuiTheme } from '../../services';
|
|
20
20
|
import { validateHref } from '../../services/security/href_validator';
|
|
21
|
+
import { euiTabStyles, euiTabContentStyles } from './tab.styles';
|
|
21
22
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
22
23
|
export var EuiTab = function EuiTab(_ref) {
|
|
23
24
|
var isSelected = _ref.isSelected,
|
|
@@ -29,14 +30,21 @@ export var EuiTab = function EuiTab(_ref) {
|
|
|
29
30
|
rel = _ref.rel,
|
|
30
31
|
prepend = _ref.prepend,
|
|
31
32
|
append = _ref.append,
|
|
33
|
+
size = _ref.size,
|
|
34
|
+
expand = _ref.expand,
|
|
32
35
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
33
36
|
|
|
37
|
+
var euiTheme = useEuiTheme();
|
|
34
38
|
var isHrefValid = !href || validateHref(href);
|
|
35
|
-
var disabled = _disabled || !isHrefValid;
|
|
39
|
+
var disabled = _disabled || !isHrefValid; // Keep CSS classnames for reference
|
|
40
|
+
|
|
36
41
|
var classes = classNames('euiTab', className, {
|
|
37
|
-
'euiTab-isSelected': isSelected
|
|
38
|
-
'euiTab-isDisabled': disabled
|
|
42
|
+
'euiTab-isSelected': isSelected
|
|
39
43
|
});
|
|
44
|
+
var tabStyles = euiTabStyles(euiTheme);
|
|
45
|
+
var cssTabStyles = [tabStyles.euiTab, expand && tabStyles.expanded, disabled && tabStyles.disabled.disabled, isSelected && (disabled ? tabStyles.disabled.selected : tabStyles.selected)];
|
|
46
|
+
var tabContentStyles = euiTabContentStyles(euiTheme);
|
|
47
|
+
var cssTabContentStyles = [tabContentStyles.euiTab__content, size && tabContentStyles[size], isSelected && tabContentStyles.selected, disabled && tabContentStyles.disabled];
|
|
40
48
|
|
|
41
49
|
var prependNode = prepend && ___EmotionJSX("span", {
|
|
42
50
|
className: "euiTab__prepend"
|
|
@@ -58,11 +66,13 @@ export var EuiTab = function EuiTab(_ref) {
|
|
|
58
66
|
role: "tab",
|
|
59
67
|
"aria-selected": !!isSelected,
|
|
60
68
|
className: classes,
|
|
69
|
+
css: cssTabStyles,
|
|
61
70
|
href: href,
|
|
62
71
|
target: target,
|
|
63
72
|
rel: secureRel
|
|
64
73
|
}, rest), prependNode, ___EmotionJSX("span", {
|
|
65
|
-
className: "euiTab__content"
|
|
74
|
+
className: "euiTab__content",
|
|
75
|
+
css: cssTabContentStyles
|
|
66
76
|
}, children), appendNode);
|
|
67
77
|
}
|
|
68
78
|
|
|
@@ -71,9 +81,11 @@ export var EuiTab = function EuiTab(_ref) {
|
|
|
71
81
|
"aria-selected": !!isSelected,
|
|
72
82
|
type: "button",
|
|
73
83
|
className: classes,
|
|
84
|
+
css: cssTabStyles,
|
|
74
85
|
disabled: disabled
|
|
75
86
|
}, rest), prependNode, ___EmotionJSX("span", {
|
|
76
|
-
className: "euiTab__content"
|
|
87
|
+
className: "euiTab__content",
|
|
88
|
+
css: cssTabContentStyles
|
|
77
89
|
}, children), appendNode);
|
|
78
90
|
};
|
|
79
91
|
EuiTab.propTypes = {
|
|
@@ -101,6 +113,18 @@ EuiTab.propTypes = {
|
|
|
101
113
|
* Will be excluded from interactive effects.
|
|
102
114
|
*/
|
|
103
115
|
append: PropTypes.node,
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Evenly stretches each tab to fill the
|
|
119
|
+
* horizontal space
|
|
120
|
+
*/
|
|
121
|
+
expand: PropTypes.bool,
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Sizes affect both font size and overall size.
|
|
125
|
+
* Only use the `xl` size when displayed as page titles.
|
|
126
|
+
*/
|
|
127
|
+
size: PropTypes.any,
|
|
104
128
|
className: PropTypes.string,
|
|
105
129
|
"aria-label": PropTypes.string,
|
|
106
130
|
"data-test-subj": PropTypes.string,
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
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)."; }
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
5
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
6
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
7
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
8
|
+
* Side Public License, v 1.
|
|
9
|
+
*/
|
|
10
|
+
import { css } from '@emotion/react';
|
|
11
|
+
import { logicalCSS, mathWithUnits } from '../../global_styling';
|
|
12
|
+
import { euiTitle } from '../title/title.styles';
|
|
13
|
+
|
|
14
|
+
var _ref2 = process.env.NODE_ENV === "production" ? {
|
|
15
|
+
name: "10tso78-expanded",
|
|
16
|
+
styles: "flex-basis:0%;flex-grow:1;justify-content:center;label:expanded;"
|
|
17
|
+
} : {
|
|
18
|
+
name: "10tso78-expanded",
|
|
19
|
+
styles: "flex-basis:0%;flex-grow:1;justify-content:center;label:expanded;",
|
|
20
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export var euiTabStyles = function euiTabStyles(_ref3) {
|
|
24
|
+
var euiTheme = _ref3.euiTheme;
|
|
25
|
+
return {
|
|
26
|
+
euiTab: /*#__PURE__*/css("display:flex;cursor:pointer;flex-direction:row;align-items:center;font-weight:", euiTheme.font.weight.semiBold, ";gap:", euiTheme.size.s, ";", logicalCSS('padding-vertical', 0), " ", logicalCSS('padding-horizontal', euiTheme.size.xs), " &:focus{background-color:transparent;outline-offset:-", euiTheme.focus.width, ";};label:euiTab;"),
|
|
27
|
+
// variations
|
|
28
|
+
expanded: _ref2,
|
|
29
|
+
selected: /*#__PURE__*/css("box-shadow:inset 0 -", euiTheme.border.width.thick, " 0 ", euiTheme.colors.primary, ";;label:selected;"),
|
|
30
|
+
disabled: {
|
|
31
|
+
disabled: /*#__PURE__*/css("cursor:not-allowed;color:", euiTheme.colors.disabledText, ";;label:disabled;"),
|
|
32
|
+
selected: /*#__PURE__*/css("box-shadow:inset 0 -", euiTheme.border.width.thick, " 0 ", euiTheme.colors.disabledText, ";;label:selected;")
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
var _ref = process.env.NODE_ENV === "production" ? {
|
|
38
|
+
name: "1yhgei9-euiTab__content",
|
|
39
|
+
styles: "&:hover{text-decoration:none;};label:euiTab__content;"
|
|
40
|
+
} : {
|
|
41
|
+
name: "1yhgei9-euiTab__content",
|
|
42
|
+
styles: "&:hover{text-decoration:none;};label:euiTab__content;",
|
|
43
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export var euiTabContentStyles = function euiTabContentStyles(euiThemeContext) {
|
|
47
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
48
|
+
return {
|
|
49
|
+
euiTab__content: _ref,
|
|
50
|
+
// sizes
|
|
51
|
+
s: /*#__PURE__*/css(euiTitle(euiThemeContext, 'xxxs'), ";line-height:", euiTheme.size.xl, ";;label:s;"),
|
|
52
|
+
m: /*#__PURE__*/css(euiTitle(euiThemeContext, 'xxs'), ";line-height:", euiTheme.size.xxl, ";;label:m;"),
|
|
53
|
+
l: /*#__PURE__*/css(euiTitle(euiThemeContext, 'xs'), ";line-height:", mathWithUnits([euiTheme.size.xl, euiTheme.size.s], function (x, y) {
|
|
54
|
+
return x + y;
|
|
55
|
+
}), ";;label:l;"),
|
|
56
|
+
xl: /*#__PURE__*/css(euiTitle(euiThemeContext, 's'), ";line-height:", mathWithUnits([euiTheme.size.xxxl, euiTheme.size.s], function (x, y) {
|
|
57
|
+
return x + y;
|
|
58
|
+
}), ";;label:xl;"),
|
|
59
|
+
// variations
|
|
60
|
+
selected: /*#__PURE__*/css("color:", euiTheme.colors.primaryText, ";;label:selected;"),
|
|
61
|
+
disabled: /*#__PURE__*/css("color:", euiTheme.colors.disabledText, ";;label:disabled;")
|
|
62
|
+
};
|
|
63
|
+
};
|
|
@@ -239,6 +239,18 @@ EuiTabbedContent.propTypes = {
|
|
|
239
239
|
* Will be excluded from interactive effects.
|
|
240
240
|
*/
|
|
241
241
|
append: PropTypes.node,
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Evenly stretches each tab to fill the
|
|
245
|
+
* horizontal space
|
|
246
|
+
*/
|
|
247
|
+
expand: PropTypes.bool,
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Sizes affect both font size and overall size.
|
|
251
|
+
* Only use the `xl` size when displayed as page titles.
|
|
252
|
+
*/
|
|
253
|
+
size: PropTypes.any,
|
|
242
254
|
className: PropTypes.string,
|
|
243
255
|
"aria-label": PropTypes.string,
|
|
244
256
|
"data-test-subj": PropTypes.string,
|
|
@@ -257,12 +269,14 @@ EuiTabbedContent.propTypes = {
|
|
|
257
269
|
disabled: PropTypes.bool,
|
|
258
270
|
prepend: PropTypes.node,
|
|
259
271
|
append: PropTypes.node,
|
|
272
|
+
expand: PropTypes.bool,
|
|
273
|
+
size: PropTypes.any,
|
|
260
274
|
className: PropTypes.string,
|
|
261
275
|
"aria-label": PropTypes.string,
|
|
262
276
|
"data-test-subj": PropTypes.string,
|
|
263
277
|
css: PropTypes.any
|
|
264
278
|
}),
|
|
265
|
-
size: PropTypes.
|
|
279
|
+
size: PropTypes.any,
|
|
266
280
|
|
|
267
281
|
/**
|
|
268
282
|
* Each tab needs id and content properties, so we can associate it with its panel for accessibility.
|
|
@@ -276,6 +290,8 @@ EuiTabbedContent.propTypes = {
|
|
|
276
290
|
disabled: PropTypes.bool,
|
|
277
291
|
prepend: PropTypes.node,
|
|
278
292
|
append: PropTypes.node,
|
|
293
|
+
expand: PropTypes.bool,
|
|
294
|
+
size: PropTypes.any,
|
|
279
295
|
className: PropTypes.string,
|
|
280
296
|
"aria-label": PropTypes.string,
|
|
281
297
|
"data-test-subj": PropTypes.string,
|
|
@@ -15,15 +15,11 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
15
15
|
*/
|
|
16
16
|
import React, { forwardRef } from 'react';
|
|
17
17
|
import classNames from 'classnames';
|
|
18
|
-
import {
|
|
18
|
+
import { useEuiTheme } from '../../services';
|
|
19
|
+
import { cloneElementWithCss } from '../../services/theme/clone_element';
|
|
20
|
+
import { euiTabsStyles } from './tabs.styles';
|
|
19
21
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
20
|
-
var
|
|
21
|
-
s: 'euiTabs--small',
|
|
22
|
-
m: null,
|
|
23
|
-
l: 'euiTabs--large',
|
|
24
|
-
xl: 'euiTabs--xlarge'
|
|
25
|
-
};
|
|
26
|
-
export var SIZES = keysOf(sizeToClassNameMap);
|
|
22
|
+
export var SIZES = ['s', 'm', 'l', 'xl'];
|
|
27
23
|
export var EuiTabs = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
28
24
|
var children = _ref.children,
|
|
29
25
|
className = _ref.className,
|
|
@@ -35,15 +31,25 @@ export var EuiTabs = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
35
31
|
size = _ref$size === void 0 ? 'm' : _ref$size,
|
|
36
32
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
37
33
|
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
var euiTheme = useEuiTheme();
|
|
35
|
+
var classes = classNames('euiTabs', className);
|
|
36
|
+
var styles = euiTabsStyles(euiTheme);
|
|
37
|
+
var cssStyles = [styles.euiTabs, styles[size], bottomBorder && styles.bottomBorder];
|
|
38
|
+
var tabItems = React.Children.map(children, function (child) {
|
|
39
|
+
if ( /*#__PURE__*/React.isValidElement(child)) {
|
|
40
|
+
return cloneElementWithCss(child, {
|
|
41
|
+
// we're passing the parent `size` and `expand` down to the children
|
|
42
|
+
size: size,
|
|
43
|
+
expand: expand
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
});
|
|
42
47
|
return ___EmotionJSX("div", _extends({
|
|
43
48
|
ref: ref,
|
|
44
|
-
className: classes
|
|
49
|
+
className: classes,
|
|
50
|
+
css: cssStyles
|
|
45
51
|
}, children && {
|
|
46
52
|
role: 'tablist'
|
|
47
|
-
}, rest),
|
|
53
|
+
}, rest), tabItems);
|
|
48
54
|
});
|
|
49
55
|
EuiTabs.displayName = 'EuiTabs';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
5
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
6
|
+
* Side Public License, v 1.
|
|
7
|
+
*/
|
|
8
|
+
import { css } from '@emotion/react';
|
|
9
|
+
import { logicalCSS, logicalCSSWithFallback } from '../../global_styling';
|
|
10
|
+
export var euiTabsStyles = function euiTabsStyles(euiThemeContext) {
|
|
11
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
12
|
+
return {
|
|
13
|
+
euiTabs: /*#__PURE__*/css("display:flex;", logicalCSS('max-width', '100%'), ";", logicalCSSWithFallback('overflow-x', 'auto'), ";", logicalCSSWithFallback('overflow-y', 'hidden'), ";position:relative;flex-shrink:0;;label:euiTabs;"),
|
|
14
|
+
bottomBorder: /*#__PURE__*/css("box-shadow:inset 0 -", euiTheme.border.width.thin, " 0 ", euiTheme.border.color, ";;label:bottomBorder;"),
|
|
15
|
+
// sizes
|
|
16
|
+
s: /*#__PURE__*/css("gap:", euiTheme.size.m, ";;label:s;"),
|
|
17
|
+
m: /*#__PURE__*/css("gap:", euiTheme.size.base, ";;label:m;"),
|
|
18
|
+
l: /*#__PURE__*/css("gap:", euiTheme.size.l, ";;label:l;"),
|
|
19
|
+
xl: /*#__PURE__*/css("gap:", euiTheme.size.xl, ";;label:xl;")
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -341,6 +341,12 @@ EuiTourStep.propTypes = {
|
|
|
341
341
|
*/
|
|
342
342
|
repositionOnScroll: PropTypes.bool,
|
|
343
343
|
|
|
344
|
+
/**
|
|
345
|
+
* Must be set to true if using `EuiDragDropContext` within a popover,
|
|
346
|
+
* otherwise your nested drag & drop will have incorrect positioning
|
|
347
|
+
*/
|
|
348
|
+
hasDragDrop: PropTypes.bool,
|
|
349
|
+
|
|
344
350
|
/**
|
|
345
351
|
* By default, popover content inherits the z-index of the anchor
|
|
346
352
|
* component; pass `zIndex` to override
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
export var MAX_INITIALS = 2;
|
|
23
23
|
export function toInitials(name, initialsLength, initials) {
|
|
24
24
|
// Calculate the number of initials to show, maxing out at MAX_INITIALS
|
|
25
|
-
var calculatedInitialsLength = initials ? initials.split('
|
|
25
|
+
var calculatedInitialsLength = initials ? initials.split('').length : name.split(' ').length;
|
|
26
26
|
calculatedInitialsLength = calculatedInitialsLength > MAX_INITIALS ? MAX_INITIALS : calculatedInitialsLength; // Check if initialsLength was passed and set to calculated, unless greater than MAX_INITIALS
|
|
27
27
|
|
|
28
28
|
if (initialsLength) {
|