@react-spectrum/labeledvalue 3.1.13-nightly.4555 → 3.1.13-nightly.4558

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.
@@ -0,0 +1,136 @@
1
+ require("./vars.0e5b9e64.css");
2
+ var $eb2fc0ee655eff6b$exports = require("./fieldlabel_vars_css.main.js");
3
+ var $lcZyr$internationalizeddate = require("@internationalized/date");
4
+ var $lcZyr$reactspectrumutils = require("@react-spectrum/utils");
5
+ var $lcZyr$reactspectrumlabel = require("@react-spectrum/label");
6
+ var $lcZyr$reactariautils = require("@react-aria/utils");
7
+ var $lcZyr$react = require("react");
8
+ var $lcZyr$reactariai18n = require("@react-aria/i18n");
9
+
10
+
11
+ function $parcel$interopDefault(a) {
12
+ return a && a.__esModule ? a.default : a;
13
+ }
14
+
15
+ function $parcel$export(e, n, v, s) {
16
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
17
+ }
18
+
19
+ $parcel$export(module.exports, "LabeledValue", () => $2a7417c2df2197f7$export$d1328f67a56fa517);
20
+ /*
21
+ * Copyright 2020 Adobe. All rights reserved.
22
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
23
+ * you may not use this file except in compliance with the License. You may obtain a copy
24
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
25
+ *
26
+ * Unless required by applicable law or agreed to in writing, software distributed under
27
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
28
+ * OF ANY KIND, either express or implied. See the License for the specific language
29
+ * governing permissions and limitations under the License.
30
+ */
31
+
32
+
33
+
34
+
35
+
36
+
37
+ function $2a7417c2df2197f7$var$LabeledValue(props, ref) {
38
+ let { value: value, formatOptions: formatOptions } = props;
39
+ let domRef = (0, $lcZyr$reactspectrumutils.useDOMRef)(ref);
40
+ let children;
41
+ if (Array.isArray(value)) children = /*#__PURE__*/ (0, ($parcel$interopDefault($lcZyr$react))).createElement($2a7417c2df2197f7$var$FormattedStringList, {
42
+ value: value,
43
+ formatOptions: formatOptions
44
+ });
45
+ if (typeof value === "object" && "start" in value && typeof value.start === "number" && typeof value.end === "number") children = /*#__PURE__*/ (0, ($parcel$interopDefault($lcZyr$react))).createElement($2a7417c2df2197f7$var$FormattedNumber, {
46
+ value: value,
47
+ formatOptions: formatOptions
48
+ });
49
+ if (typeof value === "object" && "start" in value && typeof value.start !== "number" && typeof value.end !== "number") children = /*#__PURE__*/ (0, ($parcel$interopDefault($lcZyr$react))).createElement($2a7417c2df2197f7$var$FormattedDate, {
50
+ value: value,
51
+ formatOptions: formatOptions
52
+ });
53
+ if (typeof value === "number") children = /*#__PURE__*/ (0, ($parcel$interopDefault($lcZyr$react))).createElement($2a7417c2df2197f7$var$FormattedNumber, {
54
+ value: value,
55
+ formatOptions: formatOptions
56
+ });
57
+ if (typeof value === "object" && ("calendar" in value || "hour" in value) || value instanceof Date) children = /*#__PURE__*/ (0, ($parcel$interopDefault($lcZyr$react))).createElement($2a7417c2df2197f7$var$FormattedDate, {
58
+ value: value,
59
+ formatOptions: formatOptions
60
+ });
61
+ if (typeof value === "string") children = value;
62
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($lcZyr$react))).createElement((0, $lcZyr$reactspectrumlabel.Field), {
63
+ ...props,
64
+ wrapperProps: (0, $lcZyr$reactariautils.filterDOMProps)(props),
65
+ ref: domRef,
66
+ elementType: "span",
67
+ wrapperClassName: (0, $lcZyr$reactspectrumutils.classNames)((0, ($parcel$interopDefault($eb2fc0ee655eff6b$exports))), "spectrum-LabeledValue")
68
+ }, /*#__PURE__*/ (0, ($parcel$interopDefault($lcZyr$react))).createElement("span", null, children));
69
+ }
70
+ function $2a7417c2df2197f7$var$FormattedStringList(props) {
71
+ let stringFormatter = (0, $lcZyr$reactariai18n.useListFormatter)(props.formatOptions);
72
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($lcZyr$react))).createElement((0, ($parcel$interopDefault($lcZyr$react))).Fragment, null, stringFormatter.format(props.value));
73
+ }
74
+ function $2a7417c2df2197f7$var$FormattedNumber(props) {
75
+ let numberFormatter = (0, $lcZyr$reactariai18n.useNumberFormatter)(props.formatOptions);
76
+ let value = props.value;
77
+ if (typeof value === "object") return /*#__PURE__*/ (0, ($parcel$interopDefault($lcZyr$react))).createElement((0, ($parcel$interopDefault($lcZyr$react))).Fragment, null, numberFormatter.formatRange(value.start, value.end));
78
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($lcZyr$react))).createElement((0, ($parcel$interopDefault($lcZyr$react))).Fragment, null, numberFormatter.format(value));
79
+ }
80
+ function $2a7417c2df2197f7$var$FormattedDate(props) {
81
+ let { value: value, formatOptions: formatOptions } = props;
82
+ if (!formatOptions) formatOptions = $2a7417c2df2197f7$var$getDefaultFormatOptions("start" in value ? value.start : value);
83
+ let dateFormatter = (0, $lcZyr$reactariai18n.useDateFormatter)(formatOptions);
84
+ let timeZone = dateFormatter.resolvedOptions().timeZone || (0, $lcZyr$internationalizeddate.getLocalTimeZone)();
85
+ let final;
86
+ if ("start" in value && "end" in value) {
87
+ let start = value.start;
88
+ let end = value.end;
89
+ start = $2a7417c2df2197f7$var$convertDateTime(start, timeZone);
90
+ end = $2a7417c2df2197f7$var$convertDateTime(end, timeZone);
91
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($lcZyr$react))).createElement((0, ($parcel$interopDefault($lcZyr$react))).Fragment, null, dateFormatter.formatRange(start, end));
92
+ }
93
+ final = $2a7417c2df2197f7$var$convertDateTime(value, timeZone);
94
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($lcZyr$react))).createElement((0, ($parcel$interopDefault($lcZyr$react))).Fragment, null, dateFormatter.format(final));
95
+ }
96
+ function $2a7417c2df2197f7$var$convertDateTime(value, timeZone) {
97
+ if ("timeZone" in value) return value.toDate();
98
+ else if ("calendar" in value) return value.toDate(timeZone);
99
+ else if (!(value instanceof Date)) return $2a7417c2df2197f7$var$convertValue(value).toDate(timeZone);
100
+ return value;
101
+ }
102
+ function $2a7417c2df2197f7$var$getDefaultFormatOptions(value) {
103
+ if (value instanceof Date) return {
104
+ dateStyle: "long",
105
+ timeStyle: "short"
106
+ };
107
+ else if ("timeZone" in value) return {
108
+ year: "numeric",
109
+ month: "long",
110
+ day: "numeric",
111
+ hour: "numeric",
112
+ minute: "numeric",
113
+ timeZone: value.timeZone,
114
+ timeZoneName: "short"
115
+ };
116
+ else if ("hour" in value && "year" in value) return {
117
+ dateStyle: "long",
118
+ timeStyle: "short"
119
+ };
120
+ else if ("hour" in value) return {
121
+ timeStyle: "short"
122
+ };
123
+ else return {
124
+ dateStyle: "long"
125
+ };
126
+ }
127
+ function $2a7417c2df2197f7$var$convertValue(value) {
128
+ let date = (0, $lcZyr$internationalizeddate.today)((0, $lcZyr$internationalizeddate.getLocalTimeZone)());
129
+ return (0, $lcZyr$internationalizeddate.toCalendarDateTime)(date, value);
130
+ }
131
+ /**
132
+ * A LabeledValue displays a non-editable value with a label. It formats numbers, dates, times, and lists according to the user's locale.
133
+ */ let $2a7417c2df2197f7$export$d1328f67a56fa517 = /*#__PURE__*/ (0, ($parcel$interopDefault($lcZyr$react))).forwardRef($2a7417c2df2197f7$var$LabeledValue);
134
+
135
+
136
+ //# sourceMappingURL=LabeledValue.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AA4DD,SAAS,mCAAkD,KAAmC,EAAE,GAAwB;IACtH,IAAI,SACF,KAAK,iBACL,aAAa,EACd,GAAG;IACJ,IAAI,SAAS,CAAA,GAAA,mCAAQ,EAAE;IAEvB,IAAI;IACJ,IAAI,MAAM,OAAO,CAAC,QAChB,yBAAW,0DAAC;QAAoB,OAAO;QAAO,eAAe;;IAG/D,IAAI,OAAO,UAAU,YAAY,WAAW,SAAS,OAAO,MAAM,KAAK,KAAK,YAAY,OAAO,MAAM,GAAG,KAAK,UAC3G,yBAAW,0DAAC;QAAgB,OAAO;QAAsB,eAA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.\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 {CalendarDate, CalendarDateTime, getLocalTimeZone, Time, toCalendarDateTime, today, ZonedDateTime} from '@internationalized/date';\nimport {classNames, useDOMRef} from '@react-spectrum/utils';\nimport type {DOMProps, DOMRef, RangeValue, SpectrumLabelableProps, StyleProps} from '@react-types/shared';\nimport {Field} from '@react-spectrum/label';\nimport {filterDOMProps} from '@react-aria/utils';\nimport labelStyles from '@adobe/spectrum-css-temp/components/fieldlabel/vars.css';\nimport React, {ReactNode} from 'react';\nimport {useDateFormatter, useListFormatter, useNumberFormatter} from '@react-aria/i18n';\n\n// NOTE: the types here need to be synchronized with the ones in docs/types.ts, which are simpler so the documentation generator can handle them.\n\nexport interface LabeledValueBaseProps extends DOMProps, StyleProps, Omit<SpectrumLabelableProps, 'necessityIndicator' | 'isRequired'>, DOMProps {\n /** The content to display as the label. */\n label: ReactNode\n}\n\ntype NumberValue = number | RangeValue<number>;\ninterface NumberProps<T extends NumberValue> {\n /** The value to display. */\n value: T,\n /** Formatting options for the value. */\n formatOptions?: Intl.NumberFormatOptions\n}\n\nexport type DateTime = Date | CalendarDate | CalendarDateTime | ZonedDateTime | Time;\ntype RangeDateTime = RangeValue<DateTime>;\ntype DateTimeValue = DateTime | RangeDateTime;\ninterface DateProps<T extends DateTimeValue> {\n /** The value to display. */\n value: T,\n /** Formatting options for the value. */\n formatOptions?: Intl.DateTimeFormatOptions\n}\n\ninterface StringProps<T extends string> {\n /** The value to display. */\n value: T,\n /** Formatting options for the value. */\n formatOptions?: never\n}\n\ninterface StringListProps<T extends string[]> {\n /** The value to display. */\n value: T,\n /** Formatting options for the value. */\n formatOptions?: Intl.ListFormatOptions\n}\n\ntype LabeledValueProps<T> =\n T extends NumberValue ? NumberProps<T> :\n T extends DateTimeValue ? DateProps<T> :\n T extends string[] ? StringListProps<T> :\n T extends string ? StringProps<T> :\n never;\n\ntype SpectrumLabeledValueTypes = string[] | string | Date | CalendarDate | CalendarDateTime | ZonedDateTime | Time | number | RangeValue<number> | RangeValue<DateTime>;\nexport type SpectrumLabeledValueProps<T> = LabeledValueProps<T> & LabeledValueBaseProps;\n\nfunction LabeledValue<T extends SpectrumLabeledValueTypes>(props: SpectrumLabeledValueProps<T>, ref: DOMRef<HTMLElement>) {\n let {\n value,\n formatOptions\n } = props;\n let domRef = useDOMRef(ref);\n\n let children;\n if (Array.isArray(value)) {\n children = <FormattedStringList value={value} formatOptions={formatOptions as Intl.ListFormatOptions} />;\n }\n\n if (typeof value === 'object' && 'start' in value && typeof value.start === 'number' && typeof value.end === 'number') {\n children = <FormattedNumber value={value as NumberValue} formatOptions={formatOptions as Intl.NumberFormatOptions} />;\n }\n\n if (typeof value === 'object' && 'start' in value && typeof value.start !== 'number' && typeof value.end !== 'number') {\n children = <FormattedDate value={value as DateTimeValue} formatOptions={formatOptions as Intl.DateTimeFormatOptions} />;\n }\n\n if (typeof value === 'number') {\n children = <FormattedNumber value={value} formatOptions={formatOptions as Intl.NumberFormatOptions} />;\n }\n\n if (typeof value === 'object' && ('calendar' in value || 'hour' in value) || (value instanceof Date)) {\n children = <FormattedDate value={value} formatOptions={formatOptions as Intl.DateTimeFormatOptions} />;\n }\n\n if (typeof value === 'string') {\n children = value;\n }\n\n return (\n <Field {...props as any} wrapperProps={filterDOMProps(props as any)} ref={domRef} elementType=\"span\" wrapperClassName={classNames(labelStyles, 'spectrum-LabeledValue')}>\n <span>{children}</span>\n </Field>\n );\n}\n\nfunction FormattedStringList<T extends string[]>(props: StringListProps<T>) {\n let stringFormatter = useListFormatter(props.formatOptions);\n\n return (\n <>{stringFormatter.format(props.value)}</>\n );\n}\n\nfunction FormattedNumber<T extends NumberValue>(props: NumberProps<T>) {\n let numberFormatter = useNumberFormatter(props.formatOptions);\n let value = props.value;\n\n if (typeof value === 'object') {\n return <>{numberFormatter.formatRange(value.start, value.end)}</>;\n }\n\n return <>{numberFormatter.format(value)}</>;\n}\n\nfunction FormattedDate<T extends DateTimeValue>(props: DateProps<T>) {\n let {value, formatOptions} = props;\n if (!formatOptions) {\n formatOptions = getDefaultFormatOptions('start' in value ? value.start : value);\n }\n\n let dateFormatter = useDateFormatter(formatOptions);\n let timeZone = dateFormatter.resolvedOptions().timeZone || getLocalTimeZone();\n let final: Date;\n\n if ('start' in value && 'end' in value) {\n let start = value.start;\n let end = value.end;\n\n start = convertDateTime(start, timeZone);\n end = convertDateTime(end, timeZone);\n\n return <>{dateFormatter.formatRange(start, end)}</>;\n }\n\n final = convertDateTime(value, timeZone);\n return <>{dateFormatter.format(final)}</>;\n}\n\nfunction convertDateTime(value: DateTime, timeZone: any) {\n if ('timeZone' in value) {\n return value.toDate();\n } else if ('calendar' in value) {\n return value.toDate(timeZone);\n } else if (!(value instanceof Date)) {\n return convertValue(value).toDate(timeZone);\n }\n\n return value;\n}\n\nfunction getDefaultFormatOptions(value: DateTime): Intl.DateTimeFormatOptions {\n if (value instanceof Date) {\n return {dateStyle: 'long', timeStyle: 'short'};\n } else if ('timeZone' in value) {\n return {year: 'numeric', month: 'long', day: 'numeric', hour: 'numeric', minute: 'numeric', timeZone: value.timeZone, timeZoneName: 'short'};\n } else if ('hour' in value && 'year' in value) {\n return {dateStyle: 'long', timeStyle: 'short'};\n } else if ('hour' in value) {\n return {timeStyle: 'short'};\n } else {\n return {dateStyle: 'long'};\n }\n}\n\nfunction convertValue(value: Time) {\n let date = today(getLocalTimeZone());\n\n return toCalendarDateTime(date, value);\n}\n\n/**\n * A LabeledValue displays a non-editable value with a label. It formats numbers, dates, times, and lists according to the user's locale.\n */\nlet _LabeledValue = React.forwardRef(LabeledValue);\nexport {_LabeledValue as LabeledValue};\n"],"names":[],"version":3,"file":"LabeledValue.main.js.map"}
@@ -0,0 +1,131 @@
1
+ import "./vars.0e5b9e64.css";
2
+ import $fhlTD$fieldlabel_vars_cssmodulejs from "./fieldlabel_vars_css.mjs";
3
+ import {getLocalTimeZone as $fhlTD$getLocalTimeZone, today as $fhlTD$today, toCalendarDateTime as $fhlTD$toCalendarDateTime} from "@internationalized/date";
4
+ import {useDOMRef as $fhlTD$useDOMRef, classNames as $fhlTD$classNames} from "@react-spectrum/utils";
5
+ import {Field as $fhlTD$Field} from "@react-spectrum/label";
6
+ import {filterDOMProps as $fhlTD$filterDOMProps} from "@react-aria/utils";
7
+ import $fhlTD$react from "react";
8
+ import {useListFormatter as $fhlTD$useListFormatter, useNumberFormatter as $fhlTD$useNumberFormatter, useDateFormatter as $fhlTD$useDateFormatter} from "@react-aria/i18n";
9
+
10
+
11
+ function $parcel$interopDefault(a) {
12
+ return a && a.__esModule ? a.default : a;
13
+ }
14
+ /*
15
+ * Copyright 2020 Adobe. All rights reserved.
16
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
17
+ * you may not use this file except in compliance with the License. You may obtain a copy
18
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
19
+ *
20
+ * Unless required by applicable law or agreed to in writing, software distributed under
21
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
22
+ * OF ANY KIND, either express or implied. See the License for the specific language
23
+ * governing permissions and limitations under the License.
24
+ */
25
+
26
+
27
+
28
+
29
+
30
+
31
+ function $3e9971be431adb24$var$LabeledValue(props, ref) {
32
+ let { value: value, formatOptions: formatOptions } = props;
33
+ let domRef = (0, $fhlTD$useDOMRef)(ref);
34
+ let children;
35
+ if (Array.isArray(value)) children = /*#__PURE__*/ (0, $fhlTD$react).createElement($3e9971be431adb24$var$FormattedStringList, {
36
+ value: value,
37
+ formatOptions: formatOptions
38
+ });
39
+ if (typeof value === "object" && "start" in value && typeof value.start === "number" && typeof value.end === "number") children = /*#__PURE__*/ (0, $fhlTD$react).createElement($3e9971be431adb24$var$FormattedNumber, {
40
+ value: value,
41
+ formatOptions: formatOptions
42
+ });
43
+ if (typeof value === "object" && "start" in value && typeof value.start !== "number" && typeof value.end !== "number") children = /*#__PURE__*/ (0, $fhlTD$react).createElement($3e9971be431adb24$var$FormattedDate, {
44
+ value: value,
45
+ formatOptions: formatOptions
46
+ });
47
+ if (typeof value === "number") children = /*#__PURE__*/ (0, $fhlTD$react).createElement($3e9971be431adb24$var$FormattedNumber, {
48
+ value: value,
49
+ formatOptions: formatOptions
50
+ });
51
+ if (typeof value === "object" && ("calendar" in value || "hour" in value) || value instanceof Date) children = /*#__PURE__*/ (0, $fhlTD$react).createElement($3e9971be431adb24$var$FormattedDate, {
52
+ value: value,
53
+ formatOptions: formatOptions
54
+ });
55
+ if (typeof value === "string") children = value;
56
+ return /*#__PURE__*/ (0, $fhlTD$react).createElement((0, $fhlTD$Field), {
57
+ ...props,
58
+ wrapperProps: (0, $fhlTD$filterDOMProps)(props),
59
+ ref: domRef,
60
+ elementType: "span",
61
+ wrapperClassName: (0, $fhlTD$classNames)((0, ($parcel$interopDefault($fhlTD$fieldlabel_vars_cssmodulejs))), "spectrum-LabeledValue")
62
+ }, /*#__PURE__*/ (0, $fhlTD$react).createElement("span", null, children));
63
+ }
64
+ function $3e9971be431adb24$var$FormattedStringList(props) {
65
+ let stringFormatter = (0, $fhlTD$useListFormatter)(props.formatOptions);
66
+ return /*#__PURE__*/ (0, $fhlTD$react).createElement((0, $fhlTD$react).Fragment, null, stringFormatter.format(props.value));
67
+ }
68
+ function $3e9971be431adb24$var$FormattedNumber(props) {
69
+ let numberFormatter = (0, $fhlTD$useNumberFormatter)(props.formatOptions);
70
+ let value = props.value;
71
+ if (typeof value === "object") return /*#__PURE__*/ (0, $fhlTD$react).createElement((0, $fhlTD$react).Fragment, null, numberFormatter.formatRange(value.start, value.end));
72
+ return /*#__PURE__*/ (0, $fhlTD$react).createElement((0, $fhlTD$react).Fragment, null, numberFormatter.format(value));
73
+ }
74
+ function $3e9971be431adb24$var$FormattedDate(props) {
75
+ let { value: value, formatOptions: formatOptions } = props;
76
+ if (!formatOptions) formatOptions = $3e9971be431adb24$var$getDefaultFormatOptions("start" in value ? value.start : value);
77
+ let dateFormatter = (0, $fhlTD$useDateFormatter)(formatOptions);
78
+ let timeZone = dateFormatter.resolvedOptions().timeZone || (0, $fhlTD$getLocalTimeZone)();
79
+ let final;
80
+ if ("start" in value && "end" in value) {
81
+ let start = value.start;
82
+ let end = value.end;
83
+ start = $3e9971be431adb24$var$convertDateTime(start, timeZone);
84
+ end = $3e9971be431adb24$var$convertDateTime(end, timeZone);
85
+ return /*#__PURE__*/ (0, $fhlTD$react).createElement((0, $fhlTD$react).Fragment, null, dateFormatter.formatRange(start, end));
86
+ }
87
+ final = $3e9971be431adb24$var$convertDateTime(value, timeZone);
88
+ return /*#__PURE__*/ (0, $fhlTD$react).createElement((0, $fhlTD$react).Fragment, null, dateFormatter.format(final));
89
+ }
90
+ function $3e9971be431adb24$var$convertDateTime(value, timeZone) {
91
+ if ("timeZone" in value) return value.toDate();
92
+ else if ("calendar" in value) return value.toDate(timeZone);
93
+ else if (!(value instanceof Date)) return $3e9971be431adb24$var$convertValue(value).toDate(timeZone);
94
+ return value;
95
+ }
96
+ function $3e9971be431adb24$var$getDefaultFormatOptions(value) {
97
+ if (value instanceof Date) return {
98
+ dateStyle: "long",
99
+ timeStyle: "short"
100
+ };
101
+ else if ("timeZone" in value) return {
102
+ year: "numeric",
103
+ month: "long",
104
+ day: "numeric",
105
+ hour: "numeric",
106
+ minute: "numeric",
107
+ timeZone: value.timeZone,
108
+ timeZoneName: "short"
109
+ };
110
+ else if ("hour" in value && "year" in value) return {
111
+ dateStyle: "long",
112
+ timeStyle: "short"
113
+ };
114
+ else if ("hour" in value) return {
115
+ timeStyle: "short"
116
+ };
117
+ else return {
118
+ dateStyle: "long"
119
+ };
120
+ }
121
+ function $3e9971be431adb24$var$convertValue(value) {
122
+ let date = (0, $fhlTD$today)((0, $fhlTD$getLocalTimeZone)());
123
+ return (0, $fhlTD$toCalendarDateTime)(date, value);
124
+ }
125
+ /**
126
+ * A LabeledValue displays a non-editable value with a label. It formats numbers, dates, times, and lists according to the user's locale.
127
+ */ let $3e9971be431adb24$export$d1328f67a56fa517 = /*#__PURE__*/ (0, $fhlTD$react).forwardRef($3e9971be431adb24$var$LabeledValue);
128
+
129
+
130
+ export {$3e9971be431adb24$export$d1328f67a56fa517 as LabeledValue};
131
+ //# sourceMappingURL=LabeledValue.mjs.map
@@ -0,0 +1,131 @@
1
+ import "./vars.0e5b9e64.css";
2
+ import $fhlTD$fieldlabel_vars_cssmodulejs from "./fieldlabel_vars_css.module.js";
3
+ import {getLocalTimeZone as $fhlTD$getLocalTimeZone, today as $fhlTD$today, toCalendarDateTime as $fhlTD$toCalendarDateTime} from "@internationalized/date";
4
+ import {useDOMRef as $fhlTD$useDOMRef, classNames as $fhlTD$classNames} from "@react-spectrum/utils";
5
+ import {Field as $fhlTD$Field} from "@react-spectrum/label";
6
+ import {filterDOMProps as $fhlTD$filterDOMProps} from "@react-aria/utils";
7
+ import $fhlTD$react from "react";
8
+ import {useListFormatter as $fhlTD$useListFormatter, useNumberFormatter as $fhlTD$useNumberFormatter, useDateFormatter as $fhlTD$useDateFormatter} from "@react-aria/i18n";
9
+
10
+
11
+ function $parcel$interopDefault(a) {
12
+ return a && a.__esModule ? a.default : a;
13
+ }
14
+ /*
15
+ * Copyright 2020 Adobe. All rights reserved.
16
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
17
+ * you may not use this file except in compliance with the License. You may obtain a copy
18
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
19
+ *
20
+ * Unless required by applicable law or agreed to in writing, software distributed under
21
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
22
+ * OF ANY KIND, either express or implied. See the License for the specific language
23
+ * governing permissions and limitations under the License.
24
+ */
25
+
26
+
27
+
28
+
29
+
30
+
31
+ function $3e9971be431adb24$var$LabeledValue(props, ref) {
32
+ let { value: value, formatOptions: formatOptions } = props;
33
+ let domRef = (0, $fhlTD$useDOMRef)(ref);
34
+ let children;
35
+ if (Array.isArray(value)) children = /*#__PURE__*/ (0, $fhlTD$react).createElement($3e9971be431adb24$var$FormattedStringList, {
36
+ value: value,
37
+ formatOptions: formatOptions
38
+ });
39
+ if (typeof value === "object" && "start" in value && typeof value.start === "number" && typeof value.end === "number") children = /*#__PURE__*/ (0, $fhlTD$react).createElement($3e9971be431adb24$var$FormattedNumber, {
40
+ value: value,
41
+ formatOptions: formatOptions
42
+ });
43
+ if (typeof value === "object" && "start" in value && typeof value.start !== "number" && typeof value.end !== "number") children = /*#__PURE__*/ (0, $fhlTD$react).createElement($3e9971be431adb24$var$FormattedDate, {
44
+ value: value,
45
+ formatOptions: formatOptions
46
+ });
47
+ if (typeof value === "number") children = /*#__PURE__*/ (0, $fhlTD$react).createElement($3e9971be431adb24$var$FormattedNumber, {
48
+ value: value,
49
+ formatOptions: formatOptions
50
+ });
51
+ if (typeof value === "object" && ("calendar" in value || "hour" in value) || value instanceof Date) children = /*#__PURE__*/ (0, $fhlTD$react).createElement($3e9971be431adb24$var$FormattedDate, {
52
+ value: value,
53
+ formatOptions: formatOptions
54
+ });
55
+ if (typeof value === "string") children = value;
56
+ return /*#__PURE__*/ (0, $fhlTD$react).createElement((0, $fhlTD$Field), {
57
+ ...props,
58
+ wrapperProps: (0, $fhlTD$filterDOMProps)(props),
59
+ ref: domRef,
60
+ elementType: "span",
61
+ wrapperClassName: (0, $fhlTD$classNames)((0, ($parcel$interopDefault($fhlTD$fieldlabel_vars_cssmodulejs))), "spectrum-LabeledValue")
62
+ }, /*#__PURE__*/ (0, $fhlTD$react).createElement("span", null, children));
63
+ }
64
+ function $3e9971be431adb24$var$FormattedStringList(props) {
65
+ let stringFormatter = (0, $fhlTD$useListFormatter)(props.formatOptions);
66
+ return /*#__PURE__*/ (0, $fhlTD$react).createElement((0, $fhlTD$react).Fragment, null, stringFormatter.format(props.value));
67
+ }
68
+ function $3e9971be431adb24$var$FormattedNumber(props) {
69
+ let numberFormatter = (0, $fhlTD$useNumberFormatter)(props.formatOptions);
70
+ let value = props.value;
71
+ if (typeof value === "object") return /*#__PURE__*/ (0, $fhlTD$react).createElement((0, $fhlTD$react).Fragment, null, numberFormatter.formatRange(value.start, value.end));
72
+ return /*#__PURE__*/ (0, $fhlTD$react).createElement((0, $fhlTD$react).Fragment, null, numberFormatter.format(value));
73
+ }
74
+ function $3e9971be431adb24$var$FormattedDate(props) {
75
+ let { value: value, formatOptions: formatOptions } = props;
76
+ if (!formatOptions) formatOptions = $3e9971be431adb24$var$getDefaultFormatOptions("start" in value ? value.start : value);
77
+ let dateFormatter = (0, $fhlTD$useDateFormatter)(formatOptions);
78
+ let timeZone = dateFormatter.resolvedOptions().timeZone || (0, $fhlTD$getLocalTimeZone)();
79
+ let final;
80
+ if ("start" in value && "end" in value) {
81
+ let start = value.start;
82
+ let end = value.end;
83
+ start = $3e9971be431adb24$var$convertDateTime(start, timeZone);
84
+ end = $3e9971be431adb24$var$convertDateTime(end, timeZone);
85
+ return /*#__PURE__*/ (0, $fhlTD$react).createElement((0, $fhlTD$react).Fragment, null, dateFormatter.formatRange(start, end));
86
+ }
87
+ final = $3e9971be431adb24$var$convertDateTime(value, timeZone);
88
+ return /*#__PURE__*/ (0, $fhlTD$react).createElement((0, $fhlTD$react).Fragment, null, dateFormatter.format(final));
89
+ }
90
+ function $3e9971be431adb24$var$convertDateTime(value, timeZone) {
91
+ if ("timeZone" in value) return value.toDate();
92
+ else if ("calendar" in value) return value.toDate(timeZone);
93
+ else if (!(value instanceof Date)) return $3e9971be431adb24$var$convertValue(value).toDate(timeZone);
94
+ return value;
95
+ }
96
+ function $3e9971be431adb24$var$getDefaultFormatOptions(value) {
97
+ if (value instanceof Date) return {
98
+ dateStyle: "long",
99
+ timeStyle: "short"
100
+ };
101
+ else if ("timeZone" in value) return {
102
+ year: "numeric",
103
+ month: "long",
104
+ day: "numeric",
105
+ hour: "numeric",
106
+ minute: "numeric",
107
+ timeZone: value.timeZone,
108
+ timeZoneName: "short"
109
+ };
110
+ else if ("hour" in value && "year" in value) return {
111
+ dateStyle: "long",
112
+ timeStyle: "short"
113
+ };
114
+ else if ("hour" in value) return {
115
+ timeStyle: "short"
116
+ };
117
+ else return {
118
+ dateStyle: "long"
119
+ };
120
+ }
121
+ function $3e9971be431adb24$var$convertValue(value) {
122
+ let date = (0, $fhlTD$today)((0, $fhlTD$getLocalTimeZone)());
123
+ return (0, $fhlTD$toCalendarDateTime)(date, value);
124
+ }
125
+ /**
126
+ * A LabeledValue displays a non-editable value with a label. It formats numbers, dates, times, and lists according to the user's locale.
127
+ */ let $3e9971be431adb24$export$d1328f67a56fa517 = /*#__PURE__*/ (0, $fhlTD$react).forwardRef($3e9971be431adb24$var$LabeledValue);
128
+
129
+
130
+ export {$3e9971be431adb24$export$d1328f67a56fa517 as LabeledValue};
131
+ //# sourceMappingURL=LabeledValue.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AA4DD,SAAS,mCAAkD,KAAmC,EAAE,GAAwB;IACtH,IAAI,SACF,KAAK,iBACL,aAAa,EACd,GAAG;IACJ,IAAI,SAAS,CAAA,GAAA,gBAAQ,EAAE;IAEvB,IAAI;IACJ,IAAI,MAAM,OAAO,CAAC,QAChB,yBAAW,gCAAC;QAAoB,OAAO;QAAO,eAAe;;IAG/D,IAAI,OAAO,UAAU,YAAY,WAAW,SAAS,OAAO,MAAM,KAAK,KAAK,YAAY,OAAO,MAAM,GAAG,KAAK,UAC3G,yBAAW,gCAAC;QAAgB,OAAO;QAAsB,eAAe;;IAG1E,IAAI,OAAO,UAAU,YAAY,WAAW,SAAS,OAAO,MAAM,KAAK,KAAK,YAAY,OAAO,MAAM,GAAG,KAAK,UAC3G,yBAAW,gCAAC;QAAc,OA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M,MAAM,GAAG;QAEnB,QAAQ,sCAAgB,OAAO;QAC/B,MAAM,sCAAgB,KAAK;QAE3B,qBAAO,kEAAG,cAAc,WAAW,CAAC,OAAO;IAC7C;IAEA,QAAQ,sCAAgB,OAAO;IAC/B,qBAAO,kEAAG,cAAc,MAAM,CAAC;AACjC;AAEA,SAAS,sCAAgB,KAAe,EAAE,QAAa;IACrD,IAAI,cAAc,OAChB,OAAO,MAAM,MAAM;SACd,IAAI,cAAc,OACvB,OAAO,MAAM,MAAM,CAAC;SACf,IAAI,CAAE,CAAA,iBAAiB,IAAG,GAC/B,OAAO,mCAAa,OAAO,MAAM,CAAC;IAGpC,OAAO;AACT;AAEA,SAAS,8CAAwB,KAAe;IAC9C,IAAI,iBAAiB,MACnB,OAAO;QAAC,WAAW;QAAQ,WAAW;IAAO;SACxC,IAAI,cAAc,OACvB,OAAO;QAAC,MAAM;QAAW,OAAO;QAAQ,KAAK;QAAW,MAAM;QAAW,QAAQ;QAAW,UAAU,MAAM,QAAQ;QAAE,cAAc;IAAO;SACtI,IAAI,UAAU,SAAS,UAAU,OACtC,OAAO;QAAC,WAAW;QAAQ,WAAW;IAAO;SACxC,IAAI,UAAU,OACnB,OAAO;QAAC,WAAW;IAAO;SAE1B,OAAO;QAAC,WAAW;IAAM;AAE7B;AAEA,SAAS,mCAAa,KAAW;IAC/B,IAAI,OAAO,CAAA,GAAA,YAAI,EAAE,CAAA,GAAA,uBAAe;IAEhC,OAAO,CAAA,GAAA,yBAAiB,EAAE,MAAM;AAClC;AAEA;;CAEC,GACD,IAAI,0DAAgB,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/labeledvalue/src/LabeledValue.tsx"],"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 {CalendarDate, CalendarDateTime, getLocalTimeZone, Time, toCalendarDateTime, today, ZonedDateTime} from '@internationalized/date';\nimport {classNames, useDOMRef} from '@react-spectrum/utils';\nimport type {DOMProps, DOMRef, RangeValue, SpectrumLabelableProps, StyleProps} from '@react-types/shared';\nimport {Field} from '@react-spectrum/label';\nimport {filterDOMProps} from '@react-aria/utils';\nimport labelStyles from '@adobe/spectrum-css-temp/components/fieldlabel/vars.css';\nimport React, {ReactNode} from 'react';\nimport {useDateFormatter, useListFormatter, useNumberFormatter} from '@react-aria/i18n';\n\n// NOTE: the types here need to be synchronized with the ones in docs/types.ts, which are simpler so the documentation generator can handle them.\n\nexport interface LabeledValueBaseProps extends DOMProps, StyleProps, Omit<SpectrumLabelableProps, 'necessityIndicator' | 'isRequired'>, DOMProps {\n /** The content to display as the label. */\n label: ReactNode\n}\n\ntype NumberValue = number | RangeValue<number>;\ninterface NumberProps<T extends NumberValue> {\n /** The value to display. */\n value: T,\n /** Formatting options for the value. */\n formatOptions?: Intl.NumberFormatOptions\n}\n\nexport type DateTime = Date | CalendarDate | CalendarDateTime | ZonedDateTime | Time;\ntype RangeDateTime = RangeValue<DateTime>;\ntype DateTimeValue = DateTime | RangeDateTime;\ninterface DateProps<T extends DateTimeValue> {\n /** The value to display. */\n value: T,\n /** Formatting options for the value. */\n formatOptions?: Intl.DateTimeFormatOptions\n}\n\ninterface StringProps<T extends string> {\n /** The value to display. */\n value: T,\n /** Formatting options for the value. */\n formatOptions?: never\n}\n\ninterface StringListProps<T extends string[]> {\n /** The value to display. */\n value: T,\n /** Formatting options for the value. */\n formatOptions?: Intl.ListFormatOptions\n}\n\ntype LabeledValueProps<T> =\n T extends NumberValue ? NumberProps<T> :\n T extends DateTimeValue ? DateProps<T> :\n T extends string[] ? StringListProps<T> :\n T extends string ? StringProps<T> :\n never;\n\ntype SpectrumLabeledValueTypes = string[] | string | Date | CalendarDate | CalendarDateTime | ZonedDateTime | Time | number | RangeValue<number> | RangeValue<DateTime>;\nexport type SpectrumLabeledValueProps<T> = LabeledValueProps<T> & LabeledValueBaseProps;\n\nfunction LabeledValue<T extends SpectrumLabeledValueTypes>(props: SpectrumLabeledValueProps<T>, ref: DOMRef<HTMLElement>) {\n let {\n value,\n formatOptions\n } = props;\n let domRef = useDOMRef(ref);\n\n let children;\n if (Array.isArray(value)) {\n children = <FormattedStringList value={value} formatOptions={formatOptions as Intl.ListFormatOptions} />;\n }\n\n if (typeof value === 'object' && 'start' in value && typeof value.start === 'number' && typeof value.end === 'number') {\n children = <FormattedNumber value={value as NumberValue} formatOptions={formatOptions as Intl.NumberFormatOptions} />;\n }\n\n if (typeof value === 'object' && 'start' in value && typeof value.start !== 'number' && typeof value.end !== 'number') {\n children = <FormattedDate value={value as DateTimeValue} formatOptions={formatOptions as Intl.DateTimeFormatOptions} />;\n }\n\n if (typeof value === 'number') {\n children = <FormattedNumber value={value} formatOptions={formatOptions as Intl.NumberFormatOptions} />;\n }\n\n if (typeof value === 'object' && ('calendar' in value || 'hour' in value) || (value instanceof Date)) {\n children = <FormattedDate value={value} formatOptions={formatOptions as Intl.DateTimeFormatOptions} />;\n }\n\n if (typeof value === 'string') {\n children = value;\n }\n\n return (\n <Field {...props as any} wrapperProps={filterDOMProps(props as any)} ref={domRef} elementType=\"span\" wrapperClassName={classNames(labelStyles, 'spectrum-LabeledValue')}>\n <span>{children}</span>\n </Field>\n );\n}\n\nfunction FormattedStringList<T extends string[]>(props: StringListProps<T>) {\n let stringFormatter = useListFormatter(props.formatOptions);\n\n return (\n <>{stringFormatter.format(props.value)}</>\n );\n}\n\nfunction FormattedNumber<T extends NumberValue>(props: NumberProps<T>) {\n let numberFormatter = useNumberFormatter(props.formatOptions);\n let value = props.value;\n\n if (typeof value === 'object') {\n return <>{numberFormatter.formatRange(value.start, value.end)}</>;\n }\n\n return <>{numberFormatter.format(value)}</>;\n}\n\nfunction FormattedDate<T extends DateTimeValue>(props: DateProps<T>) {\n let {value, formatOptions} = props;\n if (!formatOptions) {\n formatOptions = getDefaultFormatOptions('start' in value ? value.start : value);\n }\n\n let dateFormatter = useDateFormatter(formatOptions);\n let timeZone = dateFormatter.resolvedOptions().timeZone || getLocalTimeZone();\n let final: Date;\n\n if ('start' in value && 'end' in value) {\n let start = value.start;\n let end = value.end;\n\n start = convertDateTime(start, timeZone);\n end = convertDateTime(end, timeZone);\n\n return <>{dateFormatter.formatRange(start, end)}</>;\n }\n\n final = convertDateTime(value, timeZone);\n return <>{dateFormatter.format(final)}</>;\n}\n\nfunction convertDateTime(value: DateTime, timeZone: any) {\n if ('timeZone' in value) {\n return value.toDate();\n } else if ('calendar' in value) {\n return value.toDate(timeZone);\n } else if (!(value instanceof Date)) {\n return convertValue(value).toDate(timeZone);\n }\n\n return value;\n}\n\nfunction getDefaultFormatOptions(value: DateTime): Intl.DateTimeFormatOptions {\n if (value instanceof Date) {\n return {dateStyle: 'long', timeStyle: 'short'};\n } else if ('timeZone' in value) {\n return {year: 'numeric', month: 'long', day: 'numeric', hour: 'numeric', minute: 'numeric', timeZone: value.timeZone, timeZoneName: 'short'};\n } else if ('hour' in value && 'year' in value) {\n return {dateStyle: 'long', timeStyle: 'short'};\n } else if ('hour' in value) {\n return {timeStyle: 'short'};\n } else {\n return {dateStyle: 'long'};\n }\n}\n\nfunction convertValue(value: Time) {\n let date = today(getLocalTimeZone());\n\n return toCalendarDateTime(date, value);\n}\n\n/**\n * A LabeledValue displays a non-editable value with a label. It formats numbers, dates, times, and lists according to the user's locale.\n */\nlet _LabeledValue = React.forwardRef(LabeledValue);\nexport {_LabeledValue as LabeledValue};\n"],"names":[],"version":3,"file":"LabeledValue.module.js.map"}
@@ -0,0 +1,95 @@
1
+
2
+ function $parcel$export(e, n, v, s) {
3
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
4
+ }
5
+
6
+ $parcel$export(module.exports, "contextualHelp", () => $eb2fc0ee655eff6b$export$4ba534aba1836d, (v) => $eb2fc0ee655eff6b$export$4ba534aba1836d = v);
7
+ $parcel$export(module.exports, "field", () => $eb2fc0ee655eff6b$export$e0f35d825088c098, (v) => $eb2fc0ee655eff6b$export$e0f35d825088c098 = v);
8
+ $parcel$export(module.exports, "focus-ring", () => $eb2fc0ee655eff6b$export$f39a09f249340e2a, (v) => $eb2fc0ee655eff6b$export$f39a09f249340e2a = v);
9
+ $parcel$export(module.exports, "helpText", () => $eb2fc0ee655eff6b$export$431a3b688422af44, (v) => $eb2fc0ee655eff6b$export$431a3b688422af44 = v);
10
+ $parcel$export(module.exports, "i18nFontFamily", () => $eb2fc0ee655eff6b$export$8c4ee2c50c22c514, (v) => $eb2fc0ee655eff6b$export$8c4ee2c50c22c514 = v);
11
+ $parcel$export(module.exports, "is-disabled", () => $eb2fc0ee655eff6b$export$d35bc1e505d1ebbf, (v) => $eb2fc0ee655eff6b$export$d35bc1e505d1ebbf = v);
12
+ $parcel$export(module.exports, "label", () => $eb2fc0ee655eff6b$export$1237798dc640739a, (v) => $eb2fc0ee655eff6b$export$1237798dc640739a = v);
13
+ $parcel$export(module.exports, "spectrum-Field", () => $eb2fc0ee655eff6b$export$f6d480ae1e56eba0, (v) => $eb2fc0ee655eff6b$export$f6d480ae1e56eba0 = v);
14
+ $parcel$export(module.exports, "spectrum-Field--alignEnd", () => $eb2fc0ee655eff6b$export$5354c9be7ada5f83, (v) => $eb2fc0ee655eff6b$export$5354c9be7ada5f83 = v);
15
+ $parcel$export(module.exports, "spectrum-Field--hasContextualHelp", () => $eb2fc0ee655eff6b$export$9ba23707a252cdd4, (v) => $eb2fc0ee655eff6b$export$9ba23707a252cdd4 = v);
16
+ $parcel$export(module.exports, "spectrum-Field--positionSide", () => $eb2fc0ee655eff6b$export$2963225c91179589, (v) => $eb2fc0ee655eff6b$export$2963225c91179589 = v);
17
+ $parcel$export(module.exports, "spectrum-Field--positionTop", () => $eb2fc0ee655eff6b$export$a4ea780a9064d7f9, (v) => $eb2fc0ee655eff6b$export$a4ea780a9064d7f9 = v);
18
+ $parcel$export(module.exports, "spectrum-Field-contextualHelp", () => $eb2fc0ee655eff6b$export$24fb860d16dd2d3f, (v) => $eb2fc0ee655eff6b$export$24fb860d16dd2d3f = v);
19
+ $parcel$export(module.exports, "spectrum-Field-field", () => $eb2fc0ee655eff6b$export$3ab8a3dc7f0563d, (v) => $eb2fc0ee655eff6b$export$3ab8a3dc7f0563d = v);
20
+ $parcel$export(module.exports, "spectrum-Field-labelCell", () => $eb2fc0ee655eff6b$export$9cde5aecff012641, (v) => $eb2fc0ee655eff6b$export$9cde5aecff012641 = v);
21
+ $parcel$export(module.exports, "spectrum-Field-labelWrapper", () => $eb2fc0ee655eff6b$export$a872a8c78b26c9e0, (v) => $eb2fc0ee655eff6b$export$a872a8c78b26c9e0 = v);
22
+ $parcel$export(module.exports, "spectrum-Field-wrapper", () => $eb2fc0ee655eff6b$export$127df0b7290eb8ef, (v) => $eb2fc0ee655eff6b$export$127df0b7290eb8ef = v);
23
+ $parcel$export(module.exports, "spectrum-FieldLabel", () => $eb2fc0ee655eff6b$export$493d18e796ae054, (v) => $eb2fc0ee655eff6b$export$493d18e796ae054 = v);
24
+ $parcel$export(module.exports, "spectrum-FieldLabel--alignEnd", () => $eb2fc0ee655eff6b$export$885efcc08143a987, (v) => $eb2fc0ee655eff6b$export$885efcc08143a987 = v);
25
+ $parcel$export(module.exports, "spectrum-FieldLabel--positionSide", () => $eb2fc0ee655eff6b$export$9e6f19dc21f22f2e, (v) => $eb2fc0ee655eff6b$export$9e6f19dc21f22f2e = v);
26
+ $parcel$export(module.exports, "spectrum-FieldLabel-requiredIcon", () => $eb2fc0ee655eff6b$export$7c47642c7d46f3c9, (v) => $eb2fc0ee655eff6b$export$7c47642c7d46f3c9 = v);
27
+ $parcel$export(module.exports, "spectrum-FocusRing-ring", () => $eb2fc0ee655eff6b$export$4109102f950813a6, (v) => $eb2fc0ee655eff6b$export$4109102f950813a6 = v);
28
+ $parcel$export(module.exports, "spectrum-FocusRing", () => $eb2fc0ee655eff6b$export$24c7f46a6e3605dd, (v) => $eb2fc0ee655eff6b$export$24c7f46a6e3605dd = v);
29
+ $parcel$export(module.exports, "spectrum-FocusRing--quiet", () => $eb2fc0ee655eff6b$export$2927016961429360, (v) => $eb2fc0ee655eff6b$export$2927016961429360 = v);
30
+ $parcel$export(module.exports, "spectrum-Form", () => $eb2fc0ee655eff6b$export$94d2bcc94afabd89, (v) => $eb2fc0ee655eff6b$export$94d2bcc94afabd89 = v);
31
+ $parcel$export(module.exports, "spectrum-Form--positionSide", () => $eb2fc0ee655eff6b$export$7f44db659563c8f4, (v) => $eb2fc0ee655eff6b$export$7f44db659563c8f4 = v);
32
+ $parcel$export(module.exports, "spectrum-Form--positionTop", () => $eb2fc0ee655eff6b$export$11b8bc81fe551057, (v) => $eb2fc0ee655eff6b$export$11b8bc81fe551057 = v);
33
+ $parcel$export(module.exports, "spectrum-Form-itemLabel", () => $eb2fc0ee655eff6b$export$51ec27881a1e3928, (v) => $eb2fc0ee655eff6b$export$51ec27881a1e3928 = v);
34
+ $parcel$export(module.exports, "spectrum-LabeledValue", () => $eb2fc0ee655eff6b$export$79f9a5e9dd010c8d, (v) => $eb2fc0ee655eff6b$export$79f9a5e9dd010c8d = v);
35
+ var $eb2fc0ee655eff6b$export$4ba534aba1836d;
36
+ var $eb2fc0ee655eff6b$export$e0f35d825088c098;
37
+ var $eb2fc0ee655eff6b$export$f39a09f249340e2a;
38
+ var $eb2fc0ee655eff6b$export$431a3b688422af44;
39
+ var $eb2fc0ee655eff6b$export$8c4ee2c50c22c514;
40
+ var $eb2fc0ee655eff6b$export$d35bc1e505d1ebbf;
41
+ var $eb2fc0ee655eff6b$export$1237798dc640739a;
42
+ var $eb2fc0ee655eff6b$export$f6d480ae1e56eba0;
43
+ var $eb2fc0ee655eff6b$export$5354c9be7ada5f83;
44
+ var $eb2fc0ee655eff6b$export$9ba23707a252cdd4;
45
+ var $eb2fc0ee655eff6b$export$2963225c91179589;
46
+ var $eb2fc0ee655eff6b$export$a4ea780a9064d7f9;
47
+ var $eb2fc0ee655eff6b$export$24fb860d16dd2d3f;
48
+ var $eb2fc0ee655eff6b$export$3ab8a3dc7f0563d;
49
+ var $eb2fc0ee655eff6b$export$9cde5aecff012641;
50
+ var $eb2fc0ee655eff6b$export$a872a8c78b26c9e0;
51
+ var $eb2fc0ee655eff6b$export$127df0b7290eb8ef;
52
+ var $eb2fc0ee655eff6b$export$493d18e796ae054;
53
+ var $eb2fc0ee655eff6b$export$885efcc08143a987;
54
+ var $eb2fc0ee655eff6b$export$9e6f19dc21f22f2e;
55
+ var $eb2fc0ee655eff6b$export$7c47642c7d46f3c9;
56
+ var $eb2fc0ee655eff6b$export$4109102f950813a6;
57
+ var $eb2fc0ee655eff6b$export$24c7f46a6e3605dd;
58
+ var $eb2fc0ee655eff6b$export$2927016961429360;
59
+ var $eb2fc0ee655eff6b$export$94d2bcc94afabd89;
60
+ var $eb2fc0ee655eff6b$export$7f44db659563c8f4;
61
+ var $eb2fc0ee655eff6b$export$11b8bc81fe551057;
62
+ var $eb2fc0ee655eff6b$export$51ec27881a1e3928;
63
+ var $eb2fc0ee655eff6b$export$79f9a5e9dd010c8d;
64
+ $eb2fc0ee655eff6b$export$4ba534aba1836d = `A-HlBa_contextualHelp`;
65
+ $eb2fc0ee655eff6b$export$e0f35d825088c098 = `A-HlBa_field`;
66
+ $eb2fc0ee655eff6b$export$f39a09f249340e2a = `A-HlBa_focus-ring`;
67
+ $eb2fc0ee655eff6b$export$431a3b688422af44 = `A-HlBa_helpText`;
68
+ $eb2fc0ee655eff6b$export$8c4ee2c50c22c514 = `A-HlBa_i18nFontFamily`;
69
+ $eb2fc0ee655eff6b$export$d35bc1e505d1ebbf = `A-HlBa_is-disabled`;
70
+ $eb2fc0ee655eff6b$export$1237798dc640739a = `A-HlBa_label`;
71
+ $eb2fc0ee655eff6b$export$f6d480ae1e56eba0 = `A-HlBa_spectrum-Field`;
72
+ $eb2fc0ee655eff6b$export$5354c9be7ada5f83 = `A-HlBa_spectrum-Field--alignEnd`;
73
+ $eb2fc0ee655eff6b$export$9ba23707a252cdd4 = `A-HlBa_spectrum-Field--hasContextualHelp`;
74
+ $eb2fc0ee655eff6b$export$2963225c91179589 = `A-HlBa_spectrum-Field--positionSide`;
75
+ $eb2fc0ee655eff6b$export$a4ea780a9064d7f9 = `A-HlBa_spectrum-Field--positionTop`;
76
+ $eb2fc0ee655eff6b$export$24fb860d16dd2d3f = `A-HlBa_spectrum-Field-contextualHelp`;
77
+ $eb2fc0ee655eff6b$export$3ab8a3dc7f0563d = `A-HlBa_spectrum-Field-field`;
78
+ $eb2fc0ee655eff6b$export$9cde5aecff012641 = `A-HlBa_spectrum-Field-labelCell`;
79
+ $eb2fc0ee655eff6b$export$a872a8c78b26c9e0 = `A-HlBa_spectrum-Field-labelWrapper`;
80
+ $eb2fc0ee655eff6b$export$127df0b7290eb8ef = `A-HlBa_spectrum-Field-wrapper`;
81
+ $eb2fc0ee655eff6b$export$493d18e796ae054 = `A-HlBa_spectrum-FieldLabel`;
82
+ $eb2fc0ee655eff6b$export$885efcc08143a987 = `A-HlBa_spectrum-FieldLabel--alignEnd`;
83
+ $eb2fc0ee655eff6b$export$9e6f19dc21f22f2e = `A-HlBa_spectrum-FieldLabel--positionSide`;
84
+ $eb2fc0ee655eff6b$export$7c47642c7d46f3c9 = `A-HlBa_spectrum-FieldLabel-requiredIcon`;
85
+ $eb2fc0ee655eff6b$export$4109102f950813a6 = `A-HlBa_spectrum-FocusRing-ring`;
86
+ $eb2fc0ee655eff6b$export$24c7f46a6e3605dd = `A-HlBa_spectrum-FocusRing ${$eb2fc0ee655eff6b$export$4109102f950813a6}`;
87
+ $eb2fc0ee655eff6b$export$2927016961429360 = `A-HlBa_spectrum-FocusRing--quiet`;
88
+ $eb2fc0ee655eff6b$export$94d2bcc94afabd89 = `A-HlBa_spectrum-Form`;
89
+ $eb2fc0ee655eff6b$export$7f44db659563c8f4 = `A-HlBa_spectrum-Form--positionSide`;
90
+ $eb2fc0ee655eff6b$export$11b8bc81fe551057 = `A-HlBa_spectrum-Form--positionTop`;
91
+ $eb2fc0ee655eff6b$export$51ec27881a1e3928 = `A-HlBa_spectrum-Form-itemLabel`;
92
+ $eb2fc0ee655eff6b$export$79f9a5e9dd010c8d = `A-HlBa_spectrum-LabeledValue`;
93
+
94
+
95
+ //# sourceMappingURL=fieldlabel_vars_css.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AA5BA,0CAAmC,CAAC,qBAAqB,CAAC;AAC1D,4CAA0B,CAAC,YAAY,CAAC;AACxC,4CAA+B,CAAC,iBAAiB,CAAC;AAClD,4CAA6B,CAAC,eAAe,CAAC;AAC9C,4CAAmC,CAAC,qBAAqB,CAAC;AAC1D,4CAAgC,CAAC,kBAAkB,CAAC;AACpD,4CAA0B,CAAC,YAAY,CAAC;AACxC,4CAAmC,CAAC,qBAAqB,CAAC;AAC1D,4CAA6C,CAAC,+BAA+B,CAAC;AAC9E,4CAAsD,CAAC,wCAAwC,CAAC;AAChG,4CAAiD,CAAC,mCAAmC,CAAC;AACtF,4CAAgD,CAAC,kCAAkC,CAAC;AACpF,4CAAkD,CAAC,oCAAoC,CAAC;AACxF,2CAAyC,CAAC,2BAA2B,CAAC;AACtE,4CAA6C,CAAC,+BAA+B,CAAC;AAC9E,4CAAgD,CAAC,kCAAkC,CAAC;AACpF,4CAA2C,CAAC,6BAA6B,CAAC;AAC1E,2CAAwC,CAAC,0BAA0B,CAAC;AACpE,4CAAkD,CAAC,oCAAoC,CAAC;AACxF,4CAAsD,CAAC,wCAAwC,CAAC;AAChG,4CAAqD,CAAC,uCAAuC,CAAC;AAC9F,4CAA4C,CAAC,8BAA8B,CAAC;AAC5E,4CAAuC,CAAC,0BAA0B,EAAE,0CAA0C,CAAC;AAC/G,4CAA8C,CAAC,gCAAgC,CAAC;AAChF,4CAAkC,CAAC,oBAAoB,CAAC;AACxD,4CAAgD,CAAC,kCAAkC,CAAC;AACpF,4CAA+C,CAAC,iCAAiC,CAAC;AAClF,4CAA4C,CAAC,8BAA8B,CAAC;AAC5E,4CAA0C,CAAC,4BAA4B,CAAC","sources":["packages/@adobe/spectrum-css-temp/components/fieldlabel/vars.css"],"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\n@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"fieldlabel_vars_css.main.js.map"}