
Security News
Nx npm Packages Compromised in Supply Chain Attack Weaponizing AI CLI Tools
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
react-drag-guide-lines-test
Advanced tools
Adds guide lines to react draggable components
A React Library to enable draglines for perfect placement of draggable items
npm i -S react-drag-lines
Add the following import to your parent component
import ReactDragAlign from 'react-drag-lines';
instead of your parent you can wrap your draggable children with the following code
return (
<ReactDragAlign styles={{...yourprops}}>
{draggableComponents.map(item => <YourComponent {...props}>)}
</ReactDragAlign>
)
Title | About | type | Values | Default Values |
---|---|---|---|---|
emptyState | Empty state component if there are no children | ReactNode | ReactNode | undefined |
showEmptyState | boolean to check if we need to show empty state or not | boolean | true, false | false |
limit | Limit the lines to the boundaries | boolean | true, false | false |
styles | Styles for the wrapper, horizontal Lines and Vertical Lines | styles | values | undefined |
Styles required to pass from parent for different styles like backgroundColor, width or height
{
wrapper?: React.CSSProperties,
xLineStyle?: React.CSSProperties,
yLineStyle?: React.CSSProperties,
}
{
wrapper: { ...wrapperStyles },
xLineStyle: { ...horizontalStyles },
yLineStyle: { ...verticalStyles },
}
import { IDragOperations } from 'react-drag-lines';
to your props you can add a new Prop with IDragOperations
interface IChildProps {
// your props
dragOperations: IDragOperations
}
add data-x
and data-y
props to your child props and use the functions of IDragOperations appropriately
const ChildComponent = (props: IChildProps) => {
const { dragOperations, ...rest } = props;
// call this function when you end dragging
const handleDragEnd = () => {
// your code
dragOperations?.onDragStop();
};
// call this function when you start dragging
const handleDragStart = () => {
// Your code
dragOperations?.onDragStart();
};
// call this function when you are dragging
const handleDragging = () => {
// Your code
// dragX - difference between current x position and previous x position
// dragY - difference between current y position and previous y position
dragOperations?.onDrag({ x: dragX, y: dragY });
};
return (
<DragComponent
// your props
data-x={currentXPosition}
data-y={currentYPosition}
/>
);
}
export default ChildComponent;
FAQs
Adds guide lines to react draggable components
We found that react-drag-guide-lines-test demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.