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

@bedrock-layout/type-utils

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bedrock-layout/type-utils - npm Package Compare versions

Comparing version 0.0.18 to 0.1.0

2

lib/index.cjs.js

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

"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react");function c(e){if(e&&e.__esModule)return e;const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const u=c(n);function a(e){return u.forwardRef(e)}exports.forwardRefWithAs=a;
"use strict";

@@ -1,18 +0,42 @@

import * as React from "react";
export declare function forwardRefWithAs<Props, ComponentType extends As>(comp: (props: PropsFromAs<ComponentType, Props>, ref: React.RefObject<any>) => React.ReactElement | null): ComponentWithAs<ComponentType, Props>;
export declare type PropsFromAs<ComponentType extends As, ComponentProps> = (PropsWithAs<ComponentType, ComponentProps> & {
as: ComponentType;
}) & PropsWithAs<ComponentType, ComponentProps>;
export declare type ComponentWithForwardedRef<ElementType extends React.ElementType, ComponentProps> = React.ForwardRefExoticComponent<ComponentProps & React.HTMLProps<React.ElementType<ElementType>> & React.ComponentPropsWithRef<ElementType>>;
export declare type As<BaseProps = any> = React.ElementType<BaseProps>;
export declare type PropsWithAs<ComponentType extends As, ComponentProps> = ComponentProps & Omit<React.ComponentPropsWithRef<ComponentType>, "as" | keyof ComponentProps> & {
as?: ComponentType;
import React from "react";
export type PropsOf<C extends keyof JSX.IntrinsicElements | React.JSXElementConstructor<any>> = JSX.LibraryManagedAttributes<C, React.ComponentPropsWithoutRef<C>>;
type AsProp<C extends React.ElementType> = {
/**
* An override of the default HTML tag.
* Can also be another React component.
*/
as?: C;
};
export interface ComponentWithAs<ComponentType extends As, ComponentProps> {
<TT extends As>(props: PropsWithAs<TT, ComponentProps>): React.ReactElement | null;
(props: PropsWithAs<ComponentType, ComponentProps>): React.ReactElement | null;
displayName?: string;
propTypes?: React.WeakValidationMap<PropsWithAs<ComponentType, ComponentProps>>;
contextTypes?: React.ValidationMap<any>;
defaultProps?: Partial<PropsWithAs<ComponentType, ComponentProps>>;
}
/**
* Allows for extending a set of props (`ExtendedProps`) by an overriding set of props
* (`OverrideProps`), ensuring that any duplicates are overridden by the overriding
* set of props.
*/
export type ExtendableProps<ExtendedProps = {}, OverrideProps = {}> = OverrideProps & Omit<ExtendedProps, keyof OverrideProps>;
/**
* Allows for inheriting the props from the specified element type so that
* props like children, className & style work, as well as element-specific
* attributes like aria roles. The component (`C`) must be passed in.
*/
export type InheritableElementProps<C extends React.ElementType, Props = {}> = ExtendableProps<PropsOf<C>, Props>;
/**
* A more sophisticated version of `InheritableElementProps` where
* the passed in `as` prop will determine which props can be included
*/
export type PolymorphicComponentProps<C extends React.ElementType, Props = {}> = InheritableElementProps<C, Props & AsProp<C>>;
/**
* Utility type to extract the `ref` prop from a polymorphic component
*/
export type PolymorphicRef<C extends React.ElementType> = React.ComponentPropsWithRef<C>["ref"];
/**
* Utility type to extend the `ref` prop from a polymorphic component
*/
export type WithRef<C extends React.ElementType> = {
ref?: PolymorphicRef<C>;
};
/**
* A wrapper of `PolymorphicComponentProps` that also includes the `ref`
* prop for the polymorphic component
*/
export type PolymorphicComponentPropsWithRef<C extends React.ElementType, Props = {}> = PolymorphicComponentProps<C, Props> & WithRef<C>;
export {};

@@ -1,7 +0,1 @@

import * as f from "react";
function o(r) {
return f.forwardRef(r);
}
export {
o as forwardRefWithAs
};

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

(function(t,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],n):(t=typeof globalThis<"u"?globalThis:t||self,n(t["type-util"]={},t.React))})(this,function(t,n){"use strict";function f(e){if(e&&e.__esModule)return e;const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(o,r,i.get?i:{enumerable:!0,get:()=>e[r]})}}return o.default=e,Object.freeze(o)}const u=f(n);function c(e){return u.forwardRef(e)}t.forwardRefWithAs=c,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
(function(n){typeof define=="function"&&define.amd?define(n):n()})(function(){"use strict"});
{
"name": "@bedrock-layout/type-utils",
"version": "0.0.18",
"version": "0.1.0",
"description": "bedrock-layout type utils",

@@ -57,3 +57,3 @@ "sideEffects": false,

},
"gitHead": "17accd044b36db3f2032dae72a450a8e38e7b610"
"gitHead": "9ae10c12fea1c824280c460a6cbb06290a794b76"
}
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