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-planet-r18

v1.0.4

Published

A react lib for building circular menus in a very easy and handy way compatible with react 18

Downloads

57

Readme

react-planet-r18

Version Downloads A react lib for building circular menus in a very easy and handy way.

Live-Demo: STORYBOOK

Read the full story @ Medium or innFactory-Blog

install

npm install --save react-planet-r18

Concept

Basic Example

import { Planet } from "react-planet-r18";

export function MyPlanet() {
  return (
    <Planet
      centerContent={
        <div
          style={{
            height: 100,
            width: 100,
            borderRadius: "50%",
            backgroundColor: "#1da8a4",
          }}
        />
      }
      open
      autoClose
    >
      <div
        style={{
          height: 70,
          width: 70,
          borderRadius: "50%",
          backgroundColor: "#9257ad",
        }}
      />
      <div
        style={{
          height: 70,
          width: 70,
          borderRadius: "50%",
          backgroundColor: "#9257ad",
        }}
      />
    </Planet>
  );
}

Change the orbit

<Planet centerContent={div style={...yourStlye}/>}
        open
        orbitRadius={120}
        rotation={30}
        ...
>

Orbit Style

<Planet
  orbitStyle={(defaultStyle) => ({
    ...defaultStyle,
    borderWidth: 4,
    borderStyle: "dashed",
    borderColor: "#6f03fc",
  })}
  centerContent={<div className={classes.planetSmall} />}
  open
>
  <div className={classes.satellite1} />
  <div className={classes.satellite2} />
  <div className={classes.satellite3} />
</Planet>

Weird satellites and their orientation

<Planet
    // set one of the orientations
    satelliteOrientation="INSIDE"

Bring it to life

<Planet
    dragablePlanet
    dragRadiusPlanet={20}
    bounce

Planetception

Nested planets

Code: /src/stories/Planetception.stories.tsx

Fake the space

<Planet
  centerContent={<YourButton0 />}
  hideOrbit
  autoClose
  orbitRadius={60}
  bounceOnClose
  rotation={105}
  // the bounce direction is minimal visible
  // but on close it seems the button wobbling a bit to the bottom
  bounceDirection="BOTTOM"
>
  <YourButton1 />
  <YourButton2 />
  <YourButton3 />
  <div />
  <div />
  <div />
  <div />
</Planet>

Alter the physics

<Planet
      mass={4}
      tension={500}
      friction={19}

Props

| name | type | example /default | description | | -------------------- | --------------------------------------- | ------------------------ | -------------------------------------------------------------- | | centerContent | React.Node? | | The planet component | | orbitRadius | number? | 120 | How far the satellites are away from the planet | | open | boolean? | false | Set the open/close state from outside | | autoClose | boolean? | false | If true the planet handles the open/close state by itself | | hideOrbit | boolean? | false | If true the orbit is hidden / not rendered | | rotation | number? | 0 | The angle for the rotation of all satellites around the planet | | satelliteOrientation | DEFAULT INSIDE OUTSIDE READABLE | undefined / DEFAULT | The angle for the rotation of one satellite itself | | dragableSatellites | boolean? | false | If true you can click and drag a satellite | | dragRadiusSatellites | number? | 12 | Defines how much you can drag the satellites | | dragablePlanet | boolean? | false | If true you can click and drag the planet | | dragRadiusPlanet | number? | 12 | Defines how much you can drag the planet | | bounce | boolean? | false | If true the planet bounces on open and close | | bounceOnOpen | boolean? | false | If true the planet bounces only on open | | bounceOnClose | boolean? | false | If true the planet bounces only on close | | bounceRadius | number? | 3 | Defines how much the planet bounces | | bounceDirection | TOP BOTTOM LEFT RIGHT | undefined | On hight bounceRadius you can see a direction | | tension | number? | 500 | a react-spring animation physic value | | friction | number? | 17 | a react-spring animation physic value | | mass | number? | 1 | a react-spring animation physic value | | orbitStyle | (default: CSSProperties)=>CSSProperties | () => ({borderWidth: 4}) | You can override or set a new style for the orbit | | onClick | (e: MouseEvent)=>void | ()=>{} | The function is triggered if you click on the centerComponent | | onClose | (e: MouseEvent)=>void | ()=>{} | The function is triggered if the planet wants to close |

Start Storybook local

npm install
npm start

Made by:

https://innFactory.de/