@elastic/eui 116.3.1 → 116.4.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 (183) hide show
  1. package/es/components/banner/banner.js +1 -2
  2. package/es/components/banner/banner.styles.js +1 -1
  3. package/es/components/basic_table/basic_table.js +35 -5
  4. package/es/components/basic_table/basic_table.styles.js +19 -1
  5. package/es/components/basic_table/in_memory_table.js +17 -0
  6. package/es/components/basic_table/index.js +2 -1
  7. package/es/components/basic_table/pagination_bar.js +19 -4
  8. package/es/components/basic_table/pagination_bar.styles.js +21 -0
  9. package/es/components/basic_table/panel.styles.js +14 -0
  10. package/es/components/basic_table/use_panel_props.js +28 -0
  11. package/es/components/date_picker/auto_refresh/refresh_interval.js +176 -229
  12. package/es/components/flyout/flyout.component.js +10 -6
  13. package/es/components/flyout/flyout_menu.js +122 -19
  14. package/es/components/flyout/flyout_menu.styles.js +2 -1
  15. package/es/components/flyout/manager/actions.js +20 -0
  16. package/es/components/flyout/manager/flyout_child.js +23 -1
  17. package/es/components/flyout/manager/flyout_managed.js +65 -19
  18. package/es/components/flyout/manager/hooks.js +1 -1
  19. package/es/components/flyout/manager/index.js +2 -2
  20. package/es/components/flyout/manager/reducer.js +32 -8
  21. package/es/components/flyout/manager/selectors.js +8 -2
  22. package/es/components/flyout/manager/store.js +35 -2
  23. package/es/components/flyout/use_flyout_menu.js +2 -2
  24. package/es/components/form/form_control_layout/form_control_layout_icons.js +95 -143
  25. package/es/components/notification_icon/assets/info_fill.js +34 -0
  26. package/es/components/notification_icon/assets/warning_static.js +40 -0
  27. package/es/components/notification_icon/notification_icon.js +87 -0
  28. package/es/components/notification_icon/notification_icon.styles.js +22 -0
  29. package/es/components/table/mobile/table_sort_mobile.js +64 -103
  30. package/es/components/toast/global_toast_list.js +132 -6
  31. package/es/components/toast/global_toast_list.styles.js +31 -7
  32. package/es/components/toast/toast.js +242 -47
  33. package/es/components/toast/toast.styles.js +35 -47
  34. package/es/components/toast/toast_action.js +34 -0
  35. package/es/components/toast/types.js +9 -0
  36. package/es/components/tool_tip/tool_tip.js +3 -3
  37. package/eui.d.ts +1203 -971
  38. package/i18ntokens.json +1582 -1546
  39. package/lib/components/banner/banner.js +1 -2
  40. package/lib/components/banner/banner.styles.js +1 -1
  41. package/lib/components/basic_table/basic_table.js +34 -4
  42. package/lib/components/basic_table/basic_table.styles.js +19 -1
  43. package/lib/components/basic_table/in_memory_table.js +17 -0
  44. package/lib/components/basic_table/index.js +8 -1
  45. package/lib/components/basic_table/pagination_bar.js +19 -4
  46. package/lib/components/basic_table/pagination_bar.styles.js +26 -0
  47. package/lib/components/basic_table/panel.styles.js +20 -0
  48. package/lib/components/basic_table/use_panel_props.js +33 -0
  49. package/lib/components/date_picker/auto_refresh/refresh_interval.js +175 -229
  50. package/lib/components/flyout/flyout.component.js +10 -6
  51. package/lib/components/flyout/flyout_menu.js +120 -19
  52. package/lib/components/flyout/flyout_menu.styles.js +2 -1
  53. package/lib/components/flyout/manager/actions.js +21 -1
  54. package/lib/components/flyout/manager/flyout_child.js +23 -1
  55. package/lib/components/flyout/manager/flyout_managed.js +41 -17
  56. package/lib/components/flyout/manager/hooks.js +6 -0
  57. package/lib/components/flyout/manager/index.js +12 -0
  58. package/lib/components/flyout/manager/reducer.js +31 -7
  59. package/lib/components/flyout/manager/selectors.js +9 -3
  60. package/lib/components/flyout/manager/store.js +34 -1
  61. package/lib/components/flyout/use_flyout_menu.js +2 -2
  62. package/lib/components/form/form_control_layout/form_control_layout_icons.js +95 -145
  63. package/lib/components/notification_icon/assets/info_fill.js +41 -0
  64. package/lib/components/notification_icon/assets/warning_static.js +47 -0
  65. package/lib/components/notification_icon/notification_icon.js +93 -0
  66. package/lib/components/notification_icon/notification_icon.styles.js +28 -0
  67. package/lib/components/notification_icon/svgs/info_fill.svg +3 -0
  68. package/lib/components/notification_icon/svgs/warning_static.svg +5 -0
  69. package/lib/components/table/mobile/table_sort_mobile.js +71 -108
  70. package/lib/components/toast/global_toast_list.js +132 -6
  71. package/lib/components/toast/global_toast_list.styles.js +31 -8
  72. package/lib/components/toast/toast.js +244 -47
  73. package/lib/components/toast/toast.styles.js +32 -45
  74. package/lib/components/toast/toast_action.js +40 -0
  75. package/lib/components/toast/types.js +15 -0
  76. package/lib/components/tool_tip/tool_tip.js +2 -2
  77. package/optimize/es/components/banner/banner.js +1 -2
  78. package/optimize/es/components/banner/banner.styles.js +1 -1
  79. package/optimize/es/components/basic_table/basic_table.js +18 -5
  80. package/optimize/es/components/basic_table/basic_table.styles.js +19 -1
  81. package/optimize/es/components/basic_table/index.js +2 -1
  82. package/optimize/es/components/basic_table/pagination_bar.js +19 -4
  83. package/optimize/es/components/basic_table/pagination_bar.styles.js +21 -0
  84. package/optimize/es/components/basic_table/panel.styles.js +14 -0
  85. package/optimize/es/components/basic_table/use_panel_props.js +28 -0
  86. package/optimize/es/components/date_picker/auto_refresh/refresh_interval.js +172 -196
  87. package/optimize/es/components/flyout/flyout.component.js +10 -6
  88. package/optimize/es/components/flyout/flyout_menu.js +99 -18
  89. package/optimize/es/components/flyout/flyout_menu.styles.js +2 -1
  90. package/optimize/es/components/flyout/manager/actions.js +20 -0
  91. package/optimize/es/components/flyout/manager/flyout_managed.js +42 -18
  92. package/optimize/es/components/flyout/manager/hooks.js +1 -1
  93. package/optimize/es/components/flyout/manager/index.js +2 -2
  94. package/optimize/es/components/flyout/manager/reducer.js +32 -8
  95. package/optimize/es/components/flyout/manager/selectors.js +8 -2
  96. package/optimize/es/components/flyout/manager/store.js +35 -2
  97. package/optimize/es/components/flyout/use_flyout_menu.js +2 -2
  98. package/optimize/es/components/form/form_control_layout/form_control_layout_icons.js +96 -115
  99. package/optimize/es/components/notification_icon/assets/info_fill.js +33 -0
  100. package/optimize/es/components/notification_icon/assets/warning_static.js +39 -0
  101. package/optimize/es/components/notification_icon/notification_icon.js +77 -0
  102. package/optimize/es/components/notification_icon/notification_icon.styles.js +22 -0
  103. package/optimize/es/components/table/mobile/table_sort_mobile.js +59 -82
  104. package/optimize/es/components/toast/global_toast_list.js +31 -6
  105. package/optimize/es/components/toast/global_toast_list.styles.js +31 -7
  106. package/optimize/es/components/toast/toast.js +143 -47
  107. package/optimize/es/components/toast/toast.styles.js +35 -47
  108. package/optimize/es/components/toast/toast_action.js +33 -0
  109. package/optimize/es/components/toast/types.js +9 -0
  110. package/optimize/es/components/tool_tip/tool_tip.js +3 -3
  111. package/optimize/lib/components/banner/banner.js +1 -2
  112. package/optimize/lib/components/banner/banner.styles.js +1 -1
  113. package/optimize/lib/components/basic_table/basic_table.js +17 -4
  114. package/optimize/lib/components/basic_table/basic_table.styles.js +19 -1
  115. package/optimize/lib/components/basic_table/index.js +8 -1
  116. package/optimize/lib/components/basic_table/pagination_bar.js +19 -4
  117. package/optimize/lib/components/basic_table/pagination_bar.styles.js +26 -0
  118. package/optimize/lib/components/basic_table/panel.styles.js +20 -0
  119. package/optimize/lib/components/basic_table/use_panel_props.js +33 -0
  120. package/optimize/lib/components/date_picker/auto_refresh/refresh_interval.js +170 -194
  121. package/optimize/lib/components/flyout/flyout.component.js +10 -6
  122. package/optimize/lib/components/flyout/flyout_menu.js +98 -18
  123. package/optimize/lib/components/flyout/flyout_menu.styles.js +2 -1
  124. package/optimize/lib/components/flyout/manager/actions.js +21 -1
  125. package/optimize/lib/components/flyout/manager/flyout_managed.js +41 -17
  126. package/optimize/lib/components/flyout/manager/hooks.js +6 -0
  127. package/optimize/lib/components/flyout/manager/index.js +12 -0
  128. package/optimize/lib/components/flyout/manager/reducer.js +31 -7
  129. package/optimize/lib/components/flyout/manager/selectors.js +9 -3
  130. package/optimize/lib/components/flyout/manager/store.js +34 -1
  131. package/optimize/lib/components/flyout/use_flyout_menu.js +2 -2
  132. package/optimize/lib/components/form/form_control_layout/form_control_layout_icons.js +96 -117
  133. package/optimize/lib/components/notification_icon/assets/info_fill.js +41 -0
  134. package/optimize/lib/components/notification_icon/assets/warning_static.js +47 -0
  135. package/optimize/lib/components/notification_icon/notification_icon.js +83 -0
  136. package/optimize/lib/components/notification_icon/notification_icon.styles.js +28 -0
  137. package/optimize/lib/components/notification_icon/svgs/info_fill.svg +3 -0
  138. package/optimize/lib/components/notification_icon/svgs/warning_static.svg +5 -0
  139. package/optimize/lib/components/table/mobile/table_sort_mobile.js +61 -83
  140. package/optimize/lib/components/toast/global_toast_list.js +31 -6
  141. package/optimize/lib/components/toast/global_toast_list.styles.js +30 -7
  142. package/optimize/lib/components/toast/toast.js +146 -47
  143. package/optimize/lib/components/toast/toast.styles.js +33 -45
  144. package/optimize/lib/components/toast/toast_action.js +39 -0
  145. package/optimize/lib/components/toast/types.js +15 -0
  146. package/optimize/lib/components/tool_tip/tool_tip.js +2 -2
  147. package/package.json +7 -5
  148. package/test-env/components/banner/banner.js +1 -2
  149. package/test-env/components/banner/banner.styles.js +1 -1
  150. package/test-env/components/basic_table/basic_table.js +34 -4
  151. package/test-env/components/basic_table/basic_table.styles.js +19 -1
  152. package/test-env/components/basic_table/in_memory_table.js +17 -0
  153. package/test-env/components/basic_table/index.js +8 -1
  154. package/test-env/components/basic_table/pagination_bar.js +19 -4
  155. package/test-env/components/basic_table/pagination_bar.styles.js +26 -0
  156. package/test-env/components/basic_table/panel.styles.js +20 -0
  157. package/test-env/components/basic_table/use_panel_props.js +33 -0
  158. package/test-env/components/date_picker/auto_refresh/refresh_interval.js +170 -220
  159. package/test-env/components/flyout/flyout.component.js +10 -6
  160. package/test-env/components/flyout/flyout_menu.js +121 -19
  161. package/test-env/components/flyout/flyout_menu.styles.js +2 -1
  162. package/test-env/components/flyout/manager/actions.js +21 -1
  163. package/test-env/components/flyout/manager/flyout_child.js +23 -1
  164. package/test-env/components/flyout/manager/flyout_managed.js +41 -17
  165. package/test-env/components/flyout/manager/hooks.js +6 -0
  166. package/test-env/components/flyout/manager/index.js +12 -0
  167. package/test-env/components/flyout/manager/reducer.js +31 -7
  168. package/test-env/components/flyout/manager/selectors.js +9 -3
  169. package/test-env/components/flyout/manager/store.js +34 -1
  170. package/test-env/components/flyout/use_flyout_menu.js +2 -2
  171. package/test-env/components/form/form_control_layout/form_control_layout_icons.js +95 -139
  172. package/test-env/components/notification_icon/assets/info_fill.js +41 -0
  173. package/test-env/components/notification_icon/assets/warning_static.js +47 -0
  174. package/test-env/components/notification_icon/notification_icon.js +46 -0
  175. package/test-env/components/notification_icon/notification_icon.styles.js +28 -0
  176. package/test-env/components/table/mobile/table_sort_mobile.js +61 -98
  177. package/test-env/components/toast/global_toast_list.js +132 -6
  178. package/test-env/components/toast/global_toast_list.styles.js +30 -7
  179. package/test-env/components/toast/toast.js +242 -47
  180. package/test-env/components/toast/toast.styles.js +33 -45
  181. package/test-env/components/toast/toast_action.js +39 -0
  182. package/test-env/components/toast/types.js +15 -0
  183. package/test-env/components/tool_tip/tool_tip.js +2 -2
@@ -8,7 +8,7 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
8
8
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
9
9
  import _inherits from "@babel/runtime/helpers/inherits";
10
10
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
11
- var _excluded = ["className", "loading", "items", "itemId", "columns", "pagination", "sorting", "selection", "onChange", "error", "noItemsMessage", "compressed", "itemIdToExpandedRowMap", "responsiveBreakpoint", "rowProps", "cellProps", "tableCaption", "rowHeader", "tableLayout", "hasBackground", "scrollableInline", "stickyScrollbar", "stickyHeader"],
11
+ var _excluded = ["className", "loading", "items", "itemId", "columns", "pagination", "sorting", "selection", "onChange", "error", "noItemsMessage", "compressed", "itemIdToExpandedRowMap", "responsiveBreakpoint", "rowProps", "cellProps", "tableCaption", "rowHeader", "tableLayout", "hasBackground", "scrollableInline", "stickyScrollbar", "stickyHeader", "panelled"],
12
12
  _excluded2 = ["align", "render", "dataType", "isExpander", "textOnly", "name", "field", "description", "sortable", "footer", "mobileOptions", "nameTooltip"];
13
13
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
14
14
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -40,7 +40,7 @@ import { EuiScreenReaderOnly } from '../accessibility';
40
40
  import { EuiI18n } from '../i18n';
41
41
  import { EuiDelayRender } from '../delay_render';
42
42
  import { htmlIdGenerator } from '../../services/accessibility';
43
- import { euiBasicTableBodyLoading, safariLoadingWorkaround } from './basic_table.styles';
43
+ import { euiBasicTableBodyLoading, euiBasicTableWrapperPanelledStyles, safariLoadingWorkaround } from './basic_table.styles';
44
44
  import { EuiToolTip } from '../tool_tip';
45
45
  import { jsx as ___EmotionJSX } from "@emotion/react";
46
46
  var dataTypesProfiles = {
@@ -360,6 +360,7 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
360
360
  scrollableInline = _this$props2.scrollableInline,
361
361
  stickyScrollbar = _this$props2.stickyScrollbar,
362
362
  stickyHeader = _this$props2.stickyHeader,
363
+ panelled = _this$props2.panelled,
363
364
  rest = _objectWithoutProperties(_this$props2, _excluded);
364
365
  var classes = classNames('euiBasicTable', {
365
366
  'euiBasicTable-loading': loading
@@ -381,8 +382,9 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
381
382
  loading = _this$props3.loading,
382
383
  scrollableInline = _this$props3.scrollableInline,
383
384
  stickyScrollbar = _this$props3.stickyScrollbar,
384
- stickyHeader = _this$props3.stickyHeader;
385
- return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(EuiTableHeaderMobile, {
385
+ stickyHeader = _this$props3.stickyHeader,
386
+ panelled = _this$props3.panelled;
387
+ var content = ___EmotionJSX(React.Fragment, null, ___EmotionJSX(EuiTableHeaderMobile, {
386
388
  responsiveBreakpoint: responsiveBreakpoint
387
389
  }, this.renderSelectAll(true), this.renderTableMobileSort()), ___EmotionJSX(OverrideCopiedTabularContent, null, ___EmotionJSX(EuiTable, {
388
390
  id: this.tableId,
@@ -395,6 +397,13 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
395
397
  stickyHeader: stickyHeader,
396
398
  css: loading && safariLoadingWorkaround
397
399
  }, this.renderTableCaption(), this.renderTableHead(), this.renderTableBody(), this.renderTableFooter())));
400
+ if (panelled) {
401
+ return ___EmotionJSX("div", {
402
+ css: panelled && euiBasicTableWrapperPanelledStyles(responsiveBreakpoint),
403
+ "data-test-subj": "euiBasicTablePanelledWrapper"
404
+ }, content);
405
+ }
406
+ return content;
398
407
  }
399
408
  }, {
400
409
  key: "renderTableMobileSort",
@@ -951,7 +960,9 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
951
960
  error = _this$props11.error,
952
961
  pagination = _this$props11.pagination,
953
962
  tableCaption = _this$props11.tableCaption,
954
- onChange = _this$props11.onChange;
963
+ onChange = _this$props11.onChange,
964
+ panelled = _this$props11.panelled,
965
+ responsiveBreakpoint = _this$props11.responsiveBreakpoint;
955
966
  if (!error && pagination && pagination.totalItemCount > 0) {
956
967
  if (!onChange) {
957
968
  throw new Error("The Basic Table is configured with pagination but [onChange] is\n not configured. This callback must be implemented to handle pagination changes");
@@ -965,6 +976,8 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
965
976
  }, function (tablePagination) {
966
977
  return ___EmotionJSX(PaginationBar, {
967
978
  pagination: pagination,
979
+ panelled: panelled,
980
+ responsiveBreakpoint: responsiveBreakpoint,
968
981
  onPageSizeChange: _this7.onPageSizeChange.bind(_this7),
969
982
  onPageChange: _this7.onPageChange.bind(_this7),
970
983
  "aria-controls": _this7.tableId,
@@ -10,7 +10,8 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
10
10
  */
11
11
 
12
12
  import { css, keyframes } from '@emotion/react';
13
- import { logicalCSS, euiCantAnimate, highContrastModeStyles, preventForcedColors } from '../../global_styling';
13
+ import { logicalCSS, euiCantAnimate, highContrastModeStyles, preventForcedColors, euiMinBreakpoint } from '../../global_styling';
14
+ import { EUI_BASIC_TABLE_PANEL_CLASS_NAME } from './use_panel_props';
14
15
  var tableLoadingLine = keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n from {\n ", "\n ", "\n }\n\n 20% {\n ", "\n ", "\n }\n\n 80% {\n ", "\n ", "\n }\n\n 100% {\n ", "\n ", "\n }\n"])), logicalCSS('left', 0), logicalCSS('width', 0), logicalCSS('left', 0), logicalCSS('width', '40%'), logicalCSS('left', '60%'), logicalCSS('width', '40%'), logicalCSS('left', '100%'), logicalCSS('width', 0));
15
16
  export var euiBasicTableBodyLoading = function euiBasicTableBodyLoading(euiThemeContext) {
16
17
  var euiTheme = euiThemeContext.euiTheme;
@@ -19,6 +20,23 @@ export var euiBasicTableBodyLoading = function euiBasicTableBodyLoading(euiTheme
19
20
  }), ";}};label:euiBasicTableBodyLoading;");
20
21
  };
21
22
 
23
+ /**
24
+ * @internal
25
+ */
26
+ export var euiBasicTableWrapperPanelledStyles = function euiBasicTableWrapperPanelledStyles(responsiveBreakpoint) {
27
+ return function (theme) {
28
+ var euiTheme = theme.euiTheme;
29
+ var styles = /*#__PURE__*/css("border:", euiTheme.border.thin, ";border-block-end-width:0;padding-block-start:", euiTheme.border.width.thin, ";border-radius:", euiTheme.border.radius.medium, ";.euiTable{border-radius:", euiTheme.border.radius.medium, ";}.", EUI_BASIC_TABLE_PANEL_CLASS_NAME, "+.euiBasicTable &{border-start-start-radius:0;border-start-end-radius:0;.euiTable{border-start-start-radius:0;border-start-end-radius:0;}}&:not(:last-child),&:has(+ .", EUI_BASIC_TABLE_PANEL_CLASS_NAME, "){border-end-start-radius:0;border-end-end-radius:0;.euiTable{border-end-start-radius:0;border-end-end-radius:0;}};label:styles;");
30
+ if (responsiveBreakpoint === true) {
31
+ return null;
32
+ }
33
+ if (!responsiveBreakpoint) {
34
+ return styles;
35
+ }
36
+ return /*#__PURE__*/css(euiMinBreakpoint(theme, responsiveBreakpoint), "{", styles, ";};label:euiBasicTableWrapperPanelledStyles;");
37
+ };
38
+ };
39
+
22
40
  // Fix to make the loading indicator position correctly in Safari
23
41
  // For whatever annoying reason, Safari doesn't respect `position: relative;`
24
42
  // on `tbody` without `position: relative` on the parent `table`
@@ -7,4 +7,5 @@
7
7
  */
8
8
 
9
9
  export { EuiBasicTable } from './basic_table';
10
- export { EuiInMemoryTable } from './in_memory_table';
10
+ export { EuiInMemoryTable } from './in_memory_table';
11
+ export { useEuiBasicTablePanelProps } from './use_panel_props';
@@ -7,11 +7,24 @@
7
7
  */
8
8
 
9
9
  import React, { useEffect } from 'react';
10
- import { EuiSpacer } from '../spacer';
10
+ import { useEuiMemoizedStyles } from '../../services';
11
11
  import { EuiTablePagination, useEuiTablePaginationDefaults } from '../table/table_pagination';
12
+ import { useIsEuiTableResponsive } from '../table/mobile/responsive_context';
13
+ import { euiBasicTablePaginationBarStyles } from './pagination_bar.styles';
14
+
15
+ /**
16
+ * @internal
17
+ */
12
18
  import { jsx as ___EmotionJSX } from "@emotion/react";
19
+ /**
20
+ * An internal utility component that renders EuiTablePagination with
21
+ * proper configuration and handles the `panelled` styles.
22
+ * @internal
23
+ */
13
24
  export var PaginationBar = function PaginationBar(_ref) {
14
25
  var pagination = _ref.pagination,
26
+ panelled = _ref.panelled,
27
+ responsiveBreakpoint = _ref.responsiveBreakpoint,
15
28
  onPageSizeChange = _ref.onPageSizeChange,
16
29
  onPageChange = _ref.onPageChange,
17
30
  ariaControls = _ref['aria-controls'],
@@ -26,14 +39,16 @@ export var PaginationBar = function PaginationBar(_ref) {
26
39
  _pagination$showPerPa = pagination.showPerPageOptions,
27
40
  showPerPageOptions = _pagination$showPerPa === void 0 ? defaults.showPerPageOptions : _pagination$showPerPa;
28
41
  var pageCount = pageSize ? Math.ceil(totalItemCount / pageSize) : 1;
42
+ var styles = useEuiMemoizedStyles(euiBasicTablePaginationBarStyles);
43
+ var isResponsive = useIsEuiTableResponsive(responsiveBreakpoint);
29
44
  useEffect(function () {
30
45
  if (pageCount < pageIndex + 1) {
31
46
  onPageChange === null || onPageChange === void 0 || onPageChange(pageCount - 1);
32
47
  }
33
48
  }, [pageCount, onPageChange, pageIndex]);
34
- return ___EmotionJSX("div", null, ___EmotionJSX(EuiSpacer, {
35
- size: "m"
36
- }), ___EmotionJSX(EuiTablePagination, {
49
+ return ___EmotionJSX("div", {
50
+ css: [styles.root, !isResponsive && panelled && styles.panelled, ";label:PaginationBar;"]
51
+ }, ___EmotionJSX(EuiTablePagination, {
37
52
  activePage: pageIndex,
38
53
  showPerPageOptions: showPerPageOptions,
39
54
  itemsPerPage: pageSize,
@@ -0,0 +1,21 @@
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
+ import { logicalShorthandCSS } from '../../global_styling';
11
+
12
+ /**
13
+ * @internal
14
+ */
15
+ export var euiBasicTablePaginationBarStyles = function euiBasicTablePaginationBarStyles(theme) {
16
+ var euiTheme = theme.euiTheme;
17
+ return {
18
+ root: /*#__PURE__*/css(logicalShorthandCSS('padding', "".concat(euiTheme.size.xs, " ").concat(euiTheme.size.s)), ";;label:root;"),
19
+ panelled: /*#__PURE__*/css("background:", euiTheme.colors.backgroundBaseSubdued, ";border:", euiTheme.border.thin, ";border-block-start-width:0;", logicalShorthandCSS('border-radius', "0 0 ".concat(euiTheme.border.radius.medium, " ").concat(euiTheme.border.radius.medium)), ";;label:panelled;")
20
+ };
21
+ };
@@ -0,0 +1,14 @@
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
+ import { logicalShorthandCSS } from '../../global_styling';
11
+ export var euiBasicTablePanelStyles = function euiBasicTablePanelStyles(_ref) {
12
+ var euiTheme = _ref.euiTheme;
13
+ return /*#__PURE__*/css("background-color:", euiTheme.colors.backgroundBaseSubdued, ";border:", euiTheme.border.thin, ";border-block-end-width:0;", logicalShorthandCSS('border-radius', "".concat(euiTheme.border.radius.medium, " ").concat(euiTheme.border.radius.medium, " 0 0")), "&+&{border-start-start-radius:0;border-start-end-radius:0;};label:euiBasicTablePanelStyles;");
14
+ };
@@ -0,0 +1,28 @@
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 { useEuiMemoizedStyles } from '../../services';
10
+ import { euiBasicTablePanelStyles } from './panel.styles';
11
+
12
+ /**
13
+ * @internal
14
+ */
15
+ export var EUI_BASIC_TABLE_PANEL_CLASS_NAME = 'euiBasicTablePanel';
16
+
17
+ /**
18
+ * A utility hook that returns props needed to be passed to element(s) being
19
+ * a part of the paneled table look and feel (e.g., a toolbar above the table).
20
+ * @beta
21
+ */
22
+ export var useEuiBasicTablePanelProps = function useEuiBasicTablePanelProps() {
23
+ var css = useEuiMemoizedStyles(euiBasicTablePanelStyles);
24
+ return {
25
+ css: css,
26
+ className: EUI_BASIC_TABLE_PANEL_CLASS_NAME
27
+ };
28
+ };
@@ -1,14 +1,7 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
- import _createClass from "@babel/runtime/helpers/createClass";
4
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
5
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
- import _inherits from "@babel/runtime/helpers/inherits";
7
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
8
3
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
9
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
10
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
11
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
12
5
  /*
13
6
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
14
7
  * or more contributor license agreements. Licensed under the Elastic License
@@ -17,13 +10,13 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
17
10
  * Side Public License, v 1.
18
11
  */
19
12
 
20
- import React, { Component } from 'react';
21
- import { htmlIdGenerator } from '../../../services';
13
+ import React, { useState } from 'react';
14
+ import { useGeneratedHtmlId } from '../../../services';
22
15
  import { EuiI18n } from '../../i18n';
23
16
  import { EuiFlexGroup, EuiFlexItem } from '../../flex';
24
17
  import { EuiSelect, EuiFieldNumber, EuiFormLabel, EuiSwitch } from '../../form';
25
18
  import { EuiScreenReaderOnly } from '../../accessibility';
26
- import { RenderI18nTimeOptions } from '../super_date_picker/time_options';
19
+ import { useI18nTimeOptions } from '../super_date_picker/time_options';
27
20
  import { EuiQuickSelectPanel } from '../super_date_picker/quick_select_popover/quick_select_panel';
28
21
  import { jsx as ___EmotionJSX } from "@emotion/react";
29
22
  var MILLISECONDS_IN_SECOND = 1000;
@@ -67,198 +60,181 @@ var getMinInterval = function getMinInterval(minInterval, unit) {
67
60
  value = _fromMilliseconds.value;
68
61
  return Math.floor(value || 0);
69
62
  };
70
- export var EuiRefreshInterval = /*#__PURE__*/function (_Component) {
71
- function EuiRefreshInterval() {
72
- var _this;
73
- _classCallCheck(this, EuiRefreshInterval);
74
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
75
- args[_key] = arguments[_key];
63
+ export var EuiRefreshInterval = function EuiRefreshInterval(_ref) {
64
+ var _ref$isPaused = _ref.isPaused,
65
+ isPaused = _ref$isPaused === void 0 ? true : _ref$isPaused,
66
+ _ref$refreshInterval = _ref.refreshInterval,
67
+ refreshInterval = _ref$refreshInterval === void 0 ? 1000 : _ref$refreshInterval,
68
+ _ref$minInterval = _ref.minInterval,
69
+ minInterval = _ref$minInterval === void 0 ? 0 : _ref$minInterval,
70
+ intervalUnits = _ref.intervalUnits,
71
+ onRefreshChange = _ref.onRefreshChange;
72
+ var _useState = useState(function () {
73
+ return _objectSpread(_objectSpread({}, fromMilliseconds(refreshInterval || 0, intervalUnits)), {}, {
74
+ min: getMinInterval(minInterval, intervalUnits)
75
+ });
76
+ }),
77
+ _useState2 = _slicedToArray(_useState, 2),
78
+ state = _useState2[0],
79
+ setState = _useState2[1];
80
+ var refreshSelectionId = useGeneratedHtmlId({
81
+ prefix: 'euiRefreshInterval'
82
+ });
83
+ var _useI18nTimeOptions = useI18nTimeOptions(),
84
+ refreshUnitsOptions = _useI18nTimeOptions.refreshUnitsOptions;
85
+ var applyRefreshInterval = function applyRefreshInterval(nextState) {
86
+ var units = nextState.units,
87
+ value = nextState.value;
88
+ if (value === '') {
89
+ return;
76
90
  }
77
- _this = _callSuper(this, EuiRefreshInterval, [].concat(args));
78
- _defineProperty(_this, "state", _objectSpread(_objectSpread({}, fromMilliseconds(_this.props.refreshInterval || 0, _this.props.intervalUnits)), {}, {
79
- min: getMinInterval(_this.props.minInterval, _this.props.intervalUnits)
80
- }));
81
- _defineProperty(_this, "generateId", htmlIdGenerator());
82
- _defineProperty(_this, "refreshSelectionId", _this.generateId());
83
- _defineProperty(_this, "onValueChange", function (event) {
84
- var sanitizedValue = parseFloat(event.target.value);
85
- _this.setState({
86
- value: isNaN(sanitizedValue) ? '' : sanitizedValue
87
- }, _this.applyRefreshInterval);
88
- });
89
- _defineProperty(_this, "onUnitsChange", function (event) {
90
- var units = event.target.value;
91
- _this.setState({
92
- units: units,
93
- min: getMinInterval(_this.props.minInterval, units)
94
- }, _this.applyRefreshInterval);
95
- });
96
- _defineProperty(_this, "startRefresh", function () {
97
- var onRefreshChange = _this.props.onRefreshChange;
98
- var _this$state = _this.state,
99
- value = _this$state.value,
100
- units = _this$state.units;
101
- if (value !== '' && value > 0 && onRefreshChange !== undefined) {
102
- onRefreshChange({
103
- refreshInterval: toMilliseconds(units, value),
104
- intervalUnits: units,
105
- isPaused: false
106
- });
107
- }
91
+ if (!onRefreshChange) {
92
+ return;
93
+ }
94
+ var refreshIntervalMs = Math.max(toMilliseconds(units, value), minInterval || 0);
95
+ onRefreshChange({
96
+ refreshInterval: refreshIntervalMs,
97
+ intervalUnits: units,
98
+ isPaused: refreshIntervalMs <= 0 ? true : !!isPaused
108
99
  });
109
- _defineProperty(_this, "handleKeyDown", function (_ref) {
110
- var key = _ref.key;
111
- if (key === 'Enter') {
112
- _this.startRefresh();
113
- }
100
+ };
101
+ var onValueChange = function onValueChange(event) {
102
+ var sanitizedValue = parseFloat(event.target.value);
103
+ var newValue = isNaN(sanitizedValue) ? '' : sanitizedValue;
104
+ var nextState = _objectSpread(_objectSpread({}, state), {}, {
105
+ value: newValue
114
106
  });
115
- _defineProperty(_this, "applyRefreshInterval", function () {
116
- var _this$props = _this.props,
117
- onRefreshChange = _this$props.onRefreshChange,
118
- isPaused = _this$props.isPaused,
119
- minInterval = _this$props.minInterval;
120
- var _this$state2 = _this.state,
121
- units = _this$state2.units,
122
- value = _this$state2.value;
123
- if (value === '') {
124
- return;
125
- }
126
- if (!onRefreshChange) {
127
- return;
128
- }
129
- var refreshInterval = Math.max(toMilliseconds(units, value), minInterval || 0);
130
- onRefreshChange({
131
- refreshInterval: refreshInterval,
132
- intervalUnits: units,
133
- isPaused: refreshInterval <= 0 ? true : !!isPaused
134
- });
107
+ setState(nextState);
108
+ applyRefreshInterval(nextState);
109
+ };
110
+ var onUnitsChange = function onUnitsChange(event) {
111
+ var units = event.target.value;
112
+ var nextState = _objectSpread(_objectSpread({}, state), {}, {
113
+ units: units,
114
+ min: getMinInterval(minInterval, units)
135
115
  });
136
- _defineProperty(_this, "toggleRefresh", function () {
137
- var _this$props2 = _this.props,
138
- onRefreshChange = _this$props2.onRefreshChange,
139
- isPaused = _this$props2.isPaused;
140
- var _this$state3 = _this.state,
141
- units = _this$state3.units,
142
- value = _this$state3.value;
143
- if (!onRefreshChange || value === '') {
144
- return;
145
- }
116
+ setState(nextState);
117
+ applyRefreshInterval(nextState);
118
+ };
119
+ var startRefresh = function startRefresh() {
120
+ var value = state.value,
121
+ units = state.units;
122
+ if (value !== '' && value > 0 && onRefreshChange !== undefined) {
146
123
  onRefreshChange({
147
124
  refreshInterval: toMilliseconds(units, value),
148
125
  intervalUnits: units,
149
- isPaused: !isPaused
126
+ isPaused: false
150
127
  });
128
+ }
129
+ };
130
+ var handleKeyDown = function handleKeyDown(_ref2) {
131
+ var key = _ref2.key;
132
+ if (key === 'Enter') {
133
+ startRefresh();
134
+ }
135
+ };
136
+ var toggleRefresh = function toggleRefresh() {
137
+ if (!onRefreshChange || state.value === '') {
138
+ return;
139
+ }
140
+ var units = state.units,
141
+ value = state.value;
142
+ onRefreshChange({
143
+ refreshInterval: toMilliseconds(units, value),
144
+ intervalUnits: units,
145
+ isPaused: !isPaused
151
146
  });
152
- _defineProperty(_this, "renderScreenReaderText", function (refreshUnitsOptions) {
153
- var isPaused = _this.props.isPaused;
154
- var _this$state4 = _this.state,
155
- value = _this$state4.value,
156
- units = _this$state4.units;
157
- var options = refreshUnitsOptions.find(function (_ref2) {
158
- var value = _ref2.value;
159
- return value === units;
160
- });
161
- var optionText = options ? options.text : '';
162
- var fullDescription = isPaused ? ___EmotionJSX(EuiI18n, {
163
- token: "euiRefreshInterval.fullDescriptionOff",
164
- default: "Refresh is off, interval set to {optionValue} {optionText}.",
165
- values: {
166
- optionValue: value,
167
- optionText: optionText
168
- }
169
- }) : ___EmotionJSX(EuiI18n, {
170
- token: "euiRefreshInterval.fullDescriptionOn",
171
- default: "Refresh is on, interval set to {optionValue} {optionText}.",
172
- values: {
173
- optionValue: value,
174
- optionText: optionText
175
- }
176
- });
177
- return ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("p", {
178
- id: _this.refreshSelectionId
179
- }, fullDescription));
147
+ };
148
+ var renderScreenReaderText = function renderScreenReaderText() {
149
+ var value = state.value,
150
+ units = state.units;
151
+ var options = refreshUnitsOptions.find(function (_ref3) {
152
+ var value = _ref3.value;
153
+ return value === units;
180
154
  });
181
- return _this;
182
- }
183
- _inherits(EuiRefreshInterval, _Component);
184
- return _createClass(EuiRefreshInterval, [{
185
- key: "render",
186
- value: function render() {
187
- var _this2 = this;
188
- var isPaused = this.props.isPaused;
189
- var _this$state5 = this.state,
190
- value = _this$state5.value,
191
- units = _this$state5.units,
192
- min = _this$state5.min;
193
- return ___EmotionJSX(EuiI18n, {
194
- tokens: ['euiRefreshInterval.toggleLabel', 'euiRefreshInterval.toggleAriaLabel', 'euiRefreshInterval.valueAriaLabel', 'euiRefreshInterval.unitsAriaLabel'],
195
- defaults: ['Refresh every', 'Toggle refresh', 'Refresh interval value', 'Refresh interval units']
196
- }, function (_ref3) {
197
- var _ref4 = _slicedToArray(_ref3, 4),
198
- toggleLabel = _ref4[0],
199
- toggleAriaLabel = _ref4[1],
200
- valueAriaLabel = _ref4[2],
201
- unitsAriaLabel = _ref4[3];
202
- return ___EmotionJSX(RenderI18nTimeOptions, null, function (_ref5) {
203
- var refreshUnitsOptions = _ref5.refreshUnitsOptions;
204
- return ___EmotionJSX(EuiQuickSelectPanel, null, ___EmotionJSX(EuiFlexGroup, {
205
- alignItems: "center",
206
- gutterSize: "s",
207
- responsive: false,
208
- wrap: true
209
- }, ___EmotionJSX(EuiFlexItem, {
210
- grow: false
211
- }, ___EmotionJSX(EuiSwitch, {
212
- "data-test-subj": "superDatePickerToggleRefreshButton",
213
- checked: !isPaused,
214
- onChange: _this2.toggleRefresh,
215
- compressed: true
216
- // The IDs attached to this visible label are unused - we override with our own aria-label
217
- ,
218
- label: ___EmotionJSX(EuiFormLabel, null, toggleLabel),
219
- "aria-label": toggleAriaLabel,
220
- "aria-labelledby": undefined,
221
- "aria-describedby": _this2.refreshSelectionId
222
- })), ___EmotionJSX(EuiFlexItem, {
223
- style: {
224
- minWidth: 60
225
- }
226
- }, ___EmotionJSX(EuiFieldNumber, {
227
- compressed: true,
228
- fullWidth: true,
229
- value: value,
230
- min: min,
231
- onChange: _this2.onValueChange,
232
- onKeyDown: _this2.handleKeyDown,
233
- isInvalid: !isPaused && (value === '' || value <= 0),
234
- disabled: isPaused,
235
- "aria-label": valueAriaLabel,
236
- "aria-describedby": _this2.refreshSelectionId,
237
- "data-test-subj": "superDatePickerRefreshIntervalInput"
238
- })), ___EmotionJSX(EuiFlexItem, {
239
- style: {
240
- minWidth: 100
241
- },
242
- grow: 2
243
- }, ___EmotionJSX(EuiSelect, {
244
- compressed: true,
245
- fullWidth: true,
246
- "aria-label": unitsAriaLabel,
247
- "aria-describedby": _this2.refreshSelectionId,
248
- value: units,
249
- disabled: isPaused,
250
- options: refreshUnitsOptions,
251
- onChange: _this2.onUnitsChange,
252
- onKeyDown: _this2.handleKeyDown,
253
- "data-test-subj": "superDatePickerRefreshIntervalUnitsSelect"
254
- }))), _this2.renderScreenReaderText(refreshUnitsOptions));
255
- });
256
- });
257
- }
258
- }]);
259
- }(Component);
260
- _defineProperty(EuiRefreshInterval, "defaultProps", {
261
- isPaused: true,
262
- refreshInterval: 1000,
263
- minInterval: 0
264
- });
155
+ var optionText = options ? options.text : '';
156
+ var fullDescription = isPaused ? ___EmotionJSX(EuiI18n, {
157
+ token: "euiRefreshInterval.fullDescriptionOff",
158
+ default: "Refresh is off, interval set to {optionValue} {optionText}.",
159
+ values: {
160
+ optionValue: value,
161
+ optionText: optionText
162
+ }
163
+ }) : ___EmotionJSX(EuiI18n, {
164
+ token: "euiRefreshInterval.fullDescriptionOn",
165
+ default: "Refresh is on, interval set to {optionValue} {optionText}.",
166
+ values: {
167
+ optionValue: value,
168
+ optionText: optionText
169
+ }
170
+ });
171
+ return ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("p", {
172
+ id: refreshSelectionId
173
+ }, fullDescription));
174
+ };
175
+ var value = state.value,
176
+ units = state.units,
177
+ min = state.min;
178
+ return ___EmotionJSX(EuiI18n, {
179
+ tokens: ['euiRefreshInterval.toggleLabel', 'euiRefreshInterval.toggleAriaLabel', 'euiRefreshInterval.valueAriaLabel', 'euiRefreshInterval.unitsAriaLabel'],
180
+ defaults: ['Refresh every', 'Toggle refresh', 'Refresh interval value', 'Refresh interval units']
181
+ }, function (_ref4) {
182
+ var _ref5 = _slicedToArray(_ref4, 4),
183
+ toggleLabel = _ref5[0],
184
+ toggleAriaLabel = _ref5[1],
185
+ valueAriaLabel = _ref5[2],
186
+ unitsAriaLabel = _ref5[3];
187
+ return ___EmotionJSX(EuiQuickSelectPanel, null, ___EmotionJSX(EuiFlexGroup, {
188
+ alignItems: "center",
189
+ gutterSize: "s",
190
+ responsive: false,
191
+ wrap: true
192
+ }, ___EmotionJSX(EuiFlexItem, {
193
+ grow: false
194
+ }, ___EmotionJSX(EuiSwitch, {
195
+ "data-test-subj": "superDatePickerToggleRefreshButton",
196
+ checked: !isPaused,
197
+ onChange: toggleRefresh,
198
+ compressed: true
199
+ // The IDs attached to this visible label are unused - we override with our own aria-label
200
+ ,
201
+ label: ___EmotionJSX(EuiFormLabel, null, toggleLabel),
202
+ "aria-label": toggleAriaLabel,
203
+ "aria-labelledby": undefined,
204
+ "aria-describedby": refreshSelectionId
205
+ })), ___EmotionJSX(EuiFlexItem, {
206
+ style: {
207
+ minWidth: 60
208
+ }
209
+ }, ___EmotionJSX(EuiFieldNumber, {
210
+ compressed: true,
211
+ fullWidth: true,
212
+ value: value,
213
+ min: min,
214
+ onChange: onValueChange,
215
+ onKeyDown: handleKeyDown,
216
+ isInvalid: !isPaused && (value === '' || value <= 0),
217
+ disabled: isPaused,
218
+ "aria-label": valueAriaLabel,
219
+ "aria-describedby": refreshSelectionId,
220
+ "data-test-subj": "superDatePickerRefreshIntervalInput"
221
+ })), ___EmotionJSX(EuiFlexItem, {
222
+ style: {
223
+ minWidth: 100
224
+ },
225
+ grow: 2
226
+ }, ___EmotionJSX(EuiSelect, {
227
+ compressed: true,
228
+ fullWidth: true,
229
+ "aria-label": unitsAriaLabel,
230
+ "aria-describedby": refreshSelectionId,
231
+ value: units,
232
+ disabled: isPaused,
233
+ options: refreshUnitsOptions,
234
+ onChange: onUnitsChange,
235
+ onKeyDown: handleKeyDown,
236
+ "data-test-subj": "superDatePickerRefreshIntervalUnitsSelect"
237
+ }))), renderScreenReaderText());
238
+ });
239
+ };
240
+ EuiRefreshInterval.displayName = 'EuiRefreshInterval';