Skip to content

Commit

Permalink
fix(type): Generate FlowbiteTheme.d.ts to builds (#182)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
tulup-conner authored Jun 4, 2022
1 parent 45bc263 commit 097d875
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/lib/components/Badge/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface BadgeColors
[key: string]: string;
}

export interface BadgeSizes extends FlowbiteSizes {
export interface BadgeSizes extends Pick<FlowbiteSizes, 'xs' | 'sm'> {
[key: string]: string;
}

Expand Down
4 changes: 4 additions & 0 deletions src/lib/components/Button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ export interface ButtonGradientDuoToneColors extends FlowbiteGradientDuoToneColo
[key: string]: string;
}

export interface ButtonOutlineColors extends Pick<FlowbiteColors, 'gray'> {
[key: string]: string;
}

export interface ButtonSizes extends FlowbiteSizes {
[key: string]: string;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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<FlowbiteTheme>;

Expand Down Expand Up @@ -59,7 +62,7 @@ export interface FlowbiteTheme {
};
badge: {
base: string;
color: Colors;
color: BadgeColors;
href: string;
icon: {
off: string;
Expand Down

0 comments on commit 097d875

Please sign in to comment.