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

@nrk/core-progress

v2.0.9

Published

> `@nrk/core-progress` is an accessible progress element for displaying linear and radial progresses.

Downloads

945

Maintainers

hammeralfhammeralfjanerikbrjanerikbrthormodbthormodbsiiverssiiverstorsrextorsrexharaldskharaldskeskilgheskilghragnaroh-nrkragnaroh-nrkdaardaldaardalarevjensenarevjensenjulusianjulusianmadsernmadsernandrefauandrefaujfjeldskaarjfjeldskaarmuddahmuddahjensragejensrageoysteinkoppangoysteinkoppangphajsiphajsijorn_georgjorn_georgbjornhelsbjornhelshalvorhhalvorhmorten-nrkmorten-nrknicklassvendsrudnicklassvendsrudkjellvnnrkkjellvnnrksanderknrksanderknrknikolaianikolaiaeirikjstnrkeirikjstnrkcarinafraningcarinafraninghelenperhelenperstefanogdennrkstefanogdennrkjimmeloysundjimmeloysundtobiasrptobiasrpmartioskmartioskjimalexbergerjimalexbergergunderwondergunderwonderhamnishamnisluminrkluminrksupermeisensupermeisenvagifabilovvagifabilovclaudio-nrkclaudio-nrkhaakemonhaakemonzenangstzenangstrannveigncrannveignceschoieneschoienbaltebaltetoshbtoshbemte123emte123opetopetklizterkliztermikkelnygardmikkelnygardfeiringfeiringdervodevdervodevgrimburgrimburgardkroyergardkroyerkariaankariaanedplayzedplayzelias-chairielias-chairimiatollaksvikmiatollaksvikytterboytterbomachineboycommachineboycomtrulsltrulslmslhmmslhmcbjerkancbjerkanhermangudesenhermangudesenandreeldareideandreeldareidehenningkollerhenningkollerespenhalstensenespenhalstensendanjohnrkdanjohnrkolapeterolapeterteodor-elstadteodor-elstadlorecasterlorecasternrk-ps-teamcitynrk-ps-teamcityswlaswlanrk-midas-jenkinsnrk-midas-jenkinsandorpandorandorpandornrkrichardnrkrichardgesigesigundelsby-nrkgundelsby-nrkjonstalecarlsenjonstalecarlsennrk-sofie-cinrk-sofie-cinytaminnytaminjesperstarkarjesperstarkarskjalgepalgskjalgepalgeirikhalvardeirikhalvardastokkeastokken640071n640071n07073n07073henrik-mattssonhenrik-mattssonhaavardmhaavardmyryrnrk-kurator-jenkinsnrk-kurator-jenkinstorgeilotorgeilonrk-user-syncnrk-user-syncdhdeploydhdeployespenwaespenwaovstetunovstetunstianljstianljharaldkjharaldkjmariusumariusucristobalcristobalknuthaugknuthaugthohalvthohalvjohnarnejohnarneeshaswinieshaswinimorrowmorrowoyvindehoyvindehlaatlaattoggutoggunrk-jenkinsnrk-jenkinsplommaplommaevjandevjandmoltubakkmoltubakkingridgureningridgurenlu-luxlu-luxanderslianderslisiljesiljestiandgstiandgsjurlursjurlurandipodnrkandipodnrkpkejpkejyosrimtiyosrimtimorten.nyhaugmorten.nyhaugingvildcathingvildcatherlend.joneserlend.jonesbrneirikbrneirikmollersemollersetbnrktbnrknordankenordankesimonmitternachtsimonmitternachtmartintorgersenmartintorgersenrebchrrebchrsteipalsteipaldiscobusdiscobusmartingundersenmartingundersentinkajtstinkajtshallvardlidhallvardlidtomivartomivarajacoajacotobinustobinusmortenokmortenoknrk-ark-deploynrk-ark-deployjeangilbertlouisjeangilbertlouisheidimorkheidimorkingriddraageningriddraagenfridajalborgfridajalborgbruusibruusirosvollrosvollchristianeidechristianeideenordbyenordbyglen_imrieglen_imriemia.aasbakkenmia.aasbakkenelathamnaelathamnaevjjan17evjjan17olatoftolatoftkongsrudkongsrudchrpeterchrpeteringvildforsethingvildforsethharaldk76haraldk76stigokstigokjohannesodlandjohannesodlandanders993anders993vildefjvildefjvildepkvildepkrolerbolerrolerbolermeloyguttmeloyguttanders.baggethunanders.baggethun

Keywords

Readme

Core Progress

@nrk/core-progress is an accessible progress element for displaying linear and radial progresses.

Example

<!--demo-->
<label>
  Progress:
  <span class="my-track">
    <core-progress value=".5"></core-progress>
  </span>
</label>
<!--demo-->
<div id="jsx-progress"></div>
<script type="text/jsx">
  class MyProgress extends React.Component {
    constructor (props) {
      super(props)
      this.state = { value: 50, max: 100 }
    }
    render () {
      return <label>Progress JSX:
        <span className="my-track">
          <CoreProgress value={this.state.value} max={this.state.max} onProgressChange={(state) => this.setState(state)} />
        </span>
      </label>
    }
  }
  ReactDOM.render(<MyProgress />, document.getElementById('jsx-progress'))
</script>
<!--demo-->
<label>Indeterminate progress:
  <span class="my-track">
    <core-progress value="Loading..." max="100"></core-progress>
  </span>
</label>
<!--demo-->
<label>Radial progress:
  <span style="display:block;width:40px">
    <core-progress type="radial" class="my-radial" value=".75"></core-progress>
  </span>
</label>

Installation

Using NPM provides own element namespace and extensibility. Recommended:

npm install @nrk/core-progress  # Using NPM

Using static registers the custom element with default name automatically:

<script src="https://static.nrk.no/core-components/major/10/core-progress/core-progress.min.js"></script>  <!-- Using static -->

Remember to polyfill custom elements if needed.

Usage

HTML / Javascript

<div class="my-track">
  <core-progress type="{String}"            <!-- Optional. Default "linear". Type of progress. Possible values: "linear" and "radial" -->
                 value="{Number|String}"    <!-- Optional. Default 0. Value progress value. If string, indeterminate is set to true -->
                 max="{Number}"             <!-- Optional. Default 1. Maximum value. Progress percentage is calculated relative to this -->
                 indeterminate="{Boolean}"  <!-- Optional. Set indeterminate value -->
  </core-progress>
</div>
import CoreProgress from '@nrk/core-progress'                 // Using NPM
window.customElements.define('core-progress', CoreProgress)   // Using NPM. Replace 'core-progress' with 'my-progress' to namespace

const myProgress = document.querySelector('core-progress')

// Getters
myProgress.type                   // The progress type
myProgress.value                  // The current progress value
myProgress.max                    // The max progress value
myProgress.percentage             // The calculated percentage from (value / max * 100)
myProgress.indeterminate          // True if the progress is indeterminate (no value attribute)
// Setters
myProgress.type = 'radial'        // Set the progress type. Possible values: "linear" and "radial"
myProgress.value = .5             // Set the progress value. If string, indeterminate is set to true
myProgress.max = 10               // Set the max progress value
myProgress.indeterminate = true   // Set indeterminate value

React / Preact

import CoreProgress from '@nrk/core-progress/jsx'

<div className="my-track">
  <CoreProgress type={String}                   // Optional. Default "linear". Type of progress. Possible values: "linear" and "radial"
                value={Number|String}           // Optional. Default 0. Value of progress relative to max. If string, indeterminate is set to true
                max={Number}                    // Optional. Default 1. Maximum value. Progress percentage is calculated relative to this
                indeterminate={Boolean}         // Optional. Set indeterminate value
                ref={(comp) => {}}              // Optional. Get reference to React component
                forwardRef={(el) => {}}         // Optional. Get reference to underlying DOM custom element
                onProgressChange={Function} />  // Optional. Progress change event handler
</div>

Events

change

Fired when the progress value changes:

document.addEventListener('change', (event) => {
  event.target    // The progress element
})

Styling

For linear progress bars, wrap the <core-progress> in a container element that will work as the track and style it appropriately along with the progress:

<style>
.my-track { /* */ }
.my-track [value] { /* */ }
.my-track [indeterminate] { /* */ }
</style>

<div class="my-track">
  <core-progress value="Loading..." max="100"></core-progress>
</div>

For radial progress bars you don't need a wrapper. Use the following properties on the <core-progress> element itself to style track and progress:

Property | Affects | Example :-- | :-- | :-- color | Color of progress | stroke | Color of track | stroke-width | Percentage thickness |