@react-spectrum/radio 3.0.0-nightly.1772 → 3.0.0-nightly.1778
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 +11 -3
- package/dist/main.js.map +1 -1
- package/dist/module.js +12 -4
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +12 -12
- package/src/RadioGroup.tsx +15 -2
package/dist/main.js
CHANGED
@@ -183,11 +183,12 @@ $53124a3a0fd56fca$export$1ad8646bcba21c0e = "spectrum-FieldGroup-group--horizont
|
|
183
183
|
function $aa5529d97b69d048$var$RadioGroup(props, ref) {
|
184
184
|
props = $ltKMc$reactspectrumprovider.useProviderProps(props);
|
185
185
|
props = $ltKMc$reactspectrumform.useFormProps(props);
|
186
|
-
let { isEmphasized: isEmphasized , isRequired: isRequired , necessityIndicator: necessityIndicator , label: label , labelPosition: labelPosition = 'top' , labelAlign: labelAlign , validationState: validationState , children: children , orientation: orientation = 'vertical' , ...otherProps } = props;
|
186
|
+
let { isEmphasized: isEmphasized , isRequired: isRequired , necessityIndicator: necessityIndicator , label: label , labelPosition: labelPosition = 'top' , labelAlign: labelAlign , validationState: validationState , children: children , orientation: orientation = 'vertical' , description: description , errorMessage: errorMessage , showErrorIcon: showErrorIcon , ...otherProps } = props;
|
187
187
|
let domRef = $ltKMc$reactspectrumutils.useDOMRef(ref);
|
188
188
|
let { styleProps: styleProps } = $ltKMc$reactspectrumutils.useStyleProps(otherProps);
|
189
|
+
let hasHelpText = !!description || errorMessage && validationState === 'invalid';
|
189
190
|
let state = $ltKMc$reactstatelyradio.useRadioGroupState(props);
|
190
|
-
let { radioGroupProps: radioGroupProps , labelProps: labelProps } = $ltKMc$reactariaradio.useRadioGroup(props, state);
|
191
|
+
let { radioGroupProps: radioGroupProps , labelProps: labelProps , descriptionProps: descriptionProps , errorMessageProps: errorMessageProps } = $ltKMc$reactariaradio.useRadioGroup(props, state);
|
191
192
|
return(/*#__PURE__*/ ($parcel$interopDefault($ltKMc$react)).createElement("div", {
|
192
193
|
...styleProps,
|
193
194
|
...radioGroupProps,
|
@@ -213,7 +214,14 @@ function $aa5529d97b69d048$var$RadioGroup(props, ref) {
|
|
213
214
|
validationState: validationState,
|
214
215
|
state: state
|
215
216
|
}
|
216
|
-
}, children))))
|
217
|
+
}, children)), hasHelpText && /*#__PURE__*/ ($parcel$interopDefault($ltKMc$react)).createElement($ltKMc$reactspectrumlabel.HelpText, {
|
218
|
+
descriptionProps: descriptionProps,
|
219
|
+
errorMessageProps: errorMessageProps,
|
220
|
+
description: description,
|
221
|
+
errorMessage: errorMessage,
|
222
|
+
validationState: validationState,
|
223
|
+
showErrorIcon: showErrorIcon
|
224
|
+
})));
|
217
225
|
}
|
218
226
|
/**
|
219
227
|
* Radio groups allow users to select a single option from a list of mutually exclusive options.
|
package/dist/main.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AEAA,GAAgC;AAChC,GAAsC;AACtC,GAAuC;AACvC,GAA4B;AAC5B,GAAsC;AACtC,GAA4C;AAC5C,GAA4B;AAC5B,GAAuC;AACvC,GAA4B;AAR5B,yCAAgC,GAAG,CAAuB;AAC1D,yCAAsC,GAAG,CAA6B;AACtE,yCAAuC,GAAG,CAA8B;AACxE,yCAA4B,GAAG,CAAmB;AAClD,yCAAsC,GAAG,CAA6B;AACtE,yCAA4C,GAAG,CAAmC;AAClF,yCAA4B,GAAG,CAAmB;AAClD,yCAAuC,GAAG,CAA8B;AACxE,yCAA4B,GAAG,CAAmB;;;;;;ACc3C,KAAK,CAAC,yCAAY,GAAG,sCAAK,CAAC,aAAa,CAA2B,IAAI;SAE9D,yCAAgB,GAAsB,CAAC;IACrD,MAAM,CAAC,uBAAU,CAAC,yCAAY;AAChC,CAAC;;;SFJQ,2BAAK,CAAC,KAAyB,EAAE,GAAmC,EAAE,CAAC;IAC9E,GAAG,CAAC,CAA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ages/@react-spectrum/radio/src/Radio.tsx","packages/@adobe/spectrum-css-temp/components/radio/vars.css","packages/@react-spectrum/radio/src/context.ts","packages/@react-spectrum/radio/src/RadioGroup.tsx","packages/@adobe/spectrum-css-temp/components/fieldlabel/vars.css","packages/@adobe/spectrum-css-temp/components/fieldgroup/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/// <reference types=\"css-module-types\" />\n\nexport {Radio} from './Radio';\nexport {RadioGroup} from './RadioGroup';\nexport type {SpectrumRadioProps} from '@react-types/radio';\nexport type {SpectrumRadioGroupProps} from '@react-types/radio';\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 {classNames, useFocusableRef, useStyleProps} from '@react-spectrum/utils';\nimport {FocusableRef} from '@react-types/shared';\nimport {FocusRing} from '@react-aria/focus';\nimport React, {forwardRef, useRef} from 'react';\nimport {SpectrumRadioProps} from '@react-types/radio';\nimport styles from '@adobe/spectrum-css-temp/components/radio/vars.css';\nimport {useHover} from '@react-aria/interactions';\nimport {useRadio} from '@react-aria/radio';\nimport {useRadioProvider} from './context';\n\nfunction Radio(props: SpectrumRadioProps, ref: FocusableRef<HTMLLabelElement>) {\n let {\n isDisabled,\n children,\n autoFocus,\n ...otherProps\n } = props;\n let {styleProps} = useStyleProps(otherProps);\n let {hoverProps, isHovered} = useHover({isDisabled});\n\n let inputRef = useRef<HTMLInputElement>(null);\n let domRef = useFocusableRef(ref, inputRef);\n\n let radioGroupProps = useRadioProvider();\n let {\n isEmphasized,\n validationState,\n state\n } = radioGroupProps;\n\n let {inputProps} = useRadio({\n ...props,\n ...radioGroupProps,\n isDisabled\n }, state, inputRef);\n\n return (\n <label\n {...styleProps}\n {...hoverProps}\n ref={domRef}\n className={\n classNames(\n styles,\n 'spectrum-Radio',\n {\n // Removing. Pending design feedback.\n // 'spectrum-Radio--labelBelow': labelPosition === 'bottom',\n 'spectrum-Radio--quiet': !isEmphasized,\n 'is-disabled': isDisabled,\n 'is-invalid': validationState === 'invalid',\n 'is-hovered': isHovered\n },\n styleProps.className\n )\n }>\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')} autoFocus={autoFocus}>\n <input\n {...inputProps}\n ref={inputRef}\n className={classNames(styles, 'spectrum-Radio-input')} />\n </FocusRing>\n <span className={classNames(styles, 'spectrum-Radio-button')} />\n {children && (\n <span className={classNames(styles, 'spectrum-Radio-label')}>\n {children}\n </span>\n )}\n </label>\n );\n}\n\n/**\n * Radio buttons allow users to select a single option from a list of mutually exclusive options.\n * All possible options are exposed up front for users to compare.\n */\nconst _Radio = forwardRef(Radio);\nexport {_Radio as Radio};\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","/*\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 {RadioGroupState} from '@react-stately/radio';\nimport React, {useContext} from 'react';\n\ninterface RadioGroupContext {\n isEmphasized?: boolean,\n name?: string,\n validationState?: 'valid' | 'invalid',\n state: RadioGroupState\n}\n\nexport const RadioContext = React.createContext<RadioGroupContext | null>(null);\n\nexport function useRadioProvider(): RadioGroupContext {\n return useContext(RadioContext);\n}\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 {classNames, useDOMRef, useStyleProps} from '@react-spectrum/utils';\nimport {DOMRef, LabelPosition} from '@react-types/shared';\nimport {Label} from '@react-spectrum/label';\nimport labelStyles from '@adobe/spectrum-css-temp/components/fieldlabel/vars.css';\nimport {RadioContext} from './context';\nimport React from 'react';\nimport {SpectrumRadioGroupProps} from '@react-types/radio';\nimport styles from '@adobe/spectrum-css-temp/components/fieldgroup/vars.css';\nimport {useFormProps} from '@react-spectrum/form';\nimport {useProviderProps} from '@react-spectrum/provider';\nimport {useRadioGroup} from '@react-aria/radio';\nimport {useRadioGroupState} from '@react-stately/radio';\n\nfunction RadioGroup(props: SpectrumRadioGroupProps, ref: DOMRef<HTMLDivElement>) {\n props = useProviderProps(props);\n props = useFormProps(props);\n let {\n isEmphasized,\n isRequired,\n necessityIndicator,\n label,\n labelPosition = 'top' as LabelPosition,\n labelAlign,\n validationState,\n children,\n orientation = 'vertical',\n ...otherProps\n } = props;\n let domRef = useDOMRef(ref);\n let {styleProps} = useStyleProps(otherProps);\n\n let state = useRadioGroupState(props);\n let {radioGroupProps, labelProps} = useRadioGroup(props, state);\n\n return (\n <div\n {...styleProps}\n {...radioGroupProps}\n className={\n classNames(\n styles,\n 'spectrum-FieldGroup',\n {\n 'spectrum-FieldGroup--positionSide': labelPosition === 'side'\n },\n // This is so radio works inside a <Form>\n classNames(\n labelStyles,\n 'spectrum-Field'\n ),\n styleProps.className\n )\n }\n ref={domRef}>\n {label &&\n <Label\n {...labelProps}\n elementType=\"span\"\n labelPosition={labelPosition}\n labelAlign={labelAlign}\n isRequired={isRequired}\n necessityIndicator={necessityIndicator}>\n {label}\n </Label>\n }\n <div\n className={\n classNames(\n styles,\n 'spectrum-FieldGroup-group',\n {\n 'spectrum-FieldGroup-group--horizontal': orientation === 'horizontal'\n }\n )\n }>\n <RadioContext.Provider\n value={{\n isEmphasized,\n validationState,\n state\n }}>\n {children}\n </RadioContext.Provider>\n </div>\n </div>\n );\n}\n\n/**\n * Radio groups allow users to select a single option from a list of mutually exclusive options.\n * All possible options are exposed up front for users to compare.\n */\nconst _RadioGroup = React.forwardRef(RadioGroup);\nexport {_RadioGroup as RadioGroup};\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","/*\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"],"names":[],"version":3,"file":"main.js.map"}
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AEAA,GAAgC;AAChC,GAAsC;AACtC,GAAuC;AACvC,GAA4B;AAC5B,GAAsC;AACtC,GAA4C;AAC5C,GAA4B;AAC5B,GAAuC;AACvC,GAA4B;AAR5B,yCAAgC,GAAG,CAAuB;AAC1D,yCAAsC,GAAG,CAA6B;AACtE,yCAAuC,GAAG,CAA8B;AACxE,yCAA4B,GAAG,CAAmB;AAClD,yCAAsC,GAAG,CAA6B;AACtE,yCAA4C,GAAG,CAAmC;AAClF,yCAA4B,GAAG,CAAmB;AAClD,yCAAuC,GAAG,CAA8B;AACxE,yCAA4B,GAAG,CAAmB;;;;;;ACc3C,KAAK,CAAC,yCAAY,GAAG,sCAAK,CAAC,aAAa,CAA2B,IAAI;SAE9D,yCAAgB,GAAsB,CAAC;IACrD,MAAM,CAAC,uBAAU,CAAC,yCAAY;AAChC,CAAC;;;SFJQ,2BAAK,CAAC,KAAyB,EAAE,GAAmC,EAAE,CAAC;IAC9E,GAAG,CAAC,CAAC,aACH,UAAU,aACV,QAAQ,cACR,SAAS,MACN,UAAU,CACf,CAAC,GAAG,KAAK;IACT,GAAG,CAAC,CAAC,aAAA,UAAU,EAAA,CAAC,GAAG,uCAAa,CAAC,UAAU;IAC3C,GAAG,CAAC,CAAC,aAAA,UAAU,cAAE,SAAS,EAAA,CAAC,GAAG,qCAAQ,CAAC,CAAC;oBAAA,UAAU;IAAA,CAAC;IAEnD,GAAG,CAAC,QAAQ,GAAG,mBAAM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ources":["packages/@react-spectrum/radio/src/index.ts","packages/@react-spectrum/radio/src/Radio.tsx","packages/@adobe/spectrum-css-temp/components/radio/vars.css","packages/@react-spectrum/radio/src/context.ts","packages/@react-spectrum/radio/src/RadioGroup.tsx","packages/@adobe/spectrum-css-temp/components/fieldlabel/vars.css","packages/@adobe/spectrum-css-temp/components/fieldgroup/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/// <reference types=\"css-module-types\" />\n\nexport {Radio} from './Radio';\nexport {RadioGroup} from './RadioGroup';\nexport type {SpectrumRadioProps} from '@react-types/radio';\nexport type {SpectrumRadioGroupProps} from '@react-types/radio';\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 {classNames, useFocusableRef, useStyleProps} from '@react-spectrum/utils';\nimport {FocusableRef} from '@react-types/shared';\nimport {FocusRing} from '@react-aria/focus';\nimport React, {forwardRef, useRef} from 'react';\nimport {SpectrumRadioProps} from '@react-types/radio';\nimport styles from '@adobe/spectrum-css-temp/components/radio/vars.css';\nimport {useHover} from '@react-aria/interactions';\nimport {useRadio} from '@react-aria/radio';\nimport {useRadioProvider} from './context';\n\nfunction Radio(props: SpectrumRadioProps, ref: FocusableRef<HTMLLabelElement>) {\n let {\n isDisabled,\n children,\n autoFocus,\n ...otherProps\n } = props;\n let {styleProps} = useStyleProps(otherProps);\n let {hoverProps, isHovered} = useHover({isDisabled});\n\n let inputRef = useRef<HTMLInputElement>(null);\n let domRef = useFocusableRef(ref, inputRef);\n\n let radioGroupProps = useRadioProvider();\n let {\n isEmphasized,\n validationState,\n state\n } = radioGroupProps;\n\n let {inputProps} = useRadio({\n ...props,\n ...radioGroupProps,\n isDisabled\n }, state, inputRef);\n\n return (\n <label\n {...styleProps}\n {...hoverProps}\n ref={domRef}\n className={\n classNames(\n styles,\n 'spectrum-Radio',\n {\n // Removing. Pending design feedback.\n // 'spectrum-Radio--labelBelow': labelPosition === 'bottom',\n 'spectrum-Radio--quiet': !isEmphasized,\n 'is-disabled': isDisabled,\n 'is-invalid': validationState === 'invalid',\n 'is-hovered': isHovered\n },\n styleProps.className\n )\n }>\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')} autoFocus={autoFocus}>\n <input\n {...inputProps}\n ref={inputRef}\n className={classNames(styles, 'spectrum-Radio-input')} />\n </FocusRing>\n <span className={classNames(styles, 'spectrum-Radio-button')} />\n {children && (\n <span className={classNames(styles, 'spectrum-Radio-label')}>\n {children}\n </span>\n )}\n </label>\n );\n}\n\n/**\n * Radio buttons allow users to select a single option from a list of mutually exclusive options.\n * All possible options are exposed up front for users to compare.\n */\nconst _Radio = forwardRef(Radio);\nexport {_Radio as Radio};\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","/*\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 {RadioGroupState} from '@react-stately/radio';\nimport React, {useContext} from 'react';\n\ninterface RadioGroupContext {\n isEmphasized?: boolean,\n name?: string,\n validationState?: 'valid' | 'invalid',\n state: RadioGroupState\n}\n\nexport const RadioContext = React.createContext<RadioGroupContext | null>(null);\n\nexport function useRadioProvider(): RadioGroupContext {\n return useContext(RadioContext);\n}\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 {classNames, useDOMRef, useStyleProps} from '@react-spectrum/utils';\nimport {DOMRef, LabelPosition} from '@react-types/shared';\nimport {HelpText, Label} from '@react-spectrum/label';\nimport labelStyles from '@adobe/spectrum-css-temp/components/fieldlabel/vars.css';\nimport {RadioContext} from './context';\nimport React from 'react';\nimport {SpectrumRadioGroupProps} from '@react-types/radio';\nimport styles from '@adobe/spectrum-css-temp/components/fieldgroup/vars.css';\nimport {useFormProps} from '@react-spectrum/form';\nimport {useProviderProps} from '@react-spectrum/provider';\nimport {useRadioGroup} from '@react-aria/radio';\nimport {useRadioGroupState} from '@react-stately/radio';\n\nfunction RadioGroup(props: SpectrumRadioGroupProps, ref: DOMRef<HTMLDivElement>) {\n props = useProviderProps(props);\n props = useFormProps(props);\n let {\n isEmphasized,\n isRequired,\n necessityIndicator,\n label,\n labelPosition = 'top' as LabelPosition,\n labelAlign,\n validationState,\n children,\n orientation = 'vertical',\n description,\n errorMessage,\n showErrorIcon,\n ...otherProps\n } = props;\n let domRef = useDOMRef(ref);\n let {styleProps} = useStyleProps(otherProps);\n let hasHelpText = !!description || errorMessage && validationState === 'invalid';\n\n let state = useRadioGroupState(props);\n let {radioGroupProps, labelProps, descriptionProps, errorMessageProps} = useRadioGroup(props, state);\n\n return (\n <div\n {...styleProps}\n {...radioGroupProps}\n className={\n classNames(\n styles,\n 'spectrum-FieldGroup',\n {\n 'spectrum-FieldGroup--positionSide': labelPosition === 'side'\n },\n // This is so radio works inside a <Form>\n classNames(\n labelStyles,\n 'spectrum-Field'\n ),\n styleProps.className\n )\n }\n ref={domRef}>\n {label &&\n <Label\n {...labelProps}\n elementType=\"span\"\n labelPosition={labelPosition}\n labelAlign={labelAlign}\n isRequired={isRequired}\n necessityIndicator={necessityIndicator}>\n {label}\n </Label>\n }\n <div\n className={\n classNames(\n styles,\n 'spectrum-FieldGroup-group',\n {\n 'spectrum-FieldGroup-group--horizontal': orientation === 'horizontal'\n }\n )\n }>\n <RadioContext.Provider\n value={{\n isEmphasized,\n validationState,\n state\n }}>\n {children}\n </RadioContext.Provider>\n </div>\n {hasHelpText &&\n <HelpText\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n description={description}\n errorMessage={errorMessage}\n validationState={validationState}\n showErrorIcon={showErrorIcon} />\n }\n </div>\n );\n}\n\n/**\n * Radio groups allow users to select a single option from a list of mutually exclusive options.\n * All possible options are exposed up front for users to compare.\n */\nconst _RadioGroup = React.forwardRef(RadioGroup);\nexport {_RadioGroup as RadioGroup};\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","/*\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"],"names":[],"version":3,"file":"main.js.map"}
|
package/dist/module.js
CHANGED
@@ -4,7 +4,7 @@ import {FocusRing as $4hD9r$FocusRing} from "@react-aria/focus";
|
|
4
4
|
import $4hD9r$react, {useRef as $4hD9r$useRef, forwardRef as $4hD9r$forwardRef, useContext as $4hD9r$useContext} from "react";
|
5
5
|
import {useHover as $4hD9r$useHover} from "@react-aria/interactions";
|
6
6
|
import {useRadio as $4hD9r$useRadio, useRadioGroup as $4hD9r$useRadioGroup} from "@react-aria/radio";
|
7
|
-
import {Label as $4hD9r$Label} from "@react-spectrum/label";
|
7
|
+
import {Label as $4hD9r$Label, HelpText as $4hD9r$HelpText} from "@react-spectrum/label";
|
8
8
|
import {useFormProps as $4hD9r$useFormProps} from "@react-spectrum/form";
|
9
9
|
import {useProviderProps as $4hD9r$useProviderProps} from "@react-spectrum/provider";
|
10
10
|
import {useRadioGroupState as $4hD9r$useRadioGroupState} from "@react-stately/radio";
|
@@ -180,11 +180,12 @@ $4cb2b26710154c56$export$1ad8646bcba21c0e = "spectrum-FieldGroup-group--horizont
|
|
180
180
|
function $ac9b96486fc4badf$var$RadioGroup(props, ref) {
|
181
181
|
props = $4hD9r$useProviderProps(props);
|
182
182
|
props = $4hD9r$useFormProps(props);
|
183
|
-
let { isEmphasized: isEmphasized , isRequired: isRequired , necessityIndicator: necessityIndicator , label: label , labelPosition: labelPosition = 'top' , labelAlign: labelAlign , validationState: validationState , children: children , orientation: orientation = 'vertical' , ...otherProps } = props;
|
183
|
+
let { isEmphasized: isEmphasized , isRequired: isRequired , necessityIndicator: necessityIndicator , label: label , labelPosition: labelPosition = 'top' , labelAlign: labelAlign , validationState: validationState , children: children , orientation: orientation = 'vertical' , description: description , errorMessage: errorMessage , showErrorIcon: showErrorIcon , ...otherProps } = props;
|
184
184
|
let domRef = $4hD9r$useDOMRef(ref);
|
185
185
|
let { styleProps: styleProps } = $4hD9r$useStyleProps(otherProps);
|
186
|
+
let hasHelpText = !!description || errorMessage && validationState === 'invalid';
|
186
187
|
let state = $4hD9r$useRadioGroupState(props);
|
187
|
-
let { radioGroupProps: radioGroupProps , labelProps: labelProps } = $4hD9r$useRadioGroup(props, state);
|
188
|
+
let { radioGroupProps: radioGroupProps , labelProps: labelProps , descriptionProps: descriptionProps , errorMessageProps: errorMessageProps } = $4hD9r$useRadioGroup(props, state);
|
188
189
|
return(/*#__PURE__*/ $4hD9r$react.createElement("div", {
|
189
190
|
...styleProps,
|
190
191
|
...radioGroupProps,
|
@@ -210,7 +211,14 @@ function $ac9b96486fc4badf$var$RadioGroup(props, ref) {
|
|
210
211
|
validationState: validationState,
|
211
212
|
state: state
|
212
213
|
}
|
213
|
-
}, children))
|
214
|
+
}, children)), hasHelpText && /*#__PURE__*/ $4hD9r$react.createElement($4hD9r$HelpText, {
|
215
|
+
descriptionProps: descriptionProps,
|
216
|
+
errorMessageProps: errorMessageProps,
|
217
|
+
description: description,
|
218
|
+
errorMessage: errorMessage,
|
219
|
+
validationState: validationState,
|
220
|
+
showErrorIcon: showErrorIcon
|
221
|
+
})));
|
214
222
|
}
|
215
223
|
/**
|
216
224
|
* Radio groups allow users to select a single option from a list of mutually exclusive options.
|
package/dist/module.js.map
CHANG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ACD,EAAyC,AAAzC,uCAAyC;QACzC,iBAAU,CACR,gEAAW,EACX,CAAgB,kBAElB,UAAU,CAAC,SAAS;QAGxB,GAAG,EAAE,MAAM;OACV,KAAK,6CACH,YAAK;WACA,UAAU;QACd,WAAW,EAAC,CAAM;QAClB,aAAa,EAAE,aAAa;QAC5B,UAAU,EAAE,UAAU;QACtB,UAAU,EAAE,UAAU;QACtB,kBAAkB,EAAE,kBAAkB;OACrC,KAAK,4CAGT,CAAG;QACF,SAAS,EACP,iBAAU,CACR,gEAAM,EACN,CAA2B,4BAC3B,CAAC;YACC,CAAuC,wCAAE,WAAW,KAAK,CAAY;QACvE,CAAC;gDAGJ,yCAAY,CAAC,QAAQ;QACpB,KAAK,EAAE,CAAC;0BACN,YAAY;6BACZ,eAAe;mBACf,KAAK;QACP,CAAC;OACA,QAAQ;AAKnB,CAAC;AAED,EAGG,AAHH;;;CAGG,AAHH,EAGG,CACH,KAAK,CAAC,yCAAW,iBAAG,YAAK,CAAC,UAAU,CAAC,gCAAU;;","sources":["packages/@react-spectrum/radio/src/index.ts","packages/@react-spectrum/radio/src/Radio.tsx","packages/@adobe/spectrum-css-temp/components/radio/vars.css","packages/@react-spectrum/radio/src/context.ts","packages/@react-spectrum/radio/src/RadioGroup.tsx","packages/@adobe/spectrum-css-temp/components/fieldlabel/vars.css","packages/@adobe/spectrum-css-temp/components/fieldgroup/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/// <reference types=\"css-module-types\" />\n\nexport {Radio} from './Radio';\nexport {RadioGroup} from './RadioGroup';\nexport type {SpectrumRadioProps} from '@react-types/radio';\nexport type {SpectrumRadioGroupProps} from '@react-types/radio';\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 {classNames, useFocusableRef, useStyleProps} from '@react-spectrum/utils';\nimport {FocusableRef} from '@react-types/shared';\nimport {FocusRing} from '@react-aria/focus';\nimport React, {forwardRef, useRef} from 'react';\nimport {SpectrumRadioProps} from '@react-types/radio';\nimport styles from '@adobe/spectrum-css-temp/components/radio/vars.css';\nimport {useHover} from '@react-aria/interactions';\nimport {useRadio} from '@react-aria/radio';\nimport {useRadioProvider} from './context';\n\nfunction Radio(props: SpectrumRadioProps, ref: FocusableRef<HTMLLabelElement>) {\n let {\n isDisabled,\n children,\n autoFocus,\n ...otherProps\n } = props;\n let {styleProps} = useStyleProps(otherProps);\n let {hoverProps, isHovered} = useHover({isDisabled});\n\n let inputRef = useRef<HTMLInputElement>(null);\n let domRef = useFocusableRef(ref, inputRef);\n\n let radioGroupProps = useRadioProvider();\n let {\n isEmphasized,\n validationState,\n state\n } = radioGroupProps;\n\n let {inputProps} = useRadio({\n ...props,\n ...radioGroupProps,\n isDisabled\n }, state, inputRef);\n\n return (\n <label\n {...styleProps}\n {...hoverProps}\n ref={domRef}\n className={\n classNames(\n styles,\n 'spectrum-Radio',\n {\n // Removing. Pending design feedback.\n // 'spectrum-Radio--labelBelow': labelPosition === 'bottom',\n 'spectrum-Radio--quiet': !isEmphasized,\n 'is-disabled': isDisabled,\n 'is-invalid': validationState === 'invalid',\n 'is-hovered': isHovered\n },\n styleProps.className\n )\n }>\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')} autoFocus={autoFocus}>\n <input\n {...inputProps}\n ref={inputRef}\n className={classNames(styles, 'spectrum-Radio-input')} />\n </FocusRing>\n <span className={classNames(styles, 'spectrum-Radio-button')} />\n {children && (\n <span className={classNames(styles, 'spectrum-Radio-label')}>\n {children}\n </span>\n )}\n </label>\n );\n}\n\n/**\n * Radio buttons allow users to select a single option from a list of mutually exclusive options.\n * All possible options are exposed up front for users to compare.\n */\nconst _Radio = forwardRef(Radio);\nexport {_Radio as Radio};\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","/*\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 {RadioGroupState} from '@react-stately/radio';\nimport React, {useContext} from 'react';\n\ninterface RadioGroupContext {\n isEmphasized?: boolean,\n name?: string,\n validationState?: 'valid' | 'invalid',\n state: RadioGroupState\n}\n\nexport const RadioContext = React.createContext<RadioGroupContext | null>(null);\n\nexport function useRadioProvider(): RadioGroupContext {\n return useContext(RadioContext);\n}\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 {classNames, useDOMRef, useStyleProps} from '@react-spectrum/utils';\nimport {DOMRef, LabelPosition} from '@react-types/shared';\nimport {Label} from '@react-spectrum/label';\nimport labelStyles from '@adobe/spectrum-css-temp/components/fieldlabel/vars.css';\nimport {RadioContext} from './context';\nimport React from 'react';\nimport {SpectrumRadioGroupProps} from '@react-types/radio';\nimport styles from '@adobe/spectrum-css-temp/components/fieldgroup/vars.css';\nimport {useFormProps} from '@react-spectrum/form';\nimport {useProviderProps} from '@react-spectrum/provider';\nimport {useRadioGroup} from '@react-aria/radio';\nimport {useRadioGroupState} from '@react-stately/radio';\n\nfunction RadioGroup(props: SpectrumRadioGroupProps, ref: DOMRef<HTMLDivElement>) {\n props = useProviderProps(props);\n props = useFormProps(props);\n let {\n isEmphasized,\n isRequired,\n necessityIndicator,\n label,\n labelPosition = 'top' as LabelPosition,\n labelAlign,\n validationState,\n children,\n orientation = 'vertical',\n ...otherProps\n } = props;\n let domRef = useDOMRef(ref);\n let {styleProps} = useStyleProps(otherProps);\n\n let state = useRadioGroupState(props);\n let {radioGroupProps, labelProps} = useRadioGroup(props, state);\n\n return (\n <div\n {...styleProps}\n {...radioGroupProps}\n className={\n classNames(\n styles,\n 'spectrum-FieldGroup',\n {\n 'spectrum-FieldGroup--positionSide': labelPosition === 'side'\n },\n // This is so radio works inside a <Form>\n classNames(\n labelStyles,\n 'spectrum-Field'\n ),\n styleProps.className\n )\n }\n ref={domRef}>\n {label &&\n <Label\n {...labelProps}\n elementType=\"span\"\n labelPosition={labelPosition}\n labelAlign={labelAlign}\n isRequired={isRequired}\n necessityIndicator={necessityIndicator}>\n {label}\n </Label>\n }\n <div\n className={\n classNames(\n styles,\n 'spectrum-FieldGroup-group',\n {\n 'spectrum-FieldGroup-group--horizontal': orientation === 'horizontal'\n }\n )\n }>\n <RadioContext.Provider\n value={{\n isEmphasized,\n validationState,\n state\n }}>\n {children}\n </RadioContext.Provider>\n </div>\n </div>\n );\n}\n\n/**\n * Radio groups allow users to select a single option from a list of mutually exclusive options.\n * All possible options are exposed up front for users to compare.\n */\nconst _RadioGroup = React.forwardRef(RadioGroup);\nexport {_RadioGroup as RadioGroup};\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","/*\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"],"names":[],"version":3,"file":"module.js.map"}
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AEAA,GAAgC;AAChC,GAAsC;AACtC,GAAuC;AACvC,GAA4B;AAC5B,GAAsC;AACtC,GAA4C;AAC5C,GAA4B;AAC5B,GAAuC;AACvC,GAA4B;AAR5B,yCAAgC,GAAG,CAAuB;AAC1D,yCAAsC,GAAG,CAA6B;AACtE,yCAAuC,GAAG,CAA8B;AACxE,yCAA4B,GAAG,CA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C,CAAM;QAClB,aAAa,EAAE,aAAa;QAC5B,UAAU,EAAE,UAAU;QACtB,UAAU,EAAE,UAAU;QACtB,kBAAkB,EAAE,kBAAkB;OACrC,KAAK,4CAGT,CAAG;QACF,SAAS,EACP,iBAAU,CACR,gEAAM,EACN,CAA2B,4BAC3B,CAAC;YACC,CAAuC,wCAAE,WAAW,KAAK,CAAY;QACvE,CAAC;gDAGJ,yCAAY,CAAC,QAAQ;QACpB,KAAK,EAAE,CAAC;0BACN,YAAY;6BACZ,eAAe;mBACf,KAAK;QACP,CAAC;OACA,QAAQ,IAGZ,WAAW,6CACT,eAAQ;QACP,gBAAgB,EAAE,gBAAgB;QAClC,iBAAiB,EAAE,iBAAiB;QACpC,WAAW,EAAE,WAAW;QACxB,YAAY,EAAE,YAAY;QAC1B,eAAe,EAAE,eAAe;QAChC,aAAa,EAAE,aAAa;;AAItC,CAAC;AAED,EAGG,AAHH;;;CAGG,AAHH,EAGG,CACH,KAAK,CAAC,yCAAW,iBAAG,YAAK,CAAC,UAAU,CAAC,gCAAU;;","sources":["packages/@react-spectrum/radio/src/index.ts","packages/@react-spectrum/radio/src/Radio.tsx","packages/@adobe/spectrum-css-temp/components/radio/vars.css","packages/@react-spectrum/radio/src/context.ts","packages/@react-spectrum/radio/src/RadioGroup.tsx","packages/@adobe/spectrum-css-temp/components/fieldlabel/vars.css","packages/@adobe/spectrum-css-temp/components/fieldgroup/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/// <reference types=\"css-module-types\" />\n\nexport {Radio} from './Radio';\nexport {RadioGroup} from './RadioGroup';\nexport type {SpectrumRadioProps} from '@react-types/radio';\nexport type {SpectrumRadioGroupProps} from '@react-types/radio';\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 {classNames, useFocusableRef, useStyleProps} from '@react-spectrum/utils';\nimport {FocusableRef} from '@react-types/shared';\nimport {FocusRing} from '@react-aria/focus';\nimport React, {forwardRef, useRef} from 'react';\nimport {SpectrumRadioProps} from '@react-types/radio';\nimport styles from '@adobe/spectrum-css-temp/components/radio/vars.css';\nimport {useHover} from '@react-aria/interactions';\nimport {useRadio} from '@react-aria/radio';\nimport {useRadioProvider} from './context';\n\nfunction Radio(props: SpectrumRadioProps, ref: FocusableRef<HTMLLabelElement>) {\n let {\n isDisabled,\n children,\n autoFocus,\n ...otherProps\n } = props;\n let {styleProps} = useStyleProps(otherProps);\n let {hoverProps, isHovered} = useHover({isDisabled});\n\n let inputRef = useRef<HTMLInputElement>(null);\n let domRef = useFocusableRef(ref, inputRef);\n\n let radioGroupProps = useRadioProvider();\n let {\n isEmphasized,\n validationState,\n state\n } = radioGroupProps;\n\n let {inputProps} = useRadio({\n ...props,\n ...radioGroupProps,\n isDisabled\n }, state, inputRef);\n\n return (\n <label\n {...styleProps}\n {...hoverProps}\n ref={domRef}\n className={\n classNames(\n styles,\n 'spectrum-Radio',\n {\n // Removing. Pending design feedback.\n // 'spectrum-Radio--labelBelow': labelPosition === 'bottom',\n 'spectrum-Radio--quiet': !isEmphasized,\n 'is-disabled': isDisabled,\n 'is-invalid': validationState === 'invalid',\n 'is-hovered': isHovered\n },\n styleProps.className\n )\n }>\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')} autoFocus={autoFocus}>\n <input\n {...inputProps}\n ref={inputRef}\n className={classNames(styles, 'spectrum-Radio-input')} />\n </FocusRing>\n <span className={classNames(styles, 'spectrum-Radio-button')} />\n {children && (\n <span className={classNames(styles, 'spectrum-Radio-label')}>\n {children}\n </span>\n )}\n </label>\n );\n}\n\n/**\n * Radio buttons allow users to select a single option from a list of mutually exclusive options.\n * All possible options are exposed up front for users to compare.\n */\nconst _Radio = forwardRef(Radio);\nexport {_Radio as Radio};\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","/*\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 {RadioGroupState} from '@react-stately/radio';\nimport React, {useContext} from 'react';\n\ninterface RadioGroupContext {\n isEmphasized?: boolean,\n name?: string,\n validationState?: 'valid' | 'invalid',\n state: RadioGroupState\n}\n\nexport const RadioContext = React.createContext<RadioGroupContext | null>(null);\n\nexport function useRadioProvider(): RadioGroupContext {\n return useContext(RadioContext);\n}\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 {classNames, useDOMRef, useStyleProps} from '@react-spectrum/utils';\nimport {DOMRef, LabelPosition} from '@react-types/shared';\nimport {HelpText, Label} from '@react-spectrum/label';\nimport labelStyles from '@adobe/spectrum-css-temp/components/fieldlabel/vars.css';\nimport {RadioContext} from './context';\nimport React from 'react';\nimport {SpectrumRadioGroupProps} from '@react-types/radio';\nimport styles from '@adobe/spectrum-css-temp/components/fieldgroup/vars.css';\nimport {useFormProps} from '@react-spectrum/form';\nimport {useProviderProps} from '@react-spectrum/provider';\nimport {useRadioGroup} from '@react-aria/radio';\nimport {useRadioGroupState} from '@react-stately/radio';\n\nfunction RadioGroup(props: SpectrumRadioGroupProps, ref: DOMRef<HTMLDivElement>) {\n props = useProviderProps(props);\n props = useFormProps(props);\n let {\n isEmphasized,\n isRequired,\n necessityIndicator,\n label,\n labelPosition = 'top' as LabelPosition,\n labelAlign,\n validationState,\n children,\n orientation = 'vertical',\n description,\n errorMessage,\n showErrorIcon,\n ...otherProps\n } = props;\n let domRef = useDOMRef(ref);\n let {styleProps} = useStyleProps(otherProps);\n let hasHelpText = !!description || errorMessage && validationState === 'invalid';\n\n let state = useRadioGroupState(props);\n let {radioGroupProps, labelProps, descriptionProps, errorMessageProps} = useRadioGroup(props, state);\n\n return (\n <div\n {...styleProps}\n {...radioGroupProps}\n className={\n classNames(\n styles,\n 'spectrum-FieldGroup',\n {\n 'spectrum-FieldGroup--positionSide': labelPosition === 'side'\n },\n // This is so radio works inside a <Form>\n classNames(\n labelStyles,\n 'spectrum-Field'\n ),\n styleProps.className\n )\n }\n ref={domRef}>\n {label &&\n <Label\n {...labelProps}\n elementType=\"span\"\n labelPosition={labelPosition}\n labelAlign={labelAlign}\n isRequired={isRequired}\n necessityIndicator={necessityIndicator}>\n {label}\n </Label>\n }\n <div\n className={\n classNames(\n styles,\n 'spectrum-FieldGroup-group',\n {\n 'spectrum-FieldGroup-group--horizontal': orientation === 'horizontal'\n }\n )\n }>\n <RadioContext.Provider\n value={{\n isEmphasized,\n validationState,\n state\n }}>\n {children}\n </RadioContext.Provider>\n </div>\n {hasHelpText &&\n <HelpText\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n description={description}\n errorMessage={errorMessage}\n validationState={validationState}\n showErrorIcon={showErrorIcon} />\n }\n </div>\n );\n}\n\n/**\n * Radio groups allow users to select a single option from a list of mutually exclusive options.\n * All possible options are exposed up front for users to compare.\n */\nconst _RadioGroup = React.forwardRef(RadioGroup);\nexport {_RadioGroup as RadioGroup};\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","/*\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"],"names":[],"version":3,"file":"module.js.map"}
|
package/dist/types.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"mappings":";;ACoFA;;;GAGG;AACH,OAAA,MAAM,qKAA0B,CAAC;
|
1
|
+
{"mappings":";;ACoFA;;;GAGG;AACH,OAAA,MAAM,qKAA0B,CAAC;ACyBjC;;;GAGG;AACH,OAAA,MAAM,qJAA0C,CAAC;ACrGjD,YAAY,EAAC,kBAAkB,EAAC,MAAM,oBAAoB,CAAC;AAC3D,YAAY,EAAC,uBAAuB,EAAC,MAAM,oBAAoB,CAAC","sources":["packages/@react-spectrum/radio/src/packages/@react-spectrum/radio/src/context.ts","packages/@react-spectrum/radio/src/packages/@react-spectrum/radio/src/Radio.tsx","packages/@react-spectrum/radio/src/packages/@react-spectrum/radio/src/RadioGroup.tsx","packages/@react-spectrum/radio/src/packages/@react-spectrum/radio/src/index.ts","packages/@react-spectrum/radio/src/index.ts"],"sourcesContent":[null,null,null,null,"/*\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/// <reference types=\"css-module-types\" />\n\nexport {Radio} from './Radio';\nexport {RadioGroup} from './RadioGroup';\nexport type {SpectrumRadioProps} from '@react-types/radio';\nexport type {SpectrumRadioGroupProps} from '@react-types/radio';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@react-spectrum/radio",
|
3
|
-
"version": "3.0.0-nightly.
|
3
|
+
"version": "3.0.0-nightly.1778+c24dc2e01",
|
4
4
|
"description": "Spectrum UI components in React",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"main": "dist/main.js",
|
@@ -32,18 +32,18 @@
|
|
32
32
|
},
|
33
33
|
"dependencies": {
|
34
34
|
"@babel/runtime": "^7.6.2",
|
35
|
-
"@react-aria/focus": "3.0.0-nightly.
|
36
|
-
"@react-aria/interactions": "3.0.0-nightly.
|
37
|
-
"@react-aria/radio": "3.0.0-nightly.
|
38
|
-
"@react-spectrum/form": "3.0.0-nightly.
|
39
|
-
"@react-spectrum/label": "3.7.2-nightly.
|
40
|
-
"@react-spectrum/utils": "3.0.0-nightly.
|
41
|
-
"@react-stately/radio": "3.0.0-nightly.
|
42
|
-
"@react-types/radio": "3.0.0-nightly.
|
43
|
-
"@react-types/shared": "3.0.0-nightly.
|
35
|
+
"@react-aria/focus": "3.0.0-nightly.1778+c24dc2e01",
|
36
|
+
"@react-aria/interactions": "3.0.0-nightly.1778+c24dc2e01",
|
37
|
+
"@react-aria/radio": "3.0.0-nightly.1778+c24dc2e01",
|
38
|
+
"@react-spectrum/form": "3.0.0-nightly.1778+c24dc2e01",
|
39
|
+
"@react-spectrum/label": "3.7.2-nightly.3478+c24dc2e01",
|
40
|
+
"@react-spectrum/utils": "3.0.0-nightly.1778+c24dc2e01",
|
41
|
+
"@react-stately/radio": "3.0.0-nightly.1778+c24dc2e01",
|
42
|
+
"@react-types/radio": "3.0.0-nightly.1778+c24dc2e01",
|
43
|
+
"@react-types/shared": "3.0.0-nightly.1778+c24dc2e01"
|
44
44
|
},
|
45
45
|
"devDependencies": {
|
46
|
-
"@adobe/spectrum-css-temp": "3.0.0-nightly.
|
46
|
+
"@adobe/spectrum-css-temp": "3.0.0-nightly.1778+c24dc2e01"
|
47
47
|
},
|
48
48
|
"peerDependencies": {
|
49
49
|
"@react-spectrum/provider": "^3.0.0",
|
@@ -52,5 +52,5 @@
|
|
52
52
|
"publishConfig": {
|
53
53
|
"access": "public"
|
54
54
|
},
|
55
|
-
"gitHead": "
|
55
|
+
"gitHead": "c24dc2e0124fac3467b3adc48b1067f2447cd2b3"
|
56
56
|
}
|
package/src/RadioGroup.tsx
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
|
13
13
|
import {classNames, useDOMRef, useStyleProps} from '@react-spectrum/utils';
|
14
14
|
import {DOMRef, LabelPosition} from '@react-types/shared';
|
15
|
-
import {Label} from '@react-spectrum/label';
|
15
|
+
import {HelpText, Label} from '@react-spectrum/label';
|
16
16
|
import labelStyles from '@adobe/spectrum-css-temp/components/fieldlabel/vars.css';
|
17
17
|
import {RadioContext} from './context';
|
18
18
|
import React from 'react';
|
@@ -36,13 +36,17 @@ function RadioGroup(props: SpectrumRadioGroupProps, ref: DOMRef<HTMLDivElement>)
|
|
36
36
|
validationState,
|
37
37
|
children,
|
38
38
|
orientation = 'vertical',
|
39
|
+
description,
|
40
|
+
errorMessage,
|
41
|
+
showErrorIcon,
|
39
42
|
...otherProps
|
40
43
|
} = props;
|
41
44
|
let domRef = useDOMRef(ref);
|
42
45
|
let {styleProps} = useStyleProps(otherProps);
|
46
|
+
let hasHelpText = !!description || errorMessage && validationState === 'invalid';
|
43
47
|
|
44
48
|
let state = useRadioGroupState(props);
|
45
|
-
let {radioGroupProps, labelProps} = useRadioGroup(props, state);
|
49
|
+
let {radioGroupProps, labelProps, descriptionProps, errorMessageProps} = useRadioGroup(props, state);
|
46
50
|
|
47
51
|
return (
|
48
52
|
<div
|
@@ -94,6 +98,15 @@ function RadioGroup(props: SpectrumRadioGroupProps, ref: DOMRef<HTMLDivElement>)
|
|
94
98
|
{children}
|
95
99
|
</RadioContext.Provider>
|
96
100
|
</div>
|
101
|
+
{hasHelpText &&
|
102
|
+
<HelpText
|
103
|
+
descriptionProps={descriptionProps}
|
104
|
+
errorMessageProps={errorMessageProps}
|
105
|
+
description={description}
|
106
|
+
errorMessage={errorMessage}
|
107
|
+
validationState={validationState}
|
108
|
+
showErrorIcon={showErrorIcon} />
|
109
|
+
}
|
97
110
|
</div>
|
98
111
|
);
|
99
112
|
}
|