@grandlinex/react-components
Version:
41 lines (40 loc) • 1.4 kB
TypeScript
import React from 'react';
import { INames } from '@grandlinex/react-icons';
export type CustomBadgeColor = `!#${string}&#${string}!`;
export type BadgeColor = 'red' | 'blue' | 'black' | 'yellow' | 'green' | 'orange' | CustomBadgeColor;
export declare class BadgeColorX {
static bgColors: BadgeColor[];
private readonly color;
constructor(color: string | BadgeColor);
toForm(): {
text: `!#${string}&#${string}!`;
mode: string;
color01: string;
color02: string;
} | {
text: "black" | "blue" | "green" | "orange" | "red" | "yellow";
mode: "black" | "blue" | "green" | "orange" | "red" | "yellow";
color01: string;
color02: string;
};
getColor(): {
backgroundColor: string;
color: string;
} | {
backgroundColor: "black" | "blue" | "green" | "orange" | "red" | "yellow";
color?: undefined;
};
getBackground(): string;
getText(): string | undefined;
static isCustomBadge(color: BadgeColor): color is CustomBadgeColor;
static isValidBadge(color: unknown): color is BadgeColor;
getStringColor(): BadgeColor;
static fromSColor(bg: string, fg: string): BadgeColorX;
}
export type BadgeProps = {
text?: string;
color?: BadgeColor;
icon?: INames;
close?: () => void;
};
export declare const Badge: (prop: BadgeProps) => React.JSX.Element;