From 5b4f1fcb87dcf15564ca31137e4f300febf4a93a Mon Sep 17 00:00:00 2001 From: Peterl561 Date: Sat, 7 Dec 2024 14:25:07 -0800 Subject: [PATCH 1/3] fix(checkbox): missing data-pressed attribute due to labelProps --- packages/components/checkbox/src/use-checkbox.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/components/checkbox/src/use-checkbox.ts b/packages/components/checkbox/src/use-checkbox.ts index 376541cb1d..fa72253276 100644 --- a/packages/components/checkbox/src/use-checkbox.ts +++ b/packages/components/checkbox/src/use-checkbox.ts @@ -195,6 +195,7 @@ export function useCheckbox(props: UseCheckboxProps = {}) { const { inputProps, + labelProps, isSelected, isDisabled, isReadOnly, @@ -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, From 323c7c859a213aa9f4f464c7e3d8c0e92ada8057 Mon Sep 17 00:00:00 2001 From: Peterl561 Date: Sat, 7 Dec 2024 14:25:29 -0800 Subject: [PATCH 2/3] fix(radio): missing data-pressed attribute due to labelProps --- packages/components/radio/src/use-radio.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/components/radio/src/use-radio.ts b/packages/components/radio/src/use-radio.ts index b171b1e006..4430ec5695 100644 --- a/packages/components/radio/src/use-radio.ts +++ b/packages/components/radio/src/use-radio.ts @@ -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, @@ -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), }; }, [ From 1f1e5069e9c9fbcd12353354c9194eea94f80576 Mon Sep 17 00:00:00 2001 From: Peterl561 Date: Sat, 7 Dec 2024 14:25:43 -0800 Subject: [PATCH 3/3] fix(switch): missing data-pressed attribute due to labelProps --- packages/components/switch/src/use-switch.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/components/switch/src/use-switch.ts b/packages/components/switch/src/use-switch.ts index 34adb52e54..0e3a89fbf8 100644 --- a/packages/components/switch/src/use-switch.ts +++ b/packages/components/switch/src/use-switch.ts @@ -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, @@ -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),