Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/components/checkbox/src/use-checkbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ export function useCheckbox(props: UseCheckboxProps = {}) {

const {
inputProps,
labelProps,
isSelected,
isDisabled,
isReadOnly,
Expand Down Expand Up @@ -277,7 +278,7 @@ export function useCheckbox(props: UseCheckboxProps = {}) {
"data-readonly": dataAttr(inputProps.readOnly),
"data-focus-visible": dataAttr(isFocusVisible),
"data-indeterminate": dataAttr(isIndeterminate),
...mergeProps(hoverProps, otherProps),
...mergeProps(hoverProps, labelProps, otherProps),
};
}, [
slots,
Expand Down
4 changes: 2 additions & 2 deletions packages/components/radio/src/use-radio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export function useRadio(props: UseRadioProps) {
descriptionId,
]);

const {inputProps, isDisabled, isSelected, isPressed} = useReactAriaRadio(
const {inputProps, labelProps, isDisabled, isSelected, isPressed} = useReactAriaRadio(
{
value,
children: typeof children === "function" ? true : children,
Expand Down Expand Up @@ -166,7 +166,7 @@ export function useRadio(props: UseRadioProps) {
"data-hover-unselected": dataAttr(isHovered && !isSelected),
"data-readonly": dataAttr(inputProps.readOnly),
"aria-required": dataAttr(isRequired),
...mergeProps(hoverProps, otherProps),
...mergeProps(hoverProps, labelProps, otherProps),
};
},
[
Expand Down
8 changes: 6 additions & 2 deletions packages/components/switch/src/use-switch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,11 @@ export function useSwitch(originalProps: UseSwitchProps = {}) {
state.setSelected(isInputRefChecked);
}, [inputRef.current]);

const {inputProps, isPressed, isReadOnly} = useReactAriaSwitch(ariaSwitchProps, state, inputRef);
const {inputProps, labelProps, isPressed, isReadOnly} = useReactAriaSwitch(
ariaSwitchProps,
state,
inputRef,
);
const {focusProps, isFocused, isFocusVisible} = useFocusRing({autoFocus: inputProps.autoFocus});
const {hoverProps, isHovered} = useHover({
isDisabled: inputProps.disabled,
Expand All @@ -180,7 +184,7 @@ export function useSwitch(originalProps: UseSwitchProps = {}) {

const getBaseProps: PropGetter = (props) => {
return {
...mergeProps(hoverProps, otherProps, props),
...mergeProps(hoverProps, labelProps, otherProps, props),
ref: domRef,
className: slots.base({class: clsx(baseStyles, props?.className)}),
"data-disabled": dataAttr(isDisabled),
Expand Down