@react-spectrum/label 3.16.7-nightly.4700 → 3.16.7-nightly.4704

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.
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAaD,SAAS,4BAAM,KAAyB,EAAE,GAAqB;IAC7D,IAAI,YAAY,CAAA,GAAA,qCAAW,EAAE;IAC7B,IAAI,WAAW,cAAc;IAC7B,QAAQ;IACR,IAAI,SACF,KAAK,iBACL,gBAAgB,mBAChB,UAAU,cACV,UAAU,sBACV,kBAAkB,gDAClB,4CAA4C,mBAC5C,eAAe,aACf,SAAS,eACT,WAAW,gBACX,eAAe,CAAA,IAAK,EAAE,gBAAgB,CAAC,IAAI,CAAC,wBAC5C,gBAAgB,qBAChB,iBAAiB,cACjB,UAAU,iBACV,aAAa,kBACb,cAAc,YACd,QAAQ,cACR,aAAa,CAAC,qBACd,4DAA4D;IAC5D,mBAAmB,CAAC,sBACpB,oBAAoB,CAAC,gBACrB,WAAW,oBACX,gBAAgB,gBAChB,eAAe,CAAC,GAChB,GAAG,YACJ,GAAG;IACJ,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,uCAAY,EAAE;IACjC,IAAI,qBAAgC;IACpC,IAAI,OAAO,iBAAiB,YAC1B,qBAAqB,aAAa,QAAQ,oBAAoB,QAAQ,qBAAqB,OACvF,aAAa;mBACb;0BACA;2BACA;IACF,KACE;SAEJ,qBAAqB;IAEvB,IAAI,cAAc,CAAC,CAAC,eAAe,sBAAuB,CAAA,aAAa,oBAAoB,SAAQ;IACnG,IAAI,mBAAmB,CAAA,GAAA,2BAAI;IAE3B,IAAI,uBAAuB,CAAA,GAAA,2BAAI;IAC/B,IAAI,SAAS,kBAAkB,CAAC,WAAW,EAAE,EAC3C,WAAW,EAAE,GAAG;IAGlB,IAAI,oBAAoB,CAAA,GAAA,oCAAS,EAC7B,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kB,UAAU,SAAS,gBACnD,uCACE,0DAAC;QAAI,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAU,GAAG;qBACtC,0DAAC;QAAI,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAU,GAAG;OACrC;IAMT,qBACG,0DAAC;QACC,GAAG,UAAU;QACb,GAAG,YAAY;QAChB,KAAK;QACL,WAAW;OACV,wBACA;AAGP;AAEA,IAAI,0DAAS,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/label/src/Field.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 {classNames, SlotProvider, useStyleProps} from '@react-spectrum/utils';\nimport {Flex} from '@react-spectrum/layout';\nimport {HelpText} from './HelpText';\nimport {Label} from './Label';\nimport {LabelPosition} from '@react-types/shared';\nimport labelStyles from '@adobe/spectrum-css-temp/components/fieldlabel/vars.css';\nimport {mergeProps, useId} from '@react-aria/utils';\nimport React, {ReactNode, Ref, RefObject} from 'react';\nimport {SpectrumFieldProps} from '@react-types/label';\nimport {useFormProps} from '@react-spectrum/form';\n\nfunction Field(props: SpectrumFieldProps, ref: Ref<HTMLElement>) {\n let formProps = useFormProps(props);\n let isInForm = formProps !== props;\n props = formProps;\n let {\n label,\n labelPosition = 'top' as LabelPosition,\n labelAlign,\n isRequired,\n necessityIndicator,\n includeNecessityIndicatorInAccessibilityName,\n validationState,\n isInvalid,\n description,\n errorMessage = e => e.validationErrors.join(' '),\n validationErrors,\n validationDetails,\n isDisabled,\n showErrorIcon,\n contextualHelp,\n children,\n labelProps = {},\n // Not every component that uses <Field> supports help text.\n descriptionProps = {},\n errorMessageProps = {},\n elementType,\n wrapperClassName,\n wrapperProps = {},\n ...otherProps\n } = props;\n let {styleProps} = useStyleProps(otherProps);\n let errorMessageString: ReactNode = null;\n if (typeof errorMessage === 'function') {\n errorMessageString = isInvalid != null && validationErrors != null && validationDetails != null\n ? errorMessage({\n isInvalid,\n validationErrors,\n validationDetails\n })\n : null;\n } else {\n errorMessageString = errorMessage;\n }\n let hasHelpText = !!description || errorMessageString && (isInvalid || validationState === 'invalid');\n let contextualHelpId = useId();\n\n let fallbackLabelPropsId = useId();\n if (label && contextualHelp && !labelProps.id) {\n labelProps.id = fallbackLabelPropsId;\n }\n\n let labelWrapperClass = classNames(\n labelStyles,\n 'spectrum-Field',\n {\n 'spectrum-Field--positionTop': labelPosition === 'top',\n 'spectrum-Field--positionSide': labelPosition === 'side',\n 'spectrum-Field--alignEnd': labelAlign === 'end',\n 'spectrum-Field--hasContextualHelp': !!props.contextualHelp\n },\n styleProps.className,\n wrapperClassName\n );\n\n children = React.cloneElement(children, mergeProps(children.props as any, {\n className: classNames(\n labelStyles,\n 'spectrum-Field-field'\n )\n }));\n\n let renderHelpText = () => (\n <HelpText\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n description={description}\n errorMessage={errorMessageString}\n validationState={validationState}\n isInvalid={isInvalid}\n isDisabled={isDisabled}\n showErrorIcon={showErrorIcon}\n gridArea={labelStyles.helpText} />\n );\n\n let renderChildren = () => {\n if (labelPosition === 'side') {\n return (\n <Flex direction=\"column\" UNSAFE_className={classNames(labelStyles, 'spectrum-Field-wrapper')}>\n {children}\n {hasHelpText && renderHelpText()}\n </Flex>\n );\n }\n\n return (\n <>\n {children}\n {hasHelpText && renderHelpText()}\n </>\n );\n };\n\n let labelAndContextualHelp = (\n <>\n {label && (\n <Label\n {...labelProps}\n labelPosition={labelPosition}\n labelAlign={labelAlign}\n isRequired={isRequired}\n necessityIndicator={necessityIndicator}\n includeNecessityIndicatorInAccessibilityName={includeNecessityIndicatorInAccessibilityName}\n elementType={elementType}>\n {label}\n </Label>\n )}\n {label && contextualHelp &&\n <SlotProvider\n slots={{\n actionButton: {\n UNSAFE_className: classNames(labelStyles, 'spectrum-Field-contextualHelp'),\n id: contextualHelpId,\n 'aria-labelledby': labelProps?.id ? `${labelProps.id} ${contextualHelpId}` : undefined\n }\n }}>\n {contextualHelp}\n </SlotProvider>\n }\n </>\n );\n\n // Need to add an extra wrapper for the label and contextual help if labelPosition is side,\n // so that the table layout works inside forms.\n if (isInForm && labelPosition === 'side' && label && contextualHelp) {\n labelAndContextualHelp = (\n <div className={classNames(labelStyles, 'spectrum-Field-labelCell')}>\n <div className={classNames(labelStyles, 'spectrum-Field-labelWrapper')}>\n {labelAndContextualHelp}\n </div>\n </div>\n );\n }\n\n return (\n (<div\n {...styleProps}\n {...wrapperProps}\n ref={ref as RefObject<HTMLDivElement | null>}\n className={labelWrapperClass}>\n {labelAndContextualHelp}\n {renderChildren()}\n </div>)\n );\n}\n\nlet _Field = React.forwardRef(Field);\nexport {_Field as Field};\n"],"names":[],"version":3,"file":"Field.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAaD,SAAS,4BAAM,KAAyB,EAAE,GAAqB;IAC7D,IAAI,YAAY,CAAA,GAAA,qCAAW,EAAE;IAC7B,IAAI,WAAW,cAAc;IAC7B,QAAQ;IACR,IAAI,SACF,KAAK,iBACL,gBAAgB,mBAChB,UAAU,cACV,UAAU,sBACV,kBAAkB,gDAClB,4CAA4C,mBAC5C,eAAe,aACf,SAAS,eACT,WAAW,gBACX,eAAe,CAAA,IAAK,EAAE,gBAAgB,CAAC,IAAI,CAAC,wBAC5C,gBAAgB,qBAChB,iBAAiB,cACjB,UAAU,iBACV,aAAa,kBACb,cAAc,YACd,QAAQ,cACR,aAAa,CAAC,qBACd,4DAA4D;IAC5D,mBAAm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A,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAU,GAAG;WAChE,UACA,eAAe;QAKtB,qBACE,sHACG,UACA,eAAe;IAGtB;IAEA,IAAI,uCACF,sHACG,uBACC,0DAAC,CAAA,GAAA,+BAAI;QACF,GAAG,UAAU;QACd,eAAe;QACf,YAAY;QACZ,YAAY;QACZ,oBAAoB;QACpB,8CAA8C;QAC9C,aAAa;OACZ,QAGJ,SAAS,gCACR,0DAAC,CAAA,GAAA,sCAAW;QACV,OAAO;YACL,cAAc;gBACZ,kBAAkB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAU,GAAG;gBAC1C,IAAI;gBACJ,mBAAmB,CAAA,uBAAA,iCAAA,WAAY,EAAE,IAAG,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,EAAE,iBAAiB,CAAC,GAAG;YAC/E;QACF;OACC;IAMP,2FAA2F;IAC3F,+CAA+C;IACjD,IAAI,YAAY,kBAAkB,UAAU,SAAS,gBACnD,uCACE,0DAAC;QAAI,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAU,GAAG;qBACtC,0DAAC;QAAI,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAU,GAAG;OACrC;IAMT,qBACG,0DAAC;QACC,GAAG,UAAU;QACb,GAAG,YAAY;QAChB,KAAK;QACL,WAAW;OACV,wBACA;AAGP;AAEA,IAAI,0DAAS,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/label/src/Field.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 {classNames, SlotProvider, useStyleProps} from '@react-spectrum/utils';\nimport {Flex} from '@react-spectrum/layout';\nimport {HelpText} from './HelpText';\nimport {Label} from './Label';\nimport {LabelPosition, RefObject} from '@react-types/shared';\nimport labelStyles from '@adobe/spectrum-css-temp/components/fieldlabel/vars.css';\nimport {mergeProps, useId} from '@react-aria/utils';\nimport React, {ReactNode, Ref} from 'react';\nimport {SpectrumFieldProps} from '@react-types/label';\nimport {useFormProps} from '@react-spectrum/form';\n\nfunction Field(props: SpectrumFieldProps, ref: Ref<HTMLElement>) {\n let formProps = useFormProps(props);\n let isInForm = formProps !== props;\n props = formProps;\n let {\n label,\n labelPosition = 'top' as LabelPosition,\n labelAlign,\n isRequired,\n necessityIndicator,\n includeNecessityIndicatorInAccessibilityName,\n validationState,\n isInvalid,\n description,\n errorMessage = e => e.validationErrors.join(' '),\n validationErrors,\n validationDetails,\n isDisabled,\n showErrorIcon,\n contextualHelp,\n children,\n labelProps = {},\n // Not every component that uses <Field> supports help text.\n descriptionProps = {},\n errorMessageProps = {},\n elementType,\n wrapperClassName,\n wrapperProps = {},\n ...otherProps\n } = props;\n let {styleProps} = useStyleProps(otherProps);\n let errorMessageString: ReactNode = null;\n if (typeof errorMessage === 'function') {\n errorMessageString = isInvalid != null && validationErrors != null && validationDetails != null\n ? errorMessage({\n isInvalid,\n validationErrors,\n validationDetails\n })\n : null;\n } else {\n errorMessageString = errorMessage;\n }\n let hasHelpText = !!description || errorMessageString && (isInvalid || validationState === 'invalid');\n let contextualHelpId = useId();\n\n let fallbackLabelPropsId = useId();\n if (label && contextualHelp && !labelProps.id) {\n labelProps.id = fallbackLabelPropsId;\n }\n\n let labelWrapperClass = classNames(\n labelStyles,\n 'spectrum-Field',\n {\n 'spectrum-Field--positionTop': labelPosition === 'top',\n 'spectrum-Field--positionSide': labelPosition === 'side',\n 'spectrum-Field--alignEnd': labelAlign === 'end',\n 'spectrum-Field--hasContextualHelp': !!props.contextualHelp\n },\n styleProps.className,\n wrapperClassName\n );\n\n children = React.cloneElement(children, mergeProps(children.props as any, {\n className: classNames(\n labelStyles,\n 'spectrum-Field-field'\n )\n }));\n\n let renderHelpText = () => (\n <HelpText\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n description={description}\n errorMessage={errorMessageString}\n validationState={validationState}\n isInvalid={isInvalid}\n isDisabled={isDisabled}\n showErrorIcon={showErrorIcon}\n gridArea={labelStyles.helpText} />\n );\n\n let renderChildren = () => {\n if (labelPosition === 'side') {\n return (\n <Flex direction=\"column\" UNSAFE_className={classNames(labelStyles, 'spectrum-Field-wrapper')}>\n {children}\n {hasHelpText && renderHelpText()}\n </Flex>\n );\n }\n\n return (\n <>\n {children}\n {hasHelpText && renderHelpText()}\n </>\n );\n };\n\n let labelAndContextualHelp = (\n <>\n {label && (\n <Label\n {...labelProps}\n labelPosition={labelPosition}\n labelAlign={labelAlign}\n isRequired={isRequired}\n necessityIndicator={necessityIndicator}\n includeNecessityIndicatorInAccessibilityName={includeNecessityIndicatorInAccessibilityName}\n elementType={elementType}>\n {label}\n </Label>\n )}\n {label && contextualHelp &&\n <SlotProvider\n slots={{\n actionButton: {\n UNSAFE_className: classNames(labelStyles, 'spectrum-Field-contextualHelp'),\n id: contextualHelpId,\n 'aria-labelledby': labelProps?.id ? `${labelProps.id} ${contextualHelpId}` : undefined\n }\n }}>\n {contextualHelp}\n </SlotProvider>\n }\n </>\n );\n\n // Need to add an extra wrapper for the label and contextual help if labelPosition is side,\n // so that the table layout works inside forms.\n if (isInForm && labelPosition === 'side' && label && contextualHelp) {\n labelAndContextualHelp = (\n <div className={classNames(labelStyles, 'spectrum-Field-labelCell')}>\n <div className={classNames(labelStyles, 'spectrum-Field-labelWrapper')}>\n {labelAndContextualHelp}\n </div>\n </div>\n );\n }\n\n return (\n (<div\n {...styleProps}\n {...wrapperProps}\n ref={ref as RefObject<HTMLDivElement | null>}\n className={labelWrapperClass}>\n {labelAndContextualHelp}\n {renderChildren()}\n </div>)\n );\n}\n\nlet _Field = React.forwardRef(Field);\nexport {_Field as Field};\n"],"names":[],"version":3,"file":"Field.main.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAaD,SAAS,4BAAM,KAAyB,EAAE,GAAqB;IAC7D,IAAI,YAAY,CAAA,GAAA,mBAAW,EAAE;IAC7B,IAAI,WAAW,cAAc;IAC7B,QAAQ;IACR,IAAI,SACF,KAAK,iBACL,gBAAgB,mBAChB,UAAU,cACV,UAAU,sBACV,kBAAkB,gDAClB,4CAA4C,mBAC5C,eAAe,aACf,SAAS,eACT,WAAW,gBACX,eAAe,CAAA,IAAK,EAAE,gBAAgB,CAAC,IAAI,CAAC,wBAC5C,gBAAgB,qBAChB,iBAAiB,cACjB,UAAU,iBACV,aAAa,kBACb,cAAc,YACd,QAAQ,cACR,aAAa,CAAC,qBACd,4DAA4D;IAC5D,mBAAmB,CAAC,sBACpB,oBAAoB,CAAC,gBACrB,WAAW,oBACX,gBAAgB,gBAChB,eAAe,CAAC,GAChB,GAAG,YACJ,GAAG;IACJ,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,oBAAY,EAAE;IACjC,IAAI,qBAAgC;IACpC,IAAI,OAAO,iBAAiB,YAC1B,qBAAqB,aAAa,QAAQ,oBAAoB,QAAQ,qBAAqB,OACvF,aAAa;mBACb;0BACA;2BACA;IACF,KACE;SAEJ,qBAAqB;IAEvB,IAAI,cAAc,CAAC,CAAC,eAAe,sBAAuB,CAAA,aAAa,oBAAoB,SAAQ;IACnG,IAAI,mBAAmB,CAAA,GAAA,YAAI;IAE3B,IAAI,uBAAuB,CAAA,GAAA,YAAI;IAC/B,IAAI,SAAS,kBAAkB,CAAC,WAAW,EAAE,EAC3C,WAAW,EAAE,GAAG;IAGlB,IAAI,oBAAoB,CAAA,GAAA,iBAAS,EAC7B,CAAA,GAAA,4DAAU,GACV,kBACF;QACE,+BAA+B,kBA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AAA,GAAA,iBAAS,EAAE,CAAA,GAAA,4DAAU,GAAG;qBACtC,gCAAC;QAAI,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,4DAAU,GAAG;OACrC;IAMT,qBACG,gCAAC;QACC,GAAG,UAAU;QACb,GAAG,YAAY;QAChB,KAAK;QACL,WAAW;OACV,wBACA;AAGP;AAEA,IAAI,0DAAS,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/label/src/Field.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 {classNames, SlotProvider, useStyleProps} from '@react-spectrum/utils';\nimport {Flex} from '@react-spectrum/layout';\nimport {HelpText} from './HelpText';\nimport {Label} from './Label';\nimport {LabelPosition} from '@react-types/shared';\nimport labelStyles from '@adobe/spectrum-css-temp/components/fieldlabel/vars.css';\nimport {mergeProps, useId} from '@react-aria/utils';\nimport React, {ReactNode, Ref, RefObject} from 'react';\nimport {SpectrumFieldProps} from '@react-types/label';\nimport {useFormProps} from '@react-spectrum/form';\n\nfunction Field(props: SpectrumFieldProps, ref: Ref<HTMLElement>) {\n let formProps = useFormProps(props);\n let isInForm = formProps !== props;\n props = formProps;\n let {\n label,\n labelPosition = 'top' as LabelPosition,\n labelAlign,\n isRequired,\n necessityIndicator,\n includeNecessityIndicatorInAccessibilityName,\n validationState,\n isInvalid,\n description,\n errorMessage = e => e.validationErrors.join(' '),\n validationErrors,\n validationDetails,\n isDisabled,\n showErrorIcon,\n contextualHelp,\n children,\n labelProps = {},\n // Not every component that uses <Field> supports help text.\n descriptionProps = {},\n errorMessageProps = {},\n elementType,\n wrapperClassName,\n wrapperProps = {},\n ...otherProps\n } = props;\n let {styleProps} = useStyleProps(otherProps);\n let errorMessageString: ReactNode = null;\n if (typeof errorMessage === 'function') {\n errorMessageString = isInvalid != null && validationErrors != null && validationDetails != null\n ? errorMessage({\n isInvalid,\n validationErrors,\n validationDetails\n })\n : null;\n } else {\n errorMessageString = errorMessage;\n }\n let hasHelpText = !!description || errorMessageString && (isInvalid || validationState === 'invalid');\n let contextualHelpId = useId();\n\n let fallbackLabelPropsId = useId();\n if (label && contextualHelp && !labelProps.id) {\n labelProps.id = fallbackLabelPropsId;\n }\n\n let labelWrapperClass = classNames(\n labelStyles,\n 'spectrum-Field',\n {\n 'spectrum-Field--positionTop': labelPosition === 'top',\n 'spectrum-Field--positionSide': labelPosition === 'side',\n 'spectrum-Field--alignEnd': labelAlign === 'end',\n 'spectrum-Field--hasContextualHelp': !!props.contextualHelp\n },\n styleProps.className,\n wrapperClassName\n );\n\n children = React.cloneElement(children, mergeProps(children.props as any, {\n className: classNames(\n labelStyles,\n 'spectrum-Field-field'\n )\n }));\n\n let renderHelpText = () => (\n <HelpText\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n description={description}\n errorMessage={errorMessageString}\n validationState={validationState}\n isInvalid={isInvalid}\n isDisabled={isDisabled}\n showErrorIcon={showErrorIcon}\n gridArea={labelStyles.helpText} />\n );\n\n let renderChildren = () => {\n if (labelPosition === 'side') {\n return (\n <Flex direction=\"column\" UNSAFE_className={classNames(labelStyles, 'spectrum-Field-wrapper')}>\n {children}\n {hasHelpText && renderHelpText()}\n </Flex>\n );\n }\n\n return (\n <>\n {children}\n {hasHelpText && renderHelpText()}\n </>\n );\n };\n\n let labelAndContextualHelp = (\n <>\n {label && (\n <Label\n {...labelProps}\n labelPosition={labelPosition}\n labelAlign={labelAlign}\n isRequired={isRequired}\n necessityIndicator={necessityIndicator}\n includeNecessityIndicatorInAccessibilityName={includeNecessityIndicatorInAccessibilityName}\n elementType={elementType}>\n {label}\n </Label>\n )}\n {label && contextualHelp &&\n <SlotProvider\n slots={{\n actionButton: {\n UNSAFE_className: classNames(labelStyles, 'spectrum-Field-contextualHelp'),\n id: contextualHelpId,\n 'aria-labelledby': labelProps?.id ? `${labelProps.id} ${contextualHelpId}` : undefined\n }\n }}>\n {contextualHelp}\n </SlotProvider>\n }\n </>\n );\n\n // Need to add an extra wrapper for the label and contextual help if labelPosition is side,\n // so that the table layout works inside forms.\n if (isInForm && labelPosition === 'side' && label && contextualHelp) {\n labelAndContextualHelp = (\n <div className={classNames(labelStyles, 'spectrum-Field-labelCell')}>\n <div className={classNames(labelStyles, 'spectrum-Field-labelWrapper')}>\n {labelAndContextualHelp}\n </div>\n </div>\n );\n }\n\n return (\n (<div\n {...styleProps}\n {...wrapperProps}\n ref={ref as RefObject<HTMLDivElement | null>}\n className={labelWrapperClass}>\n {labelAndContextualHelp}\n {renderChildren()}\n </div>)\n );\n}\n\nlet _Field = React.forwardRef(Field);\nexport {_Field as Field};\n"],"names":[],"version":3,"file":"Field.module.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAaD,SAAS,4BAAM,KAAyB,EAAE,GAAqB;IAC7D,IAAI,YAAY,CAAA,GAAA,mBAAW,EAAE;IAC7B,IAAI,WAAW,cAAc;IAC7B,QAAQ;IACR,IAAI,SACF,KAAK,iBACL,gBAAgB,mBAChB,UAAU,cACV,UAAU,sBACV,kBAAkB,gDAClB,4CAA4C,mBAC5C,eAAe,aACf,SAAS,eACT,WAAW,gBACX,eAAe,CAAA,IAAK,EAAE,gBAAgB,CAAC,IAAI,CAAC,wBAC5C,gBAAgB,qBAChB,iBAAiB,cACjB,UAAU,iBACV,aAAa,kBACb,cAAc,YACd,QAAQ,cACR,aAAa,CAAC,qBACd,4DAA4D;IAC5D,mBAAmB,CAAC,sBACpB,oBAAoB,CAAC,gBACrB,WAAW,oBACX,gBAAgB,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;QAKtB,qBACE,kEACG,UACA,eAAe;IAGtB;IAEA,IAAI,uCACF,kEACG,uBACC,gCAAC,CAAA,GAAA,yCAAI;QACF,GAAG,UAAU;QACd,eAAe;QACf,YAAY;QACZ,YAAY;QACZ,oBAAoB;QACpB,8CAA8C;QAC9C,aAAa;OACZ,QAGJ,SAAS,gCACR,gCAAC,CAAA,GAAA,mBAAW;QACV,OAAO;YACL,cAAc;gBACZ,kBAAkB,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,4DAAU,GAAG;gBAC1C,IAAI;gBACJ,mBAAmB,CAAA,uBAAA,iCAAA,WAAY,EAAE,IAAG,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,EAAE,iBAAiB,CAAC,GAAG;YAC/E;QACF;OACC;IAMP,2FAA2F;IAC3F,+CAA+C;IACjD,IAAI,YAAY,kBAAkB,UAAU,SAAS,gBACnD,uCACE,gCAAC;QAAI,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,4DAAU,GAAG;qBACtC,gCAAC;QAAI,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,4DAAU,GAAG;OACrC;IAMT,qBACG,gCAAC;QACC,GAAG,UAAU;QACb,GAAG,YAAY;QAChB,KAAK;QACL,WAAW;OACV,wBACA;AAGP;AAEA,IAAI,0DAAS,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/label/src/Field.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 {classNames, SlotProvider, useStyleProps} from '@react-spectrum/utils';\nimport {Flex} from '@react-spectrum/layout';\nimport {HelpText} from './HelpText';\nimport {Label} from './Label';\nimport {LabelPosition, RefObject} from '@react-types/shared';\nimport labelStyles from '@adobe/spectrum-css-temp/components/fieldlabel/vars.css';\nimport {mergeProps, useId} from '@react-aria/utils';\nimport React, {ReactNode, Ref} from 'react';\nimport {SpectrumFieldProps} from '@react-types/label';\nimport {useFormProps} from '@react-spectrum/form';\n\nfunction Field(props: SpectrumFieldProps, ref: Ref<HTMLElement>) {\n let formProps = useFormProps(props);\n let isInForm = formProps !== props;\n props = formProps;\n let {\n label,\n labelPosition = 'top' as LabelPosition,\n labelAlign,\n isRequired,\n necessityIndicator,\n includeNecessityIndicatorInAccessibilityName,\n validationState,\n isInvalid,\n description,\n errorMessage = e => e.validationErrors.join(' '),\n validationErrors,\n validationDetails,\n isDisabled,\n showErrorIcon,\n contextualHelp,\n children,\n labelProps = {},\n // Not every component that uses <Field> supports help text.\n descriptionProps = {},\n errorMessageProps = {},\n elementType,\n wrapperClassName,\n wrapperProps = {},\n ...otherProps\n } = props;\n let {styleProps} = useStyleProps(otherProps);\n let errorMessageString: ReactNode = null;\n if (typeof errorMessage === 'function') {\n errorMessageString = isInvalid != null && validationErrors != null && validationDetails != null\n ? errorMessage({\n isInvalid,\n validationErrors,\n validationDetails\n })\n : null;\n } else {\n errorMessageString = errorMessage;\n }\n let hasHelpText = !!description || errorMessageString && (isInvalid || validationState === 'invalid');\n let contextualHelpId = useId();\n\n let fallbackLabelPropsId = useId();\n if (label && contextualHelp && !labelProps.id) {\n labelProps.id = fallbackLabelPropsId;\n }\n\n let labelWrapperClass = classNames(\n labelStyles,\n 'spectrum-Field',\n {\n 'spectrum-Field--positionTop': labelPosition === 'top',\n 'spectrum-Field--positionSide': labelPosition === 'side',\n 'spectrum-Field--alignEnd': labelAlign === 'end',\n 'spectrum-Field--hasContextualHelp': !!props.contextualHelp\n },\n styleProps.className,\n wrapperClassName\n );\n\n children = React.cloneElement(children, mergeProps(children.props as any, {\n className: classNames(\n labelStyles,\n 'spectrum-Field-field'\n )\n }));\n\n let renderHelpText = () => (\n <HelpText\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n description={description}\n errorMessage={errorMessageString}\n validationState={validationState}\n isInvalid={isInvalid}\n isDisabled={isDisabled}\n showErrorIcon={showErrorIcon}\n gridArea={labelStyles.helpText} />\n );\n\n let renderChildren = () => {\n if (labelPosition === 'side') {\n return (\n <Flex direction=\"column\" UNSAFE_className={classNames(labelStyles, 'spectrum-Field-wrapper')}>\n {children}\n {hasHelpText && renderHelpText()}\n </Flex>\n );\n }\n\n return (\n <>\n {children}\n {hasHelpText && renderHelpText()}\n </>\n );\n };\n\n let labelAndContextualHelp = (\n <>\n {label && (\n <Label\n {...labelProps}\n labelPosition={labelPosition}\n labelAlign={labelAlign}\n isRequired={isRequired}\n necessityIndicator={necessityIndicator}\n includeNecessityIndicatorInAccessibilityName={includeNecessityIndicatorInAccessibilityName}\n elementType={elementType}>\n {label}\n </Label>\n )}\n {label && contextualHelp &&\n <SlotProvider\n slots={{\n actionButton: {\n UNSAFE_className: classNames(labelStyles, 'spectrum-Field-contextualHelp'),\n id: contextualHelpId,\n 'aria-labelledby': labelProps?.id ? `${labelProps.id} ${contextualHelpId}` : undefined\n }\n }}>\n {contextualHelp}\n </SlotProvider>\n }\n </>\n );\n\n // Need to add an extra wrapper for the label and contextual help if labelPosition is side,\n // so that the table layout works inside forms.\n if (isInForm && labelPosition === 'side' && label && contextualHelp) {\n labelAndContextualHelp = (\n <div className={classNames(labelStyles, 'spectrum-Field-labelCell')}>\n <div className={classNames(labelStyles, 'spectrum-Field-labelWrapper')}>\n {labelAndContextualHelp}\n </div>\n </div>\n );\n }\n\n return (\n (<div\n {...styleProps}\n {...wrapperProps}\n ref={ref as RefObject<HTMLDivElement | null>}\n className={labelWrapperClass}>\n {labelAndContextualHelp}\n {renderChildren()}\n </div>)\n );\n}\n\nlet _Field = React.forwardRef(Field);\nexport {_Field as Field};\n"],"names":[],"version":3,"file":"Field.module.js.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-spectrum/label",
3
- "version": "3.16.7-nightly.4700+81abb2185",
3
+ "version": "3.16.7-nightly.4704+546ffa41f",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -36,18 +36,18 @@
36
36
  "url": "https://github.com/adobe/react-spectrum"
37
37
  },
38
38
  "dependencies": {
39
- "@react-aria/i18n": "3.0.0-nightly.2988+81abb2185",
40
- "@react-aria/utils": "3.0.0-nightly.2988+81abb2185",
41
- "@react-spectrum/form": "3.0.0-nightly.2988+81abb2185",
42
- "@react-spectrum/layout": "3.6.6-nightly.4700+81abb2185",
43
- "@react-spectrum/utils": "3.0.0-nightly.2988+81abb2185",
44
- "@react-types/label": "3.0.0-nightly.2988+81abb2185",
45
- "@react-types/shared": "3.0.0-nightly.2988+81abb2185",
46
- "@spectrum-icons/ui": "3.0.0-nightly.2988+81abb2185",
39
+ "@react-aria/i18n": "3.0.0-nightly.2992+546ffa41f",
40
+ "@react-aria/utils": "3.0.0-nightly.2992+546ffa41f",
41
+ "@react-spectrum/form": "3.0.0-nightly.2992+546ffa41f",
42
+ "@react-spectrum/layout": "3.6.6-nightly.4704+546ffa41f",
43
+ "@react-spectrum/utils": "3.0.0-nightly.2992+546ffa41f",
44
+ "@react-types/label": "3.0.0-nightly.2992+546ffa41f",
45
+ "@react-types/shared": "3.0.0-nightly.2992+546ffa41f",
46
+ "@spectrum-icons/ui": "3.0.0-nightly.2992+546ffa41f",
47
47
  "@swc/helpers": "^0.5.0"
48
48
  },
49
49
  "devDependencies": {
50
- "@adobe/spectrum-css-temp": "3.0.0-nightly.2988+81abb2185"
50
+ "@adobe/spectrum-css-temp": "3.0.0-nightly.2992+546ffa41f"
51
51
  },
52
52
  "peerDependencies": {
53
53
  "@react-spectrum/provider": "^3.0.0",
@@ -56,5 +56,5 @@
56
56
  "publishConfig": {
57
57
  "access": "public"
58
58
  },
59
- "gitHead": "81abb2185cb3a9c52a8feaf76a136c64852aea13"
59
+ "gitHead": "546ffa41f7d1d3a566950a14d8f46cf726891220"
60
60
  }
package/src/Field.tsx CHANGED
@@ -14,10 +14,10 @@ import {classNames, SlotProvider, useStyleProps} from '@react-spectrum/utils';
14
14
  import {Flex} from '@react-spectrum/layout';
15
15
  import {HelpText} from './HelpText';
16
16
  import {Label} from './Label';
17
- import {LabelPosition} from '@react-types/shared';
17
+ import {LabelPosition, RefObject} from '@react-types/shared';
18
18
  import labelStyles from '@adobe/spectrum-css-temp/components/fieldlabel/vars.css';
19
19
  import {mergeProps, useId} from '@react-aria/utils';
20
- import React, {ReactNode, Ref, RefObject} from 'react';
20
+ import React, {ReactNode, Ref} from 'react';
21
21
  import {SpectrumFieldProps} from '@react-types/label';
22
22
  import {useFormProps} from '@react-spectrum/form';
23
23