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

react-polymorphic-box

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-polymorphic-box - npm Package Compare versions

Comparing version 2.0.7 to 3.0.0

11

CHANGELOG.md

@@ -5,2 +5,13 @@ # Changelog

## [3.0.0](https://github.com/kripod/react-polymorphic-box/compare/v2.0.7...v3.0.0) (2020-10-08)
### Features
- tree shaking possibility for React ([533b7aa](https://github.com/kripod/react-polymorphic-box/commit/533b7aad7d886dd3c827439795cece0d4a9f4719))
### Bug Fixes
- component display name for debugging ([33d6461](https://github.com/kripod/react-polymorphic-box/commit/33d6461f31a3c06e5e8bf78cd210d84dbe0b662f))
- element return types ([841ca5e](https://github.com/kripod/react-polymorphic-box/commit/841ca5ec78ea4b9a180ea4e9efaf3ca386efb4ad))
### [2.0.7](https://github.com/kripod/react-polymorphic-box/compare/v2.0.6...v2.0.7) (2020-08-16)

@@ -7,0 +18,0 @@

17

dist/cjs/bundle.min.d.ts
/// <reference types="react" />
import React from "react";
// Source: https://github.com/emotion-js/emotion/blob/master/packages/styled-base/types/helper.d.ts
type PropsOf<
// eslint-disable-next-line @typescript-eslint/no-explicit-any
E extends keyof JSX.IntrinsicElements | React.JSXElementConstructor<any>> = JSX.LibraryManagedAttributes<E, React.ComponentPropsWithRef<E>>;
interface BoxOwnProps<E extends React.ElementType = React.ElementType> {
import * as React from "react";
type BoxOwnProps<E extends React.ElementType = React.ElementType> = {
as?: E;
}
type BoxProps<E extends React.ElementType> = BoxOwnProps<E> & Omit<PropsOf<E>, keyof BoxOwnProps>;
declare const Box: <E extends React.ElementType<any> = "div">(props: BoxProps<E>) => JSX.Element;
};
type BoxProps<E extends React.ElementType> = BoxOwnProps<E> & Omit<React.ComponentPropsWithRef<E>, keyof BoxOwnProps>;
declare const defaultElement = "div";
declare const Box: <E extends React.ElementType = typeof defaultElement>(props: BoxProps<E>) => React.ReactElement | null;
type PolymorphicComponentProps<E extends React.ElementType, P> = P & BoxProps<E>;
type PolymorphicComponent<P, D extends React.ElementType = "div"> = <E extends React.ElementType = D>(props: PolymorphicComponentProps<E, P>) => JSX.Element;
type PolymorphicComponent<P, D extends React.ElementType = "div"> = <E extends React.ElementType = D>(props: PolymorphicComponentProps<E, P>) => React.ReactElement | null;
export { Box, PolymorphicComponentProps, PolymorphicComponent };
//# sourceMappingURL=bundle.min.d.ts.map

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

"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var r=e(require("react")),t=r.forwardRef((function(e,t){var a=e.as||"div";return r.createElement(a,Object.assign({ref:t},e,{as:void 0}))}));exports.Box=t;
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var React = require('react');
const defaultElement = "div";
const Box = React.forwardRef(function Box(props, ref) {
const Element = props.as || defaultElement;
return React.createElement(Element, Object.assign({ ref: ref }, props, { as: undefined }));
});
exports.Box = Box;
//# sourceMappingURL=bundle.min.js.map
/// <reference types="react" />
import React from "react";
// Source: https://github.com/emotion-js/emotion/blob/master/packages/styled-base/types/helper.d.ts
type PropsOf<
// eslint-disable-next-line @typescript-eslint/no-explicit-any
E extends keyof JSX.IntrinsicElements | React.JSXElementConstructor<any>> = JSX.LibraryManagedAttributes<E, React.ComponentPropsWithRef<E>>;
interface BoxOwnProps<E extends React.ElementType = React.ElementType> {
import * as React from "react";
type BoxOwnProps<E extends React.ElementType = React.ElementType> = {
as?: E;
}
type BoxProps<E extends React.ElementType> = BoxOwnProps<E> & Omit<PropsOf<E>, keyof BoxOwnProps>;
declare const Box: <E extends React.ElementType<any> = "div">(props: BoxProps<E>) => JSX.Element;
};
type BoxProps<E extends React.ElementType> = BoxOwnProps<E> & Omit<React.ComponentPropsWithRef<E>, keyof BoxOwnProps>;
declare const defaultElement = "div";
declare const Box: <E extends React.ElementType = typeof defaultElement>(props: BoxProps<E>) => React.ReactElement | null;
type PolymorphicComponentProps<E extends React.ElementType, P> = P & BoxProps<E>;
type PolymorphicComponent<P, D extends React.ElementType = "div"> = <E extends React.ElementType = D>(props: PolymorphicComponentProps<E, P>) => JSX.Element;
type PolymorphicComponent<P, D extends React.ElementType = "div"> = <E extends React.ElementType = D>(props: PolymorphicComponentProps<E, P>) => React.ReactElement | null;
export { Box, PolymorphicComponentProps, PolymorphicComponent };
//# sourceMappingURL=bundle.min.d.ts.map
{
"name": "react-polymorphic-box",
"version": "2.0.7",
"version": "3.0.0",
"description": "Building blocks for strongly typed polymorphic components in React.",

@@ -60,32 +60,27 @@ "keywords": [

"devDependencies": {
"@babel/core": "^7.11.1",
"@babel/preset-env": "^7.11.0",
"@babel/preset-react": "^7.10.4",
"@babel/preset-typescript": "^7.10.4",
"@commitlint/cli": "^10.0.0",
"@commitlint/config-conventional": "^10.0.0",
"@types/react": "^16.9.46",
"@typescript-eslint/eslint-plugin": "^3.9.0",
"@typescript-eslint/parser": "^3.9.0",
"@wessberg/rollup-plugin-ts": "^1.3.2",
"commitizen": "^4.1.2",
"cz-conventional-changelog": "^3.2.0",
"eslint": "^7.7.0",
"eslint-config-airbnb-typescript": "^9.0.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.22.0",
"@commitlint/cli": "^11.0.0",
"@commitlint/config-conventional": "^11.0.0",
"@types/react": "^16.9.51",
"@typescript-eslint/eslint-plugin": "^4.4.0",
"@typescript-eslint/parser": "^4.4.0",
"@wessberg/rollup-plugin-ts": "^1.3.5",
"commitizen": "^4.2.1",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^7.10.0",
"eslint-config-airbnb-typescript": "^11.0.0",
"eslint-config-prettier": "^6.12.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-react": "^7.20.6",
"eslint-plugin-react-hooks": "^4.0.8",
"eslint-plugin-react": "^7.21.3",
"eslint-plugin-react-hooks": "^4.1.2",
"eslint-plugin-simple-import-sort": "^5.0.3",
"husky": "^4.2.5",
"lint-staged": "^10.2.11",
"prettier": "^2.0.5",
"prettier-plugin-packagejson": "^2.2.5",
"husky": "^4.3.0",
"lint-staged": "^10.4.0",
"prettier": "^2.1.2",
"prettier-plugin-packagejson": "^2.2.6",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"rollup": "^2.26.3",
"rollup-plugin-terser": "^7.0.0",
"rollup": "^2.29.0",
"standard-version": "^9.0.0",
"typescript": "^3.9.7"
"typescript": "^4.0.3"
},

@@ -92,0 +87,0 @@ "peerDependencies": {

@@ -45,5 +45,5 @@ # react-polymorphic-box

// Component-specific props should be specified separately
export interface HeadingOwnProps {
export type HeadingOwnProps = {
color?: string;
}
};

@@ -77,5 +77,5 @@ // Merge own props with others inherited from the underlying element type

// Component-specific props
interface HeadingProps {
type HeadingProps = {
color?: string;
}
};

@@ -100,3 +100,5 @@ // An HTML tag or a different React component can be rendered by default

export const Heading = React.forwardRef(
export const Heading: <E extends React.ElementType = typeof defaultElement>(
props: HeadingProps<E>
) => React.ReactElement | null = React.forwardRef(
<E extends React.ElementType = typeof defaultElement>(

@@ -115,5 +117,3 @@ { color, style, ...restProps }: HeadingProps<E>,

}
) as <E extends React.ElementType = typeof defaultElement>(
props: HeadingProps<E>
) => JSX.Element;
);
```

@@ -120,0 +120,0 @@

@@ -12,2 +12,2 @@ import { BoxProps } from "./Box";

props: PolymorphicComponentProps<E, P>,
) => JSX.Element;
) => React.ReactElement | null;

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