From 1684d5bb1d45bb2ef1ae27ab473f0a10040c220e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anne=20L=27H=C3=B4te?= Date: Tue, 16 Jul 2024 15:22:20 +0200 Subject: [PATCH] feat(types): Bundle definition types file (#7) * feat(types): Export type for Text * fix(ci/cd): Bundle definition types files --- package.json | 1 + src/components/Typography/Text.tsx | 6 ++++-- src/types/index.ts | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 694e293..10859ad 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "type": "module", "main": "./dist/dsfr-plus.es.js", "module": "./dist/dsfr-plus.es.js", + "types": "./dist/index.d.ts", "exports": { ".": { "types": "./dist/index.d.ts", diff --git a/src/components/Typography/Text.tsx b/src/components/Typography/Text.tsx index 7de4f6f..9d9646c 100644 --- a/src/components/Typography/Text.tsx +++ b/src/components/Typography/Text.tsx @@ -4,14 +4,16 @@ import { OnlyAs, PolymorphicComponent } from 'react-polymorphed'; type TextTags = 'p' | 'span'; type TextSizes = 'xs' | 'sm' | 'md' | 'lg' | 'lead'; -type TextProps = React.PropsWithChildren<{ +type TextPropsPartial = React.PropsWithChildren<{ alt?: boolean; bold?: boolean; className?: Argument; size?: TextSizes; }> -export const Text: PolymorphicComponent<"p", TextProps, OnlyAs> = ({ +export type TextProps = PolymorphicComponent<"p", TextPropsPartial, OnlyAs>; + +export const Text: TextProps = ({ alt, as: As = 'p', bold, diff --git a/src/types/index.ts b/src/types/index.ts index 1bae1c0..fcafa7f 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -1 +1,3 @@ export * from './colors'; +export * from './headings'; +export * from './polymophic';