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 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-win32dialog

v1.1.2

Published

Modeless, resizeable and moveable dialog boxes with a classic Windows look-and-feel

Downloads

3

Readme

React component library for modeless, resizeable and moveable dialog boxes with a classic Windows look-and-feel. Comes with a light-weight window manager that supports multiple dialog boxes and stacking.

NPM npm bundle size (minified + gzip) GitHub

Overview

Win32Dialog windows act a lot like classic Windows OS dialog boxes.

They can be resized by left-clicking and dragging from any edge.

red-border

They can be moved around by left-clicking and dragging the titlebar.

red-titlebar

They can be minimized, maximized and closed by using the titlebar buttons.

red-buttons

Check out the tutorial

Note that this component relies heavily on mouse events, so it might not work as intended in environments that don't use mouse pointers.

Install

npm install --save react-win32dialog

Usage

import React from 'react';
import Win32Dialog from 'react-win32dialog';

class Example extends React.Component {
    static blurText = "Dialog doesn't have focus!";
    static focusText = "Dialog has focus!";

    constructor(props) {
        super(props);

        this.state = {
            text: Example.blurText,
        };
    }

    _onFocus = () => {
        this.setState({
            text: Example.focusText
        });
    }

    _onBlur = () => {
        this.setState({
            text: Example.blurText
        });
    }

    render () {
        return (
            <Win32Dialog
                x={500}
                y={500}
                width={200}
                height={200}
                minWidth={150}
                minHeight={50}
                title="My first react-win32dialog box!"
                icon="myicon.jpg"
                onExit={() => true}
                onBlur={this._onBlur}
                onFocus={this._onFocus}
                >
                <div>
                    {this.state.text}
                </div>
            </Win32Dialog>
        );
    }
}

Props

| Property | Type | Default | Description | | :-----------: | :------: | :----------------------------------------------------------: | :----------------------------------------------------------: | | x | number | 1 | Initial x position of the dialog. | | y | number | 1 | Initial y position of the dialog. | | width | number | minWidth | Initial width if it's larger than minWidth. | | height | number | minHeight | Initial height if it's larger than minHeight. | | minWidth | number | See rect.js/defaultRect | Minimum width that the dialog can have. | | minHeight | number | See rect.js/defaultRect | Minimum height that the dialog can have. | | borderWidth | number | See rect.js/defaultRect | Width of the dialog's outer border. | | title | string | React Win32 dialog box | Text that is displayed on the dialog's titlebar. | | icon | string | assets/default-titlebar-icon.png | Icon that is displayed on the dialog's titlebar. | | onExit | function | undefined | Is called when the dialog's X button is pressed. It should return a truthy value for the dialog to exit. If it returns falsy, the X button doesn't close the dialog. | | onBlur | function | undefined | Is called when the dialog loses focus. | | onFocus | function | undefined | Is called when the dialog gains focus. |

All the number type props are measured in pixels.

Contributing

If you find a bug or want to add a feature feel free to make a PR or open an Issue.

License

Gikoskos © MIT 2018