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-mobile-cropper

v0.10.0

Published

The react mobile cropper inspired by Android mobile croppers

Downloads

7,564

Readme

React Mobile Cropper

The react mobile cropper is highly inspirited by popular Android mobile croppers. It was created as the demonstration of react-advanced-cropper possibilities and uses it under the hood. Therefore, its documentation would be helpful in the edge cases.

Demo / Sandbox

NPM

Install

npm install --save react-mobile-cropper
yarn add react-mobile-cropper

Usage

import React, { useState } from 'react';
import { CropperRef, Cropper } from 'react-mobile-cropper';
import 'react-mobile-cropper/dist/style.css'

export const GettingStartedExample = () => {
    const [image, setImage] = useState(
        'https://images.unsplash.com/photo-1599140849279-1014532882fe?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1300&q=80',
    );

    const onChange = (cropper: CropperRef) => {
        console.log(cropper.getCoordinates(), cropper.getCanvas());
    };

    return (
        <Cropper
            src={image}
            onChange={onChange}
            className={'cropper'}
        />
    )
};

FAQ

How to change the cropper's main color?

To change the cropper's main color you should redefine color property for the cropper.

.cropper {
	color: red;
}
<Cropper
	src={src}
	className={'cropper'}
/>

Cropper

| Prop | Type | Description | Default | ------------------------- |---------------------------|---------------------------------------------------------------------------------------------------------------------------------------------| --------------- | src | string | The cropping image (link / base64) | | stencilType | 'circle', 'rectangle' | The type of stencil | 'rectangle' | stencilComponent | Component | The stencil component | RectangleStencil | stencilProps | object | The props for the stencil component | {} | className | string | The optional class for the root cropper block | | imageClassName | string | The optional class for the cropping image | | boundaryClassName | string | The optional class for the area. | | backgroundClassName | string | The optional class for the background under the image | | transitions | boolean, object | Enable / disable auto zoom | false | canvas | boolean | The flag that indicates if canvas should be used | true | minWidth | number | The minimum width of the stencil (percents) | | minHeight | number | The minimum height of the stencil (percents) | | maxWidth | number | The maximum width of the stencil (percents) | | maxHeight | number | The maximum height of the stencil (percents) | | checkOrientation | boolean | Check if EXIF orientation should be checked | true | resizeImage | boolean, object | The options for the image resizing (details) | true | moveImage | boolean, object | The options for the image moving (details) | true | imageRestriction | string | Set restrictions for image position ('stencil', 'none') | 'stencil' | defaultSize | object, Function | The function that returns the default size of the stencil or object | | defaultPosition | object, Function | The function that returns the default position of the stencil or object |

See the documentation for more props and details. Notice, in this cropper props transitions, priority, and stencilSize are not available.

RectangleStencil

| Prop | Type | Description | Default | ------------------------ | ------------------- | -------------------------------------------------------------- | --------------- | aspectRatio | number | The aspect ratio | | minAspectRatio | number | The minimum aspect ratio | | maxAspectRatio | number | The maximum aspect ratio | | className | string | The class for root block of the stencil component | | previewClassName | string | The class for the preview component | | movingClassName | string | The class applied when user drag the stencil | | resizingClassName | string | The class applied when user resize the stencil | | boundingBoxClass | string | The class for the bounding box component | | handlerComponent | Component | The handler component | | handlers | object | The object of handlers that should be visible or hidden. | | handlerClassNames | object | The object of custom handler classes | | handlerWrapperClassNames | object | The object of custom handler wrapper classes | | lineComponent | Component | The handler component | | lines | object | The object of lines that should be visible or hidden. | | lineClassNames | object | The object of custom line classes | | lineWrapperClassNames | object | The object of custom line wrapper classes |

See the documentation for more props and details.

License

The source code of this library is licensed under MIT, the documentation content belongs to Norserium, except the photos that belong to their respective owners.