@react-lgpd-consent/mui 0.7.0 → 0.7.2
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/README.md +6 -1
- package/dist/index.cjs +90 -32
- package/dist/index.d.cts +57 -4
- package/dist/index.d.ts +57 -4
- package/dist/index.js +90 -32
- package/dist/ui.cjs +673 -0
- package/dist/ui.d.cts +9 -0
- package/dist/ui.d.ts +9 -0
- package/dist/ui.js +628 -0
- package/package.json +10 -5
package/README.md
CHANGED
|
@@ -28,6 +28,12 @@ pnpm add @react-lgpd-consent/mui @mui/material @mui/icons-material
|
|
|
28
28
|
- `@mui/icons-material@^7.0.0 || ^6.0.0 || ^5.15.0` (opcional)
|
|
29
29
|
- `react@^18.2.0 || ^19.0.0`, `react-dom@^18.2.0 || ^19.0.0`
|
|
30
30
|
|
|
31
|
+
### Entradas de importação (evite ambiguidades)
|
|
32
|
+
|
|
33
|
+
- `@react-lgpd-consent/mui/ui`: **apenas UI** (ConsentProvider MUI + componentes). Ideal para bundles menores e sem re-export do core.
|
|
34
|
+
- `@react-lgpd-consent/mui`: compatibilidade total (re-exporta o core); use `headless` ou `ConsentProviderHeadless` daqui se precisar da lógica.
|
|
35
|
+
- `@react-lgpd-consent/core`: headless puro, recomendado para hooks/utils na sua própria UI.
|
|
36
|
+
|
|
31
37
|
## 🚀 Uso Básico
|
|
32
38
|
|
|
33
39
|
```tsx
|
|
@@ -169,4 +175,3 @@ function CustomUI() {
|
|
|
169
175
|
## 📄 Licença
|
|
170
176
|
|
|
171
177
|
MIT © [Luciano Édipo](https://github.com/lucianoedipo)
|
|
172
|
-
|
package/dist/index.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var core = require('@react-lgpd-consent/core');
|
|
4
4
|
var Link = require('@mui/material/Link');
|
|
5
5
|
var Typography = require('@mui/material/Typography');
|
|
6
|
-
var
|
|
6
|
+
var React4 = require('react');
|
|
7
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
8
8
|
var styles = require('@mui/material/styles');
|
|
9
9
|
var Box2 = require('@mui/material/Box');
|
|
@@ -42,9 +42,10 @@ function _interopNamespace(e) {
|
|
|
42
42
|
return Object.freeze(n);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
var core__namespace = /*#__PURE__*/_interopNamespace(core);
|
|
45
46
|
var Link__default = /*#__PURE__*/_interopDefault(Link);
|
|
46
47
|
var Typography__default = /*#__PURE__*/_interopDefault(Typography);
|
|
47
|
-
var
|
|
48
|
+
var React4__namespace = /*#__PURE__*/_interopNamespace(React4);
|
|
48
49
|
var Box2__default = /*#__PURE__*/_interopDefault(Box2);
|
|
49
50
|
var Button__default = /*#__PURE__*/_interopDefault(Button);
|
|
50
51
|
var Paper__default = /*#__PURE__*/_interopDefault(Paper);
|
|
@@ -89,11 +90,22 @@ var linkStyles = {
|
|
|
89
90
|
textDecoration: "underline"
|
|
90
91
|
}
|
|
91
92
|
};
|
|
92
|
-
var Branding =
|
|
93
|
+
var Branding = React4__namespace.memo(function Branding2({
|
|
93
94
|
variant,
|
|
94
|
-
hidden = false
|
|
95
|
+
hidden = false,
|
|
96
|
+
texts: textsProp,
|
|
97
|
+
language,
|
|
98
|
+
textVariant
|
|
95
99
|
}) {
|
|
96
|
-
const
|
|
100
|
+
const baseTexts = core.useConsentTexts();
|
|
101
|
+
const mergedTexts = React4__namespace.useMemo(
|
|
102
|
+
() => ({ ...baseTexts, ...textsProp ?? {} }),
|
|
103
|
+
[baseTexts, textsProp]
|
|
104
|
+
);
|
|
105
|
+
const texts = React4__namespace.useMemo(
|
|
106
|
+
() => core.resolveTexts(mergedTexts, { language, variant: textVariant }),
|
|
107
|
+
[mergedTexts, language, textVariant]
|
|
108
|
+
);
|
|
97
109
|
const designTokens = core.useDesignTokens();
|
|
98
110
|
if (hidden) return null;
|
|
99
111
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -131,10 +143,21 @@ function CookieBanner({
|
|
|
131
143
|
blocking = true,
|
|
132
144
|
hideBranding = false,
|
|
133
145
|
SnackbarProps,
|
|
134
|
-
PaperProps
|
|
146
|
+
PaperProps,
|
|
147
|
+
texts: textsProp,
|
|
148
|
+
language,
|
|
149
|
+
textVariant
|
|
135
150
|
}) {
|
|
136
151
|
const { consented, acceptAll, rejectAll, openPreferences } = core.useConsent();
|
|
137
|
-
const
|
|
152
|
+
const baseTexts = core.useConsentTexts();
|
|
153
|
+
const mergedTexts = React4__namespace.useMemo(
|
|
154
|
+
() => ({ ...baseTexts, ...textsProp ?? {} }),
|
|
155
|
+
[baseTexts, textsProp]
|
|
156
|
+
);
|
|
157
|
+
const texts = React4__namespace.useMemo(
|
|
158
|
+
() => core.resolveTexts(mergedTexts, { language, variant: textVariant }),
|
|
159
|
+
[mergedTexts, language, textVariant]
|
|
160
|
+
);
|
|
138
161
|
const isHydrated = core.useConsentHydration();
|
|
139
162
|
const designTokens = core.useDesignTokens();
|
|
140
163
|
const open = debug ? true : isHydrated && !consented;
|
|
@@ -209,7 +232,15 @@ function CookieBanner({
|
|
|
209
232
|
}
|
|
210
233
|
)
|
|
211
234
|
] }),
|
|
212
|
-
!hideBranding && /* @__PURE__ */ jsxRuntime.jsx(
|
|
235
|
+
!hideBranding && /* @__PURE__ */ jsxRuntime.jsx(
|
|
236
|
+
Branding,
|
|
237
|
+
{
|
|
238
|
+
variant: "banner",
|
|
239
|
+
texts: textsProp,
|
|
240
|
+
language,
|
|
241
|
+
textVariant
|
|
242
|
+
}
|
|
243
|
+
)
|
|
213
244
|
] }) });
|
|
214
245
|
const resolveBannerZIndex = (theme) => designTokens?.layout?.zIndex?.banner ?? theme?.zIndex?.snackbar ?? 1400;
|
|
215
246
|
const positionStyle = (theme) => ({
|
|
@@ -309,13 +340,24 @@ function FloatingPreferencesButtonComponent({
|
|
|
309
340
|
icon = /* @__PURE__ */ jsxRuntime.jsx(CookieOutlined__default.default, {}),
|
|
310
341
|
tooltip,
|
|
311
342
|
FabProps,
|
|
312
|
-
hideWhenConsented = false
|
|
343
|
+
hideWhenConsented = false,
|
|
344
|
+
texts: textsProp,
|
|
345
|
+
language,
|
|
346
|
+
textVariant
|
|
313
347
|
}) {
|
|
314
348
|
const { openPreferences, consented } = core.useConsent();
|
|
315
|
-
const
|
|
349
|
+
const baseTexts = core.useConsentTexts();
|
|
350
|
+
const mergedTexts = React4__namespace.useMemo(
|
|
351
|
+
() => ({ ...baseTexts, ...textsProp ?? {} }),
|
|
352
|
+
[baseTexts, textsProp]
|
|
353
|
+
);
|
|
354
|
+
const texts = React4__namespace.useMemo(
|
|
355
|
+
() => core.resolveTexts(mergedTexts, { language, variant: textVariant }),
|
|
356
|
+
[mergedTexts, language, textVariant]
|
|
357
|
+
);
|
|
316
358
|
const safeTheme = useThemeWithFallbacks();
|
|
317
359
|
const designTokens = core.useDesignTokens();
|
|
318
|
-
const positionStyles =
|
|
360
|
+
const positionStyles = React4__namespace.useMemo(() => {
|
|
319
361
|
const styles = {
|
|
320
362
|
position: "fixed",
|
|
321
363
|
zIndex: 1200
|
|
@@ -366,7 +408,7 @@ function FloatingPreferencesButtonComponent({
|
|
|
366
408
|
}
|
|
367
409
|
) });
|
|
368
410
|
}
|
|
369
|
-
var FloatingPreferencesButton =
|
|
411
|
+
var FloatingPreferencesButton = React4__namespace.memo(FloatingPreferencesButtonComponent);
|
|
370
412
|
FloatingPreferencesButton.displayName = "FloatingPreferencesButton";
|
|
371
413
|
function PreferencesModal({
|
|
372
414
|
DialogProps: DialogProps2,
|
|
@@ -374,26 +416,37 @@ function PreferencesModal({
|
|
|
374
416
|
isModalOpen: isModalOpenProp,
|
|
375
417
|
preferences: preferencesProp,
|
|
376
418
|
setPreferences: setPreferencesProp,
|
|
377
|
-
closePreferences: closePreferencesProp
|
|
419
|
+
closePreferences: closePreferencesProp,
|
|
420
|
+
texts: textsProp,
|
|
421
|
+
language,
|
|
422
|
+
textVariant
|
|
378
423
|
}) {
|
|
379
424
|
const hookValue = core.useConsent();
|
|
380
425
|
const preferences = preferencesProp ?? hookValue.preferences;
|
|
381
426
|
const setPreferences = setPreferencesProp ?? hookValue.setPreferences;
|
|
382
427
|
const closePreferences = closePreferencesProp ?? hookValue.closePreferences;
|
|
383
428
|
const isModalOpen = isModalOpenProp ?? hookValue.isModalOpen;
|
|
384
|
-
const
|
|
429
|
+
const baseTexts = core.useConsentTexts();
|
|
430
|
+
const mergedTexts = React4__namespace.useMemo(
|
|
431
|
+
() => ({ ...baseTexts, ...textsProp ?? {} }),
|
|
432
|
+
[baseTexts, textsProp]
|
|
433
|
+
);
|
|
434
|
+
const texts = React4__namespace.useMemo(
|
|
435
|
+
() => core.resolveTexts(mergedTexts, { language, variant: textVariant }),
|
|
436
|
+
[mergedTexts, language, textVariant]
|
|
437
|
+
);
|
|
385
438
|
const designTokens = core.useDesignTokens();
|
|
386
439
|
const { toggleableCategories, allCategories } = core.useCategories();
|
|
387
|
-
const getInitialPreferences =
|
|
440
|
+
const getInitialPreferences = React4__namespace.useCallback(() => {
|
|
388
441
|
const syncedPrefs = { necessary: true };
|
|
389
442
|
toggleableCategories.forEach((category) => {
|
|
390
443
|
syncedPrefs[category.id] = preferences[category.id] ?? false;
|
|
391
444
|
});
|
|
392
445
|
return syncedPrefs;
|
|
393
446
|
}, [preferences, toggleableCategories]);
|
|
394
|
-
const [tempPreferences, setTempPreferences] =
|
|
395
|
-
const wasOpenRef =
|
|
396
|
-
|
|
447
|
+
const [tempPreferences, setTempPreferences] = React4__namespace.useState(getInitialPreferences);
|
|
448
|
+
const wasOpenRef = React4__namespace.useRef(isModalOpen);
|
|
449
|
+
React4__namespace.useEffect(() => {
|
|
397
450
|
const justOpened = isModalOpen && !wasOpenRef.current;
|
|
398
451
|
wasOpenRef.current = isModalOpen;
|
|
399
452
|
if (justOpened) {
|
|
@@ -420,7 +473,7 @@ function PreferencesModal({
|
|
|
420
473
|
backgroundColor: designTokens?.colors?.background ?? theme.palette.background.paper,
|
|
421
474
|
color: designTokens?.colors?.text ?? theme.palette.text.primary
|
|
422
475
|
});
|
|
423
|
-
const resolveModalZIndex =
|
|
476
|
+
const resolveModalZIndex = React4__namespace.useCallback(
|
|
424
477
|
(theme) => designTokens?.layout?.zIndex?.modal ?? (theme?.zIndex?.modal ?? 1300) + 10,
|
|
425
478
|
[designTokens?.layout?.zIndex?.modal]
|
|
426
479
|
);
|
|
@@ -466,6 +519,10 @@ function PreferencesModal({
|
|
|
466
519
|
const namesFromGuidance = full?.cookies ?? [];
|
|
467
520
|
const used = globalThis.__LGPD_USED_INTEGRATIONS__ || [];
|
|
468
521
|
const descriptors = core.getCookiesInfoForCategory(category.id, used);
|
|
522
|
+
const tableHeaders = texts.cookieDetails?.tableHeaders;
|
|
523
|
+
const toggleDetailsText = texts.cookieDetails?.toggleDetails?.expand ?? "Ver detalhes";
|
|
524
|
+
const scriptLabelPrefix = texts.cookieDetails?.scriptLabelPrefix ?? "(script) ";
|
|
525
|
+
const scriptPurpose = texts.cookieDetails?.scriptPurpose ?? "Script de integra\xE7\xE3o ativo";
|
|
469
526
|
const enrichedDescriptors = descriptors.map((desc) => {
|
|
470
527
|
if (desc.purpose && desc.duration && desc.provider) {
|
|
471
528
|
return desc;
|
|
@@ -486,8 +543,8 @@ function PreferencesModal({
|
|
|
486
543
|
if (merged.length === 0) {
|
|
487
544
|
const gmap = globalThis.__LGPD_INTEGRATIONS_MAP__ || {};
|
|
488
545
|
const scriptRows = Object.entries(gmap).filter(([, cat]) => cat === category.id).map(([id]) => ({
|
|
489
|
-
name:
|
|
490
|
-
purpose:
|
|
546
|
+
name: `${scriptLabelPrefix}${id}`,
|
|
547
|
+
purpose: scriptPurpose,
|
|
491
548
|
duration: "-",
|
|
492
549
|
provider: "-"
|
|
493
550
|
}));
|
|
@@ -513,13 +570,13 @@ function PreferencesModal({
|
|
|
513
570
|
}
|
|
514
571
|
),
|
|
515
572
|
/* @__PURE__ */ jsxRuntime.jsxs("details", { style: { marginLeft: 48 }, children: [
|
|
516
|
-
/* @__PURE__ */ jsxRuntime.jsx("summary", { children:
|
|
573
|
+
/* @__PURE__ */ jsxRuntime.jsx("summary", { children: toggleDetailsText }),
|
|
517
574
|
/* @__PURE__ */ jsxRuntime.jsx(Box2__default.default, { sx: { mt: 1 }, children: /* @__PURE__ */ jsxRuntime.jsxs("table", { style: { width: "100%", borderCollapse: "collapse" }, children: [
|
|
518
575
|
/* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
519
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { style: { textAlign: "left" }, children: "Cookie" }),
|
|
520
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { style: { textAlign: "left" }, children: "Finalidade" }),
|
|
521
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { style: { textAlign: "left" }, children: "Dura\xE7\xE3o" }),
|
|
522
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { style: { textAlign: "left" }, children: "Fornecedor" })
|
|
576
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { style: { textAlign: "left" }, children: tableHeaders?.name ?? "Cookie" }),
|
|
577
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { style: { textAlign: "left" }, children: tableHeaders?.purpose ?? "Finalidade" }),
|
|
578
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { style: { textAlign: "left" }, children: tableHeaders?.duration ?? "Dura\xE7\xE3o" }),
|
|
579
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { style: { textAlign: "left" }, children: tableHeaders?.provider ?? "Fornecedor" })
|
|
523
580
|
] }) }),
|
|
524
581
|
/* @__PURE__ */ jsxRuntime.jsx("tbody", { children: mergedFinal.map((d, idx) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
525
582
|
/* @__PURE__ */ jsxRuntime.jsx("td", { children: d.name }),
|
|
@@ -533,13 +590,13 @@ function PreferencesModal({
|
|
|
533
590
|
}),
|
|
534
591
|
/* @__PURE__ */ jsxRuntime.jsx(FormControlLabel__default.default, { control: /* @__PURE__ */ jsxRuntime.jsx(Switch__default.default, { checked: true, disabled: true }), label: texts.necessaryAlwaysOn }),
|
|
535
592
|
/* @__PURE__ */ jsxRuntime.jsxs("details", { style: { marginLeft: 48 }, children: [
|
|
536
|
-
/* @__PURE__ */ jsxRuntime.jsx("summary", { children: "Ver detalhes" }),
|
|
593
|
+
/* @__PURE__ */ jsxRuntime.jsx("summary", { children: texts.cookieDetails?.toggleDetails?.expand ?? "Ver detalhes" }),
|
|
537
594
|
/* @__PURE__ */ jsxRuntime.jsx(Box2__default.default, { sx: { mt: 1 }, children: /* @__PURE__ */ jsxRuntime.jsxs("table", { style: { width: "100%", borderCollapse: "collapse" }, children: [
|
|
538
595
|
/* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
539
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { style: { textAlign: "left" }, children: "Cookie" }),
|
|
540
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { style: { textAlign: "left" }, children: "Finalidade" }),
|
|
541
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { style: { textAlign: "left" }, children: "Dura\xE7\xE3o" }),
|
|
542
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { style: { textAlign: "left" }, children: "Fornecedor" })
|
|
596
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { style: { textAlign: "left" }, children: texts.cookieDetails?.tableHeaders?.name ?? "Cookie" }),
|
|
597
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { style: { textAlign: "left" }, children: texts.cookieDetails?.tableHeaders?.purpose ?? "Finalidade" }),
|
|
598
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { style: { textAlign: "left" }, children: texts.cookieDetails?.tableHeaders?.duration ?? "Dura\xE7\xE3o" }),
|
|
599
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { style: { textAlign: "left" }, children: texts.cookieDetails?.tableHeaders?.provider ?? "Fornecedor" })
|
|
543
600
|
] }) }),
|
|
544
601
|
/* @__PURE__ */ jsxRuntime.jsx("tbody", { children: (() => {
|
|
545
602
|
const used = globalThis.__LGPD_USED_INTEGRATIONS__ || [];
|
|
@@ -562,7 +619,7 @@ function PreferencesModal({
|
|
|
562
619
|
/* @__PURE__ */ jsxRuntime.jsx(Button__default.default, { variant: "outlined", onClick: handleCancel, children: texts.close }),
|
|
563
620
|
/* @__PURE__ */ jsxRuntime.jsx(Button__default.default, { variant: "contained", onClick: handleSave, children: texts.save })
|
|
564
621
|
] }),
|
|
565
|
-
!hideBranding && /* @__PURE__ */ jsxRuntime.jsx(Branding, { variant: "modal" })
|
|
622
|
+
!hideBranding && /* @__PURE__ */ jsxRuntime.jsx(Branding, { variant: "modal", texts: textsProp, language, textVariant })
|
|
566
623
|
] });
|
|
567
624
|
}
|
|
568
625
|
function ConsentProvider({
|
|
@@ -614,6 +671,7 @@ Object.defineProperty(exports, "ConsentProviderHeadless", {
|
|
|
614
671
|
enumerable: true,
|
|
615
672
|
get: function () { return core.ConsentProvider; }
|
|
616
673
|
});
|
|
674
|
+
exports.headless = core__namespace;
|
|
617
675
|
exports.Branding = Branding;
|
|
618
676
|
exports.ConsentProvider = ConsentProvider;
|
|
619
677
|
exports.CookieBanner = CookieBanner;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { ConsentProviderProps as ConsentProviderProps$1, ConsentPreferences } from '@react-lgpd-consent/core';
|
|
1
|
+
import { AdvancedConsentTexts, ConsentProviderProps as ConsentProviderProps$1, ConsentPreferences } from '@react-lgpd-consent/core';
|
|
2
2
|
export * from '@react-lgpd-consent/core';
|
|
3
|
+
import * as core from '@react-lgpd-consent/core';
|
|
4
|
+
export { core as headless };
|
|
3
5
|
export { ConsentProvider as ConsentProviderHeadless } from '@react-lgpd-consent/core';
|
|
4
6
|
import * as React from 'react';
|
|
5
7
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
@@ -47,6 +49,18 @@ interface BrandingProps {
|
|
|
47
49
|
* @defaultValue false
|
|
48
50
|
*/
|
|
49
51
|
hidden?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Textos customizados para o branding.
|
|
54
|
+
*/
|
|
55
|
+
texts?: Partial<AdvancedConsentTexts>;
|
|
56
|
+
/**
|
|
57
|
+
* Idioma local para resolver `texts.i18n`.
|
|
58
|
+
*/
|
|
59
|
+
language?: 'pt' | 'en' | 'es' | 'fr' | 'de' | 'it';
|
|
60
|
+
/**
|
|
61
|
+
* Variação de tom local para resolver `texts.variants`.
|
|
62
|
+
*/
|
|
63
|
+
textVariant?: 'formal' | 'casual' | 'concise' | 'detailed';
|
|
50
64
|
}
|
|
51
65
|
/**
|
|
52
66
|
* Componente de branding que exibe crédito "fornecido por LÉdipO.eti.br".
|
|
@@ -609,6 +623,20 @@ interface CookieBannerProps {
|
|
|
609
623
|
* ```
|
|
610
624
|
*/
|
|
611
625
|
PaperProps?: Partial<PaperProps>;
|
|
626
|
+
/**
|
|
627
|
+
* Textos customizados para o banner.
|
|
628
|
+
* Permite sobrescrever textos do contexto e aplicar i18n localmente.
|
|
629
|
+
*/
|
|
630
|
+
texts?: Partial<AdvancedConsentTexts>;
|
|
631
|
+
/**
|
|
632
|
+
* Idioma local para resolver `texts.i18n`.
|
|
633
|
+
* Se omitido, usa o idioma do contexto (quando configurado no Provider).
|
|
634
|
+
*/
|
|
635
|
+
language?: 'pt' | 'en' | 'es' | 'fr' | 'de' | 'it';
|
|
636
|
+
/**
|
|
637
|
+
* Variação de tom local para resolver `texts.variants`.
|
|
638
|
+
*/
|
|
639
|
+
textVariant?: 'formal' | 'casual' | 'concise' | 'detailed';
|
|
612
640
|
}
|
|
613
641
|
/**
|
|
614
642
|
* Banner principal de consentimento LGPD que solicita decisão do usuário sobre cookies.
|
|
@@ -701,7 +729,7 @@ interface CookieBannerProps {
|
|
|
701
729
|
* @public
|
|
702
730
|
* @since 0.1.0
|
|
703
731
|
*/
|
|
704
|
-
declare function CookieBanner({ policyLinkUrl, termsLinkUrl, debug, blocking, hideBranding, SnackbarProps, PaperProps, }: Readonly<CookieBannerProps>): react_jsx_runtime.JSX.Element | null;
|
|
732
|
+
declare function CookieBanner({ policyLinkUrl, termsLinkUrl, debug, blocking, hideBranding, SnackbarProps, PaperProps, texts: textsProp, language, textVariant, }: Readonly<CookieBannerProps>): react_jsx_runtime.JSX.Element | null;
|
|
705
733
|
|
|
706
734
|
/**
|
|
707
735
|
* Propriedades para customizar o comportamento e aparência do FloatingPreferencesButton.
|
|
@@ -846,6 +874,18 @@ interface FloatingPreferencesButtonProps {
|
|
|
846
874
|
* @defaultValue false
|
|
847
875
|
*/
|
|
848
876
|
hideWhenConsented?: boolean;
|
|
877
|
+
/**
|
|
878
|
+
* Textos customizados para o botão flutuante.
|
|
879
|
+
*/
|
|
880
|
+
texts?: Partial<AdvancedConsentTexts>;
|
|
881
|
+
/**
|
|
882
|
+
* Idioma local para resolver `texts.i18n`.
|
|
883
|
+
*/
|
|
884
|
+
language?: 'pt' | 'en' | 'es' | 'fr' | 'de' | 'it';
|
|
885
|
+
/**
|
|
886
|
+
* Variação de tom local para resolver `texts.variants`.
|
|
887
|
+
*/
|
|
888
|
+
textVariant?: 'formal' | 'casual' | 'concise' | 'detailed';
|
|
849
889
|
}
|
|
850
890
|
/**
|
|
851
891
|
* Componente interno do botão flutuante de preferências.
|
|
@@ -855,7 +895,7 @@ interface FloatingPreferencesButtonProps {
|
|
|
855
895
|
* @returns {JSX.Element | null} Elemento JSX do botão ou null se oculto.
|
|
856
896
|
* @remarks Memoiza estilos de posição para performance. Usa design tokens defensivamente.
|
|
857
897
|
*/
|
|
858
|
-
declare function FloatingPreferencesButtonComponent({ position, offset, icon, tooltip, FabProps, hideWhenConsented, }: Readonly<FloatingPreferencesButtonProps>): react_jsx_runtime.JSX.Element | null;
|
|
898
|
+
declare function FloatingPreferencesButtonComponent({ position, offset, icon, tooltip, FabProps, hideWhenConsented, texts: textsProp, language, textVariant, }: Readonly<FloatingPreferencesButtonProps>): react_jsx_runtime.JSX.Element | null;
|
|
859
899
|
/**
|
|
860
900
|
* Botão flutuante (FAB) para reabrir o modal de preferências de consentimento LGPD.
|
|
861
901
|
*
|
|
@@ -1094,6 +1134,19 @@ interface PreferencesModalProps {
|
|
|
1094
1134
|
* @defaultValue undefined (usa função do contexto)
|
|
1095
1135
|
*/
|
|
1096
1136
|
closePreferences?: () => void;
|
|
1137
|
+
/**
|
|
1138
|
+
* Textos customizados para o modal.
|
|
1139
|
+
* Permite sobrescrever textos do contexto e aplicar i18n localmente.
|
|
1140
|
+
*/
|
|
1141
|
+
texts?: Partial<AdvancedConsentTexts>;
|
|
1142
|
+
/**
|
|
1143
|
+
* Idioma local para resolver `texts.i18n`.
|
|
1144
|
+
*/
|
|
1145
|
+
language?: 'pt' | 'en' | 'es' | 'fr' | 'de' | 'it';
|
|
1146
|
+
/**
|
|
1147
|
+
* Variação de tom local para resolver `texts.variants`.
|
|
1148
|
+
*/
|
|
1149
|
+
textVariant?: 'formal' | 'casual' | 'concise' | 'detailed';
|
|
1097
1150
|
}
|
|
1098
1151
|
/**
|
|
1099
1152
|
* Modal de preferências de consentimento LGPD que permite ao usuário ajustar suas escolhas.
|
|
@@ -1207,6 +1260,6 @@ interface PreferencesModalProps {
|
|
|
1207
1260
|
* @see {@link PreferencesModalProps} - Interface completa de propriedades
|
|
1208
1261
|
* @see {@link getCookiesInfoForCategory} - Função que retorna informações de cookies
|
|
1209
1262
|
*/
|
|
1210
|
-
declare function PreferencesModal({ DialogProps, hideBranding, isModalOpen: isModalOpenProp, preferences: preferencesProp, setPreferences: setPreferencesProp, closePreferences: closePreferencesProp, }: Readonly<PreferencesModalProps>): react_jsx_runtime.JSX.Element;
|
|
1263
|
+
declare function PreferencesModal({ DialogProps, hideBranding, isModalOpen: isModalOpenProp, preferences: preferencesProp, setPreferences: setPreferencesProp, closePreferences: closePreferencesProp, texts: textsProp, language, textVariant, }: Readonly<PreferencesModalProps>): react_jsx_runtime.JSX.Element;
|
|
1211
1264
|
|
|
1212
1265
|
export { Branding, type BrandingProps, ConsentProvider, type ConsentProviderProps, CookieBanner, type CookieBannerProps, FloatingPreferencesButton, type FloatingPreferencesButtonProps, PreferencesModal, type PreferencesModalProps };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { ConsentProviderProps as ConsentProviderProps$1, ConsentPreferences } from '@react-lgpd-consent/core';
|
|
1
|
+
import { AdvancedConsentTexts, ConsentProviderProps as ConsentProviderProps$1, ConsentPreferences } from '@react-lgpd-consent/core';
|
|
2
2
|
export * from '@react-lgpd-consent/core';
|
|
3
|
+
import * as core from '@react-lgpd-consent/core';
|
|
4
|
+
export { core as headless };
|
|
3
5
|
export { ConsentProvider as ConsentProviderHeadless } from '@react-lgpd-consent/core';
|
|
4
6
|
import * as React from 'react';
|
|
5
7
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
@@ -47,6 +49,18 @@ interface BrandingProps {
|
|
|
47
49
|
* @defaultValue false
|
|
48
50
|
*/
|
|
49
51
|
hidden?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Textos customizados para o branding.
|
|
54
|
+
*/
|
|
55
|
+
texts?: Partial<AdvancedConsentTexts>;
|
|
56
|
+
/**
|
|
57
|
+
* Idioma local para resolver `texts.i18n`.
|
|
58
|
+
*/
|
|
59
|
+
language?: 'pt' | 'en' | 'es' | 'fr' | 'de' | 'it';
|
|
60
|
+
/**
|
|
61
|
+
* Variação de tom local para resolver `texts.variants`.
|
|
62
|
+
*/
|
|
63
|
+
textVariant?: 'formal' | 'casual' | 'concise' | 'detailed';
|
|
50
64
|
}
|
|
51
65
|
/**
|
|
52
66
|
* Componente de branding que exibe crédito "fornecido por LÉdipO.eti.br".
|
|
@@ -609,6 +623,20 @@ interface CookieBannerProps {
|
|
|
609
623
|
* ```
|
|
610
624
|
*/
|
|
611
625
|
PaperProps?: Partial<PaperProps>;
|
|
626
|
+
/**
|
|
627
|
+
* Textos customizados para o banner.
|
|
628
|
+
* Permite sobrescrever textos do contexto e aplicar i18n localmente.
|
|
629
|
+
*/
|
|
630
|
+
texts?: Partial<AdvancedConsentTexts>;
|
|
631
|
+
/**
|
|
632
|
+
* Idioma local para resolver `texts.i18n`.
|
|
633
|
+
* Se omitido, usa o idioma do contexto (quando configurado no Provider).
|
|
634
|
+
*/
|
|
635
|
+
language?: 'pt' | 'en' | 'es' | 'fr' | 'de' | 'it';
|
|
636
|
+
/**
|
|
637
|
+
* Variação de tom local para resolver `texts.variants`.
|
|
638
|
+
*/
|
|
639
|
+
textVariant?: 'formal' | 'casual' | 'concise' | 'detailed';
|
|
612
640
|
}
|
|
613
641
|
/**
|
|
614
642
|
* Banner principal de consentimento LGPD que solicita decisão do usuário sobre cookies.
|
|
@@ -701,7 +729,7 @@ interface CookieBannerProps {
|
|
|
701
729
|
* @public
|
|
702
730
|
* @since 0.1.0
|
|
703
731
|
*/
|
|
704
|
-
declare function CookieBanner({ policyLinkUrl, termsLinkUrl, debug, blocking, hideBranding, SnackbarProps, PaperProps, }: Readonly<CookieBannerProps>): react_jsx_runtime.JSX.Element | null;
|
|
732
|
+
declare function CookieBanner({ policyLinkUrl, termsLinkUrl, debug, blocking, hideBranding, SnackbarProps, PaperProps, texts: textsProp, language, textVariant, }: Readonly<CookieBannerProps>): react_jsx_runtime.JSX.Element | null;
|
|
705
733
|
|
|
706
734
|
/**
|
|
707
735
|
* Propriedades para customizar o comportamento e aparência do FloatingPreferencesButton.
|
|
@@ -846,6 +874,18 @@ interface FloatingPreferencesButtonProps {
|
|
|
846
874
|
* @defaultValue false
|
|
847
875
|
*/
|
|
848
876
|
hideWhenConsented?: boolean;
|
|
877
|
+
/**
|
|
878
|
+
* Textos customizados para o botão flutuante.
|
|
879
|
+
*/
|
|
880
|
+
texts?: Partial<AdvancedConsentTexts>;
|
|
881
|
+
/**
|
|
882
|
+
* Idioma local para resolver `texts.i18n`.
|
|
883
|
+
*/
|
|
884
|
+
language?: 'pt' | 'en' | 'es' | 'fr' | 'de' | 'it';
|
|
885
|
+
/**
|
|
886
|
+
* Variação de tom local para resolver `texts.variants`.
|
|
887
|
+
*/
|
|
888
|
+
textVariant?: 'formal' | 'casual' | 'concise' | 'detailed';
|
|
849
889
|
}
|
|
850
890
|
/**
|
|
851
891
|
* Componente interno do botão flutuante de preferências.
|
|
@@ -855,7 +895,7 @@ interface FloatingPreferencesButtonProps {
|
|
|
855
895
|
* @returns {JSX.Element | null} Elemento JSX do botão ou null se oculto.
|
|
856
896
|
* @remarks Memoiza estilos de posição para performance. Usa design tokens defensivamente.
|
|
857
897
|
*/
|
|
858
|
-
declare function FloatingPreferencesButtonComponent({ position, offset, icon, tooltip, FabProps, hideWhenConsented, }: Readonly<FloatingPreferencesButtonProps>): react_jsx_runtime.JSX.Element | null;
|
|
898
|
+
declare function FloatingPreferencesButtonComponent({ position, offset, icon, tooltip, FabProps, hideWhenConsented, texts: textsProp, language, textVariant, }: Readonly<FloatingPreferencesButtonProps>): react_jsx_runtime.JSX.Element | null;
|
|
859
899
|
/**
|
|
860
900
|
* Botão flutuante (FAB) para reabrir o modal de preferências de consentimento LGPD.
|
|
861
901
|
*
|
|
@@ -1094,6 +1134,19 @@ interface PreferencesModalProps {
|
|
|
1094
1134
|
* @defaultValue undefined (usa função do contexto)
|
|
1095
1135
|
*/
|
|
1096
1136
|
closePreferences?: () => void;
|
|
1137
|
+
/**
|
|
1138
|
+
* Textos customizados para o modal.
|
|
1139
|
+
* Permite sobrescrever textos do contexto e aplicar i18n localmente.
|
|
1140
|
+
*/
|
|
1141
|
+
texts?: Partial<AdvancedConsentTexts>;
|
|
1142
|
+
/**
|
|
1143
|
+
* Idioma local para resolver `texts.i18n`.
|
|
1144
|
+
*/
|
|
1145
|
+
language?: 'pt' | 'en' | 'es' | 'fr' | 'de' | 'it';
|
|
1146
|
+
/**
|
|
1147
|
+
* Variação de tom local para resolver `texts.variants`.
|
|
1148
|
+
*/
|
|
1149
|
+
textVariant?: 'formal' | 'casual' | 'concise' | 'detailed';
|
|
1097
1150
|
}
|
|
1098
1151
|
/**
|
|
1099
1152
|
* Modal de preferências de consentimento LGPD que permite ao usuário ajustar suas escolhas.
|
|
@@ -1207,6 +1260,6 @@ interface PreferencesModalProps {
|
|
|
1207
1260
|
* @see {@link PreferencesModalProps} - Interface completa de propriedades
|
|
1208
1261
|
* @see {@link getCookiesInfoForCategory} - Função que retorna informações de cookies
|
|
1209
1262
|
*/
|
|
1210
|
-
declare function PreferencesModal({ DialogProps, hideBranding, isModalOpen: isModalOpenProp, preferences: preferencesProp, setPreferences: setPreferencesProp, closePreferences: closePreferencesProp, }: Readonly<PreferencesModalProps>): react_jsx_runtime.JSX.Element;
|
|
1263
|
+
declare function PreferencesModal({ DialogProps, hideBranding, isModalOpen: isModalOpenProp, preferences: preferencesProp, setPreferences: setPreferencesProp, closePreferences: closePreferencesProp, texts: textsProp, language, textVariant, }: Readonly<PreferencesModalProps>): react_jsx_runtime.JSX.Element;
|
|
1211
1264
|
|
|
1212
1265
|
export { Branding, type BrandingProps, ConsentProvider, type ConsentProviderProps, CookieBanner, type CookieBannerProps, FloatingPreferencesButton, type FloatingPreferencesButtonProps, PreferencesModal, type PreferencesModalProps };
|