@mui/x-date-pickers 8.0.0-alpha.2 → 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 +376 -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/PickersActionBar/PickersActionBar.js +8 -1
- package/PickersLayout/PickersLayout.js +2 -2
- package/PickersLayout/PickersLayout.types.d.ts +4 -2
- package/PickersLayout/usePickerLayout.js +3 -3
- package/PickersShortcuts/PickersShortcuts.js +8 -1
- 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 +2 -15
- 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/useOpenState.d.ts +3 -2
- package/internals/hooks/useOpenState.js +10 -9
- 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 +17 -6
- package/internals/hooks/usePicker/usePickerProvider.js +14 -12
- package/internals/hooks/usePicker/usePickerValue.js +22 -11
- package/internals/hooks/usePicker/usePickerValue.types.d.ts +26 -0
- 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/PickersActionBar/PickersActionBar.js +8 -1
- package/modern/PickersLayout/PickersLayout.js +2 -2
- package/modern/PickersLayout/usePickerLayout.js +3 -3
- package/modern/PickersShortcuts/PickersShortcuts.js +8 -1
- 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/useOpenState.js +10 -9
- package/modern/internals/hooks/usePicker/usePicker.js +3 -3
- package/modern/internals/hooks/usePicker/usePickerProvider.js +14 -12
- package/modern/internals/hooks/usePicker/usePickerValue.js +22 -11
- 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/PickersActionBar/PickersActionBar.js +8 -1
- package/node/PickersLayout/PickersLayout.js +2 -2
- package/node/PickersLayout/usePickerLayout.js +3 -3
- package/node/PickersShortcuts/PickersShortcuts.js +8 -1
- 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/useOpenState.js +10 -9
- package/node/internals/hooks/usePicker/usePicker.js +3 -3
- package/node/internals/hooks/usePicker/usePickerProvider.js +15 -13
- package/node/internals/hooks/usePicker/usePickerValue.js +22 -11
- 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
|
@@ -1,35 +1,29 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["className", "selected", "value"];
|
|
3
|
+
const _excluded = ["className", "classes", "selected", "value"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import Typography from '@mui/material/Typography';
|
|
7
7
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
8
8
|
import composeClasses from '@mui/utils/composeClasses';
|
|
9
|
-
import { getPickersToolbarTextUtilityClass
|
|
9
|
+
import { getPickersToolbarTextUtilityClass } from "./pickersToolbarTextClasses.js";
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
-
const useUtilityClasses =
|
|
12
|
-
const {
|
|
13
|
-
classes,
|
|
14
|
-
selected
|
|
15
|
-
} = ownerState;
|
|
11
|
+
const useUtilityClasses = classes => {
|
|
16
12
|
const slots = {
|
|
17
|
-
root: ['root'
|
|
13
|
+
root: ['root']
|
|
18
14
|
};
|
|
19
15
|
return composeClasses(slots, getPickersToolbarTextUtilityClass, classes);
|
|
20
16
|
};
|
|
21
17
|
const PickersToolbarTextRoot = styled(Typography, {
|
|
22
18
|
name: 'MuiPickersToolbarText',
|
|
23
19
|
slot: 'Root',
|
|
24
|
-
overridesResolver: (_, styles) => [styles.root
|
|
25
|
-
[`&.${pickersToolbarTextClasses.selected}`]: styles.selected
|
|
26
|
-
}]
|
|
20
|
+
overridesResolver: (_, styles) => [styles.root]
|
|
27
21
|
})(({
|
|
28
22
|
theme
|
|
29
23
|
}) => ({
|
|
30
24
|
transition: theme.transitions.create('color'),
|
|
31
25
|
color: (theme.vars || theme).palette.text.secondary,
|
|
32
|
-
[
|
|
26
|
+
[`&[data-selected]`]: {
|
|
33
27
|
color: (theme.vars || theme).palette.text.primary
|
|
34
28
|
}
|
|
35
29
|
}));
|
|
@@ -40,14 +34,18 @@ export const PickersToolbarText = /*#__PURE__*/React.forwardRef(function Pickers
|
|
|
40
34
|
});
|
|
41
35
|
const {
|
|
42
36
|
className,
|
|
37
|
+
classes: classesProp,
|
|
38
|
+
selected,
|
|
43
39
|
value
|
|
44
40
|
} = props,
|
|
45
41
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
46
|
-
const classes = useUtilityClasses(
|
|
42
|
+
const classes = useUtilityClasses(classesProp);
|
|
47
43
|
return /*#__PURE__*/_jsx(PickersToolbarTextRoot, _extends({
|
|
48
44
|
ref: ref,
|
|
49
45
|
className: clsx(classes.root, className),
|
|
50
46
|
component: "span"
|
|
47
|
+
}, selected && {
|
|
48
|
+
'data-selected': true
|
|
51
49
|
}, other, {
|
|
52
50
|
children: value
|
|
53
51
|
}));
|
|
@@ -5,7 +5,7 @@ export const useOpenState = ({
|
|
|
5
5
|
onClose
|
|
6
6
|
}) => {
|
|
7
7
|
const isControllingOpenProp = React.useRef(typeof open === 'boolean').current;
|
|
8
|
-
const [openState,
|
|
8
|
+
const [openState, setOpenState] = React.useState(false);
|
|
9
9
|
|
|
10
10
|
// It is required to update inner state in useEffect in order to avoid situation when
|
|
11
11
|
// Our component is not mounted yet, but `open` state is set to `true` (for example initially opened)
|
|
@@ -14,22 +14,23 @@ export const useOpenState = ({
|
|
|
14
14
|
if (typeof open !== 'boolean') {
|
|
15
15
|
throw new Error('You must not mix controlling and uncontrolled mode for `open` prop');
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
setOpenState(open);
|
|
18
18
|
}
|
|
19
19
|
}, [isControllingOpenProp, open]);
|
|
20
|
-
const
|
|
20
|
+
const setOpen = React.useCallback(action => {
|
|
21
|
+
const newOpen = typeof action === 'function' ? action(openState) : action;
|
|
21
22
|
if (!isControllingOpenProp) {
|
|
22
|
-
|
|
23
|
+
setOpenState(newOpen);
|
|
23
24
|
}
|
|
24
|
-
if (
|
|
25
|
+
if (newOpen && onOpen) {
|
|
25
26
|
onOpen();
|
|
26
27
|
}
|
|
27
|
-
if (!
|
|
28
|
+
if (!newOpen && onClose) {
|
|
28
29
|
onClose();
|
|
29
30
|
}
|
|
30
|
-
}, [isControllingOpenProp, onOpen, onClose]);
|
|
31
|
+
}, [isControllingOpenProp, onOpen, onClose, openState]);
|
|
31
32
|
return {
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
open: openState,
|
|
34
|
+
setOpen
|
|
34
35
|
};
|
|
35
36
|
};
|
|
@@ -37,11 +37,11 @@ export const usePicker = ({
|
|
|
37
37
|
});
|
|
38
38
|
const providerProps = usePickerProvider({
|
|
39
39
|
props,
|
|
40
|
-
pickerValueResponse,
|
|
41
40
|
localeText,
|
|
42
41
|
valueManager,
|
|
43
42
|
variant,
|
|
44
|
-
|
|
43
|
+
paramsFromUsePickerValue: pickerValueResponse.provider,
|
|
44
|
+
paramsFromUsePickerViews: pickerViewsResponse.provider
|
|
45
45
|
});
|
|
46
46
|
return {
|
|
47
47
|
// Picker value
|
|
@@ -50,7 +50,7 @@ export const usePicker = ({
|
|
|
50
50
|
fieldProps: pickerValueResponse.fieldProps,
|
|
51
51
|
// Picker views
|
|
52
52
|
renderCurrentView: pickerViewsResponse.renderCurrentView,
|
|
53
|
-
hasUIView: pickerViewsResponse.hasUIView,
|
|
53
|
+
hasUIView: pickerViewsResponse.provider.hasUIView,
|
|
54
54
|
shouldRestoreFocus: pickerViewsResponse.shouldRestoreFocus,
|
|
55
55
|
// Picker layout
|
|
56
56
|
layoutProps: _extends({}, pickerViewsResponse.layoutProps, pickerValueResponse.layoutProps),
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
|
|
3
4
|
import { useUtils } from "../useUtils.js";
|
|
@@ -36,31 +37,28 @@ export const usePickerOrientation = (views, customOrientation) => {
|
|
|
36
37
|
export function usePickerProvider(parameters) {
|
|
37
38
|
const {
|
|
38
39
|
props,
|
|
39
|
-
pickerValueResponse,
|
|
40
40
|
valueManager,
|
|
41
41
|
localeText,
|
|
42
42
|
variant,
|
|
43
|
-
|
|
43
|
+
paramsFromUsePickerValue,
|
|
44
|
+
paramsFromUsePickerViews
|
|
44
45
|
} = parameters;
|
|
45
46
|
const utils = useUtils();
|
|
46
|
-
const orientation = usePickerOrientation(views, props.orientation);
|
|
47
|
+
const orientation = usePickerOrientation(paramsFromUsePickerViews.views, props.orientation);
|
|
47
48
|
const ownerState = React.useMemo(() => ({
|
|
48
|
-
isPickerValueEmpty: valueManager.areValuesEqual(utils,
|
|
49
|
-
isPickerOpen:
|
|
49
|
+
isPickerValueEmpty: valueManager.areValuesEqual(utils, paramsFromUsePickerValue.value, valueManager.emptyValue),
|
|
50
|
+
isPickerOpen: paramsFromUsePickerValue.contextValue.open,
|
|
50
51
|
isPickerDisabled: props.disabled ?? false,
|
|
51
52
|
isPickerReadOnly: props.readOnly ?? false,
|
|
52
53
|
pickerOrientation: orientation,
|
|
53
54
|
pickerVariant: variant
|
|
54
|
-
}), [utils, valueManager,
|
|
55
|
-
const contextValue = React.useMemo(() => ({
|
|
56
|
-
onOpen: pickerValueResponse.actions.onOpen,
|
|
57
|
-
onClose: pickerValueResponse.actions.onClose,
|
|
58
|
-
open: pickerValueResponse.open,
|
|
55
|
+
}), [utils, valueManager, paramsFromUsePickerValue.value, paramsFromUsePickerValue.contextValue.open, orientation, variant, props.disabled, props.readOnly]);
|
|
56
|
+
const contextValue = React.useMemo(() => _extends({}, paramsFromUsePickerValue.contextValue, {
|
|
59
57
|
disabled: props.disabled ?? false,
|
|
60
58
|
readOnly: props.readOnly ?? false,
|
|
61
59
|
variant,
|
|
62
60
|
orientation
|
|
63
|
-
}), [
|
|
61
|
+
}), [paramsFromUsePickerValue.contextValue, variant, orientation, props.disabled, props.readOnly]);
|
|
64
62
|
const privateContextValue = React.useMemo(() => ({
|
|
65
63
|
ownerState
|
|
66
64
|
}), [ownerState]);
|
|
@@ -72,6 +70,10 @@ export function usePickerProvider(parameters) {
|
|
|
72
70
|
}
|
|
73
71
|
|
|
74
72
|
/**
|
|
75
|
-
* Props used to create the
|
|
73
|
+
* Props used to create the picker's contexts.
|
|
76
74
|
* Those props are exposed on all the pickers.
|
|
75
|
+
*/
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Props used to create the picker's contexts and that are not available on static pickers.
|
|
77
79
|
*/
|
|
@@ -150,8 +150,8 @@ export const usePickerValue = ({
|
|
|
150
150
|
const utils = useUtils();
|
|
151
151
|
const adapter = useLocalizationContext();
|
|
152
152
|
const {
|
|
153
|
-
|
|
154
|
-
|
|
153
|
+
open,
|
|
154
|
+
setOpen
|
|
155
155
|
} = useOpenState(props);
|
|
156
156
|
const {
|
|
157
157
|
timezone,
|
|
@@ -237,7 +237,7 @@ export const usePickerValue = ({
|
|
|
237
237
|
onAccept(action.value, getContext());
|
|
238
238
|
}
|
|
239
239
|
if (shouldClose) {
|
|
240
|
-
|
|
240
|
+
setOpen(false);
|
|
241
241
|
}
|
|
242
242
|
});
|
|
243
243
|
if (dateState.lastControlledValue !== inValueWithoutRenderTimezone) {
|
|
@@ -288,11 +288,11 @@ export const usePickerValue = ({
|
|
|
288
288
|
});
|
|
289
289
|
const handleOpen = useEventCallback(event => {
|
|
290
290
|
event.preventDefault();
|
|
291
|
-
|
|
291
|
+
setOpen(true);
|
|
292
292
|
});
|
|
293
293
|
const handleClose = useEventCallback(event => {
|
|
294
294
|
event?.preventDefault();
|
|
295
|
-
|
|
295
|
+
setOpen(false);
|
|
296
296
|
});
|
|
297
297
|
const handleChange = useEventCallback((newValue, selectionState = 'partial') => updateDate({
|
|
298
298
|
name: 'setValueFromView',
|
|
@@ -323,12 +323,12 @@ export const usePickerValue = ({
|
|
|
323
323
|
value: dateState.draft,
|
|
324
324
|
onChange: handleChangeFromField
|
|
325
325
|
};
|
|
326
|
-
const
|
|
326
|
+
const valueWithoutError = React.useMemo(() => valueManager.cleanValue(utils, dateState.draft), [utils, valueManager, dateState.draft]);
|
|
327
327
|
const viewResponse = {
|
|
328
|
-
value:
|
|
328
|
+
value: valueWithoutError,
|
|
329
329
|
onChange: handleChange,
|
|
330
330
|
onClose: handleClose,
|
|
331
|
-
open
|
|
331
|
+
open
|
|
332
332
|
};
|
|
333
333
|
const isValid = testedValue => {
|
|
334
334
|
const error = validator({
|
|
@@ -340,16 +340,27 @@ export const usePickerValue = ({
|
|
|
340
340
|
return !valueManager.hasError(error);
|
|
341
341
|
};
|
|
342
342
|
const layoutResponse = _extends({}, actions, {
|
|
343
|
-
value:
|
|
343
|
+
value: valueWithoutError,
|
|
344
344
|
onChange: handleChange,
|
|
345
345
|
onSelectShortcut: handleSelectShortcut,
|
|
346
346
|
isValid
|
|
347
347
|
});
|
|
348
|
+
const contextValue = React.useMemo(() => {
|
|
349
|
+
return {
|
|
350
|
+
open,
|
|
351
|
+
setOpen
|
|
352
|
+
};
|
|
353
|
+
}, [open, setOpen]);
|
|
354
|
+
const providerParams = {
|
|
355
|
+
value: valueWithoutError,
|
|
356
|
+
contextValue
|
|
357
|
+
};
|
|
348
358
|
return {
|
|
349
|
-
open
|
|
359
|
+
open,
|
|
350
360
|
fieldProps: fieldResponse,
|
|
351
361
|
viewProps: viewResponse,
|
|
352
362
|
layoutProps: layoutResponse,
|
|
353
|
-
actions
|
|
363
|
+
actions,
|
|
364
|
+
provider: providerParams
|
|
354
365
|
};
|
|
355
366
|
};
|
|
@@ -11,10 +11,6 @@ import { isTimeView } from "../../utils/time-utils.js";
|
|
|
11
11
|
* Props used to handle the views that are common to all pickers.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
/**
|
|
15
|
-
* Props used to handle the views of the pickers.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
14
|
/**
|
|
19
15
|
* Props used to handle the value of the pickers.
|
|
20
16
|
*/
|
|
@@ -132,11 +128,14 @@ export const usePickerViews = ({
|
|
|
132
128
|
view: popperView,
|
|
133
129
|
onViewChange: setView
|
|
134
130
|
};
|
|
135
|
-
|
|
131
|
+
const providerParams = {
|
|
136
132
|
hasUIView,
|
|
137
|
-
views
|
|
133
|
+
views
|
|
134
|
+
};
|
|
135
|
+
return {
|
|
138
136
|
shouldRestoreFocus,
|
|
139
137
|
layoutProps,
|
|
138
|
+
provider: providerParams,
|
|
140
139
|
renderCurrentView: () => {
|
|
141
140
|
if (popperView == null) {
|
|
142
141
|
return null;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useRtl } from '@mui/system/RtlProvider';
|
|
4
|
+
import { usePickerPrivateContext } from "./usePickerPrivateContext.js";
|
|
5
|
+
export function useToolbarOwnerState() {
|
|
6
|
+
const {
|
|
7
|
+
ownerState: pickerOwnerState
|
|
8
|
+
} = usePickerPrivateContext();
|
|
9
|
+
const isRtl = useRtl();
|
|
10
|
+
return React.useMemo(() => _extends({}, pickerOwnerState, {
|
|
11
|
+
toolbarDirection: isRtl ? 'rtl' : 'ltr'
|
|
12
|
+
}), [pickerOwnerState, isRtl]);
|
|
13
|
+
}
|
|
@@ -16,6 +16,7 @@ export { useFieldOwnerState } from "./hooks/useFieldOwnerState.js";
|
|
|
16
16
|
export { usePicker } from "./hooks/usePicker/index.js";
|
|
17
17
|
export { usePickerPrivateContext } from "./hooks/usePickerPrivateContext.js";
|
|
18
18
|
export { useStaticPicker } from "./hooks/useStaticPicker/index.js";
|
|
19
|
+
export { useToolbarOwnerState } from "./hooks/useToolbarOwnerState.js";
|
|
19
20
|
export { useLocalizationContext, useDefaultDates, useUtils, useNow } from "./hooks/useUtils.js";
|
|
20
21
|
export { useViews } from "./hooks/useViews.js";
|
|
21
22
|
export { usePreviousMonthDisabled, useNextMonthDisabled } from "./hooks/date-helpers-hooks.js";
|
|
@@ -29,4 +30,5 @@ export { useDefaultReduceAnimations } from "./hooks/useDefaultReduceAnimations.j
|
|
|
29
30
|
export { applyDefaultViewProps } from "./utils/views.js";
|
|
30
31
|
export { DayCalendar } from "../DateCalendar/DayCalendar.js";
|
|
31
32
|
export { useCalendarState } from "../DateCalendar/useCalendarState.js";
|
|
32
|
-
export { isInternalTimeView, isTimeView } from "./utils/time-utils.js";
|
|
33
|
+
export { isInternalTimeView, isTimeView } from "./utils/time-utils.js";
|
|
34
|
+
export { DateTimePickerToolbarForceDesktopVariant } from "../DateTimePicker/DateTimePickerToolbar.js";
|
package/modern/locales/roRO.js
CHANGED
|
@@ -17,11 +17,10 @@ const roROPickers = {
|
|
|
17
17
|
// DateRange labels
|
|
18
18
|
start: 'Început',
|
|
19
19
|
end: 'Sfârșit',
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
startDate: 'Data de început',
|
|
21
|
+
startTime: 'Ora de început',
|
|
22
|
+
endDate: 'Data de sfârșit',
|
|
23
|
+
endTime: 'Ora de sfârșit',
|
|
25
24
|
// Action bar
|
|
26
25
|
cancelButtonLabel: 'Anulare',
|
|
27
26
|
clearButtonLabel: 'Ștergere',
|
|
@@ -55,23 +54,21 @@ const roROPickers = {
|
|
|
55
54
|
fieldYearPlaceholder: params => 'A'.repeat(params.digitAmount),
|
|
56
55
|
fieldMonthPlaceholder: params => params.contentType === 'letter' ? 'LLLL' : 'LL',
|
|
57
56
|
fieldDayPlaceholder: () => 'ZZ',
|
|
58
|
-
|
|
57
|
+
fieldWeekDayPlaceholder: params => params.contentType === 'letter' ? 'ZZZZ' : 'ZZ',
|
|
59
58
|
fieldHoursPlaceholder: () => 'hh',
|
|
60
59
|
fieldMinutesPlaceholder: () => 'mm',
|
|
61
60
|
fieldSecondsPlaceholder: () => 'ss',
|
|
62
|
-
fieldMeridiemPlaceholder: () => 'aa'
|
|
63
|
-
|
|
61
|
+
fieldMeridiemPlaceholder: () => 'aa',
|
|
64
62
|
// View names
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
63
|
+
year: 'An',
|
|
64
|
+
month: 'Luna',
|
|
65
|
+
day: 'Ziua',
|
|
66
|
+
weekDay: 'Ziua saptămânii',
|
|
67
|
+
hours: 'Ore',
|
|
68
|
+
minutes: 'Minute',
|
|
69
|
+
seconds: 'Secunde',
|
|
70
|
+
meridiem: 'Meridiem',
|
|
74
71
|
// Common
|
|
75
|
-
|
|
72
|
+
empty: 'Gol'
|
|
76
73
|
};
|
|
77
74
|
export const roRO = getPickersLocalization(roROPickers);
|
|
@@ -20,12 +20,10 @@ var _usePickerTranslations = require("../hooks/usePickerTranslations");
|
|
|
20
20
|
var _useUtils = require("../internals/hooks/useUtils");
|
|
21
21
|
var _datePickerToolbarClasses = require("./datePickerToolbarClasses");
|
|
22
22
|
var _dateUtils = require("../internals/utils/date-utils");
|
|
23
|
+
var _useToolbarOwnerState = require("../internals/hooks/useToolbarOwnerState");
|
|
23
24
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
24
|
-
const _excluded = ["value", "isLandscape", "onChange", "toolbarFormat", "toolbarPlaceholder", "views", "className", "onViewChange", "view"];
|
|
25
|
-
const useUtilityClasses =
|
|
26
|
-
const {
|
|
27
|
-
classes
|
|
28
|
-
} = ownerState;
|
|
25
|
+
const _excluded = ["value", "isLandscape", "onChange", "toolbarFormat", "toolbarPlaceholder", "views", "className", "classes", "onViewChange", "view"];
|
|
26
|
+
const useUtilityClasses = classes => {
|
|
29
27
|
const slots = {
|
|
30
28
|
root: ['root'],
|
|
31
29
|
title: ['title']
|
|
@@ -44,7 +42,7 @@ const DatePickerToolbarTitle = (0, _styles.styled)(_Typography.default, {
|
|
|
44
42
|
})({
|
|
45
43
|
variants: [{
|
|
46
44
|
props: {
|
|
47
|
-
|
|
45
|
+
pickerOrientation: 'landscape'
|
|
48
46
|
},
|
|
49
47
|
style: {
|
|
50
48
|
margin: 'auto 16px auto auto'
|
|
@@ -72,12 +70,14 @@ const DatePickerToolbar = exports.DatePickerToolbar = /*#__PURE__*/React.forward
|
|
|
72
70
|
toolbarFormat,
|
|
73
71
|
toolbarPlaceholder = '––',
|
|
74
72
|
views,
|
|
75
|
-
className
|
|
73
|
+
className,
|
|
74
|
+
classes: classesProp
|
|
76
75
|
} = props,
|
|
77
76
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
78
77
|
const utils = (0, _useUtils.useUtils)();
|
|
79
78
|
const translations = (0, _usePickerTranslations.usePickerTranslations)();
|
|
80
|
-
const
|
|
79
|
+
const ownerState = (0, _useToolbarOwnerState.useToolbarOwnerState)();
|
|
80
|
+
const classes = useUtilityClasses(classesProp);
|
|
81
81
|
const dateText = React.useMemo(() => {
|
|
82
82
|
if (!value) {
|
|
83
83
|
return toolbarPlaceholder;
|
|
@@ -88,7 +88,6 @@ const DatePickerToolbar = exports.DatePickerToolbar = /*#__PURE__*/React.forward
|
|
|
88
88
|
}, true);
|
|
89
89
|
return utils.formatByString(value, formatFromViews);
|
|
90
90
|
}, [value, toolbarFormat, toolbarPlaceholder, utils, views]);
|
|
91
|
-
const ownerState = props;
|
|
92
91
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(DatePickerToolbarRoot, (0, _extends2.default)({
|
|
93
92
|
ref: ref,
|
|
94
93
|
toolbarTitle: translations.datePickerToolbarTitle,
|