@leafygreen-ui/polymorphic
Advanced tools
Comparing version 2.0.0 to 2.0.1
# @leafygreen-ui/polymorphic | ||
## 2.0.1 | ||
### Patch Changes | ||
- ef158d904: - `PolymorphicRef` extends `null` | ||
- `PolymorphicProps` extends `ComponentPropsWithRef` | ||
- Adds type specs for refs and event handlers | ||
## 2.0.0 | ||
@@ -4,0 +12,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { ComponentPropsWithoutRef, ComponentType, ReactElement, WeakValidationMap } from 'react'; | ||
import { ComponentPropsWithRef, ComponentType, ReactElement, WeakValidationMap } from 'react'; | ||
import { PartialRequired } from '@leafygreen-ui/lib'; | ||
@@ -25,3 +25,3 @@ import { PolymorphicAs } from '../Polymorphic/Polymorphic.types'; | ||
as?: 'a'; | ||
} & ComponentPropsWithoutRef<'a'>; | ||
} & ComponentPropsWithRef<'a'>; | ||
/** | ||
@@ -32,3 +32,3 @@ * Union of {@link AnchorLikeProps} and {@link InheritedProps} | ||
as?: TAsProp; | ||
} & Omit<PartialRequired<ComponentPropsWithoutRef<TAsProp>, 'href'>, 'as'>; | ||
} & Omit<PartialRequired<ComponentPropsWithRef<TAsProp>, 'href'>, 'as'>; | ||
/** | ||
@@ -48,3 +48,3 @@ * Extends the default component props (or intrinsic attributes) | ||
as?: PolymorphicAs; | ||
} & Omit<ComponentPropsWithoutRef<TAsProp>, keyof TComponentProps | 'as'>; | ||
} & Omit<ComponentPropsWithRef<TAsProp>, keyof TComponentProps | 'as'>; | ||
/** | ||
@@ -79,3 +79,3 @@ * | ||
export interface InferredPolymorphicRenderFunction<TComponentProps = {}, TDefaultAs extends PolymorphicAs = PolymorphicAs> { | ||
<TAsProp extends PolymorphicAs = TDefaultAs>(props: InferredPolymorphicProps<TAsProp, TComponentProps>, ref: PolymorphicRef<TAsProp>): ReactElement | null; | ||
<TAsProp extends PolymorphicAs = TDefaultAs>(props: InferredPolymorphicPropsWithRef<TAsProp, TComponentProps>, ref: PolymorphicRef<TAsProp>): ReactElement | null; | ||
displayName?: string; | ||
@@ -82,0 +82,0 @@ } |
@@ -22,3 +22,3 @@ /** | ||
*/ | ||
export type PolymorphicRef<T extends PolymorphicAs> = ComponentPropsWithRef<T>['ref']; | ||
export type PolymorphicRef<T extends PolymorphicAs> = ComponentPropsWithRef<T>['ref'] | null; | ||
/** | ||
@@ -25,0 +25,0 @@ * Union of prop types potentially re-defined in React.ComponentProps |
{ | ||
"name": "@leafygreen-ui/polymorphic", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "LeafyGreen UI Kit Polymorphic", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
import { | ||
ComponentPropsWithoutRef, | ||
ComponentPropsWithRef, | ||
ComponentType, | ||
@@ -35,3 +35,3 @@ ReactElement, | ||
as?: 'a'; | ||
} & ComponentPropsWithoutRef<'a'>; | ||
} & ComponentPropsWithRef<'a'>; | ||
@@ -43,3 +43,3 @@ /** | ||
as?: TAsProp; | ||
} & Omit<PartialRequired<ComponentPropsWithoutRef<TAsProp>, 'href'>, 'as'>; | ||
} & Omit<PartialRequired<ComponentPropsWithRef<TAsProp>, 'href'>, 'as'>; | ||
@@ -63,3 +63,3 @@ /** | ||
as?: PolymorphicAs; | ||
} & Omit<ComponentPropsWithoutRef<TAsProp>, keyof TComponentProps | 'as'>; | ||
} & Omit<ComponentPropsWithRef<TAsProp>, keyof TComponentProps | 'as'>; | ||
@@ -110,3 +110,3 @@ /** | ||
<TAsProp extends PolymorphicAs = TDefaultAs>( | ||
props: InferredPolymorphicProps<TAsProp, TComponentProps>, | ||
props: InferredPolymorphicPropsWithRef<TAsProp, TComponentProps>, | ||
ref: PolymorphicRef<TAsProp>, | ||
@@ -113,0 +113,0 @@ ): ReactElement | null; |
@@ -39,3 +39,4 @@ /** | ||
export type PolymorphicRef<T extends PolymorphicAs> = | ||
ComponentPropsWithRef<T>['ref']; | ||
| ComponentPropsWithRef<T>['ref'] | ||
| null; | ||
@@ -42,0 +43,0 @@ /** |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
228749
4833