31 lines
751 B
JavaScript
31 lines
751 B
JavaScript
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
import { useIsLandscape } from '../useIsLandscape';
|
|
|
|
/**
|
|
* Props used to create the layout of the views.
|
|
* Those props are exposed on all the pickers.
|
|
*/
|
|
|
|
/**
|
|
* Prepare the props for the view layout (managed by `PickersLayout`)
|
|
*/
|
|
export const usePickerLayoutProps = ({
|
|
props,
|
|
propsFromPickerValue,
|
|
propsFromPickerViews,
|
|
wrapperVariant
|
|
}) => {
|
|
const {
|
|
orientation
|
|
} = props;
|
|
const isLandscape = useIsLandscape(propsFromPickerViews.views, orientation);
|
|
const layoutProps = _extends({}, propsFromPickerViews, propsFromPickerValue, {
|
|
isLandscape,
|
|
wrapperVariant,
|
|
disabled: props.disabled,
|
|
readOnly: props.readOnly
|
|
});
|
|
return {
|
|
layoutProps
|
|
};
|
|
}; |