Skip to content

Commit 89aa612

Browse files
authored
Merge branch 'master' into fix-issue-809
2 parents 13f6e75 + d599a1c commit 89aa612

File tree

7 files changed

+103
-57
lines changed

7 files changed

+103
-57
lines changed

.github/FUNDING.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# These are supported funding model platforms
2+
3+
github: [danielbarion] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4+
patreon: # Replace with a single Patreon username
5+
open_collective: # Replace with a single Open Collective username
6+
ko_fi: # Replace with a single Ko-fi username
7+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9+
liberapay: # Replace with a single Liberapay username
10+
issuehunt: # Replace with a single IssueHunt username
11+
otechie: # Replace with a single Otechie username
12+
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
13+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

CHANGELOG.md

+18
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
# [4.5.0](https://github.com/ReactTooltip/react-tooltip/compare/v4.4.5...v4.5.0) (2022-11-09)
2+
3+
### Features
4+
5+
- add disable internal style prop into react-tooltip.d.ts as feat to trigger semantic-release ([ce41c47](https://github.com/ReactTooltip/react-tooltip/commit/ce41c479c2532a01afbcd4250a523dbeaa014672)), closes [#811](https://github.com/ReactTooltip/react-tooltip/issues/811)
6+
7+
## [4.4.5](https://github.com/ReactTooltip/react-tooltip/compare/v4.4.4...v4.4.5) (2022-11-09)
8+
9+
### Bug Fixes
10+
11+
- add padding into the ts type file ([365c2da](https://github.com/ReactTooltip/react-tooltip/commit/365c2dad98d15ecd32356c05ee962225fa018b06)), closes [#817](https://github.com/ReactTooltip/react-tooltip/issues/817) [#808](https://github.com/ReactTooltip/react-tooltip/issues/808)
12+
13+
## [4.4.4](https://github.com/ReactTooltip/react-tooltip/compare/v4.4.3...v4.4.4) (2022-11-09)
14+
15+
### Bug Fixes
16+
17+
- Fixed the tooltip arrow overlapping tooltip content ([51c7e1a](https://github.com/ReactTooltip/react-tooltip/commit/51c7e1a854c80ea545c22edb403e831d0941d8f9))
18+
119
## [4.4.3](https://github.com/ReactTooltip/react-tooltip/compare/v4.4.2...v4.4.3) (2022-10-22)
220

321
### Bug Fixes

README.md

+34-33
Large diffs are not rendered by default.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-tooltip",
3-
"version": "4.4.3",
3+
"version": "4.5.0",
44
"description": "react tooltip component",
55
"private": false,
66
"main": "dist/index.js",

react-tooltip.d.ts

+4
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ export interface TooltipProps {
108108
clickable?: boolean;
109109
// Aria role for the tooltip
110110
role?: string;
111+
// Padding attribute
112+
padding?: string;
113+
// Set internal style as optional
114+
disableInternalStyle?: boolean;
111115
}
112116

113117
// ReactTooltip component is the default export

src/decorators/styler.js

100755100644
+7-7
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ function generateStyle(
6767
border-top-right-radius: ${arrowRadius}px;
6868
border: 1px solid ${borderColor};
6969
background-color: ${arrowColor};
70-
z-index: 1;
70+
z-index: -2;
7171
bottom: -6px;
7272
left: 50%;
7373
margin-left: -6px;
@@ -81,7 +81,7 @@ function generateStyle(
8181
content: "";
8282
background-color: inherit;
8383
position: absolute;
84-
z-index: 2;
84+
z-index: -1;
8585
width: 18px;
8686
height: 10px;
8787
}
@@ -93,7 +93,7 @@ function generateStyle(
9393
border-top-right-radius: ${arrowRadius}px;
9494
border: 1px solid ${borderColor};
9595
background-color: ${arrowColor};
96-
z-index: 1;
96+
z-index: -2;
9797
top: -6px;
9898
left: 50%;
9999
margin-left: -6px;
@@ -107,7 +107,7 @@ function generateStyle(
107107
content: "";
108108
background-color: inherit;
109109
position: absolute;
110-
z-index: 2;
110+
z-index: -1;
111111
width: 10px;
112112
height: 18px;
113113
}
@@ -119,7 +119,7 @@ function generateStyle(
119119
border-top-right-radius: ${arrowRadius}px;
120120
border: 1px solid ${borderColor};
121121
background-color: ${arrowColor};
122-
z-index: 1;
122+
z-index: -2;
123123
right: -6px;
124124
top: 50%;
125125
margin-top: -6px;
@@ -133,7 +133,7 @@ function generateStyle(
133133
content: "";
134134
background-color: inherit;
135135
position: absolute;
136-
z-index: 2;
136+
z-index: -1;
137137
width: 10px;
138138
height: 18px;
139139
}
@@ -145,7 +145,7 @@ function generateStyle(
145145
border-top-right-radius: ${arrowRadius}px;
146146
border: 1px solid ${borderColor};
147147
background-color: ${arrowColor};
148-
z-index: 1;
148+
z-index: -2;
149149
left: -6px;
150150
top: 50%;
151151
margin-top: -6px;

src/index.js

+26-16
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ class ReactTooltip extends React.Component {
7474
bodyMode: PropTypes.bool,
7575
possibleCustomEvents: PropTypes.string,
7676
possibleCustomEventsOff: PropTypes.string,
77-
clickable: PropTypes.bool
77+
clickable: PropTypes.bool,
78+
disableInternalStyle: PropTypes.bool
7879
};
7980
}
8081

@@ -152,12 +153,15 @@ class ReactTooltip extends React.Component {
152153
}
153154

154155
componentDidMount() {
155-
const { insecure, resizeHide } = this.props;
156+
const { insecure, resizeHide, disableInternalStyle } = this.props;
156157
this.mount = true;
157158

158159
this.bindListener(); // Bind listener for tooltip
159160
this.bindWindowEvents(resizeHide); // Bind global event for static method
160-
this.injectStyles(); // Inject styles for each DOM root having tooltip.
161+
162+
if (!disableInternalStyle) {
163+
this.injectStyles(); // Inject styles for each DOM root having tooltip.
164+
}
161165
}
162166

163167
static getDerivedStateFromProps(nextProps, prevState) {
@@ -798,14 +802,16 @@ class ReactTooltip extends React.Component {
798802
const { extraClass, html, ariaProps, disable, uuid } = this.state;
799803
const content = this.getTooltipContent();
800804
const isEmptyTip = this.isEmptyTip(content);
801-
const style = generateTooltipStyle(
802-
this.state.uuid,
803-
this.state.customColors,
804-
this.state.type,
805-
this.state.border,
806-
this.state.padding,
807-
this.state.customRadius
808-
);
805+
const style = this.props.disableInternalStyle
806+
? ''
807+
: generateTooltipStyle(
808+
this.state.uuid,
809+
this.state.customColors,
810+
this.state.type,
811+
this.state.border,
812+
this.state.padding,
813+
this.state.customRadius
814+
);
809815

810816
const tooltipClass =
811817
'__react_component_tooltip' +
@@ -828,7 +834,9 @@ class ReactTooltip extends React.Component {
828834
.join(' ');
829835

830836
if (html) {
831-
const htmlContent = `${content}\n<style aria-hidden="true">${style}</style>`;
837+
const htmlContent = `${content}${
838+
style ? `\n<style aria-hidden="true">${style}</style>` : ''
839+
}`;
832840

833841
return (
834842
<Wrapper
@@ -849,10 +857,12 @@ class ReactTooltip extends React.Component {
849857
ref={(ref) => (this.tooltipRef = ref)}
850858
data-id="tooltip"
851859
>
852-
<style
853-
dangerouslySetInnerHTML={{ __html: style }}
854-
aria-hidden="true"
855-
/>
860+
{style && (
861+
<style
862+
dangerouslySetInnerHTML={{ __html: style }}
863+
aria-hidden="true"
864+
/>
865+
)}
856866
{content}
857867
</Wrapper>
858868
);

0 commit comments

Comments
 (0)