Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@leafygreen-ui/polymorphic

Package Overview
Dependencies
Maintainers
0
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@leafygreen-ui/polymorphic - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

8

CHANGELOG.md
# @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 @@

10

dist/InferredPolymorphic/InferredPolymorphic.types.d.ts

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc