Skip to content

Commit

Permalink
feat: added checked for select component
Browse files Browse the repository at this point in the history
  • Loading branch information
rajat693 committed Feb 16, 2024
1 parent ce45c3b commit 0361407
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 4 additions & 0 deletions packages/config/src/theme/SelectActionsheetItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ export const SelectActionsheetItem = createStyle({
bg: '$backgroundLight200',
},

':checked': {
bg: '$backgroundLight300',
},

':focus': {
bg: '$backgroundLight100',
},
Expand Down
5 changes: 4 additions & 1 deletion packages/unstyled/actionsheet/src/ActionsheetItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,11 @@ export function ActionsheetItem<T>(
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',
Expand All @@ -76,6 +77,8 @@ export function ActionsheetItem<T>(
disabled: isDisabled ? 'true' : 'false',
focusVisible:
isFocusVisibleProp || isFocusVisible ? 'true' : 'false',
// @ts-ignore
...props.dataSet,
}}
>
{children}
Expand Down
6 changes: 3 additions & 3 deletions packages/unstyled/select/src/SelectItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}
>
<StyledSelectItemText>{label}</StyledSelectItemText>
</StyledSelectItem>
Expand Down

0 comments on commit 0361407

Please sign in to comment.