UNPKG

@material-ui/lab

Version:
84 lines (82 loc) 2.39 kB
import _extends from "@babel/runtime/helpers/esm/extends"; import * as React from 'react'; import Button from '@material-ui/core/Button'; import DialogActions from '@material-ui/core/DialogActions'; import DialogContent from '@material-ui/core/DialogContent'; import Dialog, { dialogClasses } from '@material-ui/core/Dialog'; import { styled } from '@material-ui/core/styles'; import { DIALOG_WIDTH } from './constants/dimensions'; import { jsx as _jsx } from "react/jsx-runtime"; import { jsxs as _jsxs } from "react/jsx-runtime"; const PickersModalDialogRoot = styled(Dialog, { skipSx: true })({ [`& .${dialogClasses.container}`]: { outline: 0 }, [`& .${dialogClasses.paper}`]: { outline: 0, minWidth: DIALOG_WIDTH } }); const PickersModalDialogContent = styled(DialogContent, { skipSx: true })({ '&:first-of-type': { padding: 0 } }); const PickersModalDialogActions = styled(DialogActions, { skipSx: true })(({ styleProps }) => _extends({}, (styleProps.clearable || styleProps.showTodayButton) && { // set justifyContent to default value to fix IE11 layout bug // see https://github.com/mui-org/material-ui-pickers/pull/267 justifyContent: 'flex-start', '& > *:first-of-type': { marginRight: 'auto' } })); const PickersModalDialog = props => { const { cancelText = 'Cancel', children, clearable = false, clearText = 'Clear', DialogProps = {}, okText = 'OK', onAccept, onClear, onDismiss, onSetToday, open, showTodayButton = false, todayText = 'Today' } = props; const styleProps = props; return /*#__PURE__*/_jsxs(PickersModalDialogRoot, _extends({ open: open, onClose: onDismiss }, DialogProps, { children: [/*#__PURE__*/_jsx(PickersModalDialogContent, { children: children }), /*#__PURE__*/_jsxs(PickersModalDialogActions, { styleProps: styleProps, children: [clearable && /*#__PURE__*/_jsx(Button, { onClick: onClear, children: clearText }), showTodayButton && /*#__PURE__*/_jsx(Button, { onClick: onSetToday, children: todayText }), cancelText && /*#__PURE__*/_jsx(Button, { onClick: onDismiss, children: cancelText }), okText && /*#__PURE__*/_jsx(Button, { onClick: onAccept, children: okText })] })] })); }; export default PickersModalDialog;