import React from 'react'; import { transparentize } from 'polished'; import { Platform } from 'react-native'; import { VisuallyHidden } from '@react-aria/visually-hidden'; import { Box } from '../../atoms/Box/Box'; import { Icon } from '../../atoms/Icon/Icon'; import { Pressable, PressableProps } from '../../atoms/Pressable/Pressable'; import { ColorsWithHue } from '../../../theme/primitives/colors'; import { useResolvedColor } from '../../../hooks/useResolvedColor'; export interface CheckboxProps extends PressableProps { checked?: boolean; setChecked?: (newValue: boolean) => void; color?: ColorsWithHue; uncheckedColor?: ColorsWithHue; indeterminate?: boolean; } export const Checkbox = ({ checked, setChecked, color = 'blue.500', uncheckedColor = 'grey.400', disabled, opacity, ...rest }: CheckboxProps) => { const pressColor = useResolvedColor(color); const handleChange = () => setChecked?.(!checked); const resolveInteractionStyle = (pressed: boolean) => { return pressed ? { backgroundColor: transparentize(0.8, pressColor as string), } : undefined; }; return ( {({ pressed }) => ( {pressed && ( )} {Platform.OS === 'web' && ( )} )} ); };