@react-spectrum/labeledvalue 3.0.4-nightly.3696 → 3.0.4-nightly.3705

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 +209 -0
  2. package/package.json +14 -9
@@ -0,0 +1,209 @@
1
+ import "./main.css";
2
+ import {getLocalTimeZone as $3xnHL$getLocalTimeZone, today as $3xnHL$today, toCalendarDateTime as $3xnHL$toCalendarDateTime} from "@internationalized/date";
3
+ import {useDOMRef as $3xnHL$useDOMRef, classNames as $3xnHL$classNames} from "@react-spectrum/utils";
4
+ import {Field as $3xnHL$Field} from "@react-spectrum/label";
5
+ import {filterDOMProps as $3xnHL$filterDOMProps} from "@react-aria/utils";
6
+ import $3xnHL$react from "react";
7
+ import {useListFormatter as $3xnHL$useListFormatter, useNumberFormatter as $3xnHL$useNumberFormatter, useDateFormatter as $3xnHL$useDateFormatter} from "@react-aria/i18n";
8
+
9
+ function $parcel$interopDefault(a) {
10
+ return a && a.__esModule ? a.default : a;
11
+ }
12
+ function $parcel$export(e, n, v, s) {
13
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
14
+ }
15
+ /*
16
+ * Copyright 2022 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
+ */ /// <reference types="css-module-types" />
26
+ /*
27
+ * Copyright 2020 Adobe. All rights reserved.
28
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
29
+ * you may not use this file except in compliance with the License. You may obtain a copy
30
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
31
+ *
32
+ * Unless required by applicable law or agreed to in writing, software distributed under
33
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
34
+ * OF ANY KIND, either express or implied. See the License for the specific language
35
+ * governing permissions and limitations under the License.
36
+ */
37
+
38
+
39
+
40
+ var $cd231e464c886c86$exports = {};
41
+
42
+ $parcel$export($cd231e464c886c86$exports, "spectrum-FieldLabel", () => $cd231e464c886c86$export$493d18e796ae054, (v) => $cd231e464c886c86$export$493d18e796ae054 = v);
43
+ $parcel$export($cd231e464c886c86$exports, "spectrum-FieldLabel--positionSide", () => $cd231e464c886c86$export$9e6f19dc21f22f2e, (v) => $cd231e464c886c86$export$9e6f19dc21f22f2e = v);
44
+ $parcel$export($cd231e464c886c86$exports, "spectrum-FieldLabel-requiredIcon", () => $cd231e464c886c86$export$7c47642c7d46f3c9, (v) => $cd231e464c886c86$export$7c47642c7d46f3c9 = v);
45
+ $parcel$export($cd231e464c886c86$exports, "spectrum-FieldLabel--alignEnd", () => $cd231e464c886c86$export$885efcc08143a987, (v) => $cd231e464c886c86$export$885efcc08143a987 = v);
46
+ $parcel$export($cd231e464c886c86$exports, "spectrum-Field", () => $cd231e464c886c86$export$f6d480ae1e56eba0, (v) => $cd231e464c886c86$export$f6d480ae1e56eba0 = v);
47
+ $parcel$export($cd231e464c886c86$exports, "spectrum-Field-contextualHelp", () => $cd231e464c886c86$export$24fb860d16dd2d3f, (v) => $cd231e464c886c86$export$24fb860d16dd2d3f = v);
48
+ $parcel$export($cd231e464c886c86$exports, "spectrum-Field--positionTop", () => $cd231e464c886c86$export$a4ea780a9064d7f9, (v) => $cd231e464c886c86$export$a4ea780a9064d7f9 = v);
49
+ $parcel$export($cd231e464c886c86$exports, "spectrum-Field-field", () => $cd231e464c886c86$export$3ab8a3dc7f0563d, (v) => $cd231e464c886c86$export$3ab8a3dc7f0563d = v);
50
+ $parcel$export($cd231e464c886c86$exports, "spectrum-Field--alignEnd", () => $cd231e464c886c86$export$5354c9be7ada5f83, (v) => $cd231e464c886c86$export$5354c9be7ada5f83 = v);
51
+ $parcel$export($cd231e464c886c86$exports, "spectrum-Field--positionSide", () => $cd231e464c886c86$export$2963225c91179589, (v) => $cd231e464c886c86$export$2963225c91179589 = v);
52
+ $parcel$export($cd231e464c886c86$exports, "spectrum-Field-wrapper", () => $cd231e464c886c86$export$127df0b7290eb8ef, (v) => $cd231e464c886c86$export$127df0b7290eb8ef = v);
53
+ $parcel$export($cd231e464c886c86$exports, "spectrum-Field--hasContextualHelp", () => $cd231e464c886c86$export$9ba23707a252cdd4, (v) => $cd231e464c886c86$export$9ba23707a252cdd4 = v);
54
+ $parcel$export($cd231e464c886c86$exports, "spectrum-Form", () => $cd231e464c886c86$export$94d2bcc94afabd89, (v) => $cd231e464c886c86$export$94d2bcc94afabd89 = v);
55
+ $parcel$export($cd231e464c886c86$exports, "spectrum-Form--positionSide", () => $cd231e464c886c86$export$7f44db659563c8f4, (v) => $cd231e464c886c86$export$7f44db659563c8f4 = v);
56
+ $parcel$export($cd231e464c886c86$exports, "spectrum-Field-labelCell", () => $cd231e464c886c86$export$9cde5aecff012641, (v) => $cd231e464c886c86$export$9cde5aecff012641 = v);
57
+ $parcel$export($cd231e464c886c86$exports, "spectrum-Field-labelWrapper", () => $cd231e464c886c86$export$a872a8c78b26c9e0, (v) => $cd231e464c886c86$export$a872a8c78b26c9e0 = v);
58
+ $parcel$export($cd231e464c886c86$exports, "spectrum-Form--positionTop", () => $cd231e464c886c86$export$11b8bc81fe551057, (v) => $cd231e464c886c86$export$11b8bc81fe551057 = v);
59
+ $parcel$export($cd231e464c886c86$exports, "spectrum-LabeledValue", () => $cd231e464c886c86$export$79f9a5e9dd010c8d, (v) => $cd231e464c886c86$export$79f9a5e9dd010c8d = v);
60
+ $parcel$export($cd231e464c886c86$exports, "spectrum-Form-itemLabel", () => $cd231e464c886c86$export$51ec27881a1e3928, (v) => $cd231e464c886c86$export$51ec27881a1e3928 = v);
61
+ $parcel$export($cd231e464c886c86$exports, "is-disabled", () => $cd231e464c886c86$export$d35bc1e505d1ebbf, (v) => $cd231e464c886c86$export$d35bc1e505d1ebbf = v);
62
+ var $cd231e464c886c86$export$493d18e796ae054;
63
+ var $cd231e464c886c86$export$9e6f19dc21f22f2e;
64
+ var $cd231e464c886c86$export$7c47642c7d46f3c9;
65
+ var $cd231e464c886c86$export$885efcc08143a987;
66
+ var $cd231e464c886c86$export$f6d480ae1e56eba0;
67
+ var $cd231e464c886c86$export$24fb860d16dd2d3f;
68
+ var $cd231e464c886c86$export$a4ea780a9064d7f9;
69
+ var $cd231e464c886c86$export$3ab8a3dc7f0563d;
70
+ var $cd231e464c886c86$export$5354c9be7ada5f83;
71
+ var $cd231e464c886c86$export$2963225c91179589;
72
+ var $cd231e464c886c86$export$127df0b7290eb8ef;
73
+ var $cd231e464c886c86$export$9ba23707a252cdd4;
74
+ var $cd231e464c886c86$export$94d2bcc94afabd89;
75
+ var $cd231e464c886c86$export$7f44db659563c8f4;
76
+ var $cd231e464c886c86$export$9cde5aecff012641;
77
+ var $cd231e464c886c86$export$a872a8c78b26c9e0;
78
+ var $cd231e464c886c86$export$11b8bc81fe551057;
79
+ var $cd231e464c886c86$export$79f9a5e9dd010c8d;
80
+ var $cd231e464c886c86$export$51ec27881a1e3928;
81
+ var $cd231e464c886c86$export$d35bc1e505d1ebbf;
82
+ $cd231e464c886c86$export$493d18e796ae054 = "spectrum-FieldLabel_d2db1f";
83
+ $cd231e464c886c86$export$9e6f19dc21f22f2e = "spectrum-FieldLabel--positionSide_d2db1f";
84
+ $cd231e464c886c86$export$7c47642c7d46f3c9 = "spectrum-FieldLabel-requiredIcon_d2db1f";
85
+ $cd231e464c886c86$export$885efcc08143a987 = "spectrum-FieldLabel--alignEnd_d2db1f";
86
+ $cd231e464c886c86$export$f6d480ae1e56eba0 = "spectrum-Field_d2db1f";
87
+ $cd231e464c886c86$export$24fb860d16dd2d3f = "spectrum-Field-contextualHelp_d2db1f";
88
+ $cd231e464c886c86$export$a4ea780a9064d7f9 = "spectrum-Field--positionTop_d2db1f";
89
+ $cd231e464c886c86$export$3ab8a3dc7f0563d = "spectrum-Field-field_d2db1f";
90
+ $cd231e464c886c86$export$5354c9be7ada5f83 = "spectrum-Field--alignEnd_d2db1f";
91
+ $cd231e464c886c86$export$2963225c91179589 = "spectrum-Field--positionSide_d2db1f";
92
+ $cd231e464c886c86$export$127df0b7290eb8ef = "spectrum-Field-wrapper_d2db1f";
93
+ $cd231e464c886c86$export$9ba23707a252cdd4 = "spectrum-Field--hasContextualHelp_d2db1f";
94
+ $cd231e464c886c86$export$94d2bcc94afabd89 = "spectrum-Form_d2db1f";
95
+ $cd231e464c886c86$export$7f44db659563c8f4 = "spectrum-Form--positionSide_d2db1f";
96
+ $cd231e464c886c86$export$9cde5aecff012641 = "spectrum-Field-labelCell_d2db1f";
97
+ $cd231e464c886c86$export$a872a8c78b26c9e0 = "spectrum-Field-labelWrapper_d2db1f";
98
+ $cd231e464c886c86$export$11b8bc81fe551057 = "spectrum-Form--positionTop_d2db1f";
99
+ $cd231e464c886c86$export$79f9a5e9dd010c8d = "spectrum-LabeledValue_d2db1f";
100
+ $cd231e464c886c86$export$51ec27881a1e3928 = "spectrum-Form-itemLabel_d2db1f";
101
+ $cd231e464c886c86$export$d35bc1e505d1ebbf = "is-disabled_d2db1f";
102
+
103
+
104
+
105
+
106
+ function $3e9971be431adb24$var$LabeledValue(props, ref) {
107
+ let { value: value , formatOptions: formatOptions } = props;
108
+ let domRef = (0, $3xnHL$useDOMRef)(ref);
109
+ let children;
110
+ if (Array.isArray(value)) // @ts-ignore
111
+ children = /*#__PURE__*/ (0, $3xnHL$react).createElement($3e9971be431adb24$var$FormattedStringList, {
112
+ value: value,
113
+ formatOptions: formatOptions
114
+ });
115
+ if (typeof value === "object" && "start" in value && typeof value.start === "number" && typeof value.end === "number") children = /*#__PURE__*/ (0, $3xnHL$react).createElement($3e9971be431adb24$var$FormattedNumber, {
116
+ value: value,
117
+ formatOptions: formatOptions
118
+ });
119
+ if (typeof value === "object" && "start" in value && typeof value.start !== "number" && typeof value.end !== "number") children = /*#__PURE__*/ (0, $3xnHL$react).createElement($3e9971be431adb24$var$FormattedDate, {
120
+ value: value,
121
+ formatOptions: formatOptions
122
+ });
123
+ if (typeof value === "number") children = /*#__PURE__*/ (0, $3xnHL$react).createElement($3e9971be431adb24$var$FormattedNumber, {
124
+ value: value,
125
+ formatOptions: formatOptions
126
+ });
127
+ if (typeof value === "object" && ("calendar" in value || "hour" in value) || value instanceof Date) children = /*#__PURE__*/ (0, $3xnHL$react).createElement($3e9971be431adb24$var$FormattedDate, {
128
+ value: value,
129
+ formatOptions: formatOptions
130
+ });
131
+ if (typeof value === "string") children = value;
132
+ return /*#__PURE__*/ (0, $3xnHL$react).createElement((0, $3xnHL$Field), {
133
+ ...props,
134
+ wrapperProps: (0, $3xnHL$filterDOMProps)(props),
135
+ ref: domRef,
136
+ elementType: "span",
137
+ wrapperClassName: (0, $3xnHL$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($cd231e464c886c86$exports))), "spectrum-LabeledValue")
138
+ }, /*#__PURE__*/ (0, $3xnHL$react).createElement("span", null, children));
139
+ }
140
+ function $3e9971be431adb24$var$FormattedStringList(props) {
141
+ let stringFormatter = (0, $3xnHL$useListFormatter)(props.formatOptions);
142
+ return /*#__PURE__*/ (0, $3xnHL$react).createElement((0, $3xnHL$react).Fragment, null, stringFormatter.format(props.value));
143
+ }
144
+ function $3e9971be431adb24$var$FormattedNumber(props) {
145
+ let numberFormatter = (0, $3xnHL$useNumberFormatter)(props.formatOptions);
146
+ let value = props.value;
147
+ if (typeof value === "object") return /*#__PURE__*/ (0, $3xnHL$react).createElement((0, $3xnHL$react).Fragment, null, numberFormatter.formatRange(value.start, value.end));
148
+ return /*#__PURE__*/ (0, $3xnHL$react).createElement((0, $3xnHL$react).Fragment, null, numberFormatter.format(value));
149
+ }
150
+ function $3e9971be431adb24$var$FormattedDate(props) {
151
+ let { value: value , formatOptions: formatOptions } = props;
152
+ if (!formatOptions) formatOptions = $3e9971be431adb24$var$getDefaultFormatOptions("start" in value ? value.start : value);
153
+ let dateFormatter = (0, $3xnHL$useDateFormatter)(formatOptions);
154
+ let timeZone = dateFormatter.resolvedOptions().timeZone || (0, $3xnHL$getLocalTimeZone)();
155
+ let final;
156
+ if ("start" in value && "end" in value) {
157
+ let start = value.start;
158
+ let end = value.end;
159
+ start = $3e9971be431adb24$var$convertDateTime(start, timeZone);
160
+ end = $3e9971be431adb24$var$convertDateTime(end, timeZone);
161
+ return /*#__PURE__*/ (0, $3xnHL$react).createElement((0, $3xnHL$react).Fragment, null, dateFormatter.formatRange(start, end));
162
+ }
163
+ final = $3e9971be431adb24$var$convertDateTime(value, timeZone);
164
+ return /*#__PURE__*/ (0, $3xnHL$react).createElement((0, $3xnHL$react).Fragment, null, dateFormatter.format(final));
165
+ }
166
+ function $3e9971be431adb24$var$convertDateTime(value, timeZone) {
167
+ if ("timeZone" in value) return value.toDate();
168
+ else if ("calendar" in value) return value.toDate(timeZone);
169
+ else if (!(value instanceof Date)) return $3e9971be431adb24$var$convertValue(value).toDate(timeZone);
170
+ return value;
171
+ }
172
+ function $3e9971be431adb24$var$getDefaultFormatOptions(value) {
173
+ if (value instanceof Date) return {
174
+ dateStyle: "long",
175
+ timeStyle: "short"
176
+ };
177
+ else if ("timeZone" in value) return {
178
+ year: "numeric",
179
+ month: "long",
180
+ day: "numeric",
181
+ hour: "numeric",
182
+ minute: "numeric",
183
+ timeZone: value.timeZone,
184
+ timeZoneName: "short"
185
+ };
186
+ else if ("hour" in value && "year" in value) return {
187
+ dateStyle: "long",
188
+ timeStyle: "short"
189
+ };
190
+ else if ("hour" in value) return {
191
+ timeStyle: "short"
192
+ };
193
+ else return {
194
+ dateStyle: "long"
195
+ };
196
+ }
197
+ function $3e9971be431adb24$var$convertValue(value) {
198
+ let date = (0, $3xnHL$today)((0, $3xnHL$getLocalTimeZone)());
199
+ return (0, $3xnHL$toCalendarDateTime)(date, value);
200
+ }
201
+ /**
202
+ * A LabeledValue displays a non-editable value with a label. It formats numbers, dates, times, and lists according to the user's locale.
203
+ */ let $3e9971be431adb24$export$d1328f67a56fa517 = /*#__PURE__*/ (0, $3xnHL$react).forwardRef($3e9971be431adb24$var$LabeledValue);
204
+
205
+
206
+
207
+
208
+ export {$3e9971be431adb24$export$d1328f67a56fa517 as LabeledValue};
209
+ //# sourceMappingURL=module.js.map
package/package.json CHANGED
@@ -1,10 +1,15 @@
1
1
  {
2
2
  "name": "@react-spectrum/labeledvalue",
3
- "version": "3.0.4-nightly.3696+be0fae9f7",
3
+ "version": "3.0.4-nightly.3705+93b3c951e",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
7
7
  "module": "dist/module.js",
8
+ "exports": {
9
+ "types": "./dist/types.d.ts",
10
+ "import": "./dist/import.mjs",
11
+ "require": "./dist/main.js"
12
+ },
8
13
  "types": "dist/types.d.ts",
9
14
  "source": "src/index.ts",
10
15
  "files": [
@@ -31,16 +36,16 @@
31
36
  "url": "https://github.com/adobe/react-spectrum"
32
37
  },
33
38
  "dependencies": {
34
- "@internationalized/date": "3.0.3-nightly.3696+be0fae9f7",
35
- "@react-aria/i18n": "3.0.0-nightly.1996+be0fae9f7",
36
- "@react-aria/utils": "3.0.0-nightly.1996+be0fae9f7",
37
- "@react-spectrum/label": "3.10.2-nightly.3696+be0fae9f7",
38
- "@react-spectrum/utils": "3.0.0-nightly.1996+be0fae9f7",
39
- "@react-types/shared": "3.0.0-nightly.1996+be0fae9f7",
39
+ "@internationalized/date": "3.0.3-nightly.3705+93b3c951e",
40
+ "@react-aria/i18n": "3.0.0-nightly.2005+93b3c951e",
41
+ "@react-aria/utils": "3.0.0-nightly.2005+93b3c951e",
42
+ "@react-spectrum/label": "3.10.2-nightly.3705+93b3c951e",
43
+ "@react-spectrum/utils": "3.0.0-nightly.2005+93b3c951e",
44
+ "@react-types/shared": "3.0.0-nightly.2005+93b3c951e",
40
45
  "@swc/helpers": "^0.4.14"
41
46
  },
42
47
  "devDependencies": {
43
- "@adobe/spectrum-css-temp": "3.0.0-nightly.1996+be0fae9f7"
48
+ "@adobe/spectrum-css-temp": "3.0.0-nightly.2005+93b3c951e"
44
49
  },
45
50
  "peerDependencies": {
46
51
  "@react-spectrum/provider": "^3.0.0",
@@ -49,5 +54,5 @@
49
54
  "publishConfig": {
50
55
  "access": "public"
51
56
  },
52
- "gitHead": "be0fae9f7952f4d09823498dc1f251e13842f338"
57
+ "gitHead": "93b3c951eb784b14183f9988f2d188b34de8f42d"
53
58
  }