@vtex/admin-jsxs
Advanced tools
Comparing version 0.1.1 to 0.1.2-experimental.0
@@ -6,2 +6,10 @@ # Change Log | ||
## [0.1.2-experimental.0](https://github.com/vtex/onda/compare/@vtex/admin-jsxs@0.1.1...@vtex/admin-jsxs@0.1.2-experimental.0) (2021-04-28) | ||
**Note:** Version bump only for package @vtex/admin-jsxs | ||
## [0.1.1](https://github.com/vtex/onda/compare/@vtex/admin-jsxs@0.1.0...@vtex/admin-jsxs@0.1.1) (2021-02-11) | ||
@@ -8,0 +16,0 @@ |
@@ -65,7 +65,7 @@ 'use strict'; | ||
function createComponent(type, useHook) { | ||
function createComponent(type, useOwnProps) { | ||
var Component = react$1.forwardRef(function (props, ref) { | ||
var _useHook = useHook(props), | ||
children = _useHook.children, | ||
parsedProps = _objectWithoutPropertiesLoose(_useHook, ["children"]); | ||
var _useOwnProps = useOwnProps(props), | ||
children = _useOwnProps.children, | ||
parsedProps = _objectWithoutPropertiesLoose(_useOwnProps, ["children"]); | ||
@@ -72,0 +72,0 @@ return jsxs(type, _extends({ |
@@ -62,7 +62,7 @@ import { jsx } from '@emotion/react'; | ||
function createComponent(type, useHook) { | ||
function createComponent(type, useOwnProps) { | ||
var Component = forwardRef(function (props, ref) { | ||
var _useHook = useHook(props), | ||
children = _useHook.children, | ||
parsedProps = _objectWithoutPropertiesLoose(_useHook, ["children"]); | ||
var _useOwnProps = useOwnProps(props), | ||
children = _useOwnProps.children, | ||
parsedProps = _objectWithoutPropertiesLoose(_useOwnProps, ["children"]); | ||
@@ -69,0 +69,0 @@ return jsxs(type, _extends({ |
import { ComponentClass, ElementType, ForwardRefExoticComponent, FunctionComponent, PropsWithoutRef, RefAttributes } from 'react'; | ||
export declare function createComponent<R extends HTMLElement, T extends FunctionComponent<P> | ComponentClass<P> | ElementType, P extends {}>(type: T, useHook: (props: P) => any): ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<R>>; | ||
export declare function createComponent<R extends HTMLElement, T extends FunctionComponent<P> | ComponentClass<P> | ElementType, P extends {}>(type: T, useOwnProps: (props: P) => any): ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<R>>; |
{ | ||
"name": "@vtex/admin-jsxs", | ||
"version": "0.1.1", | ||
"version": "0.1.2-experimental.0", | ||
"main": "dist/index.js", | ||
@@ -44,3 +44,3 @@ "module": "dist/admin-jsxs.esm.js", | ||
}, | ||
"gitHead": "ac4303599c907174b40a25690ff419c5cf9331c4" | ||
"gitHead": "e6ee6f4f64f1ce93206f374af913e079e014093b" | ||
} |
@@ -17,9 +17,9 @@ import { | ||
T extends FunctionComponent<P> | ComponentClass<P> | ElementType, | ||
P extends {}, | ||
P extends {} | ||
>( | ||
type: T, | ||
useHook: (props: P) => any | ||
useOwnProps: (props: P) => any | ||
): ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<R>> { | ||
const Component = forwardRef((props: P, ref: Ref<R>) => { | ||
const { children, ...parsedProps } = useHook(props) | ||
const { children, ...parsedProps } = useOwnProps(props) | ||
return jsxs(type, { ref, ...parsedProps }, children) | ||
@@ -26,0 +26,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
18865