@elastic/eui 92.0.0 → 92.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 (156) hide show
  1. package/dist/eui_theme_dark.css +3 -18
  2. package/dist/eui_theme_dark.min.css +1 -1
  3. package/dist/eui_theme_light.css +3 -18
  4. package/dist/eui_theme_light.min.css +1 -1
  5. package/es/components/aspect_ratio/aspect_ratio.js +1 -1
  6. package/es/components/collapsible_nav_beta/collapsible_nav_body_footer.js +7 -3
  7. package/es/components/collapsible_nav_beta/collapsible_nav_body_footer.styles.js +4 -4
  8. package/es/components/datagrid/body/{data_grid_cell.js → cell/data_grid_cell.js} +56 -209
  9. package/es/components/datagrid/body/{data_grid_cell_actions.js → cell/data_grid_cell_actions.js} +5 -5
  10. package/es/components/datagrid/body/{data_grid_cell_popover.js → cell/data_grid_cell_popover.js} +4 -4
  11. package/es/components/datagrid/body/{data_grid_cell_wrapper.js → cell/data_grid_cell_wrapper.js} +1 -1
  12. package/es/components/datagrid/body/cell/focus_utils.js +166 -0
  13. package/es/components/datagrid/body/cell/index.js +11 -0
  14. package/es/components/datagrid/body/data_grid_body.js +0 -2
  15. package/es/components/datagrid/body/data_grid_body_custom.js +1 -7
  16. package/es/components/datagrid/body/data_grid_body_virtualized.js +1 -7
  17. package/es/components/datagrid/body/footer/data_grid_footer_row.js +1 -2
  18. package/es/components/datagrid/body/header/data_grid_control_header_cell.js +3 -6
  19. package/es/components/datagrid/body/header/data_grid_header_cell.js +27 -12
  20. package/es/components/datagrid/body/header/data_grid_header_cell_wrapper.js +45 -116
  21. package/es/components/datagrid/body/header/data_grid_header_row.js +5 -10
  22. package/es/components/datagrid/body/header/use_data_grid_header.js +3 -14
  23. package/es/components/datagrid/data_grid.js +2 -12
  24. package/es/components/datagrid/utils/focus.js +25 -54
  25. package/es/components/datagrid/utils/scrolling.js +1 -1
  26. package/es/components/flyout/flyout_resizable.js +10 -10
  27. package/es/components/flyout/flyout_resizable.styles.js +12 -6
  28. package/es/components/resizable_container/helpers.js +5 -6
  29. package/es/components/resizable_container/resizable_button.js +13 -4
  30. package/es/components/resizable_container/resizable_button.styles.js +18 -8
  31. package/es/components/resizable_container/resizable_container.js +28 -22
  32. package/es/components/steps/step_number.styles.js +6 -7
  33. package/es/components/tree_view/tree_view.js +9 -2
  34. package/eui.d.ts +125 -90
  35. package/i18ntokens.json +108 -72
  36. package/lib/components/aspect_ratio/aspect_ratio.js +1 -1
  37. package/lib/components/collapsible_nav_beta/collapsible_nav_body_footer.js +7 -3
  38. package/lib/components/collapsible_nav_beta/collapsible_nav_body_footer.styles.js +4 -4
  39. package/lib/components/datagrid/body/{data_grid_cell.js → cell/data_grid_cell.js} +56 -209
  40. package/lib/components/datagrid/body/{data_grid_cell_actions.js → cell/data_grid_cell_actions.js} +5 -5
  41. package/lib/components/datagrid/body/{data_grid_cell_popover.js → cell/data_grid_cell_popover.js} +4 -4
  42. package/lib/components/datagrid/body/{data_grid_cell_wrapper.js → cell/data_grid_cell_wrapper.js} +1 -1
  43. package/lib/components/datagrid/body/cell/focus_utils.js +174 -0
  44. package/lib/components/datagrid/body/cell/index.js +32 -0
  45. package/lib/components/datagrid/body/data_grid_body.js +0 -2
  46. package/lib/components/datagrid/body/data_grid_body_custom.js +2 -8
  47. package/lib/components/datagrid/body/data_grid_body_virtualized.js +2 -8
  48. package/lib/components/datagrid/body/footer/data_grid_footer_row.js +5 -6
  49. package/lib/components/datagrid/body/header/data_grid_control_header_cell.js +3 -6
  50. package/lib/components/datagrid/body/header/data_grid_header_cell.js +35 -20
  51. package/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.js +47 -119
  52. package/lib/components/datagrid/body/header/data_grid_header_row.js +5 -10
  53. package/lib/components/datagrid/body/header/use_data_grid_header.js +10 -24
  54. package/lib/components/datagrid/data_grid.js +4 -14
  55. package/lib/components/datagrid/utils/focus.js +26 -56
  56. package/lib/components/datagrid/utils/scrolling.js +2 -2
  57. package/lib/components/flyout/flyout_resizable.js +10 -10
  58. package/lib/components/flyout/flyout_resizable.styles.js +12 -6
  59. package/lib/components/resizable_container/helpers.js +7 -7
  60. package/lib/components/resizable_container/resizable_button.js +13 -4
  61. package/lib/components/resizable_container/resizable_button.styles.js +18 -8
  62. package/lib/components/resizable_container/resizable_container.js +28 -22
  63. package/lib/components/steps/step_number.styles.js +6 -7
  64. package/lib/components/tree_view/tree_view.js +9 -2
  65. package/optimize/es/components/aspect_ratio/aspect_ratio.js +1 -1
  66. package/optimize/es/components/collapsible_nav_beta/collapsible_nav_body_footer.js +7 -3
  67. package/optimize/es/components/collapsible_nav_beta/collapsible_nav_body_footer.styles.js +4 -4
  68. package/optimize/es/components/datagrid/body/{data_grid_cell.js → cell/data_grid_cell.js} +56 -209
  69. package/optimize/es/components/datagrid/body/{data_grid_cell_actions.js → cell/data_grid_cell_actions.js} +5 -5
  70. package/optimize/es/components/datagrid/body/{data_grid_cell_popover.js → cell/data_grid_cell_popover.js} +4 -4
  71. package/optimize/es/components/datagrid/body/{data_grid_cell_wrapper.js → cell/data_grid_cell_wrapper.js} +1 -1
  72. package/optimize/es/components/datagrid/body/cell/focus_utils.js +153 -0
  73. package/optimize/es/components/datagrid/body/cell/index.js +11 -0
  74. package/optimize/es/components/datagrid/body/data_grid_body_custom.js +1 -5
  75. package/optimize/es/components/datagrid/body/data_grid_body_virtualized.js +1 -5
  76. package/optimize/es/components/datagrid/body/footer/data_grid_footer_row.js +1 -2
  77. package/optimize/es/components/datagrid/body/header/data_grid_control_header_cell.js +2 -4
  78. package/optimize/es/components/datagrid/body/header/data_grid_header_cell.js +25 -10
  79. package/optimize/es/components/datagrid/body/header/data_grid_header_cell_wrapper.js +41 -115
  80. package/optimize/es/components/datagrid/body/header/data_grid_header_row.js +4 -8
  81. package/optimize/es/components/datagrid/body/header/use_data_grid_header.js +3 -13
  82. package/optimize/es/components/datagrid/data_grid.js +2 -12
  83. package/optimize/es/components/datagrid/utils/focus.js +25 -54
  84. package/optimize/es/components/datagrid/utils/scrolling.js +1 -1
  85. package/optimize/es/components/flyout/flyout_resizable.js +10 -10
  86. package/optimize/es/components/flyout/flyout_resizable.styles.js +12 -6
  87. package/optimize/es/components/resizable_container/helpers.js +5 -6
  88. package/optimize/es/components/resizable_container/resizable_button.js +5 -2
  89. package/optimize/es/components/resizable_container/resizable_button.styles.js +18 -8
  90. package/optimize/es/components/resizable_container/resizable_container.js +28 -22
  91. package/optimize/es/components/steps/step_number.styles.js +6 -7
  92. package/optimize/es/components/tree_view/tree_view.js +9 -2
  93. package/optimize/lib/components/aspect_ratio/aspect_ratio.js +1 -1
  94. package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_body_footer.js +7 -3
  95. package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_body_footer.styles.js +4 -4
  96. package/optimize/lib/components/datagrid/body/{data_grid_cell.js → cell/data_grid_cell.js} +56 -209
  97. package/optimize/lib/components/datagrid/body/{data_grid_cell_actions.js → cell/data_grid_cell_actions.js} +5 -5
  98. package/optimize/lib/components/datagrid/body/{data_grid_cell_popover.js → cell/data_grid_cell_popover.js} +4 -4
  99. package/optimize/lib/components/datagrid/body/{data_grid_cell_wrapper.js → cell/data_grid_cell_wrapper.js} +1 -1
  100. package/optimize/lib/components/datagrid/body/cell/focus_utils.js +163 -0
  101. package/optimize/lib/components/datagrid/body/cell/index.js +32 -0
  102. package/optimize/lib/components/datagrid/body/data_grid_body_custom.js +2 -6
  103. package/optimize/lib/components/datagrid/body/data_grid_body_virtualized.js +2 -6
  104. package/optimize/lib/components/datagrid/body/footer/data_grid_footer_row.js +5 -6
  105. package/optimize/lib/components/datagrid/body/header/data_grid_control_header_cell.js +2 -4
  106. package/optimize/lib/components/datagrid/body/header/data_grid_header_cell.js +25 -10
  107. package/optimize/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.js +41 -115
  108. package/optimize/lib/components/datagrid/body/header/data_grid_header_row.js +4 -8
  109. package/optimize/lib/components/datagrid/body/header/use_data_grid_header.js +4 -14
  110. package/optimize/lib/components/datagrid/data_grid.js +4 -14
  111. package/optimize/lib/components/datagrid/utils/focus.js +26 -56
  112. package/optimize/lib/components/datagrid/utils/scrolling.js +2 -2
  113. package/optimize/lib/components/flyout/flyout_resizable.js +10 -10
  114. package/optimize/lib/components/flyout/flyout_resizable.styles.js +12 -6
  115. package/optimize/lib/components/resizable_container/helpers.js +7 -7
  116. package/optimize/lib/components/resizable_container/resizable_button.js +5 -2
  117. package/optimize/lib/components/resizable_container/resizable_button.styles.js +18 -8
  118. package/optimize/lib/components/resizable_container/resizable_container.js +28 -22
  119. package/optimize/lib/components/steps/step_number.styles.js +6 -7
  120. package/optimize/lib/components/tree_view/tree_view.js +9 -2
  121. package/package.json +1 -1
  122. package/src/components/datagrid/body/header/_data_grid_header_row.scss +8 -7
  123. package/test-env/components/aspect_ratio/aspect_ratio.js +1 -1
  124. package/test-env/components/collapsible_nav_beta/collapsible_nav_body_footer.js +7 -3
  125. package/test-env/components/collapsible_nav_beta/collapsible_nav_body_footer.styles.js +4 -4
  126. package/test-env/components/datagrid/body/{data_grid_cell.js → cell/data_grid_cell.js} +56 -209
  127. package/test-env/components/datagrid/body/{data_grid_cell_actions.js → cell/data_grid_cell_actions.js} +5 -5
  128. package/test-env/components/datagrid/body/{data_grid_cell_popover.js → cell/data_grid_cell_popover.js} +4 -4
  129. package/test-env/components/datagrid/body/{data_grid_cell_wrapper.js → cell/data_grid_cell_wrapper.js} +1 -1
  130. package/test-env/components/datagrid/body/cell/focus_utils.js +172 -0
  131. package/test-env/components/datagrid/body/cell/index.js +32 -0
  132. package/test-env/components/datagrid/body/data_grid_body.js +0 -2
  133. package/test-env/components/datagrid/body/data_grid_body_custom.js +2 -8
  134. package/test-env/components/datagrid/body/data_grid_body_virtualized.js +2 -8
  135. package/test-env/components/datagrid/body/footer/data_grid_footer_row.js +5 -6
  136. package/test-env/components/datagrid/body/header/data_grid_control_header_cell.js +3 -6
  137. package/test-env/components/datagrid/body/header/data_grid_header_cell.js +25 -10
  138. package/test-env/components/datagrid/body/header/data_grid_header_cell_wrapper.js +44 -116
  139. package/test-env/components/datagrid/body/header/data_grid_header_row.js +5 -10
  140. package/test-env/components/datagrid/body/header/use_data_grid_header.js +4 -14
  141. package/test-env/components/datagrid/data_grid.js +4 -14
  142. package/test-env/components/datagrid/utils/focus.js +26 -56
  143. package/test-env/components/datagrid/utils/scrolling.js +2 -2
  144. package/test-env/components/flyout/flyout_resizable.js +10 -10
  145. package/test-env/components/flyout/flyout_resizable.styles.js +12 -6
  146. package/test-env/components/resizable_container/helpers.js +7 -7
  147. package/test-env/components/resizable_container/resizable_button.js +13 -4
  148. package/test-env/components/resizable_container/resizable_button.styles.js +18 -8
  149. package/test-env/components/resizable_container/resizable_container.js +28 -22
  150. package/test-env/components/steps/step_number.styles.js +6 -7
  151. package/test-env/components/tree_view/tree_view.js +9 -2
  152. package/es/components/datagrid/body/header/header_is_interactive.js +0 -58
  153. package/lib/components/datagrid/body/header/header_is_interactive.js +0 -63
  154. package/optimize/es/components/datagrid/body/header/header_is_interactive.js +0 -53
  155. package/optimize/lib/components/datagrid/body/header/header_is_interactive.js +0 -61
  156. package/test-env/components/datagrid/body/header/header_is_interactive.js +0 -61
@@ -6,19 +6,9 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.useDataGridHeader = void 0;
8
8
  var _react = _interopRequireWildcard(require("react"));
9
- var _mutation_observer = require("../../../observer/mutation_observer");
10
9
  var _resize_observer = require("../../../observer/resize_observer");
11
- var _focus = require("../../utils/focus");
12
10
  var _data_grid_header_row = require("./data_grid_header_row");
13
11
  var _react2 = require("@emotion/react");
14
- var _excluded = ["handleHeaderMutation"];
15
- /*
16
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
17
- * or more contributor license agreements. Licensed under the Elastic License
18
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
19
- * in compliance with, at your election, the Elastic License 2.0 or the Server
20
- * Side Public License, v 1.
21
- */
22
12
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
13
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
24
14
  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); }
@@ -27,23 +17,20 @@ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructur
27
17
  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); }
28
18
  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; }
29
19
  function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
30
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
31
- 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; }
32
- 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; }
33
- /**
34
- * DRY out setting up the grid header and its refs & observers
35
- */
36
- var useDataGridHeader = function useDataGridHeader(_ref) {
37
- var handleHeaderMutation = _ref.handleHeaderMutation,
38
- props = _objectWithoutProperties(_ref, _excluded);
20
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } /*
21
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
22
+ * or more contributor license agreements. Licensed under the Elastic License
23
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
24
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
25
+ * Side Public License, v 1.
26
+ */ /**
27
+ * DRY out setting up the grid header and its refs & observers
28
+ */
29
+ var useDataGridHeader = function useDataGridHeader(props) {
39
30
  var _useState = (0, _react.useState)(null),
40
31
  _useState2 = _slicedToArray(_useState, 2),
41
32
  headerRowRef = _useState2[0],
42
33
  setHeaderRowRef = _useState2[1];
43
- (0, _mutation_observer.useMutationObserver)(headerRowRef, handleHeaderMutation, {
44
- subtree: true,
45
- childList: true
46
- });
47
34
  var _useResizeObserver = (0, _resize_observer.useResizeObserver)(headerRowRef, 'height'),
48
35
  headerRowHeight = _useResizeObserver.height;
49
36
  var headerRow = (0, _react.useMemo)(function () {
@@ -52,7 +39,6 @@ var useDataGridHeader = function useDataGridHeader(_ref) {
52
39
  }, props));
53
40
  }, Object.values(props)); // eslint-disable-line react-hooks/exhaustive-deps
54
41
 
55
- (0, _focus.useHeaderFocusWorkaround)(props.headerIsInteractive);
56
42
  return {
57
43
  headerRow: headerRow,
58
44
  headerRowHeight: headerRowHeight
@@ -18,8 +18,7 @@ var _controls = require("./controls");
18
18
  var _sorting = require("./utils/sorting");
19
19
  var _focus = require("./utils/focus");
20
20
  var _in_memory = require("./utils/in_memory");
21
- var _header_is_interactive = require("./body/header/header_is_interactive");
22
- var _data_grid_cell_popover = require("./body/data_grid_cell_popover");
21
+ var _cell = require("./body/cell");
23
22
  var _row_count = require("./utils/row_count");
24
23
  var _data_grid_pagination = require("./utils/data_grid_pagination");
25
24
  var _data_grid_schema = require("./utils/data_grid_schema");
@@ -218,20 +217,14 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forward
218
217
  /**
219
218
  * Focus
220
219
  */
221
- var _useHeaderIsInteracti = (0, _header_is_interactive.useHeaderIsInteractive)(contentRef.current),
222
- headerIsInteractive = _useHeaderIsInteracti.headerIsInteractive,
223
- handleHeaderMutation = _useHeaderIsInteracti.handleHeaderMutation;
224
- var _useFocus = (0, _focus.useFocus)({
225
- headerIsInteractive: headerIsInteractive,
226
- gridItemsRendered: gridItemsRendered
227
- }),
220
+ var _useFocus = (0, _focus.useFocus)(),
228
221
  wrappingDivFocusProps = _useFocus.focusProps,
229
222
  focusContext = _objectWithoutProperties(_useFocus, _excluded2);
230
223
 
231
224
  /**
232
225
  * Cell popover
233
226
  */
234
- var _useCellPopover = (0, _data_grid_cell_popover.useCellPopover)(),
227
+ var _useCellPopover = (0, _cell.useCellPopover)(),
235
228
  cellPopoverContext = _useCellPopover.cellPopoverContext,
236
229
  cellPopover = _useCellPopover.cellPopover;
237
230
 
@@ -305,7 +298,7 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forward
305
298
  }
306
299
  return (0, _react2.jsx)(_focus.DataGridFocusContext.Provider, {
307
300
  value: focusContext
308
- }, (0, _react2.jsx)(_data_grid_cell_popover.DataGridCellPopoverContext.Provider, {
301
+ }, (0, _react2.jsx)(_cell.DataGridCellPopoverContext.Provider, {
309
302
  value: cellPopoverContext
310
303
  }, (0, _react2.jsx)(_sorting.DataGridSortingContext.Provider, {
311
304
  value: sortingContext
@@ -352,7 +345,6 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forward
352
345
  rowCount: rowCount,
353
346
  pagination: pagination,
354
347
  hasFooter: !!renderFooterCellValue,
355
- headerIsInteractive: headerIsInteractive,
356
348
  focusContext: focusContext
357
349
  }),
358
350
  "data-test-subj": "euiDataGridBody",
@@ -369,8 +361,6 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forward
369
361
  setVisibleColumns: setVisibleColumns,
370
362
  switchColumnPos: switchColumnPos,
371
363
  onColumnResize: onColumnResize,
372
- headerIsInteractive: headerIsInteractive,
373
- handleHeaderMutation: handleHeaderMutation,
374
364
  schemaDetectors: allSchemaDetectors,
375
365
  pagination: pagination,
376
366
  renderCellValue: renderCellValue,
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.useHeaderFocusWorkaround = exports.useFocus = exports.preventTabbing = exports.notifyCellOfFocusState = exports.getParentCellContent = exports.createKeyDownHandler = exports.DataGridFocusContext = void 0;
6
+ exports.useFocus = exports.preventTabbing = exports.notifyCellOfFocusState = exports.getParentCellContent = exports.createKeyDownHandler = exports.DataGridFocusContext = void 0;
7
7
  var _react = require("react");
8
8
  var _tabbable = require("tabbable");
9
9
  var _services = require("../../../services");
@@ -32,9 +32,7 @@ exports.DataGridFocusContext = DataGridFocusContext;
32
32
  /**
33
33
  * Main focus context and overarching focus state management
34
34
  */
35
- var useFocus = function useFocus(_ref) {
36
- var headerIsInteractive = _ref.headerIsInteractive,
37
- gridItemsRendered = _ref.gridItemsRendered;
35
+ var useFocus = function useFocus() {
38
36
  // Maintain a map of focus cell state callbacks
39
37
  var cellsUpdateFocus = (0, _react.useRef)(new Map());
40
38
  var onFocusUpdate = (0, _react.useCallback)(function (cell, updateFocus) {
@@ -55,14 +53,17 @@ var useFocus = function useFocus(_ref) {
55
53
  focusedCell = _useState4[0],
56
54
  _setFocusedCell = _useState4[1];
57
55
  var setFocusedCell = (0, _react.useCallback)(function (nextFocusedCell) {
58
- // If the x/y coordinates remained the same, don't update. This keeps the focusedCell
59
- // reference stable, and allows it to be used in places that need reference equality.
60
- if (nextFocusedCell[0] === (focusedCell === null || focusedCell === void 0 ? void 0 : focusedCell[0]) && nextFocusedCell[1] === (focusedCell === null || focusedCell === void 0 ? void 0 : focusedCell[1])) {
61
- return;
62
- }
63
- _setFocusedCell(nextFocusedCell);
64
- setIsFocusedCellInView(true); // scrolling.ts ensures focused cells are fully in view
65
- }, [focusedCell]);
56
+ _setFocusedCell(function (prevFocusedCell) {
57
+ // If the x/y coordinates remained the same, don't update. This keeps the focusedCell
58
+ // reference stable, and allows it to be used in places that need reference equality.
59
+ if (nextFocusedCell[0] === (prevFocusedCell === null || prevFocusedCell === void 0 ? void 0 : prevFocusedCell[0]) && nextFocusedCell[1] === (prevFocusedCell === null || prevFocusedCell === void 0 ? void 0 : prevFocusedCell[1])) {
60
+ return prevFocusedCell;
61
+ } else {
62
+ setIsFocusedCellInView(true); // scrolling.ts ensures focused cells are fully in view
63
+ return nextFocusedCell;
64
+ }
65
+ });
66
+ }, []);
66
67
  var previousCell = (0, _react.useRef)(undefined);
67
68
  (0, _react.useEffect)(function () {
68
69
  if (previousCell.current) {
@@ -74,19 +75,8 @@ var useFocus = function useFocus(_ref) {
74
75
  }
75
76
  }, [cellsUpdateFocus, focusedCell]);
76
77
  var focusFirstVisibleInteractiveCell = (0, _react.useCallback)(function () {
77
- if (headerIsInteractive) {
78
- // The header (rowIndex -1) is sticky and will always be in view
79
- setFocusedCell([0, -1]);
80
- } else if (gridItemsRendered.current) {
81
- var _gridItemsRendered$cu = gridItemsRendered.current,
82
- visibleColumnStartIndex = _gridItemsRendered$cu.visibleColumnStartIndex,
83
- visibleRowStartIndex = _gridItemsRendered$cu.visibleRowStartIndex;
84
- setFocusedCell([visibleColumnStartIndex, visibleRowStartIndex]);
85
- } else {
86
- // If the header is non-interactive and there are no rendered cells,
87
- // there's nothing to do - we might as well leave focus on the grid body wrapper
88
- }
89
- }, [setFocusedCell, headerIsInteractive, gridItemsRendered]);
78
+ setFocusedCell([0, -1]);
79
+ }, [setFocusedCell]);
90
80
  var focusProps = (0, _react.useMemo)(function () {
91
81
  return isFocusedCellInView ? {
92
82
  // FireFox allows tabbing to a div that is scrollable, while Chrome does not
@@ -129,16 +119,15 @@ var notifyCellOfFocusState = function notifyCellOfFocusState(cellsUpdateFocus, c
129
119
  * Keydown handler for connecting focus state with keyboard navigation
130
120
  */
131
121
  exports.notifyCellOfFocusState = notifyCellOfFocusState;
132
- var createKeyDownHandler = function createKeyDownHandler(_ref2) {
133
- var gridElement = _ref2.gridElement,
134
- visibleColCount = _ref2.visibleColCount,
135
- visibleRowCount = _ref2.visibleRowCount,
136
- visibleRowStartIndex = _ref2.visibleRowStartIndex,
137
- rowCount = _ref2.rowCount,
138
- pagination = _ref2.pagination,
139
- hasFooter = _ref2.hasFooter,
140
- headerIsInteractive = _ref2.headerIsInteractive,
141
- focusContext = _ref2.focusContext;
122
+ var createKeyDownHandler = function createKeyDownHandler(_ref) {
123
+ var gridElement = _ref.gridElement,
124
+ visibleColCount = _ref.visibleColCount,
125
+ visibleRowCount = _ref.visibleRowCount,
126
+ visibleRowStartIndex = _ref.visibleRowStartIndex,
127
+ rowCount = _ref.rowCount,
128
+ pagination = _ref.pagination,
129
+ hasFooter = _ref.hasFooter,
130
+ focusContext = _ref.focusContext;
142
131
  return function (event) {
143
132
  var focusedCell = focusContext.focusedCell,
144
133
  setFocusedCell = focusContext.setFocusedCell;
@@ -172,8 +161,7 @@ var createKeyDownHandler = function createKeyDownHandler(_ref2) {
172
161
  }
173
162
  } else if (key === _services.keys.ARROW_UP) {
174
163
  event.preventDefault();
175
- var minimumIndex = headerIsInteractive ? -1 : 0;
176
- if (y > minimumIndex) {
164
+ if (y > -1) {
177
165
  setFocusedCell([x, y - 1]);
178
166
  }
179
167
  } else if (key === _services.keys.ARROW_RIGHT) {
@@ -263,22 +251,4 @@ var getParentCellContent = function getParentCellContent(_element) {
263
251
  }
264
252
  return element;
265
253
  };
266
-
267
- /**
268
- * Focus fixes & workarounds
269
- */
270
-
271
- // If the focus is on the header, and the header is no longer interactive,
272
- // move the focus down to the first row
273
- exports.getParentCellContent = getParentCellContent;
274
- var useHeaderFocusWorkaround = function useHeaderFocusWorkaround(headerIsInteractive) {
275
- var _useContext = (0, _react.useContext)(DataGridFocusContext),
276
- focusedCell = _useContext.focusedCell,
277
- setFocusedCell = _useContext.setFocusedCell;
278
- (0, _react.useEffect)(function () {
279
- if (!headerIsInteractive && focusedCell && focusedCell[1] === -1) {
280
- setFocusedCell([focusedCell[0], 0]);
281
- }
282
- }, [headerIsInteractive, focusedCell, setFocusedCell]);
283
- };
284
- exports.useHeaderFocusWorkaround = useHeaderFocusWorkaround;
254
+ exports.getParentCellContent = getParentCellContent;
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.useScrollCellIntoView = exports.useScrollBars = exports.useScroll = void 0;
8
8
  var _react = _interopRequireWildcard(require("react"));
9
- var _data_grid_cell_popover = require("../body/data_grid_cell_popover");
9
+ var _cell = require("../body/cell");
10
10
  var _focus = require("./focus");
11
11
  var _react2 = require("@emotion/react");
12
12
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -39,7 +39,7 @@ var useScroll = function useScroll(args) {
39
39
  });
40
40
  }
41
41
  }, [focusedCell, scrollCellIntoView]);
42
- var _useContext2 = (0, _react.useContext)(_data_grid_cell_popover.DataGridCellPopoverContext),
42
+ var _useContext2 = (0, _react.useContext)(_cell.DataGridCellPopoverContext),
43
43
  popoverIsOpen = _useContext2.popoverIsOpen,
44
44
  cellLocation = _useContext2.cellLocation;
45
45
  (0, _react.useEffect)(function () {
@@ -8,10 +8,11 @@ exports.EuiFlyoutResizable = void 0;
8
8
  var _react = _interopRequireWildcard(require("react"));
9
9
  var _services = require("../../services");
10
10
  var _resizable_container = require("../resizable_container");
11
+ var _helpers = require("../resizable_container/helpers");
11
12
  var _flyout = require("./flyout");
12
13
  var _flyout_resizable = require("./flyout_resizable.styles");
13
14
  var _react2 = require("@emotion/react");
14
- var _excluded = ["size", "maxWidth", "minWidth", "side", "children"];
15
+ var _excluded = ["size", "maxWidth", "minWidth", "side", "type", "children"];
15
16
  /*
16
17
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
17
18
  * or more contributor license agreements. Licensed under the Elastic License
@@ -37,11 +38,13 @@ var EuiFlyoutResizable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref
37
38
  minWidth = _ref$minWidth === void 0 ? 200 : _ref$minWidth,
38
39
  _ref$side = _ref.side,
39
40
  side = _ref$side === void 0 ? 'right' : _ref$side,
41
+ _ref$type = _ref.type,
42
+ type = _ref$type === void 0 ? 'overlay' : _ref$type,
40
43
  children = _ref.children,
41
44
  rest = _objectWithoutProperties(_ref, _excluded);
42
45
  var euiTheme = (0, _services.useEuiTheme)();
43
46
  var styles = (0, _flyout_resizable.euiFlyoutResizableButtonStyles)(euiTheme);
44
- var cssStyles = [styles.euiFlyoutResizableButton, styles[side]];
47
+ var cssStyles = [styles.euiFlyoutResizableButton, styles[type][side]];
45
48
  var getFlyoutMinMaxWidth = (0, _react.useCallback)(function (width) {
46
49
  return Math.min(Math.max(width, minWidth), maxWidth || Infinity, window.innerWidth - 20 // Leave some offset
47
50
  );
@@ -75,7 +78,7 @@ var EuiFlyoutResizable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref
75
78
  return modifier;
76
79
  }, [side, flyoutRef]);
77
80
  var onMouseMove = (0, _react.useCallback)(function (e) {
78
- var mouseOffset = getMouseOrTouchX(e) - initialMouseX.current;
81
+ var mouseOffset = (0, _helpers.getPosition)(e, true) - initialMouseX.current;
79
82
  var changedFlyoutWidth = initialWidth.current + mouseOffset * direction;
80
83
  setFlyoutWidth(getFlyoutMinMaxWidth(changedFlyoutWidth));
81
84
  }, [getFlyoutMinMaxWidth, direction]);
@@ -88,7 +91,7 @@ var EuiFlyoutResizable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref
88
91
  }, [onMouseMove]);
89
92
  var onMouseDown = (0, _react.useCallback)(function (e) {
90
93
  var _flyoutRef$offsetWidt;
91
- initialMouseX.current = getMouseOrTouchX(e);
94
+ initialMouseX.current = (0, _helpers.getPosition)(e, true);
92
95
  initialWidth.current = (_flyoutRef$offsetWidt = flyoutRef === null || flyoutRef === void 0 ? void 0 : flyoutRef.offsetWidth) !== null && _flyoutRef$offsetWidt !== void 0 ? _flyoutRef$offsetWidt : 0;
93
96
 
94
97
  // Window event listeners instead of React events are used
@@ -118,9 +121,11 @@ var EuiFlyoutResizable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref
118
121
  size: flyoutWidth || size,
119
122
  maxWidth: maxWidth,
120
123
  side: side,
124
+ type: type,
121
125
  ref: setRefs
122
126
  }), (0, _react2.jsx)(_resizable_container.EuiResizableButton, {
123
127
  isHorizontal: true,
128
+ indicator: "border",
124
129
  css: cssStyles,
125
130
  onMouseDown: onMouseDown,
126
131
  onTouchStart: onMouseDown,
@@ -128,9 +133,4 @@ var EuiFlyoutResizable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref
128
133
  }), children);
129
134
  });
130
135
  exports.EuiFlyoutResizable = EuiFlyoutResizable;
131
- EuiFlyoutResizable.displayName = 'EuiFlyoutResizable';
132
- var getMouseOrTouchX = function getMouseOrTouchX(e) {
133
- // Some Typescript fooling is needed here
134
- var x = e.targetTouches ? e.targetTouches[0].pageX : e.pageX;
135
- return x;
136
- };
136
+ EuiFlyoutResizable.displayName = 'EuiFlyoutResizable';
@@ -14,19 +14,25 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
14
14
  * Side Public License, v 1.
15
15
  */
16
16
  var _ref = process.env.NODE_ENV === "production" ? {
17
- name: "6syi0e-euiFlyoutResizableButton",
18
- styles: "position:absolute;&::before,&::after{background-color:transparent;};label:euiFlyoutResizableButton;"
17
+ name: "1gfwqnd-euiFlyoutResizableButton",
18
+ styles: "position:absolute;label:euiFlyoutResizableButton;"
19
19
  } : {
20
- name: "6syi0e-euiFlyoutResizableButton",
21
- styles: "position:absolute;&::before,&::after{background-color:transparent;};label:euiFlyoutResizableButton;",
20
+ name: "1gfwqnd-euiFlyoutResizableButton",
21
+ styles: "position:absolute;label:euiFlyoutResizableButton;",
22
22
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
23
23
  };
24
24
  var euiFlyoutResizableButtonStyles = function euiFlyoutResizableButtonStyles(_ref2) {
25
25
  var euiTheme = _ref2.euiTheme;
26
26
  return {
27
27
  euiFlyoutResizableButton: _ref,
28
- left: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('right', "-".concat(euiTheme.border.width.thin)), ";;label:left;"),
29
- right: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('left', "-".concat(euiTheme.border.width.thin)), ";;label:right;")
28
+ overlay: {
29
+ left: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('right', 0), ";;label:left;"),
30
+ right: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('left', 0), ";;label:right;")
31
+ },
32
+ push: {
33
+ left: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('right', "-".concat(euiTheme.border.width.thin)), ";;label:left;"),
34
+ right: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('left', "-".concat(euiTheme.border.width.thin)), ";;label:right;")
35
+ }
30
36
  };
31
37
  };
32
38
  exports.euiFlyoutResizableButtonStyles = euiFlyoutResizableButtonStyles;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.useContainerCallbacks = exports.sizesOnly = exports.pxToPercent = exports.getPosition = exports.getPanelMinSize = void 0;
6
+ exports.useContainerCallbacks = exports.sizesOnly = exports.pxToPercent = exports.isTouchEvent = exports.getPosition = exports.getPanelMinSize = void 0;
7
7
  var _react = require("react");
8
8
  var _common = require("../common");
9
9
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
@@ -24,9 +24,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
24
24
  * in compliance with, at your election, the Elastic License 2.0 or the Server
25
25
  * Side Public License, v 1.
26
26
  */
27
- function isMouseEvent(event) {
28
- return _typeof(event) === 'object' && 'pageX' in event && 'pageY' in event;
29
- }
27
+ var isTouchEvent = function isTouchEvent(event) {
28
+ return _typeof(event) === 'object' && 'targetTouches' in event;
29
+ };
30
+ exports.isTouchEvent = isTouchEvent;
30
31
  var pxToPercent = function pxToPercent(proportion, whole) {
31
32
  if (whole < 1 || proportion < 0) return 0;
32
33
  return proportion / whole * 100;
@@ -56,9 +57,8 @@ var getPanelMinSize = function getPanelMinSize(panelMinSize, containerSize) {
56
57
  };
57
58
  exports.getPanelMinSize = getPanelMinSize;
58
59
  var getPosition = function getPosition(event, isHorizontal) {
59
- var clientX = isMouseEvent(event) ? event.clientX : event.touches[0].clientX;
60
- var clientY = isMouseEvent(event) ? event.clientY : event.touches[0].clientY;
61
- return isHorizontal ? clientX : clientY;
60
+ var direction = isHorizontal ? 'clientX' : 'clientY';
61
+ return isTouchEvent(event) ? event.targetTouches[0][direction] : event[direction];
62
62
  };
63
63
  exports.getPosition = getPosition;
64
64
  var getSiblingPanel = function getSiblingPanel(element, adjacency) {
@@ -13,7 +13,7 @@ var _services = require("../../services");
13
13
  var _context = require("./context");
14
14
  var _resizable_button = require("./resizable_button.styles");
15
15
  var _react2 = require("@emotion/react");
16
- var _excluded = ["isHorizontal", "alignIndicator", "className"],
16
+ var _excluded = ["isHorizontal", "indicator", "alignIndicator", "className"],
17
17
  _excluded2 = ["registration", "id", "disabled", "onFocus"];
18
18
  /*
19
19
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
@@ -40,14 +40,17 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
40
40
  */
41
41
  var EuiResizableButton = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
42
42
  var isHorizontal = _ref.isHorizontal,
43
+ _ref$indicator = _ref.indicator,
44
+ indicator = _ref$indicator === void 0 ? 'handle' : _ref$indicator,
43
45
  _ref$alignIndicator = _ref.alignIndicator,
44
46
  alignIndicator = _ref$alignIndicator === void 0 ? 'center' : _ref$alignIndicator,
45
47
  className = _ref.className,
46
48
  rest = _objectWithoutProperties(_ref, _excluded);
47
49
  var classes = (0, _classnames.default)('euiResizableButton', className);
50
+ var resizeDirection = isHorizontal ? 'horizontal' : 'vertical';
48
51
  var euiTheme = (0, _services.useEuiTheme)();
49
52
  var styles = (0, _resizable_button.euiResizableButtonStyles)(euiTheme);
50
- var cssStyles = [styles.euiResizableButton, isHorizontal ? styles.horizontal : styles.vertical, styles.alignIndicator[alignIndicator]];
53
+ var cssStyles = [styles.euiResizableButton, styles[indicator], styles["".concat(indicator, "Direction")][resizeDirection], styles[resizeDirection], indicator === 'handle' && styles.alignIndicator[alignIndicator]];
51
54
  return (0, _react2.jsx)(_i18n.EuiI18n, {
52
55
  tokens: ['euiResizableButton.horizontalResizerAriaLabel', 'euiResizableButton.verticalResizerAriaLabel'],
53
56
  defaults: ['Press the left or right arrow keys to adjust panels size', 'Press the up or down arrow keys to adjust panels size']
@@ -77,8 +80,14 @@ EuiResizableButton.propTypes = {
77
80
  */
78
81
  isHorizontal: _propTypes.default.bool,
79
82
  /**
80
- * Specify the alignment of the initial resize indicator. Defaults to `center`,
81
- * but consider using `start` for extremely tall content that scrolls off-screen
83
+ * By default, EuiResizableButton will show a grab handle to indicate resizability.
84
+ * This indicator can be optionally hidden to show a plain border instead.
85
+ */
86
+ indicator: _propTypes.default.oneOf(["handle", "border"]),
87
+ /**
88
+ * Allows customizing the alignment of grab `handle` indicators (does nothing for
89
+ * border indicators). Defaults to `center`, but consider using `start` for extremely
90
+ * tall content that scrolls off-screen
82
91
  */
83
92
  alignIndicator: _propTypes.default.oneOf(["center", "start", "end"]),
84
93
  /**
@@ -46,21 +46,31 @@ var euiResizableButtonStyles = function euiResizableButtonStyles(euiThemeContext
46
46
  var transitionSpeed = euiTheme.animation.fast;
47
47
  var transition = "".concat(transitionSpeed, " ease");
48
48
  return {
49
- // Mimics the "grab" icon with CSS psuedo-elements.
50
- // 1. The "grab" icon transforms into a thicker straight line on :hover and :focus
51
- // 2. Start/end aligned handles should have a slight margin offset that disappears on hover/focus
49
+ // Creates a resizable indicator (either a grab handle or a plain border) with CSS psuedo-elements.
50
+ // 1. The "grab" handle transforms into a thicker straight line on :hover and :focus
51
+ // 2. Start/end aligned grab handles should have a slight margin offset that disappears on hover/focus
52
52
  // 3. CSS hack to smooth out/anti-alias the 1px wide handles at various zoom levels
53
- euiResizableButton: /*#__PURE__*/(0, _react.css)("z-index:1;flex-shrink:0;display:flex;justify-content:center;gap:", (0, _global_styling.mathWithUnits)(grabHandleHeight, function (x) {
54
- return x * 2;
55
- }), ";&:disabled{display:none;}&:hover,&:focus{gap:0;justify-content:center;}", _global_styling.euiCanAnimate, "{transition:gap ", transition, ",justify-content ", transition, ";}&::before,&::after{content:'';display:block;background-color:", euiTheme.colors.darkestShade, ";transform:translateZ(0);", _global_styling.euiCanAnimate, "{transition:width ", transition, ",height ", transition, ",margin ", transition, ",background-color ", transition, ";}}&:hover{&::before,&::after{background-color:", euiTheme.colors.mediumShade, ";", _global_styling.euiCanAnimate, "{transition-delay:", transitionSpeed, ";}}}&:focus,&:active{background-color:", (0, _services.transparentize)(euiTheme.colors.primary, 0.1), ";&::before,&::after{background-color:", euiTheme.colors.primary, ";", _global_styling.euiCanAnimate, "{transition:width ", transition, ",height ", transition, ";transition-delay:", (0, _global_styling.mathWithUnits)(transitionSpeed, function (x) {
53
+ euiResizableButton: /*#__PURE__*/(0, _react.css)("z-index:1;flex-shrink:0;display:flex;justify-content:center;&:disabled{display:none;}&::before,&::after{content:'';display:block;", _global_styling.euiCanAnimate, "{transition:width ", transition, ",height ", transition, ",margin ", transition, ",background-color ", transition, ";}}&:hover{&::before,&::after{background-color:", euiTheme.colors.mediumShade, ";}}&:focus,&:active{background-color:", (0, _services.transparentize)(euiTheme.colors.primary, 0.1), ";&::before,&::after{background-color:", euiTheme.colors.primary, ";", _global_styling.euiCanAnimate, "{transition:width ", transition, ",height ", transition, ";transition-delay:", (0, _global_styling.mathWithUnits)(transitionSpeed, function (x) {
56
54
  return x / 2;
57
55
  }), ";}}};label:euiResizableButton;"),
58
56
  horizontal: /*#__PURE__*/(0, _react.css)("cursor:col-resize;", (0, _global_styling.logicalCSS)('height', '100%'), " ", (0, _global_styling.logicalCSS)('width', buttonSize), " margin-inline:", (0, _global_styling.mathWithUnits)(buttonSize, function (x) {
59
57
  return x / -2;
60
- }), ";&::before,&::after{", (0, _global_styling.logicalCSS)('width', grabHandleHeight), " ", (0, _global_styling.logicalCSS)('height', grabHandleWidth), " margin-block:", euiTheme.size.base, ";}&:hover,&:focus,&:active{&::before,&::after{", (0, _global_styling.logicalCSS)('height', '100%'), " margin-block:0;transform:none;}};label:horizontal;"),
58
+ }), ";;label:horizontal;"),
61
59
  vertical: /*#__PURE__*/(0, _react.css)("flex-direction:column;cursor:row-resize;", (0, _global_styling.logicalCSS)('width', '100%'), " ", (0, _global_styling.logicalCSS)('height', buttonSize), " margin-block:", (0, _global_styling.mathWithUnits)(buttonSize, function (x) {
62
60
  return x / -2;
63
- }), ";&::before,&::after{", (0, _global_styling.logicalCSS)('height', grabHandleHeight), " ", (0, _global_styling.logicalCSS)('width', grabHandleWidth), " margin-inline:", euiTheme.size.base, ";}&:hover,&:focus,&:active{&::before,&::after{", (0, _global_styling.logicalCSS)('width', '100%'), " margin-inline:0;transform:none;}};label:vertical;"),
61
+ }), ";;label:vertical;"),
62
+ border: /*#__PURE__*/(0, _react.css)("&::before,&::after{background-color:", euiTheme.border.color, ";};label:border;"),
63
+ borderDirection: {
64
+ horizontal: /*#__PURE__*/(0, _react.css)("&::before{", (0, _global_styling.logicalCSS)('width', euiTheme.border.width.thin), " ", (0, _global_styling.logicalCSS)('height', '100%'), ";}&:hover,&:focus,&:active{&::after{", (0, _global_styling.logicalCSS)('width', euiTheme.border.width.thin), " ", (0, _global_styling.logicalCSS)('height', '100%'), ";}};label:horizontal;"),
65
+ vertical: /*#__PURE__*/(0, _react.css)("&::before{", (0, _global_styling.logicalCSS)('height', euiTheme.border.width.thin), " ", (0, _global_styling.logicalCSS)('width', '100%'), ";}&:hover,&:focus,&:active{&::after{", (0, _global_styling.logicalCSS)('height', euiTheme.border.width.thin), " ", (0, _global_styling.logicalCSS)('width', '100%'), ";}};label:vertical;")
66
+ },
67
+ handle: /*#__PURE__*/(0, _react.css)("gap:", (0, _global_styling.mathWithUnits)(grabHandleHeight, function (x) {
68
+ return x * 2;
69
+ }), ";&:hover,&:focus,&:active{gap:0;}", _global_styling.euiCanAnimate, "{transition:gap ", transition, ";}&::before,&::after{background-color:", euiTheme.colors.darkestShade, ";transform:translateZ(0);}&:hover{&::before,&::after{", _global_styling.euiCanAnimate, "{transition-delay:", transitionSpeed, ";}}};label:handle;"),
70
+ handleDirection: {
71
+ horizontal: /*#__PURE__*/(0, _react.css)("&::before,&::after{", (0, _global_styling.logicalCSS)('width', grabHandleHeight), " ", (0, _global_styling.logicalCSS)('height', grabHandleWidth), " margin-block:", euiTheme.size.base, ";}&:hover,&:focus,&:active{&::before,&::after{", (0, _global_styling.logicalCSS)('height', '100%'), " margin-block:0;transform:none;}};label:horizontal;"),
72
+ vertical: /*#__PURE__*/(0, _react.css)("&::before,&::after{", (0, _global_styling.logicalCSS)('height', grabHandleHeight), " ", (0, _global_styling.logicalCSS)('width', grabHandleWidth), " margin-inline:", euiTheme.size.base, ";}&:hover,&:focus,&:active{&::before,&::after{", (0, _global_styling.logicalCSS)('width', '100%'), " margin-inline:0;transform:none;}};label:vertical;")
73
+ },
64
74
  alignIndicator: {
65
75
  center: _ref3,
66
76
  start: _ref2,
@@ -117,16 +117,33 @@ var EuiResizableContainer = function EuiResizableContainer(_ref) {
117
117
  prevPanelId: prevPanelId,
118
118
  nextPanelId: nextPanelId
119
119
  });
120
- }, [actions, isHorizontal, resizeStart]);
121
- var onMouseMove = (0, _react.useCallback)(function (event) {
122
- if (!reducerState.prevPanelId || !reducerState.nextPanelId || !reducerState.isDragging) return;
123
- var position = (0, _helpers.getPosition)(event, isHorizontal);
124
- actions.dragMove({
125
- position: position,
126
- prevPanelId: reducerState.prevPanelId,
127
- nextPanelId: reducerState.nextPanelId
128
- });
129
- }, [actions, isHorizontal, reducerState.prevPanelId, reducerState.nextPanelId, reducerState.isDragging]);
120
+
121
+ // Window event listeners instead of React events are used to continue
122
+ // detecting movement even if the user's mouse leaves the container
123
+
124
+ var onMouseMove = function onMouseMove(event) {
125
+ var position = (0, _helpers.getPosition)(event, isHorizontal);
126
+ actions.dragMove({
127
+ position: position,
128
+ prevPanelId: prevPanelId,
129
+ nextPanelId: nextPanelId
130
+ });
131
+ };
132
+ var onMouseUp = function onMouseUp() {
133
+ if (resizeContext.current.trigger === 'pointer') {
134
+ resizeEnd();
135
+ }
136
+ actions.reset();
137
+ window.removeEventListener('mousemove', onMouseMove);
138
+ window.removeEventListener('mouseup', onMouseUp);
139
+ window.removeEventListener('touchmove', onMouseMove);
140
+ window.removeEventListener('touchend', onMouseUp);
141
+ };
142
+ window.addEventListener('mousemove', onMouseMove);
143
+ window.addEventListener('mouseup', onMouseUp);
144
+ window.addEventListener('touchmove', onMouseMove);
145
+ window.addEventListener('touchend', onMouseUp);
146
+ }, [actions, isHorizontal, resizeStart, resizeEnd]);
130
147
  var getKeyMoveDirection = (0, _react.useCallback)(function (key) {
131
148
  var direction = null;
132
149
  if (isHorizontal && key === _services.keys.ARROW_LEFT || !isHorizontal && key === _services.keys.ARROW_UP) {
@@ -164,12 +181,6 @@ var EuiResizableContainer = function EuiResizableContainer(_ref) {
164
181
  resizeEnd();
165
182
  }
166
183
  }, [getKeyMoveDirection, resizeEnd]);
167
- var onMouseUp = (0, _react.useCallback)(function () {
168
- if (resizeContext.current.trigger === 'pointer') {
169
- resizeEnd();
170
- }
171
- actions.reset();
172
- }, [actions, resizeEnd]);
173
184
  var onBlur = (0, _react.useCallback)(function () {
174
185
  if (resizeContext.current.trigger === 'key') {
175
186
  resizeEnd();
@@ -228,12 +239,7 @@ var EuiResizableContainer = function EuiResizableContainer(_ref) {
228
239
  }, (0, _react2.jsx)("div", _extends({
229
240
  css: cssStyles,
230
241
  className: classes,
231
- ref: containerRef,
232
- onMouseMove: reducerState.isDragging ? onMouseMove : undefined,
233
- onMouseUp: onMouseUp,
234
- onMouseLeave: onMouseUp,
235
- onTouchMove: onMouseMove,
236
- onTouchEnd: onMouseUp
242
+ ref: containerRef
237
243
  }, rest), render()));
238
244
  };
239
245
  exports.EuiResizableContainer = EuiResizableContainer;
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.euiStepNumberStyles = exports.euiStepNumberContentStyles = void 0;
7
7
  var _react = require("@emotion/react");
8
8
  var _global_styling = require("../../global_styling");
9
- var _services = require("../../services");
10
9
  var _step = require("./step.styles");
11
10
  var _mixins = require("../../themes/amsterdam/global_styling/mixins");
12
11
  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)."; } /*
@@ -46,12 +45,12 @@ var euiStepNumberStyles = function euiStepNumberStyles(euiThemeContext) {
46
45
  xs: /*#__PURE__*/(0, _react.css)(createStepsNumber(euiStep.numberXSSize, (0, _global_styling.euiFontSizeFromScale)('xs', euiTheme)), ";;label:xs;"),
47
46
  // status
48
47
  incomplete: /*#__PURE__*/(0, _react.css)("background-color:transparent;color:", euiTheme.colors.text, ";border:", euiTheme.border.thick, ";;label:incomplete;"),
49
- disabled: /*#__PURE__*/(0, _react.css)("background-color:", (0, _mixins.euiButtonFillColor)(euiThemeContext, 'disabled').backgroundColor, ";color:", (0, _services.makeHighContrastColor)(euiTheme.colors.disabledText)((0, _mixins.euiButtonFillColor)(euiThemeContext, 'disabled').backgroundColor), ";;label:disabled;"),
48
+ disabled: /*#__PURE__*/(0, _react.css)((0, _mixins.euiButtonFillColor)(euiThemeContext, 'disabled'), ";;label:disabled;"),
50
49
  loading: _ref,
51
- warning: /*#__PURE__*/(0, _react.css)("color:", (0, _mixins.euiButtonFillColor)(euiThemeContext, 'warning').color, ";background-color:", (0, _mixins.euiButtonFillColor)(euiThemeContext, 'warning').backgroundColor, ";", _global_styling.euiCanAnimate, "{animation:", _global_styling.euiAnimScale, " ", euiTheme.animation.fast, " ", euiTheme.animation.bounce, ";};label:warning;"),
52
- danger: /*#__PURE__*/(0, _react.css)("color:", (0, _mixins.euiButtonFillColor)(euiThemeContext, 'danger').color, ";background-color:", (0, _mixins.euiButtonFillColor)(euiThemeContext, 'danger').backgroundColor, ";", _global_styling.euiCanAnimate, "{animation:", _global_styling.euiAnimScale, " ", euiTheme.animation.fast, " ", euiTheme.animation.bounce, ";};label:danger;"),
53
- complete: /*#__PURE__*/(0, _react.css)("color:", (0, _mixins.euiButtonFillColor)(euiThemeContext, 'success').color, ";background-color:", (0, _mixins.euiButtonFillColor)(euiThemeContext, 'success').backgroundColor, ";", _global_styling.euiCanAnimate, "{animation:", _global_styling.euiAnimScale, " ", euiTheme.animation.fast, " ", euiTheme.animation.bounce, ";};label:complete;"),
54
- current: /*#__PURE__*/(0, _react.css)("border:2px solid ", euiTheme.colors.body, ";box-shadow:0 0 0 2px ", euiTheme.colors.primary, ";.euiStepNumber__number{display:inline-block;transform:translateY(-2px);};label:current;")
50
+ warning: /*#__PURE__*/(0, _react.css)((0, _mixins.euiButtonFillColor)(euiThemeContext, 'warning'), " ", _global_styling.euiCanAnimate, "{animation:", _global_styling.euiAnimScale, " ", euiTheme.animation.fast, " ", euiTheme.animation.bounce, ";};label:warning;"),
51
+ danger: /*#__PURE__*/(0, _react.css)((0, _mixins.euiButtonFillColor)(euiThemeContext, 'danger'), " ", _global_styling.euiCanAnimate, "{animation:", _global_styling.euiAnimScale, " ", euiTheme.animation.fast, " ", euiTheme.animation.bounce, ";};label:danger;"),
52
+ complete: /*#__PURE__*/(0, _react.css)((0, _mixins.euiButtonFillColor)(euiThemeContext, 'success'), " ", _global_styling.euiCanAnimate, "{animation:", _global_styling.euiAnimScale, " ", euiTheme.animation.fast, " ", euiTheme.animation.bounce, ";};label:complete;"),
53
+ current: /*#__PURE__*/(0, _react.css)("border:", euiTheme.border.width.thick, " solid ", euiTheme.colors.body, ";box-shadow:0 0 0 ", euiTheme.border.width.thick, " ", euiTheme.colors.primary, ";;label:current;")
55
54
  };
56
55
  };
57
56
  exports.euiStepNumberStyles = euiStepNumberStyles;
@@ -72,7 +71,7 @@ var euiStepNumberContentStyles = function euiStepNumberContentStyles(_ref3) {
72
71
  incomplete: /*#__PURE__*/(0, _react.css)("display:unset;position:relative;inset-block-start:-", euiTheme.border.width.thick, ";;label:incomplete;"),
73
72
  loading: /*#__PURE__*/(0, _react.css)(";label:loading;"),
74
73
  disabled: /*#__PURE__*/(0, _react.css)(";label:disabled;"),
75
- current: /*#__PURE__*/(0, _react.css)(";label:current;")
74
+ current: /*#__PURE__*/(0, _react.css)("display:inline-block;transform:translateY(-", euiTheme.border.width.thick, ");;label:current;")
76
75
  };
77
76
  };
78
77
  exports.euiStepNumberContentStyles = euiStepNumberContentStyles;