@elastic/eui 113.2.1 → 114.0.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.
- package/es/components/basic_table/collapsed_item_actions.js +2 -0
- package/es/components/button/split_button/split_button.js +13 -0
- package/es/components/button/split_button/split_button_actions.js +15 -0
- package/es/components/collapsible_nav/collapsible_nav.js +5 -0
- package/es/components/color_picker/color_picker.js +31 -8
- package/es/components/context_menu/context_menu_item.js +9 -3
- package/es/components/context_menu/context_menu_item.styles.js +6 -2
- package/es/components/datagrid/utils/scrolling.js +39 -10
- package/es/components/date_picker/super_date_picker/time_window_buttons.js +17 -3
- package/es/components/flyout/_flyout_overlay.js +34 -4
- package/es/components/flyout/const.js +10 -0
- package/es/components/flyout/flyout.component.js +49 -57
- package/es/components/flyout/flyout.js +10 -2
- package/es/components/flyout/flyout.styles.js +2 -2
- package/es/components/flyout/flyout_menu.js +19 -5
- package/es/components/flyout/flyout_resizable.js +5 -0
- package/es/components/flyout/manager/actions.js +12 -5
- package/es/components/flyout/manager/flyout_child.js +9 -2
- package/es/components/flyout/manager/flyout_managed.js +27 -14
- package/es/components/flyout/manager/reducer.js +251 -54
- package/es/components/flyout/manager/store.js +74 -12
- package/es/components/flyout/use_flyout_menu.js +70 -0
- package/es/components/form/file_picker/file_picker.js +46 -18
- package/es/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
- package/es/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +172 -0
- package/es/components/overlay_mask/overlay_mask.js +10 -3
- package/es/components/tree_view/tree_view_item.styles.js +1 -1
- package/es/services/hooks/index.js +8 -8
- package/es/services/hooks/useIsPointerDown.js +6 -15
- package/es/services/index.js +1 -1
- package/eui.d.ts +477 -63
- package/i18ntokens.json +661 -643
- package/lib/components/basic_table/collapsed_item_actions.js +2 -0
- package/lib/components/button/split_button/split_button.js +13 -0
- package/lib/components/button/split_button/split_button_actions.js +15 -0
- package/lib/components/collapsible_nav/collapsible_nav.js +5 -0
- package/lib/components/color_picker/color_picker.js +30 -7
- package/lib/components/context_menu/context_menu_item.js +9 -3
- package/lib/components/context_menu/context_menu_item.styles.js +5 -1
- package/lib/components/datagrid/utils/scrolling.js +37 -8
- package/lib/components/date_picker/super_date_picker/time_window_buttons.js +17 -3
- package/lib/components/flyout/_flyout_overlay.js +33 -3
- package/lib/components/flyout/const.js +11 -1
- package/lib/components/flyout/flyout.component.js +48 -56
- package/lib/components/flyout/flyout.js +15 -1
- package/lib/components/flyout/flyout.styles.js +2 -2
- package/lib/components/flyout/flyout_menu.js +19 -5
- package/lib/components/flyout/flyout_resizable.js +5 -0
- package/lib/components/flyout/manager/actions.js +12 -5
- package/lib/components/flyout/manager/flyout_child.js +9 -2
- package/lib/components/flyout/manager/flyout_managed.js +19 -12
- package/lib/components/flyout/manager/reducer.js +250 -53
- package/lib/components/flyout/manager/store.js +74 -14
- package/lib/components/flyout/use_flyout_menu.js +75 -0
- package/lib/components/form/file_picker/file_picker.js +46 -18
- package/lib/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
- package/lib/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +179 -0
- package/lib/components/overlay_mask/overlay_mask.js +10 -3
- package/lib/components/tree_view/tree_view_item.styles.js +1 -1
- package/lib/services/hooks/index.js +60 -91
- package/lib/services/hooks/useIsPointerDown.js +7 -14
- package/lib/services/index.js +70 -11
- package/optimize/es/components/basic_table/collapsed_item_actions.js +2 -0
- package/optimize/es/components/color_picker/color_picker.js +31 -8
- package/optimize/es/components/context_menu/context_menu_item.js +3 -2
- package/optimize/es/components/context_menu/context_menu_item.styles.js +6 -2
- package/optimize/es/components/datagrid/utils/scrolling.js +39 -10
- package/optimize/es/components/date_picker/super_date_picker/time_window_buttons.js +17 -3
- package/optimize/es/components/flyout/_flyout_overlay.js +34 -4
- package/optimize/es/components/flyout/const.js +10 -0
- package/optimize/es/components/flyout/flyout.component.js +49 -57
- package/optimize/es/components/flyout/flyout.js +5 -2
- package/optimize/es/components/flyout/flyout.styles.js +2 -2
- package/optimize/es/components/flyout/flyout_menu.js +7 -3
- package/optimize/es/components/flyout/manager/actions.js +12 -5
- package/optimize/es/components/flyout/manager/flyout_managed.js +18 -12
- package/optimize/es/components/flyout/manager/reducer.js +251 -54
- package/optimize/es/components/flyout/manager/store.js +69 -12
- package/optimize/es/components/flyout/use_flyout_menu.js +69 -0
- package/optimize/es/components/form/file_picker/file_picker.js +35 -18
- package/optimize/es/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
- package/optimize/es/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +172 -0
- package/optimize/es/components/overlay_mask/overlay_mask.js +4 -2
- package/optimize/es/components/tree_view/tree_view_item.styles.js +1 -1
- package/optimize/es/services/hooks/index.js +8 -8
- package/optimize/es/services/hooks/useIsPointerDown.js +6 -10
- package/optimize/es/services/index.js +1 -1
- package/optimize/lib/components/basic_table/collapsed_item_actions.js +2 -0
- package/optimize/lib/components/color_picker/color_picker.js +30 -7
- package/optimize/lib/components/context_menu/context_menu_item.js +3 -2
- package/optimize/lib/components/context_menu/context_menu_item.styles.js +5 -1
- package/optimize/lib/components/datagrid/utils/scrolling.js +37 -8
- package/optimize/lib/components/date_picker/super_date_picker/time_window_buttons.js +17 -3
- package/optimize/lib/components/flyout/_flyout_overlay.js +33 -3
- package/optimize/lib/components/flyout/const.js +11 -1
- package/optimize/lib/components/flyout/flyout.component.js +48 -56
- package/optimize/lib/components/flyout/flyout.js +10 -1
- package/optimize/lib/components/flyout/flyout.styles.js +2 -2
- package/optimize/lib/components/flyout/flyout_menu.js +7 -3
- package/optimize/lib/components/flyout/manager/actions.js +12 -5
- package/optimize/lib/components/flyout/manager/flyout_managed.js +18 -12
- package/optimize/lib/components/flyout/manager/reducer.js +250 -53
- package/optimize/lib/components/flyout/manager/store.js +70 -12
- package/optimize/lib/components/flyout/use_flyout_menu.js +74 -0
- package/optimize/lib/components/form/file_picker/file_picker.js +35 -18
- package/optimize/lib/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
- package/optimize/lib/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +179 -0
- package/optimize/lib/components/overlay_mask/overlay_mask.js +4 -2
- package/optimize/lib/components/tree_view/tree_view_item.styles.js +1 -1
- package/optimize/lib/services/hooks/index.js +60 -91
- package/optimize/lib/services/hooks/useIsPointerDown.js +5 -10
- package/optimize/lib/services/index.js +70 -11
- package/package.json +4 -4
- package/test-env/components/basic_table/collapsed_item_actions.js +2 -0
- package/test-env/components/button/split_button/split_button.js +13 -0
- package/test-env/components/button/split_button/split_button_actions.js +15 -0
- package/test-env/components/collapsible_nav/collapsible_nav.js +5 -0
- package/test-env/components/color_picker/color_picker.js +30 -7
- package/test-env/components/context_menu/context_menu_item.js +9 -3
- package/test-env/components/context_menu/context_menu_item.styles.js +5 -1
- package/test-env/components/datagrid/utils/scrolling.js +37 -8
- package/test-env/components/date_picker/super_date_picker/time_window_buttons.js +17 -3
- package/test-env/components/flyout/_flyout_overlay.js +33 -3
- package/test-env/components/flyout/const.js +11 -1
- package/test-env/components/flyout/flyout.component.js +48 -56
- package/test-env/components/flyout/flyout.styles.js +2 -2
- package/test-env/components/flyout/flyout_menu.js +19 -5
- package/test-env/components/flyout/flyout_resizable.js +5 -0
- package/test-env/components/flyout/manager/actions.js +12 -5
- package/test-env/components/flyout/manager/flyout_child.js +9 -2
- package/test-env/components/flyout/manager/flyout_managed.js +19 -12
- package/test-env/components/flyout/manager/reducer.js +250 -53
- package/test-env/components/flyout/manager/store.js +70 -12
- package/test-env/components/flyout/use_flyout_menu.js +74 -0
- package/test-env/components/form/file_picker/file_picker.js +46 -18
- package/test-env/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
- package/test-env/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +179 -0
- package/test-env/components/overlay_mask/overlay_mask.js +10 -3
- package/test-env/components/tree_view/tree_view_item.styles.js +1 -1
- package/test-env/services/hooks/index.js +60 -91
- package/test-env/services/hooks/useIsPointerDown.js +5 -10
- package/test-env/services/index.js +70 -11
|
@@ -11,7 +11,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
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';
|
|
14
|
-
import { LAYOUT_MODE_SIDE_BY_SIDE, LEVEL_MAIN, STAGE_OPENING } from './const';
|
|
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.
|
|
17
17
|
*/
|
|
@@ -26,6 +26,28 @@ export var initialState = {
|
|
|
26
26
|
currentZIndex: 0,
|
|
27
27
|
unmanagedFlyouts: []
|
|
28
28
|
};
|
|
29
|
+
var addSessionFlyoutsToRemove = function addSessionFlyoutsToRemove(session, flyoutsToRemove) {
|
|
30
|
+
var _session$childHistory;
|
|
31
|
+
flyoutsToRemove.add(session.mainFlyoutId);
|
|
32
|
+
if (session.childFlyoutId) {
|
|
33
|
+
flyoutsToRemove.add(session.childFlyoutId);
|
|
34
|
+
}
|
|
35
|
+
((_session$childHistory = session.childHistory) !== null && _session$childHistory !== void 0 ? _session$childHistory : []).forEach(function (e) {
|
|
36
|
+
return flyoutsToRemove.add(e.flyoutId);
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
var moveHistoryGroupToTop = function moveHistoryGroupToTop(sessions, historyKey) {
|
|
40
|
+
var groupSessions = [];
|
|
41
|
+
var otherSessions = [];
|
|
42
|
+
sessions.forEach(function (session) {
|
|
43
|
+
if (session.historyKey === historyKey) {
|
|
44
|
+
groupSessions.push(session);
|
|
45
|
+
} else {
|
|
46
|
+
otherSessions.push(session);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
return [].concat(otherSessions, groupSessions);
|
|
50
|
+
};
|
|
29
51
|
|
|
30
52
|
/**
|
|
31
53
|
* Reducer handling all flyout manager actions and state transitions.
|
|
@@ -69,16 +91,21 @@ export function flyoutManagerReducer() {
|
|
|
69
91
|
// session exists, do nothing (invalid child without a parent).
|
|
70
92
|
case ACTION_ADD:
|
|
71
93
|
{
|
|
94
|
+
var _currentSession$child;
|
|
72
95
|
var flyoutId = action.flyoutId,
|
|
73
96
|
title = action.title,
|
|
74
97
|
level = action.level,
|
|
75
98
|
size = action.size,
|
|
99
|
+
historyKey = action.historyKey,
|
|
100
|
+
iconType = action.iconType,
|
|
76
101
|
minWidth = action.minWidth;
|
|
77
|
-
|
|
78
|
-
// Ignore duplicate registrations
|
|
79
|
-
if (state.flyouts.some(function (f) {
|
|
102
|
+
var isDuplicate = state.flyouts.some(function (f) {
|
|
80
103
|
return f.flyoutId === flyoutId;
|
|
81
|
-
})
|
|
104
|
+
});
|
|
105
|
+
var isIdempotentChild = level === LEVEL_CHILD && state.sessions.length > 0 && state.sessions[state.sessions.length - 1].childFlyoutId === flyoutId;
|
|
106
|
+
|
|
107
|
+
// Ignore duplicate registrations (except idempotent child re-registration after goBack)
|
|
108
|
+
if (isDuplicate && !isIdempotentChild) {
|
|
82
109
|
return state;
|
|
83
110
|
}
|
|
84
111
|
var newFlyoutState = {
|
|
@@ -88,13 +115,16 @@ export function flyoutManagerReducer() {
|
|
|
88
115
|
minWidth: minWidth,
|
|
89
116
|
activityStage: STAGE_OPENING
|
|
90
117
|
};
|
|
91
|
-
var newFlyouts = [].concat(_toConsumableArray(state.flyouts), [newFlyoutState]);
|
|
118
|
+
var newFlyouts = isIdempotentChild ? state.flyouts : [].concat(_toConsumableArray(state.flyouts), [newFlyoutState]);
|
|
92
119
|
if (level === LEVEL_MAIN) {
|
|
93
120
|
var newSession = {
|
|
94
121
|
mainFlyoutId: flyoutId,
|
|
95
122
|
title: title,
|
|
123
|
+
iconType: iconType,
|
|
96
124
|
childFlyoutId: null,
|
|
97
|
-
|
|
125
|
+
childHistory: [],
|
|
126
|
+
zIndex: state.currentZIndex,
|
|
127
|
+
historyKey: historyKey !== null && historyKey !== void 0 ? historyKey : Symbol()
|
|
98
128
|
};
|
|
99
129
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
100
130
|
sessions: [].concat(_toConsumableArray(state.sessions), [newSession]),
|
|
@@ -110,8 +140,52 @@ export function flyoutManagerReducer() {
|
|
|
110
140
|
}
|
|
111
141
|
var updatedSessions = _toConsumableArray(state.sessions);
|
|
112
142
|
var currentSessionIndex = updatedSessions.length - 1;
|
|
113
|
-
|
|
114
|
-
|
|
143
|
+
var currentSession = updatedSessions[currentSessionIndex];
|
|
144
|
+
var childHistory = (_currentSession$child = currentSession.childHistory) !== null && _currentSession$child !== void 0 ? _currentSession$child : [];
|
|
145
|
+
|
|
146
|
+
// Idempotent re-registration (e.g. after goBack): flyout already in flyouts and session already points to it
|
|
147
|
+
if (state.flyouts.some(function (f) {
|
|
148
|
+
return f.flyoutId === flyoutId;
|
|
149
|
+
})) {
|
|
150
|
+
if (currentSession.childFlyoutId === flyoutId) {
|
|
151
|
+
updatedSessions[currentSessionIndex] = _objectSpread(_objectSpread({}, currentSession), {}, {
|
|
152
|
+
childTitle: title,
|
|
153
|
+
childIconType: iconType,
|
|
154
|
+
childHistory: childHistory
|
|
155
|
+
});
|
|
156
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
157
|
+
sessions: updatedSessions
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
return state; // duplicate registration for a different child, ignore
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// Session already has a child: push current child to history, then set new child (do not remove previous from flyouts)
|
|
164
|
+
if (currentSession.childFlyoutId) {
|
|
165
|
+
var _currentSession$child2;
|
|
166
|
+
var historyEntry = {
|
|
167
|
+
flyoutId: currentSession.childFlyoutId,
|
|
168
|
+
title: (_currentSession$child2 = currentSession.childTitle) !== null && _currentSession$child2 !== void 0 ? _currentSession$child2 : '',
|
|
169
|
+
iconType: currentSession.childIconType
|
|
170
|
+
};
|
|
171
|
+
updatedSessions[currentSessionIndex] = _objectSpread(_objectSpread({}, currentSession), {}, {
|
|
172
|
+
childHistory: [].concat(_toConsumableArray(childHistory), [historyEntry]),
|
|
173
|
+
childFlyoutId: flyoutId,
|
|
174
|
+
childTitle: title,
|
|
175
|
+
childIconType: iconType
|
|
176
|
+
});
|
|
177
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
178
|
+
sessions: updatedSessions,
|
|
179
|
+
flyouts: newFlyouts
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// First child in session
|
|
184
|
+
updatedSessions[currentSessionIndex] = _objectSpread(_objectSpread({}, currentSession), {}, {
|
|
185
|
+
childFlyoutId: flyoutId,
|
|
186
|
+
childTitle: title,
|
|
187
|
+
childIconType: iconType,
|
|
188
|
+
childHistory: childHistory
|
|
115
189
|
});
|
|
116
190
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
117
191
|
sessions: updatedSessions,
|
|
@@ -121,10 +195,11 @@ export function flyoutManagerReducer() {
|
|
|
121
195
|
|
|
122
196
|
// Unregister a flyout and update sessions accordingly.
|
|
123
197
|
// - When closing a `main` flyout, drop its entire session and all associated flyouts.
|
|
124
|
-
// - When closing a `child` flyout,
|
|
125
|
-
//
|
|
198
|
+
// - When closing a `child` flyout, find the session that owns it (childFlyoutId or
|
|
199
|
+
// childHistory) and clear that session's child state so navigation back stays consistent.
|
|
126
200
|
case ACTION_CLOSE:
|
|
127
201
|
{
|
|
202
|
+
var _owningSession$childH;
|
|
128
203
|
var removedFlyout = state.flyouts.find(function (f) {
|
|
129
204
|
return f.flyoutId === action.flyoutId;
|
|
130
205
|
});
|
|
@@ -137,11 +212,15 @@ export function flyoutManagerReducer() {
|
|
|
137
212
|
return session.mainFlyoutId === action.flyoutId;
|
|
138
213
|
});
|
|
139
214
|
if (sessionToRemove) {
|
|
140
|
-
|
|
215
|
+
var _sessionToRemove$chil;
|
|
216
|
+
// Remove all flyouts associated with this session (main + current child + child history)
|
|
141
217
|
var flyoutsToRemove = new Set([action.flyoutId]);
|
|
142
218
|
if (sessionToRemove.childFlyoutId) {
|
|
143
219
|
flyoutsToRemove.add(sessionToRemove.childFlyoutId);
|
|
144
220
|
}
|
|
221
|
+
((_sessionToRemove$chil = sessionToRemove.childHistory) !== null && _sessionToRemove$chil !== void 0 ? _sessionToRemove$chil : []).forEach(function (entry) {
|
|
222
|
+
return flyoutsToRemove.add(entry.flyoutId);
|
|
223
|
+
});
|
|
145
224
|
var _newFlyouts = state.flyouts.filter(function (f) {
|
|
146
225
|
return !flyoutsToRemove.has(f.flyoutId);
|
|
147
226
|
});
|
|
@@ -162,43 +241,80 @@ export function flyoutManagerReducer() {
|
|
|
162
241
|
}
|
|
163
242
|
}
|
|
164
243
|
|
|
165
|
-
// Handle child flyout closing
|
|
166
|
-
|
|
167
|
-
return f.flyoutId !== action.flyoutId;
|
|
168
|
-
});
|
|
244
|
+
// Handle child flyout closing: find the session that owns this child and
|
|
245
|
+
// clear that session's child state (so we stay consistent when navigating back).
|
|
169
246
|
if (state.sessions.length === 0) {
|
|
170
247
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
171
|
-
flyouts:
|
|
248
|
+
flyouts: state.flyouts.filter(function (f) {
|
|
249
|
+
return f.flyoutId !== action.flyoutId;
|
|
250
|
+
})
|
|
172
251
|
});
|
|
173
252
|
}
|
|
174
|
-
var
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
253
|
+
var owningSessionIndex = state.sessions.findIndex(function (session) {
|
|
254
|
+
var _session$childHistory2;
|
|
255
|
+
return session.childFlyoutId === action.flyoutId || ((_session$childHistory2 = session.childHistory) !== null && _session$childHistory2 !== void 0 ? _session$childHistory2 : []).some(function (entry) {
|
|
256
|
+
return entry.flyoutId === action.flyoutId;
|
|
257
|
+
});
|
|
258
|
+
});
|
|
259
|
+
if (owningSessionIndex === -1) {
|
|
260
|
+
// Closed flyout not in any session's child state; just remove the one flyout
|
|
261
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
262
|
+
flyouts: state.flyouts.filter(function (f) {
|
|
263
|
+
return f.flyoutId !== action.flyoutId;
|
|
264
|
+
})
|
|
179
265
|
});
|
|
180
266
|
}
|
|
267
|
+
var owningSession = state.sessions[owningSessionIndex];
|
|
268
|
+
var childIds = new Set([owningSession.childFlyoutId].concat(_toConsumableArray(((_owningSession$childH = owningSession.childHistory) !== null && _owningSession$childH !== void 0 ? _owningSession$childH : []).map(function (e) {
|
|
269
|
+
return e.flyoutId;
|
|
270
|
+
}))).filter(Boolean));
|
|
271
|
+
var _newFlyouts2 = state.flyouts.filter(function (f) {
|
|
272
|
+
return !childIds.has(f.flyoutId);
|
|
273
|
+
});
|
|
274
|
+
var _updatedSessions = _toConsumableArray(state.sessions);
|
|
275
|
+
_updatedSessions[owningSessionIndex] = _objectSpread(_objectSpread({}, owningSession), {}, {
|
|
276
|
+
childFlyoutId: null,
|
|
277
|
+
childTitle: undefined,
|
|
278
|
+
childIconType: undefined,
|
|
279
|
+
childHistory: []
|
|
280
|
+
});
|
|
181
281
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
182
282
|
sessions: _updatedSessions,
|
|
183
283
|
flyouts: _newFlyouts2
|
|
184
284
|
});
|
|
185
285
|
}
|
|
186
286
|
|
|
187
|
-
// Unregister all flyouts.
|
|
287
|
+
// Unregister all flyouts (within the current history group only).
|
|
188
288
|
case ACTION_CLOSE_ALL:
|
|
189
289
|
{
|
|
190
290
|
if (state.sessions.length === 0) {
|
|
191
291
|
return state;
|
|
192
292
|
}
|
|
293
|
+
var _currentSessionIndex = state.sessions.length - 1;
|
|
294
|
+
var _currentSession = state.sessions[_currentSessionIndex];
|
|
295
|
+
var currentKey = _currentSession.historyKey;
|
|
193
296
|
|
|
194
|
-
//
|
|
297
|
+
// Remove all sessions that have the current historyKey (entire group)
|
|
298
|
+
var _newSessions = state.sessions.filter(function (s) {
|
|
299
|
+
return s.historyKey !== currentKey;
|
|
300
|
+
});
|
|
301
|
+
var _flyoutsToRemove = new Set();
|
|
302
|
+
state.sessions.forEach(function (session) {
|
|
303
|
+
if (session.historyKey === currentKey) {
|
|
304
|
+
addSessionFlyoutsToRemove(session, _flyoutsToRemove);
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
var _newFlyouts3 = state.flyouts.filter(function (f) {
|
|
308
|
+
return !_flyoutsToRemove.has(f.flyoutId);
|
|
309
|
+
});
|
|
195
310
|
var _newCurrentZIndex2 = state.currentZIndex;
|
|
196
|
-
if (state.unmanagedFlyouts.length === 0) {
|
|
311
|
+
if (_newSessions.length === 0 && state.unmanagedFlyouts.length === 0) {
|
|
197
312
|
_newCurrentZIndex2 = 0;
|
|
198
313
|
}
|
|
199
|
-
return _objectSpread(_objectSpread({},
|
|
200
|
-
|
|
201
|
-
|
|
314
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
315
|
+
sessions: _newSessions,
|
|
316
|
+
flyouts: _newFlyouts3,
|
|
317
|
+
currentZIndex: _newCurrentZIndex2
|
|
202
318
|
});
|
|
203
319
|
}
|
|
204
320
|
|
|
@@ -257,59 +373,140 @@ export function flyoutManagerReducer() {
|
|
|
257
373
|
});
|
|
258
374
|
}
|
|
259
375
|
|
|
260
|
-
// Go back
|
|
376
|
+
// Go back: pop child history when any, else pop current session (only within same historyKey).
|
|
261
377
|
case ACTION_GO_BACK:
|
|
262
378
|
{
|
|
379
|
+
var _currentSession2$chil;
|
|
263
380
|
if (state.sessions.length === 0) {
|
|
264
381
|
return state;
|
|
265
382
|
}
|
|
266
383
|
var _currentSessionIndex3 = state.sessions.length - 1;
|
|
267
|
-
var
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
384
|
+
var _currentSession2 = state.sessions[_currentSessionIndex3];
|
|
385
|
+
var _childHistory = (_currentSession2$chil = _currentSession2.childHistory) !== null && _currentSession2$chil !== void 0 ? _currentSession2$chil : [];
|
|
386
|
+
if (_childHistory.length > 0) {
|
|
387
|
+
// Pop one child: set current child to the last entry in history, remove the current child flyout
|
|
388
|
+
var popped = _childHistory[_childHistory.length - 1];
|
|
389
|
+
var newChildHistory = _childHistory.slice(0, -1);
|
|
390
|
+
var _updatedSessions3 = _toConsumableArray(state.sessions);
|
|
391
|
+
_updatedSessions3[_currentSessionIndex3] = _objectSpread(_objectSpread({}, _currentSession2), {}, {
|
|
392
|
+
childHistory: newChildHistory,
|
|
393
|
+
childFlyoutId: popped.flyoutId,
|
|
394
|
+
childTitle: popped.title,
|
|
395
|
+
childIconType: popped.iconType
|
|
396
|
+
});
|
|
397
|
+
var _newFlyouts4 = state.flyouts.filter(function (f) {
|
|
398
|
+
return f.flyoutId !== _currentSession2.childFlyoutId;
|
|
399
|
+
});
|
|
400
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
401
|
+
sessions: _updatedSessions3,
|
|
402
|
+
flyouts: _newFlyouts4
|
|
403
|
+
});
|
|
273
404
|
}
|
|
274
|
-
|
|
275
|
-
|
|
405
|
+
|
|
406
|
+
// No child history: pop current session (main + all its children)
|
|
407
|
+
var _flyoutsToRemove2 = new Set();
|
|
408
|
+
addSessionFlyoutsToRemove(_currentSession2, _flyoutsToRemove2);
|
|
409
|
+
var sessionsWithoutCurrent = state.sessions.slice(0, _currentSessionIndex3);
|
|
410
|
+
var hasRemainingInCurrentGroup = sessionsWithoutCurrent.some(function (s) {
|
|
411
|
+
return s.historyKey === _currentSession2.historyKey;
|
|
412
|
+
});
|
|
413
|
+
var _newSessions2 = hasRemainingInCurrentGroup ? moveHistoryGroupToTop(sessionsWithoutCurrent, _currentSession2.historyKey) : sessionsWithoutCurrent;
|
|
414
|
+
var _newFlyouts5 = state.flyouts.filter(function (f) {
|
|
415
|
+
return !_flyoutsToRemove2.has(f.flyoutId);
|
|
276
416
|
});
|
|
277
|
-
var _newSessions = state.sessions.slice(0, _currentSessionIndex3);
|
|
278
417
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
279
|
-
sessions:
|
|
280
|
-
flyouts:
|
|
418
|
+
sessions: _newSessions2,
|
|
419
|
+
flyouts: _newFlyouts5
|
|
281
420
|
});
|
|
282
421
|
}
|
|
283
422
|
|
|
284
|
-
// Navigate to a specific flyout (
|
|
423
|
+
// Navigate to a specific flyout (by main session or by child in current session's history)
|
|
285
424
|
case ACTION_GO_TO_FLYOUT:
|
|
286
425
|
{
|
|
287
|
-
var _flyoutId3 = action.flyoutId
|
|
426
|
+
var _flyoutId3 = action.flyoutId,
|
|
427
|
+
_level = action.level;
|
|
428
|
+
var _currentSessionIndex4 = state.sessions.length - 1;
|
|
429
|
+
if (_level === LEVEL_CHILD && state.sessions.length > 0) {
|
|
430
|
+
var _currentSession3$chil;
|
|
431
|
+
var _currentSession3 = state.sessions[_currentSessionIndex4];
|
|
432
|
+
var _childHistory2 = (_currentSession3$chil = _currentSession3.childHistory) !== null && _currentSession3$chil !== void 0 ? _currentSession3$chil : [];
|
|
433
|
+
var targetIndex = _childHistory2.findIndex(function (entry) {
|
|
434
|
+
return entry.flyoutId === _flyoutId3;
|
|
435
|
+
});
|
|
436
|
+
if (targetIndex === -1) {
|
|
437
|
+
return state; // Target child not in history
|
|
438
|
+
}
|
|
439
|
+
var targetEntry = _childHistory2[targetIndex];
|
|
440
|
+
var _newChildHistory = _childHistory2.slice(0, targetIndex);
|
|
441
|
+
var _flyoutsToRemove3 = new Set();
|
|
442
|
+
if (_currentSession3.childFlyoutId) {
|
|
443
|
+
_flyoutsToRemove3.add(_currentSession3.childFlyoutId);
|
|
444
|
+
}
|
|
445
|
+
_childHistory2.slice(targetIndex + 1).forEach(function (e) {
|
|
446
|
+
_flyoutsToRemove3.add(e.flyoutId);
|
|
447
|
+
});
|
|
448
|
+
var _newFlyouts6 = state.flyouts.filter(function (f) {
|
|
449
|
+
return !_flyoutsToRemove3.has(f.flyoutId);
|
|
450
|
+
});
|
|
451
|
+
var _updatedSessions4 = _toConsumableArray(state.sessions);
|
|
452
|
+
_updatedSessions4[_currentSessionIndex4] = _objectSpread(_objectSpread({}, _currentSession3), {}, {
|
|
453
|
+
childHistory: _newChildHistory,
|
|
454
|
+
childFlyoutId: targetEntry.flyoutId,
|
|
455
|
+
childTitle: targetEntry.title,
|
|
456
|
+
childIconType: targetEntry.iconType
|
|
457
|
+
});
|
|
458
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
459
|
+
sessions: _updatedSessions4,
|
|
460
|
+
flyouts: _newFlyouts6
|
|
461
|
+
});
|
|
462
|
+
}
|
|
288
463
|
|
|
289
|
-
//
|
|
464
|
+
// Navigate by main flyout: remove all sessions after the target
|
|
290
465
|
var targetSessionIndex = state.sessions.findIndex(function (session) {
|
|
291
466
|
return session.mainFlyoutId === _flyoutId3;
|
|
292
467
|
});
|
|
293
468
|
if (targetSessionIndex === -1) {
|
|
294
469
|
return state; // Target flyout not found
|
|
295
470
|
}
|
|
471
|
+
var _currentSession4 = state.sessions[_currentSessionIndex4];
|
|
472
|
+
var targetSession = state.sessions[targetSessionIndex];
|
|
296
473
|
|
|
297
|
-
//
|
|
474
|
+
// Group-local navigation: keep other history groups, remove only newer sessions in target's group,
|
|
475
|
+
// then bring that group to the top.
|
|
476
|
+
if (targetSession.historyKey === _currentSession4.historyKey) {
|
|
477
|
+
var _flyoutsToRemove4 = new Set();
|
|
478
|
+
var sessionsAfterTargetInGroup = state.sessions.filter(function (session, index) {
|
|
479
|
+
return index > targetSessionIndex && session.historyKey === targetSession.historyKey;
|
|
480
|
+
});
|
|
481
|
+
sessionsAfterTargetInGroup.forEach(function (session) {
|
|
482
|
+
addSessionFlyoutsToRemove(session, _flyoutsToRemove4);
|
|
483
|
+
});
|
|
484
|
+
var sessionsWithoutRemoved = state.sessions.filter(function (session) {
|
|
485
|
+
return !sessionsAfterTargetInGroup.some(function (removed) {
|
|
486
|
+
return removed.mainFlyoutId === session.mainFlyoutId;
|
|
487
|
+
});
|
|
488
|
+
});
|
|
489
|
+
var reorderedSessions = moveHistoryGroupToTop(sessionsWithoutRemoved, targetSession.historyKey);
|
|
490
|
+
var _newFlyouts7 = state.flyouts.filter(function (f) {
|
|
491
|
+
return !_flyoutsToRemove4.has(f.flyoutId);
|
|
492
|
+
});
|
|
493
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
494
|
+
sessions: reorderedSessions,
|
|
495
|
+
flyouts: _newFlyouts7
|
|
496
|
+
});
|
|
497
|
+
}
|
|
298
498
|
var sessionsToClose = state.sessions.slice(targetSessionIndex + 1);
|
|
299
|
-
var
|
|
499
|
+
var _flyoutsToRemove5 = new Set();
|
|
300
500
|
sessionsToClose.forEach(function (session) {
|
|
301
|
-
|
|
302
|
-
if (session.childFlyoutId) {
|
|
303
|
-
_flyoutsToRemove2.add(session.childFlyoutId);
|
|
304
|
-
}
|
|
501
|
+
addSessionFlyoutsToRemove(session, _flyoutsToRemove5);
|
|
305
502
|
});
|
|
306
|
-
var
|
|
307
|
-
return !
|
|
503
|
+
var _newFlyouts8 = state.flyouts.filter(function (f) {
|
|
504
|
+
return !_flyoutsToRemove5.has(f.flyoutId);
|
|
308
505
|
});
|
|
309
|
-
var
|
|
506
|
+
var _newSessions3 = state.sessions.slice(0, targetSessionIndex + 1);
|
|
310
507
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
311
|
-
sessions:
|
|
312
|
-
flyouts:
|
|
508
|
+
sessions: _newSessions3,
|
|
509
|
+
flyouts: _newFlyouts8
|
|
313
510
|
});
|
|
314
511
|
}
|
|
315
512
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
1
2
|
/*
|
|
2
3
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
4
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -42,19 +43,75 @@ function createStore() {
|
|
|
42
43
|
// The onClick handlers won't execute until after store is fully assigned.
|
|
43
44
|
// eslint-disable-next-line prefer-const -- Forward declaration requires 'let' not 'const'
|
|
44
45
|
var store;
|
|
45
|
-
var computeHistoryItems = function computeHistoryItems() {
|
|
46
|
+
var computeHistoryItems = function computeHistoryItems(dispatchFn) {
|
|
47
|
+
var _currentSession$child;
|
|
46
48
|
var currentSessionIndex = currentState.sessions.length - 1;
|
|
49
|
+
var currentSession = currentSessionIndex >= 0 ? currentState.sessions[currentSessionIndex] : null;
|
|
50
|
+
if (!currentSession) {
|
|
51
|
+
return [];
|
|
52
|
+
}
|
|
47
53
|
var previousSessions = currentState.sessions.slice(0, currentSessionIndex);
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
54
|
+
// Only include sessions in the same history group (same historyKey reference)
|
|
55
|
+
var previousSessionsInGroup = previousSessions.filter(function (session) {
|
|
56
|
+
return session.historyKey === currentSession.historyKey;
|
|
57
|
+
});
|
|
58
|
+
var childHistory = (_currentSession$child = currentSession.childHistory) !== null && _currentSession$child !== void 0 ? _currentSession$child : [];
|
|
59
|
+
var childItems = _toConsumableArray(childHistory).reverse().map(function (entry) {
|
|
51
60
|
return {
|
|
52
|
-
title: title,
|
|
61
|
+
title: entry.title,
|
|
62
|
+
iconType: entry.iconType,
|
|
53
63
|
onClick: function onClick() {
|
|
54
|
-
|
|
64
|
+
dispatchFn(goToFlyoutAction(entry.flyoutId, 'child'));
|
|
55
65
|
}
|
|
56
66
|
};
|
|
57
67
|
});
|
|
68
|
+
|
|
69
|
+
// Previous sessions (same group): list each session's current child then its child history
|
|
70
|
+
var previousSessionItems = [];
|
|
71
|
+
var _loop = function _loop() {
|
|
72
|
+
var _session$childHistory;
|
|
73
|
+
var session = previousSessionsInGroup[i];
|
|
74
|
+
var mainTitle = session.title;
|
|
75
|
+
var mainFlyoutId = session.mainFlyoutId;
|
|
76
|
+
var history = (_session$childHistory = session.childHistory) !== null && _session$childHistory !== void 0 ? _session$childHistory : [];
|
|
77
|
+
var hasChildren = session.childFlyoutId != null && session.childTitle != null || history.length > 0;
|
|
78
|
+
if (session.childFlyoutId && session.childTitle) {
|
|
79
|
+
previousSessionItems.push({
|
|
80
|
+
title: session.childTitle,
|
|
81
|
+
iconType: session.childIconType,
|
|
82
|
+
onClick: function onClick() {
|
|
83
|
+
dispatchFn(goToFlyoutAction(mainFlyoutId, 'main'));
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
var _loop2 = function _loop2() {
|
|
88
|
+
var entry = history[h];
|
|
89
|
+
previousSessionItems.push({
|
|
90
|
+
title: entry.title,
|
|
91
|
+
iconType: entry.iconType,
|
|
92
|
+
onClick: function onClick() {
|
|
93
|
+
dispatchFn(goToFlyoutAction(mainFlyoutId, 'main'));
|
|
94
|
+
dispatchFn(goToFlyoutAction(entry.flyoutId, 'child'));
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
for (var h = history.length - 1; h >= 0; h--) {
|
|
99
|
+
_loop2();
|
|
100
|
+
}
|
|
101
|
+
if (!hasChildren) {
|
|
102
|
+
previousSessionItems.push({
|
|
103
|
+
title: mainTitle,
|
|
104
|
+
iconType: session.iconType,
|
|
105
|
+
onClick: function onClick() {
|
|
106
|
+
dispatchFn(goToFlyoutAction(mainFlyoutId, 'main'));
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
for (var i = previousSessionsInGroup.length - 1; i >= 0; i--) {
|
|
112
|
+
_loop();
|
|
113
|
+
}
|
|
114
|
+
return [].concat(_toConsumableArray(childItems), previousSessionItems);
|
|
58
115
|
};
|
|
59
116
|
var dispatch = function dispatch(action) {
|
|
60
117
|
var nextState = flyoutManagerReducer(currentState, action);
|
|
@@ -65,7 +122,7 @@ function createStore() {
|
|
|
65
122
|
// Recompute history items eagerly if sessions changed
|
|
66
123
|
// This ensures stable references and avoids stale closures
|
|
67
124
|
if (nextState.sessions !== previousSessions) {
|
|
68
|
-
store.historyItems = computeHistoryItems();
|
|
125
|
+
store.historyItems = computeHistoryItems(dispatch);
|
|
69
126
|
|
|
70
127
|
// Detect removed sessions and emit CLOSE_SESSION events
|
|
71
128
|
var nextSessionIds = new Set(nextState.sessions.map(function (s) {
|
|
@@ -90,8 +147,8 @@ function createStore() {
|
|
|
90
147
|
subscribe: subscribe,
|
|
91
148
|
subscribeToEvents: subscribeToEvents,
|
|
92
149
|
dispatch: dispatch,
|
|
93
|
-
addFlyout: function addFlyout(flyoutId, title, level, size, minWidth) {
|
|
94
|
-
return dispatch(addFlyoutAction(flyoutId, title, level, size, minWidth));
|
|
150
|
+
addFlyout: function addFlyout(flyoutId, title, level, size, historyKey, iconType, minWidth) {
|
|
151
|
+
return dispatch(addFlyoutAction(flyoutId, title, level, size, historyKey, iconType, minWidth));
|
|
95
152
|
},
|
|
96
153
|
closeFlyout: function closeFlyout(flyoutId) {
|
|
97
154
|
return dispatch(closeFlyoutAction(flyoutId));
|
|
@@ -114,8 +171,8 @@ function createStore() {
|
|
|
114
171
|
goBack: function goBack() {
|
|
115
172
|
return dispatch(goBackAction());
|
|
116
173
|
},
|
|
117
|
-
goToFlyout: function goToFlyout(flyoutId) {
|
|
118
|
-
return dispatch(goToFlyoutAction(flyoutId));
|
|
174
|
+
goToFlyout: function goToFlyout(flyoutId, level) {
|
|
175
|
+
return dispatch(goToFlyoutAction(flyoutId, level));
|
|
119
176
|
},
|
|
120
177
|
addUnmanagedFlyout: function addUnmanagedFlyout(flyoutId) {
|
|
121
178
|
return dispatch(addUnmanagedFlyoutAction(flyoutId));
|
|
@@ -123,7 +180,7 @@ function createStore() {
|
|
|
123
180
|
closeUnmanagedFlyout: function closeUnmanagedFlyout(flyoutId) {
|
|
124
181
|
return dispatch(closeUnmanagedFlyoutAction(flyoutId));
|
|
125
182
|
},
|
|
126
|
-
historyItems: computeHistoryItems() // Initialize with current state
|
|
183
|
+
historyItems: computeHistoryItems(dispatch) // Initialize with current state
|
|
127
184
|
};
|
|
128
185
|
return store;
|
|
129
186
|
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
|
+
var _excluded = ["titleId"];
|
|
3
|
+
/*
|
|
4
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
5
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
6
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
7
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
8
|
+
* Side Public License, v 1.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { useGeneratedHtmlId } from '../../services';
|
|
12
|
+
import { MENU_DISPLAY_ALWAYS, MENU_DISPLAY_AUTO } from './const';
|
|
13
|
+
import { useMemo } from 'react';
|
|
14
|
+
import classnames from 'classnames';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Hook to manage flyout menu state and rendering logic.
|
|
22
|
+
* Determines whether the menu should be rendered based on display mode
|
|
23
|
+
* and menu content, and computes the appropriate aria-labelledby value.
|
|
24
|
+
*
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
export var useEuiFlyoutMenu = function useEuiFlyoutMenu(_ref) {
|
|
28
|
+
var _flyoutMenuProps$hist, _flyoutMenuProps$hist2, _flyoutMenuProps$cust, _flyoutMenuProps$cust2;
|
|
29
|
+
var _flyoutMenuProps = _ref.flyoutMenuProps,
|
|
30
|
+
flyoutMenuDisplayMode = _ref.flyoutMenuDisplayMode,
|
|
31
|
+
_ariaLabelledBy = _ref.ariaLabelledBy;
|
|
32
|
+
var generatedMenuId = useGeneratedHtmlId();
|
|
33
|
+
var _ref2 = _flyoutMenuProps || {},
|
|
34
|
+
_titleId = _ref2.titleId,
|
|
35
|
+
flyoutMenuProps = _objectWithoutProperties(_ref2, _excluded);
|
|
36
|
+
var hasMenu = !!_flyoutMenuProps;
|
|
37
|
+
var flyoutMenuId = useMemo(function () {
|
|
38
|
+
if (!hasMenu) return undefined;
|
|
39
|
+
return _titleId || generatedMenuId;
|
|
40
|
+
}, [hasMenu, _titleId, generatedMenuId]);
|
|
41
|
+
|
|
42
|
+
// Determine if the menu has any content
|
|
43
|
+
// hasBackButton or hasHistory or hasCustomActions or hasVisibleTitle
|
|
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
|
+
// Component defaults to hiding the title, so only explicit false means the title will be visible
|
|
46
|
+
!!(flyoutMenuProps.title && flyoutMenuProps.hideTitle === false));
|
|
47
|
+
|
|
48
|
+
// Determine if the menu should be rendered based on the display mode and menu content
|
|
49
|
+
var shouldRenderMenu = useMemo(function () {
|
|
50
|
+
if (!hasMenu) return false;
|
|
51
|
+
if (flyoutMenuDisplayMode === MENU_DISPLAY_ALWAYS) return true;
|
|
52
|
+
if (flyoutMenuDisplayMode === MENU_DISPLAY_AUTO) return menuHasContent;
|
|
53
|
+
return false;
|
|
54
|
+
}, [hasMenu, flyoutMenuDisplayMode, menuHasContent]);
|
|
55
|
+
|
|
56
|
+
// If the flyout menu is to be rendered, ensure the flyout has aria-labelledby referencing the menu's titleId
|
|
57
|
+
var ariaLabelledBy = useMemo(function () {
|
|
58
|
+
if (flyoutMenuId && shouldRenderMenu) {
|
|
59
|
+
return classnames(flyoutMenuId, _ariaLabelledBy);
|
|
60
|
+
}
|
|
61
|
+
return _ariaLabelledBy;
|
|
62
|
+
}, [flyoutMenuId, _ariaLabelledBy, shouldRenderMenu]);
|
|
63
|
+
return {
|
|
64
|
+
flyoutMenuId: flyoutMenuId,
|
|
65
|
+
flyoutMenuProps: flyoutMenuProps,
|
|
66
|
+
shouldRenderMenu: shouldRenderMenu,
|
|
67
|
+
ariaLabelledBy: ariaLabelledBy
|
|
68
|
+
};
|
|
69
|
+
};
|