react-cm-ui
Version:
React UI for Healthy Church
151 lines (138 loc) • 7.47 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _classnames = _interopRequireDefault(require("classnames"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _react = _interopRequireDefault(require("react"));
var _constants = require("../../global/constants");
var _makeStyles = _interopRequireDefault(require("../../styles/makeStyles"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
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; }
var columnNumberEnums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
var xAlignEnums = ['center', 'left', 'right'];
var verticalAlignEnums = ['bottom', 'middle', 'top'];
var propTypes = {
children: _propTypes["default"].node.isRequired,
className: _propTypes["default"].string,
columns: _propTypes["default"].oneOf(columnNumberEnums),
horizontalAlign: _propTypes["default"].oneOf(xAlignEnums),
id: _propTypes["default"].string,
stressed: _propTypes["default"].bool,
style: _propTypes["default"].shape({}),
textAlign: _propTypes["default"].oneOf(xAlignEnums),
verticalAlign: _propTypes["default"].oneOf(verticalAlignEnums)
};
var defaultProps = {
className: undefined,
columns: undefined,
horizontalAlign: undefined,
id: undefined,
stressed: false,
style: {},
textAlign: undefined,
verticalAlign: undefined
};
var useStyles = (0, _makeStyles["default"])(function () {
var _root;
return {
'deprecatedGridRowColumns-1': {},
'deprecatedGridRowColumns-2': {},
'deprecatedGridRowColumns-3': {},
'deprecatedGridRowColumns-4': {},
'deprecatedGridRowColumns-5': {},
'deprecatedGridRowColumns-6': {},
'deprecatedGridRowColumns-7': {},
'deprecatedGridRowColumns-8': {},
'deprecatedGridRowColumns-9': {},
'deprecatedGridRowColumns-10': {},
'deprecatedGridRowColumns-11': {},
'deprecatedGridRowColumns-12': {},
deprecatedHorizontalCenter: {},
deprecatedHorizontalLeft: {},
deprecatedHorizontalTop: {},
deprecatedStressed: {},
deprecatedTextAlignCenter: {},
deprecatedTextAlignLeft: {},
deprecatedTextAlignRight: {},
deprecatedVerticalAlignBottom: {},
deprecatedVerticalAlignMiddle: {},
deprecatedVerticalAlignTop: {},
root: (_root = {
alignItems: 'inherit',
display: 'flex',
flexDirection: 'row',
flexWrap: 'wrap',
justifyContent: 'inherit',
width: '100%'
}, _defineProperty(_root, "&$deprecatedGridRowColumns-1 .".concat(_constants.BEM_GRID_COLUMN), {
width: "".concat(Math.round(1 / 1 * 10e7) / 10e5, "%")
}), _defineProperty(_root, "&$deprecatedGridRowColumns-2 .".concat(_constants.BEM_GRID_COLUMN), {
width: "".concat(Math.round(1 / 2 * 10e7) / 10e5, "%")
}), _defineProperty(_root, "&$deprecatedGridRowColumns-3 .".concat(_constants.BEM_GRID_COLUMN), {
width: "".concat(Math.round(1 / 3 * 10e7) / 10e5, "%")
}), _defineProperty(_root, "&$deprecatedGridRowColumns-4 .".concat(_constants.BEM_GRID_COLUMN), {
width: "".concat(Math.round(1 / 4 * 10e7) / 10e5, "%")
}), _defineProperty(_root, "&$deprecatedGridRowColumns-5 .".concat(_constants.BEM_GRID_COLUMN), {
width: "".concat(Math.round(1 / 5 * 10e7) / 10e5, "%")
}), _defineProperty(_root, "&$deprecatedGridRowColumns-6 .".concat(_constants.BEM_GRID_COLUMN), {
width: "".concat(Math.round(1 / 6 * 10e7) / 10e5, "%")
}), _defineProperty(_root, "&$deprecatedGridRowColumns-7 .".concat(_constants.BEM_GRID_COLUMN), {
width: "".concat(Math.round(1 / 7 * 10e7) / 10e5, "%")
}), _defineProperty(_root, "&$deprecatedGridRowColumns-8 .".concat(_constants.BEM_GRID_COLUMN), {
width: "".concat(Math.round(1 / 8 * 10e7) / 10e5, "%")
}), _defineProperty(_root, "&$deprecatedGridRowColumns-9 .".concat(_constants.BEM_GRID_COLUMN), {
width: "".concat(Math.round(1 / 9 * 10e7) / 10e5, "%")
}), _defineProperty(_root, "&$deprecatedGridRowColumns-10 .".concat(_constants.BEM_GRID_COLUMN), {
width: "".concat(Math.round(1 / 10 * 10e7) / 10e5, "%")
}), _defineProperty(_root, "&$deprecatedGridRowColumns-11 .".concat(_constants.BEM_GRID_COLUMN), {
width: "".concat(Math.round(1 / 11 * 10e7) / 10e5, "%")
}), _defineProperty(_root, "&$deprecatedGridRowColumns-12 .".concat(_constants.BEM_GRID_COLUMN), {
width: "".concat(Math.round(1 / 12 * 10e7) / 10e5, "%")
}), _defineProperty(_root, '&$deprecatedHorizontalCenter', {
justifyContent: 'center'
}), _defineProperty(_root, '&$deprecatedHorizontalLeft', {
justifyContent: 'flex-start'
}), _defineProperty(_root, '&$deprecatedHorizontalTop', {
justifyContent: 'flex-end'
}), _defineProperty(_root, '&$deprecatedTextAlignCenter', {
textAlign: 'center'
}), _defineProperty(_root, '&$deprecatedTextAlignLeft', {
textAlign: 'left'
}), _defineProperty(_root, '&$deprecatedTextAlignRight', {
textAlign: 'right'
}), _defineProperty(_root, '&$deprecatedVerticalAlignBottom', {
alignItems: 'flex-end'
}), _defineProperty(_root, '&$deprecatedVerticalAlignMiddle', {
alignItems: 'center'
}), _defineProperty(_root, '&$deprecatedVerticalAlignTop', {
alignItems: 'flex-start'
}), _root)
};
});
var GridRowDeprecated = /*#__PURE__*/_react["default"].forwardRef( // eslint-disable-next-line prefer-arrow-callback
function GridRowDeprecated(props, ref) {
var _ClassNames;
var children = props.children,
className = props.className,
columns = props.columns,
horizontalAlign = props.horizontalAlign,
id = props.id,
stressed = props.stressed,
style = props.style,
textAlign = props.textAlign,
verticalAlign = props.verticalAlign;
var classes = useStyles(props);
var rootClasses = (0, _classnames["default"])(_constants.UI_CLASS_NAME, _constants.BEM_GRID_ROW, classes.root, className, (_ClassNames = {}, _defineProperty(_ClassNames, classes["deprecatedGridRowColumns-".concat(String(columns))], columns), _defineProperty(_ClassNames, classes.deprecatedHorizontalAlignCenter, horizontalAlign === 'center'), _defineProperty(_ClassNames, classes.deprecatedHorizontalAlignLeft, horizontalAlign === 'left'), _defineProperty(_ClassNames, classes.deprecatedHorizontalAlignRight, horizontalAlign === 'right'), _defineProperty(_ClassNames, classes.deprecatedStressed, stressed), _defineProperty(_ClassNames, classes.deprecatedTextAlignCenter, textAlign === 'center'), _defineProperty(_ClassNames, classes.deprecatedTextAlignLeft, textAlign === 'left'), _defineProperty(_ClassNames, classes.deprecatedTextAlignRight, textAlign === 'right'), _defineProperty(_ClassNames, classes.deprecatedVerticalAlignBottom, verticalAlign === 'bottom'), _defineProperty(_ClassNames, classes.deprecatedVerticalAlignMiddle, verticalAlign === 'middle'), _defineProperty(_ClassNames, classes.deprecatedVerticalAlignTop, verticalAlign === 'top'), _ClassNames));
return /*#__PURE__*/_react["default"].createElement("div", {
className: rootClasses,
id: id,
ref: ref,
style: style
}, children);
});
GridRowDeprecated.propTypes = propTypes;
GridRowDeprecated.defaultProps = defaultProps;
var _default = GridRowDeprecated;
exports["default"] = _default;