UNPKG

@primer/react

Version:

An implementation of GitHub's Primer Design System using React

33 lines (32 loc) 1.42 kB
import React from "react"; //#region src/experimental/IssueLabel/IssueLabel.d.ts type Hex = `#${string}`; type LabelColorVariant = 'auburn' | 'blue' | 'brown' | 'coral' | 'cyan' | 'gray' | 'green' | 'indigo' | 'lemon' | 'lime' | 'olive' | 'orange' | 'pine' | 'pink' | 'plum' | 'purple' | 'red' | 'teal' | 'yellow'; type BaseProps = { className?: string; fillColor?: Hex; variant?: LabelColorVariant; }; type ButtonProps = React.ComponentPropsWithoutRef<'button'> & BaseProps & { as?: never; onClick: React.MouseEventHandler<HTMLButtonElement>; }; type LinkProps = React.ComponentPropsWithoutRef<'a'> & BaseProps & { as?: never; href: string; }; type SpanProps = Omit<React.ComponentPropsWithoutRef<'span'>, 'onClick'> & BaseProps & { as?: never; onClick?: never; href?: never; }; type IssueLabelAsProps<As extends React.ElementType> = { as: As; } & BaseProps & Omit<React.ComponentPropsWithoutRef<As>, keyof BaseProps>; type IssueLabelProps<As extends React.ElementType> = SpanProps | LinkProps | ButtonProps | IssueLabelAsProps<As>; declare function IssueLabel(props: SpanProps): React.ReactNode; declare function IssueLabel(props: LinkProps): React.ReactNode; declare function IssueLabel(props: ButtonProps): React.ReactNode; declare function IssueLabel<As extends React.ElementType>(props: IssueLabelAsProps<As>): React.ReactNode; //#endregion export { type Hex, IssueLabel, type IssueLabelProps };