diff --git a/.babelrc b/.babelrc new file mode 100644 index 00000000..f0a7112f --- /dev/null +++ b/.babelrc @@ -0,0 +1,21 @@ +{ + "presets": [ + "@babel/preset-env", + "@babel/preset-react" + ], + "env": { + "production": { + "plugins": [ + ["emotion", { "hoist": true }] + ] + }, + "development": { + "plugins": [ + [ + "emotion", + { "sourceMap": true, "autoLabel": true } + ] + ] + } + } +} diff --git a/.gitignore b/.gitignore index 4495fe7e..f851bd03 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,7 @@ /coverage # documentation -./docz/cache +.docz/cache # production /build diff --git a/dist/components/Button/Bordered/Bordered.js b/dist/components/Button/Bordered/Bordered.js new file mode 100644 index 00000000..c483d017 --- /dev/null +++ b/dist/components/Button/Bordered/Bordered.js @@ -0,0 +1,73 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _reactEmotion = _interopRequireDefault(require("react-emotion")); + +var _constants = require("../../../constants"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +/* Styled */ +var StyledButton = +/*#__PURE__*/ +(0, _reactEmotion.default)('button', { + target: "e1mq6gx80" +})(function (props) { + return _objectSpread({}, props.styles, { + borderColor: props.color ? _constants.COLORS[props.color.toUpperCase()] : _constants.COLORS.PRIMARY, + color: props.color ? _constants.COLORS[props.color.toUpperCase()] : _constants.COLORS.PRIMARY, + background: 'transparent' + }); +}); +/* Component */ + +var Bordered = +/*#__PURE__*/ +function (_React$Component) { + _inherits(Bordered, _React$Component); + + function Bordered() { + _classCallCheck(this, Bordered); + + return _possibleConstructorReturn(this, _getPrototypeOf(Bordered).apply(this, arguments)); + } + + _createClass(Bordered, [{ + key: "render", + value: function render() { + return _react.default.createElement(StyledButton, this.props, this.props.children); + } + }]); + + return Bordered; +}(_react.default.Component); + +exports.default = Bordered; \ No newline at end of file diff --git a/dist/components/Button/Button.js b/dist/components/Button/Button.js new file mode 100644 index 00000000..bb96ca57 --- /dev/null +++ b/dist/components/Button/Button.js @@ -0,0 +1,157 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _propTypes = _interopRequireDefault(require("prop-types")); + +var _constants = require("./constants"); + +var _Bordered = _interopRequireDefault(require("./Bordered/Bordered")); + +var _Regular = _interopRequireDefault(require("./Regular/Regular")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _extends() { _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; }; return _extends.apply(this, arguments); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +/* Component */ +var Button = +/*#__PURE__*/ +function (_React$Component) { + _inherits(Button, _React$Component); + + function Button() { + _classCallCheck(this, Button); + + return _possibleConstructorReturn(this, _getPrototypeOf(Button).apply(this, arguments)); + } + + _createClass(Button, [{ + key: "render", + value: function render() { + var _this$props = this.props, + block = _this$props.block, + bordered = _this$props.bordered, + size = _this$props.size; + var styles = Object.assign({}, _constants.BUTTON_STYLES); + + if (block) { + styles.display = 'block'; + styles.width = '100%'; + } + + switch (size) { + case 'xs': + styles.fontSize = '9px'; + styles.minHeight = '20px'; + styles.lineHeight = '18px'; + styles['@media (max-width: 767px)'] = { + minHeight: '30px', + lineHeight: '28px' + }; + break; + + case 'sm': + styles.fontSize = '13px'; + styles.minHeight = '30px'; + styles.lineHeight = '28px'; + styles['@media (max-width: 767px)'] = { + minHeight: '40px', + lineHeight: '38px' + }; + break; + + default: + styles.minHeight = '40px'; + styles.lineHeight = '38px'; + styles['@media (max-width: 767px)'] = { + minHeight: '50px', + lineHeight: '48px' + }; + } + + if (bordered) { + return _react.default.createElement(_Bordered.default, _extends({ + styles: styles + }, this.props)); + } + + return _react.default.createElement(_Regular.default, _extends({ + styles: styles + }, this.props)); + } + }]); + + return Button; +}(_react.default.Component); +/* Default Properties */ + + +Button.defaultProps = { + type: 'button', + disabled: false, + color: 'primary', + bordered: false, + block: false, + size: '' +}; +/* Properties Types */ + +Button.propTypes = { + /** + * Button Type. + * Button, Reset, Submit + */ + type: _propTypes.default.string, + + /** + * Should the Button be disabled? + */ + disabled: _propTypes.default.bool, + + /** + * Renders the button using an alternative color. + * Secondary, Warning, Error, Success + */ + color: _propTypes.default.string, + + /** + * Should the Button be bordered? + */ + bordered: _propTypes.default.bool, + + /** + * Should the Button be block? + */ + block: _propTypes.default.bool, + + /** + * Size of the button. Use the Button's xs or sm. + */ + size: _propTypes.default.string +}; +var _default = Button; +exports.default = _default; \ No newline at end of file diff --git a/dist/components/Button/Regular/Regular.js b/dist/components/Button/Regular/Regular.js new file mode 100644 index 00000000..c2f41029 --- /dev/null +++ b/dist/components/Button/Regular/Regular.js @@ -0,0 +1,73 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _reactEmotion = _interopRequireDefault(require("react-emotion")); + +var _constants = require("../../../constants"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +/* Styled */ +var StyledButton = +/*#__PURE__*/ +(0, _reactEmotion.default)('button', { + target: "e1bfgx1g0" +})(function (props) { + return _objectSpread({}, props.styles, { + borderColor: props.color ? _constants.COLORS[props.color.toUpperCase()] : _constants.COLORS.PRIMARY, + color: props.color && props.color !== 'white' ? _constants.COLORS.WHITE : _constants.COLORS.BLACK, + background: props.color ? _constants.COLORS[props.color.toUpperCase()] : _constants.COLORS.PRIMARY + }); +}); +/* Component */ + +var Regular = +/*#__PURE__*/ +function (_React$Component) { + _inherits(Regular, _React$Component); + + function Regular() { + _classCallCheck(this, Regular); + + return _possibleConstructorReturn(this, _getPrototypeOf(Regular).apply(this, arguments)); + } + + _createClass(Regular, [{ + key: "render", + value: function render() { + return _react.default.createElement(StyledButton, this.props, this.props.children); + } + }]); + + return Regular; +}(_react.default.Component); + +exports.default = Regular; \ No newline at end of file diff --git a/dist/components/Button/constants/buttonStyles.constants.js b/dist/components/Button/constants/buttonStyles.constants.js new file mode 100644 index 00000000..0d665b1b --- /dev/null +++ b/dist/components/Button/constants/buttonStyles.constants.js @@ -0,0 +1,25 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.BUTTON_STYLES = void 0; + +/* Button Styles */ +var BUTTON_STYLES = { + display: 'inline-block', + width: 'auto', + margin: 0, + padding: '0 20px', + cursor: 'pointer', + outline: 0, + border: '1px solid', + fontSize: '16px', + minWidth: '140px', + borderRadius: '25px', + textTransform: 'uppercase', + '&:hover,&:focus,&:active,&:disabled': { + outline: 0 + } +}; +exports.BUTTON_STYLES = BUTTON_STYLES; \ No newline at end of file diff --git a/dist/components/Button/constants/index.js b/dist/components/Button/constants/index.js new file mode 100644 index 00000000..a295afc0 --- /dev/null +++ b/dist/components/Button/constants/index.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _buttonStyles = require("./buttonStyles.constants"); + +Object.keys(_buttonStyles).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function get() { + return _buttonStyles[key]; + } + }); +}); \ No newline at end of file diff --git a/dist/components/index.js b/dist/components/index.js new file mode 100644 index 00000000..43466952 --- /dev/null +++ b/dist/components/index.js @@ -0,0 +1,15 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "Button", { + enumerable: true, + get: function get() { + return _Button.default; + } +}); + +var _Button = _interopRequireDefault(require("./Button/Button")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } \ No newline at end of file diff --git a/dist/constants/colors.constants.js b/dist/constants/colors.constants.js new file mode 100644 index 00000000..458b5549 --- /dev/null +++ b/dist/constants/colors.constants.js @@ -0,0 +1,24 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.COLORS = void 0; +var _COLORS = { + BLACK: 'rgb(42, 42, 42)', + WHITE: 'rgb(255, 255, 255)', + ORANGE: 'rgb(252, 163, 17)', + YELLOW: 'rgb(255, 198, 30)', + RED: 'rgb(241, 51, 53)', + GREEN: 'rgb(96,198,89)', + BLUE: 'rgb(0, 165, 219)' +}; +var COLORS = Object.assign({}, _COLORS, { + PRIMARY: _COLORS.BLUE, + SECONDARY: _COLORS.ORANGE, + ERROR: _COLORS.RED, + WARNING: _COLORS.YELLOW, + SUCCESS: _COLORS.GREEN, + INVERSE: _COLORS.WHITE +}); +exports.COLORS = COLORS; \ No newline at end of file diff --git a/dist/constants/index.js b/dist/constants/index.js new file mode 100644 index 00000000..cab8cd17 --- /dev/null +++ b/dist/constants/index.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _colors = require("./colors.constants"); + +Object.keys(_colors).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function get() { + return _colors[key]; + } + }); +}); \ No newline at end of file diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 00000000..6ad14ba3 --- /dev/null +++ b/dist/index.js @@ -0,0 +1,29 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _components = require("./components"); + +Object.keys(_components).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function get() { + return _components[key]; + } + }); +}); + +var _constants = require("./constants"); + +Object.keys(_constants).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + Object.defineProperty(exports, key, { + enumerable: true, + get: function get() { + return _constants[key]; + } + }); +}); \ No newline at end of file diff --git a/docs/assets.json b/docs/assets.json index 87c0fd3f..190be043 100644 --- a/docs/assets.json +++ b/docs/assets.json @@ -1,8 +1,8 @@ { - "app.js": "/aphrodite-react/static/js/app.03dcc95b.js", + "app.js": "/aphrodite-react/static/js/app.88e81424.js", "index.js": "/aphrodite-react/static/js/index.b08238ea.js", - "components-button-button.js": "/aphrodite-react/static/js/components-button-button.da06900a.js", - "vendors.js": "/aphrodite-react/static/js/vendors.bcd3a57a.js", - "runtime~app.js": "/aphrodite-react/static/js/runtime~app.0c1edeaab519300206b1.js", + "components-button-button.js": "/aphrodite-react/static/js/components-button-button.448c39e5.js", + "vendors.js": "/aphrodite-react/static/js/vendors.575afc31.js", + "runtime~app.js": "/aphrodite-react/static/js/runtime~app.c533064f040ed52505ba.js", "index.html": "/aphrodite-react/index.html" } \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 16f48f61..fcd32c43 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1 +1 @@ -
=0;r--){for(var u=t.words[r],c=l-1;c>=0;c--){var d=u>>c&1;i!==n[0]&&(i=this.sqr(i)),0!==d||0!==s?(s<<=1,s|=d,(4===++a||0===r&&0===c)&&(i=this.mul(i,n[s]),a=0,s=0)):a=0}l=26}return i},x.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},x.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new j(e)},i(j,x),j.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},j.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},j.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},j.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},j.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}("undefined"===typeof e||e,this)}).call(this,n("./node_modules/webpack/buildin/module.js")(e))},"./node_modules/brorand/index.js":function(e,t,n){var r;function i(e){this.rand=e}if(e.exports=function(e){return r||(r=new i(null)),r.generate(e)},e.exports.Rand=i,i.prototype.generate=function(e){return this._rand(e)},i.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),n=0;n=n&&t1114111||n<0||n>1114111)throw RangeError(a);for(var r,i,o=0,l=!1,u=e.length;on)return e;r>=t&&r<=n&&(i>t&&i-1<=n?(e.splice(o,2),o-=2):(e.splice(o-1,2),o-=2))}else{if(r==n+1)return e[o]=t,e;if(r>n)return e.splice(o,0,t,n+1),e;if(t>=r&&t=r&&t=i&&(e[o]=t,e[o+1]=n+1,l=!0)}o+=2}return l||e.push(t,n+1),e},k=function(e,t){var n=0,r=e.length,i=e[n],o=e[r-1];if(r>=2&&(to))return!1;for(;n1&&(e=b.call(arguments)),p(e)?(f(e,function(e){t.remove(e)}),t):(t.data=y(t.data,m(e)?e:R(e)),t))},addRange:function(e,t){return this.data=j(this.data,m(e)?e:R(e),m(t)?t:R(t)),this},removeRange:function(e,t){var n=m(e)?e:R(e),r=m(t)?t:R(t);return this.data=v(this.data,n,r),this},intersection:function(e){var t=e instanceof B?E(e.data):e;return this.data=function(e,t){for(var n,r=0,i=t.length,o=[];r0?this.properties[S-1].end:b;if("Property"===C.type&&(C.computed||v&&!o)){if(0===S&&(E=this.start+1),v=C,g){var O=(m?";\n"+_+g:", "+g)+("Literal"===C.key.type||C.computed?"":".");E