@vitessce/feature-list 4.0.9 → 4.1.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/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import React__default, { useContext, forwardRef, useRef, useMemo, createContext, createElement, isValidElement, cloneElement, Children, PureComponent, useEffect, useState, useCallback } from "react";
2
+ import React__default, { useContext, forwardRef, useRef, useMemo, createContext, createElement, PureComponent, useEffect, cloneElement, useState, useCallback } from "react";
3
3
  import { usePlotOptionsStyles, OptionsContainer, OptionSelect, useLoaders, useCoordinationScopes, useGridItemSize, useCoordination, useFeatureLabelsData, useExpandedFeatureLabelsMap, useObsFeatureMatrixIndices, useReady, useUrls, TitleInfo } from "@vitessce/vit-s";
4
4
  import { jsxs, jsx as jsx$1 } from "react/jsx-runtime";
5
5
  import * as ReactDOM from "react-dom";
@@ -703,6 +703,7 @@ const CoordinationType = {
703
703
  SPATIAL_ROTATION_ORBIT: "spatialRotationOrbit",
704
704
  SPATIAL_ORBIT_AXIS: "spatialOrbitAxis",
705
705
  SPATIAL_AXIS_FIXED: "spatialAxisFixed",
706
+ SPATIAL_CAMERA_SNAPSHOT: "spatialCameraSnapshot",
706
707
  HEATMAP_ZOOM_X: "heatmapZoomX",
707
708
  HEATMAP_ZOOM_Y: "heatmapZoomY",
708
709
  HEATMAP_TARGET_X: "heatmapTargetX",
@@ -750,6 +751,7 @@ const CoordinationType = {
750
751
  SPATIAL_TARGET_C: "spatialTargetC",
751
752
  SPATIAL_LAYER_VISIBLE: "spatialLayerVisible",
752
753
  SPATIAL_LAYER_OPACITY: "spatialLayerOpacity",
754
+ SPATIAL_LAYER_OPACITY_UNSELECTED: "spatialLayerOpacityUnselected",
753
755
  SPATIAL_LAYER_COLORMAP: "spatialLayerColormap",
754
756
  SPATIAL_LAYER_LABEL: "spatialLayerLabel",
755
757
  SPATIAL_LAYER_TRANSPARENT_COLOR: "spatialLayerTransparentColor",
@@ -841,6 +843,7 @@ const COMPONENT_COORDINATION_TYPES = {
841
843
  CoordinationType.SPATIAL_ROTATION_ORBIT,
842
844
  CoordinationType.SPATIAL_ORBIT_AXIS,
843
845
  CoordinationType.SPATIAL_ZOOM,
846
+ CoordinationType.SPATIAL_CAMERA_SNAPSHOT,
844
847
  CoordinationType.OBS_FILTER,
845
848
  CoordinationType.OBS_HIGHLIGHT,
846
849
  CoordinationType.OBS_SET_SELECTION,
@@ -866,6 +869,7 @@ const COMPONENT_COORDINATION_TYPES = {
866
869
  CoordinationType.FEATURE_VALUE_COLORMAP_RANGE,
867
870
  CoordinationType.SPATIAL_LAYER_COLOR,
868
871
  CoordinationType.SPATIAL_LAYER_OPACITY,
872
+ CoordinationType.SPATIAL_LAYER_OPACITY_UNSELECTED,
869
873
  CoordinationType.SPATIAL_LAYER_VISIBLE,
870
874
  CoordinationType.SPATIAL_LAYER_LABEL,
871
875
  CoordinationType.SPATIAL_CHANNEL_COLOR,
@@ -1070,6 +1074,7 @@ const COMPONENT_COORDINATION_TYPES = {
1070
1074
  CoordinationType.SPATIAL_ROTATION_ORBIT,
1071
1075
  CoordinationType.SPATIAL_ORBIT_AXIS,
1072
1076
  CoordinationType.SPATIAL_AXIS_FIXED,
1077
+ CoordinationType.SPATIAL_CAMERA_SNAPSHOT,
1073
1078
  CoordinationType.OBS_FILTER,
1074
1079
  CoordinationType.OBS_HIGHLIGHT,
1075
1080
  CoordinationType.OBS_SET_SELECTION,
@@ -1091,6 +1096,7 @@ const COMPONENT_COORDINATION_TYPES = {
1091
1096
  CoordinationType.SPATIAL_TARGET_C,
1092
1097
  CoordinationType.SPATIAL_LAYER_VISIBLE,
1093
1098
  CoordinationType.SPATIAL_LAYER_OPACITY,
1099
+ CoordinationType.SPATIAL_LAYER_OPACITY_UNSELECTED,
1094
1100
  CoordinationType.SPATIAL_LAYER_COLORMAP,
1095
1101
  CoordinationType.SPATIAL_LAYER_TRANSPARENT_COLOR,
1096
1102
  CoordinationType.SPATIAL_LAYER_MODEL_MATRIX,
@@ -1286,6 +1292,7 @@ const COMPONENT_COORDINATION_TYPES = {
1286
1292
  CoordinationType.SPATIAL_LAYER_VISIBLE,
1287
1293
  CoordinationType.SPATIAL_LAYER_LABEL,
1288
1294
  CoordinationType.SPATIAL_LAYER_OPACITY,
1295
+ CoordinationType.SPATIAL_LAYER_OPACITY_UNSELECTED,
1289
1296
  CoordinationType.SPATIAL_LAYER_COLORMAP,
1290
1297
  CoordinationType.SPATIAL_LAYER_TRANSPARENT_COLOR,
1291
1298
  CoordinationType.SPATIAL_LAYER_MODEL_MATRIX,
@@ -1999,7 +2006,7 @@ function rulesheet(callback) {
1999
2006
  }
2000
2007
  };
2001
2008
  }
2002
- function memoize$1(fn) {
2009
+ function memoize(fn) {
2003
2010
  var cache = /* @__PURE__ */ Object.create(null);
2004
2011
  return function(arg2) {
2005
2012
  if (cache[arg2] === void 0) cache[arg2] = fn(arg2);
@@ -2287,10 +2294,10 @@ var createCache = function createCache2(options) {
2287
2294
  }
2288
2295
  var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;
2289
2296
  var inserted = {};
2290
- var container;
2297
+ var container2;
2291
2298
  var nodesToHydrate = [];
2292
2299
  {
2293
- container = options.container || document.head;
2300
+ container2 = options.container || document.head;
2294
2301
  Array.prototype.forEach.call(
2295
2302
  // this means we will ignore elements which don't have a space in them which
2296
2303
  // means that the style elements we're looking at are only Emotion 11 server-rendered style elements
@@ -2327,7 +2334,7 @@ var createCache = function createCache2(options) {
2327
2334
  key,
2328
2335
  sheet: new StyleSheet({
2329
2336
  key,
2330
- container,
2337
+ container: container2,
2331
2338
  nonce: options.nonce,
2332
2339
  speedy: options.speedy,
2333
2340
  prepend: options.prepend,
@@ -2737,7 +2744,7 @@ var isCustomProperty = function isCustomProperty2(property) {
2737
2744
  var isProcessableValue = function isProcessableValue2(value) {
2738
2745
  return value != null && typeof value !== "boolean";
2739
2746
  };
2740
- var processStyleName = /* @__PURE__ */ memoize$1(function(styleName) {
2747
+ var processStyleName = /* @__PURE__ */ memoize(function(styleName) {
2741
2748
  return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, "-$&").toLowerCase();
2742
2749
  });
2743
2750
  var processStyleValue = function processStyleValue2(key, value) {
@@ -3090,7 +3097,7 @@ function matchCSSObject(arg2) {
3090
3097
  return arg2 instanceof Object && !("styles" in arg2) && !("length" in arg2) && !("__emotion_styles" in arg2);
3091
3098
  }
3092
3099
  const { createCssAndCx } = /* @__PURE__ */ (() => {
3093
- function merge2(registered, css2, className) {
3100
+ function merge(registered, css2, className) {
3094
3101
  const registeredStyles = [];
3095
3102
  const rawClassName = getRegisteredStyles(registered, registeredStyles, className);
3096
3103
  if (registeredStyles.length < 2) {
@@ -3116,7 +3123,7 @@ const { createCssAndCx } = /* @__PURE__ */ (() => {
3116
3123
  const cx = (...args) => {
3117
3124
  const className = classnames(args);
3118
3125
  const feat27FixedClassnames = increaseSpecificityToTakePrecedenceOverMediaQueries.fixClassName(cache, className, css2);
3119
- return merge2(cache.registered, css2, feat27FixedClassnames);
3126
+ return merge(cache.registered, css2, feat27FixedClassnames);
3120
3127
  };
3121
3128
  return { css: css2, cx };
3122
3129
  }
@@ -3723,7 +3730,7 @@ const { tss: tss$1 } = createTss({
3723
3730
  tss$1.create({});
3724
3731
  const THEME_ID = "$$material";
3725
3732
  var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/;
3726
- var isPropValid = /* @__PURE__ */ memoize$1(
3733
+ var isPropValid = /* @__PURE__ */ memoize(
3727
3734
  function(prop) {
3728
3735
  return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111 && prop.charCodeAt(1) === 110 && prop.charCodeAt(2) < 91;
3729
3736
  }
@@ -4173,7 +4180,7 @@ function requireFactoryWithTypeCheckers() {
4173
4180
  function emptyFunctionThatReturnsNull() {
4174
4181
  return null;
4175
4182
  }
4176
- factoryWithTypeCheckers = function(isValidElement2, throwOnDirectAccess) {
4183
+ factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
4177
4184
  var ITERATOR_SYMBOL = typeof Symbol === "function" && Symbol.iterator;
4178
4185
  var FAUX_ITERATOR_SYMBOL = "@@iterator";
4179
4186
  function getIteratorFn(maybeIterable) {
@@ -4301,7 +4308,7 @@ function requireFactoryWithTypeCheckers() {
4301
4308
  function createElementTypeChecker() {
4302
4309
  function validate(props, propName, componentName, location, propFullName) {
4303
4310
  var propValue = props[propName];
4304
- if (!isValidElement2(propValue)) {
4311
+ if (!isValidElement(propValue)) {
4305
4312
  var propType = getPropType(propValue);
4306
4313
  return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected a single ReactElement."));
4307
4314
  }
@@ -4489,7 +4496,7 @@ function requireFactoryWithTypeCheckers() {
4489
4496
  if (Array.isArray(propValue)) {
4490
4497
  return propValue.every(isNode);
4491
4498
  }
4492
- if (propValue === null || isValidElement2(propValue)) {
4499
+ if (propValue === null || isValidElement(propValue)) {
4493
4500
  return true;
4494
4501
  }
4495
4502
  var iteratorFn = getIteratorFn(propValue);
@@ -4673,8 +4680,7 @@ function requireReactIs_development() {
4673
4680
  }
4674
4681
  }
4675
4682
  }
4676
- var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler");
4677
- var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_VIEW_TRANSITION_TYPE = Symbol.for("react.view_transition"), REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference");
4683
+ var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_VIEW_TRANSITION_TYPE = Symbol.for("react.view_transition"), REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference");
4678
4684
  reactIs_development.ContextConsumer = REACT_CONSUMER_TYPE;
4679
4685
  reactIs_development.ContextProvider = REACT_CONTEXT_TYPE;
4680
4686
  reactIs_development.Element = REACT_ELEMENT_TYPE;
@@ -4724,7 +4730,7 @@ function requireReactIs_development() {
4724
4730
  return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;
4725
4731
  };
4726
4732
  reactIs_development.isValidElementType = function(type) {
4727
- return "string" === typeof type || "function" === typeof type || type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || "object" === typeof type && null !== type && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_CONSUMER_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_CLIENT_REFERENCE || void 0 !== type.getModuleId) ? true : false;
4733
+ return "string" === typeof type || "function" === typeof type || type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_VIEW_TRANSITION_TYPE || "object" === typeof type && null !== type && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_CONSUMER_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_CLIENT_REFERENCE || void 0 !== type.getModuleId) ? true : false;
4728
4734
  };
4729
4735
  reactIs_development.typeOf = typeOf;
4730
4736
  })();
@@ -4794,19 +4800,12 @@ const sortBreakpointsValues = (values2) => {
4794
4800
  };
4795
4801
  function createBreakpoints(breakpoints) {
4796
4802
  const {
4797
- // The breakpoint **start** at this value.
4798
- // For instance with the first breakpoint xs: [xs, sm).
4799
4803
  values: values2 = {
4800
4804
  xs: 0,
4801
- // phone
4802
4805
  sm: 600,
4803
- // tablet
4804
4806
  md: 900,
4805
- // small laptop
4806
4807
  lg: 1200,
4807
- // desktop
4808
4808
  xl: 1536
4809
- // large screen
4810
4809
  },
4811
4810
  unit = "px",
4812
4811
  step = 5,
@@ -4842,6 +4841,10 @@ function createBreakpoints(breakpoints) {
4842
4841
  }
4843
4842
  return between(key, keys2[keys2.indexOf(key) + 1]).replace("@media", "@media not all and");
4844
4843
  }
4844
+ const mediaKeys = [];
4845
+ for (let i = 0; i < keys2.length; i += 1) {
4846
+ mediaKeys.push(up(keys2[i]));
4847
+ }
4845
4848
  return {
4846
4849
  keys: keys2,
4847
4850
  values: sortedValues,
@@ -4851,28 +4854,40 @@ function createBreakpoints(breakpoints) {
4851
4854
  only,
4852
4855
  not,
4853
4856
  unit,
4857
+ internal_mediaKeys: mediaKeys,
4854
4858
  ...other
4855
4859
  };
4856
4860
  }
4861
+ const MIN_WIDTH_PATTERN = /min-width:\s*([0-9.]+)/;
4857
4862
  function sortContainerQueries(theme, css2) {
4858
- if (!theme.containerQueries) {
4863
+ if (!theme.containerQueries || !hasContainerQuery(css2)) {
4859
4864
  return css2;
4860
4865
  }
4861
- const sorted = Object.keys(css2).filter((key) => key.startsWith("@container")).sort((a, b) => {
4862
- const regex = /min-width:\s*([0-9.]+)/;
4863
- return +(a.match(regex)?.[1] || 0) - +(b.match(regex)?.[1] || 0);
4864
- });
4865
- if (!sorted.length) {
4866
- return css2;
4866
+ const keys2 = [];
4867
+ for (const key in css2) {
4868
+ if (key.startsWith("@container")) {
4869
+ keys2.push(key);
4870
+ }
4867
4871
  }
4868
- return sorted.reduce((acc, key) => {
4869
- const value = css2[key];
4870
- delete acc[key];
4871
- acc[key] = value;
4872
- return acc;
4873
- }, {
4874
- ...css2
4872
+ keys2.sort((a, b) => {
4873
+ return +(a.match(MIN_WIDTH_PATTERN)?.[1] || 0) - +(b.match(MIN_WIDTH_PATTERN)?.[1] || 0);
4875
4874
  });
4875
+ const result = css2;
4876
+ for (let i = 0; i < keys2.length; i += 1) {
4877
+ const key = keys2[i];
4878
+ const value = result[key];
4879
+ delete result[key];
4880
+ result[key] = value;
4881
+ }
4882
+ return result;
4883
+ }
4884
+ function hasContainerQuery(css2) {
4885
+ for (const key in css2) {
4886
+ if (key.startsWith("@container")) {
4887
+ return true;
4888
+ }
4889
+ }
4890
+ return false;
4876
4891
  }
4877
4892
  function isCqShorthand(breakpointKeys, value) {
4878
4893
  return value === "@" || value.startsWith("@") && (breakpointKeys.some((key) => value.startsWith(`@${key}`)) || !!value.match(/^@\d/));
@@ -4881,8 +4896,11 @@ function getContainerQuery(theme, shorthand) {
4881
4896
  const matches = shorthand.match(/^@([^/]+)?\/?(.+)?$/);
4882
4897
  if (!matches) {
4883
4898
  {
4884
- throw new Error(`MUI: The provided shorthand ${`(${shorthand})`} is invalid. The format should be \`@<breakpoint | number>\` or \`@<breakpoint | number>/<container>\`.
4885
- For example, \`@sm\` or \`@600\` or \`@40rem/sidebar\`.`);
4899
+ throw (
4900
+ /* minify-error */
4901
+ new Error(`MUI: The provided shorthand ${`(${shorthand})`} is invalid. The format should be \`@<breakpoint | number>\` or \`@<breakpoint | number>/<container>\`.
4902
+ For example, \`@sm\` or \`@600\` or \`@40rem/sidebar\`.`)
4903
+ );
4886
4904
  }
4887
4905
  }
4888
4906
  const [, containerQuery, containerName] = matches;
@@ -4919,16 +4937,83 @@ const shape = {
4919
4937
  borderRadius: 4
4920
4938
  };
4921
4939
  const responsivePropType = PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.object, PropTypes.array]);
4922
- function merge(acc, item) {
4923
- if (!item) {
4924
- return acc;
4940
+ function isObjectEmpty$1(object) {
4941
+ if (object == null) {
4942
+ return true;
4925
4943
  }
4926
- return deepmerge(acc, item, {
4927
- clone: false
4928
- // No need to clone deep, it's way faster.
4929
- });
4944
+ for (const _ in object) {
4945
+ return false;
4946
+ }
4947
+ return true;
4948
+ }
4949
+ function fastDeepAssign(target, source) {
4950
+ const sourceIsArray = Array.isArray(source);
4951
+ const targetIsArray = Array.isArray(target);
4952
+ if (isPrimitive(source)) {
4953
+ return source;
4954
+ } else if (isPrimitiveOrBuiltIn(target)) {
4955
+ return clone(source);
4956
+ } else if (sourceIsArray && targetIsArray) {
4957
+ return mergeArray(target, source);
4958
+ } else if (sourceIsArray !== targetIsArray) {
4959
+ return clone(source);
4960
+ } else {
4961
+ return mergeObject(target, source);
4962
+ }
4963
+ }
4964
+ function cloneArray(value) {
4965
+ let i = 0;
4966
+ const il = value.length;
4967
+ const result = new Array(il);
4968
+ for (i = 0; i < il; i += 1) {
4969
+ result[i] = clone(value[i]);
4970
+ }
4971
+ return result;
4930
4972
  }
4931
- const values$1 = {
4973
+ function cloneObject(target) {
4974
+ const result = {};
4975
+ for (const key in target) {
4976
+ if (key === "__proto__" || key === "constructor" || key === "prototype") {
4977
+ continue;
4978
+ }
4979
+ result[key] = clone(target[key]);
4980
+ }
4981
+ return result;
4982
+ }
4983
+ function mergeArray(target, source) {
4984
+ const tl = target.length;
4985
+ for (let i = 0; i < source.length; i += 1) {
4986
+ target[tl + i] = clone(source[i]);
4987
+ }
4988
+ return target;
4989
+ }
4990
+ function isMergeableObject(value) {
4991
+ return typeof value === "object" && value !== null && !(value instanceof RegExp) && !(value instanceof Date);
4992
+ }
4993
+ function isPrimitive(value) {
4994
+ return typeof value !== "object" || value === null;
4995
+ }
4996
+ function isPrimitiveOrBuiltIn(value) {
4997
+ return typeof value !== "object" || value === null || value instanceof RegExp || value instanceof Date;
4998
+ }
4999
+ function clone(entry) {
5000
+ return isMergeableObject(entry) ? Array.isArray(entry) ? cloneArray(entry) : cloneObject(entry) : entry;
5001
+ }
5002
+ function mergeObject(target, source) {
5003
+ for (const key in source) {
5004
+ if (key === "__proto__" || key === "constructor" || key === "prototype") {
5005
+ continue;
5006
+ }
5007
+ if (key in target) {
5008
+ target[key] = fastDeepAssign(target[key], source[key]);
5009
+ } else {
5010
+ target[key] = clone(source[key]);
5011
+ }
5012
+ }
5013
+ return target;
5014
+ }
5015
+ const EMPTY_THEME$2 = {};
5016
+ const values = {
4932
5017
  xs: 0,
4933
5018
  // phone
4934
5019
  sm: 600,
@@ -4940,16 +5025,13 @@ const values$1 = {
4940
5025
  xl: 1536
4941
5026
  // large screen
4942
5027
  };
4943
- const defaultBreakpoints = {
4944
- // Sorted ASC by size. That's important.
4945
- // It can't be configured as it's used statically for propTypes.
4946
- keys: ["xs", "sm", "md", "lg", "xl"],
4947
- up: (key) => `@media (min-width:${values$1[key]}px)`
4948
- };
5028
+ const DEFAULT_BREAKPOINTS = createBreakpoints({
5029
+ values
5030
+ });
4949
5031
  const defaultContainerQueries = {
4950
5032
  containerQueries: (containerName) => ({
4951
5033
  up: (key) => {
4952
- let result = typeof key === "number" ? key : values$1[key] || key;
5034
+ let result = typeof key === "number" ? key : values[key] || key;
4953
5035
  if (typeof result === "number") {
4954
5036
  result = `${result}px`;
4955
5037
  }
@@ -4958,52 +5040,89 @@ const defaultContainerQueries = {
4958
5040
  })
4959
5041
  };
4960
5042
  function handleBreakpoints(props, propValue, styleFromPropValue) {
4961
- const theme = props.theme || {};
5043
+ const result = {};
5044
+ return iterateBreakpoints(result, props.theme, propValue, (mediaKey, value, initialKey) => {
5045
+ const finalValue = styleFromPropValue(value, initialKey);
5046
+ if (mediaKey) {
5047
+ result[mediaKey] = finalValue;
5048
+ } else {
5049
+ fastDeepAssign(result, finalValue);
5050
+ }
5051
+ });
5052
+ }
5053
+ function iterateBreakpoints(target, theme, propValue, callback) {
5054
+ theme ??= EMPTY_THEME$2;
4962
5055
  if (Array.isArray(propValue)) {
4963
- const themeBreakpoints = theme.breakpoints || defaultBreakpoints;
4964
- return propValue.reduce((acc, item, index) => {
4965
- acc[themeBreakpoints.up(themeBreakpoints.keys[index])] = styleFromPropValue(propValue[index]);
4966
- return acc;
4967
- }, {});
5056
+ const breakpoints = theme.breakpoints ?? DEFAULT_BREAKPOINTS;
5057
+ for (let i = 0; i < propValue.length; i += 1) {
5058
+ buildBreakpoint(target, breakpoints.up(breakpoints.keys[i]), propValue[i], void 0, callback);
5059
+ }
5060
+ return target;
4968
5061
  }
4969
5062
  if (typeof propValue === "object") {
4970
- const themeBreakpoints = theme.breakpoints || defaultBreakpoints;
4971
- return Object.keys(propValue).reduce((acc, breakpoint) => {
4972
- if (isCqShorthand(themeBreakpoints.keys, breakpoint)) {
4973
- const containerKey = getContainerQuery(theme.containerQueries ? theme : defaultContainerQueries, breakpoint);
5063
+ const breakpoints = theme.breakpoints ?? DEFAULT_BREAKPOINTS;
5064
+ const breakpointValues = breakpoints.values ?? values;
5065
+ for (const key in propValue) {
5066
+ if (isCqShorthand(breakpoints.keys, key)) {
5067
+ const containerKey = getContainerQuery(theme.containerQueries ? theme : defaultContainerQueries, key);
4974
5068
  if (containerKey) {
4975
- acc[containerKey] = styleFromPropValue(propValue[breakpoint], breakpoint);
5069
+ buildBreakpoint(target, containerKey, propValue[key], key, callback);
4976
5070
  }
4977
- } else if (Object.keys(themeBreakpoints.values || values$1).includes(breakpoint)) {
4978
- const mediaKey = themeBreakpoints.up(breakpoint);
4979
- acc[mediaKey] = styleFromPropValue(propValue[breakpoint], breakpoint);
5071
+ } else if (key in breakpointValues) {
5072
+ const mediaKey = breakpoints.up(key);
5073
+ buildBreakpoint(target, mediaKey, propValue[key], key, callback);
4980
5074
  } else {
4981
- const cssKey = breakpoint;
4982
- acc[cssKey] = propValue[cssKey];
5075
+ const cssKey = key;
5076
+ target[cssKey] = propValue[cssKey];
4983
5077
  }
4984
- return acc;
4985
- }, {});
5078
+ }
5079
+ return target;
4986
5080
  }
4987
- const output = styleFromPropValue(propValue);
4988
- return output;
5081
+ callback(void 0, propValue);
5082
+ return target;
4989
5083
  }
4990
- function createEmptyBreakpointObject(breakpointsInput = {}) {
4991
- const breakpointsInOrder = breakpointsInput.keys?.reduce((acc, key) => {
4992
- const breakpointStyleKey = breakpointsInput.up(key);
4993
- acc[breakpointStyleKey] = {};
4994
- return acc;
4995
- }, {});
4996
- return breakpointsInOrder || {};
5084
+ function buildBreakpoint(target, mediaKey, value, initialKey, callback) {
5085
+ target[mediaKey] ??= {};
5086
+ callback(mediaKey, value, initialKey);
5087
+ }
5088
+ function createEmptyBreakpointObject(breakpoints = DEFAULT_BREAKPOINTS) {
5089
+ const {
5090
+ internal_mediaKeys: mediaKeys
5091
+ } = breakpoints;
5092
+ const result = {};
5093
+ for (let i = 0; i < mediaKeys.length; i += 1) {
5094
+ result[mediaKeys[i]] = {};
5095
+ }
5096
+ return result;
4997
5097
  }
4998
- function removeUnusedBreakpoints(breakpointKeys, style2) {
4999
- return breakpointKeys.reduce((acc, key) => {
5000
- const breakpointOutput = acc[key];
5001
- const isBreakpointUnused = !breakpointOutput || Object.keys(breakpointOutput).length === 0;
5002
- if (isBreakpointUnused) {
5003
- delete acc[key];
5098
+ function removeUnusedBreakpoints(breakpoints, style2) {
5099
+ const breakpointKeys = breakpoints.internal_mediaKeys;
5100
+ for (let i = 0; i < breakpointKeys.length; i += 1) {
5101
+ const key = breakpointKeys[i];
5102
+ if (isObjectEmpty$1(style2[key])) {
5103
+ delete style2[key];
5004
5104
  }
5005
- return acc;
5006
- }, style2);
5105
+ }
5106
+ return style2;
5107
+ }
5108
+ function hasBreakpoint(breakpoints, value) {
5109
+ if (Array.isArray(value)) {
5110
+ return true;
5111
+ }
5112
+ if (typeof value === "object" && value !== null) {
5113
+ for (let i = 0; i < breakpoints.keys.length; i += 1) {
5114
+ if (breakpoints.keys[i] in value) {
5115
+ return true;
5116
+ }
5117
+ }
5118
+ const valueKeys = Object.keys(value);
5119
+ for (let i = 0; i < valueKeys.length; i += 1) {
5120
+ if (isCqShorthand(breakpoints.keys, valueKeys[i])) {
5121
+ return true;
5122
+ }
5123
+ }
5124
+ }
5125
+ return false;
5007
5126
  }
5008
5127
  function capitalize(string) {
5009
5128
  if (typeof string !== "string") {
@@ -5011,37 +5130,54 @@ function capitalize(string) {
5011
5130
  }
5012
5131
  return string.charAt(0).toUpperCase() + string.slice(1);
5013
5132
  }
5014
- function getPath(obj, path, checkVars = true) {
5015
- if (!path || typeof path !== "string") {
5016
- return null;
5017
- }
5018
- if (obj && obj.vars && checkVars) {
5019
- const val = `vars.${path}`.split(".").reduce((acc, item) => acc && acc[item] ? acc[item] : null, obj);
5020
- if (val != null) {
5021
- return val;
5022
- }
5023
- }
5024
- return path.split(".").reduce((acc, item) => {
5025
- if (acc && acc[item] != null) {
5026
- return acc[item];
5027
- }
5028
- return null;
5029
- }, obj);
5030
- }
5031
- function getStyleValue(themeMapping, transform, propValueFinal, userValue = propValueFinal) {
5133
+ function getStyleValue2(themeMapping, transform, userValue, alternateProp) {
5032
5134
  let value;
5033
5135
  if (typeof themeMapping === "function") {
5034
- value = themeMapping(propValueFinal);
5136
+ value = themeMapping(userValue);
5035
5137
  } else if (Array.isArray(themeMapping)) {
5036
- value = themeMapping[propValueFinal] || userValue;
5138
+ value = themeMapping[userValue] || userValue;
5139
+ } else if (typeof userValue === "string") {
5140
+ value = getPath(themeMapping, userValue, true, alternateProp) || userValue;
5037
5141
  } else {
5038
- value = getPath(themeMapping, propValueFinal) || userValue;
5142
+ value = userValue;
5039
5143
  }
5040
5144
  if (transform) {
5041
5145
  value = transform(value, userValue, themeMapping);
5042
5146
  }
5043
5147
  return value;
5044
5148
  }
5149
+ function getPath(obj, pathInput, checkVars = true, alternateProp = void 0) {
5150
+ if (!obj || !pathInput) {
5151
+ return null;
5152
+ }
5153
+ const path = pathInput.split(".");
5154
+ if (obj.vars && checkVars) {
5155
+ const val = getPathImpl(obj.vars, path, alternateProp);
5156
+ if (val != null) {
5157
+ return val;
5158
+ }
5159
+ }
5160
+ return getPathImpl(obj, path, alternateProp);
5161
+ }
5162
+ function getPathImpl(object, path, alternateProp = void 0) {
5163
+ let lastResult = void 0;
5164
+ let result = object;
5165
+ let index = 0;
5166
+ while (index < path.length) {
5167
+ if (result === null || result === void 0) {
5168
+ return result;
5169
+ }
5170
+ lastResult = result;
5171
+ result = result[path[index]];
5172
+ index += 1;
5173
+ }
5174
+ if (alternateProp && result === void 0) {
5175
+ const lastKey = path[path.length - 1];
5176
+ const alternateKey = `${alternateProp}${lastKey === "default" ? "" : capitalize(lastKey)}`;
5177
+ return lastResult?.[alternateKey];
5178
+ }
5179
+ return result;
5180
+ }
5045
5181
  function style$1(options) {
5046
5182
  const {
5047
5183
  prop,
@@ -5056,15 +5192,9 @@ function style$1(options) {
5056
5192
  const propValue = props[prop];
5057
5193
  const theme = props.theme;
5058
5194
  const themeMapping = getPath(theme, themeKey) || {};
5059
- const styleFromPropValue = (propValueFinal) => {
5060
- let value = getStyleValue(themeMapping, transform, propValueFinal);
5061
- if (propValueFinal === value && typeof propValueFinal === "string") {
5062
- value = getStyleValue(themeMapping, transform, `${prop}${propValueFinal === "default" ? "" : capitalize(propValueFinal)}`, propValueFinal);
5063
- }
5064
- if (cssProperty === false) {
5065
- return value;
5066
- }
5067
- return {
5195
+ const styleFromPropValue = (valueFinal) => {
5196
+ const value = getStyleValue2(themeMapping, transform, valueFinal, prop);
5197
+ return cssProperty === false ? value : {
5068
5198
  [cssProperty]: value
5069
5199
  };
5070
5200
  };
@@ -5076,15 +5206,9 @@ function style$1(options) {
5076
5206
  fn.filterProps = [prop];
5077
5207
  return fn;
5078
5208
  }
5079
- function memoize(fn) {
5080
- const cache = {};
5081
- return (arg2) => {
5082
- if (cache[arg2] === void 0) {
5083
- cache[arg2] = fn(arg2);
5084
- }
5085
- return cache[arg2];
5086
- };
5087
- }
5209
+ const EMPTY_THEME$1 = {
5210
+ internal_cache: {}
5211
+ };
5088
5212
  const properties = {
5089
5213
  m: "margin",
5090
5214
  p: "padding"
@@ -5103,22 +5227,24 @@ const aliases = {
5103
5227
  paddingX: "px",
5104
5228
  paddingY: "py"
5105
5229
  };
5106
- const getCssProperties = memoize((prop) => {
5107
- if (prop.length > 2) {
5108
- if (aliases[prop]) {
5109
- prop = aliases[prop];
5110
- } else {
5111
- return [prop];
5112
- }
5230
+ const CSS_PROPERTIES = {};
5231
+ for (const key in properties) {
5232
+ CSS_PROPERTIES[key] = [properties[key]];
5233
+ }
5234
+ for (const keyProperty in properties) {
5235
+ for (const keyDirection in directions) {
5236
+ const property = properties[keyProperty];
5237
+ const direction = directions[keyDirection];
5238
+ const value = Array.isArray(direction) ? direction.map((dir) => property + dir) : [property + direction];
5239
+ CSS_PROPERTIES[keyProperty + keyDirection] = value;
5113
5240
  }
5114
- const [a, b] = prop.split("");
5115
- const property = properties[a];
5116
- const direction = directions[b] || "";
5117
- return Array.isArray(direction) ? direction.map((dir) => property + dir) : [property + direction];
5118
- });
5119
- const marginKeys = ["m", "mt", "mr", "mb", "ml", "mx", "my", "margin", "marginTop", "marginRight", "marginBottom", "marginLeft", "marginX", "marginY", "marginInline", "marginInlineStart", "marginInlineEnd", "marginBlock", "marginBlockStart", "marginBlockEnd"];
5120
- const paddingKeys = ["p", "pt", "pr", "pb", "pl", "px", "py", "padding", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "paddingX", "paddingY", "paddingInline", "paddingInlineStart", "paddingInlineEnd", "paddingBlock", "paddingBlockStart", "paddingBlockEnd"];
5121
- const spacingKeys = [...marginKeys, ...paddingKeys];
5241
+ }
5242
+ for (const key in aliases) {
5243
+ CSS_PROPERTIES[key] = CSS_PROPERTIES[aliases[key]];
5244
+ }
5245
+ const marginKeys = /* @__PURE__ */ new Set(["m", "mt", "mr", "mb", "ml", "mx", "my", "margin", "marginTop", "marginRight", "marginBottom", "marginLeft", "marginX", "marginY", "marginInline", "marginInlineStart", "marginInlineEnd", "marginBlock", "marginBlockStart", "marginBlockEnd"]);
5246
+ const paddingKeys = /* @__PURE__ */ new Set(["p", "pt", "pr", "pb", "pl", "px", "py", "padding", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "paddingX", "paddingY", "paddingInline", "paddingInlineStart", "paddingInlineEnd", "paddingBlock", "paddingBlockStart", "paddingBlockEnd"]);
5247
+ const spacingKeys = /* @__PURE__ */ new Set([...marginKeys, ...paddingKeys]);
5122
5248
  function createUnaryUnit(theme, themeKey, defaultValue, propName) {
5123
5249
  const themeSpacing = getPath(theme, themeKey, true) ?? defaultValue;
5124
5250
  if (typeof themeSpacing === "number" || typeof themeSpacing === "string") {
@@ -5186,42 +5312,45 @@ function getValue$1(transformer, propValue) {
5186
5312
  }
5187
5313
  return transformer(propValue);
5188
5314
  }
5189
- function getStyleFromPropValue(cssProperties, transformer) {
5190
- return (propValue) => cssProperties.reduce((acc, cssProperty) => {
5191
- acc[cssProperty] = getValue$1(transformer, propValue);
5192
- return acc;
5193
- }, {});
5194
- }
5195
- function resolveCssProperty(props, keys2, prop, transformer) {
5196
- if (!keys2.includes(prop)) {
5197
- return null;
5198
- }
5199
- const cssProperties = getCssProperties(prop);
5200
- const styleFromPropValue = getStyleFromPropValue(cssProperties, transformer);
5201
- const propValue = props[prop];
5202
- return handleBreakpoints(props, propValue, styleFromPropValue);
5203
- }
5315
+ const container = [""];
5204
5316
  function style(props, keys2) {
5205
- const transformer = createUnarySpacing(props.theme);
5206
- return Object.keys(props).map((prop) => resolveCssProperty(props, keys2, prop, transformer)).reduce(merge, {});
5317
+ const theme = props.theme ?? EMPTY_THEME$1;
5318
+ const transformer = theme?.internal_cache?.unarySpacing ?? createUnarySpacing(theme);
5319
+ const result = {};
5320
+ for (const prop in props) {
5321
+ if (!keys2.has(prop)) {
5322
+ continue;
5323
+ }
5324
+ const cssProperties = CSS_PROPERTIES[prop] ?? (container[0] = prop, container);
5325
+ const propValue = props[prop];
5326
+ iterateBreakpoints(result, props.theme, propValue, (mediaKey, value) => {
5327
+ const target = mediaKey ? result[mediaKey] : result;
5328
+ for (let i = 0; i < cssProperties.length; i += 1) {
5329
+ target[cssProperties[i]] = getValue$1(transformer, value);
5330
+ }
5331
+ });
5332
+ }
5333
+ return result;
5207
5334
  }
5208
- function margin(props) {
5335
+ function marginFn(props) {
5209
5336
  return style(props, marginKeys);
5210
5337
  }
5211
- margin.propTypes = marginKeys.reduce((obj, key) => {
5338
+ marginFn.propTypes = Array.from(marginKeys).reduce((obj, key) => {
5212
5339
  obj[key] = responsivePropType;
5213
5340
  return obj;
5214
5341
  }, {});
5215
- margin.filterProps = marginKeys;
5216
- function padding(props) {
5342
+ marginFn.filterProps = marginKeys;
5343
+ const margin = marginFn;
5344
+ function paddingFn(props) {
5217
5345
  return style(props, paddingKeys);
5218
5346
  }
5219
- padding.propTypes = paddingKeys.reduce((obj, key) => {
5347
+ paddingFn.propTypes = Array.from(paddingKeys).reduce((obj, key) => {
5220
5348
  obj[key] = responsivePropType;
5221
5349
  return obj;
5222
5350
  }, {});
5223
- padding.filterProps = paddingKeys;
5224
- spacingKeys.reduce((obj, key) => {
5351
+ paddingFn.filterProps = paddingKeys;
5352
+ const padding = paddingFn;
5353
+ Array.from(spacingKeys).reduce((obj, key) => {
5225
5354
  obj[key] = responsivePropType;
5226
5355
  return obj;
5227
5356
  }, {});
@@ -5254,12 +5383,13 @@ function compose(...styles) {
5254
5383
  return acc;
5255
5384
  }, {});
5256
5385
  const fn = (props) => {
5257
- return Object.keys(props).reduce((acc, prop) => {
5386
+ const result = {};
5387
+ for (const prop in props) {
5258
5388
  if (handlers[prop]) {
5259
- return merge(acc, handlers[prop](props));
5389
+ fastDeepAssign(result, handlers[prop](props));
5260
5390
  }
5261
- return acc;
5262
- }, {});
5391
+ }
5392
+ return result;
5263
5393
  };
5264
5394
  fn.propTypes = styles.reduce((acc, style2) => Object.assign(acc, style2.propTypes), {});
5265
5395
  fn.filterProps = styles.reduce((acc, style2) => acc.concat(style2.filterProps), []);
@@ -5398,6 +5528,7 @@ const backgroundColor = style$1({
5398
5528
  transform: paletteTransform
5399
5529
  });
5400
5530
  compose(color, bgcolor, backgroundColor);
5531
+ const breakpointsValues = values;
5401
5532
  function sizingTransform(value) {
5402
5533
  return value <= 1 && value !== 0 ? `${value * 100}%` : value;
5403
5534
  }
@@ -5408,7 +5539,7 @@ const width = style$1({
5408
5539
  const maxWidth = (props) => {
5409
5540
  if (props.maxWidth !== void 0 && props.maxWidth !== null) {
5410
5541
  const styleFromPropValue = (propValue) => {
5411
- const breakpoint = props.theme?.breakpoints?.values?.[propValue] || values$1[propValue];
5542
+ const breakpoint = props.theme?.breakpoints?.values?.[propValue] || breakpointsValues[propValue];
5412
5543
  if (!breakpoint) {
5413
5544
  return {
5414
5545
  maxWidth: sizingTransform(propValue)
@@ -5746,68 +5877,24 @@ const defaultSxConfig = {
5746
5877
  themeKey: "typography"
5747
5878
  }
5748
5879
  };
5749
- function objectsHaveSameKeys(...objects) {
5750
- const allKeys = objects.reduce((keys2, object) => keys2.concat(Object.keys(object)), []);
5751
- const union2 = new Set(allKeys);
5752
- return objects.every((object) => union2.size === Object.keys(object).length);
5753
- }
5754
- function callIfFn(maybeFn, arg2) {
5755
- return typeof maybeFn === "function" ? maybeFn(arg2) : maybeFn;
5756
- }
5880
+ const EMPTY_THEME = {};
5757
5881
  function unstable_createStyleFunctionSx() {
5758
- function getThemeValue(prop, val, theme, config) {
5759
- const props = {
5760
- [prop]: val,
5761
- theme
5762
- };
5763
- const options = config[prop];
5764
- if (!options) {
5765
- return {
5766
- [prop]: val
5767
- };
5768
- }
5769
- const {
5770
- cssProperty = prop,
5771
- themeKey,
5772
- transform,
5773
- style: style2
5774
- } = options;
5775
- if (val == null) {
5882
+ function styleFunctionSx2(props) {
5883
+ if (!props.sx) {
5776
5884
  return null;
5777
5885
  }
5778
- if (themeKey === "typography" && val === "inherit") {
5779
- return {
5780
- [prop]: val
5781
- };
5782
- }
5783
- const themeMapping = getPath(theme, themeKey) || {};
5784
- if (style2) {
5785
- return style2(props);
5786
- }
5787
- const styleFromPropValue = (propValueFinal) => {
5788
- let value = getStyleValue(themeMapping, transform, propValueFinal);
5789
- if (propValueFinal === value && typeof propValueFinal === "string") {
5790
- value = getStyleValue(themeMapping, transform, `${prop}${propValueFinal === "default" ? "" : capitalize(propValueFinal)}`, propValueFinal);
5791
- }
5792
- if (cssProperty === false) {
5793
- return value;
5794
- }
5795
- return {
5796
- [cssProperty]: value
5797
- };
5798
- };
5799
- return handleBreakpoints(props, val, styleFromPropValue);
5800
- }
5801
- function styleFunctionSx2(props) {
5802
5886
  const {
5803
5887
  sx,
5804
- theme = {}
5805
- } = props || {};
5806
- if (!sx) {
5807
- return null;
5808
- }
5888
+ theme = EMPTY_THEME,
5889
+ nested
5890
+ } = props;
5809
5891
  const config = theme.unstable_sxConfig ?? defaultSxConfig;
5810
- function traverse(sxInput) {
5892
+ const wrapper2 = {
5893
+ sx: null,
5894
+ theme,
5895
+ nested: true
5896
+ };
5897
+ function process(sxInput) {
5811
5898
  let sxObject = sxInput;
5812
5899
  if (typeof sxInput === "function") {
5813
5900
  sxObject = sxInput(theme);
@@ -5817,43 +5904,94 @@ function unstable_createStyleFunctionSx() {
5817
5904
  if (!sxObject) {
5818
5905
  return null;
5819
5906
  }
5820
- const emptyBreakpoints = createEmptyBreakpointObject(theme.breakpoints);
5821
- const breakpointsKeys = Object.keys(emptyBreakpoints);
5822
- let css2 = emptyBreakpoints;
5823
- Object.keys(sxObject).forEach((styleKey) => {
5907
+ const breakpoints = theme.breakpoints ?? DEFAULT_BREAKPOINTS;
5908
+ const css2 = createEmptyBreakpointObject(breakpoints);
5909
+ for (const styleKey in sxObject) {
5824
5910
  const value = callIfFn(sxObject[styleKey], theme);
5825
- if (value !== null && value !== void 0) {
5826
- if (typeof value === "object") {
5827
- if (config[styleKey]) {
5828
- css2 = merge(css2, getThemeValue(styleKey, value, theme, config));
5829
- } else {
5830
- const breakpointsValues = handleBreakpoints({
5831
- theme
5832
- }, value, (x) => ({
5833
- [styleKey]: x
5834
- }));
5835
- if (objectsHaveSameKeys(breakpointsValues, value)) {
5836
- css2[styleKey] = styleFunctionSx2({
5837
- sx: value,
5838
- theme
5839
- });
5840
- } else {
5841
- css2 = merge(css2, breakpointsValues);
5842
- }
5843
- }
5844
- } else {
5845
- css2 = merge(css2, getThemeValue(styleKey, value, theme, config));
5846
- }
5911
+ if (value === null || value === void 0) {
5912
+ continue;
5847
5913
  }
5848
- });
5849
- return sortContainerQueries(theme, removeUnusedBreakpoints(breakpointsKeys, css2));
5914
+ if (typeof value !== "object") {
5915
+ setThemeValue(css2, styleKey, value, theme, config);
5916
+ continue;
5917
+ }
5918
+ if (config[styleKey]) {
5919
+ setThemeValue(css2, styleKey, value, theme, config);
5920
+ continue;
5921
+ }
5922
+ if (hasBreakpoint(breakpoints, value)) {
5923
+ iterateBreakpoints(css2, props.theme, value, (mediaKey, finalValue) => {
5924
+ css2[mediaKey][styleKey] = finalValue;
5925
+ });
5926
+ } else {
5927
+ wrapper2.sx = value;
5928
+ css2[styleKey] = styleFunctionSx2(wrapper2);
5929
+ }
5930
+ }
5931
+ if (!nested && theme.modularCssLayers) {
5932
+ return {
5933
+ "@layer sx": sortContainerQueries(theme, removeUnusedBreakpoints(breakpoints, css2))
5934
+ };
5935
+ }
5936
+ return sortContainerQueries(theme, removeUnusedBreakpoints(breakpoints, css2));
5850
5937
  }
5851
- return Array.isArray(sx) ? sx.map(traverse) : traverse(sx);
5938
+ return Array.isArray(sx) ? sx.map(process) : process(sx);
5852
5939
  }
5940
+ styleFunctionSx2.filterProps = ["sx"];
5853
5941
  return styleFunctionSx2;
5854
5942
  }
5855
5943
  const styleFunctionSx = unstable_createStyleFunctionSx();
5856
- styleFunctionSx.filterProps = ["sx"];
5944
+ function setThemeValue(css2, prop, value, theme, config) {
5945
+ const options = config[prop];
5946
+ if (!options) {
5947
+ css2[prop] = value;
5948
+ return;
5949
+ }
5950
+ if (value == null) {
5951
+ return;
5952
+ }
5953
+ const {
5954
+ themeKey
5955
+ } = options;
5956
+ if (themeKey === "typography" && value === "inherit") {
5957
+ css2[prop] = value;
5958
+ return;
5959
+ }
5960
+ const {
5961
+ style: style2
5962
+ } = options;
5963
+ if (style2) {
5964
+ fastDeepAssign(css2, style2({
5965
+ [prop]: value,
5966
+ theme
5967
+ }));
5968
+ return;
5969
+ }
5970
+ const {
5971
+ cssProperty = prop,
5972
+ transform
5973
+ } = options;
5974
+ const themeMapping = getPath(theme, themeKey);
5975
+ iterateBreakpoints(css2, theme, value, (mediaKey, valueFinal) => {
5976
+ const finalValue = getStyleValue2(themeMapping, transform, valueFinal, prop);
5977
+ if (cssProperty === false) {
5978
+ if (mediaKey) {
5979
+ fastDeepAssign(css2[mediaKey], finalValue);
5980
+ } else {
5981
+ fastDeepAssign(css2, finalValue);
5982
+ }
5983
+ } else {
5984
+ if (mediaKey) {
5985
+ css2[mediaKey][cssProperty] = finalValue;
5986
+ } else {
5987
+ css2[cssProperty] = finalValue;
5988
+ }
5989
+ }
5990
+ });
5991
+ }
5992
+ function callIfFn(maybeFn, arg2) {
5993
+ return typeof maybeFn === "function" ? maybeFn(arg2) : maybeFn;
5994
+ }
5857
5995
  function applyStyles(key, styles) {
5858
5996
  const theme = this;
5859
5997
  if (theme.vars) {
@@ -5914,67 +6052,19 @@ function createTheme$1(options = {}, ...args) {
5914
6052
  theme: this
5915
6053
  });
5916
6054
  };
6055
+ muiTheme.internal_cache = {};
5917
6056
  return muiTheme;
5918
6057
  }
5919
- function isObjectEmpty$1(obj) {
6058
+ function isObjectEmpty(obj) {
5920
6059
  return Object.keys(obj).length === 0;
5921
6060
  }
5922
- function useTheme$2(defaultTheme2 = null) {
6061
+ function useThemeWithoutDefault(defaultTheme2 = null) {
5923
6062
  const contextTheme = React.useContext(ThemeContext);
5924
- return !contextTheme || isObjectEmpty$1(contextTheme) ? defaultTheme2 : contextTheme;
6063
+ return !contextTheme || isObjectEmpty(contextTheme) ? defaultTheme2 : contextTheme;
5925
6064
  }
5926
6065
  const systemDefaultTheme$1 = createTheme$1();
5927
6066
  function useTheme$1(defaultTheme2 = systemDefaultTheme$1) {
5928
- return useTheme$2(defaultTheme2);
5929
- }
5930
- const splitProps = (props) => {
5931
- const result = {
5932
- systemProps: {},
5933
- otherProps: {}
5934
- };
5935
- const config = props?.theme?.unstable_sxConfig ?? defaultSxConfig;
5936
- Object.keys(props).forEach((prop) => {
5937
- if (config[prop]) {
5938
- result.systemProps[prop] = props[prop];
5939
- } else {
5940
- result.otherProps[prop] = props[prop];
5941
- }
5942
- });
5943
- return result;
5944
- };
5945
- function extendSxProp$1(props) {
5946
- const {
5947
- sx: inSx,
5948
- ...other
5949
- } = props;
5950
- const {
5951
- systemProps,
5952
- otherProps
5953
- } = splitProps(other);
5954
- let finalSx;
5955
- if (Array.isArray(inSx)) {
5956
- finalSx = [systemProps, ...inSx];
5957
- } else if (typeof inSx === "function") {
5958
- finalSx = (...args) => {
5959
- const result = inSx(...args);
5960
- if (!isPlainObject(result)) {
5961
- return systemProps;
5962
- }
5963
- return {
5964
- ...systemProps,
5965
- ...result
5966
- };
5967
- };
5968
- } else {
5969
- finalSx = {
5970
- ...systemProps,
5971
- ...inSx
5972
- };
5973
- }
5974
- return {
5975
- ...otherProps,
5976
- sx: finalSx
5977
- };
6067
+ return useThemeWithoutDefault(defaultTheme2);
5978
6068
  }
5979
6069
  const defaultGenerator = (componentName) => componentName;
5980
6070
  const createClassNameGenerator = () => {
@@ -6085,6 +6175,12 @@ const systemDefaultTheme = createTheme$1();
6085
6175
  function shouldForwardProp(prop) {
6086
6176
  return prop !== "ownerState" && prop !== "theme" && prop !== "sx" && prop !== "as";
6087
6177
  }
6178
+ function shallowLayer(serialized, layerName) {
6179
+ if (layerName && serialized && typeof serialized === "object" && serialized.styles && !serialized.styles.startsWith("@layer")) {
6180
+ serialized.styles = `@layer ${layerName}{${String(serialized.styles)}}`;
6181
+ }
6182
+ return serialized;
6183
+ }
6088
6184
  function defaultOverridesResolver(slot) {
6089
6185
  if (!slot) {
6090
6186
  return null;
@@ -6092,32 +6188,32 @@ function defaultOverridesResolver(slot) {
6092
6188
  return (_props, styles) => styles[slot];
6093
6189
  }
6094
6190
  function attachTheme(props, themeId, defaultTheme2) {
6095
- props.theme = isObjectEmpty(props.theme) ? defaultTheme2 : props.theme[themeId] || props.theme;
6191
+ props.theme = isObjectEmpty$1(props.theme) ? defaultTheme2 : props.theme[themeId] || props.theme;
6096
6192
  }
6097
- function processStyle(props, style2) {
6193
+ function processStyle(props, style2, layerName) {
6098
6194
  const resolvedStyle = typeof style2 === "function" ? style2(props) : style2;
6099
6195
  if (Array.isArray(resolvedStyle)) {
6100
- return resolvedStyle.flatMap((subStyle) => processStyle(props, subStyle));
6196
+ return resolvedStyle.flatMap((subStyle) => processStyle(props, subStyle, layerName));
6101
6197
  }
6102
6198
  if (Array.isArray(resolvedStyle?.variants)) {
6103
6199
  let rootStyle;
6104
6200
  if (resolvedStyle.isProcessed) {
6105
- rootStyle = resolvedStyle.style;
6201
+ rootStyle = layerName ? shallowLayer(resolvedStyle.style, layerName) : resolvedStyle.style;
6106
6202
  } else {
6107
6203
  const {
6108
6204
  variants,
6109
6205
  ...otherStyles
6110
6206
  } = resolvedStyle;
6111
- rootStyle = otherStyles;
6207
+ rootStyle = layerName ? shallowLayer(internal_serializeStyles(otherStyles), layerName) : otherStyles;
6112
6208
  }
6113
- return processStyleVariants(props, resolvedStyle.variants, [rootStyle]);
6209
+ return processStyleVariants(props, resolvedStyle.variants, [rootStyle], layerName);
6114
6210
  }
6115
6211
  if (resolvedStyle?.isProcessed) {
6116
- return resolvedStyle.style;
6212
+ return layerName ? shallowLayer(internal_serializeStyles(resolvedStyle.style), layerName) : resolvedStyle.style;
6117
6213
  }
6118
- return resolvedStyle;
6214
+ return layerName ? shallowLayer(internal_serializeStyles(resolvedStyle), layerName) : resolvedStyle;
6119
6215
  }
6120
- function processStyleVariants(props, variants, results = []) {
6216
+ function processStyleVariants(props, variants, results = [], layerName = void 0) {
6121
6217
  let mergedState;
6122
6218
  variantLoop: for (let i = 0; i < variants.length; i += 1) {
6123
6219
  const variant = variants[i];
@@ -6143,9 +6239,9 @@ function processStyleVariants(props, variants, results = []) {
6143
6239
  ...props.ownerState,
6144
6240
  ownerState: props.ownerState
6145
6241
  };
6146
- results.push(variant.style(mergedState));
6242
+ results.push(layerName ? shallowLayer(internal_serializeStyles(variant.style(mergedState)), layerName) : variant.style(mergedState));
6147
6243
  } else {
6148
- results.push(variant.style);
6244
+ results.push(layerName ? shallowLayer(internal_serializeStyles(variant.style), layerName) : variant.style);
6149
6245
  }
6150
6246
  }
6151
6247
  return results;
@@ -6172,6 +6268,7 @@ function createStyled2(input = {}) {
6172
6268
  overridesResolver = defaultOverridesResolver(lowercaseFirstLetter(componentSlot)),
6173
6269
  ...options
6174
6270
  } = inputOptions;
6271
+ const layerName = componentName && componentName.startsWith("Mui") || !!componentSlot ? "components" : "custom";
6175
6272
  const skipVariantsResolver = inputSkipVariantsResolver !== void 0 ? inputSkipVariantsResolver : (
6176
6273
  // TODO v6: remove `Root` in the next major release
6177
6274
  // For more details: https://github.com/mui/material-ui/pull/37908
@@ -6192,18 +6289,21 @@ function createStyled2(input = {}) {
6192
6289
  ...options
6193
6290
  });
6194
6291
  const transformStyle = (style2) => {
6195
- if (typeof style2 === "function" && style2.__emotion_real !== style2) {
6292
+ if (style2.__emotion_real === style2) {
6293
+ return style2;
6294
+ }
6295
+ if (typeof style2 === "function") {
6196
6296
  return function styleFunctionProcessor(props) {
6197
- return processStyle(props, style2);
6297
+ return processStyle(props, style2, props.theme.modularCssLayers ? layerName : void 0);
6198
6298
  };
6199
6299
  }
6200
6300
  if (isPlainObject(style2)) {
6201
6301
  const serialized = preprocessStyles(style2);
6202
- if (!serialized.variants) {
6203
- return serialized.style;
6204
- }
6205
6302
  return function styleObjectProcessor(props) {
6206
- return processStyle(props, serialized);
6303
+ if (!serialized.variants) {
6304
+ return props.theme.modularCssLayers ? shallowLayer(serialized.style, layerName) : serialized.style;
6305
+ }
6306
+ return processStyle(props, serialized, props.theme.modularCssLayers ? layerName : void 0);
6207
6307
  };
6208
6308
  }
6209
6309
  return style2;
@@ -6222,7 +6322,7 @@ function createStyled2(input = {}) {
6222
6322
  }
6223
6323
  const resolvedStyleOverrides = {};
6224
6324
  for (const slotKey in styleOverrides) {
6225
- resolvedStyleOverrides[slotKey] = processStyle(props, styleOverrides[slotKey]);
6325
+ resolvedStyleOverrides[slotKey] = processStyle(props, styleOverrides[slotKey], props.theme.modularCssLayers ? "theme" : void 0);
6226
6326
  }
6227
6327
  return overridesResolver(props, resolvedStyleOverrides);
6228
6328
  });
@@ -6234,7 +6334,7 @@ function createStyled2(input = {}) {
6234
6334
  if (!themeVariants) {
6235
6335
  return null;
6236
6336
  }
6237
- return processStyleVariants(props, themeVariants);
6337
+ return processStyleVariants(props, themeVariants, [], props.theme.modularCssLayers ? "theme" : void 0);
6238
6338
  });
6239
6339
  }
6240
6340
  if (!skipSx) {
@@ -6283,12 +6383,6 @@ function generateStyledLabel(componentName, componentSlot) {
6283
6383
  }
6284
6384
  return label;
6285
6385
  }
6286
- function isObjectEmpty(object) {
6287
- for (const _ in object) {
6288
- return false;
6289
- }
6290
- return true;
6291
- }
6292
6386
  function isStringTag(tag) {
6293
6387
  return typeof tag === "string" && // 96 is one less than the char code
6294
6388
  // for "a" so this is checking that
@@ -6301,20 +6395,20 @@ function lowercaseFirstLetter(string) {
6301
6395
  }
6302
6396
  return string.charAt(0).toLowerCase() + string.slice(1);
6303
6397
  }
6304
- function resolveProps(defaultProps2, props) {
6398
+ function resolveProps(defaultProps, props, mergeClassNameAndStyle = false) {
6305
6399
  const output = {
6306
6400
  ...props
6307
6401
  };
6308
- for (const key in defaultProps2) {
6309
- if (Object.prototype.hasOwnProperty.call(defaultProps2, key)) {
6402
+ for (const key in defaultProps) {
6403
+ if (Object.prototype.hasOwnProperty.call(defaultProps, key)) {
6310
6404
  const propName = key;
6311
6405
  if (propName === "components" || propName === "slots") {
6312
6406
  output[propName] = {
6313
- ...defaultProps2[propName],
6407
+ ...defaultProps[propName],
6314
6408
  ...output[propName]
6315
6409
  };
6316
6410
  } else if (propName === "componentsProps" || propName === "slotProps") {
6317
- const defaultSlotProps = defaultProps2[propName];
6411
+ const defaultSlotProps = defaultProps[propName];
6318
6412
  const slotProps = props[propName];
6319
6413
  if (!slotProps) {
6320
6414
  output[propName] = defaultSlotProps || {};
@@ -6327,12 +6421,25 @@ function resolveProps(defaultProps2, props) {
6327
6421
  for (const slotKey in defaultSlotProps) {
6328
6422
  if (Object.prototype.hasOwnProperty.call(defaultSlotProps, slotKey)) {
6329
6423
  const slotPropName = slotKey;
6330
- output[propName][slotPropName] = resolveProps(defaultSlotProps[slotPropName], slotProps[slotPropName]);
6424
+ const defaultSlotPropValue = defaultSlotProps[slotPropName];
6425
+ const slotPropValue = slotProps[slotPropName];
6426
+ if (typeof defaultSlotPropValue === "function" || typeof slotPropValue === "function") {
6427
+ output[propName][slotPropName] = (...args) => resolveProps((typeof defaultSlotPropValue === "function" ? defaultSlotPropValue(...args) : defaultSlotPropValue) ?? {}, (typeof slotPropValue === "function" ? slotPropValue(...args) : slotPropValue) ?? {}, mergeClassNameAndStyle);
6428
+ } else {
6429
+ output[propName][slotPropName] = resolveProps(defaultSlotPropValue ?? {}, slotPropValue ?? {}, mergeClassNameAndStyle);
6430
+ }
6331
6431
  }
6332
6432
  }
6333
6433
  }
6434
+ } else if (propName === "className" && mergeClassNameAndStyle && props.className !== void 0) {
6435
+ output.className = clsx$1(defaultProps?.className, props?.className);
6436
+ } else if (propName === "style" && mergeClassNameAndStyle && props.style) {
6437
+ output.style = {
6438
+ ...defaultProps?.style,
6439
+ ...props?.style
6440
+ };
6334
6441
  } else if (output[propName] === void 0) {
6335
- output[propName] = defaultProps2[propName];
6442
+ output[propName] = defaultProps[propName];
6336
6443
  }
6337
6444
  }
6338
6445
  }
@@ -6490,8 +6597,11 @@ function private_safeAlpha(color2, value, warning) {
6490
6597
  try {
6491
6598
  return alpha(color2, value);
6492
6599
  } catch (error) {
6493
- return color2;
6494
- }
6600
+ if (warning && true) {
6601
+ console.warn(warning);
6602
+ }
6603
+ return color2;
6604
+ }
6495
6605
  }
6496
6606
  function darken(color2, coefficient) {
6497
6607
  color2 = decomposeColor(color2);
@@ -6509,6 +6619,9 @@ function private_safeDarken(color2, coefficient, warning) {
6509
6619
  try {
6510
6620
  return darken(color2, coefficient);
6511
6621
  } catch (error) {
6622
+ if (warning && true) {
6623
+ console.warn(warning);
6624
+ }
6512
6625
  return color2;
6513
6626
  }
6514
6627
  }
@@ -6532,6 +6645,9 @@ function private_safeLighten(color2, coefficient, warning) {
6532
6645
  try {
6533
6646
  return lighten(color2, coefficient);
6534
6647
  } catch (error) {
6648
+ if (warning && true) {
6649
+ console.warn(warning);
6650
+ }
6535
6651
  return color2;
6536
6652
  }
6537
6653
  }
@@ -6584,10 +6700,10 @@ function getThemeProps(params) {
6584
6700
  }
6585
6701
  const config = theme.components[name];
6586
6702
  if (config.defaultProps) {
6587
- return resolveProps(config.defaultProps, props);
6703
+ return resolveProps(config.defaultProps, props, theme.components.mergeClassNameAndStyle);
6588
6704
  }
6589
6705
  if (!config.styleOverrides && !config.variants) {
6590
- return resolveProps(config, props);
6706
+ return resolveProps(config, props, theme.components.mergeClassNameAndStyle);
6591
6707
  }
6592
6708
  return props;
6593
6709
  }
@@ -6637,9 +6753,14 @@ function createGetCssVar$1(prefix2 = "") {
6637
6753
  };
6638
6754
  return getCssVar;
6639
6755
  }
6756
+ const prototypePollutingKeys = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
6640
6757
  const assignNestedKeys = (obj, keys2, value, arrayKeys = []) => {
6641
6758
  let temp = obj;
6642
- keys2.forEach((k, index) => {
6759
+ for (let index = 0; index < keys2.length; index += 1) {
6760
+ const k = keys2[index];
6761
+ if (prototypePollutingKeys.has(k)) {
6762
+ break;
6763
+ }
6643
6764
  if (index === keys2.length - 1) {
6644
6765
  if (Array.isArray(temp)) {
6645
6766
  temp[Number(k)] = value;
@@ -6652,7 +6773,7 @@ const assignNestedKeys = (obj, keys2, value, arrayKeys = []) => {
6652
6773
  }
6653
6774
  temp = temp[k];
6654
6775
  }
6655
- });
6776
+ }
6656
6777
  };
6657
6778
  const walkObjectDeep = (obj, callback, shouldSkipPaths) => {
6658
6779
  function recurse(object, parentKeys = [], arrayKeys = []) {
@@ -6719,7 +6840,8 @@ function prepareCssVars(theme, parserConfig = {}) {
6719
6840
  const {
6720
6841
  getSelector = defaultGetSelector2,
6721
6842
  disableCssColorScheme,
6722
- colorSchemeSelector: selector
6843
+ colorSchemeSelector: selector,
6844
+ enableContrastVars
6723
6845
  } = parserConfig;
6724
6846
  const {
6725
6847
  colorSchemes = {},
@@ -6853,6 +6975,17 @@ function prepareCssVars(theme, parserConfig = {}) {
6853
6975
  ...finalCss
6854
6976
  }), finalCss);
6855
6977
  });
6978
+ if (enableContrastVars) {
6979
+ stylesheets.push({
6980
+ ":root": {
6981
+ // use double underscore to indicate that these are private variables
6982
+ "--__l-threshold": "0.7",
6983
+ "--__l": "clamp(0, (l / var(--__l-threshold) - 1) * -infinity, 1)",
6984
+ "--__a": "clamp(0.87, (l / var(--__l-threshold) - 1) * -infinity, 1)"
6985
+ // 0.87 is the default alpha value for black text.
6986
+ }
6987
+ });
6988
+ }
6856
6989
  return stylesheets;
6857
6990
  };
6858
6991
  return {
@@ -7053,6 +7186,19 @@ function addLightOrDark(intent, direction, shade, tonalOffset) {
7053
7186
  }
7054
7187
  }
7055
7188
  }
7189
+ function mixLightOrDark(colorSpace, intent, direction, shade, tonalOffset) {
7190
+ const tonalOffsetLight = tonalOffset.light || tonalOffset;
7191
+ const tonalOffsetDark = tonalOffset.dark || tonalOffset * 1.5;
7192
+ if (!intent[direction]) {
7193
+ if (intent.hasOwnProperty(shade)) {
7194
+ intent[direction] = intent[shade];
7195
+ } else if (direction === "light") {
7196
+ intent.light = `color-mix(in ${colorSpace}, ${intent.main}, #fff ${(tonalOffsetLight * 100).toFixed(0)}%)`;
7197
+ } else if (direction === "dark") {
7198
+ intent.dark = `color-mix(in ${colorSpace}, ${intent.main}, #000 ${(tonalOffsetDark * 100).toFixed(0)}%)`;
7199
+ }
7200
+ }
7201
+ }
7056
7202
  function getDefaultPrimary(mode = "light") {
7057
7203
  if (mode === "dark") {
7058
7204
  return {
@@ -7138,11 +7284,15 @@ function getDefaultWarning(mode = "light") {
7138
7284
  dark: orange[900]
7139
7285
  };
7140
7286
  }
7287
+ function contrastColor(background) {
7288
+ return `oklch(from ${background} var(--__l) 0 h / var(--__a))`;
7289
+ }
7141
7290
  function createPalette(palette) {
7142
7291
  const {
7143
7292
  mode = "light",
7144
7293
  contrastThreshold = 3,
7145
7294
  tonalOffset = 0.2,
7295
+ colorSpace,
7146
7296
  ...other
7147
7297
  } = palette;
7148
7298
  const primary = palette.primary || getDefaultPrimary(mode);
@@ -7152,6 +7302,9 @@ function createPalette(palette) {
7152
7302
  const success = palette.success || getDefaultSuccess(mode);
7153
7303
  const warning = palette.warning || getDefaultWarning(mode);
7154
7304
  function getContrastText(background) {
7305
+ if (colorSpace) {
7306
+ return contrastColor(background);
7307
+ }
7155
7308
  const contrastText = getContrastRatio(background, dark.text.primary) >= contrastThreshold ? dark.text.primary : light.text.primary;
7156
7309
  {
7157
7310
  const contrast = getContrastRatio(background, contrastText);
@@ -7194,8 +7347,13 @@ const theme2 = createTheme({ palette: {
7194
7347
  primary: { main: green[500] },
7195
7348
  } });`);
7196
7349
  }
7197
- addLightOrDark(color2, "light", lightShade, tonalOffset);
7198
- addLightOrDark(color2, "dark", darkShade, tonalOffset);
7350
+ if (colorSpace) {
7351
+ mixLightOrDark(colorSpace, color2, "light", lightShade, tonalOffset);
7352
+ mixLightOrDark(colorSpace, color2, "dark", darkShade, tonalOffset);
7353
+ } else {
7354
+ addLightOrDark(color2, "light", lightShade, tonalOffset);
7355
+ addLightOrDark(color2, "dark", darkShade, tonalOffset);
7356
+ }
7199
7357
  if (!color2.contrastText) {
7200
7358
  color2.contrastText = getContrastText(color2.main);
7201
7359
  }
@@ -7271,6 +7429,49 @@ const theme2 = createTheme({ palette: {
7271
7429
  }, other);
7272
7430
  return paletteOutput;
7273
7431
  }
7432
+ const focusVisibleOffsetVar = "--_focusVisible-offset";
7433
+ const focusVisibleBehaviorVar = "--_focusVisible-behavior";
7434
+ const focusVisibleShadowVar = "--_focusVisible-shadow";
7435
+ const offsetValue = `var(${focusVisibleOffsetVar}, 1)`;
7436
+ const behaviorValue = `var(${focusVisibleBehaviorVar}, )`;
7437
+ const outsetFocusRing = {
7438
+ [focusVisibleOffsetVar]: 1,
7439
+ [focusVisibleBehaviorVar]: "initial"
7440
+ // reverts the var to guaranteed-invalid so `var(--_focusVisible-behavior, )` falls back to empty — there is no explicit `outset` keyword.
7441
+ };
7442
+ function mergeFocusVisibleInput(optionsFocusVisible, args) {
7443
+ return args.reduce((acc, arg2) => arg2 && "focusVisible" in arg2 ? deepmerge(acc, {
7444
+ focusVisible: arg2.focusVisible
7445
+ }) : acc, {
7446
+ focusVisible: optionsFocusVisible
7447
+ }).focusVisible;
7448
+ }
7449
+ function isResolvedFocusVisible(input) {
7450
+ return input != null && typeof input === "object" && typeof input.outlineOffset === "string" && input.outlineOffset.includes(focusVisibleOffsetVar);
7451
+ }
7452
+ function resolveFocusVisible(input, outlineColor2) {
7453
+ return wireFocusVisibleVars({
7454
+ outlineStyle: "solid",
7455
+ outlineColor: outlineColor2,
7456
+ outlineWidth: 2,
7457
+ outlineOffset: 2,
7458
+ // invisible shadow for parent component with solid background (AppBar, Snackbar, Alert) can control the ring color.
7459
+ boxShadow: `var(${focusVisibleShadowVar}, 0 0)`,
7460
+ ...input === true ? null : input
7461
+ });
7462
+ }
7463
+ function wireFocusVisibleVars(resolved) {
7464
+ const offset2 = resolved.outlineOffset ?? 0;
7465
+ if (typeof offset2 !== "string" || !offset2.includes(focusVisibleOffsetVar)) {
7466
+ const offsetPx = typeof offset2 === "number" ? `${offset2}px` : offset2;
7467
+ resolved.outlineOffset = `calc(${offsetValue} * ${offsetPx})`;
7468
+ }
7469
+ const standaloneBoxShadows = /* @__PURE__ */ new Set(["none", "initial", "inherit", "unset", "revert", "revert-layer"]);
7470
+ if (typeof resolved.boxShadow === "string" && !standaloneBoxShadows.has(resolved.boxShadow.trim().toLowerCase()) && !/\binset\b/.test(resolved.boxShadow) && !resolved.boxShadow.includes(focusVisibleBehaviorVar)) {
7471
+ resolved.boxShadow = `${behaviorValue} ${resolved.boxShadow}`;
7472
+ }
7473
+ return resolved;
7474
+ }
7274
7475
  function prepareTypographyVars(typography) {
7275
7476
  const vars = {};
7276
7477
  const entries = Object.entries(typography);
@@ -7392,6 +7593,8 @@ function createShadow(...px) {
7392
7593
  return [`${px[0]}px ${px[1]}px ${px[2]}px ${px[3]}px rgba(0,0,0,${shadowKeyUmbraOpacity})`, `${px[4]}px ${px[5]}px ${px[6]}px ${px[7]}px rgba(0,0,0,${shadowKeyPenumbraOpacity})`, `${px[8]}px ${px[9]}px ${px[10]}px ${px[11]}px rgba(0,0,0,${shadowAmbientShadowOpacity})`].join(",");
7393
7594
  }
7394
7595
  const shadows = ["none", createShadow(0, 2, 1, -1, 0, 1, 1, 0, 0, 1, 3, 0), createShadow(0, 3, 1, -2, 0, 2, 2, 0, 0, 1, 5, 0), createShadow(0, 3, 3, -2, 0, 3, 4, 0, 0, 1, 8, 0), createShadow(0, 2, 4, -1, 0, 4, 5, 0, 0, 1, 10, 0), createShadow(0, 3, 5, -1, 0, 5, 8, 0, 0, 1, 14, 0), createShadow(0, 3, 5, -1, 0, 6, 10, 0, 0, 1, 18, 0), createShadow(0, 4, 5, -2, 0, 7, 10, 1, 0, 2, 16, 1), createShadow(0, 5, 5, -3, 0, 8, 10, 1, 0, 3, 14, 2), createShadow(0, 5, 6, -3, 0, 9, 12, 1, 0, 3, 16, 2), createShadow(0, 6, 6, -3, 0, 10, 14, 1, 0, 4, 18, 3), createShadow(0, 6, 7, -4, 0, 11, 15, 1, 0, 4, 20, 3), createShadow(0, 7, 8, -4, 0, 12, 17, 2, 0, 5, 22, 4), createShadow(0, 7, 8, -4, 0, 13, 19, 2, 0, 5, 24, 4), createShadow(0, 7, 9, -4, 0, 14, 21, 2, 0, 5, 26, 4), createShadow(0, 8, 9, -5, 0, 15, 22, 2, 0, 6, 28, 5), createShadow(0, 8, 10, -5, 0, 16, 24, 2, 0, 6, 30, 5), createShadow(0, 8, 11, -5, 0, 17, 26, 2, 0, 6, 32, 5), createShadow(0, 9, 11, -5, 0, 18, 28, 2, 0, 7, 34, 6), createShadow(0, 9, 12, -6, 0, 19, 29, 2, 0, 7, 36, 6), createShadow(0, 10, 13, -6, 0, 20, 31, 3, 0, 8, 38, 7), createShadow(0, 10, 13, -6, 0, 21, 33, 3, 0, 8, 40, 7), createShadow(0, 10, 14, -6, 0, 22, 35, 3, 0, 8, 42, 7), createShadow(0, 11, 14, -7, 0, 23, 36, 3, 0, 9, 44, 8), createShadow(0, 11, 15, -7, 0, 24, 38, 3, 0, 9, 46, 8)];
7596
+ const DEFAULT_TRANSITION_PROPS$1 = ["all"];
7597
+ const EMPTY_OPTIONS$1 = {};
7395
7598
  const easing = {
7396
7599
  // This is the most common easing curve.
7397
7600
  easeInOut: "cubic-bezier(0.4, 0, 0.2, 1)",
@@ -7427,15 +7630,19 @@ function getAutoHeightDuration(height2) {
7427
7630
  return Math.min(Math.round((4 + 15 * constant2 ** 0.25 + constant2 / 5) * 10), 3e3);
7428
7631
  }
7429
7632
  function createTransitions(inputTransitions) {
7633
+ const transitions = {
7634
+ ...inputTransitions
7635
+ };
7636
+ delete transitions.reducedMotion;
7430
7637
  const mergedEasing = {
7431
7638
  ...easing,
7432
- ...inputTransitions.easing
7639
+ ...transitions.easing
7433
7640
  };
7434
7641
  const mergedDuration = {
7435
7642
  ...duration,
7436
- ...inputTransitions.duration
7643
+ ...transitions.duration
7437
7644
  };
7438
- const create = (props = ["all"], options = {}) => {
7645
+ const createTransitionValue = (props = DEFAULT_TRANSITION_PROPS$1, options = EMPTY_OPTIONS$1) => {
7439
7646
  const {
7440
7647
  duration: durationOption = mergedDuration.standard,
7441
7648
  easing: easingOption = mergedEasing.easeInOut,
@@ -7466,14 +7673,22 @@ function createTransitions(inputTransitions) {
7466
7673
  }
7467
7674
  return (Array.isArray(props) ? props : [props]).map((animatedProp) => `${animatedProp} ${typeof durationOption === "string" ? durationOption : formatMs(durationOption)} ${easingOption} ${typeof delay === "string" ? delay : formatMs(delay)}`).join(",");
7468
7675
  };
7676
+ const create = transitions.create ?? createTransitionValue;
7469
7677
  return {
7470
7678
  getAutoHeightDuration,
7471
7679
  create,
7472
- ...inputTransitions,
7680
+ ...transitions,
7473
7681
  easing: mergedEasing,
7474
7682
  duration: mergedDuration
7475
7683
  };
7476
7684
  }
7685
+ const EMPTY_MOTION = {};
7686
+ function createMotion(inputMotion = EMPTY_MOTION) {
7687
+ return {
7688
+ reducedMotion: "never",
7689
+ ...inputMotion
7690
+ };
7691
+ }
7477
7692
  const zIndex = {
7478
7693
  mobileStepper: 1e3,
7479
7694
  fab: 1050,
@@ -7495,7 +7710,7 @@ function stringifyTheme(baseTheme = {}) {
7495
7710
  const array = Object.entries(object);
7496
7711
  for (let index = 0; index < array.length; index++) {
7497
7712
  const [key, value] = array[index];
7498
- if (!isSerializable(value) || key.startsWith("unstable_")) {
7713
+ if (!isSerializable(value) || key.startsWith("unstable_") || key.startsWith("internal_")) {
7499
7714
  delete object[key];
7500
7715
  } else if (isPlainObject(value)) {
7501
7716
  object[key] = {
@@ -7511,19 +7726,70 @@ function stringifyTheme(baseTheme = {}) {
7511
7726
  const theme = ${JSON.stringify(serializableTheme, null, 2)};
7512
7727
 
7513
7728
  theme.breakpoints = createBreakpoints(theme.breakpoints || {});
7729
+ theme.motion = { reducedMotion: 'never', ...theme.motion };
7514
7730
  theme.transitions = createTransitions(theme.transitions || {});
7515
7731
 
7516
7732
  export default theme;`;
7517
7733
  }
7734
+ function coefficientToPercentage(coefficient) {
7735
+ if (typeof coefficient === "number") {
7736
+ return `${(coefficient * 100).toFixed(0)}%`;
7737
+ }
7738
+ return `calc((${coefficient}) * 100%)`;
7739
+ }
7740
+ const parseAddition = (str) => {
7741
+ if (!Number.isNaN(+str)) {
7742
+ return +str;
7743
+ }
7744
+ const numbers = str.match(/\d*\.?\d+/g);
7745
+ if (!numbers) {
7746
+ return 0;
7747
+ }
7748
+ let sum = 0;
7749
+ for (let i = 0; i < numbers.length; i += 1) {
7750
+ sum += +numbers[i];
7751
+ }
7752
+ return sum;
7753
+ };
7754
+ function attachColorManipulators(theme) {
7755
+ Object.assign(theme, {
7756
+ alpha(color2, coefficient) {
7757
+ const obj = this || theme;
7758
+ if (obj.colorSpace) {
7759
+ return `oklch(from ${color2} l c h / ${typeof coefficient === "string" ? `calc(${coefficient})` : coefficient})`;
7760
+ }
7761
+ if (obj.vars) {
7762
+ return `rgba(${color2.replace(/var\(--([^,\s)]+)(?:,[^)]+)?\)+/g, "var(--$1Channel)")} / ${typeof coefficient === "string" ? `calc(${coefficient})` : coefficient})`;
7763
+ }
7764
+ return alpha(color2, parseAddition(coefficient));
7765
+ },
7766
+ lighten(color2, coefficient) {
7767
+ const obj = this || theme;
7768
+ if (obj.colorSpace) {
7769
+ return `color-mix(in ${obj.colorSpace}, ${color2}, #fff ${coefficientToPercentage(coefficient)})`;
7770
+ }
7771
+ return lighten(color2, coefficient);
7772
+ },
7773
+ darken(color2, coefficient) {
7774
+ const obj = this || theme;
7775
+ if (obj.colorSpace) {
7776
+ return `color-mix(in ${obj.colorSpace}, ${color2}, #000 ${coefficientToPercentage(coefficient)})`;
7777
+ }
7778
+ return darken(color2, coefficient);
7779
+ }
7780
+ });
7781
+ }
7518
7782
  function createThemeNoVars(options = {}, ...args) {
7519
7783
  const {
7520
7784
  breakpoints: breakpointsInput,
7521
7785
  mixins: mixinsInput = {},
7522
7786
  spacing: spacingInput,
7523
7787
  palette: paletteInput = {},
7788
+ motion: motionInput = {},
7524
7789
  transitions: transitionsInput = {},
7525
7790
  typography: typographyInput = {},
7526
7791
  shape: shapeInput,
7792
+ colorSpace,
7527
7793
  ...other
7528
7794
  } = options;
7529
7795
  if (options.vars && // The error should throw only for the root theme creation because user is not allowed to use a custom node `vars`.
@@ -7531,7 +7797,10 @@ function createThemeNoVars(options = {}, ...args) {
7531
7797
  options.generateThemeVars === void 0) {
7532
7798
  throw new Error("MUI: `vars` is a private field used for CSS variables support.\nPlease use another name or follow the [docs](https://mui.com/material-ui/customization/css-theme-variables/usage/) to enable the feature.");
7533
7799
  }
7534
- const palette = createPalette(paletteInput);
7800
+ const palette = createPalette({
7801
+ ...paletteInput,
7802
+ colorSpace
7803
+ });
7535
7804
  const systemTheme = createTheme$1(options);
7536
7805
  let muiTheme = deepmerge(systemTheme, {
7537
7806
  mixins: createMixins(systemTheme.breakpoints, mixinsInput),
@@ -7539,6 +7808,7 @@ function createThemeNoVars(options = {}, ...args) {
7539
7808
  // Don't use [...shadows] until you've verified its transpiled code is not invoking the iterator protocol.
7540
7809
  shadows: shadows.slice(),
7541
7810
  typography: createTypography(palette, typographyInput),
7811
+ motion: createMotion(motionInput),
7542
7812
  transitions: createTransitions(transitionsInput),
7543
7813
  zIndex: {
7544
7814
  ...zIndex
@@ -7546,6 +7816,10 @@ function createThemeNoVars(options = {}, ...args) {
7546
7816
  });
7547
7817
  muiTheme = deepmerge(muiTheme, other);
7548
7818
  muiTheme = args.reduce((acc, argument) => deepmerge(acc, argument), muiTheme);
7819
+ delete muiTheme.transitions.reducedMotion;
7820
+ if (muiTheme.focusVisible != null && muiTheme.focusVisible !== false) {
7821
+ muiTheme.focusVisible = resolveFocusVisible(muiTheme.focusVisible, muiTheme.palette.primary.main);
7822
+ }
7549
7823
  {
7550
7824
  const stateClasses = ["active", "checked", "completed", "disabled", "error", "expanded", "focused", "focusVisible", "required", "selected"];
7551
7825
  const traverse = (node2, component) => {
@@ -7583,6 +7857,7 @@ function createThemeNoVars(options = {}, ...args) {
7583
7857
  });
7584
7858
  };
7585
7859
  muiTheme.toRuntimeSource = stringifyTheme;
7860
+ attachColorManipulators(muiTheme);
7586
7861
  return muiTheme;
7587
7862
  }
7588
7863
  function getOverlayAlpha(elevation) {
@@ -7620,9 +7895,13 @@ function createColorScheme(options) {
7620
7895
  // need to cast to avoid module augmentation test
7621
7896
  opacity,
7622
7897
  overlays,
7623
- ...rest
7898
+ colorSpace,
7899
+ ...other
7624
7900
  } = options;
7625
- const palette = createPalette(paletteInput);
7901
+ const palette = createPalette({
7902
+ ...paletteInput,
7903
+ colorSpace
7904
+ });
7626
7905
  return {
7627
7906
  palette,
7628
7907
  opacity: {
@@ -7630,11 +7909,14 @@ function createColorScheme(options) {
7630
7909
  ...opacity
7631
7910
  },
7632
7911
  overlays: overlays || getOverlays(palette.mode),
7633
- ...rest
7912
+ ...other
7634
7913
  };
7635
7914
  }
7636
7915
  function shouldSkipGeneratingVar(keys2) {
7637
- return !!keys2[0].match(/(cssVarPrefix|colorSchemeSelector|rootSelector|typography|mixins|breakpoints|direction|transitions)/) || !!keys2[0].match(/sxConfig$/) || // ends with sxConfig
7916
+ return keys2[0] === "motion" || // Keep `focusVisible` inline: its values reference the per-component private vars
7917
+ // (`--_focusVisible-offset`/`-behavior`). Hoisted to a `:root` var they resolve where those
7918
+ // vars are unset, silently breaking the inner-ring inset.
7919
+ keys2[0] === "focusVisible" || !!keys2[0].match(/(cssVarPrefix|colorSchemeSelector|modularCssLayers|rootSelector|typography|mixins|breakpoints|direction|transitions)/) || !!keys2[0].match(/sxConfig$/) || // ends with sxConfig
7638
7920
  keys2[0] === "palette" && !!keys2[1]?.match(/(mode|contrastThreshold|tonalOffset)/);
7639
7921
  }
7640
7922
  const excludeVariablesFromRoot = (cssVarPrefix) => [...[...Array(25)].map((_, index) => `--${cssVarPrefix ? `${cssVarPrefix}-` : ""}overlays-${index}`), `--${cssVarPrefix ? `${cssVarPrefix}-` : ""}palette-AppBar-darkBg`, `--${cssVarPrefix ? `${cssVarPrefix}-` : ""}palette-AppBar-darkColor`];
@@ -7737,7 +8019,7 @@ const silent = (fn) => {
7737
8019
  return void 0;
7738
8020
  };
7739
8021
  const createGetCssVar = (cssVarPrefix = "mui") => createGetCssVar$1(cssVarPrefix);
7740
- function attachColorScheme$1(colorSchemes, scheme, restTheme, colorScheme) {
8022
+ function attachColorScheme$1(colorSpace, colorSchemes, scheme, restTheme, colorScheme) {
7741
8023
  if (!scheme) {
7742
8024
  return void 0;
7743
8025
  }
@@ -7749,7 +8031,8 @@ function attachColorScheme$1(colorSchemes, scheme, restTheme, colorScheme) {
7749
8031
  palette: {
7750
8032
  mode,
7751
8033
  ...scheme?.palette
7752
- }
8034
+ },
8035
+ colorSpace
7753
8036
  });
7754
8037
  return void 0;
7755
8038
  }
@@ -7761,7 +8044,8 @@ function attachColorScheme$1(colorSchemes, scheme, restTheme, colorScheme) {
7761
8044
  palette: {
7762
8045
  mode,
7763
8046
  ...scheme?.palette
7764
- }
8047
+ },
8048
+ colorSpace
7765
8049
  });
7766
8050
  colorSchemes[colorScheme] = {
7767
8051
  ...scheme,
@@ -7782,6 +8066,7 @@ function createThemeWithVars(options = {}, ...args) {
7782
8066
  defaultColorScheme: defaultColorSchemeInput,
7783
8067
  disableCssColorScheme = false,
7784
8068
  cssVarPrefix = "mui",
8069
+ nativeColor = false,
7785
8070
  shouldSkipGeneratingVar: shouldSkipGeneratingVar$1 = shouldSkipGeneratingVar,
7786
8071
  colorSchemeSelector: selector = colorSchemesInput.light && colorSchemesInput.dark ? "media" : void 0,
7787
8072
  rootSelector = ":root",
@@ -7806,12 +8091,16 @@ function createThemeWithVars(options = {}, ...args) {
7806
8091
  if (!defaultScheme) {
7807
8092
  throw new Error(`MUI: The \`colorSchemes.${defaultColorScheme}\` option is either missing or invalid.`);
7808
8093
  }
7809
- const muiTheme = attachColorScheme$1(colorSchemes, defaultScheme, input, defaultColorScheme);
8094
+ let colorSpace;
8095
+ if (nativeColor) {
8096
+ colorSpace = "oklch";
8097
+ }
8098
+ const muiTheme = attachColorScheme$1(colorSpace, colorSchemes, defaultScheme, input, defaultColorScheme);
7810
8099
  if (builtInLight && !colorSchemes.light) {
7811
- attachColorScheme$1(colorSchemes, builtInLight, void 0, "light");
8100
+ attachColorScheme$1(colorSpace, colorSchemes, builtInLight, void 0, "light");
7812
8101
  }
7813
8102
  if (builtInDark && !colorSchemes.dark) {
7814
- attachColorScheme$1(colorSchemes, builtInDark, void 0, "dark");
8103
+ attachColorScheme$1(colorSpace, colorSchemes, builtInDark, void 0, "dark");
7815
8104
  }
7816
8105
  let theme = {
7817
8106
  defaultColorScheme,
@@ -7843,12 +8132,28 @@ function createThemeWithVars(options = {}, ...args) {
7843
8132
  setColor(palette.common, "background", "#000");
7844
8133
  setColor(palette.common, "onBackground", "#fff");
7845
8134
  }
8135
+ function colorMix(method, color2, coefficient) {
8136
+ if (colorSpace) {
8137
+ let mixer;
8138
+ if (method === private_safeAlpha) {
8139
+ mixer = `transparent ${((1 - coefficient) * 100).toFixed(0)}%`;
8140
+ }
8141
+ if (method === private_safeDarken) {
8142
+ mixer = `#000 ${(coefficient * 100).toFixed(0)}%`;
8143
+ }
8144
+ if (method === private_safeLighten) {
8145
+ mixer = `#fff ${(coefficient * 100).toFixed(0)}%`;
8146
+ }
8147
+ return `color-mix(in ${colorSpace}, ${color2}, ${mixer})`;
8148
+ }
8149
+ return method(color2, coefficient);
8150
+ }
7846
8151
  assignNode(palette, ["Alert", "AppBar", "Avatar", "Button", "Chip", "FilledInput", "LinearProgress", "Skeleton", "Slider", "SnackbarContent", "SpeedDialAction", "StepConnector", "StepContent", "Switch", "TableCell", "Tooltip"]);
7847
8152
  if (palette.mode === "light") {
7848
- setColor(palette.Alert, "errorColor", private_safeDarken(palette.error.light, 0.6));
7849
- setColor(palette.Alert, "infoColor", private_safeDarken(palette.info.light, 0.6));
7850
- setColor(palette.Alert, "successColor", private_safeDarken(palette.success.light, 0.6));
7851
- setColor(palette.Alert, "warningColor", private_safeDarken(palette.warning.light, 0.6));
8153
+ setColor(palette.Alert, "errorColor", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-error-light") : palette.error.light, 0.6));
8154
+ setColor(palette.Alert, "infoColor", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-info-light") : palette.info.light, 0.6));
8155
+ setColor(palette.Alert, "successColor", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-success-light") : palette.success.light, 0.6));
8156
+ setColor(palette.Alert, "warningColor", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-warning-light") : palette.warning.light, 0.6));
7852
8157
  setColor(palette.Alert, "errorFilledBg", setCssVarColor("palette-error-main"));
7853
8158
  setColor(palette.Alert, "infoFilledBg", setCssVarColor("palette-info-main"));
7854
8159
  setColor(palette.Alert, "successFilledBg", setCssVarColor("palette-success-main"));
@@ -7857,10 +8162,10 @@ function createThemeWithVars(options = {}, ...args) {
7857
8162
  setColor(palette.Alert, "infoFilledColor", silent(() => palette.getContrastText(palette.info.main)));
7858
8163
  setColor(palette.Alert, "successFilledColor", silent(() => palette.getContrastText(palette.success.main)));
7859
8164
  setColor(palette.Alert, "warningFilledColor", silent(() => palette.getContrastText(palette.warning.main)));
7860
- setColor(palette.Alert, "errorStandardBg", private_safeLighten(palette.error.light, 0.9));
7861
- setColor(palette.Alert, "infoStandardBg", private_safeLighten(palette.info.light, 0.9));
7862
- setColor(palette.Alert, "successStandardBg", private_safeLighten(palette.success.light, 0.9));
7863
- setColor(palette.Alert, "warningStandardBg", private_safeLighten(palette.warning.light, 0.9));
8165
+ setColor(palette.Alert, "errorStandardBg", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-error-light") : palette.error.light, 0.9));
8166
+ setColor(palette.Alert, "infoStandardBg", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-info-light") : palette.info.light, 0.9));
8167
+ setColor(palette.Alert, "successStandardBg", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-success-light") : palette.success.light, 0.9));
8168
+ setColor(palette.Alert, "warningStandardBg", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-warning-light") : palette.warning.light, 0.9));
7864
8169
  setColor(palette.Alert, "errorIconColor", setCssVarColor("palette-error-main"));
7865
8170
  setColor(palette.Alert, "infoIconColor", setCssVarColor("palette-info-main"));
7866
8171
  setColor(palette.Alert, "successIconColor", setCssVarColor("palette-success-main"));
@@ -7875,41 +8180,41 @@ function createThemeWithVars(options = {}, ...args) {
7875
8180
  setColor(palette.FilledInput, "bg", "rgba(0, 0, 0, 0.06)");
7876
8181
  setColor(palette.FilledInput, "hoverBg", "rgba(0, 0, 0, 0.09)");
7877
8182
  setColor(palette.FilledInput, "disabledBg", "rgba(0, 0, 0, 0.12)");
7878
- setColor(palette.LinearProgress, "primaryBg", private_safeLighten(palette.primary.main, 0.62));
7879
- setColor(palette.LinearProgress, "secondaryBg", private_safeLighten(palette.secondary.main, 0.62));
7880
- setColor(palette.LinearProgress, "errorBg", private_safeLighten(palette.error.main, 0.62));
7881
- setColor(palette.LinearProgress, "infoBg", private_safeLighten(palette.info.main, 0.62));
7882
- setColor(palette.LinearProgress, "successBg", private_safeLighten(palette.success.main, 0.62));
7883
- setColor(palette.LinearProgress, "warningBg", private_safeLighten(palette.warning.main, 0.62));
7884
- setColor(palette.Skeleton, "bg", `rgba(${setCssVarColor("palette-text-primaryChannel")} / 0.11)`);
7885
- setColor(palette.Slider, "primaryTrack", private_safeLighten(palette.primary.main, 0.62));
7886
- setColor(palette.Slider, "secondaryTrack", private_safeLighten(palette.secondary.main, 0.62));
7887
- setColor(palette.Slider, "errorTrack", private_safeLighten(palette.error.main, 0.62));
7888
- setColor(palette.Slider, "infoTrack", private_safeLighten(palette.info.main, 0.62));
7889
- setColor(palette.Slider, "successTrack", private_safeLighten(palette.success.main, 0.62));
7890
- setColor(palette.Slider, "warningTrack", private_safeLighten(palette.warning.main, 0.62));
7891
- const snackbarContentBackground = private_safeEmphasize(palette.background.default, 0.8);
8183
+ setColor(palette.LinearProgress, "primaryBg", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-primary-main") : palette.primary.main, 0.62));
8184
+ setColor(palette.LinearProgress, "secondaryBg", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-secondary-main") : palette.secondary.main, 0.62));
8185
+ setColor(palette.LinearProgress, "errorBg", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-error-main") : palette.error.main, 0.62));
8186
+ setColor(palette.LinearProgress, "infoBg", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-info-main") : palette.info.main, 0.62));
8187
+ setColor(palette.LinearProgress, "successBg", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-success-main") : palette.success.main, 0.62));
8188
+ setColor(palette.LinearProgress, "warningBg", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-warning-light") : palette.warning.main, 0.62));
8189
+ setColor(palette.Skeleton, "bg", colorSpace ? colorMix(private_safeAlpha, nativeColor ? getCssVar("palette-text-primary") : palette.text.primary, 0.11) : `rgba(${setCssVarColor("palette-text-primaryChannel")} / 0.11)`);
8190
+ setColor(palette.Slider, "primaryTrack", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-primary-main") : palette.primary.main, 0.62));
8191
+ setColor(palette.Slider, "secondaryTrack", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-secondary-main") : palette.secondary.main, 0.62));
8192
+ setColor(palette.Slider, "errorTrack", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-error-main") : palette.error.main, 0.62));
8193
+ setColor(palette.Slider, "infoTrack", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-info-main") : palette.info.main, 0.62));
8194
+ setColor(palette.Slider, "successTrack", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-success-main") : palette.success.main, 0.62));
8195
+ setColor(palette.Slider, "warningTrack", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-warning-main") : palette.warning.main, 0.62));
8196
+ const snackbarContentBackground = colorSpace ? colorMix(private_safeDarken, nativeColor ? getCssVar("palette-background-default") : palette.background.default, 0.6825) : private_safeEmphasize(palette.background.default, 0.8);
7892
8197
  setColor(palette.SnackbarContent, "bg", snackbarContentBackground);
7893
- setColor(palette.SnackbarContent, "color", silent(() => palette.getContrastText(snackbarContentBackground)));
8198
+ setColor(palette.SnackbarContent, "color", silent(() => colorSpace ? dark.text.primary : palette.getContrastText(snackbarContentBackground)));
7894
8199
  setColor(palette.SpeedDialAction, "fabHoverBg", private_safeEmphasize(palette.background.paper, 0.15));
7895
8200
  setColor(palette.StepConnector, "border", setCssVarColor("palette-grey-400"));
7896
8201
  setColor(palette.StepContent, "border", setCssVarColor("palette-grey-400"));
7897
8202
  setColor(palette.Switch, "defaultColor", setCssVarColor("palette-common-white"));
7898
8203
  setColor(palette.Switch, "defaultDisabledColor", setCssVarColor("palette-grey-100"));
7899
- setColor(palette.Switch, "primaryDisabledColor", private_safeLighten(palette.primary.main, 0.62));
7900
- setColor(palette.Switch, "secondaryDisabledColor", private_safeLighten(palette.secondary.main, 0.62));
7901
- setColor(palette.Switch, "errorDisabledColor", private_safeLighten(palette.error.main, 0.62));
7902
- setColor(palette.Switch, "infoDisabledColor", private_safeLighten(palette.info.main, 0.62));
7903
- setColor(palette.Switch, "successDisabledColor", private_safeLighten(palette.success.main, 0.62));
7904
- setColor(palette.Switch, "warningDisabledColor", private_safeLighten(palette.warning.main, 0.62));
7905
- setColor(palette.TableCell, "border", private_safeLighten(private_safeAlpha(palette.divider, 1), 0.88));
7906
- setColor(palette.Tooltip, "bg", private_safeAlpha(palette.grey[700], 0.92));
8204
+ setColor(palette.Switch, "primaryDisabledColor", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-primary-main") : palette.primary.main, 0.62));
8205
+ setColor(palette.Switch, "secondaryDisabledColor", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-secondary-main") : palette.secondary.main, 0.62));
8206
+ setColor(palette.Switch, "errorDisabledColor", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-error-main") : palette.error.main, 0.62));
8207
+ setColor(palette.Switch, "infoDisabledColor", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-info-main") : palette.info.main, 0.62));
8208
+ setColor(palette.Switch, "successDisabledColor", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-success-main") : palette.success.main, 0.62));
8209
+ setColor(palette.Switch, "warningDisabledColor", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-warning-main") : palette.warning.main, 0.62));
8210
+ setColor(palette.TableCell, "border", colorMix(private_safeLighten, private_safeAlpha(nativeColor ? getCssVar("palette-divider") : palette.divider, 1), 0.88));
8211
+ setColor(palette.Tooltip, "bg", colorMix(private_safeAlpha, nativeColor ? getCssVar("palette-grey-700") : palette.grey[700], 0.92));
7907
8212
  }
7908
8213
  if (palette.mode === "dark") {
7909
- setColor(palette.Alert, "errorColor", private_safeLighten(palette.error.light, 0.6));
7910
- setColor(palette.Alert, "infoColor", private_safeLighten(palette.info.light, 0.6));
7911
- setColor(palette.Alert, "successColor", private_safeLighten(palette.success.light, 0.6));
7912
- setColor(palette.Alert, "warningColor", private_safeLighten(palette.warning.light, 0.6));
8214
+ setColor(palette.Alert, "errorColor", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-error-light") : palette.error.light, 0.6));
8215
+ setColor(palette.Alert, "infoColor", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-info-light") : palette.info.light, 0.6));
8216
+ setColor(palette.Alert, "successColor", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-success-light") : palette.success.light, 0.6));
8217
+ setColor(palette.Alert, "warningColor", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-warning-light") : palette.warning.light, 0.6));
7913
8218
  setColor(palette.Alert, "errorFilledBg", setCssVarColor("palette-error-dark"));
7914
8219
  setColor(palette.Alert, "infoFilledBg", setCssVarColor("palette-info-dark"));
7915
8220
  setColor(palette.Alert, "successFilledBg", setCssVarColor("palette-success-dark"));
@@ -7918,10 +8223,10 @@ function createThemeWithVars(options = {}, ...args) {
7918
8223
  setColor(palette.Alert, "infoFilledColor", silent(() => palette.getContrastText(palette.info.dark)));
7919
8224
  setColor(palette.Alert, "successFilledColor", silent(() => palette.getContrastText(palette.success.dark)));
7920
8225
  setColor(palette.Alert, "warningFilledColor", silent(() => palette.getContrastText(palette.warning.dark)));
7921
- setColor(palette.Alert, "errorStandardBg", private_safeDarken(palette.error.light, 0.9));
7922
- setColor(palette.Alert, "infoStandardBg", private_safeDarken(palette.info.light, 0.9));
7923
- setColor(palette.Alert, "successStandardBg", private_safeDarken(palette.success.light, 0.9));
7924
- setColor(palette.Alert, "warningStandardBg", private_safeDarken(palette.warning.light, 0.9));
8226
+ setColor(palette.Alert, "errorStandardBg", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-error-light") : palette.error.light, 0.9));
8227
+ setColor(palette.Alert, "infoStandardBg", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-info-light") : palette.info.light, 0.9));
8228
+ setColor(palette.Alert, "successStandardBg", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-success-light") : palette.success.light, 0.9));
8229
+ setColor(palette.Alert, "warningStandardBg", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-warning-light") : palette.warning.light, 0.9));
7925
8230
  setColor(palette.Alert, "errorIconColor", setCssVarColor("palette-error-main"));
7926
8231
  setColor(palette.Alert, "infoIconColor", setCssVarColor("palette-info-main"));
7927
8232
  setColor(palette.Alert, "successIconColor", setCssVarColor("palette-success-main"));
@@ -7938,44 +8243,46 @@ function createThemeWithVars(options = {}, ...args) {
7938
8243
  setColor(palette.FilledInput, "bg", "rgba(255, 255, 255, 0.09)");
7939
8244
  setColor(palette.FilledInput, "hoverBg", "rgba(255, 255, 255, 0.13)");
7940
8245
  setColor(palette.FilledInput, "disabledBg", "rgba(255, 255, 255, 0.12)");
7941
- setColor(palette.LinearProgress, "primaryBg", private_safeDarken(palette.primary.main, 0.5));
7942
- setColor(palette.LinearProgress, "secondaryBg", private_safeDarken(palette.secondary.main, 0.5));
7943
- setColor(palette.LinearProgress, "errorBg", private_safeDarken(palette.error.main, 0.5));
7944
- setColor(palette.LinearProgress, "infoBg", private_safeDarken(palette.info.main, 0.5));
7945
- setColor(palette.LinearProgress, "successBg", private_safeDarken(palette.success.main, 0.5));
7946
- setColor(palette.LinearProgress, "warningBg", private_safeDarken(palette.warning.main, 0.5));
7947
- setColor(palette.Skeleton, "bg", `rgba(${setCssVarColor("palette-text-primaryChannel")} / 0.13)`);
7948
- setColor(palette.Slider, "primaryTrack", private_safeDarken(palette.primary.main, 0.5));
7949
- setColor(palette.Slider, "secondaryTrack", private_safeDarken(palette.secondary.main, 0.5));
7950
- setColor(palette.Slider, "errorTrack", private_safeDarken(palette.error.main, 0.5));
7951
- setColor(palette.Slider, "infoTrack", private_safeDarken(palette.info.main, 0.5));
7952
- setColor(palette.Slider, "successTrack", private_safeDarken(palette.success.main, 0.5));
7953
- setColor(palette.Slider, "warningTrack", private_safeDarken(palette.warning.main, 0.5));
7954
- const snackbarContentBackground = private_safeEmphasize(palette.background.default, 0.98);
8246
+ setColor(palette.LinearProgress, "primaryBg", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-primary-main") : palette.primary.main, 0.5));
8247
+ setColor(palette.LinearProgress, "secondaryBg", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-secondary-main") : palette.secondary.main, 0.5));
8248
+ setColor(palette.LinearProgress, "errorBg", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-error-main") : palette.error.main, 0.5));
8249
+ setColor(palette.LinearProgress, "infoBg", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-info-main") : palette.info.main, 0.5));
8250
+ setColor(palette.LinearProgress, "successBg", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-success-main") : palette.success.main, 0.5));
8251
+ setColor(palette.LinearProgress, "warningBg", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-warning-main") : palette.warning.main, 0.5));
8252
+ setColor(palette.Skeleton, "bg", colorSpace ? colorMix(private_safeAlpha, nativeColor ? getCssVar("palette-text-primary") : palette.text.primary, 0.13) : `rgba(${setCssVarColor("palette-text-primaryChannel")} / 0.13)`);
8253
+ setColor(palette.Slider, "primaryTrack", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-primary-main") : palette.primary.main, 0.5));
8254
+ setColor(palette.Slider, "secondaryTrack", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-secondary-main") : palette.secondary.main, 0.5));
8255
+ setColor(palette.Slider, "errorTrack", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-error-main") : palette.error.main, 0.5));
8256
+ setColor(palette.Slider, "infoTrack", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-info-main") : palette.info.main, 0.5));
8257
+ setColor(palette.Slider, "successTrack", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-success-main") : palette.success.main, 0.5));
8258
+ setColor(palette.Slider, "warningTrack", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-warning-light") : palette.warning.main, 0.5));
8259
+ const snackbarContentBackground = colorSpace ? colorMix(private_safeLighten, nativeColor ? getCssVar("palette-background-default") : palette.background.default, 0.985) : private_safeEmphasize(palette.background.default, 0.98);
7955
8260
  setColor(palette.SnackbarContent, "bg", snackbarContentBackground);
7956
- setColor(palette.SnackbarContent, "color", silent(() => palette.getContrastText(snackbarContentBackground)));
8261
+ setColor(palette.SnackbarContent, "color", silent(() => colorSpace ? light.text.primary : palette.getContrastText(snackbarContentBackground)));
7957
8262
  setColor(palette.SpeedDialAction, "fabHoverBg", private_safeEmphasize(palette.background.paper, 0.15));
7958
8263
  setColor(palette.StepConnector, "border", setCssVarColor("palette-grey-600"));
7959
8264
  setColor(palette.StepContent, "border", setCssVarColor("palette-grey-600"));
7960
8265
  setColor(palette.Switch, "defaultColor", setCssVarColor("palette-grey-300"));
7961
8266
  setColor(palette.Switch, "defaultDisabledColor", setCssVarColor("palette-grey-600"));
7962
- setColor(palette.Switch, "primaryDisabledColor", private_safeDarken(palette.primary.main, 0.55));
7963
- setColor(palette.Switch, "secondaryDisabledColor", private_safeDarken(palette.secondary.main, 0.55));
7964
- setColor(palette.Switch, "errorDisabledColor", private_safeDarken(palette.error.main, 0.55));
7965
- setColor(palette.Switch, "infoDisabledColor", private_safeDarken(palette.info.main, 0.55));
7966
- setColor(palette.Switch, "successDisabledColor", private_safeDarken(palette.success.main, 0.55));
7967
- setColor(palette.Switch, "warningDisabledColor", private_safeDarken(palette.warning.main, 0.55));
7968
- setColor(palette.TableCell, "border", private_safeDarken(private_safeAlpha(palette.divider, 1), 0.68));
7969
- setColor(palette.Tooltip, "bg", private_safeAlpha(palette.grey[700], 0.92));
7970
- }
7971
- setColorChannel(palette.background, "default");
7972
- setColorChannel(palette.background, "paper");
7973
- setColorChannel(palette.common, "background");
7974
- setColorChannel(palette.common, "onBackground");
7975
- setColorChannel(palette, "divider");
8267
+ setColor(palette.Switch, "primaryDisabledColor", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-primary-main") : palette.primary.main, 0.55));
8268
+ setColor(palette.Switch, "secondaryDisabledColor", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-secondary-main") : palette.secondary.main, 0.55));
8269
+ setColor(palette.Switch, "errorDisabledColor", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-error-main") : palette.error.main, 0.55));
8270
+ setColor(palette.Switch, "infoDisabledColor", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-info-main") : palette.info.main, 0.55));
8271
+ setColor(palette.Switch, "successDisabledColor", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-success-main") : palette.success.main, 0.55));
8272
+ setColor(palette.Switch, "warningDisabledColor", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-warning-light") : palette.warning.main, 0.55));
8273
+ setColor(palette.TableCell, "border", colorMix(private_safeDarken, private_safeAlpha(nativeColor ? getCssVar("palette-divider") : palette.divider, 1), 0.68));
8274
+ setColor(palette.Tooltip, "bg", colorMix(private_safeAlpha, nativeColor ? getCssVar("palette-grey-700") : palette.grey[700], 0.92));
8275
+ }
8276
+ if (!nativeColor) {
8277
+ setColorChannel(palette.background, "default");
8278
+ setColorChannel(palette.background, "paper");
8279
+ setColorChannel(palette.common, "background");
8280
+ setColorChannel(palette.common, "onBackground");
8281
+ setColorChannel(palette, "divider");
8282
+ }
7976
8283
  Object.keys(palette).forEach((color2) => {
7977
8284
  const colors = palette[color2];
7978
- if (color2 !== "tonalOffset" && colors && typeof colors === "object") {
8285
+ if (color2 !== "tonalOffset" && !nativeColor && colors && typeof colors === "object") {
7979
8286
  if (colors.main) {
7980
8287
  setColor(palette[color2], "mainChannel", private_safeColorChannel(toRgb(colors.main)));
7981
8288
  }
@@ -8004,11 +8311,16 @@ function createThemeWithVars(options = {}, ...args) {
8004
8311
  });
8005
8312
  });
8006
8313
  theme = args.reduce((acc, argument) => deepmerge(acc, argument), theme);
8314
+ const focusVisibleInput = mergeFocusVisibleInput(options.focusVisible, args);
8315
+ if (focusVisibleInput != null && focusVisibleInput !== false) {
8316
+ theme.focusVisible = resolveFocusVisible(focusVisibleInput, getCssVar("palette-primary-main"));
8317
+ }
8007
8318
  const parserConfig = {
8008
8319
  prefix: cssVarPrefix,
8009
8320
  disableCssColorScheme,
8010
8321
  shouldSkipGeneratingVar: shouldSkipGeneratingVar$1,
8011
- getSelector: defaultGetSelector(theme)
8322
+ getSelector: defaultGetSelector(theme),
8323
+ enableContrastVars: nativeColor
8012
8324
  };
8013
8325
  const {
8014
8326
  vars,
@@ -8037,6 +8349,7 @@ function createThemeWithVars(options = {}, ...args) {
8037
8349
  theme: this
8038
8350
  });
8039
8351
  };
8352
+ theme.internal_cache = {};
8040
8353
  theme.toRuntimeSource = stringifyTheme;
8041
8354
  return theme;
8042
8355
  }
@@ -8063,7 +8376,7 @@ function createTheme(options = {}, ...args) {
8063
8376
  light: true
8064
8377
  } : void 0,
8065
8378
  defaultColorScheme: initialDefaultColorScheme = palette?.mode,
8066
- ...rest
8379
+ ...other
8067
8380
  } = options;
8068
8381
  const defaultColorSchemeInput = initialDefaultColorScheme || "light";
8069
8382
  const defaultScheme = initialColorSchemes?.[defaultColorSchemeInput];
@@ -8112,18 +8425,133 @@ function createTheme(options = {}, ...args) {
8112
8425
  };
8113
8426
  attachColorScheme(theme, "light", colorSchemesInput.light);
8114
8427
  }
8428
+ if (theme.focusVisible != null && theme.focusVisible !== false) {
8429
+ let focusVisibleInput = theme.focusVisible;
8430
+ const rawFocusVisible = mergeFocusVisibleInput(options.focusVisible, args);
8431
+ const authoredColor = rawFocusVisible && typeof rawFocusVisible === "object" ? rawFocusVisible.outlineColor : void 0;
8432
+ if (!authoredColor || isResolvedFocusVisible(rawFocusVisible) && authoredColor === theme.palette.primary.main) {
8433
+ const {
8434
+ outlineColor: outlineColor2,
8435
+ ...rest
8436
+ } = focusVisibleInput;
8437
+ focusVisibleInput = rest;
8438
+ }
8439
+ Object.keys(theme.colorSchemes).forEach((scheme) => {
8440
+ const schemePalette = theme.colorSchemes?.[scheme]?.palette;
8441
+ if (schemePalette?.primary) {
8442
+ theme.colorSchemes[scheme].focusVisible = resolveFocusVisible(focusVisibleInput, schemePalette.primary.main);
8443
+ }
8444
+ });
8445
+ }
8115
8446
  return theme;
8116
8447
  }
8117
8448
  if (!palette && !("light" in colorSchemesInput) && defaultColorSchemeInput === "light") {
8118
8449
  colorSchemesInput.light = true;
8119
8450
  }
8120
8451
  return createThemeWithVars({
8121
- ...rest,
8452
+ ...other,
8122
8453
  colorSchemes: colorSchemesInput,
8123
8454
  defaultColorScheme: defaultColorSchemeInput,
8124
8455
  ...typeof cssVariables !== "boolean" && cssVariables
8125
8456
  }, ...args);
8126
8457
  }
8458
+ function getCheckboxUtilityClass(slot) {
8459
+ return generateUtilityClass("MuiCheckbox", slot);
8460
+ }
8461
+ const checkboxClasses = generateUtilityClasses("MuiCheckbox", ["root", "checked", "disabled", "indeterminate", "colorPrimary", "colorSecondary", "sizeSmall", "sizeMedium"]);
8462
+ function chainPropTypes(propType1, propType2) {
8463
+ return function validate(...args) {
8464
+ return propType1(...args) || propType2(...args);
8465
+ };
8466
+ }
8467
+ function isClassComponent(elementType) {
8468
+ const {
8469
+ prototype = {}
8470
+ } = elementType;
8471
+ return Boolean(prototype.isReactComponent);
8472
+ }
8473
+ function elementTypeAcceptingRef(props, propName, componentName, location, propFullName) {
8474
+ const propValue = props[propName];
8475
+ const safePropName = propFullName || propName;
8476
+ if (propValue == null || // When server-side rendering React doesn't warn either.
8477
+ // This is not an accurate check for SSR.
8478
+ // This is only in place for emotion compat.
8479
+ // TODO: Revisit once https://github.com/react/react/issues/20047 is resolved.
8480
+ typeof window === "undefined") {
8481
+ return null;
8482
+ }
8483
+ let warningHint;
8484
+ if (typeof propValue === "function" && !isClassComponent(propValue)) {
8485
+ warningHint = "Did you accidentally provide a plain function component instead?";
8486
+ }
8487
+ if (propValue === React.Fragment) {
8488
+ warningHint = "Did you accidentally provide a React.Fragment instead?";
8489
+ }
8490
+ if (warningHint !== void 0) {
8491
+ return new Error(`Invalid ${location} \`${safePropName}\` supplied to \`${componentName}\`. Expected an element type that can hold a ref. ${warningHint} For more information see https://mui.com/r/caveat-with-refs-guide`);
8492
+ }
8493
+ return null;
8494
+ }
8495
+ const elementTypeAcceptingRef$1 = chainPropTypes(PropTypes.elementType, elementTypeAcceptingRef);
8496
+ const refType = PropTypes.oneOfType([PropTypes.func, PropTypes.object]);
8497
+ function isHostComponent(element) {
8498
+ return typeof element === "string";
8499
+ }
8500
+ function useForkRef$1(...refs) {
8501
+ const cleanupRef = React.useRef(void 0);
8502
+ const refEffect = React.useCallback((instance) => {
8503
+ const cleanups = refs.map((ref) => {
8504
+ if (ref == null) {
8505
+ return null;
8506
+ }
8507
+ if (typeof ref === "function") {
8508
+ const refCallback = ref;
8509
+ const refCleanup = refCallback(instance);
8510
+ return typeof refCleanup === "function" ? refCleanup : () => {
8511
+ refCallback(null);
8512
+ };
8513
+ }
8514
+ ref.current = instance;
8515
+ return () => {
8516
+ ref.current = null;
8517
+ };
8518
+ });
8519
+ return () => {
8520
+ cleanups.forEach((refCleanup) => refCleanup?.());
8521
+ };
8522
+ }, refs);
8523
+ return React.useMemo(() => {
8524
+ if (refs.every((ref) => ref == null)) {
8525
+ return null;
8526
+ }
8527
+ return (value) => {
8528
+ if (cleanupRef.current) {
8529
+ cleanupRef.current();
8530
+ cleanupRef.current = void 0;
8531
+ }
8532
+ if (value != null) {
8533
+ cleanupRef.current = refEffect(value);
8534
+ }
8535
+ };
8536
+ }, refs);
8537
+ }
8538
+ function useEventCallback(fn) {
8539
+ const ref = React.useRef(fn);
8540
+ useEnhancedEffect$1(() => {
8541
+ ref.current = fn;
8542
+ });
8543
+ return React.useRef((...args) => (
8544
+ // @ts-expect-error hide `this`
8545
+ (0, ref.current)(...args)
8546
+ )).current;
8547
+ }
8548
+ const FormControlContext = /* @__PURE__ */ React.createContext(void 0);
8549
+ {
8550
+ FormControlContext.displayName = "FormControlContext";
8551
+ }
8552
+ function useFormControl() {
8553
+ return React.useContext(FormControlContext);
8554
+ }
8127
8555
  const defaultTheme = createTheme();
8128
8556
  function useTheme() {
8129
8557
  const theme = useTheme$1(defaultTheme);
@@ -8141,20 +8569,6 @@ const styled = createStyled2({
8141
8569
  defaultTheme,
8142
8570
  rootShouldForwardProp
8143
8571
  });
8144
- const { makeStyles } = createMakeAndWithStyles({
8145
- useTheme
8146
- });
8147
- const { tss } = createTss({
8148
- "useContext": function useContext2() {
8149
- const theme = useTheme();
8150
- return { theme };
8151
- },
8152
- "usePlugin": useMuiThemeStyleOverridesPlugin
8153
- });
8154
- const useStyles$3 = tss.create({});
8155
- function internal_createExtendSxProp() {
8156
- return extendSxProp$1;
8157
- }
8158
8572
  const memoTheme = unstable_memoTheme;
8159
8573
  ({
8160
8574
  // ┌────────────────────────────── Warning ──────────────────────────────┐
@@ -8173,6 +8587,52 @@ const memoTheme = unstable_memoTheme;
8173
8587
  function useDefaultProps(params) {
8174
8588
  return useDefaultProps$1(params);
8175
8589
  }
8590
+ const defaultStyles = {
8591
+ transition: "none"
8592
+ };
8593
+ function resolveReducedMotionStyles(reducedMotion, styles) {
8594
+ if (reducedMotion === "always") {
8595
+ return styles;
8596
+ }
8597
+ if (reducedMotion === "system") {
8598
+ return {
8599
+ "@media (prefers-reduced-motion: reduce)": styles
8600
+ };
8601
+ }
8602
+ return null;
8603
+ }
8604
+ const EMPTY_STYLE = {};
8605
+ const DEFAULT_TRANSITION_PROPS = ["all"];
8606
+ const EMPTY_OPTIONS = {};
8607
+ function getReducedMotionStyles(theme, styles) {
8608
+ const resolvedStyles = defaultStyles;
8609
+ return resolveReducedMotionStyles(theme.motion?.reducedMotion, resolvedStyles);
8610
+ }
8611
+ function getTransitionStyles(theme, props = DEFAULT_TRANSITION_PROPS, options = EMPTY_OPTIONS) {
8612
+ const transition = theme.transitions?.create?.(props, options);
8613
+ const reducedMotionStyles = getReducedMotionStyles(theme);
8614
+ if (transition === void 0) {
8615
+ return reducedMotionStyles ?? EMPTY_STYLE;
8616
+ }
8617
+ const transitionStyles = {
8618
+ transition
8619
+ };
8620
+ return reducedMotionStyles ? {
8621
+ ...transitionStyles,
8622
+ ...reducedMotionStyles
8623
+ } : transitionStyles;
8624
+ }
8625
+ const { makeStyles } = createMakeAndWithStyles({
8626
+ useTheme
8627
+ });
8628
+ const { tss } = createTss({
8629
+ "useContext": function useContext2() {
8630
+ const theme = useTheme();
8631
+ return { theme };
8632
+ },
8633
+ "usePlugin": useMuiThemeStyleOverridesPlugin
8634
+ });
8635
+ const useStyles$3 = tss.create({});
8176
8636
  function getSvgIconUtilityClass(slot) {
8177
8637
  return generateUtilityClass("MuiSvgIcon", slot);
8178
8638
  }
@@ -8205,7 +8665,7 @@ const SvgIconRoot = styled("svg", {
8205
8665
  height: "1em",
8206
8666
  display: "inline-block",
8207
8667
  flexShrink: 0,
8208
- transition: theme.transitions?.create?.("fill", {
8668
+ ...getTransitionStyles(theme, "fill", {
8209
8669
  duration: (theme.vars ?? theme).transitions?.duration?.shorter
8210
8670
  }),
8211
8671
  variants: [
@@ -8451,7 +8911,7 @@ function useControlled(props) {
8451
8911
  current: defaultValue
8452
8912
  } = React.useRef(defaultProp);
8453
8913
  React.useEffect(() => {
8454
- if (!isControlled && !Object.is(defaultValue, defaultProp)) {
8914
+ if (!isControlled && JSON.stringify(defaultProp) !== JSON.stringify(defaultValue)) {
8455
8915
  console.error([`MUI: A component is changing the default ${state} state of an uncontrolled ${name} after being initialized. To suppress this warning opt to use a controlled ${name}.`].join("\n"));
8456
8916
  }
8457
8917
  }, [JSON.stringify(defaultProp)]);
@@ -8463,69 +8923,21 @@ function useControlled(props) {
8463
8923
  }, []);
8464
8924
  return [value, setValueIfUncontrolled];
8465
8925
  }
8466
- function useEventCallback(fn) {
8467
- const ref = React.useRef(fn);
8468
- useEnhancedEffect$1(() => {
8469
- ref.current = fn;
8470
- });
8471
- return React.useRef((...args) => (
8472
- // @ts-expect-error hide `this`
8473
- (0, ref.current)(...args)
8474
- )).current;
8926
+ function isEventHandler(key, value) {
8927
+ const thirdCharCode = key.charCodeAt(2);
8928
+ return key[0] === "o" && key[1] === "n" && thirdCharCode >= 65 && thirdCharCode <= 90 && typeof value === "function";
8475
8929
  }
8476
- function useForkRef$1(...refs) {
8477
- const cleanupRef = React.useRef(void 0);
8478
- const refEffect = React.useCallback((instance) => {
8479
- const cleanups = refs.map((ref) => {
8480
- if (ref == null) {
8481
- return null;
8482
- }
8483
- if (typeof ref === "function") {
8484
- const refCallback = ref;
8485
- const refCleanup = refCallback(instance);
8486
- return typeof refCleanup === "function" ? refCleanup : () => {
8487
- refCallback(null);
8488
- };
8489
- }
8490
- ref.current = instance;
8491
- return () => {
8492
- ref.current = null;
8493
- };
8494
- });
8495
- return () => {
8496
- cleanups.forEach((refCleanup) => refCleanup?.());
8497
- };
8498
- }, refs);
8499
- return React.useMemo(() => {
8500
- if (refs.every((ref) => ref == null)) {
8501
- return null;
8502
- }
8503
- return (value) => {
8504
- if (cleanupRef.current) {
8505
- cleanupRef.current();
8506
- cleanupRef.current = void 0;
8507
- }
8508
- if (value != null) {
8509
- cleanupRef.current = refEffect(value);
8510
- }
8511
- };
8512
- }, refs);
8513
- }
8514
- function isEventHandler(key, value) {
8515
- const thirdCharCode = key.charCodeAt(2);
8516
- return key[0] === "o" && key[1] === "n" && thirdCharCode >= 65 && thirdCharCode <= 90 && typeof value === "function";
8517
- }
8518
- function mergeSlotProps$1(externalSlotProps, defaultSlotProps) {
8519
- if (!externalSlotProps) {
8520
- return defaultSlotProps;
8521
- }
8522
- function extractHandlers(externalSlotPropsValue, defaultSlotPropsValue) {
8523
- const handlers2 = {};
8524
- Object.keys(defaultSlotPropsValue).forEach((key) => {
8525
- if (isEventHandler(key, defaultSlotPropsValue[key]) && typeof externalSlotPropsValue[key] === "function") {
8526
- handlers2[key] = (...args) => {
8527
- externalSlotPropsValue[key](...args);
8528
- defaultSlotPropsValue[key](...args);
8930
+ function mergeSlotProps$1(externalSlotProps, defaultSlotProps) {
8931
+ if (!externalSlotProps) {
8932
+ return defaultSlotProps;
8933
+ }
8934
+ function extractHandlers(externalSlotPropsValue, defaultSlotPropsValue) {
8935
+ const handlers2 = {};
8936
+ Object.keys(defaultSlotPropsValue).forEach((key) => {
8937
+ if (isEventHandler(key, defaultSlotPropsValue[key]) && typeof externalSlotPropsValue[key] === "function") {
8938
+ handlers2[key] = (...args) => {
8939
+ externalSlotPropsValue[key](...args);
8940
+ defaultSlotPropsValue[key](...args);
8529
8941
  };
8530
8942
  }
8531
8943
  });
@@ -8580,258 +8992,6 @@ function mergeSlotProps$1(externalSlotProps, defaultSlotProps) {
8580
8992
  }
8581
8993
  };
8582
8994
  }
8583
- function chainPropTypes(propType1, propType2) {
8584
- return function validate(...args) {
8585
- return propType1(...args) || propType2(...args);
8586
- };
8587
- }
8588
- function _objectWithoutPropertiesLoose(r2, e) {
8589
- if (null == r2) return {};
8590
- var t = {};
8591
- for (var n in r2) if ({}.hasOwnProperty.call(r2, n)) {
8592
- if (-1 !== e.indexOf(n)) continue;
8593
- t[n] = r2[n];
8594
- }
8595
- return t;
8596
- }
8597
- function _setPrototypeOf(t, e) {
8598
- return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t2, e2) {
8599
- return t2.__proto__ = e2, t2;
8600
- }, _setPrototypeOf(t, e);
8601
- }
8602
- function _inheritsLoose(t, o) {
8603
- t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
8604
- }
8605
- const TransitionGroupContext = React__default.createContext(null);
8606
- function _assertThisInitialized(e) {
8607
- if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
8608
- return e;
8609
- }
8610
- function getChildMapping(children2, mapFn) {
8611
- var mapper = function mapper2(child) {
8612
- return mapFn && isValidElement(child) ? mapFn(child) : child;
8613
- };
8614
- var result = /* @__PURE__ */ Object.create(null);
8615
- if (children2) Children.map(children2, function(c) {
8616
- return c;
8617
- }).forEach(function(child) {
8618
- result[child.key] = mapper(child);
8619
- });
8620
- return result;
8621
- }
8622
- function mergeChildMappings(prev2, next2) {
8623
- prev2 = prev2 || {};
8624
- next2 = next2 || {};
8625
- function getValueForKey(key) {
8626
- return key in next2 ? next2[key] : prev2[key];
8627
- }
8628
- var nextKeysPending = /* @__PURE__ */ Object.create(null);
8629
- var pendingKeys = [];
8630
- for (var prevKey in prev2) {
8631
- if (prevKey in next2) {
8632
- if (pendingKeys.length) {
8633
- nextKeysPending[prevKey] = pendingKeys;
8634
- pendingKeys = [];
8635
- }
8636
- } else {
8637
- pendingKeys.push(prevKey);
8638
- }
8639
- }
8640
- var i;
8641
- var childMapping = {};
8642
- for (var nextKey in next2) {
8643
- if (nextKeysPending[nextKey]) {
8644
- for (i = 0; i < nextKeysPending[nextKey].length; i++) {
8645
- var pendingNextKey = nextKeysPending[nextKey][i];
8646
- childMapping[nextKeysPending[nextKey][i]] = getValueForKey(pendingNextKey);
8647
- }
8648
- }
8649
- childMapping[nextKey] = getValueForKey(nextKey);
8650
- }
8651
- for (i = 0; i < pendingKeys.length; i++) {
8652
- childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]);
8653
- }
8654
- return childMapping;
8655
- }
8656
- function getProp(child, prop, props) {
8657
- return props[prop] != null ? props[prop] : child.props[prop];
8658
- }
8659
- function getInitialChildMapping(props, onExited) {
8660
- return getChildMapping(props.children, function(child) {
8661
- return cloneElement(child, {
8662
- onExited: onExited.bind(null, child),
8663
- in: true,
8664
- appear: getProp(child, "appear", props),
8665
- enter: getProp(child, "enter", props),
8666
- exit: getProp(child, "exit", props)
8667
- });
8668
- });
8669
- }
8670
- function getNextChildMapping(nextProps, prevChildMapping, onExited) {
8671
- var nextChildMapping = getChildMapping(nextProps.children);
8672
- var children2 = mergeChildMappings(prevChildMapping, nextChildMapping);
8673
- Object.keys(children2).forEach(function(key) {
8674
- var child = children2[key];
8675
- if (!isValidElement(child)) return;
8676
- var hasPrev = key in prevChildMapping;
8677
- var hasNext = key in nextChildMapping;
8678
- var prevChild = prevChildMapping[key];
8679
- var isLeaving = isValidElement(prevChild) && !prevChild.props.in;
8680
- if (hasNext && (!hasPrev || isLeaving)) {
8681
- children2[key] = cloneElement(child, {
8682
- onExited: onExited.bind(null, child),
8683
- in: true,
8684
- exit: getProp(child, "exit", nextProps),
8685
- enter: getProp(child, "enter", nextProps)
8686
- });
8687
- } else if (!hasNext && hasPrev && !isLeaving) {
8688
- children2[key] = cloneElement(child, {
8689
- in: false
8690
- });
8691
- } else if (hasNext && hasPrev && isValidElement(prevChild)) {
8692
- children2[key] = cloneElement(child, {
8693
- onExited: onExited.bind(null, child),
8694
- in: prevChild.props.in,
8695
- exit: getProp(child, "exit", nextProps),
8696
- enter: getProp(child, "enter", nextProps)
8697
- });
8698
- }
8699
- });
8700
- return children2;
8701
- }
8702
- var values = Object.values || function(obj) {
8703
- return Object.keys(obj).map(function(k) {
8704
- return obj[k];
8705
- });
8706
- };
8707
- var defaultProps = {
8708
- component: "div",
8709
- childFactory: function childFactory(child) {
8710
- return child;
8711
- }
8712
- };
8713
- var TransitionGroup = /* @__PURE__ */ function(_React$Component) {
8714
- _inheritsLoose(TransitionGroup2, _React$Component);
8715
- function TransitionGroup2(props, context) {
8716
- var _this;
8717
- _this = _React$Component.call(this, props, context) || this;
8718
- var handleExited = _this.handleExited.bind(_assertThisInitialized(_this));
8719
- _this.state = {
8720
- contextValue: {
8721
- isMounting: true
8722
- },
8723
- handleExited,
8724
- firstRender: true
8725
- };
8726
- return _this;
8727
- }
8728
- var _proto = TransitionGroup2.prototype;
8729
- _proto.componentDidMount = function componentDidMount() {
8730
- this.mounted = true;
8731
- this.setState({
8732
- contextValue: {
8733
- isMounting: false
8734
- }
8735
- });
8736
- };
8737
- _proto.componentWillUnmount = function componentWillUnmount() {
8738
- this.mounted = false;
8739
- };
8740
- TransitionGroup2.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, _ref) {
8741
- var prevChildMapping = _ref.children, handleExited = _ref.handleExited, firstRender = _ref.firstRender;
8742
- return {
8743
- children: firstRender ? getInitialChildMapping(nextProps, handleExited) : getNextChildMapping(nextProps, prevChildMapping, handleExited),
8744
- firstRender: false
8745
- };
8746
- };
8747
- _proto.handleExited = function handleExited(child, node2) {
8748
- var currentChildMapping = getChildMapping(this.props.children);
8749
- if (child.key in currentChildMapping) return;
8750
- if (child.props.onExited) {
8751
- child.props.onExited(node2);
8752
- }
8753
- if (this.mounted) {
8754
- this.setState(function(state) {
8755
- var children2 = _extends$1({}, state.children);
8756
- delete children2[child.key];
8757
- return {
8758
- children: children2
8759
- };
8760
- });
8761
- }
8762
- };
8763
- _proto.render = function render() {
8764
- var _this$props = this.props, Component = _this$props.component, childFactory2 = _this$props.childFactory, props = _objectWithoutPropertiesLoose(_this$props, ["component", "childFactory"]);
8765
- var contextValue = this.state.contextValue;
8766
- var children2 = values(this.state.children).map(childFactory2);
8767
- delete props.appear;
8768
- delete props.enter;
8769
- delete props.exit;
8770
- if (Component === null) {
8771
- return /* @__PURE__ */ React__default.createElement(TransitionGroupContext.Provider, {
8772
- value: contextValue
8773
- }, children2);
8774
- }
8775
- return /* @__PURE__ */ React__default.createElement(TransitionGroupContext.Provider, {
8776
- value: contextValue
8777
- }, /* @__PURE__ */ React__default.createElement(Component, props, children2));
8778
- };
8779
- return TransitionGroup2;
8780
- }(React__default.Component);
8781
- TransitionGroup.propTypes = {
8782
- /**
8783
- * `<TransitionGroup>` renders a `<div>` by default. You can change this
8784
- * behavior by providing a `component` prop.
8785
- * If you use React v16+ and would like to avoid a wrapping `<div>` element
8786
- * you can pass in `component={null}`. This is useful if the wrapping div
8787
- * borks your css styles.
8788
- */
8789
- component: PropTypes.any,
8790
- /**
8791
- * A set of `<Transition>` components, that are toggled `in` and out as they
8792
- * leave. the `<TransitionGroup>` will inject specific transition props, so
8793
- * remember to spread them through if you are wrapping the `<Transition>` as
8794
- * with our `<Fade>` example.
8795
- *
8796
- * While this component is meant for multiple `Transition` or `CSSTransition`
8797
- * children, sometimes you may want to have a single transition child with
8798
- * content that you want to be transitioned out and in when you change it
8799
- * (e.g. routes, images etc.) In that case you can change the `key` prop of
8800
- * the transition child as you change its content, this will cause
8801
- * `TransitionGroup` to transition the child out and back in.
8802
- */
8803
- children: PropTypes.node,
8804
- /**
8805
- * A convenience prop that enables or disables appear animations
8806
- * for all children. Note that specifying this will override any defaults set
8807
- * on individual children Transitions.
8808
- */
8809
- appear: PropTypes.bool,
8810
- /**
8811
- * A convenience prop that enables or disables enter animations
8812
- * for all children. Note that specifying this will override any defaults set
8813
- * on individual children Transitions.
8814
- */
8815
- enter: PropTypes.bool,
8816
- /**
8817
- * A convenience prop that enables or disables exit animations
8818
- * for all children. Note that specifying this will override any defaults set
8819
- * on individual children Transitions.
8820
- */
8821
- exit: PropTypes.bool,
8822
- /**
8823
- * You may need to apply reactive updates to a child as it is exiting.
8824
- * This is generally done by using `cloneElement` however in the case of an exiting
8825
- * child the element has already been removed and not accessible to the consumer.
8826
- *
8827
- * If you do need to update a child as it leaves you can provide a `childFactory`
8828
- * to wrap every child, even the ones that are leaving.
8829
- *
8830
- * @type Function(child: ReactElement) -> ReactElement
8831
- */
8832
- childFactory: PropTypes.func
8833
- };
8834
- TransitionGroup.defaultProps = defaultProps;
8835
8995
  const UNINITIALIZED = {};
8836
8996
  function useLazyRef(init, initArg) {
8837
8997
  const ref = React.useRef(UNINITIALIZED);
@@ -8840,68 +9000,96 @@ function useLazyRef(init, initArg) {
8840
9000
  }
8841
9001
  return ref;
8842
9002
  }
8843
- const EMPTY$1 = [];
8844
- function useOnMount(fn) {
8845
- React.useEffect(fn, EMPTY$1);
8846
- }
8847
- class Timeout {
8848
- static create() {
8849
- return new Timeout();
8850
- }
8851
- currentId = null;
8852
- /**
8853
- * Executes `fn` after `delay`, clearing any previously scheduled call.
8854
- */
8855
- start(delay, fn) {
8856
- this.clear();
8857
- this.currentId = setTimeout(() => {
8858
- this.currentId = null;
8859
- fn();
8860
- }, delay);
8861
- }
8862
- clear = () => {
8863
- if (this.currentId !== null) {
8864
- clearTimeout(this.currentId);
8865
- this.currentId = null;
9003
+ const MEDIA_QUERY = "(prefers-reduced-motion: reduce)";
9004
+ const REDUCED_MOTION_DURATION = 0;
9005
+ const REDUCED_MOTION_DELAY = "0ms";
9006
+ const NOOP$1 = () => {
9007
+ };
9008
+ const getDefaultSnapshot = () => false;
9009
+ const getReducedMotionSnapshot = () => true;
9010
+ const subscribeNoop = () => NOOP$1;
9011
+ function useReducedMotionMediaQueryOld(enabled) {
9012
+ const [queryState, setQueryState] = React.useState(() => ({
9013
+ enabled,
9014
+ matches: enabled ? null : false
9015
+ }));
9016
+ let matches = queryState.matches;
9017
+ if (queryState.enabled !== enabled) {
9018
+ matches = null;
9019
+ if (!enabled) {
9020
+ matches = false;
8866
9021
  }
8867
- };
8868
- disposeEffect = () => {
8869
- return this.clear;
8870
- };
8871
- }
8872
- function useTimeout() {
8873
- const timeout = useLazyRef(Timeout.create).current;
8874
- useOnMount(timeout.disposeEffect);
8875
- return timeout;
8876
- }
8877
- function isClassComponent(elementType) {
8878
- const {
8879
- prototype = {}
8880
- } = elementType;
8881
- return Boolean(prototype.isReactComponent);
8882
- }
8883
- function elementTypeAcceptingRef(props, propName, componentName, location, propFullName) {
8884
- const propValue = props[propName];
8885
- const safePropName = propFullName || propName;
8886
- if (propValue == null || // When server-side rendering React doesn't warn either.
8887
- // This is not an accurate check for SSR.
8888
- // This is only in place for emotion compat.
8889
- // TODO: Revisit once https://github.com/facebook/react/issues/20047 is resolved.
8890
- typeof window === "undefined") {
8891
- return null;
8892
9022
  }
8893
- let warningHint;
8894
- if (typeof propValue === "function" && !isClassComponent(propValue)) {
8895
- warningHint = "Did you accidentally provide a plain function component instead?";
8896
- }
8897
- if (warningHint !== void 0) {
8898
- return new Error(`Invalid ${location} \`${safePropName}\` supplied to \`${componentName}\`. Expected an element type that can hold a ref. ${warningHint} For more information see https://mui.com/r/caveat-with-refs-guide`);
8899
- }
8900
- return null;
9023
+ useEnhancedEffect$1(() => {
9024
+ const setResolvedMatches = (nextMatches) => {
9025
+ setQueryState((previousState) => {
9026
+ if (previousState.enabled === enabled && previousState.matches === nextMatches) {
9027
+ return previousState;
9028
+ }
9029
+ return {
9030
+ enabled,
9031
+ matches: nextMatches
9032
+ };
9033
+ });
9034
+ };
9035
+ if (!enabled) {
9036
+ if (queryState.enabled) {
9037
+ setResolvedMatches(false);
9038
+ }
9039
+ return void 0;
9040
+ }
9041
+ if (typeof window === "undefined" || typeof window.matchMedia !== "function") {
9042
+ setResolvedMatches(false);
9043
+ return void 0;
9044
+ }
9045
+ const mediaQueryList = window.matchMedia(MEDIA_QUERY);
9046
+ const update2 = () => {
9047
+ setResolvedMatches(mediaQueryList.matches);
9048
+ };
9049
+ update2();
9050
+ mediaQueryList.addEventListener("change", update2);
9051
+ return () => {
9052
+ mediaQueryList.removeEventListener("change", update2);
9053
+ };
9054
+ }, [enabled, queryState.enabled]);
9055
+ return matches;
8901
9056
  }
8902
- const elementTypeAcceptingRef$1 = chainPropTypes(PropTypes.elementType, elementTypeAcceptingRef);
8903
- function isHostComponent(element) {
8904
- return typeof element === "string";
9057
+ const safeReact = {
9058
+ ...React
9059
+ };
9060
+ const maybeReactUseSyncExternalStore = safeReact.useSyncExternalStore;
9061
+ function useReducedMotionMediaQueryNew(enabled) {
9062
+ const getServerSnapshot = enabled ? getReducedMotionSnapshot : getDefaultSnapshot;
9063
+ const [getSnapshot, subscribe] = React.useMemo(() => {
9064
+ if (!enabled || typeof window === "undefined" || typeof window.matchMedia !== "function") {
9065
+ return [getDefaultSnapshot, subscribeNoop];
9066
+ }
9067
+ const mediaQueryList = window.matchMedia(MEDIA_QUERY);
9068
+ return [() => mediaQueryList.matches, (notify) => {
9069
+ mediaQueryList.addEventListener("change", notify);
9070
+ return () => {
9071
+ mediaQueryList.removeEventListener("change", notify);
9072
+ };
9073
+ }];
9074
+ }, [enabled]);
9075
+ return maybeReactUseSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
9076
+ }
9077
+ const useReducedMotionMediaQuery = maybeReactUseSyncExternalStore !== void 0 ? useReducedMotionMediaQueryNew : useReducedMotionMediaQueryOld;
9078
+ function useReducedMotion(mode, disablePrefersReducedMotion) {
9079
+ const prefersReducedMotion = useReducedMotionMediaQuery(mode === "system");
9080
+ const shouldReduceMotion = mode === "always" || mode === "system" && prefersReducedMotion !== false;
9081
+ return React.useMemo(() => ({
9082
+ shouldReduceMotion,
9083
+ getTransitionTiming(timing) {
9084
+ if (!shouldReduceMotion) {
9085
+ return timing;
9086
+ }
9087
+ return {
9088
+ duration: REDUCED_MOTION_DURATION,
9089
+ delay: REDUCED_MOTION_DELAY
9090
+ };
9091
+ }
9092
+ }), [shouldReduceMotion]);
8905
9093
  }
8906
9094
  function appendOwnerState(elementType, otherProps, ownerState) {
8907
9095
  if (elementType === void 0 || isHostComponent(elementType)) {
@@ -8921,14 +9109,16 @@ function resolveComponentProps(componentProps, ownerState, slotState) {
8921
9109
  }
8922
9110
  return componentProps;
8923
9111
  }
8924
- function extractEventHandlers(object, excludeKeys = []) {
9112
+ function extractEventHandlers(object) {
8925
9113
  if (object === void 0) {
8926
9114
  return {};
8927
9115
  }
8928
9116
  const result = {};
8929
- Object.keys(object).filter((prop) => prop.match(/^on[A-Z]/) && typeof object[prop] === "function" && !excludeKeys.includes(prop)).forEach((prop) => {
8930
- result[prop] = object[prop];
8931
- });
9117
+ for (const prop of Object.keys(object)) {
9118
+ if (isEventHandler(prop, object[prop])) {
9119
+ result[prop] = object[prop];
9120
+ }
9121
+ }
8932
9122
  return result;
8933
9123
  }
8934
9124
  function omitEventHandlers(object) {
@@ -9053,17 +9243,200 @@ function useSlot(name, parameters) {
9053
9243
  }, ownerState);
9054
9244
  return [elementType, props];
9055
9245
  }
9056
- const refType = PropTypes.oneOfType([PropTypes.func, PropTypes.object]);
9057
9246
  function isFocusVisible(element) {
9058
9247
  try {
9059
9248
  return element.matches(":focus-visible");
9060
9249
  } catch (error) {
9061
- if (!/jsdom/.test(window.navigator.userAgent)) {
9250
+ if (!window.navigator.userAgent.includes("jsdom")) {
9062
9251
  console.warn(["MUI: The `:focus-visible` pseudo class is not supported in this browser.", "Some components rely on this feature to work properly."].join("\n"));
9063
9252
  }
9064
9253
  }
9065
9254
  return false;
9066
9255
  }
9256
+ function useFocusableWhenDisabled(parameters) {
9257
+ const {
9258
+ focusableWhenDisabled,
9259
+ disabled,
9260
+ composite = false,
9261
+ tabIndex: tabIndexProp = 0,
9262
+ isNativeButton
9263
+ } = parameters;
9264
+ const isFocusableComposite = composite && focusableWhenDisabled !== false;
9265
+ const isNonFocusableComposite = composite && focusableWhenDisabled === false;
9266
+ const props = React.useMemo(() => {
9267
+ const additionalProps = {
9268
+ // allow Tabbing away from focusableWhenDisabled elements
9269
+ onKeyDown(event) {
9270
+ if (disabled && focusableWhenDisabled && event.key !== "Tab") {
9271
+ event.preventDefault();
9272
+ }
9273
+ }
9274
+ };
9275
+ if (!composite) {
9276
+ additionalProps.tabIndex = tabIndexProp;
9277
+ if (!isNativeButton && disabled) {
9278
+ additionalProps.tabIndex = focusableWhenDisabled ? tabIndexProp : -1;
9279
+ }
9280
+ }
9281
+ if (isNativeButton && (focusableWhenDisabled || isFocusableComposite) || !isNativeButton && disabled) {
9282
+ additionalProps["aria-disabled"] = disabled;
9283
+ }
9284
+ if (isNativeButton && (!focusableWhenDisabled || isNonFocusableComposite)) {
9285
+ additionalProps.disabled = disabled;
9286
+ }
9287
+ return additionalProps;
9288
+ }, [composite, disabled, focusableWhenDisabled, isFocusableComposite, isNonFocusableComposite, isNativeButton, tabIndexProp]);
9289
+ return props;
9290
+ }
9291
+ const EMPTY$2 = {};
9292
+ function useButtonBase(parameters) {
9293
+ const {
9294
+ nativeButton,
9295
+ nativeButtonProp,
9296
+ internalNativeButton = nativeButton,
9297
+ allowInferredHostMismatch = false,
9298
+ disabled,
9299
+ type,
9300
+ hasFormAction = false,
9301
+ tabIndex = 0,
9302
+ focusableWhenDisabled: focusableWhenDisabledParam,
9303
+ stopEventPropagation = false,
9304
+ onBeforeKeyDown,
9305
+ onBeforeKeyUp
9306
+ } = parameters;
9307
+ const rootRef = React.useRef(null);
9308
+ const focusableWhenDisabled = focusableWhenDisabledParam === true;
9309
+ const focusableWhenDisabledProps = useFocusableWhenDisabled({
9310
+ focusableWhenDisabled,
9311
+ disabled,
9312
+ isNativeButton: nativeButton,
9313
+ tabIndex
9314
+ });
9315
+ {
9316
+ React.useEffect(() => {
9317
+ const root2 = rootRef.current;
9318
+ if (root2 == null) {
9319
+ return;
9320
+ }
9321
+ const isButtonTag = root2.tagName === "BUTTON";
9322
+ if (nativeButtonProp !== void 0) {
9323
+ if (nativeButtonProp && !isButtonTag) {
9324
+ const message = "MUI: A component that acts as a button expected a native <button> because the `nativeButton` prop is true. Rendering a non-<button> removes native button semantics, which can impact forms and accessibility. Render a real <button> or set `nativeButton` to `false`.";
9325
+ console.error(message);
9326
+ }
9327
+ if (!nativeButtonProp && isButtonTag) {
9328
+ const message = "MUI: A component that acts as a button expected a non-<button> because the `nativeButton` prop is false. Rendering a <button> keeps native behavior while additionally applies non-native attributes and handlers, which can add unintended extra attributes (such as `role` or `aria-disabled`). Render a non-<button> such as <div>, or set `nativeButton` to `true`.";
9329
+ console.error(message);
9330
+ }
9331
+ return;
9332
+ }
9333
+ if (allowInferredHostMismatch) {
9334
+ return;
9335
+ }
9336
+ if (internalNativeButton && !isButtonTag) {
9337
+ const message = "MUI: A component rendering a native <button> resolved to a non-<button> element, but `nativeButton={false}` was not specified and the resolved root is a non-<button>. When rendering a custom component, set `nativeButton={false}` explicitly or render a <button> element.";
9338
+ console.error(message);
9339
+ }
9340
+ if (!internalNativeButton && isButtonTag) {
9341
+ const message = "MUI: A component that acts as a non-native button resolved to a native <button> element, but `nativeButton={true}` was not specified. When rendering a custom component, set `nativeButton={true}` explicitly or render a non-<button> element.";
9342
+ console.error(message);
9343
+ }
9344
+ }, [allowInferredHostMismatch, internalNativeButton, nativeButtonProp]);
9345
+ }
9346
+ const hasNativeKeyboardActivation = React.useCallback(() => {
9347
+ const root2 = rootRef.current;
9348
+ if (root2 == null) {
9349
+ return nativeButton;
9350
+ }
9351
+ if (root2.tagName === "BUTTON") {
9352
+ return true;
9353
+ }
9354
+ return Boolean(root2.tagName === "A" && root2.href);
9355
+ }, [nativeButton]);
9356
+ const buttonProps = React.useMemo(() => {
9357
+ const resolvedButtonProps = focusableWhenDisabled ? {} : {
9358
+ tabIndex: disabled ? -1 : tabIndex
9359
+ };
9360
+ if (nativeButton) {
9361
+ resolvedButtonProps.type = type === void 0 && !hasFormAction ? "button" : type;
9362
+ if (!focusableWhenDisabled) {
9363
+ resolvedButtonProps.disabled = disabled;
9364
+ }
9365
+ } else {
9366
+ resolvedButtonProps.role = "button";
9367
+ if (!focusableWhenDisabled && disabled) {
9368
+ resolvedButtonProps["aria-disabled"] = disabled;
9369
+ }
9370
+ }
9371
+ if (focusableWhenDisabled) {
9372
+ return {
9373
+ ...resolvedButtonProps,
9374
+ ...focusableWhenDisabledProps
9375
+ };
9376
+ }
9377
+ return resolvedButtonProps;
9378
+ }, [disabled, focusableWhenDisabled, focusableWhenDisabledProps, hasFormAction, nativeButton, tabIndex, type]);
9379
+ const getButtonProps = React.useCallback((externalProps = EMPTY$2) => {
9380
+ const {
9381
+ onClick: externalOnClick,
9382
+ onKeyDown: externalOnKeyDown,
9383
+ onKeyUp: externalOnKeyUp,
9384
+ ...otherExternalProps
9385
+ } = externalProps;
9386
+ const handleClick = (event) => {
9387
+ if (stopEventPropagation) {
9388
+ event.stopPropagation();
9389
+ }
9390
+ if (disabled) {
9391
+ event.preventDefault();
9392
+ return;
9393
+ }
9394
+ externalOnClick?.(event);
9395
+ };
9396
+ const handleKeyDown = (event) => {
9397
+ if (focusableWhenDisabled) {
9398
+ focusableWhenDisabledProps.onKeyDown(event);
9399
+ }
9400
+ if (disabled) {
9401
+ return;
9402
+ }
9403
+ onBeforeKeyDown?.(event);
9404
+ externalOnKeyDown?.(event);
9405
+ if (event.target !== event.currentTarget || hasNativeKeyboardActivation()) {
9406
+ return;
9407
+ }
9408
+ if (event.key === " ") {
9409
+ event.preventDefault();
9410
+ return;
9411
+ }
9412
+ if (event.key === "Enter") {
9413
+ event.preventDefault();
9414
+ event.currentTarget.click();
9415
+ }
9416
+ };
9417
+ const handleKeyUp = (event) => {
9418
+ if (disabled) {
9419
+ return;
9420
+ }
9421
+ onBeforeKeyUp?.(event);
9422
+ externalOnKeyUp?.(event);
9423
+ if (event.target === event.currentTarget && !hasNativeKeyboardActivation() && event.key === " " && !event.defaultPrevented) {
9424
+ event.currentTarget.click();
9425
+ }
9426
+ };
9427
+ return {
9428
+ ...buttonProps,
9429
+ ...otherExternalProps,
9430
+ onClick: handleClick,
9431
+ onKeyDown: handleKeyDown,
9432
+ onKeyUp: handleKeyUp
9433
+ };
9434
+ }, [buttonProps, disabled, focusableWhenDisabled, focusableWhenDisabledProps, hasNativeKeyboardActivation, onBeforeKeyDown, onBeforeKeyUp, stopEventPropagation]);
9435
+ return {
9436
+ getButtonProps,
9437
+ rootRef
9438
+ };
9439
+ }
9067
9440
  class LazyRipple {
9068
9441
  /** React ref to the ripple instance */
9069
9442
  /** If the ripple component should be mounted */
@@ -9131,6 +9504,40 @@ function createControlledPromise() {
9131
9504
  p.reject = reject;
9132
9505
  return p;
9133
9506
  }
9507
+ const EMPTY$1 = [];
9508
+ function useOnMount(fn) {
9509
+ React.useEffect(fn, EMPTY$1);
9510
+ }
9511
+ class Timeout {
9512
+ static create() {
9513
+ return new Timeout();
9514
+ }
9515
+ currentId = null;
9516
+ /**
9517
+ * Executes `fn` after `delay`, clearing any previously scheduled call.
9518
+ */
9519
+ start(delay, fn) {
9520
+ this.clear();
9521
+ this.currentId = setTimeout(() => {
9522
+ this.currentId = null;
9523
+ fn();
9524
+ }, delay);
9525
+ }
9526
+ clear = () => {
9527
+ if (this.currentId !== null) {
9528
+ clearTimeout(this.currentId);
9529
+ this.currentId = null;
9530
+ }
9531
+ };
9532
+ disposeEffect = () => {
9533
+ return this.clear;
9534
+ };
9535
+ }
9536
+ function useTimeout() {
9537
+ const timeout = useLazyRef(Timeout.create).current;
9538
+ useOnMount(timeout.disposeEffect);
9539
+ return timeout;
9540
+ }
9134
9541
  function Ripple(props) {
9135
9542
  const {
9136
9543
  className,
@@ -9144,6 +9551,11 @@ function Ripple(props) {
9144
9551
  timeout
9145
9552
  } = props;
9146
9553
  const [leaving, setLeaving] = React.useState(false);
9554
+ const exitTimer = useTimeout();
9555
+ const exitTimerStartedRef = React.useRef(false);
9556
+ const onExitedRef = React.useRef(onExited);
9557
+ onExitedRef.current = onExited;
9558
+ const hasExitedCallback = onExited != null;
9147
9559
  const rippleClassName = clsx$1(className, classes.ripple, classes.rippleVisible, pulsate && classes.ripplePulsate);
9148
9560
  const rippleStyles = {
9149
9561
  width: rippleSize,
@@ -9156,14 +9568,19 @@ function Ripple(props) {
9156
9568
  setLeaving(true);
9157
9569
  }
9158
9570
  React.useEffect(() => {
9159
- if (!inProp && onExited != null) {
9160
- const timeoutId = setTimeout(onExited, timeout);
9161
- return () => {
9162
- clearTimeout(timeoutId);
9163
- };
9571
+ if (!inProp && hasExitedCallback) {
9572
+ if (!exitTimerStartedRef.current) {
9573
+ exitTimerStartedRef.current = true;
9574
+ exitTimer.start(timeout, () => {
9575
+ exitTimerStartedRef.current = false;
9576
+ onExitedRef.current?.();
9577
+ });
9578
+ }
9579
+ } else {
9580
+ exitTimerStartedRef.current = false;
9581
+ exitTimer.clear();
9164
9582
  }
9165
- return void 0;
9166
- }, [onExited, inProp, timeout]);
9583
+ }, [exitTimer, hasExitedCallback, inProp, timeout]);
9167
9584
  return /* @__PURE__ */ jsx$1("span", {
9168
9585
  className: rippleClassName,
9169
9586
  style: rippleStyles,
@@ -9179,11 +9596,11 @@ Ripple.propTypes = {
9179
9596
  classes: PropTypes.object.isRequired,
9180
9597
  className: PropTypes.string,
9181
9598
  /**
9182
- * @ignore - injected from TransitionGroup
9599
+ * @ignore - controlled by TouchRipple
9183
9600
  */
9184
9601
  in: PropTypes.bool,
9185
9602
  /**
9186
- * @ignore - injected from TransitionGroup
9603
+ * @ignore - controlled by TouchRipple
9187
9604
  */
9188
9605
  onExited: PropTypes.func,
9189
9606
  /**
@@ -9203,13 +9620,83 @@ Ripple.propTypes = {
9203
9620
  */
9204
9621
  rippleY: PropTypes.number,
9205
9622
  /**
9206
- * exit delay
9623
+ * Exit delay.
9207
9624
  */
9208
9625
  timeout: PropTypes.number.isRequired
9209
9626
  };
9210
9627
  const touchRippleClasses = generateUtilityClasses("MuiTouchRipple", ["root", "ripple", "rippleVisible", "ripplePulsate", "child", "childLeaving", "childPulsate"]);
9211
9628
  const DURATION = 550;
9212
9629
  const DELAY_RIPPLE = 80;
9630
+ const EMPTY_OBJ = {};
9631
+ const EMPTY_ARRAY = [];
9632
+ const NOOP = () => {
9633
+ };
9634
+ function mergeRippleOrder(prevOrder, nextActiveKeys) {
9635
+ const nextKeySet = new Set(nextActiveKeys);
9636
+ const nextKeysPending = /* @__PURE__ */ new Map();
9637
+ let pendingKeys = [];
9638
+ for (const prevKey of prevOrder) {
9639
+ if (nextKeySet.has(prevKey)) {
9640
+ if (pendingKeys.length > 0) {
9641
+ nextKeysPending.set(prevKey, pendingKeys);
9642
+ pendingKeys = [];
9643
+ }
9644
+ } else {
9645
+ pendingKeys.push(prevKey);
9646
+ }
9647
+ }
9648
+ const nextOrder = [];
9649
+ for (const nextKey of nextActiveKeys) {
9650
+ const pendingBefore = nextKeysPending.get(nextKey);
9651
+ if (pendingBefore) {
9652
+ nextOrder.push(...pendingBefore);
9653
+ }
9654
+ nextOrder.push(nextKey);
9655
+ }
9656
+ nextOrder.push(...pendingKeys);
9657
+ return nextOrder;
9658
+ }
9659
+ function computeRippleState({
9660
+ event,
9661
+ element,
9662
+ center
9663
+ }) {
9664
+ const rect = element ? element.getBoundingClientRect() : {
9665
+ width: 0,
9666
+ height: 0,
9667
+ left: 0,
9668
+ top: 0
9669
+ };
9670
+ let rippleX;
9671
+ let rippleY;
9672
+ if (center || event === void 0 || event.clientX === 0 && event.clientY === 0 || !event.clientX && !event.touches) {
9673
+ rippleX = Math.round(rect.width / 2);
9674
+ rippleY = Math.round(rect.height / 2);
9675
+ } else {
9676
+ const {
9677
+ clientX,
9678
+ clientY
9679
+ } = event.touches && event.touches.length > 0 ? event.touches[0] : event;
9680
+ rippleX = Math.round(clientX - rect.left);
9681
+ rippleY = Math.round(clientY - rect.top);
9682
+ }
9683
+ let rippleSize;
9684
+ if (center) {
9685
+ rippleSize = Math.sqrt((2 * rect.width ** 2 + rect.height ** 2) / 3);
9686
+ if (rippleSize % 2 === 0) {
9687
+ rippleSize += 1;
9688
+ }
9689
+ } else {
9690
+ const sizeX = Math.max(Math.abs((element ? element.clientWidth : 0) - rippleX), rippleX) * 2 + 2;
9691
+ const sizeY = Math.max(Math.abs((element ? element.clientHeight : 0) - rippleY), rippleY) * 2 + 2;
9692
+ rippleSize = Math.sqrt(sizeX ** 2 + sizeY ** 2);
9693
+ }
9694
+ return {
9695
+ rippleX,
9696
+ rippleY,
9697
+ rippleSize
9698
+ };
9699
+ }
9213
9700
  const enterKeyframe = keyframes`
9214
9701
  0% {
9215
9702
  transform: scale(0);
@@ -9242,7 +9729,45 @@ const pulsateKeyframe = keyframes`
9242
9729
  100% {
9243
9730
  transform: scale(1);
9244
9731
  }
9245
- `;
9732
+ `;
9733
+ function getAnimationStyles(theme) {
9734
+ if (theme.motion.reducedMotion === "always") {
9735
+ return null;
9736
+ }
9737
+ const styles = css`
9738
+ &.${touchRippleClasses.rippleVisible} {
9739
+ animation-name: ${enterKeyframe};
9740
+ animation-duration: ${DURATION}ms;
9741
+ animation-timing-function: ${theme.transitions.easing.easeInOut};
9742
+ }
9743
+
9744
+ &.${touchRippleClasses.ripplePulsate} {
9745
+ animation-duration: ${theme.transitions.duration.shorter}ms;
9746
+ }
9747
+
9748
+ & .${touchRippleClasses.childLeaving} {
9749
+ animation-name: ${exitKeyframe};
9750
+ animation-duration: ${DURATION}ms;
9751
+ animation-timing-function: ${theme.transitions.easing.easeInOut};
9752
+ }
9753
+
9754
+ & .${touchRippleClasses.childPulsate} {
9755
+ animation-name: ${pulsateKeyframe};
9756
+ animation-duration: 2500ms;
9757
+ animation-timing-function: ${theme.transitions.easing.easeInOut};
9758
+ animation-iteration-count: infinite;
9759
+ animation-delay: 200ms;
9760
+ }
9761
+ `;
9762
+ if (theme.motion.reducedMotion === "system") {
9763
+ return css`
9764
+ @media (prefers-reduced-motion: no-preference) {
9765
+ ${styles}
9766
+ }
9767
+ `;
9768
+ }
9769
+ return styles;
9770
+ }
9246
9771
  const TouchRippleRoot = styled("span", {
9247
9772
  name: "MuiTouchRipple",
9248
9773
  slot: "Root"
@@ -9267,19 +9792,16 @@ const TouchRippleRipple = styled(Ripple, {
9267
9792
  &.${touchRippleClasses.rippleVisible} {
9268
9793
  opacity: 0.3;
9269
9794
  transform: scale(1);
9270
- animation-name: ${enterKeyframe};
9271
- animation-duration: ${DURATION}ms;
9272
- animation-timing-function: ${({
9273
- theme
9274
- }) => theme.transitions.easing.easeInOut};
9275
- }
9276
-
9277
- &.${touchRippleClasses.ripplePulsate} {
9278
- animation-duration: ${({
9279
- theme
9280
- }) => theme.transitions.duration.shorter}ms;
9281
9795
  }
9282
9796
 
9797
+ /*
9798
+ * Order matters: 'child', 'childLeaving' and 'childPulsate' apply to the same
9799
+ * element with equal specificity, so the later rule wins. 'child' must come
9800
+ * before 'childLeaving' so the leaving 'opacity: 0' takes precedence. A focus
9801
+ * (pulsate) ripple keeps 'pulsateKeyframe' (no opacity animation) on exit, so
9802
+ * it relies on this static 'opacity: 0' to disappear on blur instead of
9803
+ * lingering until removal.
9804
+ */
9283
9805
  & .${touchRippleClasses.child} {
9284
9806
  opacity: 1;
9285
9807
  display: block;
@@ -9291,11 +9813,6 @@ const TouchRippleRipple = styled(Ripple, {
9291
9813
 
9292
9814
  & .${touchRippleClasses.childLeaving} {
9293
9815
  opacity: 0;
9294
- animation-name: ${exitKeyframe};
9295
- animation-duration: ${DURATION}ms;
9296
- animation-timing-function: ${({
9297
- theme
9298
- }) => theme.transitions.easing.easeInOut};
9299
9816
  }
9300
9817
 
9301
9818
  & .${touchRippleClasses.childPulsate} {
@@ -9303,29 +9820,39 @@ const TouchRippleRipple = styled(Ripple, {
9303
9820
  /* @noflip */
9304
9821
  left: 0px;
9305
9822
  top: 0;
9306
- animation-name: ${pulsateKeyframe};
9307
- animation-duration: 2500ms;
9308
- animation-timing-function: ${({
9309
- theme
9310
- }) => theme.transitions.easing.easeInOut};
9311
- animation-iteration-count: infinite;
9312
- animation-delay: 200ms;
9313
9823
  }
9824
+
9825
+ ${({
9826
+ theme
9827
+ }) => getAnimationStyles(theme)}
9314
9828
  `;
9315
9829
  const TouchRipple = /* @__PURE__ */ React.forwardRef(function TouchRipple2(inProps, ref) {
9316
9830
  const props = useDefaultProps({
9317
9831
  props: inProps,
9318
9832
  name: "MuiTouchRipple"
9319
9833
  });
9834
+ const theme = useTheme();
9835
+ const reducedMotion = useReducedMotion(theme.motion.reducedMotion);
9320
9836
  const {
9321
9837
  center: centerProp = false,
9322
- classes = {},
9838
+ classes = EMPTY_OBJ,
9323
9839
  className,
9324
9840
  ...other
9325
9841
  } = props;
9326
- const [ripples, setRipples] = React.useState([]);
9842
+ const [rippleState, setRippleState] = React.useState({
9843
+ items: EMPTY_ARRAY,
9844
+ order: EMPTY_ARRAY
9845
+ });
9846
+ const ripples = rippleState.items;
9327
9847
  const nextKey = React.useRef(0);
9328
9848
  const rippleCallback = React.useRef(null);
9849
+ const mountedRef = React.useRef(false);
9850
+ useOnMount(() => {
9851
+ mountedRef.current = true;
9852
+ return () => {
9853
+ mountedRef.current = false;
9854
+ };
9855
+ });
9329
9856
  React.useEffect(() => {
9330
9857
  if (rippleCallback.current) {
9331
9858
  rippleCallback.current();
@@ -9335,8 +9862,21 @@ const TouchRipple = /* @__PURE__ */ React.forwardRef(function TouchRipple2(inPro
9335
9862
  const ignoringMouseDown = React.useRef(false);
9336
9863
  const startTimer = useTimeout();
9337
9864
  const startTimerCommit = React.useRef(null);
9338
- const container = React.useRef(null);
9339
- const startCommit = React.useCallback((params) => {
9865
+ const container2 = React.useRef(null);
9866
+ const handleExited = useEventCallback((key) => {
9867
+ if (!mountedRef.current) {
9868
+ return;
9869
+ }
9870
+ setRippleState((prevState) => {
9871
+ const nextItems = prevState.items.filter((ripple) => ripple.key !== key);
9872
+ const nextOrder = mergeRippleOrder(prevState.order.filter((rippleKey) => rippleKey !== key), nextItems.filter((ripple) => !ripple.exiting).map((ripple) => ripple.key));
9873
+ return {
9874
+ items: nextItems,
9875
+ order: nextOrder
9876
+ };
9877
+ });
9878
+ });
9879
+ const startCommit = useEventCallback((params) => {
9340
9880
  const {
9341
9881
  pulsate: pulsate2,
9342
9882
  rippleX,
@@ -9344,31 +9884,30 @@ const TouchRipple = /* @__PURE__ */ React.forwardRef(function TouchRipple2(inPro
9344
9884
  rippleSize,
9345
9885
  cb
9346
9886
  } = params;
9347
- setRipples((oldRipples) => [...oldRipples, /* @__PURE__ */ jsx$1(TouchRippleRipple, {
9348
- classes: {
9349
- ripple: clsx$1(classes.ripple, touchRippleClasses.ripple),
9350
- rippleVisible: clsx$1(classes.rippleVisible, touchRippleClasses.rippleVisible),
9351
- ripplePulsate: clsx$1(classes.ripplePulsate, touchRippleClasses.ripplePulsate),
9352
- child: clsx$1(classes.child, touchRippleClasses.child),
9353
- childLeaving: clsx$1(classes.childLeaving, touchRippleClasses.childLeaving),
9354
- childPulsate: clsx$1(classes.childPulsate, touchRippleClasses.childPulsate)
9355
- },
9356
- timeout: DURATION,
9357
- pulsate: pulsate2,
9358
- rippleX,
9359
- rippleY,
9360
- rippleSize
9361
- }, nextKey.current)]);
9887
+ const key = nextKey.current;
9362
9888
  nextKey.current += 1;
9889
+ setRippleState((prevState) => {
9890
+ const nextItems = [...prevState.items, {
9891
+ key,
9892
+ pulsate: pulsate2,
9893
+ rippleX,
9894
+ rippleY,
9895
+ rippleSize,
9896
+ exiting: false
9897
+ }];
9898
+ return {
9899
+ items: nextItems,
9900
+ order: mergeRippleOrder(prevState.order, nextItems.filter((ripple) => !ripple.exiting).map((ripple) => ripple.key))
9901
+ };
9902
+ });
9363
9903
  rippleCallback.current = cb;
9364
- }, [classes]);
9365
- const start = React.useCallback((event = {}, options = {}, cb = () => {
9366
- }) => {
9904
+ });
9905
+ const start = useEventCallback((event = EMPTY_OBJ, options = EMPTY_OBJ, cb = NOOP) => {
9367
9906
  const {
9368
9907
  pulsate: pulsate2 = false,
9369
9908
  center = centerProp || options.pulsate,
9370
9909
  fakeElement = false
9371
- // For test purposes
9910
+ // Used only by tests.
9372
9911
  } = options;
9373
9912
  if (event?.type === "mousedown" && ignoringMouseDown.current) {
9374
9913
  ignoringMouseDown.current = false;
@@ -9377,37 +9916,16 @@ const TouchRipple = /* @__PURE__ */ React.forwardRef(function TouchRipple2(inPro
9377
9916
  if (event?.type === "touchstart") {
9378
9917
  ignoringMouseDown.current = true;
9379
9918
  }
9380
- const element = fakeElement ? null : container.current;
9381
- const rect = element ? element.getBoundingClientRect() : {
9382
- width: 0,
9383
- height: 0,
9384
- left: 0,
9385
- top: 0
9386
- };
9387
- let rippleX;
9388
- let rippleY;
9389
- let rippleSize;
9390
- if (center || event === void 0 || event.clientX === 0 && event.clientY === 0 || !event.clientX && !event.touches) {
9391
- rippleX = Math.round(rect.width / 2);
9392
- rippleY = Math.round(rect.height / 2);
9393
- } else {
9394
- const {
9395
- clientX,
9396
- clientY
9397
- } = event.touches && event.touches.length > 0 ? event.touches[0] : event;
9398
- rippleX = Math.round(clientX - rect.left);
9399
- rippleY = Math.round(clientY - rect.top);
9400
- }
9401
- if (center) {
9402
- rippleSize = Math.sqrt((2 * rect.width ** 2 + rect.height ** 2) / 3);
9403
- if (rippleSize % 2 === 0) {
9404
- rippleSize += 1;
9405
- }
9406
- } else {
9407
- const sizeX = Math.max(Math.abs((element ? element.clientWidth : 0) - rippleX), rippleX) * 2 + 2;
9408
- const sizeY = Math.max(Math.abs((element ? element.clientHeight : 0) - rippleY), rippleY) * 2 + 2;
9409
- rippleSize = Math.sqrt(sizeX ** 2 + sizeY ** 2);
9410
- }
9919
+ const element = fakeElement ? null : container2.current;
9920
+ const {
9921
+ rippleX,
9922
+ rippleY,
9923
+ rippleSize
9924
+ } = computeRippleState({
9925
+ event,
9926
+ element,
9927
+ center
9928
+ });
9411
9929
  if (event?.touches) {
9412
9930
  if (startTimerCommit.current === null) {
9413
9931
  startTimerCommit.current = () => {
@@ -9435,13 +9953,13 @@ const TouchRipple = /* @__PURE__ */ React.forwardRef(function TouchRipple2(inPro
9435
9953
  cb
9436
9954
  });
9437
9955
  }
9438
- }, [centerProp, startCommit, startTimer]);
9439
- const pulsate = React.useCallback(() => {
9440
- start({}, {
9956
+ });
9957
+ const pulsate = useEventCallback(() => {
9958
+ start(EMPTY_OBJ, {
9441
9959
  pulsate: true
9442
9960
  });
9443
- }, [start]);
9444
- const stop = React.useCallback((event, cb) => {
9961
+ });
9962
+ const stop = useEventCallback((event, cb) => {
9445
9963
  startTimer.clear();
9446
9964
  if (event?.type === "touchend" && startTimerCommit.current) {
9447
9965
  startTimerCommit.current();
@@ -9452,28 +9970,51 @@ const TouchRipple = /* @__PURE__ */ React.forwardRef(function TouchRipple2(inPro
9452
9970
  return;
9453
9971
  }
9454
9972
  startTimerCommit.current = null;
9455
- setRipples((oldRipples) => {
9456
- if (oldRipples.length > 0) {
9457
- return oldRipples.slice(1);
9458
- }
9459
- return oldRipples;
9973
+ setRippleState((prevState) => {
9974
+ const firstActiveIndex = prevState.items.findIndex((ripple) => !ripple.exiting);
9975
+ if (firstActiveIndex === -1) {
9976
+ return prevState;
9977
+ }
9978
+ const nextItems = prevState.items.slice();
9979
+ nextItems[firstActiveIndex] = {
9980
+ ...nextItems[firstActiveIndex],
9981
+ exiting: true
9982
+ };
9983
+ return {
9984
+ items: nextItems,
9985
+ order: mergeRippleOrder(prevState.order, nextItems.filter((ripple) => !ripple.exiting).map((ripple) => ripple.key))
9986
+ };
9460
9987
  });
9461
9988
  rippleCallback.current = cb;
9462
- }, [startTimer]);
9989
+ });
9463
9990
  React.useImperativeHandle(ref, () => ({
9464
9991
  pulsate,
9465
9992
  start,
9466
9993
  stop
9467
9994
  }), [pulsate, start, stop]);
9995
+ const rippleByKey = new Map(ripples.map((ripple) => [ripple.key, ripple]));
9996
+ const orderedRipples = rippleState.order.map((rippleKey) => rippleByKey.get(rippleKey)).filter(Boolean);
9468
9997
  return /* @__PURE__ */ jsx$1(TouchRippleRoot, {
9469
9998
  className: clsx$1(touchRippleClasses.root, classes.root, className),
9470
- ref: container,
9999
+ ref: container2,
9471
10000
  ...other,
9472
- children: /* @__PURE__ */ jsx$1(TransitionGroup, {
9473
- component: null,
9474
- exit: true,
9475
- children: ripples
9476
- })
10001
+ children: orderedRipples.map((ripple) => /* @__PURE__ */ jsx$1(TouchRippleRipple, {
10002
+ classes: {
10003
+ ripple: clsx$1(classes.ripple, touchRippleClasses.ripple),
10004
+ rippleVisible: clsx$1(classes.rippleVisible, touchRippleClasses.rippleVisible),
10005
+ ripplePulsate: clsx$1(classes.ripplePulsate, touchRippleClasses.ripplePulsate),
10006
+ child: clsx$1(classes.child, touchRippleClasses.child),
10007
+ childLeaving: clsx$1(classes.childLeaving, touchRippleClasses.childLeaving),
10008
+ childPulsate: clsx$1(classes.childPulsate, touchRippleClasses.childPulsate)
10009
+ },
10010
+ timeout: reducedMotion.shouldReduceMotion ? 0 : DURATION,
10011
+ pulsate: ripple.pulsate,
10012
+ rippleX: ripple.rippleX,
10013
+ rippleY: ripple.rippleY,
10014
+ rippleSize: ripple.rippleSize,
10015
+ in: !ripple.exiting,
10016
+ onExited: () => handleExited(ripple.key)
10017
+ }, ripple.key))
9477
10018
  });
9478
10019
  });
9479
10020
  TouchRipple.propTypes = {
@@ -9500,13 +10041,14 @@ const useUtilityClasses$5 = (ownerState) => {
9500
10041
  disabled,
9501
10042
  focusVisible,
9502
10043
  focusVisibleClassName,
10044
+ suppressFocusVisible,
9503
10045
  classes
9504
10046
  } = ownerState;
9505
10047
  const slots = {
9506
- root: ["root", disabled && "disabled", focusVisible && "focusVisible"]
10048
+ root: ["root", disabled && "disabled", focusVisible && !suppressFocusVisible && "focusVisible"]
9507
10049
  };
9508
10050
  const composedClasses = composeClasses(slots, getButtonBaseUtilityClass, classes);
9509
- if (focusVisible && focusVisibleClassName) {
10051
+ if (focusVisible && !suppressFocusVisible && focusVisibleClassName) {
9510
10052
  composedClasses.root += ` ${focusVisibleClassName}`;
9511
10053
  }
9512
10054
  return composedClasses;
@@ -9514,7 +10056,9 @@ const useUtilityClasses$5 = (ownerState) => {
9514
10056
  const ButtonBaseRoot = styled("button", {
9515
10057
  name: "MuiButtonBase",
9516
10058
  slot: "Root"
9517
- })({
10059
+ })(memoTheme(({
10060
+ theme
10061
+ }) => ({
9518
10062
  display: "inline-flex",
9519
10063
  alignItems: "center",
9520
10064
  justifyContent: "center",
@@ -9552,8 +10096,17 @@ const ButtonBaseRoot = styled("button", {
9552
10096
  },
9553
10097
  "@media print": {
9554
10098
  colorAdjust: "exact"
9555
- }
9556
- });
10099
+ },
10100
+ variants: [{
10101
+ props: {
10102
+ internalDisabledThemeFocusVisible: false
10103
+ },
10104
+ style: theme.focusVisible && {
10105
+ ...outsetFocusRing,
10106
+ [`&.${buttonBaseClasses.focusVisible}`]: theme.focusVisible
10107
+ }
10108
+ }]
10109
+ })));
9557
10110
  const ButtonBase = /* @__PURE__ */ React.forwardRef(function ButtonBase2(inProps, ref) {
9558
10111
  const props = useDefaultProps({
9559
10112
  props: inProps,
@@ -9570,15 +10123,27 @@ const ButtonBase = /* @__PURE__ */ React.forwardRef(function ButtonBase2(inProps
9570
10123
  disableTouchRipple = false,
9571
10124
  focusRipple = false,
9572
10125
  focusVisibleClassName,
10126
+ /* eslint-disable react/prop-types */
10127
+ // replaces internal handling in Chip, other components can opt-in individually to use this in the future
10128
+ focusableWhenDisabled,
10129
+ // escape hatch to suppress the focusVisible state and callback
10130
+ // used by anchored <Menu>s to to suppress focus visible styling when opened with a pointer
10131
+ suppressFocusVisible = false,
10132
+ // private prop to allow native vs non-native button props to be resolved before mount
10133
+ internalNativeButton: internalNativeButtonProp,
10134
+ // private prop to let a parent (like SwitchBase) control its own focus visible style
10135
+ internalDisabledThemeFocusVisible = false,
10136
+ /* eslint-enable react/prop-types */
9573
10137
  LinkComponent = "a",
10138
+ nativeButton: nativeButtonProp,
9574
10139
  onBlur,
9575
- onClick,
10140
+ onClick: onClickProp,
9576
10141
  onContextMenu,
9577
10142
  onDragLeave,
9578
10143
  onFocus,
9579
10144
  onFocusVisible,
9580
- onKeyDown,
9581
- onKeyUp,
10145
+ onKeyDown: onKeyDownProp,
10146
+ onKeyUp: onKeyUpProp,
9582
10147
  onMouseDown,
9583
10148
  onMouseLeave,
9584
10149
  onMouseUp,
@@ -9591,19 +10156,65 @@ const ButtonBase = /* @__PURE__ */ React.forwardRef(function ButtonBase2(inProps
9591
10156
  type,
9592
10157
  ...other
9593
10158
  } = props;
9594
- const buttonRef = React.useRef(null);
10159
+ const isLink = Boolean(other.href || other.to);
10160
+ const hasFormAction = Boolean(other.formAction);
10161
+ let ComponentProp = component;
10162
+ if (ComponentProp === "button" && isLink) {
10163
+ ComponentProp = LinkComponent;
10164
+ }
10165
+ const internalNativeButton = typeof ComponentProp === "string" ? ComponentProp === "button" : internalNativeButtonProp ?? false;
10166
+ const nativeButton = nativeButtonProp ?? internalNativeButton;
9595
10167
  const ripple = useLazyRipple();
9596
10168
  const handleRippleRef = useForkRef$1(ripple.ref, touchRippleRef);
9597
10169
  const [focusVisible, setFocusVisible] = React.useState(false);
9598
- if (disabled && focusVisible) {
10170
+ if ((disabled || suppressFocusVisible) && focusVisible) {
9599
10171
  setFocusVisible(false);
9600
10172
  }
10173
+ const handleBeforeKeyDown = useEventCallback((event) => {
10174
+ if (focusRipple && !event.repeat && focusVisible && event.key === " ") {
10175
+ ripple.stop(event, () => {
10176
+ ripple.start(event);
10177
+ });
10178
+ }
10179
+ });
10180
+ const handleBeforeKeyUp = useEventCallback((event) => {
10181
+ if (focusRipple && event.key === " " && focusVisible && !event.defaultPrevented) {
10182
+ ripple.stop(event, () => {
10183
+ ripple.pulsate(event);
10184
+ });
10185
+ }
10186
+ });
10187
+ const {
10188
+ getButtonProps,
10189
+ rootRef: buttonRef
10190
+ } = useButtonBase({
10191
+ nativeButton,
10192
+ nativeButtonProp,
10193
+ internalNativeButton,
10194
+ allowInferredHostMismatch: isLink || typeof ComponentProp === "string",
10195
+ disabled,
10196
+ type,
10197
+ hasFormAction,
10198
+ tabIndex,
10199
+ onBeforeKeyDown: handleBeforeKeyDown,
10200
+ onBeforeKeyUp: handleBeforeKeyUp
10201
+ });
10202
+ const {
10203
+ onClick,
10204
+ onKeyDown,
10205
+ onKeyUp,
10206
+ ...buttonProps
10207
+ } = getButtonProps({
10208
+ onClick: onClickProp,
10209
+ onKeyDown: onKeyDownProp,
10210
+ onKeyUp: onKeyUpProp
10211
+ });
9601
10212
  React.useImperativeHandle(action, () => ({
9602
10213
  focusVisible: () => {
9603
10214
  setFocusVisible(true);
9604
10215
  buttonRef.current.focus();
9605
10216
  }
9606
- }), []);
10217
+ }), [buttonRef]);
9607
10218
  const enableTouchRipple = ripple.shouldMount && !disableRipple && !disabled;
9608
10219
  React.useEffect(() => {
9609
10220
  if (focusVisible && focusRipple && !disableRipple) {
@@ -9637,7 +10248,7 @@ const ButtonBase = /* @__PURE__ */ React.forwardRef(function ButtonBase2(inProps
9637
10248
  if (!buttonRef.current) {
9638
10249
  buttonRef.current = event.currentTarget;
9639
10250
  }
9640
- if (isFocusVisible(event.target)) {
10251
+ if (!suppressFocusVisible && isFocusVisible(event.target)) {
9641
10252
  setFocusVisible(true);
9642
10253
  if (onFocusVisible) {
9643
10254
  onFocusVisible(event);
@@ -9647,57 +10258,13 @@ const ButtonBase = /* @__PURE__ */ React.forwardRef(function ButtonBase2(inProps
9647
10258
  onFocus(event);
9648
10259
  }
9649
10260
  });
9650
- const isNonNativeButton = () => {
9651
- const button = buttonRef.current;
9652
- return component && component !== "button" && !(button.tagName === "A" && button.href);
9653
- };
9654
- const handleKeyDown = useEventCallback((event) => {
9655
- if (focusRipple && !event.repeat && focusVisible && event.key === " ") {
9656
- ripple.stop(event, () => {
9657
- ripple.start(event);
9658
- });
9659
- }
9660
- if (event.target === event.currentTarget && isNonNativeButton() && event.key === " ") {
9661
- event.preventDefault();
9662
- }
9663
- if (onKeyDown) {
9664
- onKeyDown(event);
9665
- }
9666
- if (event.target === event.currentTarget && isNonNativeButton() && event.key === "Enter" && !disabled) {
9667
- event.preventDefault();
9668
- if (onClick) {
9669
- onClick(event);
9670
- }
9671
- }
9672
- });
9673
- const handleKeyUp = useEventCallback((event) => {
9674
- if (focusRipple && event.key === " " && focusVisible && !event.defaultPrevented) {
9675
- ripple.stop(event, () => {
9676
- ripple.pulsate(event);
9677
- });
9678
- }
9679
- if (onKeyUp) {
9680
- onKeyUp(event);
9681
- }
9682
- if (onClick && event.target === event.currentTarget && isNonNativeButton() && event.key === " " && !event.defaultPrevented) {
9683
- onClick(event);
9684
- }
9685
- });
9686
- let ComponentProp = component;
9687
- if (ComponentProp === "button" && (other.href || other.to)) {
9688
- ComponentProp = LinkComponent;
9689
- }
9690
- const buttonProps = {};
9691
- if (ComponentProp === "button") {
9692
- buttonProps.type = type === void 0 ? "button" : type;
9693
- buttonProps.disabled = disabled;
9694
- } else {
9695
- if (!other.href && !other.to) {
9696
- buttonProps.role = "button";
9697
- }
10261
+ const linkProps = {};
10262
+ if (isLink) {
10263
+ linkProps.tabIndex = disabled ? -1 : tabIndex;
9698
10264
  if (disabled) {
9699
- buttonProps["aria-disabled"] = disabled;
10265
+ linkProps["aria-disabled"] = disabled;
9700
10266
  }
10267
+ linkProps.type = type;
9701
10268
  }
9702
10269
  const handleRef = useForkRef$1(ref, buttonRef);
9703
10270
  const ownerState = {
@@ -9708,8 +10275,10 @@ const ButtonBase = /* @__PURE__ */ React.forwardRef(function ButtonBase2(inProps
9708
10275
  disableRipple,
9709
10276
  disableTouchRipple,
9710
10277
  focusRipple,
10278
+ suppressFocusVisible,
9711
10279
  tabIndex,
9712
- focusVisible
10280
+ focusVisible,
10281
+ internalDisabledThemeFocusVisible
9713
10282
  };
9714
10283
  const classes = useUtilityClasses$5(ownerState);
9715
10284
  return /* @__PURE__ */ jsxs(ButtonBaseRoot, {
@@ -9720,8 +10289,8 @@ const ButtonBase = /* @__PURE__ */ React.forwardRef(function ButtonBase2(inProps
9720
10289
  onClick,
9721
10290
  onContextMenu: handleContextMenu,
9722
10291
  onFocus: handleFocus,
9723
- onKeyDown: handleKeyDown,
9724
- onKeyUp: handleKeyUp,
10292
+ onKeyDown,
10293
+ onKeyUp,
9725
10294
  onMouseDown: handleMouseDown,
9726
10295
  onMouseLeave: handleMouseLeave,
9727
10296
  onMouseUp: handleMouseUp,
@@ -9730,9 +10299,7 @@ const ButtonBase = /* @__PURE__ */ React.forwardRef(function ButtonBase2(inProps
9730
10299
  onTouchMove: handleTouchMove,
9731
10300
  onTouchStart: handleTouchStart,
9732
10301
  ref: handleRef,
9733
- tabIndex: disabled ? -1 : tabIndex,
9734
- type,
9735
- ...buttonProps,
10302
+ ...isLink ? linkProps : buttonProps,
9736
10303
  ...other,
9737
10304
  children: [children2, enableTouchRipple ? /* @__PURE__ */ jsx$1(TouchRipple, {
9738
10305
  ref: handleRippleRef,
@@ -9817,6 +10384,10 @@ ButtonBase.propTypes = {
9817
10384
  * if needed.
9818
10385
  */
9819
10386
  focusVisibleClassName: PropTypes.string,
10387
+ /**
10388
+ * @ignore
10389
+ */
10390
+ formAction: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
9820
10391
  /**
9821
10392
  * @ignore
9822
10393
  */
@@ -9826,6 +10397,11 @@ ButtonBase.propTypes = {
9826
10397
  * @default 'a'
9827
10398
  */
9828
10399
  LinkComponent: PropTypes.elementType,
10400
+ /**
10401
+ * Whether the custom component is expected to render a native `<button>` element
10402
+ * when passing a React component to the `component` or `slots` prop.
10403
+ */
10404
+ nativeButton: PropTypes.bool,
9829
10405
  /**
9830
10406
  * @ignore
9831
10407
  */
@@ -9906,9 +10482,12 @@ ButtonBase.propTypes = {
9906
10482
  })
9907
10483
  })]),
9908
10484
  /**
9909
- * @ignore
10485
+ * The HTML [`type`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/button#type)
10486
+ * attribute applied to `button` and `a` elements.
10487
+ * Ignored when rendering non-native buttons.
10488
+ * @default 'button'
9910
10489
  */
9911
- type: PropTypes.oneOfType([PropTypes.oneOf(["button", "reset", "submit"]), PropTypes.string])
10490
+ type: PropTypes.string
9912
10491
  };
9913
10492
  function hasCorrectMainProperty(obj) {
9914
10493
  return typeof obj.main === "string";
@@ -9944,22 +10523,22 @@ function getReactElementRef(element) {
9944
10523
  }
9945
10524
  return element?.ref || null;
9946
10525
  }
9947
- function getContainer(container) {
9948
- return typeof container === "function" ? container() : container;
10526
+ function getContainer(container2) {
10527
+ return typeof container2 === "function" ? container2() : container2;
9949
10528
  }
9950
10529
  const Portal = /* @__PURE__ */ React.forwardRef(function Portal2(props, forwardedRef) {
9951
10530
  const {
9952
10531
  children: children2,
9953
- container,
10532
+ container: container2,
9954
10533
  disablePortal = false
9955
10534
  } = props;
9956
10535
  const [mountNode, setMountNode] = React.useState(null);
9957
10536
  const handleRef = useForkRef$1(/* @__PURE__ */ React.isValidElement(children2) ? getReactElementRef(children2) : null, forwardedRef);
9958
10537
  useEnhancedEffect$1(() => {
9959
10538
  if (!disablePortal) {
9960
- setMountNode(getContainer(container) || document.body);
10539
+ setMountNode(getContainer(container2) || document.body);
9961
10540
  }
9962
- }, [container, disablePortal]);
10541
+ }, [container2, disablePortal]);
9963
10542
  useEnhancedEffect$1(() => {
9964
10543
  if (mountNode && !disablePortal) {
9965
10544
  setRef$1(forwardedRef, mountNode);
@@ -10009,13 +10588,6 @@ Portal.propTypes = {
10009
10588
  {
10010
10589
  Portal["propTypes"] = exactProp(Portal.propTypes);
10011
10590
  }
10012
- const FormControlContext = /* @__PURE__ */ React.createContext(void 0);
10013
- {
10014
- FormControlContext.displayName = "FormControlContext";
10015
- }
10016
- function useFormControl() {
10017
- return React.useContext(FormControlContext);
10018
- }
10019
10591
  function getSwitchBaseUtilityClass(slot) {
10020
10592
  return generateUtilityClass("PrivateSwitchBase", slot);
10021
10593
  }
@@ -10033,7 +10605,9 @@ const useUtilityClasses$4 = (ownerState) => {
10033
10605
  };
10034
10606
  return composeClasses(slots, getSwitchBaseUtilityClass, classes);
10035
10607
  };
10036
- const SwitchBaseRoot = styled(ButtonBase)({
10608
+ const SwitchBaseRoot = styled(ButtonBase, {
10609
+ name: "MuiSwitchBase"
10610
+ })({
10037
10611
  padding: 9,
10038
10612
  borderRadius: "50%",
10039
10613
  variants: [{
@@ -10071,6 +10645,7 @@ const SwitchBaseRoot = styled(ButtonBase)({
10071
10645
  }]
10072
10646
  });
10073
10647
  const SwitchBaseInput = styled("input", {
10648
+ name: "MuiSwitchBase",
10074
10649
  shouldForwardProp: rootShouldForwardProp
10075
10650
  })({
10076
10651
  cursor: "inherit",
@@ -10095,8 +10670,6 @@ const SwitchBase = /* @__PURE__ */ React.forwardRef(function SwitchBase2(props,
10095
10670
  edge = false,
10096
10671
  icon,
10097
10672
  id,
10098
- inputProps,
10099
- inputRef,
10100
10673
  name,
10101
10674
  onBlur,
10102
10675
  onChange,
@@ -10110,6 +10683,10 @@ const SwitchBase = /* @__PURE__ */ React.forwardRef(function SwitchBase2(props,
10110
10683
  slotProps = {},
10111
10684
  ...other
10112
10685
  } = props;
10686
+ const {
10687
+ nativeButton,
10688
+ ...buttonBaseProps
10689
+ } = other;
10113
10690
  const [checked, setCheckedState] = useControlled({
10114
10691
  controlled: checkedProp,
10115
10692
  default: Boolean(defaultChecked),
@@ -10134,7 +10711,7 @@ const SwitchBase = /* @__PURE__ */ React.forwardRef(function SwitchBase2(props,
10134
10711
  }
10135
10712
  };
10136
10713
  const handleInputChange = (event) => {
10137
- if (event.nativeEvent.defaultPrevented) {
10714
+ if (event.nativeEvent.defaultPrevented || readOnly) {
10138
10715
  return;
10139
10716
  }
10140
10717
  const newChecked = event.target.checked;
@@ -10160,10 +10737,7 @@ const SwitchBase = /* @__PURE__ */ React.forwardRef(function SwitchBase2(props,
10160
10737
  const classes = useUtilityClasses$4(ownerState);
10161
10738
  const externalForwardedProps = {
10162
10739
  slots,
10163
- slotProps: {
10164
- input: inputProps,
10165
- ...slotProps
10166
- }
10740
+ slotProps
10167
10741
  };
10168
10742
  const [RootSlot, rootSlotProps] = useSlot("root", {
10169
10743
  ref,
@@ -10173,7 +10747,7 @@ const SwitchBase = /* @__PURE__ */ React.forwardRef(function SwitchBase2(props,
10173
10747
  externalForwardedProps: {
10174
10748
  ...externalForwardedProps,
10175
10749
  component: "span",
10176
- ...other
10750
+ ...buttonBaseProps
10177
10751
  },
10178
10752
  getSlotProps: (handlers) => ({
10179
10753
  ...handlers,
@@ -10190,13 +10764,12 @@ const SwitchBase = /* @__PURE__ */ React.forwardRef(function SwitchBase2(props,
10190
10764
  additionalProps: {
10191
10765
  centerRipple: true,
10192
10766
  focusRipple: !disableFocusRipple,
10193
- disabled,
10194
10767
  role: void 0,
10195
- tabIndex: null
10768
+ tabIndex: null,
10769
+ internalDisabledThemeFocusVisible: true
10196
10770
  }
10197
10771
  });
10198
10772
  const [InputSlot, inputSlotProps] = useSlot("input", {
10199
- ref: inputRef,
10200
10773
  elementType: SwitchBaseInput,
10201
10774
  className: classes.input,
10202
10775
  externalForwardedProps,
@@ -10281,14 +10854,6 @@ SwitchBase.propTypes = {
10281
10854
  * The id of the `input` element.
10282
10855
  */
10283
10856
  id: PropTypes.string,
10284
- /**
10285
- * [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#attributes) applied to the `input` element.
10286
- */
10287
- inputProps: PropTypes.object,
10288
- /**
10289
- * Pass a ref to the `input` element.
10290
- */
10291
- inputRef: refType,
10292
10857
  /*
10293
10858
  * @ignore
10294
10859
  */
@@ -10359,10 +10924,6 @@ const CheckBoxIcon = createSvgIcon(/* @__PURE__ */ jsx$1("path", {
10359
10924
  const IndeterminateCheckBoxIcon = createSvgIcon(/* @__PURE__ */ jsx$1("path", {
10360
10925
  d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10H7v-2h10v2z"
10361
10926
  }), "IndeterminateCheckBox");
10362
- function getCheckboxUtilityClass(slot) {
10363
- return generateUtilityClass("MuiCheckbox", slot);
10364
- }
10365
- const checkboxClasses = generateUtilityClasses("MuiCheckbox", ["root", "checked", "disabled", "indeterminate", "colorPrimary", "colorSecondary", "sizeSmall", "sizeMedium"]);
10366
10927
  const useUtilityClasses$3 = (ownerState) => {
10367
10928
  const {
10368
10929
  classes,
@@ -10394,6 +10955,13 @@ const CheckboxRoot = styled(SwitchBase, {
10394
10955
  theme
10395
10956
  }) => ({
10396
10957
  color: (theme.vars || theme).palette.text.secondary,
10958
+ ...theme.focusVisible && {
10959
+ [`&.${buttonBaseClasses.focusVisible} svg:first-of-type`]: {
10960
+ ...outsetFocusRing,
10961
+ borderRadius: (theme.vars || theme).shape.borderRadius,
10962
+ ...theme.focusVisible
10963
+ }
10964
+ },
10397
10965
  variants: [{
10398
10966
  props: {
10399
10967
  color: "default",
@@ -10401,7 +10969,7 @@ const CheckboxRoot = styled(SwitchBase, {
10401
10969
  },
10402
10970
  style: {
10403
10971
  "&:hover": {
10404
- backgroundColor: theme.vars ? `rgba(${theme.vars.palette.action.activeChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha(theme.palette.action.active, theme.palette.action.hoverOpacity)
10972
+ backgroundColor: theme.alpha((theme.vars || theme).palette.action.active, (theme.vars || theme).palette.action.hoverOpacity)
10405
10973
  }
10406
10974
  }
10407
10975
  }, ...Object.entries(theme.palette).filter(createSimplePaletteValueFilter()).map(([color2]) => ({
@@ -10411,7 +10979,7 @@ const CheckboxRoot = styled(SwitchBase, {
10411
10979
  },
10412
10980
  style: {
10413
10981
  "&:hover": {
10414
- backgroundColor: theme.vars ? `rgba(${theme.vars.palette[color2].mainChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha(theme.palette[color2].main, theme.palette.action.hoverOpacity)
10982
+ backgroundColor: theme.alpha((theme.vars || theme).palette[color2].main, (theme.vars || theme).palette.action.hoverOpacity)
10415
10983
  }
10416
10984
  }
10417
10985
  })), ...Object.entries(theme.palette).filter(createSimplePaletteValueFilter()).map(([color2]) => ({
@@ -10455,7 +11023,6 @@ const Checkbox = /* @__PURE__ */ React.forwardRef(function Checkbox2(inProps, re
10455
11023
  icon: iconProp = defaultIcon,
10456
11024
  indeterminate = false,
10457
11025
  indeterminateIcon: indeterminateIconProp = defaultIndeterminateIcon,
10458
- inputProps,
10459
11026
  size: size2 = "medium",
10460
11027
  disableRipple = false,
10461
11028
  className,
@@ -10473,7 +11040,7 @@ const Checkbox = /* @__PURE__ */ React.forwardRef(function Checkbox2(inProps, re
10473
11040
  size: size2
10474
11041
  };
10475
11042
  const classes = useUtilityClasses$3(ownerState);
10476
- const externalInputProps = slotProps.input ?? inputProps;
11043
+ const externalInputProps = slotProps.input;
10477
11044
  const [RootSlot, rootSlotProps] = useSlot("root", {
10478
11045
  ref,
10479
11046
  elementType: CheckboxRoot,
@@ -10493,11 +11060,14 @@ const Checkbox = /* @__PURE__ */ React.forwardRef(function Checkbox2(inProps, re
10493
11060
  checkedIcon: /* @__PURE__ */ React.cloneElement(indeterminateIcon, {
10494
11061
  fontSize: indeterminateIcon.props.fontSize ?? size2
10495
11062
  }),
10496
- disableRipple,
11063
+ // Forward the raw prop so an unset value stays `undefined` and ButtonBase resolves its
11064
+ // own default — letting a global `MuiButtonBase.defaultProps.disableRipple` apply here.
11065
+ disableRipple: props.disableRipple,
10497
11066
  slots,
10498
11067
  slotProps: {
10499
11068
  input: mergeSlotProps$1(typeof externalInputProps === "function" ? externalInputProps(ownerState) : externalInputProps, {
10500
- "data-indeterminate": indeterminate
11069
+ "data-indeterminate": indeterminate,
11070
+ "aria-checked": indeterminate ? "mixed" : void 0
10501
11071
  })
10502
11072
  }
10503
11073
  }
@@ -10572,11 +11142,6 @@ Checkbox.propTypes = {
10572
11142
  * @default <IndeterminateCheckBoxIcon />
10573
11143
  */
10574
11144
  indeterminateIcon: PropTypes.node,
10575
- /**
10576
- * [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#attributes) applied to the `input` element.
10577
- * @deprecated Use `slotProps.input` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
10578
- */
10579
- inputProps: PropTypes.object,
10580
11145
  /**
10581
11146
  * Callback fired when the state is changed.
10582
11147
  *
@@ -10624,30 +11189,17 @@ Checkbox.propTypes = {
10624
11189
  function getTypographyUtilityClass(slot) {
10625
11190
  return generateUtilityClass("MuiTypography", slot);
10626
11191
  }
10627
- generateUtilityClasses("MuiTypography", ["root", "h1", "h2", "h3", "h4", "h5", "h6", "subtitle1", "subtitle2", "body1", "body2", "inherit", "button", "caption", "overline", "alignLeft", "alignRight", "alignCenter", "alignJustify", "noWrap", "gutterBottom", "paragraph"]);
10628
- const v6Colors = {
10629
- primary: true,
10630
- secondary: true,
10631
- error: true,
10632
- info: true,
10633
- success: true,
10634
- warning: true,
10635
- textPrimary: true,
10636
- textSecondary: true,
10637
- textDisabled: true
10638
- };
10639
- const extendSxProp = internal_createExtendSxProp();
11192
+ generateUtilityClasses("MuiTypography", ["root", "h1", "h2", "h3", "h4", "h5", "h6", "subtitle1", "subtitle2", "body1", "body2", "inherit", "button", "caption", "overline", "alignLeft", "alignRight", "alignCenter", "alignJustify", "noWrap", "gutterBottom"]);
10640
11193
  const useUtilityClasses$2 = (ownerState) => {
10641
11194
  const {
10642
11195
  align,
10643
11196
  gutterBottom,
10644
11197
  noWrap,
10645
- paragraph,
10646
11198
  variant,
10647
11199
  classes
10648
11200
  } = ownerState;
10649
11201
  const slots = {
10650
- root: ["root", variant, ownerState.align !== "inherit" && `align${capitalize(align)}`, gutterBottom && "gutterBottom", noWrap && "noWrap", paragraph && "paragraph"]
11202
+ root: ["root", variant, ownerState.align !== "inherit" && `align${capitalize(align)}`, gutterBottom && "gutterBottom", noWrap && "noWrap"]
10651
11203
  };
10652
11204
  return composeClasses(slots, getTypographyUtilityClass, classes);
10653
11205
  };
@@ -10658,7 +11210,7 @@ const TypographyRoot = styled("span", {
10658
11210
  const {
10659
11211
  ownerState
10660
11212
  } = props;
10661
- return [styles.root, ownerState.variant && styles[ownerState.variant], ownerState.align !== "inherit" && styles[`align${capitalize(ownerState.align)}`], ownerState.noWrap && styles.noWrap, ownerState.gutterBottom && styles.gutterBottom, ownerState.paragraph && styles.paragraph];
11213
+ return [styles.root, ownerState.variant && styles[ownerState.variant], ownerState.align !== "inherit" && styles[`align${capitalize(ownerState.align)}`], ownerState.noWrap && styles.noWrap, ownerState.gutterBottom && styles.gutterBottom];
10662
11214
  }
10663
11215
  })(memoTheme(({
10664
11216
  theme
@@ -10716,13 +11268,6 @@ const TypographyRoot = styled("span", {
10716
11268
  style: {
10717
11269
  marginBottom: "0.35em"
10718
11270
  }
10719
- }, {
10720
- props: ({
10721
- ownerState
10722
- }) => ownerState.paragraph,
10723
- style: {
10724
- marginBottom: 16
10725
- }
10726
11271
  }]
10727
11272
  })));
10728
11273
  const defaultVariantMapping = {
@@ -10739,27 +11284,17 @@ const defaultVariantMapping = {
10739
11284
  inherit: "p"
10740
11285
  };
10741
11286
  const Typography = /* @__PURE__ */ React.forwardRef(function Typography2(inProps, ref) {
10742
- const {
10743
- color: color2,
10744
- ...themeProps
10745
- } = useDefaultProps({
11287
+ const props = useDefaultProps({
10746
11288
  props: inProps,
10747
11289
  name: "MuiTypography"
10748
11290
  });
10749
- const isSxColor = !v6Colors[color2];
10750
- const props = extendSxProp({
10751
- ...themeProps,
10752
- ...isSxColor && {
10753
- color: color2
10754
- }
10755
- });
10756
11291
  const {
11292
+ color: color2,
10757
11293
  align = "inherit",
10758
11294
  className,
10759
11295
  component,
10760
11296
  gutterBottom = false,
10761
11297
  noWrap = false,
10762
- paragraph = false,
10763
11298
  variant = "body1",
10764
11299
  variantMapping = defaultVariantMapping,
10765
11300
  ...other
@@ -10772,11 +11307,10 @@ const Typography = /* @__PURE__ */ React.forwardRef(function Typography2(inProps
10772
11307
  component,
10773
11308
  gutterBottom,
10774
11309
  noWrap,
10775
- paragraph,
10776
11310
  variant,
10777
11311
  variantMapping
10778
11312
  };
10779
- const Component = component || (paragraph ? "p" : variantMapping[variant] || defaultVariantMapping[variant]) || "span";
11313
+ const Component = component || variantMapping[variant] || defaultVariantMapping[variant] || "span";
10780
11314
  const classes = useUtilityClasses$2(ownerState);
10781
11315
  return /* @__PURE__ */ jsx$1(TypographyRoot, {
10782
11316
  as: Component,
@@ -10838,12 +11372,6 @@ Typography.propTypes = {
10838
11372
  * @default false
10839
11373
  */
10840
11374
  noWrap: PropTypes.bool,
10841
- /**
10842
- * If `true`, the element will be a paragraph element.
10843
- * @default false
10844
- * @deprecated Use the `component` prop instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
10845
- */
10846
- paragraph: PropTypes.bool,
10847
11375
  /**
10848
11376
  * @ignore
10849
11377
  */
@@ -10922,7 +11450,7 @@ const TableCellRoot = styled("td", {
10922
11450
  // Workaround for a rendering bug with spanned columns in Chrome 62.0.
10923
11451
  // Removes the alpha (sets it to 1), and lightens or darkens the theme color.
10924
11452
  borderBottom: theme.vars ? `1px solid ${theme.vars.palette.TableCell.border}` : `1px solid
10925
- ${theme.palette.mode === "light" ? lighten(alpha(theme.palette.divider, 1), 0.88) : darken(alpha(theme.palette.divider, 1), 0.68)}`,
11453
+ ${theme.palette.mode === "light" ? theme.lighten(theme.alpha(theme.palette.divider, 1), 0.88) : theme.darken(theme.alpha(theme.palette.divider, 1), 0.68)}`,
10926
11454
  textAlign: "left",
10927
11455
  padding: 16,
10928
11456
  variants: [{
@@ -11175,9 +11703,9 @@ const TableRowRoot = styled("tr", {
11175
11703
  backgroundColor: (theme.vars || theme).palette.action.hover
11176
11704
  },
11177
11705
  [`&.${tableRowClasses.selected}`]: {
11178
- backgroundColor: theme.vars ? `rgba(${theme.vars.palette.primary.mainChannel} / ${theme.vars.palette.action.selectedOpacity})` : alpha(theme.palette.primary.main, theme.palette.action.selectedOpacity),
11706
+ backgroundColor: theme.alpha((theme.vars || theme).palette.primary.main, (theme.vars || theme).palette.action.selectedOpacity),
11179
11707
  "&:hover": {
11180
- backgroundColor: theme.vars ? `rgba(${theme.vars.palette.primary.mainChannel} / calc(${theme.vars.palette.action.selectedOpacity} + ${theme.vars.palette.action.hoverOpacity}))` : alpha(theme.palette.primary.main, theme.palette.action.selectedOpacity + theme.palette.action.hoverOpacity)
11708
+ backgroundColor: theme.alpha((theme.vars || theme).palette.primary.main, `${(theme.vars || theme).palette.action.selectedOpacity} + ${(theme.vars || theme).palette.action.hoverOpacity}`)
11181
11709
  }
11182
11710
  }
11183
11711
  })));
@@ -11250,28 +11778,6 @@ TableRow.propTypes = {
11250
11778
  */
11251
11779
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
11252
11780
  };
11253
- function _typeof(o) {
11254
- "@babel/helpers - typeof";
11255
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
11256
- return typeof o2;
11257
- } : function(o2) {
11258
- return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
11259
- }, _typeof(o);
11260
- }
11261
- function toPrimitive(t, r2) {
11262
- if ("object" != _typeof(t) || !t) return t;
11263
- var e = t[Symbol.toPrimitive];
11264
- if (void 0 !== e) {
11265
- var i = e.call(t, r2);
11266
- if ("object" != _typeof(i)) return i;
11267
- throw new TypeError("@@toPrimitive must return a primitive value.");
11268
- }
11269
- return ("string" === r2 ? String : Number)(t);
11270
- }
11271
- function toPropertyKey(t) {
11272
- var i = toPrimitive(t, "string");
11273
- return "symbol" == _typeof(i) ? i : i + "";
11274
- }
11275
11781
  /**!
11276
11782
  * @fileOverview Kickass library to create and place poppers near their reference elements.
11277
11783
  * @version 1.16.1
@@ -12867,7 +13373,7 @@ function getAnchorEl(anchorEl) {
12867
13373
  const useEnhancedEffect = typeof window !== "undefined" ? React.useLayoutEffect : React.useEffect;
12868
13374
  const defaultPopperOptions = {};
12869
13375
  React.forwardRef((props, ref) => {
12870
- const { anchorEl, children: children2, container, disablePortal = false, keepMounted = false, modifiers: modifiers2, open, placement: initialPlacement = "bottom", popperOptions = defaultPopperOptions, popperRef: popperRefProp, style: style2, transition = false, ...other } = props;
13376
+ const { anchorEl, children: children2, container: container2, disablePortal = false, keepMounted = false, modifiers: modifiers2, open, placement: initialPlacement = "bottom", popperOptions = defaultPopperOptions, popperRef: popperRefProp, style: style2, transition = false, ...other } = props;
12871
13377
  const tooltipRef = React.useRef(null);
12872
13378
  const ownRef = useForkRef(tooltipRef, ref);
12873
13379
  const popperRef = React.useRef(null);
@@ -12964,7 +13470,7 @@ React.forwardRef((props, ref) => {
12964
13470
  onExited: handleExited
12965
13471
  };
12966
13472
  }
12967
- return jsx$1(Portal, { disablePortal, container, children: jsx$1("div", { ref: handleRef, role: "tooltip", ...other, style: {
13473
+ return jsx$1(Portal, { disablePortal, container: container2, children: jsx$1("div", { ref: handleRef, role: "tooltip", ...other, style: {
12968
13474
  // Prevents scroll issue, waiting for Popper.js to add this style once initiated.
12969
13475
  position: "fixed",
12970
13476
  // Fix Popper.js display issue
@@ -12974,6 +13480,18 @@ React.forwardRef((props, ref) => {
12974
13480
  ...style2
12975
13481
  }, children: typeof children2 === "function" ? children2(childProps) : children2 }) });
12976
13482
  });
13483
+ function _assertThisInitialized(e) {
13484
+ if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
13485
+ return e;
13486
+ }
13487
+ function _setPrototypeOf(t, e) {
13488
+ return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t2, e2) {
13489
+ return t2.__proto__ = e2, t2;
13490
+ }, _setPrototypeOf(t, e);
13491
+ }
13492
+ function _inheritsLoose(t, o) {
13493
+ t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
13494
+ }
12977
13495
  var safeIsNaN = Number.isNaN || function ponyfill(value) {
12978
13496
  return typeof value === "number" && value !== value;
12979
13497
  };
@@ -13021,6 +13539,15 @@ function memoizeOne(resultFn, isEqual2) {
13021
13539
  }
13022
13540
  return memoized;
13023
13541
  }
13542
+ function _objectWithoutPropertiesLoose(r2, e) {
13543
+ if (null == r2) return {};
13544
+ var t = {};
13545
+ for (var n in r2) if ({}.hasOwnProperty.call(r2, n)) {
13546
+ if (-1 !== e.indexOf(n)) continue;
13547
+ t[n] = r2[n];
13548
+ }
13549
+ return t;
13550
+ }
13024
13551
  var hasNativePerformanceNow = typeof performance === "object" && typeof performance.now === "function";
13025
13552
  var now = hasNativePerformanceNow ? function() {
13026
13553
  return performance.now();
@@ -13639,6 +14166,28 @@ React__default.forwardRef((props, ref) => {
13639
14166
  function _classCallCheck(a, n) {
13640
14167
  if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
13641
14168
  }
14169
+ function _typeof(o) {
14170
+ "@babel/helpers - typeof";
14171
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
14172
+ return typeof o2;
14173
+ } : function(o2) {
14174
+ return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
14175
+ }, _typeof(o);
14176
+ }
14177
+ function toPrimitive(t, r2) {
14178
+ if ("object" != _typeof(t) || !t) return t;
14179
+ var e = t[Symbol.toPrimitive];
14180
+ if (void 0 !== e) {
14181
+ var i = e.call(t, r2);
14182
+ if ("object" != _typeof(i)) return i;
14183
+ throw new TypeError("@@toPrimitive must return a primitive value.");
14184
+ }
14185
+ return ("string" === r2 ? String : Number)(t);
14186
+ }
14187
+ function toPropertyKey(t) {
14188
+ var i = toPrimitive(t, "string");
14189
+ return "symbol" == _typeof(i) ? i : i + "";
14190
+ }
13642
14191
  function _defineProperties(e, r2) {
13643
14192
  for (var t = 0; t < r2.length; t++) {
13644
14193
  var o = r2[t];
@@ -19914,8 +20463,8 @@ function getDimensions(scrollElement, props) {
19914
20463
  return getBoundingBox(scrollElement);
19915
20464
  }
19916
20465
  }
19917
- function getPositionOffset(element, container) {
19918
- if (isWindow(container) && document.documentElement) {
20466
+ function getPositionOffset(element, container2) {
20467
+ if (isWindow(container2) && document.documentElement) {
19919
20468
  var containerElement = document.documentElement;
19920
20469
  var elementRect = getBoundingBox(element);
19921
20470
  var containerRect = getBoundingBox(containerElement);
@@ -19924,9 +20473,9 @@ function getPositionOffset(element, container) {
19924
20473
  left: elementRect.left - containerRect.left
19925
20474
  };
19926
20475
  } else {
19927
- var scrollOffset = getScrollOffset(container);
20476
+ var scrollOffset = getScrollOffset(container2);
19928
20477
  var _elementRect = getBoundingBox(element);
19929
- var _containerRect = getBoundingBox(container);
20478
+ var _containerRect = getBoundingBox(container2);
19930
20479
  return {
19931
20480
  top: _elementRect.top + scrollOffset.top - _containerRect.top,
19932
20481
  left: _elementRect.left + scrollOffset.left - _containerRect.left
@@ -21189,6 +21738,7 @@ function SelectableTable(props) {
21189
21738
  selectedIds,
21190
21739
  allowMultiple = false,
21191
21740
  allowUncheck = false,
21741
+ requireShiftForMultiSelect = true,
21192
21742
  showTableHead = true,
21193
21743
  showTableInputs = false,
21194
21744
  testHeight = void 0,
@@ -21197,16 +21747,17 @@ function SelectableTable(props) {
21197
21747
  height: height2
21198
21748
  } = props;
21199
21749
  const [selectedRows, setSelectedRows] = useState(null);
21200
- const [isCheckingMultiple, setIsCheckingMultiple] = useState(false);
21750
+ const [isShiftDown, setIsShiftDown] = useState(false);
21751
+ const isCheckingMultiple = allowMultiple && (isShiftDown || !requireShiftForMultiSelect);
21201
21752
  useEffect(() => {
21202
21753
  function onKeyDown(event) {
21203
21754
  if (allowMultiple && event.keyCode === SHIFT_KEYCODE) {
21204
- setIsCheckingMultiple(true);
21755
+ setIsShiftDown(true);
21205
21756
  }
21206
21757
  }
21207
21758
  function onKeyUp(event) {
21208
21759
  if (allowMultiple && event.keyCode === SHIFT_KEYCODE) {
21209
- setIsCheckingMultiple(false);
21760
+ setIsShiftDown(false);
21210
21761
  }
21211
21762
  }
21212
21763
  window.addEventListener("keydown", onKeyDown);
@@ -21280,7 +21831,8 @@ function SelectableTable(props) {
21280
21831
  role: "button",
21281
21832
  onClick: () => onSelectRow(
21282
21833
  data[index][idKey],
21283
- !isSelected(data[index][idKey]) || !hasColorEncoding
21834
+ // Without shift-to-multi-select, clicking a selected row must be able to deselect it.
21835
+ !isSelected(data[index][idKey]) || !hasColorEncoding && requireShiftForMultiSelect
21284
21836
  )
21285
21837
  },
21286
21838
  /* @__PURE__ */ React__default.createElement("div", { className: clsx(classes.inputContainer, classes.tableCell, { [classes.hiddenInputColumn]: !showTableInputs }) }, /* @__PURE__ */ React__default.createElement("label", { htmlFor: `${inputUuid}_${data[index][idKey]}` }, /* @__PURE__ */ React__default.createElement(
@@ -21348,6 +21900,7 @@ function FeatureList(props) {
21348
21900
  geneFilter = null,
21349
21901
  setGeneSelection,
21350
21902
  enableMultiSelect,
21903
+ requireShiftForMultiSelect,
21351
21904
  showFeatureTable,
21352
21905
  featureListSort,
21353
21906
  featureListSortKey,
@@ -21431,6 +21984,7 @@ function FeatureList(props) {
21431
21984
  onChange,
21432
21985
  allowMultiple: enableMultiSelect,
21433
21986
  allowUncheck: enableMultiSelect,
21987
+ requireShiftForMultiSelect,
21434
21988
  showTableHead: columnLabels.length > 1,
21435
21989
  width: width2,
21436
21990
  height: height2 - 34
@@ -21614,6 +22168,7 @@ function FeatureListSubscriber(props) {
21614
22168
  theme,
21615
22169
  title: titleOverride,
21616
22170
  enableMultiSelect = false,
22171
+ requireShiftForMultiSelect = true,
21617
22172
  showTable = false,
21618
22173
  sort = "alphabetical",
21619
22174
  sortKey = null,
@@ -21740,6 +22295,7 @@ function FeatureListSubscriber(props) {
21740
22295
  setGeneFilter,
21741
22296
  setGeneHighlight,
21742
22297
  enableMultiSelect,
22298
+ requireShiftForMultiSelect,
21743
22299
  hasFeatureLabels,
21744
22300
  primaryColumnName
21745
22301
  }