1 | "use strict";
|
2 | var __assign = (this && this.__assign) || function () {
|
3 | __assign = Object.assign || function(t) {
|
4 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
5 | s = arguments[i];
|
6 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
7 | t[p] = s[p];
|
8 | }
|
9 | return t;
|
10 | };
|
11 | return __assign.apply(this, arguments);
|
12 | };
|
13 | var __rest = (this && this.__rest) || function (s, e) {
|
14 | var t = {};
|
15 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
16 | t[p] = s[p];
|
17 | if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
18 | for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
19 | if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
20 | t[p[i]] = s[p[i]];
|
21 | }
|
22 | return t;
|
23 | };
|
24 | var __importStar = (this && this.__importStar) || function (mod) {
|
25 | if (mod && mod.__esModule) return mod;
|
26 | var result = {};
|
27 | if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
28 | result["default"] = mod;
|
29 | return result;
|
30 | };
|
31 | var __importDefault = (this && this.__importDefault) || function (mod) {
|
32 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
33 | };
|
34 | Object.defineProperty(exports, "__esModule", { value: true });
|
35 | var React = __importStar(require("react"));
|
36 | var clsx_1 = __importDefault(require("clsx"));
|
37 | var Button_1 = __importDefault(require("@material-ui/core/Button"));
|
38 | var DialogActions_1 = __importDefault(require("@material-ui/core/DialogActions"));
|
39 | var DialogContent_1 = __importDefault(require("@material-ui/core/DialogContent"));
|
40 | var Dialog_1 = __importDefault(require("@material-ui/core/Dialog"));
|
41 | var dimensions_1 = require("../constants/dimensions");
|
42 | var styles_1 = require("@material-ui/core/styles");
|
43 | exports.ModalDialog = function (_a) {
|
44 | var _b, _c;
|
45 | var children = _a.children, classes = _a.classes, onAccept = _a.onAccept, onDismiss = _a.onDismiss, onClear = _a.onClear, onSetToday = _a.onSetToday, okLabel = _a.okLabel, cancelLabel = _a.cancelLabel, clearLabel = _a.clearLabel, todayLabel = _a.todayLabel, clearable = _a.clearable, showTodayButton = _a.showTodayButton, showTabs = _a.showTabs, wider = _a.wider, other = __rest(_a, ["children", "classes", "onAccept", "onDismiss", "onClear", "onSetToday", "okLabel", "cancelLabel", "clearLabel", "todayLabel", "clearable", "showTodayButton", "showTabs", "wider"]);
|
46 | return (React.createElement(Dialog_1.default, __assign({ role: "dialog", onClose: onDismiss, classes: {
|
47 | paper: clsx_1.default(classes.dialogRoot, (_b = {},
|
48 | _b[classes.dialogRootWider] = wider,
|
49 | _b)),
|
50 | } }, other),
|
51 | React.createElement(DialogContent_1.default, { children: children, className: classes.dialog }),
|
52 | React.createElement(DialogActions_1.default, { classes: {
|
53 | root: clsx_1.default((_c = {},
|
54 | _c[classes.withAdditionalAction] = clearable || showTodayButton,
|
55 | _c)),
|
56 | } },
|
57 | clearable && (React.createElement(Button_1.default, { color: "primary", onClick: onClear }, clearLabel)),
|
58 | showTodayButton && (React.createElement(Button_1.default, { color: "primary", onClick: onSetToday }, todayLabel)),
|
59 | cancelLabel && (React.createElement(Button_1.default, { color: "primary", onClick: onDismiss }, cancelLabel)),
|
60 | okLabel && (React.createElement(Button_1.default, { color: "primary", onClick: onAccept }, okLabel)))));
|
61 | };
|
62 | exports.ModalDialog.displayName = 'ModalDialog';
|
63 | exports.styles = styles_1.createStyles({
|
64 | dialogRoot: {
|
65 | minWidth: dimensions_1.DIALOG_WIDTH,
|
66 | },
|
67 | dialogRootWider: {
|
68 | minWidth: dimensions_1.DIALOG_WIDTH_WIDER,
|
69 | },
|
70 | dialog: {
|
71 | '&:first-child': {
|
72 | padding: 0,
|
73 | },
|
74 | },
|
75 | withAdditionalAction: {
|
76 |
|
77 |
|
78 | justifyContent: 'flex-start',
|
79 | '& > *:first-child': {
|
80 | marginRight: 'auto',
|
81 | },
|
82 | },
|
83 | });
|
84 | exports.default = styles_1.withStyles(exports.styles, { name: 'MuiPickersModal' })(exports.ModalDialog);
|