@instructure/ui-drilldown 8.33.2-snapshot-0 → 8.33.2

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 (36) hide show
  1. package/CHANGELOG.md +1 -5
  2. package/es/Drilldown/DrilldownGroup/index.js +0 -3
  3. package/es/Drilldown/DrilldownGroup/props.js +1 -0
  4. package/es/Drilldown/DrilldownLocator.js +13 -22
  5. package/es/Drilldown/DrilldownOption/index.js +0 -3
  6. package/es/Drilldown/DrilldownOption/props.js +1 -0
  7. package/es/Drilldown/DrilldownPage/index.js +0 -3
  8. package/es/Drilldown/DrilldownPage/props.js +1 -0
  9. package/es/Drilldown/DrilldownSeparator/index.js +0 -3
  10. package/es/Drilldown/DrilldownSeparator/props.js +1 -0
  11. package/es/Drilldown/__examples__/Drilldown.examples.js +9 -9
  12. package/es/Drilldown/index.js +199 -304
  13. package/es/Drilldown/locator.js +1 -0
  14. package/es/Drilldown/props.js +3 -1
  15. package/es/Drilldown/styles.js +1 -1
  16. package/es/Drilldown/theme.js +4 -4
  17. package/es/index.js +1 -0
  18. package/lib/Drilldown/DrilldownGroup/index.js +0 -7
  19. package/lib/Drilldown/DrilldownGroup/props.js +1 -6
  20. package/lib/Drilldown/DrilldownLocator.js +11 -25
  21. package/lib/Drilldown/DrilldownOption/index.js +0 -7
  22. package/lib/Drilldown/DrilldownOption/props.js +1 -3
  23. package/lib/Drilldown/DrilldownPage/index.js +0 -5
  24. package/lib/Drilldown/DrilldownPage/props.js +1 -7
  25. package/lib/Drilldown/DrilldownSeparator/index.js +0 -7
  26. package/lib/Drilldown/DrilldownSeparator/props.js +1 -3
  27. package/lib/Drilldown/__examples__/Drilldown.examples.js +8 -14
  28. package/lib/Drilldown/index.js +199 -326
  29. package/lib/Drilldown/locator.js +0 -2
  30. package/lib/Drilldown/props.js +3 -8
  31. package/lib/Drilldown/styles.js +1 -2
  32. package/lib/Drilldown/theme.js +4 -5
  33. package/lib/index.js +0 -1
  34. package/package.json +20 -20
  35. package/tsconfig.build.tsbuildinfo +1 -1
  36. package/types/Drilldown/DrilldownOption/index.d.ts +6 -6
@@ -1,72 +1,41 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
6
-
7
5
  Object.defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
8
  exports.default = exports.Drilldown = void 0;
11
-
12
9
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
13
-
14
10
  var _react = _interopRequireWildcard(require("react"));
15
-
16
11
  var _console = require("@instructure/console");
17
-
18
12
  var _testable = require("@instructure/ui-testable/lib/testable.js");
19
-
20
13
  var _contains = require("@instructure/ui-dom-utils/lib/contains.js");
21
-
22
14
  var _containsActiveElement = require("@instructure/ui-dom-utils/lib/containsActiveElement.js");
23
-
24
15
  var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
25
-
26
16
  var _matchComponentTypes = require("@instructure/ui-react-utils/lib/matchComponentTypes.js");
27
-
28
17
  var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
29
-
30
18
  var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
31
-
32
19
  var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
33
-
34
20
  var _View = require("@instructure/ui-view/lib/View");
35
-
36
21
  var _Options = require("@instructure/ui-options/lib/Options");
37
-
38
22
  var _Popover = require("@instructure/ui-popover/lib/Popover");
39
-
40
23
  var _Selectable = require("@instructure/ui-selectable/lib/Selectable");
41
-
42
24
  var _IconArrowOpenStartSolid = require("@instructure/ui-icons/lib/IconArrowOpenStartSolid.js");
43
-
44
25
  var _IconArrowOpenEndSolid = require("@instructure/ui-icons/lib/IconArrowOpenEndSolid.js");
45
-
46
26
  var _IconCheckSolid = require("@instructure/ui-icons/lib/IconCheckSolid.js");
47
-
48
27
  var _emotion = require("@instructure/emotion");
49
-
50
28
  var _DrilldownSeparator = require("./DrilldownSeparator");
51
-
52
29
  var _DrilldownOption = require("./DrilldownOption");
53
-
54
30
  var _DrilldownGroup = require("./DrilldownGroup");
55
-
56
31
  var _DrilldownPage = require("./DrilldownPage");
57
-
58
32
  var _styles = _interopRequireDefault(require("./styles"));
59
-
60
33
  var _theme = _interopRequireDefault(require("./theme"));
61
-
62
34
  var _props = require("./props");
63
-
64
35
  const _excluded = ["groupProps"],
65
- _excluded2 = ["groupProps"],
66
- _excluded3 = ["id", "themeOverride"];
67
-
36
+ _excluded2 = ["groupProps"],
37
+ _excluded3 = ["id", "themeOverride"];
68
38
  var _dec, _dec2, _dec3, _class, _class2, _IconArrowOpenEndSoli, _IconArrowOpenStartSo, _Options$Separator, _Options$Separator2;
69
-
70
39
  /**
71
40
  ---
72
41
  category: components
@@ -75,8 +44,11 @@ category: components
75
44
  **/
76
45
  let Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec3 = (0, _testable.testable)(), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = class Drilldown extends _react.Component {
77
46
  // Array of visited page ids in "breadcrumbs" fashion
47
+
78
48
  // Map of the active options on the page (includes header options too)
49
+
79
50
  // Map of the selected options in groups (grouped by group id)
51
+
80
52
  constructor(props) {
81
53
  super(props);
82
54
  this._drilldownRef = null;
@@ -92,61 +64,52 @@ let Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
92
64
  this._pageHistory = void 0;
93
65
  this._activeOptionsMap = {};
94
66
  this.ref = null;
95
-
96
67
  this.handleRef = el => {
97
68
  // ref and elementRef have to be set together for the same element
98
69
  const elementRef = this.props.elementRef;
99
70
  this.ref = el;
100
-
101
71
  if (typeof elementRef === 'function') {
102
72
  elementRef(el);
103
73
  }
104
74
  };
105
-
106
75
  this.handleDrilldownRef = el => {
107
76
  const drilldownRef = this.props.drilldownRef;
108
77
  this._drilldownRef = el;
109
-
110
78
  if (typeof drilldownRef === 'function') {
111
79
  drilldownRef(el);
112
- } // setting ref for "non-popover" version, the drilldown itself
113
- // (if a trigger is provided, the Popover sets the ref)
114
-
80
+ }
115
81
 
82
+ // setting ref for "non-popover" version, the drilldown itself
83
+ // (if a trigger is provided, the Popover sets the ref)
116
84
  if (!this.props.trigger) {
117
85
  this.handleRef(el);
118
86
  }
119
87
  };
120
-
121
88
  this.show = event => {
122
89
  if (this._popover) {
123
90
  this._popover.show(event);
124
-
125
91
  this.setState({
126
92
  isShowingPopover: true
127
93
  });
128
94
  }
129
95
  };
130
-
131
96
  this.hide = event => {
132
97
  if (this._popover) {
133
98
  this._popover.hide(event);
134
-
135
99
  this.setState({
136
100
  isShowingPopover: false
137
101
  });
138
102
  this.reset();
139
103
  }
140
104
  };
141
-
142
105
  this.handleOptionHighlight = (_event, _ref) => {
143
106
  let id = _ref.id,
144
- direction = _ref.direction;
107
+ direction = _ref.direction;
145
108
  const rotateFocus = this.props.rotateFocus;
146
- const highlightedOptionId = this.state.highlightedOptionId; // if id exists, use that, or calculate from direction
109
+ const highlightedOptionId = this.state.highlightedOptionId;
147
110
 
111
+ // if id exists, use that, or calculate from direction
148
112
  let highlightId = this.getPageChildById(id) ? id : void 0;
149
-
150
113
  if (!highlightId) {
151
114
  if (!highlightedOptionId) {
152
115
  // nothing highlighted yet, highlight first option
@@ -156,21 +119,17 @@ let Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
156
119
  const index = this.activeOptionIds.indexOf(highlightedOptionId);
157
120
  const newIndex = index + direction;
158
121
  highlightId = index > -1 ? this.activeOptionIds[newIndex] : void 0;
159
-
160
122
  if (rotateFocus) {
161
123
  const lastOptionsIndex = this.activeOptionIds.length - 1;
162
-
163
124
  if (newIndex < 0) {
164
125
  highlightId = this.activeOptionIds[lastOptionsIndex];
165
126
  }
166
-
167
127
  if (newIndex > lastOptionsIndex) {
168
128
  highlightId = this.activeOptionIds[0];
169
129
  }
170
130
  }
171
131
  }
172
132
  }
173
-
174
133
  if (highlightId) {
175
134
  // only highlight if id exists as a valid option
176
135
  this.setState({
@@ -180,33 +139,28 @@ let Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
180
139
  });
181
140
  }
182
141
  };
183
-
184
142
  this.goToPage = newPageId => {
185
143
  var _this$pageMap;
186
-
187
144
  if (!newPageId) {
188
145
  (0, _console.warn)(false, `Cannot go to page because there was no page id provided.`);
189
146
  return void 0;
190
- } // TS complains that it cannot be true, but since it is an exposed method,
191
- // it is better if we provide a warning for this case too
192
-
147
+ }
193
148
 
149
+ // TS complains that it cannot be true, but since it is an exposed method,
150
+ // it is better if we provide a warning for this case too
194
151
  if (typeof newPageId !== 'string') {
195
152
  (0, _console.warn)(false, `Cannot go to page because parameter newPageId has to be string (valid page id). Current newPageId is "${typeof newPageId}".`);
196
153
  return void 0;
197
154
  }
198
-
199
155
  if (!((_this$pageMap = this.pageMap) !== null && _this$pageMap !== void 0 && _this$pageMap[newPageId])) {
200
156
  (0, _console.warn)(false, `Cannot go to page because page with id: "${newPageId}" doesn't exist.`);
201
157
  return void 0;
202
- } // the last page id in the history is the current one,
203
- // it will become the "prevPage"
204
-
158
+ }
205
159
 
160
+ // the last page id in the history is the current one,
161
+ // it will become the "prevPage"
206
162
  const prevPageId = this._pageHistory[this._pageHistory.length - 1];
207
-
208
163
  const idxInHistory = this._pageHistory.indexOf(newPageId);
209
-
210
164
  if (idxInHistory < 0) {
211
165
  // if it is not in the page history, we have to add it
212
166
  this._pageHistory.push(newPageId);
@@ -215,7 +169,6 @@ let Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
215
169
  // and clear the rest from the history
216
170
  this._pageHistory.splice(idxInHistory + 1, this._pageHistory.length - 1);
217
171
  }
218
-
219
172
  this.setState({
220
173
  activePageId: newPageId,
221
174
  highlightedOptionId: void 0
@@ -225,60 +178,54 @@ let Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
225
178
  newPageId
226
179
  };
227
180
  };
228
-
229
181
  this.goToPreviousPage = () => {
230
182
  if (!this.previousPage) {
231
183
  (0, _console.warn)(false, `There is no previous page to go to. The current page history is: [${this._pageHistory.join(', ')}].`);
232
184
  return void 0;
233
- } // If there is a previous page, goToPage will succeed and return the data
234
-
185
+ }
235
186
 
187
+ // If there is a previous page, goToPage will succeed and return the data
236
188
  const _ref2 = this.goToPage(this.previousPage.id),
237
- newPageId = _ref2.newPageId,
238
- prevPageId = _ref2.prevPageId;
239
-
189
+ newPageId = _ref2.newPageId,
190
+ prevPageId = _ref2.prevPageId;
240
191
  return {
241
192
  newPageId,
242
193
  prevPageId
243
194
  };
244
195
  };
245
-
246
196
  this.handleBackButtonClick = () => {
247
197
  const _ref3 = this.currentPage,
248
- onBackButtonClicked = _ref3.onBackButtonClicked; // we only display the back button when there is a page to go back to
198
+ onBackButtonClicked = _ref3.onBackButtonClicked;
249
199
 
200
+ // we only display the back button when there is a page to go back to
250
201
  const _ref4 = this.goToPreviousPage(),
251
- newPageId = _ref4.newPageId,
252
- prevPageId = _ref4.prevPageId;
253
-
202
+ newPageId = _ref4.newPageId,
203
+ prevPageId = _ref4.prevPageId;
254
204
  if (typeof onBackButtonClicked === 'function') {
255
205
  onBackButtonClicked(newPageId, prevPageId);
256
206
  }
257
207
  };
258
-
259
208
  this.handleOptionSelect = (event, _ref5) => {
260
209
  let id = _ref5.id;
261
- const selectedOption = this.getPageChildById(id); // TODO: this line can be removed when React 16 is no longer supported
210
+ const selectedOption = this.getPageChildById(id);
262
211
 
212
+ // TODO: this line can be removed when React 16 is no longer supported
263
213
  event.persist();
264
-
265
214
  if (!id || !selectedOption || selectedOption.props.disabled || event.target.getAttribute('disabled') || event.target.getAttribute('aria-disabled')) {
266
215
  event.preventDefault();
267
216
  event.stopPropagation();
268
217
  return;
269
218
  }
270
-
271
219
  const _this$props = this.props,
272
- shouldHideOnSelect = _this$props.shouldHideOnSelect,
273
- onSelect = _this$props.onSelect;
220
+ shouldHideOnSelect = _this$props.shouldHideOnSelect,
221
+ onSelect = _this$props.onSelect;
274
222
  const groupProps = selectedOption.groupProps,
275
- selectedOptionChild = (0, _objectWithoutProperties2.default)(selectedOption, _excluded);
223
+ selectedOptionChild = (0, _objectWithoutProperties2.default)(selectedOption, _excluded);
276
224
  const _selectedOptionChild$ = selectedOptionChild.props,
277
- subPageId = _selectedOptionChild$.subPageId,
278
- href = _selectedOptionChild$.href,
279
- value = _selectedOptionChild$.value,
280
- onOptionClick = _selectedOptionChild$.onOptionClick;
281
-
225
+ subPageId = _selectedOptionChild$.subPageId,
226
+ href = _selectedOptionChild$.href,
227
+ value = _selectedOptionChild$.value,
228
+ onOptionClick = _selectedOptionChild$.onOptionClick;
282
229
  if (typeof onOptionClick === 'function') {
283
230
  onOptionClick(event, {
284
231
  optionId: id,
@@ -286,23 +233,20 @@ let Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
286
233
  ...this.exposedNavigationProps
287
234
  });
288
235
  }
289
-
290
236
  if (subPageId) {
291
237
  this.goToPage(subPageId);
292
238
  }
293
-
294
239
  if (href) {
295
240
  var _this$_drilldownRef;
296
-
297
241
  const optionEl = (_this$_drilldownRef = this._drilldownRef) === null || _this$_drilldownRef === void 0 ? void 0 : _this$_drilldownRef.querySelector(`#${id}`);
298
- const isLink = optionEl.tagName.toLowerCase() === 'a'; // we need this check because in some cases
299
- // we ignore href prop in renderOption()
242
+ const isLink = optionEl.tagName.toLowerCase() === 'a';
300
243
 
244
+ // we need this check because in some cases
245
+ // we ignore href prop in renderOption()
301
246
  if (isLink && optionEl !== null && optionEl !== void 0 && optionEl.href) {
302
247
  optionEl.click();
303
248
  }
304
249
  }
305
-
306
250
  if (groupProps !== null && groupProps !== void 0 && groupProps.selectableType) {
307
251
  this.handleGroupOptionSelected(event, selectedOption);
308
252
  } else {
@@ -314,31 +258,32 @@ let Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
314
258
  drilldown: this
315
259
  });
316
260
  }
317
- } // should prevent closing on page navigation
318
-
261
+ }
319
262
 
263
+ // should prevent closing on page navigation
320
264
  if (shouldHideOnSelect && !subPageId && id !== this._headerBackId) {
321
265
  this.hide(event);
322
266
  }
323
267
  };
324
-
325
268
  this.handleKeyDown = event => {
326
269
  const id = event.target.id;
327
- const option = this.getPageChildById(id); // On Space...
270
+ const option = this.getPageChildById(id);
328
271
 
272
+ // On Space...
329
273
  if ([' ', 'space', 'Space'].includes(event.key)) {
330
274
  // we need to preventDefault so the page doesn't scroll on Space
331
275
  event.preventDefault();
332
- event.stopPropagation(); // for options, Space it has to work as Enter (get selected)
276
+ event.stopPropagation();
333
277
 
278
+ // for options, Space it has to work as Enter (get selected)
334
279
  if (option) {
335
280
  this.handleOptionSelect(event, {
336
281
  id
337
282
  });
338
283
  }
339
- } // On Right arrow...
340
-
284
+ }
341
285
 
286
+ // On Right arrow...
342
287
  if (event.key === 'ArrowRight') {
343
288
  // if the option has subpage, we open it
344
289
  if (option !== null && option !== void 0 && option.props.subPageId) {
@@ -346,30 +291,27 @@ let Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
346
291
  id
347
292
  });
348
293
  }
349
- } // On Left arrow...
350
-
294
+ }
351
295
 
296
+ // On Left arrow...
352
297
  if (event.key === 'ArrowLeft') {
353
298
  var _this$_popover;
354
-
355
299
  // if it is possible, we go a level up in the history
356
300
  if (this._pageHistory.length > 1) {
357
301
  this.goToPreviousPage();
358
- } // if on root page and popover is open, we close it
359
-
302
+ }
360
303
 
304
+ // if on root page and popover is open, we close it
361
305
  if (this.isOnRootPage && (_this$_popover = this._popover) !== null && _this$_popover !== void 0 && _this$_popover.shown) {
362
306
  this._popover.hide(event);
363
307
  }
364
308
  }
365
309
  };
366
-
367
310
  this.handleToggle = (event, shown) => {
368
311
  const onToggle = this.props.onToggle;
369
312
  this.setState({
370
313
  isShowingPopover: shown
371
314
  });
372
-
373
315
  if (typeof onToggle === 'function') {
374
316
  onToggle(event, {
375
317
  shown,
@@ -378,7 +320,6 @@ let Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
378
320
  });
379
321
  }
380
322
  };
381
-
382
323
  this.state = {
383
324
  isShowingPopover: props.trigger ? !!props.show : false,
384
325
  activePageId: props.rootPageId,
@@ -394,18 +335,13 @@ let Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
394
335
  this._headerTitleLabelId = props.deterministicId('DrilldownHeader-Title-Label');
395
336
  this._headerActionId = props.deterministicId('DrilldownHeader-Action');
396
337
  }
397
-
398
338
  componentDidMount() {
399
339
  var _this$props$makeStyle, _this$props2;
400
-
401
340
  (_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2, this.makeStylesVariables);
402
341
  }
403
-
404
342
  componentDidUpdate(_prevProps, prevState) {
405
343
  var _this$props$makeStyle2, _this$props3;
406
-
407
344
  (_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3, this.makeStylesVariables);
408
-
409
345
  if (prevState.activePageId !== this.state.activePageId) {
410
346
  // on page change with mouse navigation, some option can get rendered
411
347
  // under the cursor and get focused, so we need to wait a tick to see
@@ -415,9 +351,9 @@ let Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
415
351
  this.focus();
416
352
  }
417
353
  }, 0);
418
- } // if the current page was removed
419
-
354
+ }
420
355
 
356
+ // if the current page was removed
421
357
  if (!this.currentPage) {
422
358
  if (this.previousPage) {
423
359
  this.goToPreviousPage();
@@ -425,71 +361,62 @@ let Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
425
361
  this.goToPage(this.props.rootPageId);
426
362
  }
427
363
  }
428
-
429
364
  if (this.state.highlightedOptionId && !this.getPageChildById(this.state.highlightedOptionId)) {
430
365
  this.setState({
431
366
  highlightedOptionId: void 0
432
367
  });
433
368
  }
434
369
  }
435
-
436
370
  get makeStylesVariables() {
437
371
  return {
438
372
  hasHighlightedOption: !!this.state.highlightedOptionId
439
373
  };
440
374
  }
441
-
442
375
  get activeOptionIds() {
443
376
  return Object.keys(this._activeOptionsMap);
444
377
  }
445
-
446
378
  get activeOptions() {
447
379
  return Object.values(this._activeOptionsMap);
448
380
  }
449
-
450
381
  get pages() {
451
382
  const children = this.props.children;
452
383
  return _react.default.Children.toArray(children || []);
453
384
  }
454
-
455
385
  get pageMap() {
456
386
  const children = this.props.children;
457
-
458
387
  if (!children) {
459
388
  return void 0;
460
389
  }
461
-
462
390
  const map = {};
463
391
  this.pages.forEach(page => {
464
392
  const props = page.props;
465
393
  const children = props.children;
466
- map[props.id] = { ...props,
394
+ map[props.id] = {
395
+ ...props,
467
396
  children: _react.default.Children.toArray(children || [])
468
397
  };
469
398
  });
470
399
  return map;
471
400
  }
472
-
473
401
  get isOnRootPage() {
474
402
  return this.state.activePageId === this.props.rootPageId;
475
403
  }
476
-
477
404
  get currentPage() {
478
405
  return this.getPageById(this.state.activePageId);
479
406
  }
480
-
481
407
  get previousPage() {
482
408
  const previousPageId = this._pageHistory[this._pageHistory.length - 2];
483
409
  return this.getPageById(previousPageId);
484
- } // Returns the navigation methods and the page history.
485
- // These are used in some callbacks to expose the navigation logic.
486
-
410
+ }
487
411
 
412
+ // Returns the navigation methods and the page history.
413
+ // These are used in some callbacks to expose the navigation logic.
488
414
  get exposedNavigationProps() {
489
415
  const goToPage = this.goToPage,
490
- goToPreviousPage = this.goToPreviousPage; // we make a copy of the array so the original history
491
- // cannot be modified from the outside
416
+ goToPreviousPage = this.goToPreviousPage;
492
417
 
418
+ // we make a copy of the array so the original history
419
+ // cannot be modified from the outside
493
420
  const pageHistory = [...this._pageHistory];
494
421
  return {
495
422
  pageHistory,
@@ -497,44 +424,36 @@ let Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
497
424
  goToPreviousPage
498
425
  };
499
426
  }
500
-
501
427
  get currentPageAriaLabel() {
502
428
  var _this$currentPage;
503
-
504
429
  // return, if explicitly set
505
430
  if (this.props['aria-labelledby']) {
506
431
  return this.props['aria-labelledby'];
507
- } // if it has title, point to the title label content
508
-
432
+ }
509
433
 
434
+ // if it has title, point to the title label content
510
435
  if ((_this$currentPage = this.currentPage) !== null && _this$currentPage !== void 0 && _this$currentPage.renderTitle) {
511
436
  return this._headerTitleLabelId;
512
- } // if root page has no title, try the trigger, if exists
513
-
437
+ }
514
438
 
439
+ // if root page has no title, try the trigger, if exists
515
440
  if (this.isOnRootPage && this.props.trigger) {
516
441
  return this._triggerId;
517
442
  }
518
-
519
443
  return void 0;
520
444
  }
521
-
522
445
  getChildrenArray(children) {
523
446
  if (!children) {
524
447
  return [];
525
448
  }
526
-
527
449
  return Array.isArray(children) ? children : [children];
528
450
  }
529
-
530
451
  getPageById(id) {
531
452
  return this.pageMap && id ? this.pageMap[id] : void 0;
532
453
  }
533
-
534
454
  getPageChildById(id) {
535
455
  return id ? this._activeOptionsMap[id] : void 0;
536
456
  }
537
-
538
457
  setDefaultSelected() {
539
458
  const selectedGroupOptionsMap = {};
540
459
  this.pages.forEach(page => {
@@ -542,41 +461,35 @@ let Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
542
461
  this.getChildrenArray(children).forEach(child => {
543
462
  if ((0, _matchComponentTypes.matchComponentTypes)(child, [_DrilldownGroup.DrilldownGroup])) {
544
463
  var _this$getChildrenArra;
545
-
546
464
  const _child$props = child.props,
547
- groupId = _child$props.id,
548
- selectableType = _child$props.selectableType,
549
- _child$props$defaultS = _child$props.defaultSelected,
550
- groupDefaultSelected = _child$props$defaultS === void 0 ? [] : _child$props$defaultS,
551
- groupChildren = _child$props.children;
552
-
465
+ groupId = _child$props.id,
466
+ selectableType = _child$props.selectableType,
467
+ _child$props$defaultS = _child$props.defaultSelected,
468
+ groupDefaultSelected = _child$props$defaultS === void 0 ? [] : _child$props$defaultS,
469
+ groupChildren = _child$props.children;
553
470
  if (!selectableType) {
554
471
  return;
555
472
  }
556
-
557
473
  if (selectableType && !selectedGroupOptionsMap[groupId]) {
558
474
  selectedGroupOptionsMap[groupId] = new Map();
559
475
  }
560
-
561
476
  if (selectableType === 'single' && groupDefaultSelected.length > 1) {
562
477
  (0, _console.error)(false, `Radio type selectable groups can have only one item selected! Group with id "${groupId}" cannot select multiple items: [${groupDefaultSelected.join(', ')}]!`);
563
478
  return;
564
479
  }
565
-
566
480
  selectedGroupOptionsMap[groupId] = new Map();
567
481
  (_this$getChildrenArra = this.getChildrenArray(groupChildren)) === null || _this$getChildrenArra === void 0 ? void 0 : _this$getChildrenArra.forEach(groupChild => {
568
482
  if ((0, _matchComponentTypes.matchComponentTypes)(groupChild, [_DrilldownOption.DrilldownOption])) {
569
483
  const _groupChild$props = groupChild.props,
570
- optionId = _groupChild$props.id,
571
- optionValue = _groupChild$props.value,
572
- optionDefaultSelected = _groupChild$props.defaultSelected; // if explicitly set to false, it should override the group's
484
+ optionId = _groupChild$props.id,
485
+ optionValue = _groupChild$props.value,
486
+ optionDefaultSelected = _groupChild$props.defaultSelected;
573
487
 
488
+ // if explicitly set to false, it should override the group's
574
489
  if (optionDefaultSelected === false) {
575
490
  return;
576
491
  }
577
-
578
492
  const isGroupDefaultSelected = typeof optionValue !== 'undefined' && groupDefaultSelected.filter(value => typeof value !== 'undefined').includes(optionValue);
579
-
580
493
  if (optionDefaultSelected || isGroupDefaultSelected) {
581
494
  selectedGroupOptionsMap[groupId].set(optionId, optionValue);
582
495
  }
@@ -587,29 +500,26 @@ let Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
587
500
  });
588
501
  return selectedGroupOptionsMap;
589
502
  }
590
-
591
503
  get selectedGroupOptionIdsArray() {
592
504
  return Object.values(this.state.selectedGroupOptionsMap).map(groupIdMap => Array.from(groupIdMap.keys())).flat();
593
505
  }
594
-
595
506
  get headerChildren() {
596
507
  const currentPage = this.currentPage;
597
508
  const _this$props4 = this.props,
598
- styles = _this$props4.styles,
599
- deterministicId = _this$props4.deterministicId;
509
+ styles = _this$props4.styles,
510
+ deterministicId = _this$props4.deterministicId;
600
511
  const headerChildren = [];
601
-
602
512
  if (!currentPage) {
603
513
  return headerChildren;
604
514
  }
605
-
606
515
  const children = currentPage.children,
607
- renderBackButtonLabel = currentPage.renderBackButtonLabel,
608
- renderTitle = currentPage.renderTitle,
609
- renderActionLabel = currentPage.renderActionLabel,
610
- onHeaderActionClicked = currentPage.onHeaderActionClicked,
611
- withoutHeaderSeparator = currentPage.withoutHeaderSeparator; // Back navigation option
516
+ renderBackButtonLabel = currentPage.renderBackButtonLabel,
517
+ renderTitle = currentPage.renderTitle,
518
+ renderActionLabel = currentPage.renderActionLabel,
519
+ onHeaderActionClicked = currentPage.onHeaderActionClicked,
520
+ withoutHeaderSeparator = currentPage.withoutHeaderSeparator;
612
521
 
522
+ // Back navigation option
613
523
  if (this.previousPage) {
614
524
  const prevPageTitle = (0, _callRenderProp.callRenderProp)(this.previousPage.renderTitle);
615
525
  const backButtonLabel = (0, _callRenderProp.callRenderProp)(renderBackButtonLabel, prevPageTitle);
@@ -620,12 +530,11 @@ let Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
620
530
  css: styles === null || styles === void 0 ? void 0 : styles.headerBack,
621
531
  role: "presentation"
622
532
  }, backButtonLabel)));
623
- } // Header title
624
-
533
+ }
625
534
 
535
+ // Header title
626
536
  if (renderTitle) {
627
537
  const title = (0, _callRenderProp.callRenderProp)(renderTitle);
628
-
629
538
  if (title) {
630
539
  headerChildren.push((0, _emotion.jsx)(_DrilldownOption.DrilldownOption, {
631
540
  id: this._headerTitleId,
@@ -636,12 +545,11 @@ let Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
636
545
  id: this._headerTitleLabelId
637
546
  }, title)));
638
547
  }
639
- } // Action label
640
-
548
+ }
641
549
 
550
+ // Action label
642
551
  if (renderActionLabel) {
643
552
  const actionLabel = (0, _callRenderProp.callRenderProp)(renderActionLabel);
644
-
645
553
  if (actionLabel) {
646
554
  headerChildren.push((0, _emotion.jsx)(_DrilldownOption.DrilldownOption, {
647
555
  id: this._headerActionId,
@@ -655,26 +563,22 @@ let Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
655
563
  }
656
564
  }, actionLabel));
657
565
  }
658
- } // header separator
659
-
566
+ }
660
567
 
568
+ // header separator
661
569
  if (headerChildren.length > 0 && children.length > 0 && !withoutHeaderSeparator) {
662
570
  headerChildren.push((0, _emotion.jsx)(_DrilldownSeparator.DrilldownSeparator, {
663
571
  id: deterministicId('DrilldownHeader-Separator')
664
572
  }));
665
573
  }
666
-
667
574
  return headerChildren;
668
575
  }
669
-
670
576
  get shown() {
671
577
  return this.props.trigger ? this.state.isShowingPopover : true;
672
578
  }
673
-
674
579
  containsDuplicateChild(children) {
675
580
  let containsDuplicate = false;
676
581
  const childMap = new Map();
677
-
678
582
  for (const child of children) {
679
583
  if (!childMap.has(child.props.id)) {
680
584
  childMap.set(child.props.id, true);
@@ -683,32 +587,25 @@ let Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
683
587
  return containsDuplicate = true;
684
588
  }
685
589
  }
686
-
687
590
  return containsDuplicate;
688
591
  }
689
-
690
592
  reset() {
691
593
  this._activeOptionsMap = {};
692
594
  this.setState({
693
595
  highlightedOptionId: void 0
694
596
  });
695
597
  }
696
-
697
598
  focus() {
698
599
  if (this.shown) {
699
600
  var _this$_drilldownRef2, _this$_drilldownRef3;
700
-
701
601
  (0, _console.error)(!!((_this$_drilldownRef2 = this._drilldownRef) !== null && _this$_drilldownRef2 !== void 0 && _this$_drilldownRef2.focus), '[Drilldown] Could not focus the drilldown.');
702
602
  (_this$_drilldownRef3 = this._drilldownRef) === null || _this$_drilldownRef3 === void 0 ? void 0 : _this$_drilldownRef3.focus();
703
603
  } else {
704
604
  var _this$_trigger;
705
-
706
605
  (0, _console.error)(!!((_this$_trigger = this._trigger) !== null && _this$_trigger !== void 0 && _this$_trigger.focus), '[Drilldown] Could not focus the trigger.');
707
-
708
606
  this._trigger.focus();
709
607
  }
710
608
  }
711
-
712
609
  focused() {
713
610
  if (this.shown) {
714
611
  return (0, _containsActiveElement.containsActiveElement)(this._drilldownRef);
@@ -716,25 +613,21 @@ let Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
716
613
  return (0, _containsActiveElement.containsActiveElement)(this._trigger);
717
614
  }
718
615
  }
719
-
720
616
  focusOption(id) {
721
617
  const container = this._containerElement;
722
618
  const optionElement = container === null || container === void 0 ? void 0 : container.querySelector(`[id="${id}"]`);
723
619
  optionElement === null || optionElement === void 0 ? void 0 : optionElement.focus();
724
620
  }
725
-
726
621
  handleGroupOptionSelected(event, selectedOption) {
727
622
  this.setState(oldState => {
728
623
  var _oldState$selectedGro;
729
-
730
624
  const _selectedOption$props = selectedOption.props,
731
- optionId = _selectedOption$props.id,
732
- value = _selectedOption$props.value;
625
+ optionId = _selectedOption$props.id,
626
+ value = _selectedOption$props.value;
733
627
  const _ref6 = selectedOption.groupProps,
734
- groupId = _ref6.id,
735
- selectableType = _ref6.selectableType;
628
+ groupId = _ref6.id,
629
+ selectableType = _ref6.selectableType;
736
630
  let newState = new Map(oldState.selectedGroupOptionsMap[groupId]);
737
-
738
631
  if (selectableType === 'multiple' && Boolean((_oldState$selectedGro = oldState.selectedGroupOptionsMap[groupId]) === null || _oldState$selectedGro === void 0 ? void 0 : _oldState$selectedGro.has(optionId))) {
739
632
  // toggle off, if already selected
740
633
  newState.delete(optionId);
@@ -748,22 +641,22 @@ let Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
748
641
  newState.set(optionId, value);
749
642
  }
750
643
  }
751
-
752
- return { ...oldState,
753
- selectedGroupOptionsMap: { ...oldState.selectedGroupOptionsMap,
644
+ return {
645
+ ...oldState,
646
+ selectedGroupOptionsMap: {
647
+ ...oldState.selectedGroupOptionsMap,
754
648
  [groupId]: newState
755
649
  }
756
650
  };
757
651
  }, () => {
758
652
  const value = selectedOption.props.value;
759
653
  const _ref7 = selectedOption.groupProps,
760
- groupId = _ref7.id,
761
- groupOnSelect = _ref7.onSelect;
654
+ groupId = _ref7.id,
655
+ groupOnSelect = _ref7.onSelect;
762
656
  const onSelect = this.props.onSelect;
763
657
  const groupProps = selectedOption.groupProps,
764
- option = (0, _objectWithoutProperties2.default)(selectedOption, _excluded2);
658
+ option = (0, _objectWithoutProperties2.default)(selectedOption, _excluded2);
765
659
  const selectedOptionValuesInGroup = [...this.state.selectedGroupOptionsMap[groupId].values()];
766
-
767
660
  if (typeof groupOnSelect === 'function') {
768
661
  groupOnSelect(event, {
769
662
  value: selectedOptionValuesInGroup,
@@ -772,7 +665,6 @@ let Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
772
665
  drilldown: this
773
666
  });
774
667
  }
775
-
776
668
  if (typeof onSelect === 'function') {
777
669
  onSelect(event, {
778
670
  value: selectedOptionValuesInGroup,
@@ -783,17 +675,15 @@ let Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
783
675
  }
784
676
  });
785
677
  }
786
-
787
678
  renderList(getOptionProps, getDisabledOptionProps) {
788
679
  const currentPage = this.currentPage,
789
- headerChildren = this.headerChildren;
790
-
680
+ headerChildren = this.headerChildren;
791
681
  if (!currentPage || this.containsDuplicateChild(currentPage.children)) {
792
682
  return null;
793
683
  }
684
+ const pageChildren = [...headerChildren, ...currentPage.children];
794
685
 
795
- const pageChildren = [...headerChildren, ...currentPage.children]; // for tracking if the last item was a Separator or not
796
-
686
+ // for tracking if the last item was a Separator or not
797
687
  let lastItemWasSeparator = false;
798
688
  return pageChildren.map((child, index) => {
799
689
  /**
@@ -806,8 +696,10 @@ let Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
806
696
  const needsFirstSeparator = !child.props.withoutSeparators && !isFirstChild && !afterSeparator;
807
697
  const needsLastSeparator = !child.props.withoutSeparators && !isLastChild;
808
698
  lastItemWasSeparator = needsLastSeparator;
809
- return this.renderGroup(child, getOptionProps, getDisabledOptionProps, // for rendering separators appropriately
699
+ return this.renderGroup(child, getOptionProps, getDisabledOptionProps,
700
+ // for rendering separators appropriately
810
701
  needsFirstSeparator, needsLastSeparator);
702
+
811
703
  /**
812
704
  * --- RENDER SEPARATOR ---
813
705
  */
@@ -816,9 +708,9 @@ let Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
816
708
  if (lastItemWasSeparator) {
817
709
  return null;
818
710
  }
819
-
820
711
  lastItemWasSeparator = true;
821
712
  return this.renderSeparator(child);
713
+
822
714
  /**
823
715
  * --- RENDER OPTION ---
824
716
  */
@@ -830,51 +722,49 @@ let Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
830
722
  }
831
723
  });
832
724
  }
833
-
834
725
  renderSeparator(separator) {
835
726
  const _separator$props = separator.props,
836
- id = _separator$props.id,
837
- themeOverride = _separator$props.themeOverride,
838
- props = (0, _objectWithoutProperties2.default)(_separator$props, _excluded3);
727
+ id = _separator$props.id,
728
+ themeOverride = _separator$props.themeOverride,
729
+ props = (0, _objectWithoutProperties2.default)(_separator$props, _excluded3);
839
730
  return (0, _emotion.jsx)(_Options.Options.Separator, Object.assign({}, props, {
840
731
  id: id,
841
732
  key: id,
842
- role: "separator" // we pass the themeOverride to Options.Separator
733
+ role: "separator"
734
+ // we pass the themeOverride to Options.Separator
843
735
  ,
844
736
  themeOverride: themeOverride
845
737
  }));
846
738
  }
847
-
848
739
  renderOption(option, getOptionProps, getDisabledOptionProps, groupProps) {
849
740
  var _this$currentPage2, _optionProps$renderBe, _optionProps$renderBe2, _optionProps$renderAf, _optionProps$renderAf2;
850
-
851
741
  const styles = this.props.styles;
852
742
  let isSelected = false;
853
743
  const _option$props = option.props,
854
- id = _option$props.id,
855
- children = _option$props.children,
856
- href = _option$props.href,
857
- as = _option$props.as,
858
- role = _option$props.role,
859
- subPageId = _option$props.subPageId,
860
- disabled = _option$props.disabled,
861
- renderLabelInfo = _option$props.renderLabelInfo,
862
- renderBeforeLabel = _option$props.renderBeforeLabel,
863
- renderAfterLabel = _option$props.renderAfterLabel,
864
- beforeLabelContentVAlign = _option$props.beforeLabelContentVAlign,
865
- afterLabelContentVAlign = _option$props.afterLabelContentVAlign,
866
- description = _option$props.description,
867
- descriptionRole = _option$props.descriptionRole,
868
- elementRef = _option$props.elementRef,
869
- themeOverride = _option$props.themeOverride;
870
-
744
+ id = _option$props.id,
745
+ children = _option$props.children,
746
+ href = _option$props.href,
747
+ as = _option$props.as,
748
+ role = _option$props.role,
749
+ subPageId = _option$props.subPageId,
750
+ disabled = _option$props.disabled,
751
+ renderLabelInfo = _option$props.renderLabelInfo,
752
+ renderBeforeLabel = _option$props.renderBeforeLabel,
753
+ renderAfterLabel = _option$props.renderAfterLabel,
754
+ beforeLabelContentVAlign = _option$props.beforeLabelContentVAlign,
755
+ afterLabelContentVAlign = _option$props.afterLabelContentVAlign,
756
+ description = _option$props.description,
757
+ descriptionRole = _option$props.descriptionRole,
758
+ elementRef = _option$props.elementRef,
759
+ themeOverride = _option$props.themeOverride;
871
760
  if (!id) {
872
761
  (0, _console.warn)(false, `Drilldown.Option without id won't be rendered. It is needed to internally track the options.`);
873
762
  return null;
874
- } // Props passed to the Option.Item
875
-
763
+ }
876
764
 
877
- let optionProps = { // passthrough props
765
+ // Props passed to the Option.Item
766
+ let optionProps = {
767
+ // passthrough props
878
768
  ...(0, _omitProps.omitProps)(option.props, [..._DrilldownOption.DrilldownOption.allowedProps, ..._Options.Options.Item.allowedProps]),
879
769
  // props from selectable
880
770
  ...getOptionProps({
@@ -898,81 +788,78 @@ let Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
898
788
  elementRef,
899
789
  variant: 'default',
900
790
  tabIndex: -1
901
- }; // extra data we need track on the option,
902
- // but don't want to expose as props
791
+ };
903
792
 
793
+ // extra data we need track on the option,
794
+ // but don't want to expose as props
904
795
  const optionData = {
905
796
  groupProps: groupProps
906
797
  };
907
- const isOptionDisabled = id !== this._headerBackId && ( // Back nav is never disabled
908
- this.props.disabled || ((_this$currentPage2 = this.currentPage) === null || _this$currentPage2 === void 0 ? void 0 : _this$currentPage2.disabled) || (groupProps === null || groupProps === void 0 ? void 0 : groupProps.disabled) || disabled); // display option as disabled
798
+ const isOptionDisabled = id !== this._headerBackId && (
799
+ // Back nav is never disabled
800
+ this.props.disabled || ((_this$currentPage2 = this.currentPage) === null || _this$currentPage2 === void 0 ? void 0 : _this$currentPage2.disabled) || (groupProps === null || groupProps === void 0 ? void 0 : groupProps.disabled) || disabled);
909
801
 
802
+ // display option as disabled
910
803
  if (isOptionDisabled) {
911
804
  optionProps.variant = 'disabled';
912
- optionProps = { ...optionProps,
805
+ optionProps = {
806
+ ...optionProps,
913
807
  ...getDisabledOptionProps()
914
808
  };
915
- } // track as valid active option if not the title
916
-
809
+ }
917
810
 
811
+ // track as valid active option if not the title
918
812
  if (id !== this._headerTitleId) {
919
- this._activeOptionsMap[id] = { ...option,
813
+ this._activeOptionsMap[id] = {
814
+ ...option,
920
815
  ...optionData
921
816
  };
922
817
  }
818
+ const customRole = role !== _DrilldownOption.DrilldownOption.defaultProps.role ? role : void 0;
923
819
 
924
- const customRole = role !== _DrilldownOption.DrilldownOption.defaultProps.role ? role : void 0; // BEFORE/AFTER elements:
820
+ // BEFORE/AFTER elements:
925
821
  // we set a few manually on Options.Item,
926
822
  // the rest are passed directly
927
-
928
823
  if (subPageId) {
929
824
  optionProps.renderAfterLabel = _IconArrowOpenEndSoli || (_IconArrowOpenEndSoli = (0, _emotion.jsx)(_IconArrowOpenEndSolid.IconArrowOpenEndSolid, null));
930
825
  optionProps['aria-haspopup'] = true;
931
826
  optionProps.role = customRole || 'button';
932
827
  (0, _console.warn)(!renderAfterLabel, `The prop "renderAfterLabel" is reserved on item with id: "${id}". When it has "subPageId" provided, a navigation arrow will render after the label.`);
933
828
  }
934
-
935
829
  if (id === this._headerBackId) {
936
830
  optionProps.renderBeforeLabel = _IconArrowOpenStartSo || (_IconArrowOpenStartSo = (0, _emotion.jsx)(_IconArrowOpenStartSolid.IconArrowOpenStartSolid, null));
937
831
  }
938
-
939
832
  const isOptionControlled = typeof option.props.selected === 'boolean';
940
-
941
833
  if ((groupProps !== null && groupProps !== void 0 && groupProps.selectableType || isOptionControlled) && groupProps) {
942
834
  if (!isOptionControlled) {
943
835
  var _this$state$selectedG;
944
-
945
836
  isSelected = Boolean((_this$state$selectedG = this.state.selectedGroupOptionsMap[groupProps.id]) === null || _this$state$selectedG === void 0 ? void 0 : _this$state$selectedG.has(id));
946
837
  } else {
947
838
  isSelected = Boolean(option.props.selected);
948
839
  }
949
-
950
840
  optionProps['aria-checked'] = isSelected;
951
841
  optionProps.renderBeforeLabel = (0, _emotion.jsx)(_IconCheckSolid.IconCheckSolid, {
952
842
  style: {
953
843
  opacity: isSelected ? 1 : 0
954
844
  }
955
845
  });
956
- (0, _console.warn)(!renderBeforeLabel, `The prop "renderBeforeLabel" is reserved on item with id: "${id}". When this option is a selectable member of a Drilldown.Group, selection indicator will render before the label.`); // setting aria roles and attributes for selectable group items
846
+ (0, _console.warn)(!renderBeforeLabel, `The prop "renderBeforeLabel" is reserved on item with id: "${id}". When this option is a selectable member of a Drilldown.Group, selection indicator will render before the label.`);
957
847
 
848
+ // setting aria roles and attributes for selectable group items
958
849
  if (groupProps.selectableType === 'single') {
959
850
  optionProps.role = customRole || 'menuitemradio';
960
851
  }
961
-
962
852
  if (groupProps.selectableType === 'multiple') {
963
853
  optionProps.role = customRole || 'menuitemcheckbox';
964
854
  }
965
- } // display option as highlighted
966
-
967
-
855
+ }
856
+ // display option as highlighted
968
857
  if (id === this.state.highlightedOptionId) {
969
858
  optionProps.variant = 'highlighted';
970
-
971
859
  if (isOptionDisabled) {
972
860
  optionProps.variant = 'highlighted-disabled';
973
861
  }
974
862
  }
975
-
976
863
  if (href) {
977
864
  if (subPageId) {
978
865
  (0, _console.warn)(false, `Drilldown.Option with id "${id}" has subPageId, so it will ignore the "href" property.`);
@@ -982,34 +869,30 @@ let Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
982
869
  optionProps.href = href;
983
870
  }
984
871
  }
985
-
986
872
  const optionLabel = (0, _callRenderProp.callRenderProp)(children, {
987
873
  id,
988
874
  variant: optionProps.variant,
989
875
  isSelected
990
876
  });
991
-
992
877
  if (!optionLabel) {
993
878
  (0, _console.warn)(false, `There are no "children" prop provided for option with id: "${id}", so it won't be rendered.`);
994
879
  return null;
995
880
  }
996
-
997
881
  const renderLabelProps = {
998
882
  variant: optionProps.variant,
999
883
  vAlign: afterLabelContentVAlign,
1000
884
  as,
1001
885
  role: optionProps.role,
1002
886
  isSelected
1003
- }; // we need to bind our own option props the render functions
887
+ };
1004
888
 
889
+ // we need to bind our own option props the render functions
1005
890
  if (typeof optionProps.renderBeforeLabel === 'function' && !((_optionProps$renderBe = optionProps.renderBeforeLabel) !== null && _optionProps$renderBe !== void 0 && (_optionProps$renderBe2 = _optionProps$renderBe.prototype) !== null && _optionProps$renderBe2 !== void 0 && _optionProps$renderBe2.isReactComponent)) {
1006
891
  optionProps.renderBeforeLabel = optionProps.renderBeforeLabel.bind(null, renderLabelProps);
1007
892
  }
1008
-
1009
893
  if (typeof optionProps.renderAfterLabel === 'function' && !((_optionProps$renderAf = optionProps.renderAfterLabel) !== null && _optionProps$renderAf !== void 0 && (_optionProps$renderAf2 = _optionProps$renderAf.prototype) !== null && _optionProps$renderAf2 !== void 0 && _optionProps$renderAf2.isReactComponent)) {
1010
894
  optionProps.renderAfterLabel = optionProps.renderAfterLabel.bind(null, renderLabelProps);
1011
895
  }
1012
-
1013
896
  const labelInfo = renderLabelInfo && (0, _callRenderProp.callRenderProp)(renderLabelInfo, renderLabelProps);
1014
897
  const vAlignMap = {
1015
898
  start: 'flex-start',
@@ -1041,36 +924,35 @@ let Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
1041
924
  id: infoAriaId
1042
925
  }, labelInfo)) : null));
1043
926
  }
1044
-
1045
927
  renderGroup(group, getOptionProps, getDisabledOptionProps, needsFirstSeparator, needsLastSeparator) {
1046
928
  const _group$props = group.props,
1047
- id = _group$props.id,
1048
- children = _group$props.children,
1049
- renderGroupTitle = _group$props.renderGroupTitle,
1050
- themeOverride = _group$props.themeOverride,
1051
- role = _group$props.role,
1052
- as = _group$props.as,
1053
- elementRef = _group$props.elementRef;
1054
-
929
+ id = _group$props.id,
930
+ children = _group$props.children,
931
+ renderGroupTitle = _group$props.renderGroupTitle,
932
+ themeOverride = _group$props.themeOverride,
933
+ role = _group$props.role,
934
+ as = _group$props.as,
935
+ elementRef = _group$props.elementRef;
1055
936
  if (!children) {
1056
937
  return null;
1057
938
  }
939
+ const groupChildren = [];
1058
940
 
1059
- const groupChildren = []; // add a separator above
1060
-
941
+ // add a separator above
1061
942
  if (needsFirstSeparator) {
1062
943
  groupChildren.push(_Options$Separator || (_Options$Separator = (0, _emotion.jsx)(_Options.Options.Separator, null)));
1063
- } // create a sublist as a group
1064
- // (a wrapping list item will be created by Options)
1065
-
944
+ }
1066
945
 
946
+ // create a sublist as a group
947
+ // (a wrapping list item will be created by Options)
1067
948
  groupChildren.push((0, _emotion.jsx)(_Options.Options, {
1068
949
  id: id,
1069
950
  key: id,
1070
951
  role: role,
1071
952
  as: as || this.props.as,
1072
953
  renderLabel: renderGroupTitle,
1073
- elementRef: elementRef // we pass the themeOverride to Options
954
+ elementRef: elementRef
955
+ // we pass the themeOverride to Options
1074
956
  ,
1075
957
  themeOverride: themeOverride
1076
958
  }, this.getChildrenArray(children).map(child => {
@@ -1081,34 +963,31 @@ let Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
1081
963
  } else {
1082
964
  return null;
1083
965
  }
1084
- }))); // add a separator below
966
+ })));
1085
967
 
968
+ // add a separator below
1086
969
  if (needsLastSeparator) {
1087
970
  groupChildren.push(_Options$Separator2 || (_Options$Separator2 = (0, _emotion.jsx)(_Options.Options.Separator, null)));
1088
971
  }
1089
-
1090
972
  return groupChildren;
1091
973
  }
1092
-
1093
974
  renderPage() {
1094
975
  const _this$props5 = this.props,
1095
- styles = _this$props5.styles,
1096
- overflowY = _this$props5.overflowY,
1097
- overflowX = _this$props5.overflowX,
1098
- height = _this$props5.height,
1099
- width = _this$props5.width,
1100
- minHeight = _this$props5.minHeight,
1101
- minWidth = _this$props5.minWidth,
1102
- maxHeight = _this$props5.maxHeight,
1103
- maxWidth = _this$props5.maxWidth,
1104
- role = _this$props5.role,
1105
- as = _this$props5.as,
1106
- label = _this$props5.label;
1107
-
976
+ styles = _this$props5.styles,
977
+ overflowY = _this$props5.overflowY,
978
+ overflowX = _this$props5.overflowX,
979
+ height = _this$props5.height,
980
+ width = _this$props5.width,
981
+ minHeight = _this$props5.minHeight,
982
+ minWidth = _this$props5.minWidth,
983
+ maxHeight = _this$props5.maxHeight,
984
+ maxWidth = _this$props5.maxWidth,
985
+ role = _this$props5.role,
986
+ as = _this$props5.as,
987
+ label = _this$props5.label;
1108
988
  if (!this.currentPage) {
1109
989
  return null;
1110
990
  }
1111
-
1112
991
  return (0, _emotion.jsx)(_Selectable.Selectable, {
1113
992
  isShowingOptions: this.shown,
1114
993
  highlightedOptionId: this.state.highlightedOptionId,
@@ -1131,9 +1010,9 @@ let Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
1131
1010
  }
1132
1011
  }, _ref8 => {
1133
1012
  let getTriggerProps = _ref8.getTriggerProps,
1134
- getListProps = _ref8.getListProps,
1135
- getOptionProps = _ref8.getOptionProps,
1136
- getDisabledOptionProps = _ref8.getDisabledOptionProps;
1013
+ getListProps = _ref8.getListProps,
1014
+ getOptionProps = _ref8.getOptionProps,
1015
+ getDisabledOptionProps = _ref8.getDisabledOptionProps;
1137
1016
  return (0, _emotion.jsx)(_View.View, Object.assign({
1138
1017
  as: "div",
1139
1018
  elementRef: this.handleDrilldownRef,
@@ -1158,7 +1037,6 @@ let Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
1158
1037
  const target = event.currentTarget;
1159
1038
  const related = event.relatedTarget;
1160
1039
  const containsRelated = (0, _contains.contains)(target, related);
1161
-
1162
1040
  if (!related || related === this._drilldownRef || related !== target && !containsRelated) {
1163
1041
  this.setState({
1164
1042
  highlightedOptionId: void 0
@@ -1192,40 +1070,37 @@ let Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
1192
1070
  }), this.renderList(getOptionProps, getDisabledOptionProps))));
1193
1071
  });
1194
1072
  }
1195
-
1196
1073
  render() {
1197
1074
  // clear temporary option store
1198
1075
  this._activeOptionsMap = {};
1199
1076
  const _this$props6 = this.props,
1200
- show = _this$props6.show,
1201
- defaultShow = _this$props6.defaultShow,
1202
- placement = _this$props6.placement,
1203
- withArrow = _this$props6.withArrow,
1204
- shouldContainFocus = _this$props6.shouldContainFocus,
1205
- shouldReturnFocus = _this$props6.shouldReturnFocus,
1206
- trigger = _this$props6.trigger,
1207
- mountNode = _this$props6.mountNode,
1208
- constrain = _this$props6.constrain,
1209
- positionTarget = _this$props6.positionTarget,
1210
- positionContainerDisplay = _this$props6.positionContainerDisplay,
1211
- popoverRef = _this$props6.popoverRef,
1212
- disabled = _this$props6.disabled,
1213
- onDismiss = _this$props6.onDismiss,
1214
- onFocus = _this$props6.onFocus,
1215
- onMouseOver = _this$props6.onMouseOver,
1216
- offsetX = _this$props6.offsetX,
1217
- offsetY = _this$props6.offsetY;
1077
+ show = _this$props6.show,
1078
+ defaultShow = _this$props6.defaultShow,
1079
+ placement = _this$props6.placement,
1080
+ withArrow = _this$props6.withArrow,
1081
+ shouldContainFocus = _this$props6.shouldContainFocus,
1082
+ shouldReturnFocus = _this$props6.shouldReturnFocus,
1083
+ trigger = _this$props6.trigger,
1084
+ mountNode = _this$props6.mountNode,
1085
+ constrain = _this$props6.constrain,
1086
+ positionTarget = _this$props6.positionTarget,
1087
+ positionContainerDisplay = _this$props6.positionContainerDisplay,
1088
+ popoverRef = _this$props6.popoverRef,
1089
+ disabled = _this$props6.disabled,
1090
+ onDismiss = _this$props6.onDismiss,
1091
+ onFocus = _this$props6.onFocus,
1092
+ onMouseOver = _this$props6.onMouseOver,
1093
+ offsetX = _this$props6.offsetX,
1094
+ offsetY = _this$props6.offsetY;
1218
1095
  return trigger ? (0, _emotion.jsx)(_Popover.Popover, {
1219
1096
  isShowingContent: show,
1220
1097
  defaultIsShowingContent: defaultShow,
1221
1098
  shouldCloseOnDocumentClick: true,
1222
1099
  onHideContent: (event, _ref9) => {
1223
1100
  let documentClick = _ref9.documentClick;
1224
-
1225
1101
  if (typeof onDismiss === 'function') {
1226
1102
  onDismiss(event, documentClick);
1227
1103
  }
1228
-
1229
1104
  this.reset();
1230
1105
  this.handleToggle(event, false);
1231
1106
  },
@@ -1251,7 +1126,6 @@ let Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
1251
1126
  },
1252
1127
  ref: el => {
1253
1128
  this._popover = el;
1254
-
1255
1129
  if (typeof popoverRef === 'function') {
1256
1130
  popoverRef(el);
1257
1131
  }
@@ -1267,7 +1141,6 @@ let Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
1267
1141
  })
1268
1142
  }, this.renderPage()) : this.renderPage();
1269
1143
  }
1270
-
1271
1144
  }, _class2.displayName = "Drilldown", _class2.componentId = 'Drilldown', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
1272
1145
  disabled: false,
1273
1146
  rotateFocus: true,