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

postron-screen-select

v0.0.4

Published

`DragBox` is a drag-and-drop selector component that supports image mode and text mode.

Readme

pos-screen-select

DragBox is a drag-and-drop selector component that supports image mode and text mode.

Basic usage

<DragBox
  xSize={1}
  ySize={10}
  size={80}
  type={1}
  sourceDivList={sourceDivList}
  resDivList={resDivList}
  showValue="Selected"
  showButton="Available"
  onChange={(data) => {
    console.log(data);
  }}
/>

Size compatibility

The old size prop is still supported.

  • If only size is passed, width and height both use size
  • If itemWidth or itemHeight is passed, the new prop takes priority
  • If one side is omitted, it falls back to size
<DragBox
  xSize={1}
  ySize={15}
  size={72}
  itemWidth={96}
  itemHeight={48}
  type={1}
  sourceDivList={sourceDivList}
  resDivList={resDivList}
/>

HTML header content

If you need rich content for the top labels, use showValueHtml and showButtonHtml. If these are not provided, the component will still use showValue and showButton as plain text.

<DragBox
  xSize={1}
  ySize={10}
  type={1}
  sourceDivList={sourceDivList}
  resDivList={resDivList}
  showValueHtml="<div><strong>Selected</strong><span style='margin-left:8px'>10 slots</span></div>"
  showButtonHtml="<div style='color:#F26D45'>Available modules</div>"
/>

Custom styles

You can customize the container, header area and cells through style props.

<DragBox
  xSize={1}
  ySize={15}
  itemWidth={120}
  itemHeight={54}
  type={1}
  sourceDivList={sourceDivList}
  resDivList={resDivList}
  wrapperStyle={{ alignItems: 'flex-start' }}
  leftPanelStyle={{ padding: '12px', backgroundColor: '#21242e' }}
  rightPanelStyle={{ padding: '12px', backgroundColor: '#21242e' }}
  showValueStyle={{ backgroundColor: '#393F4F', borderRadius: '6px' }}
  showButtonStyle={{ backgroundColor: '#393F4F', borderRadius: '6px' }}
  cellStyle={{ color: '#fff', borderColor: '#272A2F' }}
  resultCellStyle={{ backgroundColor: '#393F4F' }}
  sourceCellStyle={{ backgroundColor: '#2d3240' }}
  getCellStyle={(item, meta) => {
    if (meta.isRes && meta.occupied) {
      return {
        backgroundColor: '#F26D45',
        color: '#fff'
      };
    }
    if (!meta.isRes && meta.disabled) {
      return {
        cursor: 'not-allowed'
      };
    }
    return {};
  }}
/>

Props

| Prop | Description | | --- | --- | | xSize | Number of columns | | ySize | Number of rows | | size | Legacy square cell size, still supported | | itemWidth | Cell width, higher priority than size | | itemHeight | Cell height, higher priority than size | | type | 0 for image mode, 1 for text mode | | sourceDivList | Data source list on the right side | | resDivList | Result list on the left side | | showValue | Plain text label for the left header | | showButton | Plain text label for the right header | | showValueHtml | HTML content for the left header | | showButtonHtml | HTML content for the right header | | onChange | Callback when result data changes | | onClick | Double click callback | | wrapperStyle | Style object for the root wrapper | | leftPanelStyle | Style object for the left panel | | rightPanelStyle | Style object for the right panel | | resultAreaStyle | Style object for the left grid area | | sourceAreaStyle | Style object for the right grid area | | showValueStyle | Style object for the left header | | showButtonStyle | Style object for the right header | | cellStyle | Base style shared by all cells | | resultCellStyle | Additional style for left result cells | | sourceCellStyle | Additional style for right source cells | | getCellStyle(item, meta) | Dynamic cell style callback | | gridBorderWidth | Grid width calculation helper, default 2 | | rightPanelGap | Gap between left and right panels, default 30 |

getCellStyle callback

The callback receives:

{
  isRes: true,
  x: 0,
  y: 0,
  index: 0,
  disabled: false,
  occupied: true
}

The item argument is the full current cell data when available, so you can use fields like id, name, url, or your custom extension fields.