@vitessce/feature-list 4.0.10 → 4.1.1

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",
@@ -786,6 +788,7 @@ const CoordinationType = {
786
788
  PIXEL_HIGHLIGHT: "pixelHighlight",
787
789
  // Per-image-layer
788
790
  TOOLTIP_CROSSHAIRS_VISIBLE: "tooltipCrosshairsVisible",
791
+ TOOLTIP_OBS_SETS_MODE: "tooltipObsSetsMode",
789
792
  LEGEND_VISIBLE: "legendVisible",
790
793
  SPATIAL_CHANNEL_LABELS_VISIBLE: "spatialChannelLabelsVisible",
791
794
  SPATIAL_CHANNEL_LABELS_ORIENTATION: "spatialChannelLabelsOrientation",
@@ -841,6 +844,8 @@ const COMPONENT_COORDINATION_TYPES = {
841
844
  CoordinationType.SPATIAL_ROTATION_ORBIT,
842
845
  CoordinationType.SPATIAL_ORBIT_AXIS,
843
846
  CoordinationType.SPATIAL_ZOOM,
847
+ CoordinationType.SPATIAL_CAMERA_SNAPSHOT,
848
+ CoordinationType.SPATIAL_RENDERING_MODE,
844
849
  CoordinationType.OBS_FILTER,
845
850
  CoordinationType.OBS_HIGHLIGHT,
846
851
  CoordinationType.OBS_SET_SELECTION,
@@ -866,6 +871,7 @@ const COMPONENT_COORDINATION_TYPES = {
866
871
  CoordinationType.FEATURE_VALUE_COLORMAP_RANGE,
867
872
  CoordinationType.SPATIAL_LAYER_COLOR,
868
873
  CoordinationType.SPATIAL_LAYER_OPACITY,
874
+ CoordinationType.SPATIAL_LAYER_OPACITY_UNSELECTED,
869
875
  CoordinationType.SPATIAL_LAYER_VISIBLE,
870
876
  CoordinationType.SPATIAL_LAYER_LABEL,
871
877
  CoordinationType.SPATIAL_CHANNEL_COLOR,
@@ -907,6 +913,7 @@ const COMPONENT_COORDINATION_TYPES = {
907
913
  CoordinationType.OBS_COLOR_ENCODING,
908
914
  CoordinationType.ADDITIONAL_OBS_SETS,
909
915
  CoordinationType.TOOLTIPS_VISIBLE,
916
+ CoordinationType.TOOLTIP_OBS_SETS_MODE,
910
917
  CoordinationType.SAMPLE_TYPE,
911
918
  CoordinationType.SAMPLE_SET_SELECTION,
912
919
  CoordinationType.SAMPLE_SET_FILTER,
@@ -958,6 +965,7 @@ const COMPONENT_COORDINATION_TYPES = {
958
965
  CoordinationType.OBS_COLOR_ENCODING,
959
966
  CoordinationType.ADDITIONAL_OBS_SETS,
960
967
  CoordinationType.TOOLTIPS_VISIBLE,
968
+ CoordinationType.TOOLTIP_OBS_SETS_MODE,
961
969
  CoordinationType.SAMPLE_TYPE,
962
970
  CoordinationType.SAMPLE_SET_SELECTION,
963
971
  CoordinationType.SAMPLE_SET_FILTER,
@@ -1039,6 +1047,7 @@ const COMPONENT_COORDINATION_TYPES = {
1039
1047
  CoordinationType.ADDITIONAL_OBS_SETS,
1040
1048
  CoordinationType.MOLECULE_HIGHLIGHT,
1041
1049
  CoordinationType.TOOLTIPS_VISIBLE,
1050
+ CoordinationType.TOOLTIP_OBS_SETS_MODE,
1042
1051
  CoordinationType.PHOTOMETRIC_INTERPRETATION,
1043
1052
  CoordinationType.ANNOTATION_STORY,
1044
1053
  CoordinationType.ANNOTATION_SHAPES,
@@ -1070,6 +1079,7 @@ const COMPONENT_COORDINATION_TYPES = {
1070
1079
  CoordinationType.SPATIAL_ROTATION_ORBIT,
1071
1080
  CoordinationType.SPATIAL_ORBIT_AXIS,
1072
1081
  CoordinationType.SPATIAL_AXIS_FIXED,
1082
+ CoordinationType.SPATIAL_CAMERA_SNAPSHOT,
1073
1083
  CoordinationType.OBS_FILTER,
1074
1084
  CoordinationType.OBS_HIGHLIGHT,
1075
1085
  CoordinationType.OBS_SET_SELECTION,
@@ -1087,10 +1097,12 @@ const COMPONENT_COORDINATION_TYPES = {
1087
1097
  CoordinationType.ADDITIONAL_OBS_SETS,
1088
1098
  CoordinationType.MOLECULE_HIGHLIGHT,
1089
1099
  CoordinationType.TOOLTIPS_VISIBLE,
1100
+ CoordinationType.TOOLTIP_OBS_SETS_MODE,
1090
1101
  CoordinationType.FILE_UID,
1091
1102
  CoordinationType.SPATIAL_TARGET_C,
1092
1103
  CoordinationType.SPATIAL_LAYER_VISIBLE,
1093
1104
  CoordinationType.SPATIAL_LAYER_OPACITY,
1105
+ CoordinationType.SPATIAL_LAYER_OPACITY_UNSELECTED,
1094
1106
  CoordinationType.SPATIAL_LAYER_COLORMAP,
1095
1107
  CoordinationType.SPATIAL_LAYER_TRANSPARENT_COLOR,
1096
1108
  CoordinationType.SPATIAL_LAYER_MODEL_MATRIX,
@@ -1169,7 +1181,8 @@ const COMPONENT_COORDINATION_TYPES = {
1169
1181
  CoordinationType.FEATURE_VALUE_COLORMAP_RANGE,
1170
1182
  CoordinationType.OBS_COLOR_ENCODING,
1171
1183
  CoordinationType.ADDITIONAL_OBS_SETS,
1172
- CoordinationType.TOOLTIPS_VISIBLE
1184
+ CoordinationType.TOOLTIPS_VISIBLE,
1185
+ CoordinationType.TOOLTIP_OBS_SETS_MODE
1173
1186
  ],
1174
1187
  [ViewType.OBS_SETS]: [
1175
1188
  CoordinationType.DATASET,
@@ -1286,6 +1299,7 @@ const COMPONENT_COORDINATION_TYPES = {
1286
1299
  CoordinationType.SPATIAL_LAYER_VISIBLE,
1287
1300
  CoordinationType.SPATIAL_LAYER_LABEL,
1288
1301
  CoordinationType.SPATIAL_LAYER_OPACITY,
1302
+ CoordinationType.SPATIAL_LAYER_OPACITY_UNSELECTED,
1289
1303
  CoordinationType.SPATIAL_LAYER_COLORMAP,
1290
1304
  CoordinationType.SPATIAL_LAYER_TRANSPARENT_COLOR,
1291
1305
  CoordinationType.SPATIAL_LAYER_MODEL_MATRIX,
@@ -1999,7 +2013,7 @@ function rulesheet(callback) {
1999
2013
  }
2000
2014
  };
2001
2015
  }
2002
- function memoize$1(fn) {
2016
+ function memoize(fn) {
2003
2017
  var cache = /* @__PURE__ */ Object.create(null);
2004
2018
  return function(arg2) {
2005
2019
  if (cache[arg2] === void 0) cache[arg2] = fn(arg2);
@@ -2287,10 +2301,10 @@ var createCache = function createCache2(options) {
2287
2301
  }
2288
2302
  var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;
2289
2303
  var inserted = {};
2290
- var container;
2304
+ var container2;
2291
2305
  var nodesToHydrate = [];
2292
2306
  {
2293
- container = options.container || document.head;
2307
+ container2 = options.container || document.head;
2294
2308
  Array.prototype.forEach.call(
2295
2309
  // this means we will ignore elements which don't have a space in them which
2296
2310
  // means that the style elements we're looking at are only Emotion 11 server-rendered style elements
@@ -2327,7 +2341,7 @@ var createCache = function createCache2(options) {
2327
2341
  key,
2328
2342
  sheet: new StyleSheet({
2329
2343
  key,
2330
- container,
2344
+ container: container2,
2331
2345
  nonce: options.nonce,
2332
2346
  speedy: options.speedy,
2333
2347
  prepend: options.prepend,
@@ -2737,7 +2751,7 @@ var isCustomProperty = function isCustomProperty2(property) {
2737
2751
  var isProcessableValue = function isProcessableValue2(value) {
2738
2752
  return value != null && typeof value !== "boolean";
2739
2753
  };
2740
- var processStyleName = /* @__PURE__ */ memoize$1(function(styleName) {
2754
+ var processStyleName = /* @__PURE__ */ memoize(function(styleName) {
2741
2755
  return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, "-$&").toLowerCase();
2742
2756
  });
2743
2757
  var processStyleValue = function processStyleValue2(key, value) {
@@ -3090,7 +3104,7 @@ function matchCSSObject(arg2) {
3090
3104
  return arg2 instanceof Object && !("styles" in arg2) && !("length" in arg2) && !("__emotion_styles" in arg2);
3091
3105
  }
3092
3106
  const { createCssAndCx } = /* @__PURE__ */ (() => {
3093
- function merge2(registered, css2, className) {
3107
+ function merge(registered, css2, className) {
3094
3108
  const registeredStyles = [];
3095
3109
  const rawClassName = getRegisteredStyles(registered, registeredStyles, className);
3096
3110
  if (registeredStyles.length < 2) {
@@ -3116,7 +3130,7 @@ const { createCssAndCx } = /* @__PURE__ */ (() => {
3116
3130
  const cx = (...args) => {
3117
3131
  const className = classnames(args);
3118
3132
  const feat27FixedClassnames = increaseSpecificityToTakePrecedenceOverMediaQueries.fixClassName(cache, className, css2);
3119
- return merge2(cache.registered, css2, feat27FixedClassnames);
3133
+ return merge(cache.registered, css2, feat27FixedClassnames);
3120
3134
  };
3121
3135
  return { css: css2, cx };
3122
3136
  }
@@ -3723,7 +3737,7 @@ const { tss: tss$1 } = createTss({
3723
3737
  tss$1.create({});
3724
3738
  const THEME_ID = "$$material";
3725
3739
  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(
3740
+ var isPropValid = /* @__PURE__ */ memoize(
3727
3741
  function(prop) {
3728
3742
  return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111 && prop.charCodeAt(1) === 110 && prop.charCodeAt(2) < 91;
3729
3743
  }
@@ -4173,7 +4187,7 @@ function requireFactoryWithTypeCheckers() {
4173
4187
  function emptyFunctionThatReturnsNull() {
4174
4188
  return null;
4175
4189
  }
4176
- factoryWithTypeCheckers = function(isValidElement2, throwOnDirectAccess) {
4190
+ factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
4177
4191
  var ITERATOR_SYMBOL = typeof Symbol === "function" && Symbol.iterator;
4178
4192
  var FAUX_ITERATOR_SYMBOL = "@@iterator";
4179
4193
  function getIteratorFn(maybeIterable) {
@@ -4301,7 +4315,7 @@ function requireFactoryWithTypeCheckers() {
4301
4315
  function createElementTypeChecker() {
4302
4316
  function validate(props, propName, componentName, location, propFullName) {
4303
4317
  var propValue = props[propName];
4304
- if (!isValidElement2(propValue)) {
4318
+ if (!isValidElement(propValue)) {
4305
4319
  var propType = getPropType(propValue);
4306
4320
  return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected a single ReactElement."));
4307
4321
  }
@@ -4489,7 +4503,7 @@ function requireFactoryWithTypeCheckers() {
4489
4503
  if (Array.isArray(propValue)) {
4490
4504
  return propValue.every(isNode);
4491
4505
  }
4492
- if (propValue === null || isValidElement2(propValue)) {
4506
+ if (propValue === null || isValidElement(propValue)) {
4493
4507
  return true;
4494
4508
  }
4495
4509
  var iteratorFn = getIteratorFn(propValue);
@@ -4673,8 +4687,7 @@ function requireReactIs_development() {
4673
4687
  }
4674
4688
  }
4675
4689
  }
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");
4690
+ 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
4691
  reactIs_development.ContextConsumer = REACT_CONSUMER_TYPE;
4679
4692
  reactIs_development.ContextProvider = REACT_CONTEXT_TYPE;
4680
4693
  reactIs_development.Element = REACT_ELEMENT_TYPE;
@@ -4724,7 +4737,7 @@ function requireReactIs_development() {
4724
4737
  return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;
4725
4738
  };
4726
4739
  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;
4740
+ 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
4741
  };
4729
4742
  reactIs_development.typeOf = typeOf;
4730
4743
  })();
@@ -4794,19 +4807,12 @@ const sortBreakpointsValues = (values2) => {
4794
4807
  };
4795
4808
  function createBreakpoints(breakpoints) {
4796
4809
  const {
4797
- // The breakpoint **start** at this value.
4798
- // For instance with the first breakpoint xs: [xs, sm).
4799
4810
  values: values2 = {
4800
4811
  xs: 0,
4801
- // phone
4802
4812
  sm: 600,
4803
- // tablet
4804
4813
  md: 900,
4805
- // small laptop
4806
4814
  lg: 1200,
4807
- // desktop
4808
4815
  xl: 1536
4809
- // large screen
4810
4816
  },
4811
4817
  unit = "px",
4812
4818
  step = 5,
@@ -4842,6 +4848,10 @@ function createBreakpoints(breakpoints) {
4842
4848
  }
4843
4849
  return between(key, keys2[keys2.indexOf(key) + 1]).replace("@media", "@media not all and");
4844
4850
  }
4851
+ const mediaKeys = [];
4852
+ for (let i = 0; i < keys2.length; i += 1) {
4853
+ mediaKeys.push(up(keys2[i]));
4854
+ }
4845
4855
  return {
4846
4856
  keys: keys2,
4847
4857
  values: sortedValues,
@@ -4851,28 +4861,40 @@ function createBreakpoints(breakpoints) {
4851
4861
  only,
4852
4862
  not,
4853
4863
  unit,
4864
+ internal_mediaKeys: mediaKeys,
4854
4865
  ...other
4855
4866
  };
4856
4867
  }
4868
+ const MIN_WIDTH_PATTERN = /min-width:\s*([0-9.]+)/;
4857
4869
  function sortContainerQueries(theme, css2) {
4858
- if (!theme.containerQueries) {
4870
+ if (!theme.containerQueries || !hasContainerQuery(css2)) {
4859
4871
  return css2;
4860
4872
  }
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;
4873
+ const keys2 = [];
4874
+ for (const key in css2) {
4875
+ if (key.startsWith("@container")) {
4876
+ keys2.push(key);
4877
+ }
4867
4878
  }
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
4879
+ keys2.sort((a, b) => {
4880
+ return +(a.match(MIN_WIDTH_PATTERN)?.[1] || 0) - +(b.match(MIN_WIDTH_PATTERN)?.[1] || 0);
4875
4881
  });
4882
+ const result = css2;
4883
+ for (let i = 0; i < keys2.length; i += 1) {
4884
+ const key = keys2[i];
4885
+ const value = result[key];
4886
+ delete result[key];
4887
+ result[key] = value;
4888
+ }
4889
+ return result;
4890
+ }
4891
+ function hasContainerQuery(css2) {
4892
+ for (const key in css2) {
4893
+ if (key.startsWith("@container")) {
4894
+ return true;
4895
+ }
4896
+ }
4897
+ return false;
4876
4898
  }
4877
4899
  function isCqShorthand(breakpointKeys, value) {
4878
4900
  return value === "@" || value.startsWith("@") && (breakpointKeys.some((key) => value.startsWith(`@${key}`)) || !!value.match(/^@\d/));
@@ -4881,8 +4903,11 @@ function getContainerQuery(theme, shorthand) {
4881
4903
  const matches = shorthand.match(/^@([^/]+)?\/?(.+)?$/);
4882
4904
  if (!matches) {
4883
4905
  {
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\`.`);
4906
+ throw (
4907
+ /* minify-error */
4908
+ new Error(`MUI: The provided shorthand ${`(${shorthand})`} is invalid. The format should be \`@<breakpoint | number>\` or \`@<breakpoint | number>/<container>\`.
4909
+ For example, \`@sm\` or \`@600\` or \`@40rem/sidebar\`.`)
4910
+ );
4886
4911
  }
4887
4912
  }
4888
4913
  const [, containerQuery, containerName] = matches;
@@ -4919,16 +4944,83 @@ const shape = {
4919
4944
  borderRadius: 4
4920
4945
  };
4921
4946
  const responsivePropType = PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.object, PropTypes.array]);
4922
- function merge(acc, item) {
4923
- if (!item) {
4924
- return acc;
4947
+ function isObjectEmpty$1(object) {
4948
+ if (object == null) {
4949
+ return true;
4925
4950
  }
4926
- return deepmerge(acc, item, {
4927
- clone: false
4928
- // No need to clone deep, it's way faster.
4929
- });
4951
+ for (const _ in object) {
4952
+ return false;
4953
+ }
4954
+ return true;
4955
+ }
4956
+ function fastDeepAssign(target, source) {
4957
+ const sourceIsArray = Array.isArray(source);
4958
+ const targetIsArray = Array.isArray(target);
4959
+ if (isPrimitive(source)) {
4960
+ return source;
4961
+ } else if (isPrimitiveOrBuiltIn(target)) {
4962
+ return clone(source);
4963
+ } else if (sourceIsArray && targetIsArray) {
4964
+ return mergeArray(target, source);
4965
+ } else if (sourceIsArray !== targetIsArray) {
4966
+ return clone(source);
4967
+ } else {
4968
+ return mergeObject(target, source);
4969
+ }
4970
+ }
4971
+ function cloneArray(value) {
4972
+ let i = 0;
4973
+ const il = value.length;
4974
+ const result = new Array(il);
4975
+ for (i = 0; i < il; i += 1) {
4976
+ result[i] = clone(value[i]);
4977
+ }
4978
+ return result;
4979
+ }
4980
+ function cloneObject(target) {
4981
+ const result = {};
4982
+ for (const key in target) {
4983
+ if (key === "__proto__" || key === "constructor" || key === "prototype") {
4984
+ continue;
4985
+ }
4986
+ result[key] = clone(target[key]);
4987
+ }
4988
+ return result;
4989
+ }
4990
+ function mergeArray(target, source) {
4991
+ const tl = target.length;
4992
+ for (let i = 0; i < source.length; i += 1) {
4993
+ target[tl + i] = clone(source[i]);
4994
+ }
4995
+ return target;
4996
+ }
4997
+ function isMergeableObject(value) {
4998
+ return typeof value === "object" && value !== null && !(value instanceof RegExp) && !(value instanceof Date);
4999
+ }
5000
+ function isPrimitive(value) {
5001
+ return typeof value !== "object" || value === null;
5002
+ }
5003
+ function isPrimitiveOrBuiltIn(value) {
5004
+ return typeof value !== "object" || value === null || value instanceof RegExp || value instanceof Date;
5005
+ }
5006
+ function clone(entry) {
5007
+ return isMergeableObject(entry) ? Array.isArray(entry) ? cloneArray(entry) : cloneObject(entry) : entry;
5008
+ }
5009
+ function mergeObject(target, source) {
5010
+ for (const key in source) {
5011
+ if (key === "__proto__" || key === "constructor" || key === "prototype") {
5012
+ continue;
5013
+ }
5014
+ if (key in target) {
5015
+ target[key] = fastDeepAssign(target[key], source[key]);
5016
+ } else {
5017
+ target[key] = clone(source[key]);
5018
+ }
5019
+ }
5020
+ return target;
4930
5021
  }
4931
- const values$1 = {
5022
+ const EMPTY_THEME$2 = {};
5023
+ const values = {
4932
5024
  xs: 0,
4933
5025
  // phone
4934
5026
  sm: 600,
@@ -4940,16 +5032,13 @@ const values$1 = {
4940
5032
  xl: 1536
4941
5033
  // large screen
4942
5034
  };
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
- };
5035
+ const DEFAULT_BREAKPOINTS = createBreakpoints({
5036
+ values
5037
+ });
4949
5038
  const defaultContainerQueries = {
4950
5039
  containerQueries: (containerName) => ({
4951
5040
  up: (key) => {
4952
- let result = typeof key === "number" ? key : values$1[key] || key;
5041
+ let result = typeof key === "number" ? key : values[key] || key;
4953
5042
  if (typeof result === "number") {
4954
5043
  result = `${result}px`;
4955
5044
  }
@@ -4958,52 +5047,89 @@ const defaultContainerQueries = {
4958
5047
  })
4959
5048
  };
4960
5049
  function handleBreakpoints(props, propValue, styleFromPropValue) {
4961
- const theme = props.theme || {};
5050
+ const result = {};
5051
+ return iterateBreakpoints(result, props.theme, propValue, (mediaKey, value, initialKey) => {
5052
+ const finalValue = styleFromPropValue(value, initialKey);
5053
+ if (mediaKey) {
5054
+ result[mediaKey] = finalValue;
5055
+ } else {
5056
+ fastDeepAssign(result, finalValue);
5057
+ }
5058
+ });
5059
+ }
5060
+ function iterateBreakpoints(target, theme, propValue, callback) {
5061
+ theme ??= EMPTY_THEME$2;
4962
5062
  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
- }, {});
5063
+ const breakpoints = theme.breakpoints ?? DEFAULT_BREAKPOINTS;
5064
+ for (let i = 0; i < propValue.length; i += 1) {
5065
+ buildBreakpoint(target, breakpoints.up(breakpoints.keys[i]), propValue[i], void 0, callback);
5066
+ }
5067
+ return target;
4968
5068
  }
4969
5069
  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);
5070
+ const breakpoints = theme.breakpoints ?? DEFAULT_BREAKPOINTS;
5071
+ const breakpointValues = breakpoints.values ?? values;
5072
+ for (const key in propValue) {
5073
+ if (isCqShorthand(breakpoints.keys, key)) {
5074
+ const containerKey = getContainerQuery(theme.containerQueries ? theme : defaultContainerQueries, key);
4974
5075
  if (containerKey) {
4975
- acc[containerKey] = styleFromPropValue(propValue[breakpoint], breakpoint);
5076
+ buildBreakpoint(target, containerKey, propValue[key], key, callback);
4976
5077
  }
4977
- } else if (Object.keys(themeBreakpoints.values || values$1).includes(breakpoint)) {
4978
- const mediaKey = themeBreakpoints.up(breakpoint);
4979
- acc[mediaKey] = styleFromPropValue(propValue[breakpoint], breakpoint);
5078
+ } else if (key in breakpointValues) {
5079
+ const mediaKey = breakpoints.up(key);
5080
+ buildBreakpoint(target, mediaKey, propValue[key], key, callback);
4980
5081
  } else {
4981
- const cssKey = breakpoint;
4982
- acc[cssKey] = propValue[cssKey];
5082
+ const cssKey = key;
5083
+ target[cssKey] = propValue[cssKey];
4983
5084
  }
4984
- return acc;
4985
- }, {});
5085
+ }
5086
+ return target;
4986
5087
  }
4987
- const output = styleFromPropValue(propValue);
4988
- return output;
5088
+ callback(void 0, propValue);
5089
+ return target;
4989
5090
  }
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 || {};
5091
+ function buildBreakpoint(target, mediaKey, value, initialKey, callback) {
5092
+ target[mediaKey] ??= {};
5093
+ callback(mediaKey, value, initialKey);
5094
+ }
5095
+ function createEmptyBreakpointObject(breakpoints = DEFAULT_BREAKPOINTS) {
5096
+ const {
5097
+ internal_mediaKeys: mediaKeys
5098
+ } = breakpoints;
5099
+ const result = {};
5100
+ for (let i = 0; i < mediaKeys.length; i += 1) {
5101
+ result[mediaKeys[i]] = {};
5102
+ }
5103
+ return result;
4997
5104
  }
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];
5105
+ function removeUnusedBreakpoints(breakpoints, style2) {
5106
+ const breakpointKeys = breakpoints.internal_mediaKeys;
5107
+ for (let i = 0; i < breakpointKeys.length; i += 1) {
5108
+ const key = breakpointKeys[i];
5109
+ if (isObjectEmpty$1(style2[key])) {
5110
+ delete style2[key];
5004
5111
  }
5005
- return acc;
5006
- }, style2);
5112
+ }
5113
+ return style2;
5114
+ }
5115
+ function hasBreakpoint(breakpoints, value) {
5116
+ if (Array.isArray(value)) {
5117
+ return true;
5118
+ }
5119
+ if (typeof value === "object" && value !== null) {
5120
+ for (let i = 0; i < breakpoints.keys.length; i += 1) {
5121
+ if (breakpoints.keys[i] in value) {
5122
+ return true;
5123
+ }
5124
+ }
5125
+ const valueKeys = Object.keys(value);
5126
+ for (let i = 0; i < valueKeys.length; i += 1) {
5127
+ if (isCqShorthand(breakpoints.keys, valueKeys[i])) {
5128
+ return true;
5129
+ }
5130
+ }
5131
+ }
5132
+ return false;
5007
5133
  }
5008
5134
  function capitalize(string) {
5009
5135
  if (typeof string !== "string") {
@@ -5011,37 +5137,54 @@ function capitalize(string) {
5011
5137
  }
5012
5138
  return string.charAt(0).toUpperCase() + string.slice(1);
5013
5139
  }
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) {
5140
+ function getStyleValue2(themeMapping, transform, userValue, alternateProp) {
5032
5141
  let value;
5033
5142
  if (typeof themeMapping === "function") {
5034
- value = themeMapping(propValueFinal);
5143
+ value = themeMapping(userValue);
5035
5144
  } else if (Array.isArray(themeMapping)) {
5036
- value = themeMapping[propValueFinal] || userValue;
5145
+ value = themeMapping[userValue] || userValue;
5146
+ } else if (typeof userValue === "string") {
5147
+ value = getPath(themeMapping, userValue, true, alternateProp) || userValue;
5037
5148
  } else {
5038
- value = getPath(themeMapping, propValueFinal) || userValue;
5149
+ value = userValue;
5039
5150
  }
5040
5151
  if (transform) {
5041
5152
  value = transform(value, userValue, themeMapping);
5042
5153
  }
5043
5154
  return value;
5044
5155
  }
5156
+ function getPath(obj, pathInput, checkVars = true, alternateProp = void 0) {
5157
+ if (!obj || !pathInput) {
5158
+ return null;
5159
+ }
5160
+ const path = pathInput.split(".");
5161
+ if (obj.vars && checkVars) {
5162
+ const val = getPathImpl(obj.vars, path, alternateProp);
5163
+ if (val != null) {
5164
+ return val;
5165
+ }
5166
+ }
5167
+ return getPathImpl(obj, path, alternateProp);
5168
+ }
5169
+ function getPathImpl(object, path, alternateProp = void 0) {
5170
+ let lastResult = void 0;
5171
+ let result = object;
5172
+ let index = 0;
5173
+ while (index < path.length) {
5174
+ if (result === null || result === void 0) {
5175
+ return result;
5176
+ }
5177
+ lastResult = result;
5178
+ result = result[path[index]];
5179
+ index += 1;
5180
+ }
5181
+ if (alternateProp && result === void 0) {
5182
+ const lastKey = path[path.length - 1];
5183
+ const alternateKey = `${alternateProp}${lastKey === "default" ? "" : capitalize(lastKey)}`;
5184
+ return lastResult?.[alternateKey];
5185
+ }
5186
+ return result;
5187
+ }
5045
5188
  function style$1(options) {
5046
5189
  const {
5047
5190
  prop,
@@ -5056,15 +5199,9 @@ function style$1(options) {
5056
5199
  const propValue = props[prop];
5057
5200
  const theme = props.theme;
5058
5201
  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 {
5202
+ const styleFromPropValue = (valueFinal) => {
5203
+ const value = getStyleValue2(themeMapping, transform, valueFinal, prop);
5204
+ return cssProperty === false ? value : {
5068
5205
  [cssProperty]: value
5069
5206
  };
5070
5207
  };
@@ -5076,15 +5213,9 @@ function style$1(options) {
5076
5213
  fn.filterProps = [prop];
5077
5214
  return fn;
5078
5215
  }
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
- }
5216
+ const EMPTY_THEME$1 = {
5217
+ internal_cache: {}
5218
+ };
5088
5219
  const properties = {
5089
5220
  m: "margin",
5090
5221
  p: "padding"
@@ -5103,22 +5234,24 @@ const aliases = {
5103
5234
  paddingX: "px",
5104
5235
  paddingY: "py"
5105
5236
  };
5106
- const getCssProperties = memoize((prop) => {
5107
- if (prop.length > 2) {
5108
- if (aliases[prop]) {
5109
- prop = aliases[prop];
5110
- } else {
5111
- return [prop];
5112
- }
5237
+ const CSS_PROPERTIES = {};
5238
+ for (const key in properties) {
5239
+ CSS_PROPERTIES[key] = [properties[key]];
5240
+ }
5241
+ for (const keyProperty in properties) {
5242
+ for (const keyDirection in directions) {
5243
+ const property = properties[keyProperty];
5244
+ const direction = directions[keyDirection];
5245
+ const value = Array.isArray(direction) ? direction.map((dir) => property + dir) : [property + direction];
5246
+ CSS_PROPERTIES[keyProperty + keyDirection] = value;
5113
5247
  }
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];
5248
+ }
5249
+ for (const key in aliases) {
5250
+ CSS_PROPERTIES[key] = CSS_PROPERTIES[aliases[key]];
5251
+ }
5252
+ 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"]);
5253
+ 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"]);
5254
+ const spacingKeys = /* @__PURE__ */ new Set([...marginKeys, ...paddingKeys]);
5122
5255
  function createUnaryUnit(theme, themeKey, defaultValue, propName) {
5123
5256
  const themeSpacing = getPath(theme, themeKey, true) ?? defaultValue;
5124
5257
  if (typeof themeSpacing === "number" || typeof themeSpacing === "string") {
@@ -5186,42 +5319,45 @@ function getValue$1(transformer, propValue) {
5186
5319
  }
5187
5320
  return transformer(propValue);
5188
5321
  }
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
- }
5322
+ const container = [""];
5204
5323
  function style(props, keys2) {
5205
- const transformer = createUnarySpacing(props.theme);
5206
- return Object.keys(props).map((prop) => resolveCssProperty(props, keys2, prop, transformer)).reduce(merge, {});
5324
+ const theme = props.theme ?? EMPTY_THEME$1;
5325
+ const transformer = theme?.internal_cache?.unarySpacing ?? createUnarySpacing(theme);
5326
+ const result = {};
5327
+ for (const prop in props) {
5328
+ if (!keys2.has(prop)) {
5329
+ continue;
5330
+ }
5331
+ const cssProperties = CSS_PROPERTIES[prop] ?? (container[0] = prop, container);
5332
+ const propValue = props[prop];
5333
+ iterateBreakpoints(result, props.theme, propValue, (mediaKey, value) => {
5334
+ const target = mediaKey ? result[mediaKey] : result;
5335
+ for (let i = 0; i < cssProperties.length; i += 1) {
5336
+ target[cssProperties[i]] = getValue$1(transformer, value);
5337
+ }
5338
+ });
5339
+ }
5340
+ return result;
5207
5341
  }
5208
- function margin(props) {
5342
+ function marginFn(props) {
5209
5343
  return style(props, marginKeys);
5210
5344
  }
5211
- margin.propTypes = marginKeys.reduce((obj, key) => {
5345
+ marginFn.propTypes = Array.from(marginKeys).reduce((obj, key) => {
5212
5346
  obj[key] = responsivePropType;
5213
5347
  return obj;
5214
5348
  }, {});
5215
- margin.filterProps = marginKeys;
5216
- function padding(props) {
5349
+ marginFn.filterProps = marginKeys;
5350
+ const margin = marginFn;
5351
+ function paddingFn(props) {
5217
5352
  return style(props, paddingKeys);
5218
5353
  }
5219
- padding.propTypes = paddingKeys.reduce((obj, key) => {
5354
+ paddingFn.propTypes = Array.from(paddingKeys).reduce((obj, key) => {
5220
5355
  obj[key] = responsivePropType;
5221
5356
  return obj;
5222
5357
  }, {});
5223
- padding.filterProps = paddingKeys;
5224
- spacingKeys.reduce((obj, key) => {
5358
+ paddingFn.filterProps = paddingKeys;
5359
+ const padding = paddingFn;
5360
+ Array.from(spacingKeys).reduce((obj, key) => {
5225
5361
  obj[key] = responsivePropType;
5226
5362
  return obj;
5227
5363
  }, {});
@@ -5254,12 +5390,13 @@ function compose(...styles) {
5254
5390
  return acc;
5255
5391
  }, {});
5256
5392
  const fn = (props) => {
5257
- return Object.keys(props).reduce((acc, prop) => {
5393
+ const result = {};
5394
+ for (const prop in props) {
5258
5395
  if (handlers[prop]) {
5259
- return merge(acc, handlers[prop](props));
5396
+ fastDeepAssign(result, handlers[prop](props));
5260
5397
  }
5261
- return acc;
5262
- }, {});
5398
+ }
5399
+ return result;
5263
5400
  };
5264
5401
  fn.propTypes = styles.reduce((acc, style2) => Object.assign(acc, style2.propTypes), {});
5265
5402
  fn.filterProps = styles.reduce((acc, style2) => acc.concat(style2.filterProps), []);
@@ -5398,6 +5535,7 @@ const backgroundColor = style$1({
5398
5535
  transform: paletteTransform
5399
5536
  });
5400
5537
  compose(color, bgcolor, backgroundColor);
5538
+ const breakpointsValues = values;
5401
5539
  function sizingTransform(value) {
5402
5540
  return value <= 1 && value !== 0 ? `${value * 100}%` : value;
5403
5541
  }
@@ -5408,7 +5546,7 @@ const width = style$1({
5408
5546
  const maxWidth = (props) => {
5409
5547
  if (props.maxWidth !== void 0 && props.maxWidth !== null) {
5410
5548
  const styleFromPropValue = (propValue) => {
5411
- const breakpoint = props.theme?.breakpoints?.values?.[propValue] || values$1[propValue];
5549
+ const breakpoint = props.theme?.breakpoints?.values?.[propValue] || breakpointsValues[propValue];
5412
5550
  if (!breakpoint) {
5413
5551
  return {
5414
5552
  maxWidth: sizingTransform(propValue)
@@ -5746,68 +5884,24 @@ const defaultSxConfig = {
5746
5884
  themeKey: "typography"
5747
5885
  }
5748
5886
  };
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
- }
5887
+ const EMPTY_THEME = {};
5757
5888
  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) {
5889
+ function styleFunctionSx2(props) {
5890
+ if (!props.sx) {
5776
5891
  return null;
5777
5892
  }
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
5893
  const {
5803
5894
  sx,
5804
- theme = {}
5805
- } = props || {};
5806
- if (!sx) {
5807
- return null;
5808
- }
5895
+ theme = EMPTY_THEME,
5896
+ nested
5897
+ } = props;
5809
5898
  const config = theme.unstable_sxConfig ?? defaultSxConfig;
5810
- function traverse(sxInput) {
5899
+ const wrapper2 = {
5900
+ sx: null,
5901
+ theme,
5902
+ nested: true
5903
+ };
5904
+ function process(sxInput) {
5811
5905
  let sxObject = sxInput;
5812
5906
  if (typeof sxInput === "function") {
5813
5907
  sxObject = sxInput(theme);
@@ -5817,43 +5911,94 @@ function unstable_createStyleFunctionSx() {
5817
5911
  if (!sxObject) {
5818
5912
  return null;
5819
5913
  }
5820
- const emptyBreakpoints = createEmptyBreakpointObject(theme.breakpoints);
5821
- const breakpointsKeys = Object.keys(emptyBreakpoints);
5822
- let css2 = emptyBreakpoints;
5823
- Object.keys(sxObject).forEach((styleKey) => {
5914
+ const breakpoints = theme.breakpoints ?? DEFAULT_BREAKPOINTS;
5915
+ const css2 = createEmptyBreakpointObject(breakpoints);
5916
+ for (const styleKey in sxObject) {
5824
5917
  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
- }
5918
+ if (value === null || value === void 0) {
5919
+ continue;
5847
5920
  }
5848
- });
5849
- return sortContainerQueries(theme, removeUnusedBreakpoints(breakpointsKeys, css2));
5921
+ if (typeof value !== "object") {
5922
+ setThemeValue(css2, styleKey, value, theme, config);
5923
+ continue;
5924
+ }
5925
+ if (config[styleKey]) {
5926
+ setThemeValue(css2, styleKey, value, theme, config);
5927
+ continue;
5928
+ }
5929
+ if (hasBreakpoint(breakpoints, value)) {
5930
+ iterateBreakpoints(css2, props.theme, value, (mediaKey, finalValue) => {
5931
+ css2[mediaKey][styleKey] = finalValue;
5932
+ });
5933
+ } else {
5934
+ wrapper2.sx = value;
5935
+ css2[styleKey] = styleFunctionSx2(wrapper2);
5936
+ }
5937
+ }
5938
+ if (!nested && theme.modularCssLayers) {
5939
+ return {
5940
+ "@layer sx": sortContainerQueries(theme, removeUnusedBreakpoints(breakpoints, css2))
5941
+ };
5942
+ }
5943
+ return sortContainerQueries(theme, removeUnusedBreakpoints(breakpoints, css2));
5850
5944
  }
5851
- return Array.isArray(sx) ? sx.map(traverse) : traverse(sx);
5945
+ return Array.isArray(sx) ? sx.map(process) : process(sx);
5852
5946
  }
5947
+ styleFunctionSx2.filterProps = ["sx"];
5853
5948
  return styleFunctionSx2;
5854
5949
  }
5855
5950
  const styleFunctionSx = unstable_createStyleFunctionSx();
5856
- styleFunctionSx.filterProps = ["sx"];
5951
+ function setThemeValue(css2, prop, value, theme, config) {
5952
+ const options = config[prop];
5953
+ if (!options) {
5954
+ css2[prop] = value;
5955
+ return;
5956
+ }
5957
+ if (value == null) {
5958
+ return;
5959
+ }
5960
+ const {
5961
+ themeKey
5962
+ } = options;
5963
+ if (themeKey === "typography" && value === "inherit") {
5964
+ css2[prop] = value;
5965
+ return;
5966
+ }
5967
+ const {
5968
+ style: style2
5969
+ } = options;
5970
+ if (style2) {
5971
+ fastDeepAssign(css2, style2({
5972
+ [prop]: value,
5973
+ theme
5974
+ }));
5975
+ return;
5976
+ }
5977
+ const {
5978
+ cssProperty = prop,
5979
+ transform
5980
+ } = options;
5981
+ const themeMapping = getPath(theme, themeKey);
5982
+ iterateBreakpoints(css2, theme, value, (mediaKey, valueFinal) => {
5983
+ const finalValue = getStyleValue2(themeMapping, transform, valueFinal, prop);
5984
+ if (cssProperty === false) {
5985
+ if (mediaKey) {
5986
+ fastDeepAssign(css2[mediaKey], finalValue);
5987
+ } else {
5988
+ fastDeepAssign(css2, finalValue);
5989
+ }
5990
+ } else {
5991
+ if (mediaKey) {
5992
+ css2[mediaKey][cssProperty] = finalValue;
5993
+ } else {
5994
+ css2[cssProperty] = finalValue;
5995
+ }
5996
+ }
5997
+ });
5998
+ }
5999
+ function callIfFn(maybeFn, arg2) {
6000
+ return typeof maybeFn === "function" ? maybeFn(arg2) : maybeFn;
6001
+ }
5857
6002
  function applyStyles(key, styles) {
5858
6003
  const theme = this;
5859
6004
  if (theme.vars) {
@@ -5914,67 +6059,19 @@ function createTheme$1(options = {}, ...args) {
5914
6059
  theme: this
5915
6060
  });
5916
6061
  };
6062
+ muiTheme.internal_cache = {};
5917
6063
  return muiTheme;
5918
6064
  }
5919
- function isObjectEmpty$1(obj) {
6065
+ function isObjectEmpty(obj) {
5920
6066
  return Object.keys(obj).length === 0;
5921
6067
  }
5922
- function useTheme$2(defaultTheme2 = null) {
6068
+ function useThemeWithoutDefault(defaultTheme2 = null) {
5923
6069
  const contextTheme = React.useContext(ThemeContext);
5924
- return !contextTheme || isObjectEmpty$1(contextTheme) ? defaultTheme2 : contextTheme;
6070
+ return !contextTheme || isObjectEmpty(contextTheme) ? defaultTheme2 : contextTheme;
5925
6071
  }
5926
6072
  const systemDefaultTheme$1 = createTheme$1();
5927
6073
  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
- };
6074
+ return useThemeWithoutDefault(defaultTheme2);
5978
6075
  }
5979
6076
  const defaultGenerator = (componentName) => componentName;
5980
6077
  const createClassNameGenerator = () => {
@@ -6085,6 +6182,12 @@ const systemDefaultTheme = createTheme$1();
6085
6182
  function shouldForwardProp(prop) {
6086
6183
  return prop !== "ownerState" && prop !== "theme" && prop !== "sx" && prop !== "as";
6087
6184
  }
6185
+ function shallowLayer(serialized, layerName) {
6186
+ if (layerName && serialized && typeof serialized === "object" && serialized.styles && !serialized.styles.startsWith("@layer")) {
6187
+ serialized.styles = `@layer ${layerName}{${String(serialized.styles)}}`;
6188
+ }
6189
+ return serialized;
6190
+ }
6088
6191
  function defaultOverridesResolver(slot) {
6089
6192
  if (!slot) {
6090
6193
  return null;
@@ -6092,32 +6195,32 @@ function defaultOverridesResolver(slot) {
6092
6195
  return (_props, styles) => styles[slot];
6093
6196
  }
6094
6197
  function attachTheme(props, themeId, defaultTheme2) {
6095
- props.theme = isObjectEmpty(props.theme) ? defaultTheme2 : props.theme[themeId] || props.theme;
6198
+ props.theme = isObjectEmpty$1(props.theme) ? defaultTheme2 : props.theme[themeId] || props.theme;
6096
6199
  }
6097
- function processStyle(props, style2) {
6200
+ function processStyle(props, style2, layerName) {
6098
6201
  const resolvedStyle = typeof style2 === "function" ? style2(props) : style2;
6099
6202
  if (Array.isArray(resolvedStyle)) {
6100
- return resolvedStyle.flatMap((subStyle) => processStyle(props, subStyle));
6203
+ return resolvedStyle.flatMap((subStyle) => processStyle(props, subStyle, layerName));
6101
6204
  }
6102
6205
  if (Array.isArray(resolvedStyle?.variants)) {
6103
6206
  let rootStyle;
6104
6207
  if (resolvedStyle.isProcessed) {
6105
- rootStyle = resolvedStyle.style;
6208
+ rootStyle = layerName ? shallowLayer(resolvedStyle.style, layerName) : resolvedStyle.style;
6106
6209
  } else {
6107
6210
  const {
6108
6211
  variants,
6109
6212
  ...otherStyles
6110
6213
  } = resolvedStyle;
6111
- rootStyle = otherStyles;
6214
+ rootStyle = layerName ? shallowLayer(internal_serializeStyles(otherStyles), layerName) : otherStyles;
6112
6215
  }
6113
- return processStyleVariants(props, resolvedStyle.variants, [rootStyle]);
6216
+ return processStyleVariants(props, resolvedStyle.variants, [rootStyle], layerName);
6114
6217
  }
6115
6218
  if (resolvedStyle?.isProcessed) {
6116
- return resolvedStyle.style;
6219
+ return layerName ? shallowLayer(internal_serializeStyles(resolvedStyle.style), layerName) : resolvedStyle.style;
6117
6220
  }
6118
- return resolvedStyle;
6221
+ return layerName ? shallowLayer(internal_serializeStyles(resolvedStyle), layerName) : resolvedStyle;
6119
6222
  }
6120
- function processStyleVariants(props, variants, results = []) {
6223
+ function processStyleVariants(props, variants, results = [], layerName = void 0) {
6121
6224
  let mergedState;
6122
6225
  variantLoop: for (let i = 0; i < variants.length; i += 1) {
6123
6226
  const variant = variants[i];
@@ -6143,9 +6246,9 @@ function processStyleVariants(props, variants, results = []) {
6143
6246
  ...props.ownerState,
6144
6247
  ownerState: props.ownerState
6145
6248
  };
6146
- results.push(variant.style(mergedState));
6249
+ results.push(layerName ? shallowLayer(internal_serializeStyles(variant.style(mergedState)), layerName) : variant.style(mergedState));
6147
6250
  } else {
6148
- results.push(variant.style);
6251
+ results.push(layerName ? shallowLayer(internal_serializeStyles(variant.style), layerName) : variant.style);
6149
6252
  }
6150
6253
  }
6151
6254
  return results;
@@ -6172,6 +6275,7 @@ function createStyled2(input = {}) {
6172
6275
  overridesResolver = defaultOverridesResolver(lowercaseFirstLetter(componentSlot)),
6173
6276
  ...options
6174
6277
  } = inputOptions;
6278
+ const layerName = componentName && componentName.startsWith("Mui") || !!componentSlot ? "components" : "custom";
6175
6279
  const skipVariantsResolver = inputSkipVariantsResolver !== void 0 ? inputSkipVariantsResolver : (
6176
6280
  // TODO v6: remove `Root` in the next major release
6177
6281
  // For more details: https://github.com/mui/material-ui/pull/37908
@@ -6192,18 +6296,21 @@ function createStyled2(input = {}) {
6192
6296
  ...options
6193
6297
  });
6194
6298
  const transformStyle = (style2) => {
6195
- if (typeof style2 === "function" && style2.__emotion_real !== style2) {
6299
+ if (style2.__emotion_real === style2) {
6300
+ return style2;
6301
+ }
6302
+ if (typeof style2 === "function") {
6196
6303
  return function styleFunctionProcessor(props) {
6197
- return processStyle(props, style2);
6304
+ return processStyle(props, style2, props.theme.modularCssLayers ? layerName : void 0);
6198
6305
  };
6199
6306
  }
6200
6307
  if (isPlainObject(style2)) {
6201
6308
  const serialized = preprocessStyles(style2);
6202
- if (!serialized.variants) {
6203
- return serialized.style;
6204
- }
6205
6309
  return function styleObjectProcessor(props) {
6206
- return processStyle(props, serialized);
6310
+ if (!serialized.variants) {
6311
+ return props.theme.modularCssLayers ? shallowLayer(serialized.style, layerName) : serialized.style;
6312
+ }
6313
+ return processStyle(props, serialized, props.theme.modularCssLayers ? layerName : void 0);
6207
6314
  };
6208
6315
  }
6209
6316
  return style2;
@@ -6222,7 +6329,7 @@ function createStyled2(input = {}) {
6222
6329
  }
6223
6330
  const resolvedStyleOverrides = {};
6224
6331
  for (const slotKey in styleOverrides) {
6225
- resolvedStyleOverrides[slotKey] = processStyle(props, styleOverrides[slotKey]);
6332
+ resolvedStyleOverrides[slotKey] = processStyle(props, styleOverrides[slotKey], props.theme.modularCssLayers ? "theme" : void 0);
6226
6333
  }
6227
6334
  return overridesResolver(props, resolvedStyleOverrides);
6228
6335
  });
@@ -6234,7 +6341,7 @@ function createStyled2(input = {}) {
6234
6341
  if (!themeVariants) {
6235
6342
  return null;
6236
6343
  }
6237
- return processStyleVariants(props, themeVariants);
6344
+ return processStyleVariants(props, themeVariants, [], props.theme.modularCssLayers ? "theme" : void 0);
6238
6345
  });
6239
6346
  }
6240
6347
  if (!skipSx) {
@@ -6283,12 +6390,6 @@ function generateStyledLabel(componentName, componentSlot) {
6283
6390
  }
6284
6391
  return label;
6285
6392
  }
6286
- function isObjectEmpty(object) {
6287
- for (const _ in object) {
6288
- return false;
6289
- }
6290
- return true;
6291
- }
6292
6393
  function isStringTag(tag) {
6293
6394
  return typeof tag === "string" && // 96 is one less than the char code
6294
6395
  // for "a" so this is checking that
@@ -6301,20 +6402,20 @@ function lowercaseFirstLetter(string) {
6301
6402
  }
6302
6403
  return string.charAt(0).toLowerCase() + string.slice(1);
6303
6404
  }
6304
- function resolveProps(defaultProps2, props) {
6405
+ function resolveProps(defaultProps, props, mergeClassNameAndStyle = false) {
6305
6406
  const output = {
6306
6407
  ...props
6307
6408
  };
6308
- for (const key in defaultProps2) {
6309
- if (Object.prototype.hasOwnProperty.call(defaultProps2, key)) {
6409
+ for (const key in defaultProps) {
6410
+ if (Object.prototype.hasOwnProperty.call(defaultProps, key)) {
6310
6411
  const propName = key;
6311
6412
  if (propName === "components" || propName === "slots") {
6312
6413
  output[propName] = {
6313
- ...defaultProps2[propName],
6414
+ ...defaultProps[propName],
6314
6415
  ...output[propName]
6315
6416
  };
6316
6417
  } else if (propName === "componentsProps" || propName === "slotProps") {
6317
- const defaultSlotProps = defaultProps2[propName];
6418
+ const defaultSlotProps = defaultProps[propName];
6318
6419
  const slotProps = props[propName];
6319
6420
  if (!slotProps) {
6320
6421
  output[propName] = defaultSlotProps || {};
@@ -6327,12 +6428,25 @@ function resolveProps(defaultProps2, props) {
6327
6428
  for (const slotKey in defaultSlotProps) {
6328
6429
  if (Object.prototype.hasOwnProperty.call(defaultSlotProps, slotKey)) {
6329
6430
  const slotPropName = slotKey;
6330
- output[propName][slotPropName] = resolveProps(defaultSlotProps[slotPropName], slotProps[slotPropName]);
6431
+ const defaultSlotPropValue = defaultSlotProps[slotPropName];
6432
+ const slotPropValue = slotProps[slotPropName];
6433
+ if (typeof defaultSlotPropValue === "function" || typeof slotPropValue === "function") {
6434
+ output[propName][slotPropName] = (...args) => resolveProps((typeof defaultSlotPropValue === "function" ? defaultSlotPropValue(...args) : defaultSlotPropValue) ?? {}, (typeof slotPropValue === "function" ? slotPropValue(...args) : slotPropValue) ?? {}, mergeClassNameAndStyle);
6435
+ } else {
6436
+ output[propName][slotPropName] = resolveProps(defaultSlotPropValue ?? {}, slotPropValue ?? {}, mergeClassNameAndStyle);
6437
+ }
6331
6438
  }
6332
6439
  }
6333
6440
  }
6441
+ } else if (propName === "className" && mergeClassNameAndStyle && props.className !== void 0) {
6442
+ output.className = clsx$1(defaultProps?.className, props?.className);
6443
+ } else if (propName === "style" && mergeClassNameAndStyle && props.style) {
6444
+ output.style = {
6445
+ ...defaultProps?.style,
6446
+ ...props?.style
6447
+ };
6334
6448
  } else if (output[propName] === void 0) {
6335
- output[propName] = defaultProps2[propName];
6449
+ output[propName] = defaultProps[propName];
6336
6450
  }
6337
6451
  }
6338
6452
  }
@@ -6490,6 +6604,9 @@ function private_safeAlpha(color2, value, warning) {
6490
6604
  try {
6491
6605
  return alpha(color2, value);
6492
6606
  } catch (error) {
6607
+ if (warning && true) {
6608
+ console.warn(warning);
6609
+ }
6493
6610
  return color2;
6494
6611
  }
6495
6612
  }
@@ -6509,6 +6626,9 @@ function private_safeDarken(color2, coefficient, warning) {
6509
6626
  try {
6510
6627
  return darken(color2, coefficient);
6511
6628
  } catch (error) {
6629
+ if (warning && true) {
6630
+ console.warn(warning);
6631
+ }
6512
6632
  return color2;
6513
6633
  }
6514
6634
  }
@@ -6532,6 +6652,9 @@ function private_safeLighten(color2, coefficient, warning) {
6532
6652
  try {
6533
6653
  return lighten(color2, coefficient);
6534
6654
  } catch (error) {
6655
+ if (warning && true) {
6656
+ console.warn(warning);
6657
+ }
6535
6658
  return color2;
6536
6659
  }
6537
6660
  }
@@ -6584,10 +6707,10 @@ function getThemeProps(params) {
6584
6707
  }
6585
6708
  const config = theme.components[name];
6586
6709
  if (config.defaultProps) {
6587
- return resolveProps(config.defaultProps, props);
6710
+ return resolveProps(config.defaultProps, props, theme.components.mergeClassNameAndStyle);
6588
6711
  }
6589
6712
  if (!config.styleOverrides && !config.variants) {
6590
- return resolveProps(config, props);
6713
+ return resolveProps(config, props, theme.components.mergeClassNameAndStyle);
6591
6714
  }
6592
6715
  return props;
6593
6716
  }
@@ -6637,9 +6760,14 @@ function createGetCssVar$1(prefix2 = "") {
6637
6760
  };
6638
6761
  return getCssVar;
6639
6762
  }
6763
+ const prototypePollutingKeys = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
6640
6764
  const assignNestedKeys = (obj, keys2, value, arrayKeys = []) => {
6641
6765
  let temp = obj;
6642
- keys2.forEach((k, index) => {
6766
+ for (let index = 0; index < keys2.length; index += 1) {
6767
+ const k = keys2[index];
6768
+ if (prototypePollutingKeys.has(k)) {
6769
+ break;
6770
+ }
6643
6771
  if (index === keys2.length - 1) {
6644
6772
  if (Array.isArray(temp)) {
6645
6773
  temp[Number(k)] = value;
@@ -6652,7 +6780,7 @@ const assignNestedKeys = (obj, keys2, value, arrayKeys = []) => {
6652
6780
  }
6653
6781
  temp = temp[k];
6654
6782
  }
6655
- });
6783
+ }
6656
6784
  };
6657
6785
  const walkObjectDeep = (obj, callback, shouldSkipPaths) => {
6658
6786
  function recurse(object, parentKeys = [], arrayKeys = []) {
@@ -6719,7 +6847,8 @@ function prepareCssVars(theme, parserConfig = {}) {
6719
6847
  const {
6720
6848
  getSelector = defaultGetSelector2,
6721
6849
  disableCssColorScheme,
6722
- colorSchemeSelector: selector
6850
+ colorSchemeSelector: selector,
6851
+ enableContrastVars
6723
6852
  } = parserConfig;
6724
6853
  const {
6725
6854
  colorSchemes = {},
@@ -6853,6 +6982,17 @@ function prepareCssVars(theme, parserConfig = {}) {
6853
6982
  ...finalCss
6854
6983
  }), finalCss);
6855
6984
  });
6985
+ if (enableContrastVars) {
6986
+ stylesheets.push({
6987
+ ":root": {
6988
+ // use double underscore to indicate that these are private variables
6989
+ "--__l-threshold": "0.7",
6990
+ "--__l": "clamp(0, (l / var(--__l-threshold) - 1) * -infinity, 1)",
6991
+ "--__a": "clamp(0.87, (l / var(--__l-threshold) - 1) * -infinity, 1)"
6992
+ // 0.87 is the default alpha value for black text.
6993
+ }
6994
+ });
6995
+ }
6856
6996
  return stylesheets;
6857
6997
  };
6858
6998
  return {
@@ -7053,6 +7193,19 @@ function addLightOrDark(intent, direction, shade, tonalOffset) {
7053
7193
  }
7054
7194
  }
7055
7195
  }
7196
+ function mixLightOrDark(colorSpace, intent, direction, shade, tonalOffset) {
7197
+ const tonalOffsetLight = tonalOffset.light || tonalOffset;
7198
+ const tonalOffsetDark = tonalOffset.dark || tonalOffset * 1.5;
7199
+ if (!intent[direction]) {
7200
+ if (intent.hasOwnProperty(shade)) {
7201
+ intent[direction] = intent[shade];
7202
+ } else if (direction === "light") {
7203
+ intent.light = `color-mix(in ${colorSpace}, ${intent.main}, #fff ${(tonalOffsetLight * 100).toFixed(0)}%)`;
7204
+ } else if (direction === "dark") {
7205
+ intent.dark = `color-mix(in ${colorSpace}, ${intent.main}, #000 ${(tonalOffsetDark * 100).toFixed(0)}%)`;
7206
+ }
7207
+ }
7208
+ }
7056
7209
  function getDefaultPrimary(mode = "light") {
7057
7210
  if (mode === "dark") {
7058
7211
  return {
@@ -7138,11 +7291,15 @@ function getDefaultWarning(mode = "light") {
7138
7291
  dark: orange[900]
7139
7292
  };
7140
7293
  }
7294
+ function contrastColor(background) {
7295
+ return `oklch(from ${background} var(--__l) 0 h / var(--__a))`;
7296
+ }
7141
7297
  function createPalette(palette) {
7142
7298
  const {
7143
7299
  mode = "light",
7144
7300
  contrastThreshold = 3,
7145
7301
  tonalOffset = 0.2,
7302
+ colorSpace,
7146
7303
  ...other
7147
7304
  } = palette;
7148
7305
  const primary = palette.primary || getDefaultPrimary(mode);
@@ -7152,6 +7309,9 @@ function createPalette(palette) {
7152
7309
  const success = palette.success || getDefaultSuccess(mode);
7153
7310
  const warning = palette.warning || getDefaultWarning(mode);
7154
7311
  function getContrastText(background) {
7312
+ if (colorSpace) {
7313
+ return contrastColor(background);
7314
+ }
7155
7315
  const contrastText = getContrastRatio(background, dark.text.primary) >= contrastThreshold ? dark.text.primary : light.text.primary;
7156
7316
  {
7157
7317
  const contrast = getContrastRatio(background, contrastText);
@@ -7194,8 +7354,13 @@ const theme2 = createTheme({ palette: {
7194
7354
  primary: { main: green[500] },
7195
7355
  } });`);
7196
7356
  }
7197
- addLightOrDark(color2, "light", lightShade, tonalOffset);
7198
- addLightOrDark(color2, "dark", darkShade, tonalOffset);
7357
+ if (colorSpace) {
7358
+ mixLightOrDark(colorSpace, color2, "light", lightShade, tonalOffset);
7359
+ mixLightOrDark(colorSpace, color2, "dark", darkShade, tonalOffset);
7360
+ } else {
7361
+ addLightOrDark(color2, "light", lightShade, tonalOffset);
7362
+ addLightOrDark(color2, "dark", darkShade, tonalOffset);
7363
+ }
7199
7364
  if (!color2.contrastText) {
7200
7365
  color2.contrastText = getContrastText(color2.main);
7201
7366
  }
@@ -7271,6 +7436,49 @@ const theme2 = createTheme({ palette: {
7271
7436
  }, other);
7272
7437
  return paletteOutput;
7273
7438
  }
7439
+ const focusVisibleOffsetVar = "--_focusVisible-offset";
7440
+ const focusVisibleBehaviorVar = "--_focusVisible-behavior";
7441
+ const focusVisibleShadowVar = "--_focusVisible-shadow";
7442
+ const offsetValue = `var(${focusVisibleOffsetVar}, 1)`;
7443
+ const behaviorValue = `var(${focusVisibleBehaviorVar}, )`;
7444
+ const outsetFocusRing = {
7445
+ [focusVisibleOffsetVar]: 1,
7446
+ [focusVisibleBehaviorVar]: "initial"
7447
+ // reverts the var to guaranteed-invalid so `var(--_focusVisible-behavior, )` falls back to empty — there is no explicit `outset` keyword.
7448
+ };
7449
+ function mergeFocusVisibleInput(optionsFocusVisible, args) {
7450
+ return args.reduce((acc, arg2) => arg2 && "focusVisible" in arg2 ? deepmerge(acc, {
7451
+ focusVisible: arg2.focusVisible
7452
+ }) : acc, {
7453
+ focusVisible: optionsFocusVisible
7454
+ }).focusVisible;
7455
+ }
7456
+ function isResolvedFocusVisible(input) {
7457
+ return input != null && typeof input === "object" && typeof input.outlineOffset === "string" && input.outlineOffset.includes(focusVisibleOffsetVar);
7458
+ }
7459
+ function resolveFocusVisible(input, outlineColor2) {
7460
+ return wireFocusVisibleVars({
7461
+ outlineStyle: "solid",
7462
+ outlineColor: outlineColor2,
7463
+ outlineWidth: 2,
7464
+ outlineOffset: 2,
7465
+ // invisible shadow for parent component with solid background (AppBar, Snackbar, Alert) can control the ring color.
7466
+ boxShadow: `var(${focusVisibleShadowVar}, 0 0)`,
7467
+ ...input === true ? null : input
7468
+ });
7469
+ }
7470
+ function wireFocusVisibleVars(resolved) {
7471
+ const offset2 = resolved.outlineOffset ?? 0;
7472
+ if (typeof offset2 !== "string" || !offset2.includes(focusVisibleOffsetVar)) {
7473
+ const offsetPx = typeof offset2 === "number" ? `${offset2}px` : offset2;
7474
+ resolved.outlineOffset = `calc(${offsetValue} * ${offsetPx})`;
7475
+ }
7476
+ const standaloneBoxShadows = /* @__PURE__ */ new Set(["none", "initial", "inherit", "unset", "revert", "revert-layer"]);
7477
+ if (typeof resolved.boxShadow === "string" && !standaloneBoxShadows.has(resolved.boxShadow.trim().toLowerCase()) && !/\binset\b/.test(resolved.boxShadow) && !resolved.boxShadow.includes(focusVisibleBehaviorVar)) {
7478
+ resolved.boxShadow = `${behaviorValue} ${resolved.boxShadow}`;
7479
+ }
7480
+ return resolved;
7481
+ }
7274
7482
  function prepareTypographyVars(typography) {
7275
7483
  const vars = {};
7276
7484
  const entries = Object.entries(typography);
@@ -7392,6 +7600,8 @@ function createShadow(...px) {
7392
7600
  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
7601
  }
7394
7602
  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)];
7603
+ const DEFAULT_TRANSITION_PROPS$1 = ["all"];
7604
+ const EMPTY_OPTIONS$1 = {};
7395
7605
  const easing = {
7396
7606
  // This is the most common easing curve.
7397
7607
  easeInOut: "cubic-bezier(0.4, 0, 0.2, 1)",
@@ -7427,15 +7637,19 @@ function getAutoHeightDuration(height2) {
7427
7637
  return Math.min(Math.round((4 + 15 * constant2 ** 0.25 + constant2 / 5) * 10), 3e3);
7428
7638
  }
7429
7639
  function createTransitions(inputTransitions) {
7640
+ const transitions = {
7641
+ ...inputTransitions
7642
+ };
7643
+ delete transitions.reducedMotion;
7430
7644
  const mergedEasing = {
7431
7645
  ...easing,
7432
- ...inputTransitions.easing
7646
+ ...transitions.easing
7433
7647
  };
7434
7648
  const mergedDuration = {
7435
7649
  ...duration,
7436
- ...inputTransitions.duration
7650
+ ...transitions.duration
7437
7651
  };
7438
- const create = (props = ["all"], options = {}) => {
7652
+ const createTransitionValue = (props = DEFAULT_TRANSITION_PROPS$1, options = EMPTY_OPTIONS$1) => {
7439
7653
  const {
7440
7654
  duration: durationOption = mergedDuration.standard,
7441
7655
  easing: easingOption = mergedEasing.easeInOut,
@@ -7466,14 +7680,22 @@ function createTransitions(inputTransitions) {
7466
7680
  }
7467
7681
  return (Array.isArray(props) ? props : [props]).map((animatedProp) => `${animatedProp} ${typeof durationOption === "string" ? durationOption : formatMs(durationOption)} ${easingOption} ${typeof delay === "string" ? delay : formatMs(delay)}`).join(",");
7468
7682
  };
7683
+ const create = transitions.create ?? createTransitionValue;
7469
7684
  return {
7470
7685
  getAutoHeightDuration,
7471
7686
  create,
7472
- ...inputTransitions,
7687
+ ...transitions,
7473
7688
  easing: mergedEasing,
7474
7689
  duration: mergedDuration
7475
7690
  };
7476
7691
  }
7692
+ const EMPTY_MOTION = {};
7693
+ function createMotion(inputMotion = EMPTY_MOTION) {
7694
+ return {
7695
+ reducedMotion: "never",
7696
+ ...inputMotion
7697
+ };
7698
+ }
7477
7699
  const zIndex = {
7478
7700
  mobileStepper: 1e3,
7479
7701
  fab: 1050,
@@ -7495,7 +7717,7 @@ function stringifyTheme(baseTheme = {}) {
7495
7717
  const array = Object.entries(object);
7496
7718
  for (let index = 0; index < array.length; index++) {
7497
7719
  const [key, value] = array[index];
7498
- if (!isSerializable(value) || key.startsWith("unstable_")) {
7720
+ if (!isSerializable(value) || key.startsWith("unstable_") || key.startsWith("internal_")) {
7499
7721
  delete object[key];
7500
7722
  } else if (isPlainObject(value)) {
7501
7723
  object[key] = {
@@ -7511,19 +7733,70 @@ function stringifyTheme(baseTheme = {}) {
7511
7733
  const theme = ${JSON.stringify(serializableTheme, null, 2)};
7512
7734
 
7513
7735
  theme.breakpoints = createBreakpoints(theme.breakpoints || {});
7736
+ theme.motion = { reducedMotion: 'never', ...theme.motion };
7514
7737
  theme.transitions = createTransitions(theme.transitions || {});
7515
7738
 
7516
7739
  export default theme;`;
7517
7740
  }
7741
+ function coefficientToPercentage(coefficient) {
7742
+ if (typeof coefficient === "number") {
7743
+ return `${(coefficient * 100).toFixed(0)}%`;
7744
+ }
7745
+ return `calc((${coefficient}) * 100%)`;
7746
+ }
7747
+ const parseAddition = (str) => {
7748
+ if (!Number.isNaN(+str)) {
7749
+ return +str;
7750
+ }
7751
+ const numbers = str.match(/\d*\.?\d+/g);
7752
+ if (!numbers) {
7753
+ return 0;
7754
+ }
7755
+ let sum = 0;
7756
+ for (let i = 0; i < numbers.length; i += 1) {
7757
+ sum += +numbers[i];
7758
+ }
7759
+ return sum;
7760
+ };
7761
+ function attachColorManipulators(theme) {
7762
+ Object.assign(theme, {
7763
+ alpha(color2, coefficient) {
7764
+ const obj = this || theme;
7765
+ if (obj.colorSpace) {
7766
+ return `oklch(from ${color2} l c h / ${typeof coefficient === "string" ? `calc(${coefficient})` : coefficient})`;
7767
+ }
7768
+ if (obj.vars) {
7769
+ return `rgba(${color2.replace(/var\(--([^,\s)]+)(?:,[^)]+)?\)+/g, "var(--$1Channel)")} / ${typeof coefficient === "string" ? `calc(${coefficient})` : coefficient})`;
7770
+ }
7771
+ return alpha(color2, parseAddition(coefficient));
7772
+ },
7773
+ lighten(color2, coefficient) {
7774
+ const obj = this || theme;
7775
+ if (obj.colorSpace) {
7776
+ return `color-mix(in ${obj.colorSpace}, ${color2}, #fff ${coefficientToPercentage(coefficient)})`;
7777
+ }
7778
+ return lighten(color2, coefficient);
7779
+ },
7780
+ darken(color2, coefficient) {
7781
+ const obj = this || theme;
7782
+ if (obj.colorSpace) {
7783
+ return `color-mix(in ${obj.colorSpace}, ${color2}, #000 ${coefficientToPercentage(coefficient)})`;
7784
+ }
7785
+ return darken(color2, coefficient);
7786
+ }
7787
+ });
7788
+ }
7518
7789
  function createThemeNoVars(options = {}, ...args) {
7519
7790
  const {
7520
7791
  breakpoints: breakpointsInput,
7521
7792
  mixins: mixinsInput = {},
7522
7793
  spacing: spacingInput,
7523
7794
  palette: paletteInput = {},
7795
+ motion: motionInput = {},
7524
7796
  transitions: transitionsInput = {},
7525
7797
  typography: typographyInput = {},
7526
7798
  shape: shapeInput,
7799
+ colorSpace,
7527
7800
  ...other
7528
7801
  } = options;
7529
7802
  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 +7804,10 @@ function createThemeNoVars(options = {}, ...args) {
7531
7804
  options.generateThemeVars === void 0) {
7532
7805
  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
7806
  }
7534
- const palette = createPalette(paletteInput);
7807
+ const palette = createPalette({
7808
+ ...paletteInput,
7809
+ colorSpace
7810
+ });
7535
7811
  const systemTheme = createTheme$1(options);
7536
7812
  let muiTheme = deepmerge(systemTheme, {
7537
7813
  mixins: createMixins(systemTheme.breakpoints, mixinsInput),
@@ -7539,6 +7815,7 @@ function createThemeNoVars(options = {}, ...args) {
7539
7815
  // Don't use [...shadows] until you've verified its transpiled code is not invoking the iterator protocol.
7540
7816
  shadows: shadows.slice(),
7541
7817
  typography: createTypography(palette, typographyInput),
7818
+ motion: createMotion(motionInput),
7542
7819
  transitions: createTransitions(transitionsInput),
7543
7820
  zIndex: {
7544
7821
  ...zIndex
@@ -7546,6 +7823,10 @@ function createThemeNoVars(options = {}, ...args) {
7546
7823
  });
7547
7824
  muiTheme = deepmerge(muiTheme, other);
7548
7825
  muiTheme = args.reduce((acc, argument) => deepmerge(acc, argument), muiTheme);
7826
+ delete muiTheme.transitions.reducedMotion;
7827
+ if (muiTheme.focusVisible != null && muiTheme.focusVisible !== false) {
7828
+ muiTheme.focusVisible = resolveFocusVisible(muiTheme.focusVisible, muiTheme.palette.primary.main);
7829
+ }
7549
7830
  {
7550
7831
  const stateClasses = ["active", "checked", "completed", "disabled", "error", "expanded", "focused", "focusVisible", "required", "selected"];
7551
7832
  const traverse = (node2, component) => {
@@ -7583,6 +7864,7 @@ function createThemeNoVars(options = {}, ...args) {
7583
7864
  });
7584
7865
  };
7585
7866
  muiTheme.toRuntimeSource = stringifyTheme;
7867
+ attachColorManipulators(muiTheme);
7586
7868
  return muiTheme;
7587
7869
  }
7588
7870
  function getOverlayAlpha(elevation) {
@@ -7620,9 +7902,13 @@ function createColorScheme(options) {
7620
7902
  // need to cast to avoid module augmentation test
7621
7903
  opacity,
7622
7904
  overlays,
7623
- ...rest
7905
+ colorSpace,
7906
+ ...other
7624
7907
  } = options;
7625
- const palette = createPalette(paletteInput);
7908
+ const palette = createPalette({
7909
+ ...paletteInput,
7910
+ colorSpace
7911
+ });
7626
7912
  return {
7627
7913
  palette,
7628
7914
  opacity: {
@@ -7630,11 +7916,14 @@ function createColorScheme(options) {
7630
7916
  ...opacity
7631
7917
  },
7632
7918
  overlays: overlays || getOverlays(palette.mode),
7633
- ...rest
7919
+ ...other
7634
7920
  };
7635
7921
  }
7636
7922
  function shouldSkipGeneratingVar(keys2) {
7637
- return !!keys2[0].match(/(cssVarPrefix|colorSchemeSelector|rootSelector|typography|mixins|breakpoints|direction|transitions)/) || !!keys2[0].match(/sxConfig$/) || // ends with sxConfig
7923
+ return keys2[0] === "motion" || // Keep `focusVisible` inline: its values reference the per-component private vars
7924
+ // (`--_focusVisible-offset`/`-behavior`). Hoisted to a `:root` var they resolve where those
7925
+ // vars are unset, silently breaking the inner-ring inset.
7926
+ keys2[0] === "focusVisible" || !!keys2[0].match(/(cssVarPrefix|colorSchemeSelector|modularCssLayers|rootSelector|typography|mixins|breakpoints|direction|transitions)/) || !!keys2[0].match(/sxConfig$/) || // ends with sxConfig
7638
7927
  keys2[0] === "palette" && !!keys2[1]?.match(/(mode|contrastThreshold|tonalOffset)/);
7639
7928
  }
7640
7929
  const excludeVariablesFromRoot = (cssVarPrefix) => [...[...Array(25)].map((_, index) => `--${cssVarPrefix ? `${cssVarPrefix}-` : ""}overlays-${index}`), `--${cssVarPrefix ? `${cssVarPrefix}-` : ""}palette-AppBar-darkBg`, `--${cssVarPrefix ? `${cssVarPrefix}-` : ""}palette-AppBar-darkColor`];
@@ -7737,7 +8026,7 @@ const silent = (fn) => {
7737
8026
  return void 0;
7738
8027
  };
7739
8028
  const createGetCssVar = (cssVarPrefix = "mui") => createGetCssVar$1(cssVarPrefix);
7740
- function attachColorScheme$1(colorSchemes, scheme, restTheme, colorScheme) {
8029
+ function attachColorScheme$1(colorSpace, colorSchemes, scheme, restTheme, colorScheme) {
7741
8030
  if (!scheme) {
7742
8031
  return void 0;
7743
8032
  }
@@ -7749,7 +8038,8 @@ function attachColorScheme$1(colorSchemes, scheme, restTheme, colorScheme) {
7749
8038
  palette: {
7750
8039
  mode,
7751
8040
  ...scheme?.palette
7752
- }
8041
+ },
8042
+ colorSpace
7753
8043
  });
7754
8044
  return void 0;
7755
8045
  }
@@ -7761,7 +8051,8 @@ function attachColorScheme$1(colorSchemes, scheme, restTheme, colorScheme) {
7761
8051
  palette: {
7762
8052
  mode,
7763
8053
  ...scheme?.palette
7764
- }
8054
+ },
8055
+ colorSpace
7765
8056
  });
7766
8057
  colorSchemes[colorScheme] = {
7767
8058
  ...scheme,
@@ -7782,6 +8073,7 @@ function createThemeWithVars(options = {}, ...args) {
7782
8073
  defaultColorScheme: defaultColorSchemeInput,
7783
8074
  disableCssColorScheme = false,
7784
8075
  cssVarPrefix = "mui",
8076
+ nativeColor = false,
7785
8077
  shouldSkipGeneratingVar: shouldSkipGeneratingVar$1 = shouldSkipGeneratingVar,
7786
8078
  colorSchemeSelector: selector = colorSchemesInput.light && colorSchemesInput.dark ? "media" : void 0,
7787
8079
  rootSelector = ":root",
@@ -7806,12 +8098,16 @@ function createThemeWithVars(options = {}, ...args) {
7806
8098
  if (!defaultScheme) {
7807
8099
  throw new Error(`MUI: The \`colorSchemes.${defaultColorScheme}\` option is either missing or invalid.`);
7808
8100
  }
7809
- const muiTheme = attachColorScheme$1(colorSchemes, defaultScheme, input, defaultColorScheme);
8101
+ let colorSpace;
8102
+ if (nativeColor) {
8103
+ colorSpace = "oklch";
8104
+ }
8105
+ const muiTheme = attachColorScheme$1(colorSpace, colorSchemes, defaultScheme, input, defaultColorScheme);
7810
8106
  if (builtInLight && !colorSchemes.light) {
7811
- attachColorScheme$1(colorSchemes, builtInLight, void 0, "light");
8107
+ attachColorScheme$1(colorSpace, colorSchemes, builtInLight, void 0, "light");
7812
8108
  }
7813
8109
  if (builtInDark && !colorSchemes.dark) {
7814
- attachColorScheme$1(colorSchemes, builtInDark, void 0, "dark");
8110
+ attachColorScheme$1(colorSpace, colorSchemes, builtInDark, void 0, "dark");
7815
8111
  }
7816
8112
  let theme = {
7817
8113
  defaultColorScheme,
@@ -7843,12 +8139,28 @@ function createThemeWithVars(options = {}, ...args) {
7843
8139
  setColor(palette.common, "background", "#000");
7844
8140
  setColor(palette.common, "onBackground", "#fff");
7845
8141
  }
8142
+ function colorMix(method, color2, coefficient) {
8143
+ if (colorSpace) {
8144
+ let mixer;
8145
+ if (method === private_safeAlpha) {
8146
+ mixer = `transparent ${((1 - coefficient) * 100).toFixed(0)}%`;
8147
+ }
8148
+ if (method === private_safeDarken) {
8149
+ mixer = `#000 ${(coefficient * 100).toFixed(0)}%`;
8150
+ }
8151
+ if (method === private_safeLighten) {
8152
+ mixer = `#fff ${(coefficient * 100).toFixed(0)}%`;
8153
+ }
8154
+ return `color-mix(in ${colorSpace}, ${color2}, ${mixer})`;
8155
+ }
8156
+ return method(color2, coefficient);
8157
+ }
7846
8158
  assignNode(palette, ["Alert", "AppBar", "Avatar", "Button", "Chip", "FilledInput", "LinearProgress", "Skeleton", "Slider", "SnackbarContent", "SpeedDialAction", "StepConnector", "StepContent", "Switch", "TableCell", "Tooltip"]);
7847
8159
  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));
8160
+ setColor(palette.Alert, "errorColor", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-error-light") : palette.error.light, 0.6));
8161
+ setColor(palette.Alert, "infoColor", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-info-light") : palette.info.light, 0.6));
8162
+ setColor(palette.Alert, "successColor", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-success-light") : palette.success.light, 0.6));
8163
+ setColor(palette.Alert, "warningColor", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-warning-light") : palette.warning.light, 0.6));
7852
8164
  setColor(palette.Alert, "errorFilledBg", setCssVarColor("palette-error-main"));
7853
8165
  setColor(palette.Alert, "infoFilledBg", setCssVarColor("palette-info-main"));
7854
8166
  setColor(palette.Alert, "successFilledBg", setCssVarColor("palette-success-main"));
@@ -7857,10 +8169,10 @@ function createThemeWithVars(options = {}, ...args) {
7857
8169
  setColor(palette.Alert, "infoFilledColor", silent(() => palette.getContrastText(palette.info.main)));
7858
8170
  setColor(palette.Alert, "successFilledColor", silent(() => palette.getContrastText(palette.success.main)));
7859
8171
  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));
8172
+ setColor(palette.Alert, "errorStandardBg", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-error-light") : palette.error.light, 0.9));
8173
+ setColor(palette.Alert, "infoStandardBg", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-info-light") : palette.info.light, 0.9));
8174
+ setColor(palette.Alert, "successStandardBg", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-success-light") : palette.success.light, 0.9));
8175
+ setColor(palette.Alert, "warningStandardBg", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-warning-light") : palette.warning.light, 0.9));
7864
8176
  setColor(palette.Alert, "errorIconColor", setCssVarColor("palette-error-main"));
7865
8177
  setColor(palette.Alert, "infoIconColor", setCssVarColor("palette-info-main"));
7866
8178
  setColor(palette.Alert, "successIconColor", setCssVarColor("palette-success-main"));
@@ -7875,41 +8187,41 @@ function createThemeWithVars(options = {}, ...args) {
7875
8187
  setColor(palette.FilledInput, "bg", "rgba(0, 0, 0, 0.06)");
7876
8188
  setColor(palette.FilledInput, "hoverBg", "rgba(0, 0, 0, 0.09)");
7877
8189
  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);
8190
+ setColor(palette.LinearProgress, "primaryBg", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-primary-main") : palette.primary.main, 0.62));
8191
+ setColor(palette.LinearProgress, "secondaryBg", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-secondary-main") : palette.secondary.main, 0.62));
8192
+ setColor(palette.LinearProgress, "errorBg", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-error-main") : palette.error.main, 0.62));
8193
+ setColor(palette.LinearProgress, "infoBg", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-info-main") : palette.info.main, 0.62));
8194
+ setColor(palette.LinearProgress, "successBg", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-success-main") : palette.success.main, 0.62));
8195
+ setColor(palette.LinearProgress, "warningBg", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-warning-light") : palette.warning.main, 0.62));
8196
+ 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)`);
8197
+ setColor(palette.Slider, "primaryTrack", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-primary-main") : palette.primary.main, 0.62));
8198
+ setColor(palette.Slider, "secondaryTrack", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-secondary-main") : palette.secondary.main, 0.62));
8199
+ setColor(palette.Slider, "errorTrack", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-error-main") : palette.error.main, 0.62));
8200
+ setColor(palette.Slider, "infoTrack", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-info-main") : palette.info.main, 0.62));
8201
+ setColor(palette.Slider, "successTrack", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-success-main") : palette.success.main, 0.62));
8202
+ setColor(palette.Slider, "warningTrack", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-warning-main") : palette.warning.main, 0.62));
8203
+ const snackbarContentBackground = colorSpace ? colorMix(private_safeDarken, nativeColor ? getCssVar("palette-background-default") : palette.background.default, 0.6825) : private_safeEmphasize(palette.background.default, 0.8);
7892
8204
  setColor(palette.SnackbarContent, "bg", snackbarContentBackground);
7893
- setColor(palette.SnackbarContent, "color", silent(() => palette.getContrastText(snackbarContentBackground)));
8205
+ setColor(palette.SnackbarContent, "color", silent(() => colorSpace ? dark.text.primary : palette.getContrastText(snackbarContentBackground)));
7894
8206
  setColor(palette.SpeedDialAction, "fabHoverBg", private_safeEmphasize(palette.background.paper, 0.15));
7895
8207
  setColor(palette.StepConnector, "border", setCssVarColor("palette-grey-400"));
7896
8208
  setColor(palette.StepContent, "border", setCssVarColor("palette-grey-400"));
7897
8209
  setColor(palette.Switch, "defaultColor", setCssVarColor("palette-common-white"));
7898
8210
  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));
8211
+ setColor(palette.Switch, "primaryDisabledColor", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-primary-main") : palette.primary.main, 0.62));
8212
+ setColor(palette.Switch, "secondaryDisabledColor", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-secondary-main") : palette.secondary.main, 0.62));
8213
+ setColor(palette.Switch, "errorDisabledColor", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-error-main") : palette.error.main, 0.62));
8214
+ setColor(palette.Switch, "infoDisabledColor", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-info-main") : palette.info.main, 0.62));
8215
+ setColor(palette.Switch, "successDisabledColor", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-success-main") : palette.success.main, 0.62));
8216
+ setColor(palette.Switch, "warningDisabledColor", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-warning-main") : palette.warning.main, 0.62));
8217
+ setColor(palette.TableCell, "border", colorMix(private_safeLighten, private_safeAlpha(nativeColor ? getCssVar("palette-divider") : palette.divider, 1), 0.88));
8218
+ setColor(palette.Tooltip, "bg", colorMix(private_safeAlpha, nativeColor ? getCssVar("palette-grey-700") : palette.grey[700], 0.92));
7907
8219
  }
7908
8220
  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));
8221
+ setColor(palette.Alert, "errorColor", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-error-light") : palette.error.light, 0.6));
8222
+ setColor(palette.Alert, "infoColor", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-info-light") : palette.info.light, 0.6));
8223
+ setColor(palette.Alert, "successColor", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-success-light") : palette.success.light, 0.6));
8224
+ setColor(palette.Alert, "warningColor", colorMix(private_safeLighten, nativeColor ? getCssVar("palette-warning-light") : palette.warning.light, 0.6));
7913
8225
  setColor(palette.Alert, "errorFilledBg", setCssVarColor("palette-error-dark"));
7914
8226
  setColor(palette.Alert, "infoFilledBg", setCssVarColor("palette-info-dark"));
7915
8227
  setColor(palette.Alert, "successFilledBg", setCssVarColor("palette-success-dark"));
@@ -7918,10 +8230,10 @@ function createThemeWithVars(options = {}, ...args) {
7918
8230
  setColor(palette.Alert, "infoFilledColor", silent(() => palette.getContrastText(palette.info.dark)));
7919
8231
  setColor(palette.Alert, "successFilledColor", silent(() => palette.getContrastText(palette.success.dark)));
7920
8232
  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));
8233
+ setColor(palette.Alert, "errorStandardBg", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-error-light") : palette.error.light, 0.9));
8234
+ setColor(palette.Alert, "infoStandardBg", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-info-light") : palette.info.light, 0.9));
8235
+ setColor(palette.Alert, "successStandardBg", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-success-light") : palette.success.light, 0.9));
8236
+ setColor(palette.Alert, "warningStandardBg", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-warning-light") : palette.warning.light, 0.9));
7925
8237
  setColor(palette.Alert, "errorIconColor", setCssVarColor("palette-error-main"));
7926
8238
  setColor(palette.Alert, "infoIconColor", setCssVarColor("palette-info-main"));
7927
8239
  setColor(palette.Alert, "successIconColor", setCssVarColor("palette-success-main"));
@@ -7938,44 +8250,46 @@ function createThemeWithVars(options = {}, ...args) {
7938
8250
  setColor(palette.FilledInput, "bg", "rgba(255, 255, 255, 0.09)");
7939
8251
  setColor(palette.FilledInput, "hoverBg", "rgba(255, 255, 255, 0.13)");
7940
8252
  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);
8253
+ setColor(palette.LinearProgress, "primaryBg", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-primary-main") : palette.primary.main, 0.5));
8254
+ setColor(palette.LinearProgress, "secondaryBg", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-secondary-main") : palette.secondary.main, 0.5));
8255
+ setColor(palette.LinearProgress, "errorBg", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-error-main") : palette.error.main, 0.5));
8256
+ setColor(palette.LinearProgress, "infoBg", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-info-main") : palette.info.main, 0.5));
8257
+ setColor(palette.LinearProgress, "successBg", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-success-main") : palette.success.main, 0.5));
8258
+ setColor(palette.LinearProgress, "warningBg", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-warning-main") : palette.warning.main, 0.5));
8259
+ 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)`);
8260
+ setColor(palette.Slider, "primaryTrack", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-primary-main") : palette.primary.main, 0.5));
8261
+ setColor(palette.Slider, "secondaryTrack", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-secondary-main") : palette.secondary.main, 0.5));
8262
+ setColor(palette.Slider, "errorTrack", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-error-main") : palette.error.main, 0.5));
8263
+ setColor(palette.Slider, "infoTrack", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-info-main") : palette.info.main, 0.5));
8264
+ setColor(palette.Slider, "successTrack", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-success-main") : palette.success.main, 0.5));
8265
+ setColor(palette.Slider, "warningTrack", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-warning-light") : palette.warning.main, 0.5));
8266
+ const snackbarContentBackground = colorSpace ? colorMix(private_safeLighten, nativeColor ? getCssVar("palette-background-default") : palette.background.default, 0.985) : private_safeEmphasize(palette.background.default, 0.98);
7955
8267
  setColor(palette.SnackbarContent, "bg", snackbarContentBackground);
7956
- setColor(palette.SnackbarContent, "color", silent(() => palette.getContrastText(snackbarContentBackground)));
8268
+ setColor(palette.SnackbarContent, "color", silent(() => colorSpace ? light.text.primary : palette.getContrastText(snackbarContentBackground)));
7957
8269
  setColor(palette.SpeedDialAction, "fabHoverBg", private_safeEmphasize(palette.background.paper, 0.15));
7958
8270
  setColor(palette.StepConnector, "border", setCssVarColor("palette-grey-600"));
7959
8271
  setColor(palette.StepContent, "border", setCssVarColor("palette-grey-600"));
7960
8272
  setColor(palette.Switch, "defaultColor", setCssVarColor("palette-grey-300"));
7961
8273
  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");
8274
+ setColor(palette.Switch, "primaryDisabledColor", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-primary-main") : palette.primary.main, 0.55));
8275
+ setColor(palette.Switch, "secondaryDisabledColor", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-secondary-main") : palette.secondary.main, 0.55));
8276
+ setColor(palette.Switch, "errorDisabledColor", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-error-main") : palette.error.main, 0.55));
8277
+ setColor(palette.Switch, "infoDisabledColor", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-info-main") : palette.info.main, 0.55));
8278
+ setColor(palette.Switch, "successDisabledColor", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-success-main") : palette.success.main, 0.55));
8279
+ setColor(palette.Switch, "warningDisabledColor", colorMix(private_safeDarken, nativeColor ? getCssVar("palette-warning-light") : palette.warning.main, 0.55));
8280
+ setColor(palette.TableCell, "border", colorMix(private_safeDarken, private_safeAlpha(nativeColor ? getCssVar("palette-divider") : palette.divider, 1), 0.68));
8281
+ setColor(palette.Tooltip, "bg", colorMix(private_safeAlpha, nativeColor ? getCssVar("palette-grey-700") : palette.grey[700], 0.92));
8282
+ }
8283
+ if (!nativeColor) {
8284
+ setColorChannel(palette.background, "default");
8285
+ setColorChannel(palette.background, "paper");
8286
+ setColorChannel(palette.common, "background");
8287
+ setColorChannel(palette.common, "onBackground");
8288
+ setColorChannel(palette, "divider");
8289
+ }
7976
8290
  Object.keys(palette).forEach((color2) => {
7977
8291
  const colors = palette[color2];
7978
- if (color2 !== "tonalOffset" && colors && typeof colors === "object") {
8292
+ if (color2 !== "tonalOffset" && !nativeColor && colors && typeof colors === "object") {
7979
8293
  if (colors.main) {
7980
8294
  setColor(palette[color2], "mainChannel", private_safeColorChannel(toRgb(colors.main)));
7981
8295
  }
@@ -8004,11 +8318,16 @@ function createThemeWithVars(options = {}, ...args) {
8004
8318
  });
8005
8319
  });
8006
8320
  theme = args.reduce((acc, argument) => deepmerge(acc, argument), theme);
8321
+ const focusVisibleInput = mergeFocusVisibleInput(options.focusVisible, args);
8322
+ if (focusVisibleInput != null && focusVisibleInput !== false) {
8323
+ theme.focusVisible = resolveFocusVisible(focusVisibleInput, getCssVar("palette-primary-main"));
8324
+ }
8007
8325
  const parserConfig = {
8008
8326
  prefix: cssVarPrefix,
8009
8327
  disableCssColorScheme,
8010
8328
  shouldSkipGeneratingVar: shouldSkipGeneratingVar$1,
8011
- getSelector: defaultGetSelector(theme)
8329
+ getSelector: defaultGetSelector(theme),
8330
+ enableContrastVars: nativeColor
8012
8331
  };
8013
8332
  const {
8014
8333
  vars,
@@ -8037,6 +8356,7 @@ function createThemeWithVars(options = {}, ...args) {
8037
8356
  theme: this
8038
8357
  });
8039
8358
  };
8359
+ theme.internal_cache = {};
8040
8360
  theme.toRuntimeSource = stringifyTheme;
8041
8361
  return theme;
8042
8362
  }
@@ -8063,7 +8383,7 @@ function createTheme(options = {}, ...args) {
8063
8383
  light: true
8064
8384
  } : void 0,
8065
8385
  defaultColorScheme: initialDefaultColorScheme = palette?.mode,
8066
- ...rest
8386
+ ...other
8067
8387
  } = options;
8068
8388
  const defaultColorSchemeInput = initialDefaultColorScheme || "light";
8069
8389
  const defaultScheme = initialColorSchemes?.[defaultColorSchemeInput];
@@ -8112,18 +8432,133 @@ function createTheme(options = {}, ...args) {
8112
8432
  };
8113
8433
  attachColorScheme(theme, "light", colorSchemesInput.light);
8114
8434
  }
8435
+ if (theme.focusVisible != null && theme.focusVisible !== false) {
8436
+ let focusVisibleInput = theme.focusVisible;
8437
+ const rawFocusVisible = mergeFocusVisibleInput(options.focusVisible, args);
8438
+ const authoredColor = rawFocusVisible && typeof rawFocusVisible === "object" ? rawFocusVisible.outlineColor : void 0;
8439
+ if (!authoredColor || isResolvedFocusVisible(rawFocusVisible) && authoredColor === theme.palette.primary.main) {
8440
+ const {
8441
+ outlineColor: outlineColor2,
8442
+ ...rest
8443
+ } = focusVisibleInput;
8444
+ focusVisibleInput = rest;
8445
+ }
8446
+ Object.keys(theme.colorSchemes).forEach((scheme) => {
8447
+ const schemePalette = theme.colorSchemes?.[scheme]?.palette;
8448
+ if (schemePalette?.primary) {
8449
+ theme.colorSchemes[scheme].focusVisible = resolveFocusVisible(focusVisibleInput, schemePalette.primary.main);
8450
+ }
8451
+ });
8452
+ }
8115
8453
  return theme;
8116
8454
  }
8117
8455
  if (!palette && !("light" in colorSchemesInput) && defaultColorSchemeInput === "light") {
8118
8456
  colorSchemesInput.light = true;
8119
8457
  }
8120
8458
  return createThemeWithVars({
8121
- ...rest,
8459
+ ...other,
8122
8460
  colorSchemes: colorSchemesInput,
8123
8461
  defaultColorScheme: defaultColorSchemeInput,
8124
8462
  ...typeof cssVariables !== "boolean" && cssVariables
8125
8463
  }, ...args);
8126
8464
  }
8465
+ function getCheckboxUtilityClass(slot) {
8466
+ return generateUtilityClass("MuiCheckbox", slot);
8467
+ }
8468
+ const checkboxClasses = generateUtilityClasses("MuiCheckbox", ["root", "checked", "disabled", "indeterminate", "colorPrimary", "colorSecondary", "sizeSmall", "sizeMedium"]);
8469
+ function chainPropTypes(propType1, propType2) {
8470
+ return function validate(...args) {
8471
+ return propType1(...args) || propType2(...args);
8472
+ };
8473
+ }
8474
+ function isClassComponent(elementType) {
8475
+ const {
8476
+ prototype = {}
8477
+ } = elementType;
8478
+ return Boolean(prototype.isReactComponent);
8479
+ }
8480
+ function elementTypeAcceptingRef(props, propName, componentName, location, propFullName) {
8481
+ const propValue = props[propName];
8482
+ const safePropName = propFullName || propName;
8483
+ if (propValue == null || // When server-side rendering React doesn't warn either.
8484
+ // This is not an accurate check for SSR.
8485
+ // This is only in place for emotion compat.
8486
+ // TODO: Revisit once https://github.com/react/react/issues/20047 is resolved.
8487
+ typeof window === "undefined") {
8488
+ return null;
8489
+ }
8490
+ let warningHint;
8491
+ if (typeof propValue === "function" && !isClassComponent(propValue)) {
8492
+ warningHint = "Did you accidentally provide a plain function component instead?";
8493
+ }
8494
+ if (propValue === React.Fragment) {
8495
+ warningHint = "Did you accidentally provide a React.Fragment instead?";
8496
+ }
8497
+ if (warningHint !== void 0) {
8498
+ 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`);
8499
+ }
8500
+ return null;
8501
+ }
8502
+ const elementTypeAcceptingRef$1 = chainPropTypes(PropTypes.elementType, elementTypeAcceptingRef);
8503
+ const refType = PropTypes.oneOfType([PropTypes.func, PropTypes.object]);
8504
+ function isHostComponent(element) {
8505
+ return typeof element === "string";
8506
+ }
8507
+ function useForkRef$1(...refs) {
8508
+ const cleanupRef = React.useRef(void 0);
8509
+ const refEffect = React.useCallback((instance) => {
8510
+ const cleanups = refs.map((ref) => {
8511
+ if (ref == null) {
8512
+ return null;
8513
+ }
8514
+ if (typeof ref === "function") {
8515
+ const refCallback = ref;
8516
+ const refCleanup = refCallback(instance);
8517
+ return typeof refCleanup === "function" ? refCleanup : () => {
8518
+ refCallback(null);
8519
+ };
8520
+ }
8521
+ ref.current = instance;
8522
+ return () => {
8523
+ ref.current = null;
8524
+ };
8525
+ });
8526
+ return () => {
8527
+ cleanups.forEach((refCleanup) => refCleanup?.());
8528
+ };
8529
+ }, refs);
8530
+ return React.useMemo(() => {
8531
+ if (refs.every((ref) => ref == null)) {
8532
+ return null;
8533
+ }
8534
+ return (value) => {
8535
+ if (cleanupRef.current) {
8536
+ cleanupRef.current();
8537
+ cleanupRef.current = void 0;
8538
+ }
8539
+ if (value != null) {
8540
+ cleanupRef.current = refEffect(value);
8541
+ }
8542
+ };
8543
+ }, refs);
8544
+ }
8545
+ function useEventCallback(fn) {
8546
+ const ref = React.useRef(fn);
8547
+ useEnhancedEffect$1(() => {
8548
+ ref.current = fn;
8549
+ });
8550
+ return React.useRef((...args) => (
8551
+ // @ts-expect-error hide `this`
8552
+ (0, ref.current)(...args)
8553
+ )).current;
8554
+ }
8555
+ const FormControlContext = /* @__PURE__ */ React.createContext(void 0);
8556
+ {
8557
+ FormControlContext.displayName = "FormControlContext";
8558
+ }
8559
+ function useFormControl() {
8560
+ return React.useContext(FormControlContext);
8561
+ }
8127
8562
  const defaultTheme = createTheme();
8128
8563
  function useTheme() {
8129
8564
  const theme = useTheme$1(defaultTheme);
@@ -8141,20 +8576,6 @@ const styled = createStyled2({
8141
8576
  defaultTheme,
8142
8577
  rootShouldForwardProp
8143
8578
  });
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
8579
  const memoTheme = unstable_memoTheme;
8159
8580
  ({
8160
8581
  // ┌────────────────────────────── Warning ──────────────────────────────┐
@@ -8173,6 +8594,52 @@ const memoTheme = unstable_memoTheme;
8173
8594
  function useDefaultProps(params) {
8174
8595
  return useDefaultProps$1(params);
8175
8596
  }
8597
+ const defaultStyles = {
8598
+ transition: "none"
8599
+ };
8600
+ function resolveReducedMotionStyles(reducedMotion, styles) {
8601
+ if (reducedMotion === "always") {
8602
+ return styles;
8603
+ }
8604
+ if (reducedMotion === "system") {
8605
+ return {
8606
+ "@media (prefers-reduced-motion: reduce)": styles
8607
+ };
8608
+ }
8609
+ return null;
8610
+ }
8611
+ const EMPTY_STYLE = {};
8612
+ const DEFAULT_TRANSITION_PROPS = ["all"];
8613
+ const EMPTY_OPTIONS = {};
8614
+ function getReducedMotionStyles(theme, styles) {
8615
+ const resolvedStyles = defaultStyles;
8616
+ return resolveReducedMotionStyles(theme.motion?.reducedMotion, resolvedStyles);
8617
+ }
8618
+ function getTransitionStyles(theme, props = DEFAULT_TRANSITION_PROPS, options = EMPTY_OPTIONS) {
8619
+ const transition = theme.transitions?.create?.(props, options);
8620
+ const reducedMotionStyles = getReducedMotionStyles(theme);
8621
+ if (transition === void 0) {
8622
+ return reducedMotionStyles ?? EMPTY_STYLE;
8623
+ }
8624
+ const transitionStyles = {
8625
+ transition
8626
+ };
8627
+ return reducedMotionStyles ? {
8628
+ ...transitionStyles,
8629
+ ...reducedMotionStyles
8630
+ } : transitionStyles;
8631
+ }
8632
+ const { makeStyles } = createMakeAndWithStyles({
8633
+ useTheme
8634
+ });
8635
+ const { tss } = createTss({
8636
+ "useContext": function useContext2() {
8637
+ const theme = useTheme();
8638
+ return { theme };
8639
+ },
8640
+ "usePlugin": useMuiThemeStyleOverridesPlugin
8641
+ });
8642
+ const useStyles$3 = tss.create({});
8176
8643
  function getSvgIconUtilityClass(slot) {
8177
8644
  return generateUtilityClass("MuiSvgIcon", slot);
8178
8645
  }
@@ -8205,7 +8672,7 @@ const SvgIconRoot = styled("svg", {
8205
8672
  height: "1em",
8206
8673
  display: "inline-block",
8207
8674
  flexShrink: 0,
8208
- transition: theme.transitions?.create?.("fill", {
8675
+ ...getTransitionStyles(theme, "fill", {
8209
8676
  duration: (theme.vars ?? theme).transitions?.duration?.shorter
8210
8677
  }),
8211
8678
  variants: [
@@ -8451,7 +8918,7 @@ function useControlled(props) {
8451
8918
  current: defaultValue
8452
8919
  } = React.useRef(defaultProp);
8453
8920
  React.useEffect(() => {
8454
- if (!isControlled && !Object.is(defaultValue, defaultProp)) {
8921
+ if (!isControlled && JSON.stringify(defaultProp) !== JSON.stringify(defaultValue)) {
8455
8922
  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
8923
  }
8457
8924
  }, [JSON.stringify(defaultProp)]);
@@ -8463,69 +8930,21 @@ function useControlled(props) {
8463
8930
  }, []);
8464
8931
  return [value, setValueIfUncontrolled];
8465
8932
  }
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;
8933
+ function isEventHandler(key, value) {
8934
+ const thirdCharCode = key.charCodeAt(2);
8935
+ return key[0] === "o" && key[1] === "n" && thirdCharCode >= 65 && thirdCharCode <= 90 && typeof value === "function";
8475
8936
  }
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);
8937
+ function mergeSlotProps$1(externalSlotProps, defaultSlotProps) {
8938
+ if (!externalSlotProps) {
8939
+ return defaultSlotProps;
8940
+ }
8941
+ function extractHandlers(externalSlotPropsValue, defaultSlotPropsValue) {
8942
+ const handlers2 = {};
8943
+ Object.keys(defaultSlotPropsValue).forEach((key) => {
8944
+ if (isEventHandler(key, defaultSlotPropsValue[key]) && typeof externalSlotPropsValue[key] === "function") {
8945
+ handlers2[key] = (...args) => {
8946
+ externalSlotPropsValue[key](...args);
8947
+ defaultSlotPropsValue[key](...args);
8529
8948
  };
8530
8949
  }
8531
8950
  });
@@ -8580,258 +8999,6 @@ function mergeSlotProps$1(externalSlotProps, defaultSlotProps) {
8580
8999
  }
8581
9000
  };
8582
9001
  }
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
9002
  const UNINITIALIZED = {};
8836
9003
  function useLazyRef(init, initArg) {
8837
9004
  const ref = React.useRef(UNINITIALIZED);
@@ -8840,68 +9007,96 @@ function useLazyRef(init, initArg) {
8840
9007
  }
8841
9008
  return ref;
8842
9009
  }
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;
9010
+ const MEDIA_QUERY = "(prefers-reduced-motion: reduce)";
9011
+ const REDUCED_MOTION_DURATION = 0;
9012
+ const REDUCED_MOTION_DELAY = "0ms";
9013
+ const NOOP$1 = () => {
9014
+ };
9015
+ const getDefaultSnapshot = () => false;
9016
+ const getReducedMotionSnapshot = () => true;
9017
+ const subscribeNoop = () => NOOP$1;
9018
+ function useReducedMotionMediaQueryOld(enabled) {
9019
+ const [queryState, setQueryState] = React.useState(() => ({
9020
+ enabled,
9021
+ matches: enabled ? null : false
9022
+ }));
9023
+ let matches = queryState.matches;
9024
+ if (queryState.enabled !== enabled) {
9025
+ matches = null;
9026
+ if (!enabled) {
9027
+ matches = false;
8866
9028
  }
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
- }
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
9029
  }
8900
- return null;
9030
+ useEnhancedEffect$1(() => {
9031
+ const setResolvedMatches = (nextMatches) => {
9032
+ setQueryState((previousState) => {
9033
+ if (previousState.enabled === enabled && previousState.matches === nextMatches) {
9034
+ return previousState;
9035
+ }
9036
+ return {
9037
+ enabled,
9038
+ matches: nextMatches
9039
+ };
9040
+ });
9041
+ };
9042
+ if (!enabled) {
9043
+ if (queryState.enabled) {
9044
+ setResolvedMatches(false);
9045
+ }
9046
+ return void 0;
9047
+ }
9048
+ if (typeof window === "undefined" || typeof window.matchMedia !== "function") {
9049
+ setResolvedMatches(false);
9050
+ return void 0;
9051
+ }
9052
+ const mediaQueryList = window.matchMedia(MEDIA_QUERY);
9053
+ const update2 = () => {
9054
+ setResolvedMatches(mediaQueryList.matches);
9055
+ };
9056
+ update2();
9057
+ mediaQueryList.addEventListener("change", update2);
9058
+ return () => {
9059
+ mediaQueryList.removeEventListener("change", update2);
9060
+ };
9061
+ }, [enabled, queryState.enabled]);
9062
+ return matches;
8901
9063
  }
8902
- const elementTypeAcceptingRef$1 = chainPropTypes(PropTypes.elementType, elementTypeAcceptingRef);
8903
- function isHostComponent(element) {
8904
- return typeof element === "string";
9064
+ const safeReact = {
9065
+ ...React
9066
+ };
9067
+ const maybeReactUseSyncExternalStore = safeReact.useSyncExternalStore;
9068
+ function useReducedMotionMediaQueryNew(enabled) {
9069
+ const getServerSnapshot = enabled ? getReducedMotionSnapshot : getDefaultSnapshot;
9070
+ const [getSnapshot, subscribe] = React.useMemo(() => {
9071
+ if (!enabled || typeof window === "undefined" || typeof window.matchMedia !== "function") {
9072
+ return [getDefaultSnapshot, subscribeNoop];
9073
+ }
9074
+ const mediaQueryList = window.matchMedia(MEDIA_QUERY);
9075
+ return [() => mediaQueryList.matches, (notify) => {
9076
+ mediaQueryList.addEventListener("change", notify);
9077
+ return () => {
9078
+ mediaQueryList.removeEventListener("change", notify);
9079
+ };
9080
+ }];
9081
+ }, [enabled]);
9082
+ return maybeReactUseSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
9083
+ }
9084
+ const useReducedMotionMediaQuery = maybeReactUseSyncExternalStore !== void 0 ? useReducedMotionMediaQueryNew : useReducedMotionMediaQueryOld;
9085
+ function useReducedMotion(mode, disablePrefersReducedMotion) {
9086
+ const prefersReducedMotion = useReducedMotionMediaQuery(mode === "system");
9087
+ const shouldReduceMotion = mode === "always" || mode === "system" && prefersReducedMotion !== false;
9088
+ return React.useMemo(() => ({
9089
+ shouldReduceMotion,
9090
+ getTransitionTiming(timing) {
9091
+ if (!shouldReduceMotion) {
9092
+ return timing;
9093
+ }
9094
+ return {
9095
+ duration: REDUCED_MOTION_DURATION,
9096
+ delay: REDUCED_MOTION_DELAY
9097
+ };
9098
+ }
9099
+ }), [shouldReduceMotion]);
8905
9100
  }
8906
9101
  function appendOwnerState(elementType, otherProps, ownerState) {
8907
9102
  if (elementType === void 0 || isHostComponent(elementType)) {
@@ -8921,14 +9116,16 @@ function resolveComponentProps(componentProps, ownerState, slotState) {
8921
9116
  }
8922
9117
  return componentProps;
8923
9118
  }
8924
- function extractEventHandlers(object, excludeKeys = []) {
9119
+ function extractEventHandlers(object) {
8925
9120
  if (object === void 0) {
8926
9121
  return {};
8927
9122
  }
8928
9123
  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
- });
9124
+ for (const prop of Object.keys(object)) {
9125
+ if (isEventHandler(prop, object[prop])) {
9126
+ result[prop] = object[prop];
9127
+ }
9128
+ }
8932
9129
  return result;
8933
9130
  }
8934
9131
  function omitEventHandlers(object) {
@@ -9053,17 +9250,200 @@ function useSlot(name, parameters) {
9053
9250
  }, ownerState);
9054
9251
  return [elementType, props];
9055
9252
  }
9056
- const refType = PropTypes.oneOfType([PropTypes.func, PropTypes.object]);
9057
9253
  function isFocusVisible(element) {
9058
9254
  try {
9059
9255
  return element.matches(":focus-visible");
9060
9256
  } catch (error) {
9061
- if (!/jsdom/.test(window.navigator.userAgent)) {
9257
+ if (!window.navigator.userAgent.includes("jsdom")) {
9062
9258
  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
9259
  }
9064
9260
  }
9065
9261
  return false;
9066
9262
  }
9263
+ function useFocusableWhenDisabled(parameters) {
9264
+ const {
9265
+ focusableWhenDisabled,
9266
+ disabled,
9267
+ composite = false,
9268
+ tabIndex: tabIndexProp = 0,
9269
+ isNativeButton
9270
+ } = parameters;
9271
+ const isFocusableComposite = composite && focusableWhenDisabled !== false;
9272
+ const isNonFocusableComposite = composite && focusableWhenDisabled === false;
9273
+ const props = React.useMemo(() => {
9274
+ const additionalProps = {
9275
+ // allow Tabbing away from focusableWhenDisabled elements
9276
+ onKeyDown(event) {
9277
+ if (disabled && focusableWhenDisabled && event.key !== "Tab") {
9278
+ event.preventDefault();
9279
+ }
9280
+ }
9281
+ };
9282
+ if (!composite) {
9283
+ additionalProps.tabIndex = tabIndexProp;
9284
+ if (!isNativeButton && disabled) {
9285
+ additionalProps.tabIndex = focusableWhenDisabled ? tabIndexProp : -1;
9286
+ }
9287
+ }
9288
+ if (isNativeButton && (focusableWhenDisabled || isFocusableComposite) || !isNativeButton && disabled) {
9289
+ additionalProps["aria-disabled"] = disabled;
9290
+ }
9291
+ if (isNativeButton && (!focusableWhenDisabled || isNonFocusableComposite)) {
9292
+ additionalProps.disabled = disabled;
9293
+ }
9294
+ return additionalProps;
9295
+ }, [composite, disabled, focusableWhenDisabled, isFocusableComposite, isNonFocusableComposite, isNativeButton, tabIndexProp]);
9296
+ return props;
9297
+ }
9298
+ const EMPTY$2 = {};
9299
+ function useButtonBase(parameters) {
9300
+ const {
9301
+ nativeButton,
9302
+ nativeButtonProp,
9303
+ internalNativeButton = nativeButton,
9304
+ allowInferredHostMismatch = false,
9305
+ disabled,
9306
+ type,
9307
+ hasFormAction = false,
9308
+ tabIndex = 0,
9309
+ focusableWhenDisabled: focusableWhenDisabledParam,
9310
+ stopEventPropagation = false,
9311
+ onBeforeKeyDown,
9312
+ onBeforeKeyUp
9313
+ } = parameters;
9314
+ const rootRef = React.useRef(null);
9315
+ const focusableWhenDisabled = focusableWhenDisabledParam === true;
9316
+ const focusableWhenDisabledProps = useFocusableWhenDisabled({
9317
+ focusableWhenDisabled,
9318
+ disabled,
9319
+ isNativeButton: nativeButton,
9320
+ tabIndex
9321
+ });
9322
+ {
9323
+ React.useEffect(() => {
9324
+ const root2 = rootRef.current;
9325
+ if (root2 == null) {
9326
+ return;
9327
+ }
9328
+ const isButtonTag = root2.tagName === "BUTTON";
9329
+ if (nativeButtonProp !== void 0) {
9330
+ if (nativeButtonProp && !isButtonTag) {
9331
+ 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`.";
9332
+ console.error(message);
9333
+ }
9334
+ if (!nativeButtonProp && isButtonTag) {
9335
+ 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`.";
9336
+ console.error(message);
9337
+ }
9338
+ return;
9339
+ }
9340
+ if (allowInferredHostMismatch) {
9341
+ return;
9342
+ }
9343
+ if (internalNativeButton && !isButtonTag) {
9344
+ 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.";
9345
+ console.error(message);
9346
+ }
9347
+ if (!internalNativeButton && isButtonTag) {
9348
+ 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.";
9349
+ console.error(message);
9350
+ }
9351
+ }, [allowInferredHostMismatch, internalNativeButton, nativeButtonProp]);
9352
+ }
9353
+ const hasNativeKeyboardActivation = React.useCallback(() => {
9354
+ const root2 = rootRef.current;
9355
+ if (root2 == null) {
9356
+ return nativeButton;
9357
+ }
9358
+ if (root2.tagName === "BUTTON") {
9359
+ return true;
9360
+ }
9361
+ return Boolean(root2.tagName === "A" && root2.href);
9362
+ }, [nativeButton]);
9363
+ const buttonProps = React.useMemo(() => {
9364
+ const resolvedButtonProps = focusableWhenDisabled ? {} : {
9365
+ tabIndex: disabled ? -1 : tabIndex
9366
+ };
9367
+ if (nativeButton) {
9368
+ resolvedButtonProps.type = type === void 0 && !hasFormAction ? "button" : type;
9369
+ if (!focusableWhenDisabled) {
9370
+ resolvedButtonProps.disabled = disabled;
9371
+ }
9372
+ } else {
9373
+ resolvedButtonProps.role = "button";
9374
+ if (!focusableWhenDisabled && disabled) {
9375
+ resolvedButtonProps["aria-disabled"] = disabled;
9376
+ }
9377
+ }
9378
+ if (focusableWhenDisabled) {
9379
+ return {
9380
+ ...resolvedButtonProps,
9381
+ ...focusableWhenDisabledProps
9382
+ };
9383
+ }
9384
+ return resolvedButtonProps;
9385
+ }, [disabled, focusableWhenDisabled, focusableWhenDisabledProps, hasFormAction, nativeButton, tabIndex, type]);
9386
+ const getButtonProps = React.useCallback((externalProps = EMPTY$2) => {
9387
+ const {
9388
+ onClick: externalOnClick,
9389
+ onKeyDown: externalOnKeyDown,
9390
+ onKeyUp: externalOnKeyUp,
9391
+ ...otherExternalProps
9392
+ } = externalProps;
9393
+ const handleClick = (event) => {
9394
+ if (stopEventPropagation) {
9395
+ event.stopPropagation();
9396
+ }
9397
+ if (disabled) {
9398
+ event.preventDefault();
9399
+ return;
9400
+ }
9401
+ externalOnClick?.(event);
9402
+ };
9403
+ const handleKeyDown = (event) => {
9404
+ if (focusableWhenDisabled) {
9405
+ focusableWhenDisabledProps.onKeyDown(event);
9406
+ }
9407
+ if (disabled) {
9408
+ return;
9409
+ }
9410
+ onBeforeKeyDown?.(event);
9411
+ externalOnKeyDown?.(event);
9412
+ if (event.target !== event.currentTarget || hasNativeKeyboardActivation()) {
9413
+ return;
9414
+ }
9415
+ if (event.key === " ") {
9416
+ event.preventDefault();
9417
+ return;
9418
+ }
9419
+ if (event.key === "Enter") {
9420
+ event.preventDefault();
9421
+ event.currentTarget.click();
9422
+ }
9423
+ };
9424
+ const handleKeyUp = (event) => {
9425
+ if (disabled) {
9426
+ return;
9427
+ }
9428
+ onBeforeKeyUp?.(event);
9429
+ externalOnKeyUp?.(event);
9430
+ if (event.target === event.currentTarget && !hasNativeKeyboardActivation() && event.key === " " && !event.defaultPrevented) {
9431
+ event.currentTarget.click();
9432
+ }
9433
+ };
9434
+ return {
9435
+ ...buttonProps,
9436
+ ...otherExternalProps,
9437
+ onClick: handleClick,
9438
+ onKeyDown: handleKeyDown,
9439
+ onKeyUp: handleKeyUp
9440
+ };
9441
+ }, [buttonProps, disabled, focusableWhenDisabled, focusableWhenDisabledProps, hasNativeKeyboardActivation, onBeforeKeyDown, onBeforeKeyUp, stopEventPropagation]);
9442
+ return {
9443
+ getButtonProps,
9444
+ rootRef
9445
+ };
9446
+ }
9067
9447
  class LazyRipple {
9068
9448
  /** React ref to the ripple instance */
9069
9449
  /** If the ripple component should be mounted */
@@ -9131,6 +9511,40 @@ function createControlledPromise() {
9131
9511
  p.reject = reject;
9132
9512
  return p;
9133
9513
  }
9514
+ const EMPTY$1 = [];
9515
+ function useOnMount(fn) {
9516
+ React.useEffect(fn, EMPTY$1);
9517
+ }
9518
+ class Timeout {
9519
+ static create() {
9520
+ return new Timeout();
9521
+ }
9522
+ currentId = null;
9523
+ /**
9524
+ * Executes `fn` after `delay`, clearing any previously scheduled call.
9525
+ */
9526
+ start(delay, fn) {
9527
+ this.clear();
9528
+ this.currentId = setTimeout(() => {
9529
+ this.currentId = null;
9530
+ fn();
9531
+ }, delay);
9532
+ }
9533
+ clear = () => {
9534
+ if (this.currentId !== null) {
9535
+ clearTimeout(this.currentId);
9536
+ this.currentId = null;
9537
+ }
9538
+ };
9539
+ disposeEffect = () => {
9540
+ return this.clear;
9541
+ };
9542
+ }
9543
+ function useTimeout() {
9544
+ const timeout = useLazyRef(Timeout.create).current;
9545
+ useOnMount(timeout.disposeEffect);
9546
+ return timeout;
9547
+ }
9134
9548
  function Ripple(props) {
9135
9549
  const {
9136
9550
  className,
@@ -9144,6 +9558,11 @@ function Ripple(props) {
9144
9558
  timeout
9145
9559
  } = props;
9146
9560
  const [leaving, setLeaving] = React.useState(false);
9561
+ const exitTimer = useTimeout();
9562
+ const exitTimerStartedRef = React.useRef(false);
9563
+ const onExitedRef = React.useRef(onExited);
9564
+ onExitedRef.current = onExited;
9565
+ const hasExitedCallback = onExited != null;
9147
9566
  const rippleClassName = clsx$1(className, classes.ripple, classes.rippleVisible, pulsate && classes.ripplePulsate);
9148
9567
  const rippleStyles = {
9149
9568
  width: rippleSize,
@@ -9156,14 +9575,19 @@ function Ripple(props) {
9156
9575
  setLeaving(true);
9157
9576
  }
9158
9577
  React.useEffect(() => {
9159
- if (!inProp && onExited != null) {
9160
- const timeoutId = setTimeout(onExited, timeout);
9161
- return () => {
9162
- clearTimeout(timeoutId);
9163
- };
9578
+ if (!inProp && hasExitedCallback) {
9579
+ if (!exitTimerStartedRef.current) {
9580
+ exitTimerStartedRef.current = true;
9581
+ exitTimer.start(timeout, () => {
9582
+ exitTimerStartedRef.current = false;
9583
+ onExitedRef.current?.();
9584
+ });
9585
+ }
9586
+ } else {
9587
+ exitTimerStartedRef.current = false;
9588
+ exitTimer.clear();
9164
9589
  }
9165
- return void 0;
9166
- }, [onExited, inProp, timeout]);
9590
+ }, [exitTimer, hasExitedCallback, inProp, timeout]);
9167
9591
  return /* @__PURE__ */ jsx$1("span", {
9168
9592
  className: rippleClassName,
9169
9593
  style: rippleStyles,
@@ -9179,11 +9603,11 @@ Ripple.propTypes = {
9179
9603
  classes: PropTypes.object.isRequired,
9180
9604
  className: PropTypes.string,
9181
9605
  /**
9182
- * @ignore - injected from TransitionGroup
9606
+ * @ignore - controlled by TouchRipple
9183
9607
  */
9184
9608
  in: PropTypes.bool,
9185
9609
  /**
9186
- * @ignore - injected from TransitionGroup
9610
+ * @ignore - controlled by TouchRipple
9187
9611
  */
9188
9612
  onExited: PropTypes.func,
9189
9613
  /**
@@ -9203,13 +9627,83 @@ Ripple.propTypes = {
9203
9627
  */
9204
9628
  rippleY: PropTypes.number,
9205
9629
  /**
9206
- * exit delay
9630
+ * Exit delay.
9207
9631
  */
9208
9632
  timeout: PropTypes.number.isRequired
9209
9633
  };
9210
9634
  const touchRippleClasses = generateUtilityClasses("MuiTouchRipple", ["root", "ripple", "rippleVisible", "ripplePulsate", "child", "childLeaving", "childPulsate"]);
9211
9635
  const DURATION = 550;
9212
9636
  const DELAY_RIPPLE = 80;
9637
+ const EMPTY_OBJ = {};
9638
+ const EMPTY_ARRAY = [];
9639
+ const NOOP = () => {
9640
+ };
9641
+ function mergeRippleOrder(prevOrder, nextActiveKeys) {
9642
+ const nextKeySet = new Set(nextActiveKeys);
9643
+ const nextKeysPending = /* @__PURE__ */ new Map();
9644
+ let pendingKeys = [];
9645
+ for (const prevKey of prevOrder) {
9646
+ if (nextKeySet.has(prevKey)) {
9647
+ if (pendingKeys.length > 0) {
9648
+ nextKeysPending.set(prevKey, pendingKeys);
9649
+ pendingKeys = [];
9650
+ }
9651
+ } else {
9652
+ pendingKeys.push(prevKey);
9653
+ }
9654
+ }
9655
+ const nextOrder = [];
9656
+ for (const nextKey of nextActiveKeys) {
9657
+ const pendingBefore = nextKeysPending.get(nextKey);
9658
+ if (pendingBefore) {
9659
+ nextOrder.push(...pendingBefore);
9660
+ }
9661
+ nextOrder.push(nextKey);
9662
+ }
9663
+ nextOrder.push(...pendingKeys);
9664
+ return nextOrder;
9665
+ }
9666
+ function computeRippleState({
9667
+ event,
9668
+ element,
9669
+ center
9670
+ }) {
9671
+ const rect = element ? element.getBoundingClientRect() : {
9672
+ width: 0,
9673
+ height: 0,
9674
+ left: 0,
9675
+ top: 0
9676
+ };
9677
+ let rippleX;
9678
+ let rippleY;
9679
+ if (center || event === void 0 || event.clientX === 0 && event.clientY === 0 || !event.clientX && !event.touches) {
9680
+ rippleX = Math.round(rect.width / 2);
9681
+ rippleY = Math.round(rect.height / 2);
9682
+ } else {
9683
+ const {
9684
+ clientX,
9685
+ clientY
9686
+ } = event.touches && event.touches.length > 0 ? event.touches[0] : event;
9687
+ rippleX = Math.round(clientX - rect.left);
9688
+ rippleY = Math.round(clientY - rect.top);
9689
+ }
9690
+ let rippleSize;
9691
+ if (center) {
9692
+ rippleSize = Math.sqrt((2 * rect.width ** 2 + rect.height ** 2) / 3);
9693
+ if (rippleSize % 2 === 0) {
9694
+ rippleSize += 1;
9695
+ }
9696
+ } else {
9697
+ const sizeX = Math.max(Math.abs((element ? element.clientWidth : 0) - rippleX), rippleX) * 2 + 2;
9698
+ const sizeY = Math.max(Math.abs((element ? element.clientHeight : 0) - rippleY), rippleY) * 2 + 2;
9699
+ rippleSize = Math.sqrt(sizeX ** 2 + sizeY ** 2);
9700
+ }
9701
+ return {
9702
+ rippleX,
9703
+ rippleY,
9704
+ rippleSize
9705
+ };
9706
+ }
9213
9707
  const enterKeyframe = keyframes`
9214
9708
  0% {
9215
9709
  transform: scale(0);
@@ -9242,7 +9736,45 @@ const pulsateKeyframe = keyframes`
9242
9736
  100% {
9243
9737
  transform: scale(1);
9244
9738
  }
9245
- `;
9739
+ `;
9740
+ function getAnimationStyles(theme) {
9741
+ if (theme.motion.reducedMotion === "always") {
9742
+ return null;
9743
+ }
9744
+ const styles = css`
9745
+ &.${touchRippleClasses.rippleVisible} {
9746
+ animation-name: ${enterKeyframe};
9747
+ animation-duration: ${DURATION}ms;
9748
+ animation-timing-function: ${theme.transitions.easing.easeInOut};
9749
+ }
9750
+
9751
+ &.${touchRippleClasses.ripplePulsate} {
9752
+ animation-duration: ${theme.transitions.duration.shorter}ms;
9753
+ }
9754
+
9755
+ & .${touchRippleClasses.childLeaving} {
9756
+ animation-name: ${exitKeyframe};
9757
+ animation-duration: ${DURATION}ms;
9758
+ animation-timing-function: ${theme.transitions.easing.easeInOut};
9759
+ }
9760
+
9761
+ & .${touchRippleClasses.childPulsate} {
9762
+ animation-name: ${pulsateKeyframe};
9763
+ animation-duration: 2500ms;
9764
+ animation-timing-function: ${theme.transitions.easing.easeInOut};
9765
+ animation-iteration-count: infinite;
9766
+ animation-delay: 200ms;
9767
+ }
9768
+ `;
9769
+ if (theme.motion.reducedMotion === "system") {
9770
+ return css`
9771
+ @media (prefers-reduced-motion: no-preference) {
9772
+ ${styles}
9773
+ }
9774
+ `;
9775
+ }
9776
+ return styles;
9777
+ }
9246
9778
  const TouchRippleRoot = styled("span", {
9247
9779
  name: "MuiTouchRipple",
9248
9780
  slot: "Root"
@@ -9267,19 +9799,16 @@ const TouchRippleRipple = styled(Ripple, {
9267
9799
  &.${touchRippleClasses.rippleVisible} {
9268
9800
  opacity: 0.3;
9269
9801
  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
9802
  }
9282
9803
 
9804
+ /*
9805
+ * Order matters: 'child', 'childLeaving' and 'childPulsate' apply to the same
9806
+ * element with equal specificity, so the later rule wins. 'child' must come
9807
+ * before 'childLeaving' so the leaving 'opacity: 0' takes precedence. A focus
9808
+ * (pulsate) ripple keeps 'pulsateKeyframe' (no opacity animation) on exit, so
9809
+ * it relies on this static 'opacity: 0' to disappear on blur instead of
9810
+ * lingering until removal.
9811
+ */
9283
9812
  & .${touchRippleClasses.child} {
9284
9813
  opacity: 1;
9285
9814
  display: block;
@@ -9291,11 +9820,6 @@ const TouchRippleRipple = styled(Ripple, {
9291
9820
 
9292
9821
  & .${touchRippleClasses.childLeaving} {
9293
9822
  opacity: 0;
9294
- animation-name: ${exitKeyframe};
9295
- animation-duration: ${DURATION}ms;
9296
- animation-timing-function: ${({
9297
- theme
9298
- }) => theme.transitions.easing.easeInOut};
9299
9823
  }
9300
9824
 
9301
9825
  & .${touchRippleClasses.childPulsate} {
@@ -9303,29 +9827,39 @@ const TouchRippleRipple = styled(Ripple, {
9303
9827
  /* @noflip */
9304
9828
  left: 0px;
9305
9829
  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
9830
  }
9831
+
9832
+ ${({
9833
+ theme
9834
+ }) => getAnimationStyles(theme)}
9314
9835
  `;
9315
9836
  const TouchRipple = /* @__PURE__ */ React.forwardRef(function TouchRipple2(inProps, ref) {
9316
9837
  const props = useDefaultProps({
9317
9838
  props: inProps,
9318
9839
  name: "MuiTouchRipple"
9319
9840
  });
9841
+ const theme = useTheme();
9842
+ const reducedMotion = useReducedMotion(theme.motion.reducedMotion);
9320
9843
  const {
9321
9844
  center: centerProp = false,
9322
- classes = {},
9845
+ classes = EMPTY_OBJ,
9323
9846
  className,
9324
9847
  ...other
9325
9848
  } = props;
9326
- const [ripples, setRipples] = React.useState([]);
9849
+ const [rippleState, setRippleState] = React.useState({
9850
+ items: EMPTY_ARRAY,
9851
+ order: EMPTY_ARRAY
9852
+ });
9853
+ const ripples = rippleState.items;
9327
9854
  const nextKey = React.useRef(0);
9328
9855
  const rippleCallback = React.useRef(null);
9856
+ const mountedRef = React.useRef(false);
9857
+ useOnMount(() => {
9858
+ mountedRef.current = true;
9859
+ return () => {
9860
+ mountedRef.current = false;
9861
+ };
9862
+ });
9329
9863
  React.useEffect(() => {
9330
9864
  if (rippleCallback.current) {
9331
9865
  rippleCallback.current();
@@ -9335,8 +9869,21 @@ const TouchRipple = /* @__PURE__ */ React.forwardRef(function TouchRipple2(inPro
9335
9869
  const ignoringMouseDown = React.useRef(false);
9336
9870
  const startTimer = useTimeout();
9337
9871
  const startTimerCommit = React.useRef(null);
9338
- const container = React.useRef(null);
9339
- const startCommit = React.useCallback((params) => {
9872
+ const container2 = React.useRef(null);
9873
+ const handleExited = useEventCallback((key) => {
9874
+ if (!mountedRef.current) {
9875
+ return;
9876
+ }
9877
+ setRippleState((prevState) => {
9878
+ const nextItems = prevState.items.filter((ripple) => ripple.key !== key);
9879
+ const nextOrder = mergeRippleOrder(prevState.order.filter((rippleKey) => rippleKey !== key), nextItems.filter((ripple) => !ripple.exiting).map((ripple) => ripple.key));
9880
+ return {
9881
+ items: nextItems,
9882
+ order: nextOrder
9883
+ };
9884
+ });
9885
+ });
9886
+ const startCommit = useEventCallback((params) => {
9340
9887
  const {
9341
9888
  pulsate: pulsate2,
9342
9889
  rippleX,
@@ -9344,31 +9891,30 @@ const TouchRipple = /* @__PURE__ */ React.forwardRef(function TouchRipple2(inPro
9344
9891
  rippleSize,
9345
9892
  cb
9346
9893
  } = 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)]);
9894
+ const key = nextKey.current;
9362
9895
  nextKey.current += 1;
9896
+ setRippleState((prevState) => {
9897
+ const nextItems = [...prevState.items, {
9898
+ key,
9899
+ pulsate: pulsate2,
9900
+ rippleX,
9901
+ rippleY,
9902
+ rippleSize,
9903
+ exiting: false
9904
+ }];
9905
+ return {
9906
+ items: nextItems,
9907
+ order: mergeRippleOrder(prevState.order, nextItems.filter((ripple) => !ripple.exiting).map((ripple) => ripple.key))
9908
+ };
9909
+ });
9363
9910
  rippleCallback.current = cb;
9364
- }, [classes]);
9365
- const start = React.useCallback((event = {}, options = {}, cb = () => {
9366
- }) => {
9911
+ });
9912
+ const start = useEventCallback((event = EMPTY_OBJ, options = EMPTY_OBJ, cb = NOOP) => {
9367
9913
  const {
9368
9914
  pulsate: pulsate2 = false,
9369
9915
  center = centerProp || options.pulsate,
9370
9916
  fakeElement = false
9371
- // For test purposes
9917
+ // Used only by tests.
9372
9918
  } = options;
9373
9919
  if (event?.type === "mousedown" && ignoringMouseDown.current) {
9374
9920
  ignoringMouseDown.current = false;
@@ -9377,37 +9923,16 @@ const TouchRipple = /* @__PURE__ */ React.forwardRef(function TouchRipple2(inPro
9377
9923
  if (event?.type === "touchstart") {
9378
9924
  ignoringMouseDown.current = true;
9379
9925
  }
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
- }
9926
+ const element = fakeElement ? null : container2.current;
9927
+ const {
9928
+ rippleX,
9929
+ rippleY,
9930
+ rippleSize
9931
+ } = computeRippleState({
9932
+ event,
9933
+ element,
9934
+ center
9935
+ });
9411
9936
  if (event?.touches) {
9412
9937
  if (startTimerCommit.current === null) {
9413
9938
  startTimerCommit.current = () => {
@@ -9435,13 +9960,13 @@ const TouchRipple = /* @__PURE__ */ React.forwardRef(function TouchRipple2(inPro
9435
9960
  cb
9436
9961
  });
9437
9962
  }
9438
- }, [centerProp, startCommit, startTimer]);
9439
- const pulsate = React.useCallback(() => {
9440
- start({}, {
9963
+ });
9964
+ const pulsate = useEventCallback(() => {
9965
+ start(EMPTY_OBJ, {
9441
9966
  pulsate: true
9442
9967
  });
9443
- }, [start]);
9444
- const stop = React.useCallback((event, cb) => {
9968
+ });
9969
+ const stop = useEventCallback((event, cb) => {
9445
9970
  startTimer.clear();
9446
9971
  if (event?.type === "touchend" && startTimerCommit.current) {
9447
9972
  startTimerCommit.current();
@@ -9452,28 +9977,51 @@ const TouchRipple = /* @__PURE__ */ React.forwardRef(function TouchRipple2(inPro
9452
9977
  return;
9453
9978
  }
9454
9979
  startTimerCommit.current = null;
9455
- setRipples((oldRipples) => {
9456
- if (oldRipples.length > 0) {
9457
- return oldRipples.slice(1);
9458
- }
9459
- return oldRipples;
9980
+ setRippleState((prevState) => {
9981
+ const firstActiveIndex = prevState.items.findIndex((ripple) => !ripple.exiting);
9982
+ if (firstActiveIndex === -1) {
9983
+ return prevState;
9984
+ }
9985
+ const nextItems = prevState.items.slice();
9986
+ nextItems[firstActiveIndex] = {
9987
+ ...nextItems[firstActiveIndex],
9988
+ exiting: true
9989
+ };
9990
+ return {
9991
+ items: nextItems,
9992
+ order: mergeRippleOrder(prevState.order, nextItems.filter((ripple) => !ripple.exiting).map((ripple) => ripple.key))
9993
+ };
9460
9994
  });
9461
9995
  rippleCallback.current = cb;
9462
- }, [startTimer]);
9996
+ });
9463
9997
  React.useImperativeHandle(ref, () => ({
9464
9998
  pulsate,
9465
9999
  start,
9466
10000
  stop
9467
10001
  }), [pulsate, start, stop]);
10002
+ const rippleByKey = new Map(ripples.map((ripple) => [ripple.key, ripple]));
10003
+ const orderedRipples = rippleState.order.map((rippleKey) => rippleByKey.get(rippleKey)).filter(Boolean);
9468
10004
  return /* @__PURE__ */ jsx$1(TouchRippleRoot, {
9469
10005
  className: clsx$1(touchRippleClasses.root, classes.root, className),
9470
- ref: container,
10006
+ ref: container2,
9471
10007
  ...other,
9472
- children: /* @__PURE__ */ jsx$1(TransitionGroup, {
9473
- component: null,
9474
- exit: true,
9475
- children: ripples
9476
- })
10008
+ children: orderedRipples.map((ripple) => /* @__PURE__ */ jsx$1(TouchRippleRipple, {
10009
+ classes: {
10010
+ ripple: clsx$1(classes.ripple, touchRippleClasses.ripple),
10011
+ rippleVisible: clsx$1(classes.rippleVisible, touchRippleClasses.rippleVisible),
10012
+ ripplePulsate: clsx$1(classes.ripplePulsate, touchRippleClasses.ripplePulsate),
10013
+ child: clsx$1(classes.child, touchRippleClasses.child),
10014
+ childLeaving: clsx$1(classes.childLeaving, touchRippleClasses.childLeaving),
10015
+ childPulsate: clsx$1(classes.childPulsate, touchRippleClasses.childPulsate)
10016
+ },
10017
+ timeout: reducedMotion.shouldReduceMotion ? 0 : DURATION,
10018
+ pulsate: ripple.pulsate,
10019
+ rippleX: ripple.rippleX,
10020
+ rippleY: ripple.rippleY,
10021
+ rippleSize: ripple.rippleSize,
10022
+ in: !ripple.exiting,
10023
+ onExited: () => handleExited(ripple.key)
10024
+ }, ripple.key))
9477
10025
  });
9478
10026
  });
9479
10027
  TouchRipple.propTypes = {
@@ -9500,13 +10048,14 @@ const useUtilityClasses$5 = (ownerState) => {
9500
10048
  disabled,
9501
10049
  focusVisible,
9502
10050
  focusVisibleClassName,
10051
+ suppressFocusVisible,
9503
10052
  classes
9504
10053
  } = ownerState;
9505
10054
  const slots = {
9506
- root: ["root", disabled && "disabled", focusVisible && "focusVisible"]
10055
+ root: ["root", disabled && "disabled", focusVisible && !suppressFocusVisible && "focusVisible"]
9507
10056
  };
9508
10057
  const composedClasses = composeClasses(slots, getButtonBaseUtilityClass, classes);
9509
- if (focusVisible && focusVisibleClassName) {
10058
+ if (focusVisible && !suppressFocusVisible && focusVisibleClassName) {
9510
10059
  composedClasses.root += ` ${focusVisibleClassName}`;
9511
10060
  }
9512
10061
  return composedClasses;
@@ -9514,7 +10063,9 @@ const useUtilityClasses$5 = (ownerState) => {
9514
10063
  const ButtonBaseRoot = styled("button", {
9515
10064
  name: "MuiButtonBase",
9516
10065
  slot: "Root"
9517
- })({
10066
+ })(memoTheme(({
10067
+ theme
10068
+ }) => ({
9518
10069
  display: "inline-flex",
9519
10070
  alignItems: "center",
9520
10071
  justifyContent: "center",
@@ -9552,8 +10103,17 @@ const ButtonBaseRoot = styled("button", {
9552
10103
  },
9553
10104
  "@media print": {
9554
10105
  colorAdjust: "exact"
9555
- }
9556
- });
10106
+ },
10107
+ variants: [{
10108
+ props: {
10109
+ internalDisabledThemeFocusVisible: false
10110
+ },
10111
+ style: theme.focusVisible && {
10112
+ ...outsetFocusRing,
10113
+ [`&.${buttonBaseClasses.focusVisible}`]: theme.focusVisible
10114
+ }
10115
+ }]
10116
+ })));
9557
10117
  const ButtonBase = /* @__PURE__ */ React.forwardRef(function ButtonBase2(inProps, ref) {
9558
10118
  const props = useDefaultProps({
9559
10119
  props: inProps,
@@ -9570,15 +10130,27 @@ const ButtonBase = /* @__PURE__ */ React.forwardRef(function ButtonBase2(inProps
9570
10130
  disableTouchRipple = false,
9571
10131
  focusRipple = false,
9572
10132
  focusVisibleClassName,
10133
+ /* eslint-disable react/prop-types */
10134
+ // replaces internal handling in Chip, other components can opt-in individually to use this in the future
10135
+ focusableWhenDisabled,
10136
+ // escape hatch to suppress the focusVisible state and callback
10137
+ // used by anchored <Menu>s to to suppress focus visible styling when opened with a pointer
10138
+ suppressFocusVisible = false,
10139
+ // private prop to allow native vs non-native button props to be resolved before mount
10140
+ internalNativeButton: internalNativeButtonProp,
10141
+ // private prop to let a parent (like SwitchBase) control its own focus visible style
10142
+ internalDisabledThemeFocusVisible = false,
10143
+ /* eslint-enable react/prop-types */
9573
10144
  LinkComponent = "a",
10145
+ nativeButton: nativeButtonProp,
9574
10146
  onBlur,
9575
- onClick,
10147
+ onClick: onClickProp,
9576
10148
  onContextMenu,
9577
10149
  onDragLeave,
9578
10150
  onFocus,
9579
10151
  onFocusVisible,
9580
- onKeyDown,
9581
- onKeyUp,
10152
+ onKeyDown: onKeyDownProp,
10153
+ onKeyUp: onKeyUpProp,
9582
10154
  onMouseDown,
9583
10155
  onMouseLeave,
9584
10156
  onMouseUp,
@@ -9591,19 +10163,65 @@ const ButtonBase = /* @__PURE__ */ React.forwardRef(function ButtonBase2(inProps
9591
10163
  type,
9592
10164
  ...other
9593
10165
  } = props;
9594
- const buttonRef = React.useRef(null);
10166
+ const isLink = Boolean(other.href || other.to);
10167
+ const hasFormAction = Boolean(other.formAction);
10168
+ let ComponentProp = component;
10169
+ if (ComponentProp === "button" && isLink) {
10170
+ ComponentProp = LinkComponent;
10171
+ }
10172
+ const internalNativeButton = typeof ComponentProp === "string" ? ComponentProp === "button" : internalNativeButtonProp ?? false;
10173
+ const nativeButton = nativeButtonProp ?? internalNativeButton;
9595
10174
  const ripple = useLazyRipple();
9596
10175
  const handleRippleRef = useForkRef$1(ripple.ref, touchRippleRef);
9597
10176
  const [focusVisible, setFocusVisible] = React.useState(false);
9598
- if (disabled && focusVisible) {
10177
+ if ((disabled || suppressFocusVisible) && focusVisible) {
9599
10178
  setFocusVisible(false);
9600
10179
  }
10180
+ const handleBeforeKeyDown = useEventCallback((event) => {
10181
+ if (focusRipple && !event.repeat && focusVisible && event.key === " ") {
10182
+ ripple.stop(event, () => {
10183
+ ripple.start(event);
10184
+ });
10185
+ }
10186
+ });
10187
+ const handleBeforeKeyUp = useEventCallback((event) => {
10188
+ if (focusRipple && event.key === " " && focusVisible && !event.defaultPrevented) {
10189
+ ripple.stop(event, () => {
10190
+ ripple.pulsate(event);
10191
+ });
10192
+ }
10193
+ });
10194
+ const {
10195
+ getButtonProps,
10196
+ rootRef: buttonRef
10197
+ } = useButtonBase({
10198
+ nativeButton,
10199
+ nativeButtonProp,
10200
+ internalNativeButton,
10201
+ allowInferredHostMismatch: isLink || typeof ComponentProp === "string",
10202
+ disabled,
10203
+ type,
10204
+ hasFormAction,
10205
+ tabIndex,
10206
+ onBeforeKeyDown: handleBeforeKeyDown,
10207
+ onBeforeKeyUp: handleBeforeKeyUp
10208
+ });
10209
+ const {
10210
+ onClick,
10211
+ onKeyDown,
10212
+ onKeyUp,
10213
+ ...buttonProps
10214
+ } = getButtonProps({
10215
+ onClick: onClickProp,
10216
+ onKeyDown: onKeyDownProp,
10217
+ onKeyUp: onKeyUpProp
10218
+ });
9601
10219
  React.useImperativeHandle(action, () => ({
9602
10220
  focusVisible: () => {
9603
10221
  setFocusVisible(true);
9604
10222
  buttonRef.current.focus();
9605
10223
  }
9606
- }), []);
10224
+ }), [buttonRef]);
9607
10225
  const enableTouchRipple = ripple.shouldMount && !disableRipple && !disabled;
9608
10226
  React.useEffect(() => {
9609
10227
  if (focusVisible && focusRipple && !disableRipple) {
@@ -9637,7 +10255,7 @@ const ButtonBase = /* @__PURE__ */ React.forwardRef(function ButtonBase2(inProps
9637
10255
  if (!buttonRef.current) {
9638
10256
  buttonRef.current = event.currentTarget;
9639
10257
  }
9640
- if (isFocusVisible(event.target)) {
10258
+ if (!suppressFocusVisible && isFocusVisible(event.target)) {
9641
10259
  setFocusVisible(true);
9642
10260
  if (onFocusVisible) {
9643
10261
  onFocusVisible(event);
@@ -9647,57 +10265,13 @@ const ButtonBase = /* @__PURE__ */ React.forwardRef(function ButtonBase2(inProps
9647
10265
  onFocus(event);
9648
10266
  }
9649
10267
  });
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
- }
10268
+ const linkProps = {};
10269
+ if (isLink) {
10270
+ linkProps.tabIndex = disabled ? -1 : tabIndex;
9698
10271
  if (disabled) {
9699
- buttonProps["aria-disabled"] = disabled;
10272
+ linkProps["aria-disabled"] = disabled;
9700
10273
  }
10274
+ linkProps.type = type;
9701
10275
  }
9702
10276
  const handleRef = useForkRef$1(ref, buttonRef);
9703
10277
  const ownerState = {
@@ -9708,8 +10282,10 @@ const ButtonBase = /* @__PURE__ */ React.forwardRef(function ButtonBase2(inProps
9708
10282
  disableRipple,
9709
10283
  disableTouchRipple,
9710
10284
  focusRipple,
10285
+ suppressFocusVisible,
9711
10286
  tabIndex,
9712
- focusVisible
10287
+ focusVisible,
10288
+ internalDisabledThemeFocusVisible
9713
10289
  };
9714
10290
  const classes = useUtilityClasses$5(ownerState);
9715
10291
  return /* @__PURE__ */ jsxs(ButtonBaseRoot, {
@@ -9720,8 +10296,8 @@ const ButtonBase = /* @__PURE__ */ React.forwardRef(function ButtonBase2(inProps
9720
10296
  onClick,
9721
10297
  onContextMenu: handleContextMenu,
9722
10298
  onFocus: handleFocus,
9723
- onKeyDown: handleKeyDown,
9724
- onKeyUp: handleKeyUp,
10299
+ onKeyDown,
10300
+ onKeyUp,
9725
10301
  onMouseDown: handleMouseDown,
9726
10302
  onMouseLeave: handleMouseLeave,
9727
10303
  onMouseUp: handleMouseUp,
@@ -9730,9 +10306,7 @@ const ButtonBase = /* @__PURE__ */ React.forwardRef(function ButtonBase2(inProps
9730
10306
  onTouchMove: handleTouchMove,
9731
10307
  onTouchStart: handleTouchStart,
9732
10308
  ref: handleRef,
9733
- tabIndex: disabled ? -1 : tabIndex,
9734
- type,
9735
- ...buttonProps,
10309
+ ...isLink ? linkProps : buttonProps,
9736
10310
  ...other,
9737
10311
  children: [children2, enableTouchRipple ? /* @__PURE__ */ jsx$1(TouchRipple, {
9738
10312
  ref: handleRippleRef,
@@ -9817,6 +10391,10 @@ ButtonBase.propTypes = {
9817
10391
  * if needed.
9818
10392
  */
9819
10393
  focusVisibleClassName: PropTypes.string,
10394
+ /**
10395
+ * @ignore
10396
+ */
10397
+ formAction: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
9820
10398
  /**
9821
10399
  * @ignore
9822
10400
  */
@@ -9826,6 +10404,11 @@ ButtonBase.propTypes = {
9826
10404
  * @default 'a'
9827
10405
  */
9828
10406
  LinkComponent: PropTypes.elementType,
10407
+ /**
10408
+ * Whether the custom component is expected to render a native `<button>` element
10409
+ * when passing a React component to the `component` or `slots` prop.
10410
+ */
10411
+ nativeButton: PropTypes.bool,
9829
10412
  /**
9830
10413
  * @ignore
9831
10414
  */
@@ -9906,9 +10489,12 @@ ButtonBase.propTypes = {
9906
10489
  })
9907
10490
  })]),
9908
10491
  /**
9909
- * @ignore
10492
+ * The HTML [`type`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/button#type)
10493
+ * attribute applied to `button` and `a` elements.
10494
+ * Ignored when rendering non-native buttons.
10495
+ * @default 'button'
9910
10496
  */
9911
- type: PropTypes.oneOfType([PropTypes.oneOf(["button", "reset", "submit"]), PropTypes.string])
10497
+ type: PropTypes.string
9912
10498
  };
9913
10499
  function hasCorrectMainProperty(obj) {
9914
10500
  return typeof obj.main === "string";
@@ -9944,22 +10530,22 @@ function getReactElementRef(element) {
9944
10530
  }
9945
10531
  return element?.ref || null;
9946
10532
  }
9947
- function getContainer(container) {
9948
- return typeof container === "function" ? container() : container;
10533
+ function getContainer(container2) {
10534
+ return typeof container2 === "function" ? container2() : container2;
9949
10535
  }
9950
10536
  const Portal = /* @__PURE__ */ React.forwardRef(function Portal2(props, forwardedRef) {
9951
10537
  const {
9952
10538
  children: children2,
9953
- container,
10539
+ container: container2,
9954
10540
  disablePortal = false
9955
10541
  } = props;
9956
10542
  const [mountNode, setMountNode] = React.useState(null);
9957
10543
  const handleRef = useForkRef$1(/* @__PURE__ */ React.isValidElement(children2) ? getReactElementRef(children2) : null, forwardedRef);
9958
10544
  useEnhancedEffect$1(() => {
9959
10545
  if (!disablePortal) {
9960
- setMountNode(getContainer(container) || document.body);
10546
+ setMountNode(getContainer(container2) || document.body);
9961
10547
  }
9962
- }, [container, disablePortal]);
10548
+ }, [container2, disablePortal]);
9963
10549
  useEnhancedEffect$1(() => {
9964
10550
  if (mountNode && !disablePortal) {
9965
10551
  setRef$1(forwardedRef, mountNode);
@@ -10009,13 +10595,6 @@ Portal.propTypes = {
10009
10595
  {
10010
10596
  Portal["propTypes"] = exactProp(Portal.propTypes);
10011
10597
  }
10012
- const FormControlContext = /* @__PURE__ */ React.createContext(void 0);
10013
- {
10014
- FormControlContext.displayName = "FormControlContext";
10015
- }
10016
- function useFormControl() {
10017
- return React.useContext(FormControlContext);
10018
- }
10019
10598
  function getSwitchBaseUtilityClass(slot) {
10020
10599
  return generateUtilityClass("PrivateSwitchBase", slot);
10021
10600
  }
@@ -10033,7 +10612,9 @@ const useUtilityClasses$4 = (ownerState) => {
10033
10612
  };
10034
10613
  return composeClasses(slots, getSwitchBaseUtilityClass, classes);
10035
10614
  };
10036
- const SwitchBaseRoot = styled(ButtonBase)({
10615
+ const SwitchBaseRoot = styled(ButtonBase, {
10616
+ name: "MuiSwitchBase"
10617
+ })({
10037
10618
  padding: 9,
10038
10619
  borderRadius: "50%",
10039
10620
  variants: [{
@@ -10071,6 +10652,7 @@ const SwitchBaseRoot = styled(ButtonBase)({
10071
10652
  }]
10072
10653
  });
10073
10654
  const SwitchBaseInput = styled("input", {
10655
+ name: "MuiSwitchBase",
10074
10656
  shouldForwardProp: rootShouldForwardProp
10075
10657
  })({
10076
10658
  cursor: "inherit",
@@ -10095,8 +10677,6 @@ const SwitchBase = /* @__PURE__ */ React.forwardRef(function SwitchBase2(props,
10095
10677
  edge = false,
10096
10678
  icon,
10097
10679
  id,
10098
- inputProps,
10099
- inputRef,
10100
10680
  name,
10101
10681
  onBlur,
10102
10682
  onChange,
@@ -10110,6 +10690,10 @@ const SwitchBase = /* @__PURE__ */ React.forwardRef(function SwitchBase2(props,
10110
10690
  slotProps = {},
10111
10691
  ...other
10112
10692
  } = props;
10693
+ const {
10694
+ nativeButton,
10695
+ ...buttonBaseProps
10696
+ } = other;
10113
10697
  const [checked, setCheckedState] = useControlled({
10114
10698
  controlled: checkedProp,
10115
10699
  default: Boolean(defaultChecked),
@@ -10134,7 +10718,7 @@ const SwitchBase = /* @__PURE__ */ React.forwardRef(function SwitchBase2(props,
10134
10718
  }
10135
10719
  };
10136
10720
  const handleInputChange = (event) => {
10137
- if (event.nativeEvent.defaultPrevented) {
10721
+ if (event.nativeEvent.defaultPrevented || readOnly) {
10138
10722
  return;
10139
10723
  }
10140
10724
  const newChecked = event.target.checked;
@@ -10160,10 +10744,7 @@ const SwitchBase = /* @__PURE__ */ React.forwardRef(function SwitchBase2(props,
10160
10744
  const classes = useUtilityClasses$4(ownerState);
10161
10745
  const externalForwardedProps = {
10162
10746
  slots,
10163
- slotProps: {
10164
- input: inputProps,
10165
- ...slotProps
10166
- }
10747
+ slotProps
10167
10748
  };
10168
10749
  const [RootSlot, rootSlotProps] = useSlot("root", {
10169
10750
  ref,
@@ -10173,7 +10754,7 @@ const SwitchBase = /* @__PURE__ */ React.forwardRef(function SwitchBase2(props,
10173
10754
  externalForwardedProps: {
10174
10755
  ...externalForwardedProps,
10175
10756
  component: "span",
10176
- ...other
10757
+ ...buttonBaseProps
10177
10758
  },
10178
10759
  getSlotProps: (handlers) => ({
10179
10760
  ...handlers,
@@ -10190,13 +10771,12 @@ const SwitchBase = /* @__PURE__ */ React.forwardRef(function SwitchBase2(props,
10190
10771
  additionalProps: {
10191
10772
  centerRipple: true,
10192
10773
  focusRipple: !disableFocusRipple,
10193
- disabled,
10194
10774
  role: void 0,
10195
- tabIndex: null
10775
+ tabIndex: null,
10776
+ internalDisabledThemeFocusVisible: true
10196
10777
  }
10197
10778
  });
10198
10779
  const [InputSlot, inputSlotProps] = useSlot("input", {
10199
- ref: inputRef,
10200
10780
  elementType: SwitchBaseInput,
10201
10781
  className: classes.input,
10202
10782
  externalForwardedProps,
@@ -10281,14 +10861,6 @@ SwitchBase.propTypes = {
10281
10861
  * The id of the `input` element.
10282
10862
  */
10283
10863
  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
10864
  /*
10293
10865
  * @ignore
10294
10866
  */
@@ -10359,10 +10931,6 @@ const CheckBoxIcon = createSvgIcon(/* @__PURE__ */ jsx$1("path", {
10359
10931
  const IndeterminateCheckBoxIcon = createSvgIcon(/* @__PURE__ */ jsx$1("path", {
10360
10932
  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
10933
  }), "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
10934
  const useUtilityClasses$3 = (ownerState) => {
10367
10935
  const {
10368
10936
  classes,
@@ -10394,6 +10962,13 @@ const CheckboxRoot = styled(SwitchBase, {
10394
10962
  theme
10395
10963
  }) => ({
10396
10964
  color: (theme.vars || theme).palette.text.secondary,
10965
+ ...theme.focusVisible && {
10966
+ [`&.${buttonBaseClasses.focusVisible} svg:first-of-type`]: {
10967
+ ...outsetFocusRing,
10968
+ borderRadius: (theme.vars || theme).shape.borderRadius,
10969
+ ...theme.focusVisible
10970
+ }
10971
+ },
10397
10972
  variants: [{
10398
10973
  props: {
10399
10974
  color: "default",
@@ -10401,7 +10976,7 @@ const CheckboxRoot = styled(SwitchBase, {
10401
10976
  },
10402
10977
  style: {
10403
10978
  "&: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)
10979
+ backgroundColor: theme.alpha((theme.vars || theme).palette.action.active, (theme.vars || theme).palette.action.hoverOpacity)
10405
10980
  }
10406
10981
  }
10407
10982
  }, ...Object.entries(theme.palette).filter(createSimplePaletteValueFilter()).map(([color2]) => ({
@@ -10411,7 +10986,7 @@ const CheckboxRoot = styled(SwitchBase, {
10411
10986
  },
10412
10987
  style: {
10413
10988
  "&: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)
10989
+ backgroundColor: theme.alpha((theme.vars || theme).palette[color2].main, (theme.vars || theme).palette.action.hoverOpacity)
10415
10990
  }
10416
10991
  }
10417
10992
  })), ...Object.entries(theme.palette).filter(createSimplePaletteValueFilter()).map(([color2]) => ({
@@ -10455,7 +11030,6 @@ const Checkbox = /* @__PURE__ */ React.forwardRef(function Checkbox2(inProps, re
10455
11030
  icon: iconProp = defaultIcon,
10456
11031
  indeterminate = false,
10457
11032
  indeterminateIcon: indeterminateIconProp = defaultIndeterminateIcon,
10458
- inputProps,
10459
11033
  size: size2 = "medium",
10460
11034
  disableRipple = false,
10461
11035
  className,
@@ -10473,7 +11047,7 @@ const Checkbox = /* @__PURE__ */ React.forwardRef(function Checkbox2(inProps, re
10473
11047
  size: size2
10474
11048
  };
10475
11049
  const classes = useUtilityClasses$3(ownerState);
10476
- const externalInputProps = slotProps.input ?? inputProps;
11050
+ const externalInputProps = slotProps.input;
10477
11051
  const [RootSlot, rootSlotProps] = useSlot("root", {
10478
11052
  ref,
10479
11053
  elementType: CheckboxRoot,
@@ -10493,11 +11067,14 @@ const Checkbox = /* @__PURE__ */ React.forwardRef(function Checkbox2(inProps, re
10493
11067
  checkedIcon: /* @__PURE__ */ React.cloneElement(indeterminateIcon, {
10494
11068
  fontSize: indeterminateIcon.props.fontSize ?? size2
10495
11069
  }),
10496
- disableRipple,
11070
+ // Forward the raw prop so an unset value stays `undefined` and ButtonBase resolves its
11071
+ // own default — letting a global `MuiButtonBase.defaultProps.disableRipple` apply here.
11072
+ disableRipple: props.disableRipple,
10497
11073
  slots,
10498
11074
  slotProps: {
10499
11075
  input: mergeSlotProps$1(typeof externalInputProps === "function" ? externalInputProps(ownerState) : externalInputProps, {
10500
- "data-indeterminate": indeterminate
11076
+ "data-indeterminate": indeterminate,
11077
+ "aria-checked": indeterminate ? "mixed" : void 0
10501
11078
  })
10502
11079
  }
10503
11080
  }
@@ -10572,11 +11149,6 @@ Checkbox.propTypes = {
10572
11149
  * @default <IndeterminateCheckBoxIcon />
10573
11150
  */
10574
11151
  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
11152
  /**
10581
11153
  * Callback fired when the state is changed.
10582
11154
  *
@@ -10624,30 +11196,17 @@ Checkbox.propTypes = {
10624
11196
  function getTypographyUtilityClass(slot) {
10625
11197
  return generateUtilityClass("MuiTypography", slot);
10626
11198
  }
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();
11199
+ generateUtilityClasses("MuiTypography", ["root", "h1", "h2", "h3", "h4", "h5", "h6", "subtitle1", "subtitle2", "body1", "body2", "inherit", "button", "caption", "overline", "alignLeft", "alignRight", "alignCenter", "alignJustify", "noWrap", "gutterBottom"]);
10640
11200
  const useUtilityClasses$2 = (ownerState) => {
10641
11201
  const {
10642
11202
  align,
10643
11203
  gutterBottom,
10644
11204
  noWrap,
10645
- paragraph,
10646
11205
  variant,
10647
11206
  classes
10648
11207
  } = ownerState;
10649
11208
  const slots = {
10650
- root: ["root", variant, ownerState.align !== "inherit" && `align${capitalize(align)}`, gutterBottom && "gutterBottom", noWrap && "noWrap", paragraph && "paragraph"]
11209
+ root: ["root", variant, ownerState.align !== "inherit" && `align${capitalize(align)}`, gutterBottom && "gutterBottom", noWrap && "noWrap"]
10651
11210
  };
10652
11211
  return composeClasses(slots, getTypographyUtilityClass, classes);
10653
11212
  };
@@ -10658,7 +11217,7 @@ const TypographyRoot = styled("span", {
10658
11217
  const {
10659
11218
  ownerState
10660
11219
  } = 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];
11220
+ 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
11221
  }
10663
11222
  })(memoTheme(({
10664
11223
  theme
@@ -10716,13 +11275,6 @@ const TypographyRoot = styled("span", {
10716
11275
  style: {
10717
11276
  marginBottom: "0.35em"
10718
11277
  }
10719
- }, {
10720
- props: ({
10721
- ownerState
10722
- }) => ownerState.paragraph,
10723
- style: {
10724
- marginBottom: 16
10725
- }
10726
11278
  }]
10727
11279
  })));
10728
11280
  const defaultVariantMapping = {
@@ -10739,27 +11291,17 @@ const defaultVariantMapping = {
10739
11291
  inherit: "p"
10740
11292
  };
10741
11293
  const Typography = /* @__PURE__ */ React.forwardRef(function Typography2(inProps, ref) {
10742
- const {
10743
- color: color2,
10744
- ...themeProps
10745
- } = useDefaultProps({
11294
+ const props = useDefaultProps({
10746
11295
  props: inProps,
10747
11296
  name: "MuiTypography"
10748
11297
  });
10749
- const isSxColor = !v6Colors[color2];
10750
- const props = extendSxProp({
10751
- ...themeProps,
10752
- ...isSxColor && {
10753
- color: color2
10754
- }
10755
- });
10756
11298
  const {
11299
+ color: color2,
10757
11300
  align = "inherit",
10758
11301
  className,
10759
11302
  component,
10760
11303
  gutterBottom = false,
10761
11304
  noWrap = false,
10762
- paragraph = false,
10763
11305
  variant = "body1",
10764
11306
  variantMapping = defaultVariantMapping,
10765
11307
  ...other
@@ -10772,11 +11314,10 @@ const Typography = /* @__PURE__ */ React.forwardRef(function Typography2(inProps
10772
11314
  component,
10773
11315
  gutterBottom,
10774
11316
  noWrap,
10775
- paragraph,
10776
11317
  variant,
10777
11318
  variantMapping
10778
11319
  };
10779
- const Component = component || (paragraph ? "p" : variantMapping[variant] || defaultVariantMapping[variant]) || "span";
11320
+ const Component = component || variantMapping[variant] || defaultVariantMapping[variant] || "span";
10780
11321
  const classes = useUtilityClasses$2(ownerState);
10781
11322
  return /* @__PURE__ */ jsx$1(TypographyRoot, {
10782
11323
  as: Component,
@@ -10838,12 +11379,6 @@ Typography.propTypes = {
10838
11379
  * @default false
10839
11380
  */
10840
11381
  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
11382
  /**
10848
11383
  * @ignore
10849
11384
  */
@@ -10922,7 +11457,7 @@ const TableCellRoot = styled("td", {
10922
11457
  // Workaround for a rendering bug with spanned columns in Chrome 62.0.
10923
11458
  // Removes the alpha (sets it to 1), and lightens or darkens the theme color.
10924
11459
  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)}`,
11460
+ ${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
11461
  textAlign: "left",
10927
11462
  padding: 16,
10928
11463
  variants: [{
@@ -11175,9 +11710,9 @@ const TableRowRoot = styled("tr", {
11175
11710
  backgroundColor: (theme.vars || theme).palette.action.hover
11176
11711
  },
11177
11712
  [`&.${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),
11713
+ backgroundColor: theme.alpha((theme.vars || theme).palette.primary.main, (theme.vars || theme).palette.action.selectedOpacity),
11179
11714
  "&: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)
11715
+ backgroundColor: theme.alpha((theme.vars || theme).palette.primary.main, `${(theme.vars || theme).palette.action.selectedOpacity} + ${(theme.vars || theme).palette.action.hoverOpacity}`)
11181
11716
  }
11182
11717
  }
11183
11718
  })));
@@ -11250,28 +11785,6 @@ TableRow.propTypes = {
11250
11785
  */
11251
11786
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
11252
11787
  };
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
11788
  /**!
11276
11789
  * @fileOverview Kickass library to create and place poppers near their reference elements.
11277
11790
  * @version 1.16.1
@@ -12867,7 +13380,7 @@ function getAnchorEl(anchorEl) {
12867
13380
  const useEnhancedEffect = typeof window !== "undefined" ? React.useLayoutEffect : React.useEffect;
12868
13381
  const defaultPopperOptions = {};
12869
13382
  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;
13383
+ 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
13384
  const tooltipRef = React.useRef(null);
12872
13385
  const ownRef = useForkRef(tooltipRef, ref);
12873
13386
  const popperRef = React.useRef(null);
@@ -12964,7 +13477,7 @@ React.forwardRef((props, ref) => {
12964
13477
  onExited: handleExited
12965
13478
  };
12966
13479
  }
12967
- return jsx$1(Portal, { disablePortal, container, children: jsx$1("div", { ref: handleRef, role: "tooltip", ...other, style: {
13480
+ return jsx$1(Portal, { disablePortal, container: container2, children: jsx$1("div", { ref: handleRef, role: "tooltip", ...other, style: {
12968
13481
  // Prevents scroll issue, waiting for Popper.js to add this style once initiated.
12969
13482
  position: "fixed",
12970
13483
  // Fix Popper.js display issue
@@ -12974,6 +13487,18 @@ React.forwardRef((props, ref) => {
12974
13487
  ...style2
12975
13488
  }, children: typeof children2 === "function" ? children2(childProps) : children2 }) });
12976
13489
  });
13490
+ function _assertThisInitialized(e) {
13491
+ if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
13492
+ return e;
13493
+ }
13494
+ function _setPrototypeOf(t, e) {
13495
+ return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t2, e2) {
13496
+ return t2.__proto__ = e2, t2;
13497
+ }, _setPrototypeOf(t, e);
13498
+ }
13499
+ function _inheritsLoose(t, o) {
13500
+ t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
13501
+ }
12977
13502
  var safeIsNaN = Number.isNaN || function ponyfill(value) {
12978
13503
  return typeof value === "number" && value !== value;
12979
13504
  };
@@ -13021,6 +13546,15 @@ function memoizeOne(resultFn, isEqual2) {
13021
13546
  }
13022
13547
  return memoized;
13023
13548
  }
13549
+ function _objectWithoutPropertiesLoose(r2, e) {
13550
+ if (null == r2) return {};
13551
+ var t = {};
13552
+ for (var n in r2) if ({}.hasOwnProperty.call(r2, n)) {
13553
+ if (-1 !== e.indexOf(n)) continue;
13554
+ t[n] = r2[n];
13555
+ }
13556
+ return t;
13557
+ }
13024
13558
  var hasNativePerformanceNow = typeof performance === "object" && typeof performance.now === "function";
13025
13559
  var now = hasNativePerformanceNow ? function() {
13026
13560
  return performance.now();
@@ -13639,6 +14173,28 @@ React__default.forwardRef((props, ref) => {
13639
14173
  function _classCallCheck(a, n) {
13640
14174
  if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
13641
14175
  }
14176
+ function _typeof(o) {
14177
+ "@babel/helpers - typeof";
14178
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
14179
+ return typeof o2;
14180
+ } : function(o2) {
14181
+ return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
14182
+ }, _typeof(o);
14183
+ }
14184
+ function toPrimitive(t, r2) {
14185
+ if ("object" != _typeof(t) || !t) return t;
14186
+ var e = t[Symbol.toPrimitive];
14187
+ if (void 0 !== e) {
14188
+ var i = e.call(t, r2);
14189
+ if ("object" != _typeof(i)) return i;
14190
+ throw new TypeError("@@toPrimitive must return a primitive value.");
14191
+ }
14192
+ return ("string" === r2 ? String : Number)(t);
14193
+ }
14194
+ function toPropertyKey(t) {
14195
+ var i = toPrimitive(t, "string");
14196
+ return "symbol" == _typeof(i) ? i : i + "";
14197
+ }
13642
14198
  function _defineProperties(e, r2) {
13643
14199
  for (var t = 0; t < r2.length; t++) {
13644
14200
  var o = r2[t];
@@ -19914,8 +20470,8 @@ function getDimensions(scrollElement, props) {
19914
20470
  return getBoundingBox(scrollElement);
19915
20471
  }
19916
20472
  }
19917
- function getPositionOffset(element, container) {
19918
- if (isWindow(container) && document.documentElement) {
20473
+ function getPositionOffset(element, container2) {
20474
+ if (isWindow(container2) && document.documentElement) {
19919
20475
  var containerElement = document.documentElement;
19920
20476
  var elementRect = getBoundingBox(element);
19921
20477
  var containerRect = getBoundingBox(containerElement);
@@ -19924,9 +20480,9 @@ function getPositionOffset(element, container) {
19924
20480
  left: elementRect.left - containerRect.left
19925
20481
  };
19926
20482
  } else {
19927
- var scrollOffset = getScrollOffset(container);
20483
+ var scrollOffset = getScrollOffset(container2);
19928
20484
  var _elementRect = getBoundingBox(element);
19929
- var _containerRect = getBoundingBox(container);
20485
+ var _containerRect = getBoundingBox(container2);
19930
20486
  return {
19931
20487
  top: _elementRect.top + scrollOffset.top - _containerRect.top,
19932
20488
  left: _elementRect.left + scrollOffset.left - _containerRect.left
@@ -21189,6 +21745,7 @@ function SelectableTable(props) {
21189
21745
  selectedIds,
21190
21746
  allowMultiple = false,
21191
21747
  allowUncheck = false,
21748
+ requireShiftForMultiSelect = true,
21192
21749
  showTableHead = true,
21193
21750
  showTableInputs = false,
21194
21751
  testHeight = void 0,
@@ -21197,16 +21754,17 @@ function SelectableTable(props) {
21197
21754
  height: height2
21198
21755
  } = props;
21199
21756
  const [selectedRows, setSelectedRows] = useState(null);
21200
- const [isCheckingMultiple, setIsCheckingMultiple] = useState(false);
21757
+ const [isShiftDown, setIsShiftDown] = useState(false);
21758
+ const isCheckingMultiple = allowMultiple && (isShiftDown || !requireShiftForMultiSelect);
21201
21759
  useEffect(() => {
21202
21760
  function onKeyDown(event) {
21203
21761
  if (allowMultiple && event.keyCode === SHIFT_KEYCODE) {
21204
- setIsCheckingMultiple(true);
21762
+ setIsShiftDown(true);
21205
21763
  }
21206
21764
  }
21207
21765
  function onKeyUp(event) {
21208
21766
  if (allowMultiple && event.keyCode === SHIFT_KEYCODE) {
21209
- setIsCheckingMultiple(false);
21767
+ setIsShiftDown(false);
21210
21768
  }
21211
21769
  }
21212
21770
  window.addEventListener("keydown", onKeyDown);
@@ -21280,7 +21838,8 @@ function SelectableTable(props) {
21280
21838
  role: "button",
21281
21839
  onClick: () => onSelectRow(
21282
21840
  data[index][idKey],
21283
- !isSelected(data[index][idKey]) || !hasColorEncoding
21841
+ // Without shift-to-multi-select, clicking a selected row must be able to deselect it.
21842
+ !isSelected(data[index][idKey]) || !hasColorEncoding && requireShiftForMultiSelect
21284
21843
  )
21285
21844
  },
21286
21845
  /* @__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 +21907,7 @@ function FeatureList(props) {
21348
21907
  geneFilter = null,
21349
21908
  setGeneSelection,
21350
21909
  enableMultiSelect,
21910
+ requireShiftForMultiSelect,
21351
21911
  showFeatureTable,
21352
21912
  featureListSort,
21353
21913
  featureListSortKey,
@@ -21431,6 +21991,7 @@ function FeatureList(props) {
21431
21991
  onChange,
21432
21992
  allowMultiple: enableMultiSelect,
21433
21993
  allowUncheck: enableMultiSelect,
21994
+ requireShiftForMultiSelect,
21434
21995
  showTableHead: columnLabels.length > 1,
21435
21996
  width: width2,
21436
21997
  height: height2 - 34
@@ -21614,6 +22175,7 @@ function FeatureListSubscriber(props) {
21614
22175
  theme,
21615
22176
  title: titleOverride,
21616
22177
  enableMultiSelect = false,
22178
+ requireShiftForMultiSelect = true,
21617
22179
  showTable = false,
21618
22180
  sort = "alphabetical",
21619
22181
  sortKey = null,
@@ -21740,6 +22302,7 @@ function FeatureListSubscriber(props) {
21740
22302
  setGeneFilter,
21741
22303
  setGeneHighlight,
21742
22304
  enableMultiSelect,
22305
+ requireShiftForMultiSelect,
21743
22306
  hasFeatureLabels,
21744
22307
  primaryColumnName
21745
22308
  }