@elastic/eui 121.0.0 → 122.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-icons.json +37 -37
- package/es/components/combo_box/combo_box_options_list/combo_box_options_list.js +8 -2
- package/es/components/datagrid/body/cell/data_grid_cell.js +8 -5
- package/es/components/datagrid/body/cell/data_grid_cell.styles.js +1 -1
- package/es/components/datagrid/body/cell/data_grid_cell_wrapper.js +4 -2
- package/es/components/datagrid/body/footer/data_grid_footer_row.js +4 -0
- package/es/components/datagrid/body/header/column_resizer.js +74 -87
- package/es/components/datagrid/body/header/data_grid_control_header_cell.js +2 -1
- package/es/components/datagrid/body/header/data_grid_header_cell.js +1 -0
- package/es/components/datagrid/body/header/data_grid_header_cell_wrapper.js +9 -3
- package/es/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +1 -1
- package/es/components/datagrid/controls/keyboard_shortcuts.js +17 -1
- package/es/components/datagrid/data_grid.js +2 -0
- package/es/components/datagrid/utils/copy_focused_cell.js +34 -0
- package/es/components/filter_group/filter_group.a11y.js +1 -1
- package/es/components/form/super_select/super_select.js +247 -351
- package/es/components/list_item_layout/_list_item_layout.js +12 -0
- package/es/components/selectable/selectable_list/selectable_list_item.js +9 -7
- package/eui.d.ts +69 -95
- package/i18ntokens.json +608 -554
- package/lib/components/combo_box/combo_box_options_list/combo_box_options_list.js +8 -2
- package/lib/components/datagrid/body/cell/data_grid_cell.js +8 -5
- package/lib/components/datagrid/body/cell/data_grid_cell.styles.js +1 -1
- package/lib/components/datagrid/body/cell/data_grid_cell_wrapper.js +4 -2
- package/lib/components/datagrid/body/footer/data_grid_footer_row.js +4 -0
- package/lib/components/datagrid/body/header/column_resizer.js +73 -85
- package/lib/components/datagrid/body/header/data_grid_control_header_cell.js +2 -1
- package/lib/components/datagrid/body/header/data_grid_header_cell.js +1 -0
- package/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.js +9 -3
- package/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +1 -1
- package/lib/components/datagrid/controls/keyboard_shortcuts.js +17 -1
- package/lib/components/datagrid/data_grid.js +2 -0
- package/lib/components/datagrid/utils/copy_focused_cell.js +39 -0
- package/lib/components/filter_group/filter_group.a11y.js +1 -1
- package/lib/components/form/super_select/super_select.js +253 -355
- package/lib/components/list_item_layout/_list_item_layout.js +12 -0
- package/lib/components/selectable/selectable_list/selectable_list_item.js +9 -7
- package/optimize/es/components/combo_box/combo_box_options_list/combo_box_options_list.js +8 -2
- package/optimize/es/components/datagrid/body/cell/data_grid_cell.js +5 -4
- package/optimize/es/components/datagrid/body/cell/data_grid_cell.styles.js +1 -1
- package/optimize/es/components/datagrid/body/cell/data_grid_cell_wrapper.js +4 -2
- package/optimize/es/components/datagrid/body/footer/data_grid_footer_row.js +4 -0
- package/optimize/es/components/datagrid/body/header/column_resizer.js +69 -81
- package/optimize/es/components/datagrid/body/header/data_grid_control_header_cell.js +2 -1
- package/optimize/es/components/datagrid/body/header/data_grid_header_cell.js +1 -0
- package/optimize/es/components/datagrid/body/header/data_grid_header_cell_wrapper.js +7 -3
- package/optimize/es/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +1 -1
- package/optimize/es/components/datagrid/controls/keyboard_shortcuts.js +17 -1
- package/optimize/es/components/datagrid/data_grid.js +2 -0
- package/optimize/es/components/datagrid/utils/copy_focused_cell.js +34 -0
- package/optimize/es/components/filter_group/filter_group.a11y.js +1 -1
- package/optimize/es/components/form/super_select/super_select.js +242 -265
- package/optimize/es/components/selectable/selectable_list/selectable_list_item.js +9 -7
- package/optimize/lib/components/combo_box/combo_box_options_list/combo_box_options_list.js +8 -2
- package/optimize/lib/components/datagrid/body/cell/data_grid_cell.js +5 -4
- package/optimize/lib/components/datagrid/body/cell/data_grid_cell.styles.js +1 -1
- package/optimize/lib/components/datagrid/body/cell/data_grid_cell_wrapper.js +4 -2
- package/optimize/lib/components/datagrid/body/footer/data_grid_footer_row.js +4 -0
- package/optimize/lib/components/datagrid/body/header/column_resizer.js +69 -79
- package/optimize/lib/components/datagrid/body/header/data_grid_control_header_cell.js +2 -1
- package/optimize/lib/components/datagrid/body/header/data_grid_header_cell.js +1 -0
- package/optimize/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.js +7 -3
- package/optimize/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +1 -1
- package/optimize/lib/components/datagrid/controls/keyboard_shortcuts.js +17 -1
- package/optimize/lib/components/datagrid/data_grid.js +2 -0
- package/optimize/lib/components/datagrid/utils/copy_focused_cell.js +39 -0
- package/optimize/lib/components/filter_group/filter_group.a11y.js +1 -1
- package/optimize/lib/components/form/super_select/super_select.js +243 -265
- package/optimize/lib/components/selectable/selectable_list/selectable_list_item.js +9 -7
- package/package.json +2 -2
- package/test-env/components/combo_box/combo_box_options_list/combo_box_options_list.js +8 -2
- package/test-env/components/datagrid/body/cell/data_grid_cell.js +8 -5
- package/test-env/components/datagrid/body/cell/data_grid_cell.styles.js +1 -1
- package/test-env/components/datagrid/body/cell/data_grid_cell_wrapper.js +4 -2
- package/test-env/components/datagrid/body/footer/data_grid_footer_row.js +4 -0
- package/test-env/components/datagrid/body/header/column_resizer.js +69 -79
- package/test-env/components/datagrid/body/header/data_grid_control_header_cell.js +2 -1
- package/test-env/components/datagrid/body/header/data_grid_header_cell.js +1 -0
- package/test-env/components/datagrid/body/header/data_grid_header_cell_wrapper.js +9 -3
- package/test-env/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +1 -1
- package/test-env/components/datagrid/controls/keyboard_shortcuts.js +17 -1
- package/test-env/components/datagrid/data_grid.js +2 -0
- package/test-env/components/datagrid/utils/copy_focused_cell.js +16 -0
- package/test-env/components/filter_group/filter_group.a11y.js +1 -1
- package/test-env/components/form/super_select/super_select.js +243 -345
- package/test-env/components/list_item_layout/_list_item_layout.js +12 -0
- package/test-env/components/selectable/selectable_list/selectable_list_item.js +9 -7
|
@@ -7,13 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.EuiSuperSelect = void 0;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
11
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
12
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
14
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
15
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
16
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
18
13
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
19
14
|
var _services = require("../../../services");
|
|
@@ -24,288 +19,271 @@ var _super_select_control = require("./super_select_control");
|
|
|
24
19
|
var _super_select_item = require("./super_select_item");
|
|
25
20
|
var _super_select = require("./super_select.styles");
|
|
26
21
|
var _react2 = require("@emotion/react");
|
|
27
|
-
var _excluded = ["className", "options", "valueOfSelected", "placeholder", "onChange", "isOpen", "isInvalid", "itemClassName", "fullWidth", "popoverProps", "compressed"],
|
|
22
|
+
var _excluded = ["className", "options", "valueOfSelected", "placeholder", "onChange", "onFocus", "onBlur", "isOpen", "isInvalid", "itemClassName", "fullWidth", "popoverProps", "compressed", "isLoading"],
|
|
28
23
|
_excluded2 = ["value", "dropdownDisplay", "inputDisplay", "disabled"];
|
|
29
|
-
|
|
30
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
31
|
-
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
32
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /*
|
|
24
|
+
/*
|
|
33
25
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
34
26
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
35
27
|
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
36
28
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
37
29
|
* Side Public License, v 1.
|
|
38
30
|
*/
|
|
31
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
32
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
39
33
|
var ShiftDirection = /*#__PURE__*/function (ShiftDirection) {
|
|
40
34
|
ShiftDirection["BACK"] = "back";
|
|
41
35
|
ShiftDirection["FORWARD"] = "forward";
|
|
42
36
|
return ShiftDirection;
|
|
43
|
-
}(ShiftDirection || {});
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
37
|
+
}(ShiftDirection || {}); // Runs synchronously on the client before paint, so the mount flag is always
|
|
38
|
+
// set before an interaction can schedule the deferred focus in `openPopover`.
|
|
39
|
+
var useMountEffect = typeof document === 'undefined' ? _react.useEffect : _react.useLayoutEffect;
|
|
40
|
+
var EuiSuperSelectInner = function EuiSuperSelectInner(_ref, ref) {
|
|
41
|
+
var _options$currentIndex;
|
|
42
|
+
var className = _ref.className,
|
|
43
|
+
options = _ref.options,
|
|
44
|
+
valueOfSelected = _ref.valueOfSelected,
|
|
45
|
+
placeholder = _ref.placeholder,
|
|
46
|
+
onChange = _ref.onChange,
|
|
47
|
+
onFocus = _ref.onFocus,
|
|
48
|
+
onBlur = _ref.onBlur,
|
|
49
|
+
isOpen = _ref.isOpen,
|
|
50
|
+
_ref$isInvalid = _ref.isInvalid,
|
|
51
|
+
isInvalid = _ref$isInvalid === void 0 ? false : _ref$isInvalid,
|
|
52
|
+
itemClassName = _ref.itemClassName,
|
|
53
|
+
_ref$fullWidth = _ref.fullWidth,
|
|
54
|
+
fullWidth = _ref$fullWidth === void 0 ? false : _ref$fullWidth,
|
|
55
|
+
popoverProps = _ref.popoverProps,
|
|
56
|
+
_ref$compressed = _ref.compressed,
|
|
57
|
+
compressed = _ref$compressed === void 0 ? false : _ref$compressed,
|
|
58
|
+
_ref$isLoading = _ref.isLoading,
|
|
59
|
+
isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
|
|
60
|
+
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
61
|
+
var styles = (0, _services.useEuiMemoizedStyles)(_super_select.euiSuperSelectStyles);
|
|
62
|
+
var itemNodes = (0, _react.useRef)([]);
|
|
63
|
+
var isMounted = (0, _react.useRef)(false);
|
|
64
|
+
var controlButtonRef = (0, _react.useRef)(null);
|
|
65
|
+
var _useState = (0, _react.useState)(function () {
|
|
66
|
+
return (0, _services.htmlIdGenerator)('euiSuperSelect_')('_screenreaderDescribeId');
|
|
67
|
+
}),
|
|
68
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 1),
|
|
69
|
+
describedById = _useState2[0];
|
|
70
|
+
var _useState3 = (0, _react.useState)(isOpen || false),
|
|
71
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
72
|
+
isPopoverOpen = _useState4[0],
|
|
73
|
+
setIsPopoverOpen = _useState4[1];
|
|
74
|
+
var _useState5 = (0, _react.useState)(0),
|
|
75
|
+
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
76
|
+
currentIndex = _useState6[0],
|
|
77
|
+
setCurrentIndex = _useState6[1];
|
|
78
|
+
var setItemNode = function setItemNode(node, index) {
|
|
79
|
+
itemNodes.current[index] = node;
|
|
80
|
+
};
|
|
81
|
+
var focusItemAt = (0, _react.useCallback)(function (index) {
|
|
82
|
+
var _itemNodes$current$in;
|
|
83
|
+
(_itemNodes$current$in = itemNodes.current[index]) === null || _itemNodes$current$in === void 0 || _itemNodes$current$in.focus();
|
|
84
|
+
}, []);
|
|
85
|
+
var openPopover = (0, _react.useCallback)(function () {
|
|
86
|
+
var indexOfSelected = options.findIndex(function (option) {
|
|
87
|
+
return (option === null || option === void 0 ? void 0 : option.value) === valueOfSelected;
|
|
62
88
|
});
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
options = _this$props.options,
|
|
66
|
-
valueOfSelected = _this$props.valueOfSelected;
|
|
67
|
-
var indexOfSelected = options.findIndex(function (option) {
|
|
68
|
-
return (option === null || option === void 0 ? void 0 : option.value) === valueOfSelected;
|
|
69
|
-
});
|
|
70
|
-
var candidateIndex = valueOfSelected != null && indexOfSelected >= 0 ? indexOfSelected : 0;
|
|
71
|
-
var initialIndex = candidateIndex;
|
|
89
|
+
var candidateIndex = valueOfSelected != null && indexOfSelected >= 0 ? indexOfSelected : 0;
|
|
90
|
+
var initialIndex = candidateIndex;
|
|
72
91
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
});
|
|
92
|
+
// If the item is disabled, find the first focusable item going forward
|
|
93
|
+
while (initialIndex < options.length && (_options$initialIndex = options[initialIndex]) !== null && _options$initialIndex !== void 0 && _options$initialIndex.disabled) {
|
|
94
|
+
var _options$initialIndex;
|
|
95
|
+
initialIndex++;
|
|
96
|
+
}
|
|
97
|
+
if (initialIndex >= options.length) {
|
|
98
|
+
initialIndex = candidateIndex;
|
|
99
|
+
}
|
|
100
|
+
setIsPopoverOpen(options.length > 0);
|
|
101
|
+
setCurrentIndex(initialIndex);
|
|
102
|
+
requestAnimationFrame(function () {
|
|
85
103
|
requestAnimationFrame(function () {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
});
|
|
104
|
+
if (!isMounted.current) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
focusItemAt(initialIndex);
|
|
108
|
+
if (onFocus) {
|
|
109
|
+
onFocus();
|
|
110
|
+
}
|
|
95
111
|
});
|
|
96
112
|
});
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
});
|
|
113
|
+
}, [options, valueOfSelected, onFocus, focusItemAt]);
|
|
114
|
+
var closePopover = (0, _react.useCallback)(function () {
|
|
115
|
+
setIsPopoverOpen(false);
|
|
116
|
+
setCurrentIndex(-1);
|
|
102
117
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
});
|
|
108
|
-
if (_this.props.onBlur) {
|
|
109
|
-
_this.props.onBlur();
|
|
110
|
-
}
|
|
118
|
+
// Refocus back to the toggling control button on popover close
|
|
119
|
+
requestAnimationFrame(function () {
|
|
120
|
+
var _controlButtonRef$cur;
|
|
121
|
+
(_controlButtonRef$cur = controlButtonRef.current) === null || _controlButtonRef$cur === void 0 || _controlButtonRef$cur.focus();
|
|
111
122
|
});
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
123
|
+
if (onBlur) {
|
|
124
|
+
onBlur();
|
|
125
|
+
}
|
|
126
|
+
}, [onBlur]);
|
|
127
|
+
(0, _react.useImperativeHandle)(ref, function () {
|
|
128
|
+
return {
|
|
129
|
+
openPopover: openPopover,
|
|
130
|
+
closePopover: closePopover
|
|
131
|
+
};
|
|
132
|
+
}, [openPopover, closePopover]);
|
|
133
|
+
var itemClicked = function itemClicked(value) {
|
|
134
|
+
closePopover();
|
|
135
|
+
if (onChange) {
|
|
136
|
+
onChange(value);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
var onSelectKeyDown = function onSelectKeyDown(event) {
|
|
140
|
+
// Mimic the ways native `<select>`s can be opened via keypress
|
|
141
|
+
if (event.key === _services.keys.ARROW_UP || event.key === _services.keys.ARROW_DOWN || event.key === _services.keys.SPACE) {
|
|
142
|
+
event.preventDefault();
|
|
143
|
+
event.stopPropagation();
|
|
144
|
+
openPopover();
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
var onItemKeyDown = function onItemKeyDown(event) {
|
|
148
|
+
switch (event.key) {
|
|
149
|
+
case _services.keys.ESCAPE:
|
|
150
|
+
// close the popover and prevent ancestors from handling
|
|
121
151
|
event.preventDefault();
|
|
122
152
|
event.stopPropagation();
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
event.preventDefault();
|
|
142
|
-
event.stopPropagation();
|
|
143
|
-
_this.shiftFocus(ShiftDirection.BACK);
|
|
144
|
-
break;
|
|
145
|
-
case _services.keys.ARROW_DOWN:
|
|
146
|
-
event.preventDefault();
|
|
147
|
-
event.stopPropagation();
|
|
148
|
-
_this.shiftFocus(ShiftDirection.FORWARD);
|
|
149
|
-
break;
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
return _this;
|
|
153
|
-
}
|
|
154
|
-
(0, _inherits2.default)(EuiSuperSelect, _Component);
|
|
155
|
-
return (0, _createClass2.default)(EuiSuperSelect, [{
|
|
156
|
-
key: "componentDidMount",
|
|
157
|
-
value: function componentDidMount() {
|
|
158
|
-
this._isMounted = true;
|
|
159
|
-
if (this.props.isOpen) {
|
|
160
|
-
this.openPopover();
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}, {
|
|
164
|
-
key: "componentWillUnmount",
|
|
165
|
-
value: function componentWillUnmount() {
|
|
166
|
-
this._isMounted = false;
|
|
153
|
+
closePopover();
|
|
154
|
+
break;
|
|
155
|
+
case _services.keys.TAB:
|
|
156
|
+
// Mimic native `<select>` behavior, which selects an item on tab press
|
|
157
|
+
event.preventDefault();
|
|
158
|
+
event.stopPropagation();
|
|
159
|
+
event.target.click();
|
|
160
|
+
break;
|
|
161
|
+
case _services.keys.ARROW_UP:
|
|
162
|
+
event.preventDefault();
|
|
163
|
+
event.stopPropagation();
|
|
164
|
+
shiftFocus(ShiftDirection.BACK);
|
|
165
|
+
break;
|
|
166
|
+
case _services.keys.ARROW_DOWN:
|
|
167
|
+
event.preventDefault();
|
|
168
|
+
event.stopPropagation();
|
|
169
|
+
shiftFocus(ShiftDirection.FORWARD);
|
|
170
|
+
break;
|
|
167
171
|
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
(
|
|
172
|
+
};
|
|
173
|
+
var shiftFocus = function shiftFocus(direction) {
|
|
174
|
+
if (currentIndex === -1) {
|
|
175
|
+
// somehow the select options has lost focus
|
|
176
|
+
focusItemAt(0);
|
|
177
|
+
setCurrentIndex(0);
|
|
178
|
+
return;
|
|
173
179
|
}
|
|
174
|
-
}, {
|
|
175
|
-
key: "shiftFocus",
|
|
176
|
-
value: function shiftFocus(direction) {
|
|
177
|
-
var options = this.props.options;
|
|
178
|
-
var currentIndex = this.state.currentIndex;
|
|
179
|
-
if (currentIndex === -1) {
|
|
180
|
-
// somehow the select options has lost focus
|
|
181
|
-
this.focusItemAt(0);
|
|
182
|
-
this.setState({
|
|
183
|
-
currentIndex: 0
|
|
184
|
-
});
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
180
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
});
|
|
199
|
-
return;
|
|
200
|
-
}
|
|
201
|
-
nextIndex += step;
|
|
181
|
+
// Note: this component purposely does not cycle arrow key navigation
|
|
182
|
+
// to match native <select> elements
|
|
183
|
+
var step = direction === ShiftDirection.BACK ? -1 : 1;
|
|
184
|
+
var nextIndex = currentIndex + step;
|
|
185
|
+
while (nextIndex >= 0 && nextIndex < options.length) {
|
|
186
|
+
var _options$nextIndex;
|
|
187
|
+
if (!((_options$nextIndex = options[nextIndex]) !== null && _options$nextIndex !== void 0 && _options$nextIndex.disabled)) {
|
|
188
|
+
focusItemAt(nextIndex);
|
|
189
|
+
setCurrentIndex(nextIndex);
|
|
190
|
+
return;
|
|
202
191
|
}
|
|
192
|
+
nextIndex += step;
|
|
203
193
|
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
var _this$props2 = this.props,
|
|
210
|
-
className = _this$props2.className,
|
|
211
|
-
options = _this$props2.options,
|
|
212
|
-
valueOfSelected = _this$props2.valueOfSelected,
|
|
213
|
-
placeholder = _this$props2.placeholder,
|
|
214
|
-
onChange = _this$props2.onChange,
|
|
215
|
-
isOpen = _this$props2.isOpen,
|
|
216
|
-
isInvalid = _this$props2.isInvalid,
|
|
217
|
-
itemClassName = _this$props2.itemClassName,
|
|
218
|
-
fullWidth = _this$props2.fullWidth,
|
|
219
|
-
popoverProps = _this$props2.popoverProps,
|
|
220
|
-
compressed = _this$props2.compressed,
|
|
221
|
-
rest = (0, _objectWithoutProperties2.default)(_this$props2, _excluded);
|
|
222
|
-
var popoverClasses = (0, _classnames.default)('euiSuperSelect', popoverProps === null || popoverProps === void 0 ? void 0 : popoverProps.className);
|
|
223
|
-
var button = (0, _react2.jsx)(_super_select_control.EuiSuperSelectControl, (0, _extends2.default)({
|
|
224
|
-
options: options,
|
|
225
|
-
value: valueOfSelected,
|
|
226
|
-
placeholder: placeholder,
|
|
227
|
-
onClick: this.state.isPopoverOpen ? this.closePopover : this.openPopover,
|
|
228
|
-
onKeyDown: this.onSelectKeyDown,
|
|
229
|
-
className: className,
|
|
230
|
-
fullWidth: fullWidth,
|
|
231
|
-
isInvalid: isInvalid,
|
|
232
|
-
compressed: compressed
|
|
233
|
-
}, rest, {
|
|
234
|
-
buttonRef: this.controlButtonRef,
|
|
235
|
-
isDropdownOpen: this.state.isPopoverOpen
|
|
236
|
-
}));
|
|
237
|
-
var items = options.map(function (option, index) {
|
|
238
|
-
var value = option.value,
|
|
239
|
-
dropdownDisplay = option.dropdownDisplay,
|
|
240
|
-
inputDisplay = option.inputDisplay,
|
|
241
|
-
disabled = option.disabled,
|
|
242
|
-
optionRest = (0, _objectWithoutProperties2.default)(option, _excluded2);
|
|
243
|
-
if (value == null) return;
|
|
244
|
-
return (0, _react2.jsx)(_super_select_item.EuiSuperSelectItem, (0, _extends2.default)({
|
|
245
|
-
key: index
|
|
246
|
-
/* NOTE: This should rather use "li" to align select-like behavior. But the current
|
|
247
|
-
implementation relies on the interactive and focusable item for the navigation.
|
|
248
|
-
This will require additional refactoring to adjust but we might want to decide first
|
|
249
|
-
if the effort is worth it, considering the unification plans for selection components
|
|
250
|
-
as part of OneSelect (https://github.com/elastic/eui/issues/8808).
|
|
251
|
-
*/,
|
|
252
|
-
element: "button",
|
|
253
|
-
id: String(value),
|
|
254
|
-
className: itemClassName,
|
|
255
|
-
checked: valueOfSelected === value ? 'on' : undefined,
|
|
256
|
-
isSelected: valueOfSelected === value,
|
|
257
|
-
isFocused: _this2.state.currentIndex === index,
|
|
258
|
-
isSingleSelection: true,
|
|
259
|
-
isDisabled: disabled,
|
|
260
|
-
textWrap: "wrap",
|
|
261
|
-
onClick: function onClick() {
|
|
262
|
-
return _this2.itemClicked(value);
|
|
263
|
-
},
|
|
264
|
-
onKeyDown: _this2.onItemKeyDown,
|
|
265
|
-
ref: function ref(node) {
|
|
266
|
-
return _this2.setItemNode(node, index);
|
|
267
|
-
},
|
|
268
|
-
"aria-selected": valueOfSelected === value
|
|
269
|
-
}, optionRest), dropdownDisplay || inputDisplay);
|
|
270
|
-
});
|
|
271
|
-
var ariaActiveDescendant = ((_options$this$state$c = options[this.state.currentIndex]) === null || _options$this$state$c === void 0 ? void 0 : _options$this$state$c.value) != null ? String(options[this.state.currentIndex].value) : undefined;
|
|
272
|
-
return (0, _react2.jsx)(_services.RenderWithEuiStylesMemoizer, null, function (stylesMemoizer) {
|
|
273
|
-
var styles = stylesMemoizer(_super_select.euiSuperSelectStyles);
|
|
274
|
-
return (0, _react2.jsx)(_popover.EuiInputPopover, (0, _extends2.default)({
|
|
275
|
-
closePopover: _this2.closePopover,
|
|
276
|
-
panelPaddingSize: "none"
|
|
277
|
-
}, popoverProps, {
|
|
278
|
-
className: popoverClasses,
|
|
279
|
-
isOpen: isOpen || _this2.state.isPopoverOpen,
|
|
280
|
-
input: button,
|
|
281
|
-
fullWidth: fullWidth,
|
|
282
|
-
disableFocusTrap: true // This component handles its own focus manually
|
|
283
|
-
}), (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("p", {
|
|
284
|
-
id: _this2.describedById
|
|
285
|
-
}, (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
286
|
-
token: "euiSuperSelect.screenReaderAnnouncement",
|
|
287
|
-
default: "You are in a form selector and must select a single option. Use the Up and Down arrow keys to navigate or Escape to close."
|
|
288
|
-
}))), (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
289
|
-
token: "euiSuperSelect.ariaLabel",
|
|
290
|
-
default: "Select listbox"
|
|
291
|
-
}, function (ariaLabel) {
|
|
292
|
-
return (0, _react2.jsx)("div", {
|
|
293
|
-
"aria-label": ariaLabel,
|
|
294
|
-
"aria-describedby": _this2.describedById,
|
|
295
|
-
css: styles.euiSuperSelect__listbox,
|
|
296
|
-
className: "euiSuperSelect__listbox eui-scrollBar",
|
|
297
|
-
role: "listbox",
|
|
298
|
-
"aria-activedescendant": ariaActiveDescendant,
|
|
299
|
-
tabIndex: 0
|
|
300
|
-
}, items);
|
|
301
|
-
}));
|
|
302
|
-
});
|
|
194
|
+
};
|
|
195
|
+
useMountEffect(function () {
|
|
196
|
+
isMounted.current = true;
|
|
197
|
+
if (isOpen) {
|
|
198
|
+
openPopover();
|
|
303
199
|
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
200
|
+
return function () {
|
|
201
|
+
isMounted.current = false;
|
|
202
|
+
};
|
|
203
|
+
// The class lifecycle this replaces only ran when the component mounted.
|
|
204
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
205
|
+
}, []);
|
|
206
|
+
var popoverClasses = (0, _classnames.default)('euiSuperSelect', popoverProps === null || popoverProps === void 0 ? void 0 : popoverProps.className);
|
|
207
|
+
var button = (0, _react2.jsx)(_super_select_control.EuiSuperSelectControl, (0, _extends2.default)({
|
|
208
|
+
options: options,
|
|
209
|
+
value: valueOfSelected,
|
|
210
|
+
placeholder: placeholder,
|
|
211
|
+
onClick: isPopoverOpen ? closePopover : openPopover,
|
|
212
|
+
onKeyDown: onSelectKeyDown,
|
|
213
|
+
onFocus: onFocus,
|
|
214
|
+
onBlur: onBlur,
|
|
215
|
+
className: className,
|
|
216
|
+
fullWidth: fullWidth,
|
|
217
|
+
isInvalid: isInvalid,
|
|
218
|
+
compressed: compressed,
|
|
219
|
+
isLoading: isLoading
|
|
220
|
+
}, rest, {
|
|
221
|
+
buttonRef: controlButtonRef,
|
|
222
|
+
isDropdownOpen: isPopoverOpen
|
|
223
|
+
}));
|
|
224
|
+
var items = options.map(function (option, index) {
|
|
225
|
+
var value = option.value,
|
|
226
|
+
dropdownDisplay = option.dropdownDisplay,
|
|
227
|
+
inputDisplay = option.inputDisplay,
|
|
228
|
+
disabled = option.disabled,
|
|
229
|
+
optionRest = (0, _objectWithoutProperties2.default)(option, _excluded2);
|
|
230
|
+
if (value == null) return;
|
|
231
|
+
return (0, _react2.jsx)(_super_select_item.EuiSuperSelectItem, (0, _extends2.default)({
|
|
232
|
+
key: index
|
|
233
|
+
/* NOTE: This should rather use "li" to align select-like behavior. But the current
|
|
234
|
+
implementation relies on the interactive and focusable item for the navigation.
|
|
235
|
+
This will require additional refactoring to adjust but we might want to decide first
|
|
236
|
+
if the effort is worth it, considering the unification plans for selection components
|
|
237
|
+
as part of OneSelect (https://github.com/elastic/eui/issues/8808).
|
|
238
|
+
*/,
|
|
239
|
+
element: "button",
|
|
240
|
+
id: String(value),
|
|
241
|
+
className: itemClassName,
|
|
242
|
+
checked: valueOfSelected === value ? 'on' : undefined,
|
|
243
|
+
isSelected: valueOfSelected === value,
|
|
244
|
+
isFocused: currentIndex === index,
|
|
245
|
+
isSingleSelection: true,
|
|
246
|
+
isDisabled: disabled,
|
|
247
|
+
textWrap: "wrap",
|
|
248
|
+
onClick: function onClick() {
|
|
249
|
+
return itemClicked(value);
|
|
250
|
+
},
|
|
251
|
+
onKeyDown: onItemKeyDown,
|
|
252
|
+
ref: function ref(node) {
|
|
253
|
+
return setItemNode(node, index);
|
|
254
|
+
},
|
|
255
|
+
"aria-selected": valueOfSelected === value
|
|
256
|
+
}, optionRest), dropdownDisplay || inputDisplay);
|
|
257
|
+
});
|
|
258
|
+
var ariaActiveDescendant = ((_options$currentIndex = options[currentIndex]) === null || _options$currentIndex === void 0 ? void 0 : _options$currentIndex.value) != null ? String(options[currentIndex].value) : undefined;
|
|
259
|
+
return (0, _react2.jsx)(_popover.EuiInputPopover, (0, _extends2.default)({
|
|
260
|
+
closePopover: closePopover,
|
|
261
|
+
panelPaddingSize: "none"
|
|
262
|
+
}, popoverProps, {
|
|
263
|
+
className: popoverClasses,
|
|
264
|
+
isOpen: isOpen || isPopoverOpen,
|
|
265
|
+
input: button,
|
|
266
|
+
fullWidth: fullWidth,
|
|
267
|
+
disableFocusTrap: true // This component handles its own focus manually
|
|
268
|
+
}), (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("p", {
|
|
269
|
+
id: describedById
|
|
270
|
+
}, (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
271
|
+
token: "euiSuperSelect.screenReaderAnnouncement",
|
|
272
|
+
default: "You are in a form selector and must select a single option. Use the Up and Down arrow keys to navigate or Escape to close."
|
|
273
|
+
}))), (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
274
|
+
token: "euiSuperSelect.ariaLabel",
|
|
275
|
+
default: "Select listbox"
|
|
276
|
+
}, function (ariaLabel) {
|
|
277
|
+
return (0, _react2.jsx)("div", {
|
|
278
|
+
"aria-label": ariaLabel,
|
|
279
|
+
"aria-describedby": describedById,
|
|
280
|
+
css: styles.euiSuperSelect__listbox,
|
|
281
|
+
className: "euiSuperSelect__listbox eui-scrollBar",
|
|
282
|
+
role: "listbox",
|
|
283
|
+
"aria-activedescendant": ariaActiveDescendant,
|
|
284
|
+
tabIndex: 0
|
|
285
|
+
}, items);
|
|
286
|
+
}));
|
|
287
|
+
};
|
|
288
|
+
var EuiSuperSelect = exports.EuiSuperSelect = /*#__PURE__*/(0, _react.forwardRef)(EuiSuperSelectInner);
|
|
289
|
+
EuiSuperSelect.displayName = 'EuiSuperSelect';
|
|
@@ -16,7 +16,7 @@ var _accessibility = require("../../accessibility");
|
|
|
16
16
|
var _badge = require("../../badge");
|
|
17
17
|
var _list_item_layout = require("../../list_item_layout/_list_item_layout");
|
|
18
18
|
var _react2 = require("@emotion/react");
|
|
19
|
-
var _excluded = ["children", "className", "disabled", "checked", "isFocused", "showIcons", "prepend", "append", "allowExclusions", "singleSelection", "onFocusBadge", "role", "searchable", "toolTipContent", "toolTipProps"],
|
|
19
|
+
var _excluded = ["children", "className", "disabled", "checked", "isFocused", "showIcons", "prepend", "append", "allowExclusions", "singleSelection", "onFocusBadge", "role", "searchable", "toolTipContent", "toolTipProps", "title"],
|
|
20
20
|
_excluded2 = ["children", "className"];
|
|
21
21
|
/*
|
|
22
22
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
@@ -49,6 +49,7 @@ var EuiSelectableListItem = exports.EuiSelectableListItem = function EuiSelectab
|
|
|
49
49
|
searchable = _ref.searchable,
|
|
50
50
|
toolTipContent = _ref.toolTipContent,
|
|
51
51
|
toolTipProps = _ref.toolTipProps,
|
|
52
|
+
title = _ref.title,
|
|
52
53
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
53
54
|
var classes = (0, _classnames.default)('euiSelectableListItem', {
|
|
54
55
|
'euiSelectableListItem-isFocused': isFocused
|
|
@@ -78,10 +79,6 @@ var EuiSelectableListItem = exports.EuiSelectableListItem = function EuiSelectab
|
|
|
78
79
|
var instructions;
|
|
79
80
|
var screenReaderStrings = {
|
|
80
81
|
checked: {
|
|
81
|
-
state: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
82
|
-
token: "euiSelectableListItem.checkedOption",
|
|
83
|
-
default: "Checked option."
|
|
84
|
-
}),
|
|
85
82
|
instructions: (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
86
83
|
token: "euiSelectableListItem.checkOptionInstructions",
|
|
87
84
|
default: "To check this option, press Enter."
|
|
@@ -124,7 +121,8 @@ var EuiSelectableListItem = exports.EuiSelectableListItem = function EuiSelectab
|
|
|
124
121
|
};
|
|
125
122
|
switch (checked) {
|
|
126
123
|
case 'on':
|
|
127
|
-
state
|
|
124
|
+
// the checked state is already announced natively via `aria-checked`/
|
|
125
|
+
// `aria-selected`; additional state text would duplicate the announcement
|
|
128
126
|
instructions = allowExclusions ? screenReaderStrings.excluded.instructions : searchable ? screenReaderStrings.unchecked.instructions : undefined;
|
|
129
127
|
break;
|
|
130
128
|
case 'off':
|
|
@@ -167,7 +165,11 @@ var EuiSelectableListItem = exports.EuiSelectableListItem = function EuiSelectab
|
|
|
167
165
|
className: 'euiSelectableListItem__content'
|
|
168
166
|
},
|
|
169
167
|
textProps: {
|
|
170
|
-
className: 'euiSelectableListItem__text'
|
|
168
|
+
className: 'euiSelectableListItem__text',
|
|
169
|
+
// `title` must not be set on the option element itself - it would become
|
|
170
|
+
// the option's accessible description, causing screen readers to
|
|
171
|
+
// announce the option name twice
|
|
172
|
+
title: title
|
|
171
173
|
},
|
|
172
174
|
tooltipProps: hasToolTip ? _objectSpread({
|
|
173
175
|
content: toolTipContent,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elastic/eui",
|
|
3
3
|
"description": "Elastic UI Component Library",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "122.0.0",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "lib",
|
|
7
7
|
"module": "es",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"@cypress/webpack-dev-server": "^1.7.0",
|
|
112
112
|
"@elastic/datemath": "^5.0.3",
|
|
113
113
|
"@elastic/eslint-plugin-eui": "3.0.0",
|
|
114
|
-
"@elastic/eui-illustrations": "1.0
|
|
114
|
+
"@elastic/eui-illustrations": "1.1.0",
|
|
115
115
|
"@elastic/eui-theme-borealis": "8.0.0",
|
|
116
116
|
"@emotion/babel-plugin": "^11.11.0",
|
|
117
117
|
"@emotion/babel-preset-css-prop": "^11.11.0",
|
|
@@ -34,7 +34,7 @@ var _list_item_layout = require("../../list_item_layout");
|
|
|
34
34
|
var _combo_box_options_list = require("./combo_box_options_list.styles");
|
|
35
35
|
var _react2 = require("@emotion/react");
|
|
36
36
|
var _excluded = ["children"],
|
|
37
|
-
_excluded2 = ["key", "className", "isGroupLabelOption", "label", "value", "prepend", "append", "truncationProps", "toolTipContent", "toolTipProps"],
|
|
37
|
+
_excluded2 = ["key", "className", "isGroupLabelOption", "label", "value", "prepend", "append", "truncationProps", "toolTipContent", "toolTipProps", "title"],
|
|
38
38
|
_excluded3 = ["data-test-subj", "activeOptionIndex", "areAllOptionsSelected", "customOptionText", "fullWidth", "getSelectedOptionForSearchValue", "isCaseSensitive", "isLoading", "listRef", "matchingOptions", "onCloseList", "onCreateOption", "onOptionClick", "onOptionEnterKey", "onScroll", "options", "renderOption", "rootId", "rowHeight", "scrollToIndex", "searchValue", "selectedOptions", "singleSelection", "delimiter", "onFocusBadge", "truncationProps", "listboxAriaLabel", "setListOptionRefs"];
|
|
39
39
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
40
40
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -94,6 +94,7 @@ var EuiComboBoxOptionsList = exports.EuiComboBoxOptionsList = /*#__PURE__*/funct
|
|
|
94
94
|
_truncationProps = option.truncationProps,
|
|
95
95
|
toolTipContent = option.toolTipContent,
|
|
96
96
|
toolTipProps = option.toolTipProps,
|
|
97
|
+
title = option.title,
|
|
97
98
|
rest = (0, _objectWithoutProperties2.default)(option, _excluded2);
|
|
98
99
|
var _this$props2 = _this.props,
|
|
99
100
|
options = _this$props2.options,
|
|
@@ -145,7 +146,6 @@ var EuiComboBoxOptionsList = exports.EuiComboBoxOptionsList = /*#__PURE__*/funct
|
|
|
145
146
|
// loses focus on selecting an option (due to actively removing it from the list)
|
|
146
147
|
,
|
|
147
148
|
id: rootId("_option-".concat(options.indexOf(option))),
|
|
148
|
-
title: hasNativeTruncation && !toolTipContent ? label : undefined,
|
|
149
149
|
key: (_option$key = option.key) !== null && _option$key !== void 0 ? _option$key : option.label,
|
|
150
150
|
prepend: option.prepend,
|
|
151
151
|
append: hasOnFocusBadge ? (0, _react2.jsx)(_react.default.Fragment, null, option.append, hitEnterBadge) : option.append,
|
|
@@ -165,6 +165,12 @@ var EuiComboBoxOptionsList = exports.EuiComboBoxOptionsList = /*#__PURE__*/funct
|
|
|
165
165
|
contentProps: {
|
|
166
166
|
className: 'euiComboBoxOption__content'
|
|
167
167
|
},
|
|
168
|
+
textProps: {
|
|
169
|
+
// `title` must not be set on the option element itself - it would
|
|
170
|
+
// become the option's accessible description, causing screen readers
|
|
171
|
+
// to announce the option name twice
|
|
172
|
+
title: title !== null && title !== void 0 ? title : hasNativeTruncation && !toolTipContent ? label : undefined
|
|
173
|
+
},
|
|
168
174
|
onClick: function onClick() {
|
|
169
175
|
if (onOptionClick) {
|
|
170
176
|
onOptionClick(option);
|