UNPKG

puppy-lib-components

Version:

A modern TypeScript React component library with generic UI components and football pickem domain components

12 lines (11 loc) 1.98 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { Dialog, DialogTitle, DialogContent, DialogActions, Button, Box } from '@mui/material'; import { DateRange as DateRangeIcon } from '@mui/icons-material'; import { Calendar } from './Calendar'; import { RangePositionIndicator } from './RangePositionIndicator'; export const MobilePicker = ({ open, onClose, currentValue, rangePosition, onRangePositionChange, onDateChange, onAccept, onClear, clearable, minDate, maxDate, disableFuture, disablePast, shouldDisableDate, showDaysOutsideCurrentMonth, }) => { const startDate = currentValue.start || new Date(); return (_jsxs(Dialog, { open: open, onClose: onClose, maxWidth: "sm", fullWidth: true, PaperProps: { sx: { minHeight: 500 } }, children: [_jsx(DialogTitle, { children: _jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 1 }, children: [_jsx(DateRangeIcon, {}), "Select Date Range"] }) }), _jsxs(DialogContent, { children: [_jsx(Box, { sx: { mb: 3 }, children: _jsx(RangePositionIndicator, { rangePosition: rangePosition, onRangePositionChange: onRangePositionChange }) }), _jsx(Box, { sx: { display: 'flex', justifyContent: 'center' }, children: _jsx(Calendar, { date: startDate, onDateChange: (date) => onDateChange(date, 0), selectedStart: currentValue.start, selectedEnd: currentValue.end, rangePosition: rangePosition, onRangePositionChange: onRangePositionChange, minDate: minDate, maxDate: maxDate, disableFuture: disableFuture, disablePast: disablePast, shouldDisableDate: shouldDisableDate, showDaysOutsideCurrentMonth: showDaysOutsideCurrentMonth }) })] }), _jsxs(DialogActions, { children: [clearable && (currentValue.start || currentValue.end) && (_jsx(Button, { onClick: onClear, children: "Clear" })), _jsx(Button, { onClick: onClose, children: "Cancel" }), _jsx(Button, { onClick: onAccept, variant: "contained", disabled: !currentValue.start || !currentValue.end, children: "OK" })] })] })); };