react-lgpd-consent 0.3.3 → 0.3.4

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/dist/index.d.ts CHANGED
@@ -567,7 +567,7 @@ interface DesignTokens {
567
567
  mobile?: string;
568
568
  desktop?: string;
569
569
  };
570
- backdrop?: boolean;
570
+ backdrop?: boolean | string;
571
571
  };
572
572
  }
573
573
  /**
@@ -713,6 +713,22 @@ interface ConsentProviderProps {
713
713
  * - `true`: Banner bloqueia interação até decisão (compliance rigorosa)
714
714
  */
715
715
  blocking?: boolean;
716
+ /**
717
+ * Estratégia de bloqueio quando `blocking` estiver habilitado.
718
+ * - 'auto' (padrão):
719
+ * - Se usar o banner padrão da lib, o bloqueio visual/funcional fica a cargo do próprio banner.
720
+ * - Se usar `CookieBannerComponent` custom, o Provider NÃO cria overlay; o bloqueio fica a cargo do componente custom (compatibilidade atual).
721
+ * - 'provider': o Provider cria um overlay de bloqueio por cima da aplicação (e abaixo do banner),
722
+ * garantindo que cliques sejam bloqueados, independentemente do banner custom implementar ou não esse comportamento.
723
+ * - 'component': nenhum overlay do Provider; espera-se que o banner (padrão ou custom) trate o bloqueio.
724
+ *
725
+ * Observações:
726
+ * - Visual do overlay do Provider controlado por `designTokens.layout.backdrop`:
727
+ * - `false`: overlay transparente (bloqueia cliques sem escurecer — útil quando o app já possui um dark-filter visual próprio).
728
+ * - `string` (ex.: 'rgba(0,0,0,0.4)'): overlay com escurecimento gerenciado pela lib.
729
+ * - A11y: recomenda-se que o banner use semântica de diálogo (role="dialog", aria-modal="true") e trap de foco.
730
+ */
731
+ blockingStrategy?: 'auto' | 'provider' | 'component';
716
732
  /** Oculta o branding "fornecido por LÉdipO.eti.br" dos componentes. */
717
733
  hideBranding?: boolean;
718
734
  /**
@@ -776,6 +792,12 @@ interface CustomCookieBannerProps {
776
792
  rejectAll: () => void;
777
793
  openPreferences: () => void;
778
794
  texts: ConsentTexts;
795
+ /**
796
+ * Indica se o modo bloqueante está ativo no contexto.
797
+ * Esta prop é apenas informativa para banners customizados ajustarem sua UI.
798
+ * O bloqueio funcional pode ser garantido pelo Provider quando `blockingStrategy='provider'`.
799
+ */
800
+ blocking?: boolean;
779
801
  }
780
802
  /**
781
803
  * Props esperadas por um componente customizado de PreferencesModal.
@@ -883,7 +905,7 @@ interface ConsentContextValue {
883
905
  * </ConsentProvider>
884
906
  * ```
885
907
  */
886
- declare function ConsentProvider({ initialState, categories, texts: textsProp, theme, designTokens, PreferencesModalComponent, preferencesModalProps, CookieBannerComponent, cookieBannerProps, FloatingPreferencesButtonComponent, floatingPreferencesButtonProps, disableFloatingPreferencesButton, hideBranding, onConsentGiven, onPreferencesSaved, cookie: cookieOpts, disableDeveloperGuidance, children, }: Readonly<ConsentProviderProps>): react_jsx_runtime.JSX.Element;
908
+ declare function ConsentProvider({ initialState, categories, texts: textsProp, theme, designTokens, PreferencesModalComponent, preferencesModalProps, CookieBannerComponent, cookieBannerProps, FloatingPreferencesButtonComponent, floatingPreferencesButtonProps, disableFloatingPreferencesButton, blocking, blockingStrategy, hideBranding, onConsentGiven, onPreferencesSaved, cookie: cookieOpts, disableDeveloperGuidance, children, }: Readonly<ConsentProviderProps>): react_jsx_runtime.JSX.Element;
887
909
  declare const defaultTexts: ConsentTexts;
888
910
 
889
911
  /**
@@ -916,7 +938,7 @@ declare const defaultTexts: ConsentTexts;
916
938
  * - **`setPreferences(preferences)`**: Define múltiplas categorias de uma vez
917
939
  * - **`openPreferences()`**: Abre o modal de preferências
918
940
  * - **`closePreferences()`**: Fecha o modal de preferências
919
- * - **`resetConsent()`**: Limpa todo consentimento (volta ao estado inicial)
941
+ * - **`resetConsent()`**: Limpa all consentimento (volta ao estado inicial)
920
942
  *
921
943
  * ### Performance e SSR
922
944
  * - O hook é otimizado com `useMemo` interno para evitar re-renders desnecessários
package/dist/index.js CHANGED
@@ -20,7 +20,7 @@ import {
20
20
  useConsentTexts,
21
21
  useOpenPreferencesModal,
22
22
  validateProjectPreferences
23
- } from "./chunk-GPLNN3FD.js";
23
+ } from "./chunk-7D2F6JFW.js";
24
24
 
25
25
  // src/utils/ConsentGate.tsx
26
26
  import { Fragment, jsx } from "react/jsx-runtime";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-lgpd-consent",
3
- "version": "0.3.3",
4
- "description": "Biblioteca completa de consentimento LGPD com 6 categorias ANPD, integrações nativas e sistema extensível para React.",
3
+ "version": "0.3.4",
4
+ "description": "Biblioteca de consentimento LGPD, integrações nativas e sistema extensível para React.",
5
5
  "keywords": [
6
6
  "lgpd",
7
7
  "anpd",
@@ -47,23 +47,30 @@
47
47
  "files": [
48
48
  "dist",
49
49
  "README.md",
50
+ "README.en.md",
51
+ "QUICKSTART.md",
52
+ "QUICKSTART.en.md",
50
53
  "LICENSE",
51
54
  "CHANGELOG.md"
52
55
  ],
53
56
  "engines": {
54
57
  "node": ">=18.18"
55
58
  },
56
- "packageManager": "npm@10.0.0",
59
+ "packageManager": "npm@10.9.3",
57
60
  "scripts": {
58
- "clean": "rimraf node_modules package-lock.json dist",
61
+ "clean": "rimraf node_modules package-lock.json dist docs storybook-static .cache .stryker-tmp",
59
62
  "build": "cross-env NODE_ENV=production tsup src/index.ts --format esm,cjs --dts --clean",
60
63
  "dev": "cross-env NODE_ENV=development tsup src/index.ts --format esm,cjs --dts --watch",
61
64
  "lint": "eslint . --ext .ts,.tsx",
62
65
  "format": "prettier --write \"src/**/*.{ts,tsx,json,md}\" \"eslint.config.js\"",
63
66
  "type-check": "tsc --noEmit",
64
67
  "test": "jest --config jest.config.ts",
68
+ "mutation": "npx stryker run",
69
+ "mutation:tests": "npx stryker run ./stryker.tests.conf.json",
65
70
  "prepublishOnly": "npm run build",
66
- "docs:generate": "typedoc --out docs"
71
+ "docs:generate": "typedoc --out docs",
72
+ "storybook": "storybook dev -p 6006",
73
+ "build-storybook": "storybook build"
67
74
  },
68
75
  "repository": {
69
76
  "type": "git",
@@ -88,38 +95,47 @@
88
95
  "js-cookie": "^3.0.5"
89
96
  },
90
97
  "devDependencies": {
98
+ "@chromatic-com/storybook": "^4.1.1",
91
99
  "@emotion/react": "^11.14.0",
92
100
  "@emotion/styled": "^11.14.1",
93
101
  "@eslint/compat": "^1.3.2",
94
102
  "@mui/icons-material": "^7.3.1",
95
103
  "@mui/material": "^7.3.1",
104
+ "@storybook/addon-a11y": "^9.1.3",
105
+ "@storybook/addon-docs": "^9.1.3",
106
+ "@storybook/addon-vitest": "^9.1.3",
107
+ "@storybook/react-vite": "^9.1.3",
108
+ "@stryker-mutator/core": "^9.0.1",
109
+ "@stryker-mutator/jest-runner": "^9.0.1",
96
110
  "@testing-library/dom": "^10.4.1",
97
- "@testing-library/jest-dom": "^6.7.0",
111
+ "@testing-library/jest-dom": "^6.8.0",
98
112
  "@testing-library/react": "^16.3.0",
99
113
  "@testing-library/user-event": "^14.6.1",
100
- "@types/jest": "^29.5.14",
114
+ "@types/jest": "^30.0.0",
101
115
  "@types/js-cookie": "^3.0.6",
102
- "@types/node": "^24.2.1",
103
- "@types/react": "^19.1.10",
116
+ "@types/node": "^24.3.0",
117
+ "@types/react": "^19.1.11",
104
118
  "@types/react-dom": "^19.1.7",
105
- "@typescript-eslint/eslint-plugin": "^8.39.1",
106
- "@typescript-eslint/parser": "^8.39.1",
119
+ "@typescript-eslint/eslint-plugin": "^8.41.0",
120
+ "@typescript-eslint/parser": "^8.41.0",
107
121
  "cross-env": "^10.0.0",
108
- "eslint": "^9.33.0",
122
+ "eslint": "^9.34.0",
109
123
  "eslint-config-prettier": "^10.1.8",
110
124
  "eslint-plugin-jest": "^29.0.1",
111
125
  "eslint-plugin-react-hooks": "^5.2.0",
112
- "jest": "^29.7.0",
113
- "jest-environment-jsdom": "^29.7.0",
126
+ "eslint-plugin-storybook": "^9.1.3",
127
+ "jest": "^30.0.5",
128
+ "jest-environment-jsdom": "^30.0.5",
114
129
  "prettier": "^3.6.2",
115
130
  "react": "^19.1.1",
116
131
  "react-dom": "^19.1.1",
117
132
  "rimraf": "^6.0.1",
133
+ "storybook": "^9.1.3",
118
134
  "ts-jest": "^29.4.1",
119
135
  "ts-node": "^10.9.2",
120
136
  "tsup": "^8.5.0",
121
- "typedoc": "^0.28.10",
137
+ "typedoc": "^0.28.11",
122
138
  "typescript": "^5.9.2",
123
- "typescript-eslint": "^8.39.1"
139
+ "typescript-eslint": "^8.41.0"
124
140
  }
125
- }
141
+ }