@nebula.js/stardust 4.0.0-alpha.7 → 4.0.0-alpha.8

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/core/esm/dev.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * @nebula.js/stardust v4.0.0-alpha.7
2
+ * @nebula.js/stardust v4.0.0-alpha.8
3
3
  * Copyright (c) 2023 QlikTech International AB
4
4
  * Released under the MIT license.
5
5
  */
@@ -8064,7 +8064,7 @@ function create$3(definition) {
8064
8064
  return cache[key];
8065
8065
  }
8066
8066
 
8067
- const NEBULA_VERSION_HASH = "a704" ;
8067
+ const NEBULA_VERSION_HASH = "757e" ;
8068
8068
  ClassNameGenerator$1.configure(componentName => {
8069
8069
  return "njs-".concat(NEBULA_VERSION_HASH, "-").concat(componentName.replace('Mui', ''));
8070
8070
  });
@@ -8272,7 +8272,7 @@ function boot(_ref2) {
8272
8272
  const appRef = React__default.createRef();
8273
8273
  const element = document.createElement('div');
8274
8274
  element.style.display = 'none';
8275
- element.setAttribute('data-nebulajs-version', "4.0.0-alpha.7" );
8275
+ element.setAttribute('data-nebulajs-version', "4.0.0-alpha.8" );
8276
8276
  element.setAttribute('data-app-id', app.id);
8277
8277
  document.body.appendChild(element);
8278
8278
  const root = client.createRoot(element);
@@ -9071,21 +9071,70 @@ function fillRange(elementNbrs, elemNumbersOrdered) {
9071
9071
  return elemNumbersOrdered.slice(min, max + 1);
9072
9072
  }
9073
9073
 
9074
+ const PREFIX$c = 'RowColumn';
9075
+ const rowColClasses = {
9076
+ row: "".concat(PREFIX$c, "-row"),
9077
+ rowBorderBottom: "".concat(PREFIX$c, "-rowBorderBottom"),
9078
+ column: "".concat(PREFIX$c, "-column"),
9079
+ fieldRoot: "".concat(PREFIX$c, "-fieldRoot"),
9080
+ cell: "".concat(PREFIX$c, "-cell"),
9081
+ labelText: "".concat(PREFIX$c, "-labelText"),
9082
+ labelDense: "".concat(PREFIX$c, "-labelDense"),
9083
+ highlighted: "".concat(PREFIX$c, "-highlighted"),
9084
+ checkboxLabel: "".concat(PREFIX$c, "-checkboxLabel"),
9085
+ icon: "".concat(PREFIX$c, "-icon"),
9086
+ S: "".concat(PREFIX$c, "-S"),
9087
+ XS: "".concat(PREFIX$c, "-XS"),
9088
+ A: "".concat(PREFIX$c, "-A"),
9089
+ X: "".concat(PREFIX$c, "-X"),
9090
+ frequencyCount: "".concat(PREFIX$c, "-frequencyCount"),
9091
+ barContainer: "".concat(PREFIX$c, "-barContainer"),
9092
+ bar: "".concat(PREFIX$c, "-bar"),
9093
+ barSelected: "".concat(PREFIX$c, "-barSelected"),
9094
+ barWithCheckbox: "".concat(PREFIX$c, "-barWithCheckbox"),
9095
+ barSelectedWithCheckbox: "".concat(PREFIX$c, "-barSelectedWithCheckbox"),
9096
+ excludedTextWithCheckbox: "".concat(PREFIX$c, "-excludedTextWithCheckbox")
9097
+ };
9098
+
9099
+ /* eslint-disable no-underscore-dangle */
9100
+ const dataItemSelector = ".".concat(rowColClasses.fieldRoot);
9074
9101
  const getKeyAsToggleSelected = event => !(event !== null && event !== void 0 && event.metaKey || event !== null && event !== void 0 && event.ctrlKey);
9075
9102
  function useSelectionsInteractions(_ref) {
9103
+ var _loaderRef$current2, _loaderRef$current2$_;
9076
9104
  let {
9077
9105
  selectionState,
9078
9106
  selections,
9079
9107
  checkboxes = false,
9080
- doc = document
9108
+ doc = document,
9109
+ loaderRef
9081
9110
  } = _ref;
9082
9111
  const currentSelect = useRef({
9083
9112
  startElemNumber: undefined,
9084
9113
  elemNumbers: [],
9085
9114
  isRange: false,
9086
9115
  toggle: false,
9087
- active: false
9116
+ active: false,
9117
+ touchElemNumbers: [],
9118
+ touchRangeSmall: false
9088
9119
  });
9120
+ useEffect$1(() => {
9121
+ var _loaderRef$current, _loaderRef$current$_l;
9122
+ if (!((_loaderRef$current = loaderRef.current) !== null && _loaderRef$current !== void 0 && (_loaderRef$current$_l = _loaderRef$current._listRef) !== null && _loaderRef$current$_l !== void 0 && _loaderRef$current$_l._outerRef)) {
9123
+ return undefined;
9124
+ }
9125
+ const preventGestureStart = e => e.preventDefault();
9126
+ const preventGestureChange = e => e.preventDefault();
9127
+ const preventGestureEnd = e => e.preventDefault();
9128
+ const listRef = loaderRef.current._listRef._outerRef;
9129
+ listRef.addEventListener('gesturestart', preventGestureStart);
9130
+ listRef.addEventListener('gesturechange', preventGestureChange);
9131
+ listRef.addEventListener('gestureend', preventGestureEnd);
9132
+ return () => {
9133
+ listRef.removeEventListener('gesturestart', preventGestureStart);
9134
+ listRef.removeEventListener('gesturechange', preventGestureChange);
9135
+ listRef.removeEventListener('gestureend', preventGestureEnd);
9136
+ };
9137
+ }, [(_loaderRef$current2 = loaderRef.current) === null || _loaderRef$current2 === void 0 ? void 0 : (_loaderRef$current2$_ = _loaderRef$current2._listRef) === null || _loaderRef$current2$_ === void 0 ? void 0 : _loaderRef$current2$_._outerRef]);
9089
9138
 
9090
9139
  // eslint-disable-next-line arrow-body-style
9091
9140
  const doSelect = () => {
@@ -9097,6 +9146,10 @@ function useSelectionsInteractions(_ref) {
9097
9146
  toggle: currentSelect.current.toggle
9098
9147
  });
9099
9148
  };
9149
+ const getRange = (start, end) => {
9150
+ const elemNumbersOrdered = getElemNumbersFromPages(selectionState.enginePages);
9151
+ return fillRange([start, end], elemNumbersOrdered);
9152
+ };
9100
9153
  const addToRange = elemNumber => {
9101
9154
  const {
9102
9155
  startElemNumber
@@ -9104,9 +9157,7 @@ function useSelectionsInteractions(_ref) {
9104
9157
  if (startElemNumber === elemNumber) {
9105
9158
  return;
9106
9159
  }
9107
- const rangeEnds = [currentSelect.current.startElemNumber, elemNumber];
9108
- const elemNumbersOrdered = getElemNumbersFromPages(selectionState.enginePages);
9109
- const toMaybeAdd = fillRange(rangeEnds, elemNumbersOrdered);
9160
+ const toMaybeAdd = getRange(currentSelect.current.startElemNumber, elemNumber);
9110
9161
  selectionState.updateItems(toMaybeAdd, true, currentSelect.current.elemNumbers);
9111
9162
  };
9112
9163
  const selectManually = function () {
@@ -9202,6 +9253,48 @@ function useSelectionsInteractions(_ref) {
9202
9253
  const elemNumber = +event.currentTarget.getAttribute('data-n');
9203
9254
  addToRange(elemNumber);
9204
9255
  }, []);
9256
+ const onTouchStart = useCallback(event => {
9257
+ var _event$touches$0$targ, _event$touches$0$targ2, _event$touches$1$targ, _event$touches$1$targ2;
9258
+ // Handle range selection with two finger touch
9259
+ if (currentSelect.current.active || currentSelect.current.isRange || selectionState.isSingleSelect || event.touches.length <= 1) {
9260
+ return;
9261
+ }
9262
+ if (event.touches.length > 2) {
9263
+ doSelect();
9264
+ return;
9265
+ }
9266
+ const startTouchElemNumber = Number((_event$touches$0$targ = event.touches[0].target) === null || _event$touches$0$targ === void 0 ? void 0 : (_event$touches$0$targ2 = _event$touches$0$targ.closest(dataItemSelector)) === null || _event$touches$0$targ2 === void 0 ? void 0 : _event$touches$0$targ2.getAttribute('data-n'));
9267
+ const endTouchElemNumber = Number((_event$touches$1$targ = event.touches[1].target) === null || _event$touches$1$targ === void 0 ? void 0 : (_event$touches$1$targ2 = _event$touches$1$targ.closest(dataItemSelector)) === null || _event$touches$1$targ2 === void 0 ? void 0 : _event$touches$1$targ2.getAttribute('data-n'));
9268
+ if (Number.isNaN(startTouchElemNumber) || Number.isNaN(startTouchElemNumber)) {
9269
+ doSelect();
9270
+ return;
9271
+ }
9272
+ currentSelect.current.active = true;
9273
+ const range = getRange(startTouchElemNumber, endTouchElemNumber);
9274
+ if (range.length < 7) {
9275
+ currentSelect.current.touchRangeSmall = true;
9276
+ }
9277
+ currentSelect.current.elemNumbers = [];
9278
+ currentSelect.current.touchElemNumbers = [startTouchElemNumber, endTouchElemNumber];
9279
+ }, []);
9280
+ const onTouchEnd = useCallback(() => {
9281
+ if (currentSelect.current.touchElemNumbers.length !== 2) {
9282
+ return;
9283
+ }
9284
+ if (currentSelect.current.touchRangeSmall) {
9285
+ currentSelect.current.touchRangeSmall = false;
9286
+ currentSelect.current.touchElemNumbers = [];
9287
+ currentSelect.current.active = false;
9288
+ return;
9289
+ }
9290
+ const [startTouchElemNumber, endTouchElemNumber] = currentSelect.current.touchElemNumbers;
9291
+ currentSelect.current.startElemNumber = startTouchElemNumber;
9292
+ addToRange(endTouchElemNumber);
9293
+ currentSelect.current.touchElemNumbers = [];
9294
+ currentSelect.current.active = false;
9295
+ currentSelect.current.toggle = true;
9296
+ doSelect();
9297
+ }, []);
9205
9298
  useEffect$1(() => {
9206
9299
  doc.addEventListener('mouseup', onMouseUpDoc);
9207
9300
  return () => {
@@ -9234,7 +9327,9 @@ function useSelectionsInteractions(_ref) {
9234
9327
  Object.assign(interactionEvents, {
9235
9328
  onMouseUp,
9236
9329
  onMouseDown,
9237
- onMouseEnter
9330
+ onMouseEnter,
9331
+ onTouchStart,
9332
+ onTouchEnd
9238
9333
  });
9239
9334
  }
9240
9335
  return {
@@ -9369,15 +9464,14 @@ function useTempKeyboard(_ref) {
9369
9464
  enabled
9370
9465
  } = _ref;
9371
9466
  const [keyboardActive, setKeyboardActive] = useState$1(false);
9372
- const innerTabStops = !enabled || keyboardActive;
9373
9467
  const keyboard = {
9374
9468
  enabled,
9375
9469
  active: keyboardActive,
9376
- innerTabStops,
9377
- // does keyboard permit inner tab stops
9378
- outerTabStops: !innerTabStops,
9379
- // does keyboard permit outer tab stops
9380
- blur: resetFocus => {
9470
+ // innerTabStops: whether keyboard permits inner tab stops
9471
+ // (inner = everything inside .listbox-container)
9472
+
9473
+ innerTabStops: !enabled || keyboardActive,
9474
+ blur(resetFocus) {
9381
9475
  var _containerRef$current;
9382
9476
  if (!enabled) {
9383
9477
  return;
@@ -9392,7 +9486,7 @@ function useTempKeyboard(_ref) {
9392
9486
  vizCell.focus();
9393
9487
  }
9394
9488
  },
9395
- focus: () => {
9489
+ focus() {
9396
9490
  if (!enabled) {
9397
9491
  return;
9398
9492
  }
@@ -9405,7 +9499,7 @@ function useTempKeyboard(_ref) {
9405
9499
  elementToFocus === null || elementToFocus === void 0 ? void 0 : elementToFocus.setAttribute('tabIndex', 0);
9406
9500
  elementToFocus === null || elementToFocus === void 0 ? void 0 : elementToFocus.focus();
9407
9501
  },
9408
- focusSelection: () => {
9502
+ focusSelection() {
9409
9503
  const confirmButton = document.querySelector('.actions-toolbar-default-actions .actions-toolbar-confirm');
9410
9504
  confirmButton === null || confirmButton === void 0 ? void 0 : confirmButton.setAttribute('tabIndex', 0);
9411
9505
  confirmButton === null || confirmButton === void 0 ? void 0 : confirmButton.focus();
@@ -9414,6 +9508,7 @@ function useTempKeyboard(_ref) {
9414
9508
  return keyboard;
9415
9509
  }
9416
9510
 
9511
+ /* eslint-disable no-param-reassign */
9417
9512
  const getElementIndex = currentTarget => +currentTarget.getAttribute('data-n');
9418
9513
  const focusSearch = container => {
9419
9514
  const searchField = container === null || container === void 0 ? void 0 : container.querySelector('.search input');
@@ -9574,7 +9669,6 @@ function getListboxInlineKeyboardNavigation(_ref2) {
9574
9669
  let {
9575
9670
  keyboard,
9576
9671
  hovering,
9577
- setHovering,
9578
9672
  updateKeyScroll,
9579
9673
  containerRef,
9580
9674
  currentScrollIndex,
@@ -9609,77 +9703,40 @@ function getListboxInlineKeyboardNavigation(_ref2) {
9609
9703
  c === null || c === void 0 ? void 0 : c.focus();
9610
9704
  }
9611
9705
  };
9612
- const updateKeyScrollOnHover = newState => {
9613
- if (hovering) {
9614
- updateKeyScroll(newState);
9615
- }
9616
- };
9617
9706
  const handleKeyDown = event => {
9618
9707
  const {
9619
9708
  keyCode,
9620
- ctrlKey = false,
9621
9709
  shiftKey = false
9622
9710
  } = event.nativeEvent;
9623
9711
  const prevent = () => {
9624
9712
  event.stopPropagation();
9625
9713
  event.preventDefault();
9626
9714
  };
9627
- switch (keyCode) {
9628
- case KEYS.PAGE_UP:
9629
- updateKeyScrollOnHover({
9630
- up: currentScrollIndex.stop - currentScrollIndex.start
9631
- });
9632
- prevent();
9633
- break;
9634
- case KEYS.PAGE_DOWN:
9635
- updateKeyScrollOnHover({
9636
- down: currentScrollIndex.stop - currentScrollIndex.start
9637
- });
9638
- prevent();
9639
- break;
9640
- case KEYS.HOME:
9641
- updateKeyScrollOnHover({
9642
- scrollPosition: ctrlKey && shiftKey ? 'overflowStart' : 'start'
9643
- });
9644
- prevent();
9645
- break;
9646
- case KEYS.END:
9647
- updateKeyScrollOnHover({
9648
- scrollPosition: ctrlKey && shiftKey ? 'overflowEnd' : 'end'
9649
- });
9650
- prevent();
9651
- break;
9652
- case KEYS.ARROW_UP:
9653
- updateKeyScrollOnHover({
9654
- up: 1
9655
- });
9656
- prevent();
9657
- break;
9658
- case KEYS.ARROW_DOWN:
9659
- updateKeyScrollOnHover({
9660
- down: 1
9661
- });
9662
- prevent();
9663
- break;
9664
- }
9665
9715
  if (!keyboard.enabled) {
9666
9716
  // Other keys should not be handled unless keyboard is enabled.
9667
- return undefined;
9717
+ return;
9668
9718
  }
9669
9719
  const container = event.currentTarget.closest('.listbox-container');
9720
+ const inSelection = isModal();
9670
9721
  switch (keyCode) {
9671
9722
  case KEYS.TAB:
9672
- if (shiftKey) {
9673
- focusRow(container) || focusSearch(container);
9723
+ if (inSelection) {
9724
+ if (shiftKey) {
9725
+ focusRow(container) || focusSearch(container);
9726
+ } else {
9727
+ focusSearch(container) || focusRow(container);
9728
+ }
9729
+ } else if (shiftKey) {
9730
+ keyboard.blur(true);
9674
9731
  } else {
9675
- focusSearch(container) || focusRow(container);
9732
+ break;
9676
9733
  }
9677
9734
  prevent();
9678
9735
  break;
9679
9736
  case KEYS.ENTER:
9680
9737
  case KEYS.SPACE:
9681
9738
  if (!event.target.classList.contains('listbox-container')) {
9682
- return undefined; // don't mess with keydown handlers within the listbox (e.g. row seletion)
9739
+ break; // don't mess with keydown handlers within the listbox (e.g. row seletion)
9683
9740
  }
9684
9741
 
9685
9742
  keyboard.focus();
@@ -9687,13 +9744,53 @@ function getListboxInlineKeyboardNavigation(_ref2) {
9687
9744
  break;
9688
9745
  case KEYS.ESCAPE:
9689
9746
  blur(event);
9690
- prevent();
9691
9747
  break;
9692
- case KEYS.ARROW_LEFT:
9693
- case KEYS.ARROW_RIGHT:
9694
- return undefined;
9695
9748
  }
9696
- return undefined;
9749
+ };
9750
+ const globalKeyDown = event => {
9751
+ if (!hovering.current) {
9752
+ return;
9753
+ }
9754
+ const {
9755
+ keyCode,
9756
+ ctrlKey = false,
9757
+ shiftKey = false
9758
+ } = event;
9759
+ switch (keyCode) {
9760
+ case KEYS.ARROW_UP:
9761
+ updateKeyScroll({
9762
+ up: 1
9763
+ });
9764
+ break;
9765
+ case KEYS.ARROW_DOWN:
9766
+ updateKeyScroll({
9767
+ down: 1
9768
+ });
9769
+ break;
9770
+ case KEYS.PAGE_UP:
9771
+ updateKeyScroll({
9772
+ up: currentScrollIndex.stop - currentScrollIndex.start
9773
+ });
9774
+ break;
9775
+ case KEYS.PAGE_DOWN:
9776
+ updateKeyScroll({
9777
+ down: currentScrollIndex.stop - currentScrollIndex.start
9778
+ });
9779
+ break;
9780
+ case KEYS.HOME:
9781
+ updateKeyScroll({
9782
+ scrollPosition: ctrlKey && shiftKey ? 'overflowStart' : 'start'
9783
+ });
9784
+ break;
9785
+ case KEYS.END:
9786
+ updateKeyScroll({
9787
+ scrollPosition: ctrlKey && shiftKey ? 'overflowEnd' : 'end'
9788
+ });
9789
+ break;
9790
+ default:
9791
+ return;
9792
+ }
9793
+ event.preventDefault();
9697
9794
  };
9698
9795
  const focusOnHoverDisabled = () => {
9699
9796
  const selectNotAllowed = (constraints === null || constraints === void 0 ? void 0 : constraints.select) || (constraints === null || constraints === void 0 ? void 0 : constraints.active);
@@ -9702,50 +9799,22 @@ function getListboxInlineKeyboardNavigation(_ref2) {
9702
9799
  };
9703
9800
  const handleOnMouseEnter = () => {
9704
9801
  if (!focusOnHoverDisabled()) {
9705
- var _containerRef$current, _containerRef$current2;
9706
- setHovering(true);
9707
- containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : (_containerRef$current2 = _containerRef$current.focus) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.call(_containerRef$current);
9802
+ hovering.current = true;
9708
9803
  }
9709
9804
  };
9710
9805
  const handleOnMouseLeave = () => {
9711
- if (hovering) {
9712
- var _containerRef$current3, _containerRef$current4;
9713
- setHovering(false);
9714
- containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current3 = containerRef.current) === null || _containerRef$current3 === void 0 ? void 0 : (_containerRef$current4 = _containerRef$current3.blur) === null || _containerRef$current4 === void 0 ? void 0 : _containerRef$current4.call(_containerRef$current3);
9806
+ if (hovering.current) {
9807
+ hovering.current = false;
9715
9808
  }
9716
9809
  };
9717
9810
  return {
9718
9811
  handleKeyDown,
9719
9812
  handleOnMouseEnter,
9720
- handleOnMouseLeave
9813
+ handleOnMouseLeave,
9814
+ globalKeyDown
9721
9815
  };
9722
9816
  }
9723
9817
 
9724
- const PREFIX$c = 'RowColumn';
9725
- const rowColClasses = {
9726
- row: "".concat(PREFIX$c, "-row"),
9727
- rowBorderBottom: "".concat(PREFIX$c, "-rowBorderBottom"),
9728
- column: "".concat(PREFIX$c, "-column"),
9729
- fieldRoot: "".concat(PREFIX$c, "-fieldRoot"),
9730
- cell: "".concat(PREFIX$c, "-cell"),
9731
- labelText: "".concat(PREFIX$c, "-labelText"),
9732
- labelDense: "".concat(PREFIX$c, "-labelDense"),
9733
- highlighted: "".concat(PREFIX$c, "-highlighted"),
9734
- checkboxLabel: "".concat(PREFIX$c, "-checkboxLabel"),
9735
- icon: "".concat(PREFIX$c, "-icon"),
9736
- S: "".concat(PREFIX$c, "-S"),
9737
- XS: "".concat(PREFIX$c, "-XS"),
9738
- A: "".concat(PREFIX$c, "-A"),
9739
- X: "".concat(PREFIX$c, "-X"),
9740
- frequencyCount: "".concat(PREFIX$c, "-frequencyCount"),
9741
- barContainer: "".concat(PREFIX$c, "-barContainer"),
9742
- bar: "".concat(PREFIX$c, "-bar"),
9743
- barSelected: "".concat(PREFIX$c, "-barSelected"),
9744
- barWithCheckbox: "".concat(PREFIX$c, "-barWithCheckbox"),
9745
- barSelectedWithCheckbox: "".concat(PREFIX$c, "-barSelectedWithCheckbox"),
9746
- excludedTextWithCheckbox: "".concat(PREFIX$c, "-excludedTextWithCheckbox")
9747
- };
9748
-
9749
9818
  const isExcluded = c => c ? c.qState === 'X' || c.qState === 'XS' || c.qState === 'XL' : null;
9750
9819
  const isAlternative = c => c ? c.qState === 'A' : null;
9751
9820
  const excludedOrAlternative = _ref => {
@@ -10562,6 +10631,8 @@ function RowColumn(_ref) {
10562
10631
  onMouseDown,
10563
10632
  onMouseUp,
10564
10633
  onMouseEnter,
10634
+ onTouchStart,
10635
+ onTouchEnd,
10565
10636
  pages,
10566
10637
  isLocked,
10567
10638
  column = false,
@@ -10743,6 +10814,8 @@ function RowColumn(_ref) {
10743
10814
  onMouseUp: onMouseUp,
10744
10815
  onMouseEnter: onMouseEnter,
10745
10816
  onKeyDown: handleKeyDownCallback,
10817
+ onTouchStart: onTouchStart,
10818
+ onTouchEnd: onTouchEnd,
10746
10819
  onContextMenu: preventContextMenu,
10747
10820
  tabIndex: isFirstElement && keyboard.innerTabStops ? 0 : -1,
10748
10821
  "data-n": cell === null || cell === void 0 ? void 0 : cell.qElemNumber
@@ -13380,7 +13453,8 @@ function ListBox(_ref) {
13380
13453
  selectionState,
13381
13454
  selections,
13382
13455
  checkboxes,
13383
- doc: document
13456
+ doc: document,
13457
+ loaderRef
13384
13458
  });
13385
13459
  const {
13386
13460
  layoutOptions = {}
@@ -16322,6 +16396,7 @@ const addListboxTheme = themeApi => {
16322
16396
  };
16323
16397
  };
16324
16398
 
16399
+ /* eslint-disable no-nested-ternary */
16325
16400
  function showToolbarDetached(_ref) {
16326
16401
  var _containerRef$current, _containerRef$current2, _titleRef$current$cli, _titleRef$current, _titleRef$current2, _titleRef$current3;
16327
16402
  let {
@@ -16335,12 +16410,17 @@ function showToolbarDetached(_ref) {
16335
16410
  const actionToolbarWidth = 128;
16336
16411
  const notSufficientSpace = containerWidth < contentWidth + actionToolbarWidth;
16337
16412
  const isTruncated = (titleRef === null || titleRef === void 0 ? void 0 : (_titleRef$current2 = titleRef.current) === null || _titleRef$current2 === void 0 ? void 0 : _titleRef$current2.scrollWidth) > (titleRef === null || titleRef === void 0 ? void 0 : (_titleRef$current3 = titleRef.current) === null || _titleRef$current3 === void 0 ? void 0 : _titleRef$current3.offsetWidth);
16338
- return !!(notSufficientSpace | isTruncated);
16413
+ const isDetached = !!(notSufficientSpace | isTruncated);
16414
+ const reasonDetached = isDetached ? notSufficientSpace ? 'noSpace' : 'truncated' : '';
16415
+ return {
16416
+ isDetached,
16417
+ reasonDetached
16418
+ };
16339
16419
  }
16340
16420
 
16341
16421
  function getListboxActionProps(_ref) {
16342
16422
  let {
16343
- isPopover,
16423
+ isDetached,
16344
16424
  showToolbar,
16345
16425
  containerRef,
16346
16426
  isLocked,
@@ -16348,9 +16428,9 @@ function getListboxActionProps(_ref) {
16348
16428
  selections
16349
16429
  } = _ref;
16350
16430
  return {
16351
- show: showToolbar && !isPopover,
16431
+ show: showToolbar && !isDetached,
16352
16432
  popover: {
16353
- show: showToolbar && isPopover,
16433
+ show: showToolbar && isDetached,
16354
16434
  anchorEl: containerRef.current
16355
16435
  },
16356
16436
  more: {
@@ -16421,7 +16501,7 @@ const StyledGrid$3 = styled$1(Grid, {
16421
16501
  ["& .".concat(classes$4.listboxWrapper)]: {
16422
16502
  padding: containerPadding
16423
16503
  },
16424
- '&:focus:not(:hover)': {
16504
+ '&:focus': {
16425
16505
  boxShadow: "inset 0 0 0 2px ".concat(theme.palette.custom.focusBorder, " !important")
16426
16506
  },
16427
16507
  '&:focus-visible': {
@@ -16473,7 +16553,8 @@ function ListBoxInline(_ref4) {
16473
16553
  showGray = true,
16474
16554
  scrollState = undefined,
16475
16555
  renderedCallback,
16476
- toolbar = true
16556
+ toolbar = true,
16557
+ isPopover = false
16477
16558
  } = options;
16478
16559
 
16479
16560
  // Hook that will trigger update when used in useEffects.
@@ -16502,7 +16583,7 @@ function ListBoxInline(_ref4) {
16502
16583
  const [searchContainer, searchContainerRef] = useRefWithCallback();
16503
16584
  const [showToolbar, setShowToolbar] = useState$1(false);
16504
16585
  const [showSearch, setShowSearch] = useState$1(false);
16505
- const [hovering, setHovering] = useState$1(false);
16586
+ const hovering = useRef(false);
16506
16587
  const [keyScroll, setKeyScroll] = useState$1({
16507
16588
  down: 0,
16508
16589
  up: 0,
@@ -16529,11 +16610,11 @@ function ListBoxInline(_ref4) {
16529
16610
  const {
16530
16611
  handleKeyDown,
16531
16612
  handleOnMouseEnter,
16532
- handleOnMouseLeave
16533
- } = getListboxInlineKeyboardNavigation({
16613
+ handleOnMouseLeave,
16614
+ globalKeyDown
16615
+ } = useMemo$1(() => getListboxInlineKeyboardNavigation({
16534
16616
  keyboard,
16535
16617
  hovering,
16536
- setHovering,
16537
16618
  updateKeyScroll,
16538
16619
  containerRef,
16539
16620
  currentScrollIndex,
@@ -16541,9 +16622,15 @@ function ListBoxInline(_ref4) {
16541
16622
  appSelections,
16542
16623
  constraints,
16543
16624
  isModal: isModalMode
16544
- });
16545
- const showDetachedToolbarOnly = toolbar && ((layout === null || layout === void 0 ? void 0 : layout.title) === '' || (layout === null || layout === void 0 ? void 0 : layout.showTitle) === false);
16546
- const showToolbarWithTitle = toolbar && (layout === null || layout === void 0 ? void 0 : layout.title) !== '' && (layout === null || layout === void 0 ? void 0 : layout.showTitle) !== false;
16625
+ }), [keyboard, hovering, updateKeyScroll, containerRef, currentScrollIndex, app, appSelections, constraints, isModalMode]);
16626
+ const showDetachedToolbarOnly = toolbar && ((layout === null || layout === void 0 ? void 0 : layout.title) === '' || (layout === null || layout === void 0 ? void 0 : layout.showTitle) === false) && !isPopover;
16627
+ const showToolbarWithTitle = toolbar && (layout === null || layout === void 0 ? void 0 : layout.title) !== '' && (layout === null || layout === void 0 ? void 0 : layout.showTitle) !== false || isPopover;
16628
+ useEffect$1(() => {
16629
+ document.addEventListener('keydown', globalKeyDown);
16630
+ return () => {
16631
+ document.removeEventListener('keydown', globalKeyDown);
16632
+ };
16633
+ }, [globalKeyDown]);
16547
16634
  useEffect$1(() => {
16548
16635
  const show = () => {
16549
16636
  setShowToolbar(true);
@@ -16554,6 +16641,14 @@ function ListBoxInline(_ref4) {
16554
16641
  setShowSearch(false);
16555
16642
  }
16556
16643
  };
16644
+ if (isPopover) {
16645
+ if (!selections.isActive()) {
16646
+ selections.begin('/qListObjectDef');
16647
+ selections.on('activated', show);
16648
+ selections.on('deactivated', hide);
16649
+ }
16650
+ setShowToolbar(isPopover);
16651
+ }
16557
16652
  if (selections) {
16558
16653
  if (!selections.isModal()) {
16559
16654
  selections.on('activated', show);
@@ -16567,7 +16662,7 @@ function ListBoxInline(_ref4) {
16567
16662
  selections.removeListener('deactivated', hide);
16568
16663
  }
16569
16664
  };
16570
- }, [selections]);
16665
+ }, [selections, isPopover]);
16571
16666
  useEffect$1(() => {
16572
16667
  if (!searchContainer || !searchContainer.current) {
16573
16668
  return;
@@ -16615,8 +16710,8 @@ function ListBoxInline(_ref4) {
16615
16710
  input === null || input === void 0 ? void 0 : input.focus();
16616
16711
  }
16617
16712
  };
16618
- const getActionToolbarProps = isPopover => getListboxActionProps({
16619
- isPopover,
16713
+ const getActionToolbarProps = isDetached => getListboxActionProps({
16714
+ isDetached: isPopover ? false : isDetached,
16620
16715
  showToolbar,
16621
16716
  containerRef,
16622
16717
  isLocked,
@@ -16630,6 +16725,14 @@ function ListBoxInline(_ref4) {
16630
16725
  const iconsWidth = (showSearchOrLockIcon ? BUTTON_ICON_WIDTH : 0) + (isDrillDown ? ICON_WIDTH + ICON_PADDING : 0); // Drill-down icon needs padding right so there is space between the icon and the title
16631
16726
  const headerPaddingLeft = CELL_PADDING_LEFT - (showSearchOrLockIcon ? ICON_PADDING : 0);
16632
16727
  const headerPaddingRight = isRtl ? CELL_PADDING_LEFT - (showIcons ? ICON_PADDING : 0) : 0;
16728
+ const {
16729
+ isDetached,
16730
+ reasonDetached
16731
+ } = showToolbarDetached({
16732
+ containerRef,
16733
+ titleRef,
16734
+ iconsWidth
16735
+ });
16633
16736
 
16634
16737
  // Add a container padding for grid mode to harmonize with the grid item margins (should sum to 8px).
16635
16738
  const isGridMode = (layoutOptions === null || layoutOptions === void 0 ? void 0 : layoutOptions.dataLayout) === 'grid';
@@ -16678,7 +16781,7 @@ function ListBoxInline(_ref4) {
16678
16781
  }, getActionToolbarProps(true))), /*#__PURE__*/React__default.createElement(StyledGrid$3, {
16679
16782
  className: "listbox-container",
16680
16783
  container: true,
16681
- tabIndex: keyboard.outerTabStops ? 0 : -1,
16784
+ tabIndex: keyboard.enabled ? -1 : undefined,
16682
16785
  direction: "column",
16683
16786
  gap: 0,
16684
16787
  containerPadding: containerPadding,
@@ -16734,6 +16837,9 @@ function ListBoxInline(_ref4) {
16734
16837
  className: classes$4.listBoxHeader
16735
16838
  }, /*#__PURE__*/React__default.createElement(Title, {
16736
16839
  variant: "h6",
16840
+ sx: {
16841
+ width: isPopover && reasonDetached === 'noSpace' ? '60px' : undefined
16842
+ },
16737
16843
  noWrap: true,
16738
16844
  ref: titleRef,
16739
16845
  title: layout.title
@@ -16744,11 +16850,7 @@ function ListBoxInline(_ref4) {
16744
16850
  item: true
16745
16851
  }, /*#__PURE__*/React__default.createElement(ActionsToolbar, _extends$6({
16746
16852
  direction: direction
16747
- }, getActionToolbarProps(showToolbarDetached({
16748
- containerRef,
16749
- titleRef,
16750
- iconsWidth
16751
- })))))), /*#__PURE__*/React__default.createElement(Grid, {
16853
+ }, getActionToolbarProps(isDetached))))), /*#__PURE__*/React__default.createElement(Grid, {
16752
16854
  item: true,
16753
16855
  container: true,
16754
16856
  direction: "column",