@up-group/react-controls
Version:
We know that there are a ton of react UI library projects to choose from. Our hope with this one is to provide the next generation of react components that you can use to bootstrap your next project, or as a reference for building a UIKit. Read on to get
75 lines • 3.35 kB
JavaScript
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
t[p[i]] = s[p[i]];
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
var React = require("react");
var typestyle_1 = require("typestyle");
var cn = require("classnames");
;
var styleUtils_1 = require("./styleUtils");
var FullSize = typestyle_1.style({
flexGrow: 1,
flexShrink: 0,
flexBasis: "100%",
width: "100%"
});
var UpBox = (function (_super) {
__extends(UpBox, _super);
function UpBox() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.getBoxStyles = function () {
var BoxStyles = typestyle_1.style({
display: 'flex',
backgroundColor: _this.props.backgroundColor || 'transparent',
color: _this.props.color || 'black',
justifyContent: _this.props.justifyContent || 'flex-start',
alignItems: _this.props.alignItems || 'flex-start',
padding: styleUtils_1.sizeToString(_this.props.pad),
margin: styleUtils_1.sizeToString(_this.props.margin),
cursor: _this.props.selectable ? 'pointer' : 'inherit'
});
return BoxStyles;
};
_this.getSize = function () {
var Sizes = typestyle_1.style({
flexShrink: 1,
flexDirection: _this.props.flexDirection || 'column',
flexWrap: styleUtils_1.calculateFlexWrap(_this.props.flexWrap, _this.props.reverse),
width: styleUtils_1.boxSizeToStyle(_this.props.boxSize).width,
height: styleUtils_1.boxSizeToStyle(_this.props.boxSize).height,
flexBasis: "auto",
minHeight: styleUtils_1.calculateFullStyle(_this.props.full, 'vh'),
minWidth: styleUtils_1.calculateFullStyle(_this.props.full, 'vw')
});
return (_this.props.full) ? FullSize : Sizes;
};
return _this;
}
UpBox.prototype.render = function () {
var _a = this.props, children = _a.children, style = _a.style, others = __rest(_a, ["children", "style"]);
return (React.createElement("div", { style: style, className: cn(this.getBoxStyles(), this.getSize()) }, children || null));
};
UpBox.defaultProps = {
style: {}
};
return UpBox;
}(React.Component));
exports.default = UpBox;
//# sourceMappingURL=UpBox.js.map
;