From 097d8756c0130c663e3e1db15a016e8caa5316bf Mon Sep 17 00:00:00 2001 From: tulup-conner Date: Sat, 4 Jun 2022 12:47:00 -0700 Subject: [PATCH] fix(type): Generate `FlowbiteTheme.d.ts` to builds (#182) * fix(type): Add missing types to `FlowbiteTheme` `BadgeColors`, `BadgeSizes`, `ButtonOutlineColors` disappeared after all the PRs adding theme support got merged. * fix(type): Generate `FlowbiteTheme.d.ts` to builds Files suffixed with `.d.ts` are not added to the build files generated during `yarn build:lib`. But that prevents users from being able to explore the interface, or get autocomplete suggestions in their editor. --- src/lib/components/Badge/index.tsx | 2 +- src/lib/components/Button/index.tsx | 4 ++++ .../Flowbite/{FlowbiteTheme.d.ts => FlowbiteTheme.ts} | 7 +++++-- 3 files changed, 10 insertions(+), 3 deletions(-) rename src/lib/components/Flowbite/{FlowbiteTheme.d.ts => FlowbiteTheme.ts} (93%) diff --git a/src/lib/components/Badge/index.tsx b/src/lib/components/Badge/index.tsx index ac69cfa0c..d4ad3c2b1 100644 --- a/src/lib/components/Badge/index.tsx +++ b/src/lib/components/Badge/index.tsx @@ -16,7 +16,7 @@ export interface BadgeColors [key: string]: string; } -export interface BadgeSizes extends FlowbiteSizes { +export interface BadgeSizes extends Pick { [key: string]: string; } diff --git a/src/lib/components/Button/index.tsx b/src/lib/components/Button/index.tsx index 699a7ab07..6b2f57f63 100644 --- a/src/lib/components/Button/index.tsx +++ b/src/lib/components/Button/index.tsx @@ -35,6 +35,10 @@ export interface ButtonGradientDuoToneColors extends FlowbiteGradientDuoToneColo [key: string]: string; } +export interface ButtonOutlineColors extends Pick { + [key: string]: string; +} + export interface ButtonSizes extends FlowbiteSizes { [key: string]: string; } diff --git a/src/lib/components/Flowbite/FlowbiteTheme.d.ts b/src/lib/components/Flowbite/FlowbiteTheme.ts similarity index 93% rename from src/lib/components/Flowbite/FlowbiteTheme.d.ts rename to src/lib/components/Flowbite/FlowbiteTheme.ts index 57881bfa2..be2bcfd4d 100644 --- a/src/lib/components/Flowbite/FlowbiteTheme.d.ts +++ b/src/lib/components/Flowbite/FlowbiteTheme.ts @@ -1,8 +1,11 @@ import type { AlertColors } from '../Alert'; import type { AvatarSizes } from '../Avatar'; +import type { BadgeColors, BadgeSizes } from '../Badge'; import type { SpinnerColors, SpinnerSizes } from '../Spinner'; -import type { ButtonColors, ButtonOutlineColors, ButtonSizes, PositionInButtonGroup } from '../Button'; +import type { ButtonColors, ButtonOutlineColors, ButtonSizes } from '../Button'; import type { ButtonGradientColors, ButtonGradientDuoToneColors } from '../Button'; +import type { DeepPartial } from '../../helpers/deep-partial'; +import type { PositionInButtonGroup } from '../Button/ButtonGroup'; export type CustomFlowbiteTheme = DeepPartial; @@ -59,7 +62,7 @@ export interface FlowbiteTheme { }; badge: { base: string; - color: Colors; + color: BadgeColors; href: string; icon: { off: string;