diff --git a/src/components/Alert/Alert.tsx b/src/components/Alert/Alert.tsx index 7eea6a79..99d0dcc6 100644 --- a/src/components/Alert/Alert.tsx +++ b/src/components/Alert/Alert.tsx @@ -4,13 +4,13 @@ import { twMerge } from 'tailwind-merge'; import { mergeDeep } from '../../helpers/merge-deep'; import { getTheme } from '../../theme-store'; import type { DeepPartial } from '../../types'; -import type { FlowbiteColors } from '../Flowbite'; +import type { FlowbiteColorMap, FlowbiteColorValue } from '../Flowbite'; export interface FlowbiteAlertTheme { base: string; borderAccent: string; closeButton: FlowbiteAlertCloseButtonTheme; - color: FlowbiteColors; + color: FlowbiteColorMap; icon: string; rounded: string; wrapper: string; @@ -18,13 +18,13 @@ export interface FlowbiteAlertTheme { export interface FlowbiteAlertCloseButtonTheme { base: string; - color: FlowbiteColors; + color: FlowbiteColorMap; icon: string; } export interface AlertProps extends Omit, 'color'> { additionalContent?: ReactNode; - color?: keyof FlowbiteColors; + color?: FlowbiteColorValue; icon?: FC>; onDismiss?: boolean | (() => void); rounded?: boolean; diff --git a/src/components/Flowbite/FlowbiteTheme.ts b/src/components/Flowbite/FlowbiteTheme.ts index 2a1d4b66..87881262 100644 --- a/src/components/Flowbite/FlowbiteTheme.ts +++ b/src/components/Flowbite/FlowbiteTheme.ts @@ -100,7 +100,6 @@ export interface FlowbiteStateColors { } export interface FlowbiteColors extends FlowbiteStateColors { - [key: string]: string; blue: string; cyan: string; dark: string; @@ -117,7 +116,6 @@ export interface FlowbiteColors extends FlowbiteStateColors { } export interface FlowbiteGradientColors extends Omit { - [key: string]: string; cyan: string; lime: string; pink: string; @@ -166,3 +164,10 @@ export interface FlowbiteSizes { export interface FlowbiteContentPositions { center: string; } + +type LooseString = string & NonNullable; +export type LooseValue = keyof T | LooseString; +export type LooseMap = Record; + +export type FlowbiteColorMap = LooseMap; +export type FlowbiteColorValue = LooseValue; diff --git a/src/components/Flowbite/index.ts b/src/components/Flowbite/index.ts index 3c8a5a52..d025c4ae 100644 --- a/src/components/Flowbite/index.ts +++ b/src/components/Flowbite/index.ts @@ -3,6 +3,8 @@ export type { ThemeProps } from './Flowbite'; export type { CustomFlowbiteTheme, FlowbiteBoolean, + FlowbiteColorMap, + FlowbiteColorValue, FlowbiteColors, FlowbiteContentPositions, FlowbiteGradientColors,