@elastic/eui 77.1.1 → 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 (108) 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/search_bar/query/ast_to_es_query_dsl.js +6 -1
  21. package/es/components/search_bar/query/ast_to_es_query_string.js +3 -0
  22. package/es/components/suggest/suggest.a11y.js +70 -0
  23. package/es/components/table/table.a11y.js +75 -0
  24. package/eui.d.ts +54 -54
  25. package/i18ntokens.json +26 -8
  26. package/lib/components/basic_table/basic_table.a11y.js +194 -0
  27. package/lib/components/basic_table/{table.a11y.js → in_memory_table.a11y.js} +2 -2
  28. package/lib/components/date_picker/date_picker.js +23 -15
  29. package/lib/components/date_picker/date_picker_range.js +35 -41
  30. package/lib/components/date_picker/super_date_picker/super_date_picker.js +99 -84
  31. package/lib/components/form/field_number/field_number.js +42 -8
  32. package/lib/components/form/field_text/field_text.js +1 -1
  33. package/lib/components/form/form_control_layout/form_control_layout.js +67 -35
  34. package/lib/components/form/form_control_layout/form_control_layout_delimited.js +31 -11
  35. package/lib/components/form/form_control_layout/form_control_layout_icons.js +11 -19
  36. package/lib/components/form/range/dual_range.js +2 -4
  37. package/lib/components/form/range/range.js +0 -2
  38. package/lib/components/form/range/range_input.js +52 -11
  39. package/lib/components/form/validatable_control/validatable_control.js +14 -12
  40. package/lib/components/search_bar/query/ast_to_es_query_dsl.js +6 -1
  41. package/lib/components/search_bar/query/ast_to_es_query_string.js +3 -0
  42. package/lib/components/suggest/suggest.a11y.js +73 -0
  43. package/lib/components/table/table.a11y.js +78 -0
  44. package/optimize/es/components/basic_table/basic_table.a11y.js +194 -0
  45. package/optimize/es/components/basic_table/{table.a11y.js → in_memory_table.a11y.js} +1 -1
  46. package/optimize/es/components/date_picker/date_picker.js +17 -14
  47. package/optimize/es/components/date_picker/date_picker_range.js +20 -14
  48. package/optimize/es/components/date_picker/super_date_picker/super_date_picker.js +99 -84
  49. package/optimize/es/components/form/field_number/field_number.js +34 -8
  50. package/optimize/es/components/form/field_text/field_text.js +1 -1
  51. package/optimize/es/components/form/form_control_layout/form_control_layout.js +67 -30
  52. package/optimize/es/components/form/form_control_layout/form_control_layout_delimited.js +31 -11
  53. package/optimize/es/components/form/form_control_layout/form_control_layout_icons.js +10 -20
  54. package/optimize/es/components/form/range/dual_range.js +2 -4
  55. package/optimize/es/components/form/range/range.js +0 -2
  56. package/optimize/es/components/form/range/range_input.js +49 -12
  57. package/optimize/es/components/form/validatable_control/validatable_control.js +10 -5
  58. package/optimize/es/components/search_bar/query/ast_to_es_query_dsl.js +6 -1
  59. package/optimize/es/components/search_bar/query/ast_to_es_query_string.js +3 -0
  60. package/optimize/es/components/suggest/suggest.a11y.js +70 -0
  61. package/optimize/es/components/table/table.a11y.js +75 -0
  62. package/optimize/lib/components/basic_table/basic_table.a11y.js +188 -0
  63. package/{test-env/components/basic_table/table.a11y.js → optimize/lib/components/basic_table/in_memory_table.a11y.js} +2 -2
  64. package/optimize/lib/components/date_picker/date_picker.js +17 -14
  65. package/optimize/lib/components/date_picker/date_picker_range.js +19 -13
  66. package/optimize/lib/components/date_picker/super_date_picker/super_date_picker.js +99 -84
  67. package/optimize/lib/components/form/field_number/field_number.js +37 -8
  68. package/optimize/lib/components/form/field_text/field_text.js +1 -1
  69. package/optimize/lib/components/form/form_control_layout/form_control_layout.js +67 -35
  70. package/optimize/lib/components/form/form_control_layout/form_control_layout_delimited.js +31 -11
  71. package/optimize/lib/components/form/form_control_layout/form_control_layout_icons.js +9 -19
  72. package/optimize/lib/components/form/range/dual_range.js +2 -4
  73. package/optimize/lib/components/form/range/range.js +0 -2
  74. package/optimize/lib/components/form/range/range_input.js +47 -10
  75. package/optimize/lib/components/form/validatable_control/validatable_control.js +10 -4
  76. package/optimize/lib/components/search_bar/query/ast_to_es_query_dsl.js +6 -1
  77. package/optimize/lib/components/search_bar/query/ast_to_es_query_string.js +3 -0
  78. package/optimize/lib/components/suggest/suggest.a11y.js +73 -0
  79. package/optimize/lib/components/table/table.a11y.js +78 -0
  80. package/package.json +1 -1
  81. package/src/components/date_picker/_date_picker_range.scss +0 -60
  82. package/src/components/date_picker/super_date_picker/_super_date_picker.scss +23 -11
  83. package/src/components/date_picker/super_date_picker/_variables.scss +3 -0
  84. package/src/components/date_picker/super_date_picker/date_popover/_date_popover_button.scss +5 -7
  85. package/src/components/form/form_control_layout/_form_control_layout.scss +2 -2
  86. package/src/components/form/form_control_layout/_form_control_layout_delimited.scss +12 -36
  87. package/src/components/form/form_control_layout/_form_control_layout_icons.scss +27 -6
  88. package/src/themes/amsterdam/overrides/_date_picker.scss +0 -14
  89. package/src/themes/amsterdam/overrides/_index.scss +0 -1
  90. package/test-env/components/basic_table/basic_table.a11y.js +188 -0
  91. package/{optimize/lib/components/basic_table/table.a11y.js → test-env/components/basic_table/in_memory_table.a11y.js} +2 -2
  92. package/test-env/components/date_picker/date_picker.js +23 -15
  93. package/test-env/components/date_picker/date_picker_range.js +35 -41
  94. package/test-env/components/date_picker/super_date_picker/super_date_picker.js +99 -84
  95. package/test-env/components/form/field_number/field_number.js +37 -8
  96. package/test-env/components/form/field_text/field_text.js +1 -1
  97. package/test-env/components/form/form_control_layout/form_control_layout.js +68 -35
  98. package/test-env/components/form/form_control_layout/form_control_layout_delimited.js +31 -11
  99. package/test-env/components/form/form_control_layout/form_control_layout_icons.js +11 -19
  100. package/test-env/components/form/range/dual_range.js +2 -4
  101. package/test-env/components/form/range/range.js +0 -2
  102. package/test-env/components/form/range/range_input.js +47 -11
  103. package/test-env/components/form/validatable_control/validatable_control.js +9 -4
  104. package/test-env/components/search_bar/query/ast_to_es_query_dsl.js +6 -1
  105. package/test-env/components/search_bar/query/ast_to_es_query_string.js +3 -0
  106. package/test-env/components/suggest/suggest.a11y.js +73 -0
  107. package/test-env/components/table/table.a11y.js +78 -0
  108. package/src/themes/amsterdam/overrides/_date_popover_button.scss +0 -14
@@ -393,7 +393,6 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
393
393
  var min = minProps;
394
394
  var max = maxProps;
395
395
  var id = this.state.id;
396
- var digitTolerance = Math.max(String(min).length, String(max).length);
397
396
  var showInputOnly = showInput === 'inputWithPopover';
398
397
  var canShowDropdown = showInputOnly && !readOnly && !disabled;
399
398
  var rangeStyles = (0, _range.euiRangeStyles)(theme);
@@ -404,7 +403,6 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
404
403
  "aria-label": this.props['aria-label']
405
404
  }, minInputProps, {
406
405
  // Non-overridable props
407
- digitTolerance: digitTolerance,
408
406
  side: "min",
409
407
  min: min,
410
408
  max: Number(this.upperValue),
@@ -433,7 +431,6 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
433
431
  "aria-label": this.props['aria-label']
434
432
  }, maxInputProps, {
435
433
  // Non-overridable props
436
- digitTolerance: digitTolerance,
437
434
  side: "max",
438
435
  min: Number(this.lowerValue),
439
436
  max: max,
@@ -585,7 +582,8 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
585
582
  readOnly: readOnly,
586
583
  append: append,
587
584
  prepend: prepend,
588
- isLoading: isLoading
585
+ isLoading: isLoading,
586
+ isInvalid: isInvalid
589
587
  }),
590
588
  fullWidth: fullWidth,
591
589
  isOpen: this.state.isPopoverOpen,
@@ -134,14 +134,12 @@ var EuiRangeClass = /*#__PURE__*/function (_Component) {
134
134
  theme = _this$props.theme,
135
135
  rest = (0, _objectWithoutProperties2.default)(_this$props, _excluded);
136
136
  var id = this.state.id;
137
- var digitTolerance = Math.max(String(min).length, String(max).length);
138
137
  var showInputOnly = showInput === 'inputWithPopover';
139
138
  var canShowDropdown = showInputOnly && !readOnly && !disabled;
140
139
  var theInput = !!showInput ? (0, _react2.jsx)(_range_input.EuiRangeInput, (0, _extends2.default)({
141
140
  id: id,
142
141
  min: min,
143
142
  max: max,
144
- digitTolerance: digitTolerance,
145
143
  step: step,
146
144
  value: value,
147
145
  readOnly: readOnly,
@@ -7,15 +7,17 @@ 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 _propTypes = _interopRequireDefault(require("prop-types"));
13
14
  var _services = require("../../../services");
14
15
  var _global_styling = require("../../../global_styling");
16
+ var _form = require("../form.styles");
15
17
  var _field_number = require("../field_number");
16
18
  var _range_input = require("./range_input.styles");
17
19
  var _react2 = require("@emotion/react");
18
- var _excluded = ["min", "max", "step", "value", "disabled", "compressed", "onChange", "name", "side", "digitTolerance", "fullWidth", "autoSize"];
20
+ var _excluded = ["min", "max", "step", "value", "inputRef", "isInvalid", "disabled", "compressed", "onChange", "name", "side", "fullWidth", "autoSize"];
19
21
  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); }
20
22
  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; }
21
23
  var EuiRangeInput = function EuiRangeInput(_ref) {
@@ -23,28 +25,61 @@ var EuiRangeInput = function EuiRangeInput(_ref) {
23
25
  max = _ref.max,
24
26
  step = _ref.step,
25
27
  value = _ref.value,
28
+ inputRef = _ref.inputRef,
29
+ isInvalid = _ref.isInvalid,
26
30
  disabled = _ref.disabled,
27
31
  compressed = _ref.compressed,
28
32
  onChange = _ref.onChange,
29
33
  name = _ref.name,
30
34
  _ref$side = _ref.side,
31
35
  side = _ref$side === void 0 ? 'max' : _ref$side,
32
- digitTolerance = _ref.digitTolerance,
33
36
  fullWidth = _ref.fullWidth,
34
37
  _ref$autoSize = _ref.autoSize,
35
38
  autoSize = _ref$autoSize === void 0 ? true : _ref$autoSize,
36
39
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
37
- // Chrome will properly size the input based on the max value, but FF does not.
38
- // Calculate the width of the input based on highest number of characters.
39
- // Add 2 to accommodate for input stepper
40
- var widthStyle = (0, _react.useMemo)(function () {
41
- return autoSize ? (0, _global_styling.logicalStyles)({
42
- width: "".concat(digitTolerance / 1.25 + 2, "em")
43
- }) : {};
44
- }, [autoSize, digitTolerance]);
45
40
  var euiTheme = (0, _services.useEuiTheme)();
46
41
  var styles = (0, _range_input.euiRangeInputStyles)(euiTheme);
47
42
  var cssStyles = [styles.euiRangeInput];
43
+
44
+ // Determine whether an invalid icon is showing, which can come from
45
+ // the underlying EuiFieldNumber's native :invalid state
46
+ var _useState = (0, _react.useState)(isInvalid),
47
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
48
+ hasInvalidIcon = _useState2[0],
49
+ setHasInvalidIcon = _useState2[1];
50
+ var validityRef = (0, _react.useRef)(null);
51
+ var setRefs = (0, _services.useCombinedRefs)([validityRef, inputRef]);
52
+ (0, _react.useEffect)(function () {
53
+ var _validityRef$current;
54
+ var isNativelyInvalid = !((_validityRef$current = validityRef.current) !== null && _validityRef$current !== void 0 && _validityRef$current.validity.valid);
55
+ setHasInvalidIcon(isNativelyInvalid || isInvalid);
56
+ }, [value, isInvalid]);
57
+
58
+ // Calculate the auto size width of the input
59
+ var widthStyle = (0, _react.useMemo)(function () {
60
+ if (!autoSize) return undefined;
61
+
62
+ // Calculate the number of characters to show (dynamic based on user input)
63
+ // Uses the min/max char length as a max, then add an extra UX buffer of 1
64
+ var maxChars = Math.max(String(min).length, String(max).length) + 1;
65
+ var inputCharWidth = Math.min(String(value).length, maxChars);
66
+
67
+ // Calculate the form padding based on `compressed` state
68
+ var _euiFormVariables = (0, _form.euiFormVariables)(euiTheme),
69
+ controlPadding = _euiFormVariables.controlPadding,
70
+ controlCompressedPadding = _euiFormVariables.controlCompressedPadding;
71
+ var inputPadding = compressed ? controlCompressedPadding : controlPadding;
72
+
73
+ // Calculate the invalid icon (if being displayed), also based on `compressed` state
74
+ var invalidIconWidth = hasInvalidIcon ? euiTheme.euiTheme.base * (compressed ? 1.125 : 1.375) // TODO: DRY this out once EuiFormControlLayoutIcons is converted to Emotion
75
+ : 0;
76
+
77
+ // Guesstimate a width for the stepper. Note that it's a little wider in FF than it is in Chrome
78
+ var stepperWidth = 2;
79
+ return (0, _global_styling.logicalStyles)({
80
+ width: "calc(".concat(inputPadding, " + ").concat(inputCharWidth, "ch + ").concat(stepperWidth, "em + ").concat(invalidIconWidth, "px)")
81
+ });
82
+ }, [autoSize, euiTheme, compressed, hasInvalidIcon, min, max, value]);
48
83
  return (0, _react2.jsx)(_field_number.EuiFieldNumber, (0, _extends2.default)({
49
84
  name: name,
50
85
  className: "euiRangeInput euiRangeInput--".concat(side),
@@ -53,6 +88,8 @@ var EuiRangeInput = function EuiRangeInput(_ref) {
53
88
  max: Number(max),
54
89
  step: step,
55
90
  value: value === '' ? '' : Number(value),
91
+ inputRef: setRefs,
92
+ isInvalid: isInvalid,
56
93
  disabled: disabled,
57
94
  compressed: compressed,
58
95
  onChange: onChange,
@@ -63,7 +100,6 @@ var EuiRangeInput = function EuiRangeInput(_ref) {
63
100
  exports.EuiRangeInput = EuiRangeInput;
64
101
  EuiRangeInput.propTypes = {
65
102
  autoSize: _propTypes.default.bool,
66
- digitTolerance: _propTypes.default.number.isRequired,
67
103
  /**
68
104
  * @default 'max'
69
105
  */
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.useEuiValidatableControl = exports.EuiValidatableControl = void 0;
8
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
8
9
  var _react = require("react");
9
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
10
11
  /*
@@ -27,11 +28,15 @@ function isMutableRef(ref) {
27
28
  var EuiValidatableControl = function EuiValidatableControl(_ref) {
28
29
  var isInvalid = _ref.isInvalid,
29
30
  children = _ref.children;
30
- var control = (0, _react.useRef)(null);
31
+ // Note that this must be state and not a ref to cause a rerender/set invalid state on initial mount
32
+ var _useState = (0, _react.useState)(null),
33
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
34
+ control = _useState2[0],
35
+ setControl = _useState2[1];
31
36
  var child = _react.Children.only(children);
32
37
  var childRef = child.ref;
33
38
  var replacedRef = (0, _react.useCallback)(function (element) {
34
- control.current = element;
39
+ setControl(element);
35
40
 
36
41
  // Call the original ref, if any
37
42
  if (typeof childRef === 'function') {
@@ -41,12 +46,12 @@ var EuiValidatableControl = function EuiValidatableControl(_ref) {
41
46
  }
42
47
  }, [childRef]);
43
48
  useSetControlValidity({
44
- controlEl: control.current,
49
+ controlEl: control,
45
50
  isInvalid: isInvalid
46
51
  });
47
52
  return /*#__PURE__*/(0, _react.cloneElement)(child, {
48
53
  ref: replacedRef,
49
- 'aria-invalid': isInvalid
54
+ 'aria-invalid': isInvalid || child.props['aria-invalid']
50
55
  });
51
56
  };
52
57
 
@@ -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.join(' ')
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
+ });
@@ -1,14 +0,0 @@
1
- .euiDatePopoverButton--start {
2
- text-align: center;
3
- }
4
-
5
- .euiDatePopoverButton--end {
6
- text-align: center;
7
- border-top-right-radius: $euiFormControlBorderRadius;
8
- border-bottom-right-radius: $euiFormControlBorderRadius;
9
-
10
- &.euiDatePopoverButton--compressed {
11
- border-top-right-radius: $euiFormControlCompressedBorderRadius;
12
- border-bottom-right-radius: $euiFormControlCompressedBorderRadius;
13
- }
14
- }