dashboard-controls
Advanced tools
Comparing version 0.1.5 to 0.1.6
@@ -1,2 +0,2 @@ | ||
(function(a,b){'object'==typeof exports&&'object'==typeof module?module.exports=b(require('react'),require('react-dom'),require('prop-types')):'function'==typeof define&&define.amd?define(['react','react-dom'],b):'object'==typeof exports?exports['react-ui-component-template']=b(require('react'),require('react-dom'),require('prop-types')):a['react-ui-component-template']=b(a.React,a.ReactDOM,a.PropTypes)})(this,function(a,b,c){return function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={i:d,l:!1,exports:{}};return a[d].call(e.exports,e,e.exports,b),e.l=!0,e.exports}var c={};return b.m=a,b.c=c,b.d=function(a,c,d){b.o(a,c)||Object.defineProperty(a,c,{configurable:!1,enumerable:!0,get:d})},b.n=function(a){var c=a&&a.__esModule?function(){return a['default']}:function(){return a};return b.d(c,'a',c),c},b.o=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)},b.p='/',b(b.s=0)}({"./components/TimePicker/index.js":function(a,b,c){'use strict';function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function f(a,b){if(!a)throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function g(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function h(a){return 10>a?'0'+a.toString():a.toString()}Object.defineProperty(b,'__esModule',{value:!0});var i='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&'function'==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?'symbol':typeof a},j=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),k=c('react'),l=d(k),m=c('react-dom'),n=d(m),o=c('prop-types'),p=d(o),q=c('./components/TimePicker/styles.scss'),r=d(q),s=Array(12).fill().map(function(a,b){return b});s[0]=12;var t=Array(60).fill().map(function(a,b){return h(b)}),u=['AM','PM'],v=function(a){function b(){var a,c,d,g;e(this,b);for(var h=arguments.length,i=Array(h),j=0;j<h;j++)i[j]=arguments[j];return g=(c=(d=f(this,(a=b.__proto__||Object.getPrototypeOf(b)).call.apply(a,[this].concat(i))),d),d.state={popupWidth:void 0,isOpen:!1,internalValue:new Date,internalError:void 0},d._handleOnInputChange=function(a){var b=d.props.onChange,c=a.target.value.split(':');if(2===c.length){var e=c[1].split(' ');if(2===e.length){var f=parseInt(c[0].trim(),10),g=parseInt(e[0].trim(),10),h=e[1].trim().toLowerCase();if(!isNaN(f)&&12>=f&&!isNaN(g)&&60>=g&&('am'===h||'pm'===h)){'am'===h?12===f&&(f=0):12!==f&&(f+=12);var i=new Date;return i.setHours(f,g),b&&b(i),void d.setState({internalValue:i,internalError:void 0})}}}d.setState({internalValue:a.target.value,internalError:'Must be in format 12:00 pm'})},d._onHourClicked=function(a){return function(){var b=d.props.onChange,c=d.state.internalValue,e=new Date(c);if(!isNaN(e.getTime())){var f=e.getHours();f=!isNaN(f)&&12<=f?12===a?12:a+12:12===a?0:a;var g=e.getMinutes();e.setHours(f,isNaN(g)?0:g)}else e=new Date,e.setHours(a,0);b&&b(e),d.setState({internalValue:e,internalError:void 0})}},d._onMinuteClicked=function(a){return function(){var b=d.props.onChange,c=d.state.internalValue,e=new Date(c);if(!isNaN(e.getTime())){var f=e.getHours();e.setHours(isNaN(f)?12:f,a)}else e=new Date,e.setHours(12,a);b&&b(e),d.setState({internalValue:e,internalError:void 0})}},d._onAmPmClicked=function(a){return function(){var b=d.props.onChange,c=d.state.internalValue,e=new Date(c);if(!isNaN(e.getTime())){var f=e.getHours(),g=e.getMinutes();isNaN(f)||isNaN(g)||(f=12<f?f-12:f,'AM'===a?e.setHours(12===f?0:f,g):e.setHours(12===f?12:f+12,g))}else'AM'===a?(e=new Date,e.setHours(0,0)):(e=new Date,e.setHours(12,0));b&&b(e),d.setState({internalValue:e,internalError:void 0})}},d._handleClickOutside=function(a){d.mainRef&&!d.mainRef.contains(a.target)&&d._dismiss()},d._dismiss=function(){var a=d.props.onBlur;a&&a(new Event().initEvent('blur',!1,!1)),d.setState({isOpen:!1})},d._toggleOpen=function(){var a=d.state,b=a.isOpen,c=a.onBlur,e=a.onFocus;b&&c?c(new Event().initEvent('blur',!1,!1)):e&&e(new Event().initEvent('focus',!1,!1)),d.setState({isOpen:!b})},d._storeMainRef=function(a){d.mainRef=a},c),f(d,g)}return g(b,a),j(b,[{key:'componentDidMount',value:function(){var a=this.props,b=a.value,c=a.onChange;document.addEventListener('mousedown',this._handleClickOutside);var d=n.default.findDOMNode(this.mainRef);if(d){var e=d.getBoundingClientRect().width;this.setState({popupWidth:e})}!b&&c&&c(new Date),this.setState({internalValue:b})}},{key:'componentWillReceiveProps',value:function(a){var b=this.props.value;a.value!==b&&this.setState({internalValue:a.value})}},{key:'componentWillUnmount',value:function(){document.removeEventListener('mousedown',this._handleClickOutside)}},{key:'render',value:function(){var a=this,b=this.state,c=b.popupWidth,d=b.isOpen,e=b.internalError,f=this._value,g='object'===('undefined'==typeof f?'undefined':i(f))?f:{},h='object'===('undefined'==typeof f?'undefined':i(f))?f.hour+':'+f.minute+' '+f.amPm:f;return l.default.createElement('div',{className:r.default.main,ref:this._storeMainRef},l.default.createElement('input',{className:r.default.input+' '+(d?r.default.highlightBoarder:'')+' '+(e?r.default.errorHighlight:''),onChange:this._handleOnInputChange,onClick:this._toggleOpen,value:h}),!d&&e&&l.default.createElement('span',{className:r.default.error,style:{width:c}},e),d&&l.default.createElement('div',{className:r.default.popup+' '+(e?r.default.errorHighlight:''),style:{width:c}},l.default.createElement('div',{className:r.default.popupList},s.map(function(b){return l.default.createElement('span',{key:b,className:r.default.popupItem+' '+(b===g.hour?r.default.activeItem:''),onClick:a._onHourClicked(b)},b)})),l.default.createElement('div',{className:r.default.popupList},t.map(function(b){return l.default.createElement('span',{key:b,className:r.default.popupItem+' '+(b===g.minute?r.default.activeItem:''),onClick:a._onMinuteClicked(b)},b)})),l.default.createElement('div',{className:r.default.popupList},u.map(function(b){return l.default.createElement('span',{key:b,className:r.default.popupItem+' '+(b===g.amPm?r.default.activeItem:''),onClick:a._onAmPmClicked(b)},b)}))))}},{key:'_value',get:function(){var a=this.state.internalValue,b=new Date(a);if(!isNaN(b.getHours())&&!isNaN(b.getMinutes())){var c=b.getHours(),d=c;0===d&&(d=12),12<d&&(d-=12);var e=h(b.getMinutes()),f={minute:e,hour:d,amPm:12<=c?'PM':'AM'};return f}return a}}]),b}(l.default.PureComponent);v.propTypes={value:p.default.oneOfType([p.default.number,p.default.string,p.default.instanceOf(Date)]),onChange:p.default.func},b.default=v},"./components/TimePicker/styles.scss":function(a){a.exports={highlightBoarder:'_3gVTU-nbsn8lytXchvgO99',input:'_3MJsBEtJ50ACcnsCuoBg7m',popup:'_3ztZNa5AVnllIFGHOnq5fg',errorHighlight:'_9hwxmTtrm2SrzD8qbrtw7',main:'_1dd0FA5WDJULieFrc4uYNK',error:'ISVMGR6n2oJwp2fMTbxa9',activeItem:'_1SH3J0boRTh5gIX46UmjpP',popupList:'_1Lhozch40xK1F1kyndl3Op',popupItem:'_35DZ5j26IUp0I198y-c98z'}},"./index.js":function(a,b,c){'use strict';function d(a){return a&&a.__esModule?a:{default:a}}Object.defineProperty(b,'__esModule',{value:!0});var e=c('./components/TimePicker/index.js');Object.defineProperty(b,'TimePicker',{enumerable:!0,get:function(){return d(e).default}})},0:function(a,b,c){a.exports=c('./index.js')},"prop-types":function(a){a.exports=c},react:function(b){b.exports=a},"react-dom":function(a){a.exports=b}})}); | ||
(function(a,b){'object'==typeof exports&&'object'==typeof module?module.exports=b(require('react'),require('react-dom'),require('prop-types')):'function'==typeof define&&define.amd?define(['react','react-dom'],b):'object'==typeof exports?exports['react-ui-component-template']=b(require('react'),require('react-dom'),require('prop-types')):a['react-ui-component-template']=b(a.React,a.ReactDOM,a.PropTypes)})(this,function(a,b,c){return function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={i:d,l:!1,exports:{}};return a[d].call(e.exports,e,e.exports,b),e.l=!0,e.exports}var c={};return b.m=a,b.c=c,b.d=function(a,c,d){b.o(a,c)||Object.defineProperty(a,c,{configurable:!1,enumerable:!0,get:d})},b.n=function(a){var c=a&&a.__esModule?function(){return a['default']}:function(){return a};return b.d(c,'a',c),c},b.o=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)},b.p='/',b(b.s=0)}({"./components/Button/index.js":function(a,b,c){'use strict';function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){var c={};for(var d in a)0<=b.indexOf(d)||Object.prototype.hasOwnProperty.call(a,d)&&(c[d]=a[d]);return c}function f(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function g(a,b){if(!a)throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function h(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(b,'__esModule',{value:!0});var i=Object.assign||function(a){for(var b,c=1;c<arguments.length;c++)for(var d in b=arguments[c],b)Object.prototype.hasOwnProperty.call(b,d)&&(a[d]=b[d]);return a},j=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),k=c('react'),l=d(k),m=c('./components/Button/styles.scss'),n=d(m),o=function(a){function b(){return f(this,b),g(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return h(b,a),j(b,[{key:'render',value:function(){var a=this.props,b=a.className,c=a.children,d=e(a,['className','children']);return l.default.createElement('button',i({className:n.default.primaryButton+' '+(b||'')},d),c)}}]),b}(l.default.Component);b.default=o},"./components/Button/styles.scss":function(a){a.exports={primaryButton:'K1DgE_E4s8zoX2PLK4hfm',active:'_3b9ZFA30S7OQSWmnyMpDlE'}},"./components/Container/index.js":function(a,b,c){'use strict';function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){var c={};for(var d in a)0<=b.indexOf(d)||Object.prototype.hasOwnProperty.call(a,d)&&(c[d]=a[d]);return c}function f(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function g(a,b){if(!a)throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function h(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(b,'__esModule',{value:!0});var i=Object.assign||function(a){for(var b,c=1;c<arguments.length;c++)for(var d in b=arguments[c],b)Object.prototype.hasOwnProperty.call(b,d)&&(a[d]=b[d]);return a},j=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),k=c('react'),l=d(k),m=c('./components/Container/styles.scss'),n=d(m),o=function(a){function b(){return f(this,b),g(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return h(b,a),j(b,[{key:'render',value:function(){var a=this.props,b=a.className,c=a.children,d=e(a,['className','children']);return l.default.createElement('div',i({className:n.default.container+' '+(b||'')},d),c)}}]),b}(l.default.Component);b.default=o},"./components/Container/styles.scss":function(a){a.exports={container:'_3rGiVQ-ef9VmsZ2QRXE7bt'}},"./components/Grid/index.js":function(a,b,c){'use strict';function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){var c={};for(var d in a)0<=b.indexOf(d)||Object.prototype.hasOwnProperty.call(a,d)&&(c[d]=a[d]);return c}function f(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function g(a,b){if(!a)throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function h(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(b,'__esModule',{value:!0});var i=Object.assign||function(a){for(var b,c=1;c<arguments.length;c++)for(var d in b=arguments[c],b)Object.prototype.hasOwnProperty.call(b,d)&&(a[d]=b[d]);return a},j=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),k=c('react'),l=d(k),m=c('prop-types'),n=d(m),o=c('./components/Grid/styles.scss'),p=d(o),q=function(a){function b(){var a,c,d,e;f(this,b);for(var h=arguments.length,i=Array(h),j=0;j<h;j++)i[j]=arguments[j];return e=(c=(d=g(this,(a=b.__proto__||Object.getPrototypeOf(b)).call.apply(a,[this].concat(i))),d),d._handleRowClicked=function(a){return function(){var b=d.props.onRowClicked,c=window.getSelection();!c.toString()&&b&&b(a)}},c),g(d,e)}return h(b,a),j(b,[{key:'render',value:function(){var a=this,b=this.props,c=b.className,d=b.items,f=b.columns,g=b.rowKeyProperty,h=b.children,j=e(b,['className','items','columns','rowKeyProperty','children']),k=100/f.length;return l.default.createElement('div',i({className:p.default.grid+' '+(c||'')},j),l.default.createElement('div',{"data-row":!0,"data-header":!0},f.map(function(a){return l.default.createElement('div',{key:a.key,"data-col":!0,style:{width:k+'%'}},a.label)})),d&&d.map(function(b){return l.default.createElement('div',{key:b[g],"data-row":!0,onClick:a._handleRowClicked(b)},f.map(function(a){return l.default.createElement('div',{key:a.key,"data-col":!0,style:{width:k+'%'}},b[a.property])}))}))}}]),b}(l.default.Component);q.propTypes={columns:n.default.arrayOf(n.default.shape({key:n.default.oneOfType([n.default.number,n.default.string]).isRequired,property:n.default.string.isRequired,label:n.default.string})).isRequired,rowKeyProperty:n.default.string.isRequired,items:n.default.array,onRowClicked:n.default.func},b.default=q},"./components/Grid/styles.scss":function(a){a.exports={grid:'_291UAs1JYfi5dflVVAwneJ'}},"./components/Input/index.js":function(a,b,c){'use strict';function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){var c={};for(var d in a)0<=b.indexOf(d)||Object.prototype.hasOwnProperty.call(a,d)&&(c[d]=a[d]);return c}function f(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function g(a,b){if(!a)throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function h(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(b,'__esModule',{value:!0});var i=Object.assign||function(a){for(var b,c=1;c<arguments.length;c++)for(var d in b=arguments[c],b)Object.prototype.hasOwnProperty.call(b,d)&&(a[d]=b[d]);return a},j=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),k=c('react'),l=d(k),m=c('./components/Input/styles.scss'),n=d(m),o=function(a){function b(){return f(this,b),g(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return h(b,a),j(b,[{key:'render',value:function(){var a=this.props,b=a.className,c=a.children,d=e(a,['className','children']);return l.default.createElement('input',i({className:n.default.input+' '+(b||'')},d))}}]),b}(l.default.Component);b.default=o},"./components/Input/styles.scss":function(a){a.exports={input:'uqgCcWy8gzsaXBuXljcLZ'}},"./components/Loader/index.js":function(a,b,c){'use strict';function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){var c={};for(var d in a)0<=b.indexOf(d)||Object.prototype.hasOwnProperty.call(a,d)&&(c[d]=a[d]);return c}function f(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function g(a,b){if(!a)throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function h(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(b,'__esModule',{value:!0});var i=Object.assign||function(a){for(var b,c=1;c<arguments.length;c++)for(var d in b=arguments[c],b)Object.prototype.hasOwnProperty.call(b,d)&&(a[d]=b[d]);return a},j=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),k=c('react'),l=d(k),m=c('prop-types'),n=d(m),o=c('./components/Loader/styles.scss'),p=d(o),q=function(a){function b(){return f(this,b),g(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return h(b,a),j(b,[{key:'render',value:function(){var a=this.props,b=a.className,c=a.error,d=a.children,f=e(a,['className','error','children']);return l.default.createElement('div',i({className:p.default.loader+' '+(b||'')},f),l.default.createElement('span',null,'{'),l.default.createElement('span',null,'}'),c&&l.default.createElement('br',null),c&&l.default.createElement('p',null,c))}}]),b}(l.default.Component);q.propTypes={error:n.default.string},q.defaultProps={error:void 0},b.default=q},"./components/Loader/styles.scss":function(a){a.exports={loader:'_2YuvU_lKiqbKw7HWDj8UT8',pulse:'_1684wCypR_J3GKV3TogDtE'}},"./components/Select/index.js":function(a,b,c){'use strict';function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){var c={};for(var d in a)0<=b.indexOf(d)||Object.prototype.hasOwnProperty.call(a,d)&&(c[d]=a[d]);return c}function f(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function g(a,b){if(!a)throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function h(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(b,'__esModule',{value:!0});var i=Object.assign||function(a){for(var b,c=1;c<arguments.length;c++)for(var d in b=arguments[c],b)Object.prototype.hasOwnProperty.call(b,d)&&(a[d]=b[d]);return a},j=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),k=c('react'),l=d(k),m=c('./components/Select/styles.scss'),n=d(m),o=function(a){function b(){return f(this,b),g(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return h(b,a),j(b,[{key:'render',value:function(){var a=this.props,b=a.className,c=a.children,d=e(a,['className','children']);return l.default.createElement('select',i({className:n.default.input+' '+(b||'')},d),c)}}]),b}(l.default.Component);b.default=o},"./components/Select/styles.scss":function(a){a.exports={input:'_1UB3fAFDnYyeT2FbNbhQA0'}},"./components/TimePicker/index.js":function(a,b,c){'use strict';function d(a){return a&&a.__esModule?a:{default:a}}function e(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function f(a,b){if(!a)throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function g(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function h(a){return 10>a?'0'+a.toString():a.toString()}Object.defineProperty(b,'__esModule',{value:!0});var i='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&'function'==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?'symbol':typeof a},j=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),k=c('react'),l=d(k),m=c('react-dom'),n=d(m),o=c('prop-types'),p=d(o),q=c('./components/TimePicker/styles.scss'),r=d(q),s=Array(12).fill().map(function(a,b){return b});s[0]=12;var t=Array(60).fill().map(function(a,b){return h(b)}),u=['AM','PM'],v=function(a){function b(){var a,c,d,g;e(this,b);for(var h=arguments.length,i=Array(h),j=0;j<h;j++)i[j]=arguments[j];return g=(c=(d=f(this,(a=b.__proto__||Object.getPrototypeOf(b)).call.apply(a,[this].concat(i))),d),d.state={popupWidth:void 0,isOpen:!1,internalValue:new Date,internalError:void 0},d._handleOnInputChange=function(a){var b=d.props.onChange,c=a.target.value.split(':');if(2===c.length){var e=c[1].split(' ');if(2===e.length){var f=parseInt(c[0].trim(),10),g=parseInt(e[0].trim(),10),h=e[1].trim().toLowerCase();if(!isNaN(f)&&12>=f&&!isNaN(g)&&60>=g&&('am'===h||'pm'===h)){'am'===h?12===f&&(f=0):12!==f&&(f+=12);var i=new Date;return i.setHours(f,g),b&&b(i),void d.setState({internalValue:i,internalError:void 0})}}}d.setState({internalValue:a.target.value,internalError:'Must be in format 12:00 pm'})},d._onHourClicked=function(a){return function(){var b=d.props.onChange,c=d.state.internalValue,e=new Date(c);if(!isNaN(e.getTime())){var f=e.getHours();f=!isNaN(f)&&12<=f?12===a?12:a+12:12===a?0:a;var g=e.getMinutes();e.setHours(f,isNaN(g)?0:g)}else e=new Date,e.setHours(a,0);b&&b(e),d.setState({internalValue:e,internalError:void 0})}},d._onMinuteClicked=function(a){return function(){var b=d.props.onChange,c=d.state.internalValue,e=new Date(c);if(!isNaN(e.getTime())){var f=e.getHours();e.setHours(isNaN(f)?12:f,a)}else e=new Date,e.setHours(12,a);b&&b(e),d.setState({internalValue:e,internalError:void 0})}},d._onAmPmClicked=function(a){return function(){var b=d.props.onChange,c=d.state.internalValue,e=new Date(c);if(!isNaN(e.getTime())){var f=e.getHours(),g=e.getMinutes();isNaN(f)||isNaN(g)||(f=12<f?f-12:f,'AM'===a?e.setHours(12===f?0:f,g):e.setHours(12===f?12:f+12,g))}else'AM'===a?(e=new Date,e.setHours(0,0)):(e=new Date,e.setHours(12,0));b&&b(e),d.setState({internalValue:e,internalError:void 0})}},d._handleClickOutside=function(a){d.mainRef&&!d.mainRef.contains(a.target)&&d._dismiss()},d._dismiss=function(){var a=d.props.onBlur;a&&a(new Event().initEvent('blur',!1,!1)),d.setState({isOpen:!1})},d._toggleOpen=function(){var a=d.state,b=a.isOpen,c=a.onBlur,e=a.onFocus;b&&c?c(new Event().initEvent('blur',!1,!1)):e&&e(new Event().initEvent('focus',!1,!1)),d.setState({isOpen:!b})},d._storeMainRef=function(a){d.mainRef=a},c),f(d,g)}return g(b,a),j(b,[{key:'componentDidMount',value:function(){var a=this.props,b=a.value,c=a.onChange;document.addEventListener('mousedown',this._handleClickOutside);var d=n.default.findDOMNode(this.mainRef);if(d){var e=d.getBoundingClientRect().width;this.setState({popupWidth:e})}!b&&c&&c(new Date),this.setState({internalValue:b})}},{key:'componentWillReceiveProps',value:function(a){var b=this.props.value;a.value!==b&&this.setState({internalValue:a.value})}},{key:'componentWillUnmount',value:function(){document.removeEventListener('mousedown',this._handleClickOutside)}},{key:'render',value:function(){var a=this,b=this.state,c=b.popupWidth,d=b.isOpen,e=b.internalError,f=this._value,g='object'===('undefined'==typeof f?'undefined':i(f))?f:{},h='object'===('undefined'==typeof f?'undefined':i(f))?f.hour+':'+f.minute+' '+f.amPm:f;return l.default.createElement('div',{className:r.default.main,ref:this._storeMainRef},l.default.createElement('input',{className:r.default.input+' '+(d?r.default.highlightBoarder:'')+' '+(e?r.default.errorHighlight:''),onChange:this._handleOnInputChange,onClick:this._toggleOpen,value:h}),!d&&e&&l.default.createElement('span',{className:r.default.error,style:{width:c}},e),d&&l.default.createElement('div',{className:r.default.popup+' '+(e?r.default.errorHighlight:''),style:{width:c}},l.default.createElement('div',{className:r.default.popupList},s.map(function(b){return l.default.createElement('span',{key:b,className:r.default.popupItem+' '+(b===g.hour?r.default.activeItem:''),onClick:a._onHourClicked(b)},b)})),l.default.createElement('div',{className:r.default.popupList},t.map(function(b){return l.default.createElement('span',{key:b,className:r.default.popupItem+' '+(b===g.minute?r.default.activeItem:''),onClick:a._onMinuteClicked(b)},b)})),l.default.createElement('div',{className:r.default.popupList},u.map(function(b){return l.default.createElement('span',{key:b,className:r.default.popupItem+' '+(b===g.amPm?r.default.activeItem:''),onClick:a._onAmPmClicked(b)},b)}))))}},{key:'_value',get:function(){var a=this.state.internalValue,b=new Date(a);if(!isNaN(b.getHours())&&!isNaN(b.getMinutes())){var c=b.getHours(),d=c;0===d&&(d=12),12<d&&(d-=12);var e=h(b.getMinutes()),f={minute:e,hour:d,amPm:12<=c?'PM':'AM'};return f}return a}}]),b}(l.default.PureComponent);v.propTypes={value:p.default.oneOfType([p.default.number,p.default.string,p.default.instanceOf(Date)]),onChange:p.default.func},b.default=v},"./components/TimePicker/styles.scss":function(a){a.exports={highlightBoarder:'_3gVTU-nbsn8lytXchvgO99',input:'_3MJsBEtJ50ACcnsCuoBg7m',popup:'_3ztZNa5AVnllIFGHOnq5fg',errorHighlight:'_9hwxmTtrm2SrzD8qbrtw7',main:'_1dd0FA5WDJULieFrc4uYNK',error:'ISVMGR6n2oJwp2fMTbxa9',activeItem:'_1SH3J0boRTh5gIX46UmjpP',popupList:'_1Lhozch40xK1F1kyndl3Op',popupItem:'_35DZ5j26IUp0I198y-c98z'}},"./index.js":function(a,b,c){'use strict';function d(a){return a&&a.__esModule?a:{default:a}}Object.defineProperty(b,'__esModule',{value:!0});var e=c('./components/Button/index.js');Object.defineProperty(b,'Button',{enumerable:!0,get:function(){return d(e).default}});var f=c('./components/Container/index.js');Object.defineProperty(b,'Container',{enumerable:!0,get:function(){return d(f).default}});var g=c('./components/Loader/index.js');Object.defineProperty(b,'Loader',{enumerable:!0,get:function(){return d(g).default}});var h=c('./components/Grid/index.js');Object.defineProperty(b,'Grid',{enumerable:!0,get:function(){return d(h).default}});var i=c('./components/Input/index.js');Object.defineProperty(b,'Input',{enumerable:!0,get:function(){return d(i).default}});var j=c('./components/Select/index.js');Object.defineProperty(b,'Select',{enumerable:!0,get:function(){return d(j).default}});var k=c('./components/TimePicker/index.js');Object.defineProperty(b,'TimePicker',{enumerable:!0,get:function(){return d(k).default}})},0:function(a,b,c){a.exports=c('./index.js')},"prop-types":function(a){a.exports=c},react:function(b){b.exports=a},"react-dom":function(a){a.exports=b}})}); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "dashboard-controls", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "Controls for creating dashboards in React", | ||
@@ -12,6 +12,7 @@ "main": "dist/index.js", | ||
"build": "rimraf dist/ && webpack --config webpack/webpack.config.babel.js", | ||
"build:storybook": "build-storybook -c .storybook -o docs", | ||
"storybook": "start-storybook -p 9001 -c .storybook", | ||
"lint": "eslint src", | ||
"test": "yarn lint && jest", | ||
"precommit": "yarn test", | ||
"precommit": "npm run test", | ||
"prepublishOnly": "yarn precommit" | ||
@@ -39,2 +40,3 @@ }, | ||
"@storybook/react": "^3.2.8", | ||
"@storybook/storybook-deployer": "", | ||
"autoprefixer": "^7.1.4", | ||
@@ -41,0 +43,0 @@ "babel-cli": "^6.26.0", |
@@ -1,9 +0,9 @@ | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
// import React from 'react'; | ||
// import { storiesOf } from '@storybook/react'; | ||
import MyComponent from './index'; | ||
// import MyComponent from './index'; | ||
storiesOf('MyComponent', module) | ||
.add('default', () => ( | ||
<MyComponent /> | ||
)); | ||
// storiesOf('MyComponent', module) | ||
// .add('default', () => ( | ||
// <MyComponent /> | ||
// )); |
@@ -0,1 +1,7 @@ | ||
export { default as Button } from './components/Button'; | ||
export { default as Container } from './components/Container'; | ||
export { default as Loader } from './components/Loader'; | ||
export { default as Grid } from './components/Grid'; | ||
export { default as Input } from './components/Input'; | ||
export { default as Select } from './components/Select'; | ||
export { default as TimePicker } from './components/TimePicker'; |
declare module 'time-picker' { | ||
import * as React from 'react'; | ||
export class Button extends React.Component<React.ButtonHTMLAttributes<Button>, any> { } | ||
export class Container extends React.Component<React.HTMLAttributes<Container>, any> { } | ||
export interface GridColumn { | ||
key: number | string; | ||
property: string; | ||
label?: string; | ||
} | ||
export interface GridProps extends React.HTMLAttributes<Container> { | ||
columns: GridColumn[]; | ||
rowKeyProperty: string; | ||
items?: any[]; | ||
onRowClicked?: (item: any) => void; | ||
} | ||
export class Grid extends React.Component<GridProps, any> { } | ||
export class Input extends React.Component<React.InputHTMLAttributes<Input>, any> { } | ||
export interface LoaderProps extends React.HtmlHTMLAttributes<Loader> { | ||
error?: string; | ||
} | ||
export class Loader extends React.Component<LoaderProps, any> { } | ||
export class Select extends React.Component<React.SelectHTMLAttributes<Select>, any> { } | ||
export type TimeValue = number | string | Date; | ||
@@ -5,0 +34,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2228620
71
1146
34
1