import * as Ariakit from '@ariakit/react'; import { ComponentPropsWithRef, forwardRef, useContext } from 'react'; import styled from 'styled-components'; import { UIComponentWithRef } from '../../components/types'; import { getVariantKey, useVariants } from '../../variants'; import { CheckboxContext } from './checkbox.context'; import { checkboxVariants, ICheckboxVariants } from './checkbox.variants'; type Props = { variant?: keyof typeof checkboxVariants | (string & {}); variants?: ICheckboxVariants; }; // export type CheckboxGroupProps = UIStyledComponentProps; const StyledCheckboxGroup = styled(Ariakit.Group) ` ${props => getVariantKey('group', props.variant, props.variants)} `; type CheckboxGroupComponent = UIComponentWithRef; export const CheckboxGroup: CheckboxGroupComponent = forwardRef( function CheckboxGroup({ variant = 'default', variants, defaultValue, value, setValue, store, children, ...props }, ref) { const context = useContext(CheckboxContext); const globalVariants = useVariants('checkbox', checkboxVariants); variants = variants || globalVariants; return ( {children} ); } ); export type CheckboxGroupProps = ComponentPropsWithRef;