@elastic/eui 113.2.1 → 113.3.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/context_menu/context_menu_item.js +9 -3
- package/es/components/context_menu/context_menu_item.styles.js +6 -2
- package/es/components/date_picker/super_date_picker/time_window_buttons.js +17 -3
- package/es/components/flyout/const.js +10 -0
- package/es/components/flyout/flyout.component.js +47 -59
- package/es/components/flyout/flyout.js +1 -1
- package/es/components/flyout/flyout_menu.js +17 -4
- package/es/components/flyout/manager/actions.js +9 -5
- package/es/components/flyout/manager/flyout_child.js +8 -2
- package/es/components/flyout/manager/flyout_managed.js +24 -13
- package/es/components/flyout/manager/reducer.js +182 -44
- package/es/components/flyout/manager/store.js +67 -12
- package/es/components/flyout/use_flyout_menu.js +70 -0
- package/es/components/form/file_picker/file_picker.js +46 -18
- package/eui.d.ts +397 -15
- package/lib/components/basic_table/collapsed_item_actions.js +2 -0
- 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/date_picker/super_date_picker/time_window_buttons.js +17 -3
- package/lib/components/flyout/const.js +11 -1
- package/lib/components/flyout/flyout.component.js +46 -58
- package/lib/components/flyout/flyout.js +6 -0
- package/lib/components/flyout/flyout_menu.js +17 -4
- package/lib/components/flyout/manager/actions.js +9 -5
- package/lib/components/flyout/manager/flyout_child.js +8 -2
- package/lib/components/flyout/manager/flyout_managed.js +16 -11
- package/lib/components/flyout/manager/reducer.js +181 -43
- package/lib/components/flyout/manager/store.js +67 -14
- package/lib/components/flyout/use_flyout_menu.js +75 -0
- package/lib/components/form/file_picker/file_picker.js +46 -18
- package/optimize/es/components/basic_table/collapsed_item_actions.js +2 -0
- 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/date_picker/super_date_picker/time_window_buttons.js +17 -3
- package/optimize/es/components/flyout/const.js +10 -0
- package/optimize/es/components/flyout/flyout.component.js +47 -59
- package/optimize/es/components/flyout/flyout.js +1 -1
- package/optimize/es/components/flyout/flyout_menu.js +5 -2
- package/optimize/es/components/flyout/manager/actions.js +9 -5
- package/optimize/es/components/flyout/manager/flyout_managed.js +16 -11
- package/optimize/es/components/flyout/manager/reducer.js +182 -44
- package/optimize/es/components/flyout/manager/store.js +62 -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/lib/components/basic_table/collapsed_item_actions.js +2 -0
- 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/date_picker/super_date_picker/time_window_buttons.js +17 -3
- package/optimize/lib/components/flyout/const.js +11 -1
- package/optimize/lib/components/flyout/flyout.component.js +46 -58
- package/optimize/lib/components/flyout/flyout.js +6 -0
- package/optimize/lib/components/flyout/flyout_menu.js +5 -2
- package/optimize/lib/components/flyout/manager/actions.js +9 -5
- package/optimize/lib/components/flyout/manager/flyout_managed.js +16 -11
- package/optimize/lib/components/flyout/manager/reducer.js +181 -43
- package/optimize/lib/components/flyout/manager/store.js +63 -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/package.json +3 -3
- package/test-env/components/basic_table/collapsed_item_actions.js +2 -0
- 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/date_picker/super_date_picker/time_window_buttons.js +17 -3
- package/test-env/components/flyout/const.js +11 -1
- package/test-env/components/flyout/flyout.component.js +46 -58
- package/test-env/components/flyout/flyout_menu.js +17 -4
- package/test-env/components/flyout/manager/actions.js +9 -5
- package/test-env/components/flyout/manager/flyout_child.js +8 -2
- package/test-env/components/flyout/manager/flyout_managed.js +16 -11
- package/test-env/components/flyout/manager/reducer.js +181 -43
- package/test-env/components/flyout/manager/store.js +63 -12
- package/test-env/components/flyout/use_flyout_menu.js +74 -0
- package/test-env/components/form/file_picker/file_picker.js +46 -18
|
@@ -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
|
*/
|
|
@@ -69,16 +69,20 @@ export function flyoutManagerReducer() {
|
|
|
69
69
|
// session exists, do nothing (invalid child without a parent).
|
|
70
70
|
case ACTION_ADD:
|
|
71
71
|
{
|
|
72
|
+
var _currentSession$child;
|
|
72
73
|
var flyoutId = action.flyoutId,
|
|
73
74
|
title = action.title,
|
|
74
75
|
level = action.level,
|
|
75
76
|
size = action.size,
|
|
77
|
+
iconType = action.iconType,
|
|
76
78
|
minWidth = action.minWidth;
|
|
77
|
-
|
|
78
|
-
// Ignore duplicate registrations
|
|
79
|
-
if (state.flyouts.some(function (f) {
|
|
79
|
+
var isDuplicate = state.flyouts.some(function (f) {
|
|
80
80
|
return f.flyoutId === flyoutId;
|
|
81
|
-
})
|
|
81
|
+
});
|
|
82
|
+
var isIdempotentChild = level === LEVEL_CHILD && state.sessions.length > 0 && state.sessions[state.sessions.length - 1].childFlyoutId === flyoutId;
|
|
83
|
+
|
|
84
|
+
// Ignore duplicate registrations (except idempotent child re-registration after goBack)
|
|
85
|
+
if (isDuplicate && !isIdempotentChild) {
|
|
82
86
|
return state;
|
|
83
87
|
}
|
|
84
88
|
var newFlyoutState = {
|
|
@@ -88,12 +92,14 @@ export function flyoutManagerReducer() {
|
|
|
88
92
|
minWidth: minWidth,
|
|
89
93
|
activityStage: STAGE_OPENING
|
|
90
94
|
};
|
|
91
|
-
var newFlyouts = [].concat(_toConsumableArray(state.flyouts), [newFlyoutState]);
|
|
95
|
+
var newFlyouts = isIdempotentChild ? state.flyouts : [].concat(_toConsumableArray(state.flyouts), [newFlyoutState]);
|
|
92
96
|
if (level === LEVEL_MAIN) {
|
|
93
97
|
var newSession = {
|
|
94
98
|
mainFlyoutId: flyoutId,
|
|
95
99
|
title: title,
|
|
100
|
+
iconType: iconType,
|
|
96
101
|
childFlyoutId: null,
|
|
102
|
+
childHistory: [],
|
|
97
103
|
zIndex: state.currentZIndex
|
|
98
104
|
};
|
|
99
105
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
@@ -110,8 +116,52 @@ export function flyoutManagerReducer() {
|
|
|
110
116
|
}
|
|
111
117
|
var updatedSessions = _toConsumableArray(state.sessions);
|
|
112
118
|
var currentSessionIndex = updatedSessions.length - 1;
|
|
113
|
-
|
|
114
|
-
|
|
119
|
+
var currentSession = updatedSessions[currentSessionIndex];
|
|
120
|
+
var childHistory = (_currentSession$child = currentSession.childHistory) !== null && _currentSession$child !== void 0 ? _currentSession$child : [];
|
|
121
|
+
|
|
122
|
+
// Idempotent re-registration (e.g. after goBack): flyout already in flyouts and session already points to it
|
|
123
|
+
if (state.flyouts.some(function (f) {
|
|
124
|
+
return f.flyoutId === flyoutId;
|
|
125
|
+
})) {
|
|
126
|
+
if (currentSession.childFlyoutId === flyoutId) {
|
|
127
|
+
updatedSessions[currentSessionIndex] = _objectSpread(_objectSpread({}, currentSession), {}, {
|
|
128
|
+
childTitle: title,
|
|
129
|
+
childIconType: iconType,
|
|
130
|
+
childHistory: childHistory
|
|
131
|
+
});
|
|
132
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
133
|
+
sessions: updatedSessions
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
return state; // duplicate registration for a different child, ignore
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Session already has a child: push current child to history, then set new child (do not remove previous from flyouts)
|
|
140
|
+
if (currentSession.childFlyoutId) {
|
|
141
|
+
var _currentSession$child2;
|
|
142
|
+
var historyEntry = {
|
|
143
|
+
flyoutId: currentSession.childFlyoutId,
|
|
144
|
+
title: (_currentSession$child2 = currentSession.childTitle) !== null && _currentSession$child2 !== void 0 ? _currentSession$child2 : '',
|
|
145
|
+
iconType: currentSession.childIconType
|
|
146
|
+
};
|
|
147
|
+
updatedSessions[currentSessionIndex] = _objectSpread(_objectSpread({}, currentSession), {}, {
|
|
148
|
+
childHistory: [].concat(_toConsumableArray(childHistory), [historyEntry]),
|
|
149
|
+
childFlyoutId: flyoutId,
|
|
150
|
+
childTitle: title,
|
|
151
|
+
childIconType: iconType
|
|
152
|
+
});
|
|
153
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
154
|
+
sessions: updatedSessions,
|
|
155
|
+
flyouts: newFlyouts
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// First child in session
|
|
160
|
+
updatedSessions[currentSessionIndex] = _objectSpread(_objectSpread({}, currentSession), {}, {
|
|
161
|
+
childFlyoutId: flyoutId,
|
|
162
|
+
childTitle: title,
|
|
163
|
+
childIconType: iconType,
|
|
164
|
+
childHistory: childHistory
|
|
115
165
|
});
|
|
116
166
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
117
167
|
sessions: updatedSessions,
|
|
@@ -121,10 +171,11 @@ export function flyoutManagerReducer() {
|
|
|
121
171
|
|
|
122
172
|
// Unregister a flyout and update sessions accordingly.
|
|
123
173
|
// - When closing a `main` flyout, drop its entire session and all associated flyouts.
|
|
124
|
-
// - When closing a `child` flyout,
|
|
125
|
-
//
|
|
174
|
+
// - When closing a `child` flyout, find the session that owns it (childFlyoutId or
|
|
175
|
+
// childHistory) and clear that session's child state so navigation back stays consistent.
|
|
126
176
|
case ACTION_CLOSE:
|
|
127
177
|
{
|
|
178
|
+
var _owningSession$childH;
|
|
128
179
|
var removedFlyout = state.flyouts.find(function (f) {
|
|
129
180
|
return f.flyoutId === action.flyoutId;
|
|
130
181
|
});
|
|
@@ -137,11 +188,15 @@ export function flyoutManagerReducer() {
|
|
|
137
188
|
return session.mainFlyoutId === action.flyoutId;
|
|
138
189
|
});
|
|
139
190
|
if (sessionToRemove) {
|
|
140
|
-
|
|
191
|
+
var _sessionToRemove$chil;
|
|
192
|
+
// Remove all flyouts associated with this session (main + current child + child history)
|
|
141
193
|
var flyoutsToRemove = new Set([action.flyoutId]);
|
|
142
194
|
if (sessionToRemove.childFlyoutId) {
|
|
143
195
|
flyoutsToRemove.add(sessionToRemove.childFlyoutId);
|
|
144
196
|
}
|
|
197
|
+
((_sessionToRemove$chil = sessionToRemove.childHistory) !== null && _sessionToRemove$chil !== void 0 ? _sessionToRemove$chil : []).forEach(function (entry) {
|
|
198
|
+
return flyoutsToRemove.add(entry.flyoutId);
|
|
199
|
+
});
|
|
145
200
|
var _newFlyouts = state.flyouts.filter(function (f) {
|
|
146
201
|
return !flyoutsToRemove.has(f.flyoutId);
|
|
147
202
|
});
|
|
@@ -162,22 +217,43 @@ export function flyoutManagerReducer() {
|
|
|
162
217
|
}
|
|
163
218
|
}
|
|
164
219
|
|
|
165
|
-
// Handle child flyout closing
|
|
166
|
-
|
|
167
|
-
return f.flyoutId !== action.flyoutId;
|
|
168
|
-
});
|
|
220
|
+
// Handle child flyout closing: find the session that owns this child and
|
|
221
|
+
// clear that session's child state (so we stay consistent when navigating back).
|
|
169
222
|
if (state.sessions.length === 0) {
|
|
170
223
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
171
|
-
flyouts:
|
|
224
|
+
flyouts: state.flyouts.filter(function (f) {
|
|
225
|
+
return f.flyoutId !== action.flyoutId;
|
|
226
|
+
})
|
|
172
227
|
});
|
|
173
228
|
}
|
|
174
|
-
var
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
229
|
+
var owningSessionIndex = state.sessions.findIndex(function (session) {
|
|
230
|
+
var _session$childHistory;
|
|
231
|
+
return session.childFlyoutId === action.flyoutId || ((_session$childHistory = session.childHistory) !== null && _session$childHistory !== void 0 ? _session$childHistory : []).some(function (entry) {
|
|
232
|
+
return entry.flyoutId === action.flyoutId;
|
|
233
|
+
});
|
|
234
|
+
});
|
|
235
|
+
if (owningSessionIndex === -1) {
|
|
236
|
+
// Closed flyout not in any session's child state; just remove the one flyout
|
|
237
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
238
|
+
flyouts: state.flyouts.filter(function (f) {
|
|
239
|
+
return f.flyoutId !== action.flyoutId;
|
|
240
|
+
})
|
|
179
241
|
});
|
|
180
242
|
}
|
|
243
|
+
var owningSession = state.sessions[owningSessionIndex];
|
|
244
|
+
var childIds = new Set([owningSession.childFlyoutId].concat(_toConsumableArray(((_owningSession$childH = owningSession.childHistory) !== null && _owningSession$childH !== void 0 ? _owningSession$childH : []).map(function (e) {
|
|
245
|
+
return e.flyoutId;
|
|
246
|
+
}))).filter(Boolean));
|
|
247
|
+
var _newFlyouts2 = state.flyouts.filter(function (f) {
|
|
248
|
+
return !childIds.has(f.flyoutId);
|
|
249
|
+
});
|
|
250
|
+
var _updatedSessions = _toConsumableArray(state.sessions);
|
|
251
|
+
_updatedSessions[owningSessionIndex] = _objectSpread(_objectSpread({}, owningSession), {}, {
|
|
252
|
+
childFlyoutId: null,
|
|
253
|
+
childTitle: undefined,
|
|
254
|
+
childIconType: undefined,
|
|
255
|
+
childHistory: []
|
|
256
|
+
});
|
|
181
257
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
182
258
|
sessions: _updatedSessions,
|
|
183
259
|
flyouts: _newFlyouts2
|
|
@@ -210,8 +286,8 @@ export function flyoutManagerReducer() {
|
|
|
210
286
|
return state;
|
|
211
287
|
}
|
|
212
288
|
var _updatedSessions2 = _toConsumableArray(state.sessions);
|
|
213
|
-
var
|
|
214
|
-
_updatedSessions2[
|
|
289
|
+
var _currentSessionIndex = _updatedSessions2.length - 1;
|
|
290
|
+
_updatedSessions2[_currentSessionIndex] = _objectSpread(_objectSpread({}, _updatedSessions2[_currentSessionIndex]), {}, {
|
|
215
291
|
childFlyoutId: action.flyoutId
|
|
216
292
|
});
|
|
217
293
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
@@ -257,59 +333,121 @@ export function flyoutManagerReducer() {
|
|
|
257
333
|
});
|
|
258
334
|
}
|
|
259
335
|
|
|
260
|
-
// Go back
|
|
336
|
+
// Go back: pop child history when any, else pop current session
|
|
261
337
|
case ACTION_GO_BACK:
|
|
262
338
|
{
|
|
339
|
+
var _currentSession$child3, _currentSession$child4;
|
|
263
340
|
if (state.sessions.length === 0) {
|
|
264
341
|
return state;
|
|
265
342
|
}
|
|
266
|
-
var
|
|
267
|
-
var
|
|
343
|
+
var _currentSessionIndex2 = state.sessions.length - 1;
|
|
344
|
+
var _currentSession = state.sessions[_currentSessionIndex2];
|
|
345
|
+
var _childHistory = (_currentSession$child3 = _currentSession.childHistory) !== null && _currentSession$child3 !== void 0 ? _currentSession$child3 : [];
|
|
346
|
+
if (_childHistory.length > 0) {
|
|
347
|
+
// Pop one child: set current child to the last entry in history, remove the current child flyout
|
|
348
|
+
var popped = _childHistory[_childHistory.length - 1];
|
|
349
|
+
var newChildHistory = _childHistory.slice(0, -1);
|
|
350
|
+
var _updatedSessions3 = _toConsumableArray(state.sessions);
|
|
351
|
+
_updatedSessions3[_currentSessionIndex2] = _objectSpread(_objectSpread({}, _currentSession), {}, {
|
|
352
|
+
childHistory: newChildHistory,
|
|
353
|
+
childFlyoutId: popped.flyoutId,
|
|
354
|
+
childTitle: popped.title,
|
|
355
|
+
childIconType: popped.iconType
|
|
356
|
+
});
|
|
357
|
+
var _newFlyouts3 = state.flyouts.filter(function (f) {
|
|
358
|
+
return f.flyoutId !== _currentSession.childFlyoutId;
|
|
359
|
+
});
|
|
360
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
361
|
+
sessions: _updatedSessions3,
|
|
362
|
+
flyouts: _newFlyouts3
|
|
363
|
+
});
|
|
364
|
+
}
|
|
268
365
|
|
|
269
|
-
//
|
|
270
|
-
var _flyoutsToRemove = new Set([
|
|
271
|
-
if (
|
|
272
|
-
_flyoutsToRemove.add(
|
|
366
|
+
// No child history: pop current session (main + all its children)
|
|
367
|
+
var _flyoutsToRemove = new Set([_currentSession.mainFlyoutId]);
|
|
368
|
+
if (_currentSession.childFlyoutId) {
|
|
369
|
+
_flyoutsToRemove.add(_currentSession.childFlyoutId);
|
|
273
370
|
}
|
|
274
|
-
|
|
371
|
+
((_currentSession$child4 = _currentSession.childHistory) !== null && _currentSession$child4 !== void 0 ? _currentSession$child4 : []).forEach(function (e) {
|
|
372
|
+
return _flyoutsToRemove.add(e.flyoutId);
|
|
373
|
+
});
|
|
374
|
+
var _newFlyouts4 = state.flyouts.filter(function (f) {
|
|
275
375
|
return !_flyoutsToRemove.has(f.flyoutId);
|
|
276
376
|
});
|
|
277
|
-
var _newSessions = state.sessions.slice(0,
|
|
377
|
+
var _newSessions = state.sessions.slice(0, _currentSessionIndex2);
|
|
278
378
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
279
379
|
sessions: _newSessions,
|
|
280
|
-
flyouts:
|
|
380
|
+
flyouts: _newFlyouts4
|
|
281
381
|
});
|
|
282
382
|
}
|
|
283
383
|
|
|
284
|
-
// Navigate to a specific flyout (
|
|
384
|
+
// Navigate to a specific flyout (by main session or by child in current session's history)
|
|
285
385
|
case ACTION_GO_TO_FLYOUT:
|
|
286
386
|
{
|
|
287
|
-
var _flyoutId3 = action.flyoutId
|
|
387
|
+
var _flyoutId3 = action.flyoutId,
|
|
388
|
+
_level = action.level;
|
|
389
|
+
var _currentSessionIndex3 = state.sessions.length - 1;
|
|
390
|
+
if (_level === LEVEL_CHILD && state.sessions.length > 0) {
|
|
391
|
+
var _currentSession2$chil;
|
|
392
|
+
var _currentSession2 = state.sessions[_currentSessionIndex3];
|
|
393
|
+
var _childHistory2 = (_currentSession2$chil = _currentSession2.childHistory) !== null && _currentSession2$chil !== void 0 ? _currentSession2$chil : [];
|
|
394
|
+
var targetIndex = _childHistory2.findIndex(function (entry) {
|
|
395
|
+
return entry.flyoutId === _flyoutId3;
|
|
396
|
+
});
|
|
397
|
+
if (targetIndex === -1) {
|
|
398
|
+
return state; // Target child not in history
|
|
399
|
+
}
|
|
400
|
+
var targetEntry = _childHistory2[targetIndex];
|
|
401
|
+
var _newChildHistory = _childHistory2.slice(0, targetIndex);
|
|
402
|
+
var _flyoutsToRemove2 = new Set();
|
|
403
|
+
if (_currentSession2.childFlyoutId) {
|
|
404
|
+
_flyoutsToRemove2.add(_currentSession2.childFlyoutId);
|
|
405
|
+
}
|
|
406
|
+
_childHistory2.slice(targetIndex + 1).forEach(function (e) {
|
|
407
|
+
_flyoutsToRemove2.add(e.flyoutId);
|
|
408
|
+
});
|
|
409
|
+
var _newFlyouts5 = state.flyouts.filter(function (f) {
|
|
410
|
+
return !_flyoutsToRemove2.has(f.flyoutId);
|
|
411
|
+
});
|
|
412
|
+
var _updatedSessions4 = _toConsumableArray(state.sessions);
|
|
413
|
+
_updatedSessions4[_currentSessionIndex3] = _objectSpread(_objectSpread({}, _currentSession2), {}, {
|
|
414
|
+
childHistory: _newChildHistory,
|
|
415
|
+
childFlyoutId: targetEntry.flyoutId,
|
|
416
|
+
childTitle: targetEntry.title,
|
|
417
|
+
childIconType: targetEntry.iconType
|
|
418
|
+
});
|
|
419
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
420
|
+
sessions: _updatedSessions4,
|
|
421
|
+
flyouts: _newFlyouts5
|
|
422
|
+
});
|
|
423
|
+
}
|
|
288
424
|
|
|
289
|
-
//
|
|
425
|
+
// Navigate by main flyout: remove all sessions after the target
|
|
290
426
|
var targetSessionIndex = state.sessions.findIndex(function (session) {
|
|
291
427
|
return session.mainFlyoutId === _flyoutId3;
|
|
292
428
|
});
|
|
293
429
|
if (targetSessionIndex === -1) {
|
|
294
430
|
return state; // Target flyout not found
|
|
295
431
|
}
|
|
296
|
-
|
|
297
|
-
// Close all sessions after the target session
|
|
298
432
|
var sessionsToClose = state.sessions.slice(targetSessionIndex + 1);
|
|
299
|
-
var
|
|
433
|
+
var _flyoutsToRemove3 = new Set();
|
|
300
434
|
sessionsToClose.forEach(function (session) {
|
|
301
|
-
|
|
435
|
+
var _session$childHistory2;
|
|
436
|
+
_flyoutsToRemove3.add(session.mainFlyoutId);
|
|
302
437
|
if (session.childFlyoutId) {
|
|
303
|
-
|
|
438
|
+
_flyoutsToRemove3.add(session.childFlyoutId);
|
|
304
439
|
}
|
|
440
|
+
((_session$childHistory2 = session.childHistory) !== null && _session$childHistory2 !== void 0 ? _session$childHistory2 : []).forEach(function (e) {
|
|
441
|
+
return _flyoutsToRemove3.add(e.flyoutId);
|
|
442
|
+
});
|
|
305
443
|
});
|
|
306
|
-
var
|
|
307
|
-
return !
|
|
444
|
+
var _newFlyouts6 = state.flyouts.filter(function (f) {
|
|
445
|
+
return !_flyoutsToRemove3.has(f.flyoutId);
|
|
308
446
|
});
|
|
309
447
|
var _newSessions2 = state.sessions.slice(0, targetSessionIndex + 1);
|
|
310
448
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
311
449
|
sessions: _newSessions2,
|
|
312
|
-
flyouts:
|
|
450
|
+
flyouts: _newFlyouts6
|
|
313
451
|
});
|
|
314
452
|
}
|
|
315
453
|
|
|
@@ -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,68 @@ 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;
|
|
47
50
|
var previousSessions = currentState.sessions.slice(0, currentSessionIndex);
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
mainFlyoutId = _ref.mainFlyoutId;
|
|
51
|
+
var childHistory = (_currentSession$child = currentSession === null || currentSession === void 0 ? void 0 : currentSession.childHistory) !== null && _currentSession$child !== void 0 ? _currentSession$child : [];
|
|
52
|
+
var childItems = _toConsumableArray(childHistory).reverse().map(function (entry) {
|
|
51
53
|
return {
|
|
52
|
-
title: title,
|
|
54
|
+
title: entry.title,
|
|
55
|
+
iconType: entry.iconType,
|
|
53
56
|
onClick: function onClick() {
|
|
54
|
-
|
|
57
|
+
dispatchFn(goToFlyoutAction(entry.flyoutId, 'child'));
|
|
55
58
|
}
|
|
56
59
|
};
|
|
57
60
|
});
|
|
61
|
+
|
|
62
|
+
// Previous sessions: list each session's current child then its child history (so all travelled entries appear)
|
|
63
|
+
var previousSessionItems = [];
|
|
64
|
+
var _loop = function _loop() {
|
|
65
|
+
var _session$childHistory;
|
|
66
|
+
var session = previousSessions[i];
|
|
67
|
+
var mainTitle = session.title;
|
|
68
|
+
var mainFlyoutId = session.mainFlyoutId;
|
|
69
|
+
var history = (_session$childHistory = session.childHistory) !== null && _session$childHistory !== void 0 ? _session$childHistory : [];
|
|
70
|
+
var hasChildren = session.childFlyoutId != null && session.childTitle != null || history.length > 0;
|
|
71
|
+
if (session.childFlyoutId && session.childTitle) {
|
|
72
|
+
previousSessionItems.push({
|
|
73
|
+
title: session.childTitle,
|
|
74
|
+
iconType: session.childIconType,
|
|
75
|
+
onClick: function onClick() {
|
|
76
|
+
dispatchFn(goToFlyoutAction(mainFlyoutId, 'main'));
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
var _loop2 = function _loop2() {
|
|
81
|
+
var entry = history[h];
|
|
82
|
+
previousSessionItems.push({
|
|
83
|
+
title: entry.title,
|
|
84
|
+
iconType: entry.iconType,
|
|
85
|
+
onClick: function onClick() {
|
|
86
|
+
dispatchFn(goToFlyoutAction(mainFlyoutId, 'main'));
|
|
87
|
+
dispatchFn(goToFlyoutAction(entry.flyoutId, 'child'));
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
for (var h = history.length - 1; h >= 0; h--) {
|
|
92
|
+
_loop2();
|
|
93
|
+
}
|
|
94
|
+
if (!hasChildren) {
|
|
95
|
+
previousSessionItems.push({
|
|
96
|
+
title: mainTitle,
|
|
97
|
+
iconType: session.iconType,
|
|
98
|
+
onClick: function onClick() {
|
|
99
|
+
dispatchFn(goToFlyoutAction(mainFlyoutId, 'main'));
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
for (var i = previousSessions.length - 1; i >= 0; i--) {
|
|
105
|
+
_loop();
|
|
106
|
+
}
|
|
107
|
+
return [].concat(_toConsumableArray(childItems), previousSessionItems);
|
|
58
108
|
};
|
|
59
109
|
var dispatch = function dispatch(action) {
|
|
60
110
|
var nextState = flyoutManagerReducer(currentState, action);
|
|
@@ -65,7 +115,7 @@ function createStore() {
|
|
|
65
115
|
// Recompute history items eagerly if sessions changed
|
|
66
116
|
// This ensures stable references and avoids stale closures
|
|
67
117
|
if (nextState.sessions !== previousSessions) {
|
|
68
|
-
store.historyItems = computeHistoryItems();
|
|
118
|
+
store.historyItems = computeHistoryItems(dispatch);
|
|
69
119
|
|
|
70
120
|
// Detect removed sessions and emit CLOSE_SESSION events
|
|
71
121
|
var nextSessionIds = new Set(nextState.sessions.map(function (s) {
|
|
@@ -90,8 +140,8 @@ function createStore() {
|
|
|
90
140
|
subscribe: subscribe,
|
|
91
141
|
subscribeToEvents: subscribeToEvents,
|
|
92
142
|
dispatch: dispatch,
|
|
93
|
-
addFlyout: function addFlyout(flyoutId, title, level, size, minWidth) {
|
|
94
|
-
return dispatch(addFlyoutAction(flyoutId, title, level, size, minWidth));
|
|
143
|
+
addFlyout: function addFlyout(flyoutId, title, level, size, iconType, minWidth) {
|
|
144
|
+
return dispatch(addFlyoutAction(flyoutId, title, level, size, iconType, minWidth));
|
|
95
145
|
},
|
|
96
146
|
closeFlyout: function closeFlyout(flyoutId) {
|
|
97
147
|
return dispatch(closeFlyoutAction(flyoutId));
|
|
@@ -114,8 +164,8 @@ function createStore() {
|
|
|
114
164
|
goBack: function goBack() {
|
|
115
165
|
return dispatch(goBackAction());
|
|
116
166
|
},
|
|
117
|
-
goToFlyout: function goToFlyout(flyoutId) {
|
|
118
|
-
return dispatch(goToFlyoutAction(flyoutId));
|
|
167
|
+
goToFlyout: function goToFlyout(flyoutId, level) {
|
|
168
|
+
return dispatch(goToFlyoutAction(flyoutId, level));
|
|
119
169
|
},
|
|
120
170
|
addUnmanagedFlyout: function addUnmanagedFlyout(flyoutId) {
|
|
121
171
|
return dispatch(addUnmanagedFlyoutAction(flyoutId));
|
|
@@ -123,7 +173,7 @@ function createStore() {
|
|
|
123
173
|
closeUnmanagedFlyout: function closeUnmanagedFlyout(flyoutId) {
|
|
124
174
|
return dispatch(closeUnmanagedFlyoutAction(flyoutId));
|
|
125
175
|
},
|
|
126
|
-
historyItems: computeHistoryItems() // Initialize with current state
|
|
176
|
+
historyItems: computeHistoryItems(dispatch) // Initialize with current state
|
|
127
177
|
};
|
|
128
178
|
return store;
|
|
129
179
|
}
|
|
@@ -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
|
+
};
|
|
@@ -7,7 +7,7 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
|
|
|
7
7
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
8
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
9
9
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
10
|
-
var _excluded = ["stylesMemoizer", "id", "name", "initialPromptText", "className", "disabled", "compressed", "onChange", "isInvalid", "fullWidth", "isLoading", "display"];
|
|
10
|
+
var _excluded = ["stylesMemoizer", "id", "name", "initialPromptText", "className", "disabled", "compressed", "onChange", "isInvalid", "fullWidth", "isLoading", "display", "files"];
|
|
11
11
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
12
12
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
13
13
|
/*
|
|
@@ -39,36 +39,41 @@ export var EuiFilePickerClass = /*#__PURE__*/function (_Component) {
|
|
|
39
39
|
args[_key] = arguments[_key];
|
|
40
40
|
}
|
|
41
41
|
_this = _callSuper(this, EuiFilePickerClass, [].concat(args));
|
|
42
|
+
_defineProperty(_this, "fileInput", null);
|
|
43
|
+
_defineProperty(_this, "generatedId", htmlIdGenerator()());
|
|
44
|
+
_defineProperty(_this, "getPromptTextFromFileList", function (files) {
|
|
45
|
+
if (!files || files.length === 0) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
if (files.length > 1) {
|
|
49
|
+
return ___EmotionJSX(EuiI18n, {
|
|
50
|
+
token: "euiFilePicker.filesSelected",
|
|
51
|
+
default: "{fileCount} files selected",
|
|
52
|
+
values: {
|
|
53
|
+
fileCount: files.length
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return files[0].name;
|
|
58
|
+
});
|
|
42
59
|
_defineProperty(_this, "state", {
|
|
43
|
-
promptText: null,
|
|
60
|
+
promptText: _this.props.files ? _this.getPromptTextFromFileList(_this.props.files) : null,
|
|
44
61
|
isHoveringDrop: false
|
|
45
62
|
});
|
|
46
|
-
_defineProperty(_this, "fileInput", null);
|
|
47
|
-
_defineProperty(_this, "generatedId", htmlIdGenerator()());
|
|
48
63
|
_defineProperty(_this, "handleChange", function () {
|
|
49
64
|
if (!_this.fileInput) return;
|
|
50
|
-
if (_this.fileInput.files && _this.fileInput.files.length
|
|
51
|
-
_this.setState({
|
|
52
|
-
promptText: ___EmotionJSX(EuiI18n, {
|
|
53
|
-
token: "euiFilePicker.filesSelected",
|
|
54
|
-
default: "{fileCount} files selected",
|
|
55
|
-
values: {
|
|
56
|
-
fileCount: _this.fileInput.files.length
|
|
57
|
-
}
|
|
58
|
-
})
|
|
59
|
-
});
|
|
60
|
-
} else if (_this.fileInput.files && _this.fileInput.files.length === 0) {
|
|
65
|
+
if (_this.fileInput.files && _this.fileInput.files.length === 1) {
|
|
61
66
|
_this.setState({
|
|
62
|
-
promptText:
|
|
67
|
+
promptText: _this.fileInput.value.split('\\').pop()
|
|
63
68
|
});
|
|
64
69
|
} else {
|
|
65
70
|
_this.setState({
|
|
66
|
-
promptText: _this.fileInput.
|
|
71
|
+
promptText: _this.getPromptTextFromFileList(_this.fileInput.files ? Array.from(_this.fileInput.files) : null)
|
|
67
72
|
});
|
|
68
73
|
}
|
|
69
74
|
var onChange = _this.props.onChange;
|
|
70
75
|
if (onChange) {
|
|
71
|
-
onChange(_this.fileInput.files);
|
|
76
|
+
onChange(_this.fileInput.files && _this.fileInput.files.length > 0 ? _this.fileInput.files : null);
|
|
72
77
|
}
|
|
73
78
|
});
|
|
74
79
|
_defineProperty(_this, "removeFiles", function (e) {
|
|
@@ -96,6 +101,17 @@ export var EuiFilePickerClass = /*#__PURE__*/function (_Component) {
|
|
|
96
101
|
}
|
|
97
102
|
_inherits(EuiFilePickerClass, _Component);
|
|
98
103
|
return _createClass(EuiFilePickerClass, [{
|
|
104
|
+
key: "componentDidUpdate",
|
|
105
|
+
value: function componentDidUpdate(prevProps) {
|
|
106
|
+
// Update prompt text when files prop changes
|
|
107
|
+
if (this.props.files !== prevProps.files) {
|
|
108
|
+
var _this$props$files;
|
|
109
|
+
this.setState({
|
|
110
|
+
promptText: this.getPromptTextFromFileList((_this$props$files = this.props.files) !== null && _this$props$files !== void 0 ? _this$props$files : null)
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}, {
|
|
99
115
|
key: "render",
|
|
100
116
|
value: function render() {
|
|
101
117
|
var _this2 = this;
|
|
@@ -119,6 +135,7 @@ export var EuiFilePickerClass = /*#__PURE__*/function (_Component) {
|
|
|
119
135
|
fullWidth = _this2$props$fullWidt === void 0 ? defaultFullWidth : _this2$props$fullWidt,
|
|
120
136
|
isLoading = _this2$props.isLoading,
|
|
121
137
|
display = _this2$props.display,
|
|
138
|
+
files = _this2$props.files,
|
|
122
139
|
rest = _objectWithoutProperties(_this2$props, _excluded);
|
|
123
140
|
var promptId = "".concat(id || _this2.generatedId, "-filePicker__prompt");
|
|
124
141
|
var isOverridingInitialPrompt = _this2.state.promptText != null;
|
|
@@ -69,6 +69,7 @@ var CollapsedItemActions = exports.CollapsedItemActions = function CollapsedItem
|
|
|
69
69
|
var toolTipContent = (0, _action_types.callWithItemIfFunction)(item)(action.description);
|
|
70
70
|
var href = (0, _action_types.callWithItemIfFunction)(item)(action.href);
|
|
71
71
|
var dataTestSubj = (0, _action_types.callWithItemIfFunction)(item)(action['data-test-subj']);
|
|
72
|
+
var color = action.color ? (0, _action_types.callWithItemIfFunction)(item)(action.color) : undefined;
|
|
72
73
|
var _onClick = action.onClick,
|
|
73
74
|
target = action.target;
|
|
74
75
|
controls.push((0, _react2.jsx)(_context_menu.EuiContextMenuItem, {
|
|
@@ -78,6 +79,7 @@ var CollapsedItemActions = exports.CollapsedItemActions = function CollapsedItem
|
|
|
78
79
|
href: href,
|
|
79
80
|
target: target,
|
|
80
81
|
icon: icon,
|
|
82
|
+
color: color,
|
|
81
83
|
"data-test-subj": dataTestSubj,
|
|
82
84
|
onClick: function onClick(event) {
|
|
83
85
|
event.persist();
|
|
@@ -16,7 +16,7 @@ var _icon = require("../icon");
|
|
|
16
16
|
var _tool_tip = require("../tool_tip");
|
|
17
17
|
var _context_menu_item = require("./context_menu_item.styles");
|
|
18
18
|
var _react2 = require("@emotion/react");
|
|
19
|
-
var _excluded = ["children", "className", "hasPanel", "icon", "buttonRef", "disabled", "layoutAlign", "toolTipContent", "toolTipProps", "href", "target", "rel", "size"];
|
|
19
|
+
var _excluded = ["children", "className", "hasPanel", "icon", "buttonRef", "disabled", "layoutAlign", "toolTipContent", "toolTipProps", "href", "target", "rel", "size", "color"];
|
|
20
20
|
/*
|
|
21
21
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
22
22
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -47,12 +47,13 @@ var EuiContextMenuItem = exports.EuiContextMenuItem = function EuiContextMenuIte
|
|
|
47
47
|
rel = _ref.rel,
|
|
48
48
|
_ref$size = _ref.size,
|
|
49
49
|
size = _ref$size === void 0 ? 'm' : _ref$size,
|
|
50
|
+
color = _ref.color,
|
|
50
51
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
51
52
|
var isHrefValid = !href || (0, _href_validator.validateHref)(href);
|
|
52
53
|
var disabled = _disabled || !isHrefValid;
|
|
53
54
|
var classes = (0, _classnames.default)('euiContextMenuItem', className);
|
|
54
55
|
var styles = (0, _services.useEuiMemoizedStyles)(_context_menu_item.euiContextMenuItemStyles);
|
|
55
|
-
var cssStyles = [styles.euiContextMenuItem, styles.sizes[size], styles.layoutAlign[layoutAlign], disabled && styles.disabled];
|
|
56
|
+
var cssStyles = [styles.euiContextMenuItem, styles.sizes[size], styles.layoutAlign[layoutAlign], disabled && styles.disabled, !disabled && color && styles.colors[color]];
|
|
56
57
|
var iconInstance = icon && (typeof icon === 'string' ? (0, _react2.jsx)(_icon.EuiIcon, {
|
|
57
58
|
type: icon,
|
|
58
59
|
size: "m",
|