@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
@@ -1,6 +1,6 @@
1
1
  var _excluded = ["schema"],
2
2
  _excluded2 = ["onChange"],
3
- _excluded3 = ["columns", "loading", "message", "error", "selection", "isSelectable", "hasActions", "compressed", "pagination", "sorting", "itemIdToExpandedRowMap", "itemId", "rowProps", "cellProps", "tableLayout", "items", "search", "searchFormat", "onTableChange", "executeQueryOptions", "allowNeutralSort", "childrenBetween"];
3
+ _excluded3 = ["columns", "loading", "message", "error", "selection", "compressed", "pagination", "sorting", "itemIdToExpandedRowMap", "itemId", "rowProps", "cellProps", "tableLayout", "items", "search", "searchFormat", "onTableChange", "executeQueryOptions", "allowNeutralSort", "childrenBetween"];
4
4
  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); }
5
5
  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); }
6
6
  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; }
@@ -378,8 +378,6 @@ export var EuiInMemoryTable = /*#__PURE__*/function (_Component) {
378
378
  message = _this$props2.message,
379
379
  error = _this$props2.error,
380
380
  selection = _this$props2.selection,
381
- isSelectable = _this$props2.isSelectable,
382
- hasActions = _this$props2.hasActions,
383
381
  compressed = _this$props2.compressed,
384
382
  hasPagination = _this$props2.pagination,
385
383
  hasSorting = _this$props2.sorting,
@@ -436,8 +434,6 @@ export var EuiInMemoryTable = /*#__PURE__*/function (_Component) {
436
434
  pagination: pagination,
437
435
  sorting: sorting,
438
436
  selection: selection,
439
- isSelectable: isSelectable,
440
- hasActions: hasActions,
441
437
  onChange: this.onTableChange,
442
438
  error: error,
443
439
  loading: loading,
@@ -516,7 +512,6 @@ export var EuiInMemoryTable = /*#__PURE__*/function (_Component) {
516
512
  }(Component);
517
513
  _defineProperty(EuiInMemoryTable, "contextType", EuiComponentDefaultsContext);
518
514
  _defineProperty(EuiInMemoryTable, "defaultProps", {
519
- responsive: true,
520
515
  tableLayout: 'fixed',
521
516
  searchFormat: 'eql'
522
517
  });
@@ -587,16 +582,22 @@ EuiInMemoryTable.propTypes = {
587
582
  * Defines whether the user can sort on this column. If a function is provided, this function returns the value to sort against
588
583
  */
589
584
  sortable: PropTypes.oneOfType([PropTypes.bool.isRequired, PropTypes.func.isRequired]),
590
- isExpander: PropTypes.bool,
591
585
  /**
592
- * Creates a text wrapper around cell content that helps word break or truncate
593
- * long text correctly.
586
+ * Disables the user's ability to change the sort, but will still
587
+ * show the current sort direction in the column header
594
588
  */
595
- textOnly: PropTypes.bool,
589
+ readOnly: PropTypes.bool,
596
590
  /**
597
591
  * Defines the horizontal alignment of the column
592
+ * @default left
598
593
  */
599
594
  align: PropTypes.any,
595
+ /**
596
+ * Creates a text wrapper around cell content that helps word break or truncate
597
+ * long text correctly.
598
+ * @default true
599
+ */
600
+ textOnly: PropTypes.bool,
600
601
  /**
601
602
  * Indicates whether this column should truncate overflowing text content.
602
603
  * - Set to `true` to enable single-line truncation.
@@ -606,6 +607,10 @@ EuiInMemoryTable.propTypes = {
606
607
  truncateText: PropTypes.oneOfType([PropTypes.bool.isRequired, PropTypes.shape({
607
608
  lines: PropTypes.number.isRequired
608
609
  }).isRequired]),
610
+ /**
611
+ * Allows configuring custom render options or appearances for column cells
612
+ * when the table responsively collapses into a mobile-friendly view
613
+ */
609
614
  mobileOptions: PropTypes.shape({
610
615
  render: PropTypes.func
611
616
  }),
@@ -618,48 +623,31 @@ EuiInMemoryTable.propTypes = {
618
623
  */
619
624
  footer: PropTypes.oneOfType([PropTypes.string.isRequired, PropTypes.element.isRequired, PropTypes.func.isRequired]),
620
625
  /**
621
- * Disables the user's ability to change the sort but still shows the current direction
626
+ * If passing `itemIdToExpandedRowMap` to your table, set this flag to `true`
627
+ * for the custom column or cell used to toggle the expanded row.
622
628
  */
623
- readOnly: PropTypes.bool,
629
+ isExpander: PropTypes.bool,
624
630
  className: PropTypes.string,
625
631
  "aria-label": PropTypes.string,
626
632
  "data-test-subj": PropTypes.string,
627
633
  css: PropTypes.any
628
634
  }).isRequired, PropTypes.shape({
635
+ className: PropTypes.string,
636
+ "aria-label": PropTypes.string,
637
+ "data-test-subj": PropTypes.string,
638
+ css: PropTypes.any,
629
639
  /**
630
- * A function that computes the value for each item and renders it
631
- */
640
+ * A function that computes the value for each item and renders it
641
+ */
632
642
  render: PropTypes.func.isRequired,
633
643
  /**
634
- * The display name of the column
635
- */
644
+ * The display name of the column
645
+ */
636
646
  name: PropTypes.node,
637
647
  /**
638
- * A description of the column (will be presented as a title over the column header
639
- */
640
- description: PropTypes.string,
641
- /**
642
- * If provided, allows this column to be sorted on. Must return the value to sort against.
643
- */
644
- sortable: PropTypes.func,
645
- /**
646
- * A CSS width property. Hints for the required width of the column
647
- */
648
- width: PropTypes.string,
649
- /**
650
- * Indicates whether this column should truncate its content when it doesn't fit
651
- */
652
- truncateText: PropTypes.bool,
653
- isExpander: PropTypes.bool,
654
- align: PropTypes.any,
655
- /**
656
- * Disables the user's ability to change the sort but still shows the current direction
657
- */
658
- readOnly: PropTypes.bool,
659
- className: PropTypes.string,
660
- "aria-label": PropTypes.string,
661
- "data-test-subj": PropTypes.string,
662
- css: PropTypes.any
648
+ * If provided, allows this column to be sorted on. Must return the value to sort against.
649
+ */
650
+ sortable: PropTypes.func
663
651
  }).isRequired, PropTypes.shape({
664
652
  /**
665
653
  * An array of one of the objects: #DefaultItemAction or #CustomItemAction
@@ -688,10 +676,14 @@ EuiInMemoryTable.propTypes = {
688
676
  */
689
677
  description: PropTypes.oneOfType([PropTypes.string.isRequired, PropTypes.func.isRequired]).isRequired,
690
678
  /**
691
- * A handler function to execute the action
679
+ * A handler function to execute the action. Passes back the current row
680
+ * item as the first argument, and the originating React click event
681
+ * as a second argument.
692
682
  */
693
683
  /**
694
- * A handler function to execute the action
684
+ * A handler function to execute the action. Passes back the current row
685
+ * item as the first argument, and the originating React click event
686
+ * as a second argument.
695
687
  */
696
688
  onClick: PropTypes.func,
697
689
  href: PropTypes.oneOfType([PropTypes.string.isRequired, PropTypes.func.isRequired]),
@@ -710,8 +702,33 @@ EuiInMemoryTable.propTypes = {
710
702
  * A callback function that determines whether the action is enabled
711
703
  */
712
704
  enabled: PropTypes.func,
713
- isPrimary: PropTypes.bool,
714
705
  "data-test-subj": PropTypes.oneOfType([PropTypes.string.isRequired, PropTypes.func.isRequired]),
706
+ /**
707
+ * If more than 3 actions are passed, 2 primary actions will show (on hover)
708
+ * next to an expansion menu of all actions.
709
+ *
710
+ * On mobile, primary actions will be tucked away in the expansion menu for space.
711
+ */
712
+ /**
713
+ * If more than 3 actions are passed, 2 primary actions will show (on hover)
714
+ * next to an expansion menu of all actions.
715
+ *
716
+ * On mobile, primary actions will be tucked away in the expansion menu for space.
717
+ */
718
+ isPrimary: PropTypes.bool,
719
+ /**
720
+ * Allows only showing the action on mouse hover or keyboard focus.
721
+ * If more than 3 actions are passed, this will always be true for `isPrimary` actions.
722
+ *
723
+ * Has no effect on mobile, or if `hasActions` is not set.
724
+ */
725
+ /**
726
+ * Allows only showing the action on mouse hover or keyboard focus.
727
+ * If more than 3 actions are passed, this will always be true for `isPrimary` actions.
728
+ *
729
+ * Has no effect on mobile, or if `hasActions` is not set.
730
+ */
731
+ showOnHover: PropTypes.bool,
715
732
  /**
716
733
  * Associates an icon with the button
717
734
  */
@@ -728,21 +745,12 @@ EuiInMemoryTable.propTypes = {
728
745
  /**
729
746
  * A callback that defines whether the action is enabled
730
747
  */
731
- enabled: PropTypes.func,
732
- isPrimary: PropTypes.bool
748
+ enabled: PropTypes.func
733
749
  }).isRequired]).isRequired).isRequired,
734
750
  /**
735
751
  * The display name of the column
736
752
  */
737
- name: PropTypes.node,
738
- /**
739
- * A description of the column (will be presented as a title over the column header
740
- */
741
- description: PropTypes.string,
742
- /**
743
- * A CSS width property. Hints for the required width of the column
744
- */
745
- width: PropTypes.string
753
+ name: PropTypes.node
746
754
  }).isRequired]).isRequired),
747
755
  /**
748
756
  * Error message to display
@@ -765,9 +773,6 @@ EuiInMemoryTable.propTypes = {
765
773
  * Indicates which column should be used as the identifying cell in each row. Should match a "field" prop in FieldDataColumn
766
774
  */
767
775
  rowHeader: PropTypes.string,
768
- hasActions: PropTypes.bool,
769
- isExpandable: PropTypes.bool,
770
- isSelectable: PropTypes.bool,
771
776
  /**
772
777
  * Provides an infinite loading indicator
773
778
  */
@@ -775,13 +780,6 @@ EuiInMemoryTable.propTypes = {
775
780
  * Provides an infinite loading indicator
776
781
  */
777
782
  loading: PropTypes.bool,
778
- /**
779
- * If true, will convert table to cards in mobile view
780
- */
781
- /**
782
- * If true, will convert table to cards in mobile view
783
- */
784
- responsive: PropTypes.bool,
785
783
  /**
786
784
  * Applied to `EuiTableRow`
787
785
  */
@@ -831,19 +829,6 @@ EuiInMemoryTable.propTypes = {
831
829
  * Sets the table-layout CSS property. Note that auto tableLayout prevents truncateText from working properly.
832
830
  */
833
831
  tableLayout: PropTypes.oneOf(["fixed", "auto"]),
834
- /**
835
- * Applied to table cells. Any cell using a render function will set this to be false.
836
- *
837
- * Creates a text wrapper around cell content that helps word break or truncate
838
- * long text correctly.
839
- */
840
- /**
841
- * Applied to table cells. Any cell using a render function will set this to be false.
842
- *
843
- * Creates a text wrapper around cell content that helps word break or truncate
844
- * long text correctly.
845
- */
846
- textOnly: PropTypes.bool,
847
832
  message: PropTypes.node,
848
833
  /**
849
834
  * Configures #Search.
@@ -55,7 +55,13 @@ EuiComponentDefaultsProvider.propTypes = {
55
55
  *
56
56
  * These defaults will be inherited all table and grid components that utilize EuiTablePagination.
57
57
  */
58
- EuiTablePagination: PropTypes.any
58
+ EuiTablePagination: PropTypes.any,
59
+ /**
60
+ * Provide a global configuration for EuiTable's `responsiveBreakpoint` prop. Defaults to `'s'`.
61
+ *
62
+ * Defaults will be inherited by all `EuiBasicTable`s and `EuiInMemoryTable`s.
63
+ */
64
+ EuiTable: PropTypes.any
59
65
  })
60
66
  };
61
67
  export var useComponentDefaults = function useComponentDefaults() {
@@ -0,0 +1,72 @@
1
+ var _excluded = ["children", "className", "align", "textOnly", "truncateText", "hasActions"];
2
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
4
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
5
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
7
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
8
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
9
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
10
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
11
+ /*
12
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
13
+ * or more contributor license agreements. Licensed under the Elastic License
14
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
15
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
16
+ * Side Public License, v 1.
17
+ */
18
+
19
+ import React, { useMemo } from 'react';
20
+ import PropTypes from "prop-types";
21
+ import classNames from 'classnames';
22
+ import { LEFT_ALIGNMENT, useEuiMemoizedStyles } from '../../services';
23
+ import { isObject } from '../../services/predicate';
24
+ import { EuiTextBlockTruncate } from '../text_truncate';
25
+ import { useEuiTableIsResponsive } from './mobile/responsive_context';
26
+ import { euiTableCellContentStyles } from './_table_cell_content.styles';
27
+ import { jsx as ___EmotionJSX } from "@emotion/react";
28
+ export var EuiTableCellContent = function EuiTableCellContent(_ref) {
29
+ var children = _ref.children,
30
+ className = _ref.className,
31
+ _ref$align = _ref.align,
32
+ align = _ref$align === void 0 ? LEFT_ALIGNMENT : _ref$align,
33
+ textOnly = _ref.textOnly,
34
+ _ref$truncateText = _ref.truncateText,
35
+ truncateText = _ref$truncateText === void 0 ? false : _ref$truncateText,
36
+ hasActions = _ref.hasActions,
37
+ rest = _objectWithoutProperties(_ref, _excluded);
38
+ var isResponsive = useEuiTableIsResponsive();
39
+ var styles = useEuiMemoizedStyles(euiTableCellContentStyles);
40
+ var cssStyles = [styles.euiTableCellContent, styles[align], truncateText === true && styles.truncateText, truncateText === false && styles.wrapText].concat(_toConsumableArray(hasActions ? [styles.hasActions.actions, !isResponsive && styles.hasActions.desktop, isResponsive && hasActions !== 'custom' && styles.hasActions.mobile] : []));
41
+ var classes = classNames('euiTableCellContent', className);
42
+ var renderedChildren = useMemo(function () {
43
+ var textClasses = 'euiTableCellContent__text';
44
+ if (isObject(truncateText) && truncateText.lines) {
45
+ return ___EmotionJSX(EuiTextBlockTruncate, {
46
+ lines: truncateText.lines,
47
+ cloneElement: true
48
+ }, ___EmotionJSX("span", {
49
+ className: textClasses
50
+ }, children));
51
+ }
52
+ if (textOnly === true || truncateText === true) {
53
+ return ___EmotionJSX("span", {
54
+ className: textClasses
55
+ }, children);
56
+ }
57
+ return children;
58
+ }, [children, textOnly, truncateText]);
59
+ return ___EmotionJSX("div", _extends({
60
+ css: cssStyles,
61
+ className: classes
62
+ }, rest), renderedChildren);
63
+ };
64
+ EuiTableCellContent.propTypes = {
65
+ className: PropTypes.string,
66
+ "aria-label": PropTypes.string,
67
+ "data-test-subj": PropTypes.string,
68
+ css: PropTypes.any,
69
+ truncateText: PropTypes.oneOfType([PropTypes.oneOfType([PropTypes.bool.isRequired, PropTypes.shape({
70
+ lines: PropTypes.number.isRequired
71
+ }).isRequired]).isRequired, PropTypes.oneOf([null])])
72
+ };
@@ -0,0 +1,63 @@
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 { euiTextTruncate, euiTextBreakWord, logicalTextAlignCSS } from '../../global_styling';
12
+ var _ref = process.env.NODE_ENV === "production" ? {
13
+ name: "1t1ptlc-mobile",
14
+ styles: "flex-direction:column;padding:0;label:mobile;"
15
+ } : {
16
+ name: "1t1ptlc-mobile",
17
+ styles: "flex-direction:column;padding:0;label:mobile;",
18
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
19
+ };
20
+ var _ref2 = process.env.NODE_ENV === "production" ? {
21
+ name: "o9tdjd-desktop",
22
+ styles: "flex-wrap:wrap;label:desktop;"
23
+ } : {
24
+ name: "o9tdjd-desktop",
25
+ styles: "flex-wrap:wrap;label:desktop;",
26
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
27
+ };
28
+ var _ref3 = process.env.NODE_ENV === "production" ? {
29
+ name: "1x3x3jh-center",
30
+ styles: "justify-content:center;text-align:center;label:center;"
31
+ } : {
32
+ name: "1x3x3jh-center",
33
+ styles: "justify-content:center;text-align:center;label:center;",
34
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
35
+ };
36
+ var _ref4 = process.env.NODE_ENV === "production" ? {
37
+ name: "1vsid2d-euiTableCellContent",
38
+ styles: "display:flex;align-items:center;label:euiTableCellContent;"
39
+ } : {
40
+ name: "1vsid2d-euiTableCellContent",
41
+ styles: "display:flex;align-items:center;label:euiTableCellContent;",
42
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
43
+ };
44
+ export var euiTableCellContentStyles = function euiTableCellContentStyles(_ref5) {
45
+ var euiTheme = _ref5.euiTheme;
46
+ return {
47
+ euiTableCellContent: _ref4,
48
+ // Align
49
+ left: null,
50
+ // Default, no CSS needed
51
+ right: /*#__PURE__*/css("justify-content:flex-end;", logicalTextAlignCSS('right'), ";;label:right;"),
52
+ center: _ref3,
53
+ // Text wrapping
54
+ truncateText: /*#__PURE__*/css(euiTextTruncate(), ".euiTableCellContent__text{overflow:hidden;text-overflow:ellipsis;};label:truncateText;"),
55
+ wrapText: /*#__PURE__*/css(euiTextBreakWord(), ";;label:wrapText;"),
56
+ // Action cells
57
+ hasActions: {
58
+ actions: /*#__PURE__*/css("gap:", euiTheme.size.s, ";;label:actions;"),
59
+ desktop: _ref2,
60
+ mobile: _ref
61
+ }
62
+ };
63
+ };
@@ -11,7 +11,6 @@ export { EuiTableBody } from './table_body';
11
11
  export { EuiTableFooter } from './table_footer';
12
12
  export { EuiTableFooterCell } from './table_footer_cell';
13
13
  export { EuiTableHeader } from './table_header';
14
- export { EuiTableHeaderButton } from './table_header_button';
15
14
  export { EuiTableHeaderCell } from './table_header_cell';
16
15
  export { EuiTableHeaderCellCheckbox } from './table_header_cell_checkbox';
17
16
  export { EuiTablePagination } from './table_pagination';
@@ -0,0 +1,37 @@
1
+ /*
2
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
+ * or more contributor license agreements. Licensed under the Elastic License
4
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
5
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
6
+ * Side Public License, v 1.
7
+ */
8
+
9
+ import { createContext, useContext } from 'react';
10
+ import { useIsWithinMinBreakpoint } from '../../../services';
11
+ import { useComponentDefaults } from '../../provider/component_defaults';
12
+ export var DEFAULT_TABLE_BREAKPOINT = 'm';
13
+
14
+ /**
15
+ * Used by parent/top-level table components to determine isResponsive state
16
+ * based on the passed breakpoint
17
+ */
18
+ export var useIsEuiTableResponsive = function useIsEuiTableResponsive(componentProp) {
19
+ var _useComponentDefaults, _ref;
20
+ var componentDefault = (_useComponentDefaults = useComponentDefaults().EuiTable) === null || _useComponentDefaults === void 0 ? void 0 : _useComponentDefaults.responsiveBreakpoint;
21
+ var breakpoint = (_ref = componentProp !== null && componentProp !== void 0 ? componentProp : componentDefault) !== null && _ref !== void 0 ? _ref : DEFAULT_TABLE_BREAKPOINT;
22
+ var isBoolean = typeof breakpoint === 'boolean';
23
+
24
+ // Note: we're using `!useIsWithinMinBreakpoint` here instead of `useIsWithinMaxBreakpoint`
25
+ // because it more accurately reflects the single breakpoint at which tables collapse
26
+ var isResponsive = !useIsWithinMinBreakpoint(isBoolean ? '' : breakpoint);
27
+ return isBoolean ? breakpoint : isResponsive;
28
+ };
29
+
30
+ /**
31
+ * Context set by parent table components
32
+ * Hook used by cells to fetch parent isResponsive state
33
+ */
34
+ export var EuiTableIsResponsiveContext = /*#__PURE__*/createContext(false);
35
+ export var useEuiTableIsResponsive = function useEuiTableIsResponsive() {
36
+ return useContext(EuiTableIsResponsiveContext);
37
+ };
@@ -1,4 +1,4 @@
1
- var _excluded = ["children", "className"];
1
+ var _excluded = ["children", "className", "responsiveBreakpoint"];
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,15 +13,22 @@ 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';
17
+ import { useIsEuiTableResponsive } from './responsive_context';
18
+ import { euiTableHeaderMobileStyles } from './table_header_mobile.styles';
16
19
  import { jsx as ___EmotionJSX } from "@emotion/react";
17
20
  export var EuiTableHeaderMobile = function EuiTableHeaderMobile(_ref) {
18
21
  var children = _ref.children,
19
22
  className = _ref.className,
23
+ responsiveBreakpoint = _ref.responsiveBreakpoint,
20
24
  rest = _objectWithoutProperties(_ref, _excluded);
25
+ var isResponsive = useIsEuiTableResponsive(responsiveBreakpoint);
26
+ var styles = useEuiMemoizedStyles(euiTableHeaderMobileStyles);
21
27
  var classes = classNames('euiTableHeaderMobile', className);
22
- return ___EmotionJSX("div", _extends({
23
- className: classes
24
- }, rest), children);
28
+ return isResponsive ? ___EmotionJSX("div", _extends({
29
+ className: classes,
30
+ css: styles.euiTableHeaderMobile
31
+ }, rest), children) : null;
25
32
  };
26
33
  EuiTableHeaderMobile.propTypes = {
27
34
  className: PropTypes.string,
@@ -0,0 +1,15 @@
1
+ /*
2
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
+ * or more contributor license agreements. Licensed under the Elastic License
4
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
5
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
6
+ * Side Public License, v 1.
7
+ */
8
+
9
+ import { css } from '@emotion/react';
10
+ export var euiTableHeaderMobileStyles = function euiTableHeaderMobileStyles(_ref) {
11
+ var euiTheme = _ref.euiTheme;
12
+ return {
13
+ euiTableHeaderMobile: /*#__PURE__*/css("display:flex;justify-content:space-between;align-items:baseline;padding-block:", euiTheme.size.s, ";;label:euiTableHeaderMobile;")
14
+ };
15
+ };
@@ -56,6 +56,11 @@ export var EuiTableSortMobile = /*#__PURE__*/function (_Component) {
56
56
  isPopoverOpen: false
57
57
  });
58
58
  });
59
+ // Aligns the button to the right even when it's the only element present
60
+ _defineProperty(_assertThisInitialized(_this), "euiTableSortMobileStyles", {
61
+ marginInlineStart: 'auto',
62
+ label: 'euiTableSortMobile'
63
+ });
59
64
  return _this;
60
65
  }
61
66
  _createClass(EuiTableSortMobile, [{
@@ -97,14 +102,14 @@ export var EuiTableSortMobile = /*#__PURE__*/function (_Component) {
97
102
  }) : undefined
98
103
  }));
99
104
  return ___EmotionJSX("div", {
100
- className: classes
105
+ className: classes,
106
+ css: this.euiTableSortMobileStyles
101
107
  }, mobileSortPopover);
102
108
  }
103
109
  }]);
104
110
  return EuiTableSortMobile;
105
111
  }(Component);
106
112
  EuiTableSortMobile.propTypes = {
107
- className: PropTypes.string,
108
113
  anchorPosition: PropTypes.any,
109
114
  items: PropTypes.arrayOf(PropTypes.shape({
110
115
  name: PropTypes.node.isRequired,
@@ -112,5 +117,9 @@ EuiTableSortMobile.propTypes = {
112
117
  onSort: PropTypes.func,
113
118
  isSorted: PropTypes.bool,
114
119
  isSortAscending: PropTypes.bool
115
- }).isRequired)
120
+ }).isRequired),
121
+ className: PropTypes.string,
122
+ "aria-label": PropTypes.string,
123
+ "data-test-subj": PropTypes.string,
124
+ css: PropTypes.any
116
125
  };
@@ -1,4 +1,4 @@
1
- var _excluded = ["children", "className", "compressed", "tableLayout", "responsive"];
1
+ var _excluded = ["children", "className", "compressed", "tableLayout", "responsiveBreakpoint"];
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,32 +13,42 @@ 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';
17
+ import { useIsEuiTableResponsive, EuiTableIsResponsiveContext } from './mobile/responsive_context';
18
+ import { euiTableStyles } from './table.styles';
16
19
  import { jsx as ___EmotionJSX } from "@emotion/react";
17
- var tableLayoutToClassMap = {
18
- fixed: null,
19
- auto: 'euiTable--auto'
20
- };
21
20
  export var EuiTable = function EuiTable(_ref) {
22
21
  var children = _ref.children,
23
22
  className = _ref.className,
24
23
  compressed = _ref.compressed,
25
24
  _ref$tableLayout = _ref.tableLayout,
26
25
  tableLayout = _ref$tableLayout === void 0 ? 'fixed' : _ref$tableLayout,
27
- _ref$responsive = _ref.responsive,
28
- responsive = _ref$responsive === void 0 ? true : _ref$responsive,
26
+ responsiveBreakpoint = _ref.responsiveBreakpoint,
29
27
  rest = _objectWithoutProperties(_ref, _excluded);
30
- var classes = classNames('euiTable', className, {
31
- 'euiTable--compressed': compressed,
32
- 'euiTable--responsive': responsive
33
- }, tableLayoutToClassMap[tableLayout]);
28
+ var isResponsive = useIsEuiTableResponsive(responsiveBreakpoint);
29
+ var classes = classNames('euiTable', className);
30
+ var styles = useEuiMemoizedStyles(euiTableStyles);
31
+ var cssStyles = [styles.euiTable, styles.layout[tableLayout], (!compressed || isResponsive) && styles.uncompressed, compressed && !isResponsive && styles.compressed, isResponsive ? styles.mobile : styles.desktop];
34
32
  return ___EmotionJSX("table", _extends({
35
33
  tabIndex: -1,
34
+ css: cssStyles,
36
35
  className: classes
37
- }, rest), children);
36
+ }, rest), ___EmotionJSX(EuiTableIsResponsiveContext.Provider, {
37
+ value: isResponsive
38
+ }, children));
38
39
  };
39
40
  EuiTable.propTypes = {
40
41
  compressed: PropTypes.bool,
41
- responsive: PropTypes.bool,
42
+ /**
43
+ * Named breakpoint. Below this size, the table will collapse
44
+ * into responsive cards.
45
+ *
46
+ * Pass `false` to never collapse to a mobile view, or inversely,
47
+ * `true` to always render mobile-friendly cards.
48
+ *
49
+ * @default m
50
+ */
51
+ responsiveBreakpoint: PropTypes.oneOfType([PropTypes.any.isRequired, PropTypes.bool.isRequired]),
42
52
  /**
43
53
  * Sets the table-layout CSS property
44
54
  */