@nebula.js/stardust 5.1.2 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/core/esm/dev.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * @nebula.js/stardust v5.1.2
2
+ * @nebula.js/stardust v5.3.0
3
3
  * Copyright (c) 2024 QlikTech International AB
4
4
  * Released under the MIT license.
5
5
  */
@@ -753,8 +753,8 @@ function _objectWithoutProperties(e, t) {
753
753
  r,
754
754
  i = _objectWithoutPropertiesLoose$2(e, t);
755
755
  if (Object.getOwnPropertySymbols) {
756
- var n = Object.getOwnPropertySymbols(e);
757
- for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
756
+ var s = Object.getOwnPropertySymbols(e);
757
+ for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
758
758
  }
759
759
  return i;
760
760
  }
@@ -762,7 +762,7 @@ function _objectWithoutPropertiesLoose$2(r, e) {
762
762
  if (null == r) return {};
763
763
  var t = {};
764
764
  for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
765
- if (e.indexOf(n) >= 0) continue;
765
+ if (e.includes(n)) continue;
766
766
  t[n] = r[n];
767
767
  }
768
768
  return t;
@@ -1954,6 +1954,12 @@ var Visualization_UnfulfilledCalculationCondition = {
1954
1954
  "zh-TW": "不符計算條件"
1955
1955
  }
1956
1956
  };
1957
+ var Listbox_Clear_Search = {
1958
+ id: "Listbox.Clear.Search",
1959
+ locale: {
1960
+ "en-US": "Clear search"
1961
+ }
1962
+ };
1957
1963
  var all = {
1958
1964
  Cancel: Cancel$1,
1959
1965
  CurrentSelections_All: CurrentSelections_All,
@@ -2008,7 +2014,8 @@ var all = {
2008
2014
  Visualization_Invalid_Dimension: Visualization_Invalid_Dimension,
2009
2015
  Visualization_Invalid_Measure: Visualization_Invalid_Measure,
2010
2016
  Visualization_LayoutError: Visualization_LayoutError,
2011
- Visualization_UnfulfilledCalculationCondition: Visualization_UnfulfilledCalculationCondition
2017
+ Visualization_UnfulfilledCalculationCondition: Visualization_UnfulfilledCalculationCondition,
2018
+ Listbox_Clear_Search: Listbox_Clear_Search
2012
2019
  };
2013
2020
 
2014
2021
  function appLocaleFn(language) {
@@ -5244,7 +5251,7 @@ function GlobalStyles(props) {
5244
5251
  }
5245
5252
 
5246
5253
  /**
5247
- * @mui/styled-engine v5.15.14
5254
+ * @mui/styled-engine v5.16.4
5248
5255
  *
5249
5256
  * @license MIT
5250
5257
  * This source code is licensed under the MIT license found in the
@@ -5342,11 +5349,9 @@ function deepmerge$1(target, source, options = {
5342
5349
  const output = options.clone ? _extends$3({}, target) : target;
5343
5350
  if (isPlainObject(target) && isPlainObject(source)) {
5344
5351
  Object.keys(source).forEach(key => {
5352
+ if (isPlainObject(source[key]) &&
5345
5353
  // Avoid prototype pollution
5346
- if (key === '__proto__') {
5347
- return;
5348
- }
5349
- if (isPlainObject(source[key]) && key in target && isPlainObject(target[key])) {
5354
+ Object.prototype.hasOwnProperty.call(target, key) && isPlainObject(target[key])) {
5350
5355
  // Since `output` is a clone of `target` and we have narrowed `target` in this block we can cast to the same type.
5351
5356
  output[key] = deepmerge$1(target[key], source[key], options);
5352
5357
  } else if (options.clone) {
@@ -6726,36 +6731,6 @@ function resolveProps(defaultProps, props) {
6726
6731
  return output;
6727
6732
  }
6728
6733
 
6729
- function getThemeProps(params) {
6730
- const {
6731
- theme,
6732
- name,
6733
- props
6734
- } = params;
6735
- if (!theme || !theme.components || !theme.components[name] || !theme.components[name].defaultProps) {
6736
- return props;
6737
- }
6738
- return resolveProps(theme.components[name].defaultProps, props);
6739
- }
6740
-
6741
- function useThemeProps$1({
6742
- props,
6743
- name,
6744
- defaultTheme,
6745
- themeId
6746
- }) {
6747
- let theme = useTheme$3(defaultTheme);
6748
- if (themeId) {
6749
- theme = theme[themeId] || theme;
6750
- }
6751
- const mergedProps = getThemeProps({
6752
- theme,
6753
- name,
6754
- props
6755
- });
6756
- return mergedProps;
6757
- }
6758
-
6759
6734
  /**
6760
6735
  * A version of `React.useLayoutEffect` that does not show a warning when server-side rendering.
6761
6736
  * This is useful for effects that are only needed for client-side rendering but not for SSR.
@@ -7225,6 +7200,50 @@ function RtlProvider(_ref) {
7225
7200
  }, props));
7226
7201
  }
7227
7202
 
7203
+ const PropsContext = /*#__PURE__*/React.createContext(undefined);
7204
+ function DefaultPropsProvider({
7205
+ value,
7206
+ children
7207
+ }) {
7208
+ return /*#__PURE__*/jsxRuntimeExports.jsx(PropsContext.Provider, {
7209
+ value: value,
7210
+ children: children
7211
+ });
7212
+ }
7213
+ function getThemeProps(params) {
7214
+ const {
7215
+ theme,
7216
+ name,
7217
+ props
7218
+ } = params;
7219
+ if (!theme || !theme.components || !theme.components[name]) {
7220
+ return props;
7221
+ }
7222
+ const config = theme.components[name];
7223
+ if (config.defaultProps) {
7224
+ // compatible with v5 signature
7225
+ return resolveProps(config.defaultProps, props);
7226
+ }
7227
+ if (!config.styleOverrides && !config.variants) {
7228
+ // v6 signature, no property 'defaultProps'
7229
+ return resolveProps(config, props);
7230
+ }
7231
+ return props;
7232
+ }
7233
+ function useDefaultProps$1({
7234
+ props,
7235
+ name
7236
+ }) {
7237
+ const ctx = React.useContext(PropsContext);
7238
+ return getThemeProps({
7239
+ props,
7240
+ name,
7241
+ theme: {
7242
+ components: ctx
7243
+ }
7244
+ });
7245
+ }
7246
+
7228
7247
  const EMPTY_THEME = {};
7229
7248
  function useThemeScoping(themeId, upperTheme, localTheme, isPrivate = false) {
7230
7249
  return React.useMemo(() => {
@@ -7271,7 +7290,10 @@ function ThemeProvider$1(props) {
7271
7290
  value: engineTheme,
7272
7291
  children: /*#__PURE__*/jsxRuntimeExports.jsx(RtlProvider, {
7273
7292
  value: rtlValue,
7274
- children: children
7293
+ children: /*#__PURE__*/jsxRuntimeExports.jsx(DefaultPropsProvider, {
7294
+ value: engineTheme == null ? void 0 : engineTheme.components,
7295
+ children: children
7296
+ })
7275
7297
  })
7276
7298
  })
7277
7299
  });
@@ -8352,18 +8374,6 @@ function useTheme$1() {
8352
8374
  return theme[THEME_ID] || theme;
8353
8375
  }
8354
8376
 
8355
- function useThemeProps({
8356
- props,
8357
- name
8358
- }) {
8359
- return useThemeProps$1({
8360
- props,
8361
- name,
8362
- defaultTheme,
8363
- themeId: THEME_ID
8364
- });
8365
- }
8366
-
8367
8377
  var createStyled$1 = {};
8368
8378
 
8369
8379
  var _extends$1 = {exports: {}};
@@ -8689,6 +8699,10 @@ function ThemeProvider(_ref) {
8689
8699
  }));
8690
8700
  }
8691
8701
 
8702
+ function useDefaultProps(params) {
8703
+ return useDefaultProps$1(params);
8704
+ }
8705
+
8692
8706
  function _extends() {
8693
8707
  _extends = Object.assign ? Object.assign.bind() : function (target) {
8694
8708
  for (var i = 1; i < arguments.length; i++) {
@@ -9067,7 +9081,7 @@ function create$3(definition) {
9067
9081
  return cache[key];
9068
9082
  }
9069
9083
 
9070
- const NEBULA_VERSION_HASH = "4acd" ;
9084
+ const NEBULA_VERSION_HASH = "b434";
9071
9085
  ClassNameGenerator.configure(componentName => {
9072
9086
  return "njs-".concat(NEBULA_VERSION_HASH, "-").concat(componentName.replace('Mui', ''));
9073
9087
  });
@@ -9299,7 +9313,7 @@ function boot(_ref2) {
9299
9313
  const appRef = React__default.createRef();
9300
9314
  const element = document.createElement('div');
9301
9315
  element.style.display = 'none';
9302
- element.setAttribute('data-nebulajs-version', "5.1.2" );
9316
+ element.setAttribute('data-nebulajs-version', "5.3.0");
9303
9317
  element.setAttribute('data-app-id', app.id);
9304
9318
  document.body.appendChild(element);
9305
9319
  if (context) {
@@ -11309,6 +11323,78 @@ const KEYS = Object.freeze({
11309
11323
  isArrow: key => key === KEYS.ARROW_UP || key === KEYS.ARROW_DOWN || key === KEYS.ARROW_LEFT || key === KEYS.ARROW_RIGHT
11310
11324
  });
11311
11325
 
11326
+ function removeInnnerTabStops(container) {
11327
+ container === null || container === void 0 || container.querySelectorAll('[tabIndex="0"]').forEach(elm => {
11328
+ elm.setAttribute('tabIndex', -1);
11329
+ });
11330
+ }
11331
+ function removeLastFocused(container) {
11332
+ container === null || container === void 0 || container.querySelectorAll('.last-focused').forEach(elm => {
11333
+ elm.classList.remove('last-focused');
11334
+ });
11335
+ }
11336
+ function getVizCell(container) {
11337
+ return (container === null || container === void 0 ? void 0 : container.closest('.njs-cell')) || (container === null || container === void 0 ? void 0 : container.closest('.qv-gridcell')) || (container === null || container === void 0 ? void 0 : container.closest('.qv-gs-listbox'));
11338
+ }
11339
+
11340
+ // Emulate the keyboard hook, until we support it in the Listbox.
11341
+ function useTempKeyboard(_ref) {
11342
+ let {
11343
+ containerRef,
11344
+ enabled
11345
+ } = _ref;
11346
+ const [keyboardActive, setKeyboardActive] = useState$1(false);
11347
+ const keyboard = {
11348
+ enabled,
11349
+ active: keyboardActive,
11350
+ // innerTabStops: whether keyboard permits inner tab stops
11351
+ // (inner = everything inside .listbox-container)
11352
+
11353
+ innerTabStops: !enabled || keyboardActive,
11354
+ blur(resetFocus) {
11355
+ var _containerRef$current;
11356
+ if (!enabled) {
11357
+ return;
11358
+ }
11359
+ setKeyboardActive(false);
11360
+ const vizCell = getVizCell(containerRef.current) || ((_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.parentElement);
11361
+ removeInnnerTabStops(containerRef.current);
11362
+ removeLastFocused(containerRef.current);
11363
+ if (resetFocus && vizCell) {
11364
+ // Move focus to the viz's cell.
11365
+ vizCell.setAttribute('tabIndex', 0);
11366
+ containerRef.current.setAttribute('tabIndex', -1);
11367
+ vizCell.focus();
11368
+ }
11369
+ },
11370
+ focus() {
11371
+ if (!enabled) {
11372
+ return;
11373
+ }
11374
+ setKeyboardActive(true);
11375
+ const c = containerRef.current;
11376
+ const searchField = c === null || c === void 0 ? void 0 : c.querySelector('.search input');
11377
+ const lastSelectedRow = c === null || c === void 0 ? void 0 : c.querySelector('.value.last-focused');
11378
+ const firstRowElement = c === null || c === void 0 ? void 0 : c.querySelector('.value.selector, .value');
11379
+ const confirmButton = c === null || c === void 0 ? void 0 : c.querySelector('.actions-toolbar-default-actions .actions-toolbar-confirm');
11380
+ const unlockCoverButton = c === null || c === void 0 ? void 0 : c.querySelector('#listbox-unlock-button');
11381
+ const cyclicButton = c === null || c === void 0 ? void 0 : c.querySelector('.listbox-cyclic-button');
11382
+ const elementToFocus = cyclicButton || searchField || lastSelectedRow || firstRowElement || unlockCoverButton || confirmButton;
11383
+ elementToFocus === null || elementToFocus === void 0 || elementToFocus.setAttribute('tabIndex', 0);
11384
+ elementToFocus === null || elementToFocus === void 0 || elementToFocus.focus();
11385
+ },
11386
+ focusSelection() {
11387
+ const unlockCoverButton = document.querySelector('#listbox-unlock-button');
11388
+ const confirmButton = document.querySelector('.actions-toolbar-default-actions .actions-toolbar-confirm:not(:disabled)');
11389
+ const btnToFocus = unlockCoverButton || confirmButton;
11390
+ btnToFocus === null || btnToFocus === void 0 || btnToFocus.setAttribute('tabIndex', 0);
11391
+ btnToFocus === null || btnToFocus === void 0 || btnToFocus.focus();
11392
+ return btnToFocus;
11393
+ }
11394
+ };
11395
+ return keyboard;
11396
+ }
11397
+
11312
11398
  const getElementIndex = currentTarget => +currentTarget.getAttribute('data-n');
11313
11399
  const focusSearch = container => {
11314
11400
  const searchField = container === null || container === void 0 ? void 0 : container.querySelector('.search input');
@@ -11316,10 +11402,49 @@ const focusSearch = container => {
11316
11402
  return searchField;
11317
11403
  };
11318
11404
  const focusRow = container => {
11319
- const row = container === null || container === void 0 ? void 0 : container.querySelector('.value.last-focused, .value.selector, .value');
11320
- row === null || row === void 0 || row.setAttribute('tabIndex', 0);
11321
- row === null || row === void 0 || row.focus();
11322
- return row;
11405
+ const lastFocusedRow = container === null || container === void 0 ? void 0 : container.querySelector('.value.last-focused');
11406
+ const selectorRow = container === null || container === void 0 ? void 0 : container.querySelector('.value.selector');
11407
+ const row = container === null || container === void 0 ? void 0 : container.querySelector('.value');
11408
+ const rowToFocus = lastFocusedRow || selectorRow || row;
11409
+ rowToFocus === null || rowToFocus === void 0 || rowToFocus.setAttribute('tabIndex', 0);
11410
+ rowToFocus === null || rowToFocus === void 0 || rowToFocus.focus();
11411
+ removeLastFocused(container);
11412
+ return rowToFocus;
11413
+ };
11414
+ const focusCyclicButton = container => {
11415
+ const button = container === null || container === void 0 ? void 0 : container.querySelector('.listbox-cyclic-button:not(:disabled)');
11416
+ button === null || button === void 0 || button.setAttribute('tabIndex', 0);
11417
+ button === null || button === void 0 || button.focus();
11418
+ return button;
11419
+ };
11420
+ const blur$1 = (event, keyboard) => {
11421
+ if (!keyboard.enabled) return;
11422
+ const {
11423
+ currentTarget,
11424
+ target
11425
+ } = event;
11426
+ const isFocusedOnListbox = target.classList.contains('listbox-container');
11427
+ const container = currentTarget.closest('.listbox-container');
11428
+ const vizCell = getVizCell(container);
11429
+ const isSingleListbox = (vizCell === null || vizCell === void 0 ? void 0 : vizCell.querySelectorAll('.listbox-container').length) === 1;
11430
+ if (isFocusedOnListbox || isSingleListbox) {
11431
+ // Move the focus from listbox container to the viz container.
11432
+ keyboard.blur(true);
11433
+ } else {
11434
+ // More than one listbox: Move focus from row to listbox container.
11435
+
11436
+ // 1. Remove last-focused class from row siblings.
11437
+ removeLastFocused(container);
11438
+
11439
+ // 2. Add last-focused class so we can re-focus it later.
11440
+ currentTarget.classList.add('last-focused');
11441
+
11442
+ // 3. Blur row and focus the listbox container.
11443
+ keyboard.blur();
11444
+ const c = currentTarget.closest('.listbox-container');
11445
+ c.setAttribute('tabIndex', -1);
11446
+ c === null || c === void 0 || c.focus();
11447
+ }
11323
11448
  };
11324
11449
 
11325
11450
  // Find next item index to focus in the dom element list on key up and key down
@@ -11432,28 +11557,33 @@ function getRowsKeyboardNavigation(_ref) {
11432
11557
  {
11433
11558
  // Try to focus search field, otherwise confirm button.
11434
11559
  const container = currentTarget.closest('.listbox-container');
11435
- const inSelection = isModal();
11436
-
11560
+ const inSelection = typeof isModal !== 'undefined' ? isModal() : undefined;
11437
11561
  // TODO: use a store to keep track of this row.
11438
11562
  currentTarget.classList.add('last-focused'); // so that we can go back here when we tab back
11439
11563
 
11564
+ const useDefaultBrowserSupport = !(keyboard !== null && keyboard !== void 0 && keyboard.enabled);
11565
+ if (useDefaultBrowserSupport) {
11566
+ if (!inSelection) return;
11567
+ keyboard.focusSelection();
11568
+ event.preventDefault();
11569
+ event.stopPropagation();
11570
+ return;
11571
+ }
11440
11572
  if (shiftKey) {
11441
- if (!focusSearch(container)) {
11573
+ if (!focusSearch(container) && !focusCyclicButton(container)) {
11442
11574
  if (inSelection) {
11443
11575
  keyboard.focusSelection();
11444
11576
  } else {
11445
- keyboard.blur(true);
11577
+ blur$1(event, keyboard);
11446
11578
  }
11447
11579
  }
11448
11580
  break;
11449
11581
  }
11450
11582
 
11451
11583
  // Without shift key
11452
- if (inSelection) {
11453
- keyboard.focusSelection();
11454
- } else {
11584
+ if (!keyboard.focusSelection() && !focusCyclicButton(container) && !focusSearch(container)) {
11455
11585
  currentTarget.blur();
11456
- keyboard.blur();
11586
+ blur$1(event, keyboard);
11457
11587
  }
11458
11588
  break;
11459
11589
  }
@@ -11493,6 +11623,10 @@ function getRowsKeyboardNavigation(_ref) {
11493
11623
  }
11494
11624
  break;
11495
11625
  case KEYS.ESCAPE:
11626
+ if (typeof isModal === 'undefined') {
11627
+ cancel();
11628
+ return;
11629
+ }
11496
11630
  if (isModal()) {
11497
11631
  cancel();
11498
11632
  } else {
@@ -13994,7 +14128,7 @@ function ListBoxDisclaimer(_ref2) {
13994
14128
  }, translatorDynamic.get(text)));
13995
14129
  }
13996
14130
 
13997
- var Close = {};
14131
+ var Close$1 = {};
13998
14132
 
13999
14133
  var interopRequireDefault = {exports: {}};
14000
14134
 
@@ -14069,7 +14203,7 @@ const SvgIconRoot = styled('svg', {
14069
14203
  };
14070
14204
  });
14071
14205
  const SvgIcon = /*#__PURE__*/React.forwardRef(function SvgIcon(inProps, ref) {
14072
- const props = useThemeProps({
14206
+ const props = useDefaultProps({
14073
14207
  props: inProps,
14074
14208
  name: 'MuiSvgIcon'
14075
14209
  });
@@ -14185,13 +14319,13 @@ function requireCreateSvgIcon () {
14185
14319
  }
14186
14320
 
14187
14321
  var _interopRequireDefault = interopRequireDefaultExports;
14188
- Object.defineProperty(Close, "__esModule", {
14322
+ Object.defineProperty(Close$1, "__esModule", {
14189
14323
  value: true
14190
14324
  });
14191
- var default_1 = Close.default = void 0;
14325
+ var default_1 = Close$1.default = void 0;
14192
14326
  var _createSvgIcon = _interopRequireDefault(requireCreateSvgIcon());
14193
14327
  var _jsxRuntime = jsxRuntimeExports;
14194
- default_1 = Close.default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
14328
+ default_1 = Close$1.default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
14195
14329
  d: "M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"
14196
14330
  }), 'Close');
14197
14331
 
@@ -14838,11 +14972,18 @@ var createListboxSelectionToolbar = (_ref => {
14838
14972
  model,
14839
14973
  translator,
14840
14974
  selectionState,
14841
- isDirectQuery = false
14975
+ isDirectQuery = false,
14976
+ selections
14842
14977
  } = _ref;
14843
14978
  if (layout.qListObject.qDimensionInfo.qIsOneAndOnlyOne) {
14844
14979
  return [];
14845
14980
  }
14981
+ const path = '/qListObjectDef';
14982
+ const activateSelection = () => {
14983
+ if (!selections.isActive()) {
14984
+ selections.begin(path);
14985
+ }
14986
+ };
14846
14987
  const canSelectAll = () => ['qOption', 'qAlternative', 'qExcluded', 'qDeselected'].some(sc => layout.qListObject.qDimensionInfo.qStateCounts[sc] > 0);
14847
14988
  const canSelectPossible = () => ['qOption'].some(sc => layout.qListObject.qDimensionInfo.qStateCounts[sc] > 0);
14848
14989
  const canSelectAlternative = () => ['qAlternative'].some(sc => layout.qListObject.qDimensionInfo.qStateCounts[sc] > 0);
@@ -14854,8 +14995,9 @@ var createListboxSelectionToolbar = (_ref => {
14854
14995
  getSvgIconShape: selectAll,
14855
14996
  enabled: canSelectAll,
14856
14997
  action: () => {
14998
+ activateSelection();
14857
14999
  selectionState.clearItemStates(false);
14858
- model.selectListObjectAll('/qListObjectDef');
15000
+ model.selectListObjectAll(path);
14859
15001
  }
14860
15002
  }, {
14861
15003
  key: 'selectPossible',
@@ -14864,8 +15006,9 @@ var createListboxSelectionToolbar = (_ref => {
14864
15006
  getSvgIconShape: selectPossible,
14865
15007
  enabled: canSelectPossible,
14866
15008
  action: () => {
15009
+ activateSelection();
14867
15010
  selectionState.clearItemStates(false);
14868
- model.selectListObjectPossible('/qListObjectDef');
15011
+ model.selectListObjectPossible(path);
14869
15012
  }
14870
15013
  }, isDirectQuery ? false : {
14871
15014
  key: 'selectAlternative',
@@ -14874,8 +15017,9 @@ var createListboxSelectionToolbar = (_ref => {
14874
15017
  getSvgIconShape: selectAlternative,
14875
15018
  enabled: canSelectAlternative,
14876
15019
  action: () => {
15020
+ activateSelection();
14877
15021
  selectionState.clearItemStates(false);
14878
- model.selectListObjectAlternative('/qListObjectDef');
15022
+ model.selectListObjectAlternative(path);
14879
15023
  }
14880
15024
  }, isDirectQuery ? false : {
14881
15025
  key: 'selectExcluded',
@@ -14884,8 +15028,9 @@ var createListboxSelectionToolbar = (_ref => {
14884
15028
  getSvgIconShape: selectExcluded,
14885
15029
  enabled: canSelectExcluded,
14886
15030
  action: () => {
15031
+ activateSelection();
14887
15032
  selectionState.clearItemStates(false);
14888
- model.selectListObjectExcluded('/qListObjectDef');
15033
+ model.selectListObjectExcluded(path);
14889
15034
  }
14890
15035
  }].filter(Boolean);
14891
15036
  });
@@ -14975,6 +15120,7 @@ const close = props => _objectSpread2(_objectSpread2({}, props), {}, {
14975
15120
  }
14976
15121
  }]
14977
15122
  });
15123
+ var Close = (props => SvgIcon$1(close(props)));
14978
15124
 
14979
15125
  const clearSelections = props => _objectSpread2(_objectSpread2({}, props), {}, {
14980
15126
  shapes: [{
@@ -15362,7 +15508,7 @@ function ActionsToolbar(_ref3) {
15362
15508
  moreEnabled = true;
15363
15509
  moreActions = [...newMoreActions, ...more$1.actions];
15364
15510
  }
15365
- if (!selections.show && newActions.length === 0) return null;
15511
+ if (!selections.show && newActions.length === 0 && !moreEnabled) return null;
15366
15512
  const handleCloseShowMoreItems = () => {
15367
15513
  setShowMoreItems(false);
15368
15514
  };
@@ -15466,7 +15612,6 @@ const StyledOutlinedInput = styled(OutlinedInput, {
15466
15612
  shouldForwardProp: p => !['styles', 'dense', 'isRtl'].includes(p)
15467
15613
  })(_ref => {
15468
15614
  let {
15469
- theme,
15470
15615
  styles,
15471
15616
  dense,
15472
15617
  isRtl
@@ -15475,10 +15620,11 @@ const StyledOutlinedInput = styled(OutlinedInput, {
15475
15620
  if (dense) {
15476
15621
  denseProps = {
15477
15622
  fontSize: 12,
15478
- paddingLeft: theme.spacing(1),
15479
15623
  '& input': {
15480
15624
  paddingTop: '5px',
15481
- paddingBottom: '5px'
15625
+ paddingBottom: '5px',
15626
+ color: styles.search.color,
15627
+ textAlign: isRtl ? 'right' : 'left'
15482
15628
  }
15483
15629
  };
15484
15630
  }
@@ -15489,7 +15635,8 @@ const StyledOutlinedInput = styled(OutlinedInput, {
15489
15635
  borderRadius: 0,
15490
15636
  backgroundColor: styles.search.backgroundColor,
15491
15637
  backdropFilter: styles.background.backgroundImage ? styles.search.backdropFilter : undefined,
15492
- paddingLeft: "".concat(CELL_PADDING_LEFT, "px"),
15638
+ paddingLeft: 0,
15639
+ paddingRight: 0,
15493
15640
  flexDirection: isRtl ? 'row-reverse' : 'row',
15494
15641
  '& fieldset': {
15495
15642
  borderColor: "".concat(styles.search.borderColor),
@@ -15509,8 +15656,22 @@ const StyledOutlinedInput = styled(OutlinedInput, {
15509
15656
  }
15510
15657
  }, denseProps);
15511
15658
  });
15659
+ const StyledIconButton = styled(IconButton)(() => ({
15660
+ border: 0,
15661
+ padding: '8px',
15662
+ cursor: 'pointer',
15663
+ lineHeight: '12px',
15664
+ '&:hover': {
15665
+ backgroundColor: 'transparent'
15666
+ },
15667
+ ':focus-visible': {
15668
+ borderRadius: '4px',
15669
+ boxShadow: 'inset 0 0 0 2px rgb(2, 117, 217)'
15670
+ }
15671
+ }));
15512
15672
  function ListBoxSearch(_ref2) {
15513
15673
  let {
15674
+ popoverOpen,
15514
15675
  selections,
15515
15676
  selectionState,
15516
15677
  model,
@@ -15518,6 +15679,7 @@ function ListBoxSearch(_ref2) {
15518
15679
  dense = false,
15519
15680
  visible = true,
15520
15681
  autoFocus = true,
15682
+ beginSelectionOnFocus = true,
15521
15683
  wildCardSearch = false,
15522
15684
  searchEnabled,
15523
15685
  direction,
@@ -15530,6 +15692,8 @@ function ListBoxSearch(_ref2) {
15530
15692
  const [value, setValue] = useState$1('');
15531
15693
  const [wildcardOn, setWildcardOn] = useState$1(false);
15532
15694
  const inputRef = useRef();
15695
+ const clearSearchRef = useRef();
15696
+ const clearSearchText = translator.get('Listbox.Clear.Search');
15533
15697
  const {
15534
15698
  getStoreValue,
15535
15699
  setStoreValue
@@ -15573,11 +15737,20 @@ function ListBoxSearch(_ref2) {
15573
15737
  }
15574
15738
  return model.searchListObjectFor(TREE_PATH, searchValue);
15575
15739
  };
15740
+ const beginSelection = () => {
15741
+ const shouldBeginSelection = !selectionState.selectDisabled() && !selections.isModal();
15742
+ if (shouldBeginSelection) {
15743
+ selections.begin('/qListObjectDef');
15744
+ }
15745
+ };
15576
15746
  const handleFocus = () => {
15577
15747
  if (wildCardSearch) {
15578
15748
  setValue(WILDCARD);
15579
15749
  setWildcardOn(true);
15580
15750
  }
15751
+ if (beginSelectionOnFocus) {
15752
+ beginSelection();
15753
+ }
15581
15754
  };
15582
15755
  const hasHits = () => {
15583
15756
  const listCount = getStoreValue("listCount");
@@ -15599,11 +15772,6 @@ function ListBoxSearch(_ref2) {
15599
15772
  }
15600
15773
  return response;
15601
15774
  };
15602
- function focusRow(container) {
15603
- const row = (container === null || container === void 0 ? void 0 : container.querySelector('.last-focused')) || (container === null || container === void 0 ? void 0 : container.querySelector('[role="row"]:first-child'));
15604
- row === null || row === void 0 || row.setAttribute('tabIndex', 0);
15605
- row === null || row === void 0 || row.focus();
15606
- }
15607
15775
  const onKeyDown = async e => {
15608
15776
  const {
15609
15777
  currentTarget
@@ -15617,20 +15785,22 @@ function ListBoxSearch(_ref2) {
15617
15785
  {
15618
15786
  focusRow(container);
15619
15787
  cancel();
15788
+ if (popoverOpen) {
15789
+ return undefined;
15790
+ }
15620
15791
  break;
15621
15792
  }
15622
15793
  case 'Tab':
15623
15794
  {
15624
15795
  if (e.shiftKey) {
15625
- keyboard.focusSelection();
15796
+ if (!focusCyclicButton(container)) {
15797
+ keyboard.focusSelection();
15798
+ }
15799
+ } else if (clearSearchRef.current) {
15800
+ clearSearchRef.current.focus();
15626
15801
  } else {
15627
15802
  // Focus the row we last visited or the first one.
15628
15803
  focusRow(container);
15629
-
15630
- // Clean up.
15631
- container === null || container === void 0 || container.querySelectorAll('.last-focused').forEach(elm => {
15632
- elm.classList.remove('last-focused');
15633
- });
15634
15804
  }
15635
15805
  break;
15636
15806
  }
@@ -15653,6 +15823,37 @@ function ListBoxSearch(_ref2) {
15653
15823
  e.stopPropagation();
15654
15824
  return undefined;
15655
15825
  };
15826
+ const focusOnInput = () => {
15827
+ var _inputRef$current;
15828
+ (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus();
15829
+ };
15830
+ const onClearSearch = () => {
15831
+ abortSearch();
15832
+ focusOnInput();
15833
+ };
15834
+ const onKeyDownClearSearch = async e => {
15835
+ const container = e.currentTarget.closest('.listbox-container');
15836
+ switch (e.key) {
15837
+ case 'Enter':
15838
+ onClearSearch();
15839
+ break;
15840
+ case 'Tab':
15841
+ {
15842
+ if (e.shiftKey) {
15843
+ focusOnInput();
15844
+ } else {
15845
+ // Focus the row we last visited or the first one.
15846
+ focusRow(container);
15847
+ }
15848
+ break;
15849
+ }
15850
+ default:
15851
+ return undefined;
15852
+ }
15853
+ e.preventDefault();
15854
+ e.stopPropagation();
15855
+ return undefined;
15856
+ };
15656
15857
  if (!visible || searchEnabled === false) {
15657
15858
  return null;
15658
15859
  }
@@ -15661,10 +15862,28 @@ function ListBoxSearch(_ref2) {
15661
15862
  dense: dense,
15662
15863
  isRtl: isRtl,
15663
15864
  startAdornment: /*#__PURE__*/React__default.createElement(InputAdornment, {
15664
- position: "start"
15865
+ position: "start",
15866
+ sx: {
15867
+ marginLeft: dense ? '8px' : "".concat(CELL_PADDING_LEFT, "px")
15868
+ }
15665
15869
  }, /*#__PURE__*/React__default.createElement(SearchIcon, {
15666
15870
  size: dense ? 'small' : 'normal'
15667
15871
  })),
15872
+ endAdornment: /*#__PURE__*/React__default.createElement(InputAdornment, {
15873
+ position: "end",
15874
+ sx: {
15875
+ marginLeft: 0
15876
+ }
15877
+ }, value !== '' && /*#__PURE__*/React__default.createElement(StyledIconButton, {
15878
+ tabIndex: 0,
15879
+ ref: clearSearchRef,
15880
+ title: clearSearchText,
15881
+ "aria-label": clearSearchText,
15882
+ onClick: onClearSearch,
15883
+ onKeyDown: onKeyDownClearSearch
15884
+ }, /*#__PURE__*/React__default.createElement(Close, {
15885
+ size: dense ? 'small' : 'normal'
15886
+ }))),
15668
15887
  className: "search",
15669
15888
  inputRef: inputRef,
15670
15889
  size: "small",
@@ -18003,6 +18222,13 @@ const LIGHT = '#FFF';
18003
18222
  const DARK = '#000';
18004
18223
  const CONTRAST_THRESHOLD = 1.5;
18005
18224
  const LIGHT_PREFERRED_THRESHOLD = 3;
18225
+ const DEFAULT_SELECTION_COLORS = {
18226
+ selected: '#009845',
18227
+ alternative: '#E4E4E4',
18228
+ excluded: '#A9A9A9',
18229
+ selectedExcluded: '#A9A9A9',
18230
+ possible: '#FFFFFF'
18231
+ };
18006
18232
  const getContrast = (desired, background) => {
18007
18233
  let contrast = false;
18008
18234
  const des = new Color(desired);
@@ -18054,52 +18280,35 @@ function getOverridesAsObject() {
18054
18280
  return overrides;
18055
18281
  }
18056
18282
  function getSelectionColors(_ref) {
18057
- var _overrides$theme, _theme$palette, _overrides$theme$cont, _overrides$theme2, _overrides$selections, _theme$palette2, _theme$palette3, _theme$palette4, _theme$palette5, _theme$palette6, _theme$palette7, _theme$palette8, _theme$palette9, _theme$palette10, _theme$palette11;
18283
+ var _overrides$theme, _theme$palette, _overrides$theme$cont, _overrides$theme2, _overrides$selections;
18058
18284
  let {
18059
18285
  getColorPickerColor,
18060
18286
  theme,
18061
18287
  getListboxStyle,
18062
18288
  overrides,
18063
- checkboxes
18289
+ checkboxes,
18290
+ themeSelectionColorsEnabled
18064
18291
  } = _ref;
18065
18292
  const componentContentTextColor = (_overrides$theme = overrides.theme) === null || _overrides$theme === void 0 || (_overrides$theme = _overrides$theme.content) === null || _overrides$theme === void 0 ? void 0 : _overrides$theme.fontColor;
18293
+
18294
+ // color priority: layout.component > theme content color > MUI theme
18066
18295
  const desiredTextColor = getColorPickerColor(componentContentTextColor) || getListboxStyle('content', 'color') || ((_theme$palette = theme.palette) === null || _theme$palette === void 0 ? void 0 : _theme$palette.text.primary);
18067
18296
  const useContrastTextColor = !checkboxes && ((_overrides$theme$cont = (_overrides$theme2 = overrides.theme) === null || _overrides$theme2 === void 0 || (_overrides$theme2 = _overrides$theme2.content) === null || _overrides$theme2 === void 0 ? void 0 : _overrides$theme2.useContrastColor) !== null && _overrides$theme$cont !== void 0 ? _overrides$theme$cont : true);
18068
-
18069
- // Background colors
18070
- const selectionColors = ((_overrides$selections = overrides.selections) === null || _overrides$selections === void 0 ? void 0 : _overrides$selections.colors) || {};
18071
- const selected = getColorPickerColor(selectionColors.selected) || ((_theme$palette2 = theme.palette) === null || _theme$palette2 === void 0 ? void 0 : _theme$palette2.selected.main) || '#009845';
18072
- const alternative = getColorPickerColor(selectionColors.alternative) || ((_theme$palette3 = theme.palette) === null || _theme$palette3 === void 0 ? void 0 : _theme$palette3.selected.alternative) || '#E4E4E4';
18073
- const excluded = getColorPickerColor(selectionColors.excluded) || ((_theme$palette4 = theme.palette) === null || _theme$palette4 === void 0 ? void 0 : _theme$palette4.selected.excluded) || '#A9A9A9';
18074
- const selectedExcluded = getColorPickerColor(selectionColors.selectedExcluded) || ((_theme$palette5 = theme.palette) === null || _theme$palette5 === void 0 ? void 0 : _theme$palette5.selected.selectedExcluded) || '#A9A9A9';
18075
- const possible = getColorPickerColor(selectionColors.possible) || getListboxStyle('', 'backgroundColor') || ((_theme$palette6 = theme.palette) === null || _theme$palette6 === void 0 ? void 0 : _theme$palette6.selected.possible) || '#FFFFFF';
18076
-
18077
- // Font colors
18078
- let selectedContrast = desiredTextColor || ((_theme$palette7 = theme.palette) === null || _theme$palette7 === void 0 ? void 0 : _theme$palette7.selected.selectedContrastText);
18079
- let alternativeContrast = desiredTextColor || ((_theme$palette8 = theme.palette) === null || _theme$palette8 === void 0 ? void 0 : _theme$palette8.selected.alternativeContrastText);
18080
- let excludedContrast = desiredTextColor || ((_theme$palette9 = theme.palette) === null || _theme$palette9 === void 0 ? void 0 : _theme$palette9.selected.excludedContrastText);
18081
- let selectedExcludedContrast = desiredTextColor || ((_theme$palette10 = theme.palette) === null || _theme$palette10 === void 0 ? void 0 : _theme$palette10.selected.selectedExcludedContrastText);
18082
- let possibleContrast = desiredTextColor || ((_theme$palette11 = theme.palette) === null || _theme$palette11 === void 0 ? void 0 : _theme$palette11.selected.possibleContrastText);
18083
- if (useContrastTextColor) {
18084
- // Override preferred text color if it does not contrast enough with the background color.
18085
- selectedContrast = getContrastingColor(selected, desiredTextColor);
18086
- alternativeContrast = getContrastingColor(alternative, desiredTextColor);
18087
- excludedContrast = getContrastingColor(excluded, desiredTextColor);
18088
- selectedExcludedContrast = getContrastingColor(selectedExcluded, desiredTextColor);
18089
- possibleContrast = getContrastingColor(possible, desiredTextColor);
18090
- }
18091
- return {
18092
- selected,
18093
- alternative,
18094
- excluded,
18095
- selectedExcluded,
18096
- possible,
18097
- selectedContrast,
18098
- alternativeContrast,
18099
- excludedContrast,
18100
- selectedExcludedContrast,
18101
- possibleContrast
18297
+ const getSelectionThemeColor = state => themeSelectionColorsEnabled ? getListboxStyle('', "dataColors.".concat(state)) : undefined;
18298
+ const componentSelectionColors = ((_overrides$selections = overrides.selections) === null || _overrides$selections === void 0 ? void 0 : _overrides$selections.colors) || {};
18299
+ const getSelectionStateColors = state => {
18300
+ var _theme$palette2, _theme$palette3;
18301
+ const paletteState = state === 'selected' ? 'main' : state;
18302
+ const contrastState = "".concat(state, "Contrast");
18303
+ // color priority: layout.component > theme dataColors > theme background (only for 'possible') > MUI theme > hardcoded default
18304
+ const color = getColorPickerColor(componentSelectionColors[state]) || getSelectionThemeColor(state) || state === 'possible' && getListboxStyle('', 'backgroundColor') || ((_theme$palette2 = theme.palette) === null || _theme$palette2 === void 0 ? void 0 : _theme$palette2.selected[paletteState]) || DEFAULT_SELECTION_COLORS[state];
18305
+ const contrastColor = useContrastTextColor ? getContrastingColor(color, desiredTextColor) : desiredTextColor || ((_theme$palette3 = theme.palette) === null || _theme$palette3 === void 0 ? void 0 : _theme$palette3.selected["".concat(contrastState, "Text}")]);
18306
+ return {
18307
+ [state]: color,
18308
+ [contrastState]: contrastColor
18309
+ };
18102
18310
  };
18311
+ return _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, getSelectionStateColors('selected')), getSelectionStateColors('alternative')), getSelectionStateColors('excluded')), getSelectionStateColors('selectedExcluded')), getSelectionStateColors('possible'));
18103
18312
  }
18104
18313
  function getBackgroundColor(_ref2) {
18105
18314
  let {
@@ -18137,7 +18346,8 @@ function getStyles(_ref3) {
18137
18346
  themeApi,
18138
18347
  theme,
18139
18348
  components = [],
18140
- checkboxes = false
18349
+ checkboxes = false,
18350
+ themeSelectionColorsEnabled = false
18141
18351
  } = _ref3;
18142
18352
  const overrides = getOverridesAsObject(components);
18143
18353
  const getListboxStyle = (path, prop) => themeApi.getStyle('object.listBox', path, prop);
@@ -18147,7 +18357,8 @@ function getStyles(_ref3) {
18147
18357
  theme,
18148
18358
  getListboxStyle,
18149
18359
  overrides,
18150
- checkboxes
18360
+ checkboxes,
18361
+ themeSelectionColorsEnabled
18151
18362
  });
18152
18363
  const themeOverrides = overrides.theme || {};
18153
18364
  const headerColor = getColorPickerColor((_themeOverrides$heade = themeOverrides.header) === null || _themeOverrides$heade === void 0 ? void 0 : _themeOverrides$heade.fontColor) || getListboxStyle('title.main', 'color');
@@ -18221,7 +18432,8 @@ function ListBoxPopover(_ref) {
18221
18432
  autoFocus,
18222
18433
  components,
18223
18434
  checkboxes: checkboxesOption,
18224
- selectDisabled = () => false
18435
+ selectDisabled = () => false,
18436
+ flags
18225
18437
  } = _ref;
18226
18438
  const isMasterDim = Boolean(fieldName === null || fieldName === void 0 ? void 0 : fieldName.qLibraryId);
18227
18439
  const open = show && Boolean(alignTo.current);
@@ -18261,7 +18473,8 @@ function ListBoxPopover(_ref) {
18261
18473
  }, [model]);
18262
18474
  const {
18263
18475
  translator,
18264
- themeApi
18476
+ themeApi,
18477
+ keyboardNavigation
18265
18478
  } = useContext(InstanceContext);
18266
18479
  const moreAlignTo = useRef();
18267
18480
  const containerRef = useRef();
@@ -18270,14 +18483,20 @@ function ListBoxPopover(_ref) {
18270
18483
  const [selectionState$1] = useState$1(() => selectionState({
18271
18484
  selectDisabled
18272
18485
  }));
18486
+ const keyboard = useTempKeyboard({
18487
+ containerRef,
18488
+ enabled: keyboardNavigation
18489
+ });
18273
18490
  const {
18274
18491
  checkboxes = checkboxesOption
18275
18492
  } = layout || {};
18493
+ const themeSelectionColorsEnabled = flags === null || flags === void 0 ? void 0 : flags.isEnabled('PS_22149_THEME_SELECTION_COLORS');
18276
18494
  const styles = getStyles({
18277
18495
  themeApi,
18278
18496
  theme,
18279
18497
  components,
18280
- checkboxes
18498
+ checkboxes,
18499
+ themeSelectionColorsEnabled
18281
18500
  });
18282
18501
  useEffect$1(() => {
18283
18502
  if (selections && open) {
@@ -18299,7 +18518,8 @@ function ListBoxPopover(_ref) {
18299
18518
  layout,
18300
18519
  model,
18301
18520
  translator,
18302
- selectionState: selectionState$1
18521
+ selectionState: selectionState$1,
18522
+ selections
18303
18523
  });
18304
18524
  const onCtrlF = () => {
18305
18525
  const input = searchContainerRef.current.querySelector('input');
@@ -18307,6 +18527,7 @@ function ListBoxPopover(_ref) {
18307
18527
  };
18308
18528
  const hasSelections$1 = hasSelections(layout);
18309
18529
  return /*#__PURE__*/React__default.createElement(Popover, {
18530
+ className: "listbox-container",
18310
18531
  open: open,
18311
18532
  onClose: popoverClose,
18312
18533
  anchorEl: alignTo.current,
@@ -18379,6 +18600,7 @@ function ListBoxPopover(_ref) {
18379
18600
  item: true,
18380
18601
  ref: searchContainerRef
18381
18602
  }, /*#__PURE__*/React__default.createElement(ListBoxSearch, {
18603
+ popoverOpen: open,
18382
18604
  styles: styles,
18383
18605
  visible: true,
18384
18606
  model: model,
@@ -18386,7 +18608,9 @@ function ListBoxPopover(_ref) {
18386
18608
  selections: selections,
18387
18609
  selectionState: selectionState$1,
18388
18610
  keyboard: {
18389
- enabled: false
18611
+ enabled: false,
18612
+ innerTabStops: true,
18613
+ focusSelection: keyboard.focusSelection
18390
18614
  },
18391
18615
  autoFocus: autoFocus !== null && autoFocus !== void 0 ? autoFocus : true
18392
18616
  })), /*#__PURE__*/React__default.createElement(ListBox, {
@@ -18398,7 +18622,8 @@ function ListBoxPopover(_ref) {
18398
18622
  direction: "ltr",
18399
18623
  onSetListCount: c => setListCount(c),
18400
18624
  onCtrlF: onCtrlF,
18401
- styles: styles
18625
+ styles: styles,
18626
+ keyboard: keyboard
18402
18627
  }))));
18403
18628
  }
18404
18629
 
@@ -19555,114 +19780,17 @@ class AutoSizer extends Component {
19555
19780
  }
19556
19781
  }
19557
19782
 
19558
- function removeInnnerTabStops(container) {
19559
- container === null || container === void 0 || container.querySelectorAll('[tabIndex="0"]').forEach(elm => {
19560
- elm.setAttribute('tabIndex', -1);
19561
- });
19562
- }
19563
- function removeLastFocused(container) {
19564
- container === null || container === void 0 || container.querySelectorAll('.last-focused').forEach(elm => {
19565
- elm.classList.remove('last-focused');
19566
- });
19567
- }
19568
- function getVizCell(container) {
19569
- return (container === null || container === void 0 ? void 0 : container.closest('.njs-cell')) || (container === null || container === void 0 ? void 0 : container.closest('.qv-gridcell'));
19570
- }
19571
-
19572
- // Emulate the keyboard hook, until we support it in the Listbox.
19573
- function useTempKeyboard(_ref) {
19574
- let {
19575
- containerRef,
19576
- enabled
19577
- } = _ref;
19578
- const [keyboardActive, setKeyboardActive] = useState$1(false);
19579
- const keyboard = {
19580
- enabled,
19581
- active: keyboardActive,
19582
- // innerTabStops: whether keyboard permits inner tab stops
19583
- // (inner = everything inside .listbox-container)
19584
-
19585
- innerTabStops: !enabled || keyboardActive,
19586
- blur(resetFocus) {
19587
- var _containerRef$current;
19588
- if (!enabled) {
19589
- return;
19590
- }
19591
- setKeyboardActive(false);
19592
- const vizCell = getVizCell(containerRef.current) || ((_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.parentElement);
19593
- removeInnnerTabStops(containerRef.current);
19594
- removeLastFocused(containerRef.current);
19595
- if (resetFocus && vizCell) {
19596
- // Move focus to the viz's cell.
19597
- vizCell.setAttribute('tabIndex', 0);
19598
- vizCell.focus();
19599
- }
19600
- },
19601
- focus() {
19602
- if (!enabled) {
19603
- return;
19604
- }
19605
- setKeyboardActive(true);
19606
- const c = containerRef.current;
19607
- const searchField = c === null || c === void 0 ? void 0 : c.querySelector('.search input');
19608
- const lastSelectedRow = c === null || c === void 0 ? void 0 : c.querySelector('.value.last-focused');
19609
- const firstRowElement = c === null || c === void 0 ? void 0 : c.querySelector('.value.selector, .value');
19610
- const confirmButton = c === null || c === void 0 ? void 0 : c.querySelector('.actions-toolbar-default-actions .actions-toolbar-confirm');
19611
- const unlockCoverButton = c === null || c === void 0 ? void 0 : c.querySelector('#listbox-unlock-button');
19612
- const elementToFocus = searchField || lastSelectedRow || firstRowElement || unlockCoverButton || confirmButton;
19613
- elementToFocus === null || elementToFocus === void 0 || elementToFocus.setAttribute('tabIndex', 0);
19614
- elementToFocus === null || elementToFocus === void 0 || elementToFocus.focus();
19615
- },
19616
- focusSelection() {
19617
- const unlockCoverButton = document.querySelector('#listbox-unlock-button');
19618
- const confirmButton = document.querySelector('.actions-toolbar-default-actions .actions-toolbar-confirm');
19619
- const btnToFocus = unlockCoverButton || confirmButton;
19620
- btnToFocus === null || btnToFocus === void 0 || btnToFocus.setAttribute('tabIndex', 0);
19621
- btnToFocus === null || btnToFocus === void 0 || btnToFocus.focus();
19622
- }
19623
- };
19624
- return keyboard;
19625
- }
19626
-
19627
19783
  /* eslint-disable no-param-reassign */
19628
19784
  function getListboxContainerKeyboardNavigation(_ref) {
19629
19785
  let {
19630
19786
  keyboard,
19631
19787
  hovering,
19632
19788
  updateKeyScroll,
19633
- containerRef,
19634
19789
  currentScrollIndex,
19635
19790
  isModal,
19636
- constraints
19791
+ constraints,
19792
+ selections
19637
19793
  } = _ref;
19638
- const blur = event => {
19639
- const {
19640
- currentTarget,
19641
- target
19642
- } = event;
19643
- const isFocusedOnListbox = target.classList.contains('listbox-container');
19644
- const container = currentTarget.closest('.listbox-container');
19645
- const vizCell = getVizCell(container);
19646
- const isSingleListbox = (vizCell === null || vizCell === void 0 ? void 0 : vizCell.querySelectorAll('.listbox-container').length) === 1;
19647
- if (isFocusedOnListbox || isSingleListbox) {
19648
- // Move the focus from listbox container to the viz container.
19649
- keyboard.blur(true);
19650
- } else {
19651
- // More than one listbox: Move focus from row to listbox container.
19652
-
19653
- // 1. Remove last-focused class from row siblings.
19654
- removeLastFocused(containerRef.current);
19655
-
19656
- // 2. Add last-focused class so we can re-focus it later.
19657
- currentTarget.classList.add('last-focused');
19658
-
19659
- // 3. Blur row and focus the listbox container.
19660
- keyboard.blur();
19661
- const c = currentTarget.closest('.listbox-container');
19662
- c.setAttribute('tabIndex', -1);
19663
- c === null || c === void 0 || c.focus();
19664
- }
19665
- };
19666
19794
  const handleKeyDown = event => {
19667
19795
  const {
19668
19796
  keyCode,
@@ -19680,16 +19808,18 @@ function getListboxContainerKeyboardNavigation(_ref) {
19680
19808
  const inSelection = isModal();
19681
19809
  switch (keyCode) {
19682
19810
  case KEYS.TAB:
19683
- if (inSelection) {
19684
- if (shiftKey) {
19685
- focusRow(container) || focusSearch(container);
19686
- } else {
19687
- focusSearch(container) || focusRow(container);
19811
+ // Only react to tab after enter/space have been pressed or the target element is inside listbox (mouse case) or target is selection toolbar
19812
+ if (document.activeElement === container || !inSelection && !container.contains(document.activeElement)) return;
19813
+ if (shiftKey) {
19814
+ const focused = focusRow(container) || focusSearch(container);
19815
+ if (!focused) {
19816
+ blur$1(event, keyboard);
19688
19817
  }
19689
- } else if (shiftKey) {
19690
- keyboard.blur(true);
19691
19818
  } else {
19692
- break;
19819
+ const focused = focusCyclicButton(container) || focusSearch(container) || focusRow(container);
19820
+ if (!focused) {
19821
+ break;
19822
+ }
19693
19823
  }
19694
19824
  prevent();
19695
19825
  break;
@@ -19702,7 +19832,10 @@ function getListboxContainerKeyboardNavigation(_ref) {
19702
19832
  prevent();
19703
19833
  break;
19704
19834
  case KEYS.ESCAPE:
19705
- blur(event);
19835
+ blur$1(event, keyboard);
19836
+ if (selections.isActive()) {
19837
+ selections.cancel();
19838
+ }
19706
19839
  break;
19707
19840
  }
19708
19841
  };
@@ -20019,7 +20152,8 @@ const createDimensionIconData = _ref => {
20019
20152
  app,
20020
20153
  selections,
20021
20154
  isPopover,
20022
- active
20155
+ active,
20156
+ keyboard
20023
20157
  } = _ref;
20024
20158
  switch (dimInfo.qGrouping) {
20025
20159
  case dimensionTypes.drillDown:
@@ -20031,21 +20165,52 @@ const createDimensionIconData = _ref => {
20031
20165
  case dimensionTypes.cyclic:
20032
20166
  {
20033
20167
  const clickable = app && active;
20168
+ const stepToNextField = () => {
20169
+ if (!isPopover) {
20170
+ selections.confirm();
20171
+ }
20172
+ app.getDimension(dimInfo.qLibraryId).then(dimensionModel => {
20173
+ if (!dimensionModel.stepCycle) {
20174
+ // eslint-disable-next-line no-console
20175
+ console.log("engine api spec version doesn't have support for function stepCycle");
20176
+ return;
20177
+ }
20178
+ dimensionModel.stepCycle(1);
20179
+ }).catch(() => null);
20180
+ };
20034
20181
  return {
20035
20182
  icon: clickable ? ReloadIcon : CyclicIcon,
20036
20183
  tooltip: 'Listbox.Cyclic',
20037
- onClick: clickable ? () => {
20038
- if (!isPopover) {
20039
- selections.confirm();
20040
- }
20041
- app.getDimension(dimInfo.qLibraryId).then(dimensionModel => {
20042
- if (!dimensionModel.stepCycle) {
20043
- // eslint-disable-next-line no-console
20044
- console.log("engine api spec version doesn't have support for function stepCycle");
20184
+ onClick: clickable ? stepToNextField : undefined,
20185
+ onKeyDown: clickable ? event => {
20186
+ const container = event.currentTarget.closest('.listbox-container');
20187
+ switch (event.keyCode) {
20188
+ case KEYS.SPACE:
20189
+ case KEYS.ENTER:
20190
+ stepToNextField();
20191
+ break;
20192
+ case KEYS.TAB:
20193
+ {
20194
+ const useDefaultBrowserSupport = !keyboard.enabled;
20195
+ if (useDefaultBrowserSupport) {
20196
+ return;
20197
+ }
20198
+ let focused;
20199
+ if (event.shiftKey) {
20200
+ focused = keyboard.focusSelection();
20201
+ } else {
20202
+ focused = focusSearch(container) || focusRow(container);
20203
+ }
20204
+ if (!focused) {
20205
+ blur$1(event, keyboard);
20206
+ }
20207
+ }
20208
+ break;
20209
+ default:
20045
20210
  return;
20046
- }
20047
- dimensionModel.stepCycle(1);
20048
- }).catch(() => null);
20211
+ }
20212
+ event.preventDefault();
20213
+ event.stopPropagation();
20049
20214
  } : undefined
20050
20215
  };
20051
20216
  }
@@ -20069,13 +20234,15 @@ function DimensionIcon(_ref) {
20069
20234
  iconData,
20070
20235
  translator,
20071
20236
  iconStyle,
20072
- disabled
20237
+ disabled,
20238
+ keyboard
20073
20239
  } = _ref;
20074
20240
  if (!iconData) return undefined;
20075
20241
  const {
20076
20242
  icon,
20077
20243
  tooltip,
20078
- onClick
20244
+ onClick = undefined,
20245
+ onKeyDown = undefined
20079
20246
  } = iconData;
20080
20247
  const Icon = icon;
20081
20248
  const title = translator.get(tooltip);
@@ -20083,11 +20250,14 @@ function DimensionIcon(_ref) {
20083
20250
  return isButton ? /*#__PURE__*/React__default.createElement(StyledButton, {
20084
20251
  variant: "outlined",
20085
20252
  onClick: onClick,
20086
- tabIndex: -1,
20253
+ tabIndex: keyboard.innerTabStops ? 0 : -1,
20087
20254
  title: title,
20088
20255
  size: "large",
20089
20256
  disableRipple: true,
20090
- disabled: disabled
20257
+ disabled: disabled,
20258
+ onKeyDown: onKeyDown,
20259
+ className: "listbox-cyclic-button",
20260
+ "data-testid": "listbox-cyclic-button"
20091
20261
  }, /*#__PURE__*/React__default.createElement(Icon, {
20092
20262
  style: iconStyle
20093
20263
  })) : /*#__PURE__*/React__default.createElement(Icon, {
@@ -20155,8 +20325,7 @@ function ListBoxHeader(_ref2) {
20155
20325
  selections,
20156
20326
  keyboard,
20157
20327
  autoConfirm,
20158
- app,
20159
- isInSelection
20328
+ app
20160
20329
  } = _ref2;
20161
20330
  const [isToolbarDetached, setIsToolbarDetached] = useState$1(showDetachedToolbarOnly);
20162
20331
  const [isLocked, setLocked] = useState$1(layout === null || layout === void 0 || (_layout$qListObject = layout.qListObject) === null || _layout$qListObject === void 0 || (_layout$qListObject = _layout$qListObject.qDimensionInfo) === null || _layout$qListObject === void 0 ? void 0 : _layout$qListObject.qLocked);
@@ -20171,7 +20340,8 @@ function ListBoxHeader(_ref2) {
20171
20340
  app,
20172
20341
  selections,
20173
20342
  isPopover,
20174
- active: !(constraints !== null && constraints !== void 0 && constraints.active)
20343
+ active: !(constraints !== null && constraints !== void 0 && constraints.active),
20344
+ keyboard
20175
20345
  });
20176
20346
  const showUnlock = showLock && isLocked;
20177
20347
  const showLockIcon = !showLock && isLocked; // shows instead of the cover button when field/dim is locked.
@@ -20194,7 +20364,8 @@ function ListBoxHeader(_ref2) {
20194
20364
  model,
20195
20365
  translator,
20196
20366
  selectionState,
20197
- isDirectQuery
20367
+ isDirectQuery,
20368
+ selections
20198
20369
  });
20199
20370
  const extraItems = isLocked || !showLock ? undefined : [{
20200
20371
  key: 'lock',
@@ -20238,6 +20409,7 @@ function ListBoxHeader(_ref2) {
20238
20409
  isDetached: isPopover ? false : isToolbarDetached,
20239
20410
  showToolbar,
20240
20411
  containerRef,
20412
+ isPopover,
20241
20413
  isLocked,
20242
20414
  extraItems,
20243
20415
  listboxSelectionToolbarItems,
@@ -20283,8 +20455,9 @@ function ListBoxHeader(_ref2) {
20283
20455
  }, lockedIconComp || showSearchIcon && searchIconComp, /*#__PURE__*/React__default.createElement(DimensionIcon, {
20284
20456
  iconData: iconData,
20285
20457
  iconStyle: iconStyle,
20286
- disabled: isInSelection && isPopover,
20287
- translator: translator
20458
+ disabled: selections.isActive() && isPopover,
20459
+ translator: translator,
20460
+ keyboard: keyboard
20288
20461
  })), /*#__PURE__*/React__default.createElement(Grid, {
20289
20462
  item: true,
20290
20463
  xs: true,
@@ -20380,7 +20553,8 @@ function ListBoxInline(_ref3) {
20380
20553
  isPopover = false,
20381
20554
  showLock = false,
20382
20555
  components,
20383
- selectDisabled = () => false
20556
+ selectDisabled = () => false,
20557
+ flags
20384
20558
  } = options;
20385
20559
 
20386
20560
  // Hook that will trigger update when used in useEffects.
@@ -20404,12 +20578,14 @@ function ListBoxInline(_ref3) {
20404
20578
  const {
20405
20579
  checkboxes = checkboxesOption
20406
20580
  } = layout || {};
20581
+ const themeSelectionColorsEnabled = flags === null || flags === void 0 ? void 0 : flags.isEnabled('PS_22149_THEME_SELECTION_COLORS');
20407
20582
  const styles = getStyles({
20408
20583
  app,
20409
20584
  themeApi,
20410
20585
  theme,
20411
20586
  components,
20412
- checkboxes
20587
+ checkboxes,
20588
+ themeSelectionColorsEnabled
20413
20589
  });
20414
20590
  const isDirectQuery = isDirectQueryEnabled({
20415
20591
  appLayout: app === null || app === void 0 ? void 0 : app.layout
@@ -20444,7 +20620,6 @@ function ListBoxInline(_ref3) {
20444
20620
  }), [app, appSelections]);
20445
20621
  const isInvalid = layout === null || layout === void 0 ? void 0 : layout.qListObject.qDimensionInfo.qError;
20446
20622
  const errorText = isInvalid && constraints.active ? 'Visualization.Invalid.Dimension' : 'Visualization.Incomplete';
20447
- const [isInSelection, setIsInSelection] = useState$1(false);
20448
20623
  const {
20449
20624
  handleKeyDown,
20450
20625
  handleOnMouseEnter,
@@ -20459,7 +20634,8 @@ function ListBoxInline(_ref3) {
20459
20634
  app,
20460
20635
  appSelections,
20461
20636
  constraints,
20462
- isModal: isModalMode
20637
+ isModal: isModalMode,
20638
+ selections
20463
20639
  }), [keyboard, hovering, updateKeyScroll, containerRef, currentScrollIndex, app, appSelections, constraints, isModalMode]);
20464
20640
  useEffect$1(() => {
20465
20641
  document.addEventListener('keydown', globalKeyDown);
@@ -20473,11 +20649,9 @@ function ListBoxInline(_ref3) {
20473
20649
  }
20474
20650
  const show = () => {
20475
20651
  setShowToolbar(true);
20476
- setIsInSelection(true);
20477
20652
  };
20478
20653
  const hide = () => {
20479
20654
  setShowToolbar(false);
20480
- setIsInSelection(false);
20481
20655
  if (search === 'toggle') {
20482
20656
  setShowSearch(false);
20483
20657
  }
@@ -20495,7 +20669,7 @@ function ListBoxInline(_ref3) {
20495
20669
  selections.on('activated', show);
20496
20670
  selections.on('deactivated', hide);
20497
20671
  }
20498
- setShowToolbar(selections.isActive());
20672
+ setShowToolbar(isPopover || selections.isActive());
20499
20673
  }
20500
20674
  return () => {
20501
20675
  if (selections && selections.removeListener) {
@@ -20579,8 +20753,7 @@ function ListBoxInline(_ref3) {
20579
20753
  model: model,
20580
20754
  selectionState: selectionState$1,
20581
20755
  selections: selections,
20582
- keyboard: keyboard,
20583
- isInSelection: isInSelection
20756
+ keyboard: keyboard
20584
20757
  });
20585
20758
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, showDetachedToolbarOnly && listBoxHeader, /*#__PURE__*/React__default.createElement(StyledGrid$3, {
20586
20759
  className: "listbox-container",
@@ -20623,6 +20796,7 @@ function ListBoxInline(_ref3) {
20623
20796
  visible: searchVisible,
20624
20797
  search: search,
20625
20798
  autoFocus: shouldAutoFocus,
20799
+ beginSelectionOnFocus: !isPopover,
20626
20800
  wildCardSearch: wildCardSearch,
20627
20801
  searchEnabled: searchEnabled,
20628
20802
  direction: direction,
@@ -21122,7 +21296,8 @@ function ListBoxWrapper(_ref) {
21122
21296
  stateName,
21123
21297
  element,
21124
21298
  options,
21125
- renderedCallback
21299
+ renderedCallback,
21300
+ flags
21126
21301
  } = _ref;
21127
21302
  const {
21128
21303
  isExistingObject,
@@ -21159,7 +21334,8 @@ function ListBoxWrapper(_ref) {
21159
21334
  selections,
21160
21335
  model,
21161
21336
  app,
21162
- renderedCallback
21337
+ renderedCallback,
21338
+ flags
21163
21339
  }), [options, selections, model, app]);
21164
21340
  if (!selections || !model) {
21165
21341
  return null;
@@ -21176,7 +21352,8 @@ function ListBoxPortal(_ref2) {
21176
21352
  qId,
21177
21353
  stateName = '$',
21178
21354
  options = {},
21179
- renderedCallback
21355
+ renderedCallback,
21356
+ flags
21180
21357
  } = _ref2;
21181
21358
  return ReactDOM.createPortal( /*#__PURE__*/React__default.createElement(ListBoxWrapper, {
21182
21359
  app: app,
@@ -21185,7 +21362,8 @@ function ListBoxPortal(_ref2) {
21185
21362
  qId: qId,
21186
21363
  stateName: stateName,
21187
21364
  options: options,
21188
- renderedCallback: renderedCallback
21365
+ renderedCallback: renderedCallback,
21366
+ flags: flags
21189
21367
  }), element, uid());
21190
21368
  }
21191
21369
 
@@ -21212,7 +21390,8 @@ function ListBoxPopoverWrapper(_ref) {
21212
21390
  fieldIdentifier,
21213
21391
  stateName,
21214
21392
  element,
21215
- options = {}
21393
+ options = {},
21394
+ flags
21216
21395
  } = _ref;
21217
21396
  const [showState, setShowstate] = useState$1(!!options.show);
21218
21397
  const handleCloseShowState = () => {
@@ -21233,7 +21412,8 @@ function ListBoxPopoverWrapper(_ref) {
21233
21412
  fieldName: fieldIdentifier,
21234
21413
  stateName: stateName,
21235
21414
  autoFocus: options.autoFocus,
21236
- components: options.components
21415
+ components: options.components,
21416
+ flags: flags
21237
21417
  });
21238
21418
  }
21239
21419
 
@@ -27798,6 +27978,8 @@ var hasRequiredRange;
27798
27978
  function requireRange() {
27799
27979
  if (hasRequiredRange) return range;
27800
27980
  hasRequiredRange = 1;
27981
+ const SPACE_CHARACTERS = /\s+/g;
27982
+
27801
27983
  // hoisted class for cyclic dependency
27802
27984
  class Range {
27803
27985
  constructor(range, options) {
@@ -27813,7 +27995,7 @@ function requireRange() {
27813
27995
  // just put it in the set and return
27814
27996
  this.raw = range.value;
27815
27997
  this.set = [[range]];
27816
- this.format();
27998
+ this.formatted = undefined;
27817
27999
  return this;
27818
28000
  }
27819
28001
  this.options = options;
@@ -27823,7 +28005,7 @@ function requireRange() {
27823
28005
  // First reduce all whitespace as much as possible so we do not have to rely
27824
28006
  // on potentially slow regexes like \s*. This is then stored and used for
27825
28007
  // future error messages as well.
27826
- this.raw = range.trim().split(/\s+/).join(' ');
28008
+ this.raw = range.trim().replace(SPACE_CHARACTERS, ' ');
27827
28009
 
27828
28010
  // First, split on ||
27829
28011
  this.set = this.raw.split('||')
@@ -27854,10 +28036,27 @@ function requireRange() {
27854
28036
  }
27855
28037
  }
27856
28038
  }
27857
- this.format();
28039
+ this.formatted = undefined;
28040
+ }
28041
+ get range() {
28042
+ if (this.formatted === undefined) {
28043
+ this.formatted = '';
28044
+ for (let i = 0; i < this.set.length; i++) {
28045
+ if (i > 0) {
28046
+ this.formatted += '||';
28047
+ }
28048
+ const comps = this.set[i];
28049
+ for (let k = 0; k < comps.length; k++) {
28050
+ if (k > 0) {
28051
+ this.formatted += ' ';
28052
+ }
28053
+ this.formatted += comps[k].toString().trim();
28054
+ }
28055
+ }
28056
+ }
28057
+ return this.formatted;
27858
28058
  }
27859
28059
  format() {
27860
- this.range = this.set.map(comps => comps.join(' ').trim()).join('||').trim();
27861
28060
  return this.range;
27862
28061
  }
27863
28062
  toString() {
@@ -28973,7 +29172,8 @@ function nuked() {
28973
29172
  onSelectionDeactivated
28974
29173
  }, options)),
28975
29174
  stateName: options.stateName || '$',
28976
- renderedCallback: resolve
29175
+ renderedCallback: resolve,
29176
+ flags: halo.public.galaxy.flags
28977
29177
  });
28978
29178
  root.add(this._instance);
28979
29179
  });
@@ -29027,7 +29227,8 @@ function nuked() {
29027
29227
  app,
29028
29228
  fieldIdentifier,
29029
29229
  options: opts,
29030
- stateName: options.stateName || '$'
29230
+ stateName: options.stateName || '$',
29231
+ flags: halo.public.galaxy.flags
29031
29232
  });
29032
29233
  root.add(api._popoverInstance);
29033
29234
  }