@procore/core-react
Version:
React library of Procore Design Guidelines
43 lines • 2.31 kB
JavaScript
var _excluded = ["alignItems", "basis", "direction", "gap", "grow", "flex", "inline", "justifyContent", "shrink", "wrap"];
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
import * as React from 'react';
import { Box } from '../Box/Box';
/**
* `Flex` is a wrapper around `Box` defaulting to display flex CSS
* and providing shorter prop names (e.g. `shrink` instead of `flexShrink`).
* `Box` can mimic anything `Flex` can.
*/
export var Flex = /*#__PURE__*/React.forwardRef(function Flex(_ref, ref) {
var _ref$alignItems = _ref.alignItems,
alignItems = _ref$alignItems === void 0 ? 'flex-start' : _ref$alignItems,
basis = _ref.basis,
_ref$direction = _ref.direction,
direction = _ref$direction === void 0 ? 'row' : _ref$direction,
gap = _ref.gap,
grow = _ref.grow,
flex = _ref.flex,
_ref$inline = _ref.inline,
inline = _ref$inline === void 0 ? false : _ref$inline,
_ref$justifyContent = _ref.justifyContent,
justifyContent = _ref$justifyContent === void 0 ? 'flex-start' : _ref$justifyContent,
shrink = _ref.shrink,
wrap = _ref.wrap,
props = _objectWithoutProperties(_ref, _excluded);
return /*#__PURE__*/React.createElement(Box, _extends({}, props, {
ref: ref,
display: inline ? 'inline-flex' : 'flex',
alignItems: alignItems,
justifyContent: justifyContent,
flexBasis: basis,
flexDirection: direction,
flexGrow: grow,
flexShrink: shrink,
flexWrap: wrap,
flex: flex,
gap: gap
}));
});
Flex.displayName = 'Flex';
//# sourceMappingURL=Flex.js.map