From 0062d09ac7524d4beb522ee2bc2e4614a41ea6d2 Mon Sep 17 00:00:00 2001 From: Daniel Barion Date: Tue, 18 Jul 2023 10:10:43 -0300 Subject: [PATCH 1/3] fix: add react_app prefix into the available env variables --- docs/docs/options.mdx | 10 ++++++---- src/utils/handle-style.ts | 6 ++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/docs/docs/options.mdx b/docs/docs/options.mdx index 0e749f9f..3b980271 100644 --- a/docs/docs/options.mdx +++ b/docs/docs/options.mdx @@ -130,7 +130,9 @@ We have some environment variables that can be used to enable or disable some be #### Available environment variables: -| name | type | required | default | values | description | -| ----------------------------------- | --------- | -------- | ------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `REACT_TOOLTIP_DISABLE_CORE_STYLES` | `boolean` | no | `false` | `true` `false` | Environment variable to disable **core** styles from being injected into the page by ReactTooltip.

We strongly recommend to keep the core styles being injected into the project unless you know what you are doing. | -| `REACT_TOOLTIP_DISABLE_BASE_STYLES` | `boolean` | no | `false` | `true` `false` | Environment variable to disable **base** styles from being injected into the page by ReactTooltip.

Those styles are just visual styles like colors, padding, etc... And can be disabled if you want to write your tooltip styles. | +| name | type | required | default | values | description | +| --------------------------------------------- | --------- | -------- | ------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `REACT_TOOLTIP_DISABLE_CORE_STYLES` | `boolean` | no | `false` | `true` `false` | Environment variable to disable **core** styles from being injected into the page by ReactTooltip.

We strongly recommend to keep the core styles being injected into the project unless you know what you are doing. | +| `REACT_APP_REACT_TOOLTIP_DISABLE_CORE_STYLES` | `boolean` | no | `false` | `true` `false` | Same as `REACT_TOOLTIP_DISABLE_CORE_STYLES` but with `REACT_APP_` prefix. | +| `REACT_TOOLTIP_DISABLE_BASE_STYLES` | `boolean` | no | `false` | `true` `false` | Environment variable to disable **base** styles from being injected into the page by ReactTooltip.

Those styles are just visual styles like colors, padding, etc... And can be disabled if you want to write your tooltip styles. | +| `REACT_APP_REACT_TOOLTIP_DISABLE_BASE_STYLES` | `boolean` | no | `false` | `true` `false` | Same as `REACT_TOOLTIP_DISABLE_BASE_STYLES` but with `REACT_APP_` prefix. | diff --git a/src/utils/handle-style.ts b/src/utils/handle-style.ts index 7deb84ba..4ab2ff47 100644 --- a/src/utils/handle-style.ts +++ b/src/utils/handle-style.ts @@ -18,7 +18,8 @@ function injectStyle({ if ( type === 'core' && typeof process !== 'undefined' && // this validation prevents docs from breaking even with `process?` - process?.env?.REACT_TOOLTIP_DISABLE_CORE_STYLES + (process?.env?.REACT_TOOLTIP_DISABLE_CORE_STYLES || + process?.env?.REACT_APP_REACT_TOOLTIP_DISABLE_CORE_STYLES) ) { return } @@ -26,7 +27,8 @@ function injectStyle({ if ( type !== 'core' && typeof process !== 'undefined' && // this validation prevents docs from breaking even with `process?` - process?.env?.REACT_TOOLTIP_DISABLE_BASE_STYLES + (process?.env?.REACT_TOOLTIP_DISABLE_BASE_STYLES || + process?.env?.REACT_APP_REACT_TOOLTIP_DISABLE_BASE_STYLES) ) { return } From 66fa19a2b26048d17c6c39a68a8d9ab44fb0a220 Mon Sep 17 00:00:00 2001 From: Daniel Barion Date: Tue, 18 Jul 2023 11:48:48 -0300 Subject: [PATCH 2/3] docs: add new envs into the styling docs --- docs/docs/examples/styling.mdx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/docs/examples/styling.mdx b/docs/docs/examples/styling.mdx index ebce197f..b4ecec32 100644 --- a/docs/docs/examples/styling.mdx +++ b/docs/docs/examples/styling.mdx @@ -385,10 +385,12 @@ We strongly recommend using this way because it's cleaner and better for perform ::: -| name | type | required | default | values | description | -| ----------------------------------- | --------- | -------- | ------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `REACT_TOOLTIP_DISABLE_CORE_STYLES` | `boolean` | no | `false` | `true` `false` | Environment variable to disable **core** styles from being injected into the page by ReactTooltip.

We strongly recommend to keep the core styles being injected into the project unless you know what you are doing. | -| `REACT_TOOLTIP_DISABLE_BASE_STYLES` | `boolean` | no | `false` | `true` `false` | Environment variable to disable **base** styles from being injected into the page by ReactTooltip.

Those styles are just visual styles like colors, padding, etc... And can be disabled if you want to write your tooltip styles. | +| name | type | required | default | values | description | +| --------------------------------------------- | --------- | -------- | ------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `REACT_TOOLTIP_DISABLE_CORE_STYLES` | `boolean` | no | `false` | `true` `false` | Environment variable to disable **core** styles from being injected into the page by ReactTooltip.

We strongly recommend to keep the core styles being injected into the project unless you know what you are doing. | +| `REACT_APP_REACT_TOOLTIP_DISABLE_CORE_STYLES` | `boolean` | no | `false` | `true` `false` | Same as `REACT_TOOLTIP_DISABLE_CORE_STYLES` but with `REACT_APP_` prefix. | +| `REACT_TOOLTIP_DISABLE_BASE_STYLES` | `boolean` | no | `false` | `true` `false` | Environment variable to disable **base** styles from being injected into the page by ReactTooltip.

Those styles are just visual styles like colors, padding, etc... And can be disabled if you want to write your tooltip styles. | +| `REACT_APP_REACT_TOOLTIP_DISABLE_BASE_STYLES` | `boolean` | no | `false` | `true` `false` | Same as `REACT_TOOLTIP_DISABLE_BASE_STYLES` but with `REACT_APP_` prefix. | #### Using removeStyle function From 1d8ad52ec914543031cb7334792dc5408d895fb7 Mon Sep 17 00:00:00 2001 From: gabrieljablonski Date: Tue, 18 Jul 2023 14:35:52 -0300 Subject: [PATCH 3/3] docs: mention `react-scripts` disable styling --- docs/docs/examples/styling.mdx | 4 ++-- docs/docs/options.mdx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/docs/examples/styling.mdx b/docs/docs/examples/styling.mdx index b4ecec32..3134a606 100644 --- a/docs/docs/examples/styling.mdx +++ b/docs/docs/examples/styling.mdx @@ -388,9 +388,9 @@ We strongly recommend using this way because it's cleaner and better for perform | name | type | required | default | values | description | | --------------------------------------------- | --------- | -------- | ------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `REACT_TOOLTIP_DISABLE_CORE_STYLES` | `boolean` | no | `false` | `true` `false` | Environment variable to disable **core** styles from being injected into the page by ReactTooltip.

We strongly recommend to keep the core styles being injected into the project unless you know what you are doing. | -| `REACT_APP_REACT_TOOLTIP_DISABLE_CORE_STYLES` | `boolean` | no | `false` | `true` `false` | Same as `REACT_TOOLTIP_DISABLE_CORE_STYLES` but with `REACT_APP_` prefix. | | `REACT_TOOLTIP_DISABLE_BASE_STYLES` | `boolean` | no | `false` | `true` `false` | Environment variable to disable **base** styles from being injected into the page by ReactTooltip.

Those styles are just visual styles like colors, padding, etc... And can be disabled if you want to write your tooltip styles. | -| `REACT_APP_REACT_TOOLTIP_DISABLE_BASE_STYLES` | `boolean` | no | `false` | `true` `false` | Same as `REACT_TOOLTIP_DISABLE_BASE_STYLES` but with `REACT_APP_` prefix. | +| `REACT_APP_REACT_TOOLTIP_DISABLE_CORE_STYLES` | `boolean` | no | `false` | `true` `false` | Same as `REACT_TOOLTIP_DISABLE_CORE_STYLES` but with `REACT_APP_` prefix. Set this instead if your project uses `react-scripts`. | +| `REACT_APP_REACT_TOOLTIP_DISABLE_BASE_STYLES` | `boolean` | no | `false` | `true` `false` | Same as `REACT_TOOLTIP_DISABLE_BASE_STYLES` but with `REACT_APP_` prefix. Set this instead if your project uses `react-scripts`. | #### Using removeStyle function diff --git a/docs/docs/options.mdx b/docs/docs/options.mdx index 3b980271..2cc021ce 100644 --- a/docs/docs/options.mdx +++ b/docs/docs/options.mdx @@ -133,6 +133,6 @@ We have some environment variables that can be used to enable or disable some be | name | type | required | default | values | description | | --------------------------------------------- | --------- | -------- | ------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `REACT_TOOLTIP_DISABLE_CORE_STYLES` | `boolean` | no | `false` | `true` `false` | Environment variable to disable **core** styles from being injected into the page by ReactTooltip.

We strongly recommend to keep the core styles being injected into the project unless you know what you are doing. | -| `REACT_APP_REACT_TOOLTIP_DISABLE_CORE_STYLES` | `boolean` | no | `false` | `true` `false` | Same as `REACT_TOOLTIP_DISABLE_CORE_STYLES` but with `REACT_APP_` prefix. | | `REACT_TOOLTIP_DISABLE_BASE_STYLES` | `boolean` | no | `false` | `true` `false` | Environment variable to disable **base** styles from being injected into the page by ReactTooltip.

Those styles are just visual styles like colors, padding, etc... And can be disabled if you want to write your tooltip styles. | -| `REACT_APP_REACT_TOOLTIP_DISABLE_BASE_STYLES` | `boolean` | no | `false` | `true` `false` | Same as `REACT_TOOLTIP_DISABLE_BASE_STYLES` but with `REACT_APP_` prefix. | +| `REACT_APP_REACT_TOOLTIP_DISABLE_CORE_STYLES` | `boolean` | no | `false` | `true` `false` | Same as `REACT_TOOLTIP_DISABLE_CORE_STYLES` but with `REACT_APP_` prefix. Set this instead if your project uses `react-scripts`. | +| `REACT_APP_REACT_TOOLTIP_DISABLE_BASE_STYLES` | `boolean` | no | `false` | `true` `false` | Same as `REACT_TOOLTIP_DISABLE_BASE_STYLES` but with `REACT_APP_` prefix. Set this instead if your project uses `react-scripts`. |