@react-lgpd-consent/mui 0.7.1 → 0.8.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/README.md +13 -2
- package/dist/index.cjs +92 -32
- package/dist/index.d.cts +55 -4
- package/dist/index.d.ts +55 -4
- package/dist/index.js +92 -32
- package/dist/ui.cjs +92 -32
- package/dist/ui.js +92 -32
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -97,9 +97,9 @@ import { ConsentProvider } from '@react-lgpd-consent/mui'
|
|
|
97
97
|
### Presets ANPD
|
|
98
98
|
|
|
99
99
|
```tsx
|
|
100
|
-
import {
|
|
100
|
+
import { createAnpdCategoriesConfig } from '@react-lgpd-consent/mui'
|
|
101
101
|
|
|
102
|
-
const categories =
|
|
102
|
+
const categories = createAnpdCategoriesConfig({
|
|
103
103
|
include: ['analytics', 'marketing']
|
|
104
104
|
})
|
|
105
105
|
|
|
@@ -161,6 +161,17 @@ function CustomUI() {
|
|
|
161
161
|
/>
|
|
162
162
|
```
|
|
163
163
|
|
|
164
|
+
Para bloquear navegação até a decisão, use `blockingMode="hard"` no provider:
|
|
165
|
+
|
|
166
|
+
```tsx
|
|
167
|
+
<ConsentProvider
|
|
168
|
+
categories={{ enabledCategories: ['analytics'] }}
|
|
169
|
+
blocking
|
|
170
|
+
blockingMode="hard"
|
|
171
|
+
blockingStrategy="provider"
|
|
172
|
+
/>
|
|
173
|
+
```
|
|
174
|
+
|
|
164
175
|
## 📚 Documentação
|
|
165
176
|
|
|
166
177
|
- [Documentação Principal](https://lucianoedipo.github.io/react-lgpd-consent/)
|
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');
|
|
@@ -45,7 +45,7 @@ function _interopNamespace(e) {
|
|
|
45
45
|
var core__namespace = /*#__PURE__*/_interopNamespace(core);
|
|
46
46
|
var Link__default = /*#__PURE__*/_interopDefault(Link);
|
|
47
47
|
var Typography__default = /*#__PURE__*/_interopDefault(Typography);
|
|
48
|
-
var
|
|
48
|
+
var React4__namespace = /*#__PURE__*/_interopNamespace(React4);
|
|
49
49
|
var Box2__default = /*#__PURE__*/_interopDefault(Box2);
|
|
50
50
|
var Button__default = /*#__PURE__*/_interopDefault(Button);
|
|
51
51
|
var Paper__default = /*#__PURE__*/_interopDefault(Paper);
|
|
@@ -90,11 +90,22 @@ var linkStyles = {
|
|
|
90
90
|
textDecoration: "underline"
|
|
91
91
|
}
|
|
92
92
|
};
|
|
93
|
-
var Branding =
|
|
93
|
+
var Branding = React4__namespace.memo(function Branding2({
|
|
94
94
|
variant,
|
|
95
|
-
hidden = false
|
|
95
|
+
hidden = false,
|
|
96
|
+
texts: textsProp,
|
|
97
|
+
language,
|
|
98
|
+
textVariant
|
|
96
99
|
}) {
|
|
97
|
-
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
|
+
);
|
|
98
109
|
const designTokens = core.useDesignTokens();
|
|
99
110
|
if (hidden) return null;
|
|
100
111
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -132,10 +143,21 @@ function CookieBanner({
|
|
|
132
143
|
blocking = true,
|
|
133
144
|
hideBranding = false,
|
|
134
145
|
SnackbarProps,
|
|
135
|
-
PaperProps
|
|
146
|
+
PaperProps,
|
|
147
|
+
texts: textsProp,
|
|
148
|
+
language,
|
|
149
|
+
textVariant
|
|
136
150
|
}) {
|
|
137
151
|
const { consented, acceptAll, rejectAll, openPreferences } = core.useConsent();
|
|
138
|
-
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
|
+
);
|
|
139
161
|
const isHydrated = core.useConsentHydration();
|
|
140
162
|
const designTokens = core.useDesignTokens();
|
|
141
163
|
const open = debug ? true : isHydrated && !consented;
|
|
@@ -210,7 +232,15 @@ function CookieBanner({
|
|
|
210
232
|
}
|
|
211
233
|
)
|
|
212
234
|
] }),
|
|
213
|
-
!hideBranding && /* @__PURE__ */ jsxRuntime.jsx(
|
|
235
|
+
!hideBranding && /* @__PURE__ */ jsxRuntime.jsx(
|
|
236
|
+
Branding,
|
|
237
|
+
{
|
|
238
|
+
variant: "banner",
|
|
239
|
+
texts: textsProp,
|
|
240
|
+
language,
|
|
241
|
+
textVariant
|
|
242
|
+
}
|
|
243
|
+
)
|
|
214
244
|
] }) });
|
|
215
245
|
const resolveBannerZIndex = (theme) => designTokens?.layout?.zIndex?.banner ?? theme?.zIndex?.snackbar ?? 1400;
|
|
216
246
|
const positionStyle = (theme) => ({
|
|
@@ -310,13 +340,24 @@ function FloatingPreferencesButtonComponent({
|
|
|
310
340
|
icon = /* @__PURE__ */ jsxRuntime.jsx(CookieOutlined__default.default, {}),
|
|
311
341
|
tooltip,
|
|
312
342
|
FabProps,
|
|
313
|
-
hideWhenConsented = false
|
|
343
|
+
hideWhenConsented = false,
|
|
344
|
+
texts: textsProp,
|
|
345
|
+
language,
|
|
346
|
+
textVariant
|
|
314
347
|
}) {
|
|
315
348
|
const { openPreferences, consented } = core.useConsent();
|
|
316
|
-
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
|
+
);
|
|
317
358
|
const safeTheme = useThemeWithFallbacks();
|
|
318
359
|
const designTokens = core.useDesignTokens();
|
|
319
|
-
const positionStyles =
|
|
360
|
+
const positionStyles = React4__namespace.useMemo(() => {
|
|
320
361
|
const styles = {
|
|
321
362
|
position: "fixed",
|
|
322
363
|
zIndex: 1200
|
|
@@ -367,7 +408,7 @@ function FloatingPreferencesButtonComponent({
|
|
|
367
408
|
}
|
|
368
409
|
) });
|
|
369
410
|
}
|
|
370
|
-
var FloatingPreferencesButton =
|
|
411
|
+
var FloatingPreferencesButton = React4__namespace.memo(FloatingPreferencesButtonComponent);
|
|
371
412
|
FloatingPreferencesButton.displayName = "FloatingPreferencesButton";
|
|
372
413
|
function PreferencesModal({
|
|
373
414
|
DialogProps: DialogProps2,
|
|
@@ -375,26 +416,37 @@ function PreferencesModal({
|
|
|
375
416
|
isModalOpen: isModalOpenProp,
|
|
376
417
|
preferences: preferencesProp,
|
|
377
418
|
setPreferences: setPreferencesProp,
|
|
378
|
-
closePreferences: closePreferencesProp
|
|
419
|
+
closePreferences: closePreferencesProp,
|
|
420
|
+
texts: textsProp,
|
|
421
|
+
language,
|
|
422
|
+
textVariant
|
|
379
423
|
}) {
|
|
380
424
|
const hookValue = core.useConsent();
|
|
381
425
|
const preferences = preferencesProp ?? hookValue.preferences;
|
|
382
426
|
const setPreferences = setPreferencesProp ?? hookValue.setPreferences;
|
|
383
427
|
const closePreferences = closePreferencesProp ?? hookValue.closePreferences;
|
|
384
428
|
const isModalOpen = isModalOpenProp ?? hookValue.isModalOpen;
|
|
385
|
-
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
|
+
);
|
|
386
438
|
const designTokens = core.useDesignTokens();
|
|
387
439
|
const { toggleableCategories, allCategories } = core.useCategories();
|
|
388
|
-
const getInitialPreferences =
|
|
440
|
+
const getInitialPreferences = React4__namespace.useCallback(() => {
|
|
389
441
|
const syncedPrefs = { necessary: true };
|
|
390
442
|
toggleableCategories.forEach((category) => {
|
|
391
443
|
syncedPrefs[category.id] = preferences[category.id] ?? false;
|
|
392
444
|
});
|
|
393
445
|
return syncedPrefs;
|
|
394
446
|
}, [preferences, toggleableCategories]);
|
|
395
|
-
const [tempPreferences, setTempPreferences] =
|
|
396
|
-
const wasOpenRef =
|
|
397
|
-
|
|
447
|
+
const [tempPreferences, setTempPreferences] = React4__namespace.useState(getInitialPreferences);
|
|
448
|
+
const wasOpenRef = React4__namespace.useRef(isModalOpen);
|
|
449
|
+
React4__namespace.useEffect(() => {
|
|
398
450
|
const justOpened = isModalOpen && !wasOpenRef.current;
|
|
399
451
|
wasOpenRef.current = isModalOpen;
|
|
400
452
|
if (justOpened) {
|
|
@@ -412,6 +464,7 @@ function PreferencesModal({
|
|
|
412
464
|
setTempPreferences(preferences);
|
|
413
465
|
closePreferences();
|
|
414
466
|
};
|
|
467
|
+
const descriptionId = "cookie-pref-description";
|
|
415
468
|
const modalTitleSx = (theme) => ({
|
|
416
469
|
fontSize: designTokens?.typography?.fontSize?.modal ?? void 0,
|
|
417
470
|
color: designTokens?.colors?.text ?? theme.palette.text.primary
|
|
@@ -421,7 +474,7 @@ function PreferencesModal({
|
|
|
421
474
|
backgroundColor: designTokens?.colors?.background ?? theme.palette.background.paper,
|
|
422
475
|
color: designTokens?.colors?.text ?? theme.palette.text.primary
|
|
423
476
|
});
|
|
424
|
-
const resolveModalZIndex =
|
|
477
|
+
const resolveModalZIndex = React4__namespace.useCallback(
|
|
425
478
|
(theme) => designTokens?.layout?.zIndex?.modal ?? (theme?.zIndex?.modal ?? 1300) + 10,
|
|
426
479
|
[designTokens?.layout?.zIndex?.modal]
|
|
427
480
|
);
|
|
@@ -436,11 +489,13 @@ function PreferencesModal({
|
|
|
436
489
|
...modalZIndexToken ? { style: { zIndex: modalZIndexToken } } : {},
|
|
437
490
|
"data-testid": dialogRest?.slotProps?.root?.["data-testid"] ?? "lgpd-preferences-modal-root"
|
|
438
491
|
};
|
|
492
|
+
const ariaDescribedBy = dialogRest["aria-describedby"] ?? descriptionId;
|
|
439
493
|
const mergedDialogProps = {
|
|
440
494
|
open,
|
|
441
495
|
fullWidth: true,
|
|
442
496
|
maxWidth: "sm",
|
|
443
497
|
...dialogRest,
|
|
498
|
+
"aria-describedby": ariaDescribedBy,
|
|
444
499
|
slotProps: {
|
|
445
500
|
...dialogRest?.slotProps,
|
|
446
501
|
root: rootSlotProps
|
|
@@ -452,6 +507,7 @@ function PreferencesModal({
|
|
|
452
507
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
453
508
|
Typography__default.default,
|
|
454
509
|
{
|
|
510
|
+
id: descriptionId,
|
|
455
511
|
variant: "body2",
|
|
456
512
|
sx: (theme) => ({
|
|
457
513
|
mb: 2,
|
|
@@ -467,6 +523,10 @@ function PreferencesModal({
|
|
|
467
523
|
const namesFromGuidance = full?.cookies ?? [];
|
|
468
524
|
const used = globalThis.__LGPD_USED_INTEGRATIONS__ || [];
|
|
469
525
|
const descriptors = core.getCookiesInfoForCategory(category.id, used);
|
|
526
|
+
const tableHeaders = texts.cookieDetails?.tableHeaders;
|
|
527
|
+
const toggleDetailsText = texts.cookieDetails?.toggleDetails?.expand ?? "Ver detalhes";
|
|
528
|
+
const scriptLabelPrefix = texts.cookieDetails?.scriptLabelPrefix ?? "(script) ";
|
|
529
|
+
const scriptPurpose = texts.cookieDetails?.scriptPurpose ?? "Script de integra\xE7\xE3o ativo";
|
|
470
530
|
const enrichedDescriptors = descriptors.map((desc) => {
|
|
471
531
|
if (desc.purpose && desc.duration && desc.provider) {
|
|
472
532
|
return desc;
|
|
@@ -487,8 +547,8 @@ function PreferencesModal({
|
|
|
487
547
|
if (merged.length === 0) {
|
|
488
548
|
const gmap = globalThis.__LGPD_INTEGRATIONS_MAP__ || {};
|
|
489
549
|
const scriptRows = Object.entries(gmap).filter(([, cat]) => cat === category.id).map(([id]) => ({
|
|
490
|
-
name:
|
|
491
|
-
purpose:
|
|
550
|
+
name: `${scriptLabelPrefix}${id}`,
|
|
551
|
+
purpose: scriptPurpose,
|
|
492
552
|
duration: "-",
|
|
493
553
|
provider: "-"
|
|
494
554
|
}));
|
|
@@ -514,13 +574,13 @@ function PreferencesModal({
|
|
|
514
574
|
}
|
|
515
575
|
),
|
|
516
576
|
/* @__PURE__ */ jsxRuntime.jsxs("details", { style: { marginLeft: 48 }, children: [
|
|
517
|
-
/* @__PURE__ */ jsxRuntime.jsx("summary", { children:
|
|
577
|
+
/* @__PURE__ */ jsxRuntime.jsx("summary", { children: toggleDetailsText }),
|
|
518
578
|
/* @__PURE__ */ jsxRuntime.jsx(Box2__default.default, { sx: { mt: 1 }, children: /* @__PURE__ */ jsxRuntime.jsxs("table", { style: { width: "100%", borderCollapse: "collapse" }, children: [
|
|
519
579
|
/* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
520
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { style: { textAlign: "left" }, children: "Cookie" }),
|
|
521
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { style: { textAlign: "left" }, children: "Finalidade" }),
|
|
522
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { style: { textAlign: "left" }, children: "Dura\xE7\xE3o" }),
|
|
523
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { style: { textAlign: "left" }, children: "Fornecedor" })
|
|
580
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { style: { textAlign: "left" }, children: tableHeaders?.name ?? "Cookie" }),
|
|
581
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { style: { textAlign: "left" }, children: tableHeaders?.purpose ?? "Finalidade" }),
|
|
582
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { style: { textAlign: "left" }, children: tableHeaders?.duration ?? "Dura\xE7\xE3o" }),
|
|
583
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { style: { textAlign: "left" }, children: tableHeaders?.provider ?? "Fornecedor" })
|
|
524
584
|
] }) }),
|
|
525
585
|
/* @__PURE__ */ jsxRuntime.jsx("tbody", { children: mergedFinal.map((d, idx) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
526
586
|
/* @__PURE__ */ jsxRuntime.jsx("td", { children: d.name }),
|
|
@@ -534,13 +594,13 @@ function PreferencesModal({
|
|
|
534
594
|
}),
|
|
535
595
|
/* @__PURE__ */ jsxRuntime.jsx(FormControlLabel__default.default, { control: /* @__PURE__ */ jsxRuntime.jsx(Switch__default.default, { checked: true, disabled: true }), label: texts.necessaryAlwaysOn }),
|
|
536
596
|
/* @__PURE__ */ jsxRuntime.jsxs("details", { style: { marginLeft: 48 }, children: [
|
|
537
|
-
/* @__PURE__ */ jsxRuntime.jsx("summary", { children: "Ver detalhes" }),
|
|
597
|
+
/* @__PURE__ */ jsxRuntime.jsx("summary", { children: texts.cookieDetails?.toggleDetails?.expand ?? "Ver detalhes" }),
|
|
538
598
|
/* @__PURE__ */ jsxRuntime.jsx(Box2__default.default, { sx: { mt: 1 }, children: /* @__PURE__ */ jsxRuntime.jsxs("table", { style: { width: "100%", borderCollapse: "collapse" }, children: [
|
|
539
599
|
/* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
540
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { style: { textAlign: "left" }, children: "Cookie" }),
|
|
541
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { style: { textAlign: "left" }, children: "Finalidade" }),
|
|
542
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { style: { textAlign: "left" }, children: "Dura\xE7\xE3o" }),
|
|
543
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { style: { textAlign: "left" }, children: "Fornecedor" })
|
|
600
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { style: { textAlign: "left" }, children: texts.cookieDetails?.tableHeaders?.name ?? "Cookie" }),
|
|
601
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { style: { textAlign: "left" }, children: texts.cookieDetails?.tableHeaders?.purpose ?? "Finalidade" }),
|
|
602
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { style: { textAlign: "left" }, children: texts.cookieDetails?.tableHeaders?.duration ?? "Dura\xE7\xE3o" }),
|
|
603
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { style: { textAlign: "left" }, children: texts.cookieDetails?.tableHeaders?.provider ?? "Fornecedor" })
|
|
544
604
|
] }) }),
|
|
545
605
|
/* @__PURE__ */ jsxRuntime.jsx("tbody", { children: (() => {
|
|
546
606
|
const used = globalThis.__LGPD_USED_INTEGRATIONS__ || [];
|
|
@@ -563,7 +623,7 @@ function PreferencesModal({
|
|
|
563
623
|
/* @__PURE__ */ jsxRuntime.jsx(Button__default.default, { variant: "outlined", onClick: handleCancel, children: texts.close }),
|
|
564
624
|
/* @__PURE__ */ jsxRuntime.jsx(Button__default.default, { variant: "contained", onClick: handleSave, children: texts.save })
|
|
565
625
|
] }),
|
|
566
|
-
!hideBranding && /* @__PURE__ */ jsxRuntime.jsx(Branding, { variant: "modal" })
|
|
626
|
+
!hideBranding && /* @__PURE__ */ jsxRuntime.jsx(Branding, { variant: "modal", texts: textsProp, language, textVariant })
|
|
567
627
|
] });
|
|
568
628
|
}
|
|
569
629
|
function ConsentProvider({
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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
3
|
import * as core from '@react-lgpd-consent/core';
|
|
4
4
|
export { core as headless };
|
|
@@ -49,6 +49,18 @@ interface BrandingProps {
|
|
|
49
49
|
* @defaultValue false
|
|
50
50
|
*/
|
|
51
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';
|
|
52
64
|
}
|
|
53
65
|
/**
|
|
54
66
|
* Componente de branding que exibe crédito "fornecido por LÉdipO.eti.br".
|
|
@@ -611,6 +623,20 @@ interface CookieBannerProps {
|
|
|
611
623
|
* ```
|
|
612
624
|
*/
|
|
613
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';
|
|
614
640
|
}
|
|
615
641
|
/**
|
|
616
642
|
* Banner principal de consentimento LGPD que solicita decisão do usuário sobre cookies.
|
|
@@ -703,7 +729,7 @@ interface CookieBannerProps {
|
|
|
703
729
|
* @public
|
|
704
730
|
* @since 0.1.0
|
|
705
731
|
*/
|
|
706
|
-
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;
|
|
707
733
|
|
|
708
734
|
/**
|
|
709
735
|
* Propriedades para customizar o comportamento e aparência do FloatingPreferencesButton.
|
|
@@ -848,6 +874,18 @@ interface FloatingPreferencesButtonProps {
|
|
|
848
874
|
* @defaultValue false
|
|
849
875
|
*/
|
|
850
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';
|
|
851
889
|
}
|
|
852
890
|
/**
|
|
853
891
|
* Componente interno do botão flutuante de preferências.
|
|
@@ -857,7 +895,7 @@ interface FloatingPreferencesButtonProps {
|
|
|
857
895
|
* @returns {JSX.Element | null} Elemento JSX do botão ou null se oculto.
|
|
858
896
|
* @remarks Memoiza estilos de posição para performance. Usa design tokens defensivamente.
|
|
859
897
|
*/
|
|
860
|
-
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;
|
|
861
899
|
/**
|
|
862
900
|
* Botão flutuante (FAB) para reabrir o modal de preferências de consentimento LGPD.
|
|
863
901
|
*
|
|
@@ -1096,6 +1134,19 @@ interface PreferencesModalProps {
|
|
|
1096
1134
|
* @defaultValue undefined (usa função do contexto)
|
|
1097
1135
|
*/
|
|
1098
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';
|
|
1099
1150
|
}
|
|
1100
1151
|
/**
|
|
1101
1152
|
* Modal de preferências de consentimento LGPD que permite ao usuário ajustar suas escolhas.
|
|
@@ -1209,6 +1260,6 @@ interface PreferencesModalProps {
|
|
|
1209
1260
|
* @see {@link PreferencesModalProps} - Interface completa de propriedades
|
|
1210
1261
|
* @see {@link getCookiesInfoForCategory} - Função que retorna informações de cookies
|
|
1211
1262
|
*/
|
|
1212
|
-
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;
|
|
1213
1264
|
|
|
1214
1265
|
export { Branding, type BrandingProps, ConsentProvider, type ConsentProviderProps, CookieBanner, type CookieBannerProps, FloatingPreferencesButton, type FloatingPreferencesButtonProps, PreferencesModal, type PreferencesModalProps };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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
3
|
import * as core from '@react-lgpd-consent/core';
|
|
4
4
|
export { core as headless };
|
|
@@ -49,6 +49,18 @@ interface BrandingProps {
|
|
|
49
49
|
* @defaultValue false
|
|
50
50
|
*/
|
|
51
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';
|
|
52
64
|
}
|
|
53
65
|
/**
|
|
54
66
|
* Componente de branding que exibe crédito "fornecido por LÉdipO.eti.br".
|
|
@@ -611,6 +623,20 @@ interface CookieBannerProps {
|
|
|
611
623
|
* ```
|
|
612
624
|
*/
|
|
613
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';
|
|
614
640
|
}
|
|
615
641
|
/**
|
|
616
642
|
* Banner principal de consentimento LGPD que solicita decisão do usuário sobre cookies.
|
|
@@ -703,7 +729,7 @@ interface CookieBannerProps {
|
|
|
703
729
|
* @public
|
|
704
730
|
* @since 0.1.0
|
|
705
731
|
*/
|
|
706
|
-
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;
|
|
707
733
|
|
|
708
734
|
/**
|
|
709
735
|
* Propriedades para customizar o comportamento e aparência do FloatingPreferencesButton.
|
|
@@ -848,6 +874,18 @@ interface FloatingPreferencesButtonProps {
|
|
|
848
874
|
* @defaultValue false
|
|
849
875
|
*/
|
|
850
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';
|
|
851
889
|
}
|
|
852
890
|
/**
|
|
853
891
|
* Componente interno do botão flutuante de preferências.
|
|
@@ -857,7 +895,7 @@ interface FloatingPreferencesButtonProps {
|
|
|
857
895
|
* @returns {JSX.Element | null} Elemento JSX do botão ou null se oculto.
|
|
858
896
|
* @remarks Memoiza estilos de posição para performance. Usa design tokens defensivamente.
|
|
859
897
|
*/
|
|
860
|
-
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;
|
|
861
899
|
/**
|
|
862
900
|
* Botão flutuante (FAB) para reabrir o modal de preferências de consentimento LGPD.
|
|
863
901
|
*
|
|
@@ -1096,6 +1134,19 @@ interface PreferencesModalProps {
|
|
|
1096
1134
|
* @defaultValue undefined (usa função do contexto)
|
|
1097
1135
|
*/
|
|
1098
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';
|
|
1099
1150
|
}
|
|
1100
1151
|
/**
|
|
1101
1152
|
* Modal de preferências de consentimento LGPD que permite ao usuário ajustar suas escolhas.
|
|
@@ -1209,6 +1260,6 @@ interface PreferencesModalProps {
|
|
|
1209
1260
|
* @see {@link PreferencesModalProps} - Interface completa de propriedades
|
|
1210
1261
|
* @see {@link getCookiesInfoForCategory} - Função que retorna informações de cookies
|
|
1211
1262
|
*/
|
|
1212
|
-
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;
|
|
1213
1264
|
|
|
1214
1265
|
export { Branding, type BrandingProps, ConsentProvider, type ConsentProviderProps, CookieBanner, type CookieBannerProps, FloatingPreferencesButton, type FloatingPreferencesButtonProps, PreferencesModal, type PreferencesModalProps };
|