@nebula.js/stardust 4.2.1 → 4.2.3

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.2.1
2
+ * @nebula.js/stardust v4.2.3
3
3
  * Copyright (c) 2023 QlikTech International AB
4
4
  * Released under the MIT license.
5
5
  */
@@ -1898,6 +1898,24 @@ var Visualization_UnfulfilledCalculationCondition = {
1898
1898
  "zh-TW": "不符計算條件"
1899
1899
  }
1900
1900
  };
1901
+ var ScreenReader_OneSearchResult = {
1902
+ id: "ScreenReader.OneSearchResult",
1903
+ locale: {
1904
+ "en-US": "There is one available result"
1905
+ }
1906
+ };
1907
+ var ScreenReader_ManySearchResults = {
1908
+ id: "ScreenReader.ManySearchResults",
1909
+ locale: {
1910
+ "en-US": "There are {0} available results"
1911
+ }
1912
+ };
1913
+ var ScreenReader_SearchFieldLabel = {
1914
+ id: "ScreenReader.SearchFieldLabel",
1915
+ locale: {
1916
+ "en-US": "Search Field"
1917
+ }
1918
+ };
1901
1919
  var all = {
1902
1920
  Cancel: Cancel$1,
1903
1921
  CurrentSelections_All: CurrentSelections_All,
@@ -1948,7 +1966,10 @@ var all = {
1948
1966
  Visualization_Invalid_Dimension: Visualization_Invalid_Dimension,
1949
1967
  Visualization_Invalid_Measure: Visualization_Invalid_Measure,
1950
1968
  Visualization_LayoutError: Visualization_LayoutError,
1951
- Visualization_UnfulfilledCalculationCondition: Visualization_UnfulfilledCalculationCondition
1969
+ Visualization_UnfulfilledCalculationCondition: Visualization_UnfulfilledCalculationCondition,
1970
+ ScreenReader_OneSearchResult: ScreenReader_OneSearchResult,
1971
+ ScreenReader_ManySearchResults: ScreenReader_ManySearchResults,
1972
+ ScreenReader_SearchFieldLabel: ScreenReader_SearchFieldLabel
1952
1973
  };
1953
1974
 
1954
1975
  function appLocaleFn(language) {
@@ -8373,7 +8394,7 @@ function create$3(definition) {
8373
8394
  return cache[key];
8374
8395
  }
8375
8396
 
8376
- const NEBULA_VERSION_HASH = "65bf" ;
8397
+ const NEBULA_VERSION_HASH = "e554" ;
8377
8398
  ClassNameGenerator$1.configure(componentName => {
8378
8399
  return "njs-".concat(NEBULA_VERSION_HASH, "-").concat(componentName.replace('Mui', ''));
8379
8400
  });
@@ -8620,7 +8641,7 @@ function boot(_ref2) {
8620
8641
  const appRef = React__default.createRef();
8621
8642
  const element = document.createElement('div');
8622
8643
  element.style.display = 'none';
8623
- element.setAttribute('data-nebulajs-version', "4.2.1" );
8644
+ element.setAttribute('data-nebulajs-version', "4.2.3" );
8624
8645
  element.setAttribute('data-app-id', app.id);
8625
8646
  document.body.appendChild(element);
8626
8647
  if (context) {
@@ -10610,6 +10631,21 @@ function ScreenReaderForSelections(_ref2) {
10610
10631
  "aria-live": "assertive"
10611
10632
  }, text);
10612
10633
  }
10634
+ function getScreenReaderSearchText(listCount) {
10635
+ let t;
10636
+ switch (listCount) {
10637
+ case 0:
10638
+ t = 'Listbox.NoMatchesForYourTerms';
10639
+ break;
10640
+ case 1:
10641
+ t = 'ScreenReader.OneSearchResult';
10642
+ break;
10643
+ default:
10644
+ t = 'ScreenReader.ManySearchResults';
10645
+ break;
10646
+ }
10647
+ return t;
10648
+ }
10613
10649
 
10614
10650
  const KEYS = Object.freeze({
10615
10651
  ENTER: 13,
@@ -12993,7 +13029,7 @@ function useListSizes(_ref) {
12993
13029
  const {
12994
13030
  fontSize = '12px',
12995
13031
  fontFamily = 'Source sans pro'
12996
- } = ((_theme$listBox = theme.listBox) === null || _theme$listBox === void 0 ? void 0 : _theme$listBox.content) || {};
13032
+ } = (theme === null || theme === void 0 ? void 0 : (_theme$listBox = theme.listBox) === null || _theme$listBox === void 0 ? void 0 : _theme$listBox.content) || {};
12997
13033
  const font = "".concat(fontSize, " ").concat(fontFamily); // font format as supported by HTML canvas
12998
13034
  const textWidth = useTextWidth({
12999
13035
  text: getMeasureText(layout),
@@ -13698,6 +13734,7 @@ function ListBox(_ref) {
13698
13734
  checkboxes = checkboxOption,
13699
13735
  histogram
13700
13736
  } = layout !== null && layout !== void 0 ? layout : {};
13737
+ const [screenReaderText, setScreenReaderText] = useState$1('');
13701
13738
  const loaderRef = useRef(null);
13702
13739
  const local = useRef({
13703
13740
  queue: [],
@@ -13725,6 +13762,7 @@ function ListBox(_ref) {
13725
13762
  }),
13726
13763
  itemsLoader = _objectWithoutProperties(_useItemsLoader, _excluded$4);
13727
13764
  const {
13765
+ getStoreValue,
13728
13766
  setStoreValue
13729
13767
  } = useDataStore(model);
13730
13768
  const loadMoreItems = useCallback(itemsLoader.loadMoreItems, [layout]);
@@ -13855,6 +13893,14 @@ function ListBox(_ref) {
13855
13893
  listCount
13856
13894
  } = sizes;
13857
13895
  setStoreValue('listCount', listCount);
13896
+ const inputText = getStoreValue('inputText');
13897
+ useEffect$1(() => {
13898
+ if (inputText) {
13899
+ const srText = getScreenReaderSearchText(listCount);
13900
+ const srFinalText = translator.get(srText, [listCount]);
13901
+ setScreenReaderText(srFinalText);
13902
+ }
13903
+ }, [inputText, listCount]);
13858
13904
  const setScrollPosition = position => {
13859
13905
  const {
13860
13906
  scrollIndex,
@@ -13966,7 +14012,10 @@ function ListBox(_ref) {
13966
14012
  return /*#__PURE__*/React__default.createElement(StyledWrapper, null, /*#__PURE__*/React__default.createElement(ScreenReaderForSelections, {
13967
14013
  className: "screenReaderOnly",
13968
14014
  layout: layout
13969
- }), !listCount && cardinal > 0 && /*#__PURE__*/React__default.createElement(ListBoxDisclaimer, {
14015
+ }), /*#__PURE__*/React__default.createElement("div", {
14016
+ className: "screenReaderOnly",
14017
+ "aria-live": "assertive"
14018
+ }, screenReaderText), !listCount && cardinal > 0 && /*#__PURE__*/React__default.createElement(ListBoxDisclaimer, {
13970
14019
  width: width,
13971
14020
  text: "Listbox.NoMatchesForYourTerms"
13972
14021
  }), /*#__PURE__*/React__default.createElement(InfiniteLoader, {
@@ -14675,7 +14724,8 @@ function ListBoxSearch(_ref3) {
14675
14724
  const inputRef = useRef();
14676
14725
  const theme = useTheme$1();
14677
14726
  const {
14678
- getStoreValue
14727
+ getStoreValue,
14728
+ setStoreValue
14679
14729
  } = useDataStore(model);
14680
14730
  const isRtl = direction === 'rtl';
14681
14731
  const inpuTextAlign = isRtl ? 'right' : 'left';
@@ -14708,6 +14758,9 @@ function ListBoxSearch(_ref3) {
14708
14758
  setWildcardOn(false);
14709
14759
  }
14710
14760
  }, [wildcardOn, inputRef.current]);
14761
+ useEffect$1(() => {
14762
+ setStoreValue('inputText', value);
14763
+ }, [value]);
14711
14764
  const onChange = async e => {
14712
14765
  setValue(e.target.value);
14713
14766
  if (!e.target.value.length) {
@@ -14842,7 +14895,8 @@ function ListBoxSearch(_ref3) {
14842
14895
  style: {
14843
14896
  textAlign: "".concat(inpuTextAlign)
14844
14897
  },
14845
- 'data-testid': 'search-input-field'
14898
+ 'data-testid': 'search-input-field',
14899
+ 'aria-label': translator.get('ScreenReader.SearchFieldLabel')
14846
14900
  }
14847
14901
  });
14848
14902
  }
@@ -15430,7 +15484,8 @@ function ListBoxPopover(_ref) {
15430
15484
  selectionState: selectionState$1,
15431
15485
  direction: "ltr",
15432
15486
  onSetListCount: c => setListCount(c),
15433
- onCtrlF: onCtrlF
15487
+ onCtrlF: onCtrlF,
15488
+ theme: theme
15434
15489
  }))));
15435
15490
  }
15436
15491