@elastic/eui 93.6.0 → 94.0.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 (133) 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 +117 -131
  6. package/es/components/basic_table/basic_table.styles.js +3 -17
  7. package/es/components/basic_table/expanded_item_actions.js +1 -2
  8. package/es/components/basic_table/in_memory_table.js +57 -76
  9. package/es/components/provider/component_defaults/component_defaults.js +7 -1
  10. package/es/components/table/_table_cell_content.js +72 -0
  11. package/es/components/table/_table_cell_content.styles.js +63 -0
  12. package/es/components/table/index.js +0 -1
  13. package/es/components/table/mobile/responsive_context.js +37 -0
  14. package/es/components/table/mobile/table_header_mobile.js +11 -4
  15. package/es/components/table/mobile/table_header_mobile.styles.js +15 -0
  16. package/es/components/table/mobile/table_sort_mobile.js +12 -3
  17. package/es/components/table/table.js +23 -13
  18. package/es/components/table/table.styles.js +102 -0
  19. package/es/components/table/table_cells_shared.styles.js +47 -0
  20. package/es/components/table/table_footer_cell.js +12 -12
  21. package/es/components/table/table_header_cell.js +36 -51
  22. package/es/components/table/table_header_cell_checkbox.js +6 -2
  23. package/es/components/table/table_row.js +18 -6
  24. package/es/components/table/table_row.styles.js +78 -0
  25. package/es/components/table/table_row_cell.js +65 -91
  26. package/es/components/table/table_row_cell.styles.js +89 -0
  27. package/es/components/table/table_row_cell_checkbox.js +7 -0
  28. package/eui.d.ts +662 -507
  29. package/i18ntokens.json +40 -40
  30. package/lib/components/basic_table/basic_table.js +116 -130
  31. package/lib/components/basic_table/basic_table.styles.js +5 -20
  32. package/lib/components/basic_table/expanded_item_actions.js +1 -2
  33. package/lib/components/basic_table/in_memory_table.js +57 -76
  34. package/lib/components/provider/component_defaults/component_defaults.js +7 -1
  35. package/lib/components/table/_table_cell_content.js +82 -0
  36. package/lib/components/table/_table_cell_content.styles.js +68 -0
  37. package/lib/components/table/index.js +0 -7
  38. package/lib/components/table/mobile/responsive_context.js +47 -0
  39. package/lib/components/table/mobile/table_header_mobile.js +11 -4
  40. package/lib/components/table/mobile/table_header_mobile.styles.js +22 -0
  41. package/lib/components/table/mobile/table_sort_mobile.js +12 -3
  42. package/lib/components/table/table.js +23 -13
  43. package/lib/components/table/table.styles.js +109 -0
  44. package/lib/components/table/table_cells_shared.styles.js +53 -0
  45. package/lib/components/table/table_footer_cell.js +11 -11
  46. package/lib/components/table/table_header_cell.js +36 -51
  47. package/lib/components/table/table_header_cell_checkbox.js +6 -2
  48. package/lib/components/table/table_row.js +17 -5
  49. package/lib/components/table/table_row.styles.js +84 -0
  50. package/lib/components/table/table_row_cell.js +64 -92
  51. package/lib/components/table/table_row_cell.styles.js +94 -0
  52. package/lib/components/table/table_row_cell_checkbox.js +7 -0
  53. package/optimize/es/components/basic_table/basic_table.js +56 -59
  54. package/optimize/es/components/basic_table/basic_table.styles.js +3 -17
  55. package/optimize/es/components/basic_table/expanded_item_actions.js +1 -2
  56. package/optimize/es/components/basic_table/in_memory_table.js +1 -6
  57. package/optimize/es/components/table/_table_cell_content.js +56 -0
  58. package/optimize/es/components/table/_table_cell_content.styles.js +63 -0
  59. package/optimize/es/components/table/index.js +0 -1
  60. package/optimize/es/components/table/mobile/responsive_context.js +37 -0
  61. package/optimize/es/components/table/mobile/table_header_mobile.js +11 -4
  62. package/optimize/es/components/table/mobile/table_header_mobile.styles.js +15 -0
  63. package/optimize/es/components/table/mobile/table_sort_mobile.js +7 -1
  64. package/optimize/es/components/table/table.js +13 -12
  65. package/optimize/es/components/table/table.styles.js +102 -0
  66. package/optimize/es/components/table/table_cells_shared.styles.js +44 -0
  67. package/optimize/es/components/table/table_footer_cell.js +12 -12
  68. package/optimize/es/components/table/table_header_cell.js +35 -37
  69. package/optimize/es/components/table/table_header_cell_checkbox.js +6 -2
  70. package/optimize/es/components/table/table_row.js +10 -2
  71. package/optimize/es/components/table/table_row.styles.js +78 -0
  72. package/optimize/es/components/table/table_row_cell.js +49 -80
  73. package/optimize/es/components/table/table_row_cell.styles.js +89 -0
  74. package/optimize/es/components/table/table_row_cell_checkbox.js +7 -0
  75. package/optimize/lib/components/basic_table/basic_table.js +55 -58
  76. package/optimize/lib/components/basic_table/basic_table.styles.js +5 -20
  77. package/optimize/lib/components/basic_table/expanded_item_actions.js +1 -2
  78. package/optimize/lib/components/basic_table/in_memory_table.js +1 -6
  79. package/optimize/lib/components/table/_table_cell_content.js +66 -0
  80. package/optimize/lib/components/table/_table_cell_content.styles.js +68 -0
  81. package/optimize/lib/components/table/index.js +0 -7
  82. package/optimize/lib/components/table/mobile/responsive_context.js +47 -0
  83. package/optimize/lib/components/table/mobile/table_header_mobile.js +11 -4
  84. package/optimize/lib/components/table/mobile/table_header_mobile.styles.js +22 -0
  85. package/optimize/lib/components/table/mobile/table_sort_mobile.js +7 -1
  86. package/optimize/lib/components/table/table.js +13 -12
  87. package/optimize/lib/components/table/table.styles.js +109 -0
  88. package/optimize/lib/components/table/table_cells_shared.styles.js +51 -0
  89. package/optimize/lib/components/table/table_footer_cell.js +11 -11
  90. package/optimize/lib/components/table/table_header_cell.js +35 -37
  91. package/optimize/lib/components/table/table_header_cell_checkbox.js +6 -2
  92. package/optimize/lib/components/table/table_row.js +9 -1
  93. package/optimize/lib/components/table/table_row.styles.js +85 -0
  94. package/optimize/lib/components/table/table_row_cell.js +48 -82
  95. package/optimize/lib/components/table/table_row_cell.styles.js +94 -0
  96. package/optimize/lib/components/table/table_row_cell_checkbox.js +7 -0
  97. package/package.json +1 -1
  98. package/src/components/index.scss +0 -1
  99. package/test-env/components/basic_table/basic_table.js +112 -129
  100. package/test-env/components/basic_table/basic_table.styles.js +5 -20
  101. package/test-env/components/basic_table/expanded_item_actions.js +1 -2
  102. package/test-env/components/basic_table/in_memory_table.js +57 -76
  103. package/test-env/components/provider/component_defaults/component_defaults.js +7 -1
  104. package/test-env/components/table/_table_cell_content.js +76 -0
  105. package/test-env/components/table/_table_cell_content.styles.js +68 -0
  106. package/test-env/components/table/index.js +0 -7
  107. package/test-env/components/table/mobile/responsive_context.js +47 -0
  108. package/test-env/components/table/mobile/table_header_mobile.js +11 -4
  109. package/test-env/components/table/mobile/table_header_mobile.styles.js +22 -0
  110. package/test-env/components/table/mobile/table_sort_mobile.js +12 -3
  111. package/test-env/components/table/table.js +23 -13
  112. package/test-env/components/table/table.styles.js +109 -0
  113. package/test-env/components/table/table_cells_shared.styles.js +51 -0
  114. package/test-env/components/table/table_footer_cell.js +11 -11
  115. package/test-env/components/table/table_header_cell.js +36 -51
  116. package/test-env/components/table/table_header_cell_checkbox.js +6 -2
  117. package/test-env/components/table/table_row.js +17 -5
  118. package/test-env/components/table/table_row.styles.js +85 -0
  119. package/test-env/components/table/table_row_cell.js +59 -93
  120. package/test-env/components/table/table_row_cell.styles.js +94 -0
  121. package/test-env/components/table/table_row_cell_checkbox.js +7 -0
  122. package/es/components/table/table_header_button.js +0 -52
  123. package/lib/components/table/table_header_button.js +0 -59
  124. package/optimize/es/components/table/table_header_button.js +0 -43
  125. package/optimize/lib/components/table/table_header_button.js +0 -50
  126. package/src/components/table/_index.scss +0 -7
  127. package/src/components/table/_mixins.scss +0 -20
  128. package/src/components/table/_responsive.scss +0 -211
  129. package/src/components/table/_table.scss +0 -241
  130. package/src/components/table/_variables.scss +0 -17
  131. package/src/components/table/mobile/_index.scss +0 -1
  132. package/src/components/table/mobile/_mobile.scss +0 -17
  133. package/test-env/components/table/table_header_button.js +0 -58
@@ -0,0 +1,102 @@
1
+ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
2
+ /*
3
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
4
+ * or more contributor license agreements. Licensed under the Elastic License
5
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
6
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
7
+ * Side Public License, v 1.
8
+ */
9
+
10
+ import { css } from '@emotion/react';
11
+ import { euiFontSize, euiNumberFormat, logicalCSS, mathWithUnits } from '../../global_styling';
12
+ export var euiTableVariables = function euiTableVariables(_ref4) {
13
+ var euiTheme = _ref4.euiTheme;
14
+ var cellContentPadding = euiTheme.size.s;
15
+ var compressedCellContentPadding = euiTheme.size.xs;
16
+ var mobileSizes = {
17
+ actions: {
18
+ width: euiTheme.size.xxl,
19
+ offset: mathWithUnits(cellContentPadding, function (x) {
20
+ return x * 2;
21
+ })
22
+ },
23
+ checkbox: {
24
+ width: mathWithUnits([euiTheme.size.xl, euiTheme.size.xs], function (x, y) {
25
+ return x + y;
26
+ }),
27
+ offset: mathWithUnits(cellContentPadding, function (x) {
28
+ return x / 2;
29
+ })
30
+ }
31
+ };
32
+ var checkboxSize = euiTheme.size.xl;
33
+ return {
34
+ cellContentPadding: cellContentPadding,
35
+ compressedCellContentPadding: compressedCellContentPadding,
36
+ mobileSizes: mobileSizes,
37
+ checkboxSize: checkboxSize
38
+ };
39
+ };
40
+ var _ref = process.env.NODE_ENV === "production" ? {
41
+ name: "gt2v1c-mobile",
42
+ styles: "thead{display:none;}tfoot{display:none;};label:mobile;"
43
+ } : {
44
+ name: "gt2v1c-mobile",
45
+ styles: "thead{display:none;}tfoot{display:none;};label:mobile;",
46
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
47
+ };
48
+ var _ref2 = process.env.NODE_ENV === "production" ? {
49
+ name: "18uoljc-auto",
50
+ styles: "table-layout:auto;label:auto;"
51
+ } : {
52
+ name: "18uoljc-auto",
53
+ styles: "table-layout:auto;label:auto;",
54
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
55
+ };
56
+ var _ref3 = process.env.NODE_ENV === "production" ? {
57
+ name: "1fm6zfw-fixed",
58
+ styles: "table-layout:fixed;label:fixed;"
59
+ } : {
60
+ name: "1fm6zfw-fixed",
61
+ styles: "table-layout:fixed;label:fixed;",
62
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
63
+ };
64
+ export var euiTableStyles = function euiTableStyles(euiThemeContext) {
65
+ var euiTheme = euiThemeContext.euiTheme;
66
+ var _euiTableVariables = euiTableVariables(euiThemeContext),
67
+ cellContentPadding = _euiTableVariables.cellContentPadding,
68
+ compressedCellContentPadding = _euiTableVariables.compressedCellContentPadding;
69
+ return {
70
+ euiTable: /*#__PURE__*/css(euiNumberFormat(euiThemeContext), " ", logicalCSS('width', '100%'), " border:none;border-collapse:collapse;background-color:", euiTheme.colors.emptyShade, ";;label:euiTable;"),
71
+ layout: {
72
+ fixed: _ref3,
73
+ auto: _ref2
74
+ },
75
+ /**
76
+ * 1. The padding on the `.euiTableCellContent` div allows the ellipsis to show if the
77
+ * content is truncated. If the padding was on the cell, the ellipsis would be cropped.
78
+ * 2. The `:where()` selector sets the specificity to 0, allowing consumers to more easily
79
+ * override our CSS if needed
80
+ */
81
+ uncompressed: /*#__PURE__*/css("font-size:", euiFontSize(euiThemeContext, 's').fontSize, ";line-height:", euiFontSize(euiThemeContext, 'm').lineHeight, ";& :where(.euiTableCellContent){padding:", cellContentPadding, ";};label:uncompressed;"),
82
+ compressed: /*#__PURE__*/css(euiFontSize(euiThemeContext, 'xs'), "& :where(.euiTableCellContent){padding:", compressedCellContentPadding, ";};label:compressed;"),
83
+ /**
84
+ * Responsive/mobile vs desktop styles
85
+ * Individual row/cells handle their own desktop vs mobile styles
86
+ */
87
+ desktop: /*#__PURE__*/css(";label:desktop;"),
88
+ mobile: _ref
89
+ };
90
+ };
91
+
92
+ // The table caption needs to not be absolutely positioned, because for some reason
93
+ // it causes weird layout issues/double borders when used within a <table>
94
+ // Also needs to be !important to override euiScreenReaderOnly absolute positioning
95
+ export var euiTableCaptionStyles = process.env.NODE_ENV === "production" ? {
96
+ name: "1hnio98-euiTableCaptionStyles",
97
+ styles: "position:relative!important;label:euiTableCaptionStyles;"
98
+ } : {
99
+ name: "1hnio98-euiTableCaptionStyles",
100
+ styles: "position:relative!important;label:euiTableCaptionStyles;",
101
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
102
+ };
@@ -0,0 +1,47 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ 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; }
3
+ 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) { _defineProperty(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; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
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
+ import { css } from '@emotion/react';
16
+ import { euiFontSize, logicalCSS, logicalTextAlignCSS } from '../../global_styling';
17
+ import { euiTableVariables } from './table.styles';
18
+ export var euiTableHeaderFooterCellStyles = function euiTableHeaderFooterCellStyles(euiThemeContext) {
19
+ var euiTheme = euiThemeContext.euiTheme;
20
+
21
+ // euiFontSize returns an object, so we keep object notation here to merge into css``
22
+ var sharedStyles = _objectSpread(_objectSpread({}, euiFontSize(euiThemeContext, 'xs')), {}, {
23
+ fontWeight: euiTheme.font.weight.semiBold,
24
+ color: euiTheme.colors.title,
25
+ verticalAlign: 'middle'
26
+ });
27
+ return {
28
+ euiTableHeaderCell: /*#__PURE__*/css(sharedStyles, ";;label:euiTableHeaderCell;"),
29
+ euiTableHeaderCell__content: /*#__PURE__*/css("gap:", euiTheme.size.xs, ";;label:euiTableHeaderCell__content;"),
30
+ euiTableHeaderCell__button: /*#__PURE__*/css(logicalCSS('width', '100%'), " font-weight:inherit;&:hover,&:focus{color:", euiTheme.colors.primaryText, ";text-decoration:underline;};label:euiTableHeaderCell__button;"),
31
+ euiTableFooterCell: /*#__PURE__*/css(sharedStyles, " background-color:", euiTheme.colors.lightestShade, ";;label:euiTableFooterCell;")
32
+ };
33
+ };
34
+ export var euiTableCellCheckboxStyles = function euiTableCellCheckboxStyles(euiThemeContext) {
35
+ var euiTheme = euiThemeContext.euiTheme;
36
+ var _euiTableVariables = euiTableVariables(euiThemeContext),
37
+ cellContentPadding = _euiTableVariables.cellContentPadding,
38
+ mobileSizes = _euiTableVariables.mobileSizes,
39
+ checkboxSize = _euiTableVariables.checkboxSize;
40
+ var sharedCheckboxStyles = "\n ".concat(logicalCSS('width', checkboxSize), "\n vertical-align: middle;\n ");
41
+ return {
42
+ euiTableHeaderCellCheckbox: /*#__PURE__*/css(sharedCheckboxStyles, logicalTextAlignCSS('left'), ";;label:euiTableHeaderCellCheckbox;"),
43
+ euiTableRowCellCheckbox: /*#__PURE__*/css(sharedCheckboxStyles, ";;label:euiTableRowCellCheckbox;"),
44
+ desktop: /*#__PURE__*/css(logicalCSS('border-vertical', euiTheme.border.thin), ";;label:desktop;"),
45
+ mobile: /*#__PURE__*/css("position:absolute;", logicalCSS('top', cellContentPadding), " ", logicalCSS('left', mobileSizes.checkbox.offset), ";;label:mobile;")
46
+ };
47
+ };
@@ -13,8 +13,10 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
13
13
  import React from 'react';
14
14
  import PropTypes from "prop-types";
15
15
  import classNames from 'classnames';
16
- import { LEFT_ALIGNMENT, RIGHT_ALIGNMENT, CENTER_ALIGNMENT } from '../../services';
16
+ import { useEuiMemoizedStyles, LEFT_ALIGNMENT } from '../../services';
17
17
  import { resolveWidthAsStyle } from './utils';
18
+ import { EuiTableCellContent } from './_table_cell_content';
19
+ import { euiTableHeaderFooterCellStyles } from './table_cells_shared.styles';
18
20
  import { jsx as ___EmotionJSX } from "@emotion/react";
19
21
  export var EuiTableFooterCell = function EuiTableFooterCell(_ref) {
20
22
  var children = _ref.children,
@@ -25,19 +27,17 @@ export var EuiTableFooterCell = function EuiTableFooterCell(_ref) {
25
27
  style = _ref.style,
26
28
  rest = _objectWithoutProperties(_ref, _excluded);
27
29
  var classes = classNames('euiTableFooterCell', className);
28
- var contentClasses = classNames('euiTableCellContent', className, {
29
- 'euiTableCellContent--alignRight': align === RIGHT_ALIGNMENT,
30
- 'euiTableCellContent--alignCenter': align === CENTER_ALIGNMENT
31
- });
32
- var styleObj = resolveWidthAsStyle(style, width);
30
+ var inlineStyles = resolveWidthAsStyle(style, width);
31
+ var styles = useEuiMemoizedStyles(euiTableHeaderFooterCellStyles);
33
32
  return ___EmotionJSX("td", _extends({
33
+ css: styles.euiTableFooterCell,
34
34
  className: classes,
35
- style: styleObj
36
- }, rest), ___EmotionJSX("div", {
37
- className: contentClasses
38
- }, ___EmotionJSX("span", {
39
- className: "euiTableCellContent__text"
40
- }, children)));
35
+ style: inlineStyles
36
+ }, rest), ___EmotionJSX(EuiTableCellContent, {
37
+ align: align,
38
+ truncateText: true,
39
+ textOnly: true
40
+ }, children));
41
41
  };
42
42
  EuiTableFooterCell.propTypes = {
43
43
  className: PropTypes.string,
@@ -13,22 +13,29 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
13
13
  import React from 'react';
14
14
  import PropTypes from "prop-types";
15
15
  import classNames from 'classnames';
16
+ import { useEuiMemoizedStyles, LEFT_ALIGNMENT } from '../../services';
17
+ import { EuiI18n } from '../i18n';
16
18
  import { EuiScreenReaderOnly } from '../accessibility';
17
19
  import { EuiIcon } from '../icon';
18
- import { resolveWidthAsStyle } from './utils';
19
20
  import { EuiInnerText } from '../inner_text';
20
- import { LEFT_ALIGNMENT, RIGHT_ALIGNMENT, CENTER_ALIGNMENT } from '../../services';
21
- import { EuiI18n } from '../i18n';
21
+ import { resolveWidthAsStyle } from './utils';
22
+ import { useEuiTableIsResponsive } from './mobile/responsive_context';
23
+ import { EuiTableCellContent } from './_table_cell_content';
24
+ import { euiTableHeaderFooterCellStyles } from './table_cells_shared.styles';
22
25
  import { jsx as ___EmotionJSX } from "@emotion/react";
23
26
  var CellContents = function CellContents(_ref) {
24
27
  var className = _ref.className,
28
+ align = _ref.align,
25
29
  description = _ref.description,
26
30
  children = _ref.children,
27
31
  isSorted = _ref.isSorted,
28
32
  isSortAscending = _ref.isSortAscending,
29
33
  showSortMsg = _ref.showSortMsg;
30
- return ___EmotionJSX("span", {
31
- className: className
34
+ return ___EmotionJSX(EuiTableCellContent, {
35
+ className: className,
36
+ align: align,
37
+ textOnly: false,
38
+ truncateText: null
32
39
  }, ___EmotionJSX(EuiInnerText, null, function (ref, innerText) {
33
40
  return ___EmotionJSX(EuiI18n, {
34
41
  token: "euiTableHeaderCell.titleTextWithDesc",
@@ -41,7 +48,7 @@ var CellContents = function CellContents(_ref) {
41
48
  return ___EmotionJSX("span", {
42
49
  title: description ? titleTextWithDesc : innerText,
43
50
  ref: ref,
44
- className: "euiTableCellContent__text"
51
+ className: "eui-textTruncate"
45
52
  }, children);
46
53
  });
47
54
  }), description && ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("span", null, description)), showSortMsg && isSorted && ___EmotionJSX(EuiIcon, {
@@ -59,27 +66,30 @@ export var EuiTableHeaderCell = function EuiTableHeaderCell(_ref2) {
59
66
  isSortAscending = _ref2.isSortAscending,
60
67
  className = _ref2.className,
61
68
  scope = _ref2.scope,
62
- _ref2$mobileOptions = _ref2.mobileOptions,
63
- mobileOptions = _ref2$mobileOptions === void 0 ? {
64
- show: true
65
- } : _ref2$mobileOptions,
69
+ mobileOptions = _ref2.mobileOptions,
66
70
  width = _ref2.width,
67
71
  style = _ref2.style,
68
72
  readOnly = _ref2.readOnly,
69
73
  description = _ref2.description,
70
74
  rest = _objectWithoutProperties(_ref2, _excluded);
71
- var classes = classNames('euiTableHeaderCell', className, {
72
- 'euiTableHeaderCell--hideForDesktop': mobileOptions.only,
73
- 'euiTableHeaderCell--hideForMobile': !mobileOptions.show
74
- });
75
- var contentClasses = classNames('euiTableCellContent', className, {
76
- 'euiTableCellContent--alignRight': align === RIGHT_ALIGNMENT,
77
- 'euiTableCellContent--alignCenter': align === CENTER_ALIGNMENT
78
- });
79
- var styleObj = resolveWidthAsStyle(style, width);
75
+ var styles = useEuiMemoizedStyles(euiTableHeaderFooterCellStyles);
76
+ var isResponsive = useEuiTableIsResponsive();
77
+ var hideForDesktop = !isResponsive && (mobileOptions === null || mobileOptions === void 0 ? void 0 : mobileOptions.only);
78
+ var hideForMobile = isResponsive && (mobileOptions === null || mobileOptions === void 0 ? void 0 : mobileOptions.show) === false;
79
+ if (hideForDesktop || hideForMobile) return null;
80
+ var classes = classNames('euiTableHeaderCell', className);
81
+ var inlineStyles = resolveWidthAsStyle(style, width);
80
82
  var CellComponent = children ? 'th' : 'td';
81
83
  var cellScope = CellComponent === 'th' ? scope !== null && scope !== void 0 ? scope : 'col' : undefined; // `scope` is only valid on `th` elements
82
84
 
85
+ var cellContents = ___EmotionJSX(CellContents, {
86
+ css: styles.euiTableHeaderCell__content,
87
+ align: align,
88
+ description: description,
89
+ showSortMsg: true,
90
+ isSorted: isSorted,
91
+ isSortAscending: isSortAscending
92
+ }, children);
83
93
  if (onSort || isSorted) {
84
94
  var buttonClasses = classNames('euiTableHeaderButton', {
85
95
  'euiTableHeaderButton-isSorted': isSorted
@@ -88,41 +98,29 @@ export var EuiTableHeaderCell = function EuiTableHeaderCell(_ref2) {
88
98
  if (isSorted) {
89
99
  ariaSortValue = isSortAscending ? 'ascending' : 'descending';
90
100
  }
91
- var cellContents = ___EmotionJSX(CellContents, {
92
- className: contentClasses,
93
- description: description,
94
- showSortMsg: true,
95
- children: children,
96
- isSorted: isSorted,
97
- isSortAscending: isSortAscending
98
- });
99
101
  return ___EmotionJSX(CellComponent, _extends({
102
+ css: styles.euiTableHeaderCell,
100
103
  className: classes,
101
104
  scope: cellScope,
102
105
  role: "columnheader",
103
106
  "aria-sort": ariaSortValue,
104
107
  "aria-live": "polite",
105
- style: styleObj
108
+ style: inlineStyles
106
109
  }, rest), onSort && !readOnly ? ___EmotionJSX("button", {
107
110
  type: "button",
111
+ css: styles.euiTableHeaderCell__button,
108
112
  className: buttonClasses,
109
113
  onClick: onSort,
110
114
  "data-test-subj": "tableHeaderSortButton"
111
115
  }, cellContents) : cellContents);
112
116
  }
113
117
  return ___EmotionJSX(CellComponent, _extends({
118
+ css: styles.euiTableHeaderCell,
114
119
  className: classes,
115
120
  scope: cellScope,
116
121
  role: "columnheader",
117
- style: styleObj
118
- }, rest), ___EmotionJSX(CellContents, {
119
- className: contentClasses,
120
- description: description,
121
- showSortMsg: false,
122
- children: children,
123
- isSorted: isSorted,
124
- isSortAscending: isSortAscending
125
- }));
122
+ style: inlineStyles
123
+ }, rest), cellContents);
126
124
  };
127
125
  EuiTableHeaderCell.propTypes = {
128
126
  className: PropTypes.string,
@@ -132,20 +130,7 @@ EuiTableHeaderCell.propTypes = {
132
130
  align: PropTypes.any,
133
131
  isSortAscending: PropTypes.bool,
134
132
  isSorted: PropTypes.bool,
135
- /**
136
- * Mobile options for displaying differently at small screens
137
- */
138
- mobileOptions: PropTypes.shape({
139
- /**
140
- * If false, will not render the column at all for mobile
141
- */
142
- show: PropTypes.bool,
143
- /**
144
- * Only show for mobile? If true, will not render the column at all
145
- * for desktop
146
- */
147
- only: PropTypes.bool
148
- }),
133
+ mobileOptions: PropTypes.any,
149
134
  onSort: PropTypes.func,
150
135
  scope: PropTypes.oneOf(["col", "row", "colgroup", "rowgroup"]),
151
136
  width: PropTypes.oneOfType([PropTypes.string.isRequired, PropTypes.number.isRequired]),
@@ -13,7 +13,9 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
13
13
  import React from 'react';
14
14
  import PropTypes from "prop-types";
15
15
  import classNames from 'classnames';
16
+ import { useEuiMemoizedStyles } from '../../services';
16
17
  import { resolveWidthAsStyle } from './utils';
18
+ import { euiTableCellCheckboxStyles } from './table_cells_shared.styles';
17
19
  import { jsx as ___EmotionJSX } from "@emotion/react";
18
20
  export var EuiTableHeaderCellCheckbox = function EuiTableHeaderCellCheckbox(_ref) {
19
21
  var children = _ref.children,
@@ -24,11 +26,13 @@ export var EuiTableHeaderCellCheckbox = function EuiTableHeaderCellCheckbox(_ref
24
26
  width = _ref.width,
25
27
  rest = _objectWithoutProperties(_ref, _excluded);
26
28
  var classes = classNames('euiTableHeaderCellCheckbox', className);
27
- var styleObj = resolveWidthAsStyle(style, width);
29
+ var styles = useEuiMemoizedStyles(euiTableCellCheckboxStyles);
30
+ var inlineStyles = resolveWidthAsStyle(style, width);
28
31
  return ___EmotionJSX("th", _extends({
32
+ css: styles.euiTableHeaderCellCheckbox,
29
33
  className: classes,
30
34
  scope: scope,
31
- style: styleObj
35
+ style: inlineStyles
32
36
  }, rest), ___EmotionJSX("div", {
33
37
  className: "euiTableCellContent"
34
38
  }, children));
@@ -1,4 +1,4 @@
1
- var _excluded = ["children", "className", "isSelected", "isSelectable", "hasActions", "isExpandedRow", "isExpandable", "onClick"];
1
+ var _excluded = ["children", "className", "hasSelection", "isSelected", "isSelectable", "hasActions", "isExpandedRow", "isExpandable", "onClick"];
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
3
  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
4
  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; }
@@ -13,11 +13,14 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
13
13
  import React from 'react';
14
14
  import PropTypes from "prop-types";
15
15
  import classNames from 'classnames';
16
- import { keys } from '../../services';
16
+ import { keys, useEuiMemoizedStyles } from '../../services';
17
+ import { useEuiTableIsResponsive } from './mobile/responsive_context';
18
+ import { euiTableRowStyles } from './table_row.styles';
17
19
  import { jsx as ___EmotionJSX } from "@emotion/react";
18
20
  export var EuiTableRow = function EuiTableRow(_ref) {
19
21
  var children = _ref.children,
20
22
  className = _ref.className,
23
+ hasSelection = _ref.hasSelection,
21
24
  isSelected = _ref.isSelected,
22
25
  isSelectable = _ref.isSelectable,
23
26
  hasActions = _ref.hasActions,
@@ -25,6 +28,9 @@ export var EuiTableRow = function EuiTableRow(_ref) {
25
28
  isExpandable = _ref.isExpandable,
26
29
  onClick = _ref.onClick,
27
30
  rest = _objectWithoutProperties(_ref, _excluded);
31
+ var isResponsive = useEuiTableIsResponsive();
32
+ var styles = useEuiMemoizedStyles(euiTableRowStyles);
33
+ 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];
28
34
  var classes = classNames('euiTableRow', className, {
29
35
  'euiTableRow-isSelectable': isSelectable,
30
36
  'euiTableRow-isSelected': isSelected,
@@ -35,6 +41,7 @@ export var EuiTableRow = function EuiTableRow(_ref) {
35
41
  });
36
42
  if (!onClick) {
37
43
  return ___EmotionJSX("tr", _extends({
44
+ css: cssStyles,
38
45
  className: classes
39
46
  }, rest), children);
40
47
  }
@@ -49,6 +56,7 @@ export var EuiTableRow = function EuiTableRow(_ref) {
49
56
  }
50
57
  };
51
58
  return ___EmotionJSX("tr", _extends({
59
+ css: cssStyles,
52
60
  className: classes,
53
61
  onClick: onClick,
54
62
  onKeyDown: onKeyDown,
@@ -63,7 +71,11 @@ EuiTableRow.propTypes = {
63
71
  css: PropTypes.any,
64
72
  /**
65
73
  * Indicates if the table has a single column of checkboxes for selecting
66
- * rows (affects mobile only)
74
+ * rows (used for mobile styling)
75
+ */
76
+ hasSelection: PropTypes.bool,
77
+ /**
78
+ * Indicates that the current row's checkbox is selectable / not disabled
67
79
  */
68
80
  isSelectable: PropTypes.bool,
69
81
  /**
@@ -71,10 +83,10 @@ EuiTableRow.propTypes = {
71
83
  */
72
84
  isSelected: PropTypes.bool,
73
85
  /**
74
- * Indicates if the table has a dedicated column for icon-only actions
75
- * (affects mobile only)
86
+ * Indicates if the table has a dedicated column for actions
87
+ * (used for mobile styling and desktop action hover behavior)
76
88
  */
77
- hasActions: PropTypes.bool,
89
+ hasActions: PropTypes.oneOfType([PropTypes.bool.isRequired, PropTypes.oneOf(["custom"])]),
78
90
  /**
79
91
  * Indicates if the row will have an expanded row
80
92
  */
@@ -0,0 +1,78 @@
1
+ var _templateObject;
2
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
3
+ /*
4
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
5
+ * or more contributor license agreements. Licensed under the Elastic License
6
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
7
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
8
+ * Side Public License, v 1.
9
+ */
10
+
11
+ import { css, keyframes } from '@emotion/react';
12
+ import { tint, shade, transparentize } from '../../services';
13
+ import { euiCanAnimate, euiBackgroundColor, logicalCSS } from '../../global_styling';
14
+ import { euiShadow } from '../../themes/amsterdam/global_styling/mixins';
15
+ import { euiTableVariables } from './table.styles';
16
+ export var euiTableRowStyles = function euiTableRowStyles(euiThemeContext) {
17
+ var euiTheme = euiThemeContext.euiTheme;
18
+ var rowColors = _rowColorVariables(euiThemeContext);
19
+ var expandedAnimationCss = _expandedRowAnimation(euiThemeContext);
20
+ var _euiTableVariables = euiTableVariables(euiThemeContext),
21
+ cellContentPadding = _euiTableVariables.cellContentPadding,
22
+ mobileSizes = _euiTableVariables.mobileSizes,
23
+ checkboxSize = _euiTableVariables.checkboxSize;
24
+ return {
25
+ euiTableRow: /*#__PURE__*/css(";label:euiTableRow;"),
26
+ desktop: {
27
+ desktop: /*#__PURE__*/css("&:hover{background-color:", rowColors.hover, ";};label:desktop;"),
28
+ expanded: /*#__PURE__*/css("background-color:", rowColors.hover, ";", expandedAnimationCss, ";;label:expanded;"),
29
+ clickable: /*#__PURE__*/css("&:hover{background-color:", rowColors.clickable.hover, ";cursor:pointer;}&:focus{background-color:", rowColors.clickable.focus, ";};label:clickable;"),
30
+ selected: /*#__PURE__*/css("&,&+.euiTableRow-isExpandedRow{background-color:", rowColors.selected.color, ";}&:hover,&:hover+.euiTableRow-isExpandedRow{background-color:", rowColors.selected.hover, ";};label:selected;"),
31
+ // Offset expanded & selectable rows by the checkbox width to line up content with the 2nd column
32
+ // Set on the `<td>` because padding can't be applied to `<tr>` elements directly
33
+ checkboxOffset: /*#__PURE__*/css(".euiTableRowCell:first-child{", logicalCSS('padding-left', checkboxSize), ";};label:checkboxOffset;")
34
+ },
35
+ mobile: {
36
+ mobile: /*#__PURE__*/css("position:relative;display:flex;flex-wrap:wrap;padding:", cellContentPadding, ";", logicalCSS('margin-bottom', cellContentPadding), euiShadow(euiThemeContext, 's'), " background-color:", euiBackgroundColor(euiThemeContext, 'plain'), ";border-radius:", euiTheme.border.radius.medium, ";;label:mobile;"),
37
+ selected: /*#__PURE__*/css("&,&+.euiTableRow-isExpandedRow{background-color:", rowColors.selected.color, ";};label:selected;"),
38
+ /**
39
+ * Left column offset (no border)
40
+ * Used for selection checkbox, which will be absolutely positioned
41
+ */
42
+ hasLeftColumn: /*#__PURE__*/css(logicalCSS('padding-left', mobileSizes.checkbox.width), ";;label:hasLeftColumn;"),
43
+ /**
44
+ * Right column styles + border
45
+ * Used for cell actions and row expander arrow
46
+ */
47
+ hasRightColumn: /*#__PURE__*/css(logicalCSS('padding-right', mobileSizes.actions.width), " &::after{content:'';position:absolute;", logicalCSS('vertical', 0), " ", logicalCSS('right', mobileSizes.actions.width), " ", logicalCSS('width', euiTheme.border.width.thin), " background-color:", euiTheme.border.color, ";};label:hasRightColumn;"),
48
+ /**
49
+ * Bottom of card - expanded rows
50
+ */
51
+ expanded: /*#__PURE__*/css(logicalCSS('margin-top', "-".concat(mobileSizes.actions.offset)), logicalCSS('padding-left', cellContentPadding), " ", logicalCSS('border-top', euiTheme.border.thin), " ", logicalCSS('border-top-left-radius', 0), " ", logicalCSS('border-top-right-radius', 0), " .euiTableRowCell{", logicalCSS('width', '100%'), ";}", expandedAnimationCss, ";;label:expanded;")
52
+ }
53
+ };
54
+ };
55
+ var _expandedRowAnimation = function _expandedRowAnimation(_ref) {
56
+ var euiTheme = _ref.euiTheme;
57
+ // Do not attempt to animate to height auto - down that road dragons lie
58
+ // @see https://github.com/elastic/eui/pull/6826
59
+ var expandRow = keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n 0% {\n opacity: 0;\n transform: translateY(-", ");\n }\n 100% {\n opacity: 1;\n transform: translateY(0);\n }\n "])), euiTheme.size.m);
60
+
61
+ // Animation must be on the contents div inside, not the row itself
62
+ return /*#__PURE__*/css(euiCanAnimate, "{.euiTableCellContent{animation:", euiTheme.animation.fast, " ", euiTheme.animation.resistance, " 1 normal none ", expandRow, ";}}");
63
+ };
64
+ var _rowColorVariables = function _rowColorVariables(_ref2) {
65
+ var euiTheme = _ref2.euiTheme,
66
+ colorMode = _ref2.colorMode;
67
+ return {
68
+ hover: colorMode === 'DARK' ? euiTheme.colors.lightestShade : tint(euiTheme.colors.lightestShade, 0.5),
69
+ selected: {
70
+ color: colorMode === 'DARK' ? shade(euiTheme.colors.primary, 0.7) : tint(euiTheme.colors.primary, 0.96),
71
+ hover: colorMode === 'DARK' ? shade(euiTheme.colors.primary, 0.75) : tint(euiTheme.colors.primary, 0.9)
72
+ },
73
+ clickable: {
74
+ hover: transparentize(euiTheme.colors.primary, 0.05),
75
+ focus: transparentize(euiTheme.colors.primary, 0.1)
76
+ }
77
+ };
78
+ };