Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
@nrk/core-progress
Advanced tools
> `@nrk/core-progress` is an accessible progress element for displaying linear and radial progresses.
@nrk/core-progress
is an accessible progress element for displaying linear and radial progresses.
<!--demo-->
<label>
Progress:
<div class="my-track">
<core-progress value=".5"></core-progress>
</div>
</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:
<div className="my-track">
<CoreProgress value={this.state.value} max={this.state.max} onProgressChange={(state) => this.setState(state)} />
</div>
</label>
}
}
ReactDOM.render(<MyProgress />, document.getElementById('jsx-progress'))
</script>
<!--demo-->
<label>Indeterminate progress:
<div class="my-track">
<core-progress value="Loading..." max="100"></core-progress>
</div>
</label>
<!--demo-->
<label>Radial progress:
<div style="width:40px">
<core-progress type="radial" class="my-radial" value=".75"></core-progress>
</div>
</label>
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/6/core-progress/core-progress.min.js"></script> <!-- Using static -->
<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
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
onProgressChange={Function} /> // Optional. Progress change event handler
</div>
Fired when the progress value changes:
document.addEventListener('progress.change', (event) => {
event.target // The progress element
})
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 |
FAQs
> `@nrk/core-progress` is an accessible progress element for displaying linear and radial progresses.
The npm package @nrk/core-progress receives a total of 72 weekly downloads. As such, @nrk/core-progress popularity was classified as not popular.
We found that @nrk/core-progress demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 152 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.