Added logging, changed some directory structure

This commit is contained in:
2018-01-13 21:33:40 -05:00
parent f079a5f067
commit 8e72ffb917
73656 changed files with 35284 additions and 53718 deletions

View File

@@ -0,0 +1,37 @@
import * as React from 'react';
import { StandardProps } from '..';
import { ModalProps, ModalClassKey } from '../internal/Modal';
import { TransitionDuration } from '../internal/transition';
export interface DialogProps extends StandardProps<
ModalProps,
DialogClassKey,
'onBackdropClick' | 'onEscapeKeyUp'
> {
fullScreen?: boolean;
ignoreBackdropClick?: boolean;
ignoreEscapeKeyUp?: boolean;
transitionDuration?: TransitionDuration;
maxWidth?: 'xs' | 'sm' | 'md';
fullWidth?: boolean;
onBackdropClick?: Function;
onEscapeKeyUp?: Function;
onRequestClose?: React.EventHandler<any>;
open?: boolean;
transition?: React.ReactType;
}
export type DialogClassKey =
| ModalClassKey
| 'root'
| 'paper'
| 'paperWidthXs'
| 'paperWidthSm'
| 'paperWidthMd'
| 'fullWidth'
| 'fullScreen'
;
declare const Dialog: React.ComponentType<DialogProps>;
export default Dialog;

View File

@@ -0,0 +1,138 @@
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
import React from 'react';
import classNames from 'classnames';
import withStyles from '../styles/withStyles';
import { capitalizeFirstLetter } from '../utils/helpers';
import Modal from '../internal/Modal';
import Fade from '../transitions/Fade';
import { duration } from '../styles/transitions';
import Paper from '../Paper';
export const styles = theme => ({
root: {
justifyContent: 'center',
alignItems: 'center'
},
paper: {
display: 'flex',
margin: theme.spacing.unit * 4,
flexDirection: 'column',
flex: '0 1 auto',
position: 'relative',
maxHeight: '90vh',
overflowY: 'auto', // Fix IE11 issue, to remove at some point.
'&:focus': {
outline: 'none'
}
},
paperWidthXs: {
maxWidth: theme.breakpoints.values.xs
},
paperWidthSm: {
maxWidth: theme.breakpoints.values.sm
},
paperWidthMd: {
maxWidth: theme.breakpoints.values.md
},
fullWidth: {
width: '100%'
},
fullScreen: {
margin: 0,
width: '100%',
maxWidth: '100%',
height: '100%',
maxHeight: '100%',
borderRadius: 0
}
});
/**
* Dialogs are overlaid modal paper based components with a backdrop.
*/
function Dialog(props) {
const {
children,
classes,
className,
fullScreen,
ignoreBackdropClick,
ignoreEscapeKeyUp,
transitionDuration,
maxWidth,
fullWidth,
open,
onBackdropClick,
onEscapeKeyUp,
onEnter,
onEntering,
onEntered,
onExit,
onExiting,
onExited,
onRequestClose,
transition: TransitionProp
} = props,
other = _objectWithoutProperties(props, ['children', 'classes', 'className', 'fullScreen', 'ignoreBackdropClick', 'ignoreEscapeKeyUp', 'transitionDuration', 'maxWidth', 'fullWidth', 'open', 'onBackdropClick', 'onEscapeKeyUp', 'onEnter', 'onEntering', 'onEntered', 'onExit', 'onExiting', 'onExited', 'onRequestClose', 'transition']);
return React.createElement(
Modal,
_extends({
className: classNames(classes.root, className),
BackdropTransitionDuration: transitionDuration,
ignoreBackdropClick: ignoreBackdropClick,
ignoreEscapeKeyUp: ignoreEscapeKeyUp,
onBackdropClick: onBackdropClick,
onEscapeKeyUp: onEscapeKeyUp,
onRequestClose: onRequestClose,
show: open
}, other),
React.createElement(
TransitionProp,
{
appear: true,
'in': open,
timeout: transitionDuration,
onEnter: onEnter,
onEntering: onEntering,
onEntered: onEntered,
onExit: onExit,
onExiting: onExiting,
onExited: onExited
},
React.createElement(
Paper,
{
'data-mui-test': 'Dialog',
elevation: 24,
className: classNames(classes.paper, classes[`paperWidth${capitalizeFirstLetter(maxWidth)}`], {
[classes.fullScreen]: fullScreen,
[classes.fullWidth]: fullWidth
})
},
children
)
)
);
}
Dialog.defaultProps = {
fullScreen: false,
ignoreBackdropClick: false,
ignoreEscapeKeyUp: false,
transitionDuration: {
enter: duration.enteringScreen,
exit: duration.leavingScreen
},
maxWidth: 'sm',
fullWidth: false,
open: false,
transition: Fade
};
export default withStyles(styles, { name: 'MuiDialog' })(Dialog);

View File

@@ -0,0 +1,17 @@
import * as React from 'react';
import { StandardProps } from '..';
export interface DialogActionsProps extends StandardProps<
React.HTMLAttributes<HTMLDivElement>,
DialogActionsClassKey
> {}
export type DialogActionsClassKey =
| 'root'
| 'action'
| 'button'
;
declare const DialogActions: React.ComponentType<DialogActionsProps>;
export default DialogActions;

View File

@@ -0,0 +1,44 @@
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
import React from 'react';
import classNames from 'classnames';
import withStyles from '../styles/withStyles';
import '../Button'; // So we don't have any override priority issue.
export const styles = theme => ({
root: {
display: 'flex',
justifyContent: 'flex-end',
alignItems: 'center',
margin: `${theme.spacing.unit}px ${theme.spacing.unit / 2}px`,
flex: '0 0 auto'
},
action: {
margin: `0 ${theme.spacing.unit / 2}px`
},
button: {
minWidth: 64
}
});
function DialogActions(props) {
const { children, classes, className } = props,
other = _objectWithoutProperties(props, ['children', 'classes', 'className']);
return React.createElement(
'div',
_extends({ 'data-mui-test': 'DialogActions', className: classNames(classes.root, className) }, other),
React.Children.map(children, button => React.isValidElement(button) && React.createElement(
'div',
{ className: classes.action },
React.cloneElement(button, {
className: classNames(classes.button, button.props.className)
})
))
);
}
export default withStyles(styles, { name: 'MuiDialogActions' })(DialogActions);

View File

@@ -0,0 +1,15 @@
import * as React from 'react';
import { StandardProps } from '..';
export interface DialogContentProps extends StandardProps<
React.HTMLAttributes<HTMLDivElement>,
DialogContentClassKey
> {}
export type DialogContentClassKey =
| 'root'
;
declare const DialogContent: React.ComponentType<DialogContentProps>;
export default DialogContent;

View File

@@ -0,0 +1,35 @@
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
import React from 'react';
import classNames from 'classnames';
import withStyles from '../styles/withStyles';
export const styles = theme => {
const spacing = theme.spacing.unit * 3;
return {
root: {
flex: '1 1 auto',
overflowY: 'auto',
padding: `0 ${spacing}px ${spacing}px ${spacing}px`,
'&:first-child': {
paddingTop: spacing
}
}
};
};
function DialogContent(props) {
const { classes, children, className } = props,
other = _objectWithoutProperties(props, ['classes', 'children', 'className']);
return React.createElement(
'div',
_extends({ className: classNames(classes.root, className) }, other),
children
);
}
export default withStyles(styles, { name: 'MuiDialogContent' })(DialogContent);

View File

@@ -0,0 +1,15 @@
import * as React from 'react';
import { StandardProps } from '..';
export interface DialogContentTextProps extends StandardProps<
React.HTMLAttributes<HTMLParagraphElement>,
DialogContentTextClassKey
> {}
export type DialogContentTextClassKey =
| 'root'
;
declare const DialogContentText: React.ComponentType<DialogContentTextProps>;
export default DialogContentText;

View File

@@ -0,0 +1,28 @@
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
import React from 'react';
import classNames from 'classnames';
import withStyles from '../styles/withStyles';
export const styles = theme => ({
root: _extends({}, theme.typography.subheading, {
color: theme.palette.text.secondary,
margin: 0
})
});
function DialogContentText(props) {
const { children, classes, className } = props,
other = _objectWithoutProperties(props, ['children', 'classes', 'className']);
return React.createElement(
'p',
_extends({ className: classNames(classes.root, className) }, other),
children
);
}
export default withStyles(styles, { name: 'MuiDialogContentText' })(DialogContentText);

View File

@@ -0,0 +1,17 @@
import * as React from 'react';
import { StandardProps } from '..';
export interface DialogTitleProps extends StandardProps<
React.HTMLAttributes<HTMLDivElement>,
DialogTitleClassKey
> {
disableTypography?: boolean;
}
export type DialogTitleClassKey =
| 'root'
;
declare const DialogTitle: React.ComponentType<DialogTitleProps>;
export default DialogTitle;

View File

@@ -0,0 +1,39 @@
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
import React from 'react';
import classNames from 'classnames';
import withStyles from '../styles/withStyles';
import Typography from '../Typography';
export const styles = theme => ({
root: {
margin: 0,
padding: `${theme.spacing.unit * 3}px ${theme.spacing.unit * 3}px \
20px ${theme.spacing.unit * 3}px`,
flex: '0 0 auto'
}
});
function DialogTitle(props) {
const { children, classes, className, disableTypography } = props,
other = _objectWithoutProperties(props, ['children', 'classes', 'className', 'disableTypography']);
return React.createElement(
'div',
_extends({ 'data-mui-test': 'DialogTitle', className: classNames(classes.root, className) }, other),
disableTypography ? children : React.createElement(
Typography,
{ type: 'title' },
children
)
);
}
DialogTitle.defaultProps = {
disableTypography: false
};
export default withStyles(styles, { name: 'MuiDialogTitle' })(DialogTitle);

View File

@@ -0,0 +1,14 @@
export { default } from './Dialog';
export * from './Dialog';
export { default as DialogActions } from './DialogActions';
export * from './DialogActions';
export { default as DialogTitle } from './DialogTitle';
export * from './DialogTitle';
export { default as DialogContent } from './DialogContent';
export * from './DialogContent';
export { default as DialogContentText } from './DialogContentText';
export * from './DialogContentText';
export {
default as withMobileDialog,
} from './withMobileDialog';
export * from './withMobileDialog';

View File

@@ -0,0 +1,6 @@
export { default } from './Dialog';
export { default as DialogActions } from './DialogActions';
export { default as DialogTitle } from './DialogTitle';
export { default as DialogContent } from './DialogContent';
export { default as DialogContentText } from './DialogContentText';
export { default as withMobileDialog } from './withMobileDialog';

View File

@@ -0,0 +1,12 @@
import { Breakpoint } from '../styles/createBreakpoints';
import { WithWidthProps } from '../utils/withWidth';
export interface WithMobileDialogOptions {
breakpoint: Breakpoint;
}
export default function withMobileDialog<P = {}>(
options: WithMobileDialogOptions
): (
component: React.ComponentType<P & Partial<WithWidthProps>>
) => React.ComponentClass<P & Partial<WithWidthProps>>;

View File

@@ -0,0 +1,28 @@
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
import React from 'react';
import wrapDisplayName from 'recompose/wrapDisplayName';
import withWidth, { isWidthDown } from '../utils/withWidth';
/**
* Dialog will responsively be full screen *at or below* the given breakpoint
* (defaults to 'sm' for mobile devices).
* Notice that this Higher-order Component is incompatible with server side rendering.
*/
const withMobileDialog = (options = { breakpoint: 'sm' }) => Component => {
const { breakpoint } = options;
function WithMobileDialog(props) {
return React.createElement(Component, _extends({ fullScreen: isWidthDown(breakpoint, props.width) }, props));
}
if (process.env.NODE_ENV !== 'production') {
WithMobileDialog.displayName = wrapDisplayName(Component, 'withMobileDialog');
}
return withWidth()(WithMobileDialog);
};
export default withMobileDialog;