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OAAO;wBAAC;QAAU;OACnD,YAAY,QAAQ;AAI7B","sources":["packages/react-aria-components/src/RadioGroup.tsx"],"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\nimport {AriaRadioGroupProps, AriaRadioProps, useRadio, useRadioGroup} from 'react-aria/useRadioGroup';\n\nimport {\n  ClassNameOrFunction,\n  ContextValue,\n  dom,\n  Provider,\n  RACValidation,\n  removeDataAttributes,\n  RenderProps,\n  SlotProps,\n  useContextProps,\n  useRenderProps,\n  useSlot,\n  useSlottedContext\n} from './utils';\nimport {FieldErrorContext} from './FieldError';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {FormContext} from './Form';\nimport {forwardRefType, GlobalDOMAttributes, RefObject} from '@react-types/shared';\nimport {HoverEvents, Orientation} from '@react-types/shared';\nimport {LabelContext} from './Label';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {mergeRefs} from 'react-aria/mergeRefs';\nimport {RadioGroupState, useRadioGroupState} from 'react-stately/useRadioGroupState';\nimport React, {createContext, ForwardedRef, forwardRef, useMemo} from 'react';\nimport {SelectionIndicatorContext} from './SelectionIndicator';\nimport {SharedElementTransition} from './SharedElementTransition';\nimport {TextContext} from './Text';\nimport {useFocusRing} from 'react-aria/useFocusRing';\nimport {useHover} from 'react-aria/useHover';\nimport {useObjectRef} from 'react-aria/useObjectRef';\nimport {VisuallyHidden} from 'react-aria/VisuallyHidden';\n\nexport interface RadioGroupProps extends Omit<AriaRadioGroupProps, 'children' | 'label' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'>, RACValidation, RenderProps<RadioGroupRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {\n  /**\n   * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. A function may be provided to compute the class based on component state.\n   * @default 'react-aria-RadioGroup'\n   */\n  className?: ClassNameOrFunction<RadioGroupRenderProps>\n}\nexport interface RadioProps extends Omit<AriaRadioProps, 'children'>, HoverEvents, RenderProps<RadioRenderProps, 'label'>, SlotProps, Omit<GlobalDOMAttributes<HTMLLabelElement>, 'onClick'> {\n  /**\n   * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. A function may be provided to compute the class based on component state.\n   * @default 'react-aria-Radio'\n   */\n  className?: ClassNameOrFunction<RadioRenderProps>,\n  /**\n   * A ref for the HTML input element.\n   */\n  inputRef?: RefObject<HTMLInputElement | null>\n}\n\nexport interface RadioGroupRenderProps {\n  /**\n   * The orientation of the radio group.\n   * @selector [data-orientation=\"horizontal | vertical\"]\n   */\n  orientation: Orientation,\n  /**\n   * Whether the radio group is disabled.\n   * @selector [data-disabled]\n   */\n  isDisabled: boolean,\n  /**\n   * Whether the radio group is read only.\n   * @selector [data-readonly]\n   */\n  isReadOnly: boolean,\n  /**\n   * Whether the radio group is required.\n   * @selector [data-required]\n   */\n  isRequired: boolean,\n  /**\n   * Whether the radio group is invalid.\n   * @selector [data-invalid]\n   */\n  isInvalid: boolean,\n  /**\n   * State of the radio group.\n   */\n  state: RadioGroupState\n}\n\nexport interface RadioRenderProps {\n  /**\n   * Whether the radio is selected.\n   * @selector [data-selected]\n   */\n  isSelected: boolean,\n  /**\n   * Whether the radio is currently hovered with a mouse.\n   * @selector [data-hovered]\n   */\n  isHovered: boolean,\n  /**\n   * Whether the radio is currently in a pressed state.\n   * @selector [data-pressed]\n   */\n  isPressed: boolean,\n  /**\n   * Whether the radio is focused, either via a mouse or keyboard.\n   * @selector [data-focused]\n   */\n  isFocused: boolean,\n  /**\n   * Whether the radio is keyboard focused.\n   * @selector [data-focus-visible]\n   */\n  isFocusVisible: boolean,\n  /**\n   * Whether the radio is disabled.\n   * @selector [data-disabled]\n   */\n  isDisabled: boolean,\n  /**\n   * Whether the radio is read only.\n   * @selector [data-readonly]\n   */\n  isReadOnly: boolean,\n  /**\n   * Whether the radio is invalid.\n   * @selector [data-invalid]\n   */\n  isInvalid: boolean,\n  /**\n   * Whether the checkbox is required.\n   * @selector [data-required]\n   */\n  isRequired: boolean\n}\n\nexport const RadioGroupContext = createContext<ContextValue<RadioGroupProps, HTMLDivElement>>(null);\nexport const RadioContext = createContext<ContextValue<Partial<RadioProps>, HTMLLabelElement>>(null);\nexport const RadioGroupStateContext = createContext<RadioGroupState | null>(null);\n\n/**\n * A radio group allows a user to select a single item from a list of mutually exclusive options.\n */\nexport const RadioGroup = /*#__PURE__*/ (forwardRef as forwardRefType)(function RadioGroup(props: RadioGroupProps, ref: ForwardedRef<HTMLDivElement>) {\n  [props, ref] = useContextProps(props, ref, RadioGroupContext);\n  let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n  let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n  let state = useRadioGroupState({\n    ...props,\n    validationBehavior\n  });\n\n  let [labelRef, label] = useSlot(\n    !props['aria-label'] && !props['aria-labelledby']\n  );\n  let {radioGroupProps, labelProps, descriptionProps, errorMessageProps, ...validation} = useRadioGroup({\n    ...props,\n    label,\n    validationBehavior\n  }, state);\n\n  let renderProps = useRenderProps({\n    ...props,\n    values: {\n      orientation: props.orientation || 'vertical',\n      isDisabled: state.isDisabled,\n      isReadOnly: state.isReadOnly,\n      isRequired: state.isRequired,\n      isInvalid: state.isInvalid,\n      state\n    },\n    defaultClassName: 'react-aria-RadioGroup'\n  });\n\n  let DOMProps = filterDOMProps(props, {global: true});\n\n  return (\n    <dom.div\n      {...mergeProps(DOMProps, renderProps, radioGroupProps)}\n      ref={ref}\n      slot={props.slot || undefined}\n      data-orientation={props.orientation || 'vertical'}\n      data-invalid={state.isInvalid || undefined}\n      data-disabled={state.isDisabled || undefined}\n      data-readonly={state.isReadOnly || undefined}\n      data-required={state.isRequired || undefined}>\n      <Provider\n        values={[\n          [RadioGroupStateContext, state],\n          [LabelContext, {...labelProps, ref: labelRef, elementType: 'span'}],\n          [TextContext, {\n            slots: {\n              description: descriptionProps,\n              errorMessage: errorMessageProps\n            }\n          }],\n          [FieldErrorContext, validation]\n        ]}>\n        <SharedElementTransition>\n          {renderProps.children}\n        </SharedElementTransition>\n      </Provider>\n    </dom.div>\n  );\n});\n\n/**\n * A radio represents an individual option within a radio group.\n */\nexport const Radio = /*#__PURE__*/ (forwardRef as forwardRefType)(function Radio(props: RadioProps, ref: ForwardedRef<HTMLLabelElement>) {\n  let {\n    inputRef: userProvidedInputRef = null,\n    ...otherProps\n  } = props;\n  [props, ref] = useContextProps(otherProps, ref, RadioContext);\n  let state = React.useContext(RadioGroupStateContext)!;\n  let inputRef = useObjectRef(useMemo(() => mergeRefs(userProvidedInputRef, props.inputRef !== undefined ? props.inputRef : null), [userProvidedInputRef, props.inputRef]));\n  let {labelProps, inputProps, isSelected, isDisabled, isPressed} = useRadio({\n    ...removeDataAttributes<RadioProps>(props),\n    // ReactNode type doesn't allow function children.\n    children: typeof props.children === 'function' ? true : props.children\n  }, state, inputRef);\n  let {isFocused, isFocusVisible, focusProps} = useFocusRing();\n  let interactionDisabled = isDisabled || state.isReadOnly;\n\n  let {hoverProps, isHovered} = useHover({\n    ...props,\n    isDisabled: interactionDisabled\n  });\n\n  let renderProps = useRenderProps({\n    ...props,\n    defaultClassName: 'react-aria-Radio',\n    values: {\n      isSelected,\n      isPressed,\n      isHovered,\n      isFocused,\n      isFocusVisible,\n      isDisabled,\n      isReadOnly: state.isReadOnly,\n      isInvalid: state.isInvalid,\n      isRequired: state.isRequired\n    }\n  });\n\n  let DOMProps = filterDOMProps(props, {global: true});\n  delete DOMProps.id;\n  delete DOMProps.onClick;\n\n  return (\n    <dom.label\n      {...mergeProps(DOMProps, labelProps, hoverProps, renderProps)}\n      ref={ref}\n      data-selected={isSelected || undefined}\n      data-pressed={isPressed || undefined}\n      data-hovered={isHovered || undefined}\n      data-focused={isFocused || undefined}\n      data-focus-visible={isFocusVisible || undefined}\n      data-disabled={isDisabled || undefined}\n      data-readonly={state.isReadOnly || undefined}\n      data-invalid={state.isInvalid || undefined}\n      data-required={state.isRequired || undefined}>\n      <VisuallyHidden elementType=\"span\">\n        <input {...mergeProps(inputProps, focusProps)} ref={inputRef} />\n      </VisuallyHidden>\n      <SelectionIndicatorContext.Provider value={{isSelected}}>\n        {renderProps.children}\n      </SelectionIndicatorContext.Provider>\n    </dom.label>\n  );\n});\n"],"names":[],"version":3,"file":"RadioGroup.cjs.map"}