@coreui/react
Version:
UI Components Library for React.js
38 lines (35 loc) • 1.16 kB
JavaScript
var getAlignmentClassNames = function (alignment) {
var classNames = [];
if (typeof alignment === 'object') {
for (var key in alignment) {
classNames.push("dropdown-menu".concat(key === 'xs' ? '' : "-".concat(key), "-").concat(alignment[key]));
}
}
if (typeof alignment === 'string') {
classNames.push("dropdown-menu-".concat(alignment));
}
return classNames;
};
var getPlacement = function (placement, direction, alignment, isRTL) {
var _placement = placement;
if (direction === 'dropup') {
_placement = isRTL ? 'top-end' : 'top-start';
}
if (direction === 'dropup-center') {
_placement = 'top';
}
if (direction === 'dropend') {
_placement = isRTL ? 'left-start' : 'right-start';
}
if (direction === 'dropstart') {
_placement = isRTL ? 'right-start' : 'left-start';
}
if (alignment === 'end') {
_placement = isRTL ? 'bottom-start' : 'bottom-end';
}
return _placement;
};
exports.getAlignmentClassNames = getAlignmentClassNames;
exports.getPlacement = getPlacement;
//# sourceMappingURL=utils.js.map
;