@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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "module": "esm/index.js",
3
3
  "peerDependencies": {
4
- "@mui/material": "^5.11.11",
4
+ "@mui/material": "^5.11.15",
5
5
  "@mui/icons-material": "^5.11.11",
6
6
  "@emotion/react": "^11.10.6",
7
7
  "@emotion/styled": "^11.10.6",
@@ -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
  */
@@ -15420,7 +15420,7 @@
15420
15420
  return cache[key];
15421
15421
  }
15422
15422
 
15423
- const NEBULA_VERSION_HASH = "a704" ;
15423
+ const NEBULA_VERSION_HASH = "757e" ;
15424
15424
  ClassNameGenerator$1.configure(componentName => {
15425
15425
  return "njs-".concat(NEBULA_VERSION_HASH, "-").concat(componentName.replace('Mui', ''));
15426
15426
  });
@@ -15628,7 +15628,7 @@
15628
15628
  const appRef = React.createRef();
15629
15629
  const element = document.createElement('div');
15630
15630
  element.style.display = 'none';
15631
- element.setAttribute('data-nebulajs-version', "4.0.0-alpha.7" );
15631
+ element.setAttribute('data-nebulajs-version', "4.0.0-alpha.8" );
15632
15632
  element.setAttribute('data-app-id', app.id);
15633
15633
  document.body.appendChild(element);
15634
15634
  const root = client.createRoot(element);
@@ -21702,21 +21702,70 @@
21702
21702
  return elemNumbersOrdered.slice(min, max + 1);
21703
21703
  }
21704
21704
 
21705
+ const PREFIX$c = 'RowColumn';
21706
+ const rowColClasses = {
21707
+ row: "".concat(PREFIX$c, "-row"),
21708
+ rowBorderBottom: "".concat(PREFIX$c, "-rowBorderBottom"),
21709
+ column: "".concat(PREFIX$c, "-column"),
21710
+ fieldRoot: "".concat(PREFIX$c, "-fieldRoot"),
21711
+ cell: "".concat(PREFIX$c, "-cell"),
21712
+ labelText: "".concat(PREFIX$c, "-labelText"),
21713
+ labelDense: "".concat(PREFIX$c, "-labelDense"),
21714
+ highlighted: "".concat(PREFIX$c, "-highlighted"),
21715
+ checkboxLabel: "".concat(PREFIX$c, "-checkboxLabel"),
21716
+ icon: "".concat(PREFIX$c, "-icon"),
21717
+ S: "".concat(PREFIX$c, "-S"),
21718
+ XS: "".concat(PREFIX$c, "-XS"),
21719
+ A: "".concat(PREFIX$c, "-A"),
21720
+ X: "".concat(PREFIX$c, "-X"),
21721
+ frequencyCount: "".concat(PREFIX$c, "-frequencyCount"),
21722
+ barContainer: "".concat(PREFIX$c, "-barContainer"),
21723
+ bar: "".concat(PREFIX$c, "-bar"),
21724
+ barSelected: "".concat(PREFIX$c, "-barSelected"),
21725
+ barWithCheckbox: "".concat(PREFIX$c, "-barWithCheckbox"),
21726
+ barSelectedWithCheckbox: "".concat(PREFIX$c, "-barSelectedWithCheckbox"),
21727
+ excludedTextWithCheckbox: "".concat(PREFIX$c, "-excludedTextWithCheckbox")
21728
+ };
21729
+
21730
+ /* eslint-disable no-underscore-dangle */
21731
+ const dataItemSelector = ".".concat(rowColClasses.fieldRoot);
21705
21732
  const getKeyAsToggleSelected = event => !(event !== null && event !== void 0 && event.metaKey || event !== null && event !== void 0 && event.ctrlKey);
21706
21733
  function useSelectionsInteractions(_ref) {
21734
+ var _loaderRef$current2, _loaderRef$current2$_;
21707
21735
  let {
21708
21736
  selectionState,
21709
21737
  selections,
21710
21738
  checkboxes = false,
21711
- doc = document
21739
+ doc = document,
21740
+ loaderRef
21712
21741
  } = _ref;
21713
21742
  const currentSelect = reactExports.useRef({
21714
21743
  startElemNumber: undefined,
21715
21744
  elemNumbers: [],
21716
21745
  isRange: false,
21717
21746
  toggle: false,
21718
- active: false
21747
+ active: false,
21748
+ touchElemNumbers: [],
21749
+ touchRangeSmall: false
21719
21750
  });
21751
+ reactExports.useEffect(() => {
21752
+ var _loaderRef$current, _loaderRef$current$_l;
21753
+ 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)) {
21754
+ return undefined;
21755
+ }
21756
+ const preventGestureStart = e => e.preventDefault();
21757
+ const preventGestureChange = e => e.preventDefault();
21758
+ const preventGestureEnd = e => e.preventDefault();
21759
+ const listRef = loaderRef.current._listRef._outerRef;
21760
+ listRef.addEventListener('gesturestart', preventGestureStart);
21761
+ listRef.addEventListener('gesturechange', preventGestureChange);
21762
+ listRef.addEventListener('gestureend', preventGestureEnd);
21763
+ return () => {
21764
+ listRef.removeEventListener('gesturestart', preventGestureStart);
21765
+ listRef.removeEventListener('gesturechange', preventGestureChange);
21766
+ listRef.removeEventListener('gestureend', preventGestureEnd);
21767
+ };
21768
+ }, [(_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]);
21720
21769
 
21721
21770
  // eslint-disable-next-line arrow-body-style
21722
21771
  const doSelect = () => {
@@ -21728,6 +21777,10 @@
21728
21777
  toggle: currentSelect.current.toggle
21729
21778
  });
21730
21779
  };
21780
+ const getRange = (start, end) => {
21781
+ const elemNumbersOrdered = getElemNumbersFromPages(selectionState.enginePages);
21782
+ return fillRange([start, end], elemNumbersOrdered);
21783
+ };
21731
21784
  const addToRange = elemNumber => {
21732
21785
  const {
21733
21786
  startElemNumber
@@ -21735,9 +21788,7 @@
21735
21788
  if (startElemNumber === elemNumber) {
21736
21789
  return;
21737
21790
  }
21738
- const rangeEnds = [currentSelect.current.startElemNumber, elemNumber];
21739
- const elemNumbersOrdered = getElemNumbersFromPages(selectionState.enginePages);
21740
- const toMaybeAdd = fillRange(rangeEnds, elemNumbersOrdered);
21791
+ const toMaybeAdd = getRange(currentSelect.current.startElemNumber, elemNumber);
21741
21792
  selectionState.updateItems(toMaybeAdd, true, currentSelect.current.elemNumbers);
21742
21793
  };
21743
21794
  const selectManually = function () {
@@ -21833,6 +21884,48 @@
21833
21884
  const elemNumber = +event.currentTarget.getAttribute('data-n');
21834
21885
  addToRange(elemNumber);
21835
21886
  }, []);
21887
+ const onTouchStart = reactExports.useCallback(event => {
21888
+ var _event$touches$0$targ, _event$touches$0$targ2, _event$touches$1$targ, _event$touches$1$targ2;
21889
+ // Handle range selection with two finger touch
21890
+ if (currentSelect.current.active || currentSelect.current.isRange || selectionState.isSingleSelect || event.touches.length <= 1) {
21891
+ return;
21892
+ }
21893
+ if (event.touches.length > 2) {
21894
+ doSelect();
21895
+ return;
21896
+ }
21897
+ 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'));
21898
+ 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'));
21899
+ if (Number.isNaN(startTouchElemNumber) || Number.isNaN(startTouchElemNumber)) {
21900
+ doSelect();
21901
+ return;
21902
+ }
21903
+ currentSelect.current.active = true;
21904
+ const range = getRange(startTouchElemNumber, endTouchElemNumber);
21905
+ if (range.length < 7) {
21906
+ currentSelect.current.touchRangeSmall = true;
21907
+ }
21908
+ currentSelect.current.elemNumbers = [];
21909
+ currentSelect.current.touchElemNumbers = [startTouchElemNumber, endTouchElemNumber];
21910
+ }, []);
21911
+ const onTouchEnd = reactExports.useCallback(() => {
21912
+ if (currentSelect.current.touchElemNumbers.length !== 2) {
21913
+ return;
21914
+ }
21915
+ if (currentSelect.current.touchRangeSmall) {
21916
+ currentSelect.current.touchRangeSmall = false;
21917
+ currentSelect.current.touchElemNumbers = [];
21918
+ currentSelect.current.active = false;
21919
+ return;
21920
+ }
21921
+ const [startTouchElemNumber, endTouchElemNumber] = currentSelect.current.touchElemNumbers;
21922
+ currentSelect.current.startElemNumber = startTouchElemNumber;
21923
+ addToRange(endTouchElemNumber);
21924
+ currentSelect.current.touchElemNumbers = [];
21925
+ currentSelect.current.active = false;
21926
+ currentSelect.current.toggle = true;
21927
+ doSelect();
21928
+ }, []);
21836
21929
  reactExports.useEffect(() => {
21837
21930
  doc.addEventListener('mouseup', onMouseUpDoc);
21838
21931
  return () => {
@@ -21865,7 +21958,9 @@
21865
21958
  Object.assign(interactionEvents, {
21866
21959
  onMouseUp,
21867
21960
  onMouseDown,
21868
- onMouseEnter
21961
+ onMouseEnter,
21962
+ onTouchStart,
21963
+ onTouchEnd
21869
21964
  });
21870
21965
  }
21871
21966
  return {
@@ -22000,15 +22095,14 @@
22000
22095
  enabled
22001
22096
  } = _ref;
22002
22097
  const [keyboardActive, setKeyboardActive] = reactExports.useState(false);
22003
- const innerTabStops = !enabled || keyboardActive;
22004
22098
  const keyboard = {
22005
22099
  enabled,
22006
22100
  active: keyboardActive,
22007
- innerTabStops,
22008
- // does keyboard permit inner tab stops
22009
- outerTabStops: !innerTabStops,
22010
- // does keyboard permit outer tab stops
22011
- blur: resetFocus => {
22101
+ // innerTabStops: whether keyboard permits inner tab stops
22102
+ // (inner = everything inside .listbox-container)
22103
+
22104
+ innerTabStops: !enabled || keyboardActive,
22105
+ blur(resetFocus) {
22012
22106
  var _containerRef$current;
22013
22107
  if (!enabled) {
22014
22108
  return;
@@ -22023,7 +22117,7 @@
22023
22117
  vizCell.focus();
22024
22118
  }
22025
22119
  },
22026
- focus: () => {
22120
+ focus() {
22027
22121
  if (!enabled) {
22028
22122
  return;
22029
22123
  }
@@ -22036,7 +22130,7 @@
22036
22130
  elementToFocus === null || elementToFocus === void 0 ? void 0 : elementToFocus.setAttribute('tabIndex', 0);
22037
22131
  elementToFocus === null || elementToFocus === void 0 ? void 0 : elementToFocus.focus();
22038
22132
  },
22039
- focusSelection: () => {
22133
+ focusSelection() {
22040
22134
  const confirmButton = document.querySelector('.actions-toolbar-default-actions .actions-toolbar-confirm');
22041
22135
  confirmButton === null || confirmButton === void 0 ? void 0 : confirmButton.setAttribute('tabIndex', 0);
22042
22136
  confirmButton === null || confirmButton === void 0 ? void 0 : confirmButton.focus();
@@ -22045,6 +22139,7 @@
22045
22139
  return keyboard;
22046
22140
  }
22047
22141
 
22142
+ /* eslint-disable no-param-reassign */
22048
22143
  const getElementIndex = currentTarget => +currentTarget.getAttribute('data-n');
22049
22144
  const focusSearch = container => {
22050
22145
  const searchField = container === null || container === void 0 ? void 0 : container.querySelector('.search input');
@@ -22205,7 +22300,6 @@
22205
22300
  let {
22206
22301
  keyboard,
22207
22302
  hovering,
22208
- setHovering,
22209
22303
  updateKeyScroll,
22210
22304
  containerRef,
22211
22305
  currentScrollIndex,
@@ -22240,77 +22334,40 @@
22240
22334
  c === null || c === void 0 ? void 0 : c.focus();
22241
22335
  }
22242
22336
  };
22243
- const updateKeyScrollOnHover = newState => {
22244
- if (hovering) {
22245
- updateKeyScroll(newState);
22246
- }
22247
- };
22248
22337
  const handleKeyDown = event => {
22249
22338
  const {
22250
22339
  keyCode,
22251
- ctrlKey = false,
22252
22340
  shiftKey = false
22253
22341
  } = event.nativeEvent;
22254
22342
  const prevent = () => {
22255
22343
  event.stopPropagation();
22256
22344
  event.preventDefault();
22257
22345
  };
22258
- switch (keyCode) {
22259
- case KEYS.PAGE_UP:
22260
- updateKeyScrollOnHover({
22261
- up: currentScrollIndex.stop - currentScrollIndex.start
22262
- });
22263
- prevent();
22264
- break;
22265
- case KEYS.PAGE_DOWN:
22266
- updateKeyScrollOnHover({
22267
- down: currentScrollIndex.stop - currentScrollIndex.start
22268
- });
22269
- prevent();
22270
- break;
22271
- case KEYS.HOME:
22272
- updateKeyScrollOnHover({
22273
- scrollPosition: ctrlKey && shiftKey ? 'overflowStart' : 'start'
22274
- });
22275
- prevent();
22276
- break;
22277
- case KEYS.END:
22278
- updateKeyScrollOnHover({
22279
- scrollPosition: ctrlKey && shiftKey ? 'overflowEnd' : 'end'
22280
- });
22281
- prevent();
22282
- break;
22283
- case KEYS.ARROW_UP:
22284
- updateKeyScrollOnHover({
22285
- up: 1
22286
- });
22287
- prevent();
22288
- break;
22289
- case KEYS.ARROW_DOWN:
22290
- updateKeyScrollOnHover({
22291
- down: 1
22292
- });
22293
- prevent();
22294
- break;
22295
- }
22296
22346
  if (!keyboard.enabled) {
22297
22347
  // Other keys should not be handled unless keyboard is enabled.
22298
- return undefined;
22348
+ return;
22299
22349
  }
22300
22350
  const container = event.currentTarget.closest('.listbox-container');
22351
+ const inSelection = isModal();
22301
22352
  switch (keyCode) {
22302
22353
  case KEYS.TAB:
22303
- if (shiftKey) {
22304
- focusRow(container) || focusSearch(container);
22354
+ if (inSelection) {
22355
+ if (shiftKey) {
22356
+ focusRow(container) || focusSearch(container);
22357
+ } else {
22358
+ focusSearch(container) || focusRow(container);
22359
+ }
22360
+ } else if (shiftKey) {
22361
+ keyboard.blur(true);
22305
22362
  } else {
22306
- focusSearch(container) || focusRow(container);
22363
+ break;
22307
22364
  }
22308
22365
  prevent();
22309
22366
  break;
22310
22367
  case KEYS.ENTER:
22311
22368
  case KEYS.SPACE:
22312
22369
  if (!event.target.classList.contains('listbox-container')) {
22313
- return undefined; // don't mess with keydown handlers within the listbox (e.g. row seletion)
22370
+ break; // don't mess with keydown handlers within the listbox (e.g. row seletion)
22314
22371
  }
22315
22372
 
22316
22373
  keyboard.focus();
@@ -22318,13 +22375,53 @@
22318
22375
  break;
22319
22376
  case KEYS.ESCAPE:
22320
22377
  blur(event);
22321
- prevent();
22322
22378
  break;
22323
- case KEYS.ARROW_LEFT:
22324
- case KEYS.ARROW_RIGHT:
22325
- return undefined;
22326
22379
  }
22327
- return undefined;
22380
+ };
22381
+ const globalKeyDown = event => {
22382
+ if (!hovering.current) {
22383
+ return;
22384
+ }
22385
+ const {
22386
+ keyCode,
22387
+ ctrlKey = false,
22388
+ shiftKey = false
22389
+ } = event;
22390
+ switch (keyCode) {
22391
+ case KEYS.ARROW_UP:
22392
+ updateKeyScroll({
22393
+ up: 1
22394
+ });
22395
+ break;
22396
+ case KEYS.ARROW_DOWN:
22397
+ updateKeyScroll({
22398
+ down: 1
22399
+ });
22400
+ break;
22401
+ case KEYS.PAGE_UP:
22402
+ updateKeyScroll({
22403
+ up: currentScrollIndex.stop - currentScrollIndex.start
22404
+ });
22405
+ break;
22406
+ case KEYS.PAGE_DOWN:
22407
+ updateKeyScroll({
22408
+ down: currentScrollIndex.stop - currentScrollIndex.start
22409
+ });
22410
+ break;
22411
+ case KEYS.HOME:
22412
+ updateKeyScroll({
22413
+ scrollPosition: ctrlKey && shiftKey ? 'overflowStart' : 'start'
22414
+ });
22415
+ break;
22416
+ case KEYS.END:
22417
+ updateKeyScroll({
22418
+ scrollPosition: ctrlKey && shiftKey ? 'overflowEnd' : 'end'
22419
+ });
22420
+ break;
22421
+ default:
22422
+ return;
22423
+ }
22424
+ event.preventDefault();
22328
22425
  };
22329
22426
  const focusOnHoverDisabled = () => {
22330
22427
  const selectNotAllowed = (constraints === null || constraints === void 0 ? void 0 : constraints.select) || (constraints === null || constraints === void 0 ? void 0 : constraints.active);
@@ -22333,50 +22430,22 @@
22333
22430
  };
22334
22431
  const handleOnMouseEnter = () => {
22335
22432
  if (!focusOnHoverDisabled()) {
22336
- var _containerRef$current, _containerRef$current2;
22337
- setHovering(true);
22338
- 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);
22433
+ hovering.current = true;
22339
22434
  }
22340
22435
  };
22341
22436
  const handleOnMouseLeave = () => {
22342
- if (hovering) {
22343
- var _containerRef$current3, _containerRef$current4;
22344
- setHovering(false);
22345
- 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);
22437
+ if (hovering.current) {
22438
+ hovering.current = false;
22346
22439
  }
22347
22440
  };
22348
22441
  return {
22349
22442
  handleKeyDown,
22350
22443
  handleOnMouseEnter,
22351
- handleOnMouseLeave
22444
+ handleOnMouseLeave,
22445
+ globalKeyDown
22352
22446
  };
22353
22447
  }
22354
22448
 
22355
- const PREFIX$c = 'RowColumn';
22356
- const rowColClasses = {
22357
- row: "".concat(PREFIX$c, "-row"),
22358
- rowBorderBottom: "".concat(PREFIX$c, "-rowBorderBottom"),
22359
- column: "".concat(PREFIX$c, "-column"),
22360
- fieldRoot: "".concat(PREFIX$c, "-fieldRoot"),
22361
- cell: "".concat(PREFIX$c, "-cell"),
22362
- labelText: "".concat(PREFIX$c, "-labelText"),
22363
- labelDense: "".concat(PREFIX$c, "-labelDense"),
22364
- highlighted: "".concat(PREFIX$c, "-highlighted"),
22365
- checkboxLabel: "".concat(PREFIX$c, "-checkboxLabel"),
22366
- icon: "".concat(PREFIX$c, "-icon"),
22367
- S: "".concat(PREFIX$c, "-S"),
22368
- XS: "".concat(PREFIX$c, "-XS"),
22369
- A: "".concat(PREFIX$c, "-A"),
22370
- X: "".concat(PREFIX$c, "-X"),
22371
- frequencyCount: "".concat(PREFIX$c, "-frequencyCount"),
22372
- barContainer: "".concat(PREFIX$c, "-barContainer"),
22373
- bar: "".concat(PREFIX$c, "-bar"),
22374
- barSelected: "".concat(PREFIX$c, "-barSelected"),
22375
- barWithCheckbox: "".concat(PREFIX$c, "-barWithCheckbox"),
22376
- barSelectedWithCheckbox: "".concat(PREFIX$c, "-barSelectedWithCheckbox"),
22377
- excludedTextWithCheckbox: "".concat(PREFIX$c, "-excludedTextWithCheckbox")
22378
- };
22379
-
22380
22449
  const isExcluded = c => c ? c.qState === 'X' || c.qState === 'XS' || c.qState === 'XL' : null;
22381
22450
  const isAlternative = c => c ? c.qState === 'A' : null;
22382
22451
  const excludedOrAlternative = _ref => {
@@ -23193,6 +23262,8 @@
23193
23262
  onMouseDown,
23194
23263
  onMouseUp,
23195
23264
  onMouseEnter,
23265
+ onTouchStart,
23266
+ onTouchEnd,
23196
23267
  pages,
23197
23268
  isLocked,
23198
23269
  column = false,
@@ -23374,6 +23445,8 @@
23374
23445
  onMouseUp: onMouseUp,
23375
23446
  onMouseEnter: onMouseEnter,
23376
23447
  onKeyDown: handleKeyDownCallback,
23448
+ onTouchStart: onTouchStart,
23449
+ onTouchEnd: onTouchEnd,
23377
23450
  onContextMenu: preventContextMenu,
23378
23451
  tabIndex: isFirstElement && keyboard.innerTabStops ? 0 : -1,
23379
23452
  "data-n": cell === null || cell === void 0 ? void 0 : cell.qElemNumber
@@ -25865,7 +25938,8 @@
25865
25938
  selectionState,
25866
25939
  selections,
25867
25940
  checkboxes,
25868
- doc: document
25941
+ doc: document,
25942
+ loaderRef
25869
25943
  });
25870
25944
  const {
25871
25945
  layoutOptions = {}
@@ -28807,6 +28881,7 @@
28807
28881
  };
28808
28882
  };
28809
28883
 
28884
+ /* eslint-disable no-nested-ternary */
28810
28885
  function showToolbarDetached(_ref) {
28811
28886
  var _containerRef$current, _containerRef$current2, _titleRef$current$cli, _titleRef$current, _titleRef$current2, _titleRef$current3;
28812
28887
  let {
@@ -28820,12 +28895,17 @@
28820
28895
  const actionToolbarWidth = 128;
28821
28896
  const notSufficientSpace = containerWidth < contentWidth + actionToolbarWidth;
28822
28897
  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);
28823
- return !!(notSufficientSpace | isTruncated);
28898
+ const isDetached = !!(notSufficientSpace | isTruncated);
28899
+ const reasonDetached = isDetached ? notSufficientSpace ? 'noSpace' : 'truncated' : '';
28900
+ return {
28901
+ isDetached,
28902
+ reasonDetached
28903
+ };
28824
28904
  }
28825
28905
 
28826
28906
  function getListboxActionProps(_ref) {
28827
28907
  let {
28828
- isPopover,
28908
+ isDetached,
28829
28909
  showToolbar,
28830
28910
  containerRef,
28831
28911
  isLocked,
@@ -28833,9 +28913,9 @@
28833
28913
  selections
28834
28914
  } = _ref;
28835
28915
  return {
28836
- show: showToolbar && !isPopover,
28916
+ show: showToolbar && !isDetached,
28837
28917
  popover: {
28838
- show: showToolbar && isPopover,
28918
+ show: showToolbar && isDetached,
28839
28919
  anchorEl: containerRef.current
28840
28920
  },
28841
28921
  more: {
@@ -28906,7 +28986,7 @@
28906
28986
  ["& .".concat(classes$4.listboxWrapper)]: {
28907
28987
  padding: containerPadding
28908
28988
  },
28909
- '&:focus:not(:hover)': {
28989
+ '&:focus': {
28910
28990
  boxShadow: "inset 0 0 0 2px ".concat(theme.palette.custom.focusBorder, " !important")
28911
28991
  },
28912
28992
  '&:focus-visible': {
@@ -28958,7 +29038,8 @@
28958
29038
  showGray = true,
28959
29039
  scrollState = undefined,
28960
29040
  renderedCallback,
28961
- toolbar = true
29041
+ toolbar = true,
29042
+ isPopover = false
28962
29043
  } = options;
28963
29044
 
28964
29045
  // Hook that will trigger update when used in useEffects.
@@ -28987,7 +29068,7 @@
28987
29068
  const [searchContainer, searchContainerRef] = useRefWithCallback();
28988
29069
  const [showToolbar, setShowToolbar] = reactExports.useState(false);
28989
29070
  const [showSearch, setShowSearch] = reactExports.useState(false);
28990
- const [hovering, setHovering] = reactExports.useState(false);
29071
+ const hovering = reactExports.useRef(false);
28991
29072
  const [keyScroll, setKeyScroll] = reactExports.useState({
28992
29073
  down: 0,
28993
29074
  up: 0,
@@ -29014,11 +29095,11 @@
29014
29095
  const {
29015
29096
  handleKeyDown,
29016
29097
  handleOnMouseEnter,
29017
- handleOnMouseLeave
29018
- } = getListboxInlineKeyboardNavigation({
29098
+ handleOnMouseLeave,
29099
+ globalKeyDown
29100
+ } = reactExports.useMemo(() => getListboxInlineKeyboardNavigation({
29019
29101
  keyboard,
29020
29102
  hovering,
29021
- setHovering,
29022
29103
  updateKeyScroll,
29023
29104
  containerRef,
29024
29105
  currentScrollIndex,
@@ -29026,9 +29107,15 @@
29026
29107
  appSelections,
29027
29108
  constraints,
29028
29109
  isModal: isModalMode
29029
- });
29030
- const showDetachedToolbarOnly = toolbar && ((layout === null || layout === void 0 ? void 0 : layout.title) === '' || (layout === null || layout === void 0 ? void 0 : layout.showTitle) === false);
29031
- const showToolbarWithTitle = toolbar && (layout === null || layout === void 0 ? void 0 : layout.title) !== '' && (layout === null || layout === void 0 ? void 0 : layout.showTitle) !== false;
29110
+ }), [keyboard, hovering, updateKeyScroll, containerRef, currentScrollIndex, app, appSelections, constraints, isModalMode]);
29111
+ const showDetachedToolbarOnly = toolbar && ((layout === null || layout === void 0 ? void 0 : layout.title) === '' || (layout === null || layout === void 0 ? void 0 : layout.showTitle) === false) && !isPopover;
29112
+ const showToolbarWithTitle = toolbar && (layout === null || layout === void 0 ? void 0 : layout.title) !== '' && (layout === null || layout === void 0 ? void 0 : layout.showTitle) !== false || isPopover;
29113
+ reactExports.useEffect(() => {
29114
+ document.addEventListener('keydown', globalKeyDown);
29115
+ return () => {
29116
+ document.removeEventListener('keydown', globalKeyDown);
29117
+ };
29118
+ }, [globalKeyDown]);
29032
29119
  reactExports.useEffect(() => {
29033
29120
  const show = () => {
29034
29121
  setShowToolbar(true);
@@ -29039,6 +29126,14 @@
29039
29126
  setShowSearch(false);
29040
29127
  }
29041
29128
  };
29129
+ if (isPopover) {
29130
+ if (!selections.isActive()) {
29131
+ selections.begin('/qListObjectDef');
29132
+ selections.on('activated', show);
29133
+ selections.on('deactivated', hide);
29134
+ }
29135
+ setShowToolbar(isPopover);
29136
+ }
29042
29137
  if (selections) {
29043
29138
  if (!selections.isModal()) {
29044
29139
  selections.on('activated', show);
@@ -29052,7 +29147,7 @@
29052
29147
  selections.removeListener('deactivated', hide);
29053
29148
  }
29054
29149
  };
29055
- }, [selections]);
29150
+ }, [selections, isPopover]);
29056
29151
  reactExports.useEffect(() => {
29057
29152
  if (!searchContainer || !searchContainer.current) {
29058
29153
  return;
@@ -29100,8 +29195,8 @@
29100
29195
  input === null || input === void 0 ? void 0 : input.focus();
29101
29196
  }
29102
29197
  };
29103
- const getActionToolbarProps = isPopover => getListboxActionProps({
29104
- isPopover,
29198
+ const getActionToolbarProps = isDetached => getListboxActionProps({
29199
+ isDetached: isPopover ? false : isDetached,
29105
29200
  showToolbar,
29106
29201
  containerRef,
29107
29202
  isLocked,
@@ -29115,6 +29210,14 @@
29115
29210
  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
29116
29211
  const headerPaddingLeft = CELL_PADDING_LEFT - (showSearchOrLockIcon ? ICON_PADDING : 0);
29117
29212
  const headerPaddingRight = isRtl ? CELL_PADDING_LEFT - (showIcons ? ICON_PADDING : 0) : 0;
29213
+ const {
29214
+ isDetached,
29215
+ reasonDetached
29216
+ } = showToolbarDetached({
29217
+ containerRef,
29218
+ titleRef,
29219
+ iconsWidth
29220
+ });
29118
29221
 
29119
29222
  // Add a container padding for grid mode to harmonize with the grid item margins (should sum to 8px).
29120
29223
  const isGridMode = (layoutOptions === null || layoutOptions === void 0 ? void 0 : layoutOptions.dataLayout) === 'grid';
@@ -29163,7 +29266,7 @@
29163
29266
  }, getActionToolbarProps(true))), /*#__PURE__*/React.createElement(StyledGrid$3, {
29164
29267
  className: "listbox-container",
29165
29268
  container: true,
29166
- tabIndex: keyboard.outerTabStops ? 0 : -1,
29269
+ tabIndex: keyboard.enabled ? -1 : undefined,
29167
29270
  direction: "column",
29168
29271
  gap: 0,
29169
29272
  containerPadding: containerPadding,
@@ -29219,6 +29322,9 @@
29219
29322
  className: classes$4.listBoxHeader
29220
29323
  }, /*#__PURE__*/React.createElement(Title, {
29221
29324
  variant: "h6",
29325
+ sx: {
29326
+ width: isPopover && reasonDetached === 'noSpace' ? '60px' : undefined
29327
+ },
29222
29328
  noWrap: true,
29223
29329
  ref: titleRef,
29224
29330
  title: layout.title
@@ -29229,11 +29335,7 @@
29229
29335
  item: true
29230
29336
  }, /*#__PURE__*/React.createElement(ActionsToolbar, _extends$8({
29231
29337
  direction: direction
29232
- }, getActionToolbarProps(showToolbarDetached({
29233
- containerRef,
29234
- titleRef,
29235
- iconsWidth
29236
- })))))), /*#__PURE__*/React.createElement(Grid$1, {
29338
+ }, getActionToolbarProps(isDetached))))), /*#__PURE__*/React.createElement(Grid$1, {
29237
29339
  item: true,
29238
29340
  container: true,
29239
29341
  direction: "column",