Finish autoinjects
parent
6afb914126
commit
c356a2be5a
|
@ -22,3 +22,4 @@ export const SWITCH = 'RTSwitch';
|
|||
export const TABLE = 'RTTable';
|
||||
export const TABS = 'RTTabs';
|
||||
export const TOOLTIP = 'RTTooltip';
|
||||
export const TIMEPICKER = 'RTTimePicker';
|
||||
|
|
|
@ -13,27 +13,18 @@ export Dropdown from './dropdown';
|
|||
export FontIcon from './font_icon';
|
||||
export Form from './form';
|
||||
export Input from './input';
|
||||
export { Layout, NavDrawer, Panel, Sidebar } from './layout';
|
||||
export * from './layout';
|
||||
export Link from './link';
|
||||
export List from './list/List';
|
||||
export ListItem from './list/ListItem';
|
||||
export ListDivider from './list/ListDivider';
|
||||
export ListCheckbox from './list/ListCheckbox';
|
||||
export ListSubHeader from './list/ListSubHeader';
|
||||
export Menu from './menu/Menu';
|
||||
export MenuItem from './menu/MenuItem';
|
||||
export MenuDivider from './menu/MenuDivider';
|
||||
export IconMenu from './menu/IconMenu';
|
||||
export * from './list';
|
||||
export * from './menu';
|
||||
export Navigation from './navigation';
|
||||
export ProgressBar from './progress_bar';
|
||||
export RadioGroup from './radio/RadioGroup';
|
||||
export RadioButton from './radio/RadioButton';
|
||||
export * from './radio';
|
||||
export Ripple from './ripple';
|
||||
export Slider from './slider';
|
||||
export Snackbar from './snackbar';
|
||||
export Switch from './switch';
|
||||
export Table from './table';
|
||||
export Tabs from './tabs/Tabs';
|
||||
export Tab from './tabs/Tab';
|
||||
export * from './tabs';
|
||||
export Tooltip from './tooltip';
|
||||
export TimePicker from './time_picker';
|
||||
|
|
|
@ -10,5 +10,6 @@ const ThemedRadio = radioFactory(themedRippleFactory({ centered: true, spread: 2
|
|||
const ThemedRadioButton = themr(RADIO, theme)(radioButtonFactory(ThemedRadio));
|
||||
const ThemedRadioGroup = themr(RADIO, theme)(radioGroupFactory(ThemedRadioButton));
|
||||
|
||||
export default ThemedRadioButton;
|
||||
export { ThemedRadioButton as RadioButton };
|
||||
export { ThemedRadioGroup as RadioGroup };
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
import React from 'react';
|
||||
import React, { Component, PropTypes } from 'react';
|
||||
import CssTransitionGroup from 'react-addons-css-transition-group';
|
||||
import { ZoomIn, ZoomOut } from '../animations';
|
||||
import time from '../utils/time';
|
||||
import Hours from './ClockHours';
|
||||
import Minutes from './ClockMinutes';
|
||||
import time from '../utils/time.js';
|
||||
import Hours from './ClockHours.js';
|
||||
import Minutes from './ClockMinutes.js';
|
||||
|
||||
class Clock extends React.Component {
|
||||
class Clock extends Component {
|
||||
static propTypes = {
|
||||
className: React.PropTypes.string,
|
||||
display: React.PropTypes.oneOf(['hours', 'minutes']),
|
||||
format: React.PropTypes.oneOf(['24hr', 'ampm']),
|
||||
onChange: React.PropTypes.func,
|
||||
onHandMoved: React.PropTypes.func,
|
||||
theme: React.PropTypes.shape({
|
||||
clock: React.PropTypes.string.isRequired,
|
||||
clockWrapper: React.PropTypes.string.isRequired,
|
||||
placeholder: React.PropTypes.string.isRequired
|
||||
className: PropTypes.string,
|
||||
display: PropTypes.oneOf(['hours', 'minutes']),
|
||||
format: PropTypes.oneOf(['24hr', 'ampm']),
|
||||
onChange: PropTypes.func,
|
||||
onHandMoved: PropTypes.func,
|
||||
theme: PropTypes.shape({
|
||||
clock: PropTypes.string.isRequired,
|
||||
clockWrapper: PropTypes.string.isRequired,
|
||||
placeholder: PropTypes.string.isRequired
|
||||
}),
|
||||
time: React.PropTypes.object
|
||||
time: PropTypes.object
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
import React from 'react';
|
||||
import React, { Component, PropTypes } from 'react';
|
||||
import classnames from 'classnames';
|
||||
|
||||
class Face extends React.Component {
|
||||
class Face extends Component {
|
||||
static propTypes = {
|
||||
active: React.PropTypes.number,
|
||||
numbers: React.PropTypes.array,
|
||||
radius: React.PropTypes.number,
|
||||
spacing: React.PropTypes.number,
|
||||
theme: React.PropTypes.shape({
|
||||
active: React.PropTypes.string.isRequired,
|
||||
face: React.PropTypes.string.isRequired,
|
||||
number: React.PropTypes.string.isRequired
|
||||
active: PropTypes.number,
|
||||
numbers: PropTypes.array,
|
||||
radius: PropTypes.number,
|
||||
spacing: PropTypes.number,
|
||||
theme: PropTypes.shape({
|
||||
active: PropTypes.string.isRequired,
|
||||
face: PropTypes.string.isRequired,
|
||||
number: PropTypes.string.isRequired
|
||||
}),
|
||||
twoDigits: React.PropTypes.bool
|
||||
twoDigits: PropTypes.bool
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
import React from 'react';
|
||||
import events from '../utils/events';
|
||||
import prefixer from '../utils/prefixer';
|
||||
import utils from '../utils/utils';
|
||||
import React, { Component, PropTypes } from 'react';
|
||||
import events from '../utils/events.js';
|
||||
import prefixer from '../utils/prefixer.js';
|
||||
import utils from '../utils/utils.js';
|
||||
|
||||
class Hand extends React.Component {
|
||||
class Hand extends Component {
|
||||
static propTypes = {
|
||||
angle: React.PropTypes.number,
|
||||
className: React.PropTypes.string,
|
||||
length: React.PropTypes.number,
|
||||
onMove: React.PropTypes.func,
|
||||
onMoved: React.PropTypes.func,
|
||||
origin: React.PropTypes.object,
|
||||
step: React.PropTypes.number,
|
||||
theme: React.PropTypes.shape({
|
||||
hand: React.PropTypes.string.isRequired,
|
||||
knob: React.PropTypes.string.isRequired
|
||||
angle: PropTypes.number,
|
||||
className: PropTypes.string,
|
||||
length: PropTypes.number,
|
||||
onMove: PropTypes.func,
|
||||
onMoved: PropTypes.func,
|
||||
origin: PropTypes.object,
|
||||
step: PropTypes.number,
|
||||
theme: PropTypes.shape({
|
||||
hand: PropTypes.string.isRequired,
|
||||
knob: PropTypes.string.isRequired
|
||||
})
|
||||
};
|
||||
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
import React from 'react';
|
||||
import utils from '../utils/utils';
|
||||
import Face from './ClockFace';
|
||||
import Hand from './ClockHand';
|
||||
import React, { Component, PropTypes } from 'react';
|
||||
import utils from '../utils/utils.js';
|
||||
import Hand from './ClockHand.js';
|
||||
import Face from './ClockFace.js';
|
||||
|
||||
const outerNumbers = [0, ...utils.range(13, 24)];
|
||||
const innerNumbers = [12, ...utils.range(1, 12)];
|
||||
const innerSpacing = 1.7;
|
||||
const step = 360 / 12;
|
||||
|
||||
class Hours extends React.Component {
|
||||
class Hours extends Component {
|
||||
static propTypes = {
|
||||
center: React.PropTypes.object,
|
||||
format: React.PropTypes.oneOf(['24hr', 'ampm']),
|
||||
onChange: React.PropTypes.func,
|
||||
onHandMoved: React.PropTypes.func,
|
||||
radius: React.PropTypes.number,
|
||||
selected: React.PropTypes.number,
|
||||
spacing: React.PropTypes.number,
|
||||
theme: React.PropTypes.object
|
||||
center: PropTypes.object,
|
||||
format: PropTypes.oneOf(['24hr', 'ampm']),
|
||||
onChange: PropTypes.func,
|
||||
onHandMoved: PropTypes.func,
|
||||
radius: PropTypes.number,
|
||||
selected: PropTypes.number,
|
||||
spacing: PropTypes.number,
|
||||
theme: PropTypes.object
|
||||
};
|
||||
|
||||
state = {
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
import React from 'react';
|
||||
import utils from '../utils/utils';
|
||||
import Face from './ClockFace';
|
||||
import Hand from './ClockHand';
|
||||
import React, { Component, PropTypes } from 'react';
|
||||
import utils from '../utils/utils.js';
|
||||
import Hand from './ClockHand.js';
|
||||
import Face from './ClockFace.js';
|
||||
|
||||
const minutes = utils.range(0, 60, 5);
|
||||
const step = 360 / 60;
|
||||
|
||||
class Minutes extends React.Component {
|
||||
class Minutes extends Component {
|
||||
static propTypes = {
|
||||
center: React.PropTypes.object,
|
||||
onChange: React.PropTypes.func,
|
||||
radius: React.PropTypes.number,
|
||||
selected: React.PropTypes.number,
|
||||
spacing: React.PropTypes.number,
|
||||
theme: React.PropTypes.shape({
|
||||
small: React.PropTypes.string.isRequired
|
||||
center: PropTypes.object,
|
||||
onChange: PropTypes.func,
|
||||
radius: PropTypes.number,
|
||||
selected: PropTypes.number,
|
||||
spacing: PropTypes.number,
|
||||
theme: PropTypes.shape({
|
||||
small: PropTypes.string.isRequired
|
||||
})
|
||||
};
|
||||
|
||||
|
|
|
@ -1,74 +1,84 @@
|
|||
import React from 'react';
|
||||
import React, { Component, PropTypes } from 'react';
|
||||
import classnames from 'classnames';
|
||||
import { themr } from 'react-css-themr';
|
||||
import events from '../utils/events';
|
||||
import time from '../utils/time';
|
||||
import Input from '../input';
|
||||
import TimePickerDialog from './TimePickerDialog';
|
||||
import { TIME_PICKER } from '../identifiers.js';
|
||||
import events from '../utils/events.js';
|
||||
import time from '../utils/time.js';
|
||||
import InjectDialog from '../dialog/Dialog.js';
|
||||
import InjectInput from '../input/Input.js';
|
||||
import timePickerDialogFactory from './TimePickerDialog.js';
|
||||
|
||||
class TimePicker extends React.Component {
|
||||
static propTypes = {
|
||||
className: React.PropTypes.string,
|
||||
error: React.PropTypes.string,
|
||||
format: React.PropTypes.oneOf(['24hr', 'ampm']),
|
||||
inputClassName: React.PropTypes.string,
|
||||
label: React.PropTypes.string,
|
||||
onChange: React.PropTypes.func,
|
||||
theme: React.PropTypes.shape({
|
||||
input: React.PropTypes.string.isRequired
|
||||
}),
|
||||
value: React.PropTypes.object
|
||||
};
|
||||
const factory = (TimePickerDialog, Input) => {
|
||||
class TimePicker extends Component {
|
||||
static propTypes = {
|
||||
className: PropTypes.string,
|
||||
error: PropTypes.string,
|
||||
format: PropTypes.oneOf(['24hr', 'ampm']),
|
||||
inputClassName: PropTypes.string,
|
||||
label: PropTypes.string,
|
||||
onChange: PropTypes.func,
|
||||
theme: PropTypes.shape({
|
||||
input: PropTypes.string.isRequired
|
||||
}),
|
||||
value: PropTypes.object
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
className: '',
|
||||
format: '24hr'
|
||||
};
|
||||
static defaultProps = {
|
||||
className: '',
|
||||
format: '24hr'
|
||||
};
|
||||
|
||||
state = {
|
||||
active: false
|
||||
};
|
||||
state = {
|
||||
active: false
|
||||
};
|
||||
|
||||
handleDismiss = () => {
|
||||
this.setState({active: false});
|
||||
};
|
||||
handleDismiss = () => {
|
||||
this.setState({active: false});
|
||||
};
|
||||
|
||||
handleInputMouseDown = (event) => {
|
||||
events.pauseEvent(event);
|
||||
this.setState({active: true});
|
||||
};
|
||||
handleInputMouseDown = (event) => {
|
||||
events.pauseEvent(event);
|
||||
this.setState({active: true});
|
||||
};
|
||||
|
||||
handleSelect = (value, event) => {
|
||||
if (this.props.onChange) this.props.onChange(value, event);
|
||||
this.setState({active: false});
|
||||
};
|
||||
handleSelect = (value, event) => {
|
||||
if (this.props.onChange) this.props.onChange(value, event);
|
||||
this.setState({active: false});
|
||||
};
|
||||
|
||||
render () {
|
||||
const { value, format, inputClassName, theme } = this.props;
|
||||
const formattedTime = value ? time.formatTime(value, format) : '';
|
||||
return (
|
||||
<div data-react-toolbox='time-picker'>
|
||||
<Input
|
||||
className={classnames(theme.input, {[inputClassName]: inputClassName })}
|
||||
error={this.props.error}
|
||||
label={this.props.label}
|
||||
onMouseDown={this.handleInputMouseDown}
|
||||
readOnly
|
||||
type='text'
|
||||
value={formattedTime}
|
||||
/>
|
||||
<TimePickerDialog
|
||||
active={this.state.active}
|
||||
className={this.props.className}
|
||||
format={format}
|
||||
onDismiss={this.handleDismiss}
|
||||
onSelect={this.handleSelect}
|
||||
theme={this.props.theme}
|
||||
value={this.props.value}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
render () {
|
||||
const { value, format, inputClassName, theme } = this.props;
|
||||
const formattedTime = value ? time.formatTime(value, format) : '';
|
||||
return (
|
||||
<div data-react-toolbox='time-picker'>
|
||||
<Input
|
||||
className={classnames(theme.input, {[inputClassName]: inputClassName })}
|
||||
error={this.props.error}
|
||||
label={this.props.label}
|
||||
onMouseDown={this.handleInputMouseDown}
|
||||
readOnly
|
||||
type='text'
|
||||
value={formattedTime}
|
||||
/>
|
||||
<TimePickerDialog
|
||||
active={this.state.active}
|
||||
className={this.props.className}
|
||||
format={format}
|
||||
onDismiss={this.handleDismiss}
|
||||
onSelect={this.handleSelect}
|
||||
theme={this.props.theme}
|
||||
value={this.props.value}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default themr('ToolboxTimePicker')(TimePicker);
|
||||
return TimePicker;
|
||||
};
|
||||
|
||||
const TimePickerDialog = timePickerDialogFactory(InjectDialog);
|
||||
const TimePicker = factory(TimePickerDialog, InjectInput);
|
||||
export default themr(TIME_PICKER)(TimePicker);
|
||||
export { factory as timePickerFactory };
|
||||
export { TimePicker };
|
||||
|
|
|
@ -1,125 +1,128 @@
|
|||
import React from 'react';
|
||||
import React, { Component, PropTypes } from 'react';
|
||||
import classnames from 'classnames';
|
||||
import time from '../utils/time';
|
||||
import Clock from './Clock';
|
||||
import Dialog from '../dialog';
|
||||
import time from '../utils/time.js';
|
||||
import Clock from './Clock.js';
|
||||
|
||||
class TimePickerDialog extends React.Component {
|
||||
static propTypes = {
|
||||
active: React.PropTypes.bool,
|
||||
className: React.PropTypes.string,
|
||||
format: React.PropTypes.oneOf(['24hr', 'ampm']),
|
||||
onDismiss: React.PropTypes.func,
|
||||
onSelect: React.PropTypes.func,
|
||||
theme: React.PropTypes.shape({
|
||||
am: React.PropTypes.string.isRequired,
|
||||
amFormat: React.PropTypes.string.isRequired,
|
||||
ampm: React.PropTypes.string.isRequired,
|
||||
button: React.PropTypes.string.isRequired,
|
||||
dialog: React.PropTypes.string.isRequired,
|
||||
header: React.PropTypes.string.isRequired,
|
||||
hours: React.PropTypes.string.isRequired,
|
||||
hoursDisplay: React.PropTypes.string.isRequired,
|
||||
minutes: React.PropTypes.string.isRequired,
|
||||
minutesDisplay: React.PropTypes.string.isRequired,
|
||||
pm: React.PropTypes.string.isRequired,
|
||||
pmFormat: React.PropTypes.string.isRequired,
|
||||
separator: React.PropTypes.string.isRequired
|
||||
}),
|
||||
value: React.PropTypes.object
|
||||
};
|
||||
const factory = (Dialog) => {
|
||||
class TimePickerDialog extends Component {
|
||||
static propTypes = {
|
||||
active: PropTypes.bool,
|
||||
className: PropTypes.string,
|
||||
format: PropTypes.oneOf(['24hr', 'ampm']),
|
||||
onDismiss: PropTypes.func,
|
||||
onSelect: PropTypes.func,
|
||||
theme: PropTypes.shape({
|
||||
am: PropTypes.string.isRequired,
|
||||
amFormat: PropTypes.string.isRequired,
|
||||
ampm: PropTypes.string.isRequired,
|
||||
button: PropTypes.string.isRequired,
|
||||
dialog: PropTypes.string.isRequired,
|
||||
header: PropTypes.string.isRequired,
|
||||
hours: PropTypes.string.isRequired,
|
||||
hoursDisplay: PropTypes.string.isRequired,
|
||||
minutes: PropTypes.string.isRequired,
|
||||
minutesDisplay: PropTypes.string.isRequired,
|
||||
pm: PropTypes.string.isRequired,
|
||||
pmFormat: PropTypes.string.isRequired,
|
||||
separator: PropTypes.string.isRequired
|
||||
}),
|
||||
value: PropTypes.object
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
active: false,
|
||||
format: '24hr',
|
||||
value: new Date()
|
||||
};
|
||||
static defaultProps = {
|
||||
active: false,
|
||||
format: '24hr',
|
||||
value: new Date()
|
||||
};
|
||||
|
||||
state = {
|
||||
display: 'hours',
|
||||
displayTime: this.props.value
|
||||
};
|
||||
state = {
|
||||
display: 'hours',
|
||||
displayTime: this.props.value
|
||||
};
|
||||
|
||||
componentDidUpdate (prevProps) {
|
||||
if (!prevProps.active && this.props.active) {
|
||||
setTimeout(this.refs.clock.handleCalculateShape, 1000);
|
||||
componentDidUpdate (prevProps) {
|
||||
if (!prevProps.active && this.props.active) {
|
||||
setTimeout(this.refs.clock.handleCalculateShape, 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
handleClockChange = (value) => {
|
||||
this.setState({displayTime: value});
|
||||
};
|
||||
handleClockChange = (value) => {
|
||||
this.setState({displayTime: value});
|
||||
};
|
||||
|
||||
handleSelect = (event) => {
|
||||
this.props.onSelect(this.state.displayTime, event);
|
||||
};
|
||||
handleSelect = (event) => {
|
||||
this.props.onSelect(this.state.displayTime, event);
|
||||
};
|
||||
|
||||
toggleTimeMode = () => {
|
||||
this.setState({displayTime: time.toggleTimeMode(this.state.displayTime)});
|
||||
};
|
||||
toggleTimeMode = () => {
|
||||
this.setState({displayTime: time.toggleTimeMode(this.state.displayTime)});
|
||||
};
|
||||
|
||||
handleHandMoved = () => {
|
||||
if (this.state.display === 'hours') this.setState({display: 'minutes'});
|
||||
};
|
||||
handleHandMoved = () => {
|
||||
if (this.state.display === 'hours') this.setState({display: 'minutes'});
|
||||
};
|
||||
|
||||
switchDisplay = (display) => {
|
||||
this.setState({display});
|
||||
};
|
||||
switchDisplay = (display) => {
|
||||
this.setState({display});
|
||||
};
|
||||
|
||||
actions = [
|
||||
{ label: 'Cancel', className: this.props.theme.button, onClick: this.props.onDismiss },
|
||||
{ label: 'Ok', className: this.props.theme.button, onClick: this.handleSelect }
|
||||
];
|
||||
actions = [
|
||||
{ label: 'Cancel', className: this.props.theme.button, onClick: this.props.onDismiss },
|
||||
{ label: 'Ok', className: this.props.theme.button, onClick: this.handleSelect }
|
||||
];
|
||||
|
||||
formatHours () {
|
||||
if (this.props.format === 'ampm') {
|
||||
return this.state.displayTime.getHours() % 12 || 12;
|
||||
} else {
|
||||
return this.state.displayTime.getHours();
|
||||
formatHours () {
|
||||
if (this.props.format === 'ampm') {
|
||||
return this.state.displayTime.getHours() % 12 || 12;
|
||||
} else {
|
||||
return this.state.displayTime.getHours();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
renderAMPMLabels () {
|
||||
const { theme } = this.props;
|
||||
if (this.props.format === 'ampm') {
|
||||
renderAMPMLabels () {
|
||||
const { theme } = this.props;
|
||||
if (this.props.format === 'ampm') {
|
||||
return (
|
||||
<div className={theme.ampm}>
|
||||
<span className={theme.am} onClick={this.toggleTimeMode}>AM</span>
|
||||
<span className={theme.pm} onClick={this.toggleTimeMode}>PM</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
render () {
|
||||
const { theme } = this.props;
|
||||
const display = `${this.state.display}Display`;
|
||||
const format = `${time.getTimeMode(this.state.displayTime)}Format`;
|
||||
const className = classnames([theme.dialog, theme[display], theme[format]], this.props.className);
|
||||
return (
|
||||
<div className={theme.ampm}>
|
||||
<span className={theme.am} onClick={this.toggleTimeMode}>AM</span>
|
||||
<span className={theme.pm} onClick={this.toggleTimeMode}>PM</span>
|
||||
</div>
|
||||
<Dialog active={this.props.active} className={className} actions={this.actions}>
|
||||
<header className={theme.header}>
|
||||
<span className={theme.hours} onClick={this.switchDisplay.bind(this, 'hours')}>
|
||||
{('0' + this.formatHours()).slice(-2)}
|
||||
</span>
|
||||
<span className={theme.separator}>:</span>
|
||||
<span className={theme.minutes} onClick={this.switchDisplay.bind(this, 'minutes')}>
|
||||
{('0' + this.state.displayTime.getMinutes()).slice(-2)}
|
||||
</span>
|
||||
{this.renderAMPMLabels()}
|
||||
</header>
|
||||
<Clock
|
||||
ref='clock'
|
||||
display={this.state.display}
|
||||
format={this.props.format}
|
||||
onChange={this.handleClockChange}
|
||||
onHandMoved={this.handleHandMoved}
|
||||
theme={this.props.theme}
|
||||
time={this.state.displayTime}
|
||||
/>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
render () {
|
||||
const { theme } = this.props;
|
||||
const display = `${this.state.display}Display`;
|
||||
const format = `${time.getTimeMode(this.state.displayTime)}Format`;
|
||||
const className = classnames([theme.dialog, theme[display], theme[format]], this.props.className);
|
||||
return (
|
||||
<Dialog active={this.props.active} className={className} actions={this.actions}>
|
||||
<header className={theme.header}>
|
||||
<span className={theme.hours} onClick={this.switchDisplay.bind(this, 'hours')}>
|
||||
{('0' + this.formatHours()).slice(-2)}
|
||||
</span>
|
||||
<span className={theme.separator}>:</span>
|
||||
<span className={theme.minutes} onClick={this.switchDisplay.bind(this, 'minutes')}>
|
||||
{('0' + this.state.displayTime.getMinutes()).slice(-2)}
|
||||
</span>
|
||||
{this.renderAMPMLabels()}
|
||||
</header>
|
||||
<Clock
|
||||
ref='clock'
|
||||
display={this.state.display}
|
||||
format={this.props.format}
|
||||
onChange={this.handleClockChange}
|
||||
onHandMoved={this.handleHandMoved}
|
||||
theme={this.props.theme}
|
||||
time={this.state.displayTime}
|
||||
/>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
}
|
||||
return TimePickerDialog;
|
||||
};
|
||||
|
||||
export default TimePickerDialog;
|
||||
export default factory;
|
||||
|
|
|
@ -1 +1,12 @@
|
|||
export default from './TimePicker';
|
||||
import { themr } from 'react-css-themr';
|
||||
import { TIME_PICKER } from '../identifiers.js';
|
||||
import { timePickerFactory } from './TimePicker.js';
|
||||
import timePickerDialogFactory from './TimePickerDialog.js';
|
||||
import Dialog from '../dialog';
|
||||
import Input from '../input';
|
||||
import theme from './theme.scss';
|
||||
|
||||
const TimePickerDialog = timePickerDialogFactory(Dialog);
|
||||
const ThemedTimePicker = themr(TIME_PICKER, theme)(timePickerFactory(TimePickerDialog, Input));
|
||||
export default ThemedTimePicker;
|
||||
export { ThemedTimePicker as TimePicker };
|
||||
|
|
|
@ -5,7 +5,6 @@ A [dialog picker](https://www.google.com/design/spec/components/pickers.html#pic
|
|||
<!-- example -->
|
||||
```jsx
|
||||
import TimePicker from 'react-toolbox/lib/time_picker';
|
||||
import theme from 'react-toolbox/lib/time_picker/theme'
|
||||
|
||||
let time = new Date();
|
||||
time.setHours(17);
|
||||
|
@ -24,13 +23,14 @@ class TimePickerTest extends React.Component {
|
|||
label='Finishing time'
|
||||
onChange={this.handleChange}
|
||||
value={this.state.time}
|
||||
theme={theme}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
If you want to provide a theme via context, the component key is `RTTimePicker`.
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Default | Description|
|
||||
|
@ -43,9 +43,7 @@ class TimePickerTest extends React.Component {
|
|||
| `onChange` | `Function` | | Callback called when the picker value is changed.|
|
||||
| `value` | `Date` | | Datetime object with currrently selected time. |
|
||||
|
||||
## Theming
|
||||
|
||||
You can take a look to the `_config.scss` variables. The themed key for this component is `ToolboxTimePicker`, it should implement the following interface:
|
||||
## Theme
|
||||
|
||||
| Name | Description|
|
||||
|:---------|:-----------|
|
||||
|
|
75
spec/root.js
75
spec/root.js
|
@ -1,7 +1,6 @@
|
|||
/* global VERSION */
|
||||
import '../components/commons.scss';
|
||||
import React from 'react';
|
||||
import { ThemeProvider } from 'react-css-themr';
|
||||
import theme from './theme';
|
||||
import AppBar from '../components/app_bar';
|
||||
import Autocomplete from './components/autocomplete';
|
||||
import Avatar from './components/avatar';
|
||||
|
@ -30,43 +29,41 @@ import Tooltip from './components/tooltip';
|
|||
import style from './style';
|
||||
|
||||
const Root = () => (
|
||||
<ThemeProvider theme={theme}>
|
||||
<div className={style.app}>
|
||||
<AppBar className={style.appbar} fixed flat>
|
||||
<h1>React Toolbox <small>Spec {VERSION}</small></h1>
|
||||
<ButtonToolbox
|
||||
accent
|
||||
className={style.github}
|
||||
icon='web'
|
||||
floating
|
||||
onClick={() => {window.href = 'http://react-toolbox';}}
|
||||
/>
|
||||
</AppBar>
|
||||
<Autocomplete />
|
||||
<Avatar />
|
||||
<Button />
|
||||
<Card />
|
||||
<Checkbox />
|
||||
<Chip />
|
||||
<Dialog />
|
||||
<Drawer />
|
||||
<Dropdown />
|
||||
<IconMenu />
|
||||
<Input />
|
||||
<Layout />
|
||||
<List />
|
||||
<Menu />
|
||||
<Pickers />
|
||||
<Progress />
|
||||
<Radio />
|
||||
<Slider />
|
||||
<Snackbar />
|
||||
<Switch />
|
||||
<Table />
|
||||
<Tabs />
|
||||
<Tooltip />
|
||||
</div>
|
||||
</ThemeProvider>
|
||||
<div className={style.app}>
|
||||
<AppBar className={style.appbar} fixed flat>
|
||||
<h1>React Toolbox <small>Spec {VERSION}</small></h1>
|
||||
<ButtonToolbox
|
||||
accent
|
||||
className={style.github}
|
||||
icon='web'
|
||||
floating
|
||||
onClick={() => {window.href = 'http://react-toolbox';}}
|
||||
/>
|
||||
</AppBar>
|
||||
<Autocomplete />
|
||||
<Avatar />
|
||||
<Button />
|
||||
<Card />
|
||||
<Checkbox />
|
||||
<Chip />
|
||||
<Dialog />
|
||||
<Drawer />
|
||||
<Dropdown />
|
||||
<IconMenu />
|
||||
<Input />
|
||||
<Layout />
|
||||
<List />
|
||||
<Menu />
|
||||
<Pickers />
|
||||
<Progress />
|
||||
<Radio />
|
||||
<Slider />
|
||||
<Snackbar />
|
||||
<Switch />
|
||||
<Table />
|
||||
<Tabs />
|
||||
<Tooltip />
|
||||
</div>
|
||||
);
|
||||
|
||||
export default Root;
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
import '../components/commons.scss';
|
||||
|
||||
import ToolboxTimePicker from '../components/time_picker/theme.scss';
|
||||
|
||||
export default {
|
||||
ToolboxTimePicker
|
||||
};
|
Loading…
Reference in New Issue