react-lgpd-consent 0.4.4 → 0.5.1
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 +72 -0
- package/README.en.md +15 -0
- package/README.md +437 -85
- package/dist/core.cjs +12 -0
- package/dist/core.d.cts +2 -0
- package/dist/core.d.ts +2 -0
- package/dist/core.js +1 -0
- package/dist/index.cjs +6 -1085
- package/dist/index.d.cts +1 -3775
- package/dist/index.d.ts +1 -3775
- package/dist/index.js +1 -930
- package/dist/integrations.cjs +66 -0
- package/dist/integrations.d.cts +1 -0
- package/dist/integrations.d.ts +1 -0
- package/dist/integrations.js +1 -0
- package/dist/mui.cjs +12 -0
- package/dist/mui.d.cts +1 -0
- package/dist/mui.d.ts +1 -0
- package/dist/mui.js +1 -0
- package/package.json +42 -80
- package/dist/FloatingPreferencesButton-4AGBXNHH.cjs +0 -11
- package/dist/FloatingPreferencesButton-IY7TFD7D.js +0 -2
- package/dist/PreferencesModal-5KNHWW57.js +0 -2
- package/dist/PreferencesModal-YBCWCVUI.cjs +0 -11
- package/dist/chunk-25XEI2DZ.cjs +0 -193
- package/dist/chunk-FJKRAERJ.cjs +0 -119
- package/dist/chunk-N3QOW4SA.js +0 -178
- package/dist/chunk-ORI4PLVG.cjs +0 -1899
- package/dist/chunk-PJFGQMCI.js +0 -92
- package/dist/chunk-RWT2ORFE.js +0 -1840
package/dist/chunk-PJFGQMCI.js
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { useConsent, useConsentTexts, useDesignTokens, logger } from './chunk-RWT2ORFE.js';
|
|
2
|
-
import CookieOutlined from '@mui/icons-material/CookieOutlined';
|
|
3
|
-
import Fab from '@mui/material/Fab';
|
|
4
|
-
import Tooltip from '@mui/material/Tooltip';
|
|
5
|
-
import { useTheme } from '@mui/material/styles';
|
|
6
|
-
import * as React from 'react';
|
|
7
|
-
import { jsx } from 'react/jsx-runtime';
|
|
8
|
-
|
|
9
|
-
// react-lgpd-consent - Tree-shakeable ESM build
|
|
10
|
-
function useThemeWithFallbacks() {
|
|
11
|
-
const theme = useTheme();
|
|
12
|
-
logger.themeCompatibility(theme);
|
|
13
|
-
return {
|
|
14
|
-
palette: {
|
|
15
|
-
primary: {
|
|
16
|
-
main: theme?.palette?.primary?.main || "#1976d2",
|
|
17
|
-
dark: theme?.palette?.primary?.dark || "#1565c0"
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
transitions: {
|
|
21
|
-
duration: {
|
|
22
|
-
shortest: theme?.transitions?.duration?.shortest || 150,
|
|
23
|
-
short: theme?.transitions?.duration?.short || 250
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
var FloatingPreferencesButton = React.memo(function FloatingPreferencesButton2({
|
|
29
|
-
position = "bottom-right",
|
|
30
|
-
offset = 24,
|
|
31
|
-
icon = /* @__PURE__ */ jsx(CookieOutlined, {}),
|
|
32
|
-
tooltip,
|
|
33
|
-
FabProps,
|
|
34
|
-
hideWhenConsented = false
|
|
35
|
-
}) {
|
|
36
|
-
const { openPreferences, consented } = useConsent();
|
|
37
|
-
const texts = useConsentTexts();
|
|
38
|
-
const safeTheme = useThemeWithFallbacks();
|
|
39
|
-
const designTokens = useDesignTokens();
|
|
40
|
-
const positionStyles = React.useMemo(() => {
|
|
41
|
-
const styles = {
|
|
42
|
-
position: "fixed",
|
|
43
|
-
zIndex: 1200
|
|
44
|
-
};
|
|
45
|
-
switch (position) {
|
|
46
|
-
case "bottom-left":
|
|
47
|
-
return { ...styles, bottom: offset, left: offset };
|
|
48
|
-
case "bottom-right":
|
|
49
|
-
return { ...styles, bottom: offset, right: offset };
|
|
50
|
-
case "top-left":
|
|
51
|
-
return { ...styles, top: offset, left: offset };
|
|
52
|
-
case "top-right":
|
|
53
|
-
return { ...styles, top: offset, right: offset };
|
|
54
|
-
default:
|
|
55
|
-
return { ...styles, bottom: offset, right: offset };
|
|
56
|
-
}
|
|
57
|
-
}, [position, offset]);
|
|
58
|
-
logger.componentRender("FloatingPreferencesButton", {
|
|
59
|
-
position,
|
|
60
|
-
offset,
|
|
61
|
-
hideWhenConsented,
|
|
62
|
-
consented
|
|
63
|
-
});
|
|
64
|
-
if (hideWhenConsented && consented) {
|
|
65
|
-
logger.debug(
|
|
66
|
-
"FloatingPreferencesButton: Hidden due to hideWhenConsented=true and consented=true"
|
|
67
|
-
);
|
|
68
|
-
return null;
|
|
69
|
-
}
|
|
70
|
-
const tooltipText = tooltip ?? texts.preferencesButton ?? "Gerenciar Prefer\xEAncias de Cookies";
|
|
71
|
-
return /* @__PURE__ */ jsx(Tooltip, { title: tooltipText, placement: "top", children: /* @__PURE__ */ jsx(
|
|
72
|
-
Fab,
|
|
73
|
-
{
|
|
74
|
-
size: "medium",
|
|
75
|
-
color: "primary",
|
|
76
|
-
onClick: openPreferences,
|
|
77
|
-
sx: {
|
|
78
|
-
...positionStyles,
|
|
79
|
-
backgroundColor: designTokens?.colors?.primary ?? safeTheme.palette.primary.main,
|
|
80
|
-
"&:hover": {
|
|
81
|
-
backgroundColor: designTokens?.colors?.primary ? designTokens?.colors?.primary : safeTheme.palette.primary.dark
|
|
82
|
-
},
|
|
83
|
-
transition: `all ${safeTheme.transitions.duration.short}ms`
|
|
84
|
-
},
|
|
85
|
-
"aria-label": tooltipText,
|
|
86
|
-
...FabProps,
|
|
87
|
-
children: icon
|
|
88
|
-
}
|
|
89
|
-
) });
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
export { FloatingPreferencesButton };
|