import _extends from "@babel/runtime/helpers/esm/extends"; import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties"; var _excluded = ["onAccept", "onClear", "onCancel", "onSetToday", "actions"]; import * as React from 'react'; import PropTypes from 'prop-types'; import Button from '@mui/material/Button'; import DialogActions from '@mui/material/DialogActions'; import { useLocaleText } from '../internals/hooks/useUtils'; import { jsx as _jsx } from "react/jsx-runtime"; /** * Demos: * * - [Custom slots and subcomponents](https://mui.com/x/react-date-pickers/custom-components/) * - [Custom layout](https://mui.com/x/react-date-pickers/custom-layout/) * * API: * * - [PickersActionBar API](https://mui.com/x/api/date-pickers/pickers-action-bar/) */ function PickersActionBar(props) { var onAccept = props.onAccept, onClear = props.onClear, onCancel = props.onCancel, onSetToday = props.onSetToday, actions = props.actions, other = _objectWithoutProperties(props, _excluded); var localeText = useLocaleText(); if (actions == null || actions.length === 0) { return null; } var buttons = actions == null ? void 0 : actions.map(function (actionType) { switch (actionType) { case 'clear': return /*#__PURE__*/_jsx(Button, { onClick: onClear, children: localeText.clearButtonLabel }, actionType); case 'cancel': return /*#__PURE__*/_jsx(Button, { onClick: onCancel, children: localeText.cancelButtonLabel }, actionType); case 'accept': return /*#__PURE__*/_jsx(Button, { onClick: onAccept, children: localeText.okButtonLabel }, actionType); case 'today': return /*#__PURE__*/_jsx(Button, { onClick: onSetToday, children: localeText.todayButtonLabel }, actionType); default: return null; } }); return /*#__PURE__*/_jsx(DialogActions, _extends({}, other, { children: buttons })); } process.env.NODE_ENV !== "production" ? PickersActionBar.propTypes = { // ----------------------------- Warning -------------------------------- // | These PropTypes are generated from the TypeScript type definitions | // | To update them edit the TypeScript types and run "yarn proptypes" | // ---------------------------------------------------------------------- /** * Ordered array of actions to display. * If empty, does not display that action bar. * @default `['cancel', 'accept']` for mobile and `[]` for desktop */ actions: PropTypes.arrayOf(PropTypes.oneOf(['accept', 'cancel', 'clear', 'today']).isRequired), /** * If `true`, the actions do not have additional margin. * @default false */ disableSpacing: PropTypes.bool, onAccept: PropTypes.func.isRequired, onCancel: PropTypes.func.isRequired, onClear: PropTypes.func.isRequired, onSetToday: PropTypes.func.isRequired, /** * The system prop that allows defining system overrides as well as additional CSS styles. */ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]) } : void 0; export { PickersActionBar };