Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

August release #64

Merged
merged 6 commits into from
Aug 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 28 additions & 28 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@
"tween-functions": "^1.2.0"
},
"devDependencies": {
"@babel/cli": "^7.2.3",
"@babel/core": "^7.1.6",
"@babel/plugin-proposal-class-properties": "^7.3.4",
"@babel/plugin-proposal-object-rest-spread": "^7.3.4",
"@babel/preset-env": "^7.1.6",
"@babel/cli": "^7.5.5",
"@babel/core": "^7.5.5",
"@babel/plugin-proposal-class-properties": "^7.5.5",
"@babel/plugin-proposal-object-rest-spread": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"@babel/preset-react": "^7.0.0",
"@babel/preset-typescript": "^7.3.3",
"@semantic-release/changelog": "^3.0.2",
Expand All @@ -63,40 +63,40 @@
"@semantic-release/github": "^5.2.10",
"@semantic-release/npm": "^5.1.4",
"@semantic-release/release-notes-generator": "^7.1.4",
"@storybook/addon-actions": "^5.0.9",
"@storybook/addon-info": "^5.0.1",
"@storybook/addon-knobs": "^5.0.1",
"@storybook/addon-links": "^5.0.1",
"@storybook/addon-notes": "^5.0.9",
"@storybook/addon-storysource": "^5.0.1",
"@storybook/addons": "^5.0.1",
"@storybook/react": "^5.0.1",
"@types/react": "^16.8.6",
"@typescript-eslint/eslint-plugin": "^1.4.2",
"@typescript-eslint/parser": "^1.3.0",
"@storybook/addon-actions": "^5.1.10",
"@storybook/addon-info": "^5.1.10",
"@storybook/addon-knobs": "^5.1.10",
"@storybook/addon-links": "^5.1.10",
"@storybook/addon-notes": "^5.1.10",
"@storybook/addon-storysource": "^5.1.10",
"@storybook/addons": "^5.1.10",
"@storybook/react": "^5.1.10",
"@types/react": "^16.8.24",
"@typescript-eslint/eslint-plugin": "^1.13.0",
"@typescript-eslint/parser": "^1.13.0",
"babel-eslint": "^10.0.1",
"babel-loader": "^8.0.5",
"commitizen": "^3.0.7",
"cz-conventional-changelog": "^2.1.0",
"eslint": "^6",
"eslint-config-standard": "^13.0.0",
"eslint-config-standard-react": "^7.0.2",
"eslint-plugin-import": "^2.16.0",
"commitizen": "^4.0.3",
"cz-conventional-changelog": "^3.0.2",
"eslint": "^6.1.0",
"eslint-config-standard": "^13.0.1",
"eslint-config-standard-react": "^8.0.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-node": "^9.0.1",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-react": "^7.12.4",
"eslint-plugin-react": "^7.14.3",
"eslint-plugin-react-hooks": "^1.0.1",
"eslint-plugin-standard": "^4.0.0",
"nodemon": "^1.18.10",
"react": "^16.2.0",
"react-docgen-typescript-loader": "^3.0.1",
"react-dom": "^16.2.0",
"react-fps-stats": "^0.1.1",
"react-use": "^9.0.0",
"semantic-release": "^15.1.7",
"react-fps-stats": "^0.1.2",
"react-use": "^10.5.0",
"semantic-release": "^15.13.19",
"typescript": "^3.3.3333",
"webpack": "^4.29.6",
"webpack-cli": "^3.2.3"
"webpack": "^4.39.1",
"webpack-cli": "^3.3.6"
},
"config": {
"commitizen": {
Expand Down
15 changes: 10 additions & 5 deletions src/ReactConfetti.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import React, { Component, CanvasHTMLAttributes } from 'react'
import React, { Component, CanvasHTMLAttributes, NamedExoticComponent } from 'react'
import Confetti, { IConfettiOptions, confettiDefaults } from './Confetti'

export type Ref = HTMLCanvasElement

export type Props = Partial<IConfettiOptions> & CanvasHTMLAttributes<HTMLCanvasElement> & {
export type Props = Partial<IConfettiOptions> & NamedExoticComponent & CanvasHTMLAttributes<HTMLCanvasElement> & {
canvasRef: React.RefObject<HTMLCanvasElement>
}

export class ReactConfetti extends Component<Props> {
class ReactConfettiInternal extends Component<Props> {
static readonly defaultProps = {
...confettiDefaults,
}

static readonly displayName = 'ReactConfetti'

constructor(props: Props, ...rest: any[]) {
super(props, ...rest)
this.canvas = props.canvasRef || React.createRef<HTMLCanvasElement>()
Expand Down Expand Up @@ -47,6 +49,7 @@ export class ReactConfetti extends Component<Props> {
const canvasStyles = {
zIndex: 2,
position: 'absolute' as 'absolute',
pointerEvents: 'none' as 'none',
top: 0,
left: 0,
bottom: 0,
Expand Down Expand Up @@ -87,6 +90,8 @@ function extractCanvasProps(props: Partial<IConfettiOptions> | any): [Partial<IC
return [confettiOptions, rest, refs]
}

export default React.forwardRef<Ref, Props>((props, ref) => (
<ReactConfetti canvasRef={ref} {...props} />
export const ReactConfetti = React.forwardRef<Ref, Props>((props, ref) => (
<ReactConfettiInternal canvasRef={ref} {...props} />
))

export default ReactConfetti
Loading