UNPKG

ldx-widgets

Version:

widgets

55 lines (49 loc) 1.48 kB
(function() { var IOSToggleSwitch, React, button, input, label, ref, span; React = require('react'); ref = React.DOM, button = ref.button, input = ref.input, label = ref.label, span = ref.span; IOSToggleSwitch = React.createClass({ displayName: 'IOSToggleSwitch', getDefaultProps: function() { return { tabIndex: -1 }; }, render: function() { var checked, onChange, ref1, tabIndex; ref1 = this.props, checked = ref1.checked, onChange = ref1.onChange, tabIndex = ref1.tabIndex; return button({ key: 'ios-toggle-switch', className: 'ios-toggle-switch', onClick: onChange, tabIndex: tabIndex }, [ input({ key: 'input-switch', ref: 'checkbox', type: 'checkbox', name: 'ios-toggle-switch', checked: checked, className: 'ios-toggle-switch-checkbox', onChange: onChange }), label({ key: 'switch-label', className: 'ios-toggle-switch-label', htmlFor: 'myios-toggle-switch' }, [ span({ key: 'switch-inner', className: 'ios-toggle-switch-inner' }), span({ key: 'switch-switch', className: 'ios-toggle-switch-switch' }) ]) ]); }, getValue: function() { return this.refs.checkbox.checked; } }); module.exports = IOSToggleSwitch; }).call(this);