@primer/react
Version:
An implementation of GitHub's Primer Design System using React
32 lines • 1.43 kB
TypeScript
import type React from 'react';
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;
export { IssueLabel };
export type { IssueLabelProps, Hex };
//# sourceMappingURL=IssueLabel.d.ts.map