@bsara/react-layouts
Advanced tools
Comparing version 1.0.0-alpha.4 to 1.0.0-alpha.5
@@ -6,4 +6,5 @@ 'use strict'; | ||
}); | ||
exports.default = GridLayout; | ||
var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _react = require('react'); | ||
@@ -23,3 +24,7 @@ | ||
var GridDiv = _styledComponents2.default.div(['--_column-count-template:repeat( var(--column-count,0),minmax( var(--item-min-width,var(--item-min-size,0)),var(--item-width,var(--item-size,var(--item-max-width,var(--item-max-size,1fr)))) ) );--_row-count-template:repeat( var(--row-count,0),minmax( var(--item-min-height,var(--item-min-size,0)),var(--item-height,var(--item-size,var(--item-max-height,var(--item-max-size,1fr)))) ) );display:grid;grid-template-areas:var(--areas-template);grid-template-columns:var(--columns-template,var(--_column-count-template));grid-template-rows:var(--rows-template,var(--_row-count-template));grid-gap:var(--item-gap);']); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
/** | ||
@@ -43,15 +48,30 @@ * ISC License (ISC) | ||
function GridLayout(_ref) { | ||
var id = _ref.id, | ||
children = _ref.children, | ||
className = _ref.className, | ||
style = _ref.style; | ||
var GridDiv = _styledComponents2.default.div(['--_column-count-template:repeat( var(--column-count,0),minmax( var(--item-min-width,var(--item-min-size,0)),var(--item-width,var(--item-size,var(--item-max-width,var(--item-max-size,1fr)))) ) );--_row-count-template:repeat( var(--row-count,0),minmax( var(--item-min-height,var(--item-min-size,0)),var(--item-height,var(--item-size,var(--item-max-height,var(--item-max-size,1fr)))) ) );display:grid;grid-template-areas:var(--areas-template);grid-template-columns:var(--columns-template,var(--_column-count-template));grid-template-rows:var(--rows-template,var(--_row-count-template));grid-gap:var(--item-gap);> *{grid-row:--row-span;grid-column:--col-span;}']); | ||
return _react2.default.createElement( | ||
GridDiv, | ||
{ id: id, className: className, style: style }, | ||
children | ||
); | ||
} | ||
var GridLayout = function (_React$Component) { | ||
_inherits(GridLayout, _React$Component); | ||
function GridLayout() { | ||
_classCallCheck(this, GridLayout); | ||
return _possibleConstructorReturn(this, (GridLayout.__proto__ || Object.getPrototypeOf(GridLayout)).apply(this, arguments)); | ||
} | ||
_createClass(GridLayout, [{ | ||
key: 'render', | ||
value: function render() { | ||
return _react2.default.createElement( | ||
GridDiv, | ||
{ id: this.props.id, className: this.props.className, style: this.props.style }, | ||
this.props.children | ||
); | ||
} | ||
}]); | ||
return GridLayout; | ||
}(_react2.default.Component); | ||
exports.default = GridLayout; | ||
GridLayout.propTypes = { | ||
@@ -58,0 +78,0 @@ id: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string]), |
@@ -6,4 +6,5 @@ 'use strict'; | ||
}); | ||
exports.default = LinearLayout; | ||
var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _react = require('react'); | ||
@@ -31,3 +32,7 @@ | ||
var classNameUniquePart = (0, _randomatic2.default)('aA', 6); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
/** | ||
@@ -51,2 +56,3 @@ * ISC License (ISC) | ||
var classNameUniquePart = (0, _randomatic2.default)('aA', 6); | ||
var horizontalClassName = 'horizontal-' + classNameUniquePart; | ||
@@ -57,18 +63,38 @@ var verticalClassName = 'vertical-' + classNameUniquePart; | ||
function LinearLayout(_ref) { | ||
var id = _ref.id, | ||
children = _ref.children, | ||
className = _ref.className, | ||
style = _ref.style, | ||
direction = _ref.direction; | ||
var LinearLayout = function (_React$Component) { | ||
_inherits(LinearLayout, _React$Component); | ||
var directionClassName = direction === 'v' || direction === 'vert' || direction === 'vertical' ? verticalClassName : horizontalClassName; | ||
function LinearLayout() { | ||
_classCallCheck(this, LinearLayout); | ||
return _react2.default.createElement( | ||
LinearLayoutDiv, | ||
{ id: id, className: (0, _classnames2.default)(directionClassName, className), style: style }, | ||
children | ||
); | ||
} | ||
return _possibleConstructorReturn(this, (LinearLayout.__proto__ || Object.getPrototypeOf(LinearLayout)).apply(this, arguments)); | ||
} | ||
_createClass(LinearLayout, [{ | ||
key: 'render', | ||
value: function render() { | ||
var _props = this.props, | ||
id = _props.id, | ||
children = _props.children, | ||
className = _props.className, | ||
style = _props.style, | ||
direction = _props.direction; | ||
var directionClassName = direction === 'v' || direction === 'vert' || direction === 'vertical' ? verticalClassName : horizontalClassName; | ||
return _react2.default.createElement( | ||
LinearLayoutDiv, | ||
{ id: id, className: (0, _classnames2.default)(directionClassName, className), style: style }, | ||
children | ||
); | ||
} | ||
}]); | ||
return LinearLayout; | ||
}(_react2.default.Component); | ||
exports.default = LinearLayout; | ||
LinearLayout.propTypes = { | ||
@@ -75,0 +101,0 @@ id: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string]), |
{ | ||
"name": "@bsara/react-layouts", | ||
"version": "1.0.0-alpha.4", | ||
"version": "1.0.0-alpha.5", | ||
"description": "A collection of generic, reusable layout components", | ||
@@ -5,0 +5,0 @@ "authors": [ |
14380
139