@opengeoweb/form-fields 6.0.0 → 6.0.2
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/index.esm.d.ts +1 -0
- package/{index.js → index.esm.js} +303 -483
- package/package.json +5 -6
- package/src/lib/components/ReactHookFormDateTime.d.ts +1 -1
- package/src/lib/components/ReactHookFormHiddenInput.d.ts +1 -1
- package/src/lib/components/ReactHookFormNumberField.d.ts +2 -2
- package/src/lib/components/ReactHookFormRadioGroup.d.ts +1 -1
- package/src/lib/components/ReactHookFormSelect.d.ts +1 -1
- package/src/lib/components/ReactHookFormTextField.d.ts +1 -1
- package/src/lib/components/types.d.ts +1 -1
- package/src/lib/components/utils.d.ts +8 -8
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as React
|
|
2
|
-
import React__default, { Children, isValidElement, cloneElement,
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import React__default, { Children, isValidElement, cloneElement, forwardRef, useContext } from 'react';
|
|
3
3
|
import { FormControl, FormHelperText, InputLabel, Select, RadioGroup, TextField, InputAdornment } from '@mui/material';
|
|
4
4
|
import { useFormContext, useController, useForm, FormProvider } from 'react-hook-form';
|
|
5
5
|
import moment$1 from 'moment-timezone';
|
|
@@ -54,7 +54,12 @@ function __rest(s, e) {
|
|
|
54
54
|
t[p[i]] = s[p[i]];
|
|
55
55
|
}
|
|
56
56
|
return t;
|
|
57
|
-
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
60
|
+
var e = new Error(message);
|
|
61
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
62
|
+
};
|
|
58
63
|
|
|
59
64
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
60
65
|
|
|
@@ -23202,7 +23207,7 @@ var ReactHookFormFormControl = function ReactHookFormFormControl(_a) {
|
|
|
23202
23207
|
_a$className = _a.className,
|
|
23203
23208
|
className = _a$className === void 0 ? '' : _a$className,
|
|
23204
23209
|
props = __rest(_a, ["children", "errors", "isReadOnly", "sx", "className"]);
|
|
23205
|
-
return /*#__PURE__*/React
|
|
23210
|
+
return /*#__PURE__*/React.createElement(FormControl, Object.assign({
|
|
23206
23211
|
fullWidth: true,
|
|
23207
23212
|
error: !!errors,
|
|
23208
23213
|
className: "".concat(isReadOnly ? 'is-read-only' : '', " ").concat(className),
|
|
@@ -23226,7 +23231,7 @@ var ReactHookFormFormControl = function ReactHookFormFormControl(_a) {
|
|
|
23226
23231
|
border: 'transparent'
|
|
23227
23232
|
}
|
|
23228
23233
|
}), sx)
|
|
23229
|
-
}, props), children, errors && /*#__PURE__*/React
|
|
23234
|
+
}, props), children, errors && /*#__PURE__*/React.createElement(FormHelperText, {
|
|
23230
23235
|
variant: "filled"
|
|
23231
23236
|
}, getErrorMessage(errors)));
|
|
23232
23237
|
};
|
|
@@ -23270,16 +23275,16 @@ var ReactHookFormSelect = function ReactHookFormSelect(_a) {
|
|
|
23270
23275
|
ref = _useController$field.ref,
|
|
23271
23276
|
formErrors = _useController.formState.errors;
|
|
23272
23277
|
var errors = getErrors(name, formErrors);
|
|
23273
|
-
return /*#__PURE__*/React
|
|
23278
|
+
return /*#__PURE__*/React.createElement(ReactHookFormFormControl, {
|
|
23274
23279
|
className: className,
|
|
23275
23280
|
sx: sx,
|
|
23276
23281
|
disabled: disabled,
|
|
23277
23282
|
errors: errors,
|
|
23278
23283
|
isReadOnly: isReadOnly
|
|
23279
|
-
}, /*#__PURE__*/React
|
|
23284
|
+
}, /*#__PURE__*/React.createElement(InputLabel, {
|
|
23280
23285
|
variant: "filled",
|
|
23281
23286
|
id: labelId
|
|
23282
|
-
}, label), /*#__PURE__*/React
|
|
23287
|
+
}, label), /*#__PURE__*/React.createElement(Select, Object.assign({
|
|
23283
23288
|
labelId: labelId,
|
|
23284
23289
|
label: label,
|
|
23285
23290
|
inputRef: ref,
|
|
@@ -23322,7 +23327,7 @@ var ReactHookFormRadioGroup = function ReactHookFormRadioGroup(_a) {
|
|
|
23322
23327
|
ref = _useController$field.ref,
|
|
23323
23328
|
formErrors = _useController.formState.errors;
|
|
23324
23329
|
var errors = getErrors(name, formErrors);
|
|
23325
|
-
React
|
|
23330
|
+
React.useEffect(function () {
|
|
23326
23331
|
if (errors) {
|
|
23327
23332
|
var firstError = Object.keys(formErrors)[0];
|
|
23328
23333
|
if (firstError === name) {
|
|
@@ -23334,13 +23339,13 @@ var ReactHookFormRadioGroup = function ReactHookFormRadioGroup(_a) {
|
|
|
23334
23339
|
}
|
|
23335
23340
|
}
|
|
23336
23341
|
}, [errors, formErrors, name]);
|
|
23337
|
-
return /*#__PURE__*/React
|
|
23342
|
+
return /*#__PURE__*/React.createElement(ReactHookFormFormControl, {
|
|
23338
23343
|
disabled: disabled,
|
|
23339
23344
|
errors: errors,
|
|
23340
23345
|
isReadOnly: isReadOnly
|
|
23341
|
-
}, /*#__PURE__*/React
|
|
23346
|
+
}, /*#__PURE__*/React.createElement(InputLabel, {
|
|
23342
23347
|
id: labelId
|
|
23343
|
-
}, label), /*#__PURE__*/React
|
|
23348
|
+
}, label), /*#__PURE__*/React.createElement(RadioGroup, Object.assign({
|
|
23344
23349
|
value: value,
|
|
23345
23350
|
onChange: function onChange(changeEvent) {
|
|
23346
23351
|
onChangeField(changeEvent.target.value);
|
|
@@ -23387,13 +23392,13 @@ var ReactHookFormTextField = function ReactHookFormTextField(_a) {
|
|
|
23387
23392
|
ref = _useController$field.ref,
|
|
23388
23393
|
formErrors = _useController.formState.errors;
|
|
23389
23394
|
var errors = getErrors(name, formErrors);
|
|
23390
|
-
return /*#__PURE__*/React
|
|
23395
|
+
return /*#__PURE__*/React.createElement(ReactHookFormFormControl, {
|
|
23391
23396
|
className: className,
|
|
23392
23397
|
sx: sx,
|
|
23393
23398
|
disabled: disabled,
|
|
23394
23399
|
errors: errors,
|
|
23395
23400
|
isReadOnly: isReadOnly
|
|
23396
|
-
}, /*#__PURE__*/React
|
|
23401
|
+
}, /*#__PURE__*/React.createElement(TextField, Object.assign({
|
|
23397
23402
|
label: label,
|
|
23398
23403
|
error: !!errors,
|
|
23399
23404
|
helperText: helperText,
|
|
@@ -23530,17 +23535,17 @@ var ReactHookFormNumberField = function ReactHookFormNumberField(_a) {
|
|
|
23530
23535
|
event.preventDefault();
|
|
23531
23536
|
}
|
|
23532
23537
|
};
|
|
23533
|
-
var _React$useState = React
|
|
23538
|
+
var _React$useState = React.useState(value === null || isNaN(value) ? '' : value),
|
|
23534
23539
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
23535
23540
|
displayValue = _React$useState2[0],
|
|
23536
23541
|
setDisplayValue = _React$useState2[1];
|
|
23537
|
-
return /*#__PURE__*/React
|
|
23542
|
+
return /*#__PURE__*/React.createElement(ReactHookFormFormControl, {
|
|
23538
23543
|
className: className,
|
|
23539
23544
|
sx: sx,
|
|
23540
23545
|
disabled: disabled,
|
|
23541
23546
|
errors: errors,
|
|
23542
23547
|
isReadOnly: isReadOnly
|
|
23543
|
-
}, /*#__PURE__*/React
|
|
23548
|
+
}, /*#__PURE__*/React.createElement(TextField, Object.assign({
|
|
23544
23549
|
label: label,
|
|
23545
23550
|
error: !!errors,
|
|
23546
23551
|
helperText: helperText,
|
|
@@ -24787,7 +24792,7 @@ function ownerDocument(node) {
|
|
|
24787
24792
|
* while still using it inside the component.
|
|
24788
24793
|
* @param ref A ref callback or ref object. If anything falsy, this is a no-op.
|
|
24789
24794
|
*/
|
|
24790
|
-
function setRef
|
|
24795
|
+
function setRef(ref, value) {
|
|
24791
24796
|
if (typeof ref === 'function') {
|
|
24792
24797
|
ref(value);
|
|
24793
24798
|
} else if (ref) {
|
|
@@ -24795,45 +24800,44 @@ function setRef$2(ref, value) {
|
|
|
24795
24800
|
}
|
|
24796
24801
|
}
|
|
24797
24802
|
|
|
24798
|
-
const useEnhancedEffect
|
|
24799
|
-
var useEnhancedEffect$
|
|
24803
|
+
const useEnhancedEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
|
|
24804
|
+
var useEnhancedEffect$1 = useEnhancedEffect;
|
|
24800
24805
|
|
|
24801
|
-
let globalId
|
|
24802
|
-
function useGlobalId
|
|
24803
|
-
const [defaultId, setDefaultId] = React
|
|
24806
|
+
let globalId = 0;
|
|
24807
|
+
function useGlobalId(idOverride) {
|
|
24808
|
+
const [defaultId, setDefaultId] = React.useState(idOverride);
|
|
24804
24809
|
const id = idOverride || defaultId;
|
|
24805
|
-
React
|
|
24810
|
+
React.useEffect(() => {
|
|
24806
24811
|
if (defaultId == null) {
|
|
24807
24812
|
// Fallback to this default id when possible.
|
|
24808
24813
|
// Use the incrementing value for client-side rendering only.
|
|
24809
24814
|
// We can't use it server-side.
|
|
24810
24815
|
// If you want to use random values please consider the Birthday Problem: https://en.wikipedia.org/wiki/Birthday_problem
|
|
24811
|
-
globalId
|
|
24812
|
-
setDefaultId(`mui-${globalId
|
|
24816
|
+
globalId += 1;
|
|
24817
|
+
setDefaultId(`mui-${globalId}`);
|
|
24813
24818
|
}
|
|
24814
24819
|
}, [defaultId]);
|
|
24815
24820
|
return id;
|
|
24816
24821
|
}
|
|
24817
24822
|
|
|
24818
|
-
//
|
|
24819
|
-
const maybeReactUseId
|
|
24823
|
+
// downstream bundlers may remove unnecessary concatenation, but won't remove toString call -- Workaround for https://github.com/webpack/webpack/issues/14814
|
|
24824
|
+
const maybeReactUseId = React['useId'.toString()];
|
|
24820
24825
|
/**
|
|
24821
24826
|
*
|
|
24822
24827
|
* @example <div id={useId()} />
|
|
24823
24828
|
* @param idOverride
|
|
24824
24829
|
* @returns {string}
|
|
24825
24830
|
*/
|
|
24826
|
-
function useId
|
|
24827
|
-
if (maybeReactUseId
|
|
24828
|
-
const reactId = maybeReactUseId
|
|
24831
|
+
function useId(idOverride) {
|
|
24832
|
+
if (maybeReactUseId !== undefined) {
|
|
24833
|
+
const reactId = maybeReactUseId();
|
|
24829
24834
|
return idOverride != null ? idOverride : reactId;
|
|
24830
24835
|
}
|
|
24831
24836
|
// eslint-disable-next-line react-hooks/rules-of-hooks -- `React.useId` is invariant at runtime.
|
|
24832
|
-
return useGlobalId
|
|
24837
|
+
return useGlobalId(idOverride);
|
|
24833
24838
|
}
|
|
24834
24839
|
|
|
24835
|
-
|
|
24836
|
-
function useControlled$2({
|
|
24840
|
+
function useControlled({
|
|
24837
24841
|
controlled,
|
|
24838
24842
|
default: defaultProp,
|
|
24839
24843
|
name,
|
|
@@ -24842,25 +24846,25 @@ function useControlled$2({
|
|
|
24842
24846
|
// isControlled is ignored in the hook dependency lists as it should never change.
|
|
24843
24847
|
const {
|
|
24844
24848
|
current: isControlled
|
|
24845
|
-
} = React
|
|
24846
|
-
const [valueState, setValue] = React
|
|
24849
|
+
} = React.useRef(controlled !== undefined);
|
|
24850
|
+
const [valueState, setValue] = React.useState(defaultProp);
|
|
24847
24851
|
const value = isControlled ? controlled : valueState;
|
|
24848
24852
|
if (process.env.NODE_ENV !== 'production') {
|
|
24849
|
-
React
|
|
24853
|
+
React.useEffect(() => {
|
|
24850
24854
|
if (isControlled !== (controlled !== undefined)) {
|
|
24851
24855
|
console.error([`MUI: A component is changing the ${isControlled ? '' : 'un'}controlled ${state} state of ${name} to be ${isControlled ? 'un' : ''}controlled.`, 'Elements should not switch from uncontrolled to controlled (or vice versa).', `Decide between using a controlled or uncontrolled ${name} ` + 'element for the lifetime of the component.', "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", 'More info: https://fb.me/react-controlled-components'].join('\n'));
|
|
24852
24856
|
}
|
|
24853
24857
|
}, [state, name, controlled]);
|
|
24854
24858
|
const {
|
|
24855
24859
|
current: defaultValue
|
|
24856
|
-
} = React
|
|
24857
|
-
React
|
|
24860
|
+
} = React.useRef(defaultProp);
|
|
24861
|
+
React.useEffect(() => {
|
|
24858
24862
|
if (!isControlled && defaultValue !== defaultProp) {
|
|
24859
24863
|
console.error([`MUI: A component is changing the default ${state} state of an uncontrolled ${name} after being initialized. ` + `To suppress this warning opt to use a controlled ${name}.`].join('\n'));
|
|
24860
24864
|
}
|
|
24861
24865
|
}, [JSON.stringify(defaultProp)]);
|
|
24862
24866
|
}
|
|
24863
|
-
const setValueIfUncontrolled = React
|
|
24867
|
+
const setValueIfUncontrolled = React.useCallback(newValue => {
|
|
24864
24868
|
if (!isControlled) {
|
|
24865
24869
|
setValue(newValue);
|
|
24866
24870
|
}
|
|
@@ -24871,30 +24875,31 @@ function useControlled$2({
|
|
|
24871
24875
|
/**
|
|
24872
24876
|
* https://github.com/facebook/react/issues/14099#issuecomment-440013892
|
|
24873
24877
|
*/
|
|
24874
|
-
|
|
24875
|
-
|
|
24876
|
-
|
|
24878
|
+
|
|
24879
|
+
function useEventCallback(fn) {
|
|
24880
|
+
const ref = React.useRef(fn);
|
|
24881
|
+
useEnhancedEffect$1(() => {
|
|
24877
24882
|
ref.current = fn;
|
|
24878
24883
|
});
|
|
24879
|
-
return React
|
|
24884
|
+
return React.useCallback((...args) =>
|
|
24880
24885
|
// @ts-expect-error hide `this`
|
|
24881
24886
|
// tslint:disable-next-line:ban-comma-operator
|
|
24882
24887
|
(0, ref.current)(...args), []);
|
|
24883
24888
|
}
|
|
24884
24889
|
|
|
24885
|
-
function useForkRef
|
|
24890
|
+
function useForkRef(...refs) {
|
|
24886
24891
|
/**
|
|
24887
24892
|
* This will create a new function if the refs passed to this hook change and are all defined.
|
|
24888
24893
|
* This means react will call the old forkRef with `null` and the new forkRef
|
|
24889
24894
|
* with the ref. Cleanup naturally emerges from this behavior.
|
|
24890
24895
|
*/
|
|
24891
|
-
return React
|
|
24896
|
+
return React.useMemo(() => {
|
|
24892
24897
|
if (refs.every(ref => ref == null)) {
|
|
24893
24898
|
return null;
|
|
24894
24899
|
}
|
|
24895
24900
|
return instance => {
|
|
24896
24901
|
refs.forEach(ref => {
|
|
24897
|
-
setRef
|
|
24902
|
+
setRef(ref, instance);
|
|
24898
24903
|
});
|
|
24899
24904
|
};
|
|
24900
24905
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -24904,7 +24909,7 @@ function useForkRef$2(...refs) {
|
|
|
24904
24909
|
function composeClasses(slots, getUtilityClass, classes = undefined) {
|
|
24905
24910
|
const output = {};
|
|
24906
24911
|
Object.keys(slots).forEach(
|
|
24907
|
-
// `
|
|
24912
|
+
// `Object.keys(slots)` can't be wider than `T` because we infer `T` from `slots`.
|
|
24908
24913
|
// @ts-expect-error https://github.com/microsoft/TypeScript/pull/12253#issuecomment-263132208
|
|
24909
24914
|
slot => {
|
|
24910
24915
|
output[slot] = slots[slot].reduce((acc, key) => {
|
|
@@ -24941,6 +24946,8 @@ const createClassNameGenerator = () => {
|
|
|
24941
24946
|
const ClassNameGenerator = createClassNameGenerator();
|
|
24942
24947
|
var ClassNameGenerator$1 = ClassNameGenerator;
|
|
24943
24948
|
|
|
24949
|
+
// If GlobalStateSlot is changed, GLOBAL_STATE_CLASSES in
|
|
24950
|
+
// \packages\api-docs-builder\utils\parseSlotsAndClasses.ts must be updated accordingly.
|
|
24944
24951
|
const globalStateClassesMapping = {
|
|
24945
24952
|
active: 'active',
|
|
24946
24953
|
checked: 'checked',
|
|
@@ -24967,57 +24974,8 @@ function generateUtilityClasses(componentName, slots, globalStatePrefix = 'Mui')
|
|
|
24967
24974
|
return result;
|
|
24968
24975
|
}
|
|
24969
24976
|
|
|
24970
|
-
var useEventCallback$1 = {};
|
|
24971
|
-
|
|
24972
|
-
var interopRequireDefault = {exports: {}};
|
|
24973
|
-
|
|
24974
|
-
(function (module) {
|
|
24975
|
-
function _interopRequireDefault(obj) {
|
|
24976
|
-
return obj && obj.__esModule ? obj : {
|
|
24977
|
-
"default": obj
|
|
24978
|
-
};
|
|
24979
|
-
}
|
|
24980
|
-
module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
24981
|
-
}(interopRequireDefault));
|
|
24982
|
-
|
|
24983
|
-
var useEnhancedEffect$1 = {};
|
|
24984
|
-
|
|
24985
|
-
Object.defineProperty(useEnhancedEffect$1, "__esModule", {
|
|
24986
|
-
value: true
|
|
24987
|
-
});
|
|
24988
|
-
var default_1 = useEnhancedEffect$1.default = void 0;
|
|
24989
|
-
var React$4 = _interopRequireWildcard$4(React__default);
|
|
24990
|
-
function _getRequireWildcardCache$4(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache$4 = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
24991
|
-
function _interopRequireWildcard$4(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache$4(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
24992
|
-
const useEnhancedEffect = typeof window !== 'undefined' ? React$4.useLayoutEffect : React$4.useEffect;
|
|
24993
|
-
var _default$4 = useEnhancedEffect;
|
|
24994
|
-
default_1 = useEnhancedEffect$1.default = _default$4;
|
|
24995
|
-
|
|
24996
|
-
var _interopRequireDefault$1 = interopRequireDefault.exports;
|
|
24997
|
-
Object.defineProperty(useEventCallback$1, "__esModule", {
|
|
24998
|
-
value: true
|
|
24999
|
-
});
|
|
25000
|
-
var _default$3 = useEventCallback$1.default = useEventCallback;
|
|
25001
|
-
var React$3 = _interopRequireWildcard$3(React__default);
|
|
25002
|
-
var _useEnhancedEffect = _interopRequireDefault$1(useEnhancedEffect$1);
|
|
25003
|
-
function _getRequireWildcardCache$3(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache$3 = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
25004
|
-
function _interopRequireWildcard$3(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache$3(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25005
|
-
/**
|
|
25006
|
-
* https://github.com/facebook/react/issues/14099#issuecomment-440013892
|
|
25007
|
-
*/
|
|
25008
|
-
function useEventCallback(fn) {
|
|
25009
|
-
const ref = React$3.useRef(fn);
|
|
25010
|
-
(0, _useEnhancedEffect.default)(() => {
|
|
25011
|
-
ref.current = fn;
|
|
25012
|
-
});
|
|
25013
|
-
return React$3.useCallback((...args) =>
|
|
25014
|
-
// @ts-expect-error hide `this`
|
|
25015
|
-
// tslint:disable-next-line:ban-comma-operator
|
|
25016
|
-
(0, ref.current)(...args), []);
|
|
25017
|
-
}
|
|
25018
|
-
|
|
25019
24977
|
const _excluded$s = ["localeText"];
|
|
25020
|
-
const MuiPickersAdapterContext = /*#__PURE__*/React
|
|
24978
|
+
const MuiPickersAdapterContext = /*#__PURE__*/React.createContext(null);
|
|
25021
24979
|
if (process.env.NODE_ENV !== 'production') {
|
|
25022
24980
|
MuiPickersAdapterContext.displayName = 'MuiPickersAdapterContext';
|
|
25023
24981
|
}
|
|
@@ -25033,7 +24991,7 @@ function LocalizationProvider(inProps) {
|
|
|
25033
24991
|
const {
|
|
25034
24992
|
utils: parentUtils,
|
|
25035
24993
|
localeText: parentLocaleText
|
|
25036
|
-
} = (_React$useContext = React
|
|
24994
|
+
} = (_React$useContext = React.useContext(MuiPickersAdapterContext)) != null ? _React$useContext : {
|
|
25037
24995
|
utils: undefined,
|
|
25038
24996
|
localeText: undefined
|
|
25039
24997
|
};
|
|
@@ -25051,8 +25009,8 @@ function LocalizationProvider(inProps) {
|
|
|
25051
25009
|
adapterLocale,
|
|
25052
25010
|
localeText: themeLocaleText
|
|
25053
25011
|
} = props;
|
|
25054
|
-
const localeText = React
|
|
25055
|
-
const utils = React
|
|
25012
|
+
const localeText = React.useMemo(() => _extends({}, themeLocaleText, parentLocaleText, inLocaleText), [themeLocaleText, parentLocaleText, inLocaleText]);
|
|
25013
|
+
const utils = React.useMemo(() => {
|
|
25056
25014
|
if (!DateAdapter) {
|
|
25057
25015
|
if (parentUtils) {
|
|
25058
25016
|
return parentUtils;
|
|
@@ -25069,7 +25027,7 @@ function LocalizationProvider(inProps) {
|
|
|
25069
25027
|
}
|
|
25070
25028
|
return adapter;
|
|
25071
25029
|
}, [DateAdapter, adapterLocale, dateFormats, dateLibInstance, parentUtils]);
|
|
25072
|
-
const defaultDates = React
|
|
25030
|
+
const defaultDates = React.useMemo(() => {
|
|
25073
25031
|
if (!utils) {
|
|
25074
25032
|
return null;
|
|
25075
25033
|
}
|
|
@@ -25078,7 +25036,7 @@ function LocalizationProvider(inProps) {
|
|
|
25078
25036
|
maxDate: utils.date('2099-12-31T00:00:00.000')
|
|
25079
25037
|
};
|
|
25080
25038
|
}, [utils]);
|
|
25081
|
-
const contextValue = React
|
|
25039
|
+
const contextValue = React.useMemo(() => {
|
|
25082
25040
|
return {
|
|
25083
25041
|
utils,
|
|
25084
25042
|
defaultDates,
|
|
@@ -25215,15 +25173,15 @@ const DEFAULT_LOCALE = enUSPickers;
|
|
|
25215
25173
|
getPickersLocalization(enUSPickers);
|
|
25216
25174
|
|
|
25217
25175
|
const useLocalizationContext = () => {
|
|
25218
|
-
const localization = React
|
|
25176
|
+
const localization = React.useContext(MuiPickersAdapterContext);
|
|
25219
25177
|
if (localization === null) {
|
|
25220
25178
|
throw new Error(['MUI: Can not find the date and time pickers localization context.', 'It looks like you forgot to wrap your component in LocalizationProvider.', 'This can also happen if you are bundling multiple versions of the `@mui/x-date-pickers` package'].join('\n'));
|
|
25221
25179
|
}
|
|
25222
25180
|
if (localization.utils === null) {
|
|
25223
25181
|
throw new Error(['MUI: Can not find the date and time pickers adapter from its localization context.', 'It looks like you forgot to pass a `dateAdapter` to your LocalizationProvider.'].join('\n'));
|
|
25224
25182
|
}
|
|
25225
|
-
const localeText = React
|
|
25226
|
-
return React
|
|
25183
|
+
const localeText = React.useMemo(() => _extends({}, DEFAULT_LOCALE, localization.localeText), [localization.localeText]);
|
|
25184
|
+
return React.useMemo(() => _extends({}, localization, {
|
|
25227
25185
|
localeText
|
|
25228
25186
|
}), [localization, localeText]);
|
|
25229
25187
|
};
|
|
@@ -25232,7 +25190,7 @@ const useDefaultDates = () => useLocalizationContext().defaultDates;
|
|
|
25232
25190
|
const useLocaleText = () => useLocalizationContext().localeText;
|
|
25233
25191
|
const useNow = () => {
|
|
25234
25192
|
const utils = useUtils();
|
|
25235
|
-
const now = React
|
|
25193
|
+
const now = React.useRef(utils.date());
|
|
25236
25194
|
return now.current;
|
|
25237
25195
|
};
|
|
25238
25196
|
|
|
@@ -25402,7 +25360,7 @@ function useSlotProps(parameters) {
|
|
|
25402
25360
|
} = mergeSlotProps(_extends({}, rest, {
|
|
25403
25361
|
externalSlotProps: resolvedComponentsProps
|
|
25404
25362
|
}));
|
|
25405
|
-
const ref = useForkRef
|
|
25363
|
+
const ref = useForkRef(internalRef, resolvedComponentsProps == null ? void 0 : resolvedComponentsProps.ref, (_parameters$additiona = parameters.additionalProps) == null ? void 0 : _parameters$additiona.ref);
|
|
25406
25364
|
const props = appendOwnerState(elementType, _extends({}, mergedProps, {
|
|
25407
25365
|
ref
|
|
25408
25366
|
}), ownerState);
|
|
@@ -25437,7 +25395,7 @@ const Calendar = createSvgIcon( /*#__PURE__*/jsx("path", {
|
|
|
25437
25395
|
/**
|
|
25438
25396
|
* @ignore - internal component.
|
|
25439
25397
|
*/
|
|
25440
|
-
createSvgIcon( /*#__PURE__*/jsxs(React
|
|
25398
|
+
createSvgIcon( /*#__PURE__*/jsxs(React.Fragment, {
|
|
25441
25399
|
children: [/*#__PURE__*/jsx("path", {
|
|
25442
25400
|
d: "M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"
|
|
25443
25401
|
}), /*#__PURE__*/jsx("path", {
|
|
@@ -25455,7 +25413,7 @@ const DateRange = createSvgIcon( /*#__PURE__*/jsx("path", {
|
|
|
25455
25413
|
/**
|
|
25456
25414
|
* @ignore - internal component.
|
|
25457
25415
|
*/
|
|
25458
|
-
const Time = createSvgIcon( /*#__PURE__*/jsxs(React
|
|
25416
|
+
const Time = createSvgIcon( /*#__PURE__*/jsxs(React.Fragment, {
|
|
25459
25417
|
children: [/*#__PURE__*/jsx("path", {
|
|
25460
25418
|
d: "M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"
|
|
25461
25419
|
}), /*#__PURE__*/jsx("path", {
|
|
@@ -25507,7 +25465,7 @@ const useUtilityClasses$m = ownerState => {
|
|
|
25507
25465
|
};
|
|
25508
25466
|
return composeClasses(slots, getPickersArrowSwitcherUtilityClass, classes);
|
|
25509
25467
|
};
|
|
25510
|
-
const PickersArrowSwitcher = /*#__PURE__*/React
|
|
25468
|
+
const PickersArrowSwitcher = /*#__PURE__*/React.forwardRef(function PickersArrowSwitcher(inProps, ref) {
|
|
25511
25469
|
var _slots$previousIconBu, _slots$nextIconButton, _slots$leftArrowIcon, _slots$rightArrowIcon;
|
|
25512
25470
|
const theme = useTheme$2();
|
|
25513
25471
|
const isRTL = theme.direction === 'rtl';
|
|
@@ -25675,23 +25633,23 @@ function useViews({
|
|
|
25675
25633
|
}
|
|
25676
25634
|
}
|
|
25677
25635
|
}
|
|
25678
|
-
const previousOpenTo = React
|
|
25679
|
-
const previousViews = React
|
|
25680
|
-
const defaultView = React
|
|
25681
|
-
const [view, setView] = useControlled
|
|
25636
|
+
const previousOpenTo = React.useRef(openTo);
|
|
25637
|
+
const previousViews = React.useRef(views);
|
|
25638
|
+
const defaultView = React.useRef(views.includes(openTo) ? openTo : views[0]);
|
|
25639
|
+
const [view, setView] = useControlled({
|
|
25682
25640
|
name: 'useViews',
|
|
25683
25641
|
state: 'view',
|
|
25684
25642
|
controlled: inView,
|
|
25685
25643
|
default: defaultView.current
|
|
25686
25644
|
});
|
|
25687
|
-
const defaultFocusedView = React
|
|
25688
|
-
const [focusedView, setFocusedView] = useControlled
|
|
25645
|
+
const defaultFocusedView = React.useRef(autoFocus ? view : null);
|
|
25646
|
+
const [focusedView, setFocusedView] = useControlled({
|
|
25689
25647
|
name: 'useViews',
|
|
25690
25648
|
state: 'focusedView',
|
|
25691
25649
|
controlled: inFocusedView,
|
|
25692
25650
|
default: defaultFocusedView.current
|
|
25693
25651
|
});
|
|
25694
|
-
React
|
|
25652
|
+
React.useEffect(() => {
|
|
25695
25653
|
// Update the current view when `openTo` or `views` props change
|
|
25696
25654
|
if (previousOpenTo.current && previousOpenTo.current !== openTo || previousViews.current && previousViews.current.some(previousView => !views.includes(previousView))) {
|
|
25697
25655
|
setView(views.includes(openTo) ? openTo : views[0]);
|
|
@@ -25700,18 +25658,18 @@ function useViews({
|
|
|
25700
25658
|
const viewIndex = views.indexOf(view);
|
|
25701
25659
|
const previousView = (_views = views[viewIndex - 1]) != null ? _views : null;
|
|
25702
25660
|
const nextView = (_views2 = views[viewIndex + 1]) != null ? _views2 : null;
|
|
25703
|
-
const handleChangeView =
|
|
25661
|
+
const handleChangeView = useEventCallback(newView => {
|
|
25704
25662
|
setView(newView);
|
|
25705
25663
|
if (onViewChange) {
|
|
25706
25664
|
onViewChange(newView);
|
|
25707
25665
|
}
|
|
25708
25666
|
});
|
|
25709
|
-
const goToNextView =
|
|
25667
|
+
const goToNextView = useEventCallback(() => {
|
|
25710
25668
|
if (nextView) {
|
|
25711
25669
|
handleChangeView(nextView);
|
|
25712
25670
|
}
|
|
25713
25671
|
});
|
|
25714
|
-
const setValueAndGoToNextView =
|
|
25672
|
+
const setValueAndGoToNextView = useEventCallback((value, currentViewSelectionState) => {
|
|
25715
25673
|
const isSelectionFinishedOnCurrentView = currentViewSelectionState === 'finish';
|
|
25716
25674
|
const globalSelectionState = isSelectionFinishedOnCurrentView && Boolean(nextView) ? 'partial' : currentViewSelectionState;
|
|
25717
25675
|
onChange(value, globalSelectionState);
|
|
@@ -25719,7 +25677,7 @@ function useViews({
|
|
|
25719
25677
|
goToNextView();
|
|
25720
25678
|
}
|
|
25721
25679
|
});
|
|
25722
|
-
const handleFocusedViewChange =
|
|
25680
|
+
const handleFocusedViewChange = useEventCallback((viewToFocus, hasFocus) => {
|
|
25723
25681
|
if (hasFocus) {
|
|
25724
25682
|
// Focus event
|
|
25725
25683
|
setFocusedView(viewToFocus);
|
|
@@ -25749,7 +25707,7 @@ function useNextMonthDisabled(month, {
|
|
|
25749
25707
|
maxDate
|
|
25750
25708
|
}) {
|
|
25751
25709
|
const utils = useUtils();
|
|
25752
|
-
return React
|
|
25710
|
+
return React.useMemo(() => {
|
|
25753
25711
|
const now = utils.date();
|
|
25754
25712
|
const lastEnabledMonth = utils.startOfMonth(disableFuture && utils.isBefore(now, maxDate) ? now : maxDate);
|
|
25755
25713
|
return !utils.isAfter(lastEnabledMonth, month);
|
|
@@ -25760,7 +25718,7 @@ function usePreviousMonthDisabled(month, {
|
|
|
25760
25718
|
minDate
|
|
25761
25719
|
}) {
|
|
25762
25720
|
const utils = useUtils();
|
|
25763
|
-
return React
|
|
25721
|
+
return React.useMemo(() => {
|
|
25764
25722
|
const now = utils.date();
|
|
25765
25723
|
const firstEnabledMonth = utils.startOfMonth(disablePast && utils.isAfter(now, minDate) ? now : minDate);
|
|
25766
25724
|
return !utils.isBefore(firstEnabledMonth, month);
|
|
@@ -25769,7 +25727,7 @@ function usePreviousMonthDisabled(month, {
|
|
|
25769
25727
|
function useMeridiemMode(date, ampm, onChange) {
|
|
25770
25728
|
const utils = useUtils();
|
|
25771
25729
|
const meridiemMode = getMeridiem(date, utils);
|
|
25772
|
-
const handleMeridiemChange = React
|
|
25730
|
+
const handleMeridiemChange = React.useCallback(mode => {
|
|
25773
25731
|
const timeWithMeridiem = date == null ? null : convertToMeridiem(date, mode, Boolean(ampm), utils);
|
|
25774
25732
|
onChange(timeWithMeridiem, 'partial');
|
|
25775
25733
|
}, [ampm, date, onChange, utils]);
|
|
@@ -25920,8 +25878,8 @@ function ClockPointer(inProps) {
|
|
|
25920
25878
|
viewValue
|
|
25921
25879
|
} = props,
|
|
25922
25880
|
other = _objectWithoutPropertiesLoose(props, _excluded$p);
|
|
25923
|
-
const previousType = React
|
|
25924
|
-
React
|
|
25881
|
+
const previousType = React.useRef(type);
|
|
25882
|
+
React.useEffect(() => {
|
|
25925
25883
|
previousType.current = type;
|
|
25926
25884
|
}, [type]);
|
|
25927
25885
|
const ownerState = _extends({}, props, {
|
|
@@ -26114,7 +26072,7 @@ function Clock(inProps) {
|
|
|
26114
26072
|
const ownerState = props;
|
|
26115
26073
|
const utils = useUtils();
|
|
26116
26074
|
const localeText = useLocaleText();
|
|
26117
|
-
const isMoving = React
|
|
26075
|
+
const isMoving = React.useRef(false);
|
|
26118
26076
|
const classes = useUtilityClasses$k(ownerState);
|
|
26119
26077
|
const isSelectedTimeDisabled = isTimeDisabled(viewValue, type);
|
|
26120
26078
|
const isPointerInner = !ampm && type === 'hours' && (viewValue < 1 || viewValue > 12);
|
|
@@ -26162,17 +26120,17 @@ function Clock(inProps) {
|
|
|
26162
26120
|
}
|
|
26163
26121
|
setTime(event.nativeEvent, 'finish');
|
|
26164
26122
|
};
|
|
26165
|
-
const hasSelected = React
|
|
26123
|
+
const hasSelected = React.useMemo(() => {
|
|
26166
26124
|
if (type === 'hours') {
|
|
26167
26125
|
return true;
|
|
26168
26126
|
}
|
|
26169
26127
|
return viewValue % 5 === 0;
|
|
26170
26128
|
}, [type, viewValue]);
|
|
26171
26129
|
const keyboardControlStep = type === 'minutes' ? minutesStep : 1;
|
|
26172
|
-
const listboxRef = React
|
|
26130
|
+
const listboxRef = React.useRef(null);
|
|
26173
26131
|
// Since this is rendered when a Popper is opened we can't use passive effects.
|
|
26174
26132
|
// Focusing in passive effects in Popper causes scroll jump.
|
|
26175
|
-
useEnhancedEffect$
|
|
26133
|
+
useEnhancedEffect$1(() => {
|
|
26176
26134
|
if (autoFocus) {
|
|
26177
26135
|
// The ref not being resolved would be a bug in MUI.
|
|
26178
26136
|
listboxRef.current.focus();
|
|
@@ -26218,7 +26176,7 @@ function Clock(inProps) {
|
|
|
26218
26176
|
disabled
|
|
26219
26177
|
},
|
|
26220
26178
|
className: classes.squareMask
|
|
26221
|
-
}), !isSelectedTimeDisabled && /*#__PURE__*/jsxs(React
|
|
26179
|
+
}), !isSelectedTimeDisabled && /*#__PURE__*/jsxs(React.Fragment, {
|
|
26222
26180
|
children: [/*#__PURE__*/jsx(ClockPin, {
|
|
26223
26181
|
className: classes.pin
|
|
26224
26182
|
}), value != null && /*#__PURE__*/jsx(ClockPointer, {
|
|
@@ -26237,7 +26195,7 @@ function Clock(inProps) {
|
|
|
26237
26195
|
className: classes.wrapper,
|
|
26238
26196
|
children: children
|
|
26239
26197
|
})]
|
|
26240
|
-
}), ampm && ampmInClock && /*#__PURE__*/jsxs(React
|
|
26198
|
+
}), ampm && ampmInClock && /*#__PURE__*/jsxs(React.Fragment, {
|
|
26241
26199
|
children: [/*#__PURE__*/jsx(ClockAmButton, {
|
|
26242
26200
|
onClick: readOnly ? undefined : () => handleMeridiemChange('am'),
|
|
26243
26201
|
disabled: disabled || meridiemMode === null,
|
|
@@ -26468,7 +26426,7 @@ const TimeClockArrowSwitcher = styled(PickersArrowSwitcher, {
|
|
|
26468
26426
|
*
|
|
26469
26427
|
* - [TimeClock API](https://mui.com/x/api/date-pickers/time-clock/)
|
|
26470
26428
|
*/
|
|
26471
|
-
const TimeClock = /*#__PURE__*/React
|
|
26429
|
+
const TimeClock = /*#__PURE__*/React.forwardRef(function TimeClock(inProps, ref) {
|
|
26472
26430
|
const localeText = useLocaleText();
|
|
26473
26431
|
const now = useNow();
|
|
26474
26432
|
const utils = useUtils();
|
|
@@ -26507,13 +26465,13 @@ const TimeClock = /*#__PURE__*/React$5.forwardRef(function TimeClock(inProps, re
|
|
|
26507
26465
|
other = _objectWithoutPropertiesLoose(props, _excluded$n);
|
|
26508
26466
|
const slots = innerSlots != null ? innerSlots : uncapitalizeObjectKeys(components);
|
|
26509
26467
|
const slotProps = innerSlotProps != null ? innerSlotProps : componentsProps;
|
|
26510
|
-
const [value, setValue] = useControlled
|
|
26468
|
+
const [value, setValue] = useControlled({
|
|
26511
26469
|
name: 'DateCalendar',
|
|
26512
26470
|
state: 'value',
|
|
26513
26471
|
controlled: valueProp,
|
|
26514
26472
|
default: defaultValue != null ? defaultValue : null
|
|
26515
26473
|
});
|
|
26516
|
-
const handleValueChange =
|
|
26474
|
+
const handleValueChange = useEventCallback((newValue, selectionState) => {
|
|
26517
26475
|
setValue(newValue);
|
|
26518
26476
|
onChange == null ? void 0 : onChange(newValue, selectionState);
|
|
26519
26477
|
});
|
|
@@ -26530,12 +26488,12 @@ const TimeClock = /*#__PURE__*/React$5.forwardRef(function TimeClock(inProps, re
|
|
|
26530
26488
|
onViewChange,
|
|
26531
26489
|
onChange: handleValueChange
|
|
26532
26490
|
});
|
|
26533
|
-
const selectedTimeOrMidnight = React
|
|
26491
|
+
const selectedTimeOrMidnight = React.useMemo(() => value || utils.setSeconds(utils.setMinutes(utils.setHours(now, 0), 0), 0), [value, now, utils]);
|
|
26534
26492
|
const {
|
|
26535
26493
|
meridiemMode,
|
|
26536
26494
|
handleMeridiemChange
|
|
26537
26495
|
} = useMeridiemMode(selectedTimeOrMidnight, ampm, setValueAndGoToNextView);
|
|
26538
|
-
const isTimeDisabled = React
|
|
26496
|
+
const isTimeDisabled = React.useCallback((rawValue, viewType) => {
|
|
26539
26497
|
const isAfter = createIsAfterIgnoreDatePart(disableIgnoringDatePartForTimeValidation, utils);
|
|
26540
26498
|
const shouldCheckPastEnd = viewType === 'hours' || viewType === 'minutes' && views.includes('seconds');
|
|
26541
26499
|
const containsValidTime = ({
|
|
@@ -26613,8 +26571,8 @@ const TimeClock = /*#__PURE__*/React$5.forwardRef(function TimeClock(inProps, re
|
|
|
26613
26571
|
throw new Error('not supported');
|
|
26614
26572
|
}
|
|
26615
26573
|
}, [ampm, selectedTimeOrMidnight, disableIgnoringDatePartForTimeValidation, maxTime, meridiemMode, minTime, minutesStep, shouldDisableClock, shouldDisableTime, utils, disableFuture, disablePast, now, views]);
|
|
26616
|
-
const selectedId = useId
|
|
26617
|
-
const viewProps = React
|
|
26574
|
+
const selectedId = useId();
|
|
26575
|
+
const viewProps = React.useMemo(() => {
|
|
26618
26576
|
switch (view) {
|
|
26619
26577
|
case 'hours':
|
|
26620
26578
|
{
|
|
@@ -26953,7 +26911,7 @@ const PickersDayFiller = styled('div', {
|
|
|
26953
26911
|
pointerEvents: 'none'
|
|
26954
26912
|
}));
|
|
26955
26913
|
const noop$1 = () => {};
|
|
26956
|
-
const PickersDayRaw = /*#__PURE__*/React
|
|
26914
|
+
const PickersDayRaw = /*#__PURE__*/React.forwardRef(function PickersDay(inProps, forwardedRef) {
|
|
26957
26915
|
const props = useThemeProps({
|
|
26958
26916
|
props: inProps,
|
|
26959
26917
|
name: 'MuiPickersDay'
|
|
@@ -26991,12 +26949,12 @@ const PickersDayRaw = /*#__PURE__*/React$5.forwardRef(function PickersDay(inProp
|
|
|
26991
26949
|
});
|
|
26992
26950
|
const classes = useUtilityClasses$h(ownerState);
|
|
26993
26951
|
const utils = useUtils();
|
|
26994
|
-
const ref = React
|
|
26995
|
-
const handleRef = useForkRef
|
|
26952
|
+
const ref = React.useRef(null);
|
|
26953
|
+
const handleRef = useForkRef(ref, forwardedRef);
|
|
26996
26954
|
|
|
26997
26955
|
// Since this is rendered when a Popper is opened we can't use passive effects.
|
|
26998
26956
|
// Focusing in passive effects in Popper causes scroll jump.
|
|
26999
|
-
useEnhancedEffect$
|
|
26957
|
+
useEnhancedEffect$1(() => {
|
|
27000
26958
|
if (autoFocus && !disabled && !isAnimating && !outsideCurrentMonth) {
|
|
27001
26959
|
// ref.current being null would be a bug in MUI
|
|
27002
26960
|
ref.current.focus();
|
|
@@ -27198,7 +27156,7 @@ process.env.NODE_ENV !== "production" ? PickersDayRaw.propTypes = {
|
|
|
27198
27156
|
*
|
|
27199
27157
|
* - [PickersDay API](https://mui.com/x/api/date-pickers/pickers-day/)
|
|
27200
27158
|
*/
|
|
27201
|
-
const PickersDay = /*#__PURE__*/React
|
|
27159
|
+
const PickersDay = /*#__PURE__*/React.memo(PickersDayRaw);
|
|
27202
27160
|
|
|
27203
27161
|
const findClosestEnabledDate = ({
|
|
27204
27162
|
date,
|
|
@@ -28015,76 +27973,19 @@ const singleItemFieldValueManager = {
|
|
|
28015
27973
|
parseValueStr: (valueStr, referenceValue, parseDate) => parseDate(valueStr.trim(), referenceValue)
|
|
28016
27974
|
};
|
|
28017
27975
|
|
|
28018
|
-
var useForkRef$1 = {};
|
|
28019
|
-
|
|
28020
|
-
var setRef$1 = {};
|
|
28021
|
-
|
|
28022
|
-
Object.defineProperty(setRef$1, "__esModule", {
|
|
28023
|
-
value: true
|
|
28024
|
-
});
|
|
28025
|
-
setRef$1.default = setRef;
|
|
28026
|
-
/**
|
|
28027
|
-
* TODO v5: consider making it private
|
|
28028
|
-
*
|
|
28029
|
-
* passes {value} to {ref}
|
|
28030
|
-
*
|
|
28031
|
-
* WARNING: Be sure to only call this inside a callback that is passed as a ref.
|
|
28032
|
-
* Otherwise, make sure to cleanup the previous {ref} if it changes. See
|
|
28033
|
-
* https://github.com/mui/material-ui/issues/13539
|
|
28034
|
-
*
|
|
28035
|
-
* Useful if you want to expose the ref of an inner component to the public API
|
|
28036
|
-
* while still using it inside the component.
|
|
28037
|
-
* @param ref A ref callback or ref object. If anything falsy, this is a no-op.
|
|
28038
|
-
*/
|
|
28039
|
-
function setRef(ref, value) {
|
|
28040
|
-
if (typeof ref === 'function') {
|
|
28041
|
-
ref(value);
|
|
28042
|
-
} else if (ref) {
|
|
28043
|
-
ref.current = value;
|
|
28044
|
-
}
|
|
28045
|
-
}
|
|
28046
|
-
|
|
28047
|
-
var _interopRequireDefault = interopRequireDefault.exports;
|
|
28048
|
-
Object.defineProperty(useForkRef$1, "__esModule", {
|
|
28049
|
-
value: true
|
|
28050
|
-
});
|
|
28051
|
-
var _default$2 = useForkRef$1.default = useForkRef;
|
|
28052
|
-
var React$2 = _interopRequireWildcard$2(React__default);
|
|
28053
|
-
var _setRef = _interopRequireDefault(setRef$1);
|
|
28054
|
-
function _getRequireWildcardCache$2(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache$2 = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
28055
|
-
function _interopRequireWildcard$2(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache$2(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
28056
|
-
function useForkRef(...refs) {
|
|
28057
|
-
/**
|
|
28058
|
-
* This will create a new function if the refs passed to this hook change and are all defined.
|
|
28059
|
-
* This means react will call the old forkRef with `null` and the new forkRef
|
|
28060
|
-
* with the ref. Cleanup naturally emerges from this behavior.
|
|
28061
|
-
*/
|
|
28062
|
-
return React$2.useMemo(() => {
|
|
28063
|
-
if (refs.every(ref => ref == null)) {
|
|
28064
|
-
return null;
|
|
28065
|
-
}
|
|
28066
|
-
return instance => {
|
|
28067
|
-
refs.forEach(ref => {
|
|
28068
|
-
(0, _setRef.default)(ref, instance);
|
|
28069
|
-
});
|
|
28070
|
-
};
|
|
28071
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
28072
|
-
}, refs);
|
|
28073
|
-
}
|
|
28074
|
-
|
|
28075
27976
|
function useValidation(props, validate, isSameError, defaultErrorState) {
|
|
28076
27977
|
const {
|
|
28077
27978
|
value,
|
|
28078
27979
|
onError
|
|
28079
27980
|
} = props;
|
|
28080
27981
|
const adapter = useLocalizationContext();
|
|
28081
|
-
const previousValidationErrorRef = React
|
|
27982
|
+
const previousValidationErrorRef = React.useRef(defaultErrorState);
|
|
28082
27983
|
const validationError = validate({
|
|
28083
27984
|
adapter,
|
|
28084
27985
|
value,
|
|
28085
27986
|
props
|
|
28086
27987
|
});
|
|
28087
|
-
React
|
|
27988
|
+
React.useEffect(() => {
|
|
28088
27989
|
if (onError && !isSameError(validationError, previousValidationErrorRef.current)) {
|
|
28089
27990
|
onError(validationError, value);
|
|
28090
27991
|
}
|
|
@@ -28093,52 +27994,6 @@ function useValidation(props, validate, isSameError, defaultErrorState) {
|
|
|
28093
27994
|
return validationError;
|
|
28094
27995
|
}
|
|
28095
27996
|
|
|
28096
|
-
var useControlled$1 = {};
|
|
28097
|
-
|
|
28098
|
-
Object.defineProperty(useControlled$1, "__esModule", {
|
|
28099
|
-
value: true
|
|
28100
|
-
});
|
|
28101
|
-
var _default$1 = useControlled$1.default = useControlled;
|
|
28102
|
-
var React$1 = _interopRequireWildcard$1(React__default);
|
|
28103
|
-
function _getRequireWildcardCache$1(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache$1 = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
28104
|
-
function _interopRequireWildcard$1(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache$1(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
28105
|
-
/* eslint-disable react-hooks/rules-of-hooks, react-hooks/exhaustive-deps */
|
|
28106
|
-
|
|
28107
|
-
function useControlled({
|
|
28108
|
-
controlled,
|
|
28109
|
-
default: defaultProp,
|
|
28110
|
-
name,
|
|
28111
|
-
state = 'value'
|
|
28112
|
-
}) {
|
|
28113
|
-
// isControlled is ignored in the hook dependency lists as it should never change.
|
|
28114
|
-
const {
|
|
28115
|
-
current: isControlled
|
|
28116
|
-
} = React$1.useRef(controlled !== undefined);
|
|
28117
|
-
const [valueState, setValue] = React$1.useState(defaultProp);
|
|
28118
|
-
const value = isControlled ? controlled : valueState;
|
|
28119
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
28120
|
-
React$1.useEffect(() => {
|
|
28121
|
-
if (isControlled !== (controlled !== undefined)) {
|
|
28122
|
-
console.error([`MUI: A component is changing the ${isControlled ? '' : 'un'}controlled ${state} state of ${name} to be ${isControlled ? 'un' : ''}controlled.`, 'Elements should not switch from uncontrolled to controlled (or vice versa).', `Decide between using a controlled or uncontrolled ${name} ` + 'element for the lifetime of the component.', "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", 'More info: https://fb.me/react-controlled-components'].join('\n'));
|
|
28123
|
-
}
|
|
28124
|
-
}, [state, name, controlled]);
|
|
28125
|
-
const {
|
|
28126
|
-
current: defaultValue
|
|
28127
|
-
} = React$1.useRef(defaultProp);
|
|
28128
|
-
React$1.useEffect(() => {
|
|
28129
|
-
if (!isControlled && defaultValue !== defaultProp) {
|
|
28130
|
-
console.error([`MUI: A component is changing the default ${state} state of an uncontrolled ${name} after being initialized. ` + `To suppress this warning opt to use a controlled ${name}.`].join('\n'));
|
|
28131
|
-
}
|
|
28132
|
-
}, [JSON.stringify(defaultProp)]);
|
|
28133
|
-
}
|
|
28134
|
-
const setValueIfUncontrolled = React$1.useCallback(newValue => {
|
|
28135
|
-
if (!isControlled) {
|
|
28136
|
-
setValue(newValue);
|
|
28137
|
-
}
|
|
28138
|
-
}, []);
|
|
28139
|
-
return [value, setValueIfUncontrolled];
|
|
28140
|
-
}
|
|
28141
|
-
|
|
28142
27997
|
const useFieldState = params => {
|
|
28143
27998
|
var _ref;
|
|
28144
27999
|
const utils = useUtils();
|
|
@@ -28162,12 +28017,12 @@ const useFieldState = params => {
|
|
|
28162
28017
|
onSelectedSectionsChange
|
|
28163
28018
|
}
|
|
28164
28019
|
} = params;
|
|
28165
|
-
const firstDefaultValue = React
|
|
28020
|
+
const firstDefaultValue = React.useRef(defaultValue);
|
|
28166
28021
|
const valueFromTheOutside = (_ref = valueProp != null ? valueProp : firstDefaultValue.current) != null ? _ref : valueManager.emptyValue;
|
|
28167
|
-
const sectionsValueBoundaries = React
|
|
28168
|
-
const getSectionsFromValue = React
|
|
28169
|
-
const placeholder = React
|
|
28170
|
-
const [state, setState] = React
|
|
28022
|
+
const sectionsValueBoundaries = React.useMemo(() => getSectionsBoundaries(utils), [utils]);
|
|
28023
|
+
const getSectionsFromValue = React.useCallback((value, fallbackSections = null) => fieldValueManager.getSectionsFromValue(utils, value, fallbackSections, isRTL, date => splitFormatIntoSections(utils, localeText, format, date, formatDensity)), [fieldValueManager, format, localeText, isRTL, utils, formatDensity]);
|
|
28024
|
+
const placeholder = React.useMemo(() => fieldValueManager.getValueStrFromSections(getSectionsFromValue(valueManager.emptyValue), isRTL), [fieldValueManager, getSectionsFromValue, valueManager.emptyValue, isRTL]);
|
|
28025
|
+
const [state, setState] = React.useState(() => {
|
|
28171
28026
|
const sections = getSectionsFromValue(valueFromTheOutside);
|
|
28172
28027
|
validateSections(sections, valueType);
|
|
28173
28028
|
return {
|
|
@@ -28177,7 +28032,7 @@ const useFieldState = params => {
|
|
|
28177
28032
|
tempValueStrAndroid: null
|
|
28178
28033
|
};
|
|
28179
28034
|
});
|
|
28180
|
-
const [selectedSections, innerSetSelectedSections] =
|
|
28035
|
+
const [selectedSections, innerSetSelectedSections] = useControlled({
|
|
28181
28036
|
controlled: selectedSectionsProp,
|
|
28182
28037
|
default: null,
|
|
28183
28038
|
name: 'useField',
|
|
@@ -28190,7 +28045,7 @@ const useFieldState = params => {
|
|
|
28190
28045
|
selectedSectionQuery: null
|
|
28191
28046
|
}));
|
|
28192
28047
|
};
|
|
28193
|
-
const selectedSectionIndexes = React
|
|
28048
|
+
const selectedSectionIndexes = React.useMemo(() => {
|
|
28194
28049
|
if (selectedSections == null) {
|
|
28195
28050
|
return null;
|
|
28196
28051
|
}
|
|
@@ -28374,7 +28229,7 @@ const useFieldState = params => {
|
|
|
28374
28229
|
const setTempAndroidValueStr = tempValueStrAndroid => setState(prev => _extends({}, prev, {
|
|
28375
28230
|
tempValueStrAndroid
|
|
28376
28231
|
}));
|
|
28377
|
-
React
|
|
28232
|
+
React.useEffect(() => {
|
|
28378
28233
|
if (!valueManager.areValuesEqual(utils, state.value, valueFromTheOutside)) {
|
|
28379
28234
|
setState(prevState => _extends({}, prevState, {
|
|
28380
28235
|
value: valueFromTheOutside,
|
|
@@ -28384,7 +28239,7 @@ const useFieldState = params => {
|
|
|
28384
28239
|
}
|
|
28385
28240
|
}, [valueFromTheOutside]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
28386
28241
|
|
|
28387
|
-
React
|
|
28242
|
+
React.useEffect(() => {
|
|
28388
28243
|
const sections = getSectionsFromValue(state.value);
|
|
28389
28244
|
validateSections(sections, valueType);
|
|
28390
28245
|
setState(prevState => _extends({}, prevState, {
|
|
@@ -28445,15 +28300,15 @@ const useFieldCharacterEditing = ({
|
|
|
28445
28300
|
setTempAndroidValueStr
|
|
28446
28301
|
}) => {
|
|
28447
28302
|
const utils = useUtils();
|
|
28448
|
-
const [query, setQuery] = React
|
|
28449
|
-
const resetQuery =
|
|
28450
|
-
React
|
|
28303
|
+
const [query, setQuery] = React.useState(null);
|
|
28304
|
+
const resetQuery = useEventCallback(() => setQuery(null));
|
|
28305
|
+
React.useEffect(() => {
|
|
28451
28306
|
var _sections$query$secti;
|
|
28452
28307
|
if (query != null && ((_sections$query$secti = sections[query.sectionIndex]) == null ? void 0 : _sections$query$secti.type) !== query.sectionType) {
|
|
28453
28308
|
resetQuery();
|
|
28454
28309
|
}
|
|
28455
28310
|
}, [sections, query, resetQuery]);
|
|
28456
|
-
React
|
|
28311
|
+
React.useEffect(() => {
|
|
28457
28312
|
if (query != null) {
|
|
28458
28313
|
const timeout = setTimeout(() => resetQuery(), QUERY_LIFE_DURATION_MS);
|
|
28459
28314
|
return () => {
|
|
@@ -28627,7 +28482,7 @@ const useFieldCharacterEditing = ({
|
|
|
28627
28482
|
};
|
|
28628
28483
|
return applyQuery(params, getFirstSectionValueMatchingWithQuery, queryValue => !Number.isNaN(Number(queryValue)));
|
|
28629
28484
|
};
|
|
28630
|
-
const applyCharacterEditing =
|
|
28485
|
+
const applyCharacterEditing = useEventCallback(params => {
|
|
28631
28486
|
const activeSection = sections[params.sectionIndex];
|
|
28632
28487
|
const isNumericEditing = !Number.isNaN(Number(params.keyPressed));
|
|
28633
28488
|
const response = isNumericEditing ? applyNumericEditing(params) : applyLetterEditing(params);
|
|
@@ -28725,12 +28580,12 @@ const useField = params => {
|
|
|
28725
28580
|
validator
|
|
28726
28581
|
} = params,
|
|
28727
28582
|
otherForwardedProps = _objectWithoutPropertiesLoose(params.forwardedProps, _excluded$l);
|
|
28728
|
-
const inputRef = React
|
|
28729
|
-
const handleRef =
|
|
28730
|
-
const focusTimeoutRef = React
|
|
28583
|
+
const inputRef = React.useRef(null);
|
|
28584
|
+
const handleRef = useForkRef(inputRefProp, inputRef);
|
|
28585
|
+
const focusTimeoutRef = React.useRef(undefined);
|
|
28731
28586
|
const theme = useTheme$2();
|
|
28732
28587
|
const isRTL = theme.direction === 'rtl';
|
|
28733
|
-
const sectionOrder = React
|
|
28588
|
+
const sectionOrder = React.useMemo(() => getSectionOrder(state.sections, isRTL), [state.sections, isRTL]);
|
|
28734
28589
|
const syncSelectionFromDOM = () => {
|
|
28735
28590
|
var _selectionStart;
|
|
28736
28591
|
if (readOnly) {
|
|
@@ -28743,17 +28598,17 @@ const useField = params => {
|
|
|
28743
28598
|
const sectionIndex = nextSectionIndex === -1 ? state.sections.length - 1 : nextSectionIndex - 1;
|
|
28744
28599
|
setSelectedSections(sectionIndex);
|
|
28745
28600
|
};
|
|
28746
|
-
const handleInputClick =
|
|
28601
|
+
const handleInputClick = useEventCallback((...args) => {
|
|
28747
28602
|
onClick == null ? void 0 : onClick(...args);
|
|
28748
28603
|
syncSelectionFromDOM();
|
|
28749
28604
|
});
|
|
28750
|
-
const handleInputMouseUp =
|
|
28605
|
+
const handleInputMouseUp = useEventCallback(event => {
|
|
28751
28606
|
onMouseUp == null ? void 0 : onMouseUp(event);
|
|
28752
28607
|
|
|
28753
28608
|
// Without this, the browser will remove the selected when clicking inside an already-selected section.
|
|
28754
28609
|
event.preventDefault();
|
|
28755
28610
|
});
|
|
28756
|
-
const handleInputFocus =
|
|
28611
|
+
const handleInputFocus = useEventCallback((...args) => {
|
|
28757
28612
|
onFocus == null ? void 0 : onFocus(...args);
|
|
28758
28613
|
// The ref is guaranteed to be resolved at this point.
|
|
28759
28614
|
const input = inputRef.current;
|
|
@@ -28775,11 +28630,11 @@ const useField = params => {
|
|
|
28775
28630
|
}
|
|
28776
28631
|
});
|
|
28777
28632
|
});
|
|
28778
|
-
const handleInputBlur =
|
|
28633
|
+
const handleInputBlur = useEventCallback((...args) => {
|
|
28779
28634
|
onBlur == null ? void 0 : onBlur(...args);
|
|
28780
28635
|
setSelectedSections(null);
|
|
28781
28636
|
});
|
|
28782
|
-
const handleInputPaste =
|
|
28637
|
+
const handleInputPaste = useEventCallback(event => {
|
|
28783
28638
|
onPaste == null ? void 0 : onPaste(event);
|
|
28784
28639
|
if (readOnly) {
|
|
28785
28640
|
event.preventDefault();
|
|
@@ -28805,7 +28660,7 @@ const useField = params => {
|
|
|
28805
28660
|
event.preventDefault();
|
|
28806
28661
|
updateValueFromValueStr(pastedValue);
|
|
28807
28662
|
});
|
|
28808
|
-
const handleInputChange =
|
|
28663
|
+
const handleInputChange = useEventCallback(event => {
|
|
28809
28664
|
if (readOnly) {
|
|
28810
28665
|
return;
|
|
28811
28666
|
}
|
|
@@ -28853,7 +28708,7 @@ const useField = params => {
|
|
|
28853
28708
|
sectionIndex: selectedSectionIndexes.startIndex
|
|
28854
28709
|
});
|
|
28855
28710
|
});
|
|
28856
|
-
const handleInputKeyDown =
|
|
28711
|
+
const handleInputKeyDown = useEventCallback(event => {
|
|
28857
28712
|
onKeyDown == null ? void 0 : onKeyDown(event);
|
|
28858
28713
|
|
|
28859
28714
|
// eslint-disable-next-line default-case
|
|
@@ -28937,7 +28792,7 @@ const useField = params => {
|
|
|
28937
28792
|
}
|
|
28938
28793
|
}
|
|
28939
28794
|
});
|
|
28940
|
-
|
|
28795
|
+
useEnhancedEffect$1(() => {
|
|
28941
28796
|
if (selectedSectionIndexes == null) {
|
|
28942
28797
|
if (inputRef.current.scrollLeft) {
|
|
28943
28798
|
// Ensure that input content is not marked as selected.
|
|
@@ -28966,7 +28821,7 @@ const useField = params => {
|
|
|
28966
28821
|
const validationError = useValidation(_extends({}, internalProps, {
|
|
28967
28822
|
value: state.value
|
|
28968
28823
|
}), validator, valueManager.isSameError, valueManager.defaultErrorState);
|
|
28969
|
-
const inputError = React
|
|
28824
|
+
const inputError = React.useMemo(() => {
|
|
28970
28825
|
// only override when `error` is undefined.
|
|
28971
28826
|
// in case of multi input fields, the `error` value is provided externally and will always be defined.
|
|
28972
28827
|
if (error !== undefined) {
|
|
@@ -28974,7 +28829,7 @@ const useField = params => {
|
|
|
28974
28829
|
}
|
|
28975
28830
|
return valueManager.hasError(validationError);
|
|
28976
28831
|
}, [valueManager, validationError, error]);
|
|
28977
|
-
React
|
|
28832
|
+
React.useEffect(() => {
|
|
28978
28833
|
// Select the right section when focused on mount (`autoFocus = true` on the input)
|
|
28979
28834
|
if (inputRef.current && inputRef.current === document.activeElement) {
|
|
28980
28835
|
setSelectedSections('all');
|
|
@@ -28986,18 +28841,18 @@ const useField = params => {
|
|
|
28986
28841
|
// Then `onChange` has only been called once, which means the user pressed `Backspace` to reset the section.
|
|
28987
28842
|
// This causes a small flickering on Android,
|
|
28988
28843
|
// But we can't use `useEnhancedEffect` which is always called before the second `onChange` call and then would cause false positives.
|
|
28989
|
-
React
|
|
28844
|
+
React.useEffect(() => {
|
|
28990
28845
|
if (state.tempValueStrAndroid != null && selectedSectionIndexes != null) {
|
|
28991
28846
|
resetCharacterQuery();
|
|
28992
28847
|
clearActiveSection();
|
|
28993
28848
|
}
|
|
28994
28849
|
}, [state.tempValueStrAndroid]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
28995
28850
|
|
|
28996
|
-
const valueStr = React
|
|
28851
|
+
const valueStr = React.useMemo(() => {
|
|
28997
28852
|
var _state$tempValueStrAn;
|
|
28998
28853
|
return (_state$tempValueStrAn = state.tempValueStrAndroid) != null ? _state$tempValueStrAn : fieldValueManager.getValueStrFromSections(state.sections, isRTL);
|
|
28999
28854
|
}, [state.sections, fieldValueManager, state.tempValueStrAndroid, isRTL]);
|
|
29000
|
-
const inputMode = React
|
|
28855
|
+
const inputMode = React.useMemo(() => {
|
|
29001
28856
|
if (selectedSectionIndexes == null) {
|
|
29002
28857
|
return 'text';
|
|
29003
28858
|
}
|
|
@@ -29008,7 +28863,7 @@ const useField = params => {
|
|
|
29008
28863
|
}, [selectedSectionIndexes, state.sections]);
|
|
29009
28864
|
const inputHasFocus = inputRef.current && inputRef.current === getActiveElement(document);
|
|
29010
28865
|
const shouldShowPlaceholder = !inputHasFocus && valueManager.areValuesEqual(utils, state.value, valueManager.emptyValue);
|
|
29011
|
-
React
|
|
28866
|
+
React.useImperativeHandle(unstableFieldRef, () => ({
|
|
29012
28867
|
getSections: () => state.sections,
|
|
29013
28868
|
getActiveSectionIndex: () => {
|
|
29014
28869
|
var _selectionStart2, _selectionEnd;
|
|
@@ -29084,7 +28939,7 @@ const useIsDateDisabled = ({
|
|
|
29084
28939
|
disablePast
|
|
29085
28940
|
}) => {
|
|
29086
28941
|
const adapter = useLocalizationContext();
|
|
29087
|
-
return React
|
|
28942
|
+
return React.useCallback(day => validateDate({
|
|
29088
28943
|
adapter,
|
|
29089
28944
|
value: day,
|
|
29090
28945
|
props: {
|
|
@@ -29259,7 +29114,7 @@ const useDateTimeField = ({
|
|
|
29259
29114
|
const _excluded$j = ["components", "componentsProps", "slots", "slotProps", "InputProps", "inputProps"],
|
|
29260
29115
|
_excluded2$2 = ["inputRef"],
|
|
29261
29116
|
_excluded3$1 = ["ref", "onPaste", "inputMode", "readOnly"];
|
|
29262
|
-
const DateTimeField = /*#__PURE__*/React
|
|
29117
|
+
const DateTimeField = /*#__PURE__*/React.forwardRef(function DateTimeField(inProps, ref) {
|
|
29263
29118
|
var _ref, _slots$textField, _slotProps$textField;
|
|
29264
29119
|
const themeProps = useThemeProps({
|
|
29265
29120
|
props: inProps,
|
|
@@ -29638,14 +29493,14 @@ const useCalendarState = ({
|
|
|
29638
29493
|
var _ref;
|
|
29639
29494
|
const now = useNow();
|
|
29640
29495
|
const utils = useUtils();
|
|
29641
|
-
const reducerFn = React
|
|
29642
|
-
const [calendarState, dispatch] = React
|
|
29496
|
+
const reducerFn = React.useRef(createCalendarStateReducer(Boolean(reduceAnimations), disableSwitchToMonthOnDayFocus, utils)).current;
|
|
29497
|
+
const [calendarState, dispatch] = React.useReducer(reducerFn, {
|
|
29643
29498
|
isMonthSwitchingAnimating: false,
|
|
29644
29499
|
focusedDay: value || now,
|
|
29645
29500
|
currentMonth: utils.startOfMonth((_ref = value != null ? value : defaultCalendarMonth) != null ? _ref : clamp(utils, now, minDate, maxDate)),
|
|
29646
29501
|
slideDirection: 'left'
|
|
29647
29502
|
});
|
|
29648
|
-
const handleChangeMonth = React
|
|
29503
|
+
const handleChangeMonth = React.useCallback(payload => {
|
|
29649
29504
|
dispatch(_extends({
|
|
29650
29505
|
type: 'changeMonth'
|
|
29651
29506
|
}, payload));
|
|
@@ -29653,7 +29508,7 @@ const useCalendarState = ({
|
|
|
29653
29508
|
onMonthChange(payload.newMonth);
|
|
29654
29509
|
}
|
|
29655
29510
|
}, [onMonthChange]);
|
|
29656
|
-
const changeMonth = React
|
|
29511
|
+
const changeMonth = React.useCallback(newDate => {
|
|
29657
29512
|
const newDateRequested = newDate;
|
|
29658
29513
|
if (utils.isSameMonth(newDateRequested, calendarState.currentMonth)) {
|
|
29659
29514
|
return;
|
|
@@ -29670,12 +29525,12 @@ const useCalendarState = ({
|
|
|
29670
29525
|
disableFuture,
|
|
29671
29526
|
disablePast
|
|
29672
29527
|
});
|
|
29673
|
-
const onMonthSwitchingAnimationEnd = React
|
|
29528
|
+
const onMonthSwitchingAnimationEnd = React.useCallback(() => {
|
|
29674
29529
|
dispatch({
|
|
29675
29530
|
type: 'finishMonthSwitchingAnimation'
|
|
29676
29531
|
});
|
|
29677
29532
|
}, []);
|
|
29678
|
-
const changeFocusedDay =
|
|
29533
|
+
const changeFocusedDay = useEventCallback((newFocusedDate, withoutMonthSwitchingAnimation) => {
|
|
29679
29534
|
if (!isDateDisabled(newFocusedDate)) {
|
|
29680
29535
|
dispatch({
|
|
29681
29536
|
type: 'changeFocusedDay',
|
|
@@ -31277,7 +31132,7 @@ function PickersSlideTransition(inProps) {
|
|
|
31277
31132
|
};
|
|
31278
31133
|
return /*#__PURE__*/jsx(PickersSlideTransitionRoot, {
|
|
31279
31134
|
className: clsx(classes.root, className),
|
|
31280
|
-
childFactory: element => /*#__PURE__*/React
|
|
31135
|
+
childFactory: element => /*#__PURE__*/React.cloneElement(element, {
|
|
31281
31136
|
classNames: transitionClasses
|
|
31282
31137
|
}),
|
|
31283
31138
|
role: "presentation",
|
|
@@ -31452,16 +31307,16 @@ function WrappedDay(_ref) {
|
|
|
31452
31307
|
})
|
|
31453
31308
|
}),
|
|
31454
31309
|
dayProps = _objectWithoutPropertiesLoose(_useSlotProps, _excluded2$1);
|
|
31455
|
-
const isDisabled = React
|
|
31456
|
-
const outsideCurrentMonth = React
|
|
31457
|
-
const isFirstVisibleCell = React
|
|
31310
|
+
const isDisabled = React.useMemo(() => disabled || isDateDisabled(day), [disabled, isDateDisabled, day]);
|
|
31311
|
+
const outsideCurrentMonth = React.useMemo(() => utils.getMonth(day) !== currentMonthNumber, [utils, day, currentMonthNumber]);
|
|
31312
|
+
const isFirstVisibleCell = React.useMemo(() => {
|
|
31458
31313
|
const startOfMonth = utils.startOfMonth(utils.setMonth(day, currentMonthNumber));
|
|
31459
31314
|
if (!showDaysOutsideCurrentMonth) {
|
|
31460
31315
|
return utils.isSameDay(day, startOfMonth);
|
|
31461
31316
|
}
|
|
31462
31317
|
return utils.isSameDay(day, utils.startOfWeek(startOfMonth));
|
|
31463
31318
|
}, [currentMonthNumber, day, showDaysOutsideCurrentMonth, utils]);
|
|
31464
|
-
const isLastVisibleCell = React
|
|
31319
|
+
const isLastVisibleCell = React.useMemo(() => {
|
|
31465
31320
|
const endOfMonth = utils.endOfMonth(utils.setMonth(day, currentMonthNumber));
|
|
31466
31321
|
if (!showDaysOutsideCurrentMonth) {
|
|
31467
31322
|
return utils.isSameDay(day, endOfMonth);
|
|
@@ -31536,14 +31391,14 @@ function DayCalendar(inProps) {
|
|
|
31536
31391
|
disableFuture
|
|
31537
31392
|
});
|
|
31538
31393
|
const localeText = useLocaleText();
|
|
31539
|
-
const [internalHasFocus, setInternalHasFocus] = useControlled
|
|
31394
|
+
const [internalHasFocus, setInternalHasFocus] = useControlled({
|
|
31540
31395
|
name: 'DayCalendar',
|
|
31541
31396
|
state: 'hasFocus',
|
|
31542
31397
|
controlled: hasFocus,
|
|
31543
31398
|
default: autoFocus != null ? autoFocus : false
|
|
31544
31399
|
});
|
|
31545
|
-
const [internalFocusedDay, setInternalFocusedDay] = React
|
|
31546
|
-
const handleDaySelect =
|
|
31400
|
+
const [internalFocusedDay, setInternalFocusedDay] = React.useState(() => focusedDay || now);
|
|
31401
|
+
const handleDaySelect = useEventCallback(day => {
|
|
31547
31402
|
if (readOnly) {
|
|
31548
31403
|
return;
|
|
31549
31404
|
}
|
|
@@ -31557,7 +31412,7 @@ function DayCalendar(inProps) {
|
|
|
31557
31412
|
setInternalHasFocus(true);
|
|
31558
31413
|
}
|
|
31559
31414
|
};
|
|
31560
|
-
const handleKeyDown =
|
|
31415
|
+
const handleKeyDown = useEventCallback((event, day) => {
|
|
31561
31416
|
switch (event.key) {
|
|
31562
31417
|
case 'ArrowUp':
|
|
31563
31418
|
focusDay(utils.addDays(day, -7));
|
|
@@ -31615,21 +31470,21 @@ function DayCalendar(inProps) {
|
|
|
31615
31470
|
break;
|
|
31616
31471
|
}
|
|
31617
31472
|
});
|
|
31618
|
-
const handleFocus =
|
|
31619
|
-
const handleBlur =
|
|
31473
|
+
const handleFocus = useEventCallback((event, day) => focusDay(day));
|
|
31474
|
+
const handleBlur = useEventCallback((event, day) => {
|
|
31620
31475
|
if (internalHasFocus && utils.isSameDay(internalFocusedDay, day)) {
|
|
31621
31476
|
onFocusedViewChange == null ? void 0 : onFocusedViewChange(false);
|
|
31622
31477
|
}
|
|
31623
31478
|
});
|
|
31624
31479
|
const currentMonthNumber = utils.getMonth(currentMonth);
|
|
31625
|
-
const validSelectedDays = React
|
|
31480
|
+
const validSelectedDays = React.useMemo(() => selectedDays.filter(day => !!day).map(day => utils.startOfDay(day)), [utils, selectedDays]);
|
|
31626
31481
|
|
|
31627
31482
|
// need a new ref whenever the `key` of the transition changes: http://reactcommunity.org/react-transition-group/transition/#Transition-prop-nodeRef.
|
|
31628
31483
|
const transitionKey = currentMonthNumber;
|
|
31629
31484
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
31630
|
-
const slideNodeRef = React
|
|
31485
|
+
const slideNodeRef = React.useMemo(() => /*#__PURE__*/React.createRef(), [transitionKey]);
|
|
31631
31486
|
const startOfCurrentWeek = utils.startOfWeek(now);
|
|
31632
|
-
const focusableDay = React
|
|
31487
|
+
const focusableDay = React.useMemo(() => {
|
|
31633
31488
|
const startOfMonth = utils.startOfMonth(currentMonth);
|
|
31634
31489
|
const endOfMonth = utils.endOfMonth(currentMonth);
|
|
31635
31490
|
if (isDateDisabled(internalFocusedDay) || utils.isAfterDay(internalFocusedDay, endOfMonth) || utils.isBeforeDay(internalFocusedDay, startOfMonth)) {
|
|
@@ -31645,7 +31500,7 @@ function DayCalendar(inProps) {
|
|
|
31645
31500
|
}
|
|
31646
31501
|
return internalFocusedDay;
|
|
31647
31502
|
}, [currentMonth, disableFuture, disablePast, internalFocusedDay, isDateDisabled, utils]);
|
|
31648
|
-
const weeksToDisplay = React
|
|
31503
|
+
const weeksToDisplay = React.useMemo(() => {
|
|
31649
31504
|
const toDisplay = utils.getWeekArray(currentMonth);
|
|
31650
31505
|
let nextMonth = utils.addMonths(currentMonth, 1);
|
|
31651
31506
|
while (fixedWeekNumber && toDisplay.length < fixedWeekNumber) {
|
|
@@ -31901,6 +31756,7 @@ var RULESET = 'rule';
|
|
|
31901
31756
|
var DECLARATION = 'decl';
|
|
31902
31757
|
var IMPORT = '@import';
|
|
31903
31758
|
var KEYFRAMES = '@keyframes';
|
|
31759
|
+
var LAYER = '@layer';
|
|
31904
31760
|
|
|
31905
31761
|
/**
|
|
31906
31762
|
* @param {number}
|
|
@@ -32315,7 +32171,7 @@ function parse (value, root, parent, rule, rules, rulesets, pseudo, points, decl
|
|
|
32315
32171
|
// \0 }
|
|
32316
32172
|
case 0: case 125: scanning = 0;
|
|
32317
32173
|
// ;
|
|
32318
|
-
case 59 + offset:
|
|
32174
|
+
case 59 + offset: if (ampersand == -1) characters = replace(characters, /\f/g, '');
|
|
32319
32175
|
if (property > 0 && (strlen(characters) - length))
|
|
32320
32176
|
append(property > 32 ? declaration(characters + ';', rule, parent, length - 1) : declaration(replace(characters, ' ', '') + ';', rule, parent, length - 2), declarations);
|
|
32321
32177
|
break
|
|
@@ -32330,8 +32186,8 @@ function parse (value, root, parent, rule, rules, rulesets, pseudo, points, decl
|
|
|
32330
32186
|
parse(characters, root, reference, reference, props, rulesets, length, points, children);
|
|
32331
32187
|
else
|
|
32332
32188
|
switch (atrule === 99 && charat(characters, 3) === 110 ? 100 : atrule) {
|
|
32333
|
-
// d m s
|
|
32334
|
-
case 100: case 109: case 115:
|
|
32189
|
+
// d l m s
|
|
32190
|
+
case 100: case 108: case 109: case 115:
|
|
32335
32191
|
parse(value, reference, reference, rule && append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length), children), rules, children, length, points, rule ? props : children);
|
|
32336
32192
|
break
|
|
32337
32193
|
default:
|
|
@@ -32450,6 +32306,7 @@ function serialize (children, callback) {
|
|
|
32450
32306
|
*/
|
|
32451
32307
|
function stringify (element, index, children, callback) {
|
|
32452
32308
|
switch (element.type) {
|
|
32309
|
+
case LAYER: if (element.children.length) break
|
|
32453
32310
|
case IMPORT: case DECLARATION: return element.return = element.return || element.value
|
|
32454
32311
|
case COMMENT: return ''
|
|
32455
32312
|
case KEYFRAMES: return element.return = element.value + '{' + serialize(element.children, callback) + '}'
|
|
@@ -33253,6 +33110,7 @@ function murmur2(str) {
|
|
|
33253
33110
|
|
|
33254
33111
|
var unitlessKeys = {
|
|
33255
33112
|
animationIterationCount: 1,
|
|
33113
|
+
aspectRatio: 1,
|
|
33256
33114
|
borderImageOutset: 1,
|
|
33257
33115
|
borderImageSlice: 1,
|
|
33258
33116
|
borderImageWidth: 1,
|
|
@@ -33617,13 +33475,13 @@ var syncFallback = function syncFallback(create) {
|
|
|
33617
33475
|
return create();
|
|
33618
33476
|
};
|
|
33619
33477
|
|
|
33620
|
-
var useInsertionEffect = React
|
|
33478
|
+
var useInsertionEffect = React['useInsertion' + 'Effect'] ? React['useInsertion' + 'Effect'] : false;
|
|
33621
33479
|
var useInsertionEffectAlwaysWithSyncFallback = !isBrowser$1 ? syncFallback : useInsertionEffect || syncFallback;
|
|
33622
33480
|
|
|
33623
33481
|
var isBrowser = typeof document !== 'undefined';
|
|
33624
33482
|
var hasOwnProperty = {}.hasOwnProperty;
|
|
33625
33483
|
|
|
33626
|
-
var EmotionCacheContext = /* #__PURE__ */createContext( // we're doing this to avoid preconstruct's dead code elimination in this one case
|
|
33484
|
+
var EmotionCacheContext = /* #__PURE__ */React.createContext( // we're doing this to avoid preconstruct's dead code elimination in this one case
|
|
33627
33485
|
// because this module is primarily intended for the browser and node
|
|
33628
33486
|
// but it's also required in react native and similar environments sometimes
|
|
33629
33487
|
// and we could have a special build just for that
|
|
@@ -33662,7 +33520,7 @@ if (!isBrowser) {
|
|
|
33662
33520
|
cache = createCache({
|
|
33663
33521
|
key: 'css'
|
|
33664
33522
|
});
|
|
33665
|
-
return /*#__PURE__*/createElement(EmotionCacheContext.Provider, {
|
|
33523
|
+
return /*#__PURE__*/React.createElement(EmotionCacheContext.Provider, {
|
|
33666
33524
|
value: cache
|
|
33667
33525
|
}, func(props, cache));
|
|
33668
33526
|
} else {
|
|
@@ -33672,7 +33530,7 @@ if (!isBrowser) {
|
|
|
33672
33530
|
};
|
|
33673
33531
|
}
|
|
33674
33532
|
|
|
33675
|
-
var ThemeContext = /* #__PURE__ */createContext({});
|
|
33533
|
+
var ThemeContext = /* #__PURE__ */React.createContext({});
|
|
33676
33534
|
|
|
33677
33535
|
if (process.env.NODE_ENV !== 'production') {
|
|
33678
33536
|
ThemeContext.displayName = 'EmotionThemeContext';
|
|
@@ -33701,7 +33559,7 @@ var Insertion = function Insertion(_ref) {
|
|
|
33701
33559
|
next = next.next;
|
|
33702
33560
|
}
|
|
33703
33561
|
|
|
33704
|
-
return /*#__PURE__*/createElement("style", (_ref2 = {}, _ref2["data-emotion"] = cache.key + " " + serializedNames, _ref2.dangerouslySetInnerHTML = {
|
|
33562
|
+
return /*#__PURE__*/React.createElement("style", (_ref2 = {}, _ref2["data-emotion"] = cache.key + " " + serializedNames, _ref2.dangerouslySetInnerHTML = {
|
|
33705
33563
|
__html: rules
|
|
33706
33564
|
}, _ref2.nonce = cache.sheet.nonce, _ref2));
|
|
33707
33565
|
}
|
|
@@ -33728,7 +33586,7 @@ var Emotion = /* #__PURE__ */withEmotionCache(function (props, cache, ref) {
|
|
|
33728
33586
|
className = props.className + " ";
|
|
33729
33587
|
}
|
|
33730
33588
|
|
|
33731
|
-
var serialized = serializeStyles(registeredStyles, undefined, useContext(ThemeContext));
|
|
33589
|
+
var serialized = serializeStyles(registeredStyles, undefined, React.useContext(ThemeContext));
|
|
33732
33590
|
|
|
33733
33591
|
if (process.env.NODE_ENV !== 'production' && serialized.name.indexOf('-') === -1) {
|
|
33734
33592
|
var labelFromStack = props[labelPropName];
|
|
@@ -33749,11 +33607,11 @@ var Emotion = /* #__PURE__ */withEmotionCache(function (props, cache, ref) {
|
|
|
33749
33607
|
|
|
33750
33608
|
newProps.ref = ref;
|
|
33751
33609
|
newProps.className = className;
|
|
33752
|
-
return /*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/createElement(Insertion, {
|
|
33610
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Insertion, {
|
|
33753
33611
|
cache: cache,
|
|
33754
33612
|
serialized: serialized,
|
|
33755
33613
|
isStringTag: typeof WrappedComponent === 'string'
|
|
33756
|
-
}), /*#__PURE__*/createElement(WrappedComponent, newProps));
|
|
33614
|
+
}), /*#__PURE__*/React.createElement(WrappedComponent, newProps));
|
|
33757
33615
|
});
|
|
33758
33616
|
|
|
33759
33617
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -34141,6 +33999,9 @@ process.env.NODE_ENV !== 'production' ? spacingKeys.reduce((obj, key) => {
|
|
|
34141
33999
|
return obj;
|
|
34142
34000
|
}, {}) : {};
|
|
34143
34001
|
|
|
34002
|
+
// The different signatures imply different meaning for their arguments that can't be expressed structurally.
|
|
34003
|
+
// We express the difference with variable names.
|
|
34004
|
+
/* tslint:disable:unified-signatures */
|
|
34144
34005
|
/* tslint:enable:unified-signatures */
|
|
34145
34006
|
|
|
34146
34007
|
function createSpacing(spacingInput = 8) {
|
|
@@ -34377,8 +34238,8 @@ const width = style$1({
|
|
|
34377
34238
|
const maxWidth = props => {
|
|
34378
34239
|
if (props.maxWidth !== undefined && props.maxWidth !== null) {
|
|
34379
34240
|
const styleFromPropValue = propValue => {
|
|
34380
|
-
var _props$theme
|
|
34381
|
-
const breakpoint = ((_props$theme = props.theme) == null
|
|
34241
|
+
var _props$theme;
|
|
34242
|
+
const breakpoint = ((_props$theme = props.theme) == null || (_props$theme = _props$theme.breakpoints) == null || (_props$theme = _props$theme.values) == null ? void 0 : _props$theme[propValue]) || values[propValue];
|
|
34382
34243
|
return {
|
|
34383
34244
|
maxWidth: breakpoint || sizingTransform(propValue)
|
|
34384
34245
|
};
|
|
@@ -34730,6 +34591,8 @@ function unstable_createStyleFunctionSx() {
|
|
|
34730
34591
|
if (val == null) {
|
|
34731
34592
|
return null;
|
|
34732
34593
|
}
|
|
34594
|
+
|
|
34595
|
+
// TODO v6: remove, see https://github.com/mui/material-ui/pull/38123
|
|
34733
34596
|
if (themeKey === 'typography' && val === 'inherit') {
|
|
34734
34597
|
return {
|
|
34735
34598
|
[prop]: val
|
|
@@ -34858,7 +34721,7 @@ function isObjectEmpty(obj) {
|
|
|
34858
34721
|
return Object.keys(obj).length === 0;
|
|
34859
34722
|
}
|
|
34860
34723
|
function useTheme$1(defaultTheme = null) {
|
|
34861
|
-
const contextTheme = React
|
|
34724
|
+
const contextTheme = React.useContext(ThemeContext);
|
|
34862
34725
|
return !contextTheme || isObjectEmpty(contextTheme) ? defaultTheme : contextTheme;
|
|
34863
34726
|
}
|
|
34864
34727
|
|
|
@@ -34943,7 +34806,7 @@ const PickersMonthButton = styled('button', {
|
|
|
34943
34806
|
/**
|
|
34944
34807
|
* @ignore - do not document.
|
|
34945
34808
|
*/
|
|
34946
|
-
const PickersMonth = /*#__PURE__*/React
|
|
34809
|
+
const PickersMonth = /*#__PURE__*/React.memo(function PickersMonth(inProps) {
|
|
34947
34810
|
const props = useThemeProps({
|
|
34948
34811
|
props: inProps,
|
|
34949
34812
|
name: 'MuiPickersMonth'
|
|
@@ -34962,9 +34825,9 @@ const PickersMonth = /*#__PURE__*/React$5.memo(function PickersMonth(inProps) {
|
|
|
34962
34825
|
// We don't want to forward this prop to the root element
|
|
34963
34826
|
} = props,
|
|
34964
34827
|
other = _objectWithoutPropertiesLoose(props, _excluded$e);
|
|
34965
|
-
const ref = React
|
|
34828
|
+
const ref = React.useRef(null);
|
|
34966
34829
|
const classes = useUtilityClasses$d(props);
|
|
34967
|
-
useEnhancedEffect$
|
|
34830
|
+
useEnhancedEffect$1(() => {
|
|
34968
34831
|
if (autoFocus) {
|
|
34969
34832
|
var _ref$current;
|
|
34970
34833
|
(_ref$current = ref.current) == null ? void 0 : _ref$current.focus();
|
|
@@ -35032,7 +34895,7 @@ const MonthCalendarRoot = styled('div', {
|
|
|
35032
34895
|
padding: '0 4px',
|
|
35033
34896
|
width: 320
|
|
35034
34897
|
});
|
|
35035
|
-
const MonthCalendar = /*#__PURE__*/React
|
|
34898
|
+
const MonthCalendar = /*#__PURE__*/React.forwardRef(function MonthCalendar(inProps, ref) {
|
|
35036
34899
|
const now = useNow();
|
|
35037
34900
|
const theme = useTheme();
|
|
35038
34901
|
const utils = useUtils();
|
|
@@ -35059,15 +34922,15 @@ const MonthCalendar = /*#__PURE__*/React$5.forwardRef(function MonthCalendar(inP
|
|
|
35059
34922
|
other = _objectWithoutPropertiesLoose(props, _excluded$d);
|
|
35060
34923
|
const ownerState = props;
|
|
35061
34924
|
const classes = useUtilityClasses$c(ownerState);
|
|
35062
|
-
const [value, setValue] = useControlled
|
|
34925
|
+
const [value, setValue] = useControlled({
|
|
35063
34926
|
name: 'MonthCalendar',
|
|
35064
34927
|
state: 'value',
|
|
35065
34928
|
controlled: valueProp,
|
|
35066
34929
|
default: defaultValue != null ? defaultValue : null
|
|
35067
34930
|
});
|
|
35068
|
-
const todayMonth = React
|
|
35069
|
-
const selectedDateOrStartOfMonth = React
|
|
35070
|
-
const selectedMonth = React
|
|
34931
|
+
const todayMonth = React.useMemo(() => utils.getMonth(now), [utils, now]);
|
|
34932
|
+
const selectedDateOrStartOfMonth = React.useMemo(() => value != null ? value : utils.startOfMonth(now), [now, utils, value]);
|
|
34933
|
+
const selectedMonth = React.useMemo(() => {
|
|
35071
34934
|
if (value != null) {
|
|
35072
34935
|
return utils.getMonth(value);
|
|
35073
34936
|
}
|
|
@@ -35076,20 +34939,20 @@ const MonthCalendar = /*#__PURE__*/React$5.forwardRef(function MonthCalendar(inP
|
|
|
35076
34939
|
}
|
|
35077
34940
|
return utils.getMonth(now);
|
|
35078
34941
|
}, [now, value, utils, disableHighlightToday]);
|
|
35079
|
-
const [focusedMonth, setFocusedMonth] = React
|
|
35080
|
-
const [internalHasFocus, setInternalHasFocus] = useControlled
|
|
34942
|
+
const [focusedMonth, setFocusedMonth] = React.useState(() => selectedMonth || todayMonth);
|
|
34943
|
+
const [internalHasFocus, setInternalHasFocus] = useControlled({
|
|
35081
34944
|
name: 'MonthCalendar',
|
|
35082
34945
|
state: 'hasFocus',
|
|
35083
34946
|
controlled: hasFocus,
|
|
35084
34947
|
default: autoFocus != null ? autoFocus : false
|
|
35085
34948
|
});
|
|
35086
|
-
const changeHasFocus = useEventCallback
|
|
34949
|
+
const changeHasFocus = useEventCallback(newHasFocus => {
|
|
35087
34950
|
setInternalHasFocus(newHasFocus);
|
|
35088
34951
|
if (onFocusedViewChange) {
|
|
35089
34952
|
onFocusedViewChange(newHasFocus);
|
|
35090
34953
|
}
|
|
35091
34954
|
});
|
|
35092
|
-
const isMonthDisabled = useEventCallback
|
|
34955
|
+
const isMonthDisabled = useEventCallback(month => {
|
|
35093
34956
|
const firstEnabledMonth = utils.startOfMonth(disablePast && utils.isAfter(now, minDate) ? now : minDate);
|
|
35094
34957
|
const lastEnabledMonth = utils.startOfMonth(disableFuture && utils.isBefore(now, maxDate) ? now : maxDate);
|
|
35095
34958
|
if (utils.isBefore(month, firstEnabledMonth)) {
|
|
@@ -35103,7 +34966,7 @@ const MonthCalendar = /*#__PURE__*/React$5.forwardRef(function MonthCalendar(inP
|
|
|
35103
34966
|
}
|
|
35104
34967
|
return shouldDisableMonth(month);
|
|
35105
34968
|
});
|
|
35106
|
-
const handleMonthSelection = useEventCallback
|
|
34969
|
+
const handleMonthSelection = useEventCallback((event, month) => {
|
|
35107
34970
|
if (readOnly) {
|
|
35108
34971
|
return;
|
|
35109
34972
|
}
|
|
@@ -35111,7 +34974,7 @@ const MonthCalendar = /*#__PURE__*/React$5.forwardRef(function MonthCalendar(inP
|
|
|
35111
34974
|
setValue(newDate);
|
|
35112
34975
|
onChange == null ? void 0 : onChange(newDate);
|
|
35113
34976
|
});
|
|
35114
|
-
const focusMonth = useEventCallback
|
|
34977
|
+
const focusMonth = useEventCallback(month => {
|
|
35115
34978
|
if (!isMonthDisabled(utils.setMonth(selectedDateOrStartOfMonth, month))) {
|
|
35116
34979
|
setFocusedMonth(month);
|
|
35117
34980
|
changeHasFocus(true);
|
|
@@ -35120,10 +34983,10 @@ const MonthCalendar = /*#__PURE__*/React$5.forwardRef(function MonthCalendar(inP
|
|
|
35120
34983
|
}
|
|
35121
34984
|
}
|
|
35122
34985
|
});
|
|
35123
|
-
React
|
|
34986
|
+
React.useEffect(() => {
|
|
35124
34987
|
setFocusedMonth(prevFocusedMonth => selectedMonth !== null && prevFocusedMonth !== selectedMonth ? selectedMonth : prevFocusedMonth);
|
|
35125
34988
|
}, [selectedMonth]);
|
|
35126
|
-
const handleKeyDown = useEventCallback
|
|
34989
|
+
const handleKeyDown = useEventCallback((event, month) => {
|
|
35127
34990
|
const monthsInYear = 12;
|
|
35128
34991
|
const monthsInRow = 3;
|
|
35129
34992
|
switch (event.key) {
|
|
@@ -35145,10 +35008,10 @@ const MonthCalendar = /*#__PURE__*/React$5.forwardRef(function MonthCalendar(inP
|
|
|
35145
35008
|
break;
|
|
35146
35009
|
}
|
|
35147
35010
|
});
|
|
35148
|
-
const handleMonthFocus = useEventCallback
|
|
35011
|
+
const handleMonthFocus = useEventCallback((event, month) => {
|
|
35149
35012
|
focusMonth(month);
|
|
35150
35013
|
});
|
|
35151
|
-
const handleMonthBlur = useEventCallback
|
|
35014
|
+
const handleMonthBlur = useEventCallback((event, month) => {
|
|
35152
35015
|
if (focusedMonth === month) {
|
|
35153
35016
|
changeHasFocus(false);
|
|
35154
35017
|
}
|
|
@@ -35338,7 +35201,7 @@ const PickersYearButton = styled('button', {
|
|
|
35338
35201
|
/**
|
|
35339
35202
|
* @ignore - internal component.
|
|
35340
35203
|
*/
|
|
35341
|
-
const PickersYear = /*#__PURE__*/React
|
|
35204
|
+
const PickersYear = /*#__PURE__*/React.memo(function PickersYear(inProps) {
|
|
35342
35205
|
const props = useThemeProps({
|
|
35343
35206
|
props: inProps,
|
|
35344
35207
|
name: 'MuiPickersYear'
|
|
@@ -35358,11 +35221,11 @@ const PickersYear = /*#__PURE__*/React$5.memo(function PickersYear(inProps) {
|
|
|
35358
35221
|
// We don't want to forward this prop to the root element
|
|
35359
35222
|
} = props,
|
|
35360
35223
|
other = _objectWithoutPropertiesLoose(props, _excluded$c);
|
|
35361
|
-
const ref = React
|
|
35224
|
+
const ref = React.useRef(null);
|
|
35362
35225
|
const classes = useUtilityClasses$b(props);
|
|
35363
35226
|
|
|
35364
35227
|
// We can't forward the `autoFocus` to the button because it is a native button, not a MUI Button
|
|
35365
|
-
React
|
|
35228
|
+
React.useEffect(() => {
|
|
35366
35229
|
if (autoFocus) {
|
|
35367
35230
|
// `ref.current` being `null` would be a bug in MUI.
|
|
35368
35231
|
ref.current.focus();
|
|
@@ -35433,7 +35296,7 @@ const YearCalendarRoot = styled('div', {
|
|
|
35433
35296
|
width: 320,
|
|
35434
35297
|
maxHeight: 304
|
|
35435
35298
|
});
|
|
35436
|
-
const YearCalendar = /*#__PURE__*/React
|
|
35299
|
+
const YearCalendar = /*#__PURE__*/React.forwardRef(function YearCalendar(inProps, ref) {
|
|
35437
35300
|
const now = useNow();
|
|
35438
35301
|
const theme = useTheme();
|
|
35439
35302
|
const utils = useUtils();
|
|
@@ -35460,15 +35323,15 @@ const YearCalendar = /*#__PURE__*/React$5.forwardRef(function YearCalendar(inPro
|
|
|
35460
35323
|
other = _objectWithoutPropertiesLoose(props, _excluded$b);
|
|
35461
35324
|
const ownerState = props;
|
|
35462
35325
|
const classes = useUtilityClasses$a(ownerState);
|
|
35463
|
-
const [value, setValue] = useControlled
|
|
35326
|
+
const [value, setValue] = useControlled({
|
|
35464
35327
|
name: 'YearCalendar',
|
|
35465
35328
|
state: 'value',
|
|
35466
35329
|
controlled: valueProp,
|
|
35467
35330
|
default: defaultValue != null ? defaultValue : null
|
|
35468
35331
|
});
|
|
35469
|
-
const selectedDateOrStartOfYear = React
|
|
35470
|
-
const todayYear = React
|
|
35471
|
-
const selectedYear = React
|
|
35332
|
+
const selectedDateOrStartOfYear = React.useMemo(() => value != null ? value : utils.startOfYear(now), [now, utils, value]);
|
|
35333
|
+
const todayYear = React.useMemo(() => utils.getYear(now), [utils, now]);
|
|
35334
|
+
const selectedYear = React.useMemo(() => {
|
|
35472
35335
|
if (value != null) {
|
|
35473
35336
|
return utils.getYear(value);
|
|
35474
35337
|
}
|
|
@@ -35477,20 +35340,20 @@ const YearCalendar = /*#__PURE__*/React$5.forwardRef(function YearCalendar(inPro
|
|
|
35477
35340
|
}
|
|
35478
35341
|
return utils.getYear(now);
|
|
35479
35342
|
}, [now, value, utils, disableHighlightToday]);
|
|
35480
|
-
const [focusedYear, setFocusedYear] = React
|
|
35481
|
-
const [internalHasFocus, setInternalHasFocus] = useControlled
|
|
35343
|
+
const [focusedYear, setFocusedYear] = React.useState(() => selectedYear || todayYear);
|
|
35344
|
+
const [internalHasFocus, setInternalHasFocus] = useControlled({
|
|
35482
35345
|
name: 'YearCalendar',
|
|
35483
35346
|
state: 'hasFocus',
|
|
35484
35347
|
controlled: hasFocus,
|
|
35485
35348
|
default: autoFocus != null ? autoFocus : false
|
|
35486
35349
|
});
|
|
35487
|
-
const changeHasFocus = useEventCallback
|
|
35350
|
+
const changeHasFocus = useEventCallback(newHasFocus => {
|
|
35488
35351
|
setInternalHasFocus(newHasFocus);
|
|
35489
35352
|
if (onFocusedViewChange) {
|
|
35490
35353
|
onFocusedViewChange(newHasFocus);
|
|
35491
35354
|
}
|
|
35492
35355
|
});
|
|
35493
|
-
const isYearDisabled = useEventCallback
|
|
35356
|
+
const isYearDisabled = useEventCallback(dateToValidate => {
|
|
35494
35357
|
if (disablePast && utils.isBeforeYear(dateToValidate, now)) {
|
|
35495
35358
|
return true;
|
|
35496
35359
|
}
|
|
@@ -35508,7 +35371,7 @@ const YearCalendar = /*#__PURE__*/React$5.forwardRef(function YearCalendar(inPro
|
|
|
35508
35371
|
}
|
|
35509
35372
|
return false;
|
|
35510
35373
|
});
|
|
35511
|
-
const handleYearSelection = useEventCallback
|
|
35374
|
+
const handleYearSelection = useEventCallback((event, year) => {
|
|
35512
35375
|
if (readOnly) {
|
|
35513
35376
|
return;
|
|
35514
35377
|
}
|
|
@@ -35516,17 +35379,17 @@ const YearCalendar = /*#__PURE__*/React$5.forwardRef(function YearCalendar(inPro
|
|
|
35516
35379
|
setValue(newDate);
|
|
35517
35380
|
onChange == null ? void 0 : onChange(newDate);
|
|
35518
35381
|
});
|
|
35519
|
-
const focusYear = useEventCallback
|
|
35382
|
+
const focusYear = useEventCallback(year => {
|
|
35520
35383
|
if (!isYearDisabled(utils.setYear(selectedDateOrStartOfYear, year))) {
|
|
35521
35384
|
setFocusedYear(year);
|
|
35522
35385
|
changeHasFocus(true);
|
|
35523
35386
|
onYearFocus == null ? void 0 : onYearFocus(year);
|
|
35524
35387
|
}
|
|
35525
35388
|
});
|
|
35526
|
-
React
|
|
35389
|
+
React.useEffect(() => {
|
|
35527
35390
|
setFocusedYear(prevFocusedYear => selectedYear !== null && prevFocusedYear !== selectedYear ? selectedYear : prevFocusedYear);
|
|
35528
35391
|
}, [selectedYear]);
|
|
35529
|
-
const handleKeyDown = useEventCallback
|
|
35392
|
+
const handleKeyDown = useEventCallback((event, year) => {
|
|
35530
35393
|
switch (event.key) {
|
|
35531
35394
|
case 'ArrowUp':
|
|
35532
35395
|
focusYear(year - yearsPerRow);
|
|
@@ -35546,17 +35409,17 @@ const YearCalendar = /*#__PURE__*/React$5.forwardRef(function YearCalendar(inPro
|
|
|
35546
35409
|
break;
|
|
35547
35410
|
}
|
|
35548
35411
|
});
|
|
35549
|
-
const handleYearFocus = useEventCallback
|
|
35412
|
+
const handleYearFocus = useEventCallback((event, year) => {
|
|
35550
35413
|
focusYear(year);
|
|
35551
35414
|
});
|
|
35552
|
-
const handleYearBlur = useEventCallback
|
|
35415
|
+
const handleYearBlur = useEventCallback((event, year) => {
|
|
35553
35416
|
if (focusedYear === year) {
|
|
35554
35417
|
changeHasFocus(false);
|
|
35555
35418
|
}
|
|
35556
35419
|
});
|
|
35557
|
-
const scrollerRef = React
|
|
35558
|
-
const handleRef = useForkRef
|
|
35559
|
-
React
|
|
35420
|
+
const scrollerRef = React.useRef(null);
|
|
35421
|
+
const handleRef = useForkRef(ref, scrollerRef);
|
|
35422
|
+
React.useEffect(() => {
|
|
35560
35423
|
if (autoFocus || scrollerRef.current === null) {
|
|
35561
35424
|
return;
|
|
35562
35425
|
}
|
|
@@ -35940,9 +35803,9 @@ const DateCalendarViewTransitionContainer = styled(PickersFadeTransitionGroup, {
|
|
|
35940
35803
|
*
|
|
35941
35804
|
* - [DateCalendar API](https://mui.com/x/api/date-pickers/date-calendar/)
|
|
35942
35805
|
*/
|
|
35943
|
-
const DateCalendar = /*#__PURE__*/React
|
|
35806
|
+
const DateCalendar = /*#__PURE__*/React.forwardRef(function DateCalendar(inProps, ref) {
|
|
35944
35807
|
const utils = useUtils();
|
|
35945
|
-
const id = useId
|
|
35808
|
+
const id = useId();
|
|
35946
35809
|
const props = useDateCalendarDefaultizedProps(inProps, 'MuiDateCalendar');
|
|
35947
35810
|
const {
|
|
35948
35811
|
autoFocus,
|
|
@@ -35984,13 +35847,13 @@ const DateCalendar = /*#__PURE__*/React$5.forwardRef(function DateCalendar(inPro
|
|
|
35984
35847
|
monthsPerRow
|
|
35985
35848
|
} = props,
|
|
35986
35849
|
other = _objectWithoutPropertiesLoose(props, _excluded$9);
|
|
35987
|
-
const [value, setValue] = useControlled
|
|
35850
|
+
const [value, setValue] = useControlled({
|
|
35988
35851
|
name: 'DateCalendar',
|
|
35989
35852
|
state: 'value',
|
|
35990
35853
|
controlled: valueProp,
|
|
35991
35854
|
default: defaultValue != null ? defaultValue : null
|
|
35992
35855
|
});
|
|
35993
|
-
const handleValueChange = useEventCallback
|
|
35856
|
+
const handleValueChange = useEventCallback((newValue, selectionState) => {
|
|
35994
35857
|
setValue(newValue);
|
|
35995
35858
|
onChange == null ? void 0 : onChange(newValue, selectionState);
|
|
35996
35859
|
});
|
|
@@ -36029,7 +35892,7 @@ const DateCalendar = /*#__PURE__*/React$5.forwardRef(function DateCalendar(inPro
|
|
|
36029
35892
|
disablePast,
|
|
36030
35893
|
disableFuture
|
|
36031
35894
|
});
|
|
36032
|
-
const handleDateMonthChange = useEventCallback
|
|
35895
|
+
const handleDateMonthChange = useEventCallback(newDate => {
|
|
36033
35896
|
const startOfMonth = utils.startOfMonth(newDate);
|
|
36034
35897
|
const endOfMonth = utils.endOfMonth(newDate);
|
|
36035
35898
|
const closestEnabledDate = isDateDisabled(newDate) ? findClosestEnabledDate({
|
|
@@ -36050,7 +35913,7 @@ const DateCalendar = /*#__PURE__*/React$5.forwardRef(function DateCalendar(inPro
|
|
|
36050
35913
|
}
|
|
36051
35914
|
changeFocusedDay(closestEnabledDate, true);
|
|
36052
35915
|
});
|
|
36053
|
-
const handleDateYearChange = useEventCallback
|
|
35916
|
+
const handleDateYearChange = useEventCallback(newDate => {
|
|
36054
35917
|
const startOfYear = utils.startOfYear(newDate);
|
|
36055
35918
|
const endOfYear = utils.endOfYear(newDate);
|
|
36056
35919
|
const closestEnabledDate = isDateDisabled(newDate) ? findClosestEnabledDate({
|
|
@@ -36071,14 +35934,14 @@ const DateCalendar = /*#__PURE__*/React$5.forwardRef(function DateCalendar(inPro
|
|
|
36071
35934
|
}
|
|
36072
35935
|
changeFocusedDay(closestEnabledDate, true);
|
|
36073
35936
|
});
|
|
36074
|
-
const handleSelectedDayChange = useEventCallback
|
|
35937
|
+
const handleSelectedDayChange = useEventCallback(day => {
|
|
36075
35938
|
if (value && day) {
|
|
36076
35939
|
// If there is a date already selected, then we want to keep its time
|
|
36077
35940
|
return setValueAndGoToNextView(utils.mergeDateAndTime(day, value), 'finish');
|
|
36078
35941
|
}
|
|
36079
35942
|
return setValueAndGoToNextView(day, 'finish');
|
|
36080
35943
|
});
|
|
36081
|
-
React
|
|
35944
|
+
React.useEffect(() => {
|
|
36082
35945
|
if (value != null && utils.isValid(value)) {
|
|
36083
35946
|
changeMonth(value);
|
|
36084
35947
|
}
|
|
@@ -36103,8 +35966,8 @@ const DateCalendar = /*#__PURE__*/React$5.forwardRef(function DateCalendar(inPro
|
|
|
36103
35966
|
};
|
|
36104
35967
|
const gridLabelId = `${id}-grid-label`;
|
|
36105
35968
|
const hasFocus = focusedView !== null;
|
|
36106
|
-
const prevOpenViewRef = React
|
|
36107
|
-
React
|
|
35969
|
+
const prevOpenViewRef = React.useRef(view);
|
|
35970
|
+
React.useEffect(() => {
|
|
36108
35971
|
// If the view change and the focus was on the previous view
|
|
36109
35972
|
// Then we update the focus.
|
|
36110
35973
|
if (prevOpenViewRef.current === view) {
|
|
@@ -36115,7 +35978,7 @@ const DateCalendar = /*#__PURE__*/React$5.forwardRef(function DateCalendar(inPro
|
|
|
36115
35978
|
}
|
|
36116
35979
|
prevOpenViewRef.current = view;
|
|
36117
35980
|
}, [focusedView, setFocusedView, view]);
|
|
36118
|
-
const selectedDays = React
|
|
35981
|
+
const selectedDays = React.useMemo(() => [value], [value]);
|
|
36119
35982
|
return /*#__PURE__*/jsxs(DateCalendarRoot, _extends({
|
|
36120
35983
|
ref: ref,
|
|
36121
35984
|
className: clsx(classes.root, className),
|
|
@@ -36475,7 +36338,7 @@ const PickersToolbarContent = styled(Grid, {
|
|
|
36475
36338
|
}, !ownerState.isLandscape && {
|
|
36476
36339
|
alignItems: 'center'
|
|
36477
36340
|
}));
|
|
36478
|
-
const PickersToolbar = /*#__PURE__*/React
|
|
36341
|
+
const PickersToolbar = /*#__PURE__*/React.forwardRef(function PickersToolbar(inProps, ref) {
|
|
36479
36342
|
const props = useThemeProps({
|
|
36480
36343
|
props: inProps,
|
|
36481
36344
|
name: 'MuiPickersToolbar'
|
|
@@ -36601,11 +36464,11 @@ function clickedRootScrollbar(event, doc) {
|
|
|
36601
36464
|
* @returns {Array} The ref and event handler to listen to the outside clicks.
|
|
36602
36465
|
*/
|
|
36603
36466
|
function useClickAwayListener(active, onClickAway) {
|
|
36604
|
-
const movedRef = React
|
|
36605
|
-
const syntheticEventRef = React
|
|
36606
|
-
const nodeRef = React
|
|
36607
|
-
const activatedRef = React
|
|
36608
|
-
React
|
|
36467
|
+
const movedRef = React.useRef(false);
|
|
36468
|
+
const syntheticEventRef = React.useRef(false);
|
|
36469
|
+
const nodeRef = React.useRef(null);
|
|
36470
|
+
const activatedRef = React.useRef(false);
|
|
36471
|
+
React.useEffect(() => {
|
|
36609
36472
|
if (!active) {
|
|
36610
36473
|
return undefined;
|
|
36611
36474
|
}
|
|
@@ -36630,7 +36493,7 @@ function useClickAwayListener(active, onClickAway) {
|
|
|
36630
36493
|
// clicking a checkbox to check it, hitting a button to submit a form,
|
|
36631
36494
|
// and hitting left arrow to move the cursor in a text input etc.
|
|
36632
36495
|
// Only special HTML elements have these default behaviors.
|
|
36633
|
-
const handleClickAway = useEventCallback
|
|
36496
|
+
const handleClickAway = useEventCallback(event => {
|
|
36634
36497
|
if (!activatedRef.current) {
|
|
36635
36498
|
return;
|
|
36636
36499
|
}
|
|
@@ -36672,7 +36535,7 @@ function useClickAwayListener(active, onClickAway) {
|
|
|
36672
36535
|
const handleSynthetic = () => {
|
|
36673
36536
|
syntheticEventRef.current = true;
|
|
36674
36537
|
};
|
|
36675
|
-
React
|
|
36538
|
+
React.useEffect(() => {
|
|
36676
36539
|
if (active) {
|
|
36677
36540
|
const doc = ownerDocument(nodeRef.current);
|
|
36678
36541
|
const handleTouchMove = () => {
|
|
@@ -36687,7 +36550,7 @@ function useClickAwayListener(active, onClickAway) {
|
|
|
36687
36550
|
}
|
|
36688
36551
|
return undefined;
|
|
36689
36552
|
}, [active, handleClickAway]);
|
|
36690
|
-
React
|
|
36553
|
+
React.useEffect(() => {
|
|
36691
36554
|
// TODO This behavior is not tested automatically
|
|
36692
36555
|
// It's unclear whether this is due to different update semantics in test (batched in act() vs discrete on click).
|
|
36693
36556
|
// Or if this is a timing related issues due to different Transition components
|
|
@@ -36724,7 +36587,7 @@ function PickersPopper(inProps) {
|
|
|
36724
36587
|
slots,
|
|
36725
36588
|
slotProps
|
|
36726
36589
|
} = props;
|
|
36727
|
-
React
|
|
36590
|
+
React.useEffect(() => {
|
|
36728
36591
|
function handleKeyDown(nativeEvent) {
|
|
36729
36592
|
// IE11, Edge (prior to using Blink?) use 'Esc'
|
|
36730
36593
|
if (open && (nativeEvent.key === 'Escape' || nativeEvent.key === 'Esc')) {
|
|
@@ -36736,8 +36599,8 @@ function PickersPopper(inProps) {
|
|
|
36736
36599
|
document.removeEventListener('keydown', handleKeyDown);
|
|
36737
36600
|
};
|
|
36738
36601
|
}, [onDismiss, open]);
|
|
36739
|
-
const lastFocusedElementRef = React
|
|
36740
|
-
React
|
|
36602
|
+
const lastFocusedElementRef = React.useRef(null);
|
|
36603
|
+
React.useEffect(() => {
|
|
36741
36604
|
if (role === 'tooltip' || shouldRestoreFocus && !shouldRestoreFocus()) {
|
|
36742
36605
|
return;
|
|
36743
36606
|
}
|
|
@@ -36754,9 +36617,9 @@ function PickersPopper(inProps) {
|
|
|
36754
36617
|
}
|
|
36755
36618
|
}, [open, role, shouldRestoreFocus]);
|
|
36756
36619
|
const [clickAwayRef, onPaperClick, onPaperTouchStart] = useClickAwayListener(open, onBlur != null ? onBlur : onDismiss);
|
|
36757
|
-
const paperRef = React
|
|
36758
|
-
const handleRef = useForkRef
|
|
36759
|
-
const handlePaperRef = useForkRef
|
|
36620
|
+
const paperRef = React.useRef(null);
|
|
36621
|
+
const handleRef = useForkRef(paperRef, containerRef);
|
|
36622
|
+
const handlePaperRef = useForkRef(handleRef, clickAwayRef);
|
|
36760
36623
|
const ownerState = props;
|
|
36761
36624
|
const classes = useUtilityClasses$6(ownerState);
|
|
36762
36625
|
const handleKeyDown = event => {
|
|
@@ -36864,7 +36727,7 @@ const PickersToolbarTextRoot = styled(Typography, {
|
|
|
36864
36727
|
color: (theme.vars || theme).palette.text.primary
|
|
36865
36728
|
}
|
|
36866
36729
|
}));
|
|
36867
|
-
const PickersToolbarText = /*#__PURE__*/React
|
|
36730
|
+
const PickersToolbarText = /*#__PURE__*/React.forwardRef(function PickersToolbarText(inProps, ref) {
|
|
36868
36731
|
const props = useThemeProps({
|
|
36869
36732
|
props: inProps,
|
|
36870
36733
|
name: 'MuiPickersToolbarText'
|
|
@@ -36903,7 +36766,7 @@ const PickersToolbarButtonRoot = styled(Button, {
|
|
|
36903
36766
|
minWidth: 16,
|
|
36904
36767
|
textTransform: 'none'
|
|
36905
36768
|
});
|
|
36906
|
-
const PickersToolbarButton = /*#__PURE__*/React
|
|
36769
|
+
const PickersToolbarButton = /*#__PURE__*/React.forwardRef(function PickersToolbarButton(inProps, ref) {
|
|
36907
36770
|
const props = useThemeProps({
|
|
36908
36771
|
props: inProps,
|
|
36909
36772
|
name: 'MuiPickersToolbarButton'
|
|
@@ -36938,12 +36801,12 @@ const useOpenState = ({
|
|
|
36938
36801
|
onOpen,
|
|
36939
36802
|
onClose
|
|
36940
36803
|
}) => {
|
|
36941
|
-
const isControllingOpenProp = React
|
|
36942
|
-
const [openState, setIsOpenState] = React
|
|
36804
|
+
const isControllingOpenProp = React.useRef(typeof open === 'boolean').current;
|
|
36805
|
+
const [openState, setIsOpenState] = React.useState(false);
|
|
36943
36806
|
|
|
36944
36807
|
// It is required to update inner state in useEffect in order to avoid situation when
|
|
36945
36808
|
// Our component is not mounted yet, but `open` state is set to `true` (e.g. initially opened)
|
|
36946
|
-
React
|
|
36809
|
+
React.useEffect(() => {
|
|
36947
36810
|
if (isControllingOpenProp) {
|
|
36948
36811
|
if (typeof open !== 'boolean') {
|
|
36949
36812
|
throw new Error('You must not mix controlling and uncontrolled mode for `open` prop');
|
|
@@ -36951,7 +36814,7 @@ const useOpenState = ({
|
|
|
36951
36814
|
setIsOpenState(open);
|
|
36952
36815
|
}
|
|
36953
36816
|
}, [isControllingOpenProp, open]);
|
|
36954
|
-
const setIsOpen = React
|
|
36817
|
+
const setIsOpen = React.useCallback(newIsOpen => {
|
|
36955
36818
|
if (!isControllingOpenProp) {
|
|
36956
36819
|
setIsOpenState(newIsOpen);
|
|
36957
36820
|
}
|
|
@@ -37075,19 +36938,19 @@ const usePickerValue = ({
|
|
|
37075
36938
|
} = props;
|
|
37076
36939
|
const {
|
|
37077
36940
|
current: defaultValue
|
|
37078
|
-
} = React
|
|
36941
|
+
} = React.useRef(inDefaultValue);
|
|
37079
36942
|
const {
|
|
37080
36943
|
current: isControlled
|
|
37081
|
-
} = React
|
|
36944
|
+
} = React.useRef(inValue !== undefined);
|
|
37082
36945
|
|
|
37083
36946
|
/* eslint-disable react-hooks/rules-of-hooks, react-hooks/exhaustive-deps */
|
|
37084
36947
|
if (process.env.NODE_ENV !== 'production') {
|
|
37085
|
-
React
|
|
36948
|
+
React.useEffect(() => {
|
|
37086
36949
|
if (isControlled !== (inValue !== undefined)) {
|
|
37087
36950
|
console.error([`MUI: A component is changing the ${isControlled ? '' : 'un'}controlled value of a picker to be ${isControlled ? 'un' : ''}controlled.`, 'Elements should not switch from uncontrolled to controlled (or vice versa).', `Decide between using a controlled or uncontrolled value` + 'for the lifetime of the component.', "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", 'More info: https://fb.me/react-controlled-components'].join('\n'));
|
|
37088
36951
|
}
|
|
37089
36952
|
}, [inValue]);
|
|
37090
|
-
React
|
|
36953
|
+
React.useEffect(() => {
|
|
37091
36954
|
if (!isControlled && defaultValue !== inDefaultValue) {
|
|
37092
36955
|
console.error([`MUI: A component is changing the defaultValue of an uncontrolled picker after being initialized. ` + `To suppress this warning opt to use a controlled value.`].join('\n'));
|
|
37093
36956
|
}
|
|
@@ -37097,7 +36960,7 @@ const usePickerValue = ({
|
|
|
37097
36960
|
|
|
37098
36961
|
const utils = useUtils();
|
|
37099
36962
|
const adapter = useLocalizationContext();
|
|
37100
|
-
const [selectedSections, setSelectedSections] = useControlled
|
|
36963
|
+
const [selectedSections, setSelectedSections] = useControlled({
|
|
37101
36964
|
controlled: selectedSectionsProp,
|
|
37102
36965
|
default: null,
|
|
37103
36966
|
name: 'usePickerValue',
|
|
@@ -37107,7 +36970,7 @@ const usePickerValue = ({
|
|
|
37107
36970
|
isOpen,
|
|
37108
36971
|
setIsOpen
|
|
37109
36972
|
} = useOpenState(props);
|
|
37110
|
-
const [dateState, setDateState] = React
|
|
36973
|
+
const [dateState, setDateState] = React.useState(() => {
|
|
37111
36974
|
let initialValue;
|
|
37112
36975
|
if (inValue !== undefined) {
|
|
37113
36976
|
initialValue = inValue;
|
|
@@ -37127,7 +36990,7 @@ const usePickerValue = ({
|
|
|
37127
36990
|
useValidation(_extends({}, props, {
|
|
37128
36991
|
value: dateState.draft
|
|
37129
36992
|
}), validator, valueManager.isSameError, valueManager.defaultErrorState);
|
|
37130
|
-
const updateDate =
|
|
36993
|
+
const updateDate = useEventCallback(action => {
|
|
37131
36994
|
const updaterParams = {
|
|
37132
36995
|
action,
|
|
37133
36996
|
dateState,
|
|
@@ -37175,54 +37038,54 @@ const usePickerValue = ({
|
|
|
37175
37038
|
hasBeenModifiedSinceMount: true
|
|
37176
37039
|
}));
|
|
37177
37040
|
}
|
|
37178
|
-
const handleClear =
|
|
37041
|
+
const handleClear = useEventCallback(() => {
|
|
37179
37042
|
updateDate({
|
|
37180
37043
|
value: valueManager.emptyValue,
|
|
37181
37044
|
name: 'setValueFromAction',
|
|
37182
37045
|
pickerAction: 'clear'
|
|
37183
37046
|
});
|
|
37184
37047
|
});
|
|
37185
|
-
const handleAccept =
|
|
37048
|
+
const handleAccept = useEventCallback(() => {
|
|
37186
37049
|
updateDate({
|
|
37187
37050
|
value: dateState.lastPublishedValue,
|
|
37188
37051
|
name: 'setValueFromAction',
|
|
37189
37052
|
pickerAction: 'accept'
|
|
37190
37053
|
});
|
|
37191
37054
|
});
|
|
37192
|
-
const handleDismiss =
|
|
37055
|
+
const handleDismiss = useEventCallback(() => {
|
|
37193
37056
|
updateDate({
|
|
37194
37057
|
value: dateState.lastPublishedValue,
|
|
37195
37058
|
name: 'setValueFromAction',
|
|
37196
37059
|
pickerAction: 'dismiss'
|
|
37197
37060
|
});
|
|
37198
37061
|
});
|
|
37199
|
-
const handleCancel =
|
|
37062
|
+
const handleCancel = useEventCallback(() => {
|
|
37200
37063
|
updateDate({
|
|
37201
37064
|
value: dateState.lastCommittedValue,
|
|
37202
37065
|
name: 'setValueFromAction',
|
|
37203
37066
|
pickerAction: 'cancel'
|
|
37204
37067
|
});
|
|
37205
37068
|
});
|
|
37206
|
-
const handleSetToday =
|
|
37069
|
+
const handleSetToday = useEventCallback(() => {
|
|
37207
37070
|
updateDate({
|
|
37208
37071
|
value: valueManager.getTodayValue(utils, valueType),
|
|
37209
37072
|
name: 'setValueFromAction',
|
|
37210
37073
|
pickerAction: 'today'
|
|
37211
37074
|
});
|
|
37212
37075
|
});
|
|
37213
|
-
const handleOpen =
|
|
37214
|
-
const handleClose =
|
|
37215
|
-
const handleChange =
|
|
37076
|
+
const handleOpen = useEventCallback(() => setIsOpen(true));
|
|
37077
|
+
const handleClose = useEventCallback(() => setIsOpen(false));
|
|
37078
|
+
const handleChange = useEventCallback((newValue, selectionState = 'partial') => updateDate({
|
|
37216
37079
|
name: 'setValueFromView',
|
|
37217
37080
|
value: newValue,
|
|
37218
37081
|
selectionState
|
|
37219
37082
|
}));
|
|
37220
|
-
const handleChangeField =
|
|
37083
|
+
const handleChangeField = useEventCallback((newValue, context) => updateDate({
|
|
37221
37084
|
name: 'setValueFromField',
|
|
37222
37085
|
value: newValue,
|
|
37223
37086
|
context
|
|
37224
37087
|
}));
|
|
37225
|
-
const handleFieldSelectedSectionsChange =
|
|
37088
|
+
const handleFieldSelectedSectionsChange = useEventCallback(newSelectedSections => {
|
|
37226
37089
|
setSelectedSections(newSelectedSections);
|
|
37227
37090
|
onSelectedSectionsChange == null ? void 0 : onSelectedSectionsChange(newSelectedSections);
|
|
37228
37091
|
});
|
|
@@ -37241,7 +37104,7 @@ const usePickerValue = ({
|
|
|
37241
37104
|
selectedSections,
|
|
37242
37105
|
onSelectedSectionsChange: handleFieldSelectedSectionsChange
|
|
37243
37106
|
};
|
|
37244
|
-
const viewValue = React
|
|
37107
|
+
const viewValue = React.useMemo(() => valueManager.cleanValue(utils, dateState.draft), [utils, valueManager, dateState.draft]);
|
|
37245
37108
|
const viewResponse = {
|
|
37246
37109
|
value: viewValue,
|
|
37247
37110
|
onChange: handleChange,
|
|
@@ -37332,7 +37195,7 @@ const usePickerViews = ({
|
|
|
37332
37195
|
const {
|
|
37333
37196
|
hasUIView,
|
|
37334
37197
|
viewModeLookup
|
|
37335
|
-
} = React
|
|
37198
|
+
} = React.useMemo(() => views.reduce((acc, viewForReduce) => {
|
|
37336
37199
|
let viewMode;
|
|
37337
37200
|
if (disableOpenPicker) {
|
|
37338
37201
|
viewMode = 'field';
|
|
@@ -37350,7 +37213,7 @@ const usePickerViews = ({
|
|
|
37350
37213
|
hasUIView: false,
|
|
37351
37214
|
viewModeLookup: {}
|
|
37352
37215
|
}), [disableOpenPicker, viewRenderers, views]);
|
|
37353
|
-
const hasMultipleUITimeView = React
|
|
37216
|
+
const hasMultipleUITimeView = React.useMemo(() => {
|
|
37354
37217
|
const numberUITimeViews = views.reduce((acc, viewForReduce) => {
|
|
37355
37218
|
if (viewRenderers[viewForReduce] != null && isTimeView(viewForReduce)) {
|
|
37356
37219
|
return acc + 1;
|
|
@@ -37360,12 +37223,12 @@ const usePickerViews = ({
|
|
|
37360
37223
|
return numberUITimeViews > 1;
|
|
37361
37224
|
}, [viewRenderers, views]);
|
|
37362
37225
|
const currentViewMode = viewModeLookup[view];
|
|
37363
|
-
const shouldRestoreFocus =
|
|
37364
|
-
const [popperView, setPopperView] = React
|
|
37226
|
+
const shouldRestoreFocus = useEventCallback(() => currentViewMode === 'UI');
|
|
37227
|
+
const [popperView, setPopperView] = React.useState(currentViewMode === 'UI' ? view : null);
|
|
37365
37228
|
if (popperView !== view && viewModeLookup[view] === 'UI') {
|
|
37366
37229
|
setPopperView(view);
|
|
37367
37230
|
}
|
|
37368
|
-
|
|
37231
|
+
useEnhancedEffect$1(() => {
|
|
37369
37232
|
if (currentViewMode === 'field' && open) {
|
|
37370
37233
|
onClose();
|
|
37371
37234
|
onSelectedSectionsChange('hours');
|
|
@@ -37375,7 +37238,7 @@ const usePickerViews = ({
|
|
|
37375
37238
|
}
|
|
37376
37239
|
}, [view]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
37377
37240
|
|
|
37378
|
-
|
|
37241
|
+
useEnhancedEffect$1(() => {
|
|
37379
37242
|
if (!open) {
|
|
37380
37243
|
return;
|
|
37381
37244
|
}
|
|
@@ -37441,8 +37304,8 @@ function getOrientation() {
|
|
|
37441
37304
|
return 'portrait';
|
|
37442
37305
|
}
|
|
37443
37306
|
const useIsLandscape = (views, customOrientation) => {
|
|
37444
|
-
const [orientation, setOrientation] = React
|
|
37445
|
-
useEnhancedEffect$
|
|
37307
|
+
const [orientation, setOrientation] = React.useState(getOrientation);
|
|
37308
|
+
useEnhancedEffect$1(() => {
|
|
37446
37309
|
const eventHandler = () => {
|
|
37447
37310
|
setOrientation(getOrientation());
|
|
37448
37311
|
};
|
|
@@ -37933,9 +37796,9 @@ const PickersLayout = function PickersLayout(inProps) {
|
|
|
37933
37796
|
ownerState: ownerState,
|
|
37934
37797
|
children: [isLandscape ? shortcuts : toolbar, isLandscape ? toolbar : shortcuts, /*#__PURE__*/jsx(PickersLayoutContentWrapper, {
|
|
37935
37798
|
className: classes.contentWrapper,
|
|
37936
|
-
children: wrapperVariant === 'desktop' ? /*#__PURE__*/jsxs(React
|
|
37799
|
+
children: wrapperVariant === 'desktop' ? /*#__PURE__*/jsxs(React.Fragment, {
|
|
37937
37800
|
children: [content, tabs]
|
|
37938
|
-
}) : /*#__PURE__*/jsxs(React
|
|
37801
|
+
}) : /*#__PURE__*/jsxs(React.Fragment, {
|
|
37939
37802
|
children: [tabs, content]
|
|
37940
37803
|
})
|
|
37941
37804
|
}), actionBar]
|
|
@@ -38007,49 +37870,6 @@ const extractValidationProps = props => VALIDATION_PROP_NAMES.reduce((extractedP
|
|
|
38007
37870
|
return extractedProps;
|
|
38008
37871
|
}, {});
|
|
38009
37872
|
|
|
38010
|
-
var useId$1 = {};
|
|
38011
|
-
|
|
38012
|
-
Object.defineProperty(useId$1, "__esModule", {
|
|
38013
|
-
value: true
|
|
38014
|
-
});
|
|
38015
|
-
var _default = useId$1.default = useId;
|
|
38016
|
-
var React = _interopRequireWildcard(React__default);
|
|
38017
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
38018
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
38019
|
-
let globalId = 0;
|
|
38020
|
-
function useGlobalId(idOverride) {
|
|
38021
|
-
const [defaultId, setDefaultId] = React.useState(idOverride);
|
|
38022
|
-
const id = idOverride || defaultId;
|
|
38023
|
-
React.useEffect(() => {
|
|
38024
|
-
if (defaultId == null) {
|
|
38025
|
-
// Fallback to this default id when possible.
|
|
38026
|
-
// Use the incrementing value for client-side rendering only.
|
|
38027
|
-
// We can't use it server-side.
|
|
38028
|
-
// If you want to use random values please consider the Birthday Problem: https://en.wikipedia.org/wiki/Birthday_problem
|
|
38029
|
-
globalId += 1;
|
|
38030
|
-
setDefaultId(`mui-${globalId}`);
|
|
38031
|
-
}
|
|
38032
|
-
}, [defaultId]);
|
|
38033
|
-
return id;
|
|
38034
|
-
}
|
|
38035
|
-
|
|
38036
|
-
// eslint-disable-next-line no-useless-concat -- Workaround for https://github.com/webpack/webpack/issues/14814
|
|
38037
|
-
const maybeReactUseId = React['useId' + ''];
|
|
38038
|
-
/**
|
|
38039
|
-
*
|
|
38040
|
-
* @example <div id={useId()} />
|
|
38041
|
-
* @param idOverride
|
|
38042
|
-
* @returns {string}
|
|
38043
|
-
*/
|
|
38044
|
-
function useId(idOverride) {
|
|
38045
|
-
if (maybeReactUseId !== undefined) {
|
|
38046
|
-
const reactId = maybeReactUseId();
|
|
38047
|
-
return idOverride != null ? idOverride : reactId;
|
|
38048
|
-
}
|
|
38049
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks -- `React.useId` is invariant at runtime.
|
|
38050
|
-
return useGlobalId(idOverride);
|
|
38051
|
-
}
|
|
38052
|
-
|
|
38053
37873
|
const _excluded$3 = ["props", "getOpenDialogAriaText"],
|
|
38054
37874
|
_excluded2 = ["ownerState"],
|
|
38055
37875
|
_excluded3 = ["ownerState"];
|
|
@@ -38081,9 +37901,9 @@ const useDesktopPicker = _ref => {
|
|
|
38081
37901
|
localeText
|
|
38082
37902
|
} = props;
|
|
38083
37903
|
const utils = useUtils();
|
|
38084
|
-
const internalInputRef = React
|
|
38085
|
-
const containerRef = React
|
|
38086
|
-
const labelId =
|
|
37904
|
+
const internalInputRef = React.useRef(null);
|
|
37905
|
+
const containerRef = React.useRef(null);
|
|
37906
|
+
const labelId = useId();
|
|
38087
37907
|
const isToolbarHidden = (_innerSlotProps$toolb = innerSlotProps == null ? void 0 : (_innerSlotProps$toolb2 = innerSlotProps.toolbar) == null ? void 0 : _innerSlotProps$toolb2.hidden) != null ? _innerSlotProps$toolb : false;
|
|
38088
37908
|
const {
|
|
38089
37909
|
open,
|
|
@@ -38158,7 +37978,7 @@ const useDesktopPicker = _ref => {
|
|
|
38158
37978
|
textField: slots.textField
|
|
38159
37979
|
}, fieldProps.slots);
|
|
38160
37980
|
const Layout = (_slots$layout = slots.layout) != null ? _slots$layout : PickersLayout;
|
|
38161
|
-
const handleInputRef =
|
|
37981
|
+
const handleInputRef = useForkRef(internalInputRef, fieldProps.inputRef, inputRef);
|
|
38162
37982
|
let labelledById = labelId;
|
|
38163
37983
|
if (isToolbarHidden) {
|
|
38164
37984
|
if (label) {
|
|
@@ -38311,8 +38131,8 @@ const useMobilePicker = _ref => {
|
|
|
38311
38131
|
localeText
|
|
38312
38132
|
} = props;
|
|
38313
38133
|
const utils = useUtils();
|
|
38314
|
-
const internalInputRef = React
|
|
38315
|
-
const labelId =
|
|
38134
|
+
const internalInputRef = React.useRef(null);
|
|
38135
|
+
const labelId = useId();
|
|
38316
38136
|
const isToolbarHidden = (_innerSlotProps$toolb = innerSlotProps == null ? void 0 : (_innerSlotProps$toolb2 = innerSlotProps.toolbar) == null ? void 0 : _innerSlotProps$toolb2.hidden) != null ? _innerSlotProps$toolb : false;
|
|
38317
38137
|
const {
|
|
38318
38138
|
open,
|
|
@@ -38356,7 +38176,7 @@ const useMobilePicker = _ref => {
|
|
|
38356
38176
|
textField: slots.textField
|
|
38357
38177
|
}, fieldProps.slots);
|
|
38358
38178
|
const Layout = (_slots$layout = slots.layout) != null ? _slots$layout : PickersLayout;
|
|
38359
|
-
const handleInputRef =
|
|
38179
|
+
const handleInputRef = useForkRef(internalInputRef, fieldProps.inputRef, inputRef);
|
|
38360
38180
|
let labelledById = labelId;
|
|
38361
38181
|
if (isToolbarHidden) {
|
|
38362
38182
|
if (label) {
|
|
@@ -38525,13 +38345,13 @@ const DateTimePickerTabs = function DateTimePickerTabs(inProps) {
|
|
|
38525
38345
|
children: [/*#__PURE__*/jsx(Tab, {
|
|
38526
38346
|
value: "date",
|
|
38527
38347
|
"aria-label": localeText.dateTableLabel,
|
|
38528
|
-
icon: /*#__PURE__*/jsx(React
|
|
38348
|
+
icon: /*#__PURE__*/jsx(React.Fragment, {
|
|
38529
38349
|
children: dateIcon
|
|
38530
38350
|
})
|
|
38531
38351
|
}), /*#__PURE__*/jsx(Tab, {
|
|
38532
38352
|
value: "time",
|
|
38533
38353
|
"aria-label": localeText.timeTableLabel,
|
|
38534
|
-
icon: /*#__PURE__*/jsx(React
|
|
38354
|
+
icon: /*#__PURE__*/jsx(React.Fragment, {
|
|
38535
38355
|
children: timeIcon
|
|
38536
38356
|
})
|
|
38537
38357
|
})]
|
|
@@ -38746,7 +38566,7 @@ function DateTimePickerToolbar(inProps) {
|
|
|
38746
38566
|
theme
|
|
38747
38567
|
}));
|
|
38748
38568
|
const formatHours = time => ampm ? utils.format(time, 'hours12h') : utils.format(time, 'hours24h');
|
|
38749
|
-
const dateText = React
|
|
38569
|
+
const dateText = React.useMemo(() => {
|
|
38750
38570
|
if (!value) {
|
|
38751
38571
|
return toolbarPlaceholder;
|
|
38752
38572
|
}
|
|
@@ -38787,7 +38607,7 @@ function DateTimePickerToolbar(inProps) {
|
|
|
38787
38607
|
onClick: () => onViewChange('hours'),
|
|
38788
38608
|
selected: view === 'hours',
|
|
38789
38609
|
value: value ? formatHours(value) : '--'
|
|
38790
|
-
}), views.includes('minutes') && /*#__PURE__*/jsxs(React
|
|
38610
|
+
}), views.includes('minutes') && /*#__PURE__*/jsxs(React.Fragment, {
|
|
38791
38611
|
children: [/*#__PURE__*/jsx(DateTimePickerToolbarSeparator, {
|
|
38792
38612
|
variant: "h3",
|
|
38793
38613
|
value: ":",
|
|
@@ -38799,7 +38619,7 @@ function DateTimePickerToolbar(inProps) {
|
|
|
38799
38619
|
selected: view === 'minutes',
|
|
38800
38620
|
value: value ? utils.format(value, 'minutes') : '--'
|
|
38801
38621
|
})]
|
|
38802
|
-
}), views.includes('seconds') && /*#__PURE__*/jsxs(React
|
|
38622
|
+
}), views.includes('seconds') && /*#__PURE__*/jsxs(React.Fragment, {
|
|
38803
38623
|
children: [/*#__PURE__*/jsx(DateTimePickerToolbarSeparator, {
|
|
38804
38624
|
variant: "h3",
|
|
38805
38625
|
value: ":",
|
|
@@ -38893,7 +38713,7 @@ function useDateTimePickerDefaultizedProps(props, name) {
|
|
|
38893
38713
|
name
|
|
38894
38714
|
});
|
|
38895
38715
|
const ampm = (_themeProps$ampm = themeProps.ampm) != null ? _themeProps$ampm : utils.is12HourCycleInCurrentLocale();
|
|
38896
|
-
const localeText = React
|
|
38716
|
+
const localeText = React.useMemo(() => {
|
|
38897
38717
|
var _themeProps$localeTex;
|
|
38898
38718
|
if (((_themeProps$localeTex = themeProps.localeText) == null ? void 0 : _themeProps$localeTex.toolbarTitle) == null) {
|
|
38899
38719
|
return themeProps.localeText;
|
|
@@ -38935,7 +38755,7 @@ function useDateTimePickerDefaultizedProps(props, name) {
|
|
|
38935
38755
|
});
|
|
38936
38756
|
}
|
|
38937
38757
|
|
|
38938
|
-
const DesktopDateTimePicker = /*#__PURE__*/React
|
|
38758
|
+
const DesktopDateTimePicker = /*#__PURE__*/React.forwardRef(function DesktopDateTimePicker(inProps, ref) {
|
|
38939
38759
|
var _defaultizedProps$amp, _defaultizedProps$yea, _defaultizedProps$slo2, _defaultizedProps$slo3;
|
|
38940
38760
|
const localeText = useLocaleText();
|
|
38941
38761
|
|
|
@@ -39348,7 +39168,7 @@ DesktopDateTimePicker.propTypes = {
|
|
|
39348
39168
|
yearsPerRow: PropTypes.oneOf([3, 4])
|
|
39349
39169
|
};
|
|
39350
39170
|
|
|
39351
|
-
const MobileDateTimePicker = /*#__PURE__*/React
|
|
39171
|
+
const MobileDateTimePicker = /*#__PURE__*/React.forwardRef(function MobileDateTimePicker(inProps, ref) {
|
|
39352
39172
|
var _defaultizedProps$amp, _defaultizedProps$slo2, _defaultizedProps$slo3;
|
|
39353
39173
|
const localeText = useLocaleText();
|
|
39354
39174
|
|
|
@@ -39760,7 +39580,7 @@ MobileDateTimePicker.propTypes = {
|
|
|
39760
39580
|
};
|
|
39761
39581
|
|
|
39762
39582
|
const _excluded = ["desktopModeMediaQuery"];
|
|
39763
|
-
const DateTimePicker = /*#__PURE__*/React
|
|
39583
|
+
const DateTimePicker = /*#__PURE__*/React.forwardRef(function DateTimePicker(inProps, ref) {
|
|
39764
39584
|
const props = useThemeProps({
|
|
39765
39585
|
props: inProps,
|
|
39766
39586
|
name: 'MuiDateTimePicker'
|
|
@@ -40196,13 +40016,13 @@ var ReactHookKeyboardDateTimePicker = function ReactHookKeyboardDateTimePicker(_
|
|
|
40196
40016
|
var errors = getErrors(name, formErrors);
|
|
40197
40017
|
// Ensure value is a Moment object
|
|
40198
40018
|
var dateValue = value ? moment$1(value) : null;
|
|
40199
|
-
return /*#__PURE__*/React
|
|
40019
|
+
return /*#__PURE__*/React.createElement(ReactHookFormFormControl, {
|
|
40200
40020
|
disabled: disabled,
|
|
40201
40021
|
errors: errors,
|
|
40202
40022
|
className: className,
|
|
40203
40023
|
sx: sx,
|
|
40204
40024
|
isReadOnly: isReadOnly
|
|
40205
|
-
}, /*#__PURE__*/React
|
|
40025
|
+
}, /*#__PURE__*/React.createElement(DateTimePicker, Object.assign({
|
|
40206
40026
|
desktopModeMediaQuery: "@media (min-width: 720px)",
|
|
40207
40027
|
ampm: false,
|
|
40208
40028
|
format: format,
|
|
@@ -40223,7 +40043,7 @@ var ReactHookKeyboardDateTimePicker = function ReactHookKeyboardDateTimePicker(_
|
|
|
40223
40043
|
name: name,
|
|
40224
40044
|
placeholder: disabled ? '' : format.toLowerCase(),
|
|
40225
40045
|
InputProps: Object.assign({
|
|
40226
|
-
endAdornment: /*#__PURE__*/React
|
|
40046
|
+
endAdornment: /*#__PURE__*/React.createElement(InputAdornment, {
|
|
40227
40047
|
style: {
|
|
40228
40048
|
paddingTop: '16px'
|
|
40229
40049
|
},
|
|
@@ -40720,7 +40540,7 @@ var ReactHookFormHiddenInput = function ReactHookFormHiddenInput(_ref) {
|
|
|
40720
40540
|
defaultValue: defaultValue
|
|
40721
40541
|
}, defaultProps$1)),
|
|
40722
40542
|
field = _useController.field;
|
|
40723
|
-
return field.value !== null ? /*#__PURE__*/React
|
|
40543
|
+
return field.value !== null ? /*#__PURE__*/React.createElement("input", Object.assign({}, field, {
|
|
40724
40544
|
type: "hidden"
|
|
40725
40545
|
})) : null;
|
|
40726
40546
|
};
|
|
@@ -40749,7 +40569,7 @@ var useDraftFormHelpers = function useDraftFormHelpers() {
|
|
|
40749
40569
|
getValues = _useFormContext.getValues,
|
|
40750
40570
|
setValue = _useFormContext.setValue,
|
|
40751
40571
|
register = _useFormContext.register;
|
|
40752
|
-
React
|
|
40572
|
+
React.useEffect(function () {
|
|
40753
40573
|
setValue(HIDDEN_INPUT_HELPER_IS_DRAFT, isDefaultDraft, {
|
|
40754
40574
|
shouldDirty: false
|
|
40755
40575
|
});
|
|
@@ -40770,7 +40590,7 @@ var useDraftFormHelpers = function useDraftFormHelpers() {
|
|
|
40770
40590
|
});
|
|
40771
40591
|
};
|
|
40772
40592
|
var DraftFieldHelper = function DraftFieldHelper() {
|
|
40773
|
-
return /*#__PURE__*/React
|
|
40593
|
+
return /*#__PURE__*/React.createElement("input", Object.assign({}, register(HIDDEN_INPUT_HELPER_IS_DRAFT), {
|
|
40774
40594
|
type: "hidden"
|
|
40775
40595
|
}));
|
|
40776
40596
|
};
|