'use client'; "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function _export(target, all) { for(var name in all)Object.defineProperty(target, name, { enumerable: true, get: all[name] }); } _export(exports, { useRadioBase_unstable: function() { return useRadioBase_unstable; }, useRadio_unstable: function() { return useRadio_unstable; } }); const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard"); const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react")); const _reactlabel = require("@fluentui/react-label"); const _reactutilities = require("@fluentui/react-utilities"); const _RadioGroupContext = require("../../contexts/RadioGroupContext"); const _reacttabster = require("@fluentui/react-tabster"); const useRadio_unstable = (props, ref)=>{ const state = useRadioBase_unstable(props, ref); return { ...state, // eslint-disable-next-line @typescript-eslint/no-deprecated components: { ...state.components, label: _reactlabel.Label }, label: _reactutilities.slot.optional(props.label, { defaultProps: { ...state.label }, elementType: _reactlabel.Label }) }; }; const useRadioBase_unstable = (props, ref)=>{ const group = (0, _RadioGroupContext.useRadioGroupContextValue_unstable)(); const { name = group.name, checked = group.value !== undefined ? group.value === props.value : undefined, defaultChecked = group.defaultValue !== undefined ? group.defaultValue === props.value : undefined, labelPosition = group.layout === 'horizontal-stacked' ? 'below' : 'after', disabled = group.disabled, required = group.required, 'aria-describedby': ariaDescribedBy = group['aria-describedby'], onChange } = props; const nativeProps = (0, _reactutilities.getPartitionedNativeProps)({ props, primarySlotTagName: 'input', excludedPropNames: [ 'checked', 'defaultChecked', 'onChange' ] }); const root = _reactutilities.slot.always(props.root, { defaultProps: { ref: (0, _reacttabster.useFocusWithin)(), ...nativeProps.root }, elementType: 'span' }); const input = _reactutilities.slot.always(props.input, { defaultProps: { ref, type: 'radio', id: (0, _reactutilities.useId)('radio-', nativeProps.primary.id), name, checked, defaultChecked, disabled, required, 'aria-describedby': ariaDescribedBy, ...nativeProps.primary }, elementType: 'input' }); input.onChange = (0, _reactutilities.mergeCallbacks)(input.onChange, (ev)=>onChange === null || onChange === void 0 ? void 0 : onChange(ev, { value: ev.currentTarget.value })); const label = _reactutilities.slot.optional(props.label, { defaultProps: { htmlFor: input.id, disabled: input.disabled }, elementType: 'label' }); const indicator = _reactutilities.slot.always(props.indicator, { defaultProps: { 'aria-hidden': true }, elementType: 'div' }); return { labelPosition, components: { root: 'span', input: 'input', label: 'label', indicator: 'div' }, root, input, label, indicator }; };