@atlaskit/editor-common
Version:
A package that contains common classes and components for editor and renderer
67 lines (66 loc) • 1.63 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.POSITION_ATTRIBUTE_ENUM = void 0;
exports.positionPropToPopperPosition = positionPropToPopperPosition;
var positionMap = {
'top left': {
position: 'top-start',
animation: 'top'
},
'top center': {
position: 'top',
animation: 'top'
},
'top right': {
position: 'top-end',
animation: 'top'
},
'right top': {
position: 'right-start',
animation: 'right'
},
'right middle': {
position: 'right',
animation: 'right'
},
'right bottom': {
position: 'right-end',
animation: 'right'
},
'bottom left': {
position: 'bottom-start',
animation: 'bottom'
},
'bottom center': {
position: 'bottom',
animation: 'bottom'
},
'bottom right': {
position: 'bottom-end',
animation: 'bottom'
},
'left top': {
position: 'left-start',
animation: 'left'
},
'left middle': {
position: 'left',
animation: 'left'
},
'left bottom': {
position: 'left-end',
animation: 'left'
}
};
var POSITION_ATTRIBUTE_ENUM = exports.POSITION_ATTRIBUTE_ENUM = {
values: ['top left', 'top center', 'top right', 'right top', 'right middle', 'right bottom', 'bottom left', 'bottom center', 'bottom right', 'left top', 'left middle', 'left bottom'],
default: 'right middle'
};
function positionToPopper(position) {
return position && positionMap[position] ? positionMap[position].position : null;
}
function positionPropToPopperPosition(position) {
return positionToPopper(position) || positionMap[POSITION_ATTRIBUTE_ENUM.default].position;
}