@nebula.js/stardust 4.10.0 → 4.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/core/esm/dev.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * @nebula.js/stardust v4.10.0
2
+ * @nebula.js/stardust v4.11.0
3
3
  * Copyright (c) 2024 QlikTech International AB
4
4
  * Released under the MIT license.
5
5
  */
@@ -1932,6 +1932,26 @@ var Visualization_UnfulfilledCalculationCondition = {
1932
1932
  "zh-TW": "不符計算條件"
1933
1933
  }
1934
1934
  };
1935
+ var SelectionToolbar_ClickToLock = {
1936
+ id: "SelectionToolbar.ClickToLock",
1937
+ locale: {
1938
+ "de-DE": "Klicken zum Sperren",
1939
+ "en-US": "Click to lock",
1940
+ "es-ES": "Haga clic para bloquearla",
1941
+ "fr-FR": "Cliquez pour verrouiller",
1942
+ "it-IT": "Fare clic per bloccare",
1943
+ "ja-JP": "クリックしてロック",
1944
+ "ko-KR": "잠그려면 클릭하십시오.",
1945
+ "nl-NL": "Klik om te vergrendelen",
1946
+ "pl-PL": "Aby zablokować, kliknij",
1947
+ "pt-BR": "Clique para travar",
1948
+ "ru-RU": "Щелкните, чтобы заблокировать",
1949
+ "sv-SE": "Klicka för att låsa",
1950
+ "tr-TR": "Kilitlemek için tıklayın",
1951
+ "zh-CN": "单击以锁定",
1952
+ "zh-TW": "按一下鎖定"
1953
+ }
1954
+ };
1935
1955
  var all = {
1936
1956
  Cancel: Cancel$1,
1937
1957
  CurrentSelections_All: CurrentSelections_All,
@@ -1984,7 +2004,8 @@ var all = {
1984
2004
  Visualization_Invalid_Dimension: Visualization_Invalid_Dimension,
1985
2005
  Visualization_Invalid_Measure: Visualization_Invalid_Measure,
1986
2006
  Visualization_LayoutError: Visualization_LayoutError,
1987
- Visualization_UnfulfilledCalculationCondition: Visualization_UnfulfilledCalculationCondition
2007
+ Visualization_UnfulfilledCalculationCondition: Visualization_UnfulfilledCalculationCondition,
2008
+ SelectionToolbar_ClickToLock: SelectionToolbar_ClickToLock
1988
2009
  };
1989
2010
 
1990
2011
  function appLocaleFn(language) {
@@ -5177,7 +5198,7 @@ function StyledEngineProvider(props) {
5177
5198
  }
5178
5199
 
5179
5200
  /**
5180
- * @mui/styled-engine v5.15.4
5201
+ * @mui/styled-engine v5.15.7
5181
5202
  *
5182
5203
  * @license MIT
5183
5204
  * This source code is licensed under the MIT license found in the
@@ -5482,9 +5503,37 @@ function useForkRef(...refs) {
5482
5503
  }, refs);
5483
5504
  }
5484
5505
 
5506
+ class Timeout {
5507
+ constructor() {
5508
+ this.currentId = 0;
5509
+ this.clear = () => {
5510
+ if (this.currentId !== 0) {
5511
+ clearTimeout(this.currentId);
5512
+ this.currentId = 0;
5513
+ }
5514
+ };
5515
+ this.disposeEffect = () => {
5516
+ return this.clear;
5517
+ };
5518
+ }
5519
+ static create() {
5520
+ return new Timeout();
5521
+ }
5522
+ /**
5523
+ * Executes `fn` after `delay`, clearing any previously scheduled call.
5524
+ */
5525
+ start(delay, fn) {
5526
+ this.clear();
5527
+ this.currentId = setTimeout(() => {
5528
+ this.currentId = 0;
5529
+ fn();
5530
+ }, delay);
5531
+ }
5532
+ }
5533
+
5485
5534
  let hadKeyboardEvent = true;
5486
5535
  let hadFocusVisibleRecently = false;
5487
- let hadFocusVisibleRecentlyTimeout;
5536
+ const hadFocusVisibleRecentlyTimeout = new Timeout();
5488
5537
  const inputTypesWhitelist = {
5489
5538
  text: true,
5490
5539
  search: true,
@@ -5607,10 +5656,9 @@ function useIsFocusVisible() {
5607
5656
  // If we don't see a visibility change within 100ms, it's probably a
5608
5657
  // regular focus change.
5609
5658
  hadFocusVisibleRecently = true;
5610
- window.clearTimeout(hadFocusVisibleRecentlyTimeout);
5611
- hadFocusVisibleRecentlyTimeout = window.setTimeout(() => {
5659
+ hadFocusVisibleRecentlyTimeout.start(100, () => {
5612
5660
  hadFocusVisibleRecently = false;
5613
- }, 100);
5661
+ });
5614
5662
  isFocusVisibleRef.current = false;
5615
5663
  return true;
5616
5664
  }
@@ -5708,10 +5756,7 @@ const createClassNameGenerator = () => {
5708
5756
  };
5709
5757
  const ClassNameGenerator = createClassNameGenerator();
5710
5758
 
5711
- // If GlobalStateSlot is changed, GLOBAL_STATE_CLASSES in
5712
- // \packages\api-docs-builder\utils\parseSlotsAndClasses.ts must be updated accordingly.
5713
-
5714
- const globalStateClassesMapping = {
5759
+ const globalStateClasses = {
5715
5760
  active: 'active',
5716
5761
  checked: 'checked',
5717
5762
  completed: 'completed',
@@ -5726,7 +5771,7 @@ const globalStateClassesMapping = {
5726
5771
  selected: 'selected'
5727
5772
  };
5728
5773
  function generateUtilityClass(componentName, slot, globalStatePrefix = 'Mui') {
5729
- const globalStateClass = globalStateClassesMapping[slot];
5774
+ const globalStateClass = globalStateClasses[slot];
5730
5775
  return globalStateClass ? `${globalStatePrefix}-${globalStateClass}` : `${ClassNameGenerator.generate(componentName)}-${slot}`;
5731
5776
  }
5732
5777
 
@@ -5738,6 +5783,10 @@ function generateUtilityClasses(componentName, slots, globalStatePrefix = 'Mui')
5738
5783
  return result;
5739
5784
  }
5740
5785
 
5786
+ function clamp(val, min = Number.MIN_SAFE_INTEGER, max = Number.MAX_SAFE_INTEGER) {
5787
+ return Math.max(min, Math.min(val, max));
5788
+ }
5789
+
5741
5790
  const _excluded$g = ["values", "unit", "step"];
5742
5791
  const sortBreakpointsValues = values => {
5743
5792
  const breakpointsAsArray = Object.keys(values).map(key => ({
@@ -6746,6 +6795,81 @@ function unstable_createStyleFunctionSx() {
6746
6795
  const styleFunctionSx = unstable_createStyleFunctionSx();
6747
6796
  styleFunctionSx.filterProps = ['sx'];
6748
6797
 
6798
+ /**
6799
+ * A universal utility to style components with multiple color modes. Always use it from the theme object.
6800
+ * It works with:
6801
+ * - [Basic theme](https://mui.com/material-ui/customization/dark-mode/)
6802
+ * - [CSS theme variables](https://mui.com/material-ui/experimental-api/css-theme-variables/overview/)
6803
+ * - Zero-runtime engine
6804
+ *
6805
+ * Tips: Use an array over object spread and place `theme.applyStyles()` last.
6806
+ *
6807
+ * ✅ [{ background: '#e5e5e5' }, theme.applyStyles('dark', { background: '#1c1c1c' })]
6808
+ *
6809
+ * 🚫 { background: '#e5e5e5', ...theme.applyStyles('dark', { background: '#1c1c1c' })}
6810
+ *
6811
+ * @example
6812
+ * 1. using with `styled`:
6813
+ * ```jsx
6814
+ * const Component = styled('div')(({ theme }) => [
6815
+ * { background: '#e5e5e5' },
6816
+ * theme.applyStyles('dark', {
6817
+ * background: '#1c1c1c',
6818
+ * color: '#fff',
6819
+ * }),
6820
+ * ]);
6821
+ * ```
6822
+ *
6823
+ * @example
6824
+ * 2. using with `sx` prop:
6825
+ * ```jsx
6826
+ * <Box sx={theme => [
6827
+ * { background: '#e5e5e5' },
6828
+ * theme.applyStyles('dark', {
6829
+ * background: '#1c1c1c',
6830
+ * color: '#fff',
6831
+ * }),
6832
+ * ]}
6833
+ * />
6834
+ * ```
6835
+ *
6836
+ * @example
6837
+ * 3. theming a component:
6838
+ * ```jsx
6839
+ * extendTheme({
6840
+ * components: {
6841
+ * MuiButton: {
6842
+ * styleOverrides: {
6843
+ * root: ({ theme }) => [
6844
+ * { background: '#e5e5e5' },
6845
+ * theme.applyStyles('dark', {
6846
+ * background: '#1c1c1c',
6847
+ * color: '#fff',
6848
+ * }),
6849
+ * ],
6850
+ * },
6851
+ * }
6852
+ * }
6853
+ * })
6854
+ *```
6855
+ */
6856
+ function applyStyles(key, styles) {
6857
+ // @ts-expect-error this is 'any' type
6858
+ const theme = this;
6859
+ if (theme.vars && typeof theme.getColorSchemeSelector === 'function') {
6860
+ // If CssVarsProvider is used as a provider,
6861
+ // returns '* :where([data-mui-color-scheme="light|dark"]) &'
6862
+ const selector = theme.getColorSchemeSelector(key).replace(/(\[[^\]]+\])/, '*:where($1)');
6863
+ return {
6864
+ [selector]: styles
6865
+ };
6866
+ }
6867
+ if (theme.palette.mode === key) {
6868
+ return styles;
6869
+ }
6870
+ return {};
6871
+ }
6872
+
6749
6873
  const _excluded$f = ["breakpoints", "palette", "spacing", "shape"];
6750
6874
  function createTheme$1(options = {}, ...args) {
6751
6875
  const {
@@ -6768,6 +6892,7 @@ function createTheme$1(options = {}, ...args) {
6768
6892
  spacing,
6769
6893
  shape: _extends$3({}, shape$1, shapeInput)
6770
6894
  }, other);
6895
+ muiTheme.applyStyles = applyStyles;
6771
6896
  muiTheme = args.reduce((acc, argument) => deepmerge(acc, argument), muiTheme);
6772
6897
  muiTheme.unstable_sxConfig = _extends$3({}, defaultSxConfig$1, other == null ? void 0 : other.unstable_sxConfig);
6773
6898
  muiTheme.unstable_sx = function sx(props) {
@@ -7144,7 +7269,6 @@ function useThemeProps$1({
7144
7269
  return mergedProps;
7145
7270
  }
7146
7271
 
7147
- /* eslint-disable @typescript-eslint/naming-convention */
7148
7272
  /**
7149
7273
  * Returns a number whose value is limited to the given range.
7150
7274
  * @param {number} value The value to be clamped
@@ -7152,8 +7276,8 @@ function useThemeProps$1({
7152
7276
  * @param {number} max The upper boundary of the output range
7153
7277
  * @returns {number} A number in the range [min, max]
7154
7278
  */
7155
- function clamp(value, min = 0, max = 1) {
7156
- return Math.min(Math.max(min, value), max);
7279
+ function clampWrapper(value, min = 0, max = 1) {
7280
+ return clamp(value, min, max);
7157
7281
  }
7158
7282
 
7159
7283
  /**
@@ -7315,7 +7439,7 @@ function getContrastRatio(foreground, background) {
7315
7439
  */
7316
7440
  function darken(color, coefficient) {
7317
7441
  color = decomposeColor(color);
7318
- coefficient = clamp(coefficient);
7442
+ coefficient = clampWrapper(coefficient);
7319
7443
  if (color.type.indexOf('hsl') !== -1) {
7320
7444
  color.values[2] *= 1 - coefficient;
7321
7445
  } else if (color.type.indexOf('rgb') !== -1 || color.type.indexOf('color') !== -1) {
@@ -7334,7 +7458,7 @@ function darken(color, coefficient) {
7334
7458
  */
7335
7459
  function lighten(color, coefficient) {
7336
7460
  color = decomposeColor(color);
7337
- coefficient = clamp(coefficient);
7461
+ coefficient = clampWrapper(coefficient);
7338
7462
  if (color.type.indexOf('hsl') !== -1) {
7339
7463
  color.values[2] += (100 - color.values[2]) * coefficient;
7340
7464
  } else if (color.type.indexOf('rgb') !== -1) {
@@ -8568,7 +8692,7 @@ function create$3(definition) {
8568
8692
  return cache[key];
8569
8693
  }
8570
8694
 
8571
- const NEBULA_VERSION_HASH = "c1b9" ;
8695
+ const NEBULA_VERSION_HASH = "339b" ;
8572
8696
  ClassNameGenerator.configure(componentName => {
8573
8697
  return "njs-".concat(NEBULA_VERSION_HASH, "-").concat(componentName.replace('Mui', ''));
8574
8698
  });
@@ -8828,7 +8952,7 @@ function boot(_ref2) {
8828
8952
  const appRef = React__default.createRef();
8829
8953
  const element = document.createElement('div');
8830
8954
  element.style.display = 'none';
8831
- element.setAttribute('data-nebulajs-version', "4.10.0" );
8955
+ element.setAttribute('data-nebulajs-version', "4.11.0" );
8832
8956
  element.setAttribute('data-app-id', app.id);
8833
8957
  document.body.appendChild(element);
8834
8958
  if (context) {
@@ -18755,16 +18879,15 @@ class AutoSizer extends Component {
18755
18879
  onResize
18756
18880
  } = this.props;
18757
18881
  if (this._parentNode) {
18758
- var _style$paddingLeft, _style$paddingRight, _style$paddingTop, _style$paddingBottom;
18759
18882
  // Guard against AutoSizer component being removed from the DOM immediately after being added.
18760
18883
  // This can result in invalid style values which can result in NaN values if we don't handle them.
18761
18884
  // See issue #150 for more context.
18762
18885
 
18763
18886
  const style = window.getComputedStyle(this._parentNode) || {};
18764
- const paddingLeft = parseFloat((_style$paddingLeft = style.paddingLeft) !== null && _style$paddingLeft !== void 0 ? _style$paddingLeft : "0");
18765
- const paddingRight = parseFloat((_style$paddingRight = style.paddingRight) !== null && _style$paddingRight !== void 0 ? _style$paddingRight : "0");
18766
- const paddingTop = parseFloat((_style$paddingTop = style.paddingTop) !== null && _style$paddingTop !== void 0 ? _style$paddingTop : "0");
18767
- const paddingBottom = parseFloat((_style$paddingBottom = style.paddingBottom) !== null && _style$paddingBottom !== void 0 ? _style$paddingBottom : "0");
18887
+ const paddingLeft = parseFloat(style.paddingLeft || "0");
18888
+ const paddingRight = parseFloat(style.paddingRight || "0");
18889
+ const paddingTop = parseFloat(style.paddingTop || "0");
18890
+ const paddingBottom = parseFloat(style.paddingBottom || "0");
18768
18891
  const rect = this._parentNode.getBoundingClientRect();
18769
18892
  const scaledHeight = rect.height - paddingTop - paddingBottom;
18770
18893
  const scaledWidth = rect.width - paddingLeft - paddingRight;
@@ -23525,7 +23648,8 @@ function initiate(component) {
23525
23648
  },
23526
23649
  accessibility: {
23527
23650
  setter: null
23528
- }
23651
+ },
23652
+ contraintsWarning: true
23529
23653
  };
23530
23654
  }
23531
23655
  function teardown(component) {
@@ -24345,8 +24469,11 @@ function useAction(fn, deps) {
24345
24469
  */
24346
24470
  function useConstraints() {
24347
24471
  {
24348
- // eslint-disable-next-line no-console
24349
- console.warn('useContraints has been deprecated, please change to useInteractions instead. Note that interactions uses inverted values compared to contraints.');
24472
+ if (currentComponent.__hooks.contraintsWarning) {
24473
+ // eslint-disable-next-line no-console
24474
+ console.warn('useContraints has been deprecated, please change to useInteractions instead. Note that interactions uses inverted values compared to contraints.');
24475
+ currentComponent.__hooks.contraintsWarning = false;
24476
+ }
24350
24477
  }
24351
24478
  return useInternalContext('constraints');
24352
24479
  }