diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 689e0c9ec..ae53bf711 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -28,3 +28,4 @@ jobs: run: | yarn build yarn run semantic-release + yarn gh-pages diff --git a/CHANGELOG.md b/CHANGELOG.md index 6bc667552..e25c1c887 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,22 +1,22 @@ -# [4.3.0](https://github.com/wwayne/react-tooltip/compare/v4.2.21...v4.3.0) (2022-10-13) +# [4.3.0](https://github.com/wwayne/react-tooltip/compare/v4.2.21...v4.3.0) (2022-10-12) ### Bug Fixes -- [#759](https://github.com/wwayne/react-tooltip/issues/759) - Disable tooltip when disable prop changes ([8e9cca0](https://github.com/wwayne/react-tooltip/commit/8e9cca016f8eb59036c0c4623b85bf3f465ba262)) -- **aftershow:** call afterShow only after state has fully updated ([54752e8](https://github.com/wwayne/react-tooltip/commit/54752e81093f4c41bae1b49f7de65f28cf54df1a)) -- effect and type not properly applied at first render ([a8d0e51](https://github.com/wwayne/react-tooltip/commit/a8d0e51dd5dc0eb85d985232da90d54fd031ae4b)) -- **getposition:** no error when all placements outside ([249b925](https://github.com/wwayne/react-tooltip/commit/249b925a30ac2e7f04648a20bc9976e85358205b)) -- performance issue caused by excessive use of clearTimeout/Interval ([22aea50](https://github.com/wwayne/react-tooltip/commit/22aea5086db47727feae609bb7a6f8e269b7f2de)) -- **react18:** tip not hiding with React 18 StrictMode enabled ([83b72c6](https://github.com/wwayne/react-tooltip/commit/83b72c63ea9fe527bcbfb0b85414527e172c970b)) -- set aria-describedby value wrong when custom id ([a04d26c](https://github.com/wwayne/react-tooltip/commit/a04d26cc0639054b474ca8b373c95a09b199973a)) +- #759 (https://github.com/wwayne/react-tooltip/issues/759) - Disable tooltip when disable prop changes (8e9cca0 (https://github.com/wwayne/react-tooltip/commit/8e9cca016f8eb59036c0c4623b85bf3f465ba262)) +- \*aftershow: call afterShow only after state has fully updated (54752e8 (https://github.com/wwayne/react-tooltip/commit/54752e81093f4c41bae1b49f7de65f28cf54df1a)) +- effect and type not properly applied at first render (a8d0e51 (https://github.com/wwayne/react-tooltip/commit/a8d0e51dd5dc0eb85d985232da90d54fd031ae4b)) +- getposition: no error when all placements outside (249b925 (https://github.com/wwayne/react-tooltip/commit/249b925a30ac2e7f04648a20bc9976e85358205b)) +- performance issue caused by excessive use of clearTimeout/Interval (22aea50 (https://github.com/wwayne/react-tooltip/commit/22aea5086db47727feae609bb7a6f8e269b7f2de)) +- **react18: tip not hiding with React 18 StrictMode enabled** (83b72c6 (https://github.com/wwayne/react-tooltip/commit/83b72c63ea9fe527bcbfb0b85414527e172c970b)) +- set aria-describedby value wrong when custom id (a04d26c (https://github.com/wwayne/react-tooltip/commit/a04d26cc0639054b474ca8b373c95a09b199973a)) ### Features -- **component:** adding "padding" property to customize padding style ([9ae765a](https://github.com/wwayne/react-tooltip/commit/9ae765a3cc38b36ce5ea77edd8fcc0f7bd9646a6)) -- **getposition:** support desired-place-list (by priority) ([982d89d](https://github.com/wwayne/react-tooltip/commit/982d89d2b9d663ed92d41743f63069d0c8a4aac0)) -- **parent_body_mode:** [#535](https://github.com/wwayne/react-tooltip/issues/535) search parents for data-tip if in body mode ([71da348](https://github.com/wwayne/react-tooltip/commit/71da34870163c4377a82b009ac63692e34eeb444)) -- **pencil:** readme updated to trigger next minor release (react 18 support release) ([bb9c79e](https://github.com/wwayne/react-tooltip/commit/bb9c79e248918e4b0641b9305752e59019a60a72)) -- **pencil:** readme updated to trigger next minor release (react 18 support release) ([3a6ec6c](https://github.com/wwayne/react-tooltip/commit/3a6ec6c1a1c61434532a9350e7ceafe17e8794b9)) +- component: adding "padding" property to customize padding style (9ae765a (https://github.com/wwayne/react-tooltip/commit/9ae765a3cc38b36ce5ea77edd8fcc0f7bd9646a6)) +- getposition: support desired-place-list (by priority) (982d89d (https://github.com/wwayne/react-tooltip/commit/982d89d2b9d663ed92d41743f63069d0c8a4aac0)) +- parent_body_mode: #535 (https://github.com/wwayne/react-tooltip/issues/535) search parents for data-tip if in body mode (71da348 (https://github.com/wwayne/react-tooltip/commit/71da34870163c4377a82b009ac63692e34eeb444)) +- pencil: readme updated to trigger next minor release (react 18 support release) (bb9c79e (https://github.com/wwayne/react-tooltip/commit/bb9c79e248918e4b0641b9305752e59019a60a72)) +- pencil: readme updated to trigger next minor release (react 18 support release) (3a6ec6c (https://github.com/wwayne/react-tooltip/commit/3a6ec6c1a1c61434532a9350e7ceafe17e8794b9)) # [4.2.21](https://github.com/wwayne/react-tooltip/compare/v4.2.20...v4.2.21) (2021-05-28) diff --git a/README.md b/README.md index 0f59c4e4f..151ba7294 100755 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ [![Edit ReactTooltip](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/heuristic-curran-bddeu?fontsize=14&hidenavigation=1&theme=dark) -Or see it on [Github Page](https://wwayne.github.io/react-tooltip). +Or see it on [Github Page](https://reacttooltip.github.io/react-tooltip/). ## Installation @@ -226,9 +226,11 @@ return( [alexgurr](https://github.com/alexgurr) Casual maintainer - accepting PRs and doing minor testing/development. +[pdeszynski](https://github.com/pdeszynski) Casual maintainer - accepting PRs and doing minor testing/development. + [aronhelser](https://github.com/aronhelser) Passive maintainer - accepting PRs and doing minor testing, but not fixing issues or doing active development. -[roggervalf](https://github.com/roggervalf) inactive maintainer - no longer seems to be doing development. +[roggervalf](https://github.com/roggervalf) (inactive). [huumanoid](https://github.com/huumanoid) (inactive) diff --git a/bower.json b/bower.json index 58920df77..bdb22350e 100755 --- a/bower.json +++ b/bower.json @@ -2,24 +2,17 @@ "name": "react-tooltip", "description": "react tooltip component", "main": "standalone/react-tooltip.js", - "moduleType": [ - "globals", - "amd", - "node" - ], + "moduleType": ["globals", "amd", "node"], "license": "MIT", - "ignore": [ - "bin", - "example" - ], - "keywords": [ - "react", - "react-component", - "tooltip", - "react-tooltip" - ], + "ignore": ["bin", "example"], + "keywords": ["react", "react-component", "tooltip", "react-tooltip"], "authors": [ - "wwayne" + "wwayne", + "danielbarion", + "alexgurr", + "aronhelser", + "roggervalf", + "huumanoid" ], "homepage": "https://github.com/wwayne/react-tooltip", "repository": { diff --git a/package.json b/package.json index 55b1daa23..154995c2b 100755 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "react-tooltip", "version": "4.3.0", "description": "react tooltip component", + "private": false, "main": "dist/index.js", "types": "dist/react-tooltip.d.ts", "module": "dist/index.es.js", @@ -22,7 +23,7 @@ "build:watch": "rollup -c -w", "start": "npm-run-all clean build:watch", "gh-pages": "gh-pages -d example", - "github-changes": "github-changes -o wwayne -r react-tooltip -a --only-pulls --use-commit-body", + "github-changes": "github-changes -o ReactTooltip -r react-tooltip -a --only-pulls --use-commit-body", "copy:types": "cpy ./react-tooltip.d.ts ./dist --parents --dot", "cm": "git cz", "semantic-release": "semantic-release", @@ -33,22 +34,19 @@ "path": "node_modules/cz-conventional-changelog" } }, - "repository": { - "type": "git", - "url": "https://github.com/wwayne/react-tooltip" - }, + "repository": "https://github.com/ReactTooltip/react-tooltip", "keywords": [ "react", "react-component", "tooltip", "react-tooltip" ], - "author": "wwayne", + "author": "ReactTooltip", "license": "MIT", "bugs": { - "url": "https://github.com/wwayne/react-tooltip/issues" + "url": "https://github.com/ReactTooltip/react-tooltip/issues" }, - "homepage": "https://github.com/wwayne/react-tooltip#readme", + "homepage": "https://github.com/ReactTooltip/react-tooltip#readme", "browserify-shim": { "react": "global:React", "react-dom": "global:ReactDOM" @@ -59,29 +57,33 @@ }, "dependencies": { "prop-types": "^15.8.1", - "uuid": "^8.3.2" + "uuid": "9.0.0" }, "devDependencies": { - "@babel/cli": "^7.18.10", - "@babel/core": "^7.18.10", - "@babel/eslint-parser": "^7.18.9", + "@babel/cli": "7.19.3", + "@babel/core": "7.19.3", + "@babel/eslint-parser": "7.19.1", "@babel/plugin-proposal-class-properties": "^7.18.6", - "@babel/plugin-proposal-decorators": "^7.18.10", - "@babel/plugin-proposal-object-rest-spread": "^7.18.9", + "@babel/plugin-proposal-decorators": "7.19.3", + "@babel/plugin-proposal-json-strings": "^7.18.6", + "@babel/plugin-proposal-object-rest-spread": "7.19.4", + "@babel/plugin-syntax-dynamic-import": "^7.8.3", "@babel/plugin-syntax-import-meta": "^7.10.4", + "@babel/preset-env": "^7.19.4", + "@babel/preset-react": "^7.18.6", "@babel/register": "^7.18.9", - "@commitlint/cli": "^17.0.3", - "@commitlint/config-conventional": "^17.0.3", - "@commitlint/travis-cli": "^17.0.3", - "@rollup/plugin-commonjs": "^22.0.1", + "@commitlint/cli": "17.1.2", + "@commitlint/config-conventional": "17.1.0", + "@commitlint/travis-cli": "17.1.2", + "@rollup/plugin-commonjs": "23.0.0", "@rollup/plugin-node-resolve": "^13.3.0", "@semantic-release/changelog": "^6.0.1", "@semantic-release/commit-analyzer": "^9.0.2", "@semantic-release/git": "^10.0.1", "@semantic-release/npm": "^9.0.1", "@semantic-release/release-notes-generator": "^10.0.3", - "@svgr/rollup": "^6.3.1", - "@testing-library/react": "^13.3.0", + "@svgr/rollup": "6.4.0", + "@testing-library/react": "13.4.0", "babel-loader": "8.2.5", "babelify": "^10.0.0", "browserify": "^17.0.0", @@ -90,13 +92,13 @@ "chai-enzyme": "^1.0.0-beta.1", "chai-spies": "^1.0.0", "commitizen": "4.2.5", - "concurrently": "^7.3.0", - "core-js": "^3.24.1", - "cpy-cli": "^4.1.0", + "concurrently": "7.4.0", + "core-js": "3.25.5", + "cpy-cli": "4.2.0", "cz-conventional-changelog": "^3.3.0", "enzyme": "^3.11.0", "enzyme-adapter-react-16": "^1.15.6", - "eslint": ">=8.21.0", + "eslint": "8.25.0", "eslint-config-jss": ">=5.0.1", "eslint-config-prettier": ">=8.5.0", "eslint-config-standard": "^17.0.0", @@ -104,21 +106,21 @@ "eslint-plugin-import": ">=2.26.0", "eslint-plugin-node": ">=11.1.0", "eslint-plugin-prettier": "4.2.1", - "eslint-plugin-promise": ">=6.0.0", - "eslint-plugin-react": ">=7.30.1", + "eslint-plugin-promise": "6.1.0", + "eslint-plugin-react": "7.31.10", "gh-pages": "4.0.0", "github-changes": "^2.0.3", "http-server": "^14.1.1", "husky": "^8.0.0", "ignore-styles": "5.0.1", - "jsdom": "^20.0.0", + "jsdom": "20.0.1", "lint-staged": "^13.0.3", "mocha": "^10.0.0", "mocha-each": "^2.0.1", "mocha-jsdom": "^2.0.0", "npm-run-all": "^4.1.5", "postcss-nested": "^5.0.6", - "postcss-scss": "^4.0.4", + "postcss-scss": "4.0.5", "postcss-simple-vars": "^6.0.3", "prettier": "2.7.1", "pretty-quick": "^3.1.3", @@ -131,14 +133,14 @@ "rollup-plugin-eslint": "7.0.0", "rollup-plugin-peer-deps-external": "^2.2.4", "rollup-plugin-postcss": "^4.0.2", - "rollup-plugin-sass": "^1.2.13", + "rollup-plugin-sass": "1.12.16", "rollup-plugin-stylelint": "1.0.0", "rollup-plugin-url": "^3.0.1", - "sass": "^1.54.1", - "semantic-release": "^19.0.3", + "sass": "1.55.0", + "semantic-release": "19.0.5", "snazzy": "^9.0.0", "standard": "^17.0.0", - "stylelint": "14.9.1", + "stylelint": "14.13.0", "stylelint-config-standard": "26.0.0", "uglifyjs": "^2.4.10", "watchify": "^4.0.0" diff --git a/src/index.js b/src/index.js index cc25930bc..616d0d167 100755 --- a/src/index.js +++ b/src/index.js @@ -141,7 +141,7 @@ class ReactTooltip extends React.Component { * For unify the bind and unbind listener */ bind(methodArray) { - methodArray.forEach(method => { + methodArray.forEach((method) => { this[method] = this[method].bind(this); }); } @@ -158,7 +158,7 @@ class ReactTooltip extends React.Component { static getDerivedStateFromProps(nextProps, prevState) { const { ariaProps } = prevState; const newAriaProps = parseAria(nextProps); - const isChanged = Object.keys(newAriaProps).some(props => { + const isChanged = Object.keys(newAriaProps).some((props) => { return newAriaProps[props] !== ariaProps[props]; }); if (!isChanged) { @@ -254,8 +254,8 @@ class ReactTooltip extends React.Component { // Scan document for shadow DOM elements nodeListToArray(document.getElementsByTagName('*')) - .filter(element => element.shadowRoot) - .forEach(element => { + .filter((element) => element.shadowRoot) + .forEach((element) => { targetArray = targetArray.concat( nodeListToArray(element.shadowRoot.querySelectorAll(selector)) ); @@ -273,7 +273,7 @@ class ReactTooltip extends React.Component { const { id, globalEventOff, isCapture } = this.props; const targetArray = this.getTargetArray(id); - targetArray.forEach(target => { + targetArray.forEach((target) => { if (target.getAttribute('currentItem') === null) { target.setAttribute('currentItem', 'false'); } @@ -286,7 +286,7 @@ class ReactTooltip extends React.Component { if (this.isBodyMode()) { this.bindBodyListener(targetArray); } else { - targetArray.forEach(target => { + targetArray.forEach((target) => { const isCaptureMode = this.isCapture(target); const effect = this.getEffect(target); if (this.isCustomEvent(target)) { @@ -327,7 +327,7 @@ class ReactTooltip extends React.Component { this.unbindBodyListener(); } else { const targetArray = this.getTargetArray(id); - targetArray.forEach(target => { + targetArray.forEach((target) => { this.unbindBasicListener(target); if (this.isCustomEvent(target)) this.customUnbindListener(target); }); @@ -389,7 +389,7 @@ class ReactTooltip extends React.Component { if (isGlobalCall) { // Don't trigger other elements belongs to other ReactTooltip const targetArray = this.getTargetArray(this.props.id); - const isMyElement = targetArray.some(ele => ele === e.currentTarget); + const isMyElement = targetArray.some((ele) => ele === e.currentTarget); if (!isMyElement) return; } // Get the tooltip content @@ -641,7 +641,7 @@ class ReactTooltip extends React.Component { if (hasTarget) { // Don't trigger other elements belongs to other ReactTooltip const targetArray = this.getTargetArray(this.props.id); - const isMyElement = targetArray.some(ele => ele === e.currentTarget); + const isMyElement = targetArray.some((ele) => ele === e.currentTarget); if (!isMyElement || !this.state.show) return; } @@ -703,14 +703,8 @@ class ReactTooltip extends React.Component { // Calculation the position updatePosition(callbackAfter) { - const { - currentEvent, - currentTarget, - place, - desiredPlace, - effect, - offset - } = this.state; + const { currentEvent, currentTarget, place, desiredPlace, effect, offset } = + this.state; const node = this.tooltipRef; const result = getPosition( currentEvent, @@ -741,7 +735,9 @@ class ReactTooltip extends React.Component { }); } - callbackAfter(); + if (callbackAfter && typeof callbackAfter === 'function') { + callbackAfter(); + } // Set tooltip position node.style.left = result.position.left + 'px'; @@ -773,7 +769,7 @@ class ReactTooltip extends React.Component { hasCustomColors() { return Boolean( Object.keys(this.state.customColors).find( - color => color !== 'border' && this.state.customColors[color] + (color) => color !== 'border' && this.state.customColors[color] ) || (this.state.border && this.state.customColors['border']) ); @@ -818,7 +814,7 @@ class ReactTooltip extends React.Component { (this.tooltipRef = ref)} + ref={(ref) => (this.tooltipRef = ref)} {...ariaProps} data-id="tooltip" dangerouslySetInnerHTML={{ __html: htmlContent }} @@ -830,7 +826,7 @@ class ReactTooltip extends React.Component { className={`${wrapperClassName}`} id={this.props.id || uuid} {...ariaProps} - ref={ref => (this.tooltipRef = ref)} + ref={(ref) => (this.tooltipRef = ref)} data-id="tooltip" >