Comparing version 1.2.2 to 1.3.0
@@ -13,3 +13,11 @@ /// <reference types="react" /> | ||
type FirstLevelTemplate<TComponent extends React.ElementType, TCompose extends AbstractCompose, TExtraProps> = Template<TComponent, TCompose, TExtraProps> & { | ||
/** | ||
* Add additional props to the component. | ||
*/ | ||
attrs: <TProps = undefined>(attrs: Record<string, any> | ((props: ResultProps<TComponent, TProps, TExtraProps, TCompose>) => Record<string, any>)) => Template<TComponent, TCompose, TExtraProps, TProps>; | ||
} & { | ||
/** | ||
* Prevent props from being forwarded to the component. | ||
*/ | ||
transientProps: (fn: string[] | ((prop: string) => boolean)) => FirstLevelTemplate<TComponent, TCompose, TExtraProps>; | ||
}; | ||
@@ -21,3 +29,2 @@ type Twc<TCompose extends AbstractCompose> = (<T extends React.ElementType>(component: T) => FirstLevelTemplate<T, TCompose, undefined>) & { | ||
}; | ||
type ShouldForwardProp = (prop: string) => boolean; | ||
type TwcComponentProps<TComponent extends React.ElementType, TCompose extends AbstractCompose = typeof clsx> = ResultProps<TComponent, undefined, { | ||
@@ -35,3 +42,3 @@ asChild?: boolean; | ||
*/ | ||
shouldForwardProp?: ShouldForwardProp; | ||
shouldForwardProp?: (prop: string) => boolean; | ||
}; | ||
@@ -38,0 +45,0 @@ declare const createTwc: <TCompose extends AbstractCompose = typeof clsx>(config?: Config<TCompose>) => Twc<TCompose>; |
{ | ||
"name": "react-twc", | ||
"version": "1.2.2", | ||
"version": "1.3.0", | ||
"description": "Create reusable Tailwind CSS components with React.", | ||
@@ -8,4 +8,4 @@ "type": "module", | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"import": "./dist/index.mjs", | ||
"types": "./dist/index.d.ts", | ||
"default": "./dist/index.mjs" | ||
@@ -12,0 +12,0 @@ } |
@@ -11,3 +11,3 @@ ![TWC — Supercharge React + Tailwind CSS](.github/assets/banner.png "TWC — Supercharge React + Tailwind CSS") | ||
- ⚡️ Lightweight — only 0.46kb | ||
- ⚡️ Lightweight — only 0.49kb | ||
- ✨ Autocompletion in all editors | ||
@@ -14,0 +14,0 @@ - 🎨 Adapt the style based on props |
Sorry, the diff of this file is not supported yet
10325
109