@react-aria/progress 3.4.30 → 3.5.0

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,4 +1,4 @@
1
- import {useProgressBar as $204d9ebcedfb8806$export$ed5abd763a836edc} from "./useProgressBar.mjs";
1
+ import {useProgressBar as $28b01892afced368$re_export$useProgressBar} from "react-aria/useProgressBar";
2
2
 
3
3
  /*
4
4
  * Copyright 2020 Adobe. All rights reserved.
@@ -13,5 +13,5 @@ import {useProgressBar as $204d9ebcedfb8806$export$ed5abd763a836edc} from "./use
13
13
  */
14
14
 
15
15
 
16
- export {$204d9ebcedfb8806$export$ed5abd763a836edc as useProgressBar};
16
+ export {$28b01892afced368$re_export$useProgressBar as useProgressBar};
17
17
  //# sourceMappingURL=module.js.map
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
- var $c6bb999a3b4eb4f3$exports = require("./useProgressBar.main.js");
1
+ var $dAH9E$reactariauseProgressBar = require("react-aria/useProgressBar");
2
2
 
3
3
 
4
4
  function $parcel$export(e, n, v, s) {
5
5
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
6
6
  }
7
7
 
8
- $parcel$export(module.exports, "useProgressBar", () => $c6bb999a3b4eb4f3$exports.useProgressBar);
8
+ $parcel$export(module.exports, "useProgressBar", function () { return $dAH9E$reactariauseProgressBar.useProgressBar; });
9
9
  /*
10
10
  * Copyright 2020 Adobe. All rights reserved.
11
11
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
package/dist/index.js.map CHANGED
@@ -1 +1 @@
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"}
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 'react-aria/useProgressBar';\n\nexport type {ProgressBarProps, ProgressBarBaseProps, AriaProgressBarBaseProps, AriaProgressBarProps, ProgressBarAria} from 'react-aria/useProgressBar';\n"],"names":[],"version":3,"file":"index.js.map"}
package/dist/module.js CHANGED
@@ -1,4 +1,4 @@
1
- import {useProgressBar as $204d9ebcedfb8806$export$ed5abd763a836edc} from "./useProgressBar.module.js";
1
+ import {useProgressBar as $28b01892afced368$re_export$useProgressBar} from "react-aria/useProgressBar";
2
2
 
3
3
  /*
4
4
  * Copyright 2020 Adobe. All rights reserved.
@@ -13,5 +13,5 @@ import {useProgressBar as $204d9ebcedfb8806$export$ed5abd763a836edc} from "./use
13
13
  */
14
14
 
15
15
 
16
- export {$204d9ebcedfb8806$export$ed5abd763a836edc as useProgressBar};
16
+ export {$28b01892afced368$re_export$useProgressBar as useProgressBar};
17
17
  //# sourceMappingURL=module.js.map
@@ -1 +1 @@
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"}
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 'react-aria/useProgressBar';\n\nexport type {ProgressBarProps, ProgressBarBaseProps, AriaProgressBarBaseProps, AriaProgressBarProps, ProgressBarAria} from 'react-aria/useProgressBar';\n"],"names":[],"version":3,"file":"module.js.map"}
@@ -0,0 +1,2 @@
1
+ export { useProgressBar } from 'react-aria/useProgressBar';
2
+ export type { ProgressBarProps, ProgressBarBaseProps, AriaProgressBarBaseProps, AriaProgressBarProps, ProgressBarAria } from 'react-aria/useProgressBar';
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@react-aria/progress",
3
- "version": "3.4.30",
3
+ "version": "3.5.0",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/module.js",
8
8
  "exports": {
9
- "source": "./src/index.ts",
10
- "types": [
11
- "./dist/types.d.ts",
12
- "./src/index.ts"
13
- ],
14
- "import": "./dist/import.mjs",
15
- "require": "./dist/index.js"
9
+ ".": {
10
+ "source": "./src/index.ts",
11
+ "types": "./dist/types/src/index.d.ts",
12
+ "import": "./dist/import.mjs",
13
+ "require": "./dist/index.js"
14
+ },
15
+ "./package.json": "./package.json"
16
16
  },
17
- "types": "dist/types.d.ts",
17
+ "types": "dist/types/src/index.d.ts",
18
18
  "source": "src/index.ts",
19
19
  "files": [
20
20
  "dist",
@@ -26,12 +26,8 @@
26
26
  "url": "https://github.com/adobe/react-spectrum"
27
27
  },
28
28
  "dependencies": {
29
- "@react-aria/i18n": "^3.12.16",
30
- "@react-aria/label": "^3.7.25",
31
- "@react-aria/utils": "^3.33.1",
32
- "@react-types/progress": "^3.5.18",
33
- "@react-types/shared": "^3.33.1",
34
- "@swc/helpers": "^0.5.0"
29
+ "@swc/helpers": "^0.5.0",
30
+ "react-aria": "3.48.0"
35
31
  },
36
32
  "peerDependencies": {
37
33
  "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
@@ -40,5 +36,8 @@
40
36
  "publishConfig": {
41
37
  "access": "public"
42
38
  },
43
- "gitHead": "8df187370053aa35f553cb388ad670f65e1ab371"
39
+ "targets": {
40
+ "types": false
41
+ },
42
+ "gitHead": "a6999bdf494a2e9c0381a5881908328bdd22ddae"
44
43
  }
package/src/index.ts CHANGED
@@ -9,6 +9,6 @@
9
9
  * OF ANY KIND, either express or implied. See the License for the specific language
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
- export {useProgressBar} from './useProgressBar';
13
- export type {AriaProgressBarProps} from '@react-types/progress';
14
- export type {ProgressBarAria} from './useProgressBar';
12
+ export {useProgressBar} from 'react-aria/useProgressBar';
13
+
14
+ export type {ProgressBarProps, ProgressBarBaseProps, AriaProgressBarBaseProps, AriaProgressBarProps, ProgressBarAria} from 'react-aria/useProgressBar';
package/dist/types.d.ts DELETED
@@ -1,17 +0,0 @@
1
- import { AriaProgressBarProps } from "@react-types/progress";
2
- import { DOMAttributes } from "@react-types/shared";
3
- export interface ProgressBarAria {
4
- /** Props for the progress bar container element. */
5
- progressBarProps: DOMAttributes;
6
- /** Props for the progress bar's visual label element (if any). */
7
- labelProps: DOMAttributes;
8
- }
9
- /**
10
- * Provides the accessibility implementation for a progress bar component.
11
- * Progress bars show either determinate or indeterminate progress of an operation
12
- * over time.
13
- */
14
- export function useProgressBar(props: AriaProgressBarProps): ProgressBarAria;
15
- export type { AriaProgressBarProps } from '@react-types/progress';
16
-
17
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"mappings":";;AAkBA;IACE,oDAAoD;IACpD,gBAAgB,EAAE,aAAa,CAAC;IAChC,kEAAkE;IAClE,UAAU,EAAE,aAAa,CAAA;CAC1B;AAED;;;;GAIG;AACH,+BAA+B,KAAK,EAAE,oBAAoB,GAAG,eAAe,CAwC3E;AC1DD,YAAY,EAAC,oBAAoB,EAAC,MAAM,uBAAuB,CAAC","sources":["packages/@react-aria/progress/src/packages/@react-aria/progress/src/useProgressBar.ts","packages/@react-aria/progress/src/packages/@react-aria/progress/src/index.ts","packages/@react-aria/progress/src/index.ts"],"sourcesContent":[null,null,"/*\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":"types.d.ts.map"}
@@ -1,58 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,53 +0,0 @@
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
@@ -1,53 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,71 +0,0 @@
1
- /*
2
- * Copyright 2020 Adobe. All rights reserved.
3
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- * you may not use this file except in compliance with the License. You may obtain a copy
5
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
- *
7
- * Unless required by applicable law or agreed to in writing, software distributed under
8
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- * OF ANY KIND, either express or implied. See the License for the specific language
10
- * governing permissions and limitations under the License.
11
- */
12
-
13
- import {AriaProgressBarProps} from '@react-types/progress';
14
- import {clamp, filterDOMProps, mergeProps} from '@react-aria/utils';
15
- import {DOMAttributes} from '@react-types/shared';
16
- import {useLabel} from '@react-aria/label';
17
- import {useNumberFormatter} from '@react-aria/i18n';
18
-
19
- export interface ProgressBarAria {
20
- /** Props for the progress bar container element. */
21
- progressBarProps: DOMAttributes,
22
- /** Props for the progress bar's visual label element (if any). */
23
- labelProps: DOMAttributes
24
- }
25
-
26
- /**
27
- * Provides the accessibility implementation for a progress bar component.
28
- * Progress bars show either determinate or indeterminate progress of an operation
29
- * over time.
30
- */
31
- export function useProgressBar(props: AriaProgressBarProps): ProgressBarAria {
32
- let {
33
- value = 0,
34
- minValue = 0,
35
- maxValue = 100,
36
- valueLabel,
37
- isIndeterminate,
38
- formatOptions = {
39
- style: 'percent'
40
- }
41
- } = props;
42
-
43
- let domProps = filterDOMProps(props, {labelable: true});
44
- let {labelProps, fieldProps} = useLabel({
45
- ...props,
46
- // Progress bar is not an HTML input element so it
47
- // shouldn't be labeled by a <label> element.
48
- labelElementType: 'span'
49
- });
50
-
51
- value = clamp(value, minValue, maxValue);
52
- let percentage = (value - minValue) / (maxValue - minValue);
53
- let formatter = useNumberFormatter(formatOptions);
54
-
55
- if (!isIndeterminate && !valueLabel) {
56
- let valueToFormat = formatOptions.style === 'percent' ? percentage : value;
57
- valueLabel = formatter.format(valueToFormat);
58
- }
59
-
60
- return {
61
- progressBarProps: mergeProps(domProps, {
62
- ...fieldProps,
63
- 'aria-valuenow': isIndeterminate ? undefined : value,
64
- 'aria-valuemin': minValue,
65
- 'aria-valuemax': maxValue,
66
- 'aria-valuetext': isIndeterminate ? undefined : valueLabel as string,
67
- role: 'progressbar'
68
- }),
69
- labelProps
70
- };
71
- }