@mui/material 5.15.7 → 5.15.8
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/Accordion/Accordion.d.ts +2 -2
- package/Accordion/Accordion.js +2 -2
- package/Avatar/Avatar.js +4 -1
- package/CHANGELOG.md +89 -9
- package/Slider/Slider.d.ts +5 -0
- package/Slider/Slider.js +8 -1
- package/Tooltip/Tooltip.js +1 -0
- package/index.js +1 -1
- package/legacy/Accordion/Accordion.js +2 -2
- package/legacy/Avatar/Avatar.js +4 -1
- package/legacy/Slider/Slider.js +9 -1
- package/legacy/Tooltip/Tooltip.js +1 -0
- package/legacy/index.js +1 -1
- package/modern/Accordion/Accordion.js +2 -2
- package/modern/Avatar/Avatar.js +4 -1
- package/modern/Slider/Slider.js +8 -1
- package/modern/Tooltip/Tooltip.js +1 -0
- package/modern/index.js +1 -1
- package/node/Accordion/Accordion.js +2 -2
- package/node/Avatar/Avatar.js +4 -1
- package/node/Slider/Slider.js +8 -1
- package/node/Tooltip/Tooltip.js +1 -0
- package/node/index.js +1 -1
- package/package.json +7 -6
- package/styles/overrides.d.ts +13 -9
- package/umd/material-ui.development.js +1178 -1244
- package/umd/material-ui.production.min.js +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/material v5.15.
|
|
2
|
+
* @mui/material v5.15.8
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -4992,7 +4992,7 @@
|
|
|
4992
4992
|
injectFirst: PropTypes.bool
|
|
4993
4993
|
} ;
|
|
4994
4994
|
|
|
4995
|
-
function isEmpty$
|
|
4995
|
+
function isEmpty$3(obj) {
|
|
4996
4996
|
return obj === undefined || obj === null || Object.keys(obj).length === 0;
|
|
4997
4997
|
}
|
|
4998
4998
|
function GlobalStyles$2(props) {
|
|
@@ -5000,7 +5000,7 @@
|
|
|
5000
5000
|
_props$defaultTheme = props.defaultTheme,
|
|
5001
5001
|
defaultTheme = _props$defaultTheme === void 0 ? {} : _props$defaultTheme;
|
|
5002
5002
|
var globalStyles = typeof styles === 'function' ? function (themeInput) {
|
|
5003
|
-
return styles(isEmpty$
|
|
5003
|
+
return styles(isEmpty$3(themeInput) ? defaultTheme : themeInput);
|
|
5004
5004
|
} : styles;
|
|
5005
5005
|
return /*#__PURE__*/jsxRuntime_1(Global, {
|
|
5006
5006
|
styles: globalStyles
|
|
@@ -7729,29 +7729,6 @@
|
|
|
7729
7729
|
return Box;
|
|
7730
7730
|
}
|
|
7731
7731
|
|
|
7732
|
-
function isEmpty$3(string) {
|
|
7733
|
-
return string.length === 0;
|
|
7734
|
-
}
|
|
7735
|
-
|
|
7736
|
-
/**
|
|
7737
|
-
* Generates string classKey based on the properties provided. It starts with the
|
|
7738
|
-
* variant if defined, and then it appends all other properties in alphabetical order.
|
|
7739
|
-
* @param {object} props - the properties for which the classKey should be created.
|
|
7740
|
-
*/
|
|
7741
|
-
function propsToClassKey(props) {
|
|
7742
|
-
var variant = props.variant,
|
|
7743
|
-
other = _objectWithoutProperties(props, ["variant"]);
|
|
7744
|
-
var classKey = variant || '';
|
|
7745
|
-
Object.keys(other).sort().forEach(function (key) {
|
|
7746
|
-
if (key === 'color') {
|
|
7747
|
-
classKey += isEmpty$3(classKey) ? props[key] : capitalize(props[key]);
|
|
7748
|
-
} else {
|
|
7749
|
-
classKey += "".concat(isEmpty$3(classKey) ? key : capitalize(key)).concat(capitalize(props[key].toString()));
|
|
7750
|
-
}
|
|
7751
|
-
});
|
|
7752
|
-
return classKey;
|
|
7753
|
-
}
|
|
7754
|
-
|
|
7755
7732
|
function isEmpty$2(obj) {
|
|
7756
7733
|
return Object.keys(obj).length === 0;
|
|
7757
7734
|
}
|
|
@@ -7764,73 +7741,6 @@
|
|
|
7764
7741
|
// it's a lowercase character
|
|
7765
7742
|
tag.charCodeAt(0) > 96;
|
|
7766
7743
|
}
|
|
7767
|
-
var getStyleOverrides = function getStyleOverrides(name, theme) {
|
|
7768
|
-
if (theme.components && theme.components[name] && theme.components[name].styleOverrides) {
|
|
7769
|
-
return theme.components[name].styleOverrides;
|
|
7770
|
-
}
|
|
7771
|
-
return null;
|
|
7772
|
-
};
|
|
7773
|
-
var transformVariants = function transformVariants(variants) {
|
|
7774
|
-
var numOfCallbacks = 0;
|
|
7775
|
-
var variantsStyles = {};
|
|
7776
|
-
if (variants) {
|
|
7777
|
-
variants.forEach(function (definition) {
|
|
7778
|
-
var key = '';
|
|
7779
|
-
if (typeof definition.props === 'function') {
|
|
7780
|
-
key = "callback".concat(numOfCallbacks);
|
|
7781
|
-
numOfCallbacks += 1;
|
|
7782
|
-
} else {
|
|
7783
|
-
key = propsToClassKey(definition.props);
|
|
7784
|
-
}
|
|
7785
|
-
variantsStyles[key] = definition.style;
|
|
7786
|
-
});
|
|
7787
|
-
}
|
|
7788
|
-
return variantsStyles;
|
|
7789
|
-
};
|
|
7790
|
-
var getVariantStyles = function getVariantStyles(name, theme) {
|
|
7791
|
-
var variants = [];
|
|
7792
|
-
if (theme && theme.components && theme.components[name] && theme.components[name].variants) {
|
|
7793
|
-
variants = theme.components[name].variants;
|
|
7794
|
-
}
|
|
7795
|
-
return transformVariants(variants);
|
|
7796
|
-
};
|
|
7797
|
-
var variantsResolver = function variantsResolver(props, styles, variants) {
|
|
7798
|
-
var _props$ownerState = props.ownerState,
|
|
7799
|
-
ownerState = _props$ownerState === void 0 ? {} : _props$ownerState;
|
|
7800
|
-
var variantsStyles = [];
|
|
7801
|
-
var numOfCallbacks = 0;
|
|
7802
|
-
if (variants) {
|
|
7803
|
-
variants.forEach(function (variant) {
|
|
7804
|
-
var isMatch = true;
|
|
7805
|
-
if (typeof variant.props === 'function') {
|
|
7806
|
-
var propsToCheck = _extends({}, props, ownerState);
|
|
7807
|
-
isMatch = variant.props(propsToCheck);
|
|
7808
|
-
} else {
|
|
7809
|
-
Object.keys(variant.props).forEach(function (key) {
|
|
7810
|
-
if (ownerState[key] !== variant.props[key] && props[key] !== variant.props[key]) {
|
|
7811
|
-
isMatch = false;
|
|
7812
|
-
}
|
|
7813
|
-
});
|
|
7814
|
-
}
|
|
7815
|
-
if (isMatch) {
|
|
7816
|
-
if (typeof variant.props === 'function') {
|
|
7817
|
-
variantsStyles.push(styles["callback".concat(numOfCallbacks)]);
|
|
7818
|
-
} else {
|
|
7819
|
-
variantsStyles.push(styles[propsToClassKey(variant.props)]);
|
|
7820
|
-
}
|
|
7821
|
-
}
|
|
7822
|
-
if (typeof variant.props === 'function') {
|
|
7823
|
-
numOfCallbacks += 1;
|
|
7824
|
-
}
|
|
7825
|
-
});
|
|
7826
|
-
}
|
|
7827
|
-
return variantsStyles;
|
|
7828
|
-
};
|
|
7829
|
-
var themeVariantsResolver = function themeVariantsResolver(props, styles, theme, name) {
|
|
7830
|
-
var _theme$components;
|
|
7831
|
-
var themeVariants = theme == null || (_theme$components = theme.components) == null || (_theme$components = _theme$components[name]) == null ? void 0 : _theme$components.variants;
|
|
7832
|
-
return variantsResolver(props, styles, themeVariants);
|
|
7833
|
-
};
|
|
7834
7744
|
|
|
7835
7745
|
// Update /system/styled/#api in case if this changes
|
|
7836
7746
|
function shouldForwardProp(prop) {
|
|
@@ -7857,28 +7767,50 @@
|
|
|
7857
7767
|
return styles[slot];
|
|
7858
7768
|
};
|
|
7859
7769
|
}
|
|
7860
|
-
|
|
7861
|
-
var
|
|
7862
|
-
props = _ref2
|
|
7863
|
-
|
|
7864
|
-
|
|
7865
|
-
|
|
7866
|
-
|
|
7867
|
-
|
|
7868
|
-
|
|
7869
|
-
|
|
7870
|
-
|
|
7871
|
-
|
|
7872
|
-
if (resolvedStyles && resolvedStyles.variants) {
|
|
7873
|
-
optionalVariants = resolvedStyles.variants;
|
|
7874
|
-
delete resolvedStyles.variants;
|
|
7770
|
+
function processStyleArg(callableStyle, _ref2) {
|
|
7771
|
+
var ownerState = _ref2.ownerState,
|
|
7772
|
+
props = _objectWithoutProperties(_ref2, ["ownerState"]);
|
|
7773
|
+
var resolvedStylesArg = typeof callableStyle === 'function' ? callableStyle(_extends({
|
|
7774
|
+
ownerState: ownerState
|
|
7775
|
+
}, props)) : callableStyle;
|
|
7776
|
+
if (Array.isArray(resolvedStylesArg)) {
|
|
7777
|
+
return resolvedStylesArg.flatMap(function (resolvedStyle) {
|
|
7778
|
+
return processStyleArg(resolvedStyle, _extends({
|
|
7779
|
+
ownerState: ownerState
|
|
7780
|
+
}, props));
|
|
7781
|
+
});
|
|
7875
7782
|
}
|
|
7876
|
-
if (
|
|
7877
|
-
var
|
|
7878
|
-
|
|
7783
|
+
if (!!resolvedStylesArg && _typeof(resolvedStylesArg) === 'object' && Array.isArray(resolvedStylesArg.variants)) {
|
|
7784
|
+
var _resolvedStylesArg$va = resolvedStylesArg.variants,
|
|
7785
|
+
variants = _resolvedStylesArg$va === void 0 ? [] : _resolvedStylesArg$va,
|
|
7786
|
+
otherStyles = _objectWithoutProperties(resolvedStylesArg, ["variants"]);
|
|
7787
|
+
var result = otherStyles;
|
|
7788
|
+
variants.forEach(function (variant) {
|
|
7789
|
+
var isMatch = true;
|
|
7790
|
+
if (typeof variant.props === 'function') {
|
|
7791
|
+
isMatch = variant.props(_extends({
|
|
7792
|
+
ownerState: ownerState
|
|
7793
|
+
}, props));
|
|
7794
|
+
} else {
|
|
7795
|
+
Object.keys(variant.props).forEach(function (key) {
|
|
7796
|
+
if ((ownerState == null ? void 0 : ownerState[key]) !== variant.props[key] && props[key] !== variant.props[key]) {
|
|
7797
|
+
isMatch = false;
|
|
7798
|
+
}
|
|
7799
|
+
});
|
|
7800
|
+
}
|
|
7801
|
+
if (isMatch) {
|
|
7802
|
+
if (!Array.isArray(result)) {
|
|
7803
|
+
result = [result];
|
|
7804
|
+
}
|
|
7805
|
+
result.push(typeof variant.style === 'function' ? variant.style(_extends({
|
|
7806
|
+
ownerState: ownerState
|
|
7807
|
+
}, props)) : variant.style);
|
|
7808
|
+
}
|
|
7809
|
+
});
|
|
7810
|
+
return result;
|
|
7879
7811
|
}
|
|
7880
|
-
return
|
|
7881
|
-
}
|
|
7812
|
+
return resolvedStylesArg;
|
|
7813
|
+
}
|
|
7882
7814
|
function createStyled() {
|
|
7883
7815
|
var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7884
7816
|
var themeId = input.themeId,
|
|
@@ -7942,102 +7874,65 @@
|
|
|
7942
7874
|
shouldForwardProp: shouldForwardPropOption,
|
|
7943
7875
|
label: label
|
|
7944
7876
|
}, options));
|
|
7945
|
-
var
|
|
7946
|
-
for (var _len = arguments.length, expressions = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
7947
|
-
expressions[_key - 1] = arguments[_key];
|
|
7948
|
-
}
|
|
7949
|
-
var expressionsWithDefaultTheme = expressions ? expressions.map(function (stylesArg) {
|
|
7950
|
-
// On the server Emotion doesn't use React.forwardRef for creating components, so the created
|
|
7951
|
-
// component stays as a function. This condition makes sure that we do not interpolate functions
|
|
7952
|
-
// which are basically components used as a selectors.
|
|
7953
|
-
if (typeof stylesArg === 'function' && stylesArg.__emotion_real !== stylesArg) {
|
|
7954
|
-
return function (props) {
|
|
7955
|
-
return muiStyledFunctionResolver({
|
|
7956
|
-
styledArg: stylesArg,
|
|
7957
|
-
props: props,
|
|
7958
|
-
defaultTheme: defaultTheme,
|
|
7959
|
-
themeId: themeId
|
|
7960
|
-
});
|
|
7961
|
-
};
|
|
7962
|
-
}
|
|
7963
|
-
if (isPlainObject(stylesArg)) {
|
|
7964
|
-
var transformedStylesArg = stylesArg;
|
|
7965
|
-
var styledArgVariants;
|
|
7966
|
-
if (stylesArg && stylesArg.variants) {
|
|
7967
|
-
styledArgVariants = stylesArg.variants;
|
|
7968
|
-
delete transformedStylesArg.variants;
|
|
7969
|
-
transformedStylesArg = function transformedStylesArg(props) {
|
|
7970
|
-
var result = stylesArg;
|
|
7971
|
-
var variantStyles = variantsResolver(props, transformVariants(styledArgVariants), styledArgVariants);
|
|
7972
|
-
variantStyles.forEach(function (variantStyle) {
|
|
7973
|
-
result = deepmerge(result, variantStyle);
|
|
7974
|
-
});
|
|
7975
|
-
return result;
|
|
7976
|
-
};
|
|
7977
|
-
}
|
|
7978
|
-
return transformedStylesArg;
|
|
7979
|
-
}
|
|
7980
|
-
return stylesArg;
|
|
7981
|
-
}) : [];
|
|
7982
|
-
var transformedStyleArg = styleArg;
|
|
7983
|
-
if (isPlainObject(styleArg)) {
|
|
7984
|
-
var styledArgVariants;
|
|
7985
|
-
if (styleArg && styleArg.variants) {
|
|
7986
|
-
styledArgVariants = styleArg.variants;
|
|
7987
|
-
delete transformedStyleArg.variants;
|
|
7988
|
-
transformedStyleArg = function transformedStyleArg(props) {
|
|
7989
|
-
var result = styleArg;
|
|
7990
|
-
var variantStyles = variantsResolver(props, transformVariants(styledArgVariants), styledArgVariants);
|
|
7991
|
-
variantStyles.forEach(function (variantStyle) {
|
|
7992
|
-
result = deepmerge(result, variantStyle);
|
|
7993
|
-
});
|
|
7994
|
-
return result;
|
|
7995
|
-
};
|
|
7996
|
-
}
|
|
7997
|
-
} else if (typeof styleArg === 'function' &&
|
|
7877
|
+
var transformStyleArg = function transformStyleArg(stylesArg) {
|
|
7998
7878
|
// On the server Emotion doesn't use React.forwardRef for creating components, so the created
|
|
7999
7879
|
// component stays as a function. This condition makes sure that we do not interpolate functions
|
|
8000
7880
|
// which are basically components used as a selectors.
|
|
8001
|
-
|
|
8002
|
-
|
|
8003
|
-
|
|
8004
|
-
|
|
8005
|
-
|
|
8006
|
-
|
|
8007
|
-
|
|
8008
|
-
|
|
8009
|
-
});
|
|
7881
|
+
if (typeof stylesArg === 'function' && stylesArg.__emotion_real !== stylesArg || isPlainObject(stylesArg)) {
|
|
7882
|
+
return function (props) {
|
|
7883
|
+
return processStyleArg(stylesArg, _extends({}, props, {
|
|
7884
|
+
theme: resolveTheme({
|
|
7885
|
+
theme: props.theme,
|
|
7886
|
+
defaultTheme: defaultTheme,
|
|
7887
|
+
themeId: themeId
|
|
7888
|
+
})
|
|
7889
|
+
}));
|
|
8010
7890
|
};
|
|
8011
7891
|
}
|
|
7892
|
+
return stylesArg;
|
|
7893
|
+
};
|
|
7894
|
+
var muiStyledResolver = function muiStyledResolver(styleArg) {
|
|
7895
|
+
var transformedStyleArg = transformStyleArg(styleArg);
|
|
7896
|
+
for (var _len = arguments.length, expressions = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
7897
|
+
expressions[_key - 1] = arguments[_key];
|
|
7898
|
+
}
|
|
7899
|
+
var expressionsWithDefaultTheme = expressions ? expressions.map(transformStyleArg) : [];
|
|
8012
7900
|
if (componentName && overridesResolver) {
|
|
8013
7901
|
expressionsWithDefaultTheme.push(function (props) {
|
|
8014
7902
|
var theme = resolveTheme(_extends({}, props, {
|
|
8015
7903
|
defaultTheme: defaultTheme,
|
|
8016
7904
|
themeId: themeId
|
|
8017
7905
|
}));
|
|
8018
|
-
|
|
8019
|
-
|
|
8020
|
-
var resolvedStyleOverrides = {};
|
|
8021
|
-
Object.entries(styleOverrides).forEach(function (_ref3) {
|
|
8022
|
-
var _ref4 = _slicedToArray(_ref3, 2),
|
|
8023
|
-
slotKey = _ref4[0],
|
|
8024
|
-
slotStyle = _ref4[1];
|
|
8025
|
-
resolvedStyleOverrides[slotKey] = typeof slotStyle === 'function' ? slotStyle(_extends({}, props, {
|
|
8026
|
-
theme: theme
|
|
8027
|
-
})) : slotStyle;
|
|
8028
|
-
});
|
|
8029
|
-
return overridesResolver(props, resolvedStyleOverrides);
|
|
7906
|
+
if (!theme.components || !theme.components[componentName] || !theme.components[componentName].styleOverrides) {
|
|
7907
|
+
return null;
|
|
8030
7908
|
}
|
|
8031
|
-
|
|
7909
|
+
var styleOverrides = theme.components[componentName].styleOverrides;
|
|
7910
|
+
var resolvedStyleOverrides = {};
|
|
7911
|
+
// TODO: v7 remove iteration and use `resolveStyleArg(styleOverrides[slot])` directly
|
|
7912
|
+
Object.entries(styleOverrides).forEach(function (_ref3) {
|
|
7913
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
7914
|
+
slotKey = _ref4[0],
|
|
7915
|
+
slotStyle = _ref4[1];
|
|
7916
|
+
resolvedStyleOverrides[slotKey] = processStyleArg(slotStyle, _extends({}, props, {
|
|
7917
|
+
theme: theme
|
|
7918
|
+
}));
|
|
7919
|
+
});
|
|
7920
|
+
return overridesResolver(props, resolvedStyleOverrides);
|
|
8032
7921
|
});
|
|
8033
7922
|
}
|
|
8034
7923
|
if (componentName && !skipVariantsResolver) {
|
|
8035
7924
|
expressionsWithDefaultTheme.push(function (props) {
|
|
7925
|
+
var _theme$components;
|
|
8036
7926
|
var theme = resolveTheme(_extends({}, props, {
|
|
8037
7927
|
defaultTheme: defaultTheme,
|
|
8038
7928
|
themeId: themeId
|
|
8039
7929
|
}));
|
|
8040
|
-
|
|
7930
|
+
var themeVariants = theme == null || (_theme$components = theme.components) == null || (_theme$components = _theme$components[componentName]) == null ? void 0 : _theme$components.variants;
|
|
7931
|
+
return processStyleArg({
|
|
7932
|
+
variants: themeVariants
|
|
7933
|
+
}, _extends({}, props, {
|
|
7934
|
+
theme: theme
|
|
7935
|
+
}));
|
|
8041
7936
|
});
|
|
8042
7937
|
}
|
|
8043
7938
|
if (!skipSx) {
|
|
@@ -13708,13 +13603,13 @@
|
|
|
13708
13603
|
/**
|
|
13709
13604
|
* The component used for the transition.
|
|
13710
13605
|
* [Follow this guide](/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
|
|
13711
|
-
* @deprecated Use `slots.transition` instead. This prop will be removed in v7.
|
|
13606
|
+
* @deprecated Use `slots.transition` instead. This prop will be removed in v7. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/).
|
|
13712
13607
|
*/
|
|
13713
13608
|
TransitionComponent: PropTypes.elementType,
|
|
13714
13609
|
/**
|
|
13715
13610
|
* Props applied to the transition element.
|
|
13716
13611
|
* By default, the element is based on this [`Transition`](http://reactcommunity.org/react-transition-group/transition/) component.
|
|
13717
|
-
* @deprecated Use `slotProps.transition` instead. This prop will be removed in v7.
|
|
13612
|
+
* @deprecated Use `slotProps.transition` instead. This prop will be removed in v7. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/).
|
|
13718
13613
|
*/
|
|
13719
13614
|
TransitionProps: PropTypes.object
|
|
13720
13615
|
} ;
|
|
@@ -16400,153 +16295,736 @@
|
|
|
16400
16295
|
FocusTrap['propTypes' + ''] = exactProp(FocusTrap.propTypes);
|
|
16401
16296
|
}
|
|
16402
16297
|
|
|
16403
|
-
|
|
16404
|
-
|
|
16405
|
-
var right = 'right';
|
|
16406
|
-
var left = 'left';
|
|
16407
|
-
var auto = 'auto';
|
|
16408
|
-
var basePlacements = [top, bottom, right, left];
|
|
16409
|
-
var start = 'start';
|
|
16410
|
-
var end = 'end';
|
|
16411
|
-
var clippingParents = 'clippingParents';
|
|
16412
|
-
var viewport = 'viewport';
|
|
16413
|
-
var popper = 'popper';
|
|
16414
|
-
var reference = 'reference';
|
|
16415
|
-
var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
|
|
16416
|
-
return acc.concat([placement + "-" + start, placement + "-" + end]);
|
|
16417
|
-
}, []);
|
|
16418
|
-
var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
|
|
16419
|
-
return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
|
|
16420
|
-
}, []); // modifiers that need to read the DOM
|
|
16421
|
-
|
|
16422
|
-
var beforeRead = 'beforeRead';
|
|
16423
|
-
var read = 'read';
|
|
16424
|
-
var afterRead = 'afterRead'; // pure-logic modifiers
|
|
16425
|
-
|
|
16426
|
-
var beforeMain = 'beforeMain';
|
|
16427
|
-
var main = 'main';
|
|
16428
|
-
var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
|
|
16429
|
-
|
|
16430
|
-
var beforeWrite = 'beforeWrite';
|
|
16431
|
-
var write = 'write';
|
|
16432
|
-
var afterWrite = 'afterWrite';
|
|
16433
|
-
var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
|
|
16434
|
-
|
|
16435
|
-
function getNodeName(element) {
|
|
16436
|
-
return element ? (element.nodeName || '').toLowerCase() : null;
|
|
16298
|
+
function getContainer$1(container) {
|
|
16299
|
+
return typeof container === 'function' ? container() : container;
|
|
16437
16300
|
}
|
|
16438
16301
|
|
|
16439
|
-
|
|
16440
|
-
|
|
16441
|
-
|
|
16302
|
+
/**
|
|
16303
|
+
* Portals provide a first-class way to render children into a DOM node
|
|
16304
|
+
* that exists outside the DOM hierarchy of the parent component.
|
|
16305
|
+
*
|
|
16306
|
+
* Demos:
|
|
16307
|
+
*
|
|
16308
|
+
* - [Portal](https://mui.com/base-ui/react-portal/)
|
|
16309
|
+
*
|
|
16310
|
+
* API:
|
|
16311
|
+
*
|
|
16312
|
+
* - [Portal API](https://mui.com/base-ui/react-portal/components-api/#portal)
|
|
16313
|
+
*/
|
|
16314
|
+
var Portal = /*#__PURE__*/React__namespace.forwardRef(function Portal(props, forwardedRef) {
|
|
16315
|
+
var children = props.children,
|
|
16316
|
+
container = props.container,
|
|
16317
|
+
_props$disablePortal = props.disablePortal,
|
|
16318
|
+
disablePortal = _props$disablePortal === void 0 ? false : _props$disablePortal;
|
|
16319
|
+
var _React$useState = React__namespace.useState(null),
|
|
16320
|
+
mountNode = _React$useState[0],
|
|
16321
|
+
setMountNode = _React$useState[1]; // @ts-expect-error TODO upstream fix
|
|
16322
|
+
var handleRef = useForkRef( /*#__PURE__*/React__namespace.isValidElement(children) ? children.ref : null, forwardedRef);
|
|
16323
|
+
useEnhancedEffect$1(function () {
|
|
16324
|
+
if (!disablePortal) {
|
|
16325
|
+
setMountNode(getContainer$1(container) || document.body);
|
|
16326
|
+
}
|
|
16327
|
+
}, [container, disablePortal]);
|
|
16328
|
+
useEnhancedEffect$1(function () {
|
|
16329
|
+
if (mountNode && !disablePortal) {
|
|
16330
|
+
setRef(forwardedRef, mountNode);
|
|
16331
|
+
return function () {
|
|
16332
|
+
setRef(forwardedRef, null);
|
|
16333
|
+
};
|
|
16334
|
+
}
|
|
16335
|
+
return undefined;
|
|
16336
|
+
}, [forwardedRef, mountNode, disablePortal]);
|
|
16337
|
+
if (disablePortal) {
|
|
16338
|
+
if ( /*#__PURE__*/React__namespace.isValidElement(children)) {
|
|
16339
|
+
var newProps = {
|
|
16340
|
+
ref: handleRef
|
|
16341
|
+
};
|
|
16342
|
+
return /*#__PURE__*/React__namespace.cloneElement(children, newProps);
|
|
16343
|
+
}
|
|
16344
|
+
return /*#__PURE__*/jsxRuntime_1(React__namespace.Fragment, {
|
|
16345
|
+
children: children
|
|
16346
|
+
});
|
|
16442
16347
|
}
|
|
16348
|
+
return /*#__PURE__*/jsxRuntime_1(React__namespace.Fragment, {
|
|
16349
|
+
children: mountNode ? /*#__PURE__*/ReactDOM__namespace.createPortal(children, mountNode) : mountNode
|
|
16350
|
+
});
|
|
16351
|
+
});
|
|
16352
|
+
Portal.propTypes /* remove-proptypes */ = {
|
|
16353
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
16354
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
16355
|
+
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
16356
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
16357
|
+
/**
|
|
16358
|
+
* The children to render into the `container`.
|
|
16359
|
+
*/
|
|
16360
|
+
children: PropTypes.node,
|
|
16361
|
+
/**
|
|
16362
|
+
* An HTML element or function that returns one.
|
|
16363
|
+
* The `container` will have the portal children appended to it.
|
|
16364
|
+
*
|
|
16365
|
+
* You can also provide a callback, which is called in a React layout effect.
|
|
16366
|
+
* This lets you set the container from a ref, and also makes server-side rendering possible.
|
|
16367
|
+
*
|
|
16368
|
+
* By default, it uses the body of the top-level document object,
|
|
16369
|
+
* so it's simply `document.body` most of the time.
|
|
16370
|
+
*/
|
|
16371
|
+
container: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([HTMLElementType, PropTypes.func]),
|
|
16372
|
+
/**
|
|
16373
|
+
* The `children` will be under the DOM hierarchy of the parent component.
|
|
16374
|
+
* @default false
|
|
16375
|
+
*/
|
|
16376
|
+
disablePortal: PropTypes.bool
|
|
16377
|
+
} ;
|
|
16378
|
+
{
|
|
16379
|
+
// eslint-disable-next-line
|
|
16380
|
+
Portal['propTypes' + ''] = exactProp(Portal.propTypes);
|
|
16381
|
+
}
|
|
16443
16382
|
|
|
16444
|
-
|
|
16445
|
-
|
|
16446
|
-
|
|
16383
|
+
// Is a vertical scrollbar displayed?
|
|
16384
|
+
function isOverflowing(container) {
|
|
16385
|
+
var doc = ownerDocument(container);
|
|
16386
|
+
if (doc.body === container) {
|
|
16387
|
+
return ownerWindow(container).innerWidth > doc.documentElement.clientWidth;
|
|
16447
16388
|
}
|
|
16448
|
-
|
|
16449
|
-
return node;
|
|
16389
|
+
return container.scrollHeight > container.clientHeight;
|
|
16450
16390
|
}
|
|
16451
|
-
|
|
16452
|
-
|
|
16453
|
-
|
|
16454
|
-
|
|
16391
|
+
function ariaHidden(element, show) {
|
|
16392
|
+
if (show) {
|
|
16393
|
+
element.setAttribute('aria-hidden', 'true');
|
|
16394
|
+
} else {
|
|
16395
|
+
element.removeAttribute('aria-hidden');
|
|
16396
|
+
}
|
|
16455
16397
|
}
|
|
16456
|
-
|
|
16457
|
-
|
|
16458
|
-
var OwnElement = getWindow(node).HTMLElement;
|
|
16459
|
-
return node instanceof OwnElement || node instanceof HTMLElement;
|
|
16398
|
+
function getPaddingRight(element) {
|
|
16399
|
+
return parseInt(ownerWindow(element).getComputedStyle(element).paddingRight, 10) || 0;
|
|
16460
16400
|
}
|
|
16461
|
-
|
|
16462
|
-
|
|
16463
|
-
//
|
|
16464
|
-
|
|
16401
|
+
function isAriaHiddenForbiddenOnElement(element) {
|
|
16402
|
+
// The forbidden HTML tags are the ones from ARIA specification that
|
|
16403
|
+
// can be children of body and can't have aria-hidden attribute.
|
|
16404
|
+
// cf. https://www.w3.org/TR/html-aria/#docconformance
|
|
16405
|
+
var forbiddenTagNames = ['TEMPLATE', 'SCRIPT', 'STYLE', 'LINK', 'MAP', 'META', 'NOSCRIPT', 'PICTURE', 'COL', 'COLGROUP', 'PARAM', 'SLOT', 'SOURCE', 'TRACK'];
|
|
16406
|
+
var isForbiddenTagName = forbiddenTagNames.indexOf(element.tagName) !== -1;
|
|
16407
|
+
var isInputHidden = element.tagName === 'INPUT' && element.getAttribute('type') === 'hidden';
|
|
16408
|
+
return isForbiddenTagName || isInputHidden;
|
|
16409
|
+
}
|
|
16410
|
+
function ariaHiddenSiblings(container, mountElement, currentElement, elementsToExclude, show) {
|
|
16411
|
+
var blacklist = [mountElement, currentElement].concat(_toConsumableArray(elementsToExclude));
|
|
16412
|
+
[].forEach.call(container.children, function (element) {
|
|
16413
|
+
var isNotExcludedElement = blacklist.indexOf(element) === -1;
|
|
16414
|
+
var isNotForbiddenElement = !isAriaHiddenForbiddenOnElement(element);
|
|
16415
|
+
if (isNotExcludedElement && isNotForbiddenElement) {
|
|
16416
|
+
ariaHidden(element, show);
|
|
16417
|
+
}
|
|
16418
|
+
});
|
|
16419
|
+
}
|
|
16420
|
+
function findIndexOf(items, callback) {
|
|
16421
|
+
var idx = -1;
|
|
16422
|
+
items.some(function (item, index) {
|
|
16423
|
+
if (callback(item)) {
|
|
16424
|
+
idx = index;
|
|
16425
|
+
return true;
|
|
16426
|
+
}
|
|
16465
16427
|
return false;
|
|
16466
|
-
}
|
|
16467
|
-
|
|
16468
|
-
var OwnElement = getWindow(node).ShadowRoot;
|
|
16469
|
-
return node instanceof OwnElement || node instanceof ShadowRoot;
|
|
16428
|
+
});
|
|
16429
|
+
return idx;
|
|
16470
16430
|
}
|
|
16431
|
+
function handleContainer(containerInfo, props) {
|
|
16432
|
+
var restoreStyle = [];
|
|
16433
|
+
var container = containerInfo.container;
|
|
16434
|
+
if (!props.disableScrollLock) {
|
|
16435
|
+
if (isOverflowing(container)) {
|
|
16436
|
+
// Compute the size before applying overflow hidden to avoid any scroll jumps.
|
|
16437
|
+
var scrollbarSize = getScrollbarSize(ownerDocument(container));
|
|
16438
|
+
restoreStyle.push({
|
|
16439
|
+
value: container.style.paddingRight,
|
|
16440
|
+
property: 'padding-right',
|
|
16441
|
+
el: container
|
|
16442
|
+
});
|
|
16443
|
+
// Use computed style, here to get the real padding to add our scrollbar width.
|
|
16444
|
+
container.style.paddingRight = "".concat(getPaddingRight(container) + scrollbarSize, "px");
|
|
16471
16445
|
|
|
16472
|
-
|
|
16473
|
-
|
|
16474
|
-
|
|
16475
|
-
|
|
16476
|
-
|
|
16477
|
-
|
|
16478
|
-
|
|
16479
|
-
|
|
16480
|
-
|
|
16481
|
-
|
|
16482
|
-
|
|
16483
|
-
|
|
16484
|
-
|
|
16485
|
-
|
|
16486
|
-
|
|
16487
|
-
|
|
16488
|
-
|
|
16489
|
-
|
|
16490
|
-
var
|
|
16446
|
+
// .mui-fixed is a global helper.
|
|
16447
|
+
var fixedElements = ownerDocument(container).querySelectorAll('.mui-fixed');
|
|
16448
|
+
[].forEach.call(fixedElements, function (element) {
|
|
16449
|
+
restoreStyle.push({
|
|
16450
|
+
value: element.style.paddingRight,
|
|
16451
|
+
property: 'padding-right',
|
|
16452
|
+
el: element
|
|
16453
|
+
});
|
|
16454
|
+
element.style.paddingRight = "".concat(getPaddingRight(element) + scrollbarSize, "px");
|
|
16455
|
+
});
|
|
16456
|
+
}
|
|
16457
|
+
var scrollContainer;
|
|
16458
|
+
if (container.parentNode instanceof DocumentFragment) {
|
|
16459
|
+
scrollContainer = ownerDocument(container).body;
|
|
16460
|
+
} else {
|
|
16461
|
+
// Support html overflow-y: auto for scroll stability between pages
|
|
16462
|
+
// https://css-tricks.com/snippets/css/force-vertical-scrollbar/
|
|
16463
|
+
var parent = container.parentElement;
|
|
16464
|
+
var containerWindow = ownerWindow(container);
|
|
16465
|
+
scrollContainer = (parent == null ? void 0 : parent.nodeName) === 'HTML' && containerWindow.getComputedStyle(parent).overflowY === 'scroll' ? parent : container;
|
|
16466
|
+
}
|
|
16491
16467
|
|
|
16492
|
-
|
|
16493
|
-
|
|
16468
|
+
// Block the scroll even if no scrollbar is visible to account for mobile keyboard
|
|
16469
|
+
// screensize shrink.
|
|
16470
|
+
restoreStyle.push({
|
|
16471
|
+
value: scrollContainer.style.overflow,
|
|
16472
|
+
property: 'overflow',
|
|
16473
|
+
el: scrollContainer
|
|
16474
|
+
}, {
|
|
16475
|
+
value: scrollContainer.style.overflowX,
|
|
16476
|
+
property: 'overflow-x',
|
|
16477
|
+
el: scrollContainer
|
|
16478
|
+
}, {
|
|
16479
|
+
value: scrollContainer.style.overflowY,
|
|
16480
|
+
property: 'overflow-y',
|
|
16481
|
+
el: scrollContainer
|
|
16482
|
+
});
|
|
16483
|
+
scrollContainer.style.overflow = 'hidden';
|
|
16484
|
+
}
|
|
16485
|
+
var restore = function restore() {
|
|
16486
|
+
restoreStyle.forEach(function (_ref) {
|
|
16487
|
+
var value = _ref.value,
|
|
16488
|
+
el = _ref.el,
|
|
16489
|
+
property = _ref.property;
|
|
16490
|
+
if (value) {
|
|
16491
|
+
el.style.setProperty(property, value);
|
|
16494
16492
|
} else {
|
|
16495
|
-
|
|
16493
|
+
el.style.removeProperty(property);
|
|
16496
16494
|
}
|
|
16497
16495
|
});
|
|
16496
|
+
};
|
|
16497
|
+
return restore;
|
|
16498
|
+
}
|
|
16499
|
+
function getHiddenSiblings(container) {
|
|
16500
|
+
var hiddenSiblings = [];
|
|
16501
|
+
[].forEach.call(container.children, function (element) {
|
|
16502
|
+
if (element.getAttribute('aria-hidden') === 'true') {
|
|
16503
|
+
hiddenSiblings.push(element);
|
|
16504
|
+
}
|
|
16498
16505
|
});
|
|
16506
|
+
return hiddenSiblings;
|
|
16499
16507
|
}
|
|
16500
|
-
|
|
16501
|
-
|
|
16502
|
-
|
|
16503
|
-
|
|
16504
|
-
|
|
16505
|
-
|
|
16506
|
-
|
|
16507
|
-
|
|
16508
|
-
|
|
16509
|
-
|
|
16510
|
-
|
|
16511
|
-
|
|
16512
|
-
|
|
16513
|
-
|
|
16514
|
-
};
|
|
16515
|
-
Object.assign(state.elements.popper.style, initialStyles.popper);
|
|
16516
|
-
state.styles = initialStyles;
|
|
16517
|
-
|
|
16518
|
-
if (state.elements.arrow) {
|
|
16519
|
-
Object.assign(state.elements.arrow.style, initialStyles.arrow);
|
|
16508
|
+
/**
|
|
16509
|
+
* @ignore - do not document.
|
|
16510
|
+
*
|
|
16511
|
+
* Proper state management for containers and the modals in those containers.
|
|
16512
|
+
* Simplified, but inspired by react-overlay's ModalManager class.
|
|
16513
|
+
* Used by the Modal to ensure proper styling of containers.
|
|
16514
|
+
*/
|
|
16515
|
+
var ModalManager = /*#__PURE__*/function () {
|
|
16516
|
+
function ModalManager() {
|
|
16517
|
+
_classCallCheck(this, ModalManager);
|
|
16518
|
+
this.containers = void 0;
|
|
16519
|
+
this.modals = void 0;
|
|
16520
|
+
this.modals = [];
|
|
16521
|
+
this.containers = [];
|
|
16520
16522
|
}
|
|
16521
|
-
|
|
16522
|
-
|
|
16523
|
-
|
|
16524
|
-
var
|
|
16525
|
-
|
|
16526
|
-
|
|
16527
|
-
|
|
16528
|
-
var style = styleProperties.reduce(function (style, property) {
|
|
16529
|
-
style[property] = '';
|
|
16530
|
-
return style;
|
|
16531
|
-
}, {}); // arrow is optional + virtual elements
|
|
16532
|
-
|
|
16533
|
-
if (!isHTMLElement$1(element) || !getNodeName(element)) {
|
|
16534
|
-
return;
|
|
16523
|
+
_createClass(ModalManager, [{
|
|
16524
|
+
key: "add",
|
|
16525
|
+
value: function add(modal, container) {
|
|
16526
|
+
var modalIndex = this.modals.indexOf(modal);
|
|
16527
|
+
if (modalIndex !== -1) {
|
|
16528
|
+
return modalIndex;
|
|
16535
16529
|
}
|
|
16530
|
+
modalIndex = this.modals.length;
|
|
16531
|
+
this.modals.push(modal);
|
|
16536
16532
|
|
|
16537
|
-
|
|
16538
|
-
|
|
16539
|
-
|
|
16533
|
+
// If the modal we are adding is already in the DOM.
|
|
16534
|
+
if (modal.modalRef) {
|
|
16535
|
+
ariaHidden(modal.modalRef, false);
|
|
16536
|
+
}
|
|
16537
|
+
var hiddenSiblings = getHiddenSiblings(container);
|
|
16538
|
+
ariaHiddenSiblings(container, modal.mount, modal.modalRef, hiddenSiblings, true);
|
|
16539
|
+
var containerIndex = findIndexOf(this.containers, function (item) {
|
|
16540
|
+
return item.container === container;
|
|
16540
16541
|
});
|
|
16541
|
-
|
|
16542
|
-
|
|
16543
|
-
|
|
16542
|
+
if (containerIndex !== -1) {
|
|
16543
|
+
this.containers[containerIndex].modals.push(modal);
|
|
16544
|
+
return modalIndex;
|
|
16545
|
+
}
|
|
16546
|
+
this.containers.push({
|
|
16547
|
+
modals: [modal],
|
|
16548
|
+
container: container,
|
|
16549
|
+
restore: null,
|
|
16550
|
+
hiddenSiblings: hiddenSiblings
|
|
16551
|
+
});
|
|
16552
|
+
return modalIndex;
|
|
16553
|
+
}
|
|
16554
|
+
}, {
|
|
16555
|
+
key: "mount",
|
|
16556
|
+
value: function mount(modal, props) {
|
|
16557
|
+
var containerIndex = findIndexOf(this.containers, function (item) {
|
|
16558
|
+
return item.modals.indexOf(modal) !== -1;
|
|
16559
|
+
});
|
|
16560
|
+
var containerInfo = this.containers[containerIndex];
|
|
16561
|
+
if (!containerInfo.restore) {
|
|
16562
|
+
containerInfo.restore = handleContainer(containerInfo, props);
|
|
16563
|
+
}
|
|
16564
|
+
}
|
|
16565
|
+
}, {
|
|
16566
|
+
key: "remove",
|
|
16567
|
+
value: function remove(modal) {
|
|
16568
|
+
var ariaHiddenState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
16569
|
+
var modalIndex = this.modals.indexOf(modal);
|
|
16570
|
+
if (modalIndex === -1) {
|
|
16571
|
+
return modalIndex;
|
|
16572
|
+
}
|
|
16573
|
+
var containerIndex = findIndexOf(this.containers, function (item) {
|
|
16574
|
+
return item.modals.indexOf(modal) !== -1;
|
|
16575
|
+
});
|
|
16576
|
+
var containerInfo = this.containers[containerIndex];
|
|
16577
|
+
containerInfo.modals.splice(containerInfo.modals.indexOf(modal), 1);
|
|
16578
|
+
this.modals.splice(modalIndex, 1);
|
|
16544
16579
|
|
|
16580
|
+
// If that was the last modal in a container, clean up the container.
|
|
16581
|
+
if (containerInfo.modals.length === 0) {
|
|
16582
|
+
// The modal might be closed before it had the chance to be mounted in the DOM.
|
|
16583
|
+
if (containerInfo.restore) {
|
|
16584
|
+
containerInfo.restore();
|
|
16585
|
+
}
|
|
16586
|
+
if (modal.modalRef) {
|
|
16587
|
+
// In case the modal wasn't in the DOM yet.
|
|
16588
|
+
ariaHidden(modal.modalRef, ariaHiddenState);
|
|
16589
|
+
}
|
|
16590
|
+
ariaHiddenSiblings(containerInfo.container, modal.mount, modal.modalRef, containerInfo.hiddenSiblings, false);
|
|
16591
|
+
this.containers.splice(containerIndex, 1);
|
|
16592
|
+
} else {
|
|
16593
|
+
// Otherwise make sure the next top modal is visible to a screen reader.
|
|
16594
|
+
var nextTop = containerInfo.modals[containerInfo.modals.length - 1];
|
|
16595
|
+
// as soon as a modal is adding its modalRef is undefined. it can't set
|
|
16596
|
+
// aria-hidden because the dom element doesn't exist either
|
|
16597
|
+
// when modal was unmounted before modalRef gets null
|
|
16598
|
+
if (nextTop.modalRef) {
|
|
16599
|
+
ariaHidden(nextTop.modalRef, false);
|
|
16600
|
+
}
|
|
16601
|
+
}
|
|
16602
|
+
return modalIndex;
|
|
16603
|
+
}
|
|
16604
|
+
}, {
|
|
16605
|
+
key: "isTopModal",
|
|
16606
|
+
value: function isTopModal(modal) {
|
|
16607
|
+
return this.modals.length > 0 && this.modals[this.modals.length - 1] === modal;
|
|
16608
|
+
}
|
|
16609
|
+
}]);
|
|
16610
|
+
return ModalManager;
|
|
16611
|
+
}();
|
|
16545
16612
|
|
|
16546
|
-
|
|
16547
|
-
|
|
16548
|
-
|
|
16549
|
-
|
|
16613
|
+
function getContainer(container) {
|
|
16614
|
+
return typeof container === 'function' ? container() : container;
|
|
16615
|
+
}
|
|
16616
|
+
function getHasTransition(children) {
|
|
16617
|
+
return children ? children.props.hasOwnProperty('in') : false;
|
|
16618
|
+
}
|
|
16619
|
+
|
|
16620
|
+
// A modal manager used to track and manage the state of open Modals.
|
|
16621
|
+
// Modals don't open on the server so this won't conflict with concurrent requests.
|
|
16622
|
+
var defaultManager = new ModalManager();
|
|
16623
|
+
/**
|
|
16624
|
+
*
|
|
16625
|
+
* Demos:
|
|
16626
|
+
*
|
|
16627
|
+
* - [Modal](https://mui.com/base-ui/react-modal/#hook)
|
|
16628
|
+
*
|
|
16629
|
+
* API:
|
|
16630
|
+
*
|
|
16631
|
+
* - [useModal API](https://mui.com/base-ui/react-modal/hooks-api/#use-modal)
|
|
16632
|
+
*/
|
|
16633
|
+
function useModal(parameters) {
|
|
16634
|
+
var container = parameters.container,
|
|
16635
|
+
_parameters$disableEs = parameters.disableEscapeKeyDown,
|
|
16636
|
+
disableEscapeKeyDown = _parameters$disableEs === void 0 ? false : _parameters$disableEs,
|
|
16637
|
+
_parameters$disableSc = parameters.disableScrollLock,
|
|
16638
|
+
disableScrollLock = _parameters$disableSc === void 0 ? false : _parameters$disableSc,
|
|
16639
|
+
_parameters$manager = parameters.manager,
|
|
16640
|
+
manager = _parameters$manager === void 0 ? defaultManager : _parameters$manager,
|
|
16641
|
+
_parameters$closeAfte = parameters.closeAfterTransition,
|
|
16642
|
+
closeAfterTransition = _parameters$closeAfte === void 0 ? false : _parameters$closeAfte,
|
|
16643
|
+
onTransitionEnter = parameters.onTransitionEnter,
|
|
16644
|
+
onTransitionExited = parameters.onTransitionExited,
|
|
16645
|
+
children = parameters.children,
|
|
16646
|
+
onClose = parameters.onClose,
|
|
16647
|
+
open = parameters.open,
|
|
16648
|
+
rootRef = parameters.rootRef; // @ts-ignore internal logic
|
|
16649
|
+
var modal = React__namespace.useRef({});
|
|
16650
|
+
var mountNodeRef = React__namespace.useRef(null);
|
|
16651
|
+
var modalRef = React__namespace.useRef(null);
|
|
16652
|
+
var handleRef = useForkRef(modalRef, rootRef);
|
|
16653
|
+
var _React$useState = React__namespace.useState(!open),
|
|
16654
|
+
exited = _React$useState[0],
|
|
16655
|
+
setExited = _React$useState[1];
|
|
16656
|
+
var hasTransition = getHasTransition(children);
|
|
16657
|
+
var ariaHiddenProp = true;
|
|
16658
|
+
if (parameters['aria-hidden'] === 'false' || parameters['aria-hidden'] === false) {
|
|
16659
|
+
ariaHiddenProp = false;
|
|
16660
|
+
}
|
|
16661
|
+
var getDoc = function getDoc() {
|
|
16662
|
+
return ownerDocument(mountNodeRef.current);
|
|
16663
|
+
};
|
|
16664
|
+
var getModal = function getModal() {
|
|
16665
|
+
modal.current.modalRef = modalRef.current;
|
|
16666
|
+
modal.current.mount = mountNodeRef.current;
|
|
16667
|
+
return modal.current;
|
|
16668
|
+
};
|
|
16669
|
+
var handleMounted = function handleMounted() {
|
|
16670
|
+
manager.mount(getModal(), {
|
|
16671
|
+
disableScrollLock: disableScrollLock
|
|
16672
|
+
});
|
|
16673
|
+
|
|
16674
|
+
// Fix a bug on Chrome where the scroll isn't initially 0.
|
|
16675
|
+
if (modalRef.current) {
|
|
16676
|
+
modalRef.current.scrollTop = 0;
|
|
16677
|
+
}
|
|
16678
|
+
};
|
|
16679
|
+
var handleOpen = useEventCallback(function () {
|
|
16680
|
+
var resolvedContainer = getContainer(container) || getDoc().body;
|
|
16681
|
+
manager.add(getModal(), resolvedContainer);
|
|
16682
|
+
|
|
16683
|
+
// The element was already mounted.
|
|
16684
|
+
if (modalRef.current) {
|
|
16685
|
+
handleMounted();
|
|
16686
|
+
}
|
|
16687
|
+
});
|
|
16688
|
+
var isTopModal = React__namespace.useCallback(function () {
|
|
16689
|
+
return manager.isTopModal(getModal());
|
|
16690
|
+
}, [manager]);
|
|
16691
|
+
var handlePortalRef = useEventCallback(function (node) {
|
|
16692
|
+
mountNodeRef.current = node;
|
|
16693
|
+
if (!node) {
|
|
16694
|
+
return;
|
|
16695
|
+
}
|
|
16696
|
+
if (open && isTopModal()) {
|
|
16697
|
+
handleMounted();
|
|
16698
|
+
} else if (modalRef.current) {
|
|
16699
|
+
ariaHidden(modalRef.current, ariaHiddenProp);
|
|
16700
|
+
}
|
|
16701
|
+
});
|
|
16702
|
+
var handleClose = React__namespace.useCallback(function () {
|
|
16703
|
+
manager.remove(getModal(), ariaHiddenProp);
|
|
16704
|
+
}, [ariaHiddenProp, manager]);
|
|
16705
|
+
React__namespace.useEffect(function () {
|
|
16706
|
+
return function () {
|
|
16707
|
+
handleClose();
|
|
16708
|
+
};
|
|
16709
|
+
}, [handleClose]);
|
|
16710
|
+
React__namespace.useEffect(function () {
|
|
16711
|
+
if (open) {
|
|
16712
|
+
handleOpen();
|
|
16713
|
+
} else if (!hasTransition || !closeAfterTransition) {
|
|
16714
|
+
handleClose();
|
|
16715
|
+
}
|
|
16716
|
+
}, [open, handleClose, hasTransition, closeAfterTransition, handleOpen]);
|
|
16717
|
+
var createHandleKeyDown = function createHandleKeyDown(otherHandlers) {
|
|
16718
|
+
return function (event) {
|
|
16719
|
+
var _otherHandlers$onKeyD;
|
|
16720
|
+
(_otherHandlers$onKeyD = otherHandlers.onKeyDown) == null || _otherHandlers$onKeyD.call(otherHandlers, event);
|
|
16721
|
+
|
|
16722
|
+
// The handler doesn't take event.defaultPrevented into account:
|
|
16723
|
+
//
|
|
16724
|
+
// event.preventDefault() is meant to stop default behaviors like
|
|
16725
|
+
// clicking a checkbox to check it, hitting a button to submit a form,
|
|
16726
|
+
// and hitting left arrow to move the cursor in a text input etc.
|
|
16727
|
+
// Only special HTML elements have these default behaviors.
|
|
16728
|
+
if (event.key !== 'Escape' || event.which === 229 ||
|
|
16729
|
+
// Wait until IME is settled.
|
|
16730
|
+
!isTopModal()) {
|
|
16731
|
+
return;
|
|
16732
|
+
}
|
|
16733
|
+
if (!disableEscapeKeyDown) {
|
|
16734
|
+
// Swallow the event, in case someone is listening for the escape key on the body.
|
|
16735
|
+
event.stopPropagation();
|
|
16736
|
+
if (onClose) {
|
|
16737
|
+
onClose(event, 'escapeKeyDown');
|
|
16738
|
+
}
|
|
16739
|
+
}
|
|
16740
|
+
};
|
|
16741
|
+
};
|
|
16742
|
+
var createHandleBackdropClick = function createHandleBackdropClick(otherHandlers) {
|
|
16743
|
+
return function (event) {
|
|
16744
|
+
var _otherHandlers$onClic;
|
|
16745
|
+
(_otherHandlers$onClic = otherHandlers.onClick) == null || _otherHandlers$onClic.call(otherHandlers, event);
|
|
16746
|
+
if (event.target !== event.currentTarget) {
|
|
16747
|
+
return;
|
|
16748
|
+
}
|
|
16749
|
+
if (onClose) {
|
|
16750
|
+
onClose(event, 'backdropClick');
|
|
16751
|
+
}
|
|
16752
|
+
};
|
|
16753
|
+
};
|
|
16754
|
+
var getRootProps = function getRootProps() {
|
|
16755
|
+
var otherHandlers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
16756
|
+
var propsEventHandlers = extractEventHandlers(parameters);
|
|
16757
|
+
|
|
16758
|
+
// The custom event handlers shouldn't be spread on the root element
|
|
16759
|
+
delete propsEventHandlers.onTransitionEnter;
|
|
16760
|
+
delete propsEventHandlers.onTransitionExited;
|
|
16761
|
+
var externalEventHandlers = _extends({}, propsEventHandlers, otherHandlers);
|
|
16762
|
+
return _extends({
|
|
16763
|
+
role: 'presentation'
|
|
16764
|
+
}, externalEventHandlers, {
|
|
16765
|
+
onKeyDown: createHandleKeyDown(externalEventHandlers),
|
|
16766
|
+
ref: handleRef
|
|
16767
|
+
});
|
|
16768
|
+
};
|
|
16769
|
+
var getBackdropProps = function getBackdropProps() {
|
|
16770
|
+
var otherHandlers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
16771
|
+
var externalEventHandlers = otherHandlers;
|
|
16772
|
+
return _extends({
|
|
16773
|
+
'aria-hidden': true
|
|
16774
|
+
}, externalEventHandlers, {
|
|
16775
|
+
onClick: createHandleBackdropClick(externalEventHandlers),
|
|
16776
|
+
open: open
|
|
16777
|
+
});
|
|
16778
|
+
};
|
|
16779
|
+
var getTransitionProps = function getTransitionProps() {
|
|
16780
|
+
var handleEnter = function handleEnter() {
|
|
16781
|
+
setExited(false);
|
|
16782
|
+
if (onTransitionEnter) {
|
|
16783
|
+
onTransitionEnter();
|
|
16784
|
+
}
|
|
16785
|
+
};
|
|
16786
|
+
var handleExited = function handleExited() {
|
|
16787
|
+
setExited(true);
|
|
16788
|
+
if (onTransitionExited) {
|
|
16789
|
+
onTransitionExited();
|
|
16790
|
+
}
|
|
16791
|
+
if (closeAfterTransition) {
|
|
16792
|
+
handleClose();
|
|
16793
|
+
}
|
|
16794
|
+
};
|
|
16795
|
+
return {
|
|
16796
|
+
onEnter: createChainedFunction(handleEnter, children == null ? void 0 : children.props.onEnter),
|
|
16797
|
+
onExited: createChainedFunction(handleExited, children == null ? void 0 : children.props.onExited)
|
|
16798
|
+
};
|
|
16799
|
+
};
|
|
16800
|
+
return {
|
|
16801
|
+
getRootProps: getRootProps,
|
|
16802
|
+
getBackdropProps: getBackdropProps,
|
|
16803
|
+
getTransitionProps: getTransitionProps,
|
|
16804
|
+
rootRef: handleRef,
|
|
16805
|
+
portalRef: handlePortalRef,
|
|
16806
|
+
isTopModal: isTopModal,
|
|
16807
|
+
exited: exited,
|
|
16808
|
+
hasTransition: hasTransition
|
|
16809
|
+
};
|
|
16810
|
+
}
|
|
16811
|
+
|
|
16812
|
+
/**
|
|
16813
|
+
* NoSsr purposely removes components from the subject of Server Side Rendering (SSR).
|
|
16814
|
+
*
|
|
16815
|
+
* This component can be useful in a variety of situations:
|
|
16816
|
+
*
|
|
16817
|
+
* * Escape hatch for broken dependencies not supporting SSR.
|
|
16818
|
+
* * Improve the time-to-first paint on the client by only rendering above the fold.
|
|
16819
|
+
* * Reduce the rendering time on the server.
|
|
16820
|
+
* * Under too heavy server load, you can turn on service degradation.
|
|
16821
|
+
*
|
|
16822
|
+
* Demos:
|
|
16823
|
+
*
|
|
16824
|
+
* - [No SSR](https://mui.com/base-ui/react-no-ssr/)
|
|
16825
|
+
*
|
|
16826
|
+
* API:
|
|
16827
|
+
*
|
|
16828
|
+
* - [NoSsr API](https://mui.com/base-ui/react-no-ssr/components-api/#no-ssr)
|
|
16829
|
+
*/
|
|
16830
|
+
function NoSsr(props) {
|
|
16831
|
+
var children = props.children,
|
|
16832
|
+
_props$defer = props.defer,
|
|
16833
|
+
defer = _props$defer === void 0 ? false : _props$defer,
|
|
16834
|
+
_props$fallback = props.fallback,
|
|
16835
|
+
fallback = _props$fallback === void 0 ? null : _props$fallback;
|
|
16836
|
+
var _React$useState = React__namespace.useState(false),
|
|
16837
|
+
mountedState = _React$useState[0],
|
|
16838
|
+
setMountedState = _React$useState[1];
|
|
16839
|
+
useEnhancedEffect$1(function () {
|
|
16840
|
+
if (!defer) {
|
|
16841
|
+
setMountedState(true);
|
|
16842
|
+
}
|
|
16843
|
+
}, [defer]);
|
|
16844
|
+
React__namespace.useEffect(function () {
|
|
16845
|
+
if (defer) {
|
|
16846
|
+
setMountedState(true);
|
|
16847
|
+
}
|
|
16848
|
+
}, [defer]);
|
|
16849
|
+
|
|
16850
|
+
// We need the Fragment here to force react-docgen to recognise NoSsr as a component.
|
|
16851
|
+
return /*#__PURE__*/jsxRuntime_1(React__namespace.Fragment, {
|
|
16852
|
+
children: mountedState ? children : fallback
|
|
16853
|
+
});
|
|
16854
|
+
}
|
|
16855
|
+
NoSsr.propTypes /* remove-proptypes */ = {
|
|
16856
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
16857
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
16858
|
+
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
16859
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
16860
|
+
/**
|
|
16861
|
+
* You can wrap a node.
|
|
16862
|
+
*/
|
|
16863
|
+
children: PropTypes.node,
|
|
16864
|
+
/**
|
|
16865
|
+
* If `true`, the component will not only prevent server-side rendering.
|
|
16866
|
+
* It will also defer the rendering of the children into a different screen frame.
|
|
16867
|
+
* @default false
|
|
16868
|
+
*/
|
|
16869
|
+
defer: PropTypes.bool,
|
|
16870
|
+
/**
|
|
16871
|
+
* The fallback content to display.
|
|
16872
|
+
* @default null
|
|
16873
|
+
*/
|
|
16874
|
+
fallback: PropTypes.node
|
|
16875
|
+
} ;
|
|
16876
|
+
{
|
|
16877
|
+
// eslint-disable-next-line
|
|
16878
|
+
NoSsr['propTypes' + ''] = exactProp(NoSsr.propTypes);
|
|
16879
|
+
}
|
|
16880
|
+
|
|
16881
|
+
var top = 'top';
|
|
16882
|
+
var bottom = 'bottom';
|
|
16883
|
+
var right = 'right';
|
|
16884
|
+
var left = 'left';
|
|
16885
|
+
var auto = 'auto';
|
|
16886
|
+
var basePlacements = [top, bottom, right, left];
|
|
16887
|
+
var start = 'start';
|
|
16888
|
+
var end = 'end';
|
|
16889
|
+
var clippingParents = 'clippingParents';
|
|
16890
|
+
var viewport = 'viewport';
|
|
16891
|
+
var popper = 'popper';
|
|
16892
|
+
var reference = 'reference';
|
|
16893
|
+
var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
|
|
16894
|
+
return acc.concat([placement + "-" + start, placement + "-" + end]);
|
|
16895
|
+
}, []);
|
|
16896
|
+
var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
|
|
16897
|
+
return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
|
|
16898
|
+
}, []); // modifiers that need to read the DOM
|
|
16899
|
+
|
|
16900
|
+
var beforeRead = 'beforeRead';
|
|
16901
|
+
var read = 'read';
|
|
16902
|
+
var afterRead = 'afterRead'; // pure-logic modifiers
|
|
16903
|
+
|
|
16904
|
+
var beforeMain = 'beforeMain';
|
|
16905
|
+
var main = 'main';
|
|
16906
|
+
var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
|
|
16907
|
+
|
|
16908
|
+
var beforeWrite = 'beforeWrite';
|
|
16909
|
+
var write = 'write';
|
|
16910
|
+
var afterWrite = 'afterWrite';
|
|
16911
|
+
var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
|
|
16912
|
+
|
|
16913
|
+
function getNodeName(element) {
|
|
16914
|
+
return element ? (element.nodeName || '').toLowerCase() : null;
|
|
16915
|
+
}
|
|
16916
|
+
|
|
16917
|
+
function getWindow(node) {
|
|
16918
|
+
if (node == null) {
|
|
16919
|
+
return window;
|
|
16920
|
+
}
|
|
16921
|
+
|
|
16922
|
+
if (node.toString() !== '[object Window]') {
|
|
16923
|
+
var ownerDocument = node.ownerDocument;
|
|
16924
|
+
return ownerDocument ? ownerDocument.defaultView || window : window;
|
|
16925
|
+
}
|
|
16926
|
+
|
|
16927
|
+
return node;
|
|
16928
|
+
}
|
|
16929
|
+
|
|
16930
|
+
function isElement(node) {
|
|
16931
|
+
var OwnElement = getWindow(node).Element;
|
|
16932
|
+
return node instanceof OwnElement || node instanceof Element;
|
|
16933
|
+
}
|
|
16934
|
+
|
|
16935
|
+
function isHTMLElement$1(node) {
|
|
16936
|
+
var OwnElement = getWindow(node).HTMLElement;
|
|
16937
|
+
return node instanceof OwnElement || node instanceof HTMLElement;
|
|
16938
|
+
}
|
|
16939
|
+
|
|
16940
|
+
function isShadowRoot(node) {
|
|
16941
|
+
// IE 11 has no ShadowRoot
|
|
16942
|
+
if (typeof ShadowRoot === 'undefined') {
|
|
16943
|
+
return false;
|
|
16944
|
+
}
|
|
16945
|
+
|
|
16946
|
+
var OwnElement = getWindow(node).ShadowRoot;
|
|
16947
|
+
return node instanceof OwnElement || node instanceof ShadowRoot;
|
|
16948
|
+
}
|
|
16949
|
+
|
|
16950
|
+
// and applies them to the HTMLElements such as popper and arrow
|
|
16951
|
+
|
|
16952
|
+
function applyStyles(_ref) {
|
|
16953
|
+
var state = _ref.state;
|
|
16954
|
+
Object.keys(state.elements).forEach(function (name) {
|
|
16955
|
+
var style = state.styles[name] || {};
|
|
16956
|
+
var attributes = state.attributes[name] || {};
|
|
16957
|
+
var element = state.elements[name]; // arrow is optional + virtual elements
|
|
16958
|
+
|
|
16959
|
+
if (!isHTMLElement$1(element) || !getNodeName(element)) {
|
|
16960
|
+
return;
|
|
16961
|
+
} // Flow doesn't support to extend this property, but it's the most
|
|
16962
|
+
// effective way to apply styles to an HTMLElement
|
|
16963
|
+
// $FlowFixMe[cannot-write]
|
|
16964
|
+
|
|
16965
|
+
|
|
16966
|
+
Object.assign(element.style, style);
|
|
16967
|
+
Object.keys(attributes).forEach(function (name) {
|
|
16968
|
+
var value = attributes[name];
|
|
16969
|
+
|
|
16970
|
+
if (value === false) {
|
|
16971
|
+
element.removeAttribute(name);
|
|
16972
|
+
} else {
|
|
16973
|
+
element.setAttribute(name, value === true ? '' : value);
|
|
16974
|
+
}
|
|
16975
|
+
});
|
|
16976
|
+
});
|
|
16977
|
+
}
|
|
16978
|
+
|
|
16979
|
+
function effect$2(_ref2) {
|
|
16980
|
+
var state = _ref2.state;
|
|
16981
|
+
var initialStyles = {
|
|
16982
|
+
popper: {
|
|
16983
|
+
position: state.options.strategy,
|
|
16984
|
+
left: '0',
|
|
16985
|
+
top: '0',
|
|
16986
|
+
margin: '0'
|
|
16987
|
+
},
|
|
16988
|
+
arrow: {
|
|
16989
|
+
position: 'absolute'
|
|
16990
|
+
},
|
|
16991
|
+
reference: {}
|
|
16992
|
+
};
|
|
16993
|
+
Object.assign(state.elements.popper.style, initialStyles.popper);
|
|
16994
|
+
state.styles = initialStyles;
|
|
16995
|
+
|
|
16996
|
+
if (state.elements.arrow) {
|
|
16997
|
+
Object.assign(state.elements.arrow.style, initialStyles.arrow);
|
|
16998
|
+
}
|
|
16999
|
+
|
|
17000
|
+
return function () {
|
|
17001
|
+
Object.keys(state.elements).forEach(function (name) {
|
|
17002
|
+
var element = state.elements[name];
|
|
17003
|
+
var attributes = state.attributes[name] || {};
|
|
17004
|
+
var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them
|
|
17005
|
+
|
|
17006
|
+
var style = styleProperties.reduce(function (style, property) {
|
|
17007
|
+
style[property] = '';
|
|
17008
|
+
return style;
|
|
17009
|
+
}, {}); // arrow is optional + virtual elements
|
|
17010
|
+
|
|
17011
|
+
if (!isHTMLElement$1(element) || !getNodeName(element)) {
|
|
17012
|
+
return;
|
|
17013
|
+
}
|
|
17014
|
+
|
|
17015
|
+
Object.assign(element.style, style);
|
|
17016
|
+
Object.keys(attributes).forEach(function (attribute) {
|
|
17017
|
+
element.removeAttribute(attribute);
|
|
17018
|
+
});
|
|
17019
|
+
});
|
|
17020
|
+
};
|
|
17021
|
+
} // eslint-disable-next-line import/no-unused-modules
|
|
17022
|
+
|
|
17023
|
+
|
|
17024
|
+
var applyStyles$1 = {
|
|
17025
|
+
name: 'applyStyles',
|
|
17026
|
+
enabled: true,
|
|
17027
|
+
phase: 'write',
|
|
16550
17028
|
fn: applyStyles,
|
|
16551
17029
|
effect: effect$2,
|
|
16552
17030
|
requires: ['computeStyles']
|
|
@@ -18191,91 +18669,6 @@
|
|
|
18191
18669
|
defaultModifiers: defaultModifiers
|
|
18192
18670
|
}); // eslint-disable-next-line import/no-unused-modules
|
|
18193
18671
|
|
|
18194
|
-
function getContainer$1(container) {
|
|
18195
|
-
return typeof container === 'function' ? container() : container;
|
|
18196
|
-
}
|
|
18197
|
-
|
|
18198
|
-
/**
|
|
18199
|
-
* Portals provide a first-class way to render children into a DOM node
|
|
18200
|
-
* that exists outside the DOM hierarchy of the parent component.
|
|
18201
|
-
*
|
|
18202
|
-
* Demos:
|
|
18203
|
-
*
|
|
18204
|
-
* - [Portal](https://mui.com/base-ui/react-portal/)
|
|
18205
|
-
*
|
|
18206
|
-
* API:
|
|
18207
|
-
*
|
|
18208
|
-
* - [Portal API](https://mui.com/base-ui/react-portal/components-api/#portal)
|
|
18209
|
-
*/
|
|
18210
|
-
var Portal = /*#__PURE__*/React__namespace.forwardRef(function Portal(props, forwardedRef) {
|
|
18211
|
-
var children = props.children,
|
|
18212
|
-
container = props.container,
|
|
18213
|
-
_props$disablePortal = props.disablePortal,
|
|
18214
|
-
disablePortal = _props$disablePortal === void 0 ? false : _props$disablePortal;
|
|
18215
|
-
var _React$useState = React__namespace.useState(null),
|
|
18216
|
-
mountNode = _React$useState[0],
|
|
18217
|
-
setMountNode = _React$useState[1]; // @ts-expect-error TODO upstream fix
|
|
18218
|
-
var handleRef = useForkRef( /*#__PURE__*/React__namespace.isValidElement(children) ? children.ref : null, forwardedRef);
|
|
18219
|
-
useEnhancedEffect$1(function () {
|
|
18220
|
-
if (!disablePortal) {
|
|
18221
|
-
setMountNode(getContainer$1(container) || document.body);
|
|
18222
|
-
}
|
|
18223
|
-
}, [container, disablePortal]);
|
|
18224
|
-
useEnhancedEffect$1(function () {
|
|
18225
|
-
if (mountNode && !disablePortal) {
|
|
18226
|
-
setRef(forwardedRef, mountNode);
|
|
18227
|
-
return function () {
|
|
18228
|
-
setRef(forwardedRef, null);
|
|
18229
|
-
};
|
|
18230
|
-
}
|
|
18231
|
-
return undefined;
|
|
18232
|
-
}, [forwardedRef, mountNode, disablePortal]);
|
|
18233
|
-
if (disablePortal) {
|
|
18234
|
-
if ( /*#__PURE__*/React__namespace.isValidElement(children)) {
|
|
18235
|
-
var newProps = {
|
|
18236
|
-
ref: handleRef
|
|
18237
|
-
};
|
|
18238
|
-
return /*#__PURE__*/React__namespace.cloneElement(children, newProps);
|
|
18239
|
-
}
|
|
18240
|
-
return /*#__PURE__*/jsxRuntime_1(React__namespace.Fragment, {
|
|
18241
|
-
children: children
|
|
18242
|
-
});
|
|
18243
|
-
}
|
|
18244
|
-
return /*#__PURE__*/jsxRuntime_1(React__namespace.Fragment, {
|
|
18245
|
-
children: mountNode ? /*#__PURE__*/ReactDOM__namespace.createPortal(children, mountNode) : mountNode
|
|
18246
|
-
});
|
|
18247
|
-
});
|
|
18248
|
-
Portal.propTypes /* remove-proptypes */ = {
|
|
18249
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
18250
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
18251
|
-
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
18252
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
18253
|
-
/**
|
|
18254
|
-
* The children to render into the `container`.
|
|
18255
|
-
*/
|
|
18256
|
-
children: PropTypes.node,
|
|
18257
|
-
/**
|
|
18258
|
-
* An HTML element or function that returns one.
|
|
18259
|
-
* The `container` will have the portal children appended to it.
|
|
18260
|
-
*
|
|
18261
|
-
* You can also provide a callback, which is called in a React layout effect.
|
|
18262
|
-
* This lets you set the container from a ref, and also makes server-side rendering possible.
|
|
18263
|
-
*
|
|
18264
|
-
* By default, it uses the body of the top-level document object,
|
|
18265
|
-
* so it's simply `document.body` most of the time.
|
|
18266
|
-
*/
|
|
18267
|
-
container: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([HTMLElementType, PropTypes.func]),
|
|
18268
|
-
/**
|
|
18269
|
-
* The `children` will be under the DOM hierarchy of the parent component.
|
|
18270
|
-
* @default false
|
|
18271
|
-
*/
|
|
18272
|
-
disablePortal: PropTypes.bool
|
|
18273
|
-
} ;
|
|
18274
|
-
{
|
|
18275
|
-
// eslint-disable-next-line
|
|
18276
|
-
Portal['propTypes' + ''] = exactProp(Portal.propTypes);
|
|
18277
|
-
}
|
|
18278
|
-
|
|
18279
18672
|
var COMPONENT_NAME = 'Popper';
|
|
18280
18673
|
function getPopperUtilityClass(slot) {
|
|
18281
18674
|
return generateUtilityClass(COMPONENT_NAME, slot);
|
|
@@ -18323,836 +18716,338 @@
|
|
|
18323
18716
|
disablePortal = props.disablePortal,
|
|
18324
18717
|
modifiers = props.modifiers,
|
|
18325
18718
|
open = props.open,
|
|
18326
|
-
initialPlacement = props.placement,
|
|
18327
|
-
popperOptions = props.popperOptions,
|
|
18328
|
-
popperRefProp = props.popperRef,
|
|
18329
|
-
_props$slotProps = props.slotProps,
|
|
18330
|
-
slotProps = _props$slotProps === void 0 ? {} : _props$slotProps,
|
|
18331
|
-
_props$slots = props.slots,
|
|
18332
|
-
slots = _props$slots === void 0 ? {} : _props$slots,
|
|
18333
|
-
TransitionProps = props.TransitionProps;
|
|
18334
|
-
props.ownerState;
|
|
18335
|
-
var other = _objectWithoutProperties(props, ["anchorEl", "children", "direction", "disablePortal", "modifiers", "open", "placement", "popperOptions", "popperRef", "slotProps", "slots", "TransitionProps", "ownerState"]);
|
|
18336
|
-
var tooltipRef = React__namespace.useRef(null);
|
|
18337
|
-
var ownRef = useForkRef(tooltipRef, forwardedRef);
|
|
18338
|
-
var popperRef = React__namespace.useRef(null);
|
|
18339
|
-
var handlePopperRef = useForkRef(popperRef, popperRefProp);
|
|
18340
|
-
var handlePopperRefRef = React__namespace.useRef(handlePopperRef);
|
|
18341
|
-
useEnhancedEffect$1(function () {
|
|
18342
|
-
handlePopperRefRef.current = handlePopperRef;
|
|
18343
|
-
}, [handlePopperRef]);
|
|
18344
|
-
React__namespace.useImperativeHandle(popperRefProp, function () {
|
|
18345
|
-
return popperRef.current;
|
|
18346
|
-
}, []);
|
|
18347
|
-
var rtlPlacement = flipPlacement(initialPlacement, direction);
|
|
18348
|
-
/**
|
|
18349
|
-
* placement initialized from prop but can change during lifetime if modifiers.flip.
|
|
18350
|
-
* modifiers.flip is essentially a flip for controlled/uncontrolled behavior
|
|
18351
|
-
*/
|
|
18352
|
-
var _React$useState = React__namespace.useState(rtlPlacement),
|
|
18353
|
-
placement = _React$useState[0],
|
|
18354
|
-
setPlacement = _React$useState[1];
|
|
18355
|
-
var _React$useState2 = React__namespace.useState(resolveAnchorEl$1(anchorEl)),
|
|
18356
|
-
resolvedAnchorElement = _React$useState2[0],
|
|
18357
|
-
setResolvedAnchorElement = _React$useState2[1];
|
|
18358
|
-
React__namespace.useEffect(function () {
|
|
18359
|
-
if (popperRef.current) {
|
|
18360
|
-
popperRef.current.forceUpdate();
|
|
18361
|
-
}
|
|
18362
|
-
});
|
|
18363
|
-
React__namespace.useEffect(function () {
|
|
18364
|
-
if (anchorEl) {
|
|
18365
|
-
setResolvedAnchorElement(resolveAnchorEl$1(anchorEl));
|
|
18366
|
-
}
|
|
18367
|
-
}, [anchorEl]);
|
|
18368
|
-
useEnhancedEffect$1(function () {
|
|
18369
|
-
if (!resolvedAnchorElement || !open) {
|
|
18370
|
-
return undefined;
|
|
18371
|
-
}
|
|
18372
|
-
var handlePopperUpdate = function handlePopperUpdate(data) {
|
|
18373
|
-
setPlacement(data.placement);
|
|
18374
|
-
};
|
|
18375
|
-
{
|
|
18376
|
-
if (resolvedAnchorElement && isHTMLElement(resolvedAnchorElement) && resolvedAnchorElement.nodeType === 1) {
|
|
18377
|
-
var box = resolvedAnchorElement.getBoundingClientRect();
|
|
18378
|
-
if (box.top === 0 && box.left === 0 && box.right === 0 && box.bottom === 0) {
|
|
18379
|
-
console.warn(['MUI: The `anchorEl` prop provided to the component is invalid.', 'The anchor element should be part of the document layout.', "Make sure the element is present in the document or that it's not display none."].join('\n'));
|
|
18380
|
-
}
|
|
18381
|
-
}
|
|
18382
|
-
}
|
|
18383
|
-
var popperModifiers = [{
|
|
18384
|
-
name: 'preventOverflow',
|
|
18385
|
-
options: {
|
|
18386
|
-
altBoundary: disablePortal
|
|
18387
|
-
}
|
|
18388
|
-
}, {
|
|
18389
|
-
name: 'flip',
|
|
18390
|
-
options: {
|
|
18391
|
-
altBoundary: disablePortal
|
|
18392
|
-
}
|
|
18393
|
-
}, {
|
|
18394
|
-
name: 'onUpdate',
|
|
18395
|
-
enabled: true,
|
|
18396
|
-
phase: 'afterWrite',
|
|
18397
|
-
fn: function fn(_ref) {
|
|
18398
|
-
var state = _ref.state;
|
|
18399
|
-
handlePopperUpdate(state);
|
|
18400
|
-
}
|
|
18401
|
-
}];
|
|
18402
|
-
if (modifiers != null) {
|
|
18403
|
-
popperModifiers = popperModifiers.concat(modifiers);
|
|
18404
|
-
}
|
|
18405
|
-
if (popperOptions && popperOptions.modifiers != null) {
|
|
18406
|
-
popperModifiers = popperModifiers.concat(popperOptions.modifiers);
|
|
18407
|
-
}
|
|
18408
|
-
var popper = createPopper(resolvedAnchorElement, tooltipRef.current, _extends({
|
|
18409
|
-
placement: rtlPlacement
|
|
18410
|
-
}, popperOptions, {
|
|
18411
|
-
modifiers: popperModifiers
|
|
18412
|
-
}));
|
|
18413
|
-
handlePopperRefRef.current(popper);
|
|
18414
|
-
return function () {
|
|
18415
|
-
popper.destroy();
|
|
18416
|
-
handlePopperRefRef.current(null);
|
|
18417
|
-
};
|
|
18418
|
-
}, [resolvedAnchorElement, disablePortal, modifiers, open, popperOptions, rtlPlacement]);
|
|
18419
|
-
var childProps = {
|
|
18420
|
-
placement: placement
|
|
18421
|
-
};
|
|
18422
|
-
if (TransitionProps !== null) {
|
|
18423
|
-
childProps.TransitionProps = TransitionProps;
|
|
18424
|
-
}
|
|
18425
|
-
var classes = useUtilityClasses$1B();
|
|
18426
|
-
var Root = (_slots$root = slots.root) != null ? _slots$root : 'div';
|
|
18427
|
-
var rootProps = useSlotProps({
|
|
18428
|
-
elementType: Root,
|
|
18429
|
-
externalSlotProps: slotProps.root,
|
|
18430
|
-
externalForwardedProps: other,
|
|
18431
|
-
additionalProps: {
|
|
18432
|
-
role: 'tooltip',
|
|
18433
|
-
ref: ownRef
|
|
18434
|
-
},
|
|
18435
|
-
ownerState: props,
|
|
18436
|
-
className: classes.root
|
|
18437
|
-
});
|
|
18438
|
-
return /*#__PURE__*/jsxRuntime_1(Root, _extends({}, rootProps, {
|
|
18439
|
-
children: typeof children === 'function' ? children(childProps) : children
|
|
18440
|
-
}));
|
|
18441
|
-
});
|
|
18442
|
-
|
|
18443
|
-
/**
|
|
18444
|
-
* Poppers rely on the 3rd party library [Popper.js](https://popper.js.org/docs/v2/) for positioning.
|
|
18445
|
-
*
|
|
18446
|
-
* Demos:
|
|
18447
|
-
*
|
|
18448
|
-
* - [Popper](https://mui.com/base-ui/react-popper/)
|
|
18449
|
-
*
|
|
18450
|
-
* API:
|
|
18451
|
-
*
|
|
18452
|
-
* - [Popper API](https://mui.com/base-ui/react-popper/components-api/#popper)
|
|
18453
|
-
*/
|
|
18454
|
-
var Popper$2 = /*#__PURE__*/React__namespace.forwardRef(function Popper(props, forwardedRef) {
|
|
18455
|
-
var anchorEl = props.anchorEl,
|
|
18456
|
-
children = props.children,
|
|
18457
|
-
containerProp = props.container,
|
|
18458
|
-
_props$direction = props.direction,
|
|
18459
|
-
direction = _props$direction === void 0 ? 'ltr' : _props$direction,
|
|
18460
|
-
_props$disablePortal = props.disablePortal,
|
|
18461
|
-
disablePortal = _props$disablePortal === void 0 ? false : _props$disablePortal,
|
|
18462
|
-
_props$keepMounted = props.keepMounted,
|
|
18463
|
-
keepMounted = _props$keepMounted === void 0 ? false : _props$keepMounted,
|
|
18464
|
-
modifiers = props.modifiers,
|
|
18465
|
-
open = props.open,
|
|
18466
|
-
_props$placement = props.placement,
|
|
18467
|
-
placement = _props$placement === void 0 ? 'bottom' : _props$placement,
|
|
18468
|
-
_props$popperOptions = props.popperOptions,
|
|
18469
|
-
popperOptions = _props$popperOptions === void 0 ? defaultPopperOptions : _props$popperOptions,
|
|
18470
|
-
popperRef = props.popperRef,
|
|
18471
|
-
style = props.style,
|
|
18472
|
-
_props$transition = props.transition,
|
|
18473
|
-
transition = _props$transition === void 0 ? false : _props$transition,
|
|
18474
|
-
_props$slotProps2 = props.slotProps,
|
|
18475
|
-
slotProps = _props$slotProps2 === void 0 ? {} : _props$slotProps2,
|
|
18476
|
-
_props$slots2 = props.slots,
|
|
18477
|
-
slots = _props$slots2 === void 0 ? {} : _props$slots2,
|
|
18478
|
-
other = _objectWithoutProperties(props, ["anchorEl", "children", "container", "direction", "disablePortal", "keepMounted", "modifiers", "open", "placement", "popperOptions", "popperRef", "style", "transition", "slotProps", "slots"]);
|
|
18479
|
-
var _React$useState3 = React__namespace.useState(true),
|
|
18480
|
-
exited = _React$useState3[0],
|
|
18481
|
-
setExited = _React$useState3[1];
|
|
18482
|
-
var handleEnter = function handleEnter() {
|
|
18483
|
-
setExited(false);
|
|
18484
|
-
};
|
|
18485
|
-
var handleExited = function handleExited() {
|
|
18486
|
-
setExited(true);
|
|
18487
|
-
};
|
|
18488
|
-
if (!keepMounted && !open && (!transition || exited)) {
|
|
18489
|
-
return null;
|
|
18490
|
-
}
|
|
18491
|
-
|
|
18492
|
-
// If the container prop is provided, use that
|
|
18493
|
-
// If the anchorEl prop is provided, use its parent body element as the container
|
|
18494
|
-
// If neither are provided let the Modal take care of choosing the container
|
|
18495
|
-
var container;
|
|
18496
|
-
if (containerProp) {
|
|
18497
|
-
container = containerProp;
|
|
18498
|
-
} else if (anchorEl) {
|
|
18499
|
-
var resolvedAnchorEl = resolveAnchorEl$1(anchorEl);
|
|
18500
|
-
container = resolvedAnchorEl && isHTMLElement(resolvedAnchorEl) ? ownerDocument(resolvedAnchorEl).body : ownerDocument(null).body;
|
|
18501
|
-
}
|
|
18502
|
-
var display = !open && keepMounted && (!transition || exited) ? 'none' : undefined;
|
|
18503
|
-
var transitionProps = transition ? {
|
|
18504
|
-
"in": open,
|
|
18505
|
-
onEnter: handleEnter,
|
|
18506
|
-
onExited: handleExited
|
|
18507
|
-
} : undefined;
|
|
18508
|
-
return /*#__PURE__*/jsxRuntime_1(Portal, {
|
|
18509
|
-
disablePortal: disablePortal,
|
|
18510
|
-
container: container,
|
|
18511
|
-
children: /*#__PURE__*/jsxRuntime_1(PopperTooltip, _extends({
|
|
18512
|
-
anchorEl: anchorEl,
|
|
18513
|
-
direction: direction,
|
|
18514
|
-
disablePortal: disablePortal,
|
|
18515
|
-
modifiers: modifiers,
|
|
18516
|
-
ref: forwardedRef,
|
|
18517
|
-
open: transition ? !exited : open,
|
|
18518
|
-
placement: placement,
|
|
18519
|
-
popperOptions: popperOptions,
|
|
18520
|
-
popperRef: popperRef,
|
|
18521
|
-
slotProps: slotProps,
|
|
18522
|
-
slots: slots
|
|
18523
|
-
}, other, {
|
|
18524
|
-
style: _extends({
|
|
18525
|
-
// Prevents scroll issue, waiting for Popper.js to add this style once initiated.
|
|
18526
|
-
position: 'fixed',
|
|
18527
|
-
// Fix Popper.js display issue
|
|
18528
|
-
top: 0,
|
|
18529
|
-
left: 0,
|
|
18530
|
-
display: display
|
|
18531
|
-
}, style),
|
|
18532
|
-
TransitionProps: transitionProps,
|
|
18533
|
-
children: children
|
|
18534
|
-
}))
|
|
18535
|
-
});
|
|
18536
|
-
});
|
|
18537
|
-
Popper$2.propTypes /* remove-proptypes */ = {
|
|
18538
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
18539
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
18540
|
-
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
18541
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
18542
|
-
/**
|
|
18543
|
-
* An HTML element, [virtualElement](https://popper.js.org/docs/v2/virtual-elements/),
|
|
18544
|
-
* or a function that returns either.
|
|
18545
|
-
* It's used to set the position of the popper.
|
|
18546
|
-
* The return value will passed as the reference object of the Popper instance.
|
|
18547
|
-
*/
|
|
18548
|
-
anchorEl: chainPropTypes(PropTypes.oneOfType([HTMLElementType, PropTypes.object, PropTypes.func]), function (props) {
|
|
18549
|
-
if (props.open) {
|
|
18550
|
-
var resolvedAnchorEl = resolveAnchorEl$1(props.anchorEl);
|
|
18551
|
-
if (resolvedAnchorEl && isHTMLElement(resolvedAnchorEl) && resolvedAnchorEl.nodeType === 1) {
|
|
18552
|
-
var box = resolvedAnchorEl.getBoundingClientRect();
|
|
18553
|
-
if (box.top === 0 && box.left === 0 && box.right === 0 && box.bottom === 0) {
|
|
18554
|
-
return new Error(['MUI: The `anchorEl` prop provided to the component is invalid.', 'The anchor element should be part of the document layout.', "Make sure the element is present in the document or that it's not display none."].join('\n'));
|
|
18555
|
-
}
|
|
18556
|
-
} else if (!resolvedAnchorEl || typeof resolvedAnchorEl.getBoundingClientRect !== 'function' || isVirtualElement(resolvedAnchorEl) && resolvedAnchorEl.contextElement != null && resolvedAnchorEl.contextElement.nodeType !== 1) {
|
|
18557
|
-
return new Error(['MUI: The `anchorEl` prop provided to the component is invalid.', 'It should be an HTML element instance or a virtualElement ', '(https://popper.js.org/docs/v2/virtual-elements/).'].join('\n'));
|
|
18558
|
-
}
|
|
18559
|
-
}
|
|
18560
|
-
return null;
|
|
18561
|
-
}),
|
|
18562
|
-
/**
|
|
18563
|
-
* Popper render function or node.
|
|
18564
|
-
*/
|
|
18565
|
-
children: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.node, PropTypes.func]),
|
|
18566
|
-
/**
|
|
18567
|
-
* An HTML element or function that returns one.
|
|
18568
|
-
* The `container` will have the portal children appended to it.
|
|
18569
|
-
*
|
|
18570
|
-
* You can also provide a callback, which is called in a React layout effect.
|
|
18571
|
-
* This lets you set the container from a ref, and also makes server-side rendering possible.
|
|
18572
|
-
*
|
|
18573
|
-
* By default, it uses the body of the top-level document object,
|
|
18574
|
-
* so it's simply `document.body` most of the time.
|
|
18575
|
-
*/
|
|
18576
|
-
container: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([HTMLElementType, PropTypes.func]),
|
|
18577
|
-
/**
|
|
18578
|
-
* Direction of the text.
|
|
18579
|
-
* @default 'ltr'
|
|
18580
|
-
*/
|
|
18581
|
-
direction: PropTypes.oneOf(['ltr', 'rtl']),
|
|
18582
|
-
/**
|
|
18583
|
-
* The `children` will be under the DOM hierarchy of the parent component.
|
|
18584
|
-
* @default false
|
|
18585
|
-
*/
|
|
18586
|
-
disablePortal: PropTypes.bool,
|
|
18587
|
-
/**
|
|
18588
|
-
* Always keep the children in the DOM.
|
|
18589
|
-
* This prop can be useful in SEO situation or
|
|
18590
|
-
* when you want to maximize the responsiveness of the Popper.
|
|
18591
|
-
* @default false
|
|
18592
|
-
*/
|
|
18593
|
-
keepMounted: PropTypes.bool,
|
|
18594
|
-
/**
|
|
18595
|
-
* Popper.js is based on a "plugin-like" architecture,
|
|
18596
|
-
* most of its features are fully encapsulated "modifiers".
|
|
18597
|
-
*
|
|
18598
|
-
* A modifier is a function that is called each time Popper.js needs to
|
|
18599
|
-
* compute the position of the popper.
|
|
18600
|
-
* For this reason, modifiers should be very performant to avoid bottlenecks.
|
|
18601
|
-
* To learn how to create a modifier, [read the modifiers documentation](https://popper.js.org/docs/v2/modifiers/).
|
|
18602
|
-
*/
|
|
18603
|
-
modifiers: PropTypes.arrayOf(PropTypes.shape({
|
|
18604
|
-
data: PropTypes.object,
|
|
18605
|
-
effect: PropTypes.func,
|
|
18606
|
-
enabled: PropTypes.bool,
|
|
18607
|
-
fn: PropTypes.func,
|
|
18608
|
-
name: PropTypes.any,
|
|
18609
|
-
options: PropTypes.object,
|
|
18610
|
-
phase: PropTypes.oneOf(['afterMain', 'afterRead', 'afterWrite', 'beforeMain', 'beforeRead', 'beforeWrite', 'main', 'read', 'write']),
|
|
18611
|
-
requires: PropTypes.arrayOf(PropTypes.string),
|
|
18612
|
-
requiresIfExists: PropTypes.arrayOf(PropTypes.string)
|
|
18613
|
-
})),
|
|
18614
|
-
/**
|
|
18615
|
-
* If `true`, the component is shown.
|
|
18616
|
-
*/
|
|
18617
|
-
open: PropTypes.bool.isRequired,
|
|
18618
|
-
/**
|
|
18619
|
-
* Popper placement.
|
|
18620
|
-
* @default 'bottom'
|
|
18621
|
-
*/
|
|
18622
|
-
placement: PropTypes.oneOf(['auto-end', 'auto-start', 'auto', 'bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top']),
|
|
18623
|
-
/**
|
|
18624
|
-
* Options provided to the [`Popper.js`](https://popper.js.org/docs/v2/constructors/#options) instance.
|
|
18625
|
-
* @default {}
|
|
18626
|
-
*/
|
|
18627
|
-
popperOptions: PropTypes.shape({
|
|
18628
|
-
modifiers: PropTypes.array,
|
|
18629
|
-
onFirstUpdate: PropTypes.func,
|
|
18630
|
-
placement: PropTypes.oneOf(['auto-end', 'auto-start', 'auto', 'bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top']),
|
|
18631
|
-
strategy: PropTypes.oneOf(['absolute', 'fixed'])
|
|
18632
|
-
}),
|
|
18633
|
-
/**
|
|
18634
|
-
* A ref that points to the used popper instance.
|
|
18635
|
-
*/
|
|
18636
|
-
popperRef: refType$1,
|
|
18637
|
-
/**
|
|
18638
|
-
* The props used for each slot inside the Popper.
|
|
18639
|
-
* @default {}
|
|
18640
|
-
*/
|
|
18641
|
-
slotProps: PropTypes.shape({
|
|
18642
|
-
root: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
18643
|
-
}),
|
|
18644
|
-
/**
|
|
18645
|
-
* The components used for each slot inside the Popper.
|
|
18646
|
-
* Either a string to use a HTML element or a component.
|
|
18647
|
-
* @default {}
|
|
18648
|
-
*/
|
|
18649
|
-
slots: PropTypes.shape({
|
|
18650
|
-
root: PropTypes.elementType
|
|
18651
|
-
}),
|
|
18652
|
-
/**
|
|
18653
|
-
* Help supporting a react-transition-group/Transition component.
|
|
18654
|
-
* @default false
|
|
18655
|
-
*/
|
|
18656
|
-
transition: PropTypes.bool
|
|
18657
|
-
} ;
|
|
18658
|
-
|
|
18659
|
-
// Is a vertical scrollbar displayed?
|
|
18660
|
-
function isOverflowing(container) {
|
|
18661
|
-
var doc = ownerDocument(container);
|
|
18662
|
-
if (doc.body === container) {
|
|
18663
|
-
return ownerWindow(container).innerWidth > doc.documentElement.clientWidth;
|
|
18664
|
-
}
|
|
18665
|
-
return container.scrollHeight > container.clientHeight;
|
|
18666
|
-
}
|
|
18667
|
-
function ariaHidden(element, show) {
|
|
18668
|
-
if (show) {
|
|
18669
|
-
element.setAttribute('aria-hidden', 'true');
|
|
18670
|
-
} else {
|
|
18671
|
-
element.removeAttribute('aria-hidden');
|
|
18672
|
-
}
|
|
18673
|
-
}
|
|
18674
|
-
function getPaddingRight(element) {
|
|
18675
|
-
return parseInt(ownerWindow(element).getComputedStyle(element).paddingRight, 10) || 0;
|
|
18676
|
-
}
|
|
18677
|
-
function isAriaHiddenForbiddenOnElement(element) {
|
|
18678
|
-
// The forbidden HTML tags are the ones from ARIA specification that
|
|
18679
|
-
// can be children of body and can't have aria-hidden attribute.
|
|
18680
|
-
// cf. https://www.w3.org/TR/html-aria/#docconformance
|
|
18681
|
-
var forbiddenTagNames = ['TEMPLATE', 'SCRIPT', 'STYLE', 'LINK', 'MAP', 'META', 'NOSCRIPT', 'PICTURE', 'COL', 'COLGROUP', 'PARAM', 'SLOT', 'SOURCE', 'TRACK'];
|
|
18682
|
-
var isForbiddenTagName = forbiddenTagNames.indexOf(element.tagName) !== -1;
|
|
18683
|
-
var isInputHidden = element.tagName === 'INPUT' && element.getAttribute('type') === 'hidden';
|
|
18684
|
-
return isForbiddenTagName || isInputHidden;
|
|
18685
|
-
}
|
|
18686
|
-
function ariaHiddenSiblings(container, mountElement, currentElement, elementsToExclude, show) {
|
|
18687
|
-
var blacklist = [mountElement, currentElement].concat(_toConsumableArray(elementsToExclude));
|
|
18688
|
-
[].forEach.call(container.children, function (element) {
|
|
18689
|
-
var isNotExcludedElement = blacklist.indexOf(element) === -1;
|
|
18690
|
-
var isNotForbiddenElement = !isAriaHiddenForbiddenOnElement(element);
|
|
18691
|
-
if (isNotExcludedElement && isNotForbiddenElement) {
|
|
18692
|
-
ariaHidden(element, show);
|
|
18693
|
-
}
|
|
18694
|
-
});
|
|
18695
|
-
}
|
|
18696
|
-
function findIndexOf(items, callback) {
|
|
18697
|
-
var idx = -1;
|
|
18698
|
-
items.some(function (item, index) {
|
|
18699
|
-
if (callback(item)) {
|
|
18700
|
-
idx = index;
|
|
18701
|
-
return true;
|
|
18702
|
-
}
|
|
18703
|
-
return false;
|
|
18704
|
-
});
|
|
18705
|
-
return idx;
|
|
18706
|
-
}
|
|
18707
|
-
function handleContainer(containerInfo, props) {
|
|
18708
|
-
var restoreStyle = [];
|
|
18709
|
-
var container = containerInfo.container;
|
|
18710
|
-
if (!props.disableScrollLock) {
|
|
18711
|
-
if (isOverflowing(container)) {
|
|
18712
|
-
// Compute the size before applying overflow hidden to avoid any scroll jumps.
|
|
18713
|
-
var scrollbarSize = getScrollbarSize(ownerDocument(container));
|
|
18714
|
-
restoreStyle.push({
|
|
18715
|
-
value: container.style.paddingRight,
|
|
18716
|
-
property: 'padding-right',
|
|
18717
|
-
el: container
|
|
18718
|
-
});
|
|
18719
|
-
// Use computed style, here to get the real padding to add our scrollbar width.
|
|
18720
|
-
container.style.paddingRight = "".concat(getPaddingRight(container) + scrollbarSize, "px");
|
|
18721
|
-
|
|
18722
|
-
// .mui-fixed is a global helper.
|
|
18723
|
-
var fixedElements = ownerDocument(container).querySelectorAll('.mui-fixed');
|
|
18724
|
-
[].forEach.call(fixedElements, function (element) {
|
|
18725
|
-
restoreStyle.push({
|
|
18726
|
-
value: element.style.paddingRight,
|
|
18727
|
-
property: 'padding-right',
|
|
18728
|
-
el: element
|
|
18729
|
-
});
|
|
18730
|
-
element.style.paddingRight = "".concat(getPaddingRight(element) + scrollbarSize, "px");
|
|
18731
|
-
});
|
|
18732
|
-
}
|
|
18733
|
-
var scrollContainer;
|
|
18734
|
-
if (container.parentNode instanceof DocumentFragment) {
|
|
18735
|
-
scrollContainer = ownerDocument(container).body;
|
|
18736
|
-
} else {
|
|
18737
|
-
// Support html overflow-y: auto for scroll stability between pages
|
|
18738
|
-
// https://css-tricks.com/snippets/css/force-vertical-scrollbar/
|
|
18739
|
-
var parent = container.parentElement;
|
|
18740
|
-
var containerWindow = ownerWindow(container);
|
|
18741
|
-
scrollContainer = (parent == null ? void 0 : parent.nodeName) === 'HTML' && containerWindow.getComputedStyle(parent).overflowY === 'scroll' ? parent : container;
|
|
18742
|
-
}
|
|
18743
|
-
|
|
18744
|
-
// Block the scroll even if no scrollbar is visible to account for mobile keyboard
|
|
18745
|
-
// screensize shrink.
|
|
18746
|
-
restoreStyle.push({
|
|
18747
|
-
value: scrollContainer.style.overflow,
|
|
18748
|
-
property: 'overflow',
|
|
18749
|
-
el: scrollContainer
|
|
18750
|
-
}, {
|
|
18751
|
-
value: scrollContainer.style.overflowX,
|
|
18752
|
-
property: 'overflow-x',
|
|
18753
|
-
el: scrollContainer
|
|
18754
|
-
}, {
|
|
18755
|
-
value: scrollContainer.style.overflowY,
|
|
18756
|
-
property: 'overflow-y',
|
|
18757
|
-
el: scrollContainer
|
|
18758
|
-
});
|
|
18759
|
-
scrollContainer.style.overflow = 'hidden';
|
|
18760
|
-
}
|
|
18761
|
-
var restore = function restore() {
|
|
18762
|
-
restoreStyle.forEach(function (_ref) {
|
|
18763
|
-
var value = _ref.value,
|
|
18764
|
-
el = _ref.el,
|
|
18765
|
-
property = _ref.property;
|
|
18766
|
-
if (value) {
|
|
18767
|
-
el.style.setProperty(property, value);
|
|
18768
|
-
} else {
|
|
18769
|
-
el.style.removeProperty(property);
|
|
18770
|
-
}
|
|
18771
|
-
});
|
|
18772
|
-
};
|
|
18773
|
-
return restore;
|
|
18774
|
-
}
|
|
18775
|
-
function getHiddenSiblings(container) {
|
|
18776
|
-
var hiddenSiblings = [];
|
|
18777
|
-
[].forEach.call(container.children, function (element) {
|
|
18778
|
-
if (element.getAttribute('aria-hidden') === 'true') {
|
|
18779
|
-
hiddenSiblings.push(element);
|
|
18780
|
-
}
|
|
18781
|
-
});
|
|
18782
|
-
return hiddenSiblings;
|
|
18783
|
-
}
|
|
18784
|
-
/**
|
|
18785
|
-
* @ignore - do not document.
|
|
18786
|
-
*
|
|
18787
|
-
* Proper state management for containers and the modals in those containers.
|
|
18788
|
-
* Simplified, but inspired by react-overlay's ModalManager class.
|
|
18789
|
-
* Used by the Modal to ensure proper styling of containers.
|
|
18790
|
-
*/
|
|
18791
|
-
var ModalManager = /*#__PURE__*/function () {
|
|
18792
|
-
function ModalManager() {
|
|
18793
|
-
_classCallCheck(this, ModalManager);
|
|
18794
|
-
this.containers = void 0;
|
|
18795
|
-
this.modals = void 0;
|
|
18796
|
-
this.modals = [];
|
|
18797
|
-
this.containers = [];
|
|
18798
|
-
}
|
|
18799
|
-
_createClass(ModalManager, [{
|
|
18800
|
-
key: "add",
|
|
18801
|
-
value: function add(modal, container) {
|
|
18802
|
-
var modalIndex = this.modals.indexOf(modal);
|
|
18803
|
-
if (modalIndex !== -1) {
|
|
18804
|
-
return modalIndex;
|
|
18805
|
-
}
|
|
18806
|
-
modalIndex = this.modals.length;
|
|
18807
|
-
this.modals.push(modal);
|
|
18808
|
-
|
|
18809
|
-
// If the modal we are adding is already in the DOM.
|
|
18810
|
-
if (modal.modalRef) {
|
|
18811
|
-
ariaHidden(modal.modalRef, false);
|
|
18812
|
-
}
|
|
18813
|
-
var hiddenSiblings = getHiddenSiblings(container);
|
|
18814
|
-
ariaHiddenSiblings(container, modal.mount, modal.modalRef, hiddenSiblings, true);
|
|
18815
|
-
var containerIndex = findIndexOf(this.containers, function (item) {
|
|
18816
|
-
return item.container === container;
|
|
18817
|
-
});
|
|
18818
|
-
if (containerIndex !== -1) {
|
|
18819
|
-
this.containers[containerIndex].modals.push(modal);
|
|
18820
|
-
return modalIndex;
|
|
18821
|
-
}
|
|
18822
|
-
this.containers.push({
|
|
18823
|
-
modals: [modal],
|
|
18824
|
-
container: container,
|
|
18825
|
-
restore: null,
|
|
18826
|
-
hiddenSiblings: hiddenSiblings
|
|
18827
|
-
});
|
|
18828
|
-
return modalIndex;
|
|
18829
|
-
}
|
|
18830
|
-
}, {
|
|
18831
|
-
key: "mount",
|
|
18832
|
-
value: function mount(modal, props) {
|
|
18833
|
-
var containerIndex = findIndexOf(this.containers, function (item) {
|
|
18834
|
-
return item.modals.indexOf(modal) !== -1;
|
|
18835
|
-
});
|
|
18836
|
-
var containerInfo = this.containers[containerIndex];
|
|
18837
|
-
if (!containerInfo.restore) {
|
|
18838
|
-
containerInfo.restore = handleContainer(containerInfo, props);
|
|
18839
|
-
}
|
|
18840
|
-
}
|
|
18841
|
-
}, {
|
|
18842
|
-
key: "remove",
|
|
18843
|
-
value: function remove(modal) {
|
|
18844
|
-
var ariaHiddenState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
18845
|
-
var modalIndex = this.modals.indexOf(modal);
|
|
18846
|
-
if (modalIndex === -1) {
|
|
18847
|
-
return modalIndex;
|
|
18848
|
-
}
|
|
18849
|
-
var containerIndex = findIndexOf(this.containers, function (item) {
|
|
18850
|
-
return item.modals.indexOf(modal) !== -1;
|
|
18851
|
-
});
|
|
18852
|
-
var containerInfo = this.containers[containerIndex];
|
|
18853
|
-
containerInfo.modals.splice(containerInfo.modals.indexOf(modal), 1);
|
|
18854
|
-
this.modals.splice(modalIndex, 1);
|
|
18855
|
-
|
|
18856
|
-
// If that was the last modal in a container, clean up the container.
|
|
18857
|
-
if (containerInfo.modals.length === 0) {
|
|
18858
|
-
// The modal might be closed before it had the chance to be mounted in the DOM.
|
|
18859
|
-
if (containerInfo.restore) {
|
|
18860
|
-
containerInfo.restore();
|
|
18861
|
-
}
|
|
18862
|
-
if (modal.modalRef) {
|
|
18863
|
-
// In case the modal wasn't in the DOM yet.
|
|
18864
|
-
ariaHidden(modal.modalRef, ariaHiddenState);
|
|
18865
|
-
}
|
|
18866
|
-
ariaHiddenSiblings(containerInfo.container, modal.mount, modal.modalRef, containerInfo.hiddenSiblings, false);
|
|
18867
|
-
this.containers.splice(containerIndex, 1);
|
|
18868
|
-
} else {
|
|
18869
|
-
// Otherwise make sure the next top modal is visible to a screen reader.
|
|
18870
|
-
var nextTop = containerInfo.modals[containerInfo.modals.length - 1];
|
|
18871
|
-
// as soon as a modal is adding its modalRef is undefined. it can't set
|
|
18872
|
-
// aria-hidden because the dom element doesn't exist either
|
|
18873
|
-
// when modal was unmounted before modalRef gets null
|
|
18874
|
-
if (nextTop.modalRef) {
|
|
18875
|
-
ariaHidden(nextTop.modalRef, false);
|
|
18876
|
-
}
|
|
18877
|
-
}
|
|
18878
|
-
return modalIndex;
|
|
18879
|
-
}
|
|
18880
|
-
}, {
|
|
18881
|
-
key: "isTopModal",
|
|
18882
|
-
value: function isTopModal(modal) {
|
|
18883
|
-
return this.modals.length > 0 && this.modals[this.modals.length - 1] === modal;
|
|
18884
|
-
}
|
|
18885
|
-
}]);
|
|
18886
|
-
return ModalManager;
|
|
18887
|
-
}();
|
|
18888
|
-
|
|
18889
|
-
function getContainer(container) {
|
|
18890
|
-
return typeof container === 'function' ? container() : container;
|
|
18891
|
-
}
|
|
18892
|
-
function getHasTransition(children) {
|
|
18893
|
-
return children ? children.props.hasOwnProperty('in') : false;
|
|
18894
|
-
}
|
|
18895
|
-
|
|
18896
|
-
// A modal manager used to track and manage the state of open Modals.
|
|
18897
|
-
// Modals don't open on the server so this won't conflict with concurrent requests.
|
|
18898
|
-
var defaultManager = new ModalManager();
|
|
18899
|
-
/**
|
|
18900
|
-
*
|
|
18901
|
-
* Demos:
|
|
18902
|
-
*
|
|
18903
|
-
* - [Modal](https://mui.com/base-ui/react-modal/#hook)
|
|
18904
|
-
*
|
|
18905
|
-
* API:
|
|
18906
|
-
*
|
|
18907
|
-
* - [useModal API](https://mui.com/base-ui/react-modal/hooks-api/#use-modal)
|
|
18908
|
-
*/
|
|
18909
|
-
function useModal(parameters) {
|
|
18910
|
-
var container = parameters.container,
|
|
18911
|
-
_parameters$disableEs = parameters.disableEscapeKeyDown,
|
|
18912
|
-
disableEscapeKeyDown = _parameters$disableEs === void 0 ? false : _parameters$disableEs,
|
|
18913
|
-
_parameters$disableSc = parameters.disableScrollLock,
|
|
18914
|
-
disableScrollLock = _parameters$disableSc === void 0 ? false : _parameters$disableSc,
|
|
18915
|
-
_parameters$manager = parameters.manager,
|
|
18916
|
-
manager = _parameters$manager === void 0 ? defaultManager : _parameters$manager,
|
|
18917
|
-
_parameters$closeAfte = parameters.closeAfterTransition,
|
|
18918
|
-
closeAfterTransition = _parameters$closeAfte === void 0 ? false : _parameters$closeAfte,
|
|
18919
|
-
onTransitionEnter = parameters.onTransitionEnter,
|
|
18920
|
-
onTransitionExited = parameters.onTransitionExited,
|
|
18921
|
-
children = parameters.children,
|
|
18922
|
-
onClose = parameters.onClose,
|
|
18923
|
-
open = parameters.open,
|
|
18924
|
-
rootRef = parameters.rootRef; // @ts-ignore internal logic
|
|
18925
|
-
var modal = React__namespace.useRef({});
|
|
18926
|
-
var mountNodeRef = React__namespace.useRef(null);
|
|
18927
|
-
var modalRef = React__namespace.useRef(null);
|
|
18928
|
-
var handleRef = useForkRef(modalRef, rootRef);
|
|
18929
|
-
var _React$useState = React__namespace.useState(!open),
|
|
18930
|
-
exited = _React$useState[0],
|
|
18931
|
-
setExited = _React$useState[1];
|
|
18932
|
-
var hasTransition = getHasTransition(children);
|
|
18933
|
-
var ariaHiddenProp = true;
|
|
18934
|
-
if (parameters['aria-hidden'] === 'false' || parameters['aria-hidden'] === false) {
|
|
18935
|
-
ariaHiddenProp = false;
|
|
18936
|
-
}
|
|
18937
|
-
var getDoc = function getDoc() {
|
|
18938
|
-
return ownerDocument(mountNodeRef.current);
|
|
18939
|
-
};
|
|
18940
|
-
var getModal = function getModal() {
|
|
18941
|
-
modal.current.modalRef = modalRef.current;
|
|
18942
|
-
modal.current.mount = mountNodeRef.current;
|
|
18943
|
-
return modal.current;
|
|
18944
|
-
};
|
|
18945
|
-
var handleMounted = function handleMounted() {
|
|
18946
|
-
manager.mount(getModal(), {
|
|
18947
|
-
disableScrollLock: disableScrollLock
|
|
18948
|
-
});
|
|
18949
|
-
|
|
18950
|
-
// Fix a bug on Chrome where the scroll isn't initially 0.
|
|
18951
|
-
if (modalRef.current) {
|
|
18952
|
-
modalRef.current.scrollTop = 0;
|
|
18953
|
-
}
|
|
18954
|
-
};
|
|
18955
|
-
var handleOpen = useEventCallback(function () {
|
|
18956
|
-
var resolvedContainer = getContainer(container) || getDoc().body;
|
|
18957
|
-
manager.add(getModal(), resolvedContainer);
|
|
18958
|
-
|
|
18959
|
-
// The element was already mounted.
|
|
18960
|
-
if (modalRef.current) {
|
|
18961
|
-
handleMounted();
|
|
18719
|
+
initialPlacement = props.placement,
|
|
18720
|
+
popperOptions = props.popperOptions,
|
|
18721
|
+
popperRefProp = props.popperRef,
|
|
18722
|
+
_props$slotProps = props.slotProps,
|
|
18723
|
+
slotProps = _props$slotProps === void 0 ? {} : _props$slotProps,
|
|
18724
|
+
_props$slots = props.slots,
|
|
18725
|
+
slots = _props$slots === void 0 ? {} : _props$slots,
|
|
18726
|
+
TransitionProps = props.TransitionProps;
|
|
18727
|
+
props.ownerState;
|
|
18728
|
+
var other = _objectWithoutProperties(props, ["anchorEl", "children", "direction", "disablePortal", "modifiers", "open", "placement", "popperOptions", "popperRef", "slotProps", "slots", "TransitionProps", "ownerState"]);
|
|
18729
|
+
var tooltipRef = React__namespace.useRef(null);
|
|
18730
|
+
var ownRef = useForkRef(tooltipRef, forwardedRef);
|
|
18731
|
+
var popperRef = React__namespace.useRef(null);
|
|
18732
|
+
var handlePopperRef = useForkRef(popperRef, popperRefProp);
|
|
18733
|
+
var handlePopperRefRef = React__namespace.useRef(handlePopperRef);
|
|
18734
|
+
useEnhancedEffect$1(function () {
|
|
18735
|
+
handlePopperRefRef.current = handlePopperRef;
|
|
18736
|
+
}, [handlePopperRef]);
|
|
18737
|
+
React__namespace.useImperativeHandle(popperRefProp, function () {
|
|
18738
|
+
return popperRef.current;
|
|
18739
|
+
}, []);
|
|
18740
|
+
var rtlPlacement = flipPlacement(initialPlacement, direction);
|
|
18741
|
+
/**
|
|
18742
|
+
* placement initialized from prop but can change during lifetime if modifiers.flip.
|
|
18743
|
+
* modifiers.flip is essentially a flip for controlled/uncontrolled behavior
|
|
18744
|
+
*/
|
|
18745
|
+
var _React$useState = React__namespace.useState(rtlPlacement),
|
|
18746
|
+
placement = _React$useState[0],
|
|
18747
|
+
setPlacement = _React$useState[1];
|
|
18748
|
+
var _React$useState2 = React__namespace.useState(resolveAnchorEl$1(anchorEl)),
|
|
18749
|
+
resolvedAnchorElement = _React$useState2[0],
|
|
18750
|
+
setResolvedAnchorElement = _React$useState2[1];
|
|
18751
|
+
React__namespace.useEffect(function () {
|
|
18752
|
+
if (popperRef.current) {
|
|
18753
|
+
popperRef.current.forceUpdate();
|
|
18962
18754
|
}
|
|
18963
18755
|
});
|
|
18964
|
-
|
|
18965
|
-
|
|
18966
|
-
|
|
18967
|
-
var handlePortalRef = useEventCallback(function (node) {
|
|
18968
|
-
mountNodeRef.current = node;
|
|
18969
|
-
if (!node) {
|
|
18970
|
-
return;
|
|
18756
|
+
React__namespace.useEffect(function () {
|
|
18757
|
+
if (anchorEl) {
|
|
18758
|
+
setResolvedAnchorElement(resolveAnchorEl$1(anchorEl));
|
|
18971
18759
|
}
|
|
18972
|
-
|
|
18973
|
-
|
|
18974
|
-
|
|
18975
|
-
|
|
18760
|
+
}, [anchorEl]);
|
|
18761
|
+
useEnhancedEffect$1(function () {
|
|
18762
|
+
if (!resolvedAnchorElement || !open) {
|
|
18763
|
+
return undefined;
|
|
18976
18764
|
}
|
|
18977
|
-
|
|
18978
|
-
|
|
18979
|
-
manager.remove(getModal(), ariaHiddenProp);
|
|
18980
|
-
}, [ariaHiddenProp, manager]);
|
|
18981
|
-
React__namespace.useEffect(function () {
|
|
18982
|
-
return function () {
|
|
18983
|
-
handleClose();
|
|
18765
|
+
var handlePopperUpdate = function handlePopperUpdate(data) {
|
|
18766
|
+
setPlacement(data.placement);
|
|
18984
18767
|
};
|
|
18985
|
-
|
|
18986
|
-
|
|
18987
|
-
|
|
18988
|
-
|
|
18989
|
-
|
|
18990
|
-
handleClose();
|
|
18991
|
-
}
|
|
18992
|
-
}, [open, handleClose, hasTransition, closeAfterTransition, handleOpen]);
|
|
18993
|
-
var createHandleKeyDown = function createHandleKeyDown(otherHandlers) {
|
|
18994
|
-
return function (event) {
|
|
18995
|
-
var _otherHandlers$onKeyD;
|
|
18996
|
-
(_otherHandlers$onKeyD = otherHandlers.onKeyDown) == null || _otherHandlers$onKeyD.call(otherHandlers, event);
|
|
18997
|
-
|
|
18998
|
-
// The handler doesn't take event.defaultPrevented into account:
|
|
18999
|
-
//
|
|
19000
|
-
// event.preventDefault() is meant to stop default behaviors like
|
|
19001
|
-
// clicking a checkbox to check it, hitting a button to submit a form,
|
|
19002
|
-
// and hitting left arrow to move the cursor in a text input etc.
|
|
19003
|
-
// Only special HTML elements have these default behaviors.
|
|
19004
|
-
if (event.key !== 'Escape' || event.which === 229 ||
|
|
19005
|
-
// Wait until IME is settled.
|
|
19006
|
-
!isTopModal()) {
|
|
19007
|
-
return;
|
|
19008
|
-
}
|
|
19009
|
-
if (!disableEscapeKeyDown) {
|
|
19010
|
-
// Swallow the event, in case someone is listening for the escape key on the body.
|
|
19011
|
-
event.stopPropagation();
|
|
19012
|
-
if (onClose) {
|
|
19013
|
-
onClose(event, 'escapeKeyDown');
|
|
18768
|
+
{
|
|
18769
|
+
if (resolvedAnchorElement && isHTMLElement(resolvedAnchorElement) && resolvedAnchorElement.nodeType === 1) {
|
|
18770
|
+
var box = resolvedAnchorElement.getBoundingClientRect();
|
|
18771
|
+
if (box.top === 0 && box.left === 0 && box.right === 0 && box.bottom === 0) {
|
|
18772
|
+
console.warn(['MUI: The `anchorEl` prop provided to the component is invalid.', 'The anchor element should be part of the document layout.', "Make sure the element is present in the document or that it's not display none."].join('\n'));
|
|
19014
18773
|
}
|
|
19015
18774
|
}
|
|
19016
|
-
}
|
|
19017
|
-
|
|
19018
|
-
|
|
19019
|
-
|
|
19020
|
-
|
|
19021
|
-
(_otherHandlers$onClic = otherHandlers.onClick) == null || _otherHandlers$onClic.call(otherHandlers, event);
|
|
19022
|
-
if (event.target !== event.currentTarget) {
|
|
19023
|
-
return;
|
|
19024
|
-
}
|
|
19025
|
-
if (onClose) {
|
|
19026
|
-
onClose(event, 'backdropClick');
|
|
19027
|
-
}
|
|
19028
|
-
};
|
|
19029
|
-
};
|
|
19030
|
-
var getRootProps = function getRootProps() {
|
|
19031
|
-
var otherHandlers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
19032
|
-
var propsEventHandlers = extractEventHandlers(parameters);
|
|
19033
|
-
|
|
19034
|
-
// The custom event handlers shouldn't be spread on the root element
|
|
19035
|
-
delete propsEventHandlers.onTransitionEnter;
|
|
19036
|
-
delete propsEventHandlers.onTransitionExited;
|
|
19037
|
-
var externalEventHandlers = _extends({}, propsEventHandlers, otherHandlers);
|
|
19038
|
-
return _extends({
|
|
19039
|
-
role: 'presentation'
|
|
19040
|
-
}, externalEventHandlers, {
|
|
19041
|
-
onKeyDown: createHandleKeyDown(externalEventHandlers),
|
|
19042
|
-
ref: handleRef
|
|
19043
|
-
});
|
|
19044
|
-
};
|
|
19045
|
-
var getBackdropProps = function getBackdropProps() {
|
|
19046
|
-
var otherHandlers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
19047
|
-
var externalEventHandlers = otherHandlers;
|
|
19048
|
-
return _extends({
|
|
19049
|
-
'aria-hidden': true
|
|
19050
|
-
}, externalEventHandlers, {
|
|
19051
|
-
onClick: createHandleBackdropClick(externalEventHandlers),
|
|
19052
|
-
open: open
|
|
19053
|
-
});
|
|
19054
|
-
};
|
|
19055
|
-
var getTransitionProps = function getTransitionProps() {
|
|
19056
|
-
var handleEnter = function handleEnter() {
|
|
19057
|
-
setExited(false);
|
|
19058
|
-
if (onTransitionEnter) {
|
|
19059
|
-
onTransitionEnter();
|
|
18775
|
+
}
|
|
18776
|
+
var popperModifiers = [{
|
|
18777
|
+
name: 'preventOverflow',
|
|
18778
|
+
options: {
|
|
18779
|
+
altBoundary: disablePortal
|
|
19060
18780
|
}
|
|
19061
|
-
}
|
|
19062
|
-
|
|
19063
|
-
|
|
19064
|
-
|
|
19065
|
-
onTransitionExited();
|
|
18781
|
+
}, {
|
|
18782
|
+
name: 'flip',
|
|
18783
|
+
options: {
|
|
18784
|
+
altBoundary: disablePortal
|
|
19066
18785
|
}
|
|
19067
|
-
|
|
19068
|
-
|
|
18786
|
+
}, {
|
|
18787
|
+
name: 'onUpdate',
|
|
18788
|
+
enabled: true,
|
|
18789
|
+
phase: 'afterWrite',
|
|
18790
|
+
fn: function fn(_ref) {
|
|
18791
|
+
var state = _ref.state;
|
|
18792
|
+
handlePopperUpdate(state);
|
|
19069
18793
|
}
|
|
18794
|
+
}];
|
|
18795
|
+
if (modifiers != null) {
|
|
18796
|
+
popperModifiers = popperModifiers.concat(modifiers);
|
|
18797
|
+
}
|
|
18798
|
+
if (popperOptions && popperOptions.modifiers != null) {
|
|
18799
|
+
popperModifiers = popperModifiers.concat(popperOptions.modifiers);
|
|
18800
|
+
}
|
|
18801
|
+
var popper = createPopper(resolvedAnchorElement, tooltipRef.current, _extends({
|
|
18802
|
+
placement: rtlPlacement
|
|
18803
|
+
}, popperOptions, {
|
|
18804
|
+
modifiers: popperModifiers
|
|
18805
|
+
}));
|
|
18806
|
+
handlePopperRefRef.current(popper);
|
|
18807
|
+
return function () {
|
|
18808
|
+
popper.destroy();
|
|
18809
|
+
handlePopperRefRef.current(null);
|
|
19070
18810
|
};
|
|
19071
|
-
|
|
19072
|
-
|
|
19073
|
-
|
|
19074
|
-
};
|
|
19075
|
-
};
|
|
19076
|
-
return {
|
|
19077
|
-
getRootProps: getRootProps,
|
|
19078
|
-
getBackdropProps: getBackdropProps,
|
|
19079
|
-
getTransitionProps: getTransitionProps,
|
|
19080
|
-
rootRef: handleRef,
|
|
19081
|
-
portalRef: handlePortalRef,
|
|
19082
|
-
isTopModal: isTopModal,
|
|
19083
|
-
exited: exited,
|
|
19084
|
-
hasTransition: hasTransition
|
|
18811
|
+
}, [resolvedAnchorElement, disablePortal, modifiers, open, popperOptions, rtlPlacement]);
|
|
18812
|
+
var childProps = {
|
|
18813
|
+
placement: placement
|
|
19085
18814
|
};
|
|
19086
|
-
|
|
18815
|
+
if (TransitionProps !== null) {
|
|
18816
|
+
childProps.TransitionProps = TransitionProps;
|
|
18817
|
+
}
|
|
18818
|
+
var classes = useUtilityClasses$1B();
|
|
18819
|
+
var Root = (_slots$root = slots.root) != null ? _slots$root : 'div';
|
|
18820
|
+
var rootProps = useSlotProps({
|
|
18821
|
+
elementType: Root,
|
|
18822
|
+
externalSlotProps: slotProps.root,
|
|
18823
|
+
externalForwardedProps: other,
|
|
18824
|
+
additionalProps: {
|
|
18825
|
+
role: 'tooltip',
|
|
18826
|
+
ref: ownRef
|
|
18827
|
+
},
|
|
18828
|
+
ownerState: props,
|
|
18829
|
+
className: classes.root
|
|
18830
|
+
});
|
|
18831
|
+
return /*#__PURE__*/jsxRuntime_1(Root, _extends({}, rootProps, {
|
|
18832
|
+
children: typeof children === 'function' ? children(childProps) : children
|
|
18833
|
+
}));
|
|
18834
|
+
});
|
|
19087
18835
|
|
|
19088
18836
|
/**
|
|
19089
|
-
*
|
|
19090
|
-
*
|
|
19091
|
-
* This component can be useful in a variety of situations:
|
|
19092
|
-
*
|
|
19093
|
-
* * Escape hatch for broken dependencies not supporting SSR.
|
|
19094
|
-
* * Improve the time-to-first paint on the client by only rendering above the fold.
|
|
19095
|
-
* * Reduce the rendering time on the server.
|
|
19096
|
-
* * Under too heavy server load, you can turn on service degradation.
|
|
18837
|
+
* Poppers rely on the 3rd party library [Popper.js](https://popper.js.org/docs/v2/) for positioning.
|
|
19097
18838
|
*
|
|
19098
18839
|
* Demos:
|
|
19099
18840
|
*
|
|
19100
|
-
* - [
|
|
18841
|
+
* - [Popper](https://mui.com/base-ui/react-popper/)
|
|
19101
18842
|
*
|
|
19102
18843
|
* API:
|
|
19103
18844
|
*
|
|
19104
|
-
* - [
|
|
18845
|
+
* - [Popper API](https://mui.com/base-ui/react-popper/components-api/#popper)
|
|
19105
18846
|
*/
|
|
19106
|
-
function
|
|
19107
|
-
var
|
|
19108
|
-
|
|
19109
|
-
|
|
19110
|
-
_props$
|
|
19111
|
-
|
|
19112
|
-
|
|
19113
|
-
|
|
19114
|
-
|
|
19115
|
-
|
|
19116
|
-
|
|
19117
|
-
|
|
19118
|
-
|
|
19119
|
-
|
|
19120
|
-
|
|
19121
|
-
|
|
19122
|
-
|
|
19123
|
-
|
|
19124
|
-
|
|
18847
|
+
var Popper$2 = /*#__PURE__*/React__namespace.forwardRef(function Popper(props, forwardedRef) {
|
|
18848
|
+
var anchorEl = props.anchorEl,
|
|
18849
|
+
children = props.children,
|
|
18850
|
+
containerProp = props.container,
|
|
18851
|
+
_props$direction = props.direction,
|
|
18852
|
+
direction = _props$direction === void 0 ? 'ltr' : _props$direction,
|
|
18853
|
+
_props$disablePortal = props.disablePortal,
|
|
18854
|
+
disablePortal = _props$disablePortal === void 0 ? false : _props$disablePortal,
|
|
18855
|
+
_props$keepMounted = props.keepMounted,
|
|
18856
|
+
keepMounted = _props$keepMounted === void 0 ? false : _props$keepMounted,
|
|
18857
|
+
modifiers = props.modifiers,
|
|
18858
|
+
open = props.open,
|
|
18859
|
+
_props$placement = props.placement,
|
|
18860
|
+
placement = _props$placement === void 0 ? 'bottom' : _props$placement,
|
|
18861
|
+
_props$popperOptions = props.popperOptions,
|
|
18862
|
+
popperOptions = _props$popperOptions === void 0 ? defaultPopperOptions : _props$popperOptions,
|
|
18863
|
+
popperRef = props.popperRef,
|
|
18864
|
+
style = props.style,
|
|
18865
|
+
_props$transition = props.transition,
|
|
18866
|
+
transition = _props$transition === void 0 ? false : _props$transition,
|
|
18867
|
+
_props$slotProps2 = props.slotProps,
|
|
18868
|
+
slotProps = _props$slotProps2 === void 0 ? {} : _props$slotProps2,
|
|
18869
|
+
_props$slots2 = props.slots,
|
|
18870
|
+
slots = _props$slots2 === void 0 ? {} : _props$slots2,
|
|
18871
|
+
other = _objectWithoutProperties(props, ["anchorEl", "children", "container", "direction", "disablePortal", "keepMounted", "modifiers", "open", "placement", "popperOptions", "popperRef", "style", "transition", "slotProps", "slots"]);
|
|
18872
|
+
var _React$useState3 = React__namespace.useState(true),
|
|
18873
|
+
exited = _React$useState3[0],
|
|
18874
|
+
setExited = _React$useState3[1];
|
|
18875
|
+
var handleEnter = function handleEnter() {
|
|
18876
|
+
setExited(false);
|
|
18877
|
+
};
|
|
18878
|
+
var handleExited = function handleExited() {
|
|
18879
|
+
setExited(true);
|
|
18880
|
+
};
|
|
18881
|
+
if (!keepMounted && !open && (!transition || exited)) {
|
|
18882
|
+
return null;
|
|
18883
|
+
}
|
|
19125
18884
|
|
|
19126
|
-
//
|
|
19127
|
-
|
|
19128
|
-
|
|
18885
|
+
// If the container prop is provided, use that
|
|
18886
|
+
// If the anchorEl prop is provided, use its parent body element as the container
|
|
18887
|
+
// If neither are provided let the Modal take care of choosing the container
|
|
18888
|
+
var container;
|
|
18889
|
+
if (containerProp) {
|
|
18890
|
+
container = containerProp;
|
|
18891
|
+
} else if (anchorEl) {
|
|
18892
|
+
var resolvedAnchorEl = resolveAnchorEl$1(anchorEl);
|
|
18893
|
+
container = resolvedAnchorEl && isHTMLElement(resolvedAnchorEl) ? ownerDocument(resolvedAnchorEl).body : ownerDocument(null).body;
|
|
18894
|
+
}
|
|
18895
|
+
var display = !open && keepMounted && (!transition || exited) ? 'none' : undefined;
|
|
18896
|
+
var transitionProps = transition ? {
|
|
18897
|
+
"in": open,
|
|
18898
|
+
onEnter: handleEnter,
|
|
18899
|
+
onExited: handleExited
|
|
18900
|
+
} : undefined;
|
|
18901
|
+
return /*#__PURE__*/jsxRuntime_1(Portal, {
|
|
18902
|
+
disablePortal: disablePortal,
|
|
18903
|
+
container: container,
|
|
18904
|
+
children: /*#__PURE__*/jsxRuntime_1(PopperTooltip, _extends({
|
|
18905
|
+
anchorEl: anchorEl,
|
|
18906
|
+
direction: direction,
|
|
18907
|
+
disablePortal: disablePortal,
|
|
18908
|
+
modifiers: modifiers,
|
|
18909
|
+
ref: forwardedRef,
|
|
18910
|
+
open: transition ? !exited : open,
|
|
18911
|
+
placement: placement,
|
|
18912
|
+
popperOptions: popperOptions,
|
|
18913
|
+
popperRef: popperRef,
|
|
18914
|
+
slotProps: slotProps,
|
|
18915
|
+
slots: slots
|
|
18916
|
+
}, other, {
|
|
18917
|
+
style: _extends({
|
|
18918
|
+
// Prevents scroll issue, waiting for Popper.js to add this style once initiated.
|
|
18919
|
+
position: 'fixed',
|
|
18920
|
+
// Fix Popper.js display issue
|
|
18921
|
+
top: 0,
|
|
18922
|
+
left: 0,
|
|
18923
|
+
display: display
|
|
18924
|
+
}, style),
|
|
18925
|
+
TransitionProps: transitionProps,
|
|
18926
|
+
children: children
|
|
18927
|
+
}))
|
|
19129
18928
|
});
|
|
19130
|
-
}
|
|
19131
|
-
|
|
18929
|
+
});
|
|
18930
|
+
Popper$2.propTypes /* remove-proptypes */ = {
|
|
19132
18931
|
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
19133
18932
|
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
19134
18933
|
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
19135
18934
|
// └─────────────────────────────────────────────────────────────────────┘
|
|
19136
18935
|
/**
|
|
19137
|
-
*
|
|
18936
|
+
* An HTML element, [virtualElement](https://popper.js.org/docs/v2/virtual-elements/),
|
|
18937
|
+
* or a function that returns either.
|
|
18938
|
+
* It's used to set the position of the popper.
|
|
18939
|
+
* The return value will passed as the reference object of the Popper instance.
|
|
19138
18940
|
*/
|
|
19139
|
-
|
|
18941
|
+
anchorEl: chainPropTypes(PropTypes.oneOfType([HTMLElementType, PropTypes.object, PropTypes.func]), function (props) {
|
|
18942
|
+
if (props.open) {
|
|
18943
|
+
var resolvedAnchorEl = resolveAnchorEl$1(props.anchorEl);
|
|
18944
|
+
if (resolvedAnchorEl && isHTMLElement(resolvedAnchorEl) && resolvedAnchorEl.nodeType === 1) {
|
|
18945
|
+
var box = resolvedAnchorEl.getBoundingClientRect();
|
|
18946
|
+
if (box.top === 0 && box.left === 0 && box.right === 0 && box.bottom === 0) {
|
|
18947
|
+
return new Error(['MUI: The `anchorEl` prop provided to the component is invalid.', 'The anchor element should be part of the document layout.', "Make sure the element is present in the document or that it's not display none."].join('\n'));
|
|
18948
|
+
}
|
|
18949
|
+
} else if (!resolvedAnchorEl || typeof resolvedAnchorEl.getBoundingClientRect !== 'function' || isVirtualElement(resolvedAnchorEl) && resolvedAnchorEl.contextElement != null && resolvedAnchorEl.contextElement.nodeType !== 1) {
|
|
18950
|
+
return new Error(['MUI: The `anchorEl` prop provided to the component is invalid.', 'It should be an HTML element instance or a virtualElement ', '(https://popper.js.org/docs/v2/virtual-elements/).'].join('\n'));
|
|
18951
|
+
}
|
|
18952
|
+
}
|
|
18953
|
+
return null;
|
|
18954
|
+
}),
|
|
19140
18955
|
/**
|
|
19141
|
-
*
|
|
19142
|
-
|
|
18956
|
+
* Popper render function or node.
|
|
18957
|
+
*/
|
|
18958
|
+
children: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.node, PropTypes.func]),
|
|
18959
|
+
/**
|
|
18960
|
+
* An HTML element or function that returns one.
|
|
18961
|
+
* The `container` will have the portal children appended to it.
|
|
18962
|
+
*
|
|
18963
|
+
* You can also provide a callback, which is called in a React layout effect.
|
|
18964
|
+
* This lets you set the container from a ref, and also makes server-side rendering possible.
|
|
18965
|
+
*
|
|
18966
|
+
* By default, it uses the body of the top-level document object,
|
|
18967
|
+
* so it's simply `document.body` most of the time.
|
|
18968
|
+
*/
|
|
18969
|
+
container: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([HTMLElementType, PropTypes.func]),
|
|
18970
|
+
/**
|
|
18971
|
+
* Direction of the text.
|
|
18972
|
+
* @default 'ltr'
|
|
18973
|
+
*/
|
|
18974
|
+
direction: PropTypes.oneOf(['ltr', 'rtl']),
|
|
18975
|
+
/**
|
|
18976
|
+
* The `children` will be under the DOM hierarchy of the parent component.
|
|
19143
18977
|
* @default false
|
|
19144
18978
|
*/
|
|
19145
|
-
|
|
18979
|
+
disablePortal: PropTypes.bool,
|
|
19146
18980
|
/**
|
|
19147
|
-
*
|
|
19148
|
-
*
|
|
18981
|
+
* Always keep the children in the DOM.
|
|
18982
|
+
* This prop can be useful in SEO situation or
|
|
18983
|
+
* when you want to maximize the responsiveness of the Popper.
|
|
18984
|
+
* @default false
|
|
19149
18985
|
*/
|
|
19150
|
-
|
|
18986
|
+
keepMounted: PropTypes.bool,
|
|
18987
|
+
/**
|
|
18988
|
+
* Popper.js is based on a "plugin-like" architecture,
|
|
18989
|
+
* most of its features are fully encapsulated "modifiers".
|
|
18990
|
+
*
|
|
18991
|
+
* A modifier is a function that is called each time Popper.js needs to
|
|
18992
|
+
* compute the position of the popper.
|
|
18993
|
+
* For this reason, modifiers should be very performant to avoid bottlenecks.
|
|
18994
|
+
* To learn how to create a modifier, [read the modifiers documentation](https://popper.js.org/docs/v2/modifiers/).
|
|
18995
|
+
*/
|
|
18996
|
+
modifiers: PropTypes.arrayOf(PropTypes.shape({
|
|
18997
|
+
data: PropTypes.object,
|
|
18998
|
+
effect: PropTypes.func,
|
|
18999
|
+
enabled: PropTypes.bool,
|
|
19000
|
+
fn: PropTypes.func,
|
|
19001
|
+
name: PropTypes.any,
|
|
19002
|
+
options: PropTypes.object,
|
|
19003
|
+
phase: PropTypes.oneOf(['afterMain', 'afterRead', 'afterWrite', 'beforeMain', 'beforeRead', 'beforeWrite', 'main', 'read', 'write']),
|
|
19004
|
+
requires: PropTypes.arrayOf(PropTypes.string),
|
|
19005
|
+
requiresIfExists: PropTypes.arrayOf(PropTypes.string)
|
|
19006
|
+
})),
|
|
19007
|
+
/**
|
|
19008
|
+
* If `true`, the component is shown.
|
|
19009
|
+
*/
|
|
19010
|
+
open: PropTypes.bool.isRequired,
|
|
19011
|
+
/**
|
|
19012
|
+
* Popper placement.
|
|
19013
|
+
* @default 'bottom'
|
|
19014
|
+
*/
|
|
19015
|
+
placement: PropTypes.oneOf(['auto-end', 'auto-start', 'auto', 'bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top']),
|
|
19016
|
+
/**
|
|
19017
|
+
* Options provided to the [`Popper.js`](https://popper.js.org/docs/v2/constructors/#options) instance.
|
|
19018
|
+
* @default {}
|
|
19019
|
+
*/
|
|
19020
|
+
popperOptions: PropTypes.shape({
|
|
19021
|
+
modifiers: PropTypes.array,
|
|
19022
|
+
onFirstUpdate: PropTypes.func,
|
|
19023
|
+
placement: PropTypes.oneOf(['auto-end', 'auto-start', 'auto', 'bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top']),
|
|
19024
|
+
strategy: PropTypes.oneOf(['absolute', 'fixed'])
|
|
19025
|
+
}),
|
|
19026
|
+
/**
|
|
19027
|
+
* A ref that points to the used popper instance.
|
|
19028
|
+
*/
|
|
19029
|
+
popperRef: refType$1,
|
|
19030
|
+
/**
|
|
19031
|
+
* The props used for each slot inside the Popper.
|
|
19032
|
+
* @default {}
|
|
19033
|
+
*/
|
|
19034
|
+
slotProps: PropTypes.shape({
|
|
19035
|
+
root: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
19036
|
+
}),
|
|
19037
|
+
/**
|
|
19038
|
+
* The components used for each slot inside the Popper.
|
|
19039
|
+
* Either a string to use a HTML element or a component.
|
|
19040
|
+
* @default {}
|
|
19041
|
+
*/
|
|
19042
|
+
slots: PropTypes.shape({
|
|
19043
|
+
root: PropTypes.elementType
|
|
19044
|
+
}),
|
|
19045
|
+
/**
|
|
19046
|
+
* Help supporting a react-transition-group/Transition component.
|
|
19047
|
+
* @default false
|
|
19048
|
+
*/
|
|
19049
|
+
transition: PropTypes.bool
|
|
19151
19050
|
} ;
|
|
19152
|
-
{
|
|
19153
|
-
// eslint-disable-next-line
|
|
19154
|
-
NoSsr['propTypes' + ''] = exactProp(NoSsr.propTypes);
|
|
19155
|
-
}
|
|
19156
19051
|
|
|
19157
19052
|
var INTENTIONAL_DRAG_COUNT_THRESHOLD = 2;
|
|
19158
19053
|
function asc(a, b) {
|
|
@@ -19345,6 +19240,8 @@
|
|
|
19345
19240
|
scale = _parameters$scale === void 0 ? Identity$1 : _parameters$scale,
|
|
19346
19241
|
_parameters$step = parameters.step,
|
|
19347
19242
|
step = _parameters$step === void 0 ? 1 : _parameters$step,
|
|
19243
|
+
_parameters$shiftStep = parameters.shiftStep,
|
|
19244
|
+
shiftStep = _parameters$shiftStep === void 0 ? 10 : _parameters$shiftStep,
|
|
19348
19245
|
tabIndex = parameters.tabIndex,
|
|
19349
19246
|
valueProp = parameters.value;
|
|
19350
19247
|
var touchId = React__namespace.useRef();
|
|
@@ -19433,6 +19330,75 @@
|
|
|
19433
19330
|
otherHandlers == null || (_otherHandlers$onBlur = otherHandlers.onBlur) == null || _otherHandlers$onBlur.call(otherHandlers, event);
|
|
19434
19331
|
};
|
|
19435
19332
|
};
|
|
19333
|
+
var changeValue = function changeValue(event, valueInput) {
|
|
19334
|
+
var index = Number(event.currentTarget.getAttribute('data-index'));
|
|
19335
|
+
var value = values[index];
|
|
19336
|
+
var marksIndex = marksValues.indexOf(value);
|
|
19337
|
+
var newValue = valueInput;
|
|
19338
|
+
if (marks && step == null) {
|
|
19339
|
+
var maxMarksValue = marksValues[marksValues.length - 1];
|
|
19340
|
+
if (newValue > maxMarksValue) {
|
|
19341
|
+
newValue = maxMarksValue;
|
|
19342
|
+
} else if (newValue < marksValues[0]) {
|
|
19343
|
+
newValue = marksValues[0];
|
|
19344
|
+
} else {
|
|
19345
|
+
newValue = newValue < value ? marksValues[marksIndex - 1] : marksValues[marksIndex + 1];
|
|
19346
|
+
}
|
|
19347
|
+
}
|
|
19348
|
+
newValue = clamp(newValue, min, max);
|
|
19349
|
+
if (range) {
|
|
19350
|
+
// Bound the new value to the thumb's neighbours.
|
|
19351
|
+
if (disableSwap) {
|
|
19352
|
+
newValue = clamp(newValue, values[index - 1] || -Infinity, values[index + 1] || Infinity);
|
|
19353
|
+
}
|
|
19354
|
+
var previousValue = newValue;
|
|
19355
|
+
newValue = setValueIndex({
|
|
19356
|
+
values: values,
|
|
19357
|
+
newValue: newValue,
|
|
19358
|
+
index: index
|
|
19359
|
+
});
|
|
19360
|
+
var activeIndex = index;
|
|
19361
|
+
|
|
19362
|
+
// Potentially swap the index if needed.
|
|
19363
|
+
if (!disableSwap) {
|
|
19364
|
+
activeIndex = newValue.indexOf(previousValue);
|
|
19365
|
+
}
|
|
19366
|
+
focusThumb({
|
|
19367
|
+
sliderRef: sliderRef,
|
|
19368
|
+
activeIndex: activeIndex
|
|
19369
|
+
});
|
|
19370
|
+
}
|
|
19371
|
+
setValueState(newValue);
|
|
19372
|
+
setFocusedThumbIndex(index);
|
|
19373
|
+
if (handleChange && !areValuesEqual(newValue, valueDerived)) {
|
|
19374
|
+
handleChange(event, newValue, index);
|
|
19375
|
+
}
|
|
19376
|
+
if (onChangeCommitted) {
|
|
19377
|
+
onChangeCommitted(event, newValue);
|
|
19378
|
+
}
|
|
19379
|
+
};
|
|
19380
|
+
var createHandleHiddenInputKeyDown = function createHandleHiddenInputKeyDown(otherHandlers) {
|
|
19381
|
+
return function (event) {
|
|
19382
|
+
var _otherHandlers$onKeyD;
|
|
19383
|
+
// The Shift + Up/Down keyboard shortcuts for moving the slider makes sense to be supported
|
|
19384
|
+
// only if the step is defined. If the step is null, this means tha the marks are used for specifying the valid values.
|
|
19385
|
+
if (step !== null) {
|
|
19386
|
+
var index = Number(event.currentTarget.getAttribute('data-index'));
|
|
19387
|
+
var value = values[index];
|
|
19388
|
+
var newValue = null;
|
|
19389
|
+
if ((event.key === 'ArrowLeft' || event.key === 'ArrowDown') && event.shiftKey || event.key === 'PageDown') {
|
|
19390
|
+
newValue = Math.max(value - shiftStep, min);
|
|
19391
|
+
} else if ((event.key === 'ArrowRight' || event.key === 'ArrowUp') && event.shiftKey || event.key === 'PageUp') {
|
|
19392
|
+
newValue = Math.min(value + shiftStep, max);
|
|
19393
|
+
}
|
|
19394
|
+
if (newValue !== null) {
|
|
19395
|
+
changeValue(event, newValue);
|
|
19396
|
+
event.preventDefault();
|
|
19397
|
+
}
|
|
19398
|
+
}
|
|
19399
|
+
otherHandlers == null || (_otherHandlers$onKeyD = otherHandlers.onKeyDown) == null || _otherHandlers$onKeyD.call(otherHandlers, event);
|
|
19400
|
+
};
|
|
19401
|
+
};
|
|
19436
19402
|
useEnhancedEffect$1(function () {
|
|
19437
19403
|
if (disabled && sliderRef.current.contains(document.activeElement)) {
|
|
19438
19404
|
var _document$activeEleme;
|
|
@@ -19453,53 +19419,8 @@
|
|
|
19453
19419
|
return function (event) {
|
|
19454
19420
|
var _otherHandlers$onChan;
|
|
19455
19421
|
(_otherHandlers$onChan = otherHandlers.onChange) == null || _otherHandlers$onChan.call(otherHandlers, event);
|
|
19456
|
-
var index = Number(event.currentTarget.getAttribute('data-index'));
|
|
19457
|
-
var value = values[index];
|
|
19458
|
-
var marksIndex = marksValues.indexOf(value);
|
|
19459
|
-
|
|
19460
19422
|
// @ts-ignore
|
|
19461
|
-
|
|
19462
|
-
if (marks && step == null) {
|
|
19463
|
-
var maxMarksValue = marksValues[marksValues.length - 1];
|
|
19464
|
-
if (newValue > maxMarksValue) {
|
|
19465
|
-
newValue = maxMarksValue;
|
|
19466
|
-
} else if (newValue < marksValues[0]) {
|
|
19467
|
-
newValue = marksValues[0];
|
|
19468
|
-
} else {
|
|
19469
|
-
newValue = newValue < value ? marksValues[marksIndex - 1] : marksValues[marksIndex + 1];
|
|
19470
|
-
}
|
|
19471
|
-
}
|
|
19472
|
-
newValue = clamp(newValue, min, max);
|
|
19473
|
-
if (range) {
|
|
19474
|
-
// Bound the new value to the thumb's neighbours.
|
|
19475
|
-
if (disableSwap) {
|
|
19476
|
-
newValue = clamp(newValue, values[index - 1] || -Infinity, values[index + 1] || Infinity);
|
|
19477
|
-
}
|
|
19478
|
-
var previousValue = newValue;
|
|
19479
|
-
newValue = setValueIndex({
|
|
19480
|
-
values: values,
|
|
19481
|
-
newValue: newValue,
|
|
19482
|
-
index: index
|
|
19483
|
-
});
|
|
19484
|
-
var activeIndex = index;
|
|
19485
|
-
|
|
19486
|
-
// Potentially swap the index if needed.
|
|
19487
|
-
if (!disableSwap) {
|
|
19488
|
-
activeIndex = newValue.indexOf(previousValue);
|
|
19489
|
-
}
|
|
19490
|
-
focusThumb({
|
|
19491
|
-
sliderRef: sliderRef,
|
|
19492
|
-
activeIndex: activeIndex
|
|
19493
|
-
});
|
|
19494
|
-
}
|
|
19495
|
-
setValueState(newValue);
|
|
19496
|
-
setFocusedThumbIndex(index);
|
|
19497
|
-
if (handleChange && !areValuesEqual(newValue, valueDerived)) {
|
|
19498
|
-
handleChange(event, newValue, index);
|
|
19499
|
-
}
|
|
19500
|
-
if (onChangeCommitted) {
|
|
19501
|
-
onChangeCommitted(event, newValue);
|
|
19502
|
-
}
|
|
19423
|
+
changeValue(event, event.target.valueAsNumber);
|
|
19503
19424
|
};
|
|
19504
19425
|
};
|
|
19505
19426
|
var previousIndex = React__namespace.useRef();
|
|
@@ -19775,7 +19696,8 @@
|
|
|
19775
19696
|
var ownEventHandlers = {
|
|
19776
19697
|
onChange: createHandleHiddenInputChange(externalHandlers || {}),
|
|
19777
19698
|
onFocus: createHandleHiddenInputFocus(externalHandlers || {}),
|
|
19778
|
-
onBlur: createHandleHiddenInputBlur(externalHandlers || {})
|
|
19699
|
+
onBlur: createHandleHiddenInputBlur(externalHandlers || {}),
|
|
19700
|
+
onKeyDown: createHandleHiddenInputKeyDown(externalHandlers || {})
|
|
19779
19701
|
};
|
|
19780
19702
|
var mergedEventHandlers = _extends({}, externalHandlers, ownEventHandlers);
|
|
19781
19703
|
return _extends({
|
|
@@ -24084,7 +24006,10 @@
|
|
|
24084
24006
|
ownerState: ownerState,
|
|
24085
24007
|
className: classes.img
|
|
24086
24008
|
}, imgProps));
|
|
24087
|
-
|
|
24009
|
+
|
|
24010
|
+
// We only render valid children, non valid children are rendered with a fallback
|
|
24011
|
+
// We consider that invalid children are all falsy values, except 0, which is valid.
|
|
24012
|
+
} else if (!!childrenProp || childrenProp === 0) {
|
|
24088
24013
|
children = childrenProp;
|
|
24089
24014
|
} else if (hasImg && alt) {
|
|
24090
24015
|
children = alt[0];
|
|
@@ -41743,6 +41668,8 @@
|
|
|
41743
41668
|
props.onChangeCommitted;
|
|
41744
41669
|
var _props$orientation = props.orientation,
|
|
41745
41670
|
orientation = _props$orientation === void 0 ? 'horizontal' : _props$orientation,
|
|
41671
|
+
_props$shiftStep = props.shiftStep,
|
|
41672
|
+
shiftStep = _props$shiftStep === void 0 ? 10 : _props$shiftStep,
|
|
41746
41673
|
_props$size = props.size,
|
|
41747
41674
|
size = _props$size === void 0 ? 'medium' : _props$size,
|
|
41748
41675
|
_props$step = props.step,
|
|
@@ -41759,7 +41686,7 @@
|
|
|
41759
41686
|
valueLabelDisplay = _props$valueLabelDisp === void 0 ? 'off' : _props$valueLabelDisp,
|
|
41760
41687
|
_props$valueLabelForm = props.valueLabelFormat,
|
|
41761
41688
|
valueLabelFormat = _props$valueLabelForm === void 0 ? Identity : _props$valueLabelForm,
|
|
41762
|
-
other = _objectWithoutProperties(props, ["aria-label", "aria-valuetext", "aria-labelledby", "component", "components", "componentsProps", "color", "classes", "className", "disableSwap", "disabled", "getAriaLabel", "getAriaValueText", "marks", "max", "min", "name", "onChange", "onChangeCommitted", "orientation", "size", "step", "scale", "slotProps", "slots", "tabIndex", "track", "value", "valueLabelDisplay", "valueLabelFormat"]);
|
|
41689
|
+
other = _objectWithoutProperties(props, ["aria-label", "aria-valuetext", "aria-labelledby", "component", "components", "componentsProps", "color", "classes", "className", "disableSwap", "disabled", "getAriaLabel", "getAriaValueText", "marks", "max", "min", "name", "onChange", "onChangeCommitted", "orientation", "shiftStep", "size", "step", "scale", "slotProps", "slots", "tabIndex", "track", "value", "valueLabelDisplay", "valueLabelFormat"]);
|
|
41763
41690
|
var ownerState = _extends({}, props, {
|
|
41764
41691
|
isRtl: isRtl,
|
|
41765
41692
|
max: max,
|
|
@@ -41772,6 +41699,7 @@
|
|
|
41772
41699
|
color: color,
|
|
41773
41700
|
size: size,
|
|
41774
41701
|
step: step,
|
|
41702
|
+
shiftStep: shiftStep,
|
|
41775
41703
|
scale: scale,
|
|
41776
41704
|
track: track,
|
|
41777
41705
|
valueLabelDisplay: valueLabelDisplay,
|
|
@@ -42119,6 +42047,11 @@
|
|
|
42119
42047
|
* }
|
|
42120
42048
|
*/
|
|
42121
42049
|
scale: PropTypes.func,
|
|
42050
|
+
/**
|
|
42051
|
+
* The granularity with which the slider can step through values when using Page Up/Page Down or Shift + Arrow Up/Arrow Down.
|
|
42052
|
+
* @default 10
|
|
42053
|
+
*/
|
|
42054
|
+
shiftStep: PropTypes.number,
|
|
42122
42055
|
/**
|
|
42123
42056
|
* The size of the slider.
|
|
42124
42057
|
* @default 'medium'
|
|
@@ -43732,6 +43665,7 @@
|
|
|
43732
43665
|
var handleRef = useForkRef(children.ref, focusVisibleRef, setChildNode, ref);
|
|
43733
43666
|
|
|
43734
43667
|
// There is no point in displaying an empty tooltip.
|
|
43668
|
+
// So we exclude all falsy values, except 0, which is valid.
|
|
43735
43669
|
if (!title && title !== 0) {
|
|
43736
43670
|
open = false;
|
|
43737
43671
|
}
|