@elastic/eui 93.6.0 → 94.1.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 (147) hide show
  1. package/dist/eui_theme_dark.css +0 -765
  2. package/dist/eui_theme_dark.min.css +1 -1
  3. package/dist/eui_theme_light.css +0 -765
  4. package/dist/eui_theme_light.min.css +1 -1
  5. package/es/components/basic_table/basic_table.js +123 -133
  6. package/es/components/basic_table/basic_table.styles.js +3 -17
  7. package/es/components/basic_table/collapsed_item_actions.js +11 -20
  8. package/es/components/basic_table/default_item_action.js +9 -16
  9. package/es/components/basic_table/expanded_item_actions.js +1 -2
  10. package/es/components/basic_table/in_memory_table.js +63 -78
  11. package/es/components/provider/component_defaults/component_defaults.js +7 -1
  12. package/es/components/table/_table_cell_content.js +72 -0
  13. package/es/components/table/_table_cell_content.styles.js +63 -0
  14. package/es/components/table/index.js +0 -1
  15. package/es/components/table/mobile/responsive_context.js +37 -0
  16. package/es/components/table/mobile/table_header_mobile.js +11 -4
  17. package/es/components/table/mobile/table_header_mobile.styles.js +15 -0
  18. package/es/components/table/mobile/table_sort_mobile.js +12 -3
  19. package/es/components/table/table.js +23 -13
  20. package/es/components/table/table.styles.js +102 -0
  21. package/es/components/table/table_cells_shared.styles.js +52 -0
  22. package/es/components/table/table_footer_cell.js +12 -12
  23. package/es/components/table/table_header_cell.js +58 -75
  24. package/es/components/table/table_header_cell_checkbox.js +6 -2
  25. package/es/components/table/table_row.js +18 -6
  26. package/es/components/table/table_row.styles.js +78 -0
  27. package/es/components/table/table_row_cell.js +65 -91
  28. package/es/components/table/table_row_cell.styles.js +89 -0
  29. package/es/components/table/table_row_cell_checkbox.js +7 -0
  30. package/eui.d.ts +667 -510
  31. package/i18ntokens.json +52 -52
  32. package/lib/components/basic_table/basic_table.js +122 -132
  33. package/lib/components/basic_table/basic_table.styles.js +5 -20
  34. package/lib/components/basic_table/collapsed_item_actions.js +11 -20
  35. package/lib/components/basic_table/default_item_action.js +12 -17
  36. package/lib/components/basic_table/expanded_item_actions.js +1 -2
  37. package/lib/components/basic_table/in_memory_table.js +63 -78
  38. package/lib/components/provider/component_defaults/component_defaults.js +7 -1
  39. package/lib/components/table/_table_cell_content.js +82 -0
  40. package/lib/components/table/_table_cell_content.styles.js +68 -0
  41. package/lib/components/table/index.js +0 -7
  42. package/lib/components/table/mobile/responsive_context.js +47 -0
  43. package/lib/components/table/mobile/table_header_mobile.js +11 -4
  44. package/lib/components/table/mobile/table_header_mobile.styles.js +22 -0
  45. package/lib/components/table/mobile/table_sort_mobile.js +12 -3
  46. package/lib/components/table/table.js +23 -13
  47. package/lib/components/table/table.styles.js +109 -0
  48. package/lib/components/table/table_cells_shared.styles.js +58 -0
  49. package/lib/components/table/table_footer_cell.js +11 -11
  50. package/lib/components/table/table_header_cell.js +58 -75
  51. package/lib/components/table/table_header_cell_checkbox.js +6 -2
  52. package/lib/components/table/table_row.js +17 -5
  53. package/lib/components/table/table_row.styles.js +84 -0
  54. package/lib/components/table/table_row_cell.js +64 -92
  55. package/lib/components/table/table_row_cell.styles.js +94 -0
  56. package/lib/components/table/table_row_cell_checkbox.js +7 -0
  57. package/optimize/es/components/basic_table/basic_table.js +56 -59
  58. package/optimize/es/components/basic_table/basic_table.styles.js +3 -17
  59. package/optimize/es/components/basic_table/collapsed_item_actions.js +11 -20
  60. package/optimize/es/components/basic_table/default_item_action.js +9 -16
  61. package/optimize/es/components/basic_table/expanded_item_actions.js +1 -2
  62. package/optimize/es/components/basic_table/in_memory_table.js +1 -6
  63. package/optimize/es/components/table/_table_cell_content.js +56 -0
  64. package/optimize/es/components/table/_table_cell_content.styles.js +63 -0
  65. package/optimize/es/components/table/index.js +0 -1
  66. package/optimize/es/components/table/mobile/responsive_context.js +37 -0
  67. package/optimize/es/components/table/mobile/table_header_mobile.js +11 -4
  68. package/optimize/es/components/table/mobile/table_header_mobile.styles.js +15 -0
  69. package/optimize/es/components/table/mobile/table_sort_mobile.js +7 -1
  70. package/optimize/es/components/table/table.js +13 -12
  71. package/optimize/es/components/table/table.styles.js +102 -0
  72. package/optimize/es/components/table/table_cells_shared.styles.js +49 -0
  73. package/optimize/es/components/table/table_footer_cell.js +12 -12
  74. package/optimize/es/components/table/table_header_cell.js +57 -61
  75. package/optimize/es/components/table/table_header_cell_checkbox.js +6 -2
  76. package/optimize/es/components/table/table_row.js +10 -2
  77. package/optimize/es/components/table/table_row.styles.js +78 -0
  78. package/optimize/es/components/table/table_row_cell.js +49 -80
  79. package/optimize/es/components/table/table_row_cell.styles.js +89 -0
  80. package/optimize/es/components/table/table_row_cell_checkbox.js +7 -0
  81. package/optimize/lib/components/basic_table/basic_table.js +55 -58
  82. package/optimize/lib/components/basic_table/basic_table.styles.js +5 -20
  83. package/optimize/lib/components/basic_table/collapsed_item_actions.js +11 -20
  84. package/optimize/lib/components/basic_table/default_item_action.js +12 -17
  85. package/optimize/lib/components/basic_table/expanded_item_actions.js +1 -2
  86. package/optimize/lib/components/basic_table/in_memory_table.js +1 -6
  87. package/optimize/lib/components/table/_table_cell_content.js +66 -0
  88. package/optimize/lib/components/table/_table_cell_content.styles.js +68 -0
  89. package/optimize/lib/components/table/index.js +0 -7
  90. package/optimize/lib/components/table/mobile/responsive_context.js +47 -0
  91. package/optimize/lib/components/table/mobile/table_header_mobile.js +11 -4
  92. package/optimize/lib/components/table/mobile/table_header_mobile.styles.js +22 -0
  93. package/optimize/lib/components/table/mobile/table_sort_mobile.js +7 -1
  94. package/optimize/lib/components/table/table.js +13 -12
  95. package/optimize/lib/components/table/table.styles.js +109 -0
  96. package/optimize/lib/components/table/table_cells_shared.styles.js +56 -0
  97. package/optimize/lib/components/table/table_footer_cell.js +11 -11
  98. package/optimize/lib/components/table/table_header_cell.js +57 -61
  99. package/optimize/lib/components/table/table_header_cell_checkbox.js +6 -2
  100. package/optimize/lib/components/table/table_row.js +9 -1
  101. package/optimize/lib/components/table/table_row.styles.js +85 -0
  102. package/optimize/lib/components/table/table_row_cell.js +48 -82
  103. package/optimize/lib/components/table/table_row_cell.styles.js +94 -0
  104. package/optimize/lib/components/table/table_row_cell_checkbox.js +7 -0
  105. package/package.json +2 -2
  106. package/src/components/index.scss +0 -1
  107. package/test-env/components/basic_table/basic_table.js +118 -131
  108. package/test-env/components/basic_table/basic_table.styles.js +5 -20
  109. package/test-env/components/basic_table/collapsed_item_actions.js +11 -20
  110. package/test-env/components/basic_table/default_item_action.js +12 -17
  111. package/test-env/components/basic_table/expanded_item_actions.js +1 -2
  112. package/test-env/components/basic_table/in_memory_table.js +63 -78
  113. package/test-env/components/provider/component_defaults/component_defaults.js +7 -1
  114. package/test-env/components/table/_table_cell_content.js +76 -0
  115. package/test-env/components/table/_table_cell_content.styles.js +68 -0
  116. package/test-env/components/table/index.js +0 -7
  117. package/test-env/components/table/mobile/responsive_context.js +47 -0
  118. package/test-env/components/table/mobile/table_header_mobile.js +11 -4
  119. package/test-env/components/table/mobile/table_header_mobile.styles.js +22 -0
  120. package/test-env/components/table/mobile/table_sort_mobile.js +12 -3
  121. package/test-env/components/table/table.js +23 -13
  122. package/test-env/components/table/table.styles.js +109 -0
  123. package/test-env/components/table/table_cells_shared.styles.js +56 -0
  124. package/test-env/components/table/table_footer_cell.js +11 -11
  125. package/test-env/components/table/table_header_cell.js +58 -75
  126. package/test-env/components/table/table_header_cell_checkbox.js +6 -2
  127. package/test-env/components/table/table_row.js +17 -5
  128. package/test-env/components/table/table_row.styles.js +85 -0
  129. package/test-env/components/table/table_row_cell.js +59 -93
  130. package/test-env/components/table/table_row_cell.styles.js +94 -0
  131. package/test-env/components/table/table_row_cell_checkbox.js +7 -0
  132. package/es/components/table/table_header_button.js +0 -52
  133. package/lib/components/table/table_header_button.js +0 -59
  134. package/optimize/es/components/table/table_header_button.js +0 -43
  135. package/optimize/lib/components/table/table_header_button.js +0 -50
  136. package/src/components/date_picker/react-datepicker/LICENSE +0 -21
  137. package/src/components/date_picker/react-datepicker/README.md +0 -168
  138. package/src/components/table/_index.scss +0 -7
  139. package/src/components/table/_mixins.scss +0 -20
  140. package/src/components/table/_responsive.scss +0 -211
  141. package/src/components/table/_table.scss +0 -241
  142. package/src/components/table/_variables.scss +0 -17
  143. package/src/components/table/mobile/_index.scss +0 -1
  144. package/src/components/table/mobile/_mobile.scss +0 -17
  145. package/src/services/theme/README.md +0 -153
  146. package/src/test/README.md +0 -44
  147. package/test-env/components/table/table_header_button.js +0 -58
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.euiTableHeaderFooterCellStyles = exports.euiTableCellCheckboxStyles = void 0;
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
+ var _react = require("@emotion/react");
10
+ var _services = require("../../services");
11
+ var _global_styling = require("../../global_styling");
12
+ var _table = require("./table.styles");
13
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
14
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } /*
15
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
16
+ * or more contributor license agreements. Licensed under the Elastic License
17
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
18
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
19
+ * Side Public License, v 1.
20
+ */
21
+ var euiTableHeaderFooterCellStyles = function euiTableHeaderFooterCellStyles(euiThemeContext) {
22
+ var euiTheme = euiThemeContext.euiTheme,
23
+ colorMode = euiThemeContext.colorMode;
24
+
25
+ // euiFontSize returns an object, so we keep object notation here to merge into css``
26
+ var sharedStyles = _objectSpread(_objectSpread({}, (0, _global_styling.euiFontSize)(euiThemeContext, 'xs')), {}, {
27
+ fontWeight: euiTheme.font.weight.semiBold,
28
+ color: euiTheme.colors.title,
29
+ verticalAlign: 'middle'
30
+ });
31
+ return {
32
+ euiTableHeaderCell: /*#__PURE__*/(0, _react.css)(sharedStyles, ";;label:euiTableHeaderCell;"),
33
+ euiTableHeaderCell__content: /*#__PURE__*/(0, _react.css)("gap:", euiTheme.size.xs, ";;label:euiTableHeaderCell__content;"),
34
+ euiTableHeaderCell__button: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('width', '100%'), " font-weight:inherit;line-height:inherit;.euiTableSortIcon--sortable{color:", (0, _services.makeHighContrastColor)(
35
+ // Tint it arbitrarily high, the contrast util will take care of lowering back down to WCAG
36
+ (0, _services.tintOrShade)(euiTheme.colors.subduedText, 0.9, colorMode), 3 // 3:1 ratio from https://www.w3.org/WAI/WCAG22/Understanding/non-text-contrast.html
37
+ )(euiTheme.colors.emptyShade), ";}&:hover,&:focus{color:", euiTheme.colors.primaryText, ";text-decoration:underline;.euiTableSortIcon--sortable{color:", euiTheme.colors.primaryText, ";}};label:euiTableHeaderCell__button;"),
38
+ euiTableFooterCell: /*#__PURE__*/(0, _react.css)(sharedStyles, " background-color:", euiTheme.colors.lightestShade, ";;label:euiTableFooterCell;")
39
+ };
40
+ };
41
+ exports.euiTableHeaderFooterCellStyles = euiTableHeaderFooterCellStyles;
42
+ var euiTableCellCheckboxStyles = function euiTableCellCheckboxStyles(euiThemeContext) {
43
+ var euiTheme = euiThemeContext.euiTheme;
44
+ var _euiTableVariables = (0, _table.euiTableVariables)(euiThemeContext),
45
+ cellContentPadding = _euiTableVariables.cellContentPadding,
46
+ mobileSizes = _euiTableVariables.mobileSizes,
47
+ checkboxSize = _euiTableVariables.checkboxSize;
48
+ var sharedCheckboxStyles = "\n ".concat((0, _global_styling.logicalCSS)('width', checkboxSize), "\n vertical-align: middle;\n ");
49
+ return {
50
+ euiTableHeaderCellCheckbox: /*#__PURE__*/(0, _react.css)(sharedCheckboxStyles, (0, _global_styling.logicalTextAlignCSS)('left'), ";;label:euiTableHeaderCellCheckbox;"),
51
+ euiTableRowCellCheckbox: /*#__PURE__*/(0, _react.css)(sharedCheckboxStyles, ";;label:euiTableRowCellCheckbox;"),
52
+ desktop: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('border-vertical', euiTheme.border.thin), ";;label:desktop;"),
53
+ mobile: /*#__PURE__*/(0, _react.css)("position:absolute;", (0, _global_styling.logicalCSS)('top', cellContentPadding), " ", (0, _global_styling.logicalCSS)('left', mobileSizes.checkbox.offset), ";;label:mobile;")
54
+ };
55
+ };
56
+ exports.euiTableCellCheckboxStyles = euiTableCellCheckboxStyles;
@@ -11,6 +11,8 @@ var _react = _interopRequireDefault(require("react"));
11
11
  var _classnames = _interopRequireDefault(require("classnames"));
12
12
  var _services = require("../../services");
13
13
  var _utils = require("./utils");
14
+ var _table_cell_content = require("./_table_cell_content");
15
+ var _table_cells_shared = require("./table_cells_shared.styles");
14
16
  var _react2 = require("@emotion/react");
15
17
  var _excluded = ["children", "align", "className", "width", "style"];
16
18
  /*
@@ -29,18 +31,16 @@ var EuiTableFooterCell = function EuiTableFooterCell(_ref) {
29
31
  style = _ref.style,
30
32
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
31
33
  var classes = (0, _classnames.default)('euiTableFooterCell', className);
32
- var contentClasses = (0, _classnames.default)('euiTableCellContent', className, {
33
- 'euiTableCellContent--alignRight': align === _services.RIGHT_ALIGNMENT,
34
- 'euiTableCellContent--alignCenter': align === _services.CENTER_ALIGNMENT
35
- });
36
- var styleObj = (0, _utils.resolveWidthAsStyle)(style, width);
34
+ var inlineStyles = (0, _utils.resolveWidthAsStyle)(style, width);
35
+ var styles = (0, _services.useEuiMemoizedStyles)(_table_cells_shared.euiTableHeaderFooterCellStyles);
37
36
  return (0, _react2.jsx)("td", (0, _extends2.default)({
37
+ css: styles.euiTableFooterCell,
38
38
  className: classes,
39
- style: styleObj
40
- }, rest), (0, _react2.jsx)("div", {
41
- className: contentClasses
42
- }, (0, _react2.jsx)("span", {
43
- className: "euiTableCellContent__text"
44
- }, children)));
39
+ style: inlineStyles
40
+ }, rest), (0, _react2.jsx)(_table_cell_content.EuiTableCellContent, {
41
+ align: align,
42
+ truncateText: true,
43
+ textOnly: true
44
+ }, children));
45
45
  };
46
46
  exports.EuiTableFooterCell = EuiTableFooterCell;
@@ -9,12 +9,15 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
9
9
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
10
  var _react = _interopRequireDefault(require("react"));
11
11
  var _classnames = _interopRequireDefault(require("classnames"));
12
+ var _services = require("../../services");
13
+ var _i18n = require("../i18n");
12
14
  var _accessibility = require("../accessibility");
13
15
  var _icon = require("../icon");
14
- var _utils = require("./utils");
15
16
  var _inner_text = require("../inner_text");
16
- var _services = require("../../services");
17
- var _i18n = require("../i18n");
17
+ var _utils = require("./utils");
18
+ var _responsive_context = require("./mobile/responsive_context");
19
+ var _table_cell_content = require("./_table_cell_content");
20
+ var _table_cells_shared = require("./table_cells_shared.styles");
18
21
  var _react2 = require("@emotion/react");
19
22
  var _excluded = ["children", "align", "onSort", "isSorted", "isSortAscending", "className", "scope", "mobileOptions", "width", "style", "readOnly", "description"];
20
23
  /*
@@ -26,13 +29,17 @@ var _excluded = ["children", "align", "onSort", "isSorted", "isSortAscending", "
26
29
  */
27
30
  var CellContents = function CellContents(_ref) {
28
31
  var className = _ref.className,
32
+ align = _ref.align,
29
33
  description = _ref.description,
30
34
  children = _ref.children,
35
+ canSort = _ref.canSort,
31
36
  isSorted = _ref.isSorted,
32
- isSortAscending = _ref.isSortAscending,
33
- showSortMsg = _ref.showSortMsg;
34
- return (0, _react2.jsx)("span", {
35
- className: className
37
+ isSortAscending = _ref.isSortAscending;
38
+ return (0, _react2.jsx)(_table_cell_content.EuiTableCellContent, {
39
+ className: className,
40
+ align: align,
41
+ textOnly: false,
42
+ truncateText: null
36
43
  }, (0, _react2.jsx)(_inner_text.EuiInnerText, null, function (ref, innerText) {
37
44
  return (0, _react2.jsx)(_i18n.EuiI18n, {
38
45
  token: "euiTableHeaderCell.titleTextWithDesc",
@@ -45,14 +52,19 @@ var CellContents = function CellContents(_ref) {
45
52
  return (0, _react2.jsx)("span", {
46
53
  title: description ? titleTextWithDesc : innerText,
47
54
  ref: ref,
48
- className: "euiTableCellContent__text"
55
+ className: "eui-textTruncate"
49
56
  }, children);
50
57
  });
51
- }), description && (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("span", null, description)), showSortMsg && isSorted && (0, _react2.jsx)(_icon.EuiIcon, {
58
+ }), description && (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("span", null, description)), isSorted ? (0, _react2.jsx)(_icon.EuiIcon, {
52
59
  className: "euiTableSortIcon",
53
60
  type: isSortAscending ? 'sortUp' : 'sortDown',
54
61
  size: "m"
55
- }));
62
+ }) : canSort ? (0, _react2.jsx)(_icon.EuiIcon, {
63
+ className: "euiTableSortIcon euiTableSortIcon--sortable",
64
+ type: "sortable",
65
+ size: "m",
66
+ color: "subdued" // Tinted a bit further via CSS
67
+ }) : null);
56
68
  };
57
69
  var EuiTableHeaderCell = function EuiTableHeaderCell(_ref2) {
58
70
  var children = _ref2.children,
@@ -63,69 +75,53 @@ var EuiTableHeaderCell = function EuiTableHeaderCell(_ref2) {
63
75
  isSortAscending = _ref2.isSortAscending,
64
76
  className = _ref2.className,
65
77
  scope = _ref2.scope,
66
- _ref2$mobileOptions = _ref2.mobileOptions,
67
- mobileOptions = _ref2$mobileOptions === void 0 ? {
68
- show: true
69
- } : _ref2$mobileOptions,
78
+ mobileOptions = _ref2.mobileOptions,
70
79
  width = _ref2.width,
71
80
  style = _ref2.style,
72
81
  readOnly = _ref2.readOnly,
73
82
  description = _ref2.description,
74
83
  rest = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
75
- var classes = (0, _classnames.default)('euiTableHeaderCell', className, {
76
- 'euiTableHeaderCell--hideForDesktop': mobileOptions.only,
77
- 'euiTableHeaderCell--hideForMobile': !mobileOptions.show
78
- });
79
- var contentClasses = (0, _classnames.default)('euiTableCellContent', className, {
80
- 'euiTableCellContent--alignRight': align === _services.RIGHT_ALIGNMENT,
81
- 'euiTableCellContent--alignCenter': align === _services.CENTER_ALIGNMENT
82
- });
83
- var styleObj = (0, _utils.resolveWidthAsStyle)(style, width);
84
+ var styles = (0, _services.useEuiMemoizedStyles)(_table_cells_shared.euiTableHeaderFooterCellStyles);
85
+ var isResponsive = (0, _responsive_context.useEuiTableIsResponsive)();
86
+ var hideForDesktop = !isResponsive && (mobileOptions === null || mobileOptions === void 0 ? void 0 : mobileOptions.only);
87
+ var hideForMobile = isResponsive && (mobileOptions === null || mobileOptions === void 0 ? void 0 : mobileOptions.show) === false;
88
+ if (hideForDesktop || hideForMobile) return null;
89
+ var classes = (0, _classnames.default)('euiTableHeaderCell', className);
90
+ var inlineStyles = (0, _utils.resolveWidthAsStyle)(style, width);
84
91
  var CellComponent = children ? 'th' : 'td';
85
92
  var cellScope = CellComponent === 'th' ? scope !== null && scope !== void 0 ? scope : 'col' : undefined; // `scope` is only valid on `th` elements
86
93
 
87
- if (onSort || isSorted) {
88
- var buttonClasses = (0, _classnames.default)('euiTableHeaderButton', {
89
- 'euiTableHeaderButton-isSorted': isSorted
90
- });
91
- var ariaSortValue = 'none';
92
- if (isSorted) {
93
- ariaSortValue = isSortAscending ? 'ascending' : 'descending';
94
- }
95
- var cellContents = (0, _react2.jsx)(CellContents, {
96
- className: contentClasses,
97
- description: description,
98
- showSortMsg: true,
99
- children: children,
100
- isSorted: isSorted,
101
- isSortAscending: isSortAscending
102
- });
103
- return (0, _react2.jsx)(CellComponent, (0, _extends2.default)({
104
- className: classes,
105
- scope: cellScope,
106
- role: "columnheader",
107
- "aria-sort": ariaSortValue,
108
- "aria-live": "polite",
109
- style: styleObj
110
- }, rest), onSort && !readOnly ? (0, _react2.jsx)("button", {
111
- type: "button",
112
- className: buttonClasses,
113
- onClick: onSort,
114
- "data-test-subj": "tableHeaderSortButton"
115
- }, cellContents) : cellContents);
94
+ var canSort = !!(onSort && !readOnly);
95
+ var ariaSortValue;
96
+ if (isSorted) {
97
+ ariaSortValue = isSortAscending ? 'ascending' : 'descending';
98
+ } else if (canSort) {
99
+ ariaSortValue = 'none';
116
100
  }
101
+ var cellContentsProps = {
102
+ css: styles.euiTableHeaderCell__content,
103
+ align: align,
104
+ description: description,
105
+ canSort: canSort,
106
+ isSorted: isSorted,
107
+ isSortAscending: isSortAscending,
108
+ children: children
109
+ };
117
110
  return (0, _react2.jsx)(CellComponent, (0, _extends2.default)({
111
+ css: styles.euiTableHeaderCell,
118
112
  className: classes,
119
113
  scope: cellScope,
120
114
  role: "columnheader",
121
- style: styleObj
122
- }, rest), (0, _react2.jsx)(CellContents, {
123
- className: contentClasses,
124
- description: description,
125
- showSortMsg: false,
126
- children: children,
127
- isSorted: isSorted,
128
- isSortAscending: isSortAscending
129
- }));
115
+ "aria-sort": ariaSortValue,
116
+ style: inlineStyles
117
+ }, rest), canSort ? (0, _react2.jsx)("button", {
118
+ type: "button",
119
+ css: styles.euiTableHeaderCell__button,
120
+ className: (0, _classnames.default)('euiTableHeaderButton', {
121
+ 'euiTableHeaderButton-isSorted': isSorted
122
+ }),
123
+ onClick: onSort,
124
+ "data-test-subj": "tableHeaderSortButton"
125
+ }, (0, _react2.jsx)(CellContents, cellContentsProps)) : (0, _react2.jsx)(CellContents, cellContentsProps));
130
126
  };
131
127
  exports.EuiTableHeaderCell = EuiTableHeaderCell;
@@ -9,7 +9,9 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
9
9
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
10
  var _react = _interopRequireDefault(require("react"));
11
11
  var _classnames = _interopRequireDefault(require("classnames"));
12
+ var _services = require("../../services");
12
13
  var _utils = require("./utils");
14
+ var _table_cells_shared = require("./table_cells_shared.styles");
13
15
  var _react2 = require("@emotion/react");
14
16
  var _excluded = ["children", "className", "scope", "style", "width"];
15
17
  /*
@@ -28,11 +30,13 @@ var EuiTableHeaderCellCheckbox = function EuiTableHeaderCellCheckbox(_ref) {
28
30
  width = _ref.width,
29
31
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
30
32
  var classes = (0, _classnames.default)('euiTableHeaderCellCheckbox', className);
31
- var styleObj = (0, _utils.resolveWidthAsStyle)(style, width);
33
+ var styles = (0, _services.useEuiMemoizedStyles)(_table_cells_shared.euiTableCellCheckboxStyles);
34
+ var inlineStyles = (0, _utils.resolveWidthAsStyle)(style, width);
32
35
  return (0, _react2.jsx)("th", (0, _extends2.default)({
36
+ css: styles.euiTableHeaderCellCheckbox,
33
37
  className: classes,
34
38
  scope: scope,
35
- style: styleObj
39
+ style: inlineStyles
36
40
  }, rest), (0, _react2.jsx)("div", {
37
41
  className: "euiTableCellContent"
38
42
  }, children));
@@ -10,8 +10,10 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
10
10
  var _react = _interopRequireDefault(require("react"));
11
11
  var _classnames = _interopRequireDefault(require("classnames"));
12
12
  var _services = require("../../services");
13
+ var _responsive_context = require("./mobile/responsive_context");
14
+ var _table_row = require("./table_row.styles");
13
15
  var _react2 = require("@emotion/react");
14
- var _excluded = ["children", "className", "isSelected", "isSelectable", "hasActions", "isExpandedRow", "isExpandable", "onClick"];
16
+ var _excluded = ["children", "className", "hasSelection", "isSelected", "isSelectable", "hasActions", "isExpandedRow", "isExpandable", "onClick"];
15
17
  /*
16
18
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
17
19
  * or more contributor license agreements. Licensed under the Elastic License
@@ -22,6 +24,7 @@ var _excluded = ["children", "className", "isSelected", "isSelectable", "hasActi
22
24
  var EuiTableRow = function EuiTableRow(_ref) {
23
25
  var children = _ref.children,
24
26
  className = _ref.className,
27
+ hasSelection = _ref.hasSelection,
25
28
  isSelected = _ref.isSelected,
26
29
  isSelectable = _ref.isSelectable,
27
30
  hasActions = _ref.hasActions,
@@ -29,6 +32,9 @@ var EuiTableRow = function EuiTableRow(_ref) {
29
32
  isExpandable = _ref.isExpandable,
30
33
  onClick = _ref.onClick,
31
34
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
35
+ var isResponsive = (0, _responsive_context.useEuiTableIsResponsive)();
36
+ var styles = (0, _services.useEuiMemoizedStyles)(_table_row.euiTableRowStyles);
37
+ var cssStyles = isResponsive ? [styles.euiTableRow, styles.mobile.mobile, isSelected && styles.mobile.selected, isExpandedRow && styles.mobile.expanded, (hasActions === true || isExpandable || isExpandedRow) && styles.mobile.hasRightColumn, hasSelection && styles.mobile.hasLeftColumn] : [styles.euiTableRow, styles.desktop.desktop, isSelected && styles.desktop.selected, isExpandedRow && styles.desktop.expanded, onClick && styles.desktop.clickable, isExpandedRow && hasSelection && styles.desktop.checkboxOffset];
32
38
  var classes = (0, _classnames.default)('euiTableRow', className, {
33
39
  'euiTableRow-isSelectable': isSelectable,
34
40
  'euiTableRow-isSelected': isSelected,
@@ -39,6 +45,7 @@ var EuiTableRow = function EuiTableRow(_ref) {
39
45
  });
40
46
  if (!onClick) {
41
47
  return (0, _react2.jsx)("tr", (0, _extends2.default)({
48
+ css: cssStyles,
42
49
  className: classes
43
50
  }, rest), children);
44
51
  }
@@ -53,6 +60,7 @@ var EuiTableRow = function EuiTableRow(_ref) {
53
60
  }
54
61
  };
55
62
  return (0, _react2.jsx)("tr", (0, _extends2.default)({
63
+ css: cssStyles,
56
64
  className: classes,
57
65
  onClick: onClick,
58
66
  onKeyDown: onKeyDown,
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.euiTableRowStyles = void 0;
8
+ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
9
+ var _react = require("@emotion/react");
10
+ var _services = require("../../services");
11
+ var _global_styling = require("../../global_styling");
12
+ var _mixins = require("../../themes/amsterdam/global_styling/mixins");
13
+ var _table = require("./table.styles");
14
+ var _templateObject;
15
+ /*
16
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
17
+ * or more contributor license agreements. Licensed under the Elastic License
18
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
19
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
20
+ * Side Public License, v 1.
21
+ */
22
+ var euiTableRowStyles = function euiTableRowStyles(euiThemeContext) {
23
+ var euiTheme = euiThemeContext.euiTheme;
24
+ var rowColors = _rowColorVariables(euiThemeContext);
25
+ var expandedAnimationCss = _expandedRowAnimation(euiThemeContext);
26
+ var _euiTableVariables = (0, _table.euiTableVariables)(euiThemeContext),
27
+ cellContentPadding = _euiTableVariables.cellContentPadding,
28
+ mobileSizes = _euiTableVariables.mobileSizes,
29
+ checkboxSize = _euiTableVariables.checkboxSize;
30
+ return {
31
+ euiTableRow: /*#__PURE__*/(0, _react.css)(";label:euiTableRow;"),
32
+ desktop: {
33
+ desktop: /*#__PURE__*/(0, _react.css)("&:hover{background-color:", rowColors.hover, ";};label:desktop;"),
34
+ expanded: /*#__PURE__*/(0, _react.css)("background-color:", rowColors.hover, ";", expandedAnimationCss, ";;label:expanded;"),
35
+ clickable: /*#__PURE__*/(0, _react.css)("&:hover{background-color:", rowColors.clickable.hover, ";cursor:pointer;}&:focus{background-color:", rowColors.clickable.focus, ";};label:clickable;"),
36
+ selected: /*#__PURE__*/(0, _react.css)("&,&+.euiTableRow-isExpandedRow{background-color:", rowColors.selected.color, ";}&:hover,&:hover+.euiTableRow-isExpandedRow{background-color:", rowColors.selected.hover, ";};label:selected;"),
37
+ // Offset expanded & selectable rows by the checkbox width to line up content with the 2nd column
38
+ // Set on the `<td>` because padding can't be applied to `<tr>` elements directly
39
+ checkboxOffset: /*#__PURE__*/(0, _react.css)(".euiTableRowCell:first-child{", (0, _global_styling.logicalCSS)('padding-left', checkboxSize), ";};label:checkboxOffset;")
40
+ },
41
+ mobile: {
42
+ mobile: /*#__PURE__*/(0, _react.css)("position:relative;display:flex;flex-wrap:wrap;padding:", cellContentPadding, ";", (0, _global_styling.logicalCSS)('margin-bottom', cellContentPadding), (0, _mixins.euiShadow)(euiThemeContext, 's'), " background-color:", (0, _global_styling.euiBackgroundColor)(euiThemeContext, 'plain'), ";border-radius:", euiTheme.border.radius.medium, ";;label:mobile;"),
43
+ selected: /*#__PURE__*/(0, _react.css)("&,&+.euiTableRow-isExpandedRow{background-color:", rowColors.selected.color, ";};label:selected;"),
44
+ /**
45
+ * Left column offset (no border)
46
+ * Used for selection checkbox, which will be absolutely positioned
47
+ */
48
+ hasLeftColumn: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('padding-left', mobileSizes.checkbox.width), ";;label:hasLeftColumn;"),
49
+ /**
50
+ * Right column styles + border
51
+ * Used for cell actions and row expander arrow
52
+ */
53
+ hasRightColumn: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('padding-right', mobileSizes.actions.width), " &::after{content:'';position:absolute;", (0, _global_styling.logicalCSS)('vertical', 0), " ", (0, _global_styling.logicalCSS)('right', mobileSizes.actions.width), " ", (0, _global_styling.logicalCSS)('width', euiTheme.border.width.thin), " background-color:", euiTheme.border.color, ";};label:hasRightColumn;"),
54
+ /**
55
+ * Bottom of card - expanded rows
56
+ */
57
+ expanded: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('margin-top', "-".concat(mobileSizes.actions.offset)), (0, _global_styling.logicalCSS)('padding-left', cellContentPadding), " ", (0, _global_styling.logicalCSS)('border-top', euiTheme.border.thin), " ", (0, _global_styling.logicalCSS)('border-top-left-radius', 0), " ", (0, _global_styling.logicalCSS)('border-top-right-radius', 0), " .euiTableRowCell{", (0, _global_styling.logicalCSS)('width', '100%'), ";}", expandedAnimationCss, ";;label:expanded;")
58
+ }
59
+ };
60
+ };
61
+ exports.euiTableRowStyles = euiTableRowStyles;
62
+ var _expandedRowAnimation = function _expandedRowAnimation(_ref) {
63
+ var euiTheme = _ref.euiTheme;
64
+ // Do not attempt to animate to height auto - down that road dragons lie
65
+ // @see https://github.com/elastic/eui/pull/6826
66
+ var expandRow = (0, _react.keyframes)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n 0% {\n opacity: 0;\n transform: translateY(-", ");\n }\n 100% {\n opacity: 1;\n transform: translateY(0);\n }\n "])), euiTheme.size.m);
67
+
68
+ // Animation must be on the contents div inside, not the row itself
69
+ return /*#__PURE__*/(0, _react.css)(_global_styling.euiCanAnimate, "{.euiTableCellContent{animation:", euiTheme.animation.fast, " ", euiTheme.animation.resistance, " 1 normal none ", expandRow, ";}}");
70
+ };
71
+ var _rowColorVariables = function _rowColorVariables(_ref2) {
72
+ var euiTheme = _ref2.euiTheme,
73
+ colorMode = _ref2.colorMode;
74
+ return {
75
+ hover: colorMode === 'DARK' ? euiTheme.colors.lightestShade : (0, _services.tint)(euiTheme.colors.lightestShade, 0.5),
76
+ selected: {
77
+ color: colorMode === 'DARK' ? (0, _services.shade)(euiTheme.colors.primary, 0.7) : (0, _services.tint)(euiTheme.colors.primary, 0.96),
78
+ hover: colorMode === 'DARK' ? (0, _services.shade)(euiTheme.colors.primary, 0.75) : (0, _services.tint)(euiTheme.colors.primary, 0.9)
79
+ },
80
+ clickable: {
81
+ hover: (0, _services.transparentize)(euiTheme.colors.primary, 0.05),
82
+ focus: (0, _services.transparentize)(euiTheme.colors.primary, 0.1)
83
+ }
84
+ };
85
+ };
@@ -1,22 +1,23 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.EuiTableRowCell = void 0;
9
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
11
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
12
- var _react = _interopRequireWildcard(require("react"));
12
+ var _react = _interopRequireDefault(require("react"));
13
13
  var _classnames = _interopRequireDefault(require("classnames"));
14
14
  var _services = require("../../services");
15
- var _predicate = require("../../services/predicate");
16
- var _text_truncate = require("../text_truncate");
15
+ var _responsive_context = require("./mobile/responsive_context");
17
16
  var _utils = require("./utils");
17
+ var _table_cell_content = require("./_table_cell_content");
18
+ var _table_row_cell = require("./table_row_cell.styles");
18
19
  var _react2 = require("@emotion/react");
19
- var _excluded = ["align", "children", "className", "truncateText", "setScopeRow", "showOnHover", "textOnly", "hasActions", "isExpander", "style", "width", "valign", "mobileOptions"];
20
+ var _excluded = ["align", "children", "className", "truncateText", "setScopeRow", "textOnly", "hasActions", "isExpander", "style", "width", "valign", "mobileOptions"];
20
21
  /*
21
22
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
22
23
  * or more contributor license agreements. Licensed under the Elastic License
@@ -24,19 +25,15 @@ var _excluded = ["align", "children", "className", "truncateText", "setScopeRow"
24
25
  * in compliance with, at your election, the Elastic License 2.0 or the Server
25
26
  * Side Public License, v 1.
26
27
  */
27
- 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); }
28
- 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; }
29
28
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
30
29
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
31
30
  var EuiTableRowCell = function EuiTableRowCell(_ref) {
32
- var _mobileOptions$showOn, _mobileOptions$trunca;
33
31
  var _ref$align = _ref.align,
34
32
  align = _ref$align === void 0 ? _services.LEFT_ALIGNMENT : _ref$align,
35
33
  children = _ref.children,
36
34
  className = _ref.className,
37
35
  truncateText = _ref.truncateText,
38
36
  setScopeRow = _ref.setScopeRow,
39
- showOnHover = _ref.showOnHover,
40
37
  _ref$textOnly = _ref.textOnly,
41
38
  textOnly = _ref$textOnly === void 0 ? true : _ref$textOnly,
42
39
  hasActions = _ref.hasActions,
@@ -45,88 +42,57 @@ var EuiTableRowCell = function EuiTableRowCell(_ref) {
45
42
  width = _ref.width,
46
43
  _ref$valign = _ref.valign,
47
44
  valign = _ref$valign === void 0 ? 'middle' : _ref$valign,
48
- _ref$mobileOptions = _ref.mobileOptions,
49
- mobileOptions = _ref$mobileOptions === void 0 ? {
50
- show: true
51
- } : _ref$mobileOptions,
45
+ mobileOptions = _ref.mobileOptions,
52
46
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
53
- var cellClasses = (0, _classnames.default)('euiTableRowCell', (0, _defineProperty2.default)({
47
+ var isResponsive = (0, _responsive_context.useEuiTableIsResponsive)();
48
+ var styles = (0, _services.useEuiMemoizedStyles)(_table_row_cell.euiTableRowCellStyles);
49
+ var cssStyles = [styles.euiTableRowCell, setScopeRow && styles.rowHeader, isExpander && styles.isExpander, hasActions && styles.hasActions, styles[valign]].concat((0, _toConsumableArray2.default)(isResponsive ? [styles.mobile.mobile, (mobileOptions === null || mobileOptions === void 0 ? void 0 : mobileOptions.enlarge) && styles.mobile.enlarge, hasActions === 'custom' && styles.mobile.customActions, hasActions === true && styles.mobile.actions, isExpander && styles.mobile.expander] : [styles.desktop.desktop, hasActions && styles.desktop.actions]));
50
+ var cellClasses = (0, _classnames.default)('euiTableRowCell', className, {
54
51
  'euiTableRowCell--hasActions': hasActions,
55
- 'euiTableRowCell--isExpander': isExpander,
56
- 'euiTableRowCell--hideForDesktop': mobileOptions.only,
57
- 'euiTableRowCell--enlargeForMobile': mobileOptions.enlarge
58
- }, "euiTableRowCell--".concat(valign), valign));
59
- var contentClasses = (0, _classnames.default)('euiTableCellContent', className, {
60
- 'euiTableCellContent--alignRight': align === _services.RIGHT_ALIGNMENT,
61
- 'euiTableCellContent--alignCenter': align === _services.CENTER_ALIGNMENT,
62
- 'euiTableCellContent--showOnHover': showOnHover,
63
- 'euiTableCellContent--truncateText': truncateText === true,
64
- // We're doing this rigamarole instead of creating `euiTableCellContent--textOnly` for BWC
65
- // purposes for the time-being.
66
- 'euiTableCellContent--overflowingContent': textOnly !== true
52
+ 'euiTableRowCell--isExpander': isExpander
67
53
  });
68
- var mobileContentClasses = (0, _classnames.default)('euiTableCellContent', className, {
69
- 'euiTableCellContent--alignRight': mobileOptions.align === _services.RIGHT_ALIGNMENT || align === _services.RIGHT_ALIGNMENT,
70
- 'euiTableCellContent--alignCenter': mobileOptions.align === _services.CENTER_ALIGNMENT || align === _services.CENTER_ALIGNMENT,
71
- 'euiTableCellContent--showOnHover': (_mobileOptions$showOn = mobileOptions.showOnHover) !== null && _mobileOptions$showOn !== void 0 ? _mobileOptions$showOn : showOnHover,
72
- 'euiTableCellContent--truncateText': (_mobileOptions$trunca = mobileOptions.truncateText) !== null && _mobileOptions$trunca !== void 0 ? _mobileOptions$trunca : truncateText,
73
- // We're doing this rigamarole instead of creating `euiTableCellContent--textOnly` for BWC
74
- // purposes for the time-being.
75
- 'euiTableCellContent--overflowingContent': mobileOptions.textOnly !== true || textOnly !== true
76
- });
77
- var childClasses = (0, _classnames.default)({
78
- euiTableCellContent__text: textOnly === true,
79
- euiTableCellContent__hoverItem: showOnHover
80
- });
81
- var widthValue = (0, _services.useIsWithinBreakpoints)(['xs', 's']) && mobileOptions.width ? mobileOptions.width : width;
54
+ var widthValue = isResponsive ? hasActions || isExpander ? undefined // On mobile, actions are shifted to a right column via CSS
55
+ : mobileOptions === null || mobileOptions === void 0 ? void 0 : mobileOptions.width : width;
82
56
  var styleObj = (0, _utils.resolveWidthAsStyle)(style, widthValue);
83
- var modifyChildren = (0, _react.useCallback)(function (children) {
84
- var modifiedChildren = children;
85
- if (textOnly === true) {
86
- modifiedChildren = (0, _react2.jsx)("span", {
87
- className: childClasses
88
- }, children);
89
- } else if ( /*#__PURE__*/_react.default.isValidElement(children)) {
90
- modifiedChildren = _react.default.Children.map(children, function (child) {
91
- return /*#__PURE__*/_react.default.cloneElement(child, {
92
- className: (0, _classnames.default)(child.props.className, childClasses)
93
- });
94
- });
95
- }
96
- if ((0, _predicate.isObject)(truncateText) && truncateText.lines) {
97
- modifiedChildren = (0, _react2.jsx)(_text_truncate.EuiTextBlockTruncate, {
98
- lines: truncateText.lines,
99
- cloneElement: true
100
- }, modifiedChildren);
101
- }
102
- return modifiedChildren;
103
- }, [childClasses, textOnly, truncateText]);
104
- var childrenNode = modifyChildren(children);
105
- var hideForMobileClasses = 'euiTableRowCell--hideForMobile';
106
- var showForMobileClasses = 'euiTableRowCell--hideForDesktop';
107
57
  var Element = setScopeRow ? 'th' : 'td';
108
58
  var sharedProps = _objectSpread({
109
59
  scope: setScopeRow ? 'row' : undefined,
110
- style: styleObj
60
+ style: styleObj,
61
+ css: cssStyles
111
62
  }, rest);
112
- if (mobileOptions.show === false) {
113
- return (0, _react2.jsx)(Element, (0, _extends2.default)({
114
- className: "".concat(cellClasses, " ").concat(hideForMobileClasses)
115
- }, sharedProps), (0, _react2.jsx)("div", {
116
- className: contentClasses
117
- }, childrenNode));
63
+ var sharedContentProps = {
64
+ align: align,
65
+ textOnly: textOnly,
66
+ truncateText: truncateText,
67
+ hasActions: hasActions || isExpander
68
+ };
69
+ if (isResponsive) {
70
+ // Mobile view
71
+ if ((mobileOptions === null || mobileOptions === void 0 ? void 0 : mobileOptions.show) === false) {
72
+ return null;
73
+ } else {
74
+ var _mobileOptions$align, _mobileOptions$trunca, _mobileOptions$textOn;
75
+ return (0, _react2.jsx)(Element, (0, _extends2.default)({
76
+ className: cellClasses
77
+ }, sharedProps), (mobileOptions === null || mobileOptions === void 0 ? void 0 : mobileOptions.header) && (0, _react2.jsx)("div", {
78
+ className: "euiTableRowCell__mobileHeader",
79
+ css: styles.euiTableRowCell__mobileHeader
80
+ }, mobileOptions.header), (0, _react2.jsx)(_table_cell_content.EuiTableCellContent, (0, _extends2.default)({}, sharedContentProps, {
81
+ align: (_mobileOptions$align = mobileOptions === null || mobileOptions === void 0 ? void 0 : mobileOptions.align) !== null && _mobileOptions$align !== void 0 ? _mobileOptions$align : 'left' // Default to left aligned mobile cells, unless consumers specifically set an alignment for mobile
82
+ ,
83
+ truncateText: (_mobileOptions$trunca = mobileOptions === null || mobileOptions === void 0 ? void 0 : mobileOptions.truncateText) !== null && _mobileOptions$trunca !== void 0 ? _mobileOptions$trunca : truncateText,
84
+ textOnly: (_mobileOptions$textOn = mobileOptions === null || mobileOptions === void 0 ? void 0 : mobileOptions.textOnly) !== null && _mobileOptions$textOn !== void 0 ? _mobileOptions$textOn : textOnly
85
+ }), (mobileOptions === null || mobileOptions === void 0 ? void 0 : mobileOptions.render) || children));
86
+ }
118
87
  } else {
119
- return (0, _react2.jsx)(Element, (0, _extends2.default)({
120
- className: cellClasses
121
- }, sharedProps), mobileOptions.header && (0, _react2.jsx)("div", {
122
- className: "euiTableRowCell__mobileHeader ".concat(showForMobileClasses)
123
- }, mobileOptions.header), mobileOptions.render ? (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)("div", {
124
- className: "".concat(mobileContentClasses, " ").concat(showForMobileClasses)
125
- }, modifyChildren(mobileOptions.render)), (0, _react2.jsx)("div", {
126
- className: "".concat(contentClasses, " ").concat(hideForMobileClasses)
127
- }, childrenNode)) : (0, _react2.jsx)("div", {
128
- className: contentClasses
129
- }, childrenNode));
88
+ // Desktop view
89
+ if (mobileOptions !== null && mobileOptions !== void 0 && mobileOptions.only) {
90
+ return null;
91
+ } else {
92
+ return (0, _react2.jsx)(Element, (0, _extends2.default)({
93
+ className: cellClasses
94
+ }, sharedProps), (0, _react2.jsx)(_table_cell_content.EuiTableCellContent, sharedContentProps, children));
95
+ }
130
96
  }
131
97
  };
132
98
  exports.EuiTableRowCell = EuiTableRowCell;