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

have-watermelon

v1.0.7

Published

Common React components used by [Watermelon Development](https://havewatermelon.co.za). Find the docs [here](https://storybook.havewatermelon.com).

Readme

Watermelon Components

Common React components used by Watermelon Development. Find the docs here.

How to use

Clone this repo to your local computer, then run:

  • npm install && npm run build
  • To make this component available to other projects on your local computer, run npm link or yarn link.
  • Then go to the project where you want to use this package and run npm/ yarn link have-watermelon.

Finally, to fix the multiple copies of React bug that shows up with linked React packages:

  • navigate to the root of the have-watermelon package
  • run npm link ../path/to/your/parent/project/node_modules/react

You can now import have-watermelon as a normal package installed from npm like so:

import { Icon } from 'have-watermelon';

You can also import the type definitions if you're using TypeScript like so:

import { Icon, IconProps } from 'have-watermelon';

For the styles import index.css. For the breakpoints mixin import breakpoint.scss.

@import '~have-watermelon/dist/index.css';
@import '~have-watermelon/dist/breakpoints.scss';

Components

Functions and Utilities

Form

An extensive (and highly opinionated) form component. For styling the fields and button there are a couple of classes to override.

import { Form } from 'have-watermelon';

<Form
  config={loginForm}
  submit={data =>
    this.props.login({ username: data.email, password: data.password })
  }
  submitButtonText="Log in"
  error={this.props.loginError}
  footerContent={this.signUpOption}
  isLoading={this.props.isLoading}
/>;

css classes to override

  • form
  • button, button--primary
  • form__input, form__input--lg
  • form__textarea, form__radio, form__radio-checkmark
  • form__label, form__field-message, form__validation, form__error
  • form__footer

Icon

This component renders an svg icon retrieved from icons stored on Cloudinary.

import { Icon } from 'have-watermelon';

<Icon
  name="cross"
  size="sm"
  className="fill--white cursor--pointer v-align--middle"
  onClick={this.closeMessage}
/>;

List of props

IconProps = {
  name: string;
  className?: string;
  size?: "xs" | "sm" | "md" | "lg" | "xlg";
  onClick?: (e?: Event) => void; // a callback to a click on the icon
};

Notification

This component renders a notification on the top right of the screen and in the center for mobile.

import { Notification } from 'have-watermelon';
<Notification
  message="This is a test message"
  type="success"
  persist={true}
  onClose={() => console.log('Notification closed')}
/>

List of props

NotificationProps = {
  message: string;
  type?: "success" | "fail";
  persist?: boolean;
  onClose?: () => void;
};

Button

import { Button } from 'have-watermelon';

<Button isLoading={false} mode="primary" isContained>
  Click Me!!
</Button>;

Props

{
  isLoading?: boolean | undefined;
  mode?: "primary" | "secondary" | "tertiary";
  isContained?: boolean;
}

Classes to override

button, button--primary, button--secondary, button--tertiary, button--contained,

Redux Loader Reducer

Provides a reducer for actions that might require a loader/ spinner because they are async e.g calls to your backend. Dispatch startAsync before your long running code and the reducer adds your action into state. Then dispatch stopAsync once it is done, the action is then removed from state. You can use this in your components to show a loader while your action is stored as state managed by the reduxLoaderReducer.

import { reduxLoaderReducer } from 'have-watermelon';

const rootReducer = combineReducers({
  common,
  orders,
  loader: reduxLoaderReducer
});
import { startAsync, stopAsync } from 'have-watermelon';

dispatch(startAsync(LOGIN));
// your code to the server.
// any component listening to state from our reducer knows this is in progress if the LOGIN action is part of reduxLoaderReducer's state array
dispatch(stopAsync(LOGIN));
shape of the state managed by this reducer
{
  action: string;
  ...params: any
}[];

// You can pass in an optional second argument that has to be an object that will eventually get spread onto the object in state. This is useful when there might be multiple place where the loader could land and you want to match a specific one.

// e.g
// state => [{ action: LOGIN }, { action: DELETE_ITEM, id: 3 }];

isDeviceSize

Returns a boolean that determines whether the window width is one of SMALL (<= 425px), MEDIUM (<= 768px) or LARGE (> 768px).

const isMobile: boolean = isDeviceSize(DeviceSize.SMALL);

DeviceSize is the enumeration of the 3 device sizes.