From 03614072d960498c07b8c719be9aec3b9ed9ef68 Mon Sep 17 00:00:00 2001 From: Rajat Chaudhary Date: Fri, 16 Feb 2024 15:48:51 +0530 Subject: [PATCH] feat: added checked for select component --- packages/config/src/theme/SelectActionsheetItem.ts | 4 ++++ packages/unstyled/actionsheet/src/ActionsheetItem.tsx | 5 ++++- packages/unstyled/select/src/SelectItem.tsx | 6 +++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/packages/config/src/theme/SelectActionsheetItem.ts b/packages/config/src/theme/SelectActionsheetItem.ts index 126f147878..ffc9dcad4f 100644 --- a/packages/config/src/theme/SelectActionsheetItem.ts +++ b/packages/config/src/theme/SelectActionsheetItem.ts @@ -24,6 +24,10 @@ export const SelectActionsheetItem = createStyle({ bg: '$backgroundLight200', }, + ':checked': { + bg: '$backgroundLight300', + }, + ':focus': { bg: '$backgroundLight100', }, diff --git a/packages/unstyled/actionsheet/src/ActionsheetItem.tsx b/packages/unstyled/actionsheet/src/ActionsheetItem.tsx index fbeb4f24db..987d130946 100644 --- a/packages/unstyled/actionsheet/src/ActionsheetItem.tsx +++ b/packages/unstyled/actionsheet/src/ActionsheetItem.tsx @@ -63,10 +63,11 @@ export function ActionsheetItem( states={{ hover: isHoveredProp || isHovered, focus: isFocusedProp || isFocused, - // @ts-ignore active: isPressedProp || isPressed, disabled: isDisabled, focusVisible: isFocusVisibleProp || isFocusVisible, + // @ts-ignore + ...props.states, }} dataSet={{ hover: isHoveredProp || isHovered ? 'true' : 'false', @@ -76,6 +77,8 @@ export function ActionsheetItem( disabled: isDisabled ? 'true' : 'false', focusVisible: isFocusVisibleProp || isFocusVisible ? 'true' : 'false', + // @ts-ignore + ...props.dataSet, }} > {children} diff --git a/packages/unstyled/select/src/SelectItem.tsx b/packages/unstyled/select/src/SelectItem.tsx index cadaf075ec..6bddd363fe 100644 --- a/packages/unstyled/select/src/SelectItem.tsx +++ b/packages/unstyled/select/src/SelectItem.tsx @@ -36,13 +36,13 @@ export const SelectItem = (StyledSelectItem: any, StyledSelectItemText: any) => handleClose(); } }} + {...props} states={{ - active: activeValue === value, + checked: activeValue === value, }} dataSet={{ - active: activeValue === value ? 'true' : 'false', + checked: activeValue == value ? 'true' : 'false', }} - {...props} > {label}