skedify-calendar
Version:
Skedify Calendar React component
77 lines (61 loc) • 3.22 kB
JavaScript
;
exports.__esModule = true;
exports.Stack = exports.ALIGN = exports.DISTRIBUTION = exports.DIRECTION = undefined;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _definition;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _uuid = require('uuid');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
var DIRECTION = exports.DIRECTION = {
HORIZONTAL_REVERSE: (0, _uuid.v4)(),
HORIZONTAL: (0, _uuid.v4)(),
VERTICAL_REVERSE: (0, _uuid.v4)(),
VERTICAL: (0, _uuid.v4)()
};
var DISTRIBUTION = exports.DISTRIBUTION = {
AROUND: (0, _uuid.v4)(),
BETWEEN: (0, _uuid.v4)(),
CENTER: (0, _uuid.v4)(),
END: (0, _uuid.v4)(),
NORMAL: (0, _uuid.v4)(),
START: (0, _uuid.v4)(),
STRETCH: (0, _uuid.v4)()
};
var ALIGN = exports.ALIGN = {
CENTER: (0, _uuid.v4)(),
END: (0, _uuid.v4)(),
NORMAL: (0, _uuid.v4)(),
START: (0, _uuid.v4)()
};
var definition = (_definition = {}, _definition[DIRECTION.HORIZONTAL_REVERSE] = 'row-reverse', _definition[DIRECTION.HORIZONTAL] = 'row', _definition[DIRECTION.VERTICAL_REVERSE] = 'column-reverse', _definition[DIRECTION.VERTICAL] = 'column', _definition[DISTRIBUTION.AROUND] = 'space-around', _definition[DISTRIBUTION.BETWEEN] = 'space-between', _definition[DISTRIBUTION.CENTER] = 'center', _definition[DISTRIBUTION.END] = 'flex-end', _definition[DISTRIBUTION.NORMAL] = 'normal', _definition[DISTRIBUTION.START] = 'flex-start', _definition[DISTRIBUTION.STRETCH] = 'stretch', _definition[ALIGN.CENTER] = 'center', _definition[ALIGN.END] = 'flex-end', _definition[ALIGN.NORMAL] = 'normal', _definition[ALIGN.START] = 'flex-start', _definition);
var Stack = _react2.default.forwardRef(function (props, ref) {
var children = props.children,
_props$direction = props.direction,
direction = _props$direction === undefined ? Stack.direction.HORIZONTAL : _props$direction,
_props$distribution = props.distribution,
distribution = _props$distribution === undefined ? Stack.distribution.BETWEEN : _props$distribution,
_props$align = props.align,
align = _props$align === undefined ? Stack.align.CENTER : _props$align,
style = props.style,
rest = _objectWithoutProperties(props, ['children', 'direction', 'distribution', 'align', 'style']);
return _react2.default.createElement(
'div',
_extends({
ref: ref,
style: _extends({}, style, {
display: 'flex',
flexDirection: definition[direction],
justifyContent: definition[distribution],
alignItems: definition[align]
})
}, rest),
children
);
});
exports.Stack = Stack;
Stack.direction = DIRECTION;
Stack.distribution = DISTRIBUTION;
Stack.align = ALIGN;
Stack.displayName = 'Stack';