@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
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.useHeaderFocusWorkaround = exports.useFocus = exports.preventTabbing = exports.notifyCellOfFocusState = exports.getParentCellContent = exports.createKeyDownHandler = exports.DataGridFocusContext = void 0;
7
+ exports.useFocus = exports.preventTabbing = exports.notifyCellOfFocusState = exports.getParentCellContent = exports.createKeyDownHandler = exports.DataGridFocusContext = void 0;
8
8
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
9
  var _react = require("react");
10
10
  var _tabbable = require("tabbable");
@@ -30,9 +30,7 @@ exports.DataGridFocusContext = DataGridFocusContext;
30
30
  /**
31
31
  * Main focus context and overarching focus state management
32
32
  */
33
- var useFocus = function useFocus(_ref) {
34
- var headerIsInteractive = _ref.headerIsInteractive,
35
- gridItemsRendered = _ref.gridItemsRendered;
33
+ var useFocus = function useFocus() {
36
34
  // Maintain a map of focus cell state callbacks
37
35
  var cellsUpdateFocus = (0, _react.useRef)(new Map());
38
36
  var onFocusUpdate = (0, _react.useCallback)(function (cell, updateFocus) {
@@ -53,14 +51,17 @@ var useFocus = function useFocus(_ref) {
53
51
  focusedCell = _useState4[0],
54
52
  _setFocusedCell = _useState4[1];
55
53
  var setFocusedCell = (0, _react.useCallback)(function (nextFocusedCell) {
56
- // If the x/y coordinates remained the same, don't update. This keeps the focusedCell
57
- // reference stable, and allows it to be used in places that need reference equality.
58
- if (nextFocusedCell[0] === (focusedCell === null || focusedCell === void 0 ? void 0 : focusedCell[0]) && nextFocusedCell[1] === (focusedCell === null || focusedCell === void 0 ? void 0 : focusedCell[1])) {
59
- return;
60
- }
61
- _setFocusedCell(nextFocusedCell);
62
- setIsFocusedCellInView(true); // scrolling.ts ensures focused cells are fully in view
63
- }, [focusedCell]);
54
+ _setFocusedCell(function (prevFocusedCell) {
55
+ // If the x/y coordinates remained the same, don't update. This keeps the focusedCell
56
+ // reference stable, and allows it to be used in places that need reference equality.
57
+ if (nextFocusedCell[0] === (prevFocusedCell === null || prevFocusedCell === void 0 ? void 0 : prevFocusedCell[0]) && nextFocusedCell[1] === (prevFocusedCell === null || prevFocusedCell === void 0 ? void 0 : prevFocusedCell[1])) {
58
+ return prevFocusedCell;
59
+ } else {
60
+ setIsFocusedCellInView(true); // scrolling.ts ensures focused cells are fully in view
61
+ return nextFocusedCell;
62
+ }
63
+ });
64
+ }, []);
64
65
  var previousCell = (0, _react.useRef)(undefined);
65
66
  (0, _react.useEffect)(function () {
66
67
  if (previousCell.current) {
@@ -72,19 +73,8 @@ var useFocus = function useFocus(_ref) {
72
73
  }
73
74
  }, [cellsUpdateFocus, focusedCell]);
74
75
  var focusFirstVisibleInteractiveCell = (0, _react.useCallback)(function () {
75
- if (headerIsInteractive) {
76
- // The header (rowIndex -1) is sticky and will always be in view
77
- setFocusedCell([0, -1]);
78
- } else if (gridItemsRendered.current) {
79
- var _gridItemsRendered$cu = gridItemsRendered.current,
80
- visibleColumnStartIndex = _gridItemsRendered$cu.visibleColumnStartIndex,
81
- visibleRowStartIndex = _gridItemsRendered$cu.visibleRowStartIndex;
82
- setFocusedCell([visibleColumnStartIndex, visibleRowStartIndex]);
83
- } else {
84
- // If the header is non-interactive and there are no rendered cells,
85
- // there's nothing to do - we might as well leave focus on the grid body wrapper
86
- }
87
- }, [setFocusedCell, headerIsInteractive, gridItemsRendered]);
76
+ setFocusedCell([0, -1]);
77
+ }, [setFocusedCell]);
88
78
  var focusProps = (0, _react.useMemo)(function () {
89
79
  return isFocusedCellInView ? {
90
80
  // FireFox allows tabbing to a div that is scrollable, while Chrome does not
@@ -127,16 +117,15 @@ var notifyCellOfFocusState = function notifyCellOfFocusState(cellsUpdateFocus, c
127
117
  * Keydown handler for connecting focus state with keyboard navigation
128
118
  */
129
119
  exports.notifyCellOfFocusState = notifyCellOfFocusState;
130
- var createKeyDownHandler = function createKeyDownHandler(_ref2) {
131
- var gridElement = _ref2.gridElement,
132
- visibleColCount = _ref2.visibleColCount,
133
- visibleRowCount = _ref2.visibleRowCount,
134
- visibleRowStartIndex = _ref2.visibleRowStartIndex,
135
- rowCount = _ref2.rowCount,
136
- pagination = _ref2.pagination,
137
- hasFooter = _ref2.hasFooter,
138
- headerIsInteractive = _ref2.headerIsInteractive,
139
- focusContext = _ref2.focusContext;
120
+ var createKeyDownHandler = function createKeyDownHandler(_ref) {
121
+ var gridElement = _ref.gridElement,
122
+ visibleColCount = _ref.visibleColCount,
123
+ visibleRowCount = _ref.visibleRowCount,
124
+ visibleRowStartIndex = _ref.visibleRowStartIndex,
125
+ rowCount = _ref.rowCount,
126
+ pagination = _ref.pagination,
127
+ hasFooter = _ref.hasFooter,
128
+ focusContext = _ref.focusContext;
140
129
  return function (event) {
141
130
  var focusedCell = focusContext.focusedCell,
142
131
  setFocusedCell = focusContext.setFocusedCell;
@@ -170,8 +159,7 @@ var createKeyDownHandler = function createKeyDownHandler(_ref2) {
170
159
  }
171
160
  } else if (key === _services.keys.ARROW_UP) {
172
161
  event.preventDefault();
173
- var minimumIndex = headerIsInteractive ? -1 : 0;
174
- if (y > minimumIndex) {
162
+ if (y > -1) {
175
163
  setFocusedCell([x, y - 1]);
176
164
  }
177
165
  } else if (key === _services.keys.ARROW_RIGHT) {
@@ -261,22 +249,4 @@ var getParentCellContent = function getParentCellContent(_element) {
261
249
  }
262
250
  return element;
263
251
  };
264
-
265
- /**
266
- * Focus fixes & workarounds
267
- */
268
-
269
- // If the focus is on the header, and the header is no longer interactive,
270
- // move the focus down to the first row
271
- exports.getParentCellContent = getParentCellContent;
272
- var useHeaderFocusWorkaround = function useHeaderFocusWorkaround(headerIsInteractive) {
273
- var _useContext = (0, _react.useContext)(DataGridFocusContext),
274
- focusedCell = _useContext.focusedCell,
275
- setFocusedCell = _useContext.setFocusedCell;
276
- (0, _react.useEffect)(function () {
277
- if (!headerIsInteractive && focusedCell && focusedCell[1] === -1) {
278
- setFocusedCell([focusedCell[0], 0]);
279
- }
280
- }, [headerIsInteractive, focusedCell, setFocusedCell]);
281
- };
282
- exports.useHeaderFocusWorkaround = useHeaderFocusWorkaround;
252
+ exports.getParentCellContent = getParentCellContent;
@@ -9,7 +9,7 @@ exports.useScrollCellIntoView = exports.useScrollBars = exports.useScroll = void
9
9
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
10
10
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
11
  var _react = _interopRequireWildcard(require("react"));
12
- var _data_grid_cell_popover = require("../body/data_grid_cell_popover");
12
+ var _cell = require("../body/cell");
13
13
  var _focus = require("./focus");
14
14
  var _react2 = require("@emotion/react");
15
15
  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); }
@@ -41,7 +41,7 @@ var useScroll = function useScroll(args) {
41
41
  });
42
42
  }
43
43
  }, [focusedCell, scrollCellIntoView]);
44
- var _useContext2 = (0, _react.useContext)(_data_grid_cell_popover.DataGridCellPopoverContext),
44
+ var _useContext2 = (0, _react.useContext)(_cell.DataGridCellPopoverContext),
45
45
  popoverIsOpen = _useContext2.popoverIsOpen,
46
46
  cellLocation = _useContext2.cellLocation;
47
47
  (0, _react.useEffect)(function () {
@@ -12,10 +12,11 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
12
12
  var _react = _interopRequireWildcard(require("react"));
13
13
  var _services = require("../../services");
14
14
  var _resizable_container = require("../resizable_container");
15
+ var _helpers = require("../resizable_container/helpers");
15
16
  var _flyout = require("./flyout");
16
17
  var _flyout_resizable = require("./flyout_resizable.styles");
17
18
  var _react2 = require("@emotion/react");
18
- var _excluded = ["size", "maxWidth", "minWidth", "side", "children"];
19
+ var _excluded = ["size", "maxWidth", "minWidth", "side", "type", "children"];
19
20
  /*
20
21
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
21
22
  * or more contributor license agreements. Licensed under the Elastic License
@@ -32,11 +33,13 @@ var EuiFlyoutResizable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref
32
33
  minWidth = _ref$minWidth === void 0 ? 200 : _ref$minWidth,
33
34
  _ref$side = _ref.side,
34
35
  side = _ref$side === void 0 ? 'right' : _ref$side,
36
+ _ref$type = _ref.type,
37
+ type = _ref$type === void 0 ? 'overlay' : _ref$type,
35
38
  children = _ref.children,
36
39
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
37
40
  var euiTheme = (0, _services.useEuiTheme)();
38
41
  var styles = (0, _flyout_resizable.euiFlyoutResizableButtonStyles)(euiTheme);
39
- var cssStyles = [styles.euiFlyoutResizableButton, styles[side]];
42
+ var cssStyles = [styles.euiFlyoutResizableButton, styles[type][side]];
40
43
  var getFlyoutMinMaxWidth = (0, _react.useCallback)(function (width) {
41
44
  return Math.min(Math.max(width, minWidth), maxWidth || Infinity, window.innerWidth - 20 // Leave some offset
42
45
  );
@@ -70,7 +73,7 @@ var EuiFlyoutResizable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref
70
73
  return modifier;
71
74
  }, [side, flyoutRef]);
72
75
  var onMouseMove = (0, _react.useCallback)(function (e) {
73
- var mouseOffset = getMouseOrTouchX(e) - initialMouseX.current;
76
+ var mouseOffset = (0, _helpers.getPosition)(e, true) - initialMouseX.current;
74
77
  var changedFlyoutWidth = initialWidth.current + mouseOffset * direction;
75
78
  setFlyoutWidth(getFlyoutMinMaxWidth(changedFlyoutWidth));
76
79
  }, [getFlyoutMinMaxWidth, direction]);
@@ -83,7 +86,7 @@ var EuiFlyoutResizable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref
83
86
  }, [onMouseMove]);
84
87
  var onMouseDown = (0, _react.useCallback)(function (e) {
85
88
  var _flyoutRef$offsetWidt;
86
- initialMouseX.current = getMouseOrTouchX(e);
89
+ initialMouseX.current = (0, _helpers.getPosition)(e, true);
87
90
  initialWidth.current = (_flyoutRef$offsetWidt = flyoutRef === null || flyoutRef === void 0 ? void 0 : flyoutRef.offsetWidth) !== null && _flyoutRef$offsetWidt !== void 0 ? _flyoutRef$offsetWidt : 0;
88
91
 
89
92
  // Window event listeners instead of React events are used
@@ -113,9 +116,11 @@ var EuiFlyoutResizable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref
113
116
  size: flyoutWidth || size,
114
117
  maxWidth: maxWidth,
115
118
  side: side,
119
+ type: type,
116
120
  ref: setRefs
117
121
  }), (0, _react2.jsx)(_resizable_container.EuiResizableButton, {
118
122
  isHorizontal: true,
123
+ indicator: "border",
119
124
  css: cssStyles,
120
125
  onMouseDown: onMouseDown,
121
126
  onTouchStart: onMouseDown,
@@ -123,9 +128,4 @@ var EuiFlyoutResizable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref
123
128
  }), children);
124
129
  });
125
130
  exports.EuiFlyoutResizable = EuiFlyoutResizable;
126
- EuiFlyoutResizable.displayName = 'EuiFlyoutResizable';
127
- var getMouseOrTouchX = function getMouseOrTouchX(e) {
128
- // Some Typescript fooling is needed here
129
- var x = e.targetTouches ? e.targetTouches[0].pageX : e.pageX;
130
- return x;
131
- };
131
+ 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;
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.useContainerCallbacks = exports.sizesOnly = exports.pxToPercent = exports.getPosition = exports.getPanelMinSize = void 0;
7
+ exports.useContainerCallbacks = exports.sizesOnly = exports.pxToPercent = exports.isTouchEvent = exports.getPosition = exports.getPanelMinSize = void 0;
8
8
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
10
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
@@ -18,9 +18,10 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
18
18
  * in compliance with, at your election, the Elastic License 2.0 or the Server
19
19
  * Side Public License, v 1.
20
20
  */
21
- function isMouseEvent(event) {
22
- return (0, _typeof2.default)(event) === 'object' && 'pageX' in event && 'pageY' in event;
23
- }
21
+ var isTouchEvent = function isTouchEvent(event) {
22
+ return (0, _typeof2.default)(event) === 'object' && 'targetTouches' in event;
23
+ };
24
+ exports.isTouchEvent = isTouchEvent;
24
25
  var pxToPercent = function pxToPercent(proportion, whole) {
25
26
  if (whole < 1 || proportion < 0) return 0;
26
27
  return proportion / whole * 100;
@@ -50,9 +51,8 @@ var getPanelMinSize = function getPanelMinSize(panelMinSize, containerSize) {
50
51
  };
51
52
  exports.getPanelMinSize = getPanelMinSize;
52
53
  var getPosition = function getPosition(event, isHorizontal) {
53
- var clientX = isMouseEvent(event) ? event.clientX : event.touches[0].clientX;
54
- var clientY = isMouseEvent(event) ? event.clientY : event.touches[0].clientY;
55
- return isHorizontal ? clientX : clientY;
54
+ var direction = isHorizontal ? 'clientX' : 'clientY';
55
+ return isTouchEvent(event) ? event.targetTouches[0][direction] : event[direction];
56
56
  };
57
57
  exports.getPosition = getPosition;
58
58
  var getSiblingPanel = function getSiblingPanel(element, adjacency) {
@@ -17,7 +17,7 @@ var _services = require("../../services");
17
17
  var _context = require("./context");
18
18
  var _resizable_button = require("./resizable_button.styles");
19
19
  var _react2 = require("@emotion/react");
20
- var _excluded = ["isHorizontal", "alignIndicator", "className"],
20
+ var _excluded = ["isHorizontal", "indicator", "alignIndicator", "className"],
21
21
  _excluded2 = ["registration", "id", "disabled", "onFocus"];
22
22
  /*
23
23
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
@@ -34,14 +34,17 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
34
34
  */
35
35
  var EuiResizableButton = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
36
36
  var isHorizontal = _ref.isHorizontal,
37
+ _ref$indicator = _ref.indicator,
38
+ indicator = _ref$indicator === void 0 ? 'handle' : _ref$indicator,
37
39
  _ref$alignIndicator = _ref.alignIndicator,
38
40
  alignIndicator = _ref$alignIndicator === void 0 ? 'center' : _ref$alignIndicator,
39
41
  className = _ref.className,
40
42
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
41
43
  var classes = (0, _classnames.default)('euiResizableButton', className);
44
+ var resizeDirection = isHorizontal ? 'horizontal' : 'vertical';
42
45
  var euiTheme = (0, _services.useEuiTheme)();
43
46
  var styles = (0, _resizable_button.euiResizableButtonStyles)(euiTheme);
44
- var cssStyles = [styles.euiResizableButton, isHorizontal ? styles.horizontal : styles.vertical, styles.alignIndicator[alignIndicator]];
47
+ var cssStyles = [styles.euiResizableButton, styles[indicator], styles["".concat(indicator, "Direction")][resizeDirection], styles[resizeDirection], indicator === 'handle' && styles.alignIndicator[alignIndicator]];
45
48
  return (0, _react2.jsx)(_i18n.EuiI18n, {
46
49
  tokens: ['euiResizableButton.horizontalResizerAriaLabel', 'euiResizableButton.verticalResizerAriaLabel'],
47
50
  defaults: ['Press the left or right arrow keys to adjust panels size', 'Press the up or down arrow keys to adjust panels size']
@@ -71,8 +74,14 @@ EuiResizableButton.propTypes = {
71
74
  */
72
75
  isHorizontal: _propTypes.default.bool,
73
76
  /**
74
- * Specify the alignment of the initial resize indicator. Defaults to `center`,
75
- * but consider using `start` for extremely tall content that scrolls off-screen
77
+ * By default, EuiResizableButton will show a grab handle to indicate resizability.
78
+ * This indicator can be optionally hidden to show a plain border instead.
79
+ */
80
+ indicator: _propTypes.default.oneOf(["handle", "border"]),
81
+ /**
82
+ * Allows customizing the alignment of grab `handle` indicators (does nothing for
83
+ * border indicators). Defaults to `center`, but consider using `start` for extremely
84
+ * tall content that scrolls off-screen
76
85
  */
77
86
  alignIndicator: _propTypes.default.oneOf(["center", "start", "end"]),
78
87
  /**
@@ -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,
@@ -109,16 +109,33 @@ var EuiResizableContainer = function EuiResizableContainer(_ref) {
109
109
  prevPanelId: prevPanelId,
110
110
  nextPanelId: nextPanelId
111
111
  });
112
- }, [actions, isHorizontal, resizeStart]);
113
- var onMouseMove = (0, _react.useCallback)(function (event) {
114
- if (!reducerState.prevPanelId || !reducerState.nextPanelId || !reducerState.isDragging) return;
115
- var position = (0, _helpers.getPosition)(event, isHorizontal);
116
- actions.dragMove({
117
- position: position,
118
- prevPanelId: reducerState.prevPanelId,
119
- nextPanelId: reducerState.nextPanelId
120
- });
121
- }, [actions, isHorizontal, reducerState.prevPanelId, reducerState.nextPanelId, reducerState.isDragging]);
112
+
113
+ // Window event listeners instead of React events are used to continue
114
+ // detecting movement even if the user's mouse leaves the container
115
+
116
+ var onMouseMove = function onMouseMove(event) {
117
+ var position = (0, _helpers.getPosition)(event, isHorizontal);
118
+ actions.dragMove({
119
+ position: position,
120
+ prevPanelId: prevPanelId,
121
+ nextPanelId: nextPanelId
122
+ });
123
+ };
124
+ var onMouseUp = function onMouseUp() {
125
+ if (resizeContext.current.trigger === 'pointer') {
126
+ resizeEnd();
127
+ }
128
+ actions.reset();
129
+ window.removeEventListener('mousemove', onMouseMove);
130
+ window.removeEventListener('mouseup', onMouseUp);
131
+ window.removeEventListener('touchmove', onMouseMove);
132
+ window.removeEventListener('touchend', onMouseUp);
133
+ };
134
+ window.addEventListener('mousemove', onMouseMove);
135
+ window.addEventListener('mouseup', onMouseUp);
136
+ window.addEventListener('touchmove', onMouseMove);
137
+ window.addEventListener('touchend', onMouseUp);
138
+ }, [actions, isHorizontal, resizeStart, resizeEnd]);
122
139
  var getKeyMoveDirection = (0, _react.useCallback)(function (key) {
123
140
  var direction = null;
124
141
  if (isHorizontal && key === _services.keys.ARROW_LEFT || !isHorizontal && key === _services.keys.ARROW_UP) {
@@ -156,12 +173,6 @@ var EuiResizableContainer = function EuiResizableContainer(_ref) {
156
173
  resizeEnd();
157
174
  }
158
175
  }, [getKeyMoveDirection, resizeEnd]);
159
- var onMouseUp = (0, _react.useCallback)(function () {
160
- if (resizeContext.current.trigger === 'pointer') {
161
- resizeEnd();
162
- }
163
- actions.reset();
164
- }, [actions, resizeEnd]);
165
176
  var onBlur = (0, _react.useCallback)(function () {
166
177
  if (resizeContext.current.trigger === 'key') {
167
178
  resizeEnd();
@@ -220,12 +231,7 @@ var EuiResizableContainer = function EuiResizableContainer(_ref) {
220
231
  }, (0, _react2.jsx)("div", (0, _extends2.default)({
221
232
  css: cssStyles,
222
233
  className: classes,
223
- ref: containerRef,
224
- onMouseMove: reducerState.isDragging ? onMouseMove : undefined,
225
- onMouseUp: onMouseUp,
226
- onMouseLeave: onMouseUp,
227
- onTouchMove: onMouseMove,
228
- onTouchEnd: onMouseUp
234
+ ref: containerRef
229
235
  }, rest), render()));
230
236
  };
231
237
  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;
@@ -41,7 +41,9 @@ var EuiTreeViewContext = /*#__PURE__*/(0, _react.createContext)('');
41
41
  function hasAriaLabel(x) {
42
42
  return x.hasOwnProperty('aria-label');
43
43
  }
44
- function getTreeId(propId, contextId, idGenerator) {
44
+ function getTreeId(propId) {
45
+ var contextId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
46
+ var idGenerator = arguments.length > 2 ? arguments[2] : undefined;
45
47
  return propId !== null && propId !== void 0 ? propId : contextId === '' ? idGenerator() : contextId;
46
48
  }
47
49
  var displayToClassNameMap = {
@@ -51,9 +53,14 @@ var displayToClassNameMap = {
51
53
  var EuiTreeView = /*#__PURE__*/function (_Component) {
52
54
  (0, _inherits2.default)(EuiTreeView, _Component);
53
55
  var _super = _createSuper(EuiTreeView);
54
- function EuiTreeView(props, context) {
56
+ function EuiTreeView(props,
57
+ // Without the optional ? typing, TS will throw errors on JSX component errors
58
+ // @see https://github.com/facebook/react/issues/13944#issuecomment-1183693239
59
+ context) {
55
60
  var _this;
56
61
  (0, _classCallCheck2.default)(this, EuiTreeView);
62
+ // TODO: context in constructor has been deprecated.
63
+ // We should likely convert this to a function component
57
64
  _this = _super.call(this, props, context);
58
65
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "treeIdGenerator", (0, _services.htmlIdGenerator)('euiTreeView'));
59
66
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isNested", void 0);
@@ -1,58 +0,0 @@
1
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
- 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); }
4
- 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; }
5
- 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; } }
6
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
- /*
8
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
9
- * or more contributor license agreements. Licensed under the Elastic License
10
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
11
- * in compliance with, at your election, the Elastic License 2.0 or the Server
12
- * Side Public License, v 1.
13
- */
14
-
15
- import { useCallback, useEffect, useState } from 'react';
16
- import { tabbable } from 'tabbable';
17
- export var useHeaderIsInteractive = function useHeaderIsInteractive(gridElement) {
18
- var _useState = useState(false),
19
- _useState2 = _slicedToArray(_useState, 2),
20
- headerIsInteractive = _useState2[0],
21
- setHeaderIsInteractive = _useState2[1];
22
- var handleHeaderChange = useCallback(function (headerRow) {
23
- var tabbables = tabbable(headerRow);
24
- var managed = headerRow.querySelectorAll('[data-euigrid-tab-managed]');
25
- var hasInteractives = tabbables.length > 0 || managed.length > 0;
26
- if (hasInteractives !== headerIsInteractive) {
27
- setHeaderIsInteractive(hasInteractives);
28
- }
29
- }, [headerIsInteractive]);
30
-
31
- // Set headerIsInteractive on data grid init/load
32
- useEffect(function () {
33
- if (gridElement) {
34
- var headerElement = gridElement.querySelector('[data-test-subj~=dataGridHeader]');
35
- if (headerElement) {
36
- handleHeaderChange(headerElement);
37
- }
38
- }
39
- }, [gridElement, handleHeaderChange]);
40
-
41
- // Update headerIsInteractive if the header changes (e.g., columns are hidden)
42
- // Used in header mutation observer set in EuiDataGridBody
43
- var handleHeaderMutation = useCallback(function (records) {
44
- var _records = _slicedToArray(records, 1),
45
- target = _records[0].target;
46
-
47
- // find the wrapping header div
48
- var headerRow = target.parentElement;
49
- while (headerRow && (headerRow.getAttribute('data-test-subj') || '').split(/\s+/).indexOf('dataGridHeader') === -1) {
50
- headerRow = headerRow.parentElement;
51
- }
52
- if (headerRow) handleHeaderChange(headerRow);
53
- }, [handleHeaderChange]);
54
- return {
55
- headerIsInteractive: headerIsInteractive,
56
- handleHeaderMutation: handleHeaderMutation
57
- };
58
- };