@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-migration
Version:
An optional Pragmatic drag and drop package that enables rapid migration from react-beautiful-dnd to Pragmatic drag and drop
69 lines (66 loc) • 1.51 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.lineThickness = exports.lineOffset = exports.directionMapping = void 0;
/**
* Maps directions to different JS/CSS properties.
*
* Allows logic which changes with the direction to be written only once.
*/
var directionMapping = exports.directionMapping = {
vertical: {
mainAxis: {
name: 'y',
offset: 'offsetTop',
length: 'offsetHeight',
scrollOffset: 'scrollTop',
forwardEdge: 'bottom',
overflow: 'overflowY',
style: {
length: 'height',
transform: 'translateY'
}
},
crossAxis: {
name: 'x',
offset: 'offsetLeft',
length: 'offsetWidth',
style: {
length: 'width',
offset: 'left'
}
}
},
horizontal: {
mainAxis: {
name: 'x',
offset: 'offsetLeft',
length: 'offsetWidth',
scrollOffset: 'scrollLeft',
forwardEdge: 'right',
overflow: 'overflowX',
style: {
length: 'width',
transform: 'translateX'
}
},
crossAxis: {
name: 'y',
offset: 'offsetTop',
length: 'offsetHeight',
style: {
length: 'height',
offset: 'top'
}
}
}
};
/**
* The thickness of the drop indicator line, in pixels.
*/
var lineThickness = exports.lineThickness = 2;
/**
* The distance to pull the line back by, to account for its thickness.
*/
var lineOffset = exports.lineOffset = lineThickness / 2;