@mui/x-date-pickers 7.0.0-alpha.5 → 7.0.0-alpha.6

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.
Files changed (89) hide show
  1. package/CHANGELOG.md +226 -6
  2. package/PickersSectionList/PickersSectionList.d.ts +11 -0
  3. package/PickersSectionList/PickersSectionList.js +223 -0
  4. package/PickersSectionList/PickersSectionList.types.d.ts +56 -0
  5. package/PickersSectionList/index.d.ts +4 -0
  6. package/PickersSectionList/index.js +2 -0
  7. package/PickersSectionList/package.json +6 -0
  8. package/PickersSectionList/pickersSectionListClasses.d.ts +11 -0
  9. package/PickersSectionList/pickersSectionListClasses.js +6 -0
  10. package/index.d.ts +1 -0
  11. package/index.js +4 -1
  12. package/internals/components/{PickersTextField → PickersInput}/Outline.d.ts +1 -0
  13. package/internals/components/{PickersTextField → PickersInput}/Outline.js +35 -19
  14. package/internals/components/PickersInput/PickersFilledInput.d.ts +3 -0
  15. package/internals/components/PickersInput/PickersFilledInput.js +166 -0
  16. package/internals/components/PickersInput/PickersInput.d.ts +15 -0
  17. package/internals/components/{PickersTextField → PickersInput}/PickersInput.js +78 -106
  18. package/internals/components/PickersInput/PickersInput.types.d.ts +60 -0
  19. package/internals/components/PickersInput/PickersOutlinedInput.d.ts +3 -0
  20. package/internals/components/PickersInput/PickersOutlinedInput.js +117 -0
  21. package/internals/components/PickersInput/PickersStandardInput.d.ts +3 -0
  22. package/internals/components/PickersInput/PickersStandardInput.js +123 -0
  23. package/internals/components/PickersInput/index.d.ts +4 -0
  24. package/internals/components/PickersInput/index.js +3 -0
  25. package/internals/components/PickersInput/pickersInputClasses.d.ts +84 -0
  26. package/internals/components/PickersInput/pickersInputClasses.js +18 -0
  27. package/internals/components/PickersTextField/PickersTextField.d.ts +1 -2
  28. package/internals/components/PickersTextField/PickersTextField.js +15 -6
  29. package/internals/components/PickersTextField/PickersTextField.types.d.ts +46 -3
  30. package/internals/components/PickersTextField/pickersTextFieldClasses.d.ts +0 -31
  31. package/internals/components/PickersTextField/pickersTextFieldClasses.js +3 -6
  32. package/internals/hooks/useField/useField.js +8 -1
  33. package/legacy/PickersSectionList/PickersSectionList.js +230 -0
  34. package/legacy/PickersSectionList/index.js +2 -0
  35. package/legacy/PickersSectionList/pickersSectionListClasses.js +6 -0
  36. package/legacy/index.js +4 -1
  37. package/legacy/internals/components/{PickersTextField → PickersInput}/Outline.js +40 -22
  38. package/legacy/internals/components/PickersInput/PickersFilledInput.js +161 -0
  39. package/legacy/internals/components/{PickersTextField → PickersInput}/PickersInput.js +75 -90
  40. package/legacy/internals/components/PickersInput/PickersInput.types.js +1 -0
  41. package/legacy/internals/components/PickersInput/PickersOutlinedInput.js +110 -0
  42. package/legacy/internals/components/PickersInput/PickersStandardInput.js +117 -0
  43. package/legacy/internals/components/PickersInput/index.js +3 -0
  44. package/legacy/internals/components/PickersInput/pickersInputClasses.js +18 -0
  45. package/legacy/internals/components/PickersTextField/PickersTextField.js +16 -7
  46. package/legacy/internals/components/PickersTextField/pickersTextFieldClasses.js +3 -6
  47. package/legacy/internals/hooks/useField/useField.js +8 -1
  48. package/legacy/locales/ruRU.js +1 -2
  49. package/locales/ruRU.js +1 -2
  50. package/modern/PickersSectionList/PickersSectionList.js +221 -0
  51. package/modern/PickersSectionList/PickersSectionList.types.js +1 -0
  52. package/modern/PickersSectionList/index.js +2 -0
  53. package/modern/PickersSectionList/pickersSectionListClasses.js +6 -0
  54. package/modern/index.js +4 -1
  55. package/modern/internals/components/{PickersTextField → PickersInput}/Outline.js +35 -19
  56. package/modern/internals/components/PickersInput/PickersFilledInput.js +165 -0
  57. package/modern/internals/components/{PickersTextField → PickersInput}/PickersInput.js +78 -106
  58. package/modern/internals/components/PickersInput/PickersInput.types.js +1 -0
  59. package/modern/internals/components/PickersInput/PickersOutlinedInput.js +117 -0
  60. package/modern/internals/components/PickersInput/PickersStandardInput.js +123 -0
  61. package/modern/internals/components/PickersInput/index.js +3 -0
  62. package/modern/internals/components/PickersInput/pickersInputClasses.js +18 -0
  63. package/modern/internals/components/PickersTextField/PickersTextField.js +15 -6
  64. package/modern/internals/components/PickersTextField/pickersTextFieldClasses.js +3 -6
  65. package/modern/internals/hooks/useField/useField.js +8 -1
  66. package/modern/locales/ruRU.js +1 -2
  67. package/node/PickersSectionList/PickersSectionList.js +228 -0
  68. package/node/PickersSectionList/index.js +49 -0
  69. package/node/PickersSectionList/pickersSectionListClasses.js +14 -0
  70. package/node/index.js +13 -1
  71. package/node/internals/components/{PickersTextField → PickersInput}/Outline.js +35 -19
  72. package/node/internals/components/PickersInput/PickersFilledInput.js +174 -0
  73. package/node/internals/components/{PickersTextField → PickersInput}/PickersInput.js +80 -108
  74. package/node/internals/components/PickersInput/PickersInput.types.js +5 -0
  75. package/node/internals/components/PickersInput/PickersOutlinedInput.js +125 -0
  76. package/node/internals/components/PickersInput/PickersStandardInput.js +132 -0
  77. package/node/internals/components/PickersInput/index.js +32 -0
  78. package/node/internals/components/PickersInput/pickersInputClasses.js +29 -0
  79. package/node/internals/components/PickersTextField/PickersTextField.js +15 -6
  80. package/node/internals/components/PickersTextField/pickersTextFieldClasses.js +6 -9
  81. package/node/internals/hooks/useField/useField.js +8 -1
  82. package/node/locales/ruRU.js +1 -2
  83. package/package.json +4 -4
  84. package/internals/components/PickersTextField/PickersInput.d.ts +0 -3
  85. package/internals/components/PickersTextField/PickersInput.types.d.ts +0 -45
  86. /package/{internals/components/PickersTextField/PickersInput.types.js → PickersSectionList/PickersSectionList.types.js} +0 -0
  87. /package/{legacy/internals/components/PickersTextField → internals/components/PickersInput}/PickersInput.types.js +0 -0
  88. /package/{modern/internals/components/PickersTextField/PickersInput.types.js → legacy/PickersSectionList/PickersSectionList.types.js} +0 -0
  89. /package/node/{internals/components/PickersTextField/PickersInput.types.js → PickersSectionList/PickersSectionList.types.js} +0 -0
@@ -4,22 +4,38 @@ const _excluded = ["children", "className", "label"];
4
4
  import * as React from 'react';
5
5
  import { styled } from '@mui/material/styles';
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
- const OutlineRoot = styled('fieldset')({
8
- textAlign: 'left',
9
- position: 'absolute',
10
- bottom: 0,
11
- right: 0,
12
- top: -5,
13
- left: 0,
14
- margin: 0,
15
- padding: '0 8px',
16
- pointerEvents: 'none',
17
- borderRadius: 'inherit',
18
- borderStyle: 'solid',
19
- borderWidth: 1,
20
- overflow: 'hidden',
21
- minWidth: '0%'
7
+ const OutlineRoot = styled('fieldset', {
8
+ name: 'MuiPickersOutlinedInput',
9
+ slot: 'NotchedOutline',
10
+ overridesResolver: (props, styles) => styles.notchedOutline
11
+ })(({
12
+ theme
13
+ }) => {
14
+ const borderColor = theme.palette.mode === 'light' ? 'rgba(0, 0, 0, 0.23)' : 'rgba(255, 255, 255, 0.23)';
15
+ return {
16
+ textAlign: 'left',
17
+ position: 'absolute',
18
+ bottom: 0,
19
+ right: 0,
20
+ top: -5,
21
+ left: 0,
22
+ margin: 0,
23
+ padding: '0 8px',
24
+ pointerEvents: 'none',
25
+ borderRadius: 'inherit',
26
+ borderStyle: 'solid',
27
+ borderWidth: 1,
28
+ overflow: 'hidden',
29
+ minWidth: '0%',
30
+ borderColor: theme.vars ? `rgba(${theme.vars.palette.common.onBackgroundChannel} / 0.23)` : borderColor
31
+ };
22
32
  });
33
+ const OutlineLabel = styled('span')(({
34
+ theme
35
+ }) => ({
36
+ fontFamily: theme.typography.fontFamily,
37
+ fontSize: 'inherit'
38
+ }));
23
39
  const OutlineLegend = styled('legend')(({
24
40
  ownerState,
25
41
  theme
@@ -78,17 +94,17 @@ export default function Outline(props) {
78
94
  });
79
95
  return /*#__PURE__*/_jsx(OutlineRoot, _extends({
80
96
  "aria-hidden": true,
81
- className: className,
82
- ownerState: ownerState
97
+ className: className
83
98
  }, other, {
99
+ ownerState: ownerState,
84
100
  children: /*#__PURE__*/_jsx(OutlineLegend, {
85
101
  ownerState: ownerState,
86
- children: withLabel ? /*#__PURE__*/_jsx("span", {
102
+ children: withLabel ? /*#__PURE__*/_jsx(OutlineLabel, {
87
103
  children: label
88
104
  }) :
89
105
  /*#__PURE__*/
90
106
  // notranslate needed while Google Translate will not fix zero-width space issue
91
- _jsx("span", {
107
+ _jsx(OutlineLabel, {
92
108
  className: "notranslate",
93
109
  children: "\u200B"
94
110
  })
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ import { PickersFilledInputProps } from './PickersInput.types';
3
+ export declare const PickersFilledInput: React.ForwardRefExoticComponent<Omit<PickersFilledInputProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,166 @@
1
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
+ import _extends from "@babel/runtime/helpers/esm/extends";
3
+ const _excluded = ["label", "autoFocus", "ownerState"];
4
+ import * as React from 'react';
5
+ import { useFormControl } from '@mui/material/FormControl';
6
+ import { styled } from '@mui/material/styles';
7
+ import { unstable_composeClasses as composeClasses, unstable_capitalize as capitalize } from '@mui/utils';
8
+ import { pickersFilledInputClasses, getPickersFilledInputUtilityClass } from './pickersInputClasses';
9
+ import { PickersInputRoot, PickersInput, PickersInputSectionsContainer } from './PickersInput';
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ const FilledInputRoot = styled(PickersInputRoot, {
12
+ name: 'MuiPickersFilledInput',
13
+ slot: 'Root',
14
+ overridesResolver: (props, styles) => styles.root
15
+ })(({
16
+ theme,
17
+ ownerState
18
+ }) => {
19
+ var _palette;
20
+ const light = theme.palette.mode === 'light';
21
+ const bottomLineColor = light ? 'rgba(0, 0, 0, 0.42)' : 'rgba(255, 255, 255, 0.7)';
22
+ const backgroundColor = light ? 'rgba(0, 0, 0, 0.06)' : 'rgba(255, 255, 255, 0.09)';
23
+ const hoverBackground = light ? 'rgba(0, 0, 0, 0.09)' : 'rgba(255, 255, 255, 0.13)';
24
+ const disabledBackground = light ? 'rgba(0, 0, 0, 0.12)' : 'rgba(255, 255, 255, 0.12)';
25
+ return _extends({
26
+ backgroundColor: theme.vars ? theme.vars.palette.FilledInput.bg : backgroundColor,
27
+ borderTopLeftRadius: (theme.vars || theme).shape.borderRadius,
28
+ borderTopRightRadius: (theme.vars || theme).shape.borderRadius,
29
+ transition: theme.transitions.create('background-color', {
30
+ duration: theme.transitions.duration.shorter,
31
+ easing: theme.transitions.easing.easeOut
32
+ }),
33
+ '&:hover': {
34
+ backgroundColor: theme.vars ? theme.vars.palette.FilledInput.hoverBg : hoverBackground,
35
+ // Reset on touch devices, it doesn't add specificity
36
+ '@media (hover: none)': {
37
+ backgroundColor: theme.vars ? theme.vars.palette.FilledInput.bg : backgroundColor
38
+ }
39
+ },
40
+ [`&.${pickersFilledInputClasses.focused}`]: {
41
+ backgroundColor: theme.vars ? theme.vars.palette.FilledInput.bg : backgroundColor
42
+ },
43
+ [`&.${pickersFilledInputClasses.disabled}`]: {
44
+ backgroundColor: theme.vars ? theme.vars.palette.FilledInput.disabledBg : disabledBackground
45
+ }
46
+ }, !ownerState.disableUnderline && {
47
+ '&:after': {
48
+ borderBottom: `2px solid ${(_palette = (theme.vars || theme).palette[ownerState.color || 'primary']) == null ? void 0 : _palette.main}`,
49
+ left: 0,
50
+ bottom: 0,
51
+ // Doing the other way around crash on IE11 "''" https://github.com/cssinjs/jss/issues/242
52
+ content: '""',
53
+ position: 'absolute',
54
+ right: 0,
55
+ transform: 'scaleX(0)',
56
+ transition: theme.transitions.create('transform', {
57
+ duration: theme.transitions.duration.shorter,
58
+ easing: theme.transitions.easing.easeOut
59
+ }),
60
+ pointerEvents: 'none' // Transparent to the hover style.
61
+ },
62
+ [`&.${pickersFilledInputClasses.focused}:after`]: {
63
+ // translateX(0) is a workaround for Safari transform scale bug
64
+ // See https://github.com/mui/material-ui/issues/31766
65
+ transform: 'scaleX(1) translateX(0)'
66
+ },
67
+ [`&.${pickersFilledInputClasses.error}`]: {
68
+ '&:before, &:after': {
69
+ borderBottomColor: (theme.vars || theme).palette.error.main
70
+ }
71
+ },
72
+ '&:before': {
73
+ borderBottom: `1px solid ${theme.vars ? `rgba(${theme.vars.palette.common.onBackgroundChannel} / ${theme.vars.opacity.inputUnderline})` : bottomLineColor}`,
74
+ left: 0,
75
+ bottom: 0,
76
+ // Doing the other way around crash on IE11 "''" https://github.com/cssinjs/jss/issues/242
77
+ content: '"\\00a0"',
78
+ position: 'absolute',
79
+ right: 0,
80
+ transition: theme.transitions.create('border-bottom-color', {
81
+ duration: theme.transitions.duration.shorter
82
+ }),
83
+ pointerEvents: 'none' // Transparent to the hover style.
84
+ },
85
+ [`&:hover:not(.${pickersFilledInputClasses.disabled}, .${pickersFilledInputClasses.error}):before`]: {
86
+ borderBottom: `1px solid ${(theme.vars || theme).palette.text.primary}`
87
+ },
88
+ [`&.${pickersFilledInputClasses.disabled}:before`]: {
89
+ borderBottomStyle: 'dotted'
90
+ }
91
+ }, ownerState.startAdornment && {
92
+ paddingLeft: 12
93
+ }, ownerState.endAdornment && {
94
+ paddingRight: 12
95
+ });
96
+ });
97
+ const FilledSectionsContainer = styled(PickersInputSectionsContainer, {
98
+ name: 'MuiPickersFilledInput',
99
+ slot: 'sectionsContainer',
100
+ overridesResolver: (props, styles) => styles.sectionsContainer
101
+ })(({
102
+ ownerState
103
+ }) => _extends({
104
+ paddingTop: 25,
105
+ paddingRight: 12,
106
+ paddingBottom: 8,
107
+ paddingLeft: 12
108
+ }, ownerState.size === 'small' && {
109
+ paddingTop: 21,
110
+ paddingBottom: 4
111
+ }, ownerState.startAdornment && {
112
+ paddingLeft: 0
113
+ }, ownerState.endAdornment && {
114
+ paddingRight: 0
115
+ }, ownerState.hiddenLabel && {
116
+ paddingTop: 16,
117
+ paddingBottom: 17
118
+ }, ownerState.hiddenLabel && ownerState.size === 'small' && {
119
+ paddingTop: 8,
120
+ paddingBottom: 9
121
+ }));
122
+ const useUtilityClasses = ownerState => {
123
+ const {
124
+ focused,
125
+ disabled,
126
+ error,
127
+ classes,
128
+ fullWidth,
129
+ color,
130
+ size,
131
+ endAdornment,
132
+ startAdornment
133
+ } = ownerState;
134
+ const slots = {
135
+ root: ['root', focused && !disabled && 'focused', disabled && 'disabled', error && 'error', fullWidth && 'fullWidth', `color${capitalize(color)}`, size === 'small' && 'inputSizeSmall', Boolean(startAdornment) && 'adornedStart', Boolean(endAdornment) && 'adornedEnd'],
136
+ notchedOutline: ['notchedOutline'],
137
+ before: ['before'],
138
+ after: ['after'],
139
+ content: ['content'],
140
+ input: ['input']
141
+ };
142
+ return composeClasses(slots, getPickersFilledInputUtilityClass, classes);
143
+ };
144
+ export const PickersFilledInput = /*#__PURE__*/React.forwardRef(function PickersFilledInput(props, ref) {
145
+ const {
146
+ label,
147
+ ownerState: ownerStateProp
148
+ } = props,
149
+ other = _objectWithoutPropertiesLoose(props, _excluded);
150
+ const muiFormControl = useFormControl();
151
+ const ownerState = _extends({}, props, ownerStateProp, muiFormControl, {
152
+ color: (muiFormControl == null ? void 0 : muiFormControl.color) || 'primary'
153
+ });
154
+ const classes = useUtilityClasses(ownerState);
155
+ return /*#__PURE__*/_jsx(PickersInput, _extends({
156
+ slots: {
157
+ root: FilledInputRoot,
158
+ input: FilledSectionsContainer
159
+ }
160
+ }, other, {
161
+ label: label,
162
+ classes: classes,
163
+ ref: ref
164
+ }));
165
+ });
166
+ PickersInput.muiName = 'Input';
@@ -0,0 +1,15 @@
1
+ import * as React from 'react';
2
+ import { FormControlState } from '@mui/material/FormControl';
3
+ import { PickersInputProps } from './PickersInput.types';
4
+ export declare const PickersInputRoot: import("@emotion/styled").StyledComponent<Pick<import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme> & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
5
+ ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
6
+ }, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>>, "hidden" | "content" | "style" | "translate" | "slot" | "title" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "nonce" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
7
+ ownerState: OwnerStateType;
8
+ }, {}, {}>;
9
+ export declare const PickersInputSectionsContainer: import("@emotion/styled").StyledComponent<Pick<import("@mui/system").MUIStyledCommonProps<import("@mui/system").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/system").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
10
+ ownerState: OwnerStateType;
11
+ }, {}, {}>;
12
+ interface OwnerStateType extends FormControlState, Omit<PickersInputProps, keyof FormControlState> {
13
+ }
14
+ export declare const PickersInput: React.ForwardRefExoticComponent<Omit<PickersInputProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
15
+ export {};
@@ -1,8 +1,7 @@
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", "contentEditable", "tabIndex", "fullWidth", "inputProps", "inputRef", "sectionsContainerRef"];
3
+ const _excluded = ["elements", "areAllSectionsEmpty", "defaultValue", "label", "value", "onChange", "id", "autoFocus", "endAdornment", "startAdornment", "renderSuffix", "slots", "contentEditable", "tabIndex", "onInput", "onPaste", "onKeyDown", "fullWidth", "inputProps", "inputRef", "sectionListRef"];
4
4
  import * as React from 'react';
5
- import clsx from 'clsx';
6
5
  import Box from '@mui/material/Box';
7
6
  import { useFormControl } from '@mui/material/FormControl';
8
7
  import { styled } from '@mui/material/styles';
@@ -10,59 +9,33 @@ import useForkRef from '@mui/utils/useForkRef';
10
9
  import composeClasses from '@mui/utils/composeClasses';
11
10
  import capitalize from '@mui/utils/capitalize';
12
11
  import visuallyHidden from '@mui/utils/visuallyHidden';
13
- import { pickersInputClasses, getPickersInputUtilityClass } from './pickersTextFieldClasses';
14
- import Outline from './Outline';
12
+ import { pickersInputClasses, getPickersInputUtilityClass } from './pickersInputClasses';
13
+ import { Unstable_PickersSectionList as PickersSectionList, Unstable_PickersSectionListRoot as PickersSectionListRoot, Unstable_PickersSectionListSection as PickersSectionListSection, Unstable_PickersSectionListSectionSeparator as PickersSectionListSectionSeparator, Unstable_PickersSectionListSectionContent as PickersSectionListSectionContent } from '../../../PickersSectionList';
15
14
  import { jsx as _jsx } from "react/jsx-runtime";
16
15
  import { jsxs as _jsxs } from "react/jsx-runtime";
17
- const PickersInputRoot = styled(Box, {
16
+ const round = value => Math.round(value * 1e5) / 1e5;
17
+ export const PickersInputRoot = styled(Box, {
18
18
  name: 'MuiPickersInput',
19
19
  slot: 'Root',
20
20
  overridesResolver: (props, styles) => styles.root
21
21
  })(({
22
22
  theme,
23
23
  ownerState
24
- }) => {
25
- const borderColor = theme.palette.mode === 'light' ? 'rgba(0, 0, 0, 0.23)' : 'rgba(255, 255, 255, 0.23)';
26
- return _extends({
27
- cursor: 'text',
28
- padding: '16.5px 14px',
29
- display: 'flex',
30
- justifyContent: 'flex-start',
31
- alignItems: 'center',
32
- width: ownerState.fullWidth ? '100%' : '25ch',
33
- position: 'relative',
34
- outline: 'none',
35
- borderRadius: (theme.vars || theme).shape.borderRadius,
36
- [`&:hover .${pickersInputClasses.notchedOutline}`]: {
37
- borderColor: (theme.vars || theme).palette.text.primary
38
- },
39
- // Reset on touch devices, it doesn't add specificity
40
- '@media (hover: none)': {
41
- [`&:hover .${pickersInputClasses.notchedOutline}`]: {
42
- borderColor: theme.vars ? `rgba(${theme.vars.palette.common.onBackgroundChannel} / 0.23)` : borderColor
43
- }
44
- },
45
- [`&.${pickersInputClasses.focused} .${pickersInputClasses.notchedOutline}`]: {
46
- borderStyle: 'solid',
47
- borderColor: (theme.vars || theme).palette[ownerState.color].main,
48
- borderWidth: 2
49
- },
50
- [`&.${pickersInputClasses.disabled}`]: {
51
- [`& .${pickersInputClasses.notchedOutline}`]: {
52
- borderColor: (theme.vars || theme).palette.action.disabled
53
- },
54
- '*': {
55
- color: (theme.vars || theme).palette.action.disabled
56
- }
57
- },
58
- [`&.${pickersInputClasses.error} .${pickersInputClasses.notchedOutline}`]: {
59
- borderColor: (theme.vars || theme).palette.error.main
60
- }
61
- }, ownerState.size === 'small' && {
62
- padding: '8.5px 14px'
63
- });
64
- });
65
- const PickersInputSectionsContainer = styled('div', {
24
+ }) => _extends({}, theme.typography.body1, {
25
+ color: (theme.vars || theme).palette.text.primary,
26
+ cursor: 'text',
27
+ padding: 0,
28
+ display: 'flex',
29
+ justifyContent: 'flex-start',
30
+ alignItems: 'center',
31
+ position: 'relative',
32
+ boxSizing: 'border-box',
33
+ // Prevent padding issue with fullWidth.
34
+ letterSpacing: `${round(0.15 / 16)}em`
35
+ }, ownerState.fullWidth && {
36
+ width: '100%'
37
+ }));
38
+ export const PickersInputSectionsContainer = styled(PickersSectionListRoot, {
66
39
  name: 'MuiPickersInput',
67
40
  slot: 'SectionsContainer',
68
41
  overridesResolver: (props, styles) => styles.sectionsContainer
@@ -70,12 +43,23 @@ const PickersInputSectionsContainer = styled('div', {
70
43
  theme,
71
44
  ownerState
72
45
  }) => _extends({
46
+ padding: '4px 0 5px',
73
47
  fontFamily: theme.typography.fontFamily,
74
48
  fontSize: 'inherit',
75
49
  lineHeight: '1.4375em',
76
50
  // 23px
77
51
  flexGrow: 1,
78
- outline: 'none'
52
+ outline: 'none',
53
+ display: 'flex',
54
+ flexWrap: 'nowrap',
55
+ overflow: 'hidden',
56
+ letterSpacing: 'inherit',
57
+ // Baseline behavior
58
+ width: '182px'
59
+ }, ownerState.size === 'small' && {
60
+ paddingTop: 1
61
+ }, theme.direction === 'rtl' && {
62
+ textAlign: 'right /*! @noflip */'
79
63
  }, !(ownerState.adornedStart || ownerState.focused || ownerState.filled) && _extends({
80
64
  color: 'currentColor'
81
65
  }, ownerState.label == null && (theme.vars ? {
@@ -85,7 +69,7 @@ const PickersInputSectionsContainer = styled('div', {
85
69
  }), ownerState.label != null && {
86
70
  opacity: 0
87
71
  })));
88
- const PickersInputSection = styled('span', {
72
+ const PickersInputSection = styled(PickersSectionListSection, {
89
73
  name: 'MuiPickersInput',
90
74
  slot: 'Section',
91
75
  overridesResolver: (props, styles) => styles.section
@@ -94,11 +78,12 @@ const PickersInputSection = styled('span', {
94
78
  }) => ({
95
79
  fontFamily: theme.typography.fontFamily,
96
80
  fontSize: 'inherit',
81
+ letterSpacing: 'inherit',
97
82
  lineHeight: '1.4375em',
98
83
  // 23px
99
- flexGrow: 1
84
+ display: 'flex'
100
85
  }));
101
- const PickersInputContent = styled('span', {
86
+ const PickersInputSectionContent = styled(PickersSectionListSectionContent, {
102
87
  name: 'MuiPickersInput',
103
88
  slot: 'SectionContent',
104
89
  overridesResolver: (props, styles) => styles.content
@@ -109,32 +94,22 @@ const PickersInputContent = styled('span', {
109
94
  lineHeight: '1.4375em',
110
95
  // 23px
111
96
  letterSpacing: 'inherit',
112
- width: 'fit-content'
97
+ width: 'fit-content',
98
+ outline: 'none'
113
99
  }));
114
- const PickersInputSeparator = styled('span', {
100
+ const PickersInputSeparator = styled(PickersSectionListSectionSeparator, {
115
101
  name: 'MuiPickersInput',
116
102
  slot: 'Separator',
117
103
  overridesResolver: (props, styles) => styles.separator
118
104
  })(() => ({
119
- whiteSpace: 'pre'
105
+ whiteSpace: 'pre',
106
+ letterSpacing: 'inherit'
120
107
  }));
121
108
  const PickersInputInput = styled('input', {
122
109
  name: 'MuiPickersInput',
123
110
  slot: 'Input',
124
111
  overridesResolver: (props, styles) => styles.hiddenInput
125
112
  })(_extends({}, visuallyHidden));
126
- const NotchedOutlineRoot = styled(Outline, {
127
- name: 'MuiPickersInput',
128
- slot: 'NotchedOutline',
129
- overridesResolver: (props, styles) => styles.notchedOutline
130
- })(({
131
- theme
132
- }) => {
133
- const borderColor = theme.palette.mode === 'light' ? 'rgba(0, 0, 0, 0.23)' : 'rgba(255, 255, 255, 0.23)';
134
- return {
135
- borderColor: theme.vars ? `rgba(${theme.vars.palette.common.onBackgroundChannel} / 0.23)` : borderColor
136
- };
137
- });
138
113
  const useUtilityClasses = ownerState => {
139
114
  const {
140
115
  focused,
@@ -163,17 +138,21 @@ export const PickersInput = /*#__PURE__*/React.forwardRef(function PickersInput(
163
138
  const {
164
139
  elements,
165
140
  areAllSectionsEmpty,
166
- label,
167
141
  value,
168
142
  onChange,
169
143
  id,
170
144
  endAdornment,
171
145
  startAdornment,
146
+ renderSuffix,
147
+ slots,
172
148
  contentEditable,
173
149
  tabIndex,
150
+ onInput,
151
+ onPaste,
152
+ onKeyDown,
174
153
  inputProps,
175
154
  inputRef,
176
- sectionsContainerRef
155
+ sectionListRef
177
156
  } = props,
178
157
  other = _objectWithoutPropertiesLoose(props, _excluded);
179
158
  const rootRef = React.useRef(null);
@@ -210,51 +189,44 @@ export const PickersInput = /*#__PURE__*/React.forwardRef(function PickersInput(
210
189
  }, [muiFormControl, areAllSectionsEmpty]);
211
190
  const ownerState = _extends({}, props, muiFormControl);
212
191
  const classes = useUtilityClasses(ownerState);
213
- return /*#__PURE__*/_jsxs(PickersInputRoot, _extends({}, other, {
192
+ const InputRoot = (slots == null ? void 0 : slots.root) || PickersInputRoot;
193
+ const InputSectionsContainer = (slots == null ? void 0 : slots.input) || PickersInputSectionsContainer;
194
+ return /*#__PURE__*/_jsxs(InputRoot, _extends({}, other, {
214
195
  className: classes.root,
215
196
  ownerState: ownerState,
216
197
  "aria-invalid": muiFormControl.error,
217
198
  ref: handleRootRef,
218
- children: [startAdornment, /*#__PURE__*/_jsx(PickersInputSectionsContainer, {
219
- ownerState: ownerState,
220
- className: classes.sectionsContainer,
199
+ children: [startAdornment, /*#__PURE__*/_jsx(PickersSectionList, {
200
+ sectionListRef: sectionListRef,
201
+ elements: elements,
221
202
  contentEditable: contentEditable,
222
- suppressContentEditableWarning: true,
203
+ tabIndex: tabIndex,
204
+ className: classes.sectionsContainer,
223
205
  onFocus: handleInputFocus,
224
206
  onBlur: muiFormControl.onBlur,
225
- tabIndex: tabIndex,
226
- ref: sectionsContainerRef,
227
- children: contentEditable ? elements.map(({
228
- content,
229
- before,
230
- after
231
- }) => `${before.children}${content.children}${after.children}`).join('') : /*#__PURE__*/_jsx(React.Fragment, {
232
- children: elements.map(({
233
- container,
234
- content,
235
- before,
236
- after
237
- }, elementIndex) => /*#__PURE__*/_jsxs(PickersInputSection, _extends({}, container, {
238
- children: [/*#__PURE__*/_jsx(PickersInputSeparator, _extends({}, before, {
239
- className: clsx(pickersInputClasses.sectionBefore, before == null ? void 0 : before.className)
240
- })), /*#__PURE__*/_jsx(PickersInputContent, _extends({}, content, {
241
- suppressContentEditableWarning: true,
242
- className: clsx(pickersInputClasses.sectionContent, content == null ? void 0 : content.className),
243
- ownerState
244
- })), /*#__PURE__*/_jsx(PickersInputSeparator, _extends({}, after, {
245
- className: clsx(pickersInputClasses.sectionAfter, after == null ? void 0 : after.className)
246
- }))]
247
- }), elementIndex))
248
- })
249
- }), endAdornment, /*#__PURE__*/_jsx(NotchedOutlineRoot, {
250
- shrink: muiFormControl.adornedStart || muiFormControl.focused || muiFormControl.filled,
251
- notched: muiFormControl.adornedStart || muiFormControl.focused || muiFormControl.filled,
252
- className: classes.notchedOutline,
253
- label: label != null && label !== '' && muiFormControl.required ? /*#__PURE__*/_jsxs(React.Fragment, {
254
- children: [label, "\u2009", '*']
255
- }) : label,
256
- ownerState: ownerState
257
- }), /*#__PURE__*/_jsx(PickersInputInput, _extends({
207
+ onInput: onInput,
208
+ onPaste: onPaste,
209
+ onKeyDown: onKeyDown,
210
+ slots: {
211
+ root: InputSectionsContainer,
212
+ section: PickersInputSection,
213
+ sectionContent: PickersInputSectionContent,
214
+ sectionSeparator: PickersInputSeparator
215
+ },
216
+ slotProps: {
217
+ root: {
218
+ ownerState
219
+ },
220
+ sectionContent: {
221
+ className: pickersInputClasses.sectionContent
222
+ },
223
+ sectionSeparator: ({
224
+ position
225
+ }) => ({
226
+ className: position === 'before' ? pickersInputClasses.sectionBefore : pickersInputClasses.sectionAfter
227
+ })
228
+ }
229
+ }), endAdornment, renderSuffix ? renderSuffix(_extends({}, muiFormControl)) : null, /*#__PURE__*/_jsx(PickersInputInput, _extends({
258
230
  className: classes.input,
259
231
  value: value,
260
232
  onChange: onChange,
@@ -0,0 +1,60 @@
1
+ /// <reference types="react" />
2
+ import { BoxProps } from '@mui/material/Box';
3
+ import { PickersSectionListProps } from '../../../PickersSectionList';
4
+ export interface PickersInputPropsUsedByField extends Pick<PickersSectionListProps, 'elements' | 'sectionListRef' | 'contentEditable' | 'tabIndex'> {
5
+ /**
6
+ * Is `true` if the current values equals the empty value.
7
+ * For a single item value, it means that `value === null`
8
+ * For a range value, it means that `value === [null, null]`
9
+ */
10
+ areAllSectionsEmpty: boolean;
11
+ onClick: React.MouseEventHandler<HTMLDivElement>;
12
+ onKeyDown: React.KeyboardEventHandler<HTMLDivElement>;
13
+ onInput: React.FormEventHandler<HTMLDivElement>;
14
+ onPaste: React.ClipboardEventHandler<HTMLDivElement>;
15
+ endAdornment?: React.ReactNode;
16
+ startAdornment?: React.ReactNode;
17
+ value: string;
18
+ onChange: React.ChangeEventHandler<HTMLInputElement>;
19
+ label?: React.ReactNode;
20
+ id?: string;
21
+ fullWidth?: boolean;
22
+ readOnly?: boolean;
23
+ inputProps?: React.HTMLAttributes<HTMLInputElement> & {
24
+ ref?: React.Ref<HTMLInputElement>;
25
+ };
26
+ inputRef?: React.Ref<HTMLInputElement>;
27
+ }
28
+ export interface PickersInputProps extends Omit<BoxProps, keyof PickersInputPropsUsedByField>, PickersInputPropsUsedByField {
29
+ ownerState?: any;
30
+ margin?: 'dense' | 'none' | 'normal';
31
+ renderSuffix?: (state: {
32
+ disabled?: boolean;
33
+ error?: boolean;
34
+ filled?: boolean;
35
+ focused?: boolean;
36
+ margin?: 'dense' | 'none' | 'normal';
37
+ required?: boolean;
38
+ adornedStart?: boolean;
39
+ }) => React.ReactNode;
40
+ ref?: React.Ref<HTMLDivElement>;
41
+ /**
42
+ * The components used for each slot inside.
43
+ *
44
+ * @default {}
45
+ */
46
+ slots?: {
47
+ root?: React.ElementType;
48
+ input?: React.ElementType;
49
+ };
50
+ }
51
+ export interface PickersOutlinedInputProps extends PickersInputProps {
52
+ notched?: boolean;
53
+ }
54
+ export interface PickersStandardInputProps extends PickersInputProps {
55
+ disableUnderline?: boolean;
56
+ }
57
+ export interface PickersFilledInputProps extends PickersInputProps {
58
+ disableUnderline?: boolean;
59
+ hiddenLabel?: boolean;
60
+ }
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ import { PickersOutlinedInputProps } from './PickersInput.types';
3
+ export declare const PickersOutlinedInput: React.ForwardRefExoticComponent<Omit<PickersOutlinedInputProps, "ref"> & React.RefAttributes<HTMLDivElement>>;