@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,70 +0,0 @@
|
|
|
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
|
-
|
|
9
|
-
/// <reference types="cypress" />
|
|
10
|
-
/// <reference types="cypress-real-events" />
|
|
11
|
-
/// <reference types="../../../cypress/support" />
|
|
12
|
-
|
|
13
|
-
import React from 'react';
|
|
14
|
-
import { EuiFormRow } from '../form';
|
|
15
|
-
import { EuiSuggest } from './suggest';
|
|
16
|
-
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
17
|
-
var Suggest = function Suggest() {
|
|
18
|
-
var suggestedItems = [{
|
|
19
|
-
type: {
|
|
20
|
-
iconType: 'accessibility',
|
|
21
|
-
color: 'tint1'
|
|
22
|
-
},
|
|
23
|
-
label: 'Accessibility',
|
|
24
|
-
description: 'A short description'
|
|
25
|
-
}, {
|
|
26
|
-
type: {
|
|
27
|
-
iconType: 'image',
|
|
28
|
-
color: 'tint2'
|
|
29
|
-
},
|
|
30
|
-
label: 'Images',
|
|
31
|
-
description: 'Another short description'
|
|
32
|
-
}, {
|
|
33
|
-
type: {
|
|
34
|
-
iconType: 'lock',
|
|
35
|
-
color: 'tint3'
|
|
36
|
-
},
|
|
37
|
-
label: 'Locks',
|
|
38
|
-
description: 'A third short description'
|
|
39
|
-
}];
|
|
40
|
-
return ___EmotionJSX(EuiFormRow, {
|
|
41
|
-
label: "Suggest a topic",
|
|
42
|
-
id: "cy-label-suggest-1"
|
|
43
|
-
}, ___EmotionJSX(EuiSuggest, {
|
|
44
|
-
"aria-labelledby": "cy-label-suggest-1-label",
|
|
45
|
-
suggestions: suggestedItems
|
|
46
|
-
}));
|
|
47
|
-
};
|
|
48
|
-
describe('EuiSuggest', function () {
|
|
49
|
-
beforeEach(function () {
|
|
50
|
-
cy.realMount(___EmotionJSX(Suggest, null));
|
|
51
|
-
});
|
|
52
|
-
describe('Automated accessibility check', function () {
|
|
53
|
-
it('has zero violations when rendered', function () {
|
|
54
|
-
cy.checkAxe();
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
describe('Keyboard accessibility', function () {
|
|
58
|
-
it('has zero violations after traversing list items', function () {
|
|
59
|
-
cy.realPress('Tab');
|
|
60
|
-
cy.get('#cy-label-suggest-1').should('have.focus');
|
|
61
|
-
cy.get('ul[role="listbox"]').should('exist');
|
|
62
|
-
cy.realPress('ArrowDown');
|
|
63
|
-
cy.realPress('ArrowUp');
|
|
64
|
-
cy.realPress('ArrowRight');
|
|
65
|
-
cy.realPress('ArrowLeft');
|
|
66
|
-
cy.get('li[role="option"]').first().should('have.attr', 'aria-selected', 'true');
|
|
67
|
-
cy.checkAxe();
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
});
|
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["onItemClick", "onBlur", "onFocus", "onInput", "onSearch", "status", "append", "tooltipContent", "suggestions", "id", "aria-label", "aria-labelledby", "isPreFiltered", "isVirtualized", "fullWidth", "maxHeight"];
|
|
5
|
-
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; }
|
|
6
|
-
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; }
|
|
7
|
-
/*
|
|
8
|
-
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
9
|
-
* or more contributor license agreements. Licensed under the Elastic License
|
|
10
|
-
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
11
|
-
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
12
|
-
* Side Public License, v 1.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
import React, { useState, useCallback } from 'react';
|
|
16
|
-
import classNames from 'classnames';
|
|
17
|
-
import { EuiIcon } from '../icon';
|
|
18
|
-
import { useEuiI18n } from '../i18n';
|
|
19
|
-
import { EuiInputPopover } from '../popover';
|
|
20
|
-
import { EuiSelectable } from '../selectable';
|
|
21
|
-
import { EuiToolTip } from '../tool_tip';
|
|
22
|
-
import { EuiSuggestItem } from './suggest_item';
|
|
23
|
-
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
24
|
-
var statusMap = {
|
|
25
|
-
unsaved: {
|
|
26
|
-
icon: 'dot',
|
|
27
|
-
color: 'accent'
|
|
28
|
-
},
|
|
29
|
-
saved: {
|
|
30
|
-
icon: 'checkInCircleFilled',
|
|
31
|
-
color: 'success'
|
|
32
|
-
},
|
|
33
|
-
unchanged: {
|
|
34
|
-
icon: '',
|
|
35
|
-
color: 'success'
|
|
36
|
-
},
|
|
37
|
-
loading: {}
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
// keys of _EuiSuggestItemPropsBase
|
|
41
|
-
var suggestItemPropsKeys = ['label', 'type', 'description', 'labelDisplay', 'labelWidth', 'descriptionDisplay'];
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* @deprecated
|
|
45
|
-
*/
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* @deprecated
|
|
49
|
-
*/
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* @deprecated - EuiSuggest is scheduled for deprecation due to low internal usage and high
|
|
53
|
-
* overlap with other existing EUI components. We recommend using EuiSelectable instead,
|
|
54
|
-
* or copying this component into your own application for usage if necessary.
|
|
55
|
-
*
|
|
56
|
-
* The component will be permanently removed in October 2023.
|
|
57
|
-
*/
|
|
58
|
-
export var EuiSuggest = function EuiSuggest(_ref) {
|
|
59
|
-
var onItemClick = _ref.onItemClick,
|
|
60
|
-
onBlur = _ref.onBlur,
|
|
61
|
-
onFocus = _ref.onFocus,
|
|
62
|
-
onInput = _ref.onInput,
|
|
63
|
-
onSearch = _ref.onSearch,
|
|
64
|
-
_ref$status = _ref.status,
|
|
65
|
-
status = _ref$status === void 0 ? 'unchanged' : _ref$status,
|
|
66
|
-
append = _ref.append,
|
|
67
|
-
tooltipContent = _ref.tooltipContent,
|
|
68
|
-
suggestions = _ref.suggestions,
|
|
69
|
-
id = _ref.id,
|
|
70
|
-
ariaLabel = _ref['aria-label'],
|
|
71
|
-
labelId = _ref['aria-labelledby'],
|
|
72
|
-
_ref$isPreFiltered = _ref.isPreFiltered,
|
|
73
|
-
isPreFiltered = _ref$isPreFiltered === void 0 ? false : _ref$isPreFiltered,
|
|
74
|
-
_ref$isVirtualized = _ref.isVirtualized,
|
|
75
|
-
isVirtualized = _ref$isVirtualized === void 0 ? false : _ref$isVirtualized,
|
|
76
|
-
_ref$fullWidth = _ref.fullWidth,
|
|
77
|
-
fullWidth = _ref$fullWidth === void 0 ? true : _ref$fullWidth,
|
|
78
|
-
_ref$maxHeight = _ref.maxHeight,
|
|
79
|
-
maxHeight = _ref$maxHeight === void 0 ? '60vh' : _ref$maxHeight,
|
|
80
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
81
|
-
/**
|
|
82
|
-
* Popover helpers
|
|
83
|
-
*/
|
|
84
|
-
var _useState = useState(null),
|
|
85
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
86
|
-
popoverRef = _useState2[0],
|
|
87
|
-
setPopoverRef = _useState2[1];
|
|
88
|
-
var _useState3 = useState(false),
|
|
89
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
90
|
-
isPopoverOpen = _useState4[0],
|
|
91
|
-
setIsPopoverOpen = _useState4[1];
|
|
92
|
-
var openPopover = function openPopover() {
|
|
93
|
-
return setIsPopoverOpen(true);
|
|
94
|
-
};
|
|
95
|
-
var closePopover = function closePopover() {
|
|
96
|
-
return setIsPopoverOpen(false);
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Search helpers
|
|
101
|
-
*/
|
|
102
|
-
var searchOnFocus = function searchOnFocus(e) {
|
|
103
|
-
onFocus === null || onFocus === void 0 ? void 0 : onFocus(e);
|
|
104
|
-
openPopover();
|
|
105
|
-
};
|
|
106
|
-
var searchOnBlur = function searchOnBlur(e) {
|
|
107
|
-
onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
|
|
108
|
-
if (!(popoverRef !== null && popoverRef !== void 0 && popoverRef.contains(e.relatedTarget))) {
|
|
109
|
-
closePopover();
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
var searchOnInput = function searchOnInput(e) {
|
|
113
|
-
onInput === null || onInput === void 0 ? void 0 : onInput(e.target);
|
|
114
|
-
openPopover();
|
|
115
|
-
};
|
|
116
|
-
var searchOnChange = function searchOnChange(value) {
|
|
117
|
-
onSearch === null || onSearch === void 0 ? void 0 : onSearch(value);
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Status
|
|
122
|
-
*/
|
|
123
|
-
var icon = '';
|
|
124
|
-
var color = '';
|
|
125
|
-
if (statusMap[status]) {
|
|
126
|
-
icon = statusMap[status].icon || '';
|
|
127
|
-
color = statusMap[status].color || '';
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// EuiFieldText's append accepts an array of elements so start by creating an empty array
|
|
131
|
-
var appendArray = [];
|
|
132
|
-
var _useEuiI18n = useEuiI18n(['euiSuggest.stateSavedTooltip', 'euiSuggest.stateUnsavedTooltip'], ['Saved.', 'Changes have not been saved.']),
|
|
133
|
-
_useEuiI18n2 = _slicedToArray(_useEuiI18n, 2),
|
|
134
|
-
statusSaved = _useEuiI18n2[0],
|
|
135
|
-
statusUnsaved = _useEuiI18n2[1];
|
|
136
|
-
statusMap.saved.tooltip = statusSaved;
|
|
137
|
-
statusMap.unsaved.tooltip = statusUnsaved;
|
|
138
|
-
var statusElement = (status === 'saved' || status === 'unsaved') && ___EmotionJSX(EuiToolTip, {
|
|
139
|
-
position: "left",
|
|
140
|
-
content: tooltipContent || statusMap[status].tooltip
|
|
141
|
-
}, ___EmotionJSX(EuiIcon, {
|
|
142
|
-
className: "euiSuggestInput__statusIcon",
|
|
143
|
-
color: color,
|
|
144
|
-
type: icon
|
|
145
|
-
}));
|
|
146
|
-
|
|
147
|
-
// Push the status element to the array if it is not undefined
|
|
148
|
-
if (statusElement) appendArray.push(statusElement);
|
|
149
|
-
|
|
150
|
-
// Check to see if consumer passed an append item and if so, add it to the array
|
|
151
|
-
if (append) appendArray.push(append);
|
|
152
|
-
var _useEuiI18n3 = useEuiI18n(['euiSuggest.stateLoading', 'euiSuggest.stateSaved', 'euiSuggest.stateUnsaved', 'euiSuggest.stateUnchanged'], ['State: loading.', 'State: saved.', 'State: unsaved.', 'State: unchanged.']),
|
|
153
|
-
_useEuiI18n4 = _slicedToArray(_useEuiI18n3, 4),
|
|
154
|
-
stateLoading = _useEuiI18n4[0],
|
|
155
|
-
stateSaved = _useEuiI18n4[1],
|
|
156
|
-
stateUnsaved = _useEuiI18n4[2],
|
|
157
|
-
stateUnchanged = _useEuiI18n4[3];
|
|
158
|
-
var stateMessageMap = {
|
|
159
|
-
loading: stateLoading,
|
|
160
|
-
saved: stateSaved,
|
|
161
|
-
unsaved: stateUnsaved,
|
|
162
|
-
unchanged: stateUnchanged
|
|
163
|
-
};
|
|
164
|
-
var stateMessage = stateMessageMap[status];
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Options list
|
|
168
|
-
*/
|
|
169
|
-
var suggestionList = suggestions.map(function (props) {
|
|
170
|
-
// Omit props destined for the EuiSuggestItem so that they don't
|
|
171
|
-
// cause warnings or render in the DOM of the EuiSelectableItem
|
|
172
|
-
var data = {};
|
|
173
|
-
var liProps = {
|
|
174
|
-
label: props.label
|
|
175
|
-
};
|
|
176
|
-
Object.keys(props).forEach(function (key) {
|
|
177
|
-
if (suggestItemPropsKeys.includes(key)) {
|
|
178
|
-
// @ts-ignore string index type
|
|
179
|
-
data[key] = props[key];
|
|
180
|
-
} else {
|
|
181
|
-
// @ts-ignore string index type
|
|
182
|
-
liProps[key] = props[key];
|
|
183
|
-
}
|
|
184
|
-
});
|
|
185
|
-
return _objectSpread(_objectSpread({}, liProps), {}, {
|
|
186
|
-
data: data,
|
|
187
|
-
className: classNames(props.className, 'euiSuggestItemOption'),
|
|
188
|
-
// Force truncation if `isVirtualized` is true
|
|
189
|
-
truncate: isVirtualized ? true : props.truncate
|
|
190
|
-
});
|
|
191
|
-
});
|
|
192
|
-
var renderOption = useCallback(function (props) {
|
|
193
|
-
return ___EmotionJSX(EuiSuggestItem, props);
|
|
194
|
-
}, []);
|
|
195
|
-
var onItemSelect = useCallback(function (options) {
|
|
196
|
-
if (onItemClick) {
|
|
197
|
-
var selectedIndex = options.findIndex(function (option) {
|
|
198
|
-
return option.checked === 'on';
|
|
199
|
-
});
|
|
200
|
-
if (selectedIndex >= 0) {
|
|
201
|
-
var selectedSuggestion = suggestions[selectedIndex];
|
|
202
|
-
onItemClick(selectedSuggestion);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
}, [onItemClick, suggestions]);
|
|
206
|
-
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(EuiSelectable, {
|
|
207
|
-
selectableScreenReaderText: stateMessage,
|
|
208
|
-
singleSelection: true,
|
|
209
|
-
height: isVirtualized ? undefined : 'full',
|
|
210
|
-
options: suggestionList,
|
|
211
|
-
renderOption: renderOption,
|
|
212
|
-
onChange: onItemSelect,
|
|
213
|
-
listProps: {
|
|
214
|
-
bordered: false,
|
|
215
|
-
showIcons: false,
|
|
216
|
-
onFocusBadge: false,
|
|
217
|
-
paddingSize: 'none',
|
|
218
|
-
textWrap: isVirtualized ? 'truncate' : 'wrap',
|
|
219
|
-
isVirtualized: isVirtualized
|
|
220
|
-
},
|
|
221
|
-
searchable: true,
|
|
222
|
-
isPreFiltered: isPreFiltered,
|
|
223
|
-
searchProps: _objectSpread({
|
|
224
|
-
id: id,
|
|
225
|
-
append: appendArray.length ? appendArray : undefined,
|
|
226
|
-
fullWidth: fullWidth,
|
|
227
|
-
isLoading: status === 'loading' ? true : false,
|
|
228
|
-
onFocus: searchOnFocus,
|
|
229
|
-
onBlur: searchOnBlur,
|
|
230
|
-
onInput: searchOnInput,
|
|
231
|
-
onChange: searchOnChange,
|
|
232
|
-
'aria-label': ariaLabel,
|
|
233
|
-
'aria-labelledby': labelId
|
|
234
|
-
}, rest)
|
|
235
|
-
}, function (list, search) {
|
|
236
|
-
return ___EmotionJSX(EuiInputPopover, {
|
|
237
|
-
disableFocusTrap: true,
|
|
238
|
-
input: ___EmotionJSX(React.Fragment, null, search),
|
|
239
|
-
isOpen: isPopoverOpen,
|
|
240
|
-
panelPaddingSize: "none",
|
|
241
|
-
fullWidth: fullWidth,
|
|
242
|
-
closePopover: closePopover,
|
|
243
|
-
panelRef: setPopoverRef,
|
|
244
|
-
panelProps: {
|
|
245
|
-
'aria-live': undefined,
|
|
246
|
-
'aria-modal': false,
|
|
247
|
-
role: undefined
|
|
248
|
-
}
|
|
249
|
-
}, ___EmotionJSX("div", {
|
|
250
|
-
style: {
|
|
251
|
-
maxHeight: maxHeight
|
|
252
|
-
},
|
|
253
|
-
className: "eui-yScroll"
|
|
254
|
-
}, list));
|
|
255
|
-
}));
|
|
256
|
-
};
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["className", "label", "type", "labelWidth", "description", "truncate", "onClick"];
|
|
4
|
-
/*
|
|
5
|
-
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
6
|
-
* or more contributor license agreements. Licensed under the Elastic License
|
|
7
|
-
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
8
|
-
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
9
|
-
* Side Public License, v 1.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import React from 'react';
|
|
13
|
-
import { keysOf } from '../common';
|
|
14
|
-
import classNames from 'classnames';
|
|
15
|
-
import { EuiIcon } from '../icon';
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @deprecated
|
|
19
|
-
*/
|
|
20
|
-
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
21
|
-
var colorToClassNameMap = {
|
|
22
|
-
tint0: 'euiSuggestItem__type--tint0',
|
|
23
|
-
tint1: 'euiSuggestItem__type--tint1',
|
|
24
|
-
tint2: 'euiSuggestItem__type--tint2',
|
|
25
|
-
tint3: 'euiSuggestItem__type--tint3',
|
|
26
|
-
tint4: 'euiSuggestItem__type--tint4',
|
|
27
|
-
tint5: 'euiSuggestItem__type--tint5',
|
|
28
|
-
tint6: 'euiSuggestItem__type--tint6',
|
|
29
|
-
tint7: 'euiSuggestItem__type--tint7',
|
|
30
|
-
tint8: 'euiSuggestItem__type--tint8',
|
|
31
|
-
tint9: 'euiSuggestItem__type--tint9',
|
|
32
|
-
tint10: 'euiSuggestItem__type--tint10'
|
|
33
|
-
};
|
|
34
|
-
export var COLORS = keysOf(colorToClassNameMap);
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* @deprecated - EuiSuggest is scheduled for deprecation due to low internal usage and high
|
|
38
|
-
* overlap with other existing EUI components. We recommend using EuiSelectable instead,
|
|
39
|
-
* or copying this component into your own application for usage if necessary.
|
|
40
|
-
*
|
|
41
|
-
* The component will be permanently removed in October 2023.
|
|
42
|
-
*/
|
|
43
|
-
export var EuiSuggestItem = function EuiSuggestItem(_ref) {
|
|
44
|
-
var className = _ref.className,
|
|
45
|
-
label = _ref.label,
|
|
46
|
-
type = _ref.type,
|
|
47
|
-
_ref$labelWidth = _ref.labelWidth,
|
|
48
|
-
labelWidth = _ref$labelWidth === void 0 ? '50' : _ref$labelWidth,
|
|
49
|
-
description = _ref.description,
|
|
50
|
-
_ref$truncate = _ref.truncate,
|
|
51
|
-
truncate = _ref$truncate === void 0 ? true : _ref$truncate,
|
|
52
|
-
onClick = _ref.onClick,
|
|
53
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
54
|
-
var classes = classNames('euiSuggestItem', {
|
|
55
|
-
'euiSuggestItem--truncate': truncate
|
|
56
|
-
}, className);
|
|
57
|
-
var labelClassNames = classNames('euiSuggestItem__label', "euiSuggestItem__label--width".concat(labelWidth));
|
|
58
|
-
var descriptionClassNames = classNames('euiSuggestItem__description', {
|
|
59
|
-
'euiSuggestItem__description--wrap': !truncate
|
|
60
|
-
});
|
|
61
|
-
var typeColorClass = '';
|
|
62
|
-
if (type && type.color) {
|
|
63
|
-
if (COLORS.indexOf(type.color) > -1) {
|
|
64
|
-
typeColorClass = colorToClassNameMap[type.color];
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
var innerContent = ___EmotionJSX(React.Fragment, null, ___EmotionJSX("span", {
|
|
68
|
-
className: "euiSuggestItem__type ".concat(typeColorClass)
|
|
69
|
-
}, ___EmotionJSX(EuiIcon, {
|
|
70
|
-
type: type.iconType,
|
|
71
|
-
color: "inherit" // forces the icon to inherit its parent color
|
|
72
|
-
})), ___EmotionJSX("span", {
|
|
73
|
-
className: labelClassNames,
|
|
74
|
-
title: label
|
|
75
|
-
}, label), description && ___EmotionJSX("span", {
|
|
76
|
-
className: descriptionClassNames,
|
|
77
|
-
title: description
|
|
78
|
-
}, description));
|
|
79
|
-
if (onClick) {
|
|
80
|
-
return ___EmotionJSX("button", _extends({
|
|
81
|
-
onClick: onClick,
|
|
82
|
-
className: classes
|
|
83
|
-
}, rest), innerContent);
|
|
84
|
-
} else {
|
|
85
|
-
return ___EmotionJSX("span", _extends({
|
|
86
|
-
className: classes
|
|
87
|
-
}, rest), innerContent);
|
|
88
|
-
}
|
|
89
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
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
|
-
|
|
9
|
-
export var ALL_STATUSES = ['unsaved', 'saved', 'unchanged', 'loading'];
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
var _accessibleClickKeys;
|
|
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
|
-
|
|
11
|
-
import { ENTER, SPACE } from '../keys';
|
|
12
|
-
|
|
13
|
-
// These keys are used to execute click actions on interactive elements like buttons and links.
|
|
14
|
-
export var accessibleClickKeys = (_accessibleClickKeys = {}, _defineProperty(_accessibleClickKeys, ENTER, 'enter'), _defineProperty(_accessibleClickKeys, SPACE, 'space'), _accessibleClickKeys);
|
|
@@ -1,28 +0,0 @@
|
|
|
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
|
-
|
|
9
|
-
/**
|
|
10
|
-
* These keys are used for navigating cascading menu UI components.
|
|
11
|
-
*
|
|
12
|
-
* ARROW_DOWN: Select the next item in the list.
|
|
13
|
-
* ARROW_LEFT: Show the previous menu.
|
|
14
|
-
* ARROW_RIGHT: Show the next menu for the selected item.
|
|
15
|
-
* ARROW_UP: Select the previous item in the list.
|
|
16
|
-
* ESC: Deselect the current selection and hide the list.
|
|
17
|
-
* TAB: Normal tabbing navigation is still supported.
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
import { ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT, ARROW_UP, ESCAPE, TAB } from '../keys';
|
|
21
|
-
export var cascadingMenuKeys = {
|
|
22
|
-
ARROW_DOWN: ARROW_DOWN,
|
|
23
|
-
ARROW_LEFT: ARROW_LEFT,
|
|
24
|
-
ARROW_RIGHT: ARROW_RIGHT,
|
|
25
|
-
ARROW_UP: ARROW_UP,
|
|
26
|
-
ESCAPE: ESCAPE,
|
|
27
|
-
TAB: TAB
|
|
28
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
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
|
-
|
|
9
|
-
/**
|
|
10
|
-
* These keys are used for navigating combobox UI components.
|
|
11
|
-
*
|
|
12
|
-
* ARROW_UP: Select the previous item in the list.
|
|
13
|
-
* ARROW_DOWN: Select the next item in the list.
|
|
14
|
-
* ENTER / TAB: Complete input with the current selection.
|
|
15
|
-
* ESC: Deselect the current selection and hide the list.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
import { ARROW_DOWN, ENTER, ESCAPE, TAB, ARROW_UP } from '../keys';
|
|
19
|
-
export var comboBoxKeys = {
|
|
20
|
-
ARROW_DOWN: ARROW_DOWN,
|
|
21
|
-
ARROW_UP: ARROW_UP,
|
|
22
|
-
ENTER: ENTER,
|
|
23
|
-
ESCAPE: ESCAPE,
|
|
24
|
-
TAB: TAB
|
|
25
|
-
};
|