@react-aria/progress 3.4.11 → 3.4.12

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.
package/dist/import.mjs CHANGED
@@ -1,18 +1,6 @@
1
- import {filterDOMProps as $e3Dei$filterDOMProps, clamp as $e3Dei$clamp, mergeProps as $e3Dei$mergeProps} from "@react-aria/utils";
2
- import {useLabel as $e3Dei$useLabel} from "@react-aria/label";
3
- import {useNumberFormatter as $e3Dei$useNumberFormatter} from "@react-aria/i18n";
1
+ import {useProgressBar as $204d9ebcedfb8806$export$ed5abd763a836edc} from "./useProgressBar.mjs";
4
2
 
5
3
  /*
6
- * Copyright 2020 Adobe. All rights reserved.
7
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
8
- * you may not use this file except in compliance with the License. You may obtain a copy
9
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software distributed under
12
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
13
- * OF ANY KIND, either express or implied. See the License for the specific language
14
- * governing permissions and limitations under the License.
15
- */ /*
16
4
  * Copyright 2020 Adobe. All rights reserved.
17
5
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
18
6
  * you may not use this file except in compliance with the License. You may obtain a copy
@@ -25,41 +13,5 @@ import {useNumberFormatter as $e3Dei$useNumberFormatter} from "@react-aria/i18n"
25
13
  */
26
14
 
27
15
 
28
- function $204d9ebcedfb8806$export$ed5abd763a836edc(props) {
29
- let { value: value = 0, minValue: minValue = 0, maxValue: maxValue = 100, valueLabel: valueLabel, isIndeterminate: isIndeterminate, formatOptions: formatOptions = {
30
- style: "percent"
31
- } } = props;
32
- let domProps = (0, $e3Dei$filterDOMProps)(props, {
33
- labelable: true
34
- });
35
- let { labelProps: labelProps, fieldProps: fieldProps } = (0, $e3Dei$useLabel)({
36
- ...props,
37
- // Progress bar is not an HTML input element so it
38
- // shouldn't be labeled by a <label> element.
39
- labelElementType: "span"
40
- });
41
- value = (0, $e3Dei$clamp)(value, minValue, maxValue);
42
- let percentage = (value - minValue) / (maxValue - minValue);
43
- let formatter = (0, $e3Dei$useNumberFormatter)(formatOptions);
44
- if (!isIndeterminate && !valueLabel) {
45
- let valueToFormat = formatOptions.style === "percent" ? percentage : value;
46
- valueLabel = formatter.format(valueToFormat);
47
- }
48
- return {
49
- progressBarProps: (0, $e3Dei$mergeProps)(domProps, {
50
- ...fieldProps,
51
- "aria-valuenow": isIndeterminate ? undefined : value,
52
- "aria-valuemin": minValue,
53
- "aria-valuemax": maxValue,
54
- "aria-valuetext": isIndeterminate ? undefined : valueLabel,
55
- role: "progressbar"
56
- }),
57
- labelProps: labelProps
58
- };
59
- }
60
-
61
-
62
-
63
-
64
16
  export {$204d9ebcedfb8806$export$ed5abd763a836edc as useProgressBar};
65
17
  //# sourceMappingURL=module.js.map
package/dist/index.js CHANGED
@@ -1,24 +1,12 @@
1
- var $jaqU8$reactariautils = require("@react-aria/utils");
2
- var $jaqU8$reactarialabel = require("@react-aria/label");
3
- var $jaqU8$reactariai18n = require("@react-aria/i18n");
1
+ var $c6bb999a3b4eb4f3$exports = require("./useProgressBar.main.js");
4
2
 
5
3
 
6
4
  function $parcel$export(e, n, v, s) {
7
5
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
8
6
  }
9
7
 
10
- $parcel$export(module.exports, "useProgressBar", () => $c6bb999a3b4eb4f3$export$ed5abd763a836edc);
8
+ $parcel$export(module.exports, "useProgressBar", () => $c6bb999a3b4eb4f3$exports.useProgressBar);
11
9
  /*
12
- * Copyright 2020 Adobe. All rights reserved.
13
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
14
- * you may not use this file except in compliance with the License. You may obtain a copy
15
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
16
- *
17
- * Unless required by applicable law or agreed to in writing, software distributed under
18
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
19
- * OF ANY KIND, either express or implied. See the License for the specific language
20
- * governing permissions and limitations under the License.
21
- */ /*
22
10
  * Copyright 2020 Adobe. All rights reserved.
23
11
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
24
12
  * you may not use this file except in compliance with the License. You may obtain a copy
@@ -31,40 +19,4 @@ $parcel$export(module.exports, "useProgressBar", () => $c6bb999a3b4eb4f3$export$
31
19
  */
32
20
 
33
21
 
34
- function $c6bb999a3b4eb4f3$export$ed5abd763a836edc(props) {
35
- let { value: value = 0, minValue: minValue = 0, maxValue: maxValue = 100, valueLabel: valueLabel, isIndeterminate: isIndeterminate, formatOptions: formatOptions = {
36
- style: "percent"
37
- } } = props;
38
- let domProps = (0, $jaqU8$reactariautils.filterDOMProps)(props, {
39
- labelable: true
40
- });
41
- let { labelProps: labelProps, fieldProps: fieldProps } = (0, $jaqU8$reactarialabel.useLabel)({
42
- ...props,
43
- // Progress bar is not an HTML input element so it
44
- // shouldn't be labeled by a <label> element.
45
- labelElementType: "span"
46
- });
47
- value = (0, $jaqU8$reactariautils.clamp)(value, minValue, maxValue);
48
- let percentage = (value - minValue) / (maxValue - minValue);
49
- let formatter = (0, $jaqU8$reactariai18n.useNumberFormatter)(formatOptions);
50
- if (!isIndeterminate && !valueLabel) {
51
- let valueToFormat = formatOptions.style === "percent" ? percentage : value;
52
- valueLabel = formatter.format(valueToFormat);
53
- }
54
- return {
55
- progressBarProps: (0, $jaqU8$reactariautils.mergeProps)(domProps, {
56
- ...fieldProps,
57
- "aria-valuenow": isIndeterminate ? undefined : value,
58
- "aria-valuemin": minValue,
59
- "aria-valuemax": maxValue,
60
- "aria-valuetext": isIndeterminate ? undefined : valueLabel,
61
- role: "progressbar"
62
- }),
63
- labelProps: labelProps
64
- };
65
- }
66
-
67
-
68
-
69
-
70
22
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC;;;AAoBM,SAAS,0CAAe,KAA2B;IACxD,IAAI,SACF,QAAQ,aACR,WAAW,aACX,WAAW,iBACX,UAAU,mBACV,eAAe,iBACf,gBAAgB;QACd,OAAO;IACT,GACD,GAAG;IAEJ,IAAI,WAAW,CAAA,GAAA,oCAAa,EAAE,OAAO;QAAC,WAAW;IAAI;IACrD,IAAI,cAAC,UAAU,cAAE,UAAU,EAAC,GAAG,CAAA,GAAA,8BAAO,EAAE;QACtC,GAAG,KAAK;QACR,kDAAkD;QAClD,6CAA6C;QAC7C,kBAAkB;IACpB;IAEA,QAAQ,CAAA,GAAA,2BAAI,EAAE,OAAO,UAAU;IAC/B,IAAI,aAAa,AAAC,CAAA,QAAQ,QAAO,IAAM,CAAA,WAAW,QAAO;IACzD,IAAI,YAAY,CAAA,GAAA,uCAAiB,EAAE;IAEnC,IAAI,CAAC,mBAAmB,CAAC,YAAY;QACnC,IAAI,gBAAgB,cAAc,KAAK,KAAK,YAAY,aAAa;QACrE,aAAa,UAAU,MAAM,CAAC;IAChC;IAEA,OAAO;QACL,kBAAkB,CAAA,GAAA,gCAAS,EAAE,UAAU;YACrC,GAAG,UAAU;YACb,iBAAiB,kBAAkB,YAAY;YAC/C,iBAAiB;YACjB,iBAAiB;YACjB,kBAAkB,kBAAkB,YAAY;YAChD,MAAM;QACR;oBACA;IACF;AACF;;CD5DC","sources":["packages/@react-aria/progress/src/index.ts","packages/@react-aria/progress/src/useProgressBar.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {useProgressBar} from './useProgressBar';\nexport type {AriaProgressBarProps} from '@react-types/progress';\nexport type {ProgressBarAria} from './useProgressBar';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaProgressBarProps} from '@react-types/progress';\nimport {clamp, filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {DOMAttributes} from '@react-types/shared';\nimport {useLabel} from '@react-aria/label';\nimport {useNumberFormatter} from '@react-aria/i18n';\n\nexport interface ProgressBarAria {\n /** Props for the progress bar container element. */\n progressBarProps: DOMAttributes,\n /** Props for the progress bar's visual label element (if any). */\n labelProps: DOMAttributes\n}\n\n/**\n * Provides the accessibility implementation for a progress bar component.\n * Progress bars show either determinate or indeterminate progress of an operation\n * over time.\n */\nexport function useProgressBar(props: AriaProgressBarProps): ProgressBarAria {\n let {\n value = 0,\n minValue = 0,\n maxValue = 100,\n valueLabel,\n isIndeterminate,\n formatOptions = {\n style: 'percent'\n }\n } = props;\n\n let domProps = filterDOMProps(props, {labelable: true});\n let {labelProps, fieldProps} = useLabel({\n ...props,\n // Progress bar is not an HTML input element so it\n // shouldn't be labeled by a <label> element.\n labelElementType: 'span'\n });\n\n value = clamp(value, minValue, maxValue);\n let percentage = (value - minValue) / (maxValue - minValue);\n let formatter = useNumberFormatter(formatOptions);\n\n if (!isIndeterminate && !valueLabel) {\n let valueToFormat = formatOptions.style === 'percent' ? percentage : value;\n valueLabel = formatter.format(valueToFormat);\n }\n\n return {\n progressBarProps: mergeProps(domProps, {\n ...fieldProps,\n 'aria-valuenow': isIndeterminate ? undefined : value,\n 'aria-valuemin': minValue,\n 'aria-valuemax': maxValue,\n 'aria-valuetext': isIndeterminate ? undefined : valueLabel as string,\n role: 'progressbar'\n }),\n labelProps\n };\n}\n"],"names":[],"version":3,"file":"index.js.map"}
1
+ {"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/progress/src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {useProgressBar} from './useProgressBar';\nexport type {AriaProgressBarProps} from '@react-types/progress';\nexport type {ProgressBarAria} from './useProgressBar';\n"],"names":[],"version":3,"file":"index.js.map"}
package/dist/module.js CHANGED
@@ -1,18 +1,6 @@
1
- import {filterDOMProps as $e3Dei$filterDOMProps, clamp as $e3Dei$clamp, mergeProps as $e3Dei$mergeProps} from "@react-aria/utils";
2
- import {useLabel as $e3Dei$useLabel} from "@react-aria/label";
3
- import {useNumberFormatter as $e3Dei$useNumberFormatter} from "@react-aria/i18n";
1
+ import {useProgressBar as $204d9ebcedfb8806$export$ed5abd763a836edc} from "./useProgressBar.module.js";
4
2
 
5
3
  /*
6
- * Copyright 2020 Adobe. All rights reserved.
7
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
8
- * you may not use this file except in compliance with the License. You may obtain a copy
9
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software distributed under
12
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
13
- * OF ANY KIND, either express or implied. See the License for the specific language
14
- * governing permissions and limitations under the License.
15
- */ /*
16
4
  * Copyright 2020 Adobe. All rights reserved.
17
5
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
18
6
  * you may not use this file except in compliance with the License. You may obtain a copy
@@ -25,41 +13,5 @@ import {useNumberFormatter as $e3Dei$useNumberFormatter} from "@react-aria/i18n"
25
13
  */
26
14
 
27
15
 
28
- function $204d9ebcedfb8806$export$ed5abd763a836edc(props) {
29
- let { value: value = 0, minValue: minValue = 0, maxValue: maxValue = 100, valueLabel: valueLabel, isIndeterminate: isIndeterminate, formatOptions: formatOptions = {
30
- style: "percent"
31
- } } = props;
32
- let domProps = (0, $e3Dei$filterDOMProps)(props, {
33
- labelable: true
34
- });
35
- let { labelProps: labelProps, fieldProps: fieldProps } = (0, $e3Dei$useLabel)({
36
- ...props,
37
- // Progress bar is not an HTML input element so it
38
- // shouldn't be labeled by a <label> element.
39
- labelElementType: "span"
40
- });
41
- value = (0, $e3Dei$clamp)(value, minValue, maxValue);
42
- let percentage = (value - minValue) / (maxValue - minValue);
43
- let formatter = (0, $e3Dei$useNumberFormatter)(formatOptions);
44
- if (!isIndeterminate && !valueLabel) {
45
- let valueToFormat = formatOptions.style === "percent" ? percentage : value;
46
- valueLabel = formatter.format(valueToFormat);
47
- }
48
- return {
49
- progressBarProps: (0, $e3Dei$mergeProps)(domProps, {
50
- ...fieldProps,
51
- "aria-valuenow": isIndeterminate ? undefined : value,
52
- "aria-valuemin": minValue,
53
- "aria-valuemax": maxValue,
54
- "aria-valuetext": isIndeterminate ? undefined : valueLabel,
55
- role: "progressbar"
56
- }),
57
- labelProps: labelProps
58
- };
59
- }
60
-
61
-
62
-
63
-
64
16
  export {$204d9ebcedfb8806$export$ed5abd763a836edc as useProgressBar};
65
17
  //# sourceMappingURL=module.js.map
@@ -1 +1 @@
1
- {"mappings":";;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC;;;AAoBM,SAAS,0CAAe,KAA2B;IACxD,IAAI,SACF,QAAQ,aACR,WAAW,aACX,WAAW,iBACX,UAAU,mBACV,eAAe,iBACf,gBAAgB;QACd,OAAO;IACT,GACD,GAAG;IAEJ,IAAI,WAAW,CAAA,GAAA,qBAAa,EAAE,OAAO;QAAC,WAAW;IAAI;IACrD,IAAI,cAAC,UAAU,cAAE,UAAU,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;QACtC,GAAG,KAAK;QACR,kDAAkD;QAClD,6CAA6C;QAC7C,kBAAkB;IACpB;IAEA,QAAQ,CAAA,GAAA,YAAI,EAAE,OAAO,UAAU;IAC/B,IAAI,aAAa,AAAC,CAAA,QAAQ,QAAO,IAAM,CAAA,WAAW,QAAO;IACzD,IAAI,YAAY,CAAA,GAAA,yBAAiB,EAAE;IAEnC,IAAI,CAAC,mBAAmB,CAAC,YAAY;QACnC,IAAI,gBAAgB,cAAc,KAAK,KAAK,YAAY,aAAa;QACrE,aAAa,UAAU,MAAM,CAAC;IAChC;IAEA,OAAO;QACL,kBAAkB,CAAA,GAAA,iBAAS,EAAE,UAAU;YACrC,GAAG,UAAU;YACb,iBAAiB,kBAAkB,YAAY;YAC/C,iBAAiB;YACjB,iBAAiB;YACjB,kBAAkB,kBAAkB,YAAY;YAChD,MAAM;QACR;oBACA;IACF;AACF;;CD5DC","sources":["packages/@react-aria/progress/src/index.ts","packages/@react-aria/progress/src/useProgressBar.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {useProgressBar} from './useProgressBar';\nexport type {AriaProgressBarProps} from '@react-types/progress';\nexport type {ProgressBarAria} from './useProgressBar';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaProgressBarProps} from '@react-types/progress';\nimport {clamp, filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {DOMAttributes} from '@react-types/shared';\nimport {useLabel} from '@react-aria/label';\nimport {useNumberFormatter} from '@react-aria/i18n';\n\nexport interface ProgressBarAria {\n /** Props for the progress bar container element. */\n progressBarProps: DOMAttributes,\n /** Props for the progress bar's visual label element (if any). */\n labelProps: DOMAttributes\n}\n\n/**\n * Provides the accessibility implementation for a progress bar component.\n * Progress bars show either determinate or indeterminate progress of an operation\n * over time.\n */\nexport function useProgressBar(props: AriaProgressBarProps): ProgressBarAria {\n let {\n value = 0,\n minValue = 0,\n maxValue = 100,\n valueLabel,\n isIndeterminate,\n formatOptions = {\n style: 'percent'\n }\n } = props;\n\n let domProps = filterDOMProps(props, {labelable: true});\n let {labelProps, fieldProps} = useLabel({\n ...props,\n // Progress bar is not an HTML input element so it\n // shouldn't be labeled by a <label> element.\n labelElementType: 'span'\n });\n\n value = clamp(value, minValue, maxValue);\n let percentage = (value - minValue) / (maxValue - minValue);\n let formatter = useNumberFormatter(formatOptions);\n\n if (!isIndeterminate && !valueLabel) {\n let valueToFormat = formatOptions.style === 'percent' ? percentage : value;\n valueLabel = formatter.format(valueToFormat);\n }\n\n return {\n progressBarProps: mergeProps(domProps, {\n ...fieldProps,\n 'aria-valuenow': isIndeterminate ? undefined : value,\n 'aria-valuemin': minValue,\n 'aria-valuemax': maxValue,\n 'aria-valuetext': isIndeterminate ? undefined : valueLabel as string,\n role: 'progressbar'\n }),\n labelProps\n };\n}\n"],"names":[],"version":3,"file":"module.js.map"}
1
+ {"mappings":";;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/progress/src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {useProgressBar} from './useProgressBar';\nexport type {AriaProgressBarProps} from '@react-types/progress';\nexport type {ProgressBarAria} from './useProgressBar';\n"],"names":[],"version":3,"file":"module.js.map"}
@@ -0,0 +1,58 @@
1
+ var $dNefm$reactariautils = require("@react-aria/utils");
2
+ var $dNefm$reactarialabel = require("@react-aria/label");
3
+ var $dNefm$reactariai18n = require("@react-aria/i18n");
4
+
5
+
6
+ function $parcel$export(e, n, v, s) {
7
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
8
+ }
9
+
10
+ $parcel$export(module.exports, "useProgressBar", () => $c6bb999a3b4eb4f3$export$ed5abd763a836edc);
11
+ /*
12
+ * Copyright 2020 Adobe. All rights reserved.
13
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
14
+ * you may not use this file except in compliance with the License. You may obtain a copy
15
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
16
+ *
17
+ * Unless required by applicable law or agreed to in writing, software distributed under
18
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
19
+ * OF ANY KIND, either express or implied. See the License for the specific language
20
+ * governing permissions and limitations under the License.
21
+ */
22
+
23
+
24
+ function $c6bb999a3b4eb4f3$export$ed5abd763a836edc(props) {
25
+ let { value: value = 0, minValue: minValue = 0, maxValue: maxValue = 100, valueLabel: valueLabel, isIndeterminate: isIndeterminate, formatOptions: formatOptions = {
26
+ style: "percent"
27
+ } } = props;
28
+ let domProps = (0, $dNefm$reactariautils.filterDOMProps)(props, {
29
+ labelable: true
30
+ });
31
+ let { labelProps: labelProps, fieldProps: fieldProps } = (0, $dNefm$reactarialabel.useLabel)({
32
+ ...props,
33
+ // Progress bar is not an HTML input element so it
34
+ // shouldn't be labeled by a <label> element.
35
+ labelElementType: "span"
36
+ });
37
+ value = (0, $dNefm$reactariautils.clamp)(value, minValue, maxValue);
38
+ let percentage = (value - minValue) / (maxValue - minValue);
39
+ let formatter = (0, $dNefm$reactariai18n.useNumberFormatter)(formatOptions);
40
+ if (!isIndeterminate && !valueLabel) {
41
+ let valueToFormat = formatOptions.style === "percent" ? percentage : value;
42
+ valueLabel = formatter.format(valueToFormat);
43
+ }
44
+ return {
45
+ progressBarProps: (0, $dNefm$reactariautils.mergeProps)(domProps, {
46
+ ...fieldProps,
47
+ "aria-valuenow": isIndeterminate ? undefined : value,
48
+ "aria-valuemin": minValue,
49
+ "aria-valuemax": maxValue,
50
+ "aria-valuetext": isIndeterminate ? undefined : valueLabel,
51
+ role: "progressbar"
52
+ }),
53
+ labelProps: labelProps
54
+ };
55
+ }
56
+
57
+
58
+ //# sourceMappingURL=useProgressBar.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AAoBM,SAAS,0CAAe,KAA2B;IACxD,IAAI,SACF,QAAQ,aACR,WAAW,aACX,WAAW,iBACX,UAAU,mBACV,eAAe,iBACf,gBAAgB;QACd,OAAO;IACT,GACD,GAAG;IAEJ,IAAI,WAAW,CAAA,GAAA,oCAAa,EAAE,OAAO;QAAC,WAAW;IAAI;IACrD,IAAI,cAAC,UAAU,cAAE,UAAU,EAAC,GAAG,CAAA,GAAA,8BAAO,EAAE;QACtC,GAAG,KAAK;QACR,kDAAkD;QAClD,6CAA6C;QAC7C,kBAAkB;IACpB;IAEA,QAAQ,CAAA,GAAA,2BAAI,EAAE,OAAO,UAAU;IAC/B,IAAI,aAAa,AAAC,CAAA,QAAQ,QAAO,IAAM,CAAA,WAAW,QAAO;IACzD,IAAI,YAAY,CAAA,GAAA,uCAAiB,EAAE;IAEnC,IAAI,CAAC,mBAAmB,CAAC,YAAY;QACnC,IAAI,gBAAgB,cAAc,KAAK,KAAK,YAAY,aAAa;QACrE,aAAa,UAAU,MAAM,CAAC;IAChC;IAEA,OAAO;QACL,kBAAkB,CAAA,GAAA,gCAAS,EAAE,UAAU;YACrC,GAAG,UAAU;YACb,iBAAiB,kBAAkB,YAAY;YAC/C,iBAAiB;YACjB,iBAAiB;YACjB,kBAAkB,kBAAkB,YAAY;YAChD,MAAM;QACR;oBACA;IACF;AACF","sources":["packages/@react-aria/progress/src/useProgressBar.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaProgressBarProps} from '@react-types/progress';\nimport {clamp, filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {DOMAttributes} from '@react-types/shared';\nimport {useLabel} from '@react-aria/label';\nimport {useNumberFormatter} from '@react-aria/i18n';\n\nexport interface ProgressBarAria {\n /** Props for the progress bar container element. */\n progressBarProps: DOMAttributes,\n /** Props for the progress bar's visual label element (if any). */\n labelProps: DOMAttributes\n}\n\n/**\n * Provides the accessibility implementation for a progress bar component.\n * Progress bars show either determinate or indeterminate progress of an operation\n * over time.\n */\nexport function useProgressBar(props: AriaProgressBarProps): ProgressBarAria {\n let {\n value = 0,\n minValue = 0,\n maxValue = 100,\n valueLabel,\n isIndeterminate,\n formatOptions = {\n style: 'percent'\n }\n } = props;\n\n let domProps = filterDOMProps(props, {labelable: true});\n let {labelProps, fieldProps} = useLabel({\n ...props,\n // Progress bar is not an HTML input element so it\n // shouldn't be labeled by a <label> element.\n labelElementType: 'span'\n });\n\n value = clamp(value, minValue, maxValue);\n let percentage = (value - minValue) / (maxValue - minValue);\n let formatter = useNumberFormatter(formatOptions);\n\n if (!isIndeterminate && !valueLabel) {\n let valueToFormat = formatOptions.style === 'percent' ? percentage : value;\n valueLabel = formatter.format(valueToFormat);\n }\n\n return {\n progressBarProps: mergeProps(domProps, {\n ...fieldProps,\n 'aria-valuenow': isIndeterminate ? undefined : value,\n 'aria-valuemin': minValue,\n 'aria-valuemax': maxValue,\n 'aria-valuetext': isIndeterminate ? undefined : valueLabel as string,\n role: 'progressbar'\n }),\n labelProps\n };\n}\n"],"names":[],"version":3,"file":"useProgressBar.main.js.map"}
@@ -0,0 +1,53 @@
1
+ import {filterDOMProps as $2xLm1$filterDOMProps, clamp as $2xLm1$clamp, mergeProps as $2xLm1$mergeProps} from "@react-aria/utils";
2
+ import {useLabel as $2xLm1$useLabel} from "@react-aria/label";
3
+ import {useNumberFormatter as $2xLm1$useNumberFormatter} from "@react-aria/i18n";
4
+
5
+ /*
6
+ * Copyright 2020 Adobe. All rights reserved.
7
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License. You may obtain a copy
9
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software distributed under
12
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
13
+ * OF ANY KIND, either express or implied. See the License for the specific language
14
+ * governing permissions and limitations under the License.
15
+ */
16
+
17
+
18
+ function $204d9ebcedfb8806$export$ed5abd763a836edc(props) {
19
+ let { value: value = 0, minValue: minValue = 0, maxValue: maxValue = 100, valueLabel: valueLabel, isIndeterminate: isIndeterminate, formatOptions: formatOptions = {
20
+ style: "percent"
21
+ } } = props;
22
+ let domProps = (0, $2xLm1$filterDOMProps)(props, {
23
+ labelable: true
24
+ });
25
+ let { labelProps: labelProps, fieldProps: fieldProps } = (0, $2xLm1$useLabel)({
26
+ ...props,
27
+ // Progress bar is not an HTML input element so it
28
+ // shouldn't be labeled by a <label> element.
29
+ labelElementType: "span"
30
+ });
31
+ value = (0, $2xLm1$clamp)(value, minValue, maxValue);
32
+ let percentage = (value - minValue) / (maxValue - minValue);
33
+ let formatter = (0, $2xLm1$useNumberFormatter)(formatOptions);
34
+ if (!isIndeterminate && !valueLabel) {
35
+ let valueToFormat = formatOptions.style === "percent" ? percentage : value;
36
+ valueLabel = formatter.format(valueToFormat);
37
+ }
38
+ return {
39
+ progressBarProps: (0, $2xLm1$mergeProps)(domProps, {
40
+ ...fieldProps,
41
+ "aria-valuenow": isIndeterminate ? undefined : value,
42
+ "aria-valuemin": minValue,
43
+ "aria-valuemax": maxValue,
44
+ "aria-valuetext": isIndeterminate ? undefined : valueLabel,
45
+ role: "progressbar"
46
+ }),
47
+ labelProps: labelProps
48
+ };
49
+ }
50
+
51
+
52
+ export {$204d9ebcedfb8806$export$ed5abd763a836edc as useProgressBar};
53
+ //# sourceMappingURL=useProgressBar.mjs.map
@@ -0,0 +1,53 @@
1
+ import {filterDOMProps as $2xLm1$filterDOMProps, clamp as $2xLm1$clamp, mergeProps as $2xLm1$mergeProps} from "@react-aria/utils";
2
+ import {useLabel as $2xLm1$useLabel} from "@react-aria/label";
3
+ import {useNumberFormatter as $2xLm1$useNumberFormatter} from "@react-aria/i18n";
4
+
5
+ /*
6
+ * Copyright 2020 Adobe. All rights reserved.
7
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License. You may obtain a copy
9
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software distributed under
12
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
13
+ * OF ANY KIND, either express or implied. See the License for the specific language
14
+ * governing permissions and limitations under the License.
15
+ */
16
+
17
+
18
+ function $204d9ebcedfb8806$export$ed5abd763a836edc(props) {
19
+ let { value: value = 0, minValue: minValue = 0, maxValue: maxValue = 100, valueLabel: valueLabel, isIndeterminate: isIndeterminate, formatOptions: formatOptions = {
20
+ style: "percent"
21
+ } } = props;
22
+ let domProps = (0, $2xLm1$filterDOMProps)(props, {
23
+ labelable: true
24
+ });
25
+ let { labelProps: labelProps, fieldProps: fieldProps } = (0, $2xLm1$useLabel)({
26
+ ...props,
27
+ // Progress bar is not an HTML input element so it
28
+ // shouldn't be labeled by a <label> element.
29
+ labelElementType: "span"
30
+ });
31
+ value = (0, $2xLm1$clamp)(value, minValue, maxValue);
32
+ let percentage = (value - minValue) / (maxValue - minValue);
33
+ let formatter = (0, $2xLm1$useNumberFormatter)(formatOptions);
34
+ if (!isIndeterminate && !valueLabel) {
35
+ let valueToFormat = formatOptions.style === "percent" ? percentage : value;
36
+ valueLabel = formatter.format(valueToFormat);
37
+ }
38
+ return {
39
+ progressBarProps: (0, $2xLm1$mergeProps)(domProps, {
40
+ ...fieldProps,
41
+ "aria-valuenow": isIndeterminate ? undefined : value,
42
+ "aria-valuemin": minValue,
43
+ "aria-valuemax": maxValue,
44
+ "aria-valuetext": isIndeterminate ? undefined : valueLabel,
45
+ role: "progressbar"
46
+ }),
47
+ labelProps: labelProps
48
+ };
49
+ }
50
+
51
+
52
+ export {$204d9ebcedfb8806$export$ed5abd763a836edc as useProgressBar};
53
+ //# sourceMappingURL=useProgressBar.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AAoBM,SAAS,0CAAe,KAA2B;IACxD,IAAI,SACF,QAAQ,aACR,WAAW,aACX,WAAW,iBACX,UAAU,mBACV,eAAe,iBACf,gBAAgB;QACd,OAAO;IACT,GACD,GAAG;IAEJ,IAAI,WAAW,CAAA,GAAA,qBAAa,EAAE,OAAO;QAAC,WAAW;IAAI;IACrD,IAAI,cAAC,UAAU,cAAE,UAAU,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;QACtC,GAAG,KAAK;QACR,kDAAkD;QAClD,6CAA6C;QAC7C,kBAAkB;IACpB;IAEA,QAAQ,CAAA,GAAA,YAAI,EAAE,OAAO,UAAU;IAC/B,IAAI,aAAa,AAAC,CAAA,QAAQ,QAAO,IAAM,CAAA,WAAW,QAAO;IACzD,IAAI,YAAY,CAAA,GAAA,yBAAiB,EAAE;IAEnC,IAAI,CAAC,mBAAmB,CAAC,YAAY;QACnC,IAAI,gBAAgB,cAAc,KAAK,KAAK,YAAY,aAAa;QACrE,aAAa,UAAU,MAAM,CAAC;IAChC;IAEA,OAAO;QACL,kBAAkB,CAAA,GAAA,iBAAS,EAAE,UAAU;YACrC,GAAG,UAAU;YACb,iBAAiB,kBAAkB,YAAY;YAC/C,iBAAiB;YACjB,iBAAiB;YACjB,kBAAkB,kBAAkB,YAAY;YAChD,MAAM;QACR;oBACA;IACF;AACF","sources":["packages/@react-aria/progress/src/useProgressBar.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaProgressBarProps} from '@react-types/progress';\nimport {clamp, filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {DOMAttributes} from '@react-types/shared';\nimport {useLabel} from '@react-aria/label';\nimport {useNumberFormatter} from '@react-aria/i18n';\n\nexport interface ProgressBarAria {\n /** Props for the progress bar container element. */\n progressBarProps: DOMAttributes,\n /** Props for the progress bar's visual label element (if any). */\n labelProps: DOMAttributes\n}\n\n/**\n * Provides the accessibility implementation for a progress bar component.\n * Progress bars show either determinate or indeterminate progress of an operation\n * over time.\n */\nexport function useProgressBar(props: AriaProgressBarProps): ProgressBarAria {\n let {\n value = 0,\n minValue = 0,\n maxValue = 100,\n valueLabel,\n isIndeterminate,\n formatOptions = {\n style: 'percent'\n }\n } = props;\n\n let domProps = filterDOMProps(props, {labelable: true});\n let {labelProps, fieldProps} = useLabel({\n ...props,\n // Progress bar is not an HTML input element so it\n // shouldn't be labeled by a <label> element.\n labelElementType: 'span'\n });\n\n value = clamp(value, minValue, maxValue);\n let percentage = (value - minValue) / (maxValue - minValue);\n let formatter = useNumberFormatter(formatOptions);\n\n if (!isIndeterminate && !valueLabel) {\n let valueToFormat = formatOptions.style === 'percent' ? percentage : value;\n valueLabel = formatter.format(valueToFormat);\n }\n\n return {\n progressBarProps: mergeProps(domProps, {\n ...fieldProps,\n 'aria-valuenow': isIndeterminate ? undefined : value,\n 'aria-valuemin': minValue,\n 'aria-valuemax': maxValue,\n 'aria-valuetext': isIndeterminate ? undefined : valueLabel as string,\n role: 'progressbar'\n }),\n labelProps\n };\n}\n"],"names":[],"version":3,"file":"useProgressBar.module.js.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-aria/progress",
3
- "version": "3.4.11",
3
+ "version": "3.4.12",
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.10.2",
26
- "@react-aria/label": "^3.7.6",
27
- "@react-aria/utils": "^3.23.2",
28
- "@react-types/progress": "^3.5.2",
29
- "@react-types/shared": "^3.22.1",
25
+ "@react-aria/i18n": "^3.11.0",
26
+ "@react-aria/label": "^3.7.7",
27
+ "@react-aria/utils": "^3.24.0",
28
+ "@react-types/progress": "^3.5.3",
29
+ "@react-types/shared": "^3.23.0",
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": "de9f84a22583fc741c29b341d14cd35ef4cca161"
38
+ "gitHead": "f645f29edc1322153fd60af4640cbcab1d992dbd"
39
39
  }