@elastic/eui 77.1.1 → 77.2.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 +30 -29
- package/dist/eui_theme_dark.css +70 -158
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +70 -158
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/basic_table/basic_table.a11y.js +202 -0
- package/es/components/basic_table/{table.a11y.js → in_memory_table.a11y.js} +1 -1
- package/es/components/date_picker/date_picker.js +23 -15
- package/es/components/date_picker/date_picker_range.js +36 -42
- package/es/components/date_picker/super_date_picker/super_date_picker.js +99 -84
- package/es/components/form/field_number/field_number.js +37 -8
- package/es/components/form/field_text/field_text.js +1 -1
- package/es/components/form/form_control_layout/form_control_layout.js +67 -30
- package/es/components/form/form_control_layout/form_control_layout_delimited.js +31 -11
- package/es/components/form/form_control_layout/form_control_layout_icons.js +12 -20
- package/es/components/form/range/dual_range.js +2 -4
- package/es/components/form/range/range.js +0 -2
- package/es/components/form/range/range_input.js +54 -13
- package/es/components/form/validatable_control/validatable_control.js +15 -5
- package/es/components/search_bar/query/ast_to_es_query_dsl.js +6 -1
- package/es/components/search_bar/query/ast_to_es_query_string.js +3 -0
- package/es/components/suggest/suggest.a11y.js +70 -0
- package/es/components/table/table.a11y.js +75 -0
- package/eui.d.ts +54 -54
- package/i18ntokens.json +26 -8
- package/lib/components/basic_table/basic_table.a11y.js +194 -0
- package/lib/components/basic_table/{table.a11y.js → in_memory_table.a11y.js} +2 -2
- package/lib/components/date_picker/date_picker.js +23 -15
- package/lib/components/date_picker/date_picker_range.js +35 -41
- package/lib/components/date_picker/super_date_picker/super_date_picker.js +99 -84
- package/lib/components/form/field_number/field_number.js +40 -8
- package/lib/components/form/field_text/field_text.js +1 -1
- package/lib/components/form/form_control_layout/form_control_layout.js +67 -35
- package/lib/components/form/form_control_layout/form_control_layout_delimited.js +31 -11
- package/lib/components/form/form_control_layout/form_control_layout_icons.js +11 -19
- package/lib/components/form/range/dual_range.js +2 -4
- package/lib/components/form/range/range.js +0 -2
- package/lib/components/form/range/range_input.js +52 -11
- package/lib/components/form/validatable_control/validatable_control.js +14 -12
- package/lib/components/search_bar/query/ast_to_es_query_dsl.js +6 -1
- package/lib/components/search_bar/query/ast_to_es_query_string.js +3 -0
- package/lib/components/suggest/suggest.a11y.js +73 -0
- package/lib/components/table/table.a11y.js +78 -0
- package/optimize/es/components/basic_table/basic_table.a11y.js +194 -0
- package/optimize/es/components/basic_table/{table.a11y.js → in_memory_table.a11y.js} +1 -1
- package/optimize/es/components/date_picker/date_picker.js +17 -14
- package/optimize/es/components/date_picker/date_picker_range.js +20 -14
- package/optimize/es/components/date_picker/super_date_picker/super_date_picker.js +99 -84
- package/optimize/es/components/form/field_number/field_number.js +32 -8
- package/optimize/es/components/form/field_text/field_text.js +1 -1
- package/optimize/es/components/form/form_control_layout/form_control_layout.js +67 -30
- package/optimize/es/components/form/form_control_layout/form_control_layout_delimited.js +31 -11
- package/optimize/es/components/form/form_control_layout/form_control_layout_icons.js +10 -20
- package/optimize/es/components/form/range/dual_range.js +2 -4
- package/optimize/es/components/form/range/range.js +0 -2
- package/optimize/es/components/form/range/range_input.js +49 -12
- package/optimize/es/components/form/validatable_control/validatable_control.js +10 -5
- package/optimize/es/components/search_bar/query/ast_to_es_query_dsl.js +6 -1
- package/optimize/es/components/search_bar/query/ast_to_es_query_string.js +3 -0
- package/optimize/es/components/suggest/suggest.a11y.js +70 -0
- package/optimize/es/components/table/table.a11y.js +75 -0
- package/optimize/lib/components/basic_table/basic_table.a11y.js +188 -0
- package/{test-env/components/basic_table/table.a11y.js → optimize/lib/components/basic_table/in_memory_table.a11y.js} +2 -2
- package/optimize/lib/components/date_picker/date_picker.js +17 -14
- package/optimize/lib/components/date_picker/date_picker_range.js +19 -13
- package/optimize/lib/components/date_picker/super_date_picker/super_date_picker.js +99 -84
- package/optimize/lib/components/form/field_number/field_number.js +35 -8
- package/optimize/lib/components/form/field_text/field_text.js +1 -1
- package/optimize/lib/components/form/form_control_layout/form_control_layout.js +67 -35
- package/optimize/lib/components/form/form_control_layout/form_control_layout_delimited.js +31 -11
- package/optimize/lib/components/form/form_control_layout/form_control_layout_icons.js +9 -19
- package/optimize/lib/components/form/range/dual_range.js +2 -4
- package/optimize/lib/components/form/range/range.js +0 -2
- package/optimize/lib/components/form/range/range_input.js +47 -10
- package/optimize/lib/components/form/validatable_control/validatable_control.js +10 -4
- package/optimize/lib/components/search_bar/query/ast_to_es_query_dsl.js +6 -1
- package/optimize/lib/components/search_bar/query/ast_to_es_query_string.js +3 -0
- package/optimize/lib/components/suggest/suggest.a11y.js +73 -0
- package/optimize/lib/components/table/table.a11y.js +78 -0
- package/package.json +1 -1
- package/src/components/date_picker/_date_picker_range.scss +0 -60
- package/src/components/date_picker/super_date_picker/_super_date_picker.scss +23 -11
- package/src/components/date_picker/super_date_picker/_variables.scss +3 -0
- package/src/components/date_picker/super_date_picker/date_popover/_date_popover_button.scss +5 -7
- package/src/components/form/form_control_layout/_form_control_layout.scss +2 -2
- package/src/components/form/form_control_layout/_form_control_layout_delimited.scss +12 -36
- package/src/components/form/form_control_layout/_form_control_layout_icons.scss +27 -6
- package/src/themes/amsterdam/overrides/_date_picker.scss +0 -14
- package/src/themes/amsterdam/overrides/_index.scss +0 -1
- package/test-env/components/basic_table/basic_table.a11y.js +188 -0
- package/{optimize/lib/components/basic_table/table.a11y.js → test-env/components/basic_table/in_memory_table.a11y.js} +2 -2
- package/test-env/components/date_picker/date_picker.js +23 -15
- package/test-env/components/date_picker/date_picker_range.js +35 -41
- package/test-env/components/date_picker/super_date_picker/super_date_picker.js +99 -84
- package/test-env/components/form/field_number/field_number.js +35 -8
- package/test-env/components/form/field_text/field_text.js +1 -1
- package/test-env/components/form/form_control_layout/form_control_layout.js +68 -35
- package/test-env/components/form/form_control_layout/form_control_layout_delimited.js +31 -11
- package/test-env/components/form/form_control_layout/form_control_layout_icons.js +11 -19
- package/test-env/components/form/range/dual_range.js +2 -4
- package/test-env/components/form/range/range.js +0 -2
- package/test-env/components/form/range/range_input.js +47 -11
- package/test-env/components/form/validatable_control/validatable_control.js +9 -4
- package/test-env/components/search_bar/query/ast_to_es_query_dsl.js +6 -1
- package/test-env/components/search_bar/query/ast_to_es_query_string.js +3 -0
- package/test-env/components/suggest/suggest.a11y.js +73 -0
- package/test-env/components/table/table.a11y.js +78 -0
- package/src/themes/amsterdam/overrides/_date_popover_button.scss +0 -14
|
@@ -14,6 +14,7 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
|
|
|
14
14
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
15
15
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
16
16
|
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
17
18
|
var _loading = require("../../loading");
|
|
18
19
|
var _form_control_layout_clear_button = require("./form_control_layout_clear_button");
|
|
19
20
|
var _form_control_layout_custom_icon = require("./form_control_layout_custom_icon");
|
|
@@ -40,30 +41,19 @@ var EuiFormControlLayoutIcons = /*#__PURE__*/function (_Component) {
|
|
|
40
41
|
key: "render",
|
|
41
42
|
value: function render() {
|
|
42
43
|
var _this$props = this.props,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
_this$props$side = _this$props.side,
|
|
45
|
+
side = _this$props$side === void 0 ? 'left' : _this$props$side,
|
|
46
|
+
_this$props$iconsPosi = _this$props.iconsPosition,
|
|
47
|
+
iconsPosition = _this$props$iconsPosi === void 0 ? 'absolute' : _this$props$iconsPosi;
|
|
47
48
|
var customIcon = this.renderCustomIcon();
|
|
48
49
|
var loadingSpinner = this.renderLoadingSpinner();
|
|
49
50
|
var clearButton = this.renderClearButton();
|
|
50
51
|
var invalidIcon = this.renderInvalidIcon();
|
|
51
52
|
var dropdownIcon = this.renderDropdownIcon();
|
|
52
|
-
var
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}, customIcon);
|
|
57
|
-
}
|
|
58
|
-
var rightIcons;
|
|
59
|
-
|
|
60
|
-
// If the icon is on the right, it should be placed after the clear button in the DOM.
|
|
61
|
-
if (clearButton || loadingSpinner || isInvalid || isDropdown || customIcon && iconSide === 'right') {
|
|
62
|
-
rightIcons = (0, _react2.jsx)("div", {
|
|
63
|
-
className: "euiFormControlLayoutIcons euiFormControlLayoutIcons--right"
|
|
64
|
-
}, clearButton, loadingSpinner, invalidIcon, iconSide === 'right' ? customIcon : undefined, dropdownIcon);
|
|
65
|
-
}
|
|
66
|
-
return (0, _react2.jsx)(_react.Fragment, null, leftIcons, rightIcons);
|
|
53
|
+
var classes = (0, _classnames.default)('euiFormControlLayoutIcons', "euiFormControlLayoutIcons--".concat(side), "euiFormControlLayoutIcons--".concat(iconsPosition));
|
|
54
|
+
return (0, _react2.jsx)("div", {
|
|
55
|
+
className: classes
|
|
56
|
+
}, clearButton, loadingSpinner, invalidIcon, customIcon, dropdownIcon);
|
|
67
57
|
}
|
|
68
58
|
}, {
|
|
69
59
|
key: "renderCustomIcon",
|
|
@@ -392,7 +392,6 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
392
392
|
var min = minProps;
|
|
393
393
|
var max = maxProps;
|
|
394
394
|
var id = this.state.id;
|
|
395
|
-
var digitTolerance = Math.max(String(min).length, String(max).length);
|
|
396
395
|
var showInputOnly = showInput === 'inputWithPopover';
|
|
397
396
|
var canShowDropdown = showInputOnly && !readOnly && !disabled;
|
|
398
397
|
var rangeStyles = (0, _range.euiRangeStyles)(theme);
|
|
@@ -403,7 +402,6 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
403
402
|
"aria-label": this.props['aria-label']
|
|
404
403
|
}, minInputProps, {
|
|
405
404
|
// Non-overridable props
|
|
406
|
-
digitTolerance: digitTolerance,
|
|
407
405
|
side: "min",
|
|
408
406
|
min: min,
|
|
409
407
|
max: Number(this.upperValue),
|
|
@@ -432,7 +430,6 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
432
430
|
"aria-label": this.props['aria-label']
|
|
433
431
|
}, maxInputProps, {
|
|
434
432
|
// Non-overridable props
|
|
435
|
-
digitTolerance: digitTolerance,
|
|
436
433
|
side: "max",
|
|
437
434
|
min: Number(this.lowerValue),
|
|
438
435
|
max: max,
|
|
@@ -584,7 +581,8 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
584
581
|
readOnly: readOnly,
|
|
585
582
|
append: append,
|
|
586
583
|
prepend: prepend,
|
|
587
|
-
isLoading: isLoading
|
|
584
|
+
isLoading: isLoading,
|
|
585
|
+
isInvalid: isInvalid
|
|
588
586
|
}),
|
|
589
587
|
fullWidth: fullWidth,
|
|
590
588
|
isOpen: this.state.isPopoverOpen,
|
|
@@ -133,14 +133,12 @@ var EuiRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
133
133
|
theme = _this$props.theme,
|
|
134
134
|
rest = (0, _objectWithoutProperties2.default)(_this$props, _excluded);
|
|
135
135
|
var id = this.state.id;
|
|
136
|
-
var digitTolerance = Math.max(String(min).length, String(max).length);
|
|
137
136
|
var showInputOnly = showInput === 'inputWithPopover';
|
|
138
137
|
var canShowDropdown = showInputOnly && !readOnly && !disabled;
|
|
139
138
|
var theInput = !!showInput ? (0, _react2.jsx)(_range_input.EuiRangeInput, (0, _extends2.default)({
|
|
140
139
|
id: id,
|
|
141
140
|
min: min,
|
|
142
141
|
max: max,
|
|
143
|
-
digitTolerance: digitTolerance,
|
|
144
142
|
step: step,
|
|
145
143
|
value: value,
|
|
146
144
|
readOnly: readOnly,
|
|
@@ -7,14 +7,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.EuiRangeInput = 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
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
13
|
var _services = require("../../../services");
|
|
13
14
|
var _global_styling = require("../../../global_styling");
|
|
15
|
+
var _form = require("../form.styles");
|
|
14
16
|
var _field_number = require("../field_number");
|
|
15
17
|
var _range_input = require("./range_input.styles");
|
|
16
18
|
var _react2 = require("@emotion/react");
|
|
17
|
-
var _excluded = ["min", "max", "step", "value", "disabled", "compressed", "onChange", "name", "side", "
|
|
19
|
+
var _excluded = ["min", "max", "step", "value", "inputRef", "isInvalid", "disabled", "compressed", "onChange", "name", "side", "fullWidth", "autoSize"];
|
|
18
20
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
21
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
20
22
|
var EuiRangeInput = function EuiRangeInput(_ref) {
|
|
@@ -22,28 +24,61 @@ var EuiRangeInput = function EuiRangeInput(_ref) {
|
|
|
22
24
|
max = _ref.max,
|
|
23
25
|
step = _ref.step,
|
|
24
26
|
value = _ref.value,
|
|
27
|
+
inputRef = _ref.inputRef,
|
|
28
|
+
isInvalid = _ref.isInvalid,
|
|
25
29
|
disabled = _ref.disabled,
|
|
26
30
|
compressed = _ref.compressed,
|
|
27
31
|
onChange = _ref.onChange,
|
|
28
32
|
name = _ref.name,
|
|
29
33
|
_ref$side = _ref.side,
|
|
30
34
|
side = _ref$side === void 0 ? 'max' : _ref$side,
|
|
31
|
-
digitTolerance = _ref.digitTolerance,
|
|
32
35
|
fullWidth = _ref.fullWidth,
|
|
33
36
|
_ref$autoSize = _ref.autoSize,
|
|
34
37
|
autoSize = _ref$autoSize === void 0 ? true : _ref$autoSize,
|
|
35
38
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
36
|
-
// Chrome will properly size the input based on the max value, but FF does not.
|
|
37
|
-
// Calculate the width of the input based on highest number of characters.
|
|
38
|
-
// Add 2 to accommodate for input stepper
|
|
39
|
-
var widthStyle = (0, _react.useMemo)(function () {
|
|
40
|
-
return autoSize ? (0, _global_styling.logicalStyles)({
|
|
41
|
-
width: "".concat(digitTolerance / 1.25 + 2, "em")
|
|
42
|
-
}) : {};
|
|
43
|
-
}, [autoSize, digitTolerance]);
|
|
44
39
|
var euiTheme = (0, _services.useEuiTheme)();
|
|
45
40
|
var styles = (0, _range_input.euiRangeInputStyles)(euiTheme);
|
|
46
41
|
var cssStyles = [styles.euiRangeInput];
|
|
42
|
+
|
|
43
|
+
// Determine whether an invalid icon is showing, which can come from
|
|
44
|
+
// the underlying EuiFieldNumber's native :invalid state
|
|
45
|
+
var _useState = (0, _react.useState)(isInvalid),
|
|
46
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
47
|
+
hasInvalidIcon = _useState2[0],
|
|
48
|
+
setHasInvalidIcon = _useState2[1];
|
|
49
|
+
var validityRef = (0, _react.useRef)(null);
|
|
50
|
+
var setRefs = (0, _services.useCombinedRefs)([validityRef, inputRef]);
|
|
51
|
+
(0, _react.useEffect)(function () {
|
|
52
|
+
var _validityRef$current;
|
|
53
|
+
var isNativelyInvalid = !((_validityRef$current = validityRef.current) !== null && _validityRef$current !== void 0 && _validityRef$current.validity.valid);
|
|
54
|
+
setHasInvalidIcon(isNativelyInvalid || isInvalid);
|
|
55
|
+
}, [value, isInvalid]);
|
|
56
|
+
|
|
57
|
+
// Calculate the auto size width of the input
|
|
58
|
+
var widthStyle = (0, _react.useMemo)(function () {
|
|
59
|
+
if (!autoSize) return undefined;
|
|
60
|
+
|
|
61
|
+
// Calculate the number of characters to show (dynamic based on user input)
|
|
62
|
+
// Uses the min/max char length as a max, then add an extra UX buffer of 1
|
|
63
|
+
var maxChars = Math.max(String(min).length, String(max).length) + 1;
|
|
64
|
+
var inputCharWidth = Math.min(String(value).length, maxChars);
|
|
65
|
+
|
|
66
|
+
// Calculate the form padding based on `compressed` state
|
|
67
|
+
var _euiFormVariables = (0, _form.euiFormVariables)(euiTheme),
|
|
68
|
+
controlPadding = _euiFormVariables.controlPadding,
|
|
69
|
+
controlCompressedPadding = _euiFormVariables.controlCompressedPadding;
|
|
70
|
+
var inputPadding = compressed ? controlCompressedPadding : controlPadding;
|
|
71
|
+
|
|
72
|
+
// Calculate the invalid icon (if being displayed), also based on `compressed` state
|
|
73
|
+
var invalidIconWidth = hasInvalidIcon ? euiTheme.euiTheme.base * (compressed ? 1.125 : 1.375) // TODO: DRY this out once EuiFormControlLayoutIcons is converted to Emotion
|
|
74
|
+
: 0;
|
|
75
|
+
|
|
76
|
+
// Guesstimate a width for the stepper. Note that it's a little wider in FF than it is in Chrome
|
|
77
|
+
var stepperWidth = 2;
|
|
78
|
+
return (0, _global_styling.logicalStyles)({
|
|
79
|
+
width: "calc(".concat(inputPadding, " + ").concat(inputCharWidth, "ch + ").concat(stepperWidth, "em + ").concat(invalidIconWidth, "px)")
|
|
80
|
+
});
|
|
81
|
+
}, [autoSize, euiTheme, compressed, hasInvalidIcon, min, max, value]);
|
|
47
82
|
return (0, _react2.jsx)(_field_number.EuiFieldNumber, (0, _extends2.default)({
|
|
48
83
|
name: name,
|
|
49
84
|
className: "euiRangeInput euiRangeInput--".concat(side),
|
|
@@ -52,6 +87,8 @@ var EuiRangeInput = function EuiRangeInput(_ref) {
|
|
|
52
87
|
max: Number(max),
|
|
53
88
|
step: step,
|
|
54
89
|
value: value === '' ? '' : Number(value),
|
|
90
|
+
inputRef: setRefs,
|
|
91
|
+
isInvalid: isInvalid,
|
|
55
92
|
disabled: disabled,
|
|
56
93
|
compressed: compressed,
|
|
57
94
|
onChange: onChange,
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.useEuiValidatableControl = exports.EuiValidatableControl = void 0;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
7
9
|
var _react = require("react");
|
|
8
10
|
/*
|
|
9
11
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
@@ -25,11 +27,15 @@ function isMutableRef(ref) {
|
|
|
25
27
|
var EuiValidatableControl = function EuiValidatableControl(_ref) {
|
|
26
28
|
var isInvalid = _ref.isInvalid,
|
|
27
29
|
children = _ref.children;
|
|
28
|
-
|
|
30
|
+
// Note that this must be state and not a ref to cause a rerender/set invalid state on initial mount
|
|
31
|
+
var _useState = (0, _react.useState)(null),
|
|
32
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
33
|
+
control = _useState2[0],
|
|
34
|
+
setControl = _useState2[1];
|
|
29
35
|
var child = _react.Children.only(children);
|
|
30
36
|
var childRef = child.ref;
|
|
31
37
|
var replacedRef = (0, _react.useCallback)(function (element) {
|
|
32
|
-
|
|
38
|
+
setControl(element);
|
|
33
39
|
|
|
34
40
|
// Call the original ref, if any
|
|
35
41
|
if (typeof childRef === 'function') {
|
|
@@ -39,12 +45,12 @@ var EuiValidatableControl = function EuiValidatableControl(_ref) {
|
|
|
39
45
|
}
|
|
40
46
|
}, [childRef]);
|
|
41
47
|
useSetControlValidity({
|
|
42
|
-
controlEl: control
|
|
48
|
+
controlEl: control,
|
|
43
49
|
isInvalid: isInvalid
|
|
44
50
|
});
|
|
45
51
|
return /*#__PURE__*/(0, _react.cloneElement)(child, {
|
|
46
52
|
ref: replacedRef,
|
|
47
|
-
'aria-invalid': isInvalid
|
|
53
|
+
'aria-invalid': isInvalid || child.props['aria-invalid']
|
|
48
54
|
});
|
|
49
55
|
};
|
|
50
56
|
|
|
@@ -59,7 +59,12 @@ var processDateOperation = function processDateOperation(value, operator) {
|
|
|
59
59
|
};
|
|
60
60
|
var _termValuesToQuery = function _termValuesToQuery(values, options) {
|
|
61
61
|
var body = {
|
|
62
|
-
query: values.
|
|
62
|
+
query: values.map(function (value) {
|
|
63
|
+
if ((0, _predicate.isString)(value) && value.match(/\s/)) {
|
|
64
|
+
return "\"".concat(value, "\"");
|
|
65
|
+
}
|
|
66
|
+
return value;
|
|
67
|
+
}).join(' ')
|
|
63
68
|
};
|
|
64
69
|
if (body.query === '') {
|
|
65
70
|
return;
|
|
@@ -140,6 +140,9 @@ var emitTermClause = function emitTermClause(clause, isGroupMember) {
|
|
|
140
140
|
match = undefined;
|
|
141
141
|
}
|
|
142
142
|
var matchOp = emitMatch(match);
|
|
143
|
+
if ((0, _predicate.isString)(value) && value.match(/\s/)) {
|
|
144
|
+
return "".concat(matchOp, "\"").concat(escapeValue(value), "\"");
|
|
145
|
+
}
|
|
143
146
|
return "".concat(matchOp).concat(escapeValue(value));
|
|
144
147
|
};
|
|
145
148
|
var emitIsClause = function emitIsClause(clause, isGroupMember) {
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _react = _interopRequireDefault(require("react"));
|
|
5
|
+
var _form = require("../form");
|
|
6
|
+
var _suggest = require("./suggest");
|
|
7
|
+
var _react2 = require("@emotion/react");
|
|
8
|
+
/*
|
|
9
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
10
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
11
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
12
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
13
|
+
* Side Public License, v 1.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/// <reference types="cypress" />
|
|
17
|
+
/// <reference types="cypress-real-events" />
|
|
18
|
+
/// <reference types="../../../cypress/support" />
|
|
19
|
+
|
|
20
|
+
var Suggest = function Suggest() {
|
|
21
|
+
var suggestedItems = [{
|
|
22
|
+
type: {
|
|
23
|
+
iconType: 'accessibility',
|
|
24
|
+
color: 'tint1'
|
|
25
|
+
},
|
|
26
|
+
label: 'Accessibility',
|
|
27
|
+
description: 'A short description'
|
|
28
|
+
}, {
|
|
29
|
+
type: {
|
|
30
|
+
iconType: 'image',
|
|
31
|
+
color: 'tint2'
|
|
32
|
+
},
|
|
33
|
+
label: 'Images',
|
|
34
|
+
description: 'Another short description'
|
|
35
|
+
}, {
|
|
36
|
+
type: {
|
|
37
|
+
iconType: 'lock',
|
|
38
|
+
color: 'tint3'
|
|
39
|
+
},
|
|
40
|
+
label: 'Locks',
|
|
41
|
+
description: 'A third short description'
|
|
42
|
+
}];
|
|
43
|
+
return (0, _react2.jsx)(_form.EuiFormRow, {
|
|
44
|
+
label: "Suggest a topic",
|
|
45
|
+
id: "cy-label-suggest-1"
|
|
46
|
+
}, (0, _react2.jsx)(_suggest.EuiSuggest, {
|
|
47
|
+
"aria-labelledby": "cy-label-suggest-1-label",
|
|
48
|
+
suggestions: suggestedItems
|
|
49
|
+
}));
|
|
50
|
+
};
|
|
51
|
+
describe('EuiSuggest', function () {
|
|
52
|
+
beforeEach(function () {
|
|
53
|
+
cy.realMount((0, _react2.jsx)(Suggest, null));
|
|
54
|
+
});
|
|
55
|
+
describe('Automated accessibility check', function () {
|
|
56
|
+
it('has zero violations when rendered', function () {
|
|
57
|
+
cy.checkAxe();
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
describe('Keyboard accessibility', function () {
|
|
61
|
+
it('has zero violations after traversing list items', function () {
|
|
62
|
+
cy.realPress('Tab');
|
|
63
|
+
cy.get('#cy-label-suggest-1').should('have.focus');
|
|
64
|
+
cy.get('ul[role="listbox"]').should('exist');
|
|
65
|
+
cy.realPress('ArrowDown');
|
|
66
|
+
cy.realPress('ArrowUp');
|
|
67
|
+
cy.realPress('ArrowRight');
|
|
68
|
+
cy.realPress('ArrowLeft');
|
|
69
|
+
cy.get('li[role="option"]').first().should('have.attr', 'aria-selected', 'true');
|
|
70
|
+
cy.checkAxe();
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
});
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _react = _interopRequireDefault(require("react"));
|
|
5
|
+
var _ = require(".");
|
|
6
|
+
var _react2 = require("@emotion/react");
|
|
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
|
+
/// <reference types="cypress" />
|
|
16
|
+
/// <reference types="cypress-real-events" />
|
|
17
|
+
/// <reference types="../../../cypress/support" />
|
|
18
|
+
|
|
19
|
+
var users = [{
|
|
20
|
+
id: '47936',
|
|
21
|
+
firstName: 'Robert',
|
|
22
|
+
lastName: 'Stein',
|
|
23
|
+
github: 'steiner_rob',
|
|
24
|
+
location: {
|
|
25
|
+
city: 'Los Angeles',
|
|
26
|
+
state: 'CA'
|
|
27
|
+
}
|
|
28
|
+
}, {
|
|
29
|
+
id: '54736',
|
|
30
|
+
firstName: 'Martina',
|
|
31
|
+
lastName: 'Conlon',
|
|
32
|
+
github: 'martina_zen',
|
|
33
|
+
location: {
|
|
34
|
+
city: 'Boston',
|
|
35
|
+
state: 'MA'
|
|
36
|
+
}
|
|
37
|
+
}, {
|
|
38
|
+
id: '40193',
|
|
39
|
+
firstName: 'Alyce',
|
|
40
|
+
lastName: 'Benning',
|
|
41
|
+
github: 'alyce_benning',
|
|
42
|
+
location: {
|
|
43
|
+
city: 'Atlanta',
|
|
44
|
+
state: 'GA'
|
|
45
|
+
}
|
|
46
|
+
}];
|
|
47
|
+
var userRows = users.map(function (user) {
|
|
48
|
+
var id = user.id,
|
|
49
|
+
firstName = user.firstName,
|
|
50
|
+
lastName = user.lastName,
|
|
51
|
+
github = user.github,
|
|
52
|
+
_user$location = user.location,
|
|
53
|
+
city = _user$location.city,
|
|
54
|
+
state = _user$location.state;
|
|
55
|
+
return (0, _react2.jsx)(_.EuiTableRow, {
|
|
56
|
+
key: id
|
|
57
|
+
}, (0, _react2.jsx)(_.EuiTableRowCell, null, "".concat(firstName, " ").concat(lastName)), (0, _react2.jsx)(_.EuiTableRowCell, null, github), (0, _react2.jsx)(_.EuiTableRowCell, null, "".concat(city, ", ").concat(state)));
|
|
58
|
+
});
|
|
59
|
+
var customColumns = ['Name', 'Github', 'Location'];
|
|
60
|
+
var columnHeaders = customColumns.map(function (column, i) {
|
|
61
|
+
return (0, _react2.jsx)(_.EuiTableHeaderCell, {
|
|
62
|
+
key: i
|
|
63
|
+
}, column);
|
|
64
|
+
});
|
|
65
|
+
var CustomTable = function CustomTable() {
|
|
66
|
+
return (0, _react2.jsx)(_.EuiTable, null, (0, _react2.jsx)(_.EuiTableHeader, null, columnHeaders), (0, _react2.jsx)(_.EuiTableBody, null, userRows));
|
|
67
|
+
};
|
|
68
|
+
describe('EuiTable', function () {
|
|
69
|
+
beforeEach(function () {
|
|
70
|
+
cy.viewport(1024, 768); // medium breakpoint
|
|
71
|
+
cy.realMount((0, _react2.jsx)(CustomTable, null));
|
|
72
|
+
});
|
|
73
|
+
describe('Automated accessibility check', function () {
|
|
74
|
+
it('has zero violations on render', function () {
|
|
75
|
+
cy.checkAxe();
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
});
|
package/package.json
CHANGED
|
@@ -1,65 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 1. Account for inner box-shadow style border
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
1
|
.euiDatePickerRange {
|
|
6
|
-
@include euiFormControlSize(auto, $includeAlternates: true);
|
|
7
|
-
// Match just the regular drop shadow of inputs
|
|
8
|
-
@include euiFormControlDefaultShadow;
|
|
9
|
-
display: flex;
|
|
10
|
-
align-items: center;
|
|
11
|
-
padding: 1px; /* 1 */
|
|
12
|
-
|
|
13
|
-
// Allow any child to fill entire range container
|
|
14
|
-
> * {
|
|
15
|
-
flex-grow: 1;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
2
|
.euiFieldText.euiDatePicker {
|
|
19
3
|
height: $euiFormControlLayoutGroupInputHeight;
|
|
20
|
-
// including all states
|
|
21
|
-
box-shadow: none !important; // stylelint-disable-line declaration-no-important
|
|
22
|
-
text-align: center;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.euiDatePickerRange__start {
|
|
26
|
-
border-top-right-radius: 0;
|
|
27
|
-
border-bottom-right-radius: 0;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.euiDatePickerRange__end {
|
|
31
|
-
border-top-left-radius: 0;
|
|
32
|
-
border-bottom-left-radius: 0;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.react-datepicker-popper .euiFieldText.euiDatePicker {
|
|
36
|
-
// set any subsequent children in popper back to left align
|
|
37
|
-
text-align: left;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Necessary for EuiSuperDatePicker
|
|
41
|
-
&--inGroup {
|
|
42
|
-
box-shadow: none;
|
|
43
|
-
padding: 0;
|
|
44
4
|
}
|
|
45
5
|
}
|
|
46
|
-
|
|
47
|
-
.euiDatePickerRange--isDisabled {
|
|
48
|
-
background: $euiFormBackgroundDisabledColor;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.euiDatePickerRange--readOnly {
|
|
52
|
-
background: $euiFormBackgroundReadOnlyColor;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.euiDatePickerRange__delimeter {
|
|
56
|
-
align-self: stretch;
|
|
57
|
-
height: auto;
|
|
58
|
-
flex-grow: 0;
|
|
59
|
-
display: flex;
|
|
60
|
-
align-items: center;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.euiDatePickerRange--isInvalid:not(.euiDatePickerRange--isDisabled):not(.euiDatePickerRange--readOnly) .euiDatePickerRange__delimeter {
|
|
64
|
-
@include euiFormControlInvalidStyle;
|
|
65
|
-
}
|
|
@@ -38,22 +38,17 @@
|
|
|
38
38
|
max-width: 100% !important;
|
|
39
39
|
|
|
40
40
|
> .euiFormControlLayout__childrenWrapper {
|
|
41
|
-
|
|
41
|
+
display: flex;
|
|
42
|
+
align-items: center;
|
|
42
43
|
overflow: hidden;
|
|
44
|
+
background-color: $euiFormBackgroundColor;
|
|
43
45
|
|
|
44
|
-
|
|
45
|
-
max-width: none;
|
|
46
|
-
width: auto;
|
|
46
|
+
&:last-child {
|
|
47
47
|
border-radius: 0 $euiFormControlBorderRadius $euiFormControlBorderRadius 0;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
.euiDatePopoverButton--end,
|
|
53
|
-
.euiSuperDatePicker__prettyFormat {
|
|
54
|
-
border-top-right-radius: 0;
|
|
55
|
-
border-bottom-right-radius: 0;
|
|
56
|
-
}
|
|
50
|
+
& > .euiFormControlLayoutDelimited__input {
|
|
51
|
+
flex-grow: 1;
|
|
57
52
|
}
|
|
58
53
|
}
|
|
59
54
|
}
|
|
@@ -75,3 +70,20 @@
|
|
|
75
70
|
cursor: not-allowed;
|
|
76
71
|
}
|
|
77
72
|
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Make the arrow delimiter match the colors of `.euiDatePopoverButton-needsUpdating`
|
|
76
|
+
*/
|
|
77
|
+
.euiSuperDatePicker--needsUpdating.euiFormControlLayoutDelimited { // Extra specificity needed to override default delimited styles
|
|
78
|
+
.euiFormControlLayout__childrenWrapper {
|
|
79
|
+
background-color: $euiSuperDatePickerNeedsUpdatingBackgroundColor;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.euiFormControlLayoutDelimited__delimiter {
|
|
83
|
+
color: $euiSuperDatePickerNeedsUpdatingTextColor;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.euiSuperDatePicker .euiFormControlLayout__childrenWrapper {
|
|
88
|
+
transition: background $euiAnimSpeedFast ease-in; // Match @mixin euiSuperDatePickerText / .euiDatePopoverButton
|
|
89
|
+
}
|
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
$euiSuperDatePickerWidth: $euiSize * 30;
|
|
2
2
|
$euiSuperDatePickerButtonWidth: $euiButtonMinWidth + ($euiSizeXS * 1.5);
|
|
3
|
+
|
|
4
|
+
$euiSuperDatePickerNeedsUpdatingBackgroundColor: tintOrShade($euiColorSuccess, 90%, 70%);
|
|
5
|
+
$euiSuperDatePickerNeedsUpdatingTextColor: makeHighContrastColor($euiColorSuccess, $euiSuperDatePickerNeedsUpdatingBackgroundColor);
|
|
@@ -13,11 +13,8 @@
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
&-needsUpdating {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
background-color: $backgroundColor;
|
|
20
|
-
color: $textColor;
|
|
16
|
+
background-color: $euiSuperDatePickerNeedsUpdatingBackgroundColor;
|
|
17
|
+
color: $euiSuperDatePickerNeedsUpdatingTextColor;
|
|
21
18
|
|
|
22
19
|
&:focus,
|
|
23
20
|
&.euiDatePopoverButton-isSelected {
|
|
@@ -38,15 +35,16 @@
|
|
|
38
35
|
|
|
39
36
|
&:disabled {
|
|
40
37
|
background-color: $euiFormBackgroundDisabledColor;
|
|
38
|
+
background-image: none;
|
|
41
39
|
color: $euiColorDarkShade;
|
|
42
40
|
cursor: default;
|
|
43
41
|
}
|
|
44
42
|
}
|
|
45
43
|
|
|
46
44
|
.euiDatePopoverButton--start {
|
|
47
|
-
text-align:
|
|
45
|
+
text-align: center;
|
|
48
46
|
}
|
|
49
47
|
|
|
50
48
|
.euiDatePopoverButton--end {
|
|
51
|
-
text-align:
|
|
49
|
+
text-align: center;
|
|
52
50
|
}
|
|
@@ -128,7 +128,7 @@
|
|
|
128
128
|
// TEXT
|
|
129
129
|
|
|
130
130
|
.euiFormLabel,
|
|
131
|
-
.euiText {
|
|
131
|
+
.euiText:not(.euiFormControlLayoutDelimited__delimiter) {
|
|
132
132
|
background-color: $euiFormInputGroupLabelBackground;
|
|
133
133
|
padding: $euiFormControlPadding;
|
|
134
134
|
line-height: $euiSize !important;
|
|
@@ -171,7 +171,7 @@
|
|
|
171
171
|
|
|
172
172
|
// Padding
|
|
173
173
|
.euiFormLabel,
|
|
174
|
-
.euiText {
|
|
174
|
+
.euiText:not(.euiFormControlLayoutDelimited__delimiter) {
|
|
175
175
|
padding: $euiFormControlCompressedPadding;
|
|
176
176
|
|
|
177
177
|
// If the next sibling is not the input, pull it closer to the text to reduce space
|