@react-spectrum/labeledvalue 3.0.0-nightly.3472 → 3.0.0-nightly.3478

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/main.js CHANGED
@@ -78,7 +78,7 @@ function $2a7417c2df2197f7$var$LabeledValue(props, ref) {
78
78
  'spectrum-Field--positionSide': labelPosition === 'side'
79
79
  });
80
80
  return(/*#__PURE__*/ ($parcel$interopDefault($3cJLQ$react)).createElement("div", {
81
- ...$3cJLQ$reactariautils.filterDOMProps(props),
81
+ ...$3cJLQ$reactariautils.filterDOMProps(otherProps),
82
82
  ...styleProps,
83
83
  className: $3cJLQ$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($eb2fc0ee655eff6b$exports)), 'spectrum-LabeledValue', {
84
84
  [labelWrapperClass]: label
@@ -171,7 +171,9 @@ function $2a7417c2df2197f7$var$convertValue(value) {
171
171
  let date = $3cJLQ$internationalizeddate.today($3cJLQ$internationalizeddate.getLocalTimeZone());
172
172
  return $3cJLQ$internationalizeddate.toCalendarDateTime(date, value);
173
173
  }
174
- let $2a7417c2df2197f7$export$d1328f67a56fa517 = /*#__PURE__*/ ($parcel$interopDefault($3cJLQ$react)).forwardRef($2a7417c2df2197f7$var$LabeledValue);
174
+ /**
175
+ * A LabeledValue displays a non-editable value with a label. It formats numbers, dates, times, and lists according to the user's locale.
176
+ */ let $2a7417c2df2197f7$export$d1328f67a56fa517 = /*#__PURE__*/ ($parcel$interopDefault($3cJLQ$react)).forwardRef($2a7417c2df2197f7$var$LabeledValue);
175
177
 
176
178
 
177
179
 
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AEAA,GAAqC;AACrC,GAAmD;AACnD,GAAkD;AAClD,GAA+C;AAC/C,GAAgC;AAChC,GAA6C;AAC7C,GAAsC;AACtC,GAA8C;AAC9C,GAAwC;AACxC,GAA+B;AAC/B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,CAAC,UAAU,CAAC,kCAAY","sources":["packages/@react-spectrum/labeledvalue/src/index.ts","packages/@react-spectrum/labeledvalue/src/LabeledValue.tsx","packages/@adobe/spectrum-css-temp/components/fieldlabel/vars.css"],"sourcesContent":["/*\n * Copyright 2022 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/// <reference types=\"css-module-types\" />\n\nexport type {SpectrumLabeledValueProps} from './LabeledValue';\nexport {LabeledValue} from './LabeledValue';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport type {AriaLabelingProps, DOMProps, RangeValue, SpectrumLabelableProps, StyleProps} from '@react-types/shared';\nimport {CalendarDate, CalendarDateTime, getLocalTimeZone, Time, toCalendarDateTime, today, ZonedDateTime} from '@internationalized/date';\nimport {classNames} from '@react-spectrum/utils';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {Label} from '@react-spectrum/label';\nimport labelStyles from '@adobe/spectrum-css-temp/components/fieldlabel/vars.css';\nimport React, {RefObject} from 'react';\nimport {useDateFormatter, useListFormatter, useNumberFormatter} from '@react-aria/i18n';\nimport {useStyleProps} from '@react-spectrum/utils';\n\ninterface LabeledValueBaseProps extends DOMProps, StyleProps, Omit<SpectrumLabelableProps, 'necessityIndicator' | 'isRequired'>, AriaLabelingProps {}\n\ntype NumberValue = number | RangeValue<number>;\ninterface NumberProps<T extends NumberValue> {\n value: T,\n formatOptions?: Intl.NumberFormatOptions\n}\n\ntype DateTime = Date | CalendarDate | CalendarDateTime | ZonedDateTime | Time;\ntype RangeDateTime = RangeValue<DateTime>;\ntype DateTimeValue = DateTime | RangeDateTime;\ninterface DateProps<T extends DateTimeValue> {\n value: T,\n formatOptions?: Intl.DateTimeFormatOptions\n}\n\ninterface StringProps<T extends string> {\n value: T,\n formatOptions?: never\n}\n\ninterface StringListProps<T extends string[]> {\n value: T,\n // @ts-ignore\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: RefObject<HTMLDivElement>) {\n let {\n value,\n formatOptions,\n labelPosition,\n labelAlign,\n label,\n ...otherProps\n } = props;\n let {styleProps} = useStyleProps(otherProps);\n let labelWrapperClass = classNames(\n labelStyles,\n 'spectrum-Field',\n {\n 'spectrum-Field--positionTop': labelPosition === 'top',\n 'spectrum-Field--positionSide': labelPosition === 'side'\n }\n );\n\n return (\n <div\n {...filterDOMProps(props)}\n {...styleProps}\n className={classNames(labelStyles, 'spectrum-LabeledValue', {[labelWrapperClass]: label}, styleProps.className)}\n ref={ref}>\n {props.label &&\n <Label\n labelPosition={labelPosition}\n labelAlign={labelAlign}\n elementType=\"span\">\n {props.label}\n </Label>}\n <div\n className={classNames(labelStyles, 'spectrum-Field-wrapper')}>\n <div\n className={classNames(labelStyles, 'spectrum-Field-field')}>\n {Array.isArray(value) &&\n // @ts-ignore\n <FormattedStringList value={value} formatOptions={formatOptions as Intl.ListFormatOptions} />}\n\n {typeof value === 'object' && 'start' in value && typeof value.start === 'number' && typeof value.end === 'number' &&\n <FormattedNumber value={value as NumberValue} formatOptions={formatOptions as Intl.NumberFormatOptions} />}\n\n {typeof value === 'object' && 'start' in value && typeof value.start !== 'number' && typeof value.end !== 'number' &&\n <FormattedDate value={value as DateTimeValue} formatOptions={formatOptions as Intl.DateTimeFormatOptions} />}\n\n {typeof value === 'number' &&\n <FormattedNumber value={value} formatOptions={formatOptions as Intl.NumberFormatOptions} />}\n\n {(typeof value === 'object' && ('calendar' in value || 'hour' in value) || (value instanceof Date)) &&\n <FormattedDate value={value} formatOptions={formatOptions as Intl.DateTimeFormatOptions} />}\n\n {typeof value === 'string' &&\n value}\n </div>\n </div>\n </div>\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\nlet _LabeledValue = React.forwardRef(LabeledValue);\nexport {_LabeledValue as LabeledValue};\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AEAA,GAAqC;AACrC,GAAmD;AACnD,GAAkD;AAClD,GAA+C;AAC/C,GAAgC;AAChC,GAA6C;AAC7C,GAAsC;AACtC,GAA8C;AAC9C,GAAwC;AACxC,GAA+B;AAC/B,GAA6C;AAC7C,GAA4C;AAC5C,GAAuC;AACvC,GAAyC;AACzC,GAA6B;AAd7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["packages/@react-spectrum/labeledvalue/src/index.ts","packages/@react-spectrum/labeledvalue/src/LabeledValue.tsx","packages/@adobe/spectrum-css-temp/components/fieldlabel/vars.css"],"sourcesContent":["/*\n * Copyright 2022 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/// <reference types=\"css-module-types\" />\n\nexport type {SpectrumLabeledValueProps} from './LabeledValue';\nexport {LabeledValue} from './LabeledValue';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {CalendarDate, CalendarDateTime, getLocalTimeZone, Time, toCalendarDateTime, today, ZonedDateTime} from '@internationalized/date';\nimport {classNames} from '@react-spectrum/utils';\nimport type {DOMProps, RangeValue, SpectrumLabelableProps, StyleProps} from '@react-types/shared';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {Label} from '@react-spectrum/label';\nimport labelStyles from '@adobe/spectrum-css-temp/components/fieldlabel/vars.css';\nimport React, {ReactNode, RefObject} from 'react';\nimport {useDateFormatter, useListFormatter, useNumberFormatter} from '@react-aria/i18n';\nimport {useStyleProps} from '@react-spectrum/utils';\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 // @ts-ignore\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: RefObject<HTMLDivElement>) {\n let {\n value,\n formatOptions,\n labelPosition,\n labelAlign,\n label,\n ...otherProps\n } = props;\n let {styleProps} = useStyleProps(otherProps);\n let labelWrapperClass = classNames(\n labelStyles,\n 'spectrum-Field',\n {\n 'spectrum-Field--positionTop': labelPosition === 'top',\n 'spectrum-Field--positionSide': labelPosition === 'side'\n }\n );\n\n return (\n <div\n {...filterDOMProps(otherProps)}\n {...styleProps}\n className={classNames(labelStyles, 'spectrum-LabeledValue', {[labelWrapperClass]: label}, styleProps.className)}\n ref={ref}>\n {props.label &&\n <Label\n labelPosition={labelPosition}\n labelAlign={labelAlign}\n elementType=\"span\">\n {props.label}\n </Label>}\n <div\n className={classNames(labelStyles, 'spectrum-Field-wrapper')}>\n <div className={classNames(labelStyles, 'spectrum-Field-field')}>\n {Array.isArray(value) &&\n // @ts-ignore\n <FormattedStringList value={value} formatOptions={formatOptions as Intl.ListFormatOptions} />}\n\n {typeof value === 'object' && 'start' in value && typeof value.start === 'number' && typeof value.end === 'number' &&\n <FormattedNumber value={value as NumberValue} formatOptions={formatOptions as Intl.NumberFormatOptions} />}\n\n {typeof value === 'object' && 'start' in value && typeof value.start !== 'number' && typeof value.end !== 'number' &&\n <FormattedDate value={value as DateTimeValue} formatOptions={formatOptions as Intl.DateTimeFormatOptions} />}\n\n {typeof value === 'number' &&\n <FormattedNumber value={value} formatOptions={formatOptions as Intl.NumberFormatOptions} />}\n\n {(typeof value === 'object' && ('calendar' in value || 'hour' in value) || (value instanceof Date)) &&\n <FormattedDate value={value} formatOptions={formatOptions as Intl.DateTimeFormatOptions} />}\n\n {typeof value === 'string' &&\n value}\n </div>\n </div>\n </div>\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","/*\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":"main.js.map"}
package/dist/module.js CHANGED
@@ -76,7 +76,7 @@ function $3e9971be431adb24$var$LabeledValue(props, ref) {
76
76
  'spectrum-Field--positionSide': labelPosition === 'side'
77
77
  });
78
78
  return(/*#__PURE__*/ $3xnHL$react.createElement("div", {
79
- ...$3xnHL$filterDOMProps(props),
79
+ ...$3xnHL$filterDOMProps(otherProps),
80
80
  ...styleProps,
81
81
  className: $3xnHL$classNames((/*@__PURE__*/$parcel$interopDefault($cd231e464c886c86$exports)), 'spectrum-LabeledValue', {
82
82
  [labelWrapperClass]: label
@@ -169,7 +169,9 @@ function $3e9971be431adb24$var$convertValue(value) {
169
169
  let date = $3xnHL$today($3xnHL$getLocalTimeZone());
170
170
  return $3xnHL$toCalendarDateTime(date, value);
171
171
  }
172
- let $3e9971be431adb24$export$d1328f67a56fa517 = /*#__PURE__*/ $3xnHL$react.forwardRef($3e9971be431adb24$var$LabeledValue);
172
+ /**
173
+ * A LabeledValue displays a non-editable value with a label. It formats numbers, dates, times, and lists according to the user's locale.
174
+ */ let $3e9971be431adb24$export$d1328f67a56fa517 = /*#__PURE__*/ $3xnHL$react.forwardRef($3e9971be431adb24$var$LabeledValue);
173
175
 
174
176
 
175
177
 
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AEAA,GAAqC;AACrC,GAAmD;AACnD,GAAkD;AAClD,GAA+C;AAC/C,GAAgC;AAChC,GAA6C;AAC7C,GAAsC;AACtC,GAA8C;AAC9C,GAAwC;AACxC,GAA+B;AAC/B,GAA6C;AAC7C,GAA4C;AAC5C,GAAuC;AACvC,GAAyC;AACzC,GAA6B;AAd7B,wCAAqC,GAAG,CAA4B;AACpE,yCAAmD,GAAG,CAA0C;AAChG,yCAAkD,GAAG,CAAyC;AAC9F,yCAA+C,GAAG,CAAsC;AACxF,yCAAgC,GAAG,CAAuB;AAC1D,yCAA6C,GAAG,CAAoC;AACpF,wCAAsC,GAAG,CAA6B;AACtE,yCAA8C,GAAG,CAAqC;AACtF,yCAAwC,GAAG,CAA+B;AAC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CAAC,KAAe,EAA8B,CAAC;IAC7E,EAAE,EAAE,KAAK,YAAY,IAAI,EACvB,MAAM,CAAC,CAAC;QAAA,SAAS,EAAE,CAAM;QAAE,SAAS,EAAE,CAAO;IAAA,CAAC;SACzC,EAAE,EAAE,CAAU,aAAI,KAAK,EAC5B,MAAM,CAAC,CAAC;QAAA,IAAI,EAAE,CAAS;QAAE,KAAK,EAAE,CAAM;QAAE,GAAG,EAAE,CAAS;QAAE,IAAI,EAAE,CAAS;QAAE,MAAM,EAAE,CAAS;QAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ;QAAE,YAAY,EAAE,CAAO;IAAA,CAAC;SACvI,EAAE,EAAE,CAAM,SAAI,KAAK,IAAI,CAAM,SAAI,KAAK,EAC3C,MAAM,CAAC,CAAC;QAAA,SAAS,EAAE,CAAM;QAAE,SAAS,EAAE,CAAO;IAAA,CAAC;SACzC,EAAE,EAAE,CAAM,SAAI,KAAK,EACxB,MAAM,CAAC,CAAC;QAAA,SAAS,EAAE,CAAO;IAAA,CAAC;SAE3B,MAAM,CAAC,CAAC;QAAA,SAAS,EAAE,CAAM;IAAA,CAAC;AAE9B,CAAC;SAEQ,kCAAY,CAAC,KAAW,EAAE,CAAC;IAClC,GAAG,CAAC,IAAI,GAAG,YAAK,CAAC,uBAAgB;IAEjC,MAAM,CAAC,yBAAkB,CAAC,IAAI,EAAE,KAAK;AACvC,CAAC;AAED,GAAG,CAAC,yCAAa,iBAAG,YAAK,CAAC,UAAU,CAAC,kCAAY","sources":["packages/@react-spectrum/labeledvalue/src/index.ts","packages/@react-spectrum/labeledvalue/src/LabeledValue.tsx","packages/@adobe/spectrum-css-temp/components/fieldlabel/vars.css"],"sourcesContent":["/*\n * Copyright 2022 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/// <reference types=\"css-module-types\" />\n\nexport type {SpectrumLabeledValueProps} from './LabeledValue';\nexport {LabeledValue} from './LabeledValue';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport type {AriaLabelingProps, DOMProps, RangeValue, SpectrumLabelableProps, StyleProps} from '@react-types/shared';\nimport {CalendarDate, CalendarDateTime, getLocalTimeZone, Time, toCalendarDateTime, today, ZonedDateTime} from '@internationalized/date';\nimport {classNames} from '@react-spectrum/utils';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {Label} from '@react-spectrum/label';\nimport labelStyles from '@adobe/spectrum-css-temp/components/fieldlabel/vars.css';\nimport React, {RefObject} from 'react';\nimport {useDateFormatter, useListFormatter, useNumberFormatter} from '@react-aria/i18n';\nimport {useStyleProps} from '@react-spectrum/utils';\n\ninterface LabeledValueBaseProps extends DOMProps, StyleProps, Omit<SpectrumLabelableProps, 'necessityIndicator' | 'isRequired'>, AriaLabelingProps {}\n\ntype NumberValue = number | RangeValue<number>;\ninterface NumberProps<T extends NumberValue> {\n value: T,\n formatOptions?: Intl.NumberFormatOptions\n}\n\ntype DateTime = Date | CalendarDate | CalendarDateTime | ZonedDateTime | Time;\ntype RangeDateTime = RangeValue<DateTime>;\ntype DateTimeValue = DateTime | RangeDateTime;\ninterface DateProps<T extends DateTimeValue> {\n value: T,\n formatOptions?: Intl.DateTimeFormatOptions\n}\n\ninterface StringProps<T extends string> {\n value: T,\n formatOptions?: never\n}\n\ninterface StringListProps<T extends string[]> {\n value: T,\n // @ts-ignore\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: RefObject<HTMLDivElement>) {\n let {\n value,\n formatOptions,\n labelPosition,\n labelAlign,\n label,\n ...otherProps\n } = props;\n let {styleProps} = useStyleProps(otherProps);\n let labelWrapperClass = classNames(\n labelStyles,\n 'spectrum-Field',\n {\n 'spectrum-Field--positionTop': labelPosition === 'top',\n 'spectrum-Field--positionSide': labelPosition === 'side'\n }\n );\n\n return (\n <div\n {...filterDOMProps(props)}\n {...styleProps}\n className={classNames(labelStyles, 'spectrum-LabeledValue', {[labelWrapperClass]: label}, styleProps.className)}\n ref={ref}>\n {props.label &&\n <Label\n labelPosition={labelPosition}\n labelAlign={labelAlign}\n elementType=\"span\">\n {props.label}\n </Label>}\n <div\n className={classNames(labelStyles, 'spectrum-Field-wrapper')}>\n <div\n className={classNames(labelStyles, 'spectrum-Field-field')}>\n {Array.isArray(value) &&\n // @ts-ignore\n <FormattedStringList value={value} formatOptions={formatOptions as Intl.ListFormatOptions} />}\n\n {typeof value === 'object' && 'start' in value && typeof value.start === 'number' && typeof value.end === 'number' &&\n <FormattedNumber value={value as NumberValue} formatOptions={formatOptions as Intl.NumberFormatOptions} />}\n\n {typeof value === 'object' && 'start' in value && typeof value.start !== 'number' && typeof value.end !== 'number' &&\n <FormattedDate value={value as DateTimeValue} formatOptions={formatOptions as Intl.DateTimeFormatOptions} />}\n\n {typeof value === 'number' &&\n <FormattedNumber value={value} formatOptions={formatOptions as Intl.NumberFormatOptions} />}\n\n {(typeof value === 'object' && ('calendar' in value || 'hour' in value) || (value instanceof Date)) &&\n <FormattedDate value={value} formatOptions={formatOptions as Intl.DateTimeFormatOptions} />}\n\n {typeof value === 'string' &&\n value}\n </div>\n </div>\n </div>\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\nlet _LabeledValue = React.forwardRef(LabeledValue);\nexport {_LabeledValue as LabeledValue};\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"module.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AEAA,GAAqC;AACrC,GAAmD;AACnD,GAAkD;AAClD,GAA+C;AAC/C,GAAgC;AAChC,GAA6C;AAC7C,GAAsC;AACtC,GAA8C;AAC9C,GAAwC;AACxC,GAA+B;AAC/B,GAA6C;AAC7C,GAA4C;AAC5C,GAAuC;AACvC,GAAyC;AACzC,GAA6B;AAd7B,wCAAqC,GAAG,CAA4B;AACpE,yCAAmD,GAAG,CAA0C;AAChG,yCAAkD,GAAG,CAAyC;AAC9F,yCAA+C,GAAG,CAAsC;AACxF,yCAAgC,GAAG,CAAuB;AAC1D,yCAA6C,GAAG,CAAoC;AACpF,wCAAsC,GAAG,CAA6B;AACtE,yCAA8C,GAAG,CAAqC;AACtF,yCAAwC,GAAG,CAA+B;AAC1E,yCAA+B,GAAG,CAAsB;AACxD,yCAA6C,GAAG,CAAoC;AACpF,yCAA4C,GAAG,C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M,CAAC,CAAC;QAAA,SAAS,EAAE,CAAM;QAAE,SAAS,EAAE,CAAO;IAAA,CAAC;SACzC,EAAE,EAAE,CAAU,aAAI,KAAK,EAC5B,MAAM,CAAC,CAAC;QAAA,IAAI,EAAE,CAAS;QAAE,KAAK,EAAE,CAAM;QAAE,GAAG,EAAE,CAAS;QAAE,IAAI,EAAE,CAAS;QAAE,MAAM,EAAE,CAAS;QAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ;QAAE,YAAY,EAAE,CAAO;IAAA,CAAC;SACvI,EAAE,EAAE,CAAM,SAAI,KAAK,IAAI,CAAM,SAAI,KAAK,EAC3C,MAAM,CAAC,CAAC;QAAA,SAAS,EAAE,CAAM;QAAE,SAAS,EAAE,CAAO;IAAA,CAAC;SACzC,EAAE,EAAE,CAAM,SAAI,KAAK,EACxB,MAAM,CAAC,CAAC;QAAA,SAAS,EAAE,CAAO;IAAA,CAAC;SAE3B,MAAM,CAAC,CAAC;QAAA,SAAS,EAAE,CAAM;IAAA,CAAC;AAE9B,CAAC;SAEQ,kCAAY,CAAC,KAAW,EAAE,CAAC;IAClC,GAAG,CAAC,IAAI,GAAG,YAAK,CAAC,uBAAgB;IAEjC,MAAM,CAAC,yBAAkB,CAAC,IAAI,EAAE,KAAK;AACvC,CAAC;AAED,EAEG,AAFH;;CAEG,AAFH,EAEG,CACH,GAAG,CAAC,yCAAa,iBAAG,YAAK,CAAC,UAAU,CAAC,kCAAY","sources":["packages/@react-spectrum/labeledvalue/src/index.ts","packages/@react-spectrum/labeledvalue/src/LabeledValue.tsx","packages/@adobe/spectrum-css-temp/components/fieldlabel/vars.css"],"sourcesContent":["/*\n * Copyright 2022 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/// <reference types=\"css-module-types\" />\n\nexport type {SpectrumLabeledValueProps} from './LabeledValue';\nexport {LabeledValue} from './LabeledValue';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {CalendarDate, CalendarDateTime, getLocalTimeZone, Time, toCalendarDateTime, today, ZonedDateTime} from '@internationalized/date';\nimport {classNames} from '@react-spectrum/utils';\nimport type {DOMProps, RangeValue, SpectrumLabelableProps, StyleProps} from '@react-types/shared';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {Label} from '@react-spectrum/label';\nimport labelStyles from '@adobe/spectrum-css-temp/components/fieldlabel/vars.css';\nimport React, {ReactNode, RefObject} from 'react';\nimport {useDateFormatter, useListFormatter, useNumberFormatter} from '@react-aria/i18n';\nimport {useStyleProps} from '@react-spectrum/utils';\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 // @ts-ignore\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: RefObject<HTMLDivElement>) {\n let {\n value,\n formatOptions,\n labelPosition,\n labelAlign,\n label,\n ...otherProps\n } = props;\n let {styleProps} = useStyleProps(otherProps);\n let labelWrapperClass = classNames(\n labelStyles,\n 'spectrum-Field',\n {\n 'spectrum-Field--positionTop': labelPosition === 'top',\n 'spectrum-Field--positionSide': labelPosition === 'side'\n }\n );\n\n return (\n <div\n {...filterDOMProps(otherProps)}\n {...styleProps}\n className={classNames(labelStyles, 'spectrum-LabeledValue', {[labelWrapperClass]: label}, styleProps.className)}\n ref={ref}>\n {props.label &&\n <Label\n labelPosition={labelPosition}\n labelAlign={labelAlign}\n elementType=\"span\">\n {props.label}\n </Label>}\n <div\n className={classNames(labelStyles, 'spectrum-Field-wrapper')}>\n <div className={classNames(labelStyles, 'spectrum-Field-field')}>\n {Array.isArray(value) &&\n // @ts-ignore\n <FormattedStringList value={value} formatOptions={formatOptions as Intl.ListFormatOptions} />}\n\n {typeof value === 'object' && 'start' in value && typeof value.start === 'number' && typeof value.end === 'number' &&\n <FormattedNumber value={value as NumberValue} formatOptions={formatOptions as Intl.NumberFormatOptions} />}\n\n {typeof value === 'object' && 'start' in value && typeof value.start !== 'number' && typeof value.end !== 'number' &&\n <FormattedDate value={value as DateTimeValue} formatOptions={formatOptions as Intl.DateTimeFormatOptions} />}\n\n {typeof value === 'number' &&\n <FormattedNumber value={value} formatOptions={formatOptions as Intl.NumberFormatOptions} />}\n\n {(typeof value === 'object' && ('calendar' in value || 'hour' in value) || (value instanceof Date)) &&\n <FormattedDate value={value} formatOptions={formatOptions as Intl.DateTimeFormatOptions} />}\n\n {typeof value === 'string' &&\n value}\n </div>\n </div>\n </div>\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","/*\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":"module.js.map"}
package/dist/types.d.ts CHANGED
@@ -1,31 +1,44 @@
1
- import { AriaLabelingProps, DOMProps, RangeValue, SpectrumLabelableProps, StyleProps } from "@react-types/shared";
2
1
  import { CalendarDate, CalendarDateTime, Time, ZonedDateTime } from "@internationalized/date";
3
- import React from "react";
4
- interface LabeledValueBaseProps extends DOMProps, StyleProps, Omit<SpectrumLabelableProps, 'necessityIndicator' | 'isRequired'>, AriaLabelingProps {
2
+ import { DOMProps, RangeValue, SpectrumLabelableProps, StyleProps } from "@react-types/shared";
3
+ import React, { ReactNode } from "react";
4
+ interface LabeledValueBaseProps extends DOMProps, StyleProps, Omit<SpectrumLabelableProps, 'necessityIndicator' | 'isRequired'>, DOMProps {
5
+ /** The content to display as the label. */
6
+ label: ReactNode;
5
7
  }
6
8
  type NumberValue = number | RangeValue<number>;
7
9
  interface NumberProps<T extends NumberValue> {
10
+ /** The value to display. */
8
11
  value: T;
12
+ /** Formatting options for the value. */
9
13
  formatOptions?: Intl.NumberFormatOptions;
10
14
  }
11
15
  type DateTime = Date | CalendarDate | CalendarDateTime | ZonedDateTime | Time;
12
16
  type RangeDateTime = RangeValue<DateTime>;
13
17
  type DateTimeValue = DateTime | RangeDateTime;
14
18
  interface DateProps<T extends DateTimeValue> {
19
+ /** The value to display. */
15
20
  value: T;
21
+ /** Formatting options for the value. */
16
22
  formatOptions?: Intl.DateTimeFormatOptions;
17
23
  }
18
24
  interface StringProps<T extends string> {
25
+ /** The value to display. */
19
26
  value: T;
27
+ /** Formatting options for the value. */
20
28
  formatOptions?: never;
21
29
  }
22
30
  interface StringListProps<T extends string[]> {
31
+ /** The value to display. */
23
32
  value: T;
33
+ /** Formatting options for the value. */
24
34
  formatOptions?: Intl.ListFormatOptions;
25
35
  }
26
36
  type LabeledValueProps<T> = T extends NumberValue ? NumberProps<T> : T extends DateTimeValue ? DateProps<T> : T extends string[] ? StringListProps<T> : T extends string ? StringProps<T> : never;
27
37
  type SpectrumLabeledValueTypes = string[] | string | Date | CalendarDate | CalendarDateTime | ZonedDateTime | Time | number | RangeValue<number> | RangeValue<DateTime>;
28
38
  export type SpectrumLabeledValueProps<T> = LabeledValueProps<T> & LabeledValueBaseProps;
39
+ /**
40
+ * A LabeledValue displays a non-editable value with a label. It formats numbers, dates, times, and lists according to the user's locale.
41
+ */
29
42
  export let LabeledValue: React.ForwardRefExoticComponent<SpectrumLabeledValueProps<SpectrumLabeledValueTypes> & React.RefAttributes<HTMLDivElement>>;
30
43
 
31
44
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"mappings":";;;AAsBA,+BAAgC,SA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;AAyIxF,OAAA,IAAI,yIAA8C,CAAC","sources":["packages/@react-spectrum/labeledvalue/src/packages/@react-spectrum/labeledvalue/src/LabeledValue.tsx","packages/@react-spectrum/labeledvalue/src/packages/@react-spectrum/labeledvalue/src/index.ts","packages/@react-spectrum/labeledvalue/src/index.ts"],"sourcesContent":[null,null,"/*\n * Copyright 2022 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/// <reference types=\"css-module-types\" />\n\nexport type {SpectrumLabeledValueProps} from './LabeledValue';\nexport {LabeledValue} from './LabeledValue';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
1
+ {"mappings":";;;AAwBA,+BAAuC,SAAQ,QAAQ,EAAE,UAAU,EAAE,IAAI,CAAC,sBAAsB,EAAE,oBAAoB,GAAG,YAAY,CAAC,EAAE,QAAQ;IAC9I,2CAA2C;IAC3C,KAAK,EAAE,SAAS,CAAA;CACjB;AAED,mBAAmB,MAAM,GAAG,WAAW,MAAM,CAAC,CAAC;AAC/C,sBAAsB,CAAC,SAAS,WAAW;IACzC,4BAA4B;IAC5B,KAAK,EAAE,CAAC,CAAC;IACT,wCAAwC;IACxC,aAAa,CAAC,EAAE,KAAK,mBAAmB,CAAA;CACzC;AAED,gBAAuB,IAAI,GAAG,YAAY,GAAG,gBAAgB,GAAG,aAAa,GAAG,IAAI,CAAC;AACrF,qBAAqB,WAAW,QAAQ,CAAC,CAAC;AAC1C,qBAAqB,QAAQ,GAAG,aAAa,CAAC;AAC9C,oBAAoB,CAAC,SAAS,aAAa;IACzC,4BAA4B;IAC5B,KAAK,EAAE,CAAC,CAAC;IACT,wCAAwC;IACxC,aAAa,CAAC,EAAE,KAAK,qBAAqB,CAAA;CAC3C;AAED,sBAAsB,CAAC,SAAS,MAAM;IACpC,4BAA4B;IAC5B,KAAK,EAAE,CAAC,CAAC;IACT,wCAAwC;IACxC,aAAa,CAAC,EAAE,KAAK,CAAA;CACtB;AAED,0BAA0B,CAAC,SAAS,MAAM,EAAE;IAC1C,4BAA4B;IAC5B,KAAK,EAAE,CAAC,CAAC;IACT,wCAAwC;IAExC,aAAa,CAAC,EAAE,KAAK,iBAAiB,CAAA;CACvC;AAED,uBAAuB,CAAC,IACtB,CAAC,SAAS,WAAW,GAAG,YAAY,CAAC,CAAC,GACtC,CAAC,SAAS,aAAa,GAAG,UAAU,CAAC,CAAC,GACtC,CAAC,SAAS,MAAM,EAAE,GAAG,gBAAgB,CAAC,CAAC,GACvC,CAAC,SAAS,MAAM,GAAG,YAAY,CAAC,CAAC,GACjC,KAAK,CAAC;AAER,iCAAiC,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,GAAG,YAAY,GAAG,gBAAgB,GAAG,aAAa,GAAG,IAAI,GAAG,MAAM,GAAG,WAAW,MAAM,CAAC,GAAG,WAAW,QAAQ,CAAC,CAAC;AACxK,sCAAsC,CAAC,IAAI,kBAAkB,CAAC,CAAC,GAAG,qBAAqB,CAAC;AAwIxF;;GAEG;AACH,OAAA,IAAI,yIAA8C,CAAC","sources":["packages/@react-spectrum/labeledvalue/src/packages/@react-spectrum/labeledvalue/src/LabeledValue.tsx","packages/@react-spectrum/labeledvalue/src/packages/@react-spectrum/labeledvalue/src/index.ts","packages/@react-spectrum/labeledvalue/src/index.ts"],"sourcesContent":[null,null,"/*\n * Copyright 2022 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/// <reference types=\"css-module-types\" />\n\nexport type {SpectrumLabeledValueProps} from './LabeledValue';\nexport {LabeledValue} from './LabeledValue';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-spectrum/labeledvalue",
3
- "version": "3.0.0-nightly.3472+e514827f4",
3
+ "version": "3.0.0-nightly.3478+c24dc2e01",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -32,15 +32,15 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@babel/runtime": "^7.6.2",
35
- "@internationalized/date": "3.0.2-nightly.3472+e514827f4",
36
- "@react-aria/i18n": "3.0.0-nightly.1772+e514827f4",
37
- "@react-aria/utils": "3.0.0-nightly.1772+e514827f4",
38
- "@react-spectrum/label": "3.7.2-nightly.3472+e514827f4",
39
- "@react-spectrum/utils": "3.0.0-nightly.1772+e514827f4",
40
- "@react-types/shared": "3.0.0-nightly.1772+e514827f4"
35
+ "@internationalized/date": "3.0.2-nightly.3478+c24dc2e01",
36
+ "@react-aria/i18n": "3.0.0-nightly.1778+c24dc2e01",
37
+ "@react-aria/utils": "3.0.0-nightly.1778+c24dc2e01",
38
+ "@react-spectrum/label": "3.7.2-nightly.3478+c24dc2e01",
39
+ "@react-spectrum/utils": "3.0.0-nightly.1778+c24dc2e01",
40
+ "@react-types/shared": "3.0.0-nightly.1778+c24dc2e01"
41
41
  },
42
42
  "devDependencies": {
43
- "@adobe/spectrum-css-temp": "3.0.0-nightly.1772+e514827f4"
43
+ "@adobe/spectrum-css-temp": "3.0.0-nightly.1778+c24dc2e01"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "@react-spectrum/provider": "^3.0.0",
@@ -49,5 +49,5 @@
49
49
  "publishConfig": {
50
50
  "access": "public"
51
51
  },
52
- "gitHead": "e514827f49696a9c20fb819bd9610651f7017039"
52
+ "gitHead": "c24dc2e0124fac3467b3adc48b1067f2447cd2b3"
53
53
  }
@@ -10,39 +10,52 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- import type {AriaLabelingProps, DOMProps, RangeValue, SpectrumLabelableProps, StyleProps} from '@react-types/shared';
14
13
  import {CalendarDate, CalendarDateTime, getLocalTimeZone, Time, toCalendarDateTime, today, ZonedDateTime} from '@internationalized/date';
15
14
  import {classNames} from '@react-spectrum/utils';
15
+ import type {DOMProps, RangeValue, SpectrumLabelableProps, StyleProps} from '@react-types/shared';
16
16
  import {filterDOMProps} from '@react-aria/utils';
17
17
  import {Label} from '@react-spectrum/label';
18
18
  import labelStyles from '@adobe/spectrum-css-temp/components/fieldlabel/vars.css';
19
- import React, {RefObject} from 'react';
19
+ import React, {ReactNode, RefObject} from 'react';
20
20
  import {useDateFormatter, useListFormatter, useNumberFormatter} from '@react-aria/i18n';
21
21
  import {useStyleProps} from '@react-spectrum/utils';
22
22
 
23
- interface LabeledValueBaseProps extends DOMProps, StyleProps, Omit<SpectrumLabelableProps, 'necessityIndicator' | 'isRequired'>, AriaLabelingProps {}
23
+ // 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.
24
+
25
+ export interface LabeledValueBaseProps extends DOMProps, StyleProps, Omit<SpectrumLabelableProps, 'necessityIndicator' | 'isRequired'>, DOMProps {
26
+ /** The content to display as the label. */
27
+ label: ReactNode
28
+ }
24
29
 
25
30
  type NumberValue = number | RangeValue<number>;
26
31
  interface NumberProps<T extends NumberValue> {
32
+ /** The value to display. */
27
33
  value: T,
34
+ /** Formatting options for the value. */
28
35
  formatOptions?: Intl.NumberFormatOptions
29
36
  }
30
37
 
31
- type DateTime = Date | CalendarDate | CalendarDateTime | ZonedDateTime | Time;
38
+ export type DateTime = Date | CalendarDate | CalendarDateTime | ZonedDateTime | Time;
32
39
  type RangeDateTime = RangeValue<DateTime>;
33
40
  type DateTimeValue = DateTime | RangeDateTime;
34
41
  interface DateProps<T extends DateTimeValue> {
42
+ /** The value to display. */
35
43
  value: T,
44
+ /** Formatting options for the value. */
36
45
  formatOptions?: Intl.DateTimeFormatOptions
37
46
  }
38
47
 
39
48
  interface StringProps<T extends string> {
49
+ /** The value to display. */
40
50
  value: T,
51
+ /** Formatting options for the value. */
41
52
  formatOptions?: never
42
53
  }
43
54
 
44
55
  interface StringListProps<T extends string[]> {
56
+ /** The value to display. */
45
57
  value: T,
58
+ /** Formatting options for the value. */
46
59
  // @ts-ignore
47
60
  formatOptions?: Intl.ListFormatOptions
48
61
  }
@@ -78,7 +91,7 @@ function LabeledValue<T extends SpectrumLabeledValueTypes>(props: SpectrumLabele
78
91
 
79
92
  return (
80
93
  <div
81
- {...filterDOMProps(props)}
94
+ {...filterDOMProps(otherProps)}
82
95
  {...styleProps}
83
96
  className={classNames(labelStyles, 'spectrum-LabeledValue', {[labelWrapperClass]: label}, styleProps.className)}
84
97
  ref={ref}>
@@ -91,8 +104,7 @@ function LabeledValue<T extends SpectrumLabeledValueTypes>(props: SpectrumLabele
91
104
  </Label>}
92
105
  <div
93
106
  className={classNames(labelStyles, 'spectrum-Field-wrapper')}>
94
- <div
95
- className={classNames(labelStyles, 'spectrum-Field-field')}>
107
+ <div className={classNames(labelStyles, 'spectrum-Field-field')}>
96
108
  {Array.isArray(value) &&
97
109
  // @ts-ignore
98
110
  <FormattedStringList value={value} formatOptions={formatOptions as Intl.ListFormatOptions} />}
@@ -192,5 +204,8 @@ function convertValue(value: Time) {
192
204
  return toCalendarDateTime(date, value);
193
205
  }
194
206
 
207
+ /**
208
+ * A LabeledValue displays a non-editable value with a label. It formats numbers, dates, times, and lists according to the user's locale.
209
+ */
195
210
  let _LabeledValue = React.forwardRef(LabeledValue);
196
211
  export {_LabeledValue as LabeledValue};