@mui/x-date-pickers 8.0.0-alpha.12 → 8.0.0-alpha.13
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/AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.d.ts +1 -1
- package/AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.js +96 -94
- package/AdapterDateFnsV2/AdapterDateFnsV2.d.ts +1 -1
- package/AdapterDateFnsV2/AdapterDateFnsV2.js +96 -94
- package/AdapterDayjs/AdapterDayjs.js +11 -5
- package/CHANGELOG.md +299 -0
- package/DateCalendar/DateCalendar.js +1 -1
- package/DateField/useDateField.d.ts +1 -1
- package/DatePicker/DatePicker.types.d.ts +2 -2
- package/DateTimeField/useDateTimeField.d.ts +1 -1
- package/DateTimePicker/DateTimePicker.types.d.ts +2 -2
- package/TimeClock/Clock.js +2 -2
- package/TimeClock/ClockPointer.js +1 -1
- package/TimeField/useTimeField.d.ts +1 -1
- package/TimePicker/TimePicker.types.d.ts +2 -2
- package/esm/AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.d.ts +1 -1
- package/esm/AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.js +47 -45
- package/esm/AdapterDateFnsV2/AdapterDateFnsV2.d.ts +1 -1
- package/esm/AdapterDateFnsV2/AdapterDateFnsV2.js +47 -45
- package/esm/AdapterDayjs/AdapterDayjs.js +9 -5
- package/esm/DateCalendar/DateCalendar.js +1 -1
- package/esm/DateField/useDateField.d.ts +1 -1
- package/esm/DatePicker/DatePicker.types.d.ts +2 -2
- package/esm/DateTimeField/useDateTimeField.d.ts +1 -1
- package/esm/DateTimePicker/DateTimePicker.types.d.ts +2 -2
- package/esm/TimeClock/Clock.js +2 -2
- package/esm/TimeClock/ClockPointer.js +1 -1
- package/esm/TimeField/useTimeField.d.ts +1 -1
- package/esm/TimePicker/TimePicker.types.d.ts +2 -2
- package/esm/hooks/useSplitFieldProps.d.ts +1 -1
- package/esm/hooks/useSplitFieldProps.js +1 -1
- package/esm/index.js +1 -1
- package/esm/internals/components/PickerFieldUI.d.ts +7 -0
- package/esm/internals/components/PickerFieldUI.js +2 -2
- package/esm/internals/components/PickerPopper/PickerPopper.d.ts +0 -3
- package/esm/internals/components/PickerPopper/PickerPopper.js +26 -14
- package/esm/internals/components/PickerProvider.d.ts +21 -1
- package/esm/internals/components/PickerProvider.js +7 -2
- package/esm/internals/demo/DemoContainer.js +3 -3
- package/esm/internals/hooks/useDesktopPicker/useDesktopPicker.js +5 -22
- package/esm/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +0 -5
- package/esm/internals/hooks/useField/index.d.ts +1 -2
- package/esm/internals/hooks/useField/useField.types.d.ts +10 -4
- package/esm/internals/hooks/useField/useFieldInternalPropsWithDefaults.d.ts +9 -9
- package/esm/internals/hooks/useField/useFieldInternalPropsWithDefaults.js +16 -8
- package/esm/internals/hooks/useField/useFieldV6TextField.js +8 -6
- package/esm/internals/hooks/useField/useFieldV7TextField.js +7 -7
- package/esm/internals/hooks/useMobilePicker/useMobilePicker.js +5 -21
- package/esm/internals/hooks/useNullableFieldPrivateContext.d.ts +6 -0
- package/esm/internals/hooks/useNullableFieldPrivateContext.js +5 -0
- package/esm/internals/hooks/usePicker/usePicker.d.ts +1 -1
- package/esm/internals/hooks/usePicker/usePicker.js +2 -2
- package/esm/internals/hooks/usePicker/usePicker.types.d.ts +1 -1
- package/esm/internals/hooks/usePicker/usePickerProvider.d.ts +8 -3
- package/esm/internals/hooks/usePicker/usePickerProvider.js +20 -6
- package/esm/internals/hooks/usePicker/usePickerViews.d.ts +20 -3
- package/esm/internals/hooks/usePicker/usePickerViews.js +20 -8
- package/esm/internals/hooks/useStaticPicker/useStaticPicker.js +3 -2
- package/esm/internals/index.d.ts +4 -3
- package/esm/internals/index.js +2 -1
- package/esm/internals/models/fields.d.ts +3 -10
- package/esm/locales/bnBD.d.ts +80 -0
- package/esm/locales/bnBD.js +73 -0
- package/esm/locales/index.d.ts +1 -0
- package/esm/locales/index.js +1 -0
- package/esm/models/fields.d.ts +2 -2
- package/esm/validation/extractValidationProps.d.ts +1 -1
- package/esm/validation/index.d.ts +1 -1
- package/esm/validation/useValidation.d.ts +1 -1
- package/hooks/useSplitFieldProps.d.ts +1 -1
- package/hooks/useSplitFieldProps.js +1 -1
- package/index.js +1 -1
- package/internals/components/PickerFieldUI.d.ts +7 -0
- package/internals/components/PickerFieldUI.js +3 -1
- package/internals/components/PickerPopper/PickerPopper.d.ts +0 -3
- package/internals/components/PickerPopper/PickerPopper.js +25 -13
- package/internals/components/PickerProvider.d.ts +21 -1
- package/internals/components/PickerProvider.js +8 -3
- package/internals/demo/DemoContainer.js +3 -3
- package/internals/hooks/useDesktopPicker/useDesktopPicker.js +5 -22
- package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +0 -5
- package/internals/hooks/useField/index.d.ts +1 -2
- package/internals/hooks/useField/useField.types.d.ts +10 -4
- package/internals/hooks/useField/useFieldInternalPropsWithDefaults.d.ts +9 -9
- package/internals/hooks/useField/useFieldInternalPropsWithDefaults.js +16 -10
- package/internals/hooks/useField/useFieldV6TextField.js +8 -6
- package/internals/hooks/useField/useFieldV7TextField.js +7 -7
- package/internals/hooks/useMobilePicker/useMobilePicker.js +5 -21
- package/internals/hooks/useNullableFieldPrivateContext.d.ts +6 -0
- package/internals/hooks/useNullableFieldPrivateContext.js +13 -0
- package/internals/hooks/usePicker/usePicker.d.ts +1 -1
- package/internals/hooks/usePicker/usePicker.js +2 -2
- package/internals/hooks/usePicker/usePicker.types.d.ts +1 -1
- package/internals/hooks/usePicker/usePickerProvider.d.ts +8 -3
- package/internals/hooks/usePicker/usePickerProvider.js +20 -6
- package/internals/hooks/usePicker/usePickerViews.d.ts +20 -3
- package/internals/hooks/usePicker/usePickerViews.js +20 -8
- package/internals/hooks/useStaticPicker/useStaticPicker.js +3 -2
- package/internals/index.d.ts +4 -3
- package/internals/index.js +19 -0
- package/internals/models/fields.d.ts +3 -10
- package/locales/bnBD.d.ts +80 -0
- package/locales/bnBD.js +79 -0
- package/locales/index.d.ts +1 -0
- package/locales/index.js +11 -0
- package/models/fields.d.ts +2 -2
- package/modern/AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.d.ts +1 -1
- package/modern/AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.js +47 -45
- package/modern/AdapterDateFnsV2/AdapterDateFnsV2.d.ts +1 -1
- package/modern/AdapterDateFnsV2/AdapterDateFnsV2.js +47 -45
- package/modern/AdapterDayjs/AdapterDayjs.js +9 -5
- package/modern/DateCalendar/DateCalendar.js +1 -1
- package/modern/DateField/useDateField.d.ts +1 -1
- package/modern/DatePicker/DatePicker.types.d.ts +2 -2
- package/modern/DateTimeField/useDateTimeField.d.ts +1 -1
- package/modern/DateTimePicker/DateTimePicker.types.d.ts +2 -2
- package/modern/TimeClock/Clock.js +2 -2
- package/modern/TimeClock/ClockPointer.js +1 -1
- package/modern/TimeField/useTimeField.d.ts +1 -1
- package/modern/TimePicker/TimePicker.types.d.ts +2 -2
- package/modern/hooks/useSplitFieldProps.d.ts +1 -1
- package/modern/hooks/useSplitFieldProps.js +1 -1
- package/modern/index.js +1 -1
- package/modern/internals/components/PickerFieldUI.d.ts +7 -0
- package/modern/internals/components/PickerFieldUI.js +2 -2
- package/modern/internals/components/PickerPopper/PickerPopper.d.ts +0 -3
- package/modern/internals/components/PickerPopper/PickerPopper.js +26 -14
- package/modern/internals/components/PickerProvider.d.ts +21 -1
- package/modern/internals/components/PickerProvider.js +7 -2
- package/modern/internals/demo/DemoContainer.js +3 -3
- package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +5 -22
- package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +0 -5
- package/modern/internals/hooks/useField/index.d.ts +1 -2
- package/modern/internals/hooks/useField/useField.types.d.ts +10 -4
- package/modern/internals/hooks/useField/useFieldInternalPropsWithDefaults.d.ts +9 -9
- package/modern/internals/hooks/useField/useFieldInternalPropsWithDefaults.js +16 -8
- package/modern/internals/hooks/useField/useFieldV6TextField.js +8 -6
- package/modern/internals/hooks/useField/useFieldV7TextField.js +7 -7
- package/modern/internals/hooks/useMobilePicker/useMobilePicker.js +5 -21
- package/modern/internals/hooks/useNullableFieldPrivateContext.d.ts +6 -0
- package/modern/internals/hooks/useNullableFieldPrivateContext.js +5 -0
- package/modern/internals/hooks/usePicker/usePicker.d.ts +1 -1
- package/modern/internals/hooks/usePicker/usePicker.js +2 -2
- package/modern/internals/hooks/usePicker/usePicker.types.d.ts +1 -1
- package/modern/internals/hooks/usePicker/usePickerProvider.d.ts +8 -3
- package/modern/internals/hooks/usePicker/usePickerProvider.js +20 -6
- package/modern/internals/hooks/usePicker/usePickerViews.d.ts +20 -3
- package/modern/internals/hooks/usePicker/usePickerViews.js +20 -8
- package/modern/internals/hooks/useStaticPicker/useStaticPicker.js +3 -2
- package/modern/internals/index.d.ts +4 -3
- package/modern/internals/index.js +2 -1
- package/modern/internals/models/fields.d.ts +3 -10
- package/modern/locales/bnBD.d.ts +80 -0
- package/modern/locales/bnBD.js +73 -0
- package/modern/locales/index.d.ts +1 -0
- package/modern/locales/index.js +1 -0
- package/modern/models/fields.d.ts +2 -2
- package/modern/validation/extractValidationProps.d.ts +1 -1
- package/modern/validation/index.d.ts +1 -1
- package/modern/validation/useValidation.d.ts +1 -1
- package/package.json +2 -2
- package/tsconfig.build.tsbuildinfo +1 -1
- package/validation/extractValidationProps.d.ts +1 -1
- package/validation/index.d.ts +1 -1
- package/validation/useValidation.d.ts +1 -1
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
|
|
4
|
+
import useForkRef from '@mui/utils/useForkRef';
|
|
5
|
+
import useId from '@mui/utils/useId';
|
|
4
6
|
import { useUtils } from "../useUtils.js";
|
|
5
7
|
import { arrayIncludes } from "../../utils/utils.js";
|
|
6
8
|
import { useReduceAnimations } from "../useReduceAnimations.js";
|
|
@@ -49,6 +51,14 @@ export function usePickerProvider(parameters) {
|
|
|
49
51
|
const orientation = usePickerOrientation(paramsFromUsePickerViews.views, props.orientation);
|
|
50
52
|
const reduceAnimations = useReduceAnimations(props.reduceAnimations);
|
|
51
53
|
const triggerRef = React.useRef(null);
|
|
54
|
+
const popupRef = React.useRef(null);
|
|
55
|
+
const rootRefObject = React.useRef(null);
|
|
56
|
+
const rootRef = useForkRef(ref, rootRefObject);
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* TODO: Improve how we generate the aria-label and aria-labelledby attributes.
|
|
60
|
+
*/
|
|
61
|
+
const labelId = useId();
|
|
52
62
|
const ownerState = React.useMemo(() => ({
|
|
53
63
|
isPickerValueEmpty: valueManager.areValuesEqual(utils, paramsFromUsePickerValue.value, valueManager.emptyValue),
|
|
54
64
|
isPickerOpen: paramsFromUsePickerValue.contextValue.open,
|
|
@@ -69,8 +79,10 @@ export function usePickerProvider(parameters) {
|
|
|
69
79
|
const contextValue = React.useMemo(() => _extends({}, paramsFromUsePickerValue.contextValue, paramsFromUsePickerViews.contextValue, {
|
|
70
80
|
disabled: props.disabled ?? false,
|
|
71
81
|
readOnly: props.readOnly ?? false,
|
|
82
|
+
autoFocus: props.autoFocus ?? false,
|
|
72
83
|
variant,
|
|
73
84
|
orientation,
|
|
85
|
+
popupRef,
|
|
74
86
|
reduceAnimations,
|
|
75
87
|
triggerRef,
|
|
76
88
|
triggerStatus,
|
|
@@ -78,19 +90,21 @@ export function usePickerProvider(parameters) {
|
|
|
78
90
|
name: props.name,
|
|
79
91
|
label: props.label,
|
|
80
92
|
rootSx: props.sx,
|
|
81
|
-
rootRef
|
|
93
|
+
rootRef,
|
|
82
94
|
rootClassName: props.className
|
|
83
|
-
}), [paramsFromUsePickerValue.contextValue, paramsFromUsePickerViews.contextValue,
|
|
95
|
+
}), [paramsFromUsePickerValue.contextValue, paramsFromUsePickerViews.contextValue, rootRef, variant, orientation, reduceAnimations, props.disabled, props.readOnly, props.autoFocus, props.format, props.className, props.name, props.label, props.sx, triggerRef, triggerStatus]);
|
|
84
96
|
const privateContextValue = React.useMemo(() => _extends({}, paramsFromUsePickerValue.privateContextValue, paramsFromUsePickerViews.privateContextValue, {
|
|
85
|
-
ownerState
|
|
86
|
-
|
|
97
|
+
ownerState,
|
|
98
|
+
rootRefObject,
|
|
99
|
+
labelId
|
|
100
|
+
}), [paramsFromUsePickerValue.privateContextValue, paramsFromUsePickerViews.privateContextValue, ownerState, labelId]);
|
|
87
101
|
const actionsContextValue = React.useMemo(() => _extends({}, paramsFromUsePickerValue.actionsContextValue, paramsFromUsePickerViews.actionsContextValue), [paramsFromUsePickerValue.actionsContextValue, paramsFromUsePickerViews.actionsContextValue]);
|
|
88
|
-
const fieldPrivateContextValue = React.useMemo(() => ({
|
|
102
|
+
const fieldPrivateContextValue = React.useMemo(() => _extends({}, paramsFromUsePickerViews.fieldPrivateContextValue, {
|
|
89
103
|
formatDensity: props.formatDensity,
|
|
90
104
|
enableAccessibleFieldDOMStructure: props.enableAccessibleFieldDOMStructure,
|
|
91
105
|
selectedSections: props.selectedSections,
|
|
92
106
|
onSelectedSectionsChange: props.onSelectedSectionsChange
|
|
93
|
-
}), [props.formatDensity, props.enableAccessibleFieldDOMStructure, props.selectedSections, props.onSelectedSectionsChange]);
|
|
107
|
+
}), [paramsFromUsePickerViews.fieldPrivateContextValue, props.formatDensity, props.enableAccessibleFieldDOMStructure, props.selectedSections, props.onSelectedSectionsChange]);
|
|
94
108
|
return {
|
|
95
109
|
localeText,
|
|
96
110
|
contextValue,
|
|
@@ -42,7 +42,7 @@ export interface UsePickerViewParams<TValue extends PickerValidValue, TView exte
|
|
|
42
42
|
props: TExternalProps;
|
|
43
43
|
propsFromPickerValue: UsePickerValueViewsResponse<TValue>;
|
|
44
44
|
autoFocusView: boolean;
|
|
45
|
-
|
|
45
|
+
viewContainerRole: 'dialog' | 'tooltip' | null;
|
|
46
46
|
/**
|
|
47
47
|
* A function that intercepts the regular picker rendering.
|
|
48
48
|
* Can be used to consume the provided `viewRenderers` and render a custom component wrapping them.
|
|
@@ -86,6 +86,10 @@ export interface UsePickerViewsContextValue<TView extends DateOrTimeViewWithMeri
|
|
|
86
86
|
* The view currently rendered.
|
|
87
87
|
*/
|
|
88
88
|
view: TView | null;
|
|
89
|
+
/**
|
|
90
|
+
* The view showed when first opening the picker.
|
|
91
|
+
*/
|
|
92
|
+
initialView: TView | null;
|
|
89
93
|
}
|
|
90
94
|
export interface UsePickerViewsPrivateContextValue {
|
|
91
95
|
/**
|
|
@@ -97,6 +101,18 @@ export interface UsePickerViewsPrivateContextValue {
|
|
|
97
101
|
* @returns {boolean} Whether the current view has an UI.
|
|
98
102
|
*/
|
|
99
103
|
doesTheCurrentViewHasAnUI: () => boolean;
|
|
104
|
+
/**
|
|
105
|
+
* The aria role associated with the view container.
|
|
106
|
+
* It is equal to "dialog" when the view is rendered inside a `@mui/material/Dialog`.
|
|
107
|
+
* It is equal to "dialog" when the view is rendered inside a `@mui/material/Popper` and the focus is trapped inside the view.
|
|
108
|
+
* It is equal to "tooltip" when the view is rendered inside a `@mui/material/Popper` and the focus remains inside the field.
|
|
109
|
+
* It is always equal to null if the picker does not have a field (static pickers).
|
|
110
|
+
* It is always equal to null if the component you are accessing the context from is not wrapped by a picker.
|
|
111
|
+
*/
|
|
112
|
+
viewContainerRole: 'dialog' | 'tooltip' | null;
|
|
113
|
+
}
|
|
114
|
+
export interface UsePickerViewsFieldPrivateContextValue {
|
|
115
|
+
fieldRef: React.RefObject<FieldRef<PickerValue> | FieldRef<PickerRangeValue> | null>;
|
|
100
116
|
}
|
|
101
117
|
export interface UsePickerViewsProviderParams<TView extends DateOrTimeViewWithMeridiem> {
|
|
102
118
|
hasUIView: boolean;
|
|
@@ -104,6 +120,7 @@ export interface UsePickerViewsProviderParams<TView extends DateOrTimeViewWithMe
|
|
|
104
120
|
contextValue: UsePickerViewsContextValue<TView>;
|
|
105
121
|
actionsContextValue: UsePickerViewsActionsContextValue<TView>;
|
|
106
122
|
privateContextValue: UsePickerViewsPrivateContextValue;
|
|
123
|
+
fieldPrivateContextValue: UsePickerViewsFieldPrivateContextValue;
|
|
107
124
|
}
|
|
108
125
|
/**
|
|
109
126
|
* Manage the views of all the pickers:
|
|
@@ -115,6 +132,6 @@ export declare const usePickerViews: <TValue extends PickerValidValue, TView ext
|
|
|
115
132
|
props,
|
|
116
133
|
propsFromPickerValue,
|
|
117
134
|
autoFocusView,
|
|
118
|
-
|
|
119
|
-
|
|
135
|
+
viewContainerRole,
|
|
136
|
+
rendererInterceptor: RendererInterceptor
|
|
120
137
|
}: UsePickerViewParams<TValue, TView, TExternalProps>) => UsePickerViewsResponse<TView>;
|
|
@@ -25,8 +25,8 @@ export const usePickerViews = ({
|
|
|
25
25
|
props,
|
|
26
26
|
propsFromPickerValue,
|
|
27
27
|
autoFocusView,
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
viewContainerRole,
|
|
29
|
+
rendererInterceptor: RendererInterceptor
|
|
30
30
|
}) => {
|
|
31
31
|
const {
|
|
32
32
|
onChange,
|
|
@@ -43,6 +43,7 @@ export const usePickerViews = ({
|
|
|
43
43
|
timezone
|
|
44
44
|
} = props;
|
|
45
45
|
const propsToForwardToView = _objectWithoutPropertiesLoose(props, _excluded);
|
|
46
|
+
const fieldRef = React.useRef(null);
|
|
46
47
|
const {
|
|
47
48
|
view,
|
|
48
49
|
setView,
|
|
@@ -126,20 +127,27 @@ export const usePickerViews = ({
|
|
|
126
127
|
const actionsContextValue = React.useMemo(() => ({
|
|
127
128
|
setView
|
|
128
129
|
}), [setView]);
|
|
130
|
+
const initialViewRef = React.useRef(openTo ?? null);
|
|
129
131
|
const contextValue = React.useMemo(() => _extends({}, actionsContextValue, {
|
|
130
132
|
views,
|
|
131
|
-
view: popperView
|
|
133
|
+
view: popperView,
|
|
134
|
+
initialView: initialViewRef.current
|
|
132
135
|
}), [actionsContextValue, views, popperView]);
|
|
133
136
|
const privateContextValue = React.useMemo(() => ({
|
|
134
137
|
hasUIView,
|
|
135
|
-
doesTheCurrentViewHasAnUI
|
|
136
|
-
|
|
138
|
+
doesTheCurrentViewHasAnUI,
|
|
139
|
+
viewContainerRole
|
|
140
|
+
}), [hasUIView, doesTheCurrentViewHasAnUI, viewContainerRole]);
|
|
141
|
+
const fieldPrivateContextValue = React.useMemo(() => ({
|
|
142
|
+
fieldRef
|
|
143
|
+
}), []);
|
|
137
144
|
const providerParams = {
|
|
138
145
|
hasUIView,
|
|
139
146
|
views,
|
|
140
147
|
contextValue,
|
|
141
148
|
actionsContextValue,
|
|
142
|
-
privateContextValue
|
|
149
|
+
privateContextValue,
|
|
150
|
+
fieldPrivateContextValue
|
|
143
151
|
};
|
|
144
152
|
return {
|
|
145
153
|
provider: providerParams,
|
|
@@ -158,10 +166,14 @@ export const usePickerViews = ({
|
|
|
158
166
|
onChange: setValueAndGoToNextView,
|
|
159
167
|
view: popperView,
|
|
160
168
|
onViewChange: setView,
|
|
161
|
-
focusedView,
|
|
162
|
-
onFocusedViewChange: setFocusedView,
|
|
163
169
|
showViewSwitcher: timeViewsCount > 1,
|
|
164
170
|
timeViewsCount
|
|
171
|
+
}, viewContainerRole === 'tooltip' ? {
|
|
172
|
+
focusedView: null,
|
|
173
|
+
onFocusedViewChange: () => {}
|
|
174
|
+
} : {
|
|
175
|
+
focusedView,
|
|
176
|
+
onFocusedViewChange: setFocusedView
|
|
165
177
|
});
|
|
166
178
|
if (RendererInterceptor) {
|
|
167
179
|
return /*#__PURE__*/_jsx(RendererInterceptor, {
|
|
@@ -41,9 +41,10 @@ export const useStaticPicker = _ref => {
|
|
|
41
41
|
renderCurrentView
|
|
42
42
|
} = usePicker(_extends({}, pickerParams, {
|
|
43
43
|
props,
|
|
44
|
+
variant: displayStaticWrapperAs,
|
|
44
45
|
autoFocusView: autoFocus ?? false,
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
viewContainerRole: null,
|
|
47
|
+
localeText
|
|
47
48
|
}));
|
|
48
49
|
const Layout = slots?.layout ?? PickerStaticLayout;
|
|
49
50
|
const renderPicker = () => /*#__PURE__*/_jsx(PickerProvider, _extends({}, providerProps, {
|
package/esm/internals/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { PickersArrowSwitcher } from "./components/PickersArrowSwitcher/PickersArrowSwitcher.js";
|
|
2
2
|
export type { ExportedPickersArrowSwitcherProps, PickersArrowSwitcherSlots, PickersArrowSwitcherSlotProps } from './components/PickersArrowSwitcher';
|
|
3
|
-
export { PickerFieldUI, PickerFieldUIContextProvider, cleanFieldResponse, useFieldTextFieldProps } from "./components/PickerFieldUI.js";
|
|
4
|
-
export type { ExportedPickerFieldUIProps, PickerFieldUISlots, PickerFieldUISlotProps } from './components/PickerFieldUI';
|
|
3
|
+
export { PickerFieldUI, PickerFieldUIContextProvider, cleanFieldResponse, useFieldTextFieldProps, PickerFieldUIContext, mergeSlotProps } from "./components/PickerFieldUI.js";
|
|
4
|
+
export type { ExportedPickerFieldUIProps, PickerFieldUISlots, PickerFieldUISlotProps, PickerFieldUISlotsFromContext, PickerFieldUISlotPropsFromContext } from './components/PickerFieldUI';
|
|
5
5
|
export { PickerProvider } from "./components/PickerProvider.js";
|
|
6
6
|
export type { PickerContextValue } from './components/PickerProvider';
|
|
7
7
|
export { PickersModalDialog } from "./components/PickersModalDialog.js";
|
|
@@ -25,9 +25,10 @@ export { DAY_MARGIN, DIALOG_WIDTH, VIEW_HEIGHT } from "./constants/dimensions.js
|
|
|
25
25
|
export { useControlledValueWithTimezone } from "./hooks/useValueWithTimezone.js";
|
|
26
26
|
export type { DesktopOnlyPickerProps } from './hooks/useDesktopPicker';
|
|
27
27
|
export { useField, useFieldInternalPropsWithDefaults, createDateStrForV7HiddenInputFromSections, createDateStrForV6InputFromSections } from "./hooks/useField/index.js";
|
|
28
|
-
export type { UseFieldInternalProps, UseFieldParams, UseFieldResponse, FieldValueManager, FieldChangeHandler, FieldChangeHandlerContext
|
|
28
|
+
export type { UseFieldInternalProps, UseFieldParams, UseFieldResponse, FieldValueManager, FieldChangeHandler, FieldChangeHandlerContext } from './hooks/useField';
|
|
29
29
|
export { useFieldOwnerState } from "./hooks/useFieldOwnerState.js";
|
|
30
30
|
export type { MobileOnlyPickerProps } from './hooks/useMobilePicker';
|
|
31
|
+
export { useNullableFieldPrivateContext } from "./hooks/useNullableFieldPrivateContext.js";
|
|
31
32
|
export { useNullablePickerContext } from "./hooks/useNullablePickerContext.js";
|
|
32
33
|
export { usePicker } from "./hooks/usePicker/index.js";
|
|
33
34
|
export type { UsePickerParams, UsePickerProps, UsePickerValueFieldResponse, PickerViewsRendererProps } from './hooks/usePicker';
|
package/esm/internals/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { PickersArrowSwitcher } from "./components/PickersArrowSwitcher/PickersArrowSwitcher.js";
|
|
2
|
-
export { PickerFieldUI, PickerFieldUIContextProvider, cleanFieldResponse, useFieldTextFieldProps } from "./components/PickerFieldUI.js";
|
|
2
|
+
export { PickerFieldUI, PickerFieldUIContextProvider, cleanFieldResponse, useFieldTextFieldProps, PickerFieldUIContext, mergeSlotProps } from "./components/PickerFieldUI.js";
|
|
3
3
|
export { PickerProvider } from "./components/PickerProvider.js";
|
|
4
4
|
export { PickersModalDialog } from "./components/PickersModalDialog.js";
|
|
5
5
|
export { PickerPopper } from "./components/PickerPopper/PickerPopper.js";
|
|
@@ -13,6 +13,7 @@ export { DAY_MARGIN, DIALOG_WIDTH, VIEW_HEIGHT } from "./constants/dimensions.js
|
|
|
13
13
|
export { useControlledValueWithTimezone } from "./hooks/useValueWithTimezone.js";
|
|
14
14
|
export { useField, useFieldInternalPropsWithDefaults, createDateStrForV7HiddenInputFromSections, createDateStrForV6InputFromSections } from "./hooks/useField/index.js";
|
|
15
15
|
export { useFieldOwnerState } from "./hooks/useFieldOwnerState.js";
|
|
16
|
+
export { useNullableFieldPrivateContext } from "./hooks/useNullableFieldPrivateContext.js";
|
|
16
17
|
export { useNullablePickerContext } from "./hooks/useNullablePickerContext.js";
|
|
17
18
|
export { usePicker } from "./hooks/usePicker/index.js";
|
|
18
19
|
export { usePickerPrivateContext } from "./hooks/usePickerPrivateContext.js";
|
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
import type { FieldSection } from '../../models';
|
|
2
|
-
import type { UseFieldInternalProps } from '../hooks/useField';
|
|
3
2
|
import { RangePosition } from "./pickers.js";
|
|
4
|
-
import { PickerValidValue } from "./value.js";
|
|
5
3
|
export interface FieldRangeSection extends FieldSection {
|
|
6
4
|
dateName: RangePosition;
|
|
7
5
|
}
|
|
8
|
-
export interface BaseForwardedSingleInputFieldProps {
|
|
9
|
-
id?: string;
|
|
10
|
-
focused?: boolean;
|
|
11
|
-
onKeyDown?: React.KeyboardEventHandler;
|
|
12
|
-
onBlur?: React.FocusEventHandler;
|
|
13
|
-
ref?: React.Ref<HTMLDivElement>;
|
|
14
|
-
}
|
|
15
6
|
/**
|
|
16
7
|
* Props the single input field can receive when used inside a picker.
|
|
17
8
|
* Only contains what the MUI components are passing to the field, not what users can pass using the `props.slotProps.field`.
|
|
18
9
|
*/
|
|
19
|
-
export
|
|
10
|
+
export interface BaseSingleInputFieldProps {
|
|
11
|
+
id?: string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { TimeViewWithMeridiem } from "../internals/models/index.js";
|
|
2
|
+
export declare const bnBD: {
|
|
3
|
+
components: {
|
|
4
|
+
MuiLocalizationProvider: {
|
|
5
|
+
defaultProps: {
|
|
6
|
+
localeText: {
|
|
7
|
+
previousMonth?: string | undefined;
|
|
8
|
+
nextMonth?: string | undefined;
|
|
9
|
+
calendarWeekNumberHeaderLabel?: string | undefined;
|
|
10
|
+
calendarWeekNumberHeaderText?: string | undefined;
|
|
11
|
+
calendarWeekNumberAriaLabelText?: ((weekNumber: number) => string) | undefined;
|
|
12
|
+
calendarWeekNumberText?: ((weekNumber: number) => string) | undefined;
|
|
13
|
+
openPreviousView?: string | undefined;
|
|
14
|
+
openNextView?: string | undefined;
|
|
15
|
+
calendarViewSwitchingButtonAriaLabel?: ((currentView: import("@mui/x-date-pickers/models").DateView) => string) | undefined;
|
|
16
|
+
start?: string | undefined;
|
|
17
|
+
end?: string | undefined;
|
|
18
|
+
startDate?: string | undefined;
|
|
19
|
+
startTime?: string | undefined;
|
|
20
|
+
endDate?: string | undefined;
|
|
21
|
+
endTime?: string | undefined;
|
|
22
|
+
cancelButtonLabel?: string | undefined;
|
|
23
|
+
clearButtonLabel?: string | undefined;
|
|
24
|
+
okButtonLabel?: string | undefined;
|
|
25
|
+
todayButtonLabel?: string | undefined;
|
|
26
|
+
clockLabelText?: ((view: import("@mui/x-date-pickers/models").TimeView, formattedTime: string | null) => string) | undefined;
|
|
27
|
+
hoursClockNumberText?: ((hours: string) => string) | undefined;
|
|
28
|
+
minutesClockNumberText?: ((minutes: string) => string) | undefined;
|
|
29
|
+
secondsClockNumberText?: ((seconds: string) => string) | undefined;
|
|
30
|
+
selectViewText?: ((view: TimeViewWithMeridiem) => string) | undefined;
|
|
31
|
+
openDatePickerDialogue?: ((formattedDate: string | null) => string) | undefined;
|
|
32
|
+
openTimePickerDialogue?: ((formattedTime: string | null) => string) | undefined;
|
|
33
|
+
fieldClearLabel?: string | undefined;
|
|
34
|
+
timeTableLabel?: string | undefined;
|
|
35
|
+
dateTableLabel?: string | undefined;
|
|
36
|
+
fieldYearPlaceholder?: ((params: {
|
|
37
|
+
digitAmount: number;
|
|
38
|
+
format: string;
|
|
39
|
+
}) => string) | undefined;
|
|
40
|
+
fieldMonthPlaceholder?: ((params: {
|
|
41
|
+
contentType: import("@mui/x-date-pickers/models").FieldSectionContentType;
|
|
42
|
+
format: string;
|
|
43
|
+
}) => string) | undefined;
|
|
44
|
+
fieldDayPlaceholder?: ((params: {
|
|
45
|
+
format: string;
|
|
46
|
+
}) => string) | undefined;
|
|
47
|
+
fieldWeekDayPlaceholder?: ((params: {
|
|
48
|
+
contentType: import("@mui/x-date-pickers/models").FieldSectionContentType;
|
|
49
|
+
format: string;
|
|
50
|
+
}) => string) | undefined;
|
|
51
|
+
fieldHoursPlaceholder?: ((params: {
|
|
52
|
+
format: string;
|
|
53
|
+
}) => string) | undefined;
|
|
54
|
+
fieldMinutesPlaceholder?: ((params: {
|
|
55
|
+
format: string;
|
|
56
|
+
}) => string) | undefined;
|
|
57
|
+
fieldSecondsPlaceholder?: ((params: {
|
|
58
|
+
format: string;
|
|
59
|
+
}) => string) | undefined;
|
|
60
|
+
fieldMeridiemPlaceholder?: ((params: {
|
|
61
|
+
format: string;
|
|
62
|
+
}) => string) | undefined;
|
|
63
|
+
year?: string | undefined;
|
|
64
|
+
month?: string | undefined;
|
|
65
|
+
day?: string | undefined;
|
|
66
|
+
weekDay?: string | undefined;
|
|
67
|
+
hours?: string | undefined;
|
|
68
|
+
minutes?: string | undefined;
|
|
69
|
+
seconds?: string | undefined;
|
|
70
|
+
meridiem?: string | undefined;
|
|
71
|
+
empty?: string | undefined;
|
|
72
|
+
datePickerToolbarTitle?: string | undefined;
|
|
73
|
+
timePickerToolbarTitle?: string | undefined;
|
|
74
|
+
dateTimePickerToolbarTitle?: string | undefined;
|
|
75
|
+
dateRangePickerToolbarTitle?: string | undefined;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { getPickersLocalization } from "./utils/getPickersLocalization.js";
|
|
2
|
+
const views = {
|
|
3
|
+
hours: 'ঘণ্টা',
|
|
4
|
+
minutes: 'মিনিট',
|
|
5
|
+
seconds: 'সেকেন্ড',
|
|
6
|
+
meridiem: 'এএম/পিএম'
|
|
7
|
+
};
|
|
8
|
+
const bnBDPickers = {
|
|
9
|
+
// Calendar navigation
|
|
10
|
+
previousMonth: 'আগের মাস',
|
|
11
|
+
nextMonth: 'পরের মাস',
|
|
12
|
+
// View navigation
|
|
13
|
+
openPreviousView: 'আগের ভিউ খুলুন',
|
|
14
|
+
openNextView: 'পরের ভিউ খুলুন',
|
|
15
|
+
calendarViewSwitchingButtonAriaLabel: view => view === 'year' ? 'বছরের ভিউ খোলা আছে, ক্যালেন্ডার ভিউতে পরিবর্তন করুন' : 'ক্যালেন্ডার ভিউ খোলা আছে, বছরের ভিউতে পরিবর্তন করুন',
|
|
16
|
+
// DateRange labels
|
|
17
|
+
start: 'শুরু',
|
|
18
|
+
end: 'শেষ',
|
|
19
|
+
startDate: 'শুরুর তারিখ',
|
|
20
|
+
startTime: 'শুরুর সময়',
|
|
21
|
+
endDate: 'শেষের তারিখ',
|
|
22
|
+
endTime: 'শেষের সময়',
|
|
23
|
+
// Action bar
|
|
24
|
+
cancelButtonLabel: 'বাতিল',
|
|
25
|
+
clearButtonLabel: 'পরিষ্কার',
|
|
26
|
+
okButtonLabel: 'ঠিক আছে',
|
|
27
|
+
todayButtonLabel: 'আজ',
|
|
28
|
+
// Toolbar titles
|
|
29
|
+
datePickerToolbarTitle: 'তারিখ নির্বাচন করুন',
|
|
30
|
+
dateTimePickerToolbarTitle: 'তারিখ ও সময় নির্বাচন করুন',
|
|
31
|
+
timePickerToolbarTitle: 'সময় নির্বাচন করুন',
|
|
32
|
+
dateRangePickerToolbarTitle: 'তারিখের পরিসীমা নির্বাচন করুন',
|
|
33
|
+
// Clock labels
|
|
34
|
+
clockLabelText: (view, formattedTime) => `নির্বাচন করুন ${views[view]}. ${!formattedTime ? 'কোনও সময় নির্বাচন করা হয়নি' : `নির্বাচিত সময় ${formattedTime}`}`,
|
|
35
|
+
hoursClockNumberText: hours => `${hours} ঘণ্টা`,
|
|
36
|
+
minutesClockNumberText: minutes => `${minutes} মিনিট`,
|
|
37
|
+
secondsClockNumberText: seconds => `${seconds} সেকেন্ড`,
|
|
38
|
+
// Digital clock labels
|
|
39
|
+
selectViewText: view => `${views[view]} নির্বাচন করুন`,
|
|
40
|
+
// Calendar labels
|
|
41
|
+
calendarWeekNumberHeaderLabel: 'সপ্তাহ সংখ্যা',
|
|
42
|
+
calendarWeekNumberHeaderText: '#',
|
|
43
|
+
calendarWeekNumberAriaLabelText: weekNumber => `সপ্তাহ ${weekNumber}`,
|
|
44
|
+
calendarWeekNumberText: weekNumber => `${weekNumber}`,
|
|
45
|
+
// Open picker labels
|
|
46
|
+
openDatePickerDialogue: formattedDate => formattedDate ? `তারিখ নির্বাচন করুন, নির্বাচিত তারিখ ${formattedDate}` : 'তারিখ নির্বাচন করুন',
|
|
47
|
+
openTimePickerDialogue: formattedTime => formattedTime ? `সময় নির্বাচন করুন, নির্বাচিত সময় ${formattedTime}` : 'সময় নির্বাচন করুন',
|
|
48
|
+
fieldClearLabel: 'পরিষ্কার',
|
|
49
|
+
// Table labels
|
|
50
|
+
timeTableLabel: 'সময় নির্বাচন করুন',
|
|
51
|
+
dateTableLabel: 'তারিখ নির্বাচন করুন',
|
|
52
|
+
// Field section placeholders
|
|
53
|
+
fieldYearPlaceholder: params => 'ব'.repeat(params.digitAmount),
|
|
54
|
+
fieldMonthPlaceholder: params => params.contentType === 'letter' ? 'MMMM' : 'MM',
|
|
55
|
+
fieldDayPlaceholder: () => 'DD',
|
|
56
|
+
fieldWeekDayPlaceholder: params => params.contentType === 'letter' ? 'EEEE' : 'EE',
|
|
57
|
+
fieldHoursPlaceholder: () => 'ঘন্টা',
|
|
58
|
+
fieldMinutesPlaceholder: () => 'মিনিট',
|
|
59
|
+
fieldSecondsPlaceholder: () => 'সেকেন্ড',
|
|
60
|
+
fieldMeridiemPlaceholder: () => 'এএম/পিএম',
|
|
61
|
+
// View names
|
|
62
|
+
year: 'বছর',
|
|
63
|
+
month: 'মাস',
|
|
64
|
+
day: 'দিন',
|
|
65
|
+
weekDay: 'সপ্তাহের দিন',
|
|
66
|
+
hours: 'ঘণ্টা',
|
|
67
|
+
minutes: 'মিনিট',
|
|
68
|
+
seconds: 'সেকেন্ড',
|
|
69
|
+
meridiem: 'এএম/পিএম',
|
|
70
|
+
// Common
|
|
71
|
+
empty: 'ফাঁকা'
|
|
72
|
+
};
|
|
73
|
+
export const bnBD = getPickersLocalization(bnBDPickers);
|
package/esm/locales/index.d.ts
CHANGED
package/esm/locales/index.js
CHANGED
package/esm/models/fields.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { TextFieldProps } from '@mui/material/TextField';
|
|
|
3
3
|
import type { ExportedPickersSectionListProps } from '../PickersSectionList';
|
|
4
4
|
import type { UseFieldInternalProps, UseFieldResponse } from '../internals/hooks/useField';
|
|
5
5
|
import type { PickersTextFieldProps } from '../PickersTextField';
|
|
6
|
-
import {
|
|
6
|
+
import { BaseSingleInputFieldProps, FieldRangeSection, PickerRangeValue, PickerValidValue } from "../internals/models/index.js";
|
|
7
7
|
import { PickerOwnerState } from "./pickers.js";
|
|
8
8
|
import type { ExportedPickerFieldUIProps } from '../internals/components/PickerFieldUI';
|
|
9
9
|
export type FieldSectionType = 'year' | 'month' | 'day' | 'weekDay' | 'hours' | 'minutes' | 'seconds' | 'meridiem' | 'empty';
|
|
@@ -131,7 +131,7 @@ export type PickerFieldSlotProps<TValue extends PickerValidValue, TEnableAccessi
|
|
|
131
131
|
* Props the text field receives when used inside a single input picker.
|
|
132
132
|
* Only contains what the MUI components are passing to the text field, not what users can pass using the `props.slotProps.field` and `props.slotProps.textField`.
|
|
133
133
|
*/
|
|
134
|
-
export type BaseSingleInputPickersTextFieldProps<TEnableAccessibleFieldDOMStructure extends boolean> = Omit<UseFieldResponse<TEnableAccessibleFieldDOMStructure,
|
|
134
|
+
export type BaseSingleInputPickersTextFieldProps<TEnableAccessibleFieldDOMStructure extends boolean> = Omit<UseFieldResponse<TEnableAccessibleFieldDOMStructure, BaseSingleInputFieldProps>, 'slots' | 'slotProps' | 'clearable' | 'onClear' | 'openPickerButtonPosition' | 'clearButtonPosition' | 'openPickerAriaLabel'>;
|
|
135
135
|
/**
|
|
136
136
|
* Props the built-in text field component can receive.
|
|
137
137
|
*/
|
|
@@ -8,4 +8,4 @@ export declare const DATE_TIME_VALIDATION_PROP_NAMES: (keyof DateTimeValidationP
|
|
|
8
8
|
*/
|
|
9
9
|
export declare const extractValidationProps: <Props extends {
|
|
10
10
|
[key: string]: any;
|
|
11
|
-
}>(props: Props) => Pick<Props, "
|
|
11
|
+
}>(props: Props) => Pick<Props, "maxDate" | "minDate" | "disablePast" | "disableFuture" | "shouldDisableYear" | "shouldDisableMonth" | "shouldDisableDate" | "minTime" | "maxTime" | "minutesStep" | "shouldDisableTime" | "disableIgnoringDatePartForTimeValidation" | "ampm" | "minDateTime" | "maxDateTime">;
|
|
@@ -6,4 +6,4 @@ export { validateDateTime } from "./validateDateTime.js";
|
|
|
6
6
|
export type { ValidateDateTimeProps } from './validateDateTime';
|
|
7
7
|
export { extractValidationProps } from "./extractValidationProps.js";
|
|
8
8
|
export { useValidation } from "./useValidation.js";
|
|
9
|
-
export type { Validator } from './useValidation';
|
|
9
|
+
export type { Validator, UseValidationReturnValue } from './useValidation';
|
|
@@ -33,7 +33,7 @@ interface UseValidationOptions<TValue extends PickerValidValue, TError, TValidat
|
|
|
33
33
|
*/
|
|
34
34
|
props: TValidationProps;
|
|
35
35
|
}
|
|
36
|
-
interface UseValidationReturnValue<TValue extends PickerValidValue, TError> {
|
|
36
|
+
export interface UseValidationReturnValue<TValue extends PickerValidValue, TError> {
|
|
37
37
|
/**
|
|
38
38
|
* The validation error associated to the value passed to the `useValidation` hook.
|
|
39
39
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DATE_TIME_VALIDATION_PROP_NAMES, DATE_VALIDATION_PROP_NAMES, TIME_VALIDATION_PROP_NAMES } from "../validation/extractValidationProps.js";
|
|
2
2
|
import { PickerValueType } from "../models/common.js";
|
|
3
|
-
declare const SHARED_FIELD_INTERNAL_PROP_NAMES: readonly ["value", "defaultValue", "referenceDate", "format", "formatDensity", "onChange", "timezone", "onError", "shouldRespectLeadingZeros", "selectedSections", "onSelectedSectionsChange", "unstableFieldRef", "unstableStartFieldRef", "unstableEndFieldRef", "enableAccessibleFieldDOMStructure", "disabled", "readOnly", "dateSeparator", "autoFocus"];
|
|
3
|
+
declare const SHARED_FIELD_INTERNAL_PROP_NAMES: readonly ["value", "defaultValue", "referenceDate", "format", "formatDensity", "onChange", "timezone", "onError", "shouldRespectLeadingZeros", "selectedSections", "onSelectedSectionsChange", "unstableFieldRef", "unstableStartFieldRef", "unstableEndFieldRef", "enableAccessibleFieldDOMStructure", "disabled", "readOnly", "dateSeparator", "autoFocus", "focused"];
|
|
4
4
|
type InternalPropNames<TValueType extends PickerValueType> = (typeof SHARED_FIELD_INTERNAL_PROP_NAMES)[number] | (TValueType extends 'date' | 'date-time' ? (typeof DATE_VALIDATION_PROP_NAMES)[number] : never) | (TValueType extends 'time' | 'date-time' ? (typeof TIME_VALIDATION_PROP_NAMES)[number] : never) | (TValueType extends 'date-time' ? (typeof DATE_TIME_VALIDATION_PROP_NAMES)[number] : never);
|
|
5
5
|
/**
|
|
6
6
|
* Split the props received by the field component into:
|
|
@@ -10,7 +10,7 @@ exports.useSplitFieldProps = void 0;
|
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _extractValidationProps = require("../validation/extractValidationProps");
|
|
13
|
-
const SHARED_FIELD_INTERNAL_PROP_NAMES = ['value', 'defaultValue', 'referenceDate', 'format', 'formatDensity', 'onChange', 'timezone', 'onError', 'shouldRespectLeadingZeros', 'selectedSections', 'onSelectedSectionsChange', 'unstableFieldRef', 'unstableStartFieldRef', 'unstableEndFieldRef', 'enableAccessibleFieldDOMStructure', 'disabled', 'readOnly', 'dateSeparator', 'autoFocus'];
|
|
13
|
+
const SHARED_FIELD_INTERNAL_PROP_NAMES = ['value', 'defaultValue', 'referenceDate', 'format', 'formatDensity', 'onChange', 'timezone', 'onError', 'shouldRespectLeadingZeros', 'selectedSections', 'onSelectedSectionsChange', 'unstableFieldRef', 'unstableStartFieldRef', 'unstableEndFieldRef', 'enableAccessibleFieldDOMStructure', 'disabled', 'readOnly', 'dateSeparator', 'autoFocus', 'focused'];
|
|
14
14
|
/**
|
|
15
15
|
* Split the props received by the field component into:
|
|
16
16
|
* - `internalProps` which are used by the various hooks called by the field component.
|
package/index.js
CHANGED
|
@@ -17,6 +17,7 @@ export declare const cleanFieldResponse: <TFieldResponse extends MakeOptional<Us
|
|
|
17
17
|
openPickerAriaLabel: string;
|
|
18
18
|
textFieldProps: TextFieldProps | PickersTextFieldProps;
|
|
19
19
|
};
|
|
20
|
+
export declare const PickerFieldUIContext: React.Context<PickerFieldUIContextValue>;
|
|
20
21
|
/**
|
|
21
22
|
* Adds the button to open the picker and the button to clear the value of the field.
|
|
22
23
|
* @ignore - internal component.
|
|
@@ -111,6 +112,12 @@ export interface PickerFieldUISlotPropsFromContext extends PickerFieldUISlotProp
|
|
|
111
112
|
interface FieldInputAdornmentOwnerState extends FieldOwnerState {
|
|
112
113
|
position: 'start' | 'end';
|
|
113
114
|
}
|
|
115
|
+
interface PickerFieldUIContextValue {
|
|
116
|
+
inputRef: React.Ref<HTMLInputElement> | undefined;
|
|
117
|
+
slots: PickerFieldUISlotsFromContext;
|
|
118
|
+
slotProps: PickerFieldUISlotPropsFromContext;
|
|
119
|
+
}
|
|
120
|
+
export declare function mergeSlotProps<TProps extends {}, TOwnerState extends FieldOwnerState>(slotPropsA: SlotComponentPropsFromProps<TProps, {}, TOwnerState> | undefined, slotPropsB: SlotComponentPropsFromProps<TProps, {}, TOwnerState> | undefined): Partial<TProps> | ((ownerState: TOwnerState) => {}) | undefined;
|
|
114
121
|
/**
|
|
115
122
|
* The `textField` slot props cannot be handled inside `PickerFieldUI` because it would be a breaking change to not pass the enriched props to `useField`.
|
|
116
123
|
* Once the non-accessible DOM structure will be removed, we will be able to remove the `textField` slot and clean this logic.
|
|
@@ -6,8 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.PickerFieldUI = PickerFieldUI;
|
|
9
|
+
exports.PickerFieldUIContext = void 0;
|
|
9
10
|
exports.PickerFieldUIContextProvider = PickerFieldUIContextProvider;
|
|
10
11
|
exports.cleanFieldResponse = void 0;
|
|
12
|
+
exports.mergeSlotProps = mergeSlotProps;
|
|
11
13
|
exports.useFieldTextFieldProps = useFieldTextFieldProps;
|
|
12
14
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
15
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
@@ -97,7 +99,7 @@ const cleanFieldResponse = _ref => {
|
|
|
97
99
|
};
|
|
98
100
|
};
|
|
99
101
|
exports.cleanFieldResponse = cleanFieldResponse;
|
|
100
|
-
const PickerFieldUIContext = /*#__PURE__*/React.createContext({
|
|
102
|
+
const PickerFieldUIContext = exports.PickerFieldUIContext = /*#__PURE__*/React.createContext({
|
|
101
103
|
slots: {},
|
|
102
104
|
slotProps: {},
|
|
103
105
|
inputRef: undefined
|
|
@@ -60,10 +60,7 @@ export interface ExportedPickerPopperProps {
|
|
|
60
60
|
placement?: MuiPopperProps['placement'];
|
|
61
61
|
}
|
|
62
62
|
export interface PickerPopperProps extends ExportedPickerPopperProps {
|
|
63
|
-
role: 'tooltip' | 'dialog';
|
|
64
|
-
containerRef?: React.Ref<HTMLDivElement>;
|
|
65
63
|
children?: React.ReactNode;
|
|
66
|
-
onBlur?: () => void;
|
|
67
64
|
slots?: PickerPopperSlots;
|
|
68
65
|
slotProps?: PickerPopperSlotProps;
|
|
69
66
|
}
|