@elastic/eui 116.3.0 → 116.3.1-snapshot.1782148316870

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 (199) hide show
  1. package/es/components/avatar/avatar.js +4 -0
  2. package/es/components/avatar/avatar.styles.js +16 -16
  3. package/es/components/banner/banner.js +1 -2
  4. package/es/components/banner/banner.styles.js +1 -1
  5. package/es/components/basic_table/basic_table.js +35 -5
  6. package/es/components/basic_table/basic_table.styles.js +19 -1
  7. package/es/components/basic_table/in_memory_table.js +17 -0
  8. package/es/components/basic_table/index.js +2 -1
  9. package/es/components/basic_table/pagination_bar.js +19 -4
  10. package/es/components/basic_table/pagination_bar.styles.js +21 -0
  11. package/es/components/basic_table/panel.styles.js +14 -0
  12. package/es/components/basic_table/use_panel_props.js +28 -0
  13. package/es/components/date_picker/auto_refresh/refresh_interval.js +176 -229
  14. package/es/components/date_picker/date_picker.js +1 -1
  15. package/es/components/flyout/flyout.component.js +10 -6
  16. package/es/components/flyout/flyout_menu.js +122 -19
  17. package/es/components/flyout/flyout_menu.styles.js +2 -1
  18. package/es/components/flyout/manager/actions.js +20 -0
  19. package/es/components/flyout/manager/flyout_child.js +23 -1
  20. package/es/components/flyout/manager/flyout_managed.js +65 -19
  21. package/es/components/flyout/manager/hooks.js +1 -1
  22. package/es/components/flyout/manager/index.js +2 -2
  23. package/es/components/flyout/manager/reducer.js +32 -8
  24. package/es/components/flyout/manager/selectors.js +8 -2
  25. package/es/components/flyout/manager/store.js +35 -2
  26. package/es/components/flyout/use_flyout_menu.js +2 -2
  27. package/es/components/form/field_password/field_password.styles.js +1 -1
  28. package/es/components/form/field_search/field_search.styles.js +1 -1
  29. package/es/components/form/form.styles.js +1 -1
  30. package/es/components/form/form_control_layout/form_control_layout_icons.js +95 -143
  31. package/es/components/form/select/select.styles.js +1 -1
  32. package/es/components/form/text_area/text_area.styles.js +1 -1
  33. package/es/components/form/validatable_control/validatable_control.js +8 -55
  34. package/es/components/table/mobile/table_sort_mobile.js +64 -103
  35. package/es/components/table/store/use_unique_column_id.js +25 -0
  36. package/es/components/table/table_header_cell.js +7 -8
  37. package/es/components/table/table_header_cell_checkbox.js +5 -6
  38. package/es/components/tool_tip/tool_tip.js +61 -30
  39. package/es/components/tool_tip/tool_tip_anchor.js +5 -5
  40. package/es/components/tool_tip/tool_tip_manager.js +27 -2
  41. package/eui.d.ts +679 -530
  42. package/i18ntokens.json +810 -738
  43. package/lib/components/avatar/avatar.js +4 -0
  44. package/lib/components/avatar/avatar.styles.js +16 -16
  45. package/lib/components/banner/banner.js +1 -2
  46. package/lib/components/banner/banner.styles.js +1 -1
  47. package/lib/components/basic_table/basic_table.js +34 -4
  48. package/lib/components/basic_table/basic_table.styles.js +19 -1
  49. package/lib/components/basic_table/in_memory_table.js +17 -0
  50. package/lib/components/basic_table/index.js +8 -1
  51. package/lib/components/basic_table/pagination_bar.js +19 -4
  52. package/lib/components/basic_table/pagination_bar.styles.js +26 -0
  53. package/lib/components/basic_table/panel.styles.js +20 -0
  54. package/lib/components/basic_table/use_panel_props.js +33 -0
  55. package/lib/components/date_picker/auto_refresh/refresh_interval.js +175 -229
  56. package/lib/components/date_picker/date_picker.js +1 -1
  57. package/lib/components/flyout/flyout.component.js +10 -6
  58. package/lib/components/flyout/flyout_menu.js +120 -19
  59. package/lib/components/flyout/flyout_menu.styles.js +2 -1
  60. package/lib/components/flyout/manager/actions.js +21 -1
  61. package/lib/components/flyout/manager/flyout_child.js +23 -1
  62. package/lib/components/flyout/manager/flyout_managed.js +41 -17
  63. package/lib/components/flyout/manager/hooks.js +6 -0
  64. package/lib/components/flyout/manager/index.js +12 -0
  65. package/lib/components/flyout/manager/reducer.js +31 -7
  66. package/lib/components/flyout/manager/selectors.js +9 -3
  67. package/lib/components/flyout/manager/store.js +34 -1
  68. package/lib/components/flyout/use_flyout_menu.js +2 -2
  69. package/lib/components/form/field_password/field_password.styles.js +1 -1
  70. package/lib/components/form/field_search/field_search.styles.js +1 -1
  71. package/lib/components/form/form.styles.js +1 -1
  72. package/lib/components/form/form_control_layout/form_control_layout_icons.js +95 -145
  73. package/lib/components/form/select/select.styles.js +1 -1
  74. package/lib/components/form/text_area/text_area.styles.js +1 -1
  75. package/lib/components/form/validatable_control/validatable_control.js +7 -52
  76. package/lib/components/table/mobile/table_sort_mobile.js +71 -108
  77. package/lib/components/table/store/use_unique_column_id.js +34 -0
  78. package/lib/components/table/table_header_cell.js +7 -8
  79. package/lib/components/table/table_header_cell_checkbox.js +5 -6
  80. package/lib/components/tool_tip/tool_tip.js +59 -29
  81. package/lib/components/tool_tip/tool_tip_anchor.js +5 -5
  82. package/lib/components/tool_tip/tool_tip_manager.js +27 -2
  83. package/optimize/es/components/avatar/avatar.js +4 -0
  84. package/optimize/es/components/avatar/avatar.styles.js +16 -16
  85. package/optimize/es/components/banner/banner.js +1 -2
  86. package/optimize/es/components/banner/banner.styles.js +1 -1
  87. package/optimize/es/components/basic_table/basic_table.js +18 -5
  88. package/optimize/es/components/basic_table/basic_table.styles.js +19 -1
  89. package/optimize/es/components/basic_table/index.js +2 -1
  90. package/optimize/es/components/basic_table/pagination_bar.js +19 -4
  91. package/optimize/es/components/basic_table/pagination_bar.styles.js +21 -0
  92. package/optimize/es/components/basic_table/panel.styles.js +14 -0
  93. package/optimize/es/components/basic_table/use_panel_props.js +28 -0
  94. package/optimize/es/components/date_picker/auto_refresh/refresh_interval.js +172 -196
  95. package/optimize/es/components/date_picker/date_picker.js +1 -1
  96. package/optimize/es/components/flyout/flyout.component.js +10 -6
  97. package/optimize/es/components/flyout/flyout_menu.js +99 -18
  98. package/optimize/es/components/flyout/flyout_menu.styles.js +2 -1
  99. package/optimize/es/components/flyout/manager/actions.js +20 -0
  100. package/optimize/es/components/flyout/manager/flyout_managed.js +42 -18
  101. package/optimize/es/components/flyout/manager/hooks.js +1 -1
  102. package/optimize/es/components/flyout/manager/index.js +2 -2
  103. package/optimize/es/components/flyout/manager/reducer.js +32 -8
  104. package/optimize/es/components/flyout/manager/selectors.js +8 -2
  105. package/optimize/es/components/flyout/manager/store.js +35 -2
  106. package/optimize/es/components/flyout/use_flyout_menu.js +2 -2
  107. package/optimize/es/components/form/field_password/field_password.styles.js +1 -1
  108. package/optimize/es/components/form/field_search/field_search.styles.js +1 -1
  109. package/optimize/es/components/form/form.styles.js +1 -1
  110. package/optimize/es/components/form/form_control_layout/form_control_layout_icons.js +96 -115
  111. package/optimize/es/components/form/select/select.styles.js +1 -1
  112. package/optimize/es/components/form/text_area/text_area.styles.js +1 -1
  113. package/optimize/es/components/form/validatable_control/validatable_control.js +7 -48
  114. package/optimize/es/components/table/mobile/table_sort_mobile.js +59 -82
  115. package/optimize/es/components/table/store/use_unique_column_id.js +25 -0
  116. package/optimize/es/components/table/table_header_cell.js +7 -8
  117. package/optimize/es/components/table/table_header_cell_checkbox.js +5 -6
  118. package/optimize/es/components/tool_tip/tool_tip.js +58 -30
  119. package/optimize/es/components/tool_tip/tool_tip_anchor.js +5 -5
  120. package/optimize/es/components/tool_tip/tool_tip_manager.js +27 -2
  121. package/optimize/lib/components/avatar/avatar.js +4 -0
  122. package/optimize/lib/components/avatar/avatar.styles.js +16 -16
  123. package/optimize/lib/components/banner/banner.js +1 -2
  124. package/optimize/lib/components/banner/banner.styles.js +1 -1
  125. package/optimize/lib/components/basic_table/basic_table.js +17 -4
  126. package/optimize/lib/components/basic_table/basic_table.styles.js +19 -1
  127. package/optimize/lib/components/basic_table/index.js +8 -1
  128. package/optimize/lib/components/basic_table/pagination_bar.js +19 -4
  129. package/optimize/lib/components/basic_table/pagination_bar.styles.js +26 -0
  130. package/optimize/lib/components/basic_table/panel.styles.js +20 -0
  131. package/optimize/lib/components/basic_table/use_panel_props.js +33 -0
  132. package/optimize/lib/components/date_picker/auto_refresh/refresh_interval.js +170 -194
  133. package/optimize/lib/components/date_picker/date_picker.js +1 -1
  134. package/optimize/lib/components/flyout/flyout.component.js +10 -6
  135. package/optimize/lib/components/flyout/flyout_menu.js +98 -18
  136. package/optimize/lib/components/flyout/flyout_menu.styles.js +2 -1
  137. package/optimize/lib/components/flyout/manager/actions.js +21 -1
  138. package/optimize/lib/components/flyout/manager/flyout_managed.js +41 -17
  139. package/optimize/lib/components/flyout/manager/hooks.js +6 -0
  140. package/optimize/lib/components/flyout/manager/index.js +12 -0
  141. package/optimize/lib/components/flyout/manager/reducer.js +31 -7
  142. package/optimize/lib/components/flyout/manager/selectors.js +9 -3
  143. package/optimize/lib/components/flyout/manager/store.js +34 -1
  144. package/optimize/lib/components/flyout/use_flyout_menu.js +2 -2
  145. package/optimize/lib/components/form/field_password/field_password.styles.js +1 -1
  146. package/optimize/lib/components/form/field_search/field_search.styles.js +1 -1
  147. package/optimize/lib/components/form/form.styles.js +1 -1
  148. package/optimize/lib/components/form/form_control_layout/form_control_layout_icons.js +96 -117
  149. package/optimize/lib/components/form/select/select.styles.js +1 -1
  150. package/optimize/lib/components/form/text_area/text_area.styles.js +1 -1
  151. package/optimize/lib/components/form/validatable_control/validatable_control.js +6 -49
  152. package/optimize/lib/components/table/mobile/table_sort_mobile.js +61 -83
  153. package/optimize/lib/components/table/store/use_unique_column_id.js +34 -0
  154. package/optimize/lib/components/table/table_header_cell.js +7 -8
  155. package/optimize/lib/components/table/table_header_cell_checkbox.js +5 -6
  156. package/optimize/lib/components/tool_tip/tool_tip.js +57 -29
  157. package/optimize/lib/components/tool_tip/tool_tip_anchor.js +5 -5
  158. package/optimize/lib/components/tool_tip/tool_tip_manager.js +27 -2
  159. package/package.json +8 -5
  160. package/test-env/components/avatar/avatar.js +4 -0
  161. package/test-env/components/avatar/avatar.styles.js +16 -16
  162. package/test-env/components/banner/banner.js +1 -2
  163. package/test-env/components/banner/banner.styles.js +1 -1
  164. package/test-env/components/basic_table/basic_table.js +34 -4
  165. package/test-env/components/basic_table/basic_table.styles.js +19 -1
  166. package/test-env/components/basic_table/in_memory_table.js +17 -0
  167. package/test-env/components/basic_table/index.js +8 -1
  168. package/test-env/components/basic_table/pagination_bar.js +19 -4
  169. package/test-env/components/basic_table/pagination_bar.styles.js +26 -0
  170. package/test-env/components/basic_table/panel.styles.js +20 -0
  171. package/test-env/components/basic_table/use_panel_props.js +33 -0
  172. package/test-env/components/date_picker/auto_refresh/refresh_interval.js +170 -220
  173. package/test-env/components/date_picker/date_picker.js +1 -1
  174. package/test-env/components/flyout/flyout.component.js +10 -6
  175. package/test-env/components/flyout/flyout_menu.js +121 -19
  176. package/test-env/components/flyout/flyout_menu.styles.js +2 -1
  177. package/test-env/components/flyout/manager/actions.js +21 -1
  178. package/test-env/components/flyout/manager/flyout_child.js +23 -1
  179. package/test-env/components/flyout/manager/flyout_managed.js +41 -17
  180. package/test-env/components/flyout/manager/hooks.js +6 -0
  181. package/test-env/components/flyout/manager/index.js +12 -0
  182. package/test-env/components/flyout/manager/reducer.js +31 -7
  183. package/test-env/components/flyout/manager/selectors.js +9 -3
  184. package/test-env/components/flyout/manager/store.js +34 -1
  185. package/test-env/components/flyout/use_flyout_menu.js +2 -2
  186. package/test-env/components/form/field_password/field_password.styles.js +1 -1
  187. package/test-env/components/form/field_search/field_search.styles.js +1 -1
  188. package/test-env/components/form/form.styles.js +1 -1
  189. package/test-env/components/form/form_control_layout/form_control_layout_icons.js +95 -139
  190. package/test-env/components/form/select/select.styles.js +1 -1
  191. package/test-env/components/form/text_area/text_area.styles.js +1 -1
  192. package/test-env/components/form/validatable_control/validatable_control.js +6 -48
  193. package/test-env/components/table/mobile/table_sort_mobile.js +61 -98
  194. package/test-env/components/table/store/use_unique_column_id.js +34 -0
  195. package/test-env/components/table/table_header_cell.js +7 -8
  196. package/test-env/components/table/table_header_cell_checkbox.js +5 -6
  197. package/test-env/components/tool_tip/tool_tip.js +57 -29
  198. package/test-env/components/tool_tip/tool_tip_anchor.js +5 -5
  199. package/test-env/components/tool_tip/tool_tip_manager.js +27 -2
@@ -18,6 +18,8 @@ export var ACTION_CLOSE_ALL = "".concat(PREFIX, "/closeAll");
18
18
  export var ACTION_SET_ACTIVE = "".concat(PREFIX, "/setActive");
19
19
  /** Dispatched when an active flyout's pixel width changes (for responsive layout). */
20
20
  export var ACTION_SET_WIDTH = "".concat(PREFIX, "/setWidth");
21
+ /** Dispatched to set a flyout's menu pagination. */
22
+ export var ACTION_SET_PAGINATION = "".concat(PREFIX, "/setPagination");
21
23
  /** Dispatched to switch layout mode between `side-by-side` and `stacked`. */
22
24
  export var ACTION_SET_LAYOUT_MODE = "".concat(PREFIX, "/setLayoutMode");
23
25
  /** Dispatched to update a flyout's activity stage (e.g., opening -> active). */
@@ -48,6 +50,8 @@ export var ACTION_CLOSE_UNMANAGED_FLYOUT = "".concat(PREFIX, "/closeUnmanagedFly
48
50
 
49
51
  /** Update a flyout's measured width in pixels. */
50
52
 
53
+ /** Set the manager pagination value for a flyout. */
54
+
51
55
  /** Change how flyouts are arranged: `side-by-side` or `stacked`. */
52
56
 
53
57
  /** Set a specific flyout's activity stage. */
@@ -122,6 +126,22 @@ export var setFlyoutWidth = function setFlyoutWidth(flyoutId, width) {
122
126
  };
123
127
  };
124
128
 
129
+ /**
130
+ * Set (or clear) the menu pagination config for a flyout. When set, this
131
+ * overrides any pagination passed via `flyoutMenuProps.pagination` on the
132
+ * flyout itself, allowing reactive updates from a different React root.
133
+ *
134
+ * Only works for managed flyouts. Unmanaged flyouts (session={false}) must use
135
+ * the `flyoutMenuProps.pagination` prop instead.
136
+ */
137
+ export var setPagination = function setPagination(flyoutId, pagination) {
138
+ return {
139
+ type: ACTION_SET_PAGINATION,
140
+ flyoutId: flyoutId,
141
+ pagination: pagination
142
+ };
143
+ };
144
+
125
145
  /** Switch layout mode between `side-by-side` and `stacked`. */
126
146
  export var setLayoutMode = function setLayoutMode(layoutMode) {
127
147
  return {
@@ -26,7 +26,7 @@ import { useFlyoutActivityStage } from './activity_stage';
26
26
  import { LAYOUT_MODE_SIDE_BY_SIDE, LEVEL_CHILD, LEVEL_MAIN, PROPERTY_FLYOUT, PROPERTY_LAYOUT_MODE, PROPERTY_LEVEL } from './const';
27
27
  import { EuiFlyoutIsManagedProvider } from './context';
28
28
  import { euiManagedFlyoutStyles } from './flyout_managed.styles';
29
- import { useFlyoutManager as _useFlyoutManager, useFlyoutId } from './hooks';
29
+ import { useFlyoutManager as _useFlyoutManager, useFlyoutId, useFlyoutPagination } from './hooks';
30
30
  import { useIsFlyoutRegistered } from './selectors';
31
31
  import { getFlyoutManagerStore } from './store';
32
32
  import { createValidationErrorMessage, isNamedSize, validateManagedFlyoutSize, validateSizeCombination } from './validation';
@@ -144,10 +144,10 @@ export var EuiManagedFlyout = /*#__PURE__*/forwardRef(function (_ref2, ref) {
144
144
 
145
145
  // Stabilize the onClose callback
146
146
  var onCloseCallbackRef = useRef();
147
- onCloseCallbackRef.current = function (e) {
147
+ onCloseCallbackRef.current = function (e, meta) {
148
148
  if (onCloseProp) {
149
149
  var event = e || new MouseEvent('click');
150
- onCloseProp(event);
150
+ onCloseProp(event, meta);
151
151
  }
152
152
  };
153
153
 
@@ -172,17 +172,20 @@ export var EuiManagedFlyout = /*#__PURE__*/forwardRef(function (_ref2, ref) {
172
172
  useLayoutEffect(function () {
173
173
  addFlyout(flyoutId, title, level, size, level === LEVEL_MAIN ? historyKey : undefined, _flyoutMenuProps === null || _flyoutMenuProps === void 0 ? void 0 : _flyoutMenuProps.iconType, typeof minWidth === 'number' ? minWidth : undefined);
174
174
  return function () {
175
- var currentStoreState = getFlyoutManagerStore().getState();
176
- var stillInStore = currentStoreState.flyouts.some(function (f) {
175
+ var store = getFlyoutManagerStore();
176
+ var stillInStore = store.getState().flyouts.some(function (f) {
177
177
  return f.flyoutId === flyoutId;
178
178
  });
179
179
  if (stillInStore) {
180
180
  // Normal cleanup (deps changed or explicit close via isOpen=false)
181
181
  level === LEVEL_MAIN ? closeAllFlyouts() : closeFlyout(flyoutId);
182
182
  } else if (wasRegisteredRef.current) {
183
- var _onCloseCallbackRef$c;
184
- // Cascade close: was registered but removed externally (e.g. main closed)
185
- (_onCloseCallbackRef$c = onCloseCallbackRef.current) === null || _onCloseCallbackRef$c === void 0 || _onCloseCallbackRef$c.call(onCloseCallbackRef, new MouseEvent('navigation'));
183
+ var _onCloseCallbackRef$c, _store$consumeCloseMe;
184
+ // Removed externally while mounted: forward the store-stamped reason
185
+ // (e.g. `navigation-back` from goBack), defaulting to cascade.
186
+ (_onCloseCallbackRef$c = onCloseCallbackRef.current) === null || _onCloseCallbackRef$c === void 0 || _onCloseCallbackRef$c.call(onCloseCallbackRef, new MouseEvent('navigation'), (_store$consumeCloseMe = store.consumeCloseMeta(flyoutId)) !== null && _store$consumeCloseMe !== void 0 ? _store$consumeCloseMe : {
187
+ reason: 'navigation-cascade'
188
+ });
186
189
  }
187
190
  wasRegisteredRef.current = false;
188
191
  };
@@ -195,11 +198,16 @@ export var EuiManagedFlyout = /*#__PURE__*/forwardRef(function (_ref2, ref) {
195
198
  wasRegisteredRef.current = true;
196
199
  }
197
200
 
198
- // If flyout was previously registered, is marked as open, but no longer exists in manager state,
199
- // it was removed via navigation (Back button) - trigger close callback
201
+ // If flyout was previously registered, is marked as open, but no longer
202
+ // exists in manager state, it was removed externally while still mounted.
203
+ // Forward the store-stamped reason (e.g. `navigation-back` from goBack);
204
+ // any other removal (e.g. a closeAllFlyouts cascade reaching a backgrounded
205
+ // flyout) defaults to `navigation-cascade`.
200
206
  if (wasRegisteredRef.current && !flyoutExistsInManager) {
201
- var _onCloseCallbackRef$c2;
202
- (_onCloseCallbackRef$c2 = onCloseCallbackRef.current) === null || _onCloseCallbackRef$c2 === void 0 || _onCloseCallbackRef$c2.call(onCloseCallbackRef, new MouseEvent('navigation'));
207
+ var _onCloseCallbackRef$c2, _getFlyoutManagerStor;
208
+ (_onCloseCallbackRef$c2 = onCloseCallbackRef.current) === null || _onCloseCallbackRef$c2 === void 0 || _onCloseCallbackRef$c2.call(onCloseCallbackRef, new MouseEvent('navigation'), (_getFlyoutManagerStor = getFlyoutManagerStore().consumeCloseMeta(flyoutId)) !== null && _getFlyoutManagerStor !== void 0 ? _getFlyoutManagerStor : {
209
+ reason: 'navigation-cascade'
210
+ });
203
211
  wasRegisteredRef.current = false; // Reset to avoid repeated calls
204
212
  }
205
213
  }, [flyoutExistsInManager, flyoutId]);
@@ -223,7 +231,12 @@ export var EuiManagedFlyout = /*#__PURE__*/forwardRef(function (_ref2, ref) {
223
231
  width = _useResizeObserver.width;
224
232
 
225
233
  // Pass the stabilized onClose callback to the flyout menu context
226
- var onClose = function onClose(e) {
234
+ var onClose = function onClose(e, meta) {
235
+ // Clear before flushSync so that effects flushed synchronously inside it
236
+ // (the navigation-back detector) see wasRegisteredRef = false and do not
237
+ // misidentify this user-initiated close as a Back-button navigation.
238
+ wasRegisteredRef.current = false;
239
+
227
240
  // CRITICAL: Update manager state FIRST before allowing React to unmount
228
241
  // This prevents race conditions during portal → inline DOM transitions
229
242
  // and ensures cascade close logic runs before DOM cleanup begins
@@ -231,10 +244,9 @@ export var EuiManagedFlyout = /*#__PURE__*/forwardRef(function (_ref2, ref) {
231
244
  flushSync(function () {
232
245
  level === LEVEL_MAIN ? closeAllFlyouts() : closeFlyout(flyoutId);
233
246
  });
234
- wasRegisteredRef.current = false; // Prevent cleanup from double-firing onClose
235
247
  if (onCloseCallbackRef.current) {
236
248
  var event = e || new MouseEvent('click');
237
- onCloseCallbackRef.current(event);
249
+ onCloseCallbackRef.current(event, meta);
238
250
  }
239
251
  };
240
252
 
@@ -263,11 +275,23 @@ export var EuiManagedFlyout = /*#__PURE__*/forwardRef(function (_ref2, ref) {
263
275
  } : undefined;
264
276
  }, [level, goBack]);
265
277
  var showBackButton = historyItems ? historyItems.length > 0 : false;
278
+
279
+ // When the store has a defined pagination value it takes precedence; the
280
+ // prop acts as a fallback for callers that don't use the cross-root store.
281
+ // Using both simultaneously is not supported and will log a warning in dev.
282
+ var storePagination = useFlyoutPagination(flyoutId);
283
+ var propPagination = _flyoutMenuProps === null || _flyoutMenuProps === void 0 ? void 0 : _flyoutMenuProps.pagination;
284
+ if (process.env.NODE_ENV === 'development' && storePagination != null && propPagination != null) {
285
+ console.warn("flyout-pagination-dual-source-".concat(flyoutId), "[EuiFlyoutManager] flyout \"".concat(flyoutId, "\" has pagination set both via the store (setPagination) ") + 'and via flyoutMenuProps.pagination. The store value will be used. Remove one source to avoid confusion.');
286
+ }
287
+ var pagination = storePagination !== null && storePagination !== void 0 ? storePagination : propPagination;
288
+ var showPaginationControls = pagination != null && pagination.total > 1;
266
289
  var flyoutMenuProps = _objectSpread(_objectSpread({}, _flyoutMenuProps), {}, {
267
- historyItems: historyItems,
268
- showBackButton: showBackButton,
290
+ historyItems: showPaginationControls ? [] : historyItems,
291
+ showBackButton: showPaginationControls ? false : showBackButton,
269
292
  backButtonProps: backButtonProps,
270
- title: title
293
+ title: title,
294
+ pagination: pagination
271
295
  });
272
296
  return ___EmotionJSX(EuiFlyoutIsManagedProvider, {
273
297
  isManaged: true
@@ -13,7 +13,7 @@ import { useIsFlyoutRegistered } from './selectors';
13
13
 
14
14
  // Ensure uniqueness across multiple hook instances, including in test envs
15
15
  var autoGeneratedFlyoutIdCounter = 0;
16
- export { useIsFlyoutActive, useHasActiveSession, useCurrentSession, useCurrentMainFlyout, useCurrentChildFlyout, useFlyoutWidth, useParentFlyoutSize, useHasChildFlyout, usePushPaddingOffsets, useHasPushPadding } from './selectors';
16
+ export { useIsFlyoutActive, useHasActiveSession, useCurrentSession, useCurrentMainFlyout, useCurrentChildFlyout, useFlyoutWidth, useFlyoutPagination, useParentFlyoutSize, useHasChildFlyout, usePushPaddingOffsets, useHasPushPadding } from './selectors';
17
17
  export { useFlyoutLayoutMode } from './layout_mode';
18
18
  export { useIsInManagedFlyout } from './context';
19
19
 
@@ -9,7 +9,7 @@
9
9
  /**
10
10
  * Convenience re-exports of bound action creators for external usage.
11
11
  */
12
- export { addFlyout as addFlyoutAction, closeFlyout as closeFlyoutAction, closeAllFlyouts as closeAllFlyoutsAction, setActiveFlyout as setActiveFlyoutAction, setFlyoutWidth as setFlyoutWidthAction, setPushPadding as setPushPaddingAction, setActivityStage as setActivityStageAction } from './actions';
12
+ export { addFlyout as addFlyoutAction, closeFlyout as closeFlyoutAction, closeAllFlyouts as closeAllFlyoutsAction, setActiveFlyout as setActiveFlyoutAction, setFlyoutWidth as setFlyoutWidthAction, setPagination as setPaginationAction, setPushPadding as setPushPaddingAction, setActivityStage as setActivityStageAction } from './actions';
13
13
 
14
14
  /** Reducer and default state for the flyout manager. */
15
15
  export { flyoutManagerReducer, initialState } from './reducer';
@@ -25,7 +25,7 @@ export { EuiFlyoutManager } from './provider';
25
25
  /**
26
26
  * Selectors and derived state hooks for managed flyouts.
27
27
  */
28
- export { useCurrentChildFlyout, useCurrentMainFlyout, useCurrentSession, useFlyoutId, useFlyoutLayoutMode, useFlyoutManager, useFlyoutWidth, useHasChildFlyout, useIsFlyoutActive, useIsInManagedFlyout, useHasActiveSession, useParentFlyoutSize, usePushPaddingOffsets, useHasPushPadding } from './hooks';
28
+ export { useCurrentChildFlyout, useCurrentMainFlyout, useCurrentSession, useFlyoutId, useFlyoutLayoutMode, useFlyoutManager, useFlyoutPagination, useFlyoutWidth, useHasChildFlyout, useIsFlyoutActive, useIsInManagedFlyout, useHasActiveSession, useParentFlyoutSize, usePushPaddingOffsets, useHasPushPadding } from './hooks';
29
29
  export { EuiFlyoutChild } from './flyout_child';
30
30
  export { EuiFlyoutMain } from './flyout_main';
31
31
 
@@ -10,7 +10,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
10
10
  * Side Public License, v 1.
11
11
  */
12
12
 
13
- import { ACTION_ADD, ACTION_CLOSE, ACTION_CLOSE_ALL, ACTION_SET_ACTIVE, ACTION_SET_LAYOUT_MODE, ACTION_SET_WIDTH, ACTION_SET_ACTIVITY_STAGE, ACTION_GO_BACK, ACTION_GO_TO_FLYOUT, ACTION_SET_PUSH_PADDING, ACTION_ADD_UNMANAGED_FLYOUT, ACTION_CLOSE_UNMANAGED_FLYOUT, ACTION_SET_CONTAINER_ELEMENT, ACTION_SET_REFERENCE_WIDTH } from './actions';
13
+ import { ACTION_ADD, ACTION_CLOSE, ACTION_CLOSE_ALL, ACTION_SET_ACTIVE, ACTION_SET_LAYOUT_MODE, ACTION_SET_WIDTH, ACTION_SET_PAGINATION, ACTION_SET_ACTIVITY_STAGE, ACTION_GO_BACK, ACTION_GO_TO_FLYOUT, ACTION_SET_PUSH_PADDING, ACTION_ADD_UNMANAGED_FLYOUT, ACTION_CLOSE_UNMANAGED_FLYOUT, ACTION_SET_CONTAINER_ELEMENT, ACTION_SET_REFERENCE_WIDTH } from './actions';
14
14
  import { LAYOUT_MODE_SIDE_BY_SIDE, LEVEL_MAIN, LEVEL_CHILD, STAGE_OPENING } from './const';
15
15
  /**
16
16
  * Default flyout manager state used to initialize the reducer.
@@ -351,6 +351,30 @@ export function flyoutManagerReducer() {
351
351
  });
352
352
  }
353
353
 
354
+ // Update a flyout's menu pagination. No-op if unchanged or missing.
355
+ case ACTION_SET_PAGINATION:
356
+ {
357
+ var _flyoutId2 = action.flyoutId,
358
+ pagination = action.pagination;
359
+ var target = state.flyouts.find(function (f) {
360
+ return f.flyoutId === _flyoutId2;
361
+ });
362
+ if (!target) {
363
+ return state;
364
+ }
365
+ if (target.pagination === pagination) {
366
+ return state;
367
+ }
368
+ var _updatedFlyouts = state.flyouts.map(function (flyout) {
369
+ return flyout.flyoutId === _flyoutId2 ? _objectSpread(_objectSpread({}, flyout), {}, {
370
+ pagination: pagination
371
+ }) : flyout;
372
+ });
373
+ return _objectSpread(_objectSpread({}, state), {}, {
374
+ flyouts: _updatedFlyouts
375
+ });
376
+ }
377
+
354
378
  // Switch global layout mode for managed flyouts.
355
379
  case ACTION_SET_LAYOUT_MODE:
356
380
  {
@@ -362,14 +386,14 @@ export function flyoutManagerReducer() {
362
386
  // Update a flyout's activity stage in state
363
387
  case ACTION_SET_ACTIVITY_STAGE:
364
388
  {
365
- var _flyoutId2 = action.flyoutId;
366
- var _updatedFlyouts = state.flyouts.map(function (flyout) {
367
- return flyout.flyoutId === _flyoutId2 ? _objectSpread(_objectSpread({}, flyout), {}, {
389
+ var _flyoutId3 = action.flyoutId;
390
+ var _updatedFlyouts2 = state.flyouts.map(function (flyout) {
391
+ return flyout.flyoutId === _flyoutId3 ? _objectSpread(_objectSpread({}, flyout), {}, {
368
392
  activityStage: action.activityStage
369
393
  }) : flyout;
370
394
  });
371
395
  return _objectSpread(_objectSpread({}, state), {}, {
372
- flyouts: _updatedFlyouts
396
+ flyouts: _updatedFlyouts2
373
397
  });
374
398
  }
375
399
 
@@ -423,7 +447,7 @@ export function flyoutManagerReducer() {
423
447
  // Navigate to a specific flyout (by main session or by child in current session's history)
424
448
  case ACTION_GO_TO_FLYOUT:
425
449
  {
426
- var _flyoutId3 = action.flyoutId,
450
+ var _flyoutId4 = action.flyoutId,
427
451
  _level = action.level;
428
452
  var _currentSessionIndex4 = state.sessions.length - 1;
429
453
  if (_level === LEVEL_CHILD && state.sessions.length > 0) {
@@ -431,7 +455,7 @@ export function flyoutManagerReducer() {
431
455
  var _currentSession3 = state.sessions[_currentSessionIndex4];
432
456
  var _childHistory2 = (_currentSession3$chil = _currentSession3.childHistory) !== null && _currentSession3$chil !== void 0 ? _currentSession3$chil : [];
433
457
  var targetIndex = _childHistory2.findIndex(function (entry) {
434
- return entry.flyoutId === _flyoutId3;
458
+ return entry.flyoutId === _flyoutId4;
435
459
  });
436
460
  if (targetIndex === -1) {
437
461
  return state; // Target child not in history
@@ -463,7 +487,7 @@ export function flyoutManagerReducer() {
463
487
 
464
488
  // Navigate by main flyout: remove all sessions after the target
465
489
  var targetSessionIndex = state.sessions.findIndex(function (session) {
466
- return session.mainFlyoutId === _flyoutId3;
490
+ return session.mainFlyoutId === _flyoutId4;
467
491
  });
468
492
  if (targetSessionIndex === -1) {
469
493
  return state; // Target flyout not found
@@ -74,10 +74,16 @@ export var useFlyoutWidth = function useFlyoutWidth(flyoutId) {
74
74
  return (_useFlyout = useFlyout(flyoutId)) === null || _useFlyout === void 0 ? void 0 : _useFlyout.width;
75
75
  };
76
76
 
77
+ /** Returns the store pagination override for a flyout, if set. */
78
+ export var useFlyoutPagination = function useFlyoutPagination(flyoutId) {
79
+ var _useFlyout2;
80
+ return (_useFlyout2 = useFlyout(flyoutId)) === null || _useFlyout2 === void 0 ? void 0 : _useFlyout2.pagination;
81
+ };
82
+
77
83
  /** The configured minWidth (px) of the specified flyout, or `undefined` if not set. */
78
84
  export var useFlyoutMinWidth = function useFlyoutMinWidth(flyoutId) {
79
- var _useFlyout2;
80
- return (_useFlyout2 = useFlyout(flyoutId)) === null || _useFlyout2 === void 0 ? void 0 : _useFlyout2.minWidth;
85
+ var _useFlyout3;
86
+ return (_useFlyout3 = useFlyout(flyoutId)) === null || _useFlyout3 === void 0 ? void 0 : _useFlyout3.minWidth;
81
87
  };
82
88
 
83
89
  /** The configured size of the parent (main) flyout for a given child flyout ID. */
@@ -7,7 +7,7 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
7
7
  * Side Public License, v 1.
8
8
  */
9
9
 
10
- import { addFlyout as addFlyoutAction, closeFlyout as closeFlyoutAction, closeAllFlyouts as closeAllFlyoutsAction, setActiveFlyout as setActiveFlyoutAction, setFlyoutWidth as setFlyoutWidthAction, setPushPadding as setPushPaddingAction, goBack as goBackAction, goToFlyout as goToFlyoutAction, addUnmanagedFlyout as addUnmanagedFlyoutAction, closeUnmanagedFlyout as closeUnmanagedFlyoutAction, setContainerElement as setContainerElementAction } from './actions';
10
+ import { addFlyout as addFlyoutAction, closeFlyout as closeFlyoutAction, closeAllFlyouts as closeAllFlyoutsAction, setActiveFlyout as setActiveFlyoutAction, setFlyoutWidth as setFlyoutWidthAction, setPagination as setPaginationAction, setPushPadding as setPushPaddingAction, goBack as goBackAction, goToFlyout as goToFlyoutAction, addUnmanagedFlyout as addUnmanagedFlyoutAction, closeUnmanagedFlyout as closeUnmanagedFlyoutAction, setContainerElement as setContainerElementAction } from './actions';
11
11
  import { flyoutManagerReducer, initialState } from './reducer';
12
12
 
13
13
  /**
@@ -19,6 +19,13 @@ function createStore() {
19
19
  var currentState = initial;
20
20
  var listeners = new Set();
21
21
  var eventListeners = new Set();
22
+
23
+ // Transient, one-shot close annotations keyed by flyoutId. `goBack` stamps the
24
+ // flyouts it removes so the managed flyout can report `navigation-back`; any
25
+ // other removal (e.g. closeAllFlyouts cascade) leaves no stamp and defaults to
26
+ // `navigation-cascade`. Kept off reducer state because it is a per-close
27
+ // annotation, not persistent state.
28
+ var pendingCloseMeta = new Map();
22
29
  var getState = function getState() {
23
30
  return currentState;
24
31
  };
@@ -162,6 +169,9 @@ function createStore() {
162
169
  setFlyoutWidth: function setFlyoutWidth(flyoutId, width) {
163
170
  return dispatch(setFlyoutWidthAction(flyoutId, width));
164
171
  },
172
+ setPagination: function setPagination(flyoutId, pagination) {
173
+ return dispatch(setPaginationAction(flyoutId, pagination));
174
+ },
165
175
  setPushPadding: function setPushPadding(side, width) {
166
176
  return dispatch(setPushPaddingAction(side, width));
167
177
  },
@@ -169,7 +179,23 @@ function createStore() {
169
179
  return dispatch(setContainerElementAction(element));
170
180
  },
171
181
  goBack: function goBack() {
172
- return dispatch(goBackAction());
182
+ // Stamp the flyouts goBack removes as `navigation-back` (vs. the default
183
+ // `navigation-cascade`) BEFORE dispatching. dispatch synchronously flushes
184
+ // subscribers, which can consume the meta during unmount, so peek the pure
185
+ // reducer to learn which flyouts go away and stamp them first.
186
+ var action = goBackAction();
187
+ var nextState = flyoutManagerReducer(currentState, action);
188
+ var remaining = new Set(nextState.flyouts.map(function (f) {
189
+ return f.flyoutId;
190
+ }));
191
+ currentState.flyouts.forEach(function (f) {
192
+ if (!remaining.has(f.flyoutId)) {
193
+ pendingCloseMeta.set(f.flyoutId, {
194
+ reason: 'navigation-back'
195
+ });
196
+ }
197
+ });
198
+ dispatch(action);
173
199
  },
174
200
  goToFlyout: function goToFlyout(flyoutId, level) {
175
201
  return dispatch(goToFlyoutAction(flyoutId, level));
@@ -180,6 +206,13 @@ function createStore() {
180
206
  closeUnmanagedFlyout: function closeUnmanagedFlyout(flyoutId) {
181
207
  return dispatch(closeUnmanagedFlyoutAction(flyoutId));
182
208
  },
209
+ consumeCloseMeta: function consumeCloseMeta(flyoutId) {
210
+ var meta = pendingCloseMeta.get(flyoutId);
211
+ if (meta) {
212
+ pendingCloseMeta.delete(flyoutId);
213
+ }
214
+ return meta;
215
+ },
183
216
  historyItems: computeHistoryItems(dispatch) // Initialize with current state
184
217
  };
185
218
  return store;
@@ -40,10 +40,10 @@ export var useEuiFlyoutMenu = function useEuiFlyoutMenu(_ref) {
40
40
  }, [hasMenu, _titleId, generatedMenuId]);
41
41
 
42
42
  // Determine if the menu has any content
43
- // hasBackButton or hasHistory or hasCustomActions or hasVisibleTitle
43
+ // hasBackButton or hasHistory or hasCustomActions or hasVisibleTitle or hasPagination
44
44
  var menuHasContent = hasMenu && (!!flyoutMenuProps.showBackButton || ((_flyoutMenuProps$hist = (_flyoutMenuProps$hist2 = flyoutMenuProps.historyItems) === null || _flyoutMenuProps$hist2 === void 0 ? void 0 : _flyoutMenuProps$hist2.length) !== null && _flyoutMenuProps$hist !== void 0 ? _flyoutMenuProps$hist : 0) > 0 || ((_flyoutMenuProps$cust = (_flyoutMenuProps$cust2 = flyoutMenuProps.customActions) === null || _flyoutMenuProps$cust2 === void 0 ? void 0 : _flyoutMenuProps$cust2.length) !== null && _flyoutMenuProps$cust !== void 0 ? _flyoutMenuProps$cust : 0) > 0 ||
45
45
  // Component defaults to hiding the title, so only explicit false means the title will be visible
46
- !!(flyoutMenuProps.title && flyoutMenuProps.hideTitle === false));
46
+ !!(flyoutMenuProps.title && flyoutMenuProps.hideTitle === false) || !!(flyoutMenuProps.pagination && flyoutMenuProps.pagination.total > 1));
47
47
 
48
48
  // Determine if the menu should be rendered based on the display mode and menu content
49
49
  var shouldRenderMenu = useMemo(function () {
@@ -20,7 +20,7 @@ var _ref = process.env.NODE_ENV === "production" ? {
20
20
  export var euiFieldPasswordStyles = function euiFieldPasswordStyles(euiThemeContext) {
21
21
  var formStyles = euiFormControlStyles(euiThemeContext);
22
22
  return {
23
- euiFieldPassword: /*#__PURE__*/css(formStyles.shared, " &:invalid{", formStyles.invalid, ";}&:focus{", formStyles.focus, ";}&:disabled{", formStyles.disabled, ";}&[readOnly]{", formStyles.readOnly, ";}&:autofill{", formStyles.autoFill, ";};label:euiFieldPassword;"),
23
+ euiFieldPassword: /*#__PURE__*/css(formStyles.shared, " &:is(:invalid, [aria-invalid='true']){", formStyles.invalid, ";}&:focus{", formStyles.focus, ";}&:disabled{", formStyles.disabled, ";}&[readOnly]{", formStyles.readOnly, ";}&:autofill{", formStyles.autoFill, ";};label:euiFieldPassword;"),
24
24
  // Only remove Edge's internal reveal button if we're providing a custom one
25
25
  // This pseudo-element is still supported in Chromium-based Edge.
26
26
  withToggle: _ref,
@@ -11,7 +11,7 @@ import { euiFormControlStyles } from '../form.styles';
11
11
  export var euiFieldSearchStyles = function euiFieldSearchStyles(euiThemeContext) {
12
12
  var formStyles = euiFormControlStyles(euiThemeContext);
13
13
  return {
14
- euiFieldSearch: /*#__PURE__*/css("-webkit-appearance:textfield;&::-webkit-search-decoration,&::-webkit-search-cancel-button{-webkit-appearance:none;}", formStyles.shared, " &:invalid{", formStyles.invalid, ";}&:focus{", formStyles.focus, ";}&:disabled{", formStyles.disabled, ";}&[readOnly]{", formStyles.readOnly, ";}&:autofill{", formStyles.autoFill, ";};label:euiFieldSearch;"),
14
+ euiFieldSearch: /*#__PURE__*/css("-webkit-appearance:textfield;&::-webkit-search-decoration,&::-webkit-search-cancel-button{-webkit-appearance:none;}", formStyles.shared, " &:is(:invalid, [aria-invalid='true']){", formStyles.invalid, ";}&:focus{", formStyles.focus, ";}&:disabled{", formStyles.disabled, ";}&[readOnly]{", formStyles.readOnly, ";}&:autofill{", formStyles.autoFill, ";};label:euiFieldSearch;"),
15
15
  // Skip the css() on the default height to avoid generating a className
16
16
  uncompressed: formStyles.uncompressed,
17
17
  compressed: /*#__PURE__*/css(formStyles.compressed, ";label:compressed;"),
@@ -205,7 +205,7 @@ export var euiFormControlAutoFillStyles = function euiFormControlAutoFillStyles(
205
205
  var borderShadow = "inset 0 0 0 var(--euiFormControlStateAutofillWidth) var(--euiFormControlStateAutofillColor), ".concat(backgroundShadow);
206
206
 
207
207
  // These styles only apply/override Chrome/webkit browsers - Firefox does not set autofill styles
208
- return "\n &:where(:-webkit-autofill) {\n --euiFormControlStateAutofillWidth: ".concat(euiTheme.border.width.thin, ";\n --euiFormControlStateAutofillColor: ").concat(borderColor, ";\n \n -webkit-text-fill-color: ").concat(textColor, ";\n -webkit-box-shadow: ").concat(borderShadow, ";\n \n\n &:hover {\n --euiFormControlStateAutofillColor: ").concat(borderHovered, ";\n }\n\n &:focus {\n --euiFormControlStateAutofillWidth: ").concat(euiTheme.border.width.thick, ";\n }\n\n &:invalid {\n --euiFormControlStateAutofillColor: ").concat(borderInvalid, ";\n\n &:hover {\n --euiFormControlStateAutofillColor: ").concat(borderInvalidHovered, ";\n }\n }\n }\n ");
208
+ return "\n &:where(:-webkit-autofill) {\n --euiFormControlStateAutofillWidth: ".concat(euiTheme.border.width.thin, ";\n --euiFormControlStateAutofillColor: ").concat(borderColor, ";\n \n -webkit-text-fill-color: ").concat(textColor, ";\n -webkit-box-shadow: ").concat(borderShadow, ";\n \n\n &:hover {\n --euiFormControlStateAutofillColor: ").concat(borderHovered, ";\n }\n\n &:focus {\n --euiFormControlStateAutofillWidth: ").concat(euiTheme.border.width.thick, ";\n }\n\n &:is(:invalid, [aria-invalid='true']) {\n --euiFormControlStateAutofillColor: ").concat(borderInvalid, ";\n\n &:hover {\n --euiFormControlStateAutofillColor: ").concat(borderInvalidHovered, ";\n }\n }\n }\n ");
209
209
  };
210
210
  export var euiFormControlAutofillUnsetStyles = "\n\n";
211
211
  export var euiFormControlShowBackgroundLine = function euiFormControlShowBackgroundLine(euiThemeContext, color) {