@react-aria/progress 3.4.12 → 3.4.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -23,7 +23,7 @@ $parcel$export(module.exports, "useProgressBar", () => $c6bb999a3b4eb4f3$export$
|
|
|
23
23
|
|
|
24
24
|
function $c6bb999a3b4eb4f3$export$ed5abd763a836edc(props) {
|
|
25
25
|
let { value: value = 0, minValue: minValue = 0, maxValue: maxValue = 100, valueLabel: valueLabel, isIndeterminate: isIndeterminate, formatOptions: formatOptions = {
|
|
26
|
-
style:
|
|
26
|
+
style: 'percent'
|
|
27
27
|
} } = props;
|
|
28
28
|
let domProps = (0, $dNefm$reactariautils.filterDOMProps)(props, {
|
|
29
29
|
labelable: true
|
|
@@ -32,23 +32,23 @@ function $c6bb999a3b4eb4f3$export$ed5abd763a836edc(props) {
|
|
|
32
32
|
...props,
|
|
33
33
|
// Progress bar is not an HTML input element so it
|
|
34
34
|
// shouldn't be labeled by a <label> element.
|
|
35
|
-
labelElementType:
|
|
35
|
+
labelElementType: 'span'
|
|
36
36
|
});
|
|
37
37
|
value = (0, $dNefm$reactariautils.clamp)(value, minValue, maxValue);
|
|
38
38
|
let percentage = (value - minValue) / (maxValue - minValue);
|
|
39
39
|
let formatter = (0, $dNefm$reactariai18n.useNumberFormatter)(formatOptions);
|
|
40
40
|
if (!isIndeterminate && !valueLabel) {
|
|
41
|
-
let valueToFormat = formatOptions.style ===
|
|
41
|
+
let valueToFormat = formatOptions.style === 'percent' ? percentage : value;
|
|
42
42
|
valueLabel = formatter.format(valueToFormat);
|
|
43
43
|
}
|
|
44
44
|
return {
|
|
45
45
|
progressBarProps: (0, $dNefm$reactariautils.mergeProps)(domProps, {
|
|
46
46
|
...fieldProps,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
role:
|
|
47
|
+
'aria-valuenow': isIndeterminate ? undefined : value,
|
|
48
|
+
'aria-valuemin': minValue,
|
|
49
|
+
'aria-valuemax': maxValue,
|
|
50
|
+
'aria-valuetext': isIndeterminate ? undefined : valueLabel,
|
|
51
|
+
role: 'progressbar'
|
|
52
52
|
}),
|
|
53
53
|
labelProps: labelProps
|
|
54
54
|
};
|
package/dist/useProgressBar.mjs
CHANGED
|
@@ -17,7 +17,7 @@ import {useNumberFormatter as $2xLm1$useNumberFormatter} from "@react-aria/i18n"
|
|
|
17
17
|
|
|
18
18
|
function $204d9ebcedfb8806$export$ed5abd763a836edc(props) {
|
|
19
19
|
let { value: value = 0, minValue: minValue = 0, maxValue: maxValue = 100, valueLabel: valueLabel, isIndeterminate: isIndeterminate, formatOptions: formatOptions = {
|
|
20
|
-
style:
|
|
20
|
+
style: 'percent'
|
|
21
21
|
} } = props;
|
|
22
22
|
let domProps = (0, $2xLm1$filterDOMProps)(props, {
|
|
23
23
|
labelable: true
|
|
@@ -26,23 +26,23 @@ function $204d9ebcedfb8806$export$ed5abd763a836edc(props) {
|
|
|
26
26
|
...props,
|
|
27
27
|
// Progress bar is not an HTML input element so it
|
|
28
28
|
// shouldn't be labeled by a <label> element.
|
|
29
|
-
labelElementType:
|
|
29
|
+
labelElementType: 'span'
|
|
30
30
|
});
|
|
31
31
|
value = (0, $2xLm1$clamp)(value, minValue, maxValue);
|
|
32
32
|
let percentage = (value - minValue) / (maxValue - minValue);
|
|
33
33
|
let formatter = (0, $2xLm1$useNumberFormatter)(formatOptions);
|
|
34
34
|
if (!isIndeterminate && !valueLabel) {
|
|
35
|
-
let valueToFormat = formatOptions.style ===
|
|
35
|
+
let valueToFormat = formatOptions.style === 'percent' ? percentage : value;
|
|
36
36
|
valueLabel = formatter.format(valueToFormat);
|
|
37
37
|
}
|
|
38
38
|
return {
|
|
39
39
|
progressBarProps: (0, $2xLm1$mergeProps)(domProps, {
|
|
40
40
|
...fieldProps,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
role:
|
|
41
|
+
'aria-valuenow': isIndeterminate ? undefined : value,
|
|
42
|
+
'aria-valuemin': minValue,
|
|
43
|
+
'aria-valuemax': maxValue,
|
|
44
|
+
'aria-valuetext': isIndeterminate ? undefined : valueLabel,
|
|
45
|
+
role: 'progressbar'
|
|
46
46
|
}),
|
|
47
47
|
labelProps: labelProps
|
|
48
48
|
};
|
|
@@ -50,4 +50,4 @@ function $204d9ebcedfb8806$export$ed5abd763a836edc(props) {
|
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|
export {$204d9ebcedfb8806$export$ed5abd763a836edc as useProgressBar};
|
|
53
|
-
//# sourceMappingURL=useProgressBar.
|
|
53
|
+
//# sourceMappingURL=useProgressBar.module.js.map
|
|
@@ -17,7 +17,7 @@ import {useNumberFormatter as $2xLm1$useNumberFormatter} from "@react-aria/i18n"
|
|
|
17
17
|
|
|
18
18
|
function $204d9ebcedfb8806$export$ed5abd763a836edc(props) {
|
|
19
19
|
let { value: value = 0, minValue: minValue = 0, maxValue: maxValue = 100, valueLabel: valueLabel, isIndeterminate: isIndeterminate, formatOptions: formatOptions = {
|
|
20
|
-
style:
|
|
20
|
+
style: 'percent'
|
|
21
21
|
} } = props;
|
|
22
22
|
let domProps = (0, $2xLm1$filterDOMProps)(props, {
|
|
23
23
|
labelable: true
|
|
@@ -26,23 +26,23 @@ function $204d9ebcedfb8806$export$ed5abd763a836edc(props) {
|
|
|
26
26
|
...props,
|
|
27
27
|
// Progress bar is not an HTML input element so it
|
|
28
28
|
// shouldn't be labeled by a <label> element.
|
|
29
|
-
labelElementType:
|
|
29
|
+
labelElementType: 'span'
|
|
30
30
|
});
|
|
31
31
|
value = (0, $2xLm1$clamp)(value, minValue, maxValue);
|
|
32
32
|
let percentage = (value - minValue) / (maxValue - minValue);
|
|
33
33
|
let formatter = (0, $2xLm1$useNumberFormatter)(formatOptions);
|
|
34
34
|
if (!isIndeterminate && !valueLabel) {
|
|
35
|
-
let valueToFormat = formatOptions.style ===
|
|
35
|
+
let valueToFormat = formatOptions.style === 'percent' ? percentage : value;
|
|
36
36
|
valueLabel = formatter.format(valueToFormat);
|
|
37
37
|
}
|
|
38
38
|
return {
|
|
39
39
|
progressBarProps: (0, $2xLm1$mergeProps)(domProps, {
|
|
40
40
|
...fieldProps,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
role:
|
|
41
|
+
'aria-valuenow': isIndeterminate ? undefined : value,
|
|
42
|
+
'aria-valuemin': minValue,
|
|
43
|
+
'aria-valuemax': maxValue,
|
|
44
|
+
'aria-valuetext': isIndeterminate ? undefined : valueLabel,
|
|
45
|
+
role: 'progressbar'
|
|
46
46
|
}),
|
|
47
47
|
labelProps: labelProps
|
|
48
48
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/progress",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.13",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
"url": "https://github.com/adobe/react-spectrum"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@react-aria/i18n": "^3.11.
|
|
26
|
-
"@react-aria/label": "^3.7.
|
|
27
|
-
"@react-aria/utils": "^3.24.
|
|
28
|
-
"@react-types/progress": "^3.5.
|
|
29
|
-
"@react-types/shared": "^3.23.
|
|
25
|
+
"@react-aria/i18n": "^3.11.1",
|
|
26
|
+
"@react-aria/label": "^3.7.8",
|
|
27
|
+
"@react-aria/utils": "^3.24.1",
|
|
28
|
+
"@react-types/progress": "^3.5.4",
|
|
29
|
+
"@react-types/shared": "^3.23.1",
|
|
30
30
|
"@swc/helpers": "^0.5.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"access": "public"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "b77d7d594dff4dcfb5359bffbcfd18142b146433"
|
|
39
39
|
}
|