Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@react-aria/progress

Package Overview
Dependencies
Maintainers
1
Versions
794
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-aria/progress - npm Package Compare versions

Comparing version 3.0.0-rc.2 to 3.0.0-rc.3

dist/index.js.map

78

dist/index.js

@@ -1,8 +0,16 @@

var _babelRuntimeHelpersObjectSpread = $parcel$interopDefault(require("@babel/runtime/helpers/objectSpread2"));
var {
useNumberFormatter
} = require("@react-aria/i18n");
var clamp = require("@react-aria/utils").clamp;
var {
useLabel
} = require("@react-aria/label");
var useLabel = require("@react-aria/label").useLabel;
var {
clamp,
filterDOMProps,
mergeProps
} = require("@react-aria/utils");
var useNumberFormatter = require("@react-aria/i18n").useNumberFormatter;
var _babelRuntimeHelpersExtends = $parcel$interopDefault(require("@babel/runtime/helpers/extends"));

@@ -13,45 +21,51 @@ function $parcel$interopDefault(a) {

/**
* Provides the accessibility implementation for a progress bar component.
* Progress bars show either determinate or indeterminate progress of an operation
* over time.
*/
function useProgressBar(props) {
var _props$value = props.value,
value = _props$value === void 0 ? 0 : _props$value,
_props$minValue = props.minValue,
minValue = _props$minValue === void 0 ? 0 : _props$minValue,
_props$maxValue = props.maxValue,
maxValue = _props$maxValue === void 0 ? 100 : _props$maxValue,
textValue = props.textValue,
isIndeterminate = props.isIndeterminate,
_props$formatOptions = props.formatOptions,
formatOptions = _props$formatOptions === void 0 ? {
style: 'percent'
} : _props$formatOptions;
var _useLabel = useLabel(_babelRuntimeHelpersObjectSpread({}, props, {
let {
value = 0,
minValue = 0,
maxValue = 100,
valueLabel,
isIndeterminate,
formatOptions = {
style: 'percent'
}
} = props;
let domProps = filterDOMProps(props, {
labelable: true
});
let {
labelProps,
fieldProps
} = useLabel(_babelRuntimeHelpersExtends({}, props, {
// Progress bar is not an HTML input element so it
// shouldn't be labeled by a <label> element.
labelElementType: 'span'
})),
labelProps = _useLabel.labelProps,
fieldProps = _useLabel.fieldProps;
}));
value = clamp(value, minValue, maxValue);
var percentage = (value - minValue) / (maxValue - minValue);
var formatter = useNumberFormatter(formatOptions);
let percentage = (value - minValue) / (maxValue - minValue);
let formatter = useNumberFormatter(formatOptions);
if (!isIndeterminate && !textValue) {
var valueToFormat = formatOptions.style === 'percent' ? percentage : value;
textValue = formatter.format(valueToFormat);
if (!isIndeterminate && !valueLabel) {
let valueToFormat = formatOptions.style === 'percent' ? percentage : value;
valueLabel = formatter.format(valueToFormat);
}
return {
progressBarProps: _babelRuntimeHelpersObjectSpread({}, fieldProps, {
progressBarProps: mergeProps(domProps, _babelRuntimeHelpersExtends({}, fieldProps, {
'aria-valuenow': isIndeterminate ? undefined : value,
'aria-valuemin': minValue,
'aria-valuemax': maxValue,
'aria-valuetext': isIndeterminate ? undefined : textValue,
'aria-valuetext': isIndeterminate ? undefined : valueLabel,
role: 'progressbar'
}),
labelProps: labelProps
})),
labelProps
};
}
exports.useProgressBar = useProgressBar;
exports.useProgressBar = useProgressBar;
//# sourceMappingURL=index.js.map

@@ -1,5 +0,11 @@

import _babelRuntimeHelpersEsmObjectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import { clamp } from "@react-aria/utils";
import { useNumberFormatter } from "@react-aria/i18n";
import { useLabel } from "@react-aria/label";
import { useNumberFormatter } from "@react-aria/i18n";
import { clamp, filterDOMProps, mergeProps } from "@react-aria/utils";
import _babelRuntimeHelpersEsmExtends from "@babel/runtime/helpers/esm/extends";
/**
* Provides the accessibility implementation for a progress bar component.
* Progress bars show either determinate or indeterminate progress of an operation
* over time.
*/
export function useProgressBar(props) {

@@ -10,3 +16,3 @@ let {

maxValue = 100,
textValue,
valueLabel,
isIndeterminate,

@@ -17,6 +23,9 @@ formatOptions = {

} = props;
let domProps = filterDOMProps(props, {
labelable: true
});
let {
labelProps,
fieldProps
} = useLabel(_babelRuntimeHelpersEsmObjectSpread({}, props, {
} = useLabel(_babelRuntimeHelpersEsmExtends({}, props, {
// Progress bar is not an HTML input element so it

@@ -30,17 +39,18 @@ // shouldn't be labeled by a <label> element.

if (!isIndeterminate && !textValue) {
if (!isIndeterminate && !valueLabel) {
let valueToFormat = formatOptions.style === 'percent' ? percentage : value;
textValue = formatter.format(valueToFormat);
valueLabel = formatter.format(valueToFormat);
}
return {
progressBarProps: _babelRuntimeHelpersEsmObjectSpread({}, fieldProps, {
progressBarProps: mergeProps(domProps, _babelRuntimeHelpersEsmExtends({}, fieldProps, {
'aria-valuenow': isIndeterminate ? undefined : value,
'aria-valuemin': minValue,
'aria-valuemax': maxValue,
'aria-valuetext': isIndeterminate ? undefined : textValue,
'aria-valuetext': isIndeterminate ? undefined : valueLabel,
role: 'progressbar'
}),
})),
labelProps
};
}
}
//# sourceMappingURL=module.js.map

@@ -1,13 +0,16 @@

import { DOMProps } from "@react-types/shared";
import { AriaProgressBarProps } from "@react-types/progress";
import { HTMLAttributes } from "react";
import { ProgressBarProps } from "@react-types/progress";
interface ProgressBarAria {
progressBarProps: HTMLAttributes<HTMLDivElement>;
labelProps: HTMLAttributes<HTMLLabelElement>;
/** Props for the progress bar container element. */
progressBarProps: HTMLAttributes<HTMLElement>;
/** Props for the progress bar's visual label element (if any). */
labelProps: HTMLAttributes<HTMLElement>;
}
interface ProgressBarAriaProps extends ProgressBarProps, DOMProps {
textValue?: string;
}
export function useProgressBar(props: ProgressBarAriaProps): ProgressBarAria;
/**
* Provides the accessibility implementation for a progress bar component.
* Progress bars show either determinate or indeterminate progress of an operation
* over time.
*/
export function useProgressBar(props: AriaProgressBarProps): ProgressBarAria;
//# sourceMappingURL=types.d.ts.map
{
"name": "@react-aria/progress",
"version": "3.0.0-rc.2",
"version": "3.0.0-rc.3",
"description": "Spectrum UI components in React",

@@ -20,7 +20,7 @@ "license": "Apache-2.0",

"@babel/runtime": "^7.6.2",
"@react-aria/i18n": "^3.0.0-rc.2",
"@react-aria/label": "^3.0.0-rc.2",
"@react-aria/utils": "^3.0.0-rc.2",
"@react-types/progress": "^3.0.0-rc.2",
"@react-types/shared": "^3.0.0-rc.2"
"@react-aria/i18n": "3.0.0-rc.3",
"@react-aria/label": "3.0.0-rc.3",
"@react-aria/utils": "3.0.0-rc.3",
"@react-types/progress": "3.0.0-rc.3",
"@react-types/shared": "3.0.0-rc.3"
},

@@ -33,3 +33,3 @@ "peerDependencies": {

},
"gitHead": "207e6ee9076905c96638a7f81a367758872e1410"
"gitHead": "461d6321126ae9b4f1508aa912f7b36bf8a603f8"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc