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

carbon-neos-loadinganimation

v1.1.1

Published

Loading animation for Neos UI

Downloads

192

Readme

Carbon.NeosUi.LoadingAnimation

It’s important that users understand that things are happening when they have to wait for something. This loading timer can be used to provide feedback when there is a server response delay.

This is a small package to help create a nice loading animation in the Neos UI. There are three variants of the loading animation: One with a CSS file, one with StyleX, and one with pure inline style attributes. Use the one that best suits your stack.

How it looks

Visualization of animation

How to install

Based on your package manager run:

# npm
npm install carbon-neos-loadinganimation --save-dev
# pnpm
pnpm add carbon-neos-loadinganimation -D
# Yarn
yarn add carbon-neos-loadinganimation --dev

How to use

// Styled with inline styles
import { LoadingWithStyles } from "carbon-neos-loadinganimation";

// Styled with css classes
import { LoadingWithClassNames } from "carbon-neos-loadinganimation";

// Styled with styleX classes
import { LoadingWithStyleX } from "carbon-neos-loadinganimation";

You can also directly import the loader:

// Styled with inline styles
import LoadingAnimation from "carbon-neos-loadinganimation/LoadingWithStyles";

// Styled with css classes
import LoadingAnimation from "carbon-neos-loadinganimation/LoadingWithClassNames";

// Styled with styleX classes
import LoadingAnimation from "carbon-neos-loadinganimation/LoadingWithStyleX";

You can use the component inside react like this

import React, { useState, useEffect } from "react";
import LoadingAnimation from "carbon-neos-loadinganimation/LoadingWithStyles";

function Editor({ id, isLoading }) {
  const [isLoading, setIsLoading] = useState(true);

  useEffect(() => {
    setLoading(true);
    // Do your calls
    // ...
    setLoading(false);
  }, []);

  return <LoadingAnimation id={id} isLoading={isLoading} delayTime={2000} timeoutTime={7000} heightMultiplier={2} />;
}

Every component receives following props:

| Property name | Default value | Description | | ------------- | -------------------------- | -------------------------------------------------------------------- | | isLoading | false | The main property. True will start the animation process. | | delayTime | 500 | The time in ms after the circle animations starts. | | timeoutTime | 5000 | The time in ms after the dots animations starts. | | id | null | The id of the container | | title | 'Neos.Neos:Main:loading' | The title of the container. Will shown a tooltip. Will be translated |

delayTime and timeoutTime should be positive. timeoutTime is the time after delayTime is finished.

How it works

After a certain time when the isLoading is set to true, determined by delayTime and timeoutTime, the timers changes his state. If isLoading is false, nothing is displayed at all.

                      ┌────────────────────┐
              ┌───────│     isLoading      │───────┐
              │       └────────────────────┘       │

            true                                 false

              │                                    │
              ▼                                    ▼
┌───────────────────────────┐        ┌───────────────────────────┐
│                           │        │       cancel timer        │
│       reserve space       │        │             +             │
│                           │        │        return null        │
└───────────────────────────┘        └───────────────────────────┘
              │

    after delayTime in ms

              │
              ▼
┌───────────────────────────┐
│                           │
│   show circle animation   │
│                           │
└───────────────────────────┘
              │

   after timeoutTime in ms

              │
              ▼
┌───────────────────────────┐
│                           │
│    show dots animation    │
│                           │
└───────────────────────────┘