@mui/x-date-pickers 8.0.0-alpha.4 → 8.0.0-alpha.5
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 +103 -0
- package/MonthCalendar/MonthCalendar.d.ts +1 -1
- package/MonthCalendar/MonthCalendar.js +31 -11
- package/MonthCalendar/MonthCalendar.types.d.ts +2 -2
- package/MonthCalendar/MonthCalendarButton.d.ts +24 -0
- package/MonthCalendar/{PickersMonth.js → MonthCalendarButton.js} +20 -61
- package/MonthCalendar/index.d.ts +0 -3
- package/MonthCalendar/index.js +1 -2
- package/MonthCalendar/monthCalendarClasses.d.ts +7 -1
- package/MonthCalendar/monthCalendarClasses.js +1 -1
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +3 -0
- package/PickersSectionList/PickersSectionList.js +21 -16
- package/PickersSectionList/PickersSectionList.types.d.ts +13 -6
- package/PickersTextField/PickersFilledInput/PickersFilledInput.d.ts +7 -0
- package/PickersTextField/PickersFilledInput/PickersFilledInput.js +34 -28
- package/PickersTextField/PickersFilledInput/pickersFilledInputClasses.d.ts +1 -1
- package/PickersTextField/PickersInput/PickersInput.js +20 -14
- package/PickersTextField/PickersInput/pickersInputClasses.d.ts +3 -2
- package/PickersTextField/PickersInput/pickersInputClasses.js +1 -1
- package/PickersTextField/PickersInputBase/PickersInputBase.d.ts +3 -6
- package/PickersTextField/PickersInputBase/PickersInputBase.js +36 -37
- package/PickersTextField/PickersInputBase/PickersInputBase.types.d.ts +1 -0
- package/PickersTextField/PickersOutlinedInput/Outline.d.ts +0 -1
- package/PickersTextField/PickersOutlinedInput/Outline.js +13 -10
- package/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +8 -14
- package/PickersTextField/PickersTextField.js +75 -62
- package/PickersTextField/PickersTextField.types.d.ts +43 -4
- package/PickersTextField/usePickerTextFieldOwnerState.d.ts +4 -0
- package/PickersTextField/usePickerTextFieldOwnerState.js +11 -0
- package/TimeClock/Clock.d.ts +4 -0
- package/TimeClock/Clock.js +9 -6
- package/TimeClock/TimeClock.js +21 -4
- package/YearCalendar/YearCalendar.js +46 -13
- package/YearCalendar/YearCalendar.types.d.ts +2 -2
- package/YearCalendar/YearCalendarButton.d.ts +23 -0
- package/YearCalendar/{PickersYear.js → YearCalendarButton.js} +20 -59
- package/YearCalendar/index.d.ts +0 -3
- package/YearCalendar/index.js +1 -2
- package/YearCalendar/yearCalendarClasses.d.ts +7 -1
- package/YearCalendar/yearCalendarClasses.js +1 -1
- package/index.js +1 -1
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +3 -3
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.types.d.ts +1 -1
- package/internals/hooks/useFieldOwnerState.d.ts +1 -0
- package/internals/hooks/useFieldOwnerState.js +6 -2
- package/models/fields.d.ts +11 -1
- package/modern/MonthCalendar/MonthCalendar.js +31 -11
- package/modern/MonthCalendar/{PickersMonth.js → MonthCalendarButton.js} +20 -61
- package/modern/MonthCalendar/index.js +1 -2
- package/modern/MonthCalendar/monthCalendarClasses.js +1 -1
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +3 -0
- package/modern/PickersSectionList/PickersSectionList.js +21 -16
- package/modern/PickersTextField/PickersFilledInput/PickersFilledInput.js +34 -28
- package/modern/PickersTextField/PickersInput/PickersInput.js +20 -14
- package/modern/PickersTextField/PickersInput/pickersInputClasses.js +1 -1
- package/modern/PickersTextField/PickersInputBase/PickersInputBase.js +36 -37
- package/modern/PickersTextField/PickersOutlinedInput/Outline.js +13 -10
- package/modern/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +8 -14
- package/modern/PickersTextField/PickersTextField.js +75 -62
- package/modern/PickersTextField/usePickerTextFieldOwnerState.js +11 -0
- package/modern/TimeClock/Clock.js +9 -6
- package/modern/TimeClock/TimeClock.js +21 -4
- package/modern/YearCalendar/YearCalendar.js +46 -13
- package/modern/YearCalendar/{PickersYear.js → YearCalendarButton.js} +20 -59
- package/modern/YearCalendar/index.js +1 -2
- package/modern/YearCalendar/yearCalendarClasses.js +1 -1
- package/modern/index.js +1 -1
- package/modern/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +3 -3
- package/modern/internals/hooks/useFieldOwnerState.js +6 -2
- package/node/MonthCalendar/MonthCalendar.js +31 -11
- package/node/MonthCalendar/{PickersMonth.js → MonthCalendarButton.js} +20 -61
- package/node/MonthCalendar/index.js +1 -8
- package/node/MonthCalendar/monthCalendarClasses.js +1 -1
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +3 -0
- package/node/PickersSectionList/PickersSectionList.js +21 -16
- package/node/PickersTextField/PickersFilledInput/PickersFilledInput.js +34 -28
- package/node/PickersTextField/PickersInput/PickersInput.js +20 -14
- package/node/PickersTextField/PickersInput/pickersInputClasses.js +1 -1
- package/node/PickersTextField/PickersInputBase/PickersInputBase.js +36 -37
- package/node/PickersTextField/PickersOutlinedInput/Outline.js +13 -10
- package/node/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +8 -14
- package/node/PickersTextField/PickersTextField.js +75 -62
- package/node/PickersTextField/usePickerTextFieldOwnerState.js +18 -0
- package/node/TimeClock/Clock.js +9 -6
- package/node/TimeClock/TimeClock.js +21 -4
- package/node/YearCalendar/YearCalendar.js +45 -12
- package/node/YearCalendar/{PickersYear.js → YearCalendarButton.js} +20 -59
- package/node/YearCalendar/index.js +1 -8
- package/node/YearCalendar/yearCalendarClasses.js +1 -1
- package/node/index.js +1 -1
- package/node/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +3 -3
- package/node/internals/hooks/useFieldOwnerState.js +6 -2
- package/package.json +3 -3
- package/themeAugmentation/components.d.ts +0 -8
- package/themeAugmentation/overrides.d.ts +2 -4
- package/themeAugmentation/props.d.ts +2 -4
- package/MonthCalendar/PickersMonth.d.ts +0 -28
- package/MonthCalendar/pickersMonthClasses.d.ts +0 -13
- package/MonthCalendar/pickersMonthClasses.js +0 -5
- package/YearCalendar/PickersYear.d.ts +0 -27
- package/YearCalendar/pickersYearClasses.d.ts +0 -13
- package/YearCalendar/pickersYearClasses.js +0 -5
- package/modern/MonthCalendar/pickersMonthClasses.js +0 -5
- package/modern/YearCalendar/pickersYearClasses.js +0 -5
- package/node/MonthCalendar/pickersMonthClasses.js +0 -12
- package/node/YearCalendar/pickersYearClasses.js +0 -12
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["label", "autoFocus", "disableUnderline", "
|
|
3
|
+
const _excluded = ["label", "autoFocus", "disableUnderline", "hiddenLabel", "classes"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import { useFormControl } from '@mui/material/FormControl';
|
|
7
6
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
8
7
|
import { shouldForwardProp } from '@mui/system';
|
|
9
8
|
import { refType } from '@mui/utils';
|
|
@@ -11,6 +10,7 @@ import composeClasses from '@mui/utils/composeClasses';
|
|
|
11
10
|
import { pickersFilledInputClasses, getPickersFilledInputUtilityClass } from "./pickersFilledInputClasses.js";
|
|
12
11
|
import { PickersInputBase } from "../PickersInputBase/index.js";
|
|
13
12
|
import { PickersInputBaseRoot, PickersInputBaseSectionsContainer } from "../PickersInputBase/PickersInputBase.js";
|
|
13
|
+
import { usePickerTextFieldOwnerState } from "../usePickerTextFieldOwnerState.js";
|
|
14
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
15
|
const PickersFilledInputRoot = styled(PickersInputBaseRoot, {
|
|
16
16
|
name: 'MuiPickersFilledInput',
|
|
@@ -50,7 +50,7 @@ const PickersFilledInputRoot = styled(PickersInputBaseRoot, {
|
|
|
50
50
|
// @ts-ignore
|
|
51
51
|
.filter(key => (theme.vars ?? theme).palette[key].main).map(color => ({
|
|
52
52
|
props: {
|
|
53
|
-
color,
|
|
53
|
+
inputColor: color,
|
|
54
54
|
disableUnderline: false
|
|
55
55
|
},
|
|
56
56
|
style: {
|
|
@@ -109,16 +109,16 @@ const PickersFilledInputRoot = styled(PickersInputBaseRoot, {
|
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
}, {
|
|
112
|
-
props:
|
|
113
|
-
|
|
114
|
-
}
|
|
112
|
+
props: {
|
|
113
|
+
hasStartAdornment: true
|
|
114
|
+
},
|
|
115
115
|
style: {
|
|
116
116
|
paddingLeft: 12
|
|
117
117
|
}
|
|
118
118
|
}, {
|
|
119
|
-
props:
|
|
120
|
-
|
|
121
|
-
}
|
|
119
|
+
props: {
|
|
120
|
+
hasEndAdornment: true
|
|
121
|
+
},
|
|
122
122
|
style: {
|
|
123
123
|
paddingRight: 12
|
|
124
124
|
}
|
|
@@ -128,7 +128,8 @@ const PickersFilledInputRoot = styled(PickersInputBaseRoot, {
|
|
|
128
128
|
const PickersFilledSectionsContainer = styled(PickersInputBaseSectionsContainer, {
|
|
129
129
|
name: 'MuiPickersFilledInput',
|
|
130
130
|
slot: 'sectionsContainer',
|
|
131
|
-
overridesResolver: (props, styles) => styles.sectionsContainer
|
|
131
|
+
overridesResolver: (props, styles) => styles.sectionsContainer,
|
|
132
|
+
shouldForwardProp: prop => shouldForwardProp(prop) && prop !== 'hiddenLabel'
|
|
132
133
|
})({
|
|
133
134
|
paddingTop: 25,
|
|
134
135
|
paddingRight: 12,
|
|
@@ -136,23 +137,23 @@ const PickersFilledSectionsContainer = styled(PickersInputBaseSectionsContainer,
|
|
|
136
137
|
paddingLeft: 12,
|
|
137
138
|
variants: [{
|
|
138
139
|
props: {
|
|
139
|
-
|
|
140
|
+
inputSize: 'small'
|
|
140
141
|
},
|
|
141
142
|
style: {
|
|
142
143
|
paddingTop: 21,
|
|
143
144
|
paddingBottom: 4
|
|
144
145
|
}
|
|
145
146
|
}, {
|
|
146
|
-
props:
|
|
147
|
-
|
|
148
|
-
}
|
|
147
|
+
props: {
|
|
148
|
+
hasStartAdornment: true
|
|
149
|
+
},
|
|
149
150
|
style: {
|
|
150
151
|
paddingLeft: 0
|
|
151
152
|
}
|
|
152
153
|
}, {
|
|
153
|
-
props:
|
|
154
|
-
|
|
155
|
-
}
|
|
154
|
+
props: {
|
|
155
|
+
hasEndAdornment: true
|
|
156
|
+
},
|
|
156
157
|
style: {
|
|
157
158
|
paddingRight: 0
|
|
158
159
|
}
|
|
@@ -167,7 +168,7 @@ const PickersFilledSectionsContainer = styled(PickersInputBaseSectionsContainer,
|
|
|
167
168
|
}, {
|
|
168
169
|
props: {
|
|
169
170
|
hiddenLabel: true,
|
|
170
|
-
|
|
171
|
+
inputSize: 'small'
|
|
171
172
|
},
|
|
172
173
|
style: {
|
|
173
174
|
paddingTop: 8,
|
|
@@ -175,18 +176,18 @@ const PickersFilledSectionsContainer = styled(PickersInputBaseSectionsContainer,
|
|
|
175
176
|
}
|
|
176
177
|
}]
|
|
177
178
|
});
|
|
178
|
-
const useUtilityClasses = ownerState => {
|
|
179
|
+
const useUtilityClasses = (classes, ownerState) => {
|
|
179
180
|
const {
|
|
180
|
-
|
|
181
|
-
disableUnderline
|
|
181
|
+
inputHasUnderline
|
|
182
182
|
} = ownerState;
|
|
183
183
|
const slots = {
|
|
184
|
-
root: ['root',
|
|
184
|
+
root: ['root', inputHasUnderline && 'underline'],
|
|
185
185
|
input: ['input']
|
|
186
186
|
};
|
|
187
187
|
const composedClasses = composeClasses(slots, getPickersFilledInputUtilityClass, classes);
|
|
188
188
|
return _extends({}, classes, composedClasses);
|
|
189
189
|
};
|
|
190
|
+
|
|
190
191
|
/**
|
|
191
192
|
* @ignore - internal component.
|
|
192
193
|
*/
|
|
@@ -198,14 +199,15 @@ const PickersFilledInput = /*#__PURE__*/React.forwardRef(function PickersFilledI
|
|
|
198
199
|
const {
|
|
199
200
|
label,
|
|
200
201
|
disableUnderline = false,
|
|
201
|
-
|
|
202
|
+
hiddenLabel = false,
|
|
203
|
+
classes: classesProp
|
|
202
204
|
} = props,
|
|
203
205
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
204
|
-
const
|
|
205
|
-
const ownerState = _extends({},
|
|
206
|
-
|
|
206
|
+
const pickerTextFieldOwnerState = usePickerTextFieldOwnerState();
|
|
207
|
+
const ownerState = _extends({}, pickerTextFieldOwnerState, {
|
|
208
|
+
inputHasUnderline: !disableUnderline
|
|
207
209
|
});
|
|
208
|
-
const classes = useUtilityClasses(ownerState);
|
|
210
|
+
const classes = useUtilityClasses(classesProp, ownerState);
|
|
209
211
|
return /*#__PURE__*/_jsx(PickersInputBase, _extends({
|
|
210
212
|
slots: {
|
|
211
213
|
root: PickersFilledInputRoot,
|
|
@@ -214,12 +216,16 @@ const PickersFilledInput = /*#__PURE__*/React.forwardRef(function PickersFilledI
|
|
|
214
216
|
slotProps: {
|
|
215
217
|
root: {
|
|
216
218
|
disableUnderline
|
|
219
|
+
},
|
|
220
|
+
input: {
|
|
221
|
+
hiddenLabel
|
|
217
222
|
}
|
|
218
223
|
}
|
|
219
224
|
}, other, {
|
|
220
225
|
label: label,
|
|
221
226
|
classes: classes,
|
|
222
|
-
ref: ref
|
|
227
|
+
ref: ref,
|
|
228
|
+
ownerState: ownerState
|
|
223
229
|
}));
|
|
224
230
|
});
|
|
225
231
|
process.env.NODE_ENV !== "production" ? PickersFilledInput.propTypes = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PickersInputBaseClasses } from '../PickersInputBase';
|
|
2
2
|
export interface PickersFilledInputClasses extends PickersInputBaseClasses {
|
|
3
3
|
/** Styles applied to the root element unless `disableUnderline={true}`. */
|
|
4
|
-
underline
|
|
4
|
+
underline: string;
|
|
5
5
|
}
|
|
6
6
|
export type PickersFilledInputClassKey = keyof PickersFilledInputClasses;
|
|
7
7
|
export declare function getPickersFilledInputUtilityClass(slot: string): string;
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["label", "autoFocus", "disableUnderline", "ownerState"];
|
|
3
|
+
const _excluded = ["label", "autoFocus", "disableUnderline", "ownerState", "classes"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import { useFormControl } from '@mui/material/FormControl';
|
|
7
6
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
7
|
+
import { shouldForwardProp } from '@mui/system/createStyled';
|
|
8
8
|
import { refType } from '@mui/utils';
|
|
9
9
|
import composeClasses from '@mui/utils/composeClasses';
|
|
10
10
|
import { pickersInputClasses, getPickersInputUtilityClass } from "./pickersInputClasses.js";
|
|
11
11
|
import { PickersInputBase } from "../PickersInputBase/index.js";
|
|
12
12
|
import { PickersInputBaseRoot } from "../PickersInputBase/PickersInputBase.js";
|
|
13
|
+
import { usePickerTextFieldOwnerState } from "../usePickerTextFieldOwnerState.js";
|
|
13
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
15
|
const PickersInputRoot = styled(PickersInputBaseRoot, {
|
|
15
16
|
name: 'MuiPickersInput',
|
|
16
17
|
slot: 'Root',
|
|
17
|
-
overridesResolver: (props, styles) => styles.root
|
|
18
|
+
overridesResolver: (props, styles) => styles.root,
|
|
19
|
+
shouldForwardProp: prop => shouldForwardProp(prop) && prop !== 'disableUnderline'
|
|
18
20
|
})(({
|
|
19
21
|
theme
|
|
20
22
|
}) => {
|
|
@@ -31,7 +33,7 @@ const PickersInputRoot = styled(PickersInputBaseRoot, {
|
|
|
31
33
|
// @ts-ignore
|
|
32
34
|
.filter(key => (theme.vars ?? theme).palette[key].main).map(color => ({
|
|
33
35
|
props: {
|
|
34
|
-
color
|
|
36
|
+
inputColor: color
|
|
35
37
|
},
|
|
36
38
|
style: {
|
|
37
39
|
'&::after': {
|
|
@@ -96,18 +98,18 @@ const PickersInputRoot = styled(PickersInputBaseRoot, {
|
|
|
96
98
|
}]
|
|
97
99
|
};
|
|
98
100
|
});
|
|
99
|
-
const useUtilityClasses = ownerState => {
|
|
101
|
+
const useUtilityClasses = (classes, ownerState) => {
|
|
100
102
|
const {
|
|
101
|
-
|
|
102
|
-
disableUnderline
|
|
103
|
+
inputHasUnderline
|
|
103
104
|
} = ownerState;
|
|
104
105
|
const slots = {
|
|
105
|
-
root: ['root', !
|
|
106
|
+
root: ['root', !inputHasUnderline && 'underline'],
|
|
106
107
|
input: ['input']
|
|
107
108
|
};
|
|
108
109
|
const composedClasses = composeClasses(slots, getPickersInputUtilityClass, classes);
|
|
109
110
|
return _extends({}, classes, composedClasses);
|
|
110
111
|
};
|
|
112
|
+
|
|
111
113
|
/**
|
|
112
114
|
* @ignore - internal component.
|
|
113
115
|
*/
|
|
@@ -119,18 +121,22 @@ const PickersInput = /*#__PURE__*/React.forwardRef(function PickersInput(inProps
|
|
|
119
121
|
const {
|
|
120
122
|
label,
|
|
121
123
|
disableUnderline = false,
|
|
122
|
-
|
|
124
|
+
classes: classesProp
|
|
123
125
|
} = props,
|
|
124
126
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
125
|
-
const
|
|
126
|
-
const ownerState = _extends({},
|
|
127
|
-
disableUnderline
|
|
128
|
-
color: muiFormControl?.color || 'primary'
|
|
127
|
+
const pickerTextFieldOwnerState = usePickerTextFieldOwnerState();
|
|
128
|
+
const ownerState = _extends({}, pickerTextFieldOwnerState, {
|
|
129
|
+
inputHasUnderline: !disableUnderline
|
|
129
130
|
});
|
|
130
|
-
const classes = useUtilityClasses(ownerState);
|
|
131
|
+
const classes = useUtilityClasses(classesProp, ownerState);
|
|
131
132
|
return /*#__PURE__*/_jsx(PickersInputBase, _extends({
|
|
132
133
|
slots: {
|
|
133
134
|
root: PickersInputRoot
|
|
135
|
+
},
|
|
136
|
+
slotProps: {
|
|
137
|
+
root: {
|
|
138
|
+
disableUnderline
|
|
139
|
+
}
|
|
134
140
|
}
|
|
135
141
|
}, other, {
|
|
136
142
|
label: label,
|
|
@@ -6,11 +6,12 @@ export interface PickersInputClasses extends PickersInputBaseClasses {
|
|
|
6
6
|
export type PickersInputClassKey = keyof PickersInputClasses;
|
|
7
7
|
export declare function getPickersInputUtilityClass(slot: string): string;
|
|
8
8
|
export declare const pickersInputClasses: {
|
|
9
|
-
|
|
9
|
+
underline: string;
|
|
10
10
|
input: string;
|
|
11
|
+
root: string;
|
|
12
|
+
disabled: string;
|
|
11
13
|
readOnly: string;
|
|
12
14
|
error: string;
|
|
13
|
-
root: string;
|
|
14
15
|
focused: string;
|
|
15
16
|
adornedStart: string;
|
|
16
17
|
adornedEnd: string;
|
|
@@ -5,4 +5,4 @@ import { pickersInputBaseClasses } from "../PickersInputBase/index.js";
|
|
|
5
5
|
export function getPickersInputUtilityClass(slot) {
|
|
6
6
|
return generateUtilityClass('MuiPickersFilledInput', slot);
|
|
7
7
|
}
|
|
8
|
-
export const pickersInputClasses = _extends({}, pickersInputBaseClasses, generateUtilityClasses('MuiPickersInput', ['root', 'input']));
|
|
8
|
+
export const pickersInputClasses = _extends({}, pickersInputBaseClasses, generateUtilityClasses('MuiPickersInput', ['root', 'underline', 'input']));
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { FormControlState } from '@mui/material/FormControl';
|
|
3
2
|
import { PickersInputBaseProps } from './PickersInputBase.types';
|
|
3
|
+
import { PickerTextFieldOwnerState } from '../PickersTextField.types';
|
|
4
4
|
export declare const PickersInputBaseRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
5
|
-
ownerState:
|
|
5
|
+
ownerState: PickerTextFieldOwnerState;
|
|
6
6
|
}, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, {}>;
|
|
7
7
|
export declare const PickersInputBaseSectionsContainer: import("@emotion/styled").StyledComponent<Pick<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement> | keyof import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
8
|
-
ownerState:
|
|
8
|
+
ownerState: PickerTextFieldOwnerState;
|
|
9
9
|
}, {}, {}>;
|
|
10
|
-
interface OwnerStateType extends FormControlState, Omit<PickersInputBaseProps, keyof FormControlState> {
|
|
11
|
-
isRtl: boolean;
|
|
12
|
-
}
|
|
13
10
|
/**
|
|
14
11
|
* @ignore - internal component.
|
|
15
12
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["elements", "areAllSectionsEmpty", "defaultValue", "label", "value", "onChange", "id", "autoFocus", "endAdornment", "startAdornment", "renderSuffix", "slots", "slotProps", "contentEditable", "tabIndex", "onInput", "onPaste", "onKeyDown", "fullWidth", "name", "readOnly", "inputProps", "inputRef", "sectionListRef", "onFocus", "onBlur"];
|
|
3
|
+
const _excluded = ["elements", "areAllSectionsEmpty", "defaultValue", "label", "value", "onChange", "id", "autoFocus", "endAdornment", "startAdornment", "renderSuffix", "slots", "slotProps", "contentEditable", "tabIndex", "onInput", "onPaste", "onKeyDown", "fullWidth", "name", "readOnly", "inputProps", "inputRef", "sectionListRef", "onFocus", "onBlur", "classes", "ownerState"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { useFormControl } from '@mui/material/FormControl';
|
|
@@ -11,9 +11,9 @@ import composeClasses from '@mui/utils/composeClasses';
|
|
|
11
11
|
import capitalize from '@mui/utils/capitalize';
|
|
12
12
|
import useSlotProps from '@mui/utils/useSlotProps';
|
|
13
13
|
import visuallyHidden from '@mui/utils/visuallyHidden';
|
|
14
|
-
import { useRtl } from '@mui/system/RtlProvider';
|
|
15
14
|
import { pickersInputBaseClasses, getPickersInputBaseUtilityClass } from "./pickersInputBaseClasses.js";
|
|
16
15
|
import { Unstable_PickersSectionList as PickersSectionList, Unstable_PickersSectionListRoot as PickersSectionListRoot, Unstable_PickersSectionListSection as PickersSectionListSection, Unstable_PickersSectionListSectionSeparator as PickersSectionListSectionSeparator, Unstable_PickersSectionListSectionContent as PickersSectionListSectionContent } from "../../PickersSectionList/index.js";
|
|
16
|
+
import { usePickerTextFieldOwnerState } from "../usePickerTextFieldOwnerState.js";
|
|
17
17
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
18
|
const round = value => Math.round(value * 1e5) / 1e5;
|
|
19
19
|
export const PickersInputBaseRoot = styled('div', {
|
|
@@ -35,7 +35,7 @@ export const PickersInputBaseRoot = styled('div', {
|
|
|
35
35
|
letterSpacing: `${round(0.15 / 16)}em`,
|
|
36
36
|
variants: [{
|
|
37
37
|
props: {
|
|
38
|
-
|
|
38
|
+
isInputInFullWidth: true
|
|
39
39
|
},
|
|
40
40
|
style: {
|
|
41
41
|
width: '100%'
|
|
@@ -64,36 +64,35 @@ export const PickersInputBaseSectionsContainer = styled(PickersSectionListRoot,
|
|
|
64
64
|
width: '182px',
|
|
65
65
|
variants: [{
|
|
66
66
|
props: {
|
|
67
|
-
|
|
67
|
+
fieldDirection: 'rtl'
|
|
68
68
|
},
|
|
69
69
|
style: {
|
|
70
70
|
textAlign: 'right /*! @noflip */'
|
|
71
71
|
}
|
|
72
72
|
}, {
|
|
73
73
|
props: {
|
|
74
|
-
|
|
74
|
+
inputSize: 'small'
|
|
75
75
|
},
|
|
76
76
|
style: {
|
|
77
77
|
paddingTop: 1
|
|
78
78
|
}
|
|
79
79
|
}, {
|
|
80
80
|
props: {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
hasStartAdornment: false,
|
|
82
|
+
isFieldFocused: false,
|
|
83
|
+
isFieldValueEmpty: true
|
|
84
84
|
},
|
|
85
85
|
style: {
|
|
86
86
|
color: 'currentColor',
|
|
87
87
|
opacity: 0
|
|
88
88
|
}
|
|
89
89
|
}, {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}) => !adornedStart && !focused && !filled && label == null,
|
|
90
|
+
props: {
|
|
91
|
+
hasStartAdornment: false,
|
|
92
|
+
isFieldFocused: false,
|
|
93
|
+
isFieldValueEmpty: true,
|
|
94
|
+
inputHasLabel: false
|
|
95
|
+
},
|
|
97
96
|
style: theme.vars ? {
|
|
98
97
|
opacity: theme.vars.opacity.inputPlaceholder
|
|
99
98
|
} : {
|
|
@@ -142,21 +141,20 @@ const PickersInputBaseInput = styled('input', {
|
|
|
142
141
|
slot: 'Input',
|
|
143
142
|
overridesResolver: (props, styles) => styles.hiddenInput
|
|
144
143
|
})(_extends({}, visuallyHidden));
|
|
145
|
-
const useUtilityClasses = ownerState => {
|
|
144
|
+
const useUtilityClasses = (classes, ownerState) => {
|
|
146
145
|
const {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
startAdornment
|
|
146
|
+
isFieldFocused,
|
|
147
|
+
isFieldDisabled,
|
|
148
|
+
isFieldReadOnly,
|
|
149
|
+
hasFieldError,
|
|
150
|
+
inputSize,
|
|
151
|
+
isInputInFullWidth,
|
|
152
|
+
inputColor,
|
|
153
|
+
hasStartAdornment,
|
|
154
|
+
hasEndAdornment
|
|
157
155
|
} = ownerState;
|
|
158
156
|
const slots = {
|
|
159
|
-
root: ['root',
|
|
157
|
+
root: ['root', isFieldFocused && !isFieldDisabled && 'focused', isFieldDisabled && 'disabled', isFieldReadOnly && 'readOnly', hasFieldError && 'error', isInputInFullWidth && 'fullWidth', `color${capitalize(inputColor)}`, inputSize === 'small' && 'inputSizeSmall', hasStartAdornment && 'adornedStart', hasEndAdornment && 'adornedEnd'],
|
|
160
158
|
notchedOutline: ['notchedOutline'],
|
|
161
159
|
input: ['input'],
|
|
162
160
|
sectionsContainer: ['sectionsContainer'],
|
|
@@ -166,6 +164,7 @@ const useUtilityClasses = ownerState => {
|
|
|
166
164
|
};
|
|
167
165
|
return composeClasses(slots, getPickersInputBaseUtilityClass, classes);
|
|
168
166
|
};
|
|
167
|
+
|
|
169
168
|
/**
|
|
170
169
|
* @ignore - internal component.
|
|
171
170
|
*/
|
|
@@ -196,17 +195,20 @@ const PickersInputBase = /*#__PURE__*/React.forwardRef(function PickersInputBase
|
|
|
196
195
|
inputRef,
|
|
197
196
|
sectionListRef,
|
|
198
197
|
onFocus,
|
|
199
|
-
onBlur
|
|
198
|
+
onBlur,
|
|
199
|
+
classes: classesProp,
|
|
200
|
+
ownerState: ownerStateProp
|
|
200
201
|
} = props,
|
|
201
202
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
203
|
+
const ownerStateContext = usePickerTextFieldOwnerState();
|
|
202
204
|
const rootRef = React.useRef(null);
|
|
203
205
|
const handleRootRef = useForkRef(ref, rootRef);
|
|
204
206
|
const handleInputRef = useForkRef(inputProps?.ref, inputRef);
|
|
205
|
-
const isRtl = useRtl();
|
|
206
207
|
const muiFormControl = useFormControl();
|
|
207
208
|
if (!muiFormControl) {
|
|
208
209
|
throw new Error('MUI X: PickersInputBase should always be used inside a PickersTextField component');
|
|
209
210
|
}
|
|
211
|
+
const ownerState = ownerStateProp ?? ownerStateContext;
|
|
210
212
|
const handleInputFocus = event => {
|
|
211
213
|
muiFormControl.onFocus?.(event);
|
|
212
214
|
onFocus?.(event);
|
|
@@ -230,10 +232,7 @@ const PickersInputBase = /*#__PURE__*/React.forwardRef(function PickersInputBase
|
|
|
230
232
|
muiFormControl.onFilled();
|
|
231
233
|
}
|
|
232
234
|
}, [muiFormControl, areAllSectionsEmpty]);
|
|
233
|
-
const
|
|
234
|
-
isRtl
|
|
235
|
-
});
|
|
236
|
-
const classes = useUtilityClasses(ownerState);
|
|
235
|
+
const classes = useUtilityClasses(classesProp, ownerState);
|
|
237
236
|
const InputRoot = slots?.root || PickersInputBaseRoot;
|
|
238
237
|
const inputRootProps = useSlotProps({
|
|
239
238
|
elementType: InputRoot,
|
|
@@ -266,16 +265,16 @@ const PickersInputBase = /*#__PURE__*/React.forwardRef(function PickersInputBase
|
|
|
266
265
|
sectionSeparator: PickersInputBaseSectionSeparator
|
|
267
266
|
},
|
|
268
267
|
slotProps: {
|
|
269
|
-
root: {
|
|
268
|
+
root: _extends({}, slotProps?.input, {
|
|
270
269
|
ownerState
|
|
271
|
-
},
|
|
270
|
+
}),
|
|
272
271
|
sectionContent: {
|
|
273
272
|
className: pickersInputBaseClasses.sectionContent
|
|
274
273
|
},
|
|
275
274
|
sectionSeparator: ({
|
|
276
|
-
|
|
275
|
+
separatorPosition
|
|
277
276
|
}) => ({
|
|
278
|
-
className:
|
|
277
|
+
className: separatorPosition === 'before' ? pickersInputBaseClasses.sectionBefore : pickersInputBaseClasses.sectionAfter
|
|
279
278
|
})
|
|
280
279
|
}
|
|
281
280
|
}), endAdornment, renderSuffix ? renderSuffix(_extends({}, muiFormControl)) : null, /*#__PURE__*/_jsx(PickersInputBaseInput, _extends({
|
|
@@ -3,6 +3,8 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
3
3
|
const _excluded = ["children", "className", "label", "notched", "shrink"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { styled } from '@mui/material/styles';
|
|
6
|
+
import { shouldForwardProp } from '@mui/system/createStyled';
|
|
7
|
+
import { usePickerTextFieldOwnerState } from "../usePickerTextFieldOwnerState.js";
|
|
6
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
9
|
const OutlineRoot = styled('fieldset', {
|
|
8
10
|
name: 'MuiPickersOutlinedInput',
|
|
@@ -36,7 +38,9 @@ const OutlineLabel = styled('span')(({
|
|
|
36
38
|
fontFamily: theme.typography.fontFamily,
|
|
37
39
|
fontSize: 'inherit'
|
|
38
40
|
}));
|
|
39
|
-
const OutlineLegend = styled('legend'
|
|
41
|
+
const OutlineLegend = styled('legend', {
|
|
42
|
+
shouldForwardProp: prop => shouldForwardProp(prop) && prop !== 'notched'
|
|
43
|
+
})(({
|
|
40
44
|
theme
|
|
41
45
|
}) => ({
|
|
42
46
|
float: 'unset',
|
|
@@ -47,7 +51,7 @@ const OutlineLegend = styled('legend')(({
|
|
|
47
51
|
// Fix Horizontal scroll when label too long
|
|
48
52
|
variants: [{
|
|
49
53
|
props: {
|
|
50
|
-
|
|
54
|
+
inputHasLabel: false
|
|
51
55
|
},
|
|
52
56
|
style: {
|
|
53
57
|
padding: 0,
|
|
@@ -60,7 +64,7 @@ const OutlineLegend = styled('legend')(({
|
|
|
60
64
|
}
|
|
61
65
|
}, {
|
|
62
66
|
props: {
|
|
63
|
-
|
|
67
|
+
inputHasLabel: true
|
|
64
68
|
},
|
|
65
69
|
style: {
|
|
66
70
|
display: 'block',
|
|
@@ -86,7 +90,7 @@ const OutlineLegend = styled('legend')(({
|
|
|
86
90
|
}
|
|
87
91
|
}, {
|
|
88
92
|
props: {
|
|
89
|
-
|
|
93
|
+
inputHasLabel: true,
|
|
90
94
|
notched: true
|
|
91
95
|
},
|
|
92
96
|
style: {
|
|
@@ -106,13 +110,11 @@ const OutlineLegend = styled('legend')(({
|
|
|
106
110
|
export default function Outline(props) {
|
|
107
111
|
const {
|
|
108
112
|
className,
|
|
109
|
-
label
|
|
113
|
+
label,
|
|
114
|
+
notched
|
|
110
115
|
} = props,
|
|
111
116
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
112
|
-
const
|
|
113
|
-
const ownerState = _extends({}, props, {
|
|
114
|
-
withLabel
|
|
115
|
-
});
|
|
117
|
+
const ownerState = usePickerTextFieldOwnerState();
|
|
116
118
|
return /*#__PURE__*/_jsx(OutlineRoot, _extends({
|
|
117
119
|
"aria-hidden": true,
|
|
118
120
|
className: className
|
|
@@ -120,7 +122,8 @@ export default function Outline(props) {
|
|
|
120
122
|
ownerState: ownerState,
|
|
121
123
|
children: /*#__PURE__*/_jsx(OutlineLegend, {
|
|
122
124
|
ownerState: ownerState,
|
|
123
|
-
|
|
125
|
+
notched: notched,
|
|
126
|
+
children: label ? /*#__PURE__*/_jsx(OutlineLabel, {
|
|
124
127
|
children: label
|
|
125
128
|
}) :
|
|
126
129
|
/*#__PURE__*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["label", "autoFocus", "ownerState", "notched"];
|
|
3
|
+
const _excluded = ["label", "autoFocus", "ownerState", "classes", "notched"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { useFormControl } from '@mui/material/FormControl';
|
|
@@ -51,7 +51,7 @@ const PickersOutlinedInputRoot = styled(PickersInputBaseRoot, {
|
|
|
51
51
|
// @ts-ignore
|
|
52
52
|
.filter(key => (theme.vars ?? theme).palette[key]?.main ?? false).map(color => ({
|
|
53
53
|
props: {
|
|
54
|
-
color
|
|
54
|
+
inputColor: color
|
|
55
55
|
},
|
|
56
56
|
style: {
|
|
57
57
|
[`&.${pickersOutlinedInputClasses.focused}:not(.${pickersOutlinedInputClasses.error}) .${pickersOutlinedInputClasses.notchedOutline}`]: {
|
|
@@ -70,17 +70,14 @@ const PickersOutlinedInputSectionsContainer = styled(PickersInputBaseSectionsCon
|
|
|
70
70
|
padding: '16.5px 0',
|
|
71
71
|
variants: [{
|
|
72
72
|
props: {
|
|
73
|
-
|
|
73
|
+
inputSize: 'small'
|
|
74
74
|
},
|
|
75
75
|
style: {
|
|
76
76
|
padding: '8.5px 0'
|
|
77
77
|
}
|
|
78
78
|
}]
|
|
79
79
|
});
|
|
80
|
-
const useUtilityClasses =
|
|
81
|
-
const {
|
|
82
|
-
classes
|
|
83
|
-
} = ownerState;
|
|
80
|
+
const useUtilityClasses = classes => {
|
|
84
81
|
const slots = {
|
|
85
82
|
root: ['root'],
|
|
86
83
|
notchedOutline: ['notchedOutline'],
|
|
@@ -89,6 +86,7 @@ const useUtilityClasses = ownerState => {
|
|
|
89
86
|
const composedClasses = composeClasses(slots, getPickersOutlinedInputUtilityClass, classes);
|
|
90
87
|
return _extends({}, classes, composedClasses);
|
|
91
88
|
};
|
|
89
|
+
|
|
92
90
|
/**
|
|
93
91
|
* @ignore - internal component.
|
|
94
92
|
*/
|
|
@@ -99,15 +97,12 @@ const PickersOutlinedInput = /*#__PURE__*/React.forwardRef(function PickersOutli
|
|
|
99
97
|
});
|
|
100
98
|
const {
|
|
101
99
|
label,
|
|
102
|
-
|
|
100
|
+
classes: classesProp,
|
|
103
101
|
notched
|
|
104
102
|
} = props,
|
|
105
103
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
106
104
|
const muiFormControl = useFormControl();
|
|
107
|
-
const
|
|
108
|
-
color: muiFormControl?.color || 'primary'
|
|
109
|
-
});
|
|
110
|
-
const classes = useUtilityClasses(ownerState);
|
|
105
|
+
const classes = useUtilityClasses(classesProp);
|
|
111
106
|
return /*#__PURE__*/_jsx(PickersInputBase, _extends({
|
|
112
107
|
slots: {
|
|
113
108
|
root: PickersOutlinedInputRoot,
|
|
@@ -119,8 +114,7 @@ const PickersOutlinedInput = /*#__PURE__*/React.forwardRef(function PickersOutli
|
|
|
119
114
|
className: classes.notchedOutline,
|
|
120
115
|
label: label != null && label !== '' && muiFormControl?.required ? /*#__PURE__*/_jsxs(React.Fragment, {
|
|
121
116
|
children: [label, "\u2009", '*']
|
|
122
|
-
}) : label
|
|
123
|
-
ownerState: ownerState
|
|
117
|
+
}) : label
|
|
124
118
|
})
|
|
125
119
|
}, other, {
|
|
126
120
|
label: label,
|