@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.
Files changed (116) hide show
  1. package/CHANGELOG.md +408 -6
  2. package/DateCalendar/DateCalendar.js +6 -4
  3. package/DateCalendar/DateCalendar.types.d.ts +0 -8
  4. package/DigitalClock/DigitalClock.js +3 -2
  5. package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +9 -13
  6. package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +4 -8
  7. package/PickersSectionList/PickersSectionList.d.ts +11 -0
  8. package/PickersSectionList/PickersSectionList.js +223 -0
  9. package/PickersSectionList/PickersSectionList.types.d.ts +56 -0
  10. package/PickersSectionList/index.d.ts +4 -0
  11. package/PickersSectionList/index.js +2 -0
  12. package/PickersSectionList/package.json +6 -0
  13. package/PickersSectionList/pickersSectionListClasses.d.ts +11 -0
  14. package/PickersSectionList/pickersSectionListClasses.js +6 -0
  15. package/TimeClock/TimeClock.js +3 -2
  16. package/index.d.ts +1 -0
  17. package/index.js +4 -1
  18. package/internals/components/{PickersTextField → PickersInput}/Outline.d.ts +1 -0
  19. package/internals/components/{PickersTextField → PickersInput}/Outline.js +35 -19
  20. package/internals/components/PickersInput/PickersFilledInput.d.ts +3 -0
  21. package/internals/components/PickersInput/PickersFilledInput.js +166 -0
  22. package/internals/components/PickersInput/PickersInput.d.ts +15 -0
  23. package/internals/components/{PickersTextField → PickersInput}/PickersInput.js +78 -106
  24. package/internals/components/PickersInput/PickersInput.types.d.ts +60 -0
  25. package/internals/components/PickersInput/PickersOutlinedInput.d.ts +3 -0
  26. package/internals/components/PickersInput/PickersOutlinedInput.js +117 -0
  27. package/internals/components/PickersInput/PickersStandardInput.d.ts +3 -0
  28. package/internals/components/PickersInput/PickersStandardInput.js +123 -0
  29. package/internals/components/PickersInput/index.d.ts +4 -0
  30. package/internals/components/PickersInput/index.js +3 -0
  31. package/internals/components/PickersInput/pickersInputClasses.d.ts +84 -0
  32. package/internals/components/PickersInput/pickersInputClasses.js +18 -0
  33. package/internals/components/PickersTextField/PickersTextField.d.ts +1 -2
  34. package/internals/components/PickersTextField/PickersTextField.js +15 -6
  35. package/internals/components/PickersTextField/PickersTextField.types.d.ts +46 -3
  36. package/internals/components/PickersTextField/pickersTextFieldClasses.d.ts +0 -31
  37. package/internals/components/PickersTextField/pickersTextFieldClasses.js +3 -6
  38. package/internals/hooks/useField/useField.js +8 -1
  39. package/internals/hooks/useViews.d.ts +4 -4
  40. package/internals/hooks/useViews.js +13 -13
  41. package/internals/models/props/clock.d.ts +0 -9
  42. package/legacy/DateCalendar/DateCalendar.js +6 -4
  43. package/legacy/DigitalClock/DigitalClock.js +3 -2
  44. package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.js +9 -13
  45. package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +4 -8
  46. package/legacy/PickersSectionList/PickersSectionList.js +230 -0
  47. package/legacy/PickersSectionList/index.js +2 -0
  48. package/legacy/PickersSectionList/pickersSectionListClasses.js +6 -0
  49. package/legacy/TimeClock/TimeClock.js +3 -2
  50. package/legacy/index.js +4 -1
  51. package/legacy/internals/components/{PickersTextField → PickersInput}/Outline.js +40 -22
  52. package/legacy/internals/components/PickersInput/PickersFilledInput.js +161 -0
  53. package/legacy/internals/components/{PickersTextField → PickersInput}/PickersInput.js +75 -90
  54. package/legacy/internals/components/PickersInput/PickersInput.types.js +1 -0
  55. package/legacy/internals/components/PickersInput/PickersOutlinedInput.js +110 -0
  56. package/legacy/internals/components/PickersInput/PickersStandardInput.js +117 -0
  57. package/legacy/internals/components/PickersInput/index.js +3 -0
  58. package/legacy/internals/components/PickersInput/pickersInputClasses.js +18 -0
  59. package/legacy/internals/components/PickersTextField/PickersTextField.js +16 -7
  60. package/legacy/internals/components/PickersTextField/pickersTextFieldClasses.js +3 -6
  61. package/legacy/internals/hooks/useField/useField.js +8 -1
  62. package/legacy/internals/hooks/useViews.js +13 -13
  63. package/legacy/locales/ruRU.js +1 -2
  64. package/locales/ruRU.js +1 -2
  65. package/modern/DateCalendar/DateCalendar.js +6 -4
  66. package/modern/DigitalClock/DigitalClock.js +3 -2
  67. package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +9 -13
  68. package/modern/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +4 -8
  69. package/modern/PickersSectionList/PickersSectionList.js +221 -0
  70. package/modern/PickersSectionList/PickersSectionList.types.js +1 -0
  71. package/modern/PickersSectionList/index.js +2 -0
  72. package/modern/PickersSectionList/pickersSectionListClasses.js +6 -0
  73. package/modern/TimeClock/TimeClock.js +3 -2
  74. package/modern/index.js +4 -1
  75. package/modern/internals/components/{PickersTextField → PickersInput}/Outline.js +35 -19
  76. package/modern/internals/components/PickersInput/PickersFilledInput.js +165 -0
  77. package/modern/internals/components/{PickersTextField → PickersInput}/PickersInput.js +78 -106
  78. package/modern/internals/components/PickersInput/PickersInput.types.js +1 -0
  79. package/modern/internals/components/PickersInput/PickersOutlinedInput.js +117 -0
  80. package/modern/internals/components/PickersInput/PickersStandardInput.js +123 -0
  81. package/modern/internals/components/PickersInput/index.js +3 -0
  82. package/modern/internals/components/PickersInput/pickersInputClasses.js +18 -0
  83. package/modern/internals/components/PickersTextField/PickersTextField.js +15 -6
  84. package/modern/internals/components/PickersTextField/pickersTextFieldClasses.js +3 -6
  85. package/modern/internals/hooks/useField/useField.js +8 -1
  86. package/modern/internals/hooks/useViews.js +13 -13
  87. package/modern/locales/ruRU.js +1 -2
  88. package/node/DateCalendar/DateCalendar.js +6 -4
  89. package/node/DigitalClock/DigitalClock.js +3 -2
  90. package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +9 -13
  91. package/node/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +4 -8
  92. package/node/PickersSectionList/PickersSectionList.js +228 -0
  93. package/node/PickersSectionList/index.js +49 -0
  94. package/node/PickersSectionList/pickersSectionListClasses.js +14 -0
  95. package/node/TimeClock/TimeClock.js +3 -2
  96. package/node/index.js +13 -1
  97. package/node/internals/components/{PickersTextField → PickersInput}/Outline.js +35 -19
  98. package/node/internals/components/PickersInput/PickersFilledInput.js +174 -0
  99. package/node/internals/components/{PickersTextField → PickersInput}/PickersInput.js +80 -108
  100. package/node/internals/components/PickersInput/PickersInput.types.js +5 -0
  101. package/node/internals/components/PickersInput/PickersOutlinedInput.js +125 -0
  102. package/node/internals/components/PickersInput/PickersStandardInput.js +132 -0
  103. package/node/internals/components/PickersInput/index.js +32 -0
  104. package/node/internals/components/PickersInput/pickersInputClasses.js +29 -0
  105. package/node/internals/components/PickersTextField/PickersTextField.js +15 -6
  106. package/node/internals/components/PickersTextField/pickersTextFieldClasses.js +6 -9
  107. package/node/internals/hooks/useField/useField.js +8 -1
  108. package/node/internals/hooks/useViews.js +13 -13
  109. package/node/locales/ruRU.js +1 -2
  110. package/package.json +5 -5
  111. package/internals/components/PickersTextField/PickersInput.d.ts +0 -3
  112. package/internals/components/PickersTextField/PickersInput.types.d.ts +0 -45
  113. /package/{internals/components/PickersTextField/PickersInput.types.js → PickersSectionList/PickersSectionList.types.js} +0 -0
  114. /package/{legacy/internals/components/PickersTextField → internals/components/PickersInput}/PickersInput.types.js +0 -0
  115. /package/{modern/internals/components/PickersTextField/PickersInput.types.js → legacy/PickersSectionList/PickersSectionList.types.js} +0 -0
  116. /package/node/{internals/components/PickersTextField/PickersInput.types.js → PickersSectionList/PickersSectionList.types.js} +0 -0
@@ -0,0 +1,223 @@
1
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
+ import _extends from "@babel/runtime/helpers/esm/extends";
3
+ const _excluded = ["slots", "slotProps", "elements", "sectionListRef"];
4
+ import * as React from 'react';
5
+ import styled from '@mui/system/styled';
6
+ import PropTypes from 'prop-types';
7
+ import { useSlotProps } from '@mui/base/utils';
8
+ import composeClasses from '@mui/utils/composeClasses';
9
+ import useForkRef from '@mui/utils/useForkRef';
10
+ import { getPickersSectionListUtilityClass, pickersSectionListClasses } from './pickersSectionListClasses';
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ import { jsxs as _jsxs } from "react/jsx-runtime";
13
+ export const PickersSectionListRoot = styled('div', {
14
+ name: 'MuiPickersSectionList',
15
+ slot: 'Root',
16
+ overridesResolver: (props, styles) => styles.root
17
+ })({
18
+ direction: 'ltr /*! @noflip */',
19
+ outline: 'none'
20
+ });
21
+ export const PickersSectionListSection = styled('span', {
22
+ name: 'MuiPickersSectionList',
23
+ slot: 'Section',
24
+ overridesResolver: (props, styles) => styles.section
25
+ })({});
26
+ export const PickersSectionListSectionSeparator = styled('span', {
27
+ name: 'MuiPickersSectionList',
28
+ slot: 'SectionSeparator',
29
+ overridesResolver: (props, styles) => styles.sectionSeparator
30
+ })({
31
+ whiteSpace: 'pre'
32
+ });
33
+ export const PickersSectionListSectionContent = styled('span', {
34
+ name: 'MuiPickersSectionList',
35
+ slot: 'SectionContent',
36
+ overridesResolver: (props, styles) => styles.sectionContent
37
+ })({
38
+ outline: 'none'
39
+ });
40
+ const useUtilityClasses = ownerState => {
41
+ const {
42
+ classes
43
+ } = ownerState;
44
+ const slots = {
45
+ root: ['root'],
46
+ section: ['section'],
47
+ sectionContent: ['sectionContent']
48
+ };
49
+ return composeClasses(slots, getPickersSectionListUtilityClass, classes);
50
+ };
51
+ /**
52
+ * Demos:
53
+ *
54
+ * - [Custom field](https://mui.com/x/react-date-pickers/custom-field/)
55
+ *
56
+ * API:
57
+ *
58
+ * - [PickersSectionList API](https://mui.com/x/api/date-pickers/pickers-section-list/)
59
+ */
60
+ function PickersSection(props) {
61
+ var _slots$section, _slots$sectionContent, _slots$sectionSeparat;
62
+ const {
63
+ slots,
64
+ slotProps,
65
+ element,
66
+ classes
67
+ } = props;
68
+ const Section = (_slots$section = slots == null ? void 0 : slots.section) != null ? _slots$section : PickersSectionListSection;
69
+ const sectionProps = useSlotProps({
70
+ elementType: Section,
71
+ externalSlotProps: slotProps == null ? void 0 : slotProps.section,
72
+ externalForwardedProps: element.container,
73
+ className: classes.section,
74
+ ownerState: {}
75
+ });
76
+ const SectionContent = (_slots$sectionContent = slots == null ? void 0 : slots.sectionContent) != null ? _slots$sectionContent : PickersSectionListSectionContent;
77
+ const sectionContentProps = useSlotProps({
78
+ elementType: SectionContent,
79
+ externalSlotProps: slotProps == null ? void 0 : slotProps.sectionContent,
80
+ externalForwardedProps: element.content,
81
+ additionalProps: {
82
+ suppressContentEditableWarning: true
83
+ },
84
+ className: classes.sectionContent,
85
+ ownerState: {}
86
+ });
87
+ const SectionSeparator = (_slots$sectionSeparat = slots == null ? void 0 : slots.sectionSeparator) != null ? _slots$sectionSeparat : PickersSectionListSectionSeparator;
88
+ const sectionSeparatorBeforeProps = useSlotProps({
89
+ elementType: SectionSeparator,
90
+ externalSlotProps: slotProps == null ? void 0 : slotProps.sectionSeparator,
91
+ externalForwardedProps: element.before,
92
+ ownerState: {
93
+ position: 'before'
94
+ }
95
+ });
96
+ const sectionSeparatorAfterProps = useSlotProps({
97
+ elementType: SectionSeparator,
98
+ externalSlotProps: slotProps == null ? void 0 : slotProps.sectionSeparator,
99
+ externalForwardedProps: element.after,
100
+ ownerState: {
101
+ position: 'after'
102
+ }
103
+ });
104
+ return /*#__PURE__*/_jsxs(Section, _extends({}, sectionProps, {
105
+ children: [/*#__PURE__*/_jsx(SectionSeparator, _extends({}, sectionSeparatorBeforeProps)), /*#__PURE__*/_jsx(SectionContent, _extends({}, sectionContentProps)), /*#__PURE__*/_jsx(SectionSeparator, _extends({}, sectionSeparatorAfterProps))]
106
+ }));
107
+ }
108
+ const PickersSectionList = /*#__PURE__*/React.forwardRef(function PickersSectionList(props, ref) {
109
+ var _slots$root;
110
+ const {
111
+ slots,
112
+ slotProps,
113
+ elements,
114
+ sectionListRef
115
+ } = props,
116
+ other = _objectWithoutPropertiesLoose(props, _excluded);
117
+ const classes = useUtilityClasses(props);
118
+ const rootRef = React.useRef(null);
119
+ const handleRootRef = useForkRef(ref, rootRef);
120
+ const getRoot = methodName => {
121
+ if (!rootRef.current) {
122
+ throw new Error(`MUI: Cannot call sectionListRef.${methodName} before the mount of the component`);
123
+ }
124
+ return rootRef.current;
125
+ };
126
+ React.useImperativeHandle(sectionListRef, () => ({
127
+ getRoot() {
128
+ return getRoot('getRoot');
129
+ },
130
+ getSectionContainer(index) {
131
+ const root = getRoot('getSectionContainer');
132
+ return root.querySelector(`.${pickersSectionListClasses.section}[data-sectionindex="${index}"]`);
133
+ },
134
+ getSectionContent(index) {
135
+ const root = getRoot('getSectionContent');
136
+ return root.querySelector(`.${pickersSectionListClasses.section}[data-sectionindex="${index}"] .${pickersSectionListClasses.sectionContent}`);
137
+ },
138
+ getSectionIndexFromDOMElement(element) {
139
+ const root = getRoot('getSectionIndexFromDOMElement');
140
+ if (element == null || !root.contains(element)) {
141
+ return null;
142
+ }
143
+ let sectionContainer = null;
144
+ if (element.classList.contains(pickersSectionListClasses.section)) {
145
+ sectionContainer = element;
146
+ } else if (element.classList.contains(pickersSectionListClasses.sectionContent)) {
147
+ sectionContainer = element.parentElement;
148
+ }
149
+ if (sectionContainer == null) {
150
+ return null;
151
+ }
152
+ return Number(sectionContainer.dataset.sectionindex);
153
+ }
154
+ }));
155
+ const Root = (_slots$root = slots == null ? void 0 : slots.root) != null ? _slots$root : PickersSectionListRoot;
156
+ const rootProps = useSlotProps({
157
+ elementType: Root,
158
+ externalSlotProps: slotProps == null ? void 0 : slotProps.root,
159
+ externalForwardedProps: other,
160
+ additionalProps: {
161
+ ref: handleRootRef,
162
+ suppressContentEditableWarning: true
163
+ },
164
+ className: classes.root,
165
+ ownerState: {}
166
+ });
167
+ return /*#__PURE__*/_jsx(Root, _extends({}, rootProps, {
168
+ children: rootProps.contentEditable ? elements.map(({
169
+ content,
170
+ before,
171
+ after
172
+ }) => `${before.children}${content.children}${after.children}`).join('') : /*#__PURE__*/_jsx(React.Fragment, {
173
+ children: elements.map((element, elementIndex) => /*#__PURE__*/_jsx(PickersSection, {
174
+ slots: slots,
175
+ slotProps: slotProps,
176
+ element: element,
177
+ classes: classes
178
+ }, elementIndex))
179
+ })
180
+ }));
181
+ });
182
+ process.env.NODE_ENV !== "production" ? PickersSectionList.propTypes = {
183
+ // ----------------------------- Warning --------------------------------
184
+ // | These PropTypes are generated from the TypeScript type definitions |
185
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
186
+ // ----------------------------------------------------------------------
187
+ /**
188
+ * Override or extend the styles applied to the component.
189
+ */
190
+ classes: PropTypes.object,
191
+ /**
192
+ * If true, the whole element is editable.
193
+ * Useful when all the sections are selected.
194
+ */
195
+ contentEditable: PropTypes.bool.isRequired,
196
+ /**
197
+ * The elements to render.
198
+ * Each element contains the prop to edit a section of the value.
199
+ */
200
+ elements: PropTypes.arrayOf(PropTypes.shape({
201
+ after: PropTypes.object.isRequired,
202
+ before: PropTypes.object.isRequired,
203
+ container: PropTypes.object.isRequired,
204
+ content: PropTypes.object.isRequired
205
+ })).isRequired,
206
+ sectionListRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
207
+ current: PropTypes.shape({
208
+ getRoot: PropTypes.func.isRequired,
209
+ getSectionContainer: PropTypes.func.isRequired,
210
+ getSectionContent: PropTypes.func.isRequired,
211
+ getSectionIndexFromDOMElement: PropTypes.func.isRequired
212
+ })
213
+ })]),
214
+ /**
215
+ * The props used for each component slot.
216
+ */
217
+ slotProps: PropTypes.object,
218
+ /**
219
+ * Overridable component slots.
220
+ */
221
+ slots: PropTypes.object
222
+ } : void 0;
223
+ export { PickersSectionList };
@@ -0,0 +1,56 @@
1
+ import * as React from 'react';
2
+ import { SlotComponentProps } from '@mui/base/utils';
3
+ import { PickersSectionListClasses } from './pickersSectionListClasses';
4
+ export interface PickersSectionListSlots {
5
+ root: React.ElementType;
6
+ section: React.ElementType;
7
+ sectionSeparator: React.ElementType;
8
+ sectionContent: React.ElementType;
9
+ }
10
+ export interface PickersSectionListSlotProps {
11
+ root?: SlotComponentProps<'div', {}, {}>;
12
+ section?: SlotComponentProps<'span', {}, {}>;
13
+ sectionSeparator?: SlotComponentProps<'span', {}, {
14
+ position: 'before' | 'after';
15
+ }>;
16
+ sectionContent?: SlotComponentProps<'span', {}, {}>;
17
+ }
18
+ export interface PickersSectionElement {
19
+ container: React.HTMLAttributes<HTMLSpanElement>;
20
+ content: React.HTMLAttributes<HTMLSpanElement>;
21
+ before: React.HTMLAttributes<HTMLSpanElement>;
22
+ after: React.HTMLAttributes<HTMLSpanElement>;
23
+ }
24
+ export interface PickersSectionListRef {
25
+ getRoot: () => HTMLElement;
26
+ getSectionContainer: (sectionIndex: number) => HTMLElement;
27
+ getSectionContent: (sectionIndex: number) => HTMLElement;
28
+ getSectionIndexFromDOMElement: (element: Element | null | undefined) => number | null;
29
+ }
30
+ export interface ExportedPickersSectionListProps extends Pick<React.HTMLAttributes<HTMLDivElement>, 'tabIndex'> {
31
+ /**
32
+ * The elements to render.
33
+ * Each element contains the prop to edit a section of the value.
34
+ */
35
+ elements: PickersSectionElement[];
36
+ sectionListRef: React.Ref<PickersSectionListRef>;
37
+ /**
38
+ * If true, the whole element is editable.
39
+ * Useful when all the sections are selected.
40
+ */
41
+ contentEditable: boolean;
42
+ }
43
+ export interface PickersSectionListProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'contentEditable'>, ExportedPickersSectionListProps {
44
+ /**
45
+ * Overridable component slots.
46
+ */
47
+ slots?: PickersSectionListSlots;
48
+ /**
49
+ * The props used for each component slot.
50
+ */
51
+ slotProps?: PickersSectionListSlotProps;
52
+ /**
53
+ * Override or extend the styles applied to the component.
54
+ */
55
+ classes?: Partial<PickersSectionListClasses>;
56
+ }
@@ -0,0 +1,4 @@
1
+ export { PickersSectionList as Unstable_PickersSectionList, PickersSectionListRoot as Unstable_PickersSectionListRoot, PickersSectionListSection as Unstable_PickersSectionListSection, PickersSectionListSectionSeparator as Unstable_PickersSectionListSectionSeparator, PickersSectionListSectionContent as Unstable_PickersSectionListSectionContent, } from './PickersSectionList';
2
+ export type { PickersSectionListProps, PickersSectionElement, PickersSectionListRef, PickersSectionListSlots, PickersSectionListSlotProps, ExportedPickersSectionListProps, } from './PickersSectionList.types';
3
+ export { getPickersSectionListUtilityClass, pickersSectionListClasses, } from './pickersSectionListClasses';
4
+ export type { PickersSectionListClasses, PickersSectionListClassKey, } from './pickersSectionListClasses';
@@ -0,0 +1,2 @@
1
+ export { PickersSectionList as Unstable_PickersSectionList, PickersSectionListRoot as Unstable_PickersSectionListRoot, PickersSectionListSection as Unstable_PickersSectionListSection, PickersSectionListSectionSeparator as Unstable_PickersSectionListSectionSeparator, PickersSectionListSectionContent as Unstable_PickersSectionListSectionContent } from './PickersSectionList';
2
+ export { getPickersSectionListUtilityClass, pickersSectionListClasses } from './pickersSectionListClasses';
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "main": "../node/PickersSectionList/index.js",
5
+ "types": "./index.d.ts"
6
+ }
@@ -0,0 +1,11 @@
1
+ export interface PickersSectionListClasses {
2
+ /** Styles applied to the root element. */
3
+ root: string;
4
+ /** Styles applied to the container of a section. */
5
+ section: string;
6
+ /** Styles applied to the content of a section. */
7
+ sectionContent: string;
8
+ }
9
+ export type PickersSectionListClassKey = keyof PickersSectionListClasses;
10
+ export declare function getPickersSectionListUtilityClass(slot: string): string;
11
+ export declare const pickersSectionListClasses: Record<keyof PickersSectionListClasses, string>;
@@ -0,0 +1,6 @@
1
+ import generateUtilityClass from '@mui/utils/generateUtilityClass';
2
+ import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
3
+ export function getPickersSectionListUtilityClass(slot) {
4
+ return generateUtilityClass('MuiPickersSectionList', slot);
5
+ }
6
+ export const pickersSectionListClasses = generateUtilityClasses('MuiPickersSectionList', ['root', 'section', 'sectionContent']);
@@ -383,8 +383,9 @@ process.env.NODE_ENV !== "production" ? TimeClock.propTypes = {
383
383
  minutesStep: PropTypes.number,
384
384
  /**
385
385
  * Callback fired when the value changes.
386
- * @template TDate, TView
387
- * @param {TDate | null} value The new value.
386
+ * @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.
387
+ * @template TView The view type. Will be one of date or time views.
388
+ * @param {TValue} value The new value.
388
389
  * @param {PickerSelectionState | undefined} selectionState Indicates if the date selection is complete.
389
390
  * @param {TView | undefined} selectedView Indicates the view in which the selection has been made.
390
391
  */
package/index.d.ts CHANGED
@@ -29,6 +29,7 @@ export * from './PickersLayout';
29
29
  export * from './PickersActionBar';
30
30
  export * from './PickersShortcuts';
31
31
  export * from './PickersCalendarHeader';
32
+ export * from './PickersSectionList';
32
33
  export { DEFAULT_DESKTOP_MODE_MEDIA_QUERY } from './internals/utils/utils';
33
34
  export * from './models';
34
35
  export * from './icons';
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers v7.0.0-alpha.5
2
+ * @mui/x-date-pickers v7.0.0-alpha.7
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -49,6 +49,9 @@ export * from './PickersShortcuts';
49
49
 
50
50
  // Other slots
51
51
  export * from './PickersCalendarHeader';
52
+
53
+ // Field utilities
54
+ export * from './PickersSectionList';
52
55
  export { DEFAULT_DESKTOP_MODE_MEDIA_QUERY } from './internals/utils/utils';
53
56
  export * from './models';
54
57
  export * from './icons';
@@ -3,6 +3,7 @@ interface OutlineProps extends React.HTMLAttributes<HTMLFieldSetElement> {
3
3
  notched: boolean;
4
4
  shrink: boolean;
5
5
  label: React.ReactNode;
6
+ ownerState: any;
6
7
  }
7
8
  export default function Outline(props: OutlineProps): React.JSX.Element;
8
9
  export {};
@@ -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 {};