UNPKG

@docyrus/react-toggle-group

Version:

docy-toggle-group component for react

49 lines (48 loc) 2.52 kB
import * as React from "react"; import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group"; import { type VariantProps } from "class-variance-authority"; export type ToggleGroupBaseProps = { disabled?: boolean; size?: 'sm' | 'default' | 'lg'; variant?: 'default' | 'outline'; orientation?: 'horizontal' | 'vertical'; className?: string; loop?: boolean; rovingFocus?: boolean; children?: React.ReactNode; }; export type ToggleGroupItemProps = { value: string; disabled?: boolean; children?: React.ReactNode; className?: string; 'aria-label'?: string; }; declare const toggleGroupVariants: (props?: ({ orientation?: "horizontal" | "vertical" | null | undefined; } & import("class-variance-authority/types").ClassProp) | undefined) => string; declare const toggleGroupItemVariants: (props?: ({ variant?: "default" | "outline" | null | undefined; size?: "sm" | "lg" | "default" | null | undefined; } & import("class-variance-authority/types").ClassProp) | undefined) => string; type DocyToggleGroupSingleProps = { type?: 'single'; value?: string; defaultValue?: string; onValueChange?: (value: string) => void; }; type DocyToggleGroupMultipleProps = { type: 'multiple'; value?: string[]; defaultValue?: string[]; onValueChange?: (value: string[]) => void; }; export type DocyToggleGroupProps = Omit<React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Root>, 'type' | 'value' | 'defaultValue' | 'onValueChange'> & VariantProps<typeof toggleGroupVariants> & ToggleGroupBaseProps & (DocyToggleGroupSingleProps | DocyToggleGroupMultipleProps); export type DocyToggleGroupItemProps = React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Item> & ToggleGroupItemProps & VariantProps<typeof toggleGroupItemVariants>; declare const DocyToggleGroup: React.ForwardRefExoticComponent<DocyToggleGroupProps & React.RefAttributes<HTMLDivElement>>; declare const DocyToggleGroupItem: React.ForwardRefExoticComponent<Omit<ToggleGroupPrimitive.ToggleGroupItemProps & React.RefAttributes<HTMLButtonElement>, "ref"> & ToggleGroupItemProps & VariantProps<(props?: ({ variant?: "default" | "outline" | null | undefined; size?: "sm" | "lg" | "default" | null | undefined; } & import("class-variance-authority/types").ClassProp) | undefined) => string> & React.RefAttributes<HTMLButtonElement>>; export { DocyToggleGroup, DocyToggleGroupItem, toggleGroupVariants, toggleGroupItemVariants }; export default DocyToggleGroup;