@mui/x-date-pickers 8.0.0-alpha.3 → 8.0.0-alpha.4
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 +274 -0
- package/DateField/useDateField.d.ts +1 -1
- package/DatePicker/DatePickerToolbar.js +8 -9
- package/DateTimeField/useDateTimeField.d.ts +1 -1
- package/DateTimePicker/DateTimePickerToolbar.d.ts +6 -2
- package/DateTimePicker/DateTimePickerToolbar.js +53 -39
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +1 -2
- package/DigitalClock/DigitalClock.js +13 -11
- package/DigitalClock/DigitalClock.types.d.ts +8 -2
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +8 -7
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +12 -10
- package/PickersLayout/PickersLayout.js +2 -2
- package/PickersLayout/PickersLayout.types.d.ts +4 -2
- package/PickersLayout/usePickerLayout.js +3 -3
- package/README.md +1 -1
- package/TimeClock/Clock.js +18 -21
- package/TimeClock/ClockNumber.js +15 -11
- package/TimeClock/ClockPointer.d.ts +6 -1
- package/TimeClock/ClockPointer.js +14 -10
- package/TimeClock/TimeClock.js +9 -8
- package/TimeField/useTimeField.d.ts +1 -1
- package/TimePicker/TimePickerToolbar.js +14 -17
- package/hooks/useClearableField.d.ts +5 -3
- package/hooks/useClearableField.js +4 -2
- package/index.js +1 -1
- package/internals/components/PickerProvider.d.ts +1 -1
- package/internals/components/PickersPopper.d.ts +11 -7
- package/internals/components/PickersPopper.js +18 -20
- package/internals/components/PickersToolbar.js +15 -12
- package/internals/components/PickersToolbarButton.js +4 -6
- package/internals/components/PickersToolbarText.js +11 -13
- package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +3 -2
- package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +3 -2
- package/internals/hooks/usePicker/usePicker.js +3 -3
- package/internals/hooks/usePicker/usePicker.types.d.ts +3 -2
- package/internals/hooks/usePicker/usePickerProvider.d.ts +15 -4
- package/internals/hooks/usePicker/usePickerProvider.js +8 -4
- package/internals/hooks/usePicker/usePickerViews.d.ts +5 -15
- package/internals/hooks/usePicker/usePickerViews.js +5 -6
- package/internals/hooks/useToolbarOwnerState.d.ts +10 -0
- package/internals/hooks/useToolbarOwnerState.js +13 -0
- package/internals/index.d.ts +5 -1
- package/internals/index.js +3 -1
- package/internals/models/common.d.ts +1 -1
- package/locales/roRO.js +15 -18
- package/modern/DatePicker/DatePickerToolbar.js +8 -9
- package/modern/DateTimePicker/DateTimePickerToolbar.js +53 -39
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +1 -2
- package/modern/DigitalClock/DigitalClock.js +13 -11
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +8 -7
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +12 -10
- package/modern/PickersLayout/PickersLayout.js +2 -2
- package/modern/PickersLayout/usePickerLayout.js +3 -3
- package/modern/TimeClock/Clock.js +18 -21
- package/modern/TimeClock/ClockNumber.js +15 -11
- package/modern/TimeClock/ClockPointer.js +14 -10
- package/modern/TimeClock/TimeClock.js +9 -8
- package/modern/TimePicker/TimePickerToolbar.js +14 -17
- package/modern/hooks/useClearableField.js +4 -2
- package/modern/index.js +1 -1
- package/modern/internals/components/PickersPopper.js +18 -20
- package/modern/internals/components/PickersToolbar.js +15 -12
- package/modern/internals/components/PickersToolbarButton.js +4 -6
- package/modern/internals/components/PickersToolbarText.js +11 -13
- package/modern/internals/hooks/usePicker/usePicker.js +3 -3
- package/modern/internals/hooks/usePicker/usePickerProvider.js +8 -4
- package/modern/internals/hooks/usePicker/usePickerViews.js +5 -6
- package/modern/internals/hooks/useToolbarOwnerState.js +13 -0
- package/modern/internals/index.js +3 -1
- package/modern/locales/roRO.js +15 -18
- package/node/DatePicker/DatePickerToolbar.js +8 -9
- package/node/DateTimePicker/DateTimePickerToolbar.js +54 -39
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +1 -2
- package/node/DigitalClock/DigitalClock.js +13 -11
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +8 -7
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +12 -10
- package/node/PickersLayout/PickersLayout.js +2 -2
- package/node/PickersLayout/usePickerLayout.js +3 -3
- package/node/TimeClock/Clock.js +18 -21
- package/node/TimeClock/ClockNumber.js +15 -11
- package/node/TimeClock/ClockPointer.js +14 -10
- package/node/TimeClock/TimeClock.js +9 -8
- package/node/TimePicker/TimePickerToolbar.js +14 -17
- package/node/hooks/useClearableField.js +4 -2
- package/node/index.js +1 -1
- package/node/internals/components/PickersPopper.js +18 -20
- package/node/internals/components/PickersToolbar.js +15 -12
- package/node/internals/components/PickersToolbarButton.js +4 -6
- package/node/internals/components/PickersToolbarText.js +10 -12
- package/node/internals/hooks/usePicker/usePicker.js +3 -3
- package/node/internals/hooks/usePicker/usePickerProvider.js +8 -4
- package/node/internals/hooks/usePicker/usePickerViews.js +5 -6
- package/node/internals/hooks/useToolbarOwnerState.js +21 -0
- package/node/internals/index.js +15 -1
- package/node/locales/roRO.js +15 -18
- package/package.json +1 -1
|
@@ -16,11 +16,8 @@ var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"
|
|
|
16
16
|
var _PickersToolbarText = require("./PickersToolbarText");
|
|
17
17
|
var _pickersToolbarClasses = require("./pickersToolbarClasses");
|
|
18
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
-
const _excluded = ["align", "className", "selected", "typographyClassName", "value", "variant", "width"];
|
|
20
|
-
const useUtilityClasses =
|
|
21
|
-
const {
|
|
22
|
-
classes
|
|
23
|
-
} = ownerState;
|
|
19
|
+
const _excluded = ["align", "className", "classes", "selected", "typographyClassName", "value", "variant", "width"];
|
|
20
|
+
const useUtilityClasses = classes => {
|
|
24
21
|
const slots = {
|
|
25
22
|
root: ['root']
|
|
26
23
|
};
|
|
@@ -43,6 +40,7 @@ const PickersToolbarButton = exports.PickersToolbarButton = /*#__PURE__*/React.f
|
|
|
43
40
|
const {
|
|
44
41
|
align,
|
|
45
42
|
className,
|
|
43
|
+
classes: classesProp,
|
|
46
44
|
selected,
|
|
47
45
|
typographyClassName,
|
|
48
46
|
value,
|
|
@@ -50,7 +48,7 @@ const PickersToolbarButton = exports.PickersToolbarButton = /*#__PURE__*/React.f
|
|
|
50
48
|
width
|
|
51
49
|
} = props,
|
|
52
50
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
53
|
-
const classes = useUtilityClasses(
|
|
51
|
+
const classes = useUtilityClasses(classesProp);
|
|
54
52
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(PickersToolbarButtonRoot, (0, _extends2.default)({
|
|
55
53
|
variant: "text",
|
|
56
54
|
ref: ref,
|
|
@@ -15,29 +15,23 @@ var _styles = require("@mui/material/styles");
|
|
|
15
15
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
16
16
|
var _pickersToolbarTextClasses = require("./pickersToolbarTextClasses");
|
|
17
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
-
const _excluded = ["className", "selected", "value"];
|
|
19
|
-
const useUtilityClasses =
|
|
20
|
-
const {
|
|
21
|
-
classes,
|
|
22
|
-
selected
|
|
23
|
-
} = ownerState;
|
|
18
|
+
const _excluded = ["className", "classes", "selected", "value"];
|
|
19
|
+
const useUtilityClasses = classes => {
|
|
24
20
|
const slots = {
|
|
25
|
-
root: ['root'
|
|
21
|
+
root: ['root']
|
|
26
22
|
};
|
|
27
23
|
return (0, _composeClasses.default)(slots, _pickersToolbarTextClasses.getPickersToolbarTextUtilityClass, classes);
|
|
28
24
|
};
|
|
29
25
|
const PickersToolbarTextRoot = (0, _styles.styled)(_Typography.default, {
|
|
30
26
|
name: 'MuiPickersToolbarText',
|
|
31
27
|
slot: 'Root',
|
|
32
|
-
overridesResolver: (_, styles) => [styles.root
|
|
33
|
-
[`&.${_pickersToolbarTextClasses.pickersToolbarTextClasses.selected}`]: styles.selected
|
|
34
|
-
}]
|
|
28
|
+
overridesResolver: (_, styles) => [styles.root]
|
|
35
29
|
})(({
|
|
36
30
|
theme
|
|
37
31
|
}) => ({
|
|
38
32
|
transition: theme.transitions.create('color'),
|
|
39
33
|
color: (theme.vars || theme).palette.text.secondary,
|
|
40
|
-
[
|
|
34
|
+
[`&[data-selected]`]: {
|
|
41
35
|
color: (theme.vars || theme).palette.text.primary
|
|
42
36
|
}
|
|
43
37
|
}));
|
|
@@ -48,14 +42,18 @@ const PickersToolbarText = exports.PickersToolbarText = /*#__PURE__*/React.forwa
|
|
|
48
42
|
});
|
|
49
43
|
const {
|
|
50
44
|
className,
|
|
45
|
+
classes: classesProp,
|
|
46
|
+
selected,
|
|
51
47
|
value
|
|
52
48
|
} = props,
|
|
53
49
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
54
|
-
const classes = useUtilityClasses(
|
|
50
|
+
const classes = useUtilityClasses(classesProp);
|
|
55
51
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(PickersToolbarTextRoot, (0, _extends2.default)({
|
|
56
52
|
ref: ref,
|
|
57
53
|
className: (0, _clsx.default)(classes.root, className),
|
|
58
54
|
component: "span"
|
|
55
|
+
}, selected && {
|
|
56
|
+
'data-selected': true
|
|
59
57
|
}, other, {
|
|
60
58
|
children: value
|
|
61
59
|
}));
|
|
@@ -47,8 +47,8 @@ const usePicker = ({
|
|
|
47
47
|
localeText,
|
|
48
48
|
valueManager,
|
|
49
49
|
variant,
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
paramsFromUsePickerValue: pickerValueResponse.provider,
|
|
51
|
+
paramsFromUsePickerViews: pickerViewsResponse.provider
|
|
52
52
|
});
|
|
53
53
|
return {
|
|
54
54
|
// Picker value
|
|
@@ -57,7 +57,7 @@ const usePicker = ({
|
|
|
57
57
|
fieldProps: pickerValueResponse.fieldProps,
|
|
58
58
|
// Picker views
|
|
59
59
|
renderCurrentView: pickerViewsResponse.renderCurrentView,
|
|
60
|
-
hasUIView: pickerViewsResponse.hasUIView,
|
|
60
|
+
hasUIView: pickerViewsResponse.provider.hasUIView,
|
|
61
61
|
shouldRestoreFocus: pickerViewsResponse.shouldRestoreFocus,
|
|
62
62
|
// Picker layout
|
|
63
63
|
layoutProps: (0, _extends2.default)({}, pickerViewsResponse.layoutProps, pickerValueResponse.layoutProps),
|
|
@@ -50,11 +50,11 @@ function usePickerProvider(parameters) {
|
|
|
50
50
|
valueManager,
|
|
51
51
|
localeText,
|
|
52
52
|
variant,
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
paramsFromUsePickerValue,
|
|
54
|
+
paramsFromUsePickerViews
|
|
55
55
|
} = parameters;
|
|
56
56
|
const utils = (0, _useUtils.useUtils)();
|
|
57
|
-
const orientation = usePickerOrientation(views, props.orientation);
|
|
57
|
+
const orientation = usePickerOrientation(paramsFromUsePickerViews.views, props.orientation);
|
|
58
58
|
const ownerState = React.useMemo(() => ({
|
|
59
59
|
isPickerValueEmpty: valueManager.areValuesEqual(utils, paramsFromUsePickerValue.value, valueManager.emptyValue),
|
|
60
60
|
isPickerOpen: paramsFromUsePickerValue.contextValue.open,
|
|
@@ -80,6 +80,10 @@ function usePickerProvider(parameters) {
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
/**
|
|
83
|
-
* Props used to create the
|
|
83
|
+
* Props used to create the picker's contexts.
|
|
84
84
|
* Those props are exposed on all the pickers.
|
|
85
|
+
*/
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Props used to create the picker's contexts and that are not available on static pickers.
|
|
85
89
|
*/
|
|
@@ -18,10 +18,6 @@ const _excluded = ["className", "sx"];
|
|
|
18
18
|
* Props used to handle the views that are common to all pickers.
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
/**
|
|
22
|
-
* Props used to handle the views of the pickers.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
21
|
/**
|
|
26
22
|
* Props used to handle the value of the pickers.
|
|
27
23
|
*/
|
|
@@ -139,11 +135,14 @@ const usePickerViews = ({
|
|
|
139
135
|
view: popperView,
|
|
140
136
|
onViewChange: setView
|
|
141
137
|
};
|
|
142
|
-
|
|
138
|
+
const providerParams = {
|
|
143
139
|
hasUIView,
|
|
144
|
-
views
|
|
140
|
+
views
|
|
141
|
+
};
|
|
142
|
+
return {
|
|
145
143
|
shouldRestoreFocus,
|
|
146
144
|
layoutProps,
|
|
145
|
+
provider: providerParams,
|
|
147
146
|
renderCurrentView: () => {
|
|
148
147
|
if (popperView == null) {
|
|
149
148
|
return null;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.useToolbarOwnerState = useToolbarOwnerState;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _RtlProvider = require("@mui/system/RtlProvider");
|
|
12
|
+
var _usePickerPrivateContext = require("./usePickerPrivateContext");
|
|
13
|
+
function useToolbarOwnerState() {
|
|
14
|
+
const {
|
|
15
|
+
ownerState: pickerOwnerState
|
|
16
|
+
} = (0, _usePickerPrivateContext.usePickerPrivateContext)();
|
|
17
|
+
const isRtl = (0, _RtlProvider.useRtl)();
|
|
18
|
+
return React.useMemo(() => (0, _extends2.default)({}, pickerOwnerState, {
|
|
19
|
+
toolbarDirection: isRtl ? 'rtl' : 'ltr'
|
|
20
|
+
}), [pickerOwnerState, isRtl]);
|
|
21
|
+
}
|
package/node/internals/index.js
CHANGED
|
@@ -21,6 +21,12 @@ Object.defineProperty(exports, "DIALOG_WIDTH", {
|
|
|
21
21
|
return _dimensions.DIALOG_WIDTH;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
+
Object.defineProperty(exports, "DateTimePickerToolbarForceDesktopVariant", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _DateTimePickerToolbar.DateTimePickerToolbarForceDesktopVariant;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
24
30
|
Object.defineProperty(exports, "DayCalendar", {
|
|
25
31
|
enumerable: true,
|
|
26
32
|
get: function () {
|
|
@@ -309,6 +315,12 @@ Object.defineProperty(exports, "useStaticPicker", {
|
|
|
309
315
|
return _useStaticPicker.useStaticPicker;
|
|
310
316
|
}
|
|
311
317
|
});
|
|
318
|
+
Object.defineProperty(exports, "useToolbarOwnerState", {
|
|
319
|
+
enumerable: true,
|
|
320
|
+
get: function () {
|
|
321
|
+
return _useToolbarOwnerState.useToolbarOwnerState;
|
|
322
|
+
}
|
|
323
|
+
});
|
|
312
324
|
Object.defineProperty(exports, "useUtils", {
|
|
313
325
|
enumerable: true,
|
|
314
326
|
get: function () {
|
|
@@ -339,6 +351,7 @@ var _useFieldOwnerState = require("./hooks/useFieldOwnerState");
|
|
|
339
351
|
var _usePicker = require("./hooks/usePicker");
|
|
340
352
|
var _usePickerPrivateContext = require("./hooks/usePickerPrivateContext");
|
|
341
353
|
var _useStaticPicker = require("./hooks/useStaticPicker");
|
|
354
|
+
var _useToolbarOwnerState = require("./hooks/useToolbarOwnerState");
|
|
342
355
|
var _useUtils = require("./hooks/useUtils");
|
|
343
356
|
var _useViews = require("./hooks/useViews");
|
|
344
357
|
var _dateHelpersHooks = require("./hooks/date-helpers-hooks");
|
|
@@ -352,4 +365,5 @@ var _useDefaultReduceAnimations = require("./hooks/useDefaultReduceAnimations");
|
|
|
352
365
|
var _views = require("./utils/views");
|
|
353
366
|
var _DayCalendar = require("../DateCalendar/DayCalendar");
|
|
354
367
|
var _useCalendarState = require("../DateCalendar/useCalendarState");
|
|
355
|
-
var _timeUtils = require("./utils/time-utils");
|
|
368
|
+
var _timeUtils = require("./utils/time-utils");
|
|
369
|
+
var _DateTimePickerToolbar = require("../DateTimePicker/DateTimePickerToolbar");
|
package/node/locales/roRO.js
CHANGED
|
@@ -23,11 +23,10 @@ const roROPickers = {
|
|
|
23
23
|
// DateRange labels
|
|
24
24
|
start: 'Început',
|
|
25
25
|
end: 'Sfârșit',
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
startDate: 'Data de început',
|
|
27
|
+
startTime: 'Ora de început',
|
|
28
|
+
endDate: 'Data de sfârșit',
|
|
29
|
+
endTime: 'Ora de sfârșit',
|
|
31
30
|
// Action bar
|
|
32
31
|
cancelButtonLabel: 'Anulare',
|
|
33
32
|
clearButtonLabel: 'Ștergere',
|
|
@@ -61,23 +60,21 @@ const roROPickers = {
|
|
|
61
60
|
fieldYearPlaceholder: params => 'A'.repeat(params.digitAmount),
|
|
62
61
|
fieldMonthPlaceholder: params => params.contentType === 'letter' ? 'LLLL' : 'LL',
|
|
63
62
|
fieldDayPlaceholder: () => 'ZZ',
|
|
64
|
-
|
|
63
|
+
fieldWeekDayPlaceholder: params => params.contentType === 'letter' ? 'ZZZZ' : 'ZZ',
|
|
65
64
|
fieldHoursPlaceholder: () => 'hh',
|
|
66
65
|
fieldMinutesPlaceholder: () => 'mm',
|
|
67
66
|
fieldSecondsPlaceholder: () => 'ss',
|
|
68
|
-
fieldMeridiemPlaceholder: () => 'aa'
|
|
69
|
-
|
|
67
|
+
fieldMeridiemPlaceholder: () => 'aa',
|
|
70
68
|
// View names
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
69
|
+
year: 'An',
|
|
70
|
+
month: 'Luna',
|
|
71
|
+
day: 'Ziua',
|
|
72
|
+
weekDay: 'Ziua saptămânii',
|
|
73
|
+
hours: 'Ore',
|
|
74
|
+
minutes: 'Minute',
|
|
75
|
+
seconds: 'Secunde',
|
|
76
|
+
meridiem: 'Meridiem',
|
|
80
77
|
// Common
|
|
81
|
-
|
|
78
|
+
empty: 'Gol'
|
|
82
79
|
};
|
|
83
80
|
const roRO = exports.roRO = (0, _getPickersLocalization.getPickersLocalization)(roROPickers);
|