@mui/x-date-pickers 9.0.0-rc.0 → 9.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/CHANGELOG.md +328 -6892
- package/DateField/DateField.js +0 -24
- package/DateField/DateField.mjs +0 -24
- package/DateTimeField/DateTimeField.js +0 -24
- package/DateTimeField/DateTimeField.mjs +0 -24
- package/LocalizationProvider/LocalizationProvider.d.mts +0 -6
- package/LocalizationProvider/LocalizationProvider.d.ts +0 -6
- package/LocalizationProvider/LocalizationProvider.js +1 -10
- package/LocalizationProvider/LocalizationProvider.mjs +0 -9
- package/LocalizationProvider/index.d.mts +1 -1
- package/LocalizationProvider/index.d.ts +1 -1
- package/LocalizationProvider/index.js +0 -6
- package/LocalizationProvider/index.mjs +1 -1
- package/PickersTextField/PickersFilledInput/PickersFilledInput.js +14 -19
- package/PickersTextField/PickersFilledInput/PickersFilledInput.mjs +14 -19
- package/PickersTextField/PickersInput/PickersInput.js +12 -17
- package/PickersTextField/PickersInput/PickersInput.mjs +12 -17
- package/PickersTextField/PickersInputBase/PickersInputBase.js +16 -12
- package/PickersTextField/PickersInputBase/PickersInputBase.mjs +16 -12
- package/PickersTextField/PickersInputBase/PickersInputBase.types.d.mts +34 -17
- package/PickersTextField/PickersInputBase/PickersInputBase.types.d.ts +34 -17
- package/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +10 -14
- package/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.mjs +10 -14
- package/PickersTextField/PickersTextField.js +68 -55
- package/PickersTextField/PickersTextField.mjs +68 -55
- package/PickersTextField/PickersTextField.types.d.mts +52 -40
- package/PickersTextField/PickersTextField.types.d.ts +52 -40
- package/PickersTextField/index.d.mts +1 -1
- package/PickersTextField/index.d.ts +1 -1
- package/TimeField/TimeField.js +1 -25
- package/TimeField/TimeField.mjs +1 -25
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/internals/components/PickerFieldUI.d.mts +4 -20
- package/internals/components/PickerFieldUI.d.ts +4 -20
- package/internals/components/PickerFieldUI.js +57 -49
- package/internals/components/PickerFieldUI.mjs +57 -49
- package/internals/hooks/useField/useField.js +15 -2
- package/internals/hooks/useField/useField.mjs +15 -2
- package/internals/hooks/useField/useField.utils.js +3 -9
- package/internals/hooks/useField/useField.utils.mjs +3 -9
- package/models/fields.d.mts +1 -1
- package/models/fields.d.ts +1 -1
- package/package.json +125 -125
|
@@ -24,7 +24,8 @@ var _pickersInputBaseClasses = require("./pickersInputBaseClasses");
|
|
|
24
24
|
var _PickersSectionList = require("../../PickersSectionList");
|
|
25
25
|
var _usePickerTextFieldOwnerState = require("../usePickerTextFieldOwnerState");
|
|
26
26
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
27
|
-
const _excluded = ["elements", "areAllSectionsEmpty", "defaultValue", "label", "value", "onChange", "id", "autoFocus", "endAdornment", "startAdornment", "renderSuffix", "slots", "slotProps", "contentEditable", "tabIndex", "onInput", "onPaste", "onKeyDown", "fullWidth", "name", "readOnly", "
|
|
27
|
+
const _excluded = ["elements", "areAllSectionsEmpty", "defaultValue", "label", "value", "onChange", "id", "autoFocus", "endAdornment", "startAdornment", "renderSuffix", "slots", "slotProps", "contentEditable", "tabIndex", "onInput", "onPaste", "onKeyDown", "fullWidth", "name", "readOnly", "inputRef", "sectionListRef", "onFocus", "onBlur", "classes", "ownerState"],
|
|
28
|
+
_excluded2 = ["ref"];
|
|
28
29
|
const round = value => Math.round(value * 1e5) / 1e5;
|
|
29
30
|
const PickersInputBaseRoot = exports.PickersInputBaseRoot = (0, _styles.styled)('div', {
|
|
30
31
|
name: 'MuiPickersInputBase',
|
|
@@ -267,7 +268,6 @@ const PickersInputBase = exports.PickersInputBase = /*#__PURE__*/React.forwardRe
|
|
|
267
268
|
onKeyDown,
|
|
268
269
|
name,
|
|
269
270
|
readOnly,
|
|
270
|
-
inputProps,
|
|
271
271
|
inputRef,
|
|
272
272
|
sectionListRef,
|
|
273
273
|
onFocus,
|
|
@@ -281,7 +281,6 @@ const PickersInputBase = exports.PickersInputBase = /*#__PURE__*/React.forwardRe
|
|
|
281
281
|
const activeBarRef = React.useRef(null);
|
|
282
282
|
const sectionOffsetsRef = React.useRef([]);
|
|
283
283
|
const handleRootRef = (0, _useForkRef.default)(ref, rootRef);
|
|
284
|
-
const handleInputRef = (0, _useForkRef.default)(inputProps?.ref, inputRef);
|
|
285
284
|
const muiFormControl = (0, _FormControl.useFormControl)();
|
|
286
285
|
if (!muiFormControl) {
|
|
287
286
|
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI X: PickersInputBase should always be used inside a PickersTextField component' : (0, _formatErrorMessage2.default)(152));
|
|
@@ -345,6 +344,17 @@ const PickersInputBase = exports.PickersInputBase = /*#__PURE__*/React.forwardRe
|
|
|
345
344
|
ownerState
|
|
346
345
|
});
|
|
347
346
|
const InputSectionsContainer = slots?.input || PickersInputBaseSectionsContainer;
|
|
347
|
+
const HtmlInputComponent = slots?.htmlInput || PickersInputBaseInput;
|
|
348
|
+
const _ref = (0, _useSlotProps.default)({
|
|
349
|
+
elementType: HtmlInputComponent,
|
|
350
|
+
externalSlotProps: slotProps?.htmlInput,
|
|
351
|
+
ownerState
|
|
352
|
+
}),
|
|
353
|
+
{
|
|
354
|
+
ref: resolvedHtmlInputRef
|
|
355
|
+
} = _ref,
|
|
356
|
+
htmlInputProps = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded2);
|
|
357
|
+
const handleInputRef = (0, _useForkRef.default)(resolvedHtmlInputRef, inputRef);
|
|
348
358
|
const isSingleInputRange = elements.some(element => element.content['data-range-position'] !== undefined);
|
|
349
359
|
React.useEffect(() => {
|
|
350
360
|
if (!isSingleInputRange || !ownerState.isPickerOpen) {
|
|
@@ -390,7 +400,7 @@ const PickersInputBase = exports.PickersInputBase = /*#__PURE__*/React.forwardRe
|
|
|
390
400
|
className: separatorPosition === 'before' ? _pickersInputBaseClasses.pickersInputBaseClasses.sectionBefore : _pickersInputBaseClasses.pickersInputBaseClasses.sectionAfter
|
|
391
401
|
})
|
|
392
402
|
}
|
|
393
|
-
}), endAdornment, renderSuffix ? renderSuffix((0, _extends2.default)({}, muiFormControl)) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
403
|
+
}), endAdornment, renderSuffix ? renderSuffix((0, _extends2.default)({}, muiFormControl)) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(HtmlInputComponent, (0, _extends2.default)({
|
|
394
404
|
name: name,
|
|
395
405
|
className: classes.input,
|
|
396
406
|
value: value,
|
|
@@ -405,7 +415,7 @@ const PickersInputBase = exports.PickersInputBase = /*#__PURE__*/React.forwardRe
|
|
|
405
415
|
// This allows to maintain the ability to do `inputRef.current.focus()` to focus the field
|
|
406
416
|
,
|
|
407
417
|
onFocus: handleHiddenInputFocus
|
|
408
|
-
},
|
|
418
|
+
}, htmlInputProps, {
|
|
409
419
|
ref: handleInputRef
|
|
410
420
|
})), isSingleInputRange && /*#__PURE__*/(0, _jsxRuntime.jsx)(PickersInputBaseActiveBar, {
|
|
411
421
|
className: classes.activeBar,
|
|
@@ -428,8 +438,8 @@ process.env.NODE_ENV !== "production" ? PickersInputBase.propTypes = {
|
|
|
428
438
|
* For a range value, it means that `value === [null, null]`
|
|
429
439
|
*/
|
|
430
440
|
areAllSectionsEmpty: _propTypes.default.bool.isRequired,
|
|
441
|
+
classes: _propTypes.default.object,
|
|
431
442
|
className: _propTypes.default.string,
|
|
432
|
-
component: _propTypes.default.elementType,
|
|
433
443
|
/**
|
|
434
444
|
* If true, the whole element is editable.
|
|
435
445
|
* Useful when all the sections are selected.
|
|
@@ -459,11 +469,6 @@ process.env.NODE_ENV !== "production" ? PickersInputBase.propTypes = {
|
|
|
459
469
|
* The id of the `input` element.
|
|
460
470
|
*/
|
|
461
471
|
id: _propTypes.default.string,
|
|
462
|
-
/**
|
|
463
|
-
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#attributes) applied to the `input` element.
|
|
464
|
-
* @deprecated Use `slotProps.htmlInput` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
465
|
-
*/
|
|
466
|
-
inputProps: _propTypes.default.object,
|
|
467
472
|
/**
|
|
468
473
|
* Pass a ref to the `input` element.
|
|
469
474
|
*/
|
|
@@ -508,7 +513,6 @@ process.env.NODE_ENV !== "production" ? PickersInputBase.propTypes = {
|
|
|
508
513
|
* Start `InputAdornment` for this component.
|
|
509
514
|
*/
|
|
510
515
|
startAdornment: _propTypes.default.node,
|
|
511
|
-
style: _propTypes.default.object,
|
|
512
516
|
/**
|
|
513
517
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
514
518
|
*/
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
import _formatErrorMessage from "@mui/x-internals/formatErrorMessage";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
5
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
6
|
-
const _excluded = ["elements", "areAllSectionsEmpty", "defaultValue", "label", "value", "onChange", "id", "autoFocus", "endAdornment", "startAdornment", "renderSuffix", "slots", "slotProps", "contentEditable", "tabIndex", "onInput", "onPaste", "onKeyDown", "fullWidth", "name", "readOnly", "
|
|
6
|
+
const _excluded = ["elements", "areAllSectionsEmpty", "defaultValue", "label", "value", "onChange", "id", "autoFocus", "endAdornment", "startAdornment", "renderSuffix", "slots", "slotProps", "contentEditable", "tabIndex", "onInput", "onPaste", "onKeyDown", "fullWidth", "name", "readOnly", "inputRef", "sectionListRef", "onFocus", "onBlur", "classes", "ownerState"],
|
|
7
|
+
_excluded2 = ["ref"];
|
|
7
8
|
import * as React from 'react';
|
|
8
9
|
import PropTypes from 'prop-types';
|
|
9
10
|
import { useFormControl } from '@mui/material/FormControl';
|
|
@@ -260,7 +261,6 @@ const PickersInputBase = /*#__PURE__*/React.forwardRef(function PickersInputBase
|
|
|
260
261
|
onKeyDown,
|
|
261
262
|
name,
|
|
262
263
|
readOnly,
|
|
263
|
-
inputProps,
|
|
264
264
|
inputRef,
|
|
265
265
|
sectionListRef,
|
|
266
266
|
onFocus,
|
|
@@ -274,7 +274,6 @@ const PickersInputBase = /*#__PURE__*/React.forwardRef(function PickersInputBase
|
|
|
274
274
|
const activeBarRef = React.useRef(null);
|
|
275
275
|
const sectionOffsetsRef = React.useRef([]);
|
|
276
276
|
const handleRootRef = useForkRef(ref, rootRef);
|
|
277
|
-
const handleInputRef = useForkRef(inputProps?.ref, inputRef);
|
|
278
277
|
const muiFormControl = useFormControl();
|
|
279
278
|
if (!muiFormControl) {
|
|
280
279
|
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI X: PickersInputBase should always be used inside a PickersTextField component' : _formatErrorMessage(152));
|
|
@@ -338,6 +337,17 @@ const PickersInputBase = /*#__PURE__*/React.forwardRef(function PickersInputBase
|
|
|
338
337
|
ownerState
|
|
339
338
|
});
|
|
340
339
|
const InputSectionsContainer = slots?.input || PickersInputBaseSectionsContainer;
|
|
340
|
+
const HtmlInputComponent = slots?.htmlInput || PickersInputBaseInput;
|
|
341
|
+
const _ref = useSlotProps({
|
|
342
|
+
elementType: HtmlInputComponent,
|
|
343
|
+
externalSlotProps: slotProps?.htmlInput,
|
|
344
|
+
ownerState
|
|
345
|
+
}),
|
|
346
|
+
{
|
|
347
|
+
ref: resolvedHtmlInputRef
|
|
348
|
+
} = _ref,
|
|
349
|
+
htmlInputProps = _objectWithoutPropertiesLoose(_ref, _excluded2);
|
|
350
|
+
const handleInputRef = useForkRef(resolvedHtmlInputRef, inputRef);
|
|
341
351
|
const isSingleInputRange = elements.some(element => element.content['data-range-position'] !== undefined);
|
|
342
352
|
React.useEffect(() => {
|
|
343
353
|
if (!isSingleInputRange || !ownerState.isPickerOpen) {
|
|
@@ -383,7 +393,7 @@ const PickersInputBase = /*#__PURE__*/React.forwardRef(function PickersInputBase
|
|
|
383
393
|
className: separatorPosition === 'before' ? pickersInputBaseClasses.sectionBefore : pickersInputBaseClasses.sectionAfter
|
|
384
394
|
})
|
|
385
395
|
}
|
|
386
|
-
}), endAdornment, renderSuffix ? renderSuffix(_extends({}, muiFormControl)) : null, /*#__PURE__*/_jsx(
|
|
396
|
+
}), endAdornment, renderSuffix ? renderSuffix(_extends({}, muiFormControl)) : null, /*#__PURE__*/_jsx(HtmlInputComponent, _extends({
|
|
387
397
|
name: name,
|
|
388
398
|
className: classes.input,
|
|
389
399
|
value: value,
|
|
@@ -398,7 +408,7 @@ const PickersInputBase = /*#__PURE__*/React.forwardRef(function PickersInputBase
|
|
|
398
408
|
// This allows to maintain the ability to do `inputRef.current.focus()` to focus the field
|
|
399
409
|
,
|
|
400
410
|
onFocus: handleHiddenInputFocus
|
|
401
|
-
},
|
|
411
|
+
}, htmlInputProps, {
|
|
402
412
|
ref: handleInputRef
|
|
403
413
|
})), isSingleInputRange && /*#__PURE__*/_jsx(PickersInputBaseActiveBar, {
|
|
404
414
|
className: classes.activeBar,
|
|
@@ -421,8 +431,8 @@ process.env.NODE_ENV !== "production" ? PickersInputBase.propTypes = {
|
|
|
421
431
|
* For a range value, it means that `value === [null, null]`
|
|
422
432
|
*/
|
|
423
433
|
areAllSectionsEmpty: PropTypes.bool.isRequired,
|
|
434
|
+
classes: PropTypes.object,
|
|
424
435
|
className: PropTypes.string,
|
|
425
|
-
component: PropTypes.elementType,
|
|
426
436
|
/**
|
|
427
437
|
* If true, the whole element is editable.
|
|
428
438
|
* Useful when all the sections are selected.
|
|
@@ -452,11 +462,6 @@ process.env.NODE_ENV !== "production" ? PickersInputBase.propTypes = {
|
|
|
452
462
|
* The id of the `input` element.
|
|
453
463
|
*/
|
|
454
464
|
id: PropTypes.string,
|
|
455
|
-
/**
|
|
456
|
-
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#attributes) applied to the `input` element.
|
|
457
|
-
* @deprecated Use `slotProps.htmlInput` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
458
|
-
*/
|
|
459
|
-
inputProps: PropTypes.object,
|
|
460
465
|
/**
|
|
461
466
|
* Pass a ref to the `input` element.
|
|
462
467
|
*/
|
|
@@ -501,7 +506,6 @@ process.env.NODE_ENV !== "production" ? PickersInputBase.propTypes = {
|
|
|
501
506
|
* Start `InputAdornment` for this component.
|
|
502
507
|
*/
|
|
503
508
|
startAdornment: PropTypes.node,
|
|
504
|
-
style: PropTypes.object,
|
|
505
509
|
/**
|
|
506
510
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
507
511
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { SxProps, Theme } from '@mui/material/styles';
|
|
3
3
|
import { MuiEvent } from '@mui/x-internals/types';
|
|
4
4
|
import { PickersSectionListProps } from "../../PickersSectionList/index.mjs";
|
|
5
5
|
import { PickerTextFieldOwnerState } from "../../models/fields.mjs";
|
|
@@ -42,20 +42,43 @@ export interface PickersInputPropsUsedByField extends Pick<PickersSectionListPro
|
|
|
42
42
|
* Name attribute of the `input` element.
|
|
43
43
|
*/
|
|
44
44
|
name?: string;
|
|
45
|
-
/**
|
|
46
|
-
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#attributes) applied to the `input` element.
|
|
47
|
-
* @deprecated Use `slotProps.htmlInput` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
48
|
-
*/
|
|
49
|
-
inputProps?: React.HTMLAttributes<HTMLInputElement> & {
|
|
50
|
-
ref?: React.Ref<HTMLInputElement>;
|
|
51
|
-
};
|
|
52
45
|
/**
|
|
53
46
|
* Pass a ref to the `input` element.
|
|
54
47
|
*/
|
|
55
48
|
inputRef?: React.Ref<HTMLInputElement>;
|
|
56
49
|
}
|
|
57
|
-
export interface
|
|
50
|
+
export interface PickersInputBaseSlots {
|
|
51
|
+
root?: React.ElementType;
|
|
52
|
+
input?: React.ElementType;
|
|
53
|
+
htmlInput?: React.ElementType;
|
|
54
|
+
}
|
|
55
|
+
export interface PickersInputBaseRootSlotProps extends React.ComponentPropsWithRef<'div'> {
|
|
56
|
+
/**
|
|
57
|
+
* Variant-specific. Forwarded by `PickersFilledInput` / `PickersInput` to render an underline.
|
|
58
|
+
*/
|
|
59
|
+
disableUnderline?: boolean;
|
|
60
|
+
ownerState?: PickerTextFieldOwnerState;
|
|
61
|
+
}
|
|
62
|
+
export interface PickersInputBaseInputSlotProps extends React.ComponentPropsWithRef<'div'> {
|
|
63
|
+
/**
|
|
64
|
+
* Variant-specific. Forwarded by `PickersFilledInput` to hide the label.
|
|
65
|
+
*/
|
|
66
|
+
hiddenLabel?: boolean;
|
|
58
67
|
ownerState?: PickerTextFieldOwnerState;
|
|
68
|
+
}
|
|
69
|
+
export interface PickersInputBaseSlotProps {
|
|
70
|
+
root?: PickersInputBaseRootSlotProps;
|
|
71
|
+
input?: PickersInputBaseInputSlotProps;
|
|
72
|
+
htmlInput?: React.ComponentPropsWithRef<'input'>;
|
|
73
|
+
}
|
|
74
|
+
export interface PickersInputBaseProps extends Omit<React.HTMLAttributes<HTMLDivElement>, keyof PickersInputPropsUsedByField>, PickersInputPropsUsedByField {
|
|
75
|
+
ownerState?: PickerTextFieldOwnerState;
|
|
76
|
+
className?: string;
|
|
77
|
+
classes?: Record<string, string>;
|
|
78
|
+
/**
|
|
79
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
80
|
+
*/
|
|
81
|
+
sx?: SxProps<Theme>;
|
|
59
82
|
margin?: 'dense' | 'none' | 'normal';
|
|
60
83
|
renderSuffix?: (state: {
|
|
61
84
|
disabled?: boolean;
|
|
@@ -72,17 +95,11 @@ export interface PickersInputBaseProps extends Omit<BoxProps, keyof PickersInput
|
|
|
72
95
|
*
|
|
73
96
|
* @default {}
|
|
74
97
|
*/
|
|
75
|
-
slots?:
|
|
76
|
-
root?: React.ElementType;
|
|
77
|
-
input?: React.ElementType;
|
|
78
|
-
};
|
|
98
|
+
slots?: PickersInputBaseSlots;
|
|
79
99
|
/**
|
|
80
100
|
* The props used for each component slot.
|
|
81
101
|
* @default {}
|
|
82
102
|
*/
|
|
83
|
-
slotProps?:
|
|
84
|
-
root?: any;
|
|
85
|
-
input?: any;
|
|
86
|
-
};
|
|
103
|
+
slotProps?: PickersInputBaseSlotProps;
|
|
87
104
|
'data-multi-input'?: string;
|
|
88
105
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { SxProps, Theme } from '@mui/material/styles';
|
|
3
3
|
import { MuiEvent } from '@mui/x-internals/types';
|
|
4
4
|
import { PickersSectionListProps } from "../../PickersSectionList/index.js";
|
|
5
5
|
import { PickerTextFieldOwnerState } from "../../models/fields.js";
|
|
@@ -42,20 +42,43 @@ export interface PickersInputPropsUsedByField extends Pick<PickersSectionListPro
|
|
|
42
42
|
* Name attribute of the `input` element.
|
|
43
43
|
*/
|
|
44
44
|
name?: string;
|
|
45
|
-
/**
|
|
46
|
-
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#attributes) applied to the `input` element.
|
|
47
|
-
* @deprecated Use `slotProps.htmlInput` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
48
|
-
*/
|
|
49
|
-
inputProps?: React.HTMLAttributes<HTMLInputElement> & {
|
|
50
|
-
ref?: React.Ref<HTMLInputElement>;
|
|
51
|
-
};
|
|
52
45
|
/**
|
|
53
46
|
* Pass a ref to the `input` element.
|
|
54
47
|
*/
|
|
55
48
|
inputRef?: React.Ref<HTMLInputElement>;
|
|
56
49
|
}
|
|
57
|
-
export interface
|
|
50
|
+
export interface PickersInputBaseSlots {
|
|
51
|
+
root?: React.ElementType;
|
|
52
|
+
input?: React.ElementType;
|
|
53
|
+
htmlInput?: React.ElementType;
|
|
54
|
+
}
|
|
55
|
+
export interface PickersInputBaseRootSlotProps extends React.ComponentPropsWithRef<'div'> {
|
|
56
|
+
/**
|
|
57
|
+
* Variant-specific. Forwarded by `PickersFilledInput` / `PickersInput` to render an underline.
|
|
58
|
+
*/
|
|
59
|
+
disableUnderline?: boolean;
|
|
60
|
+
ownerState?: PickerTextFieldOwnerState;
|
|
61
|
+
}
|
|
62
|
+
export interface PickersInputBaseInputSlotProps extends React.ComponentPropsWithRef<'div'> {
|
|
63
|
+
/**
|
|
64
|
+
* Variant-specific. Forwarded by `PickersFilledInput` to hide the label.
|
|
65
|
+
*/
|
|
66
|
+
hiddenLabel?: boolean;
|
|
58
67
|
ownerState?: PickerTextFieldOwnerState;
|
|
68
|
+
}
|
|
69
|
+
export interface PickersInputBaseSlotProps {
|
|
70
|
+
root?: PickersInputBaseRootSlotProps;
|
|
71
|
+
input?: PickersInputBaseInputSlotProps;
|
|
72
|
+
htmlInput?: React.ComponentPropsWithRef<'input'>;
|
|
73
|
+
}
|
|
74
|
+
export interface PickersInputBaseProps extends Omit<React.HTMLAttributes<HTMLDivElement>, keyof PickersInputPropsUsedByField>, PickersInputPropsUsedByField {
|
|
75
|
+
ownerState?: PickerTextFieldOwnerState;
|
|
76
|
+
className?: string;
|
|
77
|
+
classes?: Record<string, string>;
|
|
78
|
+
/**
|
|
79
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
80
|
+
*/
|
|
81
|
+
sx?: SxProps<Theme>;
|
|
59
82
|
margin?: 'dense' | 'none' | 'normal';
|
|
60
83
|
renderSuffix?: (state: {
|
|
61
84
|
disabled?: boolean;
|
|
@@ -72,17 +95,11 @@ export interface PickersInputBaseProps extends Omit<BoxProps, keyof PickersInput
|
|
|
72
95
|
*
|
|
73
96
|
* @default {}
|
|
74
97
|
*/
|
|
75
|
-
slots?:
|
|
76
|
-
root?: React.ElementType;
|
|
77
|
-
input?: React.ElementType;
|
|
78
|
-
};
|
|
98
|
+
slots?: PickersInputBaseSlots;
|
|
79
99
|
/**
|
|
80
100
|
* The props used for each component slot.
|
|
81
101
|
* @default {}
|
|
82
102
|
*/
|
|
83
|
-
slotProps?:
|
|
84
|
-
root?: any;
|
|
85
|
-
input?: any;
|
|
86
|
-
};
|
|
103
|
+
slotProps?: PickersInputBaseSlotProps;
|
|
87
104
|
'data-multi-input'?: string;
|
|
88
105
|
}
|
|
@@ -20,7 +20,7 @@ var _Outline = _interopRequireDefault(require("./Outline"));
|
|
|
20
20
|
var _PickersInputBase = require("../PickersInputBase");
|
|
21
21
|
var _PickersInputBase2 = require("../PickersInputBase/PickersInputBase");
|
|
22
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
|
-
const _excluded = ["label", "autoFocus", "ownerState", "classes", "notched"];
|
|
23
|
+
const _excluded = ["label", "autoFocus", "ownerState", "classes", "notched", "slots", "slotProps"];
|
|
24
24
|
const PickersOutlinedInputRoot = (0, _styles.styled)(_PickersInputBase2.PickersInputBaseRoot, {
|
|
25
25
|
name: 'MuiPickersOutlinedInput',
|
|
26
26
|
slot: 'Root'
|
|
@@ -105,16 +105,19 @@ const PickersOutlinedInput = exports.PickersOutlinedInput = /*#__PURE__*/React.f
|
|
|
105
105
|
const {
|
|
106
106
|
label,
|
|
107
107
|
classes: classesProp,
|
|
108
|
-
notched
|
|
108
|
+
notched,
|
|
109
|
+
slots: inSlots,
|
|
110
|
+
slotProps: inSlotProps
|
|
109
111
|
} = props,
|
|
110
112
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
111
113
|
const muiFormControl = (0, _FormControl.useFormControl)();
|
|
112
114
|
const classes = useUtilityClasses(classesProp);
|
|
113
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PickersInputBase.PickersInputBase, (0, _extends2.default)({
|
|
114
|
-
slots: {
|
|
115
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PickersInputBase.PickersInputBase, (0, _extends2.default)({}, other, {
|
|
116
|
+
slots: (0, _extends2.default)({
|
|
115
117
|
root: PickersOutlinedInputRoot,
|
|
116
118
|
input: PickersOutlinedInputSectionsContainer
|
|
117
|
-
},
|
|
119
|
+
}, inSlots),
|
|
120
|
+
slotProps: inSlotProps,
|
|
118
121
|
renderSuffix: state => /*#__PURE__*/(0, _jsxRuntime.jsx)(_Outline.default, {
|
|
119
122
|
shrink: Boolean(notched || state.adornedStart || state.focused || state.filled),
|
|
120
123
|
notched: Boolean(notched || state.adornedStart || state.focused || state.filled),
|
|
@@ -122,8 +125,7 @@ const PickersOutlinedInput = exports.PickersOutlinedInput = /*#__PURE__*/React.f
|
|
|
122
125
|
label: label != null && label !== '' && muiFormControl?.required ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
123
126
|
children: [label, "\u2009", '*']
|
|
124
127
|
}) : label
|
|
125
|
-
})
|
|
126
|
-
}, other, {
|
|
128
|
+
}),
|
|
127
129
|
label: label,
|
|
128
130
|
classes: classes,
|
|
129
131
|
ref: ref
|
|
@@ -141,8 +143,8 @@ process.env.NODE_ENV !== "production" ? PickersOutlinedInput.propTypes = {
|
|
|
141
143
|
* For a range value, it means that `value === [null, null]`
|
|
142
144
|
*/
|
|
143
145
|
areAllSectionsEmpty: _propTypes.default.bool.isRequired,
|
|
146
|
+
classes: _propTypes.default.object,
|
|
144
147
|
className: _propTypes.default.string,
|
|
145
|
-
component: _propTypes.default.elementType,
|
|
146
148
|
/**
|
|
147
149
|
* If true, the whole element is editable.
|
|
148
150
|
* Useful when all the sections are selected.
|
|
@@ -172,11 +174,6 @@ process.env.NODE_ENV !== "production" ? PickersOutlinedInput.propTypes = {
|
|
|
172
174
|
* The id of the `input` element.
|
|
173
175
|
*/
|
|
174
176
|
id: _propTypes.default.string,
|
|
175
|
-
/**
|
|
176
|
-
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#attributes) applied to the `input` element.
|
|
177
|
-
* @deprecated Use `slotProps.htmlInput` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
178
|
-
*/
|
|
179
|
-
inputProps: _propTypes.default.object,
|
|
180
177
|
/**
|
|
181
178
|
* Pass a ref to the `input` element.
|
|
182
179
|
*/
|
|
@@ -222,7 +219,6 @@ process.env.NODE_ENV !== "production" ? PickersOutlinedInput.propTypes = {
|
|
|
222
219
|
* Start `InputAdornment` for this component.
|
|
223
220
|
*/
|
|
224
221
|
startAdornment: _propTypes.default.node,
|
|
225
|
-
style: _propTypes.default.object,
|
|
226
222
|
/**
|
|
227
223
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
228
224
|
*/
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
4
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
5
|
-
const _excluded = ["label", "autoFocus", "ownerState", "classes", "notched"];
|
|
5
|
+
const _excluded = ["label", "autoFocus", "ownerState", "classes", "notched", "slots", "slotProps"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { useFormControl } from '@mui/material/FormControl';
|
|
@@ -98,16 +98,19 @@ const PickersOutlinedInput = /*#__PURE__*/React.forwardRef(function PickersOutli
|
|
|
98
98
|
const {
|
|
99
99
|
label,
|
|
100
100
|
classes: classesProp,
|
|
101
|
-
notched
|
|
101
|
+
notched,
|
|
102
|
+
slots: inSlots,
|
|
103
|
+
slotProps: inSlotProps
|
|
102
104
|
} = props,
|
|
103
105
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
104
106
|
const muiFormControl = useFormControl();
|
|
105
107
|
const classes = useUtilityClasses(classesProp);
|
|
106
|
-
return /*#__PURE__*/_jsx(PickersInputBase, _extends({
|
|
107
|
-
slots: {
|
|
108
|
+
return /*#__PURE__*/_jsx(PickersInputBase, _extends({}, other, {
|
|
109
|
+
slots: _extends({
|
|
108
110
|
root: PickersOutlinedInputRoot,
|
|
109
111
|
input: PickersOutlinedInputSectionsContainer
|
|
110
|
-
},
|
|
112
|
+
}, inSlots),
|
|
113
|
+
slotProps: inSlotProps,
|
|
111
114
|
renderSuffix: state => /*#__PURE__*/_jsx(Outline, {
|
|
112
115
|
shrink: Boolean(notched || state.adornedStart || state.focused || state.filled),
|
|
113
116
|
notched: Boolean(notched || state.adornedStart || state.focused || state.filled),
|
|
@@ -115,8 +118,7 @@ const PickersOutlinedInput = /*#__PURE__*/React.forwardRef(function PickersOutli
|
|
|
115
118
|
label: label != null && label !== '' && muiFormControl?.required ? /*#__PURE__*/_jsxs(React.Fragment, {
|
|
116
119
|
children: [label, "\u2009", '*']
|
|
117
120
|
}) : label
|
|
118
|
-
})
|
|
119
|
-
}, other, {
|
|
121
|
+
}),
|
|
120
122
|
label: label,
|
|
121
123
|
classes: classes,
|
|
122
124
|
ref: ref
|
|
@@ -134,8 +136,8 @@ process.env.NODE_ENV !== "production" ? PickersOutlinedInput.propTypes = {
|
|
|
134
136
|
* For a range value, it means that `value === [null, null]`
|
|
135
137
|
*/
|
|
136
138
|
areAllSectionsEmpty: PropTypes.bool.isRequired,
|
|
139
|
+
classes: PropTypes.object,
|
|
137
140
|
className: PropTypes.string,
|
|
138
|
-
component: PropTypes.elementType,
|
|
139
141
|
/**
|
|
140
142
|
* If true, the whole element is editable.
|
|
141
143
|
* Useful when all the sections are selected.
|
|
@@ -165,11 +167,6 @@ process.env.NODE_ENV !== "production" ? PickersOutlinedInput.propTypes = {
|
|
|
165
167
|
* The id of the `input` element.
|
|
166
168
|
*/
|
|
167
169
|
id: PropTypes.string,
|
|
168
|
-
/**
|
|
169
|
-
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#attributes) applied to the `input` element.
|
|
170
|
-
* @deprecated Use `slotProps.htmlInput` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
171
|
-
*/
|
|
172
|
-
inputProps: PropTypes.object,
|
|
173
170
|
/**
|
|
174
171
|
* Pass a ref to the `input` element.
|
|
175
172
|
*/
|
|
@@ -215,7 +212,6 @@ process.env.NODE_ENV !== "production" ? PickersOutlinedInput.propTypes = {
|
|
|
215
212
|
* Start `InputAdornment` for this component.
|
|
216
213
|
*/
|
|
217
214
|
startAdornment: PropTypes.node,
|
|
218
|
-
style: PropTypes.object,
|
|
219
215
|
/**
|
|
220
216
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
221
217
|
*/
|