@elastic/eui 94.3.0 → 94.4.1
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/README.md +3 -0
- package/dist/eui_charts_theme.js +1519 -1519
- package/dist/eui_charts_theme.js.map +1 -1
- package/dist/eui_theme_dark.css +41 -497
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +41 -497
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +5 -1
- package/es/components/date_picker/super_date_picker/date_popover/absolute_tab.js +25 -11
- package/es/components/form/form.styles.js +26 -3
- package/es/components/markdown_editor/markdown_editor.js +12 -8
- package/es/components/markdown_editor/markdown_editor.styles.js +29 -0
- package/es/components/markdown_editor/markdown_editor_drop_zone.js +22 -9
- package/es/components/markdown_editor/markdown_editor_drop_zone.styles.js +33 -0
- package/es/components/markdown_editor/markdown_editor_footer.js +11 -2
- package/es/components/markdown_editor/markdown_editor_footer.styles.js +26 -0
- package/es/components/markdown_editor/markdown_editor_text_area.js +6 -1
- package/es/components/markdown_editor/markdown_editor_text_area.styles.js +22 -0
- package/es/components/markdown_editor/markdown_editor_toolbar.js +10 -2
- package/es/components/markdown_editor/markdown_editor_toolbar.styles.js +21 -0
- package/es/components/markdown_editor/markdown_format.js +9 -6
- package/es/components/markdown_editor/markdown_format.styles.js +25 -10
- package/es/components/markdown_editor/plugins/markdown_checkbox/renderer.js +9 -3
- package/es/components/markdown_editor/plugins/markdown_tooltip/renderer.js +13 -2
- package/es/components/selectable/selectable.js +10 -2
- package/es/components/selectable/selectable_list/selectable_list.js +95 -42
- package/es/components/selectable/selectable_list/selectable_list_item.js +234 -204
- package/es/components/selectable/selectable_option.js +9 -1
- package/es/components/selectable/selectable_templates/selectable_template_sitewide.js +10 -2
- package/es/components/text/text_color.js +4 -1
- package/es/components/toast/global_toast_list_item.js +5 -5
- package/eui.d.ts +332 -234
- package/i18ntokens.json +124 -106
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +5 -1
- package/lib/components/date_picker/super_date_picker/date_popover/absolute_tab.js +25 -11
- package/lib/components/form/form.styles.js +30 -4
- package/lib/components/markdown_editor/markdown_editor.js +12 -8
- package/lib/components/markdown_editor/markdown_editor.styles.js +37 -0
- package/lib/components/markdown_editor/markdown_editor_drop_zone.js +20 -8
- package/lib/components/markdown_editor/markdown_editor_drop_zone.styles.js +38 -0
- package/lib/components/markdown_editor/markdown_editor_footer.js +10 -1
- package/lib/components/markdown_editor/markdown_editor_footer.styles.js +33 -0
- package/lib/components/markdown_editor/markdown_editor_text_area.js +6 -1
- package/lib/components/markdown_editor/markdown_editor_text_area.styles.js +29 -0
- package/lib/components/markdown_editor/markdown_editor_toolbar.js +10 -2
- package/lib/components/markdown_editor/markdown_editor_toolbar.styles.js +28 -0
- package/lib/components/markdown_editor/markdown_format.js +8 -5
- package/lib/components/markdown_editor/markdown_format.styles.js +25 -10
- package/lib/components/markdown_editor/plugins/markdown_checkbox/renderer.js +9 -4
- package/lib/components/markdown_editor/plugins/markdown_tooltip/renderer.js +19 -10
- package/lib/components/selectable/selectable.js +10 -2
- package/lib/components/selectable/selectable_list/selectable_list.js +95 -42
- package/lib/components/selectable/selectable_list/selectable_list_item.js +241 -210
- package/lib/components/selectable/selectable_option.js +12 -1
- package/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +10 -2
- package/lib/components/text/text_color.js +6 -2
- package/lib/components/toast/global_toast_list_item.js +5 -5
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +5 -1
- package/optimize/es/components/date_picker/super_date_picker/date_popover/absolute_tab.js +25 -11
- package/optimize/es/components/form/form.styles.js +26 -3
- package/optimize/es/components/markdown_editor/markdown_editor.js +12 -8
- package/optimize/es/components/markdown_editor/markdown_editor.styles.js +29 -0
- package/optimize/es/components/markdown_editor/markdown_editor_drop_zone.js +19 -9
- package/optimize/es/components/markdown_editor/markdown_editor_drop_zone.styles.js +33 -0
- package/optimize/es/components/markdown_editor/markdown_editor_footer.js +11 -2
- package/optimize/es/components/markdown_editor/markdown_editor_footer.styles.js +26 -0
- package/optimize/es/components/markdown_editor/markdown_editor_text_area.js +6 -1
- package/optimize/es/components/markdown_editor/markdown_editor_text_area.styles.js +22 -0
- package/optimize/es/components/markdown_editor/markdown_editor_toolbar.js +10 -2
- package/optimize/es/components/markdown_editor/markdown_editor_toolbar.styles.js +21 -0
- package/optimize/es/components/markdown_editor/markdown_format.js +9 -6
- package/optimize/es/components/markdown_editor/markdown_format.styles.js +25 -10
- package/optimize/es/components/markdown_editor/plugins/markdown_checkbox/renderer.js +9 -3
- package/optimize/es/components/markdown_editor/plugins/markdown_tooltip/renderer.js +13 -2
- package/optimize/es/components/selectable/selectable_list/selectable_list.js +81 -38
- package/optimize/es/components/selectable/selectable_list/selectable_list_item.js +217 -198
- package/optimize/es/components/selectable/selectable_option.js +9 -1
- package/optimize/es/components/text/text_color.js +4 -1
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +5 -1
- package/optimize/lib/components/date_picker/super_date_picker/date_popover/absolute_tab.js +25 -11
- package/optimize/lib/components/form/form.styles.js +30 -4
- package/optimize/lib/components/markdown_editor/markdown_editor.js +12 -8
- package/optimize/lib/components/markdown_editor/markdown_editor.styles.js +37 -0
- package/optimize/lib/components/markdown_editor/markdown_editor_drop_zone.js +24 -16
- package/optimize/lib/components/markdown_editor/markdown_editor_drop_zone.styles.js +38 -0
- package/optimize/lib/components/markdown_editor/markdown_editor_footer.js +10 -1
- package/optimize/lib/components/markdown_editor/markdown_editor_footer.styles.js +33 -0
- package/optimize/lib/components/markdown_editor/markdown_editor_text_area.js +6 -1
- package/optimize/lib/components/markdown_editor/markdown_editor_text_area.styles.js +29 -0
- package/optimize/lib/components/markdown_editor/markdown_editor_toolbar.js +10 -2
- package/optimize/lib/components/markdown_editor/markdown_editor_toolbar.styles.js +28 -0
- package/optimize/lib/components/markdown_editor/markdown_format.js +8 -5
- package/optimize/lib/components/markdown_editor/markdown_format.styles.js +25 -10
- package/optimize/lib/components/markdown_editor/plugins/markdown_checkbox/renderer.js +9 -4
- package/optimize/lib/components/markdown_editor/plugins/markdown_tooltip/renderer.js +19 -10
- package/optimize/lib/components/selectable/selectable_list/selectable_list.js +81 -38
- package/optimize/lib/components/selectable/selectable_list/selectable_list_item.js +224 -204
- package/optimize/lib/components/selectable/selectable_option.js +12 -1
- package/optimize/lib/components/text/text_color.js +6 -2
- package/package.json +5 -12
- package/src/components/date_picker/react-datepicker/LICENSE +21 -0
- package/src/components/date_picker/react-datepicker/README.md +168 -0
- package/src/components/date_picker/super_date_picker/date_popover/_absolute_tab.scss +13 -18
- package/src/components/form/checkbox/_checkbox.scss +23 -6
- package/src/components/index.scss +0 -1
- package/src/components/selectable/selectable_list/_selectable_list_item.scss +4 -0
- package/src/components/selectable/selectable_templates/_selectable_template_sitewide_option.scss +5 -1
- package/src/services/theme/README.md +153 -0
- package/src/test/README.md +44 -0
- package/src/themes/amsterdam/overrides/_index.scss +0 -1
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +5 -1
- package/test-env/components/date_picker/super_date_picker/date_popover/absolute_tab.js +25 -11
- package/test-env/components/form/form.styles.js +30 -4
- package/test-env/components/markdown_editor/markdown_editor.js +12 -8
- package/test-env/components/markdown_editor/markdown_editor.styles.js +37 -0
- package/test-env/components/markdown_editor/markdown_editor_drop_zone.js +24 -16
- package/test-env/components/markdown_editor/markdown_editor_drop_zone.styles.js +38 -0
- package/test-env/components/markdown_editor/markdown_editor_footer.js +10 -1
- package/test-env/components/markdown_editor/markdown_editor_footer.styles.js +33 -0
- package/test-env/components/markdown_editor/markdown_editor_text_area.js +6 -1
- package/test-env/components/markdown_editor/markdown_editor_text_area.styles.js +29 -0
- package/test-env/components/markdown_editor/markdown_editor_toolbar.js +10 -2
- package/test-env/components/markdown_editor/markdown_editor_toolbar.styles.js +28 -0
- package/test-env/components/markdown_editor/markdown_format.js +8 -5
- package/test-env/components/markdown_editor/markdown_format.styles.js +25 -10
- package/test-env/components/markdown_editor/plugins/markdown_checkbox/renderer.js +9 -4
- package/test-env/components/markdown_editor/plugins/markdown_tooltip/renderer.js +19 -10
- package/test-env/components/selectable/selectable.js +10 -2
- package/test-env/components/selectable/selectable_list/selectable_list.js +95 -42
- package/test-env/components/selectable/selectable_list/selectable_list_item.js +233 -205
- package/test-env/components/selectable/selectable_option.js +12 -1
- package/test-env/components/selectable/selectable_templates/selectable_template_sitewide.js +10 -2
- package/test-env/components/text/text_color.js +6 -2
- package/test-env/components/toast/global_toast_list_item.js +5 -5
- package/src/components/markdown_editor/_index.scss +0 -9
- package/src/components/markdown_editor/_markdown_editor.scss +0 -22
- package/src/components/markdown_editor/_markdown_editor_drop_zone.scss +0 -58
- package/src/components/markdown_editor/_markdown_editor_footer.scss +0 -42
- package/src/components/markdown_editor/_markdown_editor_preview.scss +0 -20
- package/src/components/markdown_editor/_markdown_editor_text_area.scss +0 -43
- package/src/components/markdown_editor/_markdown_editor_toolbar.scss +0 -29
- package/src/components/markdown_editor/_markdown_format.scss +0 -78
- package/src/components/markdown_editor/_variables.scss +0 -1
- package/src/components/markdown_editor/plugins/markdown_tooltip.scss +0 -4
- package/src/themes/amsterdam/overrides/_markdown_editor.scss +0 -18
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
var _excluded = ["children", "className", "disabled", "checked", "isFocused", "showIcons", "prepend", "append", "allowExclusions", "onFocusBadge", "paddingSize", "role", "searchable", "textWrap"],
|
|
2
|
-
_excluded2 = ["children", "className"];
|
|
3
1
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
var _excluded = ["children", "className", "disabled", "checked", "isFocused", "showIcons", "prepend", "append", "allowExclusions", "onFocusBadge", "paddingSize", "role", "searchable", "textWrap", "toolTipContent", "toolTipProps", "aria-describedby"],
|
|
3
|
+
_excluded2 = ["children", "className"];
|
|
4
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
5
|
+
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."); }
|
|
6
|
+
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); }
|
|
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
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
9
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
4
10
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
5
|
-
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
|
-
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; }
|
|
7
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
8
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
9
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
10
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
11
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
12
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
13
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
14
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
15
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
16
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
17
11
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
18
12
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
19
13
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
14
|
+
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; }
|
|
15
|
+
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; }
|
|
20
16
|
/*
|
|
21
17
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
22
18
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -27,12 +23,13 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
27
23
|
|
|
28
24
|
import classNames from 'classnames';
|
|
29
25
|
import PropTypes from "prop-types";
|
|
30
|
-
import React, {
|
|
26
|
+
import React, { useState, useEffect, useMemo } from 'react';
|
|
31
27
|
import { keysOf } from '../../common';
|
|
32
28
|
import { EuiI18n } from '../../i18n';
|
|
33
29
|
import { EuiIcon } from '../../icon';
|
|
34
30
|
import { EuiScreenReaderOnly } from '../../accessibility';
|
|
35
31
|
import { EuiBadge } from '../../badge';
|
|
32
|
+
import { EuiToolTip } from '../../tool_tip';
|
|
36
33
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
37
34
|
function resolveIconAndColor(checked) {
|
|
38
35
|
switch (checked) {
|
|
@@ -63,197 +60,222 @@ var paddingSizeToClassNameMap = {
|
|
|
63
60
|
s: 'euiSelectableListItem--paddingSmall'
|
|
64
61
|
};
|
|
65
62
|
export var PADDING_SIZES = keysOf(paddingSizeToClassNameMap);
|
|
66
|
-
export var EuiSelectableListItem =
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
instructions = screenReaderStrings.unchecked.instructions;
|
|
189
|
-
break;
|
|
190
|
-
case 'mixed':
|
|
191
|
-
state = screenReaderStrings.mixed.state;
|
|
192
|
-
instructions = ___EmotionJSX(React.Fragment, null, screenReaderStrings.mixed.instructions, ' ', allowExclusions ? screenReaderStrings.mixed.excludeInstructions : screenReaderStrings.mixed.uncheckInstructions);
|
|
193
|
-
break;
|
|
194
|
-
case undefined:
|
|
195
|
-
default:
|
|
196
|
-
instructions = allowExclusions || searchable ? screenReaderStrings.checked.instructions : undefined;
|
|
197
|
-
break;
|
|
198
|
-
}
|
|
199
|
-
var prependNode;
|
|
200
|
-
if (prepend) {
|
|
201
|
-
prependNode = ___EmotionJSX("span", {
|
|
202
|
-
className: "euiSelectableListItem__prepend"
|
|
203
|
-
}, prepend);
|
|
63
|
+
export var EuiSelectableListItem = function EuiSelectableListItem(_ref) {
|
|
64
|
+
var children = _ref.children,
|
|
65
|
+
className = _ref.className,
|
|
66
|
+
disabled = _ref.disabled,
|
|
67
|
+
checked = _ref.checked,
|
|
68
|
+
isFocused = _ref.isFocused,
|
|
69
|
+
_ref$showIcons = _ref.showIcons,
|
|
70
|
+
showIcons = _ref$showIcons === void 0 ? true : _ref$showIcons,
|
|
71
|
+
prepend = _ref.prepend,
|
|
72
|
+
append = _ref.append,
|
|
73
|
+
allowExclusions = _ref.allowExclusions,
|
|
74
|
+
_ref$onFocusBadge = _ref.onFocusBadge,
|
|
75
|
+
onFocusBadge = _ref$onFocusBadge === void 0 ? true : _ref$onFocusBadge,
|
|
76
|
+
_ref$paddingSize = _ref.paddingSize,
|
|
77
|
+
paddingSize = _ref$paddingSize === void 0 ? 's' : _ref$paddingSize,
|
|
78
|
+
_ref$role = _ref.role,
|
|
79
|
+
role = _ref$role === void 0 ? 'option' : _ref$role,
|
|
80
|
+
searchable = _ref.searchable,
|
|
81
|
+
_ref$textWrap = _ref.textWrap,
|
|
82
|
+
textWrap = _ref$textWrap === void 0 ? 'truncate' : _ref$textWrap,
|
|
83
|
+
toolTipContent = _ref.toolTipContent,
|
|
84
|
+
toolTipProps = _ref.toolTipProps,
|
|
85
|
+
_ariaDescribedBy = _ref['aria-describedby'],
|
|
86
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
87
|
+
var classes = classNames('euiSelectableListItem', {
|
|
88
|
+
'euiSelectableListItem-isFocused': isFocused
|
|
89
|
+
}, paddingSizeToClassNameMap[paddingSize], className);
|
|
90
|
+
var textClasses = classNames('euiSelectableListItem__text', _defineProperty({}, "euiSelectableListItem__text--".concat(textWrap), textWrap));
|
|
91
|
+
var optionIcon = useMemo(function () {
|
|
92
|
+
if (showIcons) {
|
|
93
|
+
var _resolveIconAndColor = resolveIconAndColor(checked),
|
|
94
|
+
icon = _resolveIconAndColor.icon,
|
|
95
|
+
color = _resolveIconAndColor.color;
|
|
96
|
+
return ___EmotionJSX(EuiIcon, {
|
|
97
|
+
className: "euiSelectableListItem__icon",
|
|
98
|
+
color: color,
|
|
99
|
+
type: icon
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}, [showIcons, checked]);
|
|
103
|
+
var prependNode = useMemo(function () {
|
|
104
|
+
if (prepend) {
|
|
105
|
+
return ___EmotionJSX("span", {
|
|
106
|
+
className: "euiSelectableListItem__prepend"
|
|
107
|
+
}, prepend);
|
|
108
|
+
}
|
|
109
|
+
}, [prepend]);
|
|
110
|
+
var onFocusBadgeNode = useMemo(function () {
|
|
111
|
+
var defaultOnFocusBadgeProps = {
|
|
112
|
+
'aria-hidden': true,
|
|
113
|
+
iconType: 'returnKey',
|
|
114
|
+
iconSide: 'left',
|
|
115
|
+
color: 'hollow'
|
|
116
|
+
};
|
|
117
|
+
if (onFocusBadge === true) {
|
|
118
|
+
return ___EmotionJSX(EuiBadge, _extends({
|
|
119
|
+
className: "euiSelectableListItem__onFocusBadge"
|
|
120
|
+
}, defaultOnFocusBadgeProps));
|
|
121
|
+
} else if (typeof onFocusBadge !== 'boolean' && !!onFocusBadge) {
|
|
122
|
+
var _children = onFocusBadge.children,
|
|
123
|
+
_className = onFocusBadge.className,
|
|
124
|
+
restBadgeProps = _objectWithoutProperties(onFocusBadge, _excluded2);
|
|
125
|
+
return ___EmotionJSX(EuiBadge, _extends({
|
|
126
|
+
className: classNames('euiSelectableListItem__onFocusBadge', _className)
|
|
127
|
+
}, defaultOnFocusBadgeProps, restBadgeProps), _children);
|
|
128
|
+
}
|
|
129
|
+
}, [onFocusBadge]);
|
|
130
|
+
var showOnFocusBadge = !!(isFocused && !disabled && onFocusBadgeNode);
|
|
131
|
+
var appendNode = useMemo(function () {
|
|
132
|
+
if (append || showOnFocusBadge) {
|
|
133
|
+
return ___EmotionJSX("span", {
|
|
134
|
+
className: "euiSelectableListItem__append"
|
|
135
|
+
}, append, " ", showOnFocusBadge ? onFocusBadgeNode : null);
|
|
136
|
+
}
|
|
137
|
+
}, [append, showOnFocusBadge, onFocusBadgeNode]);
|
|
138
|
+
var screenReaderText = useMemo(function () {
|
|
139
|
+
var state;
|
|
140
|
+
var instructions;
|
|
141
|
+
var screenReaderStrings = {
|
|
142
|
+
checked: {
|
|
143
|
+
state: ___EmotionJSX(EuiI18n, {
|
|
144
|
+
token: "euiSelectableListItem.checkedOption",
|
|
145
|
+
default: "Checked option."
|
|
146
|
+
}),
|
|
147
|
+
instructions: ___EmotionJSX(EuiI18n, {
|
|
148
|
+
token: "euiSelectableListItem.checkOptionInstructions",
|
|
149
|
+
default: "To check this option, press Enter."
|
|
150
|
+
})
|
|
151
|
+
},
|
|
152
|
+
unchecked: {
|
|
153
|
+
instructions: ___EmotionJSX(EuiI18n, {
|
|
154
|
+
token: "euiSelectableListItem.uncheckOptionInstructions",
|
|
155
|
+
default: "To uncheck this option, press Enter."
|
|
156
|
+
})
|
|
157
|
+
},
|
|
158
|
+
excluded: {
|
|
159
|
+
state: ___EmotionJSX(EuiI18n, {
|
|
160
|
+
token: "euiSelectableListItem.excludedOption",
|
|
161
|
+
default: "Excluded option."
|
|
162
|
+
}),
|
|
163
|
+
instructions: ___EmotionJSX(EuiI18n, {
|
|
164
|
+
token: "euiSelectableListItem.excludeOptionInstructions",
|
|
165
|
+
default: "To exclude this option, press Enter."
|
|
166
|
+
})
|
|
167
|
+
},
|
|
168
|
+
mixed: {
|
|
169
|
+
state: ___EmotionJSX(EuiI18n, {
|
|
170
|
+
token: "euiSelectableListItem.mixedOption",
|
|
171
|
+
default: "Mixed (indeterminate) option."
|
|
172
|
+
}),
|
|
173
|
+
instructions: ___EmotionJSX(EuiI18n, {
|
|
174
|
+
token: "euiSelectableListItem.mixedOptionInstructions",
|
|
175
|
+
default: "To check this option for all, press Enter once."
|
|
176
|
+
}),
|
|
177
|
+
uncheckInstructions: ___EmotionJSX(EuiI18n, {
|
|
178
|
+
token: "euiSelectableListItem.mixedOptionUncheckInstructions",
|
|
179
|
+
default: "To uncheck this option for all, press Enter twice."
|
|
180
|
+
}),
|
|
181
|
+
excludeInstructions: ___EmotionJSX(EuiI18n, {
|
|
182
|
+
token: "euiSelectableListItem.mixedOptionExcludeInstructions",
|
|
183
|
+
default: "To exclude this option for all, press Enter twice."
|
|
184
|
+
})
|
|
204
185
|
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
186
|
+
};
|
|
187
|
+
switch (checked) {
|
|
188
|
+
case 'on':
|
|
189
|
+
state = screenReaderStrings.checked.state;
|
|
190
|
+
instructions = allowExclusions ? screenReaderStrings.excluded.instructions : searchable ? screenReaderStrings.unchecked.instructions : undefined;
|
|
191
|
+
break;
|
|
192
|
+
case 'off':
|
|
193
|
+
state = screenReaderStrings.excluded.state;
|
|
194
|
+
instructions = screenReaderStrings.unchecked.instructions;
|
|
195
|
+
break;
|
|
196
|
+
case 'mixed':
|
|
197
|
+
state = screenReaderStrings.mixed.state;
|
|
198
|
+
instructions = ___EmotionJSX(React.Fragment, null, screenReaderStrings.mixed.instructions, ' ', allowExclusions ? screenReaderStrings.mixed.excludeInstructions : screenReaderStrings.mixed.uncheckInstructions);
|
|
199
|
+
break;
|
|
200
|
+
case undefined:
|
|
201
|
+
default:
|
|
202
|
+
instructions = allowExclusions || searchable ? screenReaderStrings.checked.instructions : undefined;
|
|
203
|
+
break;
|
|
204
|
+
}
|
|
205
|
+
return state || instructions ? ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("div", null, state || instructions ? '. ' : null, state, state && instructions ? ' ' : null, instructions)) : null;
|
|
206
|
+
}, [checked, searchable, allowExclusions]);
|
|
226
207
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
208
|
+
// aria-checked is intended to be used with role="checkbox" but
|
|
209
|
+
// the MDN documentation lists it as a possibility for role="option".
|
|
210
|
+
// See https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-checked
|
|
211
|
+
// and https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/option_role
|
|
212
|
+
var ariaChecked = useMemo(function () {
|
|
213
|
+
var rolesThatCanBeMixed = ['option', 'checkbox', 'menuitemcheckbox'];
|
|
214
|
+
var rolesThatCanBeChecked = [].concat(rolesThatCanBeMixed, ['radio', 'menuitemradio', 'switch']);
|
|
215
|
+
if (!rolesThatCanBeChecked.includes(role)) return undefined;
|
|
216
|
+
switch (checked) {
|
|
217
|
+
case 'on':
|
|
218
|
+
case 'off':
|
|
219
|
+
return true;
|
|
220
|
+
case 'mixed':
|
|
221
|
+
if (rolesThatCanBeMixed.includes(role)) {
|
|
222
|
+
return 'mixed';
|
|
223
|
+
} else {
|
|
224
|
+
return false;
|
|
232
225
|
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
226
|
+
default:
|
|
227
|
+
return false;
|
|
228
|
+
}
|
|
229
|
+
}, [role, checked]);
|
|
230
|
+
var hasToolTip = !!toolTipContent && !disabled;
|
|
231
|
+
var _useState = useState(null),
|
|
232
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
233
|
+
tooltipRef = _useState2[0],
|
|
234
|
+
setTooltipRef = _useState2[1]; // Needs to be state and not a ref to trigger useEffect
|
|
235
|
+
var _useState3 = useState(_ariaDescribedBy),
|
|
236
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
237
|
+
ariaDescribedBy = _useState4[0],
|
|
238
|
+
setAriaDescribedBy = _useState4[1];
|
|
239
|
+
|
|
240
|
+
// Manually trigger the tooltip on keyboard focus
|
|
241
|
+
useEffect(function () {
|
|
242
|
+
if (!tooltipRef) return;
|
|
243
|
+
if (isFocused) {
|
|
244
|
+
tooltipRef.showToolTip();
|
|
245
|
+
} else {
|
|
246
|
+
tooltipRef.hideToolTip();
|
|
248
247
|
}
|
|
249
|
-
}]);
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
}
|
|
248
|
+
}, [isFocused, tooltipRef]);
|
|
249
|
+
|
|
250
|
+
// Manually set the `aria-describedby` id on the <li> wrapper
|
|
251
|
+
useEffect(function () {
|
|
252
|
+
if (tooltipRef) {
|
|
253
|
+
var tooltipId = tooltipRef.state.id;
|
|
254
|
+
setAriaDescribedBy(classNames(tooltipId, _ariaDescribedBy));
|
|
255
|
+
}
|
|
256
|
+
}, [tooltipRef, _ariaDescribedBy]);
|
|
257
|
+
var content = ___EmotionJSX("span", {
|
|
258
|
+
className: "euiSelectableListItem__content"
|
|
259
|
+
}, optionIcon, prependNode, ___EmotionJSX("span", {
|
|
260
|
+
className: textClasses
|
|
261
|
+
}, children, screenReaderText), appendNode);
|
|
262
|
+
return ___EmotionJSX("li", _extends({
|
|
263
|
+
role: role,
|
|
264
|
+
"aria-disabled": disabled,
|
|
265
|
+
"aria-checked": ariaChecked // Whether the item is "checked"
|
|
266
|
+
,
|
|
267
|
+
"aria-selected": !disabled && isFocused // Whether the item has keyboard focus per W3 spec
|
|
268
|
+
,
|
|
269
|
+
className: classes
|
|
270
|
+
}, rest, {
|
|
271
|
+
"aria-describedby": ariaDescribedBy
|
|
272
|
+
}), hasToolTip ? ___EmotionJSX(EuiToolTip, _extends({
|
|
273
|
+
ref: setTooltipRef,
|
|
274
|
+
content: toolTipContent,
|
|
275
|
+
anchorClassName: "euiSelectableListItem__tooltipAnchor",
|
|
276
|
+
position: "left"
|
|
277
|
+
}, toolTipProps), content) : content);
|
|
278
|
+
};
|
|
257
279
|
EuiSelectableListItem.propTypes = {
|
|
258
280
|
className: PropTypes.string,
|
|
259
281
|
"aria-label": PropTypes.string,
|
|
@@ -263,7 +285,7 @@ EuiSelectableListItem.propTypes = {
|
|
|
263
285
|
/**
|
|
264
286
|
* Applies an icon and visual styling to activated items
|
|
265
287
|
*/
|
|
266
|
-
checked: PropTypes.
|
|
288
|
+
checked: PropTypes.any,
|
|
267
289
|
/**
|
|
268
290
|
* Shows icons based on `checked` type
|
|
269
291
|
*/
|
|
@@ -346,5 +368,13 @@ EuiSelectableListItem.propTypes = {
|
|
|
346
368
|
* How to handle long text within the item.
|
|
347
369
|
* Wrapping only works if virtualization is off.
|
|
348
370
|
*/
|
|
349
|
-
textWrap: PropTypes.oneOf(["truncate", "wrap"])
|
|
371
|
+
textWrap: PropTypes.oneOf(["truncate", "wrap"]),
|
|
372
|
+
/**
|
|
373
|
+
* Optional custom tooltip content for the button
|
|
374
|
+
*/
|
|
375
|
+
toolTipContent: PropTypes.node,
|
|
376
|
+
/**
|
|
377
|
+
* Optional props to pass to the underlying **[EuiToolTip](/#/display/tooltip)**
|
|
378
|
+
*/
|
|
379
|
+
toolTipProps: PropTypes.any
|
|
350
380
|
};
|
|
@@ -1 +1,9 @@
|
|
|
1
|
-
|
|
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 OPTION_CHECKED_STATES = ['on', 'off', 'mixed', undefined];
|
|
@@ -375,7 +375,7 @@ EuiSelectableTemplateSitewide.propTypes = {
|
|
|
375
375
|
* 'on' to indicate inclusion, 'off' to indicate exclusion,
|
|
376
376
|
* or 'mixed' to indicate inclusion for some.
|
|
377
377
|
*/
|
|
378
|
-
checked: PropTypes.
|
|
378
|
+
checked: PropTypes.any,
|
|
379
379
|
disabled: PropTypes.bool,
|
|
380
380
|
/**
|
|
381
381
|
* Node to add between the selection icon and the label
|
|
@@ -405,7 +405,15 @@ EuiSelectableTemplateSitewide.propTypes = {
|
|
|
405
405
|
* Note: when searching, custom truncation props are ignored. The highlighted search
|
|
406
406
|
* text will always take precedence.
|
|
407
407
|
*/
|
|
408
|
-
truncationProps: PropTypes.any
|
|
408
|
+
truncationProps: PropTypes.any,
|
|
409
|
+
/**
|
|
410
|
+
* Optional custom tooltip content for the button
|
|
411
|
+
*/
|
|
412
|
+
toolTipContent: PropTypes.node,
|
|
413
|
+
/**
|
|
414
|
+
* Optional props to pass to the underlying **[EuiToolTip](/#/display/tooltip)**
|
|
415
|
+
*/
|
|
416
|
+
toolTipProps: PropTypes.any
|
|
409
417
|
}).isRequired).isRequired,
|
|
410
418
|
/**
|
|
411
419
|
* Override some of the EuiPopover props housing the list.
|
|
@@ -21,6 +21,9 @@ import { useEuiMemoizedStyles, cloneElementWithCss } from '../../services';
|
|
|
21
21
|
import { euiTextColorStyles } from './text_color.styles';
|
|
22
22
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
23
23
|
export var COLORS = ['default', 'subdued', 'success', 'accent', 'danger', 'warning', 'ghost', 'inherit'];
|
|
24
|
+
export var _isNamedColor = function _isNamedColor(color) {
|
|
25
|
+
return COLORS.includes(color);
|
|
26
|
+
};
|
|
24
27
|
export var EuiTextColor = function EuiTextColor(_ref) {
|
|
25
28
|
var children = _ref.children,
|
|
26
29
|
_ref$color = _ref.color,
|
|
@@ -31,7 +34,7 @@ export var EuiTextColor = function EuiTextColor(_ref) {
|
|
|
31
34
|
cloneElement = _ref$cloneElement === void 0 ? false : _ref$cloneElement,
|
|
32
35
|
style = _ref.style,
|
|
33
36
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
34
|
-
var isNamedColor =
|
|
37
|
+
var isNamedColor = _isNamedColor(color);
|
|
35
38
|
var styles = useEuiMemoizedStyles(euiTextColorStyles);
|
|
36
39
|
var cssStyles = [styles.euiTextColor, isNamedColor ? styles[color] : styles.customColor];
|
|
37
40
|
|
|
@@ -33,13 +33,13 @@ export var EuiGlobalToastListItem = function EuiGlobalToastListItem(_ref) {
|
|
|
33
33
|
}));
|
|
34
34
|
};
|
|
35
35
|
EuiGlobalToastListItem.propTypes = {
|
|
36
|
-
className: PropTypes.string,
|
|
37
|
-
"aria-label": PropTypes.string,
|
|
38
|
-
"data-test-subj": PropTypes.string,
|
|
39
|
-
css: PropTypes.any,
|
|
40
36
|
isDismissed: PropTypes.bool,
|
|
41
37
|
/**
|
|
42
38
|
* ReactElement to render as this component's content
|
|
43
39
|
*/
|
|
44
|
-
children: PropTypes.element
|
|
40
|
+
children: PropTypes.element,
|
|
41
|
+
className: PropTypes.string,
|
|
42
|
+
"aria-label": PropTypes.string,
|
|
43
|
+
"data-test-subj": PropTypes.string,
|
|
44
|
+
css: PropTypes.any
|
|
45
45
|
};
|