@mui/x-date-pickers 7.0.0-alpha.5 → 7.0.0-alpha.7
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 +408 -6
- package/DateCalendar/DateCalendar.js +6 -4
- package/DateCalendar/DateCalendar.types.d.ts +0 -8
- package/DigitalClock/DigitalClock.js +3 -2
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +9 -13
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +4 -8
- package/PickersSectionList/PickersSectionList.d.ts +11 -0
- package/PickersSectionList/PickersSectionList.js +223 -0
- package/PickersSectionList/PickersSectionList.types.d.ts +56 -0
- package/PickersSectionList/index.d.ts +4 -0
- package/PickersSectionList/index.js +2 -0
- package/PickersSectionList/package.json +6 -0
- package/PickersSectionList/pickersSectionListClasses.d.ts +11 -0
- package/PickersSectionList/pickersSectionListClasses.js +6 -0
- package/TimeClock/TimeClock.js +3 -2
- package/index.d.ts +1 -0
- package/index.js +4 -1
- package/internals/components/{PickersTextField → PickersInput}/Outline.d.ts +1 -0
- package/internals/components/{PickersTextField → PickersInput}/Outline.js +35 -19
- package/internals/components/PickersInput/PickersFilledInput.d.ts +3 -0
- package/internals/components/PickersInput/PickersFilledInput.js +166 -0
- package/internals/components/PickersInput/PickersInput.d.ts +15 -0
- package/internals/components/{PickersTextField → PickersInput}/PickersInput.js +78 -106
- package/internals/components/PickersInput/PickersInput.types.d.ts +60 -0
- package/internals/components/PickersInput/PickersOutlinedInput.d.ts +3 -0
- package/internals/components/PickersInput/PickersOutlinedInput.js +117 -0
- package/internals/components/PickersInput/PickersStandardInput.d.ts +3 -0
- package/internals/components/PickersInput/PickersStandardInput.js +123 -0
- package/internals/components/PickersInput/index.d.ts +4 -0
- package/internals/components/PickersInput/index.js +3 -0
- package/internals/components/PickersInput/pickersInputClasses.d.ts +84 -0
- package/internals/components/PickersInput/pickersInputClasses.js +18 -0
- package/internals/components/PickersTextField/PickersTextField.d.ts +1 -2
- package/internals/components/PickersTextField/PickersTextField.js +15 -6
- package/internals/components/PickersTextField/PickersTextField.types.d.ts +46 -3
- package/internals/components/PickersTextField/pickersTextFieldClasses.d.ts +0 -31
- package/internals/components/PickersTextField/pickersTextFieldClasses.js +3 -6
- package/internals/hooks/useField/useField.js +8 -1
- package/internals/hooks/useViews.d.ts +4 -4
- package/internals/hooks/useViews.js +13 -13
- package/internals/models/props/clock.d.ts +0 -9
- package/legacy/DateCalendar/DateCalendar.js +6 -4
- package/legacy/DigitalClock/DigitalClock.js +3 -2
- package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.js +9 -13
- package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +4 -8
- package/legacy/PickersSectionList/PickersSectionList.js +230 -0
- package/legacy/PickersSectionList/index.js +2 -0
- package/legacy/PickersSectionList/pickersSectionListClasses.js +6 -0
- package/legacy/TimeClock/TimeClock.js +3 -2
- package/legacy/index.js +4 -1
- package/legacy/internals/components/{PickersTextField → PickersInput}/Outline.js +40 -22
- package/legacy/internals/components/PickersInput/PickersFilledInput.js +161 -0
- package/legacy/internals/components/{PickersTextField → PickersInput}/PickersInput.js +75 -90
- package/legacy/internals/components/PickersInput/PickersInput.types.js +1 -0
- package/legacy/internals/components/PickersInput/PickersOutlinedInput.js +110 -0
- package/legacy/internals/components/PickersInput/PickersStandardInput.js +117 -0
- package/legacy/internals/components/PickersInput/index.js +3 -0
- package/legacy/internals/components/PickersInput/pickersInputClasses.js +18 -0
- package/legacy/internals/components/PickersTextField/PickersTextField.js +16 -7
- package/legacy/internals/components/PickersTextField/pickersTextFieldClasses.js +3 -6
- package/legacy/internals/hooks/useField/useField.js +8 -1
- package/legacy/internals/hooks/useViews.js +13 -13
- package/legacy/locales/ruRU.js +1 -2
- package/locales/ruRU.js +1 -2
- package/modern/DateCalendar/DateCalendar.js +6 -4
- package/modern/DigitalClock/DigitalClock.js +3 -2
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +9 -13
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +4 -8
- package/modern/PickersSectionList/PickersSectionList.js +221 -0
- package/modern/PickersSectionList/PickersSectionList.types.js +1 -0
- package/modern/PickersSectionList/index.js +2 -0
- package/modern/PickersSectionList/pickersSectionListClasses.js +6 -0
- package/modern/TimeClock/TimeClock.js +3 -2
- package/modern/index.js +4 -1
- package/modern/internals/components/{PickersTextField → PickersInput}/Outline.js +35 -19
- package/modern/internals/components/PickersInput/PickersFilledInput.js +165 -0
- package/modern/internals/components/{PickersTextField → PickersInput}/PickersInput.js +78 -106
- package/modern/internals/components/PickersInput/PickersInput.types.js +1 -0
- package/modern/internals/components/PickersInput/PickersOutlinedInput.js +117 -0
- package/modern/internals/components/PickersInput/PickersStandardInput.js +123 -0
- package/modern/internals/components/PickersInput/index.js +3 -0
- package/modern/internals/components/PickersInput/pickersInputClasses.js +18 -0
- package/modern/internals/components/PickersTextField/PickersTextField.js +15 -6
- package/modern/internals/components/PickersTextField/pickersTextFieldClasses.js +3 -6
- package/modern/internals/hooks/useField/useField.js +8 -1
- package/modern/internals/hooks/useViews.js +13 -13
- package/modern/locales/ruRU.js +1 -2
- package/node/DateCalendar/DateCalendar.js +6 -4
- package/node/DigitalClock/DigitalClock.js +3 -2
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +9 -13
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +4 -8
- package/node/PickersSectionList/PickersSectionList.js +228 -0
- package/node/PickersSectionList/index.js +49 -0
- package/node/PickersSectionList/pickersSectionListClasses.js +14 -0
- package/node/TimeClock/TimeClock.js +3 -2
- package/node/index.js +13 -1
- package/node/internals/components/{PickersTextField → PickersInput}/Outline.js +35 -19
- package/node/internals/components/PickersInput/PickersFilledInput.js +174 -0
- package/node/internals/components/{PickersTextField → PickersInput}/PickersInput.js +80 -108
- package/node/internals/components/PickersInput/PickersInput.types.js +5 -0
- package/node/internals/components/PickersInput/PickersOutlinedInput.js +125 -0
- package/node/internals/components/PickersInput/PickersStandardInput.js +132 -0
- package/node/internals/components/PickersInput/index.js +32 -0
- package/node/internals/components/PickersInput/pickersInputClasses.js +29 -0
- package/node/internals/components/PickersTextField/PickersTextField.js +15 -6
- package/node/internals/components/PickersTextField/pickersTextFieldClasses.js +6 -9
- package/node/internals/hooks/useField/useField.js +8 -1
- package/node/internals/hooks/useViews.js +13 -13
- package/node/locales/ruRU.js +1 -2
- package/package.json +5 -5
- package/internals/components/PickersTextField/PickersInput.d.ts +0 -3
- package/internals/components/PickersTextField/PickersInput.types.d.ts +0 -45
- /package/{internals/components/PickersTextField/PickersInput.types.js → PickersSectionList/PickersSectionList.types.js} +0 -0
- /package/{legacy/internals/components/PickersTextField → internals/components/PickersInput}/PickersInput.types.js +0 -0
- /package/{modern/internals/components/PickersTextField/PickersInput.types.js → legacy/PickersSectionList/PickersSectionList.types.js} +0 -0
- /package/node/{internals/components/PickersTextField/PickersInput.types.js → PickersSectionList/PickersSectionList.types.js} +0 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
export interface PickersInputClasses {
|
|
2
|
+
/** Styles applied to the root element. */
|
|
3
|
+
root: string;
|
|
4
|
+
/** Styles applied to the root element if focused. */
|
|
5
|
+
focused: string;
|
|
6
|
+
/** State class applied to the root element if `disabled=true`. */
|
|
7
|
+
disabled: string;
|
|
8
|
+
/** State class applied to the root element if `readOnly=true`. */
|
|
9
|
+
readOnly: string;
|
|
10
|
+
/** State class applied to the root element if `error=true`. */
|
|
11
|
+
error: string;
|
|
12
|
+
/** Styles applied to the NotchedOutline element. */
|
|
13
|
+
notchedOutline: string;
|
|
14
|
+
/** Styles applied to the real hidden input element. */
|
|
15
|
+
input: string;
|
|
16
|
+
/** Styles applied to the container of the sections. */
|
|
17
|
+
sectionsContainer: string;
|
|
18
|
+
/** Styles applied to the content of a section. */
|
|
19
|
+
sectionContent: string;
|
|
20
|
+
/** Styles applied to the separator before a section */
|
|
21
|
+
sectionBefore: string;
|
|
22
|
+
/** Styles applied to the separator after a section */
|
|
23
|
+
sectionAfter: string;
|
|
24
|
+
/** Styles applied to the root if there is a startAdornment present */
|
|
25
|
+
adornedStart: string;
|
|
26
|
+
/** Styles applied to the root if there is an endAdornment present */
|
|
27
|
+
adornedEnd: string;
|
|
28
|
+
/** Styles applied to the root element unless `disableUnderline={true}`. */
|
|
29
|
+
underline?: string;
|
|
30
|
+
}
|
|
31
|
+
export type PickersInputClassKey = keyof PickersInputClasses;
|
|
32
|
+
export declare function getPickersInputUtilityClass(slot: string): string;
|
|
33
|
+
export declare function getPickersOutlinedInputUtilityClass(slot: string): string;
|
|
34
|
+
export declare function getPickersFilledInputUtilityClass(slot: string): string;
|
|
35
|
+
export declare function getPickersStandardInputUtilityClass(slot: string): string;
|
|
36
|
+
export declare const pickersInputClasses: Record<keyof PickersInputClasses, string>;
|
|
37
|
+
export declare const pickersOutlinedInputClasses: {
|
|
38
|
+
underline: string;
|
|
39
|
+
disabled: string;
|
|
40
|
+
input: string;
|
|
41
|
+
readOnly: string;
|
|
42
|
+
error: string;
|
|
43
|
+
focused: string;
|
|
44
|
+
root: string;
|
|
45
|
+
adornedStart: string;
|
|
46
|
+
adornedEnd: string;
|
|
47
|
+
notchedOutline: string;
|
|
48
|
+
sectionContent: string;
|
|
49
|
+
sectionsContainer: string;
|
|
50
|
+
sectionBefore: string;
|
|
51
|
+
sectionAfter: string;
|
|
52
|
+
};
|
|
53
|
+
export declare const pickersFilledInputClasses: {
|
|
54
|
+
underline: string;
|
|
55
|
+
disabled: string;
|
|
56
|
+
input: string;
|
|
57
|
+
readOnly: string;
|
|
58
|
+
error: string;
|
|
59
|
+
focused: string;
|
|
60
|
+
root: string;
|
|
61
|
+
adornedStart: string;
|
|
62
|
+
adornedEnd: string;
|
|
63
|
+
notchedOutline: string;
|
|
64
|
+
sectionContent: string;
|
|
65
|
+
sectionsContainer: string;
|
|
66
|
+
sectionBefore: string;
|
|
67
|
+
sectionAfter: string;
|
|
68
|
+
};
|
|
69
|
+
export declare const pickersStandardInputClasses: {
|
|
70
|
+
underline: string;
|
|
71
|
+
disabled: string;
|
|
72
|
+
input: string;
|
|
73
|
+
readOnly: string;
|
|
74
|
+
error: string;
|
|
75
|
+
focused: string;
|
|
76
|
+
root: string;
|
|
77
|
+
adornedStart: string;
|
|
78
|
+
adornedEnd: string;
|
|
79
|
+
notchedOutline: string;
|
|
80
|
+
sectionContent: string;
|
|
81
|
+
sectionsContainer: string;
|
|
82
|
+
sectionBefore: string;
|
|
83
|
+
sectionAfter: string;
|
|
84
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import { unstable_generateUtilityClass as generateUtilityClass, unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
|
|
3
|
+
export function getPickersInputUtilityClass(slot) {
|
|
4
|
+
return generateUtilityClass('MuiPickersInput', slot);
|
|
5
|
+
}
|
|
6
|
+
export function getPickersOutlinedInputUtilityClass(slot) {
|
|
7
|
+
return generateUtilityClass('MuiPickersOutlinedInput', slot);
|
|
8
|
+
}
|
|
9
|
+
export function getPickersFilledInputUtilityClass(slot) {
|
|
10
|
+
return generateUtilityClass('MuiPickersFilledInput', slot);
|
|
11
|
+
}
|
|
12
|
+
export function getPickersStandardInputUtilityClass(slot) {
|
|
13
|
+
return generateUtilityClass('MuiPickersStandardInput', slot);
|
|
14
|
+
}
|
|
15
|
+
export const pickersInputClasses = generateUtilityClasses('MuiPickersInput', ['root', 'focused', 'disabled', 'error', 'notchedOutline', 'sectionContent', 'sectionBefore', 'sectionAfter', 'adornedStart', 'adornedEnd', 'input']);
|
|
16
|
+
export const pickersOutlinedInputClasses = _extends({}, pickersInputClasses, generateUtilityClasses('MuiPickersOutlinedInput', ['root', 'notchedOutline', 'input']));
|
|
17
|
+
export const pickersFilledInputClasses = _extends({}, pickersInputClasses, generateUtilityClasses('MuiPickersFilledInput', ['root', 'underline', 'input']));
|
|
18
|
+
export const pickersStandardInputClasses = _extends({}, pickersInputClasses, generateUtilityClasses('MuiPickersStandardInput', ['root', 'underline', 'input']));
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import
|
|
3
|
-
export declare const PickersTextField: React.ForwardRefExoticComponent<Omit<PickersTextFieldProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
2
|
+
export declare const PickersTextField: React.ForwardRefExoticComponent<(Omit<import("./PickersTextField.types").PickersStandardTextFieldProps, "ref"> | Omit<import("./PickersTextField.types").PickersOutlinedTextFieldProps, "ref"> | Omit<import("./PickersTextField.types").PickersFilledTextFieldProps, "ref">) & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["onFocus", "onBlur", "className", "color", "disabled", "error", "
|
|
3
|
+
const _excluded = ["onFocus", "onBlur", "className", "color", "disabled", "error", "variant", "required", "InputProps", "inputProps", "inputRef", "sectionListRef", "elements", "areAllSectionsEmpty", "onClick", "onKeyDown", "onKeyUp", "onPaste", "onInput", "endAdornment", "startAdornment", "tabIndex", "contentEditable", "focused", "value", "onChange", "fullWidth", "id", "helperText", "FormHelperTextProps", "label", "InputLabelProps"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import { styled } from '@mui/material/styles';
|
|
@@ -10,9 +10,16 @@ import InputLabel from '@mui/material/InputLabel';
|
|
|
10
10
|
import FormHelperText from '@mui/material/FormHelperText';
|
|
11
11
|
import FormControl from '@mui/material/FormControl';
|
|
12
12
|
import { getPickersTextFieldUtilityClass } from './pickersTextFieldClasses';
|
|
13
|
-
import {
|
|
13
|
+
import { PickersOutlinedInput } from '../PickersInput/PickersOutlinedInput';
|
|
14
|
+
import { PickersFilledInput } from '../PickersInput/PickersFilledInput';
|
|
15
|
+
import { PickersStandardInput } from '../PickersInput/PickersStandardInput';
|
|
14
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
17
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
|
+
const VARIANT_COMPONENT = {
|
|
19
|
+
standard: PickersStandardInput,
|
|
20
|
+
filled: PickersFilledInput,
|
|
21
|
+
outlined: PickersOutlinedInput
|
|
22
|
+
};
|
|
16
23
|
const PickersTextFieldRoot = styled(FormControl, {
|
|
17
24
|
name: 'MuiPickersTextField',
|
|
18
25
|
slot: 'Root',
|
|
@@ -39,13 +46,13 @@ export const PickersTextField = /*#__PURE__*/React.forwardRef(function PickersTe
|
|
|
39
46
|
color = 'primary',
|
|
40
47
|
disabled = false,
|
|
41
48
|
error = false,
|
|
42
|
-
required = false,
|
|
43
49
|
variant = 'outlined',
|
|
50
|
+
required = false,
|
|
44
51
|
// Props used by PickersInput
|
|
45
52
|
InputProps,
|
|
46
53
|
inputProps,
|
|
47
54
|
inputRef,
|
|
48
|
-
|
|
55
|
+
sectionListRef,
|
|
49
56
|
elements,
|
|
50
57
|
areAllSectionsEmpty,
|
|
51
58
|
onClick,
|
|
@@ -83,6 +90,7 @@ export const PickersTextField = /*#__PURE__*/React.forwardRef(function PickersTe
|
|
|
83
90
|
variant
|
|
84
91
|
});
|
|
85
92
|
const classes = useUtilityClasses(ownerState);
|
|
93
|
+
const PickersInputComponent = VARIANT_COMPONENT[variant];
|
|
86
94
|
return /*#__PURE__*/_jsxs(PickersTextFieldRoot, _extends({
|
|
87
95
|
className: clsx(classes.root, className),
|
|
88
96
|
ref: handleRootRef,
|
|
@@ -93,6 +101,7 @@ export const PickersTextField = /*#__PURE__*/React.forwardRef(function PickersTe
|
|
|
93
101
|
variant: variant,
|
|
94
102
|
error: error,
|
|
95
103
|
color: color,
|
|
104
|
+
fullWidth: fullWidth,
|
|
96
105
|
required: required,
|
|
97
106
|
ownerState: ownerState
|
|
98
107
|
}, other, {
|
|
@@ -101,7 +110,7 @@ export const PickersTextField = /*#__PURE__*/React.forwardRef(function PickersTe
|
|
|
101
110
|
id: inputLabelId
|
|
102
111
|
}, InputLabelProps, {
|
|
103
112
|
children: label
|
|
104
|
-
})), /*#__PURE__*/_jsx(
|
|
113
|
+
})), /*#__PURE__*/_jsx(PickersInputComponent, _extends({
|
|
105
114
|
elements: elements,
|
|
106
115
|
areAllSectionsEmpty: areAllSectionsEmpty,
|
|
107
116
|
onClick: onClick,
|
|
@@ -118,7 +127,7 @@ export const PickersTextField = /*#__PURE__*/React.forwardRef(function PickersTe
|
|
|
118
127
|
fullWidth: fullWidth,
|
|
119
128
|
inputProps: inputProps,
|
|
120
129
|
inputRef: inputRef,
|
|
121
|
-
|
|
130
|
+
sectionListRef: sectionListRef,
|
|
122
131
|
label: label
|
|
123
132
|
}, InputProps)), helperText && /*#__PURE__*/_jsx(FormHelperText, _extends({
|
|
124
133
|
id: helperTextId
|
|
@@ -2,15 +2,15 @@ import * as React from 'react';
|
|
|
2
2
|
import { FormControlProps } from '@mui/material/FormControl';
|
|
3
3
|
import { FormHelperTextProps } from '@mui/material/FormHelperText';
|
|
4
4
|
import { InputLabelProps } from '@mui/material/InputLabel';
|
|
5
|
-
import {
|
|
5
|
+
import { TextFieldVariants } from '@mui/material/TextField';
|
|
6
|
+
import { PickersFilledInputProps, PickersInputPropsUsedByField, PickersOutlinedInputProps, PickersStandardInputProps } from '../PickersInput/PickersInput.types';
|
|
6
7
|
interface PickersTextFieldPropsUsedByField {
|
|
7
8
|
onFocus: React.FocusEventHandler<HTMLDivElement>;
|
|
8
9
|
onBlur: React.FocusEventHandler<HTMLDivElement>;
|
|
9
10
|
disabled: boolean;
|
|
10
11
|
error: boolean;
|
|
11
12
|
}
|
|
12
|
-
export interface
|
|
13
|
-
InputProps?: PickersInputOtherProps;
|
|
13
|
+
export interface PickersBaseTextFieldProps extends PickersInputPropsUsedByField, PickersTextFieldPropsUsedByField, Omit<FormControlProps, keyof PickersInputPropsUsedByField | keyof PickersTextFieldPropsUsedByField> {
|
|
14
14
|
FormHelperTextProps?: Partial<FormHelperTextProps>;
|
|
15
15
|
InputLabelProps?: Partial<InputLabelProps>;
|
|
16
16
|
/**
|
|
@@ -18,4 +18,47 @@ export interface PickersTextFieldProps extends PickersInputPropsUsedByField, Pic
|
|
|
18
18
|
*/
|
|
19
19
|
helperText?: React.ReactNode;
|
|
20
20
|
}
|
|
21
|
+
export interface PickersStandardTextFieldProps extends PickersBaseTextFieldProps {
|
|
22
|
+
/**
|
|
23
|
+
* The variant to use.
|
|
24
|
+
* @default 'outlined'
|
|
25
|
+
*/
|
|
26
|
+
variant?: 'standard';
|
|
27
|
+
/**
|
|
28
|
+
* Props applied to the Input element.
|
|
29
|
+
* It will be a [`FilledInput`](/material-ui/api/filled-input/),
|
|
30
|
+
* [`OutlinedInput`](/material-ui/api/outlined-input/) or [`Input`](/material-ui/api/input/)
|
|
31
|
+
* component depending on the `variant` prop value.
|
|
32
|
+
*/
|
|
33
|
+
InputProps?: Partial<PickersStandardInputProps>;
|
|
34
|
+
}
|
|
35
|
+
export interface PickersOutlinedTextFieldProps extends PickersBaseTextFieldProps {
|
|
36
|
+
/**
|
|
37
|
+
* The variant to use.
|
|
38
|
+
* @default 'outlined'
|
|
39
|
+
*/
|
|
40
|
+
variant?: 'outlined';
|
|
41
|
+
/**
|
|
42
|
+
* Props applied to the Input element.
|
|
43
|
+
* It will be a [`FilledInput`](/material-ui/api/filled-input/),
|
|
44
|
+
* [`OutlinedInput`](/material-ui/api/outlined-input/) or [`Input`](/material-ui/api/input/)
|
|
45
|
+
* component depending on the `variant` prop value.
|
|
46
|
+
*/
|
|
47
|
+
InputProps?: Partial<PickersOutlinedInputProps>;
|
|
48
|
+
}
|
|
49
|
+
export interface PickersFilledTextFieldProps extends PickersBaseTextFieldProps {
|
|
50
|
+
/**
|
|
51
|
+
* The variant to use.
|
|
52
|
+
* @default 'outlined'
|
|
53
|
+
*/
|
|
54
|
+
variant?: 'filled';
|
|
55
|
+
/**
|
|
56
|
+
* Props applied to the Input element.
|
|
57
|
+
* It will be a [`FilledInput`](/material-ui/api/filled-input/),
|
|
58
|
+
* [`OutlinedInput`](/material-ui/api/outlined-input/) or [`Input`](/material-ui/api/input/)
|
|
59
|
+
* component depending on the `variant` prop value.
|
|
60
|
+
*/
|
|
61
|
+
InputProps?: Partial<PickersFilledInputProps>;
|
|
62
|
+
}
|
|
63
|
+
export type PickersTextFieldProps<Variant extends TextFieldVariants = TextFieldVariants> = Variant extends 'filled' ? PickersFilledTextFieldProps : Variant extends 'standard' ? PickersStandardTextFieldProps : PickersOutlinedTextFieldProps;
|
|
21
64
|
export {};
|
|
@@ -13,34 +13,3 @@ export interface PickersTextFieldClasses {
|
|
|
13
13
|
export type PickersTextFieldClassKey = keyof PickersTextFieldClasses;
|
|
14
14
|
export declare function getPickersTextFieldUtilityClass(slot: string): string;
|
|
15
15
|
export declare const pickersTextFieldClasses: Record<keyof PickersTextFieldClasses, string>;
|
|
16
|
-
export interface PickersInputClasses {
|
|
17
|
-
/** Styles applied to the root element. */
|
|
18
|
-
root: string;
|
|
19
|
-
/** Styles applied to the root element if focused. */
|
|
20
|
-
focused: string;
|
|
21
|
-
/** State class applied to the root element if `disabled=true`. */
|
|
22
|
-
disabled: string;
|
|
23
|
-
/** State class applied to the root element if `readOnly=true`. */
|
|
24
|
-
readOnly: string;
|
|
25
|
-
/** State class applied to the root element if `error=true`. */
|
|
26
|
-
error: string;
|
|
27
|
-
/** Styles applied to the NotchedOutline element. */
|
|
28
|
-
notchedOutline: string;
|
|
29
|
-
/** Styles applied to the real hidden input element. */
|
|
30
|
-
input: string;
|
|
31
|
-
/** Styles applied to the container of the sections. */
|
|
32
|
-
sectionsContainer: string;
|
|
33
|
-
/** Styles applied to the content of a section. */
|
|
34
|
-
sectionContent: string;
|
|
35
|
-
/** Styles applied to the separator before a section */
|
|
36
|
-
sectionBefore: string;
|
|
37
|
-
/** Styles applied to the separator after a section */
|
|
38
|
-
sectionAfter: string;
|
|
39
|
-
/** Styles applied to the root if there is a startAdornment present */
|
|
40
|
-
adornedStart: string;
|
|
41
|
-
/** Styles applied to the root if there is an endAdornment present */
|
|
42
|
-
adornedEnd: string;
|
|
43
|
-
}
|
|
44
|
-
export type PickersInputClassKey = keyof PickersInputClasses;
|
|
45
|
-
export declare function getPickersInputUtilityClass(slot: string): string;
|
|
46
|
-
export declare const pickersInputClasses: Record<keyof PickersInputClasses, string>;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
2
|
+
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
2
3
|
export function getPickersTextFieldUtilityClass(slot) {
|
|
3
4
|
return generateUtilityClass('MuiPickersTextField', slot);
|
|
4
5
|
}
|
|
5
|
-
export const pickersTextFieldClasses = generateUtilityClasses('MuiPickersTextField', ['root', 'focused', 'disabled', 'error', 'required']);
|
|
6
|
-
export function getPickersInputUtilityClass(slot) {
|
|
7
|
-
return generateUtilityClass('MuiPickersInput', slot);
|
|
8
|
-
}
|
|
9
|
-
export const pickersInputClasses = generateUtilityClasses('MuiPickersInput', ['root', 'focused', 'disabled', 'error', 'notchedOutline', 'adornedStart', 'adornedEnd', 'input', 'sectionsContainer', 'sectionContent', 'sectionBefore', 'sectionAfter']);
|
|
6
|
+
export const pickersTextFieldClasses = generateUtilityClasses('MuiPickersTextField', ['root', 'focused', 'disabled', 'error', 'required']);
|
|
@@ -143,7 +143,14 @@ export const useField = params => {
|
|
|
143
143
|
const digitsAndLetterOnly = /^(([a-zA-Z]+)|)([0-9]+)(([a-zA-Z]+)|)$/.test(pastedValue);
|
|
144
144
|
const isValidPastedValue = activeSection.contentType === 'letter' && lettersOnly || activeSection.contentType === 'digit' && digitsOnly || activeSection.contentType === 'digit-with-letter' && digitsAndLetterOnly;
|
|
145
145
|
if (isValidPastedValue) {
|
|
146
|
-
|
|
146
|
+
resetCharacterQuery();
|
|
147
|
+
updateSectionValue({
|
|
148
|
+
activeSection,
|
|
149
|
+
newSectionValue: pastedValue,
|
|
150
|
+
shouldGoToNextSection: true
|
|
151
|
+
});
|
|
152
|
+
// prevent default to avoid the input change handler being called
|
|
153
|
+
event.preventDefault();
|
|
147
154
|
return;
|
|
148
155
|
}
|
|
149
156
|
if (lettersOnly || digitsOnly) {
|
|
@@ -5,7 +5,8 @@ export type PickerOnChangeFn<TDate> = (date: TDate | null, selectionState?: Pick
|
|
|
5
5
|
export interface UseViewsOptions<TValue, TView extends DateOrTimeViewWithMeridiem> {
|
|
6
6
|
/**
|
|
7
7
|
* Callback fired when the value changes.
|
|
8
|
-
* @template TValue
|
|
8
|
+
* @template TValue The value type. Will be either the same type as `value` or `null`. Can be in `[start, end]` format in case of range value.
|
|
9
|
+
* @template TView The view type. Will be one of date or time views.
|
|
9
10
|
* @param {TValue} value The new value.
|
|
10
11
|
* @param {PickerSelectionState | undefined} selectionState Indicates if the date selection is complete.
|
|
11
12
|
* @param {TView | undefined} selectedView Indicates the view in which the selection has been made.
|
|
@@ -52,7 +53,7 @@ export interface UseViewsOptions<TValue, TView extends DateOrTimeViewWithMeridie
|
|
|
52
53
|
*/
|
|
53
54
|
onFocusedViewChange?: (view: TView, hasFocus: boolean) => void;
|
|
54
55
|
}
|
|
55
|
-
export interface ExportedUseViewsOptions<TView extends DateOrTimeViewWithMeridiem> extends MakeOptional<
|
|
56
|
+
export interface ExportedUseViewsOptions<TView extends DateOrTimeViewWithMeridiem> extends MakeOptional<UseViewsOptions<any, TView>, 'onChange' | 'openTo' | 'views'> {
|
|
56
57
|
}
|
|
57
58
|
interface UseViewsResponse<TValue, TView extends DateOrTimeViewWithMeridiem> {
|
|
58
59
|
view: TView;
|
|
@@ -63,8 +64,7 @@ interface UseViewsResponse<TValue, TView extends DateOrTimeViewWithMeridiem> {
|
|
|
63
64
|
previousView: TView | null;
|
|
64
65
|
defaultView: TView;
|
|
65
66
|
goToNextView: () => void;
|
|
66
|
-
setValueAndGoToNextView: (value: TValue, currentViewSelectionState?: PickerSelectionState) => void;
|
|
67
|
-
setValueAndGoToView: (value: TValue, newView: TView | null, selectedView: TView) => void;
|
|
67
|
+
setValueAndGoToNextView: (value: TValue, currentViewSelectionState?: PickerSelectionState, selectedView?: TView) => void;
|
|
68
68
|
}
|
|
69
69
|
export declare function useViews<TValue, TView extends DateOrTimeViewWithMeridiem>({ onChange, onViewChange, openTo, view: inView, views, autoFocus, focusedView: inFocusedView, onFocusedViewChange, }: UseViewsOptions<TValue, TView>): UseViewsResponse<TValue, TView>;
|
|
70
70
|
export {};
|
|
@@ -64,11 +64,12 @@ export function useViews({
|
|
|
64
64
|
onFocusedViewChange == null || onFocusedViewChange(viewToFocus, hasFocus);
|
|
65
65
|
});
|
|
66
66
|
const handleChangeView = useEventCallback(newView => {
|
|
67
|
+
// always keep the focused view in sync
|
|
68
|
+
handleFocusedViewChange(newView, true);
|
|
67
69
|
if (newView === view) {
|
|
68
70
|
return;
|
|
69
71
|
}
|
|
70
72
|
setView(newView);
|
|
71
|
-
handleFocusedViewChange(newView, true);
|
|
72
73
|
if (onViewChange) {
|
|
73
74
|
onViewChange(newView);
|
|
74
75
|
}
|
|
@@ -77,7 +78,6 @@ export function useViews({
|
|
|
77
78
|
if (nextView) {
|
|
78
79
|
handleChangeView(nextView);
|
|
79
80
|
}
|
|
80
|
-
handleFocusedViewChange(nextView, true);
|
|
81
81
|
});
|
|
82
82
|
const setValueAndGoToNextView = useEventCallback((value, currentViewSelectionState, selectedView) => {
|
|
83
83
|
const isSelectionFinishedOnCurrentView = currentViewSelectionState === 'finish';
|
|
@@ -86,18 +86,19 @@ export function useViews({
|
|
|
86
86
|
// but when it's not the final view given all `views` -> overall selection state should be `partial`.
|
|
87
87
|
views.indexOf(selectedView) < views.length - 1 : Boolean(nextView);
|
|
88
88
|
const globalSelectionState = isSelectionFinishedOnCurrentView && hasMoreViews ? 'partial' : currentViewSelectionState;
|
|
89
|
-
onChange(value, globalSelectionState);
|
|
90
|
-
if
|
|
89
|
+
onChange(value, globalSelectionState, selectedView);
|
|
90
|
+
// Detects if the selected view is not the active one.
|
|
91
|
+
// Can happen if multiple views are displayed, like in `DesktopDateTimePicker` or `MultiSectionDigitalClock`.
|
|
92
|
+
if (selectedView && selectedView !== view) {
|
|
93
|
+
const nextViewAfterSelected = views[views.indexOf(selectedView) + 1];
|
|
94
|
+
if (nextViewAfterSelected) {
|
|
95
|
+
// move to next view after the selected one
|
|
96
|
+
handleChangeView(nextViewAfterSelected);
|
|
97
|
+
}
|
|
98
|
+
} else if (isSelectionFinishedOnCurrentView) {
|
|
91
99
|
goToNextView();
|
|
92
100
|
}
|
|
93
101
|
});
|
|
94
|
-
const setValueAndGoToView = useEventCallback((value, newView, selectedView) => {
|
|
95
|
-
onChange(value, newView ? 'partial' : 'finish', selectedView);
|
|
96
|
-
if (newView) {
|
|
97
|
-
handleChangeView(newView);
|
|
98
|
-
handleFocusedViewChange(newView, true);
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
102
|
return {
|
|
102
103
|
view,
|
|
103
104
|
setView: handleChangeView,
|
|
@@ -108,7 +109,6 @@ export function useViews({
|
|
|
108
109
|
// Always return up-to-date default view instead of the initial one (i.e. defaultView.current)
|
|
109
110
|
defaultView: views.includes(openTo) ? openTo : views[0],
|
|
110
111
|
goToNextView,
|
|
111
|
-
setValueAndGoToNextView
|
|
112
|
-
setValueAndGoToView
|
|
112
|
+
setValueAndGoToNextView
|
|
113
113
|
};
|
|
114
114
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { SxProps, Theme } from '@mui/material/styles';
|
|
2
2
|
import { BaseTimeValidationProps, TimeValidationProps } from '../validation';
|
|
3
|
-
import { PickerSelectionState } from '../../hooks/usePicker/usePickerValue.types';
|
|
4
3
|
import { TimeStepOptions, TimezoneProps } from '../../../models';
|
|
5
4
|
import type { ExportedDigitalClockProps } from '../../../DigitalClock/DigitalClock.types';
|
|
6
5
|
import type { ExportedMultiSectionDigitalClockProps } from '../../../MultiSectionDigitalClock/MultiSectionDigitalClock.types';
|
|
@@ -29,14 +28,6 @@ export interface BaseClockProps<TDate, TView extends TimeViewWithMeridiem> exten
|
|
|
29
28
|
* Used when the component is not controlled.
|
|
30
29
|
*/
|
|
31
30
|
defaultValue?: TDate | null;
|
|
32
|
-
/**
|
|
33
|
-
* Callback fired when the value changes.
|
|
34
|
-
* @template TDate, TView
|
|
35
|
-
* @param {TDate | null} value The new value.
|
|
36
|
-
* @param {PickerSelectionState | undefined} selectionState Indicates if the date selection is complete.
|
|
37
|
-
* @param {TView | undefined} selectedView Indicates the view in which the selection has been made.
|
|
38
|
-
*/
|
|
39
|
-
onChange?: (value: TDate | null, selectionState?: PickerSelectionState, selectedView?: TView) => void;
|
|
40
31
|
/**
|
|
41
32
|
* If `true`, the picker views and text field are disabled.
|
|
42
33
|
* @default false
|
|
@@ -255,9 +255,9 @@ export var DateCalendar = /*#__PURE__*/React.forwardRef(function DateCalendar(in
|
|
|
255
255
|
var handleSelectedDayChange = useEventCallback(function (day) {
|
|
256
256
|
if (day) {
|
|
257
257
|
// If there is a date already selected, then we want to keep its time
|
|
258
|
-
return handleValueChange(mergeDateAndTime(utils, day, value != null ? value : referenceDate), 'finish');
|
|
258
|
+
return handleValueChange(mergeDateAndTime(utils, day, value != null ? value : referenceDate), 'finish', view);
|
|
259
259
|
}
|
|
260
|
-
return handleValueChange(day, 'finish');
|
|
260
|
+
return handleValueChange(day, 'finish', view);
|
|
261
261
|
});
|
|
262
262
|
React.useEffect(function () {
|
|
263
263
|
if (value != null && utils.isValid(value)) {
|
|
@@ -434,9 +434,11 @@ process.env.NODE_ENV !== "production" ? DateCalendar.propTypes = {
|
|
|
434
434
|
monthsPerRow: PropTypes.oneOf([3, 4]),
|
|
435
435
|
/**
|
|
436
436
|
* Callback fired when the value changes.
|
|
437
|
-
* @template
|
|
438
|
-
* @
|
|
437
|
+
* @template TValue The value type. Will be either the same type as `value` or `null`. Can be in `[start, end]` format in case of range value.
|
|
438
|
+
* @template TView The view type. Will be one of date or time views.
|
|
439
|
+
* @param {TValue} value The new value.
|
|
439
440
|
* @param {PickerSelectionState | undefined} selectionState Indicates if the date selection is complete.
|
|
441
|
+
* @param {TView | undefined} selectedView Indicates the view in which the selection has been made.
|
|
440
442
|
*/
|
|
441
443
|
onChange: PropTypes.func,
|
|
442
444
|
/**
|
|
@@ -347,8 +347,9 @@ process.env.NODE_ENV !== "production" ? DigitalClock.propTypes = {
|
|
|
347
347
|
minutesStep: PropTypes.number,
|
|
348
348
|
/**
|
|
349
349
|
* Callback fired when the value changes.
|
|
350
|
-
* @template
|
|
351
|
-
* @
|
|
350
|
+
* @template TValue The value type. Will be either the same type as `value` or `null`. Can be in `[start, end]` format in case of range value.
|
|
351
|
+
* @template TView The view type. Will be one of date or time views.
|
|
352
|
+
* @param {TValue} value The new value.
|
|
352
353
|
* @param {PickerSelectionState | undefined} selectionState Indicates if the date selection is complete.
|
|
353
354
|
* @param {TView | undefined} selectedView Indicates the view in which the selection has been made.
|
|
354
355
|
*/
|
|
@@ -140,10 +140,10 @@ export var MultiSectionDigitalClock = /*#__PURE__*/React.forwardRef(function Mul
|
|
|
140
140
|
onFocusedViewChange: onFocusedViewChange
|
|
141
141
|
}),
|
|
142
142
|
view = _useViews.view,
|
|
143
|
-
|
|
143
|
+
setValueAndGoToNextView = _useViews.setValueAndGoToNextView,
|
|
144
144
|
focusedView = _useViews.focusedView;
|
|
145
145
|
var handleMeridiemValueChange = useEventCallback(function (newValue) {
|
|
146
|
-
|
|
146
|
+
setValueAndGoToNextView(newValue, 'finish', 'meridiem');
|
|
147
147
|
});
|
|
148
148
|
var _useMeridiemMode = useMeridiemMode(valueOrReferenceDate, ampm, handleMeridiemValueChange, 'finish'),
|
|
149
149
|
meridiemMode = _useMeridiemMode.meridiemMode,
|
|
@@ -223,11 +223,6 @@ export var MultiSectionDigitalClock = /*#__PURE__*/React.forwardRef(function Mul
|
|
|
223
223
|
throw new Error('not supported');
|
|
224
224
|
}
|
|
225
225
|
}, [ampm, valueOrReferenceDate, disableIgnoringDatePartForTimeValidation, maxTime, meridiemMode, minTime, minutesStep, shouldDisableTime, utils, disableFuture, disablePast, now, views]);
|
|
226
|
-
var handleSectionChange = useEventCallback(function (sectionView, newValue) {
|
|
227
|
-
var viewIndex = views.indexOf(sectionView);
|
|
228
|
-
var nextView = views[viewIndex + 1];
|
|
229
|
-
setValueAndGoToView(newValue, nextView, sectionView);
|
|
230
|
-
});
|
|
231
226
|
var buildViewProps = React.useCallback(function (viewToBuild) {
|
|
232
227
|
switch (viewToBuild) {
|
|
233
228
|
case 'hours':
|
|
@@ -235,7 +230,7 @@ export var MultiSectionDigitalClock = /*#__PURE__*/React.forwardRef(function Mul
|
|
|
235
230
|
return {
|
|
236
231
|
onChange: function onChange(hours) {
|
|
237
232
|
var valueWithMeridiem = convertValueToMeridiem(hours, meridiemMode, ampm);
|
|
238
|
-
|
|
233
|
+
setValueAndGoToNextView(utils.setHours(valueOrReferenceDate, valueWithMeridiem), 'finish', 'hours');
|
|
239
234
|
},
|
|
240
235
|
items: getHourSectionOptions({
|
|
241
236
|
now: now,
|
|
@@ -255,7 +250,7 @@ export var MultiSectionDigitalClock = /*#__PURE__*/React.forwardRef(function Mul
|
|
|
255
250
|
{
|
|
256
251
|
return {
|
|
257
252
|
onChange: function onChange(minutes) {
|
|
258
|
-
|
|
253
|
+
setValueAndGoToNextView(utils.setMinutes(valueOrReferenceDate, minutes), 'finish', 'minutes');
|
|
259
254
|
},
|
|
260
255
|
items: getTimeSectionOptions({
|
|
261
256
|
value: utils.getMinutes(valueOrReferenceDate),
|
|
@@ -276,7 +271,7 @@ export var MultiSectionDigitalClock = /*#__PURE__*/React.forwardRef(function Mul
|
|
|
276
271
|
{
|
|
277
272
|
return {
|
|
278
273
|
onChange: function onChange(seconds) {
|
|
279
|
-
|
|
274
|
+
setValueAndGoToNextView(utils.setSeconds(valueOrReferenceDate, seconds), 'finish', 'seconds');
|
|
280
275
|
},
|
|
281
276
|
items: getTimeSectionOptions({
|
|
282
277
|
value: utils.getSeconds(valueOrReferenceDate),
|
|
@@ -325,7 +320,7 @@ export var MultiSectionDigitalClock = /*#__PURE__*/React.forwardRef(function Mul
|
|
|
325
320
|
default:
|
|
326
321
|
throw new Error("Unknown view: ".concat(viewToBuild, " found."));
|
|
327
322
|
}
|
|
328
|
-
}, [now, value, ampm, utils, timeSteps.hours, timeSteps.minutes, timeSteps.seconds, localeText.hoursClockNumberText, localeText.minutesClockNumberText, localeText.secondsClockNumberText, meridiemMode,
|
|
323
|
+
}, [now, value, ampm, utils, timeSteps.hours, timeSteps.minutes, timeSteps.seconds, localeText.hoursClockNumberText, localeText.minutesClockNumberText, localeText.secondsClockNumberText, meridiemMode, setValueAndGoToNextView, valueOrReferenceDate, disabled, isTimeDisabled, handleMeridiemChange]);
|
|
329
324
|
var viewTimeOptions = React.useMemo(function () {
|
|
330
325
|
return views.reduce(function (result, currentView) {
|
|
331
326
|
return _extends({}, result, _defineProperty({}, currentView, buildViewProps(currentView)));
|
|
@@ -426,8 +421,9 @@ process.env.NODE_ENV !== "production" ? MultiSectionDigitalClock.propTypes = {
|
|
|
426
421
|
minutesStep: PropTypes.number,
|
|
427
422
|
/**
|
|
428
423
|
* Callback fired when the value changes.
|
|
429
|
-
* @template
|
|
430
|
-
* @
|
|
424
|
+
* @template TValue The value type. Will be either the same type as `value` or `null`. Can be in `[start, end]` format in case of range value.
|
|
425
|
+
* @template TView The view type. Will be one of date or time views.
|
|
426
|
+
* @param {TValue} value The new value.
|
|
431
427
|
* @param {PickerSelectionState | undefined} selectionState Indicates if the date selection is complete.
|
|
432
428
|
* @param {TView | undefined} selectedView Indicates the view in which the selection has been made.
|
|
433
429
|
*/
|
|
@@ -47,7 +47,7 @@ var MultiSectionDigitalClockSectionRoot = styled(MenuList, {
|
|
|
47
47
|
'&:not(:first-of-type)': {
|
|
48
48
|
borderLeft: "1px solid ".concat((theme.vars || theme).palette.divider)
|
|
49
49
|
},
|
|
50
|
-
'
|
|
50
|
+
'&::after': {
|
|
51
51
|
display: 'block',
|
|
52
52
|
content: '""',
|
|
53
53
|
// subtracting the height of one item, extra margin and borders to make sure the max height is correct
|
|
@@ -121,17 +121,13 @@ export var MultiSectionDigitalClockSection = /*#__PURE__*/React.forwardRef(funct
|
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
123
123
|
var activeItem = containerRef.current.querySelector('[role="option"][tabindex="0"], [role="option"][aria-selected="true"]');
|
|
124
|
+
if (active && autoFocus && activeItem) {
|
|
125
|
+
activeItem.focus();
|
|
126
|
+
}
|
|
124
127
|
if (!activeItem || previousActive.current === activeItem) {
|
|
125
|
-
// Handle setting the ref to null if the selected item is ever reset via UI
|
|
126
|
-
if (previousActive.current !== activeItem) {
|
|
127
|
-
previousActive.current = activeItem;
|
|
128
|
-
}
|
|
129
128
|
return;
|
|
130
129
|
}
|
|
131
130
|
previousActive.current = activeItem;
|
|
132
|
-
if (active && autoFocus) {
|
|
133
|
-
activeItem.focus();
|
|
134
|
-
}
|
|
135
131
|
var offsetTop = activeItem.offsetTop;
|
|
136
132
|
|
|
137
133
|
// Subtracting the 4px of extra margin intended for the first visible section item
|