@react-lgpd-consent/mui 0.5.0

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/LICENSE ADDED
@@ -0,0 +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.
package/README.md ADDED
@@ -0,0 +1,138 @@
1
+ # @react-lgpd-consent/mui
2
+
3
+ > Componentes Material-UI para react-lgpd-consent - UI pronta para usar
4
+
5
+ [![NPM Version](https://img.shields.io/npm/v/@react-lgpd-consent/mui)](https://www.npmjs.com/package/@react-lgpd-consent/mui)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
7
+
8
+ ## 📦 Sobre
9
+
10
+ O pacote `@react-lgpd-consent/mui` fornece **componentes visuais prontos para uso** baseados em Material-UI para a biblioteca `react-lgpd-consent`.
11
+
12
+ ### Ideal para:
13
+ - ✅ Aplicações que já usam Material-UI
14
+ - ✅ Desenvolvimento rápido com componentes prontos
15
+ - ✅ Customização via theme do Material-UI
16
+ - ✅ Experiência consistente com Material Design
17
+
18
+ ## 📥 Instalação
19
+
20
+ ```bash
21
+ npm install @react-lgpd-consent/mui @mui/material @mui/icons-material
22
+ # ou
23
+ pnpm add @react-lgpd-consent/mui @mui/material @mui/icons-material
24
+ ```
25
+
26
+ **Peer Dependencies:**
27
+ - `@mui/material@^7.0.0 || ^6.0.0 || ^5.15.0`
28
+ - `@mui/icons-material@^7.0.0 || ^6.0.0 || ^5.15.0` (opcional)
29
+ - `react@^18.2.0 || ^19.0.0`, `react-dom@^18.2.0 || ^19.0.0`
30
+
31
+ ## 🚀 Uso Básico
32
+
33
+ ```tsx
34
+ import {
35
+ ConsentProvider,
36
+ CookieBanner,
37
+ FloatingPreferencesButton
38
+ } from '@react-lgpd-consent/mui'
39
+
40
+ function App() {
41
+ return (
42
+ <ConsentProvider categories={{ enabledCategories: ['analytics', 'marketing'] }}>
43
+ <CookieBanner policyLinkUrl="/privacy-policy" />
44
+ <FloatingPreferencesButton />
45
+ {/* O PreferencesModal é injetado automaticamente! */}
46
+ <YourApp />
47
+ </ConsentProvider>
48
+ )
49
+ }
50
+ ```
51
+
52
+ > ✨ **Nota:** O `ConsentProvider` deste pacote automaticamente renderiza o `PreferencesModal`. Você não precisa incluí-lo manualmente!
53
+
54
+ ### Customizando o Modal de Preferências
55
+
56
+ ```tsx
57
+ import { ConsentProvider, PreferencesModal } from '@react-lgpd-consent/mui'
58
+
59
+ function App() {
60
+ return (
61
+ <ConsentProvider
62
+ categories={{ enabledCategories: ['analytics'] }}
63
+ PreferencesModalComponent={(props) => (
64
+ <PreferencesModal {...props} hideBranding={true} />
65
+ )}
66
+ >
67
+ <YourApp />
68
+ </ConsentProvider>
69
+ )
70
+ }
71
+ ```
72
+
73
+ ### Uso Headless (Avançado)
74
+
75
+ Se você quiser controle total sobre a UI:
76
+
77
+ ```tsx
78
+ import { ConsentProviderHeadless, useConsent } from '@react-lgpd-consent/mui'
79
+
80
+ function App() {
81
+ return (
82
+ <ConsentProviderHeadless categories={{ enabledCategories: ['analytics'] }}>
83
+ <CustomUI />
84
+ </ConsentProviderHeadless>
85
+ )
86
+ }
87
+
88
+ function CustomUI() {
89
+ const { acceptAll, rejectAll } = useConsent()
90
+ return (
91
+ <div>
92
+ <button onClick={acceptAll}>Aceitar</button>
93
+ <button onClick={rejectAll}>Rejeitar</button>
94
+ </div>
95
+ )
96
+ }
97
+ ```
98
+
99
+ ## 🎯 Componentes Incluídos
100
+
101
+ - **`CookieBanner`** - Banner de consentimento (modal ou snackbar)
102
+ - **`PreferencesModal`** - Modal de preferências detalhadas
103
+ - **`FloatingPreferencesButton`** - Botão flutuante para reabrir preferências
104
+ - **`Branding`** - Componente de marca/logo customizável
105
+
106
+ **Nota:** Este pacote **re-exporta todo o `@react-lgpd-consent/core`**, então você tem acesso a todos os hooks, contextos, utilitários e tipos.
107
+
108
+ ## 🎨 Customização
109
+
110
+ ```tsx
111
+ <CookieBanner
112
+ blocking={true}
113
+ policyLinkUrl="/privacy"
114
+ SnackbarProps={{ anchorOrigin: { vertical: 'top', horizontal: 'center' } }}
115
+ />
116
+
117
+ <FloatingPreferencesButton
118
+ position="bottom-right"
119
+ offset={24}
120
+ icon={<CustomIcon />}
121
+ />
122
+ ```
123
+
124
+ ## 📚 Documentação
125
+
126
+ - [Documentação Principal](https://lucianoedipo.github.io/react-lgpd-consent/)
127
+ - [Storybook (Componentes Interativos)](https://lucianoedipo.github.io/react-lgpd-consent/storybook/)
128
+ - [Guia de Início Rápido](../../QUICKSTART.md)
129
+
130
+ ## 🔗 Pacotes Relacionados
131
+
132
+ - [`@react-lgpd-consent/core`](../core) - Núcleo sem dependências de UI
133
+ - [`react-lgpd-consent`](../react-lgpd-consent) - Pacote agregador (core + mui)
134
+
135
+ ## 📄 Licença
136
+
137
+ MIT © [Luciano Édipo](https://github.com/lucianoedipo)
138
+