@elastic/eui 77.1.0 → 77.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/README.md +30 -29
  2. package/dist/eui_theme_dark.css +70 -158
  3. package/dist/eui_theme_dark.min.css +1 -1
  4. package/dist/eui_theme_light.css +70 -158
  5. package/dist/eui_theme_light.min.css +1 -1
  6. package/es/components/basic_table/basic_table.a11y.js +202 -0
  7. package/es/components/basic_table/{table.a11y.js → in_memory_table.a11y.js} +1 -1
  8. package/es/components/date_picker/date_picker.js +23 -15
  9. package/es/components/date_picker/date_picker_range.js +36 -42
  10. package/es/components/date_picker/super_date_picker/super_date_picker.js +99 -84
  11. package/es/components/form/field_number/field_number.js +39 -8
  12. package/es/components/form/field_text/field_text.js +1 -1
  13. package/es/components/form/form_control_layout/form_control_layout.js +67 -30
  14. package/es/components/form/form_control_layout/form_control_layout_delimited.js +31 -11
  15. package/es/components/form/form_control_layout/form_control_layout_icons.js +12 -20
  16. package/es/components/form/range/dual_range.js +2 -4
  17. package/es/components/form/range/range.js +0 -2
  18. package/es/components/form/range/range_input.js +54 -13
  19. package/es/components/form/validatable_control/validatable_control.js +15 -5
  20. package/es/components/index.js +0 -1
  21. package/es/components/search_bar/query/ast_to_es_query_dsl.js +6 -1
  22. package/es/components/search_bar/query/ast_to_es_query_string.js +3 -0
  23. package/es/components/suggest/suggest.a11y.js +70 -0
  24. package/es/components/table/table.a11y.js +75 -0
  25. package/eui.d.ts +55 -173
  26. package/i18ntokens.json +26 -44
  27. package/lib/components/basic_table/basic_table.a11y.js +194 -0
  28. package/lib/components/basic_table/{table.a11y.js → in_memory_table.a11y.js} +2 -2
  29. package/lib/components/date_picker/date_picker.js +23 -15
  30. package/lib/components/date_picker/date_picker_range.js +35 -41
  31. package/lib/components/date_picker/super_date_picker/super_date_picker.js +99 -84
  32. package/lib/components/form/field_number/field_number.js +42 -8
  33. package/lib/components/form/field_text/field_text.js +1 -1
  34. package/lib/components/form/form_control_layout/form_control_layout.js +67 -35
  35. package/lib/components/form/form_control_layout/form_control_layout_delimited.js +31 -11
  36. package/lib/components/form/form_control_layout/form_control_layout_icons.js +11 -19
  37. package/lib/components/form/range/dual_range.js +2 -4
  38. package/lib/components/form/range/range.js +0 -2
  39. package/lib/components/form/range/range_input.js +52 -11
  40. package/lib/components/form/validatable_control/validatable_control.js +14 -12
  41. package/lib/components/index.js +0 -11
  42. package/lib/components/search_bar/query/ast_to_es_query_dsl.js +6 -1
  43. package/lib/components/search_bar/query/ast_to_es_query_string.js +3 -0
  44. package/lib/components/suggest/suggest.a11y.js +73 -0
  45. package/lib/components/table/table.a11y.js +78 -0
  46. package/optimize/es/components/basic_table/basic_table.a11y.js +194 -0
  47. package/optimize/es/components/basic_table/{table.a11y.js → in_memory_table.a11y.js} +1 -1
  48. package/optimize/es/components/date_picker/date_picker.js +17 -14
  49. package/optimize/es/components/date_picker/date_picker_range.js +20 -14
  50. package/optimize/es/components/date_picker/super_date_picker/super_date_picker.js +99 -84
  51. package/optimize/es/components/form/field_number/field_number.js +34 -8
  52. package/optimize/es/components/form/field_text/field_text.js +1 -1
  53. package/optimize/es/components/form/form_control_layout/form_control_layout.js +67 -30
  54. package/optimize/es/components/form/form_control_layout/form_control_layout_delimited.js +31 -11
  55. package/optimize/es/components/form/form_control_layout/form_control_layout_icons.js +10 -20
  56. package/optimize/es/components/form/range/dual_range.js +2 -4
  57. package/optimize/es/components/form/range/range.js +0 -2
  58. package/optimize/es/components/form/range/range_input.js +49 -12
  59. package/optimize/es/components/form/validatable_control/validatable_control.js +10 -5
  60. package/optimize/es/components/index.js +0 -1
  61. package/optimize/es/components/search_bar/query/ast_to_es_query_dsl.js +6 -1
  62. package/optimize/es/components/search_bar/query/ast_to_es_query_string.js +3 -0
  63. package/optimize/es/components/suggest/suggest.a11y.js +70 -0
  64. package/optimize/es/components/table/table.a11y.js +75 -0
  65. package/optimize/lib/components/basic_table/basic_table.a11y.js +188 -0
  66. package/{test-env/components/basic_table/table.a11y.js → optimize/lib/components/basic_table/in_memory_table.a11y.js} +2 -2
  67. package/optimize/lib/components/date_picker/date_picker.js +17 -14
  68. package/optimize/lib/components/date_picker/date_picker_range.js +19 -13
  69. package/optimize/lib/components/date_picker/super_date_picker/super_date_picker.js +99 -84
  70. package/optimize/lib/components/form/field_number/field_number.js +37 -8
  71. package/optimize/lib/components/form/field_text/field_text.js +1 -1
  72. package/optimize/lib/components/form/form_control_layout/form_control_layout.js +67 -35
  73. package/optimize/lib/components/form/form_control_layout/form_control_layout_delimited.js +31 -11
  74. package/optimize/lib/components/form/form_control_layout/form_control_layout_icons.js +9 -19
  75. package/optimize/lib/components/form/range/dual_range.js +2 -4
  76. package/optimize/lib/components/form/range/range.js +0 -2
  77. package/optimize/lib/components/form/range/range_input.js +47 -10
  78. package/optimize/lib/components/form/validatable_control/validatable_control.js +10 -4
  79. package/optimize/lib/components/index.js +0 -11
  80. package/optimize/lib/components/search_bar/query/ast_to_es_query_dsl.js +6 -1
  81. package/optimize/lib/components/search_bar/query/ast_to_es_query_string.js +3 -0
  82. package/optimize/lib/components/suggest/suggest.a11y.js +73 -0
  83. package/optimize/lib/components/table/table.a11y.js +78 -0
  84. package/package.json +1 -1
  85. package/src/components/date_picker/_date_picker_range.scss +0 -60
  86. package/src/components/date_picker/super_date_picker/_super_date_picker.scss +23 -11
  87. package/src/components/date_picker/super_date_picker/_variables.scss +3 -0
  88. package/src/components/date_picker/super_date_picker/date_popover/_date_popover_button.scss +5 -7
  89. package/src/components/form/form_control_layout/_form_control_layout.scss +2 -2
  90. package/src/components/form/form_control_layout/_form_control_layout_delimited.scss +12 -36
  91. package/src/components/form/form_control_layout/_form_control_layout_icons.scss +27 -6
  92. package/src/themes/amsterdam/overrides/_date_picker.scss +0 -14
  93. package/src/themes/amsterdam/overrides/_index.scss +0 -1
  94. package/test-env/components/basic_table/basic_table.a11y.js +188 -0
  95. package/{optimize/lib/components/basic_table/table.a11y.js → test-env/components/basic_table/in_memory_table.a11y.js} +2 -2
  96. package/test-env/components/date_picker/date_picker.js +23 -15
  97. package/test-env/components/date_picker/date_picker_range.js +35 -41
  98. package/test-env/components/date_picker/super_date_picker/super_date_picker.js +99 -84
  99. package/test-env/components/form/field_number/field_number.js +37 -8
  100. package/test-env/components/form/field_text/field_text.js +1 -1
  101. package/test-env/components/form/form_control_layout/form_control_layout.js +68 -35
  102. package/test-env/components/form/form_control_layout/form_control_layout_delimited.js +31 -11
  103. package/test-env/components/form/form_control_layout/form_control_layout_icons.js +11 -19
  104. package/test-env/components/form/range/dual_range.js +2 -4
  105. package/test-env/components/form/range/range.js +0 -2
  106. package/test-env/components/form/range/range_input.js +47 -11
  107. package/test-env/components/form/validatable_control/validatable_control.js +9 -4
  108. package/test-env/components/index.js +0 -11
  109. package/test-env/components/search_bar/query/ast_to_es_query_dsl.js +6 -1
  110. package/test-env/components/search_bar/query/ast_to_es_query_string.js +3 -0
  111. package/test-env/components/suggest/suggest.a11y.js +73 -0
  112. package/test-env/components/table/table.a11y.js +78 -0
  113. package/es/components/inline_edit/index.js +0 -10
  114. package/es/components/inline_edit/inline_edit.styles.js +0 -15
  115. package/es/components/inline_edit/inline_edit_form.js +0 -190
  116. package/es/components/inline_edit/inline_edit_text.js +0 -97
  117. package/es/components/inline_edit/inline_edit_title.js +0 -105
  118. package/lib/components/inline_edit/index.js +0 -19
  119. package/lib/components/inline_edit/inline_edit.styles.js +0 -22
  120. package/lib/components/inline_edit/inline_edit_form.js +0 -193
  121. package/lib/components/inline_edit/inline_edit_text.js +0 -97
  122. package/lib/components/inline_edit/inline_edit_title.js +0 -106
  123. package/optimize/es/components/inline_edit/index.js +0 -10
  124. package/optimize/es/components/inline_edit/inline_edit.styles.js +0 -15
  125. package/optimize/es/components/inline_edit/inline_edit_form.js +0 -133
  126. package/optimize/es/components/inline_edit/inline_edit_text.js +0 -52
  127. package/optimize/es/components/inline_edit/inline_edit_title.js +0 -56
  128. package/optimize/lib/components/inline_edit/index.js +0 -19
  129. package/optimize/lib/components/inline_edit/inline_edit.styles.js +0 -22
  130. package/optimize/lib/components/inline_edit/inline_edit_form.js +0 -144
  131. package/optimize/lib/components/inline_edit/inline_edit_text.js +0 -52
  132. package/optimize/lib/components/inline_edit/inline_edit_title.js +0 -57
  133. package/src/themes/amsterdam/overrides/_date_popover_button.scss +0 -14
  134. package/test-env/components/inline_edit/index.js +0 -19
  135. package/test-env/components/inline_edit/inline_edit.styles.js +0 -22
  136. package/test-env/components/inline_edit/inline_edit_form.js +0 -196
  137. package/test-env/components/inline_edit/inline_edit_text.js +0 -96
  138. package/test-env/components/inline_edit/inline_edit_title.js +0 -105
@@ -138,14 +138,12 @@ export var EuiRangeClass = /*#__PURE__*/function (_Component) {
138
138
  theme = _this$props.theme,
139
139
  rest = _objectWithoutProperties(_this$props, _excluded);
140
140
  var id = this.state.id;
141
- var digitTolerance = Math.max(String(min).length, String(max).length);
142
141
  var showInputOnly = showInput === 'inputWithPopover';
143
142
  var canShowDropdown = showInputOnly && !readOnly && !disabled;
144
143
  var theInput = !!showInput ? ___EmotionJSX(EuiRangeInput, _extends({
145
144
  id: id,
146
145
  min: min,
147
146
  max: max,
148
- digitTolerance: digitTolerance,
149
147
  step: step,
150
148
  value: value,
151
149
  readOnly: readOnly,
@@ -1,5 +1,11 @@
1
- var _excluded = ["min", "max", "step", "value", "disabled", "compressed", "onChange", "name", "side", "digitTolerance", "fullWidth", "autoSize"];
1
+ var _excluded = ["min", "max", "step", "value", "inputRef", "isInvalid", "disabled", "compressed", "onChange", "name", "side", "fullWidth", "autoSize"];
2
2
  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); }
3
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
+ 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."); }
5
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
+ 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; }
7
+ 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; } }
8
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
3
9
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
10
  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; }
5
11
  /*
@@ -10,10 +16,11 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
10
16
  * Side Public License, v 1.
11
17
  */
12
18
 
13
- import React, { useMemo } from 'react';
19
+ import React, { useState, useEffect, useMemo, useRef } from 'react';
14
20
  import PropTypes from "prop-types";
15
- import { useEuiTheme } from '../../../services';
21
+ import { useEuiTheme, useCombinedRefs } from '../../../services';
16
22
  import { logicalStyles } from '../../../global_styling';
23
+ import { euiFormVariables } from '../form.styles';
17
24
  import { EuiFieldNumber } from '../field_number';
18
25
  import { euiRangeInputStyles } from './range_input.styles';
19
26
  import { jsx as ___EmotionJSX } from "@emotion/react";
@@ -22,28 +29,61 @@ export var EuiRangeInput = function EuiRangeInput(_ref) {
22
29
  max = _ref.max,
23
30
  step = _ref.step,
24
31
  value = _ref.value,
32
+ inputRef = _ref.inputRef,
33
+ isInvalid = _ref.isInvalid,
25
34
  disabled = _ref.disabled,
26
35
  compressed = _ref.compressed,
27
36
  onChange = _ref.onChange,
28
37
  name = _ref.name,
29
38
  _ref$side = _ref.side,
30
39
  side = _ref$side === void 0 ? 'max' : _ref$side,
31
- digitTolerance = _ref.digitTolerance,
32
40
  fullWidth = _ref.fullWidth,
33
41
  _ref$autoSize = _ref.autoSize,
34
42
  autoSize = _ref$autoSize === void 0 ? true : _ref$autoSize,
35
43
  rest = _objectWithoutProperties(_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 = useMemo(function () {
40
- return autoSize ? logicalStyles({
41
- width: "".concat(digitTolerance / 1.25 + 2, "em")
42
- }) : {};
43
- }, [autoSize, digitTolerance]);
44
44
  var euiTheme = useEuiTheme();
45
45
  var styles = euiRangeInputStyles(euiTheme);
46
46
  var cssStyles = [styles.euiRangeInput];
47
+
48
+ // Determine whether an invalid icon is showing, which can come from
49
+ // the underlying EuiFieldNumber's native :invalid state
50
+ var _useState = useState(isInvalid),
51
+ _useState2 = _slicedToArray(_useState, 2),
52
+ hasInvalidIcon = _useState2[0],
53
+ setHasInvalidIcon = _useState2[1];
54
+ var validityRef = useRef(null);
55
+ var setRefs = useCombinedRefs([validityRef, inputRef]);
56
+ useEffect(function () {
57
+ var _validityRef$current;
58
+ var isNativelyInvalid = !((_validityRef$current = validityRef.current) !== null && _validityRef$current !== void 0 && _validityRef$current.validity.valid);
59
+ setHasInvalidIcon(isNativelyInvalid || isInvalid);
60
+ }, [value, isInvalid]);
61
+
62
+ // Calculate the auto size width of the input
63
+ var widthStyle = useMemo(function () {
64
+ if (!autoSize) return undefined;
65
+
66
+ // Calculate the number of characters to show (dynamic based on user input)
67
+ // Uses the min/max char length as a max, then add an extra UX buffer of 1
68
+ var maxChars = Math.max(String(min).length, String(max).length) + 1;
69
+ var inputCharWidth = Math.min(String(value).length, maxChars);
70
+
71
+ // Calculate the form padding based on `compressed` state
72
+ var _euiFormVariables = euiFormVariables(euiTheme),
73
+ controlPadding = _euiFormVariables.controlPadding,
74
+ controlCompressedPadding = _euiFormVariables.controlCompressedPadding;
75
+ var inputPadding = compressed ? controlCompressedPadding : controlPadding;
76
+
77
+ // Calculate the invalid icon (if being displayed), also based on `compressed` state
78
+ var invalidIconWidth = hasInvalidIcon ? euiTheme.euiTheme.base * (compressed ? 1.125 : 1.375) // TODO: DRY this out once EuiFormControlLayoutIcons is converted to Emotion
79
+ : 0;
80
+
81
+ // Guesstimate a width for the stepper. Note that it's a little wider in FF than it is in Chrome
82
+ var stepperWidth = 2;
83
+ return logicalStyles({
84
+ width: "calc(".concat(inputPadding, " + ").concat(inputCharWidth, "ch + ").concat(stepperWidth, "em + ").concat(invalidIconWidth, "px)")
85
+ });
86
+ }, [autoSize, euiTheme, compressed, hasInvalidIcon, min, max, value]);
47
87
  return ___EmotionJSX(EuiFieldNumber, _extends({
48
88
  name: name,
49
89
  className: "euiRangeInput euiRangeInput--".concat(side),
@@ -52,6 +92,8 @@ export var EuiRangeInput = function EuiRangeInput(_ref) {
52
92
  max: Number(max),
53
93
  step: step,
54
94
  value: value === '' ? '' : Number(value),
95
+ inputRef: setRefs,
96
+ isInvalid: isInvalid,
55
97
  disabled: disabled,
56
98
  compressed: compressed,
57
99
  onChange: onChange,
@@ -61,7 +103,6 @@ export var EuiRangeInput = function EuiRangeInput(_ref) {
61
103
  };
62
104
  EuiRangeInput.propTypes = {
63
105
  autoSize: PropTypes.bool,
64
- digitTolerance: PropTypes.number.isRequired,
65
106
  /**
66
107
  * @default 'max'
67
108
  */
@@ -1,3 +1,9 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ 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."); }
3
+ 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); }
4
+ 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; }
5
+ 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; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
1
7
  /*
2
8
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
9
  * or more contributor license agreements. Licensed under the Elastic License
@@ -6,7 +12,7 @@
6
12
  * Side Public License, v 1.
7
13
  */
8
14
 
9
- import { Children, cloneElement, useRef, useEffect, useCallback } from 'react';
15
+ import { Children, cloneElement, useState, useEffect, useCallback } from 'react';
10
16
  import PropTypes from "prop-types";
11
17
  function isMutableRef(ref) {
12
18
  return ref != null && ref.hasOwnProperty('current');
@@ -20,11 +26,15 @@ function isMutableRef(ref) {
20
26
  export var EuiValidatableControl = function EuiValidatableControl(_ref) {
21
27
  var isInvalid = _ref.isInvalid,
22
28
  children = _ref.children;
23
- var control = useRef(null);
29
+ // Note that this must be state and not a ref to cause a rerender/set invalid state on initial mount
30
+ var _useState = useState(null),
31
+ _useState2 = _slicedToArray(_useState, 2),
32
+ control = _useState2[0],
33
+ setControl = _useState2[1];
24
34
  var child = Children.only(children);
25
35
  var childRef = child.ref;
26
36
  var replacedRef = useCallback(function (element) {
27
- control.current = element;
37
+ setControl(element);
28
38
 
29
39
  // Call the original ref, if any
30
40
  if (typeof childRef === 'function') {
@@ -34,12 +44,12 @@ export var EuiValidatableControl = function EuiValidatableControl(_ref) {
34
44
  }
35
45
  }, [childRef]);
36
46
  useSetControlValidity({
37
- controlEl: control.current,
47
+ controlEl: control,
38
48
  isInvalid: isInvalid
39
49
  });
40
50
  return /*#__PURE__*/cloneElement(child, {
41
51
  ref: replacedRef,
42
- 'aria-invalid': isInvalid
52
+ 'aria-invalid': isInvalid || child.props['aria-invalid']
43
53
  });
44
54
  };
45
55
 
@@ -49,7 +49,6 @@ export * from './horizontal_rule';
49
49
  export * from './icon';
50
50
  export * from './image';
51
51
  export * from './inner_text';
52
- export * from './inline_edit';
53
52
  export * from './i18n';
54
53
  export * from './loading';
55
54
  export * from './key_pad_menu';
@@ -66,7 +66,12 @@ var processDateOperation = function processDateOperation(value, operator) {
66
66
  };
67
67
  export var _termValuesToQuery = function _termValuesToQuery(values, options) {
68
68
  var body = {
69
- query: values.join(' ')
69
+ query: values.map(function (value) {
70
+ if (isString(value) && value.match(/\s/)) {
71
+ return "\"".concat(value, "\"");
72
+ }
73
+ return value;
74
+ }).join(' ')
70
75
  };
71
76
  if (body.query === '') {
72
77
  return;
@@ -134,6 +134,9 @@ var emitTermClause = function emitTermClause(clause, isGroupMember) {
134
134
  match = undefined;
135
135
  }
136
136
  var matchOp = emitMatch(match);
137
+ if (isString(value) && value.match(/\s/)) {
138
+ return "".concat(matchOp, "\"").concat(escapeValue(value), "\"");
139
+ }
137
140
  return "".concat(matchOp).concat(escapeValue(value));
138
141
  };
139
142
  var emitIsClause = function emitIsClause(clause, isGroupMember) {
@@ -0,0 +1,70 @@
1
+ /*
2
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
+ * or more contributor license agreements. Licensed under the Elastic License
4
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
5
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
6
+ * Side Public License, v 1.
7
+ */
8
+
9
+ /// <reference types="cypress" />
10
+ /// <reference types="cypress-real-events" />
11
+ /// <reference types="../../../cypress/support" />
12
+
13
+ import React from 'react';
14
+ import { EuiFormRow } from '../form';
15
+ import { EuiSuggest } from './suggest';
16
+ import { jsx as ___EmotionJSX } from "@emotion/react";
17
+ var Suggest = function Suggest() {
18
+ var suggestedItems = [{
19
+ type: {
20
+ iconType: 'accessibility',
21
+ color: 'tint1'
22
+ },
23
+ label: 'Accessibility',
24
+ description: 'A short description'
25
+ }, {
26
+ type: {
27
+ iconType: 'image',
28
+ color: 'tint2'
29
+ },
30
+ label: 'Images',
31
+ description: 'Another short description'
32
+ }, {
33
+ type: {
34
+ iconType: 'lock',
35
+ color: 'tint3'
36
+ },
37
+ label: 'Locks',
38
+ description: 'A third short description'
39
+ }];
40
+ return ___EmotionJSX(EuiFormRow, {
41
+ label: "Suggest a topic",
42
+ id: "cy-label-suggest-1"
43
+ }, ___EmotionJSX(EuiSuggest, {
44
+ "aria-labelledby": "cy-label-suggest-1-label",
45
+ suggestions: suggestedItems
46
+ }));
47
+ };
48
+ describe('EuiSuggest', function () {
49
+ beforeEach(function () {
50
+ cy.realMount(___EmotionJSX(Suggest, null));
51
+ });
52
+ describe('Automated accessibility check', function () {
53
+ it('has zero violations when rendered', function () {
54
+ cy.checkAxe();
55
+ });
56
+ });
57
+ describe('Keyboard accessibility', function () {
58
+ it('has zero violations after traversing list items', function () {
59
+ cy.realPress('Tab');
60
+ cy.get('#cy-label-suggest-1').should('have.focus');
61
+ cy.get('ul[role="listbox"]').should('exist');
62
+ cy.realPress('ArrowDown');
63
+ cy.realPress('ArrowUp');
64
+ cy.realPress('ArrowRight');
65
+ cy.realPress('ArrowLeft');
66
+ cy.get('li[role="option"]').first().should('have.attr', 'aria-selected', 'true');
67
+ cy.checkAxe();
68
+ });
69
+ });
70
+ });
@@ -0,0 +1,75 @@
1
+ /*
2
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
+ * or more contributor license agreements. Licensed under the Elastic License
4
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
5
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
6
+ * Side Public License, v 1.
7
+ */
8
+
9
+ /// <reference types="cypress" />
10
+ /// <reference types="cypress-real-events" />
11
+ /// <reference types="../../../cypress/support" />
12
+
13
+ import React from 'react';
14
+ import { EuiTable, EuiTableHeader, EuiTableHeaderCell, EuiTableBody, EuiTableRow, EuiTableRowCell } from '.';
15
+ import { jsx as ___EmotionJSX } from "@emotion/react";
16
+ var users = [{
17
+ id: '47936',
18
+ firstName: 'Robert',
19
+ lastName: 'Stein',
20
+ github: 'steiner_rob',
21
+ location: {
22
+ city: 'Los Angeles',
23
+ state: 'CA'
24
+ }
25
+ }, {
26
+ id: '54736',
27
+ firstName: 'Martina',
28
+ lastName: 'Conlon',
29
+ github: 'martina_zen',
30
+ location: {
31
+ city: 'Boston',
32
+ state: 'MA'
33
+ }
34
+ }, {
35
+ id: '40193',
36
+ firstName: 'Alyce',
37
+ lastName: 'Benning',
38
+ github: 'alyce_benning',
39
+ location: {
40
+ city: 'Atlanta',
41
+ state: 'GA'
42
+ }
43
+ }];
44
+ var userRows = users.map(function (user) {
45
+ var id = user.id,
46
+ firstName = user.firstName,
47
+ lastName = user.lastName,
48
+ github = user.github,
49
+ _user$location = user.location,
50
+ city = _user$location.city,
51
+ state = _user$location.state;
52
+ return ___EmotionJSX(EuiTableRow, {
53
+ key: id
54
+ }, ___EmotionJSX(EuiTableRowCell, null, "".concat(firstName, " ").concat(lastName)), ___EmotionJSX(EuiTableRowCell, null, github), ___EmotionJSX(EuiTableRowCell, null, "".concat(city, ", ").concat(state)));
55
+ });
56
+ var customColumns = ['Name', 'Github', 'Location'];
57
+ var columnHeaders = customColumns.map(function (column, i) {
58
+ return ___EmotionJSX(EuiTableHeaderCell, {
59
+ key: i
60
+ }, column);
61
+ });
62
+ var CustomTable = function CustomTable() {
63
+ return ___EmotionJSX(EuiTable, null, ___EmotionJSX(EuiTableHeader, null, columnHeaders), ___EmotionJSX(EuiTableBody, null, userRows));
64
+ };
65
+ describe('EuiTable', function () {
66
+ beforeEach(function () {
67
+ cy.viewport(1024, 768); // medium breakpoint
68
+ cy.realMount(___EmotionJSX(CustomTable, null));
69
+ });
70
+ describe('Automated accessibility check', function () {
71
+ it('has zero violations on render', function () {
72
+ cy.checkAxe();
73
+ });
74
+ });
75
+ });