@react-aria/progress 3.3.4 → 3.4.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.
Files changed (2) hide show
  1. package/dist/import.mjs +65 -0
  2. package/package.json +12 -7
@@ -0,0 +1,65 @@
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";
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
+ * Copyright 2020 Adobe. All rights reserved.
17
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
18
+ * you may not use this file except in compliance with the License. You may obtain a copy
19
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
20
+ *
21
+ * Unless required by applicable law or agreed to in writing, software distributed under
22
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
23
+ * OF ANY KIND, either express or implied. See the License for the specific language
24
+ * governing permissions and limitations under the License.
25
+ */
26
+
27
+
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
+ export {$204d9ebcedfb8806$export$ed5abd763a836edc as useProgressBar};
65
+ //# sourceMappingURL=module.js.map
package/package.json CHANGED
@@ -1,10 +1,15 @@
1
1
  {
2
2
  "name": "@react-aria/progress",
3
- "version": "3.3.4",
3
+ "version": "3.4.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
+ "exports": {
9
+ "types": "./dist/types.d.ts",
10
+ "import": "./dist/import.mjs",
11
+ "require": "./dist/index.js"
12
+ },
8
13
  "types": "dist/types.d.ts",
9
14
  "source": "src/index.ts",
10
15
  "files": [
@@ -17,11 +22,11 @@
17
22
  "url": "https://github.com/adobe/react-spectrum"
18
23
  },
19
24
  "dependencies": {
20
- "@react-aria/i18n": "^3.6.3",
21
- "@react-aria/label": "^3.4.4",
22
- "@react-aria/utils": "^3.14.2",
23
- "@react-types/progress": "^3.2.5",
24
- "@react-types/shared": "^3.16.0",
25
+ "@react-aria/i18n": "^3.7.0",
26
+ "@react-aria/label": "^3.5.0",
27
+ "@react-aria/utils": "^3.15.0",
28
+ "@react-types/progress": "^3.3.0",
29
+ "@react-types/shared": "^3.17.0",
25
30
  "@swc/helpers": "^0.4.14"
26
31
  },
27
32
  "peerDependencies": {
@@ -30,5 +35,5 @@
30
35
  "publishConfig": {
31
36
  "access": "public"
32
37
  },
33
- "gitHead": "5480d76bd815e239366f92852c76b6831ad2a4fd"
38
+ "gitHead": "a0efee84aa178cb1a202951dfd6d8de02b292307"
34
39
  }