@vtex/admin-jsxs
Advanced tools
Comparing version 0.1.2-experimental.0 to 0.1.2
@@ -6,26 +6,16 @@ # 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) | ||
## [0.1.2](https://github.com/vtex/onda/compare/@vtex/admin-jsxs@0.1.1...@vtex/admin-jsxs@0.1.2) (2021-07-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) | ||
### Bug Fixes | ||
* **admin:** emotion deps on all /admin packages ([3562180](https://github.com/vtex/onda/commit/35621800491ffc5132235e83edcf6c086d0b3ce4)) | ||
- **admin:** emotion deps on all /admin packages ([3562180](https://github.com/vtex/onda/commit/35621800491ffc5132235e83edcf6c086d0b3ce4)) | ||
# 0.1.0 (2021-02-02) | ||
### Features | ||
* **jsxs:** create package to standarize component creation ([8af7695](https://github.com/vtex/onda/commit/8af7695c761d60f9cedb9f18086e414cd7ceb25e)) | ||
- **jsxs:** create package to standarize component creation ([8af7695](https://github.com/vtex/onda/commit/8af7695c761d60f9cedb9f18086e414cd7ceb25e)) |
@@ -65,7 +65,7 @@ 'use strict'; | ||
function createComponent(type, useOwnProps) { | ||
function createComponent(type, useHook) { | ||
var Component = react$1.forwardRef(function (props, ref) { | ||
var _useOwnProps = useOwnProps(props), | ||
children = _useOwnProps.children, | ||
parsedProps = _objectWithoutPropertiesLoose(_useOwnProps, ["children"]); | ||
var _useHook = useHook(props), | ||
children = _useHook.children, | ||
parsedProps = _objectWithoutPropertiesLoose(_useHook, ["children"]); | ||
@@ -72,0 +72,0 @@ return jsxs(type, _extends({ |
@@ -62,7 +62,7 @@ import { jsx } from '@emotion/react'; | ||
function createComponent(type, useOwnProps) { | ||
function createComponent(type, useHook) { | ||
var Component = forwardRef(function (props, ref) { | ||
var _useOwnProps = useOwnProps(props), | ||
children = _useOwnProps.children, | ||
parsedProps = _objectWithoutPropertiesLoose(_useOwnProps, ["children"]); | ||
var _useHook = useHook(props), | ||
children = _useHook.children, | ||
parsedProps = _objectWithoutPropertiesLoose(_useHook, ["children"]); | ||
@@ -69,0 +69,0 @@ return jsxs(type, _extends({ |
@@ -1,2 +0,2 @@ | ||
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, useOwnProps: (props: P) => any): ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<R>>; | ||
import type { 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>>; |
@@ -1,2 +0,2 @@ | ||
import { ElementType, ReactNode, Attributes, FunctionComponent, ComponentClass, ReactElement } from 'react'; | ||
import type { ElementType, ReactNode, Attributes, FunctionComponent, ComponentClass, ReactElement } from 'react'; | ||
/** | ||
@@ -3,0 +3,0 @@ * emotion jsx |
{ | ||
"name": "@vtex/admin-jsxs", | ||
"version": "0.1.2-experimental.0", | ||
"version": "0.1.2", | ||
"main": "dist/index.js", | ||
@@ -19,3 +19,3 @@ "module": "dist/admin-jsxs.esm.js", | ||
"repository": { | ||
"directory": "styleguides/admin/admin-jsxs", | ||
"directory": "packages/jsxs", | ||
"type": "git", | ||
@@ -30,2 +30,3 @@ "url": "git+https://github.com/vtex/onda.git" | ||
"build": "tsdx build --tsconfig tsconfig.json", | ||
"build:fast": "tsdx build --tsconfig tsconfig.json --transpileOnly --format esm,cjs", | ||
"test": "tsdx test" | ||
@@ -46,3 +47,3 @@ }, | ||
}, | ||
"gitHead": "e6ee6f4f64f1ce93206f374af913e079e014093b" | ||
"gitHead": "00f24b5dd7fb9323a27127d4236d3dedb4527878" | ||
} |
@@ -1,5 +0,4 @@ | ||
import { | ||
import type { | ||
ComponentClass, | ||
ElementType, | ||
forwardRef, | ||
ForwardRefExoticComponent, | ||
@@ -11,2 +10,3 @@ FunctionComponent, | ||
} from 'react' | ||
import { forwardRef } from 'react' | ||
@@ -21,6 +21,7 @@ import { jsxs } from './jsxs' | ||
type: T, | ||
useOwnProps: (props: P) => any | ||
useHook: (props: P) => any | ||
): ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<R>> { | ||
const Component = forwardRef((props: P, ref: Ref<R>) => { | ||
const { children, ...parsedProps } = useOwnProps(props) | ||
const { children, ...parsedProps } = useHook(props) | ||
return jsxs(type, { ref, ...parsedProps }, children) | ||
@@ -27,0 +28,0 @@ }) |
import { jsx } from '@emotion/react' | ||
import { | ||
import type { | ||
ElementType, | ||
@@ -26,7 +26,3 @@ ReactNode, | ||
return jsx( | ||
type, | ||
props, | ||
...children | ||
) | ||
return jsx(type, props, ...children) | ||
} |
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
18861
277