UNPKG

@spark-ui/components

Version:

Spark (Leboncoin design system) components.

28 lines (24 loc) 1.47 kB
import * as react_jsx_runtime from 'react/jsx-runtime'; import { PropsWithChildren, ButtonHTMLAttributes, Ref } from 'react'; import * as class_variance_authority_types from 'class-variance-authority/types'; import { VariantProps } from 'class-variance-authority'; declare const tagStyles: (props?: ({ design?: "filled" | "outlined" | "tinted" | null | undefined; intent?: "main" | "alert" | "support" | "accent" | "basic" | "success" | "danger" | "info" | "neutral" | "surface" | null | undefined; } & class_variance_authority_types.ClassProp) | undefined) => string; type TagStylesProps = VariantProps<typeof tagStyles>; interface BaseTagProps extends PropsWithChildren<ButtonHTMLAttributes<HTMLSpanElement>>, TagStylesProps { /** * Change the component to the HTML tag or custom component of the only child. */ asChild?: boolean; } interface FilteredDesignIntent<Design extends TagProps['design'], K extends TagStylesProps['intent'] | never = never> { design?: Design; intent?: Exclude<TagStylesProps['intent'], K>; ref?: Ref<HTMLButtonElement>; } type ValidTagDesignIntent = FilteredDesignIntent<'tinted', 'surface'> | FilteredDesignIntent<'outlined', 'surface'> | FilteredDesignIntent<'filled'>; type TagProps = BaseTagProps & ValidTagDesignIntent; declare const Tag: ({ design, intent, asChild, className, ref, ...others }: TagProps) => react_jsx_runtime.JSX.Element; export { Tag, type TagProps, type ValidTagDesignIntent };