@mui/material 5.11.11 → 5.11.13

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.
Files changed (50) hide show
  1. package/Autocomplete/Autocomplete.d.ts +1 -0
  2. package/Autocomplete/Autocomplete.js +5 -2
  3. package/Autocomplete/autocompleteClasses.d.ts +2 -0
  4. package/Autocomplete/autocompleteClasses.js +1 -1
  5. package/CHANGELOG.md +187 -2
  6. package/DialogTitle/DialogTitle.js +2 -2
  7. package/Menu/Menu.js +1 -1
  8. package/index.js +1 -1
  9. package/legacy/Autocomplete/Autocomplete.js +5 -2
  10. package/legacy/Autocomplete/autocompleteClasses.js +1 -1
  11. package/legacy/DialogTitle/DialogTitle.js +2 -2
  12. package/legacy/Menu/Menu.js +1 -1
  13. package/legacy/index.js +1 -1
  14. package/legacy/styles/CssVarsProvider.js +1 -8
  15. package/legacy/styles/createTypography.js +8 -1
  16. package/legacy/styles/experimental_extendTheme.js +59 -40
  17. package/legacy/styles/index.js +1 -0
  18. package/legacy/styles/shouldSkipGeneratingVar.js +6 -0
  19. package/modern/Autocomplete/Autocomplete.js +5 -2
  20. package/modern/Autocomplete/autocompleteClasses.js +1 -1
  21. package/modern/DialogTitle/DialogTitle.js +2 -2
  22. package/modern/Menu/Menu.js +1 -1
  23. package/modern/index.js +1 -1
  24. package/modern/styles/CssVarsProvider.js +1 -5
  25. package/modern/styles/createTypography.js +8 -1
  26. package/modern/styles/experimental_extendTheme.js +60 -41
  27. package/modern/styles/index.js +1 -0
  28. package/modern/styles/shouldSkipGeneratingVar.js +5 -0
  29. package/node/Autocomplete/Autocomplete.js +5 -2
  30. package/node/Autocomplete/autocompleteClasses.js +1 -1
  31. package/node/DialogTitle/DialogTitle.js +2 -2
  32. package/node/Menu/Menu.js +1 -1
  33. package/node/index.js +1 -1
  34. package/node/styles/CssVarsProvider.js +1 -9
  35. package/node/styles/createTypography.js +8 -1
  36. package/node/styles/experimental_extendTheme.js +59 -40
  37. package/node/styles/index.js +8 -0
  38. package/node/styles/shouldSkipGeneratingVar.js +12 -0
  39. package/package.json +5 -5
  40. package/styles/CssVarsProvider.d.ts +1 -2
  41. package/styles/CssVarsProvider.js +1 -8
  42. package/styles/createTypography.js +8 -1
  43. package/styles/experimental_extendTheme.d.ts +20 -0
  44. package/styles/experimental_extendTheme.js +60 -41
  45. package/styles/index.d.ts +1 -0
  46. package/styles/index.js +1 -0
  47. package/styles/shouldSkipGeneratingVar.d.ts +1 -0
  48. package/styles/shouldSkipGeneratingVar.js +6 -0
  49. package/umd/material-ui.development.js +362 -221
  50. package/umd/material-ui.production.min.js +20 -20
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/material v5.11.11
2
+ * @mui/material v5.11.13
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -2292,7 +2292,7 @@
2292
2292
  return output;
2293
2293
  }
2294
2294
 
2295
- function composeClasses(slots, getUtilityClass, classes) {
2295
+ function composeClasses(slots, getUtilityClass, classes = undefined) {
2296
2296
  const output = {};
2297
2297
  Object.keys(slots).forEach(
2298
2298
  // `Objet.keys(slots)` can't be wider than `T` because we infer `T` from `slots`.
@@ -2300,7 +2300,10 @@
2300
2300
  slot => {
2301
2301
  output[slot] = slots[slot].reduce((acc, key) => {
2302
2302
  if (key) {
2303
- acc.push(getUtilityClass(key));
2303
+ const utilityClass = getUtilityClass(key);
2304
+ if (utilityClass !== '') {
2305
+ acc.push(utilityClass);
2306
+ }
2304
2307
  if (classes && classes[key]) {
2305
2308
  acc.push(classes[key]);
2306
2309
  }
@@ -6447,6 +6450,28 @@
6447
6450
  });
6448
6451
  compose(width, maxWidth, minWidth, height, maxHeight, minHeight, boxSizing);
6449
6452
 
6453
+ const createFontStyleFunction = prop => {
6454
+ return props => {
6455
+ if (props[prop] !== undefined && props[prop] !== null) {
6456
+ const styleFromPropValue = propValue => {
6457
+ var _props$theme$typograp, _props$prop;
6458
+ let value = (_props$theme$typograp = props.theme.typography) == null ? void 0 : _props$theme$typograp[`${prop}${props[prop] === 'default' || props[prop] === prop ? '' : capitalize((_props$prop = props[prop]) == null ? void 0 : _props$prop.toString())}`];
6459
+ if (!value) {
6460
+ var _props$theme$typograp2, _props$theme$typograp3;
6461
+ value = (_props$theme$typograp2 = props.theme.typography) == null ? void 0 : (_props$theme$typograp3 = _props$theme$typograp2[propValue]) == null ? void 0 : _props$theme$typograp3[prop];
6462
+ }
6463
+ if (!value) {
6464
+ value = propValue;
6465
+ }
6466
+ return {
6467
+ [prop]: value
6468
+ };
6469
+ };
6470
+ return handleBreakpoints(props, props[prop], styleFromPropValue);
6471
+ }
6472
+ return null;
6473
+ };
6474
+ };
6450
6475
  const defaultSxConfig = {
6451
6476
  // borders
6452
6477
  border: {
@@ -6705,16 +6730,19 @@
6705
6730
  boxSizing: {},
6706
6731
  // typography
6707
6732
  fontFamily: {
6708
- themeKey: 'typography'
6733
+ themeKey: 'typography',
6734
+ style: createFontStyleFunction('fontFamily')
6709
6735
  },
6710
6736
  fontSize: {
6711
- themeKey: 'typography'
6737
+ themeKey: 'typography',
6738
+ style: createFontStyleFunction('fontSize')
6712
6739
  },
6713
6740
  fontStyle: {
6714
6741
  themeKey: 'typography'
6715
6742
  },
6716
6743
  fontWeight: {
6717
- themeKey: 'typography'
6744
+ themeKey: 'typography',
6745
+ style: createFontStyleFunction('fontWeight')
6718
6746
  },
6719
6747
  letterSpacing: {},
6720
6748
  textTransform: {},
@@ -6844,7 +6872,7 @@
6844
6872
  styleFunctionSx.filterProps = ['sx'];
6845
6873
  var styleFunctionSx$1 = styleFunctionSx;
6846
6874
 
6847
- const _excluded$2m = ["sx"];
6875
+ const _excluded$2n = ["sx"];
6848
6876
  const splitProps = props => {
6849
6877
  var _props$theme$unstable, _props$theme;
6850
6878
  const result = {
@@ -6865,7 +6893,7 @@
6865
6893
  const {
6866
6894
  sx: inSx
6867
6895
  } = props,
6868
- other = _objectWithoutPropertiesLoose(props, _excluded$2m);
6896
+ other = _objectWithoutPropertiesLoose(props, _excluded$2n);
6869
6897
  const {
6870
6898
  systemProps,
6871
6899
  otherProps
@@ -6891,7 +6919,7 @@
6891
6919
 
6892
6920
  function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function clsx(){for(var e,t,f=0,n="";f<arguments.length;)(e=arguments[f++])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
6893
6921
 
6894
- const _excluded$2l = ["values", "unit", "step"];
6922
+ const _excluded$2m = ["values", "unit", "step"];
6895
6923
  const sortBreakpointsValues = values => {
6896
6924
  const breakpointsAsArray = Object.keys(values).map(key => ({
6897
6925
  key,
@@ -6926,7 +6954,7 @@
6926
6954
  unit = 'px',
6927
6955
  step = 5
6928
6956
  } = breakpoints,
6929
- other = _objectWithoutPropertiesLoose(breakpoints, _excluded$2l);
6957
+ other = _objectWithoutPropertiesLoose(breakpoints, _excluded$2m);
6930
6958
  const sortedValues = sortBreakpointsValues(values);
6931
6959
  const keys = Object.keys(sortedValues);
6932
6960
  function up(key) {
@@ -7005,7 +7033,7 @@
7005
7033
  return spacing;
7006
7034
  }
7007
7035
 
7008
- const _excluded$2k = ["breakpoints", "palette", "spacing", "shape"];
7036
+ const _excluded$2l = ["breakpoints", "palette", "spacing", "shape"];
7009
7037
  function createTheme$1(options = {}, ...args) {
7010
7038
  const {
7011
7039
  breakpoints: breakpointsInput = {},
@@ -7013,7 +7041,7 @@
7013
7041
  spacing: spacingInput,
7014
7042
  shape: shapeInput = {}
7015
7043
  } = options,
7016
- other = _objectWithoutPropertiesLoose(options, _excluded$2k);
7044
+ other = _objectWithoutPropertiesLoose(options, _excluded$2l);
7017
7045
  const breakpoints = createBreakpoints(breakpointsInput);
7018
7046
  const spacing = createSpacing(spacingInput);
7019
7047
  let muiTheme = deepmerge({
@@ -7124,7 +7152,7 @@
7124
7152
  return useTheme$2(defaultTheme);
7125
7153
  }
7126
7154
 
7127
- const _excluded$2j = ["className", "component"];
7155
+ const _excluded$2k = ["className", "component"];
7128
7156
  function createBox(options = {}) {
7129
7157
  const {
7130
7158
  defaultTheme,
@@ -7141,7 +7169,7 @@
7141
7169
  className,
7142
7170
  component = 'div'
7143
7171
  } = _extendSxProp,
7144
- other = _objectWithoutPropertiesLoose(_extendSxProp, _excluded$2j);
7172
+ other = _objectWithoutPropertiesLoose(_extendSxProp, _excluded$2k);
7145
7173
  return /*#__PURE__*/jsxRuntime_1(BoxRoot, _extends({
7146
7174
  as: component,
7147
7175
  ref: ref,
@@ -7152,7 +7180,7 @@
7152
7180
  return Box;
7153
7181
  }
7154
7182
 
7155
- const _excluded$2i = ["variant"];
7183
+ const _excluded$2j = ["variant"];
7156
7184
  function isEmpty$3(string) {
7157
7185
  return string.length === 0;
7158
7186
  }
@@ -7166,7 +7194,7 @@
7166
7194
  const {
7167
7195
  variant
7168
7196
  } = props,
7169
- other = _objectWithoutPropertiesLoose(props, _excluded$2i);
7197
+ other = _objectWithoutPropertiesLoose(props, _excluded$2j);
7170
7198
  let classKey = variant || '';
7171
7199
  Object.keys(other).sort().forEach(key => {
7172
7200
  if (key === 'color') {
@@ -7178,8 +7206,8 @@
7178
7206
  return classKey;
7179
7207
  }
7180
7208
 
7181
- const _excluded$2h = ["name", "slot", "skipVariantsResolver", "skipSx", "overridesResolver"],
7182
- _excluded2$c = ["theme"],
7209
+ const _excluded$2i = ["name", "slot", "skipVariantsResolver", "skipSx", "overridesResolver"],
7210
+ _excluded2$d = ["theme"],
7183
7211
  _excluded3$1 = ["theme"];
7184
7212
  function isEmpty$2(obj) {
7185
7213
  return Object.keys(obj).length === 0;
@@ -7265,7 +7293,7 @@
7265
7293
  skipSx: inputSkipSx,
7266
7294
  overridesResolver
7267
7295
  } = inputOptions,
7268
- options = _objectWithoutPropertiesLoose(inputOptions, _excluded$2h);
7296
+ options = _objectWithoutPropertiesLoose(inputOptions, _excluded$2i);
7269
7297
 
7270
7298
  // if skipVariantsResolver option is defined, take the value, otherwise, true for root and false for other slots.
7271
7299
  const skipVariantsResolver = inputSkipVariantsResolver !== undefined ? inputSkipVariantsResolver : componentSlot && componentSlot !== 'Root' || false;
@@ -7299,7 +7327,7 @@
7299
7327
  let {
7300
7328
  theme: themeInput
7301
7329
  } = _ref,
7302
- other = _objectWithoutPropertiesLoose(_ref, _excluded2$c);
7330
+ other = _objectWithoutPropertiesLoose(_ref, _excluded2$d);
7303
7331
  return stylesArg(_extends({
7304
7332
  theme: isEmpty$2(themeInput) ? defaultTheme : themeInput
7305
7333
  }, other));
@@ -7776,133 +7804,6 @@ The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rg
7776
7804
  ThemeProvider.propTypes = exactProp(ThemeProvider.propTypes) ;
7777
7805
  }
7778
7806
 
7779
- /**
7780
- * This function create an object from keys, value and then assign to target
7781
- *
7782
- * @param {Object} obj : the target object to be assigned
7783
- * @param {string[]} keys
7784
- * @param {string | number} value
7785
- *
7786
- * @example
7787
- * const source = {}
7788
- * assignNestedKeys(source, ['palette', 'primary'], 'var(--palette-primary)')
7789
- * console.log(source) // { palette: { primary: 'var(--palette-primary)' } }
7790
- *
7791
- * @example
7792
- * const source = { palette: { primary: 'var(--palette-primary)' } }
7793
- * assignNestedKeys(source, ['palette', 'secondary'], 'var(--palette-secondary)')
7794
- * console.log(source) // { palette: { primary: 'var(--palette-primary)', secondary: 'var(--palette-secondary)' } }
7795
- */
7796
- const assignNestedKeys = (obj, keys, value, arrayKeys = []) => {
7797
- let temp = obj;
7798
- keys.forEach((k, index) => {
7799
- if (index === keys.length - 1) {
7800
- if (Array.isArray(temp)) {
7801
- temp[Number(k)] = value;
7802
- } else if (temp && typeof temp === 'object') {
7803
- temp[k] = value;
7804
- }
7805
- } else if (temp && typeof temp === 'object') {
7806
- if (!temp[k]) {
7807
- temp[k] = arrayKeys.includes(k) ? [] : {};
7808
- }
7809
- temp = temp[k];
7810
- }
7811
- });
7812
- };
7813
-
7814
- /**
7815
- *
7816
- * @param {Object} obj : source object
7817
- * @param {Function} callback : a function that will be called when
7818
- * - the deepest key in source object is reached
7819
- * - the value of the deepest key is NOT `undefined` | `null`
7820
- *
7821
- * @example
7822
- * walkObjectDeep({ palette: { primary: { main: '#000000' } } }, console.log)
7823
- * // ['palette', 'primary', 'main'] '#000000'
7824
- */
7825
- const walkObjectDeep = (obj, callback, shouldSkipPaths) => {
7826
- function recurse(object, parentKeys = [], arrayKeys = []) {
7827
- Object.entries(object).forEach(([key, value]) => {
7828
- if (!shouldSkipPaths || shouldSkipPaths && !shouldSkipPaths([...parentKeys, key])) {
7829
- if (value !== undefined && value !== null) {
7830
- if (typeof value === 'object' && Object.keys(value).length > 0) {
7831
- recurse(value, [...parentKeys, key], Array.isArray(value) ? [...arrayKeys, key] : arrayKeys);
7832
- } else {
7833
- callback([...parentKeys, key], value, arrayKeys);
7834
- }
7835
- }
7836
- }
7837
- });
7838
- }
7839
- recurse(obj);
7840
- };
7841
- const getCssValue = (keys, value) => {
7842
- if (typeof value === 'number') {
7843
- if (['lineHeight', 'fontWeight', 'opacity', 'zIndex'].some(prop => keys.includes(prop))) {
7844
- // CSS property that are unitless
7845
- return value;
7846
- }
7847
- const lastKey = keys[keys.length - 1];
7848
- if (lastKey.toLowerCase().indexOf('opacity') >= 0) {
7849
- // opacity values are unitless
7850
- return value;
7851
- }
7852
- return `${value}px`;
7853
- }
7854
- return value;
7855
- };
7856
-
7857
- /**
7858
- * a function that parse theme and return { css, vars }
7859
- *
7860
- * @param {Object} theme
7861
- * @param {{
7862
- * prefix?: string,
7863
- * shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean
7864
- * }} options.
7865
- * `prefix`: The prefix of the generated CSS variables. This function does not change the value.
7866
- *
7867
- * @returns {{ css: Object, vars: Object }} `css` is the stylesheet, `vars` is an object to get css variable (same structure as theme).
7868
- *
7869
- * @example
7870
- * const { css, vars } = parser({
7871
- * fontSize: 12,
7872
- * lineHeight: 1.2,
7873
- * palette: { primary: { 500: 'var(--color)' } }
7874
- * }, { prefix: 'foo' })
7875
- *
7876
- * console.log(css) // { '--foo-fontSize': '12px', '--foo-lineHeight': 1.2, '--foo-palette-primary-500': 'var(--color)' }
7877
- * console.log(vars) // { fontSize: 'var(--foo-fontSize)', lineHeight: 'var(--foo-lineHeight)', palette: { primary: { 500: 'var(--foo-palette-primary-500)' } } }
7878
- */
7879
- function cssVarsParser(theme, options) {
7880
- const {
7881
- prefix,
7882
- shouldSkipGeneratingVar
7883
- } = options || {};
7884
- const css = {};
7885
- const vars = {};
7886
- walkObjectDeep(theme, (keys, value, arrayKeys) => {
7887
- if (typeof value === 'string' || typeof value === 'number') {
7888
- if (!shouldSkipGeneratingVar || !shouldSkipGeneratingVar(keys, value)) {
7889
- // only create css & var if `shouldSkipGeneratingVar` return false
7890
- const cssVar = `--${prefix ? `${prefix}-` : ''}${keys.join('-')}`;
7891
- Object.assign(css, {
7892
- [cssVar]: getCssValue(keys, value)
7893
- });
7894
- assignNestedKeys(vars, keys, `var(${cssVar})`, arrayKeys);
7895
- }
7896
- }
7897
- }, keys => keys[0] === 'vars' // skip 'vars/*' paths
7898
- );
7899
-
7900
- return {
7901
- css,
7902
- vars
7903
- };
7904
- }
7905
-
7906
7807
  const DEFAULT_MODE_STORAGE_KEY = 'mode';
7907
7808
  const DEFAULT_COLOR_SCHEME_STORAGE_KEY = 'color-scheme';
7908
7809
  const DEFAULT_ATTRIBUTE = 'data-color-scheme';
@@ -8162,7 +8063,7 @@ The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rg
8162
8063
  });
8163
8064
  }
8164
8065
 
8165
- const _excluded$2g = ["colorSchemes", "components", "cssVarPrefix"];
8066
+ const _excluded$2h = ["colorSchemes", "components", "generateCssVars", "cssVarPrefix"];
8166
8067
  const DISABLE_CSS_TRANSITION = '*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}';
8167
8068
  function createCssVarsProvider(options) {
8168
8069
  const {
@@ -8173,7 +8074,6 @@ The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rg
8173
8074
  defaultMode: designSystemMode = 'light',
8174
8075
  defaultColorScheme: designSystemColorScheme,
8175
8076
  disableTransitionOnChange: designSystemTransitionOnChange = false,
8176
- shouldSkipGeneratingVar: designSystemShouldSkipGeneratingVar,
8177
8077
  resolveTheme,
8178
8078
  excludeVariablesFromRoot
8179
8079
  } = options;
@@ -8201,7 +8101,6 @@ The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rg
8201
8101
  documentNode = typeof document === 'undefined' ? undefined : document,
8202
8102
  colorSchemeNode = typeof document === 'undefined' ? undefined : document.documentElement,
8203
8103
  colorSchemeSelector = ':root',
8204
- shouldSkipGeneratingVar = designSystemShouldSkipGeneratingVar,
8205
8104
  disableNestedContext = false,
8206
8105
  disableStyleSheetGeneration = false
8207
8106
  }) {
@@ -8212,9 +8111,13 @@ The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rg
8212
8111
  const {
8213
8112
  colorSchemes = {},
8214
8113
  components = {},
8114
+ generateCssVars = () => ({
8115
+ vars: {},
8116
+ css: {}
8117
+ }),
8215
8118
  cssVarPrefix
8216
8119
  } = themeProp,
8217
- restThemeProp = _objectWithoutPropertiesLoose(themeProp, _excluded$2g);
8120
+ restThemeProp = _objectWithoutPropertiesLoose(themeProp, _excluded$2h);
8218
8121
  const allColorSchemes = Object.keys(colorSchemes);
8219
8122
  const defaultLightColorScheme = typeof defaultColorScheme === 'string' ? defaultColorScheme : defaultColorScheme.light;
8220
8123
  const defaultDarkColorScheme = typeof defaultColorScheme === 'string' ? defaultColorScheme : defaultColorScheme.dark;
@@ -8269,10 +8172,7 @@ The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rg
8269
8172
  const {
8270
8173
  css: rootCss,
8271
8174
  vars: rootVars
8272
- } = cssVarsParser(restThemeProp, {
8273
- prefix: cssVarPrefix,
8274
- shouldSkipGeneratingVar
8275
- });
8175
+ } = generateCssVars();
8276
8176
 
8277
8177
  // 3. Start composing the theme object
8278
8178
  const theme = _extends({}, restThemeProp, {
@@ -8292,10 +8192,7 @@ The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rg
8292
8192
  const {
8293
8193
  css,
8294
8194
  vars
8295
- } = cssVarsParser(scheme, {
8296
- prefix: cssVarPrefix,
8297
- shouldSkipGeneratingVar
8298
- });
8195
+ } = generateCssVars(key);
8299
8196
  theme.vars = deepmerge(theme.vars, vars);
8300
8197
  if (key === calculatedColorScheme) {
8301
8198
  // 4.1 Merge the selected color scheme to the theme
@@ -8334,6 +8231,7 @@ The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rg
8334
8231
  otherColorSchemesStyleSheet[`${colorSchemeSelector === ':root' ? '' : colorSchemeSelector}[${attribute}="${key}"]`] = css;
8335
8232
  }
8336
8233
  });
8234
+ theme.vars = deepmerge(theme.vars, rootVars);
8337
8235
 
8338
8236
  // 5. Declaring effects
8339
8237
  // 5.1 Updates the selector value to use the current color scheme which tells CSS to use the proper stylesheet.
@@ -8458,10 +8356,6 @@ The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rg
8458
8356
  * The key in the local storage used to store current color scheme.
8459
8357
  */
8460
8358
  modeStorageKey: PropTypes.string,
8461
- /**
8462
- * A function to determine if the key, value should be attached as CSS Variable
8463
- */
8464
- shouldSkipGeneratingVar: PropTypes.func,
8465
8359
  /**
8466
8360
  * The window that attaches the 'storage' event listener
8467
8361
  * @default window
@@ -8499,7 +8393,7 @@ The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rg
8499
8393
  return '';
8500
8394
  }
8501
8395
  const value = vars[0];
8502
- if (typeof value === 'string' && !value.match(/(#|\(|\)|(-?(\d*\.)?\d+)(px|em|%|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc))/)) {
8396
+ if (typeof value === 'string' && !value.match(/(#|\(|\)|(-?(\d*\.)?\d+)(px|em|%|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc))|^(-?(\d*\.)?\d+)$|(\d+ \d+ \d+)/)) {
8503
8397
  return `, var(--${prefix ? `${prefix}-` : ''}${value}${appendVar(...vars.slice(1))})`;
8504
8398
  }
8505
8399
  return `, ${value}`;
@@ -8512,6 +8406,195 @@ The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rg
8512
8406
  return getCssVar;
8513
8407
  }
8514
8408
 
8409
+ /**
8410
+ * This function create an object from keys, value and then assign to target
8411
+ *
8412
+ * @param {Object} obj : the target object to be assigned
8413
+ * @param {string[]} keys
8414
+ * @param {string | number} value
8415
+ *
8416
+ * @example
8417
+ * const source = {}
8418
+ * assignNestedKeys(source, ['palette', 'primary'], 'var(--palette-primary)')
8419
+ * console.log(source) // { palette: { primary: 'var(--palette-primary)' } }
8420
+ *
8421
+ * @example
8422
+ * const source = { palette: { primary: 'var(--palette-primary)' } }
8423
+ * assignNestedKeys(source, ['palette', 'secondary'], 'var(--palette-secondary)')
8424
+ * console.log(source) // { palette: { primary: 'var(--palette-primary)', secondary: 'var(--palette-secondary)' } }
8425
+ */
8426
+ const assignNestedKeys = (obj, keys, value, arrayKeys = []) => {
8427
+ let temp = obj;
8428
+ keys.forEach((k, index) => {
8429
+ if (index === keys.length - 1) {
8430
+ if (Array.isArray(temp)) {
8431
+ temp[Number(k)] = value;
8432
+ } else if (temp && typeof temp === 'object') {
8433
+ temp[k] = value;
8434
+ }
8435
+ } else if (temp && typeof temp === 'object') {
8436
+ if (!temp[k]) {
8437
+ temp[k] = arrayKeys.includes(k) ? [] : {};
8438
+ }
8439
+ temp = temp[k];
8440
+ }
8441
+ });
8442
+ };
8443
+
8444
+ /**
8445
+ *
8446
+ * @param {Object} obj : source object
8447
+ * @param {Function} callback : a function that will be called when
8448
+ * - the deepest key in source object is reached
8449
+ * - the value of the deepest key is NOT `undefined` | `null`
8450
+ *
8451
+ * @example
8452
+ * walkObjectDeep({ palette: { primary: { main: '#000000' } } }, console.log)
8453
+ * // ['palette', 'primary', 'main'] '#000000'
8454
+ */
8455
+ const walkObjectDeep = (obj, callback, shouldSkipPaths) => {
8456
+ function recurse(object, parentKeys = [], arrayKeys = []) {
8457
+ Object.entries(object).forEach(([key, value]) => {
8458
+ if (!shouldSkipPaths || shouldSkipPaths && !shouldSkipPaths([...parentKeys, key])) {
8459
+ if (value !== undefined && value !== null) {
8460
+ if (typeof value === 'object' && Object.keys(value).length > 0) {
8461
+ recurse(value, [...parentKeys, key], Array.isArray(value) ? [...arrayKeys, key] : arrayKeys);
8462
+ } else {
8463
+ callback([...parentKeys, key], value, arrayKeys);
8464
+ }
8465
+ }
8466
+ }
8467
+ });
8468
+ }
8469
+ recurse(obj);
8470
+ };
8471
+ const getCssValue = (keys, value) => {
8472
+ if (typeof value === 'number') {
8473
+ if (['lineHeight', 'fontWeight', 'opacity', 'zIndex'].some(prop => keys.includes(prop))) {
8474
+ // CSS property that are unitless
8475
+ return value;
8476
+ }
8477
+ const lastKey = keys[keys.length - 1];
8478
+ if (lastKey.toLowerCase().indexOf('opacity') >= 0) {
8479
+ // opacity values are unitless
8480
+ return value;
8481
+ }
8482
+ return `${value}px`;
8483
+ }
8484
+ return value;
8485
+ };
8486
+
8487
+ /**
8488
+ * a function that parse theme and return { css, vars }
8489
+ *
8490
+ * @param {Object} theme
8491
+ * @param {{
8492
+ * prefix?: string,
8493
+ * shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean
8494
+ * }} options.
8495
+ * `prefix`: The prefix of the generated CSS variables. This function does not change the value.
8496
+ *
8497
+ * @returns {{ css: Object, vars: Object }} `css` is the stylesheet, `vars` is an object to get css variable (same structure as theme).
8498
+ *
8499
+ * @example
8500
+ * const { css, vars } = parser({
8501
+ * fontSize: 12,
8502
+ * lineHeight: 1.2,
8503
+ * palette: { primary: { 500: 'var(--color)' } }
8504
+ * }, { prefix: 'foo' })
8505
+ *
8506
+ * console.log(css) // { '--foo-fontSize': '12px', '--foo-lineHeight': 1.2, '--foo-palette-primary-500': 'var(--color)' }
8507
+ * console.log(vars) // { fontSize: 'var(--foo-fontSize)', lineHeight: 'var(--foo-lineHeight)', palette: { primary: { 500: 'var(--foo-palette-primary-500)' } } }
8508
+ */
8509
+ function cssVarsParser(theme, options) {
8510
+ const {
8511
+ prefix,
8512
+ shouldSkipGeneratingVar
8513
+ } = options || {};
8514
+ const css = {};
8515
+ const vars = {};
8516
+ const varsWithDefaults = {};
8517
+ walkObjectDeep(theme, (keys, value, arrayKeys) => {
8518
+ if (typeof value === 'string' || typeof value === 'number') {
8519
+ if (!shouldSkipGeneratingVar || !shouldSkipGeneratingVar(keys, value)) {
8520
+ // only create css & var if `shouldSkipGeneratingVar` return false
8521
+ const cssVar = `--${prefix ? `${prefix}-` : ''}${keys.join('-')}`;
8522
+ Object.assign(css, {
8523
+ [cssVar]: getCssValue(keys, value)
8524
+ });
8525
+ assignNestedKeys(vars, keys, `var(${cssVar})`, arrayKeys);
8526
+ assignNestedKeys(varsWithDefaults, keys, `var(${cssVar}, ${value})`, arrayKeys);
8527
+ }
8528
+ }
8529
+ }, keys => keys[0] === 'vars' // skip 'vars/*' paths
8530
+ );
8531
+
8532
+ return {
8533
+ css,
8534
+ vars,
8535
+ varsWithDefaults
8536
+ };
8537
+ }
8538
+
8539
+ const _excluded$2g = ["colorSchemes", "components"],
8540
+ _excluded2$c = ["light"];
8541
+ function prepareCssVars(theme, parserConfig) {
8542
+ // @ts-ignore - ignore components do not exist
8543
+ const {
8544
+ colorSchemes = {}
8545
+ } = theme,
8546
+ otherTheme = _objectWithoutPropertiesLoose(theme, _excluded$2g);
8547
+ const {
8548
+ vars: rootVars,
8549
+ css: rootCss,
8550
+ varsWithDefaults: rootVarsWithDefaults
8551
+ } = cssVarsParser(otherTheme, parserConfig);
8552
+ let themeVars = rootVarsWithDefaults;
8553
+ const colorSchemesMap = {};
8554
+ const {
8555
+ light
8556
+ } = colorSchemes,
8557
+ otherColorSchemes = _objectWithoutPropertiesLoose(colorSchemes, _excluded2$c);
8558
+ Object.entries(otherColorSchemes || {}).forEach(([key, scheme]) => {
8559
+ const {
8560
+ vars,
8561
+ css,
8562
+ varsWithDefaults
8563
+ } = cssVarsParser(scheme, parserConfig);
8564
+ themeVars = deepmerge(themeVars, varsWithDefaults);
8565
+ colorSchemesMap[key] = {
8566
+ css,
8567
+ vars
8568
+ };
8569
+ });
8570
+ if (light) {
8571
+ // light color scheme vars should be merged last to set as default
8572
+ const {
8573
+ css,
8574
+ vars,
8575
+ varsWithDefaults
8576
+ } = cssVarsParser(light, parserConfig);
8577
+ themeVars = deepmerge(themeVars, varsWithDefaults);
8578
+ colorSchemesMap.light = {
8579
+ css,
8580
+ vars
8581
+ };
8582
+ }
8583
+ const generateCssVars = colorScheme => {
8584
+ if (!colorScheme) {
8585
+ return {
8586
+ css: rootCss,
8587
+ vars: rootVars
8588
+ };
8589
+ }
8590
+ return colorSchemesMap[colorScheme];
8591
+ };
8592
+ return {
8593
+ vars: themeVars,
8594
+ generateCssVars
8595
+ };
8596
+ }
8597
+
8515
8598
  const _excluded$2f = ["className", "component", "disableGutters", "fixed", "maxWidth", "classes"];
8516
8599
  const defaultTheme$6 = createTheme$1();
8517
8600
  const defaultCreateStyledComponent$2 = systemStyled('div', {
@@ -9643,7 +9726,14 @@ const theme2 = createTheme({ palette: {
9643
9726
  body2: buildVariant(fontWeightRegular, 14, 1.43, 0.15),
9644
9727
  button: buildVariant(fontWeightMedium, 14, 1.75, 0.4, caseAllCaps),
9645
9728
  caption: buildVariant(fontWeightRegular, 12, 1.66, 0.4),
9646
- overline: buildVariant(fontWeightRegular, 12, 2.66, 1, caseAllCaps)
9729
+ overline: buildVariant(fontWeightRegular, 12, 2.66, 1, caseAllCaps),
9730
+ inherit: {
9731
+ fontFamily: 'inherit',
9732
+ fontWeight: 'inherit',
9733
+ fontSize: 'inherit',
9734
+ lineHeight: 'inherit',
9735
+ letterSpacing: 'inherit'
9736
+ }
9647
9737
  };
9648
9738
  return deepmerge(_extends({
9649
9739
  htmlFontSize,
@@ -10093,6 +10183,13 @@ You have to import it from @mui/styles.
10093
10183
  See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
10094
10184
  }
10095
10185
 
10186
+ function shouldSkipGeneratingVar(keys) {
10187
+ var _keys$;
10188
+ return !!keys[0].match(/(cssVarPrefix|typography|mixins|breakpoints|direction|transitions)/) || !!keys[0].match(/sxConfig$/) ||
10189
+ // ends with sxConfig
10190
+ keys[0] === 'palette' && !!((_keys$ = keys[1]) != null && _keys$.match(/(mode|contrastThreshold|tonalOffset)/));
10191
+ }
10192
+
10096
10193
  // Inspired by https://github.com/material-components/material-components-ios/blob/bca36107405594d5b7b16265a5b0ed698f85a5ee/components/Elevation/src/UIColor%2BMaterialElevation.m#L61
10097
10194
  const getOverlayAlpha = elevation => {
10098
10195
  let alphaValue;
@@ -10105,7 +10202,7 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
10105
10202
  };
10106
10203
  var getOverlayAlpha$1 = getOverlayAlpha;
10107
10204
 
10108
- const _excluded$27 = ["colorSchemes", "cssVarPrefix"],
10205
+ const _excluded$27 = ["colorSchemes", "cssVarPrefix", "shouldSkipGeneratingVar"],
10109
10206
  _excluded2$a = ["palette"];
10110
10207
  const defaultDarkOverlays = [...Array(25)].map((_, index) => {
10111
10208
  if (index === 0) {
@@ -10146,7 +10243,8 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
10146
10243
  var _colorSchemesInput$li, _colorSchemesInput$da, _colorSchemesInput$li2, _colorSchemesInput$li3, _colorSchemesInput$da2, _colorSchemesInput$da3;
10147
10244
  const {
10148
10245
  colorSchemes: colorSchemesInput = {},
10149
- cssVarPrefix = 'mui'
10246
+ cssVarPrefix = 'mui',
10247
+ shouldSkipGeneratingVar: shouldSkipGeneratingVar$1 = shouldSkipGeneratingVar
10150
10248
  } = options,
10151
10249
  input = _objectWithoutPropertiesLoose(options, _excluded$27);
10152
10250
  const getCssVar = createGetCssVar(cssVarPrefix);
@@ -10192,6 +10290,12 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
10192
10290
  });
10193
10291
  Object.keys(theme.colorSchemes).forEach(key => {
10194
10292
  const palette = theme.colorSchemes[key].palette;
10293
+ const setCssVarColor = cssVar => {
10294
+ const tokens = cssVar.split('-');
10295
+ const color = tokens[1];
10296
+ const colorToken = tokens[2];
10297
+ return getCssVar(cssVar, palette[color][colorToken]);
10298
+ };
10195
10299
 
10196
10300
  // attach black & white channels to common node
10197
10301
  if (key === 'light') {
@@ -10209,10 +10313,10 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
10209
10313
  setColor(palette.Alert, 'infoColor', private_safeDarken(palette.info.light, 0.6));
10210
10314
  setColor(palette.Alert, 'successColor', private_safeDarken(palette.success.light, 0.6));
10211
10315
  setColor(palette.Alert, 'warningColor', private_safeDarken(palette.warning.light, 0.6));
10212
- setColor(palette.Alert, 'errorFilledBg', getCssVar('palette-error-main'));
10213
- setColor(palette.Alert, 'infoFilledBg', getCssVar('palette-info-main'));
10214
- setColor(palette.Alert, 'successFilledBg', getCssVar('palette-success-main'));
10215
- setColor(palette.Alert, 'warningFilledBg', getCssVar('palette-warning-main'));
10316
+ setColor(palette.Alert, 'errorFilledBg', setCssVarColor('palette-error-main'));
10317
+ setColor(palette.Alert, 'infoFilledBg', setCssVarColor('palette-info-main'));
10318
+ setColor(palette.Alert, 'successFilledBg', setCssVarColor('palette-success-main'));
10319
+ setColor(palette.Alert, 'warningFilledBg', setCssVarColor('palette-warning-main'));
10216
10320
  setColor(palette.Alert, 'errorFilledColor', silent(() => lightPalette.getContrastText(palette.error.main)));
10217
10321
  setColor(palette.Alert, 'infoFilledColor', silent(() => lightPalette.getContrastText(palette.info.main)));
10218
10322
  setColor(palette.Alert, 'successFilledColor', silent(() => lightPalette.getContrastText(palette.success.main)));
@@ -10221,15 +10325,15 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
10221
10325
  setColor(palette.Alert, 'infoStandardBg', private_safeLighten(palette.info.light, 0.9));
10222
10326
  setColor(palette.Alert, 'successStandardBg', private_safeLighten(palette.success.light, 0.9));
10223
10327
  setColor(palette.Alert, 'warningStandardBg', private_safeLighten(palette.warning.light, 0.9));
10224
- setColor(palette.Alert, 'errorIconColor', getCssVar('palette-error-main'));
10225
- setColor(palette.Alert, 'infoIconColor', getCssVar('palette-info-main'));
10226
- setColor(palette.Alert, 'successIconColor', getCssVar('palette-success-main'));
10227
- setColor(palette.Alert, 'warningIconColor', getCssVar('palette-warning-main'));
10228
- setColor(palette.AppBar, 'defaultBg', getCssVar('palette-grey-100'));
10229
- setColor(palette.Avatar, 'defaultBg', getCssVar('palette-grey-400'));
10230
- setColor(palette.Chip, 'defaultBorder', getCssVar('palette-grey-400'));
10231
- setColor(palette.Chip, 'defaultAvatarColor', getCssVar('palette-grey-700'));
10232
- setColor(palette.Chip, 'defaultIconColor', getCssVar('palette-grey-700'));
10328
+ setColor(palette.Alert, 'errorIconColor', setCssVarColor('palette-error-main'));
10329
+ setColor(palette.Alert, 'infoIconColor', setCssVarColor('palette-info-main'));
10330
+ setColor(palette.Alert, 'successIconColor', setCssVarColor('palette-success-main'));
10331
+ setColor(palette.Alert, 'warningIconColor', setCssVarColor('palette-warning-main'));
10332
+ setColor(palette.AppBar, 'defaultBg', setCssVarColor('palette-grey-100'));
10333
+ setColor(palette.Avatar, 'defaultBg', setCssVarColor('palette-grey-400'));
10334
+ setColor(palette.Chip, 'defaultBorder', setCssVarColor('palette-grey-400'));
10335
+ setColor(palette.Chip, 'defaultAvatarColor', setCssVarColor('palette-grey-700'));
10336
+ setColor(palette.Chip, 'defaultIconColor', setCssVarColor('palette-grey-700'));
10233
10337
  setColor(palette.FilledInput, 'bg', 'rgba(0, 0, 0, 0.06)');
10234
10338
  setColor(palette.FilledInput, 'hoverBg', 'rgba(0, 0, 0, 0.09)');
10235
10339
  setColor(palette.FilledInput, 'disabledBg', 'rgba(0, 0, 0, 0.12)');
@@ -10239,7 +10343,7 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
10239
10343
  setColor(palette.LinearProgress, 'infoBg', private_safeLighten(palette.info.main, 0.62));
10240
10344
  setColor(palette.LinearProgress, 'successBg', private_safeLighten(palette.success.main, 0.62));
10241
10345
  setColor(palette.LinearProgress, 'warningBg', private_safeLighten(palette.warning.main, 0.62));
10242
- setColor(palette.Skeleton, 'bg', `rgba(${getCssVar('palette-text-primaryChannel')} / 0.11)`);
10346
+ setColor(palette.Skeleton, 'bg', `rgba(${setCssVarColor('palette-text-primaryChannel')} / 0.11)`);
10243
10347
  setColor(palette.Slider, 'primaryTrack', private_safeLighten(palette.primary.main, 0.62));
10244
10348
  setColor(palette.Slider, 'secondaryTrack', private_safeLighten(palette.secondary.main, 0.62));
10245
10349
  setColor(palette.Slider, 'errorTrack', private_safeLighten(palette.error.main, 0.62));
@@ -10250,10 +10354,10 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
10250
10354
  setColor(palette.SnackbarContent, 'bg', snackbarContentBackground);
10251
10355
  setColor(palette.SnackbarContent, 'color', silent(() => lightPalette.getContrastText(snackbarContentBackground)));
10252
10356
  setColor(palette.SpeedDialAction, 'fabHoverBg', private_safeEmphasize(palette.background.paper, 0.15));
10253
- setColor(palette.StepConnector, 'border', getCssVar('palette-grey-400'));
10254
- setColor(palette.StepContent, 'border', getCssVar('palette-grey-400'));
10255
- setColor(palette.Switch, 'defaultColor', getCssVar('palette-common-white'));
10256
- setColor(palette.Switch, 'defaultDisabledColor', getCssVar('palette-grey-100'));
10357
+ setColor(palette.StepConnector, 'border', setCssVarColor('palette-grey-400'));
10358
+ setColor(palette.StepContent, 'border', setCssVarColor('palette-grey-400'));
10359
+ setColor(palette.Switch, 'defaultColor', setCssVarColor('palette-common-white'));
10360
+ setColor(palette.Switch, 'defaultDisabledColor', setCssVarColor('palette-grey-100'));
10257
10361
  setColor(palette.Switch, 'primaryDisabledColor', private_safeLighten(palette.primary.main, 0.62));
10258
10362
  setColor(palette.Switch, 'secondaryDisabledColor', private_safeLighten(palette.secondary.main, 0.62));
10259
10363
  setColor(palette.Switch, 'errorDisabledColor', private_safeLighten(palette.error.main, 0.62));
@@ -10267,10 +10371,10 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
10267
10371
  setColor(palette.Alert, 'infoColor', private_safeLighten(palette.info.light, 0.6));
10268
10372
  setColor(palette.Alert, 'successColor', private_safeLighten(palette.success.light, 0.6));
10269
10373
  setColor(palette.Alert, 'warningColor', private_safeLighten(palette.warning.light, 0.6));
10270
- setColor(palette.Alert, 'errorFilledBg', getCssVar('palette-error-dark'));
10271
- setColor(palette.Alert, 'infoFilledBg', getCssVar('palette-info-dark'));
10272
- setColor(palette.Alert, 'successFilledBg', getCssVar('palette-success-dark'));
10273
- setColor(palette.Alert, 'warningFilledBg', getCssVar('palette-warning-dark'));
10374
+ setColor(palette.Alert, 'errorFilledBg', setCssVarColor('palette-error-dark'));
10375
+ setColor(palette.Alert, 'infoFilledBg', setCssVarColor('palette-info-dark'));
10376
+ setColor(palette.Alert, 'successFilledBg', setCssVarColor('palette-success-dark'));
10377
+ setColor(palette.Alert, 'warningFilledBg', setCssVarColor('palette-warning-dark'));
10274
10378
  setColor(palette.Alert, 'errorFilledColor', silent(() => darkPalette.getContrastText(palette.error.dark)));
10275
10379
  setColor(palette.Alert, 'infoFilledColor', silent(() => darkPalette.getContrastText(palette.info.dark)));
10276
10380
  setColor(palette.Alert, 'successFilledColor', silent(() => darkPalette.getContrastText(palette.success.dark)));
@@ -10279,17 +10383,17 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
10279
10383
  setColor(palette.Alert, 'infoStandardBg', private_safeDarken(palette.info.light, 0.9));
10280
10384
  setColor(palette.Alert, 'successStandardBg', private_safeDarken(palette.success.light, 0.9));
10281
10385
  setColor(palette.Alert, 'warningStandardBg', private_safeDarken(palette.warning.light, 0.9));
10282
- setColor(palette.Alert, 'errorIconColor', getCssVar('palette-error-main'));
10283
- setColor(palette.Alert, 'infoIconColor', getCssVar('palette-info-main'));
10284
- setColor(palette.Alert, 'successIconColor', getCssVar('palette-success-main'));
10285
- setColor(palette.Alert, 'warningIconColor', getCssVar('palette-warning-main'));
10286
- setColor(palette.AppBar, 'defaultBg', getCssVar('palette-grey-900'));
10287
- setColor(palette.AppBar, 'darkBg', getCssVar('palette-background-paper')); // specific for dark mode
10288
- setColor(palette.AppBar, 'darkColor', getCssVar('palette-text-primary')); // specific for dark mode
10289
- setColor(palette.Avatar, 'defaultBg', getCssVar('palette-grey-600'));
10290
- setColor(palette.Chip, 'defaultBorder', getCssVar('palette-grey-700'));
10291
- setColor(palette.Chip, 'defaultAvatarColor', getCssVar('palette-grey-300'));
10292
- setColor(palette.Chip, 'defaultIconColor', getCssVar('palette-grey-300'));
10386
+ setColor(palette.Alert, 'errorIconColor', setCssVarColor('palette-error-main'));
10387
+ setColor(palette.Alert, 'infoIconColor', setCssVarColor('palette-info-main'));
10388
+ setColor(palette.Alert, 'successIconColor', setCssVarColor('palette-success-main'));
10389
+ setColor(palette.Alert, 'warningIconColor', setCssVarColor('palette-warning-main'));
10390
+ setColor(palette.AppBar, 'defaultBg', setCssVarColor('palette-grey-900'));
10391
+ setColor(palette.AppBar, 'darkBg', setCssVarColor('palette-background-paper')); // specific for dark mode
10392
+ setColor(palette.AppBar, 'darkColor', setCssVarColor('palette-text-primary')); // specific for dark mode
10393
+ setColor(palette.Avatar, 'defaultBg', setCssVarColor('palette-grey-600'));
10394
+ setColor(palette.Chip, 'defaultBorder', setCssVarColor('palette-grey-700'));
10395
+ setColor(palette.Chip, 'defaultAvatarColor', setCssVarColor('palette-grey-300'));
10396
+ setColor(palette.Chip, 'defaultIconColor', setCssVarColor('palette-grey-300'));
10293
10397
  setColor(palette.FilledInput, 'bg', 'rgba(255, 255, 255, 0.09)');
10294
10398
  setColor(palette.FilledInput, 'hoverBg', 'rgba(255, 255, 255, 0.13)');
10295
10399
  setColor(palette.FilledInput, 'disabledBg', 'rgba(255, 255, 255, 0.12)');
@@ -10299,7 +10403,7 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
10299
10403
  setColor(palette.LinearProgress, 'infoBg', private_safeDarken(palette.info.main, 0.5));
10300
10404
  setColor(palette.LinearProgress, 'successBg', private_safeDarken(palette.success.main, 0.5));
10301
10405
  setColor(palette.LinearProgress, 'warningBg', private_safeDarken(palette.warning.main, 0.5));
10302
- setColor(palette.Skeleton, 'bg', `rgba(${getCssVar('palette-text-primaryChannel')} / 0.13)`);
10406
+ setColor(palette.Skeleton, 'bg', `rgba(${setCssVarColor('palette-text-primaryChannel')} / 0.13)`);
10303
10407
  setColor(palette.Slider, 'primaryTrack', private_safeDarken(palette.primary.main, 0.5));
10304
10408
  setColor(palette.Slider, 'secondaryTrack', private_safeDarken(palette.secondary.main, 0.5));
10305
10409
  setColor(palette.Slider, 'errorTrack', private_safeDarken(palette.error.main, 0.5));
@@ -10310,10 +10414,10 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
10310
10414
  setColor(palette.SnackbarContent, 'bg', snackbarContentBackground);
10311
10415
  setColor(palette.SnackbarContent, 'color', silent(() => darkPalette.getContrastText(snackbarContentBackground)));
10312
10416
  setColor(palette.SpeedDialAction, 'fabHoverBg', private_safeEmphasize(palette.background.paper, 0.15));
10313
- setColor(palette.StepConnector, 'border', getCssVar('palette-grey-600'));
10314
- setColor(palette.StepContent, 'border', getCssVar('palette-grey-600'));
10315
- setColor(palette.Switch, 'defaultColor', getCssVar('palette-grey-300'));
10316
- setColor(palette.Switch, 'defaultDisabledColor', getCssVar('palette-grey-600'));
10417
+ setColor(palette.StepConnector, 'border', setCssVarColor('palette-grey-600'));
10418
+ setColor(palette.StepContent, 'border', setCssVarColor('palette-grey-600'));
10419
+ setColor(palette.Switch, 'defaultColor', setCssVarColor('palette-grey-300'));
10420
+ setColor(palette.Switch, 'defaultDisabledColor', setCssVarColor('palette-grey-600'));
10317
10421
  setColor(palette.Switch, 'primaryDisabledColor', private_safeDarken(palette.primary.main, 0.55));
10318
10422
  setColor(palette.Switch, 'secondaryDisabledColor', private_safeDarken(palette.secondary.main, 0.55));
10319
10423
  setColor(palette.Switch, 'errorDisabledColor', private_safeDarken(palette.error.main, 0.55));
@@ -10366,6 +10470,17 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
10366
10470
  });
10367
10471
  });
10368
10472
  theme = args.reduce((acc, argument) => deepmerge(acc, argument), theme);
10473
+ const parserConfig = {
10474
+ prefix: cssVarPrefix,
10475
+ shouldSkipGeneratingVar: shouldSkipGeneratingVar$1
10476
+ };
10477
+ const {
10478
+ vars: themeVars,
10479
+ generateCssVars
10480
+ } = prepareCssVars(theme, parserConfig);
10481
+ theme.vars = themeVars;
10482
+ theme.generateCssVars = generateCssVars;
10483
+ theme.shouldSkipGeneratingVar = shouldSkipGeneratingVar$1;
10369
10484
  theme.unstable_sxConfig = _extends({}, defaultSxConfig$1, input == null ? void 0 : input.unstable_sxConfig);
10370
10485
  theme.unstable_sx = function sx(props) {
10371
10486
  return styleFunctionSx$1({
@@ -10382,12 +10497,6 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
10382
10497
  const excludeVariablesFromRoot = cssVarPrefix => [...[...Array(24)].map((_, index) => `--${cssVarPrefix ? `${cssVarPrefix}-` : ''}overlays-${index + 1}`), `--${cssVarPrefix ? `${cssVarPrefix}-` : ''}palette-AppBar-darkBg`, `--${cssVarPrefix ? `${cssVarPrefix}-` : ''}palette-AppBar-darkColor`];
10383
10498
  var excludeVariablesFromRoot$1 = excludeVariablesFromRoot;
10384
10499
 
10385
- const shouldSkipGeneratingVar = keys => {
10386
- var _keys$;
10387
- return !!keys[0].match(/(typography|mixins|breakpoints|direction|transitions)/) || !!keys[0].match(/sxConfig$/) ||
10388
- // ends with sxConfig
10389
- keys[0] === 'palette' && !!((_keys$ = keys[1]) != null && _keys$.match(/(mode|contrastThreshold|tonalOffset)/));
10390
- };
10391
10500
  const defaultTheme$1 = extendTheme();
10392
10501
  const {
10393
10502
  CssVarsProvider,
@@ -10414,7 +10523,6 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
10414
10523
  };
10415
10524
  return newTheme;
10416
10525
  },
10417
- shouldSkipGeneratingVar,
10418
10526
  excludeVariablesFromRoot: excludeVariablesFromRoot$1
10419
10527
  });
10420
10528
 
@@ -10453,6 +10561,30 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
10453
10561
  });
10454
10562
  }
10455
10563
 
10564
+ const defaultContextValue = {
10565
+ disableDefaultClasses: false
10566
+ };
10567
+ const ClassNameConfiguratorContext = /*#__PURE__*/React__namespace.createContext(defaultContextValue);
10568
+ /**
10569
+ * @ignore - internal hook.
10570
+ *
10571
+ * Wraps the `generateUtilityClass` function and controls how the classes are generated.
10572
+ * Currently it only affects whether the classes are applied or not.
10573
+ *
10574
+ * @returns Function to be called with the `generateUtilityClass` function specific to a component to generate the classes.
10575
+ */
10576
+ function useClassNamesOverride(generateUtilityClass) {
10577
+ const {
10578
+ disableDefaultClasses
10579
+ } = React__namespace.useContext(ClassNameConfiguratorContext);
10580
+ return slot => {
10581
+ if (disableDefaultClasses) {
10582
+ return '';
10583
+ }
10584
+ return generateUtilityClass(slot);
10585
+ };
10586
+ }
10587
+
10456
10588
  /**
10457
10589
  * Extracts event handlers from a given object.
10458
10590
  * A prop is considered an event handler if it is a function and its name starts with `on`.
@@ -13220,7 +13352,7 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
13220
13352
  const slots = {
13221
13353
  root: ['root']
13222
13354
  };
13223
- return composeClasses(slots, getPopperUnstyledUtilityClass, {});
13355
+ return composeClasses(slots, useClassNamesOverride(getPopperUnstyledUtilityClass));
13224
13356
  };
13225
13357
  const defaultPopperOptions = {};
13226
13358
  const PopperTooltip = /*#__PURE__*/React__namespace.forwardRef(function PopperTooltip(props, ref) {
@@ -13783,7 +13915,7 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
13783
13915
  root: ['root', !open && exited && 'hidden'],
13784
13916
  backdrop: ['backdrop']
13785
13917
  };
13786
- return composeClasses(slots, getModalUtilityClass, undefined);
13918
+ return composeClasses(slots, useClassNamesOverride(getModalUtilityClass));
13787
13919
  };
13788
13920
  function getContainer(container) {
13789
13921
  return typeof container === 'function' ? container() : container;
@@ -15983,7 +16115,12 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
15983
16115
  reason: 'mouse'
15984
16116
  });
15985
16117
  };
15986
- const handleOptionTouchStart = () => {
16118
+ const handleOptionTouchStart = event => {
16119
+ setHighlightedIndex({
16120
+ event,
16121
+ index: Number(event.currentTarget.getAttribute('data-option-index')),
16122
+ reason: 'touch'
16123
+ });
15987
16124
  isTouch.current = true;
15988
16125
  };
15989
16126
  const handleOptionClick = event => {
@@ -16142,6 +16279,7 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
16142
16279
  inputValue,
16143
16280
  value,
16144
16281
  dirty,
16282
+ expanded: popupOpen && anchorEl,
16145
16283
  popupOpen,
16146
16284
  focused: focused || focusedTag !== -1,
16147
16285
  anchorEl,
@@ -21885,7 +22023,7 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
21885
22023
  function getAutocompleteUtilityClass(slot) {
21886
22024
  return generateUtilityClass('MuiAutocomplete', slot);
21887
22025
  }
21888
- const autocompleteClasses = generateUtilityClasses('MuiAutocomplete', ['root', 'fullWidth', 'focused', 'focusVisible', 'tag', 'tagSizeSmall', 'tagSizeMedium', 'hasPopupIcon', 'hasClearIcon', 'inputRoot', 'input', 'inputFocused', 'endAdornment', 'clearIndicator', 'popupIndicator', 'popupIndicatorOpen', 'popper', 'popperDisablePortal', 'paper', 'listbox', 'loading', 'noOptions', 'option', 'groupLabel', 'groupUl']);
22026
+ const autocompleteClasses = generateUtilityClasses('MuiAutocomplete', ['root', 'expanded', 'fullWidth', 'focused', 'focusVisible', 'tag', 'tagSizeSmall', 'tagSizeMedium', 'hasPopupIcon', 'hasClearIcon', 'inputRoot', 'input', 'inputFocused', 'endAdornment', 'clearIndicator', 'popupIndicator', 'popupIndicatorOpen', 'popper', 'popperDisablePortal', 'paper', 'listbox', 'loading', 'noOptions', 'option', 'groupLabel', 'groupUl']);
21889
22027
  var autocompleteClasses$1 = autocompleteClasses;
21890
22028
 
21891
22029
  var _ClearIcon, _ArrowDropDownIcon;
@@ -21894,6 +22032,7 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
21894
22032
  const {
21895
22033
  classes,
21896
22034
  disablePortal,
22035
+ expanded,
21897
22036
  focused,
21898
22037
  fullWidth,
21899
22038
  hasClearIcon,
@@ -21903,7 +22042,7 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
21903
22042
  size
21904
22043
  } = ownerState;
21905
22044
  const slots = {
21906
- root: ['root', focused && 'focused', fullWidth && 'fullWidth', hasClearIcon && 'hasClearIcon', hasPopupIcon && 'hasPopupIcon'],
22045
+ root: ['root', expanded && 'expanded', focused && 'focused', fullWidth && 'fullWidth', hasClearIcon && 'hasClearIcon', hasPopupIcon && 'hasPopupIcon'],
21907
22046
  inputRoot: ['inputRoot'],
21908
22047
  input: ['input', inputFocused && 'inputFocused'],
21909
22048
  tag: ['tag', `tagSize${capitalize(size)}`],
@@ -22302,6 +22441,7 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
22302
22441
  getOptionProps,
22303
22442
  value,
22304
22443
  dirty,
22444
+ expanded,
22305
22445
  id,
22306
22446
  popupOpen,
22307
22447
  focused,
@@ -22319,6 +22459,7 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
22319
22459
  // If you modify this, make sure to keep the `AutocompleteOwnerState` type in sync.
22320
22460
  const ownerState = _extends({}, props, {
22321
22461
  disablePortal,
22462
+ expanded,
22322
22463
  focused,
22323
22464
  fullWidth,
22324
22465
  hasClearIcon,
@@ -22765,7 +22906,7 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
22765
22906
  *
22766
22907
  * @param {React.SyntheticEvent} event The event source of the callback.
22767
22908
  * @param {T} option The highlighted option.
22768
- * @param {string} reason Can be: `"keyboard"`, `"auto"`, `"mouse"`.
22909
+ * @param {string} reason Can be: `"keyboard"`, `"auto"`, `"mouse"`, `"touch"`.
22769
22910
  */
22770
22911
  onHighlightChange: PropTypes.func,
22771
22912
  /**
@@ -27812,7 +27953,7 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
27812
27953
  const ownerState = props;
27813
27954
  const classes = useUtilityClasses$19(ownerState);
27814
27955
  const {
27815
- titleId: id = idProp
27956
+ titleId = idProp
27816
27957
  } = React__namespace.useContext(DialogContext$1);
27817
27958
  return /*#__PURE__*/jsxRuntime_1(DialogTitleRoot, _extends({
27818
27959
  component: "h2",
@@ -27820,7 +27961,7 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
27820
27961
  ownerState: ownerState,
27821
27962
  ref: ref,
27822
27963
  variant: "h6",
27823
- id: id
27964
+ id: idProp != null ? idProp : titleId
27824
27965
  }, other));
27825
27966
  });
27826
27967
  DialogTitle.propTypes /* remove-proptypes */ = {
@@ -35707,7 +35848,7 @@ See https://mui.com/r/migration-v4/#mui-material-styles for more details.` );
35707
35848
  },
35708
35849
  transformOrigin: isRtl ? RTL_ORIGIN : LTR_ORIGIN,
35709
35850
  PaperProps: _extends({
35710
- component: MenuPaper
35851
+ as: MenuPaper
35711
35852
  }, PaperProps, {
35712
35853
  classes: _extends({}, PaperProps.classes, {
35713
35854
  root: classes.paper