diff --git a/CHANGELOG.md b/CHANGELOG.md index 02bde6c..5a28c09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,23 @@ +## [4.3.1](https://github.com/FriendsOfReactJS/react-css-themr/compare/4.3.0...4.3.1) (2020-07-22) + + +### Build + +* Release 4.3.1 [skip ci] ([49ac3cd](https://github.com/FriendsOfReactJS/react-css-themr/commit/49ac3cd0e724381b840419e39dffdf32e417e6f1)) + +### Fix + +* Name the default export for themr typings ([ddb4303](https://github.com/FriendsOfReactJS/react-css-themr/commit/ddb4303c7b76288d29eac097f68dfe7076d5f360)), closes [#74](https://github.com/FriendsOfReactJS/react-css-themr/issues/74) +* Resolve linting issues ([4dbc02c](https://github.com/FriendsOfReactJS/react-css-themr/commit/4dbc02cb746138e58fbf3ed35f39aa25b9b6eb60)) +* Resolve typings for themr decorator ([1e20574](https://github.com/FriendsOfReactJS/react-css-themr/commit/1e2057483c3ddd550f055872b7499686766bc959)), closes [#74](https://github.com/FriendsOfReactJS/react-css-themr/issues/74) + +## [4.3.1](https://github.com/FriendsOfReactJS/react-css-themr/compare/4.3.0...4.3.1) (2020-07-22) + + +### Fix + +* Name the default export for themr typings ([ddb4303](https://github.com/FriendsOfReactJS/react-css-themr/commit/ddb4303c7b76288d29eac097f68dfe7076d5f360)), closes [#74](https://github.com/FriendsOfReactJS/react-css-themr/issues/74) + # [4.3.0](https://github.com/FriendsOfReactJS/react-css-themr/compare/4.2.1...4.3.0) (2020-07-22) diff --git a/package.json b/package.json index e057436..b2d8064 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@friendsofreactjs/react-css-themr", "description": "Friends of ReactJS: React CSS Themr", "homepage": "https://github.com/FriendsOfReactJS/react-css-themr#readme", - "version": "4.3.0", + "version": "4.3.1", "main": "./lib", "author": "Javi Velasco (http://javivelasco.com/)", "repository": { diff --git a/src/components/themr.js b/src/components/themr.js index 6cf57a7..ed20d52 100644 --- a/src/components/themr.js +++ b/src/components/themr.js @@ -33,7 +33,7 @@ const THEMR_CONFIG = * @param {{}} [options] - Themr options * @returns {function(ThemedComponent:Function):Function} - ThemedComponent */ -export default (componentName, localTheme, options = {}) => ThemedComponent => { +const themr = (componentName, localTheme, options = {}) => ThemedComponent => { const { composeTheme: optionComposeTheme, mapThemrProps: optionMapThemrProps @@ -177,6 +177,7 @@ export default (componentName, localTheme, options = {}) => ThemedComponent => { return hoistNonReactStatics(Themed, ThemedComponent) } +export default themr /** * Merges passed themes by concatenating string keys and processing nested themes diff --git a/test/components/themr.spec.js b/test/components/themr.spec.js index d8be201..20d4555 100644 --- a/test/components/themr.spec.js +++ b/test/components/themr.spec.js @@ -337,9 +337,10 @@ describe('Themr decorator function', () => { } const theme = {} const DecoratedContainer = hoc(Container) - const ThemedDecoratedContainer = themr('Container', theme)( - DecoratedContainer - ) + const ThemedDecoratedContainer = themr( + 'Container', + theme + )(DecoratedContainer) const tree = TestUtils.renderIntoDocument( ) diff --git a/types/components/ThemeProvider.d.ts b/types/components/ThemeProvider.d.ts index ac73065..fb33779 100644 --- a/types/components/ThemeProvider.d.ts +++ b/types/components/ThemeProvider.d.ts @@ -1,13 +1,15 @@ export default class ThemeProvider extends Component { static propTypes: { - children: any; - theme: any; + children: PropTypes.Validator; + theme: PropTypes.Validator; }; static defaultProps: { theme: {}; }; static childContextTypes: { - themr: any; + themr: PropTypes.Validator; + }>>; }; constructor(props: Readonly); constructor(props: any, context?: any); @@ -18,3 +20,4 @@ export default class ThemeProvider extends Component { }; } import { Component } from "react"; +import PropTypes from "prop-types"; diff --git a/types/components/themr.d.ts b/types/components/themr.d.ts index 22f5b5d..ece8368 100644 --- a/types/components/themr.d.ts +++ b/types/components/themr.d.ts @@ -5,7 +5,6 @@ * @returns {TReactCSSThemrTheme} - Resulting theme */ export function themeable(...themes: TReactCSSThemrTheme[]): any; -declare function _default(componentName: string | number | Symbol, localTheme?: any, options?: {}): (arg0: any, arg1: Function) => Function; -export default _default; export type TReactCSSThemrTheme = any; export type TReactCSSThemrOptions = {}; +export default function themr(componentName: string | number | Symbol, localTheme?: any, options?: {}): (arg0: any, arg1: Function) => Function; diff --git a/types/index.d.ts b/types/index.d.ts index 901367d..184a943 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1,2 +1,2 @@ export { default as ThemeProvider } from "./components/ThemeProvider"; -export { default as themr, themeable } from "./components/themr"; +export { themr, themeable } from "./components/themr"; diff --git a/types/utils/themr-shape.d.ts b/types/utils/themr-shape.d.ts index e384567..57dea3d 100644 --- a/types/utils/themr-shape.d.ts +++ b/types/utils/themr-shape.d.ts @@ -1,2 +1,5 @@ -declare var _default: any; +declare var _default: PropTypes.Requireable; +}>>; export default _default; +import PropTypes from "prop-types";