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,32 @@
import * as React from 'react';
import { StandardProps } from '..';
import { SwitchBaseProps, SwitchBaseClassKey } from '../internal/SwitchBase';
export interface SwitchProps extends StandardProps<
SwitchBaseProps,
SwitchClassKey
> {
checked?: boolean | string;
checkedClassName?: string;
checkedIcon?: React.ReactNode;
defaultChecked?: boolean;
disabled?: boolean;
disabledClassName?: string;
disableRipple?: boolean;
icon?: React.ReactNode;
inputProps?: object;
name?: string;
onChange?: (event: React.ChangeEvent<{}>, checked: boolean) => void;
tabIndex?: number;
value?: string;
}
export type SwitchClassKey =
| SwitchBaseClassKey
| 'bar'
| 'icon'
;
declare const Switch: React.ComponentType<SwitchProps>;
export default Switch;

View File

@@ -0,0 +1,91 @@
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; }
// weak
import React from 'react';
import classNames from 'classnames';
import withStyles from '../styles/withStyles';
import createSwitch from '../internal/SwitchBase';
export const styles = theme => ({
root: {
display: 'inline-flex',
width: 62,
position: 'relative',
flexShrink: 0
},
bar: {
borderRadius: 7,
display: 'block',
position: 'absolute',
width: 34,
height: 14,
top: '50%',
marginTop: -7,
left: '50%',
marginLeft: -17,
transition: theme.transitions.create(['opacity', 'background-color'], {
duration: theme.transitions.duration.shortest
}),
backgroundColor: theme.palette.type === 'light' ? '#000' : '#fff',
opacity: theme.palette.type === 'light' ? 0.38 : 0.3
},
icon: {
boxShadow: theme.shadows[1],
backgroundColor: 'currentColor',
width: 20,
height: 20,
borderRadius: '50%'
},
// For SwitchBase
default: {
zIndex: 1,
color: theme.palette.type === 'light' ? theme.palette.grey[50] : theme.palette.grey[400],
transition: theme.transitions.create('transform', {
duration: theme.transitions.duration.shortest
})
},
checked: {
color: theme.palette.primary[500],
transform: 'translateX(14px)',
'& + $bar': {
backgroundColor: theme.palette.primary[500],
opacity: 0.5
}
},
disabled: {
color: theme.palette.type === 'light' ? theme.palette.grey[400] : theme.palette.grey[800],
'& + $bar': {
backgroundColor: theme.palette.type === 'light' ? '#000' : '#fff',
opacity: theme.palette.type === 'light' ? 0.12 : 0.1
}
}
});
const SwitchBase = createSwitch();
function Switch(props) {
const { classes, className } = props,
other = _objectWithoutProperties(props, ['classes', 'className']);
const icon = React.createElement('div', { className: classes.icon });
return React.createElement(
'div',
{ className: classNames(classes.root, className) },
React.createElement(SwitchBase, _extends({
icon: icon,
classes: {
default: classes.default,
checked: classes.checked,
disabled: classes.disabled
},
checkedIcon: icon
}, other)),
React.createElement('div', { className: classes.bar })
);
}
export default withStyles(styles, { name: 'MuiSwitch' })(Switch);

View File

@@ -0,0 +1,2 @@
export { default } from './Switch';
export * from './Switch';

View File

@@ -0,0 +1 @@
export { default } from './Switch';