react-lgpd-consent 0.3.4 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -46,6 +46,15 @@ O formato é baseado em [Keep a Changelog](https://keepachangelog.com/pt-BR/1.0.
46
46
  - Novo Quickstart em PT/EN e simplificações no `README` com foco em `QUICKSTART`.
47
47
  - Documentação de uso do Storybook e troubleshooting adicionada em `docs`.
48
48
 
49
+ ### 🛠️ Correção crítica: Herança de ThemeProvider (v0.3.5)
50
+
51
+ - **Corrigido:** A biblioteca não deve criar ou impor um `ThemeProvider` global por si só. Agora o `ConsentProvider` herda o theme do app consumidor quando um `ThemeProvider` do MUI estiver presente. O Provider só envolverá com `ThemeProvider` se a prop `theme` for explicitamente fornecida.
52
+ - **Motivação:** Evitar conflitos de contexto MUI/Emotion, regressões visuais e problemas em SSR causados por criação de tema no escopo de módulo.
53
+ - **Export:** `createDefaultConsentTheme()` foi adicionada como fábrica para quem precisar de um fallback explícito. Há também um getter compat (deprecated) `defaultConsentTheme()` que retorna uma nova instância quando chamada.
54
+ - **Compatibilidade:** Uso padrão continua igual — se seu app fornece um `ThemeProvider` e você passa o mesmo theme para `ConsentProvider` (ou não passa `theme`), tudo continuará funcionando normalmente.
55
+
56
+ Referência: issues/PR relacionadas e notas de release serão adicionadas no branch de release.
57
+
49
58
  ### ♻️ Dependências e manutenção
50
59
 
51
60
  - Dev-deps e chores
@@ -60,7 +69,6 @@ O formato é baseado em [Keep a Changelog](https://keepachangelog.com/pt-BR/1.0.
60
69
  - Quickstart / README: `db03ae3`
61
70
  - Dependências / chores: `27339e7`, `3b7fdba`, `11c3602`
62
71
 
63
-
64
72
  ## [0.3.1] - 2025-08-13 - CORREÇÕES DE PRODUÇÃO E MELHORIAS DE COMPATIBILIDADE
65
73
 
66
74
  ### 🛡️ **Corrigido - Critical Production Fixes**
@@ -515,8 +523,6 @@ A v0.2.1 introduz um **sistema inteligente de orientações** que guia desenvolv
515
523
 
516
524
  ---
517
525
 
518
-
519
-
520
526
  ### 🔮 Futuro (v0.4.0+)
521
527
 
522
528
  - [ ] Modal detalhado com lista de cookies
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 @lucianoedipo
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2025 @lucianoedipo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/QUICKSTART.md CHANGED
@@ -18,7 +18,7 @@ npm install @mui/material @mui/icons-material @emotion/react @emotion/styled
18
18
 
19
19
  ## 🎯 Uso Básico (30 segundos)
20
20
 
21
- ```tsx
21
+ ````tsx
22
22
  import React from 'react'
23
23
  import { ConsentProvider } from 'react-lgpd-consent'
24
24
 
@@ -44,7 +44,7 @@ This repository ships an interactive Storybook playground used for manual testin
44
44
 
45
45
  ```bash
46
46
  npm run storybook
47
- ```
47
+ ````
48
48
 
49
49
  - Build static Storybook (for publishing to GitHub Pages):
50
50
 
@@ -53,12 +53,14 @@ npm run build-storybook
53
53
  ```
54
54
 
55
55
  Notes:
56
+
56
57
  - The Storybook preview (`.storybook/preview.tsx`) applies a clean environment between stories (removes consent cookie and performs defensive DOM cleanup). Check that file when creating stories that rely on a clean initial state.
57
58
 
58
59
  }
59
60
 
60
61
  export default App
61
- ```
62
+
63
+ ````
62
64
 
63
65
  ## 📋 Tabela Completa de Props do ConsentProvider
64
66
 
@@ -136,10 +138,29 @@ function App() {
136
138
  </ConsentProvider>
137
139
  )
138
140
  }
139
- ```
141
+ ````
140
142
 
141
143
  ### Modal de Preferências Personalizado
142
144
 
145
+ ---
146
+
147
+ ## Nota sobre ThemeProvider
148
+
149
+ A biblioteca `react-lgpd-consent` não injeta um `ThemeProvider` global por conta própria. Ela foi projetada para herdar o tema do app quando um `ThemeProvider` do MUI está presente. Se você precisa garantir um tema de fallback apenas para os componentes da biblioteca, use a fábrica exportada `createDefaultConsentTheme()` e passe pelo prop `theme` do `ConsentProvider`:
150
+
151
+ ```tsx
152
+ import { ConsentProvider, createDefaultConsentTheme } from 'react-lgpd-consent'
153
+
154
+ ;<ConsentProvider
155
+ theme={createDefaultConsentTheme()}
156
+ categories={{ enabledCategories: ['analytics'] }}
157
+ >
158
+ <App />
159
+ </ConsentProvider>
160
+ ```
161
+
162
+ Isso evita alterações indesejadas no contexto do MUI do seu app e problemas de SSR.
163
+
143
164
  ```tsx
144
165
  import React from 'react'
145
166
  import { ConsentProvider, type CustomPreferencesModalProps } from 'react-lgpd-consent'
package/README.md CHANGED
@@ -62,27 +62,50 @@ export default function App() {
62
62
  }
63
63
  ```
64
64
 
65
+ ## Nota sobre ThemeProvider e tema padrão
66
+
67
+ A biblioteca não cria um `ThemeProvider` global automaticamente. Ela tenta herdar o tema do seu app quando você já possui um `ThemeProvider` do MUI. Se você quiser aplicar explicitamente um tema de fallback para os componentes de consentimento, use a fábrica exportada `createDefaultConsentTheme()` e passe via prop `theme`:
68
+
69
+ ```tsx
70
+ import { ConsentProvider, createDefaultConsentTheme } from 'react-lgpd-consent'
71
+
72
+ // Aplica um tema de fallback somente para os componentes da lib
73
+ ;<ConsentProvider
74
+ theme={createDefaultConsentTheme()}
75
+ categories={{ enabledCategories: ['analytics'] }}
76
+ >
77
+ <App />
78
+ </ConsentProvider>
79
+ ```
80
+
81
+ Evite depender de criação de tema no import (isso evita side-effects e problemas em SSR). Se você precisar de compatibilidade retroativa com quem importava `defaultConsentTheme`, entre em contato para adicionarmos um export compatível com deprecação documentada.
82
+
65
83
  ## 📚 Documentação Completa
66
84
 
67
85
  Para mais detalhes sobre customização, hooks e funcionalidades, consulte os seguintes guias:
68
86
 
69
87
  ### 📋 Documentação Principal
88
+
70
89
  - **[📚 Guia de Início Rápido (`QUICKSTART.md`)](./QUICKSTART.md)**: Tutorial passo a passo com exemplos práticos, tabela completa de props, debugging e integrações.
71
90
  - **[Guia da API (`API.md`)](./API.md)**: Referência completa de todos os componentes, hooks e tipos.
72
91
  - **[Guia de Conformidade (`CONFORMIDADE.md`)](./CONFORMIDADE.md)**: Detalhes sobre as funcionalidades de conformidade com a LGPD.
73
92
  - **[Guia de Integrações (`INTEGRACOES.md`)](./INTEGRACOES.md)**: Como usar as integrações nativas e criar as suas.
74
93
 
75
94
  ### 🎨 Documentação Interativa (GitHub Pages)
95
+
76
96
  - **[📖 Storybook - Playground Interativo](https://lucianoedipo.github.io/react-lgpd-consent/storybook/)**: Explore e teste todos os componentes em tempo real com controles interativos.
77
97
  - **[⚙️ TypeDoc - Referência de API](https://lucianoedipo.github.io/react-lgpd-consent/docs/)**: Documentação completa da API gerada automaticamente.
78
98
  - **[🏠 Portal de Documentação](https://lucianoedipo.github.io/react-lgpd-consent/)**: Página inicial com navegação entre todas as documentações.
99
+
79
100
  ---
80
101
 
81
102
  ## 🤝 Como Contribuir
103
+
82
104
  1. Abra uma [Issue](https://github.com/lucianoedipo/react-lgpd-consent/issues) para bugs ou melhorias.
83
105
  2. Siga o Guia de Desenvolvimento em `DEVELOPMENT.md` para enviar um PR.
84
106
 
85
107
  ---
108
+
86
109
  ## 📄 Licença
87
110
 
88
111
  MIT — veja o arquivo `LICENSE`.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  PreferencesModal
3
- } from "./chunk-7D2F6JFW.js";
3
+ } from "./chunk-MHCQFGRJ.js";
4
4
  export {
5
5
  PreferencesModal
6
6
  };