File tree Expand file tree Collapse file tree 2 files changed +26
-4
lines changed Expand file tree Collapse file tree 2 files changed +26
-4
lines changed Original file line number Diff line number Diff line change @@ -48,3 +48,5 @@ export type {
4848 IPosition ,
4949 Middleware ,
5050}
51+
52+ export { removeStyle } from './utils/handle-style'
Original file line number Diff line number Diff line change @@ -20,6 +20,26 @@ function injectStyle({
2020 // eslint-disable-next-line @typescript-eslint/no-explicit-any
2121 ref ?: any
2222} ) {
23+ if ( ! css || typeof document === 'undefined' || injected [ type ] ) {
24+ return
25+ }
26+
27+ if (
28+ type === 'core' &&
29+ typeof process !== 'undefined' && // this validation prevents docs from breaking even with `process?`
30+ process ?. env ?. REACT_TOOLTIP_DISABLE_CORE_STYLES
31+ ) {
32+ return
33+ }
34+
35+ if (
36+ type !== 'base' &&
37+ typeof process !== 'undefined' && // this validation prevents docs from breaking even with `process?`
38+ process ?. env ?. REACT_TOOLTIP_DISABLE_BASE_STYLES
39+ ) {
40+ return
41+ }
42+
2343 if ( type === 'core' ) {
2444 // eslint-disable-next-line no-param-reassign
2545 id = REACT_TOOLTIP_CORE_STYLES_ID
@@ -31,10 +51,6 @@ function injectStyle({
3151 }
3252 const { insertAt } = ref
3353
34- if ( ! css || typeof document === 'undefined' || injected [ type ] ) {
35- return
36- }
37-
3854 if ( document . getElementById ( id ) ) {
3955 // this should never happen because of `injected[type]`
4056 if ( process . env . NODE_ENV !== 'production' ) {
@@ -71,6 +87,10 @@ function injectStyle({
7187 injected [ type ] = true
7288}
7389
90+ /**
91+ * @deprecated Use the `disableStyleInjection` tooltip prop instead.
92+ * See https://react-tooltip.com/docs/examples/styling#disabling-reacttooltip-css
93+ */
7494function removeStyle ( {
7595 type = 'base' ,
7696 id = REACT_TOOLTIP_BASE_STYLES_ID ,
You can’t perform that action at this time.
0 commit comments