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

@leafygreen-ui/polymorphic

Package Overview
Dependencies
Maintainers
6
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 1.3.5 to 1.3.6

6

CHANGELOG.md
# @leafygreen-ui/polymorphic
## 1.3.6
### Patch Changes
- 4fcf2e94: Updates types with `React.PropsWithChildren`
## 1.3.5

@@ -4,0 +10,0 @@

4

dist/Example/Polymorphic.example.d.ts

@@ -38,3 +38,3 @@ import React from 'react';

*/
declare type RestrictedType = 'a' | 'button' | React.ComponentType;
declare type RestrictedType = 'a' | 'button' | React.ComponentType<React.PropsWithChildren<unknown>>;
declare type RestrictedProps<T extends RestrictedType> = PolymorphicPropsWithRef<T, {

@@ -46,3 +46,3 @@ title?: 'string';

*/
export declare const RestrictedExample: <T extends RestrictedType = "button">({ as, ...rest }: RestrictedProps<T>) => JSX.Element;
export declare const RestrictedExample: <T extends RestrictedType = "button">({ as, ...rest }: RestrictedProps<T>) => React.JSX.Element;
/**

@@ -49,0 +49,0 @@ * Styled version of ExampleComponent

@@ -1,2 +0,2 @@

/// <reference types="react" />
import React from 'react';
import { PolymorphicAs, PolymorphicComponentType, PolymorphicPropsWithRef, PolymorphicRef } from './Polymorphic.types';

@@ -6,3 +6,3 @@ /**

*/
export declare const BasePolymorph: <T extends PolymorphicAs = "div">({ as, children, ...rest }: PolymorphicPropsWithRef<T, {}>, ref: PolymorphicRef<T>) => JSX.Element;
export declare const BasePolymorph: <T extends PolymorphicAs = "div">({ as, children, ...rest }: PolymorphicPropsWithRef<T, {}>, ref: PolymorphicRef<T>) => React.JSX.Element;
/**

@@ -9,0 +9,0 @@ * Polymorphic component that supports forwarded refs

@@ -24,3 +24,3 @@ import { ComponentProps, ComponentType, PropsWithChildren } from 'react';

*/
export declare type PropsOf<C extends PolymorphicComponentType | InferredPolymorphicComponentType | ComponentType> = C extends PolymorphicComponentType<infer P, infer T> ? PolymorphicPropsWithRef<T, P> : C extends InferredPolymorphicComponentType<infer P, infer T> ? InferredPolymorphicPropsWithRef<T, P> : C extends ComponentType ? ComponentProps<C> : never;
export declare type PropsOf<C extends PolymorphicComponentType | InferredPolymorphicComponentType | ComponentType<React.PropsWithChildren<unknown>>> = C extends PolymorphicComponentType<infer P, infer T> ? PolymorphicPropsWithRef<T, P> : C extends InferredPolymorphicComponentType<infer P, infer T> ? InferredPolymorphicPropsWithRef<T, P> : C extends ComponentType<React.PropsWithChildren<unknown>> ? ComponentProps<C> : never;
/**

@@ -27,0 +27,0 @@ * Generates loosely typed polymorphic props, for use in tests or wrapper components,

{
"name": "@leafygreen-ui/polymorphic",
"version": "1.3.5",
"version": "1.3.6",
"description": "LeafyGreen UI Kit Polymorphic",

@@ -34,6 +34,6 @@ "main": "./dist/index.js",

"@emotion/styled": "^11.10.5",
"@lg-tools/build": "^0.2.0",
"@lg-tools/build": "^0.2.1",
"next": "^13.1.6",
"@leafygreen-ui/lib": "^10.4.3"
"@leafygreen-ui/lib": "^11.0.0"
}
}

@@ -32,2 +32,4 @@ import { forwardRef } from 'react';

// If no `ref` arg was passed in, we use the plain render function
// Using ts-ignore instead of ts-expect-error since expect throws an unused expect TS error in a React 17 environment
// @ts-ignore FIXME: https://jira.mongodb.org/browse/LG-3410
const PolyComponent: PolymorphicComponentType<XP, DefaultAs> =

@@ -34,0 +36,0 @@ render.length === 1 ? render : forwardRef(render);

@@ -37,3 +37,3 @@ import { ComponentProps, ComponentType, PropsWithChildren } from 'react';

| InferredPolymorphicComponentType
| ComponentType,
| ComponentType<React.PropsWithChildren<unknown>>,
> = C extends PolymorphicComponentType<infer P, infer T>

@@ -43,3 +43,3 @@ ? PolymorphicPropsWithRef<T, P>

? InferredPolymorphicPropsWithRef<T, P>
: C extends ComponentType
: C extends ComponentType<React.PropsWithChildren<unknown>>
? ComponentProps<C>

@@ -46,0 +46,0 @@ : never;

@@ -110,2 +110,5 @@ [

{
"value": "\"center\""
},
{
"value": "\"cite\""

@@ -315,2 +318,5 @@ },

{
"value": "\"search\""
},
{
"value": "\"slot\""

@@ -687,2 +693,5 @@ },

{
"value": "\"center\""
},
{
"value": "\"cite\""

@@ -892,2 +901,5 @@ },

{
"value": "\"search\""
},
{
"value": "\"slot\""

@@ -894,0 +906,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

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

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