@nebula.js/stardust 4.2.0 → 4.2.2

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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * @nebula.js/stardust v4.2.0
2
+ * @nebula.js/stardust v4.2.2
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 = "28e4" ;
14787
+ const NEBULA_VERSION_HASH = "7f71" ;
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.0" );
15034
+ element.setAttribute('data-nebulajs-version', "4.2.2" );
15020
15035
  element.setAttribute('data-app-id', app.id);
15021
15036
  document.body.appendChild(element);
15022
15037
  if (context) {
@@ -17154,7 +17169,7 @@
17154
17169
  className: clsx(className, rootSlotProps == null ? void 0 : rootSlotProps.className, classes == null ? void 0 : classes.root, !ownerState.open && ownerState.exited && (classes == null ? void 0 : classes.hidden))
17155
17170
  }),
17156
17171
  backdrop: () => _extends$4({}, BackdropProps, resolveComponentProps(backdropSlotProps, ownerState), {
17157
- className: clsx(backdropSlotProps == null ? void 0 : backdropSlotProps.className, classes == null ? void 0 : classes.backdrop)
17172
+ className: clsx(backdropSlotProps == null ? void 0 : backdropSlotProps.className, BackdropProps == null ? void 0 : BackdropProps.className, classes == null ? void 0 : classes.backdrop)
17158
17173
  })
17159
17174
  },
17160
17175
  onTransitionEnter: () => setExited(false),
@@ -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
  }))
@@ -21533,7 +21580,6 @@
21533
21580
  const REMOVE_TICK_LIMIT = 80; // an item width equal to or less than this, will hide the select tick
21534
21581
  const SCROLL_BAR_WIDTH = 10; // TODO: ignore this - instead set the styling only show on hover...
21535
21582
  const ITEM_MAX_WIDTH = 150;
21536
- const FREQUENCY_WIDTH = 40;
21537
21583
  const ITEM_MIN_WIDTH = 56;
21538
21584
  const CHECKBOX_WIDTH = 20;
21539
21585
  const frequencyTextNone = '-';
@@ -21555,10 +21601,39 @@
21555
21601
  };
21556
21602
  const getFrequencyText = qFrequency => qFrequency || frequencyTextNone;
21557
21603
 
21558
- const getSelectedStyle = _ref => {
21604
+ const getFreqFlexBasis = _ref => {
21559
21605
  let {
21560
- theme
21606
+ sizes,
21607
+ frequencyMode,
21608
+ isGridMode,
21609
+ freqHitsValue
21561
21610
  } = _ref;
21611
+ if (frequencyMode === 'P') {
21612
+ return "".concat(sizes.freqMinWidth, "px");
21613
+ }
21614
+ const flexBasis = isGridMode && !freqHitsValue ? 'max-content' : '25%';
21615
+ return flexBasis;
21616
+ };
21617
+ const getMaxFreqWidth = _ref2 => {
21618
+ let {
21619
+ sizes,
21620
+ frequencyMode,
21621
+ isGridMode
21622
+ } = _ref2;
21623
+ if (isGridMode) {
21624
+ // This makes the neighbouring value stretch farther than when using a fixed freuency width.
21625
+ return 'max-content';
21626
+ }
21627
+ if (frequencyMode === 'P') {
21628
+ return sizes.freqMinWidth; // because it will never grow beyond "100.0%"
21629
+ }
21630
+
21631
+ return sizes.freqMaxWidth;
21632
+ };
21633
+ const getSelectedStyle = _ref3 => {
21634
+ let {
21635
+ theme
21636
+ } = _ref3;
21562
21637
  return {
21563
21638
  background: theme.palette.selected.main,
21564
21639
  color: theme.palette.selected.mainContrastText,
@@ -21580,18 +21655,20 @@
21580
21655
  const iconWidth = 24; // tick and lock icon width in px
21581
21656
 
21582
21657
  const RowColRoot = styled$1('div', {
21583
- shouldForwardProp: prop => !['flexBasisProp', 'isGridMode', 'isGridCol', 'dense', 'frequencyWidth', 'direction'].includes(prop)
21584
- })(_ref2 => {
21658
+ shouldForwardProp: prop => !['checkboxes', 'isGridMode', 'isGridCol', 'dense', 'direction', 'sizes', 'frequencyMode', 'freqHitsValue'].includes(prop)
21659
+ })(_ref4 => {
21585
21660
  var _theme$listBox$conten, _theme$listBox, _theme$listBox$conten2, _theme$listBox$conten3, _theme$listBox2, _theme$listBox2$conte, _theme$listBox3, _theme$listBox3$conte, _theme$listBox4, _theme$listBox4$conte;
21586
21661
  let {
21587
21662
  theme,
21588
- flexBasisProp,
21663
+ checkboxes,
21589
21664
  isGridMode,
21590
21665
  isGridCol,
21591
21666
  dense,
21592
- frequencyWidth,
21593
- direction
21594
- } = _ref2;
21667
+ direction,
21668
+ sizes,
21669
+ frequencyMode,
21670
+ freqHitsValue
21671
+ } = _ref4;
21595
21672
  return {
21596
21673
  '&:focus': {
21597
21674
  boxShadow: "inset 0 0 0 2px ".concat(theme.palette.custom.focusBorder, " !important")
@@ -21624,15 +21701,16 @@
21624
21701
  ["& .".concat(rowColClasses.cell)]: {
21625
21702
  display: 'flex',
21626
21703
  alignItems: 'center',
21627
- minWidth: 0,
21628
21704
  flexGrow: 1,
21705
+ minWidth: checkboxes ? '52px' : '26px',
21706
+ // these numbers are just enough to show one letter and ellipsis: A…
21707
+ flexBasis: checkboxes ? 'auto' : 'max-content',
21629
21708
  // Note that this padding is overridden when using checkboxes.
21630
21709
  paddingLeft: "".concat(CELL_PADDING_LEFT, "px"),
21631
21710
  paddingRight: 0
21632
21711
  },
21633
21712
  // The leaf node, containing the label text.
21634
21713
  ["& .".concat(rowColClasses.labelText)]: _objectSpread2(_objectSpread2({
21635
- flexBasis: flexBasisProp,
21636
21714
  lineHeight: '16px',
21637
21715
  userSelect: 'none',
21638
21716
  paddingRight: '1px'
@@ -21700,9 +21778,22 @@
21700
21778
  ["& .".concat(rowColClasses.frequencyCount)]: _objectSpread2(_objectSpread2({
21701
21779
  justifyContent: 'flex-end'
21702
21780
  }, ellipsis), {}, {
21703
- flex: "0 1 ".concat(frequencyWidth, "px"),
21781
+ flex: "0 0 ".concat(getFreqFlexBasis({
21782
+ sizes,
21783
+ frequencyMode,
21784
+ isGridMode,
21785
+ freqHitsValue
21786
+ })),
21787
+ minWidth: !isGridMode && frequencyMode !== 'P' && freqHitsValue ? sizes.freqMinWidth : 'max-content',
21788
+ maxWidth: getMaxFreqWidth({
21789
+ sizes,
21790
+ frequencyMode,
21791
+ isGridMode
21792
+ }),
21704
21793
  textAlign: direction === 'rtl' ? 'left' : 'right',
21705
- paddingLeft: '2px'
21794
+ // In RTL, we already get the 8px from the value element's padding and for
21795
+ // percent mode we have already adapted the width (fixed width) to the max number.
21796
+ paddingLeft: direction !== 'rtl' ? '8px' : 0
21706
21797
  }),
21707
21798
  ["&.".concat(rowColClasses.barContainer)]: {
21708
21799
  height: '100%',
@@ -22286,6 +22377,21 @@
22286
22377
  "aria-live": "assertive"
22287
22378
  }, text);
22288
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
+ }
22289
22395
 
22290
22396
  const KEYS = Object.freeze({
22291
22397
  ENTER: 13,
@@ -22548,6 +22654,32 @@
22548
22654
  return handleKeyDown;
22549
22655
  }
22550
22656
 
22657
+ function getValueTextAlign(_ref) {
22658
+ let {
22659
+ direction,
22660
+ cell,
22661
+ textAlign
22662
+ } = _ref;
22663
+ const isNumeric = !['NaN', undefined].includes(cell === null || cell === void 0 ? void 0 : cell.qNum);
22664
+ let valueTextAlign;
22665
+ const isAutoTextAlign = !textAlign || textAlign.auto;
22666
+ const dirToTextAlignMap = {
22667
+ rtl: 'right',
22668
+ ltr: 'left'
22669
+ };
22670
+ if (isAutoTextAlign) {
22671
+ if (!isNumeric) {
22672
+ valueTextAlign = dirToTextAlignMap[direction];
22673
+ } else {
22674
+ valueTextAlign = direction === 'rtl' ? 'left' : 'right';
22675
+ }
22676
+ } else {
22677
+ valueTextAlign = (textAlign === null || textAlign === void 0 ? void 0 : textAlign.align) || 'left';
22678
+ }
22679
+ const ALLOWED_OPTIONS = ['left', 'center', 'right'];
22680
+ return ALLOWED_OPTIONS.includes(valueTextAlign) ? valueTextAlign : 'left';
22681
+ }
22682
+
22551
22683
  function RowColumn(_ref) {
22552
22684
  var _cell$qText, _cell$qHighlightRange, _cell$qHighlightRange2;
22553
22685
  let {
@@ -22583,10 +22715,10 @@
22583
22715
  columnCount = 1,
22584
22716
  rowCount = 1,
22585
22717
  dataOffset,
22718
+ deducedFrequencyMode,
22586
22719
  focusListItems,
22587
22720
  listCount,
22588
- itemPadding,
22589
- frequencyWidth,
22721
+ sizes,
22590
22722
  translator,
22591
22723
  showSearch,
22592
22724
  isModal
@@ -22596,6 +22728,9 @@
22596
22728
  dataLayout = 'singleColumn',
22597
22729
  layoutOrder
22598
22730
  } = layoutOptions;
22731
+ const {
22732
+ itemPadding
22733
+ } = sizes;
22599
22734
  let cellIndex;
22600
22735
  let styles;
22601
22736
  const count = {
@@ -22663,26 +22798,15 @@
22663
22798
  const preventContextMenu = reactExports.useCallback(event => {
22664
22799
  event.preventDefault();
22665
22800
  }, [checkboxes]);
22801
+ const valueTextAlign = reactExports.useMemo(() => cell && getValueTextAlign({
22802
+ direction,
22803
+ cell,
22804
+ textAlign
22805
+ }), [direction, cell, textAlign]);
22666
22806
  if (!cell) {
22667
22807
  return null; // prevent rendering empty rows
22668
22808
  }
22669
22809
 
22670
- const isNumeric = !['NaN', undefined].includes(cell === null || cell === void 0 ? void 0 : cell.qNum);
22671
- let valueTextAlign;
22672
- const isAutoTextAlign = !textAlign || textAlign.auto;
22673
- const dirToTextAlignMap = {
22674
- rtl: 'right',
22675
- ltr: 'left'
22676
- };
22677
- if (isAutoTextAlign) {
22678
- if (!isNumeric) {
22679
- valueTextAlign = dirToTextAlignMap[direction];
22680
- } else {
22681
- valueTextAlign = direction === 'rtl' ? 'left' : 'right';
22682
- }
22683
- } else {
22684
- valueTextAlign = (textAlign === null || textAlign === void 0 ? void 0 : textAlign.align) || 'left';
22685
- }
22686
22810
  const isGridCol = dataLayout === 'grid' && layoutOrder === 'column';
22687
22811
  const label = (_cell$qText = cell === null || cell === void 0 ? void 0 : cell.qText) !== null && _cell$qText !== void 0 ? _cell$qText : '';
22688
22812
  // Search highlights. Split up labelText span into several and add the highlighted class to matching sub-strings.
@@ -22697,17 +22821,16 @@
22697
22821
  display: 'flex',
22698
22822
  fontSize: '8px'
22699
22823
  };
22824
+ const isRtl = direction === 'rtl';
22700
22825
  const cellStyle = {
22701
22826
  display: 'flex',
22702
22827
  alignItems: 'center',
22703
- minWidth: 0,
22704
22828
  flexGrow: 1,
22705
- paddingLeft: direction === 'rtl' ? 8 : checkboxes ? 0 : undefined,
22706
- paddingRight: checkboxes ? 0 : direction === 'rtl' ? 8 : 0,
22829
+ paddingLeft: isRtl ? 8 : checkboxes ? 0 : undefined,
22830
+ paddingRight: checkboxes ? 0 : isRtl ? 8 : 0,
22707
22831
  justifyContent: valueTextAlign
22708
22832
  };
22709
22833
  const isFirstElement = index === 0;
22710
- const flexBasisVal = checkboxes ? 'auto' : 'max-content';
22711
22834
  const showLock = isSelected && isLocked;
22712
22835
  const showTick = !checkboxes && isSelected && !isLocked;
22713
22836
  const showIcon = !checkboxes && sizePermitsTickOrLock;
@@ -22720,15 +22843,18 @@
22720
22843
  maxIndex: count.max,
22721
22844
  showSearch
22722
22845
  });
22846
+ const freqHitsValue = !isRtl && valueTextAlign === 'right' || isRtl && valueTextAlign === 'left';
22723
22847
  return /*#__PURE__*/React.createElement(RowColRoot$1, {
22724
22848
  className: rowColClasses.barContainer,
22725
- flexBasisProp: flexBasisVal,
22849
+ checkboxes: checkboxes,
22726
22850
  style: styles,
22727
22851
  isGridCol: isGridCol,
22728
22852
  isGridMode: dataLayout === 'grid',
22729
22853
  dense: dense,
22730
- frequencyWidth: frequencyWidth,
22731
22854
  direction: direction,
22855
+ sizes: sizes,
22856
+ frequencyMode: deducedFrequencyMode,
22857
+ freqHitsValue: freqHitsValue,
22732
22858
  "data-testid": "listbox.item"
22733
22859
  }, /*#__PURE__*/React.createElement(ItemGrid, {
22734
22860
  role: "row",
@@ -24352,7 +24478,7 @@
24352
24478
  pages,
24353
24479
  selectDisabled,
24354
24480
  interactionEvents,
24355
- frequencyMode,
24481
+ deducedFrequencyMode,
24356
24482
  histogram,
24357
24483
  isSingleSelect,
24358
24484
  select,
@@ -24382,12 +24508,10 @@
24382
24508
  } = layout || {};
24383
24509
  const {
24384
24510
  columnWidth,
24385
- itemPadding,
24386
24511
  listHeight,
24387
24512
  itemHeight,
24388
24513
  rowCount,
24389
- columnCount,
24390
- frequencyWidth
24514
+ columnCount
24391
24515
  } = sizes || {};
24392
24516
  const itemWidth = layoutOptions.dataLayout === 'grid' ? columnWidth : width;
24393
24517
  const showTick = itemWidth > REMOVE_TICK_LIMIT;
@@ -24408,12 +24532,11 @@
24408
24532
  }, isLocked || selectDisabled() ? {} : interactionEvents), {}, {
24409
24533
  checkboxes,
24410
24534
  layoutOptions,
24411
- frequencyMode,
24535
+ deducedFrequencyMode,
24412
24536
  freqIsAllowed,
24413
24537
  isSingleSelect,
24414
24538
  textAlign,
24415
- itemPadding,
24416
- frequencyWidth,
24539
+ sizes,
24417
24540
  actions: {
24418
24541
  select,
24419
24542
  confirm: () => selections === null || selections === void 0 ? void 0 : selections.confirm.call(selections),
@@ -24598,16 +24721,46 @@
24598
24721
  };
24599
24722
  }
24600
24723
 
24601
- function getListSizes(_ref) {
24724
+ const getContext = () => {
24725
+ const fragment = document.createDocumentFragment();
24726
+ const canvas = document.createElement('canvas');
24727
+ fragment.appendChild(canvas);
24728
+ return canvas.getContext('2d');
24729
+ };
24730
+ const getTextWidth = (currentText, font) => {
24731
+ const context = getContext();
24732
+ context.font = font;
24733
+ if (Array.isArray(currentText)) {
24734
+ return Math.max(...currentText.map(t => context.measureText(t).width));
24735
+ }
24736
+ const metrics = context.measureText(currentText);
24737
+ return Math.ceil(metrics.width || 0);
24738
+ };
24739
+ const useTextWidth = options => {
24740
+ const textOptions = reactExports.useMemo(() => 'text' in options ? options : {}, [options]);
24741
+ return reactExports.useMemo(() => getTextWidth(textOptions.text, textOptions.font || '12px Source Sans Pro'), [textOptions.text, textOptions.font]);
24742
+ };
24743
+
24744
+ function getMeasureText(layoutOrNumber) {
24745
+ if (!layoutOrNumber) {
24746
+ return '';
24747
+ }
24748
+ const maxGlyphCount = typeof layoutOrNumber === 'number' ? layoutOrNumber : layoutOrNumber.qListObject.qDimensionInfo.qApprMaxGlyphCount;
24749
+ const measureString = Array(maxGlyphCount).fill('M').join('');
24750
+ return measureString;
24751
+ }
24752
+
24753
+ function useListSizes(_ref) {
24754
+ var _theme$listBox;
24602
24755
  let {
24603
24756
  layout,
24604
24757
  width,
24605
24758
  height,
24606
24759
  listCount,
24607
24760
  count,
24608
- textWidth,
24609
24761
  freqIsAllowed,
24610
- checkboxes
24762
+ checkboxes,
24763
+ theme
24611
24764
  } = _ref;
24612
24765
  const {
24613
24766
  layoutOptions = {}
@@ -24619,7 +24772,24 @@
24619
24772
  dense,
24620
24773
  dataLayout
24621
24774
  } = layoutOptions;
24622
- const frequencyAddWidth = freqIsAllowed ? FREQUENCY_WIDTH : 0;
24775
+ const {
24776
+ fontSize = '12px',
24777
+ fontFamily = 'Source sans pro'
24778
+ } = ((_theme$listBox = theme.listBox) === null || _theme$listBox === void 0 ? void 0 : _theme$listBox.content) || {};
24779
+ const font = "".concat(fontSize, " ").concat(fontFamily); // font format as supported by HTML canvas
24780
+ const textWidth = useTextWidth({
24781
+ text: getMeasureText(layout),
24782
+ font
24783
+ });
24784
+ const freqMinWidth = useTextWidth({
24785
+ text: getMeasureText(5),
24786
+ font
24787
+ });
24788
+ const freqMaxWidth = useTextWidth({
24789
+ text: getMeasureText(8),
24790
+ font
24791
+ });
24792
+ const frequencyAddWidth = freqIsAllowed ? freqMinWidth : 0;
24623
24793
  const checkboxAddWidth = checkboxes ? CHECKBOX_WIDTH : 0;
24624
24794
  const tickIconWidth = CHECKBOX_WIDTH;
24625
24795
  let dynamicItemMinWidth = ITEM_MIN_WIDTH + frequencyAddWidth + checkboxAddWidth;
@@ -24700,6 +24870,7 @@
24700
24870
  overflowStyling,
24701
24871
  itemHeight,
24702
24872
  listHeight,
24873
+ listWidth: width,
24703
24874
  scrollBarWidth: SCROLL_BAR_WIDTH,
24704
24875
  count,
24705
24876
  listCount: limitedListCount,
@@ -24708,42 +24879,12 @@
24708
24879
  column: maxColumnCount
24709
24880
  },
24710
24881
  itemPadding,
24711
- frequencyWidth: FREQUENCY_WIDTH
24882
+ textWidth,
24883
+ freqMinWidth,
24884
+ freqMaxWidth
24712
24885
  };
24713
24886
  }
24714
24887
 
24715
- const getContext = () => {
24716
- const fragment = document.createDocumentFragment();
24717
- const canvas = document.createElement('canvas');
24718
- fragment.appendChild(canvas);
24719
- return canvas.getContext('2d');
24720
- };
24721
- const getTextWidth = (currentText, font) => {
24722
- const context = getContext();
24723
- context.font = font;
24724
- if (Array.isArray(currentText)) {
24725
- return Math.max(...currentText.map(t => context.measureText(t).width));
24726
- }
24727
- const metrics = context.measureText(currentText);
24728
- return metrics.width;
24729
- };
24730
- const useTextWidth = options => {
24731
- const textOptions = reactExports.useMemo(() => 'text' in options ? options : {}, [options]);
24732
- return reactExports.useMemo(() => getTextWidth(textOptions.text, textOptions.font || '14px Source Sans Pro'), [textOptions.text, textOptions.font]);
24733
- };
24734
-
24735
- function getMeasureText(layout) {
24736
- if (!layout) {
24737
- return '';
24738
- }
24739
- const maxGlyphCount = layout.qListObject.qDimensionInfo.qApprMaxGlyphCount;
24740
- let measureString = '';
24741
- for (let i = 0; i < maxGlyphCount; i++) {
24742
- measureString += 'M';
24743
- }
24744
- return measureString;
24745
- }
24746
-
24747
24888
  function getHorizontalMinBatchSize(_ref) {
24748
24889
  let {
24749
24890
  width,
@@ -25077,7 +25218,7 @@
25077
25218
  const {
25078
25219
  frequencyEnabled = false
25079
25220
  } = (layout === null || layout === void 0 ? void 0 : layout.qListObject) || {};
25080
- const hasValidFreqOption = !['none', undefined].includes(frequencyMode);
25221
+ const hasValidFreqOption = !['N', undefined].includes(frequencyMode);
25081
25222
  return !!(widthPermitsFreq && (hasValidFreqOption || frequencyEnabled));
25082
25223
  }
25083
25224
 
@@ -25124,6 +25265,21 @@
25124
25265
  };
25125
25266
  };
25126
25267
 
25268
+ function deduceFrequencyMode(pages) {
25269
+ const hasPercentSign = pages.some(_ref => {
25270
+ let {
25271
+ qMatrix
25272
+ } = _ref;
25273
+ return qMatrix.some(_ref2 => {
25274
+ var _item$qFrequency;
25275
+ let [item] = _ref2;
25276
+ return !!((_item$qFrequency = item.qFrequency) !== null && _item$qFrequency !== void 0 && _item$qFrequency.match('%'));
25277
+ });
25278
+ });
25279
+ const OTHER = '-'; // treat all other as '-' (change later if we need to identify other modes)
25280
+ return hasPercentSign ? 'P' : OTHER;
25281
+ }
25282
+
25127
25283
  const _excluded$4 = ["isLoadingData"];
25128
25284
  const DEFAULT_MIN_BATCH_SIZE = 100;
25129
25285
  const StyledWrapper = styled$1('div')(() => ({
@@ -25140,6 +25296,7 @@
25140
25296
  model,
25141
25297
  app,
25142
25298
  constraints,
25299
+ theme,
25143
25300
  layout,
25144
25301
  selections,
25145
25302
  selectionState,
@@ -25177,6 +25334,7 @@
25177
25334
  checkboxes = checkboxOption,
25178
25335
  histogram
25179
25336
  } = layout !== null && layout !== void 0 ? layout : {};
25337
+ const [screenReaderText, setScreenReaderText] = reactExports.useState('');
25180
25338
  const loaderRef = reactExports.useRef(null);
25181
25339
  const local = reactExports.useRef({
25182
25340
  queue: [],
@@ -25204,6 +25362,7 @@
25204
25362
  }),
25205
25363
  itemsLoader = _objectWithoutProperties(_useItemsLoader, _excluded$4);
25206
25364
  const {
25365
+ getStoreValue,
25207
25366
  setStoreValue
25208
25367
  } = useDataStore(model);
25209
25368
  const loadMoreItems = reactExports.useCallback(itemsLoader.loadMoreItems, [layout]);
@@ -25295,10 +25454,6 @@
25295
25454
  reactExports.useEffect(() => {
25296
25455
  fetchData();
25297
25456
  }, [layout, local.current.dataOffset]);
25298
- const textWidth = useTextWidth({
25299
- text: getMeasureText(layout),
25300
- font: '14px Source sans pro'
25301
- });
25302
25457
  let minimumBatchSize = DEFAULT_MIN_BATCH_SIZE;
25303
25458
  const isVertical = layoutOptions.dataLayout !== 'grid';
25304
25459
  const count = layout === null || layout === void 0 ? void 0 : (_layout$qListObject$q = layout.qListObject.qSize) === null || _layout$qListObject$q === void 0 ? void 0 : _layout$qListObject$q.qcy;
@@ -25315,15 +25470,16 @@
25315
25470
  layout,
25316
25471
  frequencyMode
25317
25472
  });
25318
- const sizes = getListSizes({
25473
+ const deducedFrequencyMode = deduceFrequencyMode(pages);
25474
+ const sizes = useListSizes({
25319
25475
  layout,
25320
25476
  width,
25321
25477
  height,
25322
25478
  listCount: unlimitedListCount,
25323
25479
  count,
25324
- textWidth,
25325
25480
  freqIsAllowed,
25326
- checkboxes
25481
+ checkboxes,
25482
+ theme
25327
25483
  });
25328
25484
  if (sizes.columnWidth) {
25329
25485
  // In grid mode, where we have a dynamic item width, get a second opinion on showing/hiding frequency.
@@ -25337,6 +25493,14 @@
25337
25493
  listCount
25338
25494
  } = sizes;
25339
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]);
25340
25504
  const setScrollPosition = position => {
25341
25505
  const {
25342
25506
  scrollIndex,
@@ -25400,7 +25564,7 @@
25400
25564
  height,
25401
25565
  width,
25402
25566
  checkboxes,
25403
- frequencyMode,
25567
+ deducedFrequencyMode,
25404
25568
  histogram,
25405
25569
  keyboard,
25406
25570
  showGray,
@@ -25448,7 +25612,10 @@
25448
25612
  return /*#__PURE__*/React.createElement(StyledWrapper, null, /*#__PURE__*/React.createElement(ScreenReaderForSelections, {
25449
25613
  className: "screenReaderOnly",
25450
25614
  layout: layout
25451
- }), !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, {
25452
25619
  width: width,
25453
25620
  text: "Listbox.NoMatchesForYourTerms"
25454
25621
  }), /*#__PURE__*/React.createElement(InfiniteLoader, {
@@ -26157,7 +26324,8 @@
26157
26324
  const inputRef = reactExports.useRef();
26158
26325
  const theme = useTheme$1();
26159
26326
  const {
26160
- getStoreValue
26327
+ getStoreValue,
26328
+ setStoreValue
26161
26329
  } = useDataStore(model);
26162
26330
  const isRtl = direction === 'rtl';
26163
26331
  const inpuTextAlign = isRtl ? 'right' : 'left';
@@ -26190,6 +26358,9 @@
26190
26358
  setWildcardOn(false);
26191
26359
  }
26192
26360
  }, [wildcardOn, inputRef.current]);
26361
+ reactExports.useEffect(() => {
26362
+ setStoreValue('inputText', value);
26363
+ }, [value]);
26193
26364
  const onChange = async e => {
26194
26365
  setValue(e.target.value);
26195
26366
  if (!e.target.value.length) {
@@ -26324,7 +26495,8 @@
26324
26495
  style: {
26325
26496
  textAlign: "".concat(inpuTextAlign)
26326
26497
  },
26327
- 'data-testid': 'search-input-field'
26498
+ 'data-testid': 'search-input-field',
26499
+ 'aria-label': translator.get('ScreenReader.SearchFieldLabel')
26328
26500
  }
26329
26501
  });
26330
26502
  }
@@ -27687,21 +27859,6 @@
27687
27859
  }), element, uid());
27688
27860
  }
27689
27861
 
27690
- var $parcel$global =
27691
- typeof globalThis !== 'undefined'
27692
- ? globalThis
27693
- : typeof self !== 'undefined'
27694
- ? self
27695
- : typeof window !== 'undefined'
27696
- ? window
27697
- : typeof global !== 'undefined'
27698
- ? global
27699
- : {};
27700
- function $parcel$export(e, n, v, s) {
27701
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
27702
- }
27703
-
27704
- var $3e40d2fd7fdb47d2$exports = {};
27705
27862
  /**
27706
27863
  * Detect Element Resize.
27707
27864
  * https://github.com/sdecima/javascript-detect-element-resize
@@ -27712,346 +27869,371 @@
27712
27869
  * 2) Defer initialization code via a top-level function wrapper (to support SSR).
27713
27870
  * 3) Avoid unnecessary reflows by not measuring size for scroll events bubbling from children.
27714
27871
  * 4) Add nonce for style element.
27715
- **/ // Check `document` and `window` in case of server-side rendering
27716
- let $3e40d2fd7fdb47d2$var$windowObject;
27717
- if (typeof window !== "undefined") $3e40d2fd7fdb47d2$var$windowObject = window;
27718
- else if (typeof self !== "undefined") // eslint-disable-next-line no-restricted-globals
27719
- $3e40d2fd7fdb47d2$var$windowObject = self;
27720
- else $3e40d2fd7fdb47d2$var$windowObject = $parcel$global;
27721
- let $3e40d2fd7fdb47d2$var$cancelFrame = null;
27722
- let $3e40d2fd7fdb47d2$var$requestFrame = null;
27723
- const $3e40d2fd7fdb47d2$var$TIMEOUT_DURATION = 20;
27724
- const $3e40d2fd7fdb47d2$var$clearTimeoutFn = $3e40d2fd7fdb47d2$var$windowObject.clearTimeout;
27725
- const $3e40d2fd7fdb47d2$var$setTimeoutFn = $3e40d2fd7fdb47d2$var$windowObject.setTimeout;
27726
- const $3e40d2fd7fdb47d2$var$cancelAnimationFrameFn = $3e40d2fd7fdb47d2$var$windowObject.cancelAnimationFrame || $3e40d2fd7fdb47d2$var$windowObject.mozCancelAnimationFrame || $3e40d2fd7fdb47d2$var$windowObject.webkitCancelAnimationFrame;
27727
- const $3e40d2fd7fdb47d2$var$requestAnimationFrameFn = $3e40d2fd7fdb47d2$var$windowObject.requestAnimationFrame || $3e40d2fd7fdb47d2$var$windowObject.mozRequestAnimationFrame || $3e40d2fd7fdb47d2$var$windowObject.webkitRequestAnimationFrame;
27728
- if ($3e40d2fd7fdb47d2$var$cancelAnimationFrameFn == null || $3e40d2fd7fdb47d2$var$requestAnimationFrameFn == null) {
27729
- // For environments that don't support animation frame,
27730
- // fallback to a setTimeout based approach.
27731
- $3e40d2fd7fdb47d2$var$cancelFrame = $3e40d2fd7fdb47d2$var$clearTimeoutFn;
27732
- $3e40d2fd7fdb47d2$var$requestFrame = function requestAnimationFrameViaSetTimeout(callback) {
27733
- return $3e40d2fd7fdb47d2$var$setTimeoutFn(callback, $3e40d2fd7fdb47d2$var$TIMEOUT_DURATION);
27734
- };
27872
+ * 5) Use 'export' statement over 'module.exports' assignment
27873
+ **/
27874
+
27875
+ // Check `document` and `window` in case of server-side rendering
27876
+ let windowObject;
27877
+ if (typeof window !== "undefined") {
27878
+ windowObject = window;
27879
+
27880
+ // eslint-disable-next-line no-restricted-globals
27881
+ } else if (typeof self !== "undefined") {
27882
+ // eslint-disable-next-line no-restricted-globals
27883
+ windowObject = self;
27735
27884
  } else {
27736
- // Counter intuitively, environments that support animation frames can be trickier.
27737
- // Chrome's "Throttle non-visible cross-origin iframes" flag can prevent rAFs from being called.
27738
- // In this case, we should fallback to a setTimeout() implementation.
27739
- $3e40d2fd7fdb47d2$var$cancelFrame = function cancelFrame([animationFrameID, timeoutID]) {
27740
- $3e40d2fd7fdb47d2$var$cancelAnimationFrameFn(animationFrameID);
27741
- $3e40d2fd7fdb47d2$var$clearTimeoutFn(timeoutID);
27742
- };
27743
- $3e40d2fd7fdb47d2$var$requestFrame = function requestAnimationFrameWithSetTimeoutFallback(callback) {
27744
- const animationFrameID = $3e40d2fd7fdb47d2$var$requestAnimationFrameFn(function animationFrameCallback() {
27745
- $3e40d2fd7fdb47d2$var$clearTimeoutFn(timeoutID);
27746
- callback();
27747
- });
27748
- const timeoutID = $3e40d2fd7fdb47d2$var$setTimeoutFn(function timeoutCallback() {
27749
- $3e40d2fd7fdb47d2$var$cancelAnimationFrameFn(animationFrameID);
27750
- callback();
27751
- }, $3e40d2fd7fdb47d2$var$TIMEOUT_DURATION);
27752
- return [
27753
- animationFrameID,
27754
- timeoutID
27755
- ];
27756
- };
27757
- }
27758
- function $3e40d2fd7fdb47d2$var$createDetectElementResize(nonce) {
27759
- let animationKeyframes;
27760
- let animationName;
27761
- let animationStartEvent;
27762
- let animationStyle;
27763
- let checkTriggers;
27764
- let resetTriggers;
27765
- let scrollListener;
27766
- const attachEvent = typeof document !== "undefined" && document.attachEvent;
27767
- if (!attachEvent) {
27768
- resetTriggers = function(element) {
27769
- const triggers = element.__resizeTriggers__, expand = triggers.firstElementChild, contract = triggers.lastElementChild, expandChild = expand.firstElementChild;
27770
- contract.scrollLeft = contract.scrollWidth;
27771
- contract.scrollTop = contract.scrollHeight;
27772
- expandChild.style.width = expand.offsetWidth + 1 + "px";
27773
- expandChild.style.height = expand.offsetHeight + 1 + "px";
27774
- expand.scrollLeft = expand.scrollWidth;
27775
- expand.scrollTop = expand.scrollHeight;
27776
- };
27777
- checkTriggers = function(element) {
27778
- return element.offsetWidth !== element.__resizeLast__.width || element.offsetHeight !== element.__resizeLast__.height;
27779
- };
27780
- scrollListener = function(e) {
27781
- // Don't measure (which forces) reflow for scrolls that happen inside of children!
27782
- if (e.target.className && typeof e.target.className.indexOf === "function" && e.target.className.indexOf("contract-trigger") < 0 && e.target.className.indexOf("expand-trigger") < 0) return;
27783
- const element = this;
27784
- resetTriggers(this);
27785
- if (this.__resizeRAF__) $3e40d2fd7fdb47d2$var$cancelFrame(this.__resizeRAF__);
27786
- this.__resizeRAF__ = $3e40d2fd7fdb47d2$var$requestFrame(function animationFrame() {
27787
- if (checkTriggers(element)) {
27788
- element.__resizeLast__.width = element.offsetWidth;
27789
- element.__resizeLast__.height = element.offsetHeight;
27790
- element.__resizeListeners__.forEach(function forEachResizeListener(fn) {
27791
- fn.call(element, e);
27792
- });
27793
- }
27794
- });
27795
- };
27796
- /* Detect CSS Animations support to detect element display/re-attach */ let animation = false;
27797
- let keyframeprefix = "";
27798
- animationStartEvent = "animationstart";
27799
- const domPrefixes = "Webkit Moz O ms".split(" ");
27800
- let startEvents = "webkitAnimationStart animationstart oAnimationStart MSAnimationStart".split(" ");
27801
- let pfx = "";
27802
- {
27803
- const elm = document.createElement("fakeelement");
27804
- if (elm.style.animationName !== undefined) animation = true;
27805
- if (animation === false) {
27806
- for(let i = 0; i < domPrefixes.length; i++)if (elm.style[domPrefixes[i] + "AnimationName"] !== undefined) {
27807
- pfx = domPrefixes[i];
27808
- keyframeprefix = "-" + pfx.toLowerCase() + "-";
27809
- animationStartEvent = startEvents[i];
27810
- animation = true;
27811
- break;
27812
- }
27813
- }
27814
- }
27815
- animationName = "resizeanim";
27816
- animationKeyframes = "@" + keyframeprefix + "keyframes " + animationName + " { from { opacity: 0; } to { opacity: 0; } } ";
27817
- animationStyle = keyframeprefix + "animation: 1ms " + animationName + "; ";
27818
- }
27819
- const createStyles = function(doc) {
27820
- if (!doc.getElementById("detectElementResize")) {
27821
- //opacity:0 works around a chrome bug https://code.google.com/p/chromium/issues/detail?id=286360
27822
- const css = (animationKeyframes ? animationKeyframes : "") + ".resize-triggers { " + (animationStyle ? animationStyle : "") + "visibility: hidden; opacity: 0; } " + '.resize-triggers, .resize-triggers > div, .contract-trigger:before { content: " "; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; z-index: -1; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }', head = doc.head || doc.getElementsByTagName("head")[0], style = doc.createElement("style");
27823
- style.id = "detectElementResize";
27824
- style.type = "text/css";
27825
- if (nonce != null) style.setAttribute("nonce", nonce);
27826
- if (style.styleSheet) style.styleSheet.cssText = css;
27827
- else style.appendChild(doc.createTextNode(css));
27828
- head.appendChild(style);
27829
- }
27885
+ windowObject = global;
27886
+ }
27887
+ let cancelFrame = null;
27888
+ let requestFrame = null;
27889
+ const TIMEOUT_DURATION = 20;
27890
+ const clearTimeoutFn = windowObject.clearTimeout;
27891
+ const setTimeoutFn = windowObject.setTimeout;
27892
+ const cancelAnimationFrameFn = windowObject.cancelAnimationFrame || windowObject.mozCancelAnimationFrame || windowObject.webkitCancelAnimationFrame;
27893
+ const requestAnimationFrameFn = windowObject.requestAnimationFrame || windowObject.mozRequestAnimationFrame || windowObject.webkitRequestAnimationFrame;
27894
+ if (cancelAnimationFrameFn == null || requestAnimationFrameFn == null) {
27895
+ // For environments that don't support animation frame,
27896
+ // fallback to a setTimeout based approach.
27897
+ cancelFrame = clearTimeoutFn;
27898
+ requestFrame = function requestAnimationFrameViaSetTimeout(callback) {
27899
+ return setTimeoutFn(callback, TIMEOUT_DURATION);
27900
+ };
27901
+ } else {
27902
+ // Counter intuitively, environments that support animation frames can be trickier.
27903
+ // Chrome's "Throttle non-visible cross-origin iframes" flag can prevent rAFs from being called.
27904
+ // In this case, we should fallback to a setTimeout() implementation.
27905
+ cancelFrame = function cancelFrame([animationFrameID, timeoutID]) {
27906
+ cancelAnimationFrameFn(animationFrameID);
27907
+ clearTimeoutFn(timeoutID);
27908
+ };
27909
+ requestFrame = function requestAnimationFrameWithSetTimeoutFallback(callback) {
27910
+ const animationFrameID = requestAnimationFrameFn(function animationFrameCallback() {
27911
+ clearTimeoutFn(timeoutID);
27912
+ callback();
27913
+ });
27914
+ const timeoutID = setTimeoutFn(function timeoutCallback() {
27915
+ cancelAnimationFrameFn(animationFrameID);
27916
+ callback();
27917
+ }, TIMEOUT_DURATION);
27918
+ return [animationFrameID, timeoutID];
27919
+ };
27920
+ }
27921
+ function createDetectElementResize(nonce) {
27922
+ let animationKeyframes;
27923
+ let animationName;
27924
+ let animationStartEvent;
27925
+ let animationStyle;
27926
+ let checkTriggers;
27927
+ let resetTriggers;
27928
+ let scrollListener;
27929
+ const attachEvent = typeof document !== "undefined" && document.attachEvent;
27930
+ if (!attachEvent) {
27931
+ resetTriggers = function (element) {
27932
+ const triggers = element.__resizeTriggers__,
27933
+ expand = triggers.firstElementChild,
27934
+ contract = triggers.lastElementChild,
27935
+ expandChild = expand.firstElementChild;
27936
+ contract.scrollLeft = contract.scrollWidth;
27937
+ contract.scrollTop = contract.scrollHeight;
27938
+ expandChild.style.width = expand.offsetWidth + 1 + "px";
27939
+ expandChild.style.height = expand.offsetHeight + 1 + "px";
27940
+ expand.scrollLeft = expand.scrollWidth;
27941
+ expand.scrollTop = expand.scrollHeight;
27830
27942
  };
27831
- const addResizeListener = function(element, fn) {
27832
- if (attachEvent) element.attachEvent("onresize", fn);
27833
- else {
27834
- if (!element.__resizeTriggers__) {
27835
- const doc = element.ownerDocument;
27836
- const elementStyle = $3e40d2fd7fdb47d2$var$windowObject.getComputedStyle(element);
27837
- if (elementStyle && elementStyle.position === "static") element.style.position = "relative";
27838
- createStyles(doc);
27839
- element.__resizeLast__ = {};
27840
- element.__resizeListeners__ = [];
27841
- (element.__resizeTriggers__ = doc.createElement("div")).className = "resize-triggers";
27842
- const expandTrigger = doc.createElement("div");
27843
- expandTrigger.className = "expand-trigger";
27844
- expandTrigger.appendChild(doc.createElement("div"));
27845
- const contractTrigger = doc.createElement("div");
27846
- contractTrigger.className = "contract-trigger";
27847
- element.__resizeTriggers__.appendChild(expandTrigger);
27848
- element.__resizeTriggers__.appendChild(contractTrigger);
27849
- element.appendChild(element.__resizeTriggers__);
27850
- resetTriggers(element);
27851
- element.addEventListener("scroll", scrollListener, true);
27852
- /* Listen for a css animation to detect element display/re-attach */ if (animationStartEvent) {
27853
- element.__resizeTriggers__.__animationListener__ = function animationListener(e) {
27854
- if (e.animationName === animationName) resetTriggers(element);
27855
- };
27856
- element.__resizeTriggers__.addEventListener(animationStartEvent, element.__resizeTriggers__.__animationListener__);
27857
- }
27858
- }
27859
- element.__resizeListeners__.push(fn);
27860
- }
27943
+ checkTriggers = function (element) {
27944
+ return element.offsetWidth !== element.__resizeLast__.width || element.offsetHeight !== element.__resizeLast__.height;
27861
27945
  };
27862
- const removeResizeListener = function(element, fn) {
27863
- if (attachEvent) element.detachEvent("onresize", fn);
27864
- else {
27865
- element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn), 1);
27866
- if (!element.__resizeListeners__.length) {
27867
- element.removeEventListener("scroll", scrollListener, true);
27868
- if (element.__resizeTriggers__.__animationListener__) {
27869
- element.__resizeTriggers__.removeEventListener(animationStartEvent, element.__resizeTriggers__.__animationListener__);
27870
- element.__resizeTriggers__.__animationListener__ = null;
27871
- }
27872
- try {
27873
- element.__resizeTriggers__ = !element.removeChild(element.__resizeTriggers__);
27874
- } catch (e) {
27875
- // Preact compat; see developit/preact-compat/issues/228
27876
- }
27877
- }
27946
+ scrollListener = function (e) {
27947
+ // Don't measure (which forces) reflow for scrolls that happen inside of children!
27948
+ if (e.target.className && typeof e.target.className.indexOf === "function" && e.target.className.indexOf("contract-trigger") < 0 && e.target.className.indexOf("expand-trigger") < 0) {
27949
+ return;
27950
+ }
27951
+ const element = this;
27952
+ resetTriggers(this);
27953
+ if (this.__resizeRAF__) {
27954
+ cancelFrame(this.__resizeRAF__);
27955
+ }
27956
+ this.__resizeRAF__ = requestFrame(function animationFrame() {
27957
+ if (checkTriggers(element)) {
27958
+ element.__resizeLast__.width = element.offsetWidth;
27959
+ element.__resizeLast__.height = element.offsetHeight;
27960
+ element.__resizeListeners__.forEach(function forEachResizeListener(fn) {
27961
+ fn.call(element, e);
27962
+ });
27878
27963
  }
27964
+ });
27879
27965
  };
27880
- return {
27881
- addResizeListener: addResizeListener,
27882
- removeResizeListener: removeResizeListener
27883
- };
27884
- }
27885
- $3e40d2fd7fdb47d2$exports = {
27886
- createDetectElementResize: $3e40d2fd7fdb47d2$var$createDetectElementResize
27887
- };
27888
-
27889
27966
 
27890
- function $6e2bb92d9db3b0c8$var$_defineProperty(obj, key, value) {
27891
- key = $6e2bb92d9db3b0c8$var$_toPropertyKey(key);
27892
- if (key in obj) Object.defineProperty(obj, key, {
27893
- value: value,
27894
- enumerable: true,
27895
- configurable: true,
27896
- writable: true
27897
- });
27898
- else obj[key] = value;
27899
- return obj;
27900
- }
27901
- function $6e2bb92d9db3b0c8$var$_toPropertyKey(arg) {
27902
- var key = $6e2bb92d9db3b0c8$var$_toPrimitive(arg, "string");
27903
- return typeof key === "symbol" ? key : String(key);
27904
- }
27905
- function $6e2bb92d9db3b0c8$var$_toPrimitive(input, hint) {
27906
- if (typeof input !== "object" || input === null) return input;
27907
- var prim = input[Symbol.toPrimitive];
27908
- if (prim !== undefined) {
27909
- var res = prim.call(input, hint || "default");
27910
- if (typeof res !== "object") return res;
27911
- throw new TypeError("@@toPrimitive must return a primitive value.");
27912
- }
27913
- return (hint === "string" ? String : Number)(input);
27914
- }
27915
- class $6e2bb92d9db3b0c8$export$9d94f4ee1d930ff extends (reactExports.Component) {
27916
- constructor(...args){
27917
- super(...args);
27918
- $6e2bb92d9db3b0c8$var$_defineProperty(this, "state", {
27919
- height: this.props.defaultHeight || 0,
27920
- scaledHeight: this.props.defaultHeight || 0,
27921
- scaledWidth: this.props.defaultWidth || 0,
27922
- width: this.props.defaultWidth || 0
27923
- });
27924
- $6e2bb92d9db3b0c8$var$_defineProperty(this, "_autoSizer", null);
27925
- $6e2bb92d9db3b0c8$var$_defineProperty(this, "_detectElementResize", null);
27926
- $6e2bb92d9db3b0c8$var$_defineProperty(this, "_parentNode", null);
27927
- $6e2bb92d9db3b0c8$var$_defineProperty(this, "_resizeObserver", null);
27928
- $6e2bb92d9db3b0c8$var$_defineProperty(this, "_onResize", ()=>{
27929
- const { disableHeight: disableHeight , disableWidth: disableWidth , onResize: onResize } = this.props;
27930
- if (this._parentNode) {
27931
- var _style$paddingLeft, _style$paddingRight, _style$paddingTop, _style$paddingBottom;
27932
- // Guard against AutoSizer component being removed from the DOM immediately after being added.
27933
- // This can result in invalid style values which can result in NaN values if we don't handle them.
27934
- // See issue #150 for more context.
27935
- const style = window.getComputedStyle(this._parentNode) || {};
27936
- const paddingLeft = parseFloat((_style$paddingLeft = style.paddingLeft) !== null && _style$paddingLeft !== void 0 ? _style$paddingLeft : "0");
27937
- const paddingRight = parseFloat((_style$paddingRight = style.paddingRight) !== null && _style$paddingRight !== void 0 ? _style$paddingRight : "0");
27938
- const paddingTop = parseFloat((_style$paddingTop = style.paddingTop) !== null && _style$paddingTop !== void 0 ? _style$paddingTop : "0");
27939
- const paddingBottom = parseFloat((_style$paddingBottom = style.paddingBottom) !== null && _style$paddingBottom !== void 0 ? _style$paddingBottom : "0");
27940
- const rect = this._parentNode.getBoundingClientRect();
27941
- const scaledHeight = rect.height - paddingTop - paddingBottom;
27942
- const scaledWidth = rect.width - paddingLeft - paddingRight;
27943
- const height = this._parentNode.offsetHeight - paddingTop - paddingBottom;
27944
- const width = this._parentNode.offsetWidth - paddingLeft - paddingRight;
27945
- if (!disableHeight && (this.state.height !== height || this.state.scaledHeight !== scaledHeight) || !disableWidth && (this.state.width !== width || this.state.scaledWidth !== scaledWidth)) {
27946
- this.setState({
27947
- height: height,
27948
- width: width,
27949
- scaledHeight: scaledHeight,
27950
- scaledWidth: scaledWidth
27951
- });
27952
- if (typeof onResize === "function") onResize({
27953
- height: height,
27954
- scaledHeight: scaledHeight,
27955
- scaledWidth: scaledWidth,
27956
- width: width
27957
- });
27958
- }
27959
- }
27960
- });
27961
- $6e2bb92d9db3b0c8$var$_defineProperty(this, "_setRef", (autoSizer)=>{
27962
- this._autoSizer = autoSizer;
27963
- });
27964
- }
27965
- componentDidMount() {
27966
- const { nonce: nonce } = this.props;
27967
- if (this._autoSizer && this._autoSizer.parentNode && this._autoSizer.parentNode.ownerDocument && this._autoSizer.parentNode.ownerDocument.defaultView && this._autoSizer.parentNode instanceof this._autoSizer.parentNode.ownerDocument.defaultView.HTMLElement) {
27968
- // Delay access of parentNode until mount.
27969
- // This handles edge-cases where the component has already been unmounted before its ref has been set,
27970
- // As well as libraries like react-lite which have a slightly different lifecycle.
27971
- this._parentNode = this._autoSizer.parentNode;
27972
- // Defer requiring resize handler in order to support server-side rendering.
27973
- // See issue #41
27974
- if (this._parentNode != null) {
27975
- if (typeof ResizeObserver !== "undefined") {
27976
- this._resizeObserver = new ResizeObserver(()=>{
27977
- // Guard against "ResizeObserver loop limit exceeded" error;
27978
- // could be triggered if the state update causes the ResizeObserver handler to run long.
27979
- // See https://github.com/bvaughn/react-virtualized-auto-sizer/issues/55
27980
- setTimeout(this._onResize, 0);
27981
- });
27982
- this._resizeObserver.observe(this._parentNode);
27983
- } else {
27984
- this._detectElementResize = (0, $3e40d2fd7fdb47d2$exports.createDetectElementResize)(nonce);
27985
- this._detectElementResize.addResizeListener(this._parentNode, this._onResize);
27986
- }
27987
- this._onResize();
27988
- }
27967
+ /* Detect CSS Animations support to detect element display/re-attach */
27968
+ let animation = false;
27969
+ let keyframeprefix = "";
27970
+ animationStartEvent = "animationstart";
27971
+ const domPrefixes = "Webkit Moz O ms".split(" ");
27972
+ let startEvents = "webkitAnimationStart animationstart oAnimationStart MSAnimationStart".split(" ");
27973
+ let pfx = "";
27974
+ {
27975
+ const elm = document.createElement("fakeelement");
27976
+ if (elm.style.animationName !== undefined) {
27977
+ animation = true;
27978
+ }
27979
+ if (animation === false) {
27980
+ for (let i = 0; i < domPrefixes.length; i++) {
27981
+ if (elm.style[domPrefixes[i] + "AnimationName"] !== undefined) {
27982
+ pfx = domPrefixes[i];
27983
+ keyframeprefix = "-" + pfx.toLowerCase() + "-";
27984
+ animationStartEvent = startEvents[i];
27985
+ animation = true;
27986
+ break;
27987
+ }
27989
27988
  }
27989
+ }
27990
27990
  }
27991
- componentWillUnmount() {
27992
- if (this._parentNode) {
27993
- if (this._detectElementResize) this._detectElementResize.removeResizeListener(this._parentNode, this._onResize);
27994
- if (this._resizeObserver) {
27995
- this._resizeObserver.observe(this._parentNode);
27996
- this._resizeObserver.disconnect();
27991
+ animationName = "resizeanim";
27992
+ animationKeyframes = "@" + keyframeprefix + "keyframes " + animationName + " { from { opacity: 0; } to { opacity: 0; } } ";
27993
+ animationStyle = keyframeprefix + "animation: 1ms " + animationName + "; ";
27994
+ }
27995
+ const createStyles = function (doc) {
27996
+ if (!doc.getElementById("detectElementResize")) {
27997
+ //opacity:0 works around a chrome bug https://code.google.com/p/chromium/issues/detail?id=286360
27998
+ const css = (animationKeyframes ? animationKeyframes : "") + ".resize-triggers { " + (animationStyle ? animationStyle : "") + "visibility: hidden; opacity: 0; } " + '.resize-triggers, .resize-triggers > div, .contract-trigger:before { content: " "; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; z-index: -1; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }',
27999
+ head = doc.head || doc.getElementsByTagName("head")[0],
28000
+ style = doc.createElement("style");
28001
+ style.id = "detectElementResize";
28002
+ style.type = "text/css";
28003
+ if (nonce != null) {
28004
+ style.setAttribute("nonce", nonce);
28005
+ }
28006
+ if (style.styleSheet) {
28007
+ style.styleSheet.cssText = css;
28008
+ } else {
28009
+ style.appendChild(doc.createTextNode(css));
28010
+ }
28011
+ head.appendChild(style);
28012
+ }
28013
+ };
28014
+ const addResizeListener = function (element, fn) {
28015
+ if (attachEvent) {
28016
+ element.attachEvent("onresize", fn);
28017
+ } else {
28018
+ if (!element.__resizeTriggers__) {
28019
+ const doc = element.ownerDocument;
28020
+ const elementStyle = windowObject.getComputedStyle(element);
28021
+ if (elementStyle && elementStyle.position === "static") {
28022
+ element.style.position = "relative";
28023
+ }
28024
+ createStyles(doc);
28025
+ element.__resizeLast__ = {};
28026
+ element.__resizeListeners__ = [];
28027
+ (element.__resizeTriggers__ = doc.createElement("div")).className = "resize-triggers";
28028
+ const expandTrigger = doc.createElement("div");
28029
+ expandTrigger.className = "expand-trigger";
28030
+ expandTrigger.appendChild(doc.createElement("div"));
28031
+ const contractTrigger = doc.createElement("div");
28032
+ contractTrigger.className = "contract-trigger";
28033
+ element.__resizeTriggers__.appendChild(expandTrigger);
28034
+ element.__resizeTriggers__.appendChild(contractTrigger);
28035
+ element.appendChild(element.__resizeTriggers__);
28036
+ resetTriggers(element);
28037
+ element.addEventListener("scroll", scrollListener, true);
28038
+
28039
+ /* Listen for a css animation to detect element display/re-attach */
28040
+ if (animationStartEvent) {
28041
+ element.__resizeTriggers__.__animationListener__ = function animationListener(e) {
28042
+ if (e.animationName === animationName) {
28043
+ resetTriggers(element);
27997
28044
  }
28045
+ };
28046
+ element.__resizeTriggers__.addEventListener(animationStartEvent, element.__resizeTriggers__.__animationListener__);
27998
28047
  }
28048
+ }
28049
+ element.__resizeListeners__.push(fn);
27999
28050
  }
28000
- render() {
28001
- const { children: children , defaultHeight: defaultHeight , defaultWidth: defaultWidth , disableHeight: disableHeight = false , disableWidth: disableWidth = false , nonce: nonce , onResize: onResize , style: style = {} , tagName: tagName = "div" , ...rest } = this.props;
28002
- const { height: height , scaledHeight: scaledHeight , scaledWidth: scaledWidth , width: width } = this.state;
28003
- // Outer div should not force width/height since that may prevent containers from shrinking.
28004
- // Inner component should overflow and use calculated width/height.
28005
- // See issue #68 for more information.
28006
- const outerStyle = {
28007
- overflow: "visible"
28008
- };
28009
- const childParams = {};
28010
- // Avoid rendering children before the initial measurements have been collected.
28011
- // At best this would just be wasting cycles.
28012
- let bailoutOnChildren = false;
28013
- if (!disableHeight) {
28014
- if (height === 0) bailoutOnChildren = true;
28015
- outerStyle.height = 0;
28016
- childParams.height = height;
28017
- childParams.scaledHeight = scaledHeight;
28051
+ };
28052
+ const removeResizeListener = function (element, fn) {
28053
+ if (attachEvent) {
28054
+ element.detachEvent("onresize", fn);
28055
+ } else {
28056
+ element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn), 1);
28057
+ if (!element.__resizeListeners__.length) {
28058
+ element.removeEventListener("scroll", scrollListener, true);
28059
+ if (element.__resizeTriggers__.__animationListener__) {
28060
+ element.__resizeTriggers__.removeEventListener(animationStartEvent, element.__resizeTriggers__.__animationListener__);
28061
+ element.__resizeTriggers__.__animationListener__ = null;
28018
28062
  }
28019
- if (!disableWidth) {
28020
- if (width === 0) bailoutOnChildren = true;
28021
- outerStyle.width = 0;
28022
- childParams.width = width;
28023
- childParams.scaledWidth = scaledWidth;
28063
+ try {
28064
+ element.__resizeTriggers__ = !element.removeChild(element.__resizeTriggers__);
28065
+ } catch (e) {
28066
+ // Preact compat; see developit/preact-compat/issues/228
28024
28067
  }
28025
- return (reactExports.createElement)(tagName, {
28026
- ref: this._setRef,
28027
- style: {
28028
- ...outerStyle,
28029
- ...style
28030
- },
28031
- ...rest
28032
- }, !bailoutOnChildren && children(childParams));
28068
+ }
28033
28069
  }
28070
+ };
28071
+ return {
28072
+ addResizeListener,
28073
+ removeResizeListener
28074
+ };
28034
28075
  }
28035
28076
 
28077
+ class AutoSizer extends reactExports.Component {
28078
+ constructor(...args) {
28079
+ super(...args);
28080
+ this.state = {
28081
+ height: this.props.defaultHeight || 0,
28082
+ scaledHeight: this.props.defaultHeight || 0,
28083
+ scaledWidth: this.props.defaultWidth || 0,
28084
+ width: this.props.defaultWidth || 0
28085
+ };
28086
+ this._autoSizer = null;
28087
+ this._detectElementResize = null;
28088
+ this._parentNode = null;
28089
+ this._resizeObserver = null;
28090
+ this._timeoutId = null;
28091
+ this._onResize = () => {
28092
+ this._timeoutId = null;
28093
+ const {
28094
+ disableHeight,
28095
+ disableWidth,
28096
+ onResize
28097
+ } = this.props;
28098
+ if (this._parentNode) {
28099
+ var _style$paddingLeft, _style$paddingRight, _style$paddingTop, _style$paddingBottom;
28100
+ // Guard against AutoSizer component being removed from the DOM immediately after being added.
28101
+ // This can result in invalid style values which can result in NaN values if we don't handle them.
28102
+ // See issue #150 for more context.
28103
+
28104
+ const style = window.getComputedStyle(this._parentNode) || {};
28105
+ const paddingLeft = parseFloat((_style$paddingLeft = style.paddingLeft) !== null && _style$paddingLeft !== void 0 ? _style$paddingLeft : "0");
28106
+ const paddingRight = parseFloat((_style$paddingRight = style.paddingRight) !== null && _style$paddingRight !== void 0 ? _style$paddingRight : "0");
28107
+ const paddingTop = parseFloat((_style$paddingTop = style.paddingTop) !== null && _style$paddingTop !== void 0 ? _style$paddingTop : "0");
28108
+ const paddingBottom = parseFloat((_style$paddingBottom = style.paddingBottom) !== null && _style$paddingBottom !== void 0 ? _style$paddingBottom : "0");
28109
+ const rect = this._parentNode.getBoundingClientRect();
28110
+ const scaledHeight = rect.height - paddingTop - paddingBottom;
28111
+ const scaledWidth = rect.width - paddingLeft - paddingRight;
28112
+ const height = this._parentNode.offsetHeight - paddingTop - paddingBottom;
28113
+ const width = this._parentNode.offsetWidth - paddingLeft - paddingRight;
28114
+ if (!disableHeight && (this.state.height !== height || this.state.scaledHeight !== scaledHeight) || !disableWidth && (this.state.width !== width || this.state.scaledWidth !== scaledWidth)) {
28115
+ this.setState({
28116
+ height,
28117
+ width,
28118
+ scaledHeight,
28119
+ scaledWidth
28120
+ });
28121
+ if (typeof onResize === "function") {
28122
+ onResize({
28123
+ height,
28124
+ scaledHeight,
28125
+ scaledWidth,
28126
+ width
28127
+ });
28128
+ }
28129
+ }
28130
+ }
28131
+ };
28132
+ this._setRef = autoSizer => {
28133
+ this._autoSizer = autoSizer;
28134
+ };
28135
+ }
28136
+ componentDidMount() {
28137
+ const {
28138
+ nonce
28139
+ } = this.props;
28140
+ if (this._autoSizer && this._autoSizer.parentNode && this._autoSizer.parentNode.ownerDocument && this._autoSizer.parentNode.ownerDocument.defaultView && this._autoSizer.parentNode instanceof this._autoSizer.parentNode.ownerDocument.defaultView.HTMLElement) {
28141
+ // Delay access of parentNode until mount.
28142
+ // This handles edge-cases where the component has already been unmounted before its ref has been set,
28143
+ // As well as libraries like react-lite which have a slightly different lifecycle.
28144
+ this._parentNode = this._autoSizer.parentNode;
28145
+
28146
+ // Defer requiring resize handler in order to support server-side rendering.
28147
+ // See issue #41
28148
+ if (this._parentNode != null) {
28149
+ if (typeof ResizeObserver !== "undefined") {
28150
+ this._resizeObserver = new ResizeObserver(() => {
28151
+ // Guard against "ResizeObserver loop limit exceeded" error;
28152
+ // could be triggered if the state update causes the ResizeObserver handler to run long.
28153
+ // See https://github.com/bvaughn/react-virtualized-auto-sizer/issues/55
28154
+ this._timeoutId = setTimeout(this._onResize, 0);
28155
+ });
28156
+ this._resizeObserver.observe(this._parentNode);
28157
+ } else {
28158
+ this._detectElementResize = createDetectElementResize(nonce);
28159
+ this._detectElementResize.addResizeListener(this._parentNode, this._onResize);
28160
+ }
28161
+ this._onResize();
28162
+ }
28163
+ }
28164
+ }
28165
+ componentWillUnmount() {
28166
+ if (this._parentNode) {
28167
+ if (this._detectElementResize) {
28168
+ this._detectElementResize.removeResizeListener(this._parentNode, this._onResize);
28169
+ }
28170
+ if (this._timeoutId !== null) {
28171
+ clearTimeout(this._timeoutId);
28172
+ }
28173
+ if (this._resizeObserver) {
28174
+ this._resizeObserver.observe(this._parentNode);
28175
+ this._resizeObserver.disconnect();
28176
+ }
28177
+ }
28178
+ }
28179
+ render() {
28180
+ const {
28181
+ children,
28182
+ defaultHeight,
28183
+ defaultWidth,
28184
+ disableHeight = false,
28185
+ disableWidth = false,
28186
+ nonce,
28187
+ onResize,
28188
+ style = {},
28189
+ tagName = "div",
28190
+ ...rest
28191
+ } = this.props;
28192
+ const {
28193
+ height,
28194
+ scaledHeight,
28195
+ scaledWidth,
28196
+ width
28197
+ } = this.state;
28036
28198
 
28037
- var $81c1b644006d48ec$exports = {};
28199
+ // Outer div should not force width/height since that may prevent containers from shrinking.
28200
+ // Inner component should overflow and use calculated width/height.
28201
+ // See issue #68 for more information.
28202
+ const outerStyle = {
28203
+ overflow: "visible"
28204
+ };
28205
+ const childParams = {};
28038
28206
 
28039
- $parcel$export($81c1b644006d48ec$exports, "isHeightAndWidthProps", () => $81c1b644006d48ec$export$6a9e233b3261c1f);
28040
- $parcel$export($81c1b644006d48ec$exports, "isHeightOnlyProps", () => $81c1b644006d48ec$export$232069b3e05ce32a);
28041
- $parcel$export($81c1b644006d48ec$exports, "isWidthOnlyProps", () => $81c1b644006d48ec$export$10ec32941a097f36);
28042
- function $81c1b644006d48ec$export$6a9e233b3261c1f(props) {
28043
- return props && props.disableHeight !== true && props.disableWidth !== true;
28044
- }
28045
- function $81c1b644006d48ec$export$232069b3e05ce32a(props) {
28046
- return props && props.disableHeight !== true && props.disableWidth === true;
28047
- }
28048
- function $81c1b644006d48ec$export$10ec32941a097f36(props) {
28049
- return props && props.disableHeight === true && props.disableWidth !== true;
28207
+ // Avoid rendering children before the initial measurements have been collected.
28208
+ // At best this would just be wasting cycles.
28209
+ let bailoutOnChildren = false;
28210
+ if (!disableHeight) {
28211
+ if (height === 0) {
28212
+ bailoutOnChildren = true;
28213
+ }
28214
+ outerStyle.height = 0;
28215
+ childParams.height = height;
28216
+ childParams.scaledHeight = scaledHeight;
28217
+ }
28218
+ if (!disableWidth) {
28219
+ if (width === 0) {
28220
+ bailoutOnChildren = true;
28221
+ }
28222
+ outerStyle.width = 0;
28223
+ childParams.width = width;
28224
+ childParams.scaledWidth = scaledWidth;
28225
+ }
28226
+ return reactExports.createElement(tagName, {
28227
+ ref: this._setRef,
28228
+ style: {
28229
+ ...outerStyle,
28230
+ ...style
28231
+ },
28232
+ ...rest
28233
+ }, !bailoutOnChildren && children(childParams));
28234
+ }
28050
28235
  }
28051
28236
 
28052
-
28053
- var $149c1bd638913645$export$2e2bcd8739ae039 = ($6e2bb92d9db3b0c8$export$9d94f4ee1d930ff);
28054
-
28055
28237
  const drillDown = props => _objectSpread2(_objectSpread2({}, props), {}, {
28056
28238
  shapes: [{
28057
28239
  type: 'path',
@@ -28802,7 +28984,7 @@
28802
28984
  className: classes$4.screenReaderOnly
28803
28985
  }, translator.get('Listbox.ScreenReaderInstructions')), isInvalid ? /*#__PURE__*/React.createElement(ListBoxError, {
28804
28986
  text: errorText
28805
- }) : /*#__PURE__*/React.createElement($149c1bd638913645$export$2e2bcd8739ae039, null, _ref5 => {
28987
+ }) : /*#__PURE__*/React.createElement(AutoSizer, null, _ref5 => {
28806
28988
  let {
28807
28989
  height,
28808
28990
  width
@@ -28810,6 +28992,7 @@
28810
28992
  return /*#__PURE__*/React.createElement(ListBox, {
28811
28993
  model: model,
28812
28994
  app: app,
28995
+ theme: theme,
28813
28996
  constraints: constraints,
28814
28997
  layout: layout,
28815
28998
  selections: selections,
@@ -29085,6 +29268,14 @@
29085
29268
  const [model, setModel] = reactExports.useState();
29086
29269
  const [fallbackTitle, setFallbackTitle] = reactExports.useState();
29087
29270
  const title = (_options$title = options.title) !== null && _options$title !== void 0 ? _options$title : fallbackTitle;
29271
+ let {
29272
+ histogram = false,
29273
+ frequencyMode = 'N'
29274
+ } = options;
29275
+ if (fieldDef && fieldDef.failedToFetchFieldDef) {
29276
+ histogram = false;
29277
+ frequencyMode = 'N';
29278
+ }
29088
29279
  reactExports.useEffect(() => {
29089
29280
  async function fetchMasterItem() {
29090
29281
  try {
@@ -29107,7 +29298,7 @@
29107
29298
  throw new Error("Disabling frequency count and histogram: ".concat(e && e.message));
29108
29299
  }
29109
29300
  }
29110
- const isFrequencyMaxNeeded = options.histogram || options.frequencyMode !== 'N';
29301
+ const isFrequencyMaxNeeded = histogram || frequencyMode !== 'N';
29111
29302
  const shouldFetchMasterItem = fieldIdentifier.qLibraryId && isFrequencyMaxNeeded;
29112
29303
  if (shouldFetchMasterItem) {
29113
29304
  fetchMasterItem();
@@ -29122,31 +29313,6 @@
29122
29313
  listLayout,
29123
29314
  properties = {}
29124
29315
  } = options;
29125
- let {
29126
- frequencyMode,
29127
- histogram = false
29128
- } = options;
29129
- if (fieldDef && fieldDef.failedToFetchFieldDef) {
29130
- histogram = false;
29131
- frequencyMode = 'N';
29132
- }
29133
- switch (true) {
29134
- case ['none', 'N', 'NX_FREQUENCY_NONE'].includes(frequencyMode):
29135
- frequencyMode = 'N';
29136
- break;
29137
- case ['value', 'V', 'NX_FREQUENCY_VALUE', 'default'].includes(frequencyMode):
29138
- frequencyMode = 'V';
29139
- break;
29140
- case ['percent', 'P', 'NX_FREQUENCY_PERCENT'].includes(frequencyMode):
29141
- frequencyMode = 'P';
29142
- break;
29143
- case ['relative', 'R', 'NX_FREQUENCY_RELATIVE'].includes(frequencyMode):
29144
- frequencyMode = 'R';
29145
- break;
29146
- default:
29147
- frequencyMode = 'N';
29148
- break;
29149
- }
29150
29316
  const getListdefFrequencyMode = () => histogram && frequencyMode === 'N' ? 'V' : frequencyMode;
29151
29317
  const layoutOptions = {
29152
29318
  dense
@@ -29224,6 +29390,28 @@
29224
29390
  };
29225
29391
  }
29226
29392
 
29393
+ function getFrequencyModeLetter(frequencyMode) {
29394
+ let freqLetter;
29395
+ switch (true) {
29396
+ case ['none', 'N', 'NX_FREQUENCY_NONE'].includes(frequencyMode):
29397
+ freqLetter = 'N';
29398
+ break;
29399
+ case ['value', 'V', 'NX_FREQUENCY_VALUE', 'default'].includes(frequencyMode):
29400
+ freqLetter = 'V';
29401
+ break;
29402
+ case ['percent', 'P', 'NX_FREQUENCY_PERCENT'].includes(frequencyMode):
29403
+ freqLetter = 'P';
29404
+ break;
29405
+ case ['relative', 'R', 'NX_FREQUENCY_RELATIVE'].includes(frequencyMode):
29406
+ freqLetter = 'R';
29407
+ break;
29408
+ default:
29409
+ freqLetter = 'N';
29410
+ break;
29411
+ }
29412
+ return freqLetter;
29413
+ }
29414
+
29227
29415
  const _excluded$3 = ["__DO_NOT_USE__"];
29228
29416
 
29229
29417
  /**
@@ -29286,6 +29474,12 @@
29286
29474
  qId,
29287
29475
  options
29288
29476
  });
29477
+ if (!isExistingObject) {
29478
+ Object.assign(options, {
29479
+ frequencyMode: getFrequencyModeLetter(options.frequencyMode) // stick to letter option hereafter
29480
+ });
29481
+ }
29482
+
29289
29483
  const [changeCount, setChangeCount] = reactExports.useState(0);
29290
29484
  reactExports.useEffect(() => {
29291
29485
  if (changeCount) {
@@ -37110,12 +37304,11 @@
37110
37304
  * @returns {Promise<object>} The objects properties
37111
37305
  * @example
37112
37306
  * // generate properties for a barchart
37113
- * const properties = await n.create({
37307
+ * const properties = await n.generateProperties({
37114
37308
  * type: 'barchart',
37115
37309
  * fields: ['Product', { qLibraryId: 'u378hn', type: 'measure' }],
37116
37310
  * properties: { showTitle: true }
37117
37311
  * },
37118
- * true
37119
37312
  * );
37120
37313
  */
37121
37314
  generateProperties: async cfg => createObject(cfg, halo, true),