@momentum-ui/react-collaboration
Version:
Cisco Momentum UI Framework for React Collaboration Applications
61 lines • 3.24 kB
JavaScript
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
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 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
import React from 'react';
import classnames from 'classnames';
import './Flex.style.scss';
import { CLASS_PREFIX, DEFAULTS, STYLE } from './Flex.constants';
var Flex = function (props) {
var _a;
var className = props.className, children = props.children, xgap = props.xgap, ygap = props.ygap, direction = props.direction, justifyContent = props.justifyContent, alignItems = props.alignItems, alignContent = props.alignContent, wrap = props.wrap, style = props.style, id = props.id, rest = __rest(props, ["className", "children", "xgap", "ygap", "direction", "justifyContent", "alignItems", "alignContent", "wrap", "style", "id"]);
var _style = {
flexDirection: direction || DEFAULTS.DIRECTION,
justifyContent: justifyContent || DEFAULTS.JUSTIFY_CONTENT,
alignItems: alignItems || DEFAULTS.ALIGN_ITEMS,
alignContent: alignContent || DEFAULTS.ALIGN_CONTENT,
flexWrap: wrap || 'nowrap',
};
var buildClasses = function () {
return [
"".concat(CLASS_PREFIX, "-direction-").concat(_style.flexDirection),
"".concat(CLASS_PREFIX, "-justify-content-").concat(_style.justifyContent),
"".concat(CLASS_PREFIX, "-align-items-").concat(_style.alignItems),
"".concat(CLASS_PREFIX, "-align-content-").concat(_style.alignContent),
"".concat(CLASS_PREFIX, "-").concat(_style.flexWrap),
];
};
return (React.createElement("div", __assign({}, rest, { id: id, "data-xgap": _style.flexDirection === 'row' && true, "data-ygap": _style.flexDirection === 'column' && true, style: __assign((_a = {}, _a['--md-globals-flex-xgap-size'] = xgap, _a['--md-globals-flex-ygap-size'] = ygap, _a), style), className: classnames.apply(void 0, __spreadArray(__spreadArray([STYLE.wrapper], buildClasses(), false), [className], false)) }), children));
};
/**
* Utility component which displays children in a flex container.
*/
export default Flex;
//# sourceMappingURL=Flex.js.map