npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@smart-input/dragblocks

v1.0.5

Published

Drag and drop styled blocks handler for building interactive content editors

Readme

@smart-input/dragblocks

A React component that enables drag-and-drop reordering of styled blocks within the smart-input editor.

Features

  • 🎯 Drag and drop styled blocks (StyledBlock, DocumentBlock, ImageBlock) to reorder them
  • 📍 Visual drop indicator showing where blocks will be placed
  • 🎨 Smooth animations and visual feedback during drag operations
  • 🔒 Plain text blocks remain fixed and cannot be dragged
  • ⚡ Integrates seamlessly with @smart-input/core state management

🚀 Live Demo

Try the interactive examples online: https://markgregg.github.io/smart-input/

Installation

npm install @smart-input/dragblocks
# or
pnpm add @smart-input/dragblocks
# or
yarn add @smart-input/dragblocks

Usage

import { Editor, StateContext } from '@smart-input/core';
import { DragBlocksHandler } from '@smart-input/dragblocks';
import '@smart-input/dragblocks/style.css';

function MyComponent() {
  const [blocks, setBlocks] = useState<Block[]>([
    { id: '1', type: BlockType.Text, text: 'Hello ' },
    {
      id: '2',
      type: BlockType.Styled,
      text: 'draggable',
      style: { fontWeight: 'bold' },
    },
    { id: '3', type: BlockType.Text, text: ' world!' },
  ]);

  return (
    <StateContext blocks={blocks} setBlocks={setBlocks}>
      <DragBlocksHandler>
        <Editor placeholder="Start typing..." />
      </DragBlocksHandler>
    </StateContext>
  );
}

How It Works

  1. Wrap your Editor: Place the DragBlocksHandler component around your Editor component
  2. Drag styled blocks: Click and drag any styled block (colored, formatted, or media blocks)
  3. See drop indicator: A blue horizontal line shows where the block will be dropped
  4. Drop to reorder: Release the mouse to drop the block in its new position

Visual Indicators

  • Dragging: The dragged block becomes semi-transparent (50% opacity)
  • Drop Zone: A blue animated line indicates the drop position
  • Cursor: Styled blocks show a "grab" cursor when hoverable

Block Types

The handler works with these block types from @smart-input/core:

  • StyledBlock - Text with custom styling
  • DocumentBlock - File attachments
  • ImageBlock - Embedded images
  • TextBlock - Plain text (not draggable)

Props

DragBlocksHandler

| Prop | Type | Required | Description | |------|------|----------|-------------| | children | ReactNode | Yes | The Editor component to wrap |

State Management

The component integrates with @smart-input/core's zustand-based state management using the useBlocks hook. Block order changes are automatically synchronized with your application state.

Styling

Import the default styles:

import '@smart-input/dragblocks/style.css';

The package includes:

  • Animated drop indicator
  • Smooth transitions
  • Responsive hover states

Requirements

  • @smart-input/core: ^1.0.0
  • react: ^18.3.1
  • react-dom: ^18.3.1

License

MIT © Mark Gregg