@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/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "module": "esm/index.js",
3
3
  "peerDependencies": {
4
- "@mui/material": "^5.13.3",
4
+ "@mui/material": "^5.13.5",
5
5
  "@mui/icons-material": "^5.11.16",
6
- "@emotion/react": "^11.11.0",
6
+ "@emotion/react": "^11.11.1",
7
7
  "@emotion/styled": "^11.11.0",
8
8
  "react": "^17.0.2 || ^18.1.0",
9
9
  "react-dom": "^17.0.2 || ^18.1.0"
@@ -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
  */
@@ -1955,6 +1955,24 @@
1955
1955
  "zh-TW": "不符計算條件"
1956
1956
  }
1957
1957
  };
1958
+ var ScreenReader_OneSearchResult = {
1959
+ id: "ScreenReader.OneSearchResult",
1960
+ locale: {
1961
+ "en-US": "There is one available result"
1962
+ }
1963
+ };
1964
+ var ScreenReader_ManySearchResults = {
1965
+ id: "ScreenReader.ManySearchResults",
1966
+ locale: {
1967
+ "en-US": "There are {0} available results"
1968
+ }
1969
+ };
1970
+ var ScreenReader_SearchFieldLabel = {
1971
+ id: "ScreenReader.SearchFieldLabel",
1972
+ locale: {
1973
+ "en-US": "Search Field"
1974
+ }
1975
+ };
1958
1976
  var all = {
1959
1977
  Cancel: Cancel$1,
1960
1978
  CurrentSelections_All: CurrentSelections_All,
@@ -2005,7 +2023,10 @@
2005
2023
  Visualization_Invalid_Dimension: Visualization_Invalid_Dimension,
2006
2024
  Visualization_Invalid_Measure: Visualization_Invalid_Measure,
2007
2025
  Visualization_LayoutError: Visualization_LayoutError,
2008
- Visualization_UnfulfilledCalculationCondition: Visualization_UnfulfilledCalculationCondition
2026
+ Visualization_UnfulfilledCalculationCondition: Visualization_UnfulfilledCalculationCondition,
2027
+ ScreenReader_OneSearchResult: ScreenReader_OneSearchResult,
2028
+ ScreenReader_ManySearchResults: ScreenReader_ManySearchResults,
2029
+ ScreenReader_SearchFieldLabel: ScreenReader_SearchFieldLabel
2009
2030
  };
2010
2031
 
2011
2032
  function appLocaleFn(language) {
@@ -10439,7 +10460,6 @@
10439
10460
  }
10440
10461
 
10441
10462
  if (!contains(state.elements.popper, arrowElement)) {
10442
-
10443
10463
  return;
10444
10464
  }
10445
10465
 
@@ -10581,7 +10601,6 @@
10581
10601
  adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
10582
10602
  _options$roundOffsets = options.roundOffsets,
10583
10603
  roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
10584
-
10585
10604
  var commonStyles = {
10586
10605
  placement: getBasePlacement(state.placement),
10587
10606
  variation: getVariation(state.placement),
@@ -11649,8 +11668,7 @@
11649
11668
 
11650
11669
  state.orderedModifiers = orderedModifiers.filter(function (m) {
11651
11670
  return m.enabled;
11652
- }); // Validate the provided modifiers so that the consumer will get warned
11653
-
11671
+ });
11654
11672
  runModifierEffects();
11655
11673
  return instance.update();
11656
11674
  },
@@ -11670,7 +11688,6 @@
11670
11688
  // anymore
11671
11689
 
11672
11690
  if (!areValidElements(reference, popper)) {
11673
-
11674
11691
  return;
11675
11692
  } // Store the reference and popper rects to be read by modifiers
11676
11693
 
@@ -11695,7 +11712,6 @@
11695
11712
  });
11696
11713
 
11697
11714
  for (var index = 0; index < state.orderedModifiers.length; index++) {
11698
-
11699
11715
  if (state.reset === true) {
11700
11716
  state.reset = false;
11701
11717
  index = -1;
@@ -11733,7 +11749,6 @@
11733
11749
  };
11734
11750
 
11735
11751
  if (!areValidElements(reference, popper)) {
11736
-
11737
11752
  return instance;
11738
11753
  }
11739
11754
 
@@ -11748,11 +11763,11 @@
11748
11763
  // one.
11749
11764
 
11750
11765
  function runModifierEffects() {
11751
- state.orderedModifiers.forEach(function (_ref3) {
11752
- var name = _ref3.name,
11753
- _ref3$options = _ref3.options,
11754
- options = _ref3$options === void 0 ? {} : _ref3$options,
11755
- effect = _ref3.effect;
11766
+ state.orderedModifiers.forEach(function (_ref) {
11767
+ var name = _ref.name,
11768
+ _ref$options = _ref.options,
11769
+ options = _ref$options === void 0 ? {} : _ref$options,
11770
+ effect = _ref.effect;
11756
11771
 
11757
11772
  if (typeof effect === 'function') {
11758
11773
  var cleanupFn = effect({
@@ -14769,7 +14784,7 @@
14769
14784
  return cache[key];
14770
14785
  }
14771
14786
 
14772
- const NEBULA_VERSION_HASH = "65bf" ;
14787
+ const NEBULA_VERSION_HASH = "e554" ;
14773
14788
  ClassNameGenerator$1.configure(componentName => {
14774
14789
  return "njs-".concat(NEBULA_VERSION_HASH, "-").concat(componentName.replace('Mui', ''));
14775
14790
  });
@@ -15016,7 +15031,7 @@
15016
15031
  const appRef = React.createRef();
15017
15032
  const element = document.createElement('div');
15018
15033
  element.style.display = 'none';
15019
- element.setAttribute('data-nebulajs-version', "4.2.1" );
15034
+ element.setAttribute('data-nebulajs-version', "4.2.3" );
15020
15035
  element.setAttribute('data-app-id', app.id);
15021
15036
  document.body.appendChild(element);
15022
15037
  if (context) {
@@ -18919,6 +18934,13 @@
18919
18934
  // item and use the first valid item as a fallback
18920
18935
  reactExports.Children.forEach(children, (child, index) => {
18921
18936
  if (! /*#__PURE__*/reactExports.isValidElement(child)) {
18937
+ if (activeItemIndex === index) {
18938
+ activeItemIndex += 1;
18939
+ if (activeItemIndex >= children.length) {
18940
+ // there are no focusable items within the list.
18941
+ activeItemIndex = -1;
18942
+ }
18943
+ }
18922
18944
  return;
18923
18945
  }
18924
18946
  if (!child.props.disabled) {
@@ -18967,7 +18989,8 @@
18967
18989
  generateUtilityClasses('MuiPopover', ['root', 'paper']);
18968
18990
 
18969
18991
  const _excluded$a = ["onEntering"],
18970
- _excluded2$1 = ["action", "anchorEl", "anchorOrigin", "anchorPosition", "anchorReference", "children", "className", "container", "elevation", "marginThreshold", "open", "PaperProps", "transformOrigin", "TransitionComponent", "transitionDuration", "TransitionProps"];
18992
+ _excluded2$1 = ["action", "anchorEl", "anchorOrigin", "anchorPosition", "anchorReference", "children", "className", "container", "elevation", "marginThreshold", "open", "PaperProps", "slots", "slotProps", "transformOrigin", "TransitionComponent", "transitionDuration", "TransitionProps"],
18993
+ _excluded3 = ["slotProps"];
18971
18994
  function getOffsetTop(rect, vertical) {
18972
18995
  let offset = 0;
18973
18996
  if (typeof vertical === 'number') {
@@ -19029,6 +19052,7 @@
19029
19052
  outline: 0
19030
19053
  });
19031
19054
  const Popover = /*#__PURE__*/reactExports.forwardRef(function Popover(inProps, ref) {
19055
+ var _slotProps$paper, _slots$root, _slots$paper;
19032
19056
  const props = useThemeProps({
19033
19057
  props: inProps,
19034
19058
  name: 'MuiPopover'
@@ -19048,7 +19072,9 @@
19048
19072
  elevation = 8,
19049
19073
  marginThreshold = 16,
19050
19074
  open,
19051
- PaperProps = {},
19075
+ PaperProps: PaperPropsProp = {},
19076
+ slots,
19077
+ slotProps,
19052
19078
  transformOrigin = {
19053
19079
  vertical: 'top',
19054
19080
  horizontal: 'left'
@@ -19061,14 +19087,15 @@
19061
19087
  } = props,
19062
19088
  TransitionProps = _objectWithoutPropertiesLoose$3(props.TransitionProps, _excluded$a),
19063
19089
  other = _objectWithoutPropertiesLoose$3(props, _excluded2$1);
19090
+ const externalPaperSlotProps = (_slotProps$paper = slotProps == null ? void 0 : slotProps.paper) != null ? _slotProps$paper : PaperPropsProp;
19064
19091
  const paperRef = reactExports.useRef();
19065
- const handlePaperRef = useForkRef(paperRef, PaperProps.ref);
19092
+ const handlePaperRef = useForkRef(paperRef, externalPaperSlotProps.ref);
19066
19093
  const ownerState = _extends$4({}, props, {
19067
19094
  anchorOrigin,
19068
19095
  anchorReference,
19069
19096
  elevation,
19070
19097
  marginThreshold,
19071
- PaperProps,
19098
+ externalPaperSlotProps,
19072
19099
  transformOrigin,
19073
19100
  TransitionComponent,
19074
19101
  transitionDuration: transitionDurationProp,
@@ -19217,16 +19244,46 @@
19217
19244
  // If the anchorEl prop is provided, use its parent body element as the container
19218
19245
  // If neither are provided let the Modal take care of choosing the container
19219
19246
  const container = containerProp || (anchorEl ? ownerDocument(resolveAnchorEl(anchorEl)).body : undefined);
19220
- return /*#__PURE__*/jsxRuntimeExports.jsx(PopoverRoot, _extends$4({
19221
- BackdropProps: {
19222
- invisible: true
19247
+ const RootSlot = (_slots$root = slots == null ? void 0 : slots.root) != null ? _slots$root : PopoverRoot;
19248
+ const PaperSlot = (_slots$paper = slots == null ? void 0 : slots.paper) != null ? _slots$paper : PopoverPaper;
19249
+ const paperProps = useSlotProps({
19250
+ elementType: PaperSlot,
19251
+ externalSlotProps: _extends$4({}, externalPaperSlotProps, {
19252
+ style: isPositioned ? externalPaperSlotProps.style : _extends$4({}, externalPaperSlotProps.style, {
19253
+ opacity: 0
19254
+ })
19255
+ }),
19256
+ additionalProps: {
19257
+ elevation,
19258
+ ref: handlePaperRef
19223
19259
  },
19224
- className: clsx(classes.root, className),
19225
- container: container,
19226
- open: open,
19227
- ref: ref,
19228
- ownerState: ownerState
19229
- }, other, {
19260
+ ownerState,
19261
+ className: clsx(classes.paper, externalPaperSlotProps == null ? void 0 : externalPaperSlotProps.className)
19262
+ });
19263
+ const _useSlotProps = useSlotProps({
19264
+ elementType: RootSlot,
19265
+ externalSlotProps: (slotProps == null ? void 0 : slotProps.root) || {},
19266
+ externalForwardedProps: other,
19267
+ additionalProps: {
19268
+ ref,
19269
+ slotProps: {
19270
+ backdrop: {
19271
+ invisible: true
19272
+ }
19273
+ },
19274
+ container,
19275
+ open
19276
+ },
19277
+ ownerState,
19278
+ className: clsx(classes.root, className)
19279
+ }),
19280
+ {
19281
+ slotProps: rootSlotPropsProp
19282
+ } = _useSlotProps,
19283
+ rootProps = _objectWithoutPropertiesLoose$3(_useSlotProps, _excluded3);
19284
+ return /*#__PURE__*/jsxRuntimeExports.jsx(RootSlot, _extends$4({}, rootProps, !isHostComponent(RootSlot) && {
19285
+ slotProps: rootSlotPropsProp
19286
+ }, {
19230
19287
  children: /*#__PURE__*/jsxRuntimeExports.jsx(TransitionComponent, _extends$4({
19231
19288
  appear: true,
19232
19289
  in: open,
@@ -19234,17 +19291,7 @@
19234
19291
  onExited: handleExited,
19235
19292
  timeout: transitionDuration
19236
19293
  }, TransitionProps, {
19237
- children: /*#__PURE__*/jsxRuntimeExports.jsx(PopoverPaper, _extends$4({
19238
- elevation: elevation
19239
- }, PaperProps, {
19240
- ref: handlePaperRef,
19241
- className: clsx(classes.paper, PaperProps.className)
19242
- }, isPositioned ? undefined : {
19243
- style: _extends$4({}, PaperProps.style, {
19244
- opacity: 0
19245
- })
19246
- }, {
19247
- ownerState: ownerState,
19294
+ children: /*#__PURE__*/jsxRuntimeExports.jsx(PaperSlot, _extends$4({}, paperProps, {
19248
19295
  children: children
19249
19296
  }))
19250
19297
  }))
@@ -22330,6 +22377,21 @@
22330
22377
  "aria-live": "assertive"
22331
22378
  }, text);
22332
22379
  }
22380
+ function getScreenReaderSearchText(listCount) {
22381
+ let t;
22382
+ switch (listCount) {
22383
+ case 0:
22384
+ t = 'Listbox.NoMatchesForYourTerms';
22385
+ break;
22386
+ case 1:
22387
+ t = 'ScreenReader.OneSearchResult';
22388
+ break;
22389
+ default:
22390
+ t = 'ScreenReader.ManySearchResults';
22391
+ break;
22392
+ }
22393
+ return t;
22394
+ }
22333
22395
 
22334
22396
  const KEYS = Object.freeze({
22335
22397
  ENTER: 13,
@@ -24713,7 +24775,7 @@
24713
24775
  const {
24714
24776
  fontSize = '12px',
24715
24777
  fontFamily = 'Source sans pro'
24716
- } = ((_theme$listBox = theme.listBox) === null || _theme$listBox === void 0 ? void 0 : _theme$listBox.content) || {};
24778
+ } = (theme === null || theme === void 0 ? void 0 : (_theme$listBox = theme.listBox) === null || _theme$listBox === void 0 ? void 0 : _theme$listBox.content) || {};
24717
24779
  const font = "".concat(fontSize, " ").concat(fontFamily); // font format as supported by HTML canvas
24718
24780
  const textWidth = useTextWidth({
24719
24781
  text: getMeasureText(layout),
@@ -25272,6 +25334,7 @@
25272
25334
  checkboxes = checkboxOption,
25273
25335
  histogram
25274
25336
  } = layout !== null && layout !== void 0 ? layout : {};
25337
+ const [screenReaderText, setScreenReaderText] = reactExports.useState('');
25275
25338
  const loaderRef = reactExports.useRef(null);
25276
25339
  const local = reactExports.useRef({
25277
25340
  queue: [],
@@ -25299,6 +25362,7 @@
25299
25362
  }),
25300
25363
  itemsLoader = _objectWithoutProperties(_useItemsLoader, _excluded$4);
25301
25364
  const {
25365
+ getStoreValue,
25302
25366
  setStoreValue
25303
25367
  } = useDataStore(model);
25304
25368
  const loadMoreItems = reactExports.useCallback(itemsLoader.loadMoreItems, [layout]);
@@ -25429,6 +25493,14 @@
25429
25493
  listCount
25430
25494
  } = sizes;
25431
25495
  setStoreValue('listCount', listCount);
25496
+ const inputText = getStoreValue('inputText');
25497
+ reactExports.useEffect(() => {
25498
+ if (inputText) {
25499
+ const srText = getScreenReaderSearchText(listCount);
25500
+ const srFinalText = translator.get(srText, [listCount]);
25501
+ setScreenReaderText(srFinalText);
25502
+ }
25503
+ }, [inputText, listCount]);
25432
25504
  const setScrollPosition = position => {
25433
25505
  const {
25434
25506
  scrollIndex,
@@ -25540,7 +25612,10 @@
25540
25612
  return /*#__PURE__*/React.createElement(StyledWrapper, null, /*#__PURE__*/React.createElement(ScreenReaderForSelections, {
25541
25613
  className: "screenReaderOnly",
25542
25614
  layout: layout
25543
- }), !listCount && cardinal > 0 && /*#__PURE__*/React.createElement(ListBoxDisclaimer, {
25615
+ }), /*#__PURE__*/React.createElement("div", {
25616
+ className: "screenReaderOnly",
25617
+ "aria-live": "assertive"
25618
+ }, screenReaderText), !listCount && cardinal > 0 && /*#__PURE__*/React.createElement(ListBoxDisclaimer, {
25544
25619
  width: width,
25545
25620
  text: "Listbox.NoMatchesForYourTerms"
25546
25621
  }), /*#__PURE__*/React.createElement(InfiniteLoader, {
@@ -26249,7 +26324,8 @@
26249
26324
  const inputRef = reactExports.useRef();
26250
26325
  const theme = useTheme$1();
26251
26326
  const {
26252
- getStoreValue
26327
+ getStoreValue,
26328
+ setStoreValue
26253
26329
  } = useDataStore(model);
26254
26330
  const isRtl = direction === 'rtl';
26255
26331
  const inpuTextAlign = isRtl ? 'right' : 'left';
@@ -26282,6 +26358,9 @@
26282
26358
  setWildcardOn(false);
26283
26359
  }
26284
26360
  }, [wildcardOn, inputRef.current]);
26361
+ reactExports.useEffect(() => {
26362
+ setStoreValue('inputText', value);
26363
+ }, [value]);
26285
26364
  const onChange = async e => {
26286
26365
  setValue(e.target.value);
26287
26366
  if (!e.target.value.length) {
@@ -26416,7 +26495,8 @@
26416
26495
  style: {
26417
26496
  textAlign: "".concat(inpuTextAlign)
26418
26497
  },
26419
- 'data-testid': 'search-input-field'
26498
+ 'data-testid': 'search-input-field',
26499
+ 'aria-label': translator.get('ScreenReader.SearchFieldLabel')
26420
26500
  }
26421
26501
  });
26422
26502
  }
@@ -27004,7 +27084,8 @@
27004
27084
  selectionState: selectionState$1,
27005
27085
  direction: "ltr",
27006
27086
  onSetListCount: c => setListCount(c),
27007
- onCtrlF: onCtrlF
27087
+ onCtrlF: onCtrlF,
27088
+ theme: theme
27008
27089
  }))));
27009
27090
  }
27010
27091