@c15t/react 0.0.1-rc.3
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.md +595 -0
- package/README.md +55 -0
- package/dist/common/components/consent-manager-provider.cjs +93 -0
- package/dist/common/components/consent-manager-provider.d.ts +16 -0
- package/dist/common/components/consent-manager-provider.d.ts.map +1 -0
- package/dist/common/components/consent-manager-provider.js +59 -0
- package/dist/common/context/consent-manager-context.cjs +38 -0
- package/dist/common/context/consent-manager-context.d.ts +13 -0
- package/dist/common/context/consent-manager-context.d.ts.map +1 -0
- package/dist/common/context/consent-manager-context.js +4 -0
- package/dist/common/hooks/use-consent-manager.cjs +45 -0
- package/dist/common/hooks/use-consent-manager.d.ts +20 -0
- package/dist/common/hooks/use-consent-manager.d.ts.map +1 -0
- package/dist/common/hooks/use-consent-manager.js +11 -0
- package/dist/common/index.cjs +42 -0
- package/dist/common/index.d.ts +7 -0
- package/dist/common/index.d.ts.map +1 -0
- package/dist/common/index.js +9 -0
- package/dist/common/store/use-consent-manager.cjs +47 -0
- package/dist/common/store/use-consent-manager.d.ts +136 -0
- package/dist/common/store/use-consent-manager.d.ts.map +1 -0
- package/dist/common/store/use-consent-manager.js +13 -0
- package/dist/common/store/use-translations.cjs +58 -0
- package/dist/common/store/use-translations.d.ts +29 -0
- package/dist/common/store/use-translations.d.ts.map +1 -0
- package/dist/common/store/use-translations.js +24 -0
- package/dist/common/types/consent-manager.cjs +19 -0
- package/dist/common/types/consent-manager.d.ts +82 -0
- package/dist/common/types/consent-manager.d.ts.map +1 -0
- package/dist/common/types/consent-manager.js +0 -0
- package/dist/common/utils/theme.cjs +47 -0
- package/dist/common/utils/theme.d.ts +8 -0
- package/dist/common/utils/theme.d.ts.map +1 -0
- package/dist/common/utils/theme.js +13 -0
- package/dist/common/utils/translations.cjs +86 -0
- package/dist/common/utils/translations.d.ts +14 -0
- package/dist/common/utils/translations.d.ts.map +1 -0
- package/dist/common/utils/translations.js +50 -0
- package/dist/consent-manager-dialog/__tests__/styles.spec.cjs +218 -0
- package/dist/consent-manager-dialog/__tests__/styles.spec.d.ts +2 -0
- package/dist/consent-manager-dialog/__tests__/styles.spec.d.ts.map +1 -0
- package/dist/consent-manager-dialog/__tests__/styles.spec.js +183 -0
- package/dist/consent-manager-dialog/__tests__/utils.cjs +68 -0
- package/dist/consent-manager-dialog/__tests__/utils.d.ts +13 -0
- package/dist/consent-manager-dialog/__tests__/utils.d.ts.map +1 -0
- package/dist/consent-manager-dialog/__tests__/utils.js +34 -0
- package/dist/consent-manager-dialog/atoms/dialog-card.cjs +139 -0
- package/dist/consent-manager-dialog/atoms/dialog-card.d.ts +90 -0
- package/dist/consent-manager-dialog/atoms/dialog-card.d.ts.map +1 -0
- package/dist/consent-manager-dialog/atoms/dialog-card.js +94 -0
- package/dist/consent-manager-dialog/atoms/overlay.cjs +67 -0
- package/dist/consent-manager-dialog/atoms/overlay.d.ts +71 -0
- package/dist/consent-manager-dialog/atoms/overlay.d.ts.map +1 -0
- package/dist/consent-manager-dialog/atoms/overlay.js +32 -0
- package/dist/consent-manager-dialog/consent-manager-dialog.cjs +129 -0
- package/dist/consent-manager-dialog/consent-manager-dialog.css +75 -0
- package/dist/consent-manager-dialog/consent-manager-dialog.d.ts +44 -0
- package/dist/consent-manager-dialog/consent-manager-dialog.d.ts.map +1 -0
- package/dist/consent-manager-dialog/consent-manager-dialog.js +95 -0
- package/dist/consent-manager-dialog/index.cjs +51 -0
- package/dist/consent-manager-dialog/index.d.ts +4 -0
- package/dist/consent-manager-dialog/index.d.ts.map +1 -0
- package/dist/consent-manager-dialog/index.js +18 -0
- package/dist/consent-manager-dialog/theme.cjs +19 -0
- package/dist/consent-manager-dialog/theme.d.ts +19 -0
- package/dist/consent-manager-dialog/theme.d.ts.map +1 -0
- package/dist/consent-manager-dialog/theme.js +0 -0
- package/dist/consent-manager-widget/__tests__/styles.spec.cjs +228 -0
- package/dist/consent-manager-widget/__tests__/styles.spec.d.ts +2 -0
- package/dist/consent-manager-widget/__tests__/styles.spec.d.ts.map +1 -0
- package/dist/consent-manager-widget/__tests__/styles.spec.js +193 -0
- package/dist/consent-manager-widget/__tests__/utils.cjs +68 -0
- package/dist/consent-manager-widget/__tests__/utils.d.ts +13 -0
- package/dist/consent-manager-widget/__tests__/utils.d.ts.map +1 -0
- package/dist/consent-manager-widget/__tests__/utils.js +34 -0
- package/dist/consent-manager-widget/atoms/accordion.cjs +147 -0
- package/dist/consent-manager-widget/atoms/accordion.d.ts +57 -0
- package/dist/consent-manager-widget/atoms/accordion.d.ts.map +1 -0
- package/dist/consent-manager-widget/atoms/accordion.js +98 -0
- package/dist/consent-manager-widget/atoms/button.cjs +77 -0
- package/dist/consent-manager-widget/atoms/button.d.ts +17 -0
- package/dist/consent-manager-widget/atoms/button.d.ts.map +1 -0
- package/dist/consent-manager-widget/atoms/button.js +38 -0
- package/dist/consent-manager-widget/atoms/footer.cjs +70 -0
- package/dist/consent-manager-widget/atoms/footer.d.ts +22 -0
- package/dist/consent-manager-widget/atoms/footer.d.ts.map +1 -0
- package/dist/consent-manager-widget/atoms/footer.js +34 -0
- package/dist/consent-manager-widget/atoms/logo.cjs +101 -0
- package/dist/consent-manager-widget/atoms/logo.d.ts +8 -0
- package/dist/consent-manager-widget/atoms/logo.d.ts.map +1 -0
- package/dist/consent-manager-widget/atoms/logo.js +67 -0
- package/dist/consent-manager-widget/atoms/root.cjs +64 -0
- package/dist/consent-manager-widget/atoms/root.d.ts +82 -0
- package/dist/consent-manager-widget/atoms/root.d.ts.map +1 -0
- package/dist/consent-manager-widget/atoms/root.js +29 -0
- package/dist/consent-manager-widget/consent-manager-widget.cjs +98 -0
- package/dist/consent-manager-widget/consent-manager-widget.css +79 -0
- package/dist/consent-manager-widget/consent-manager-widget.d.ts +51 -0
- package/dist/consent-manager-widget/consent-manager-widget.d.ts.map +1 -0
- package/dist/consent-manager-widget/consent-manager-widget.js +64 -0
- package/dist/consent-manager-widget/index.cjs +62 -0
- package/dist/consent-manager-widget/index.d.ts +10 -0
- package/dist/consent-manager-widget/index.d.ts.map +1 -0
- package/dist/consent-manager-widget/index.js +29 -0
- package/dist/consent-manager-widget/theme.cjs +19 -0
- package/dist/consent-manager-widget/theme.d.ts +48 -0
- package/dist/consent-manager-widget/theme.d.ts.map +1 -0
- package/dist/consent-manager-widget/theme.js +0 -0
- package/dist/consent-manager-widget/types.cjs +19 -0
- package/dist/consent-manager-widget/types.d.ts +18 -0
- package/dist/consent-manager-widget/types.d.ts.map +1 -0
- package/dist/consent-manager-widget/types.js +0 -0
- package/dist/cookie-banner/__tests__/styles.spec.cjs +234 -0
- package/dist/cookie-banner/__tests__/styles.spec.d.ts +2 -0
- package/dist/cookie-banner/__tests__/styles.spec.d.ts.map +1 -0
- package/dist/cookie-banner/__tests__/styles.spec.js +199 -0
- package/dist/cookie-banner/__tests__/utils.cjs +67 -0
- package/dist/cookie-banner/__tests__/utils.d.ts +13 -0
- package/dist/cookie-banner/__tests__/utils.d.ts.map +1 -0
- package/dist/cookie-banner/__tests__/utils.js +33 -0
- package/dist/cookie-banner/atoms/overlay.cjs +71 -0
- package/dist/cookie-banner/atoms/overlay.d.ts +46 -0
- package/dist/cookie-banner/atoms/overlay.d.ts.map +1 -0
- package/dist/cookie-banner/atoms/overlay.js +36 -0
- package/dist/cookie-banner/atoms/root.cjs +116 -0
- package/dist/cookie-banner/atoms/root.d.ts +79 -0
- package/dist/cookie-banner/atoms/root.d.ts.map +1 -0
- package/dist/cookie-banner/atoms/root.js +81 -0
- package/dist/cookie-banner/components.cjs +160 -0
- package/dist/cookie-banner/components.d.ts +136 -0
- package/dist/cookie-banner/components.d.ts.map +1 -0
- package/dist/cookie-banner/components.js +109 -0
- package/dist/cookie-banner/cookie-banner.cjs +99 -0
- package/dist/cookie-banner/cookie-banner.css +226 -0
- package/dist/cookie-banner/cookie-banner.d.ts +134 -0
- package/dist/cookie-banner/cookie-banner.d.ts.map +1 -0
- package/dist/cookie-banner/cookie-banner.js +65 -0
- package/dist/cookie-banner/error-boundary.cjs +68 -0
- package/dist/cookie-banner/error-boundary.d.ts +56 -0
- package/dist/cookie-banner/error-boundary.d.ts.map +1 -0
- package/dist/cookie-banner/error-boundary.js +34 -0
- package/dist/cookie-banner/index.cjs +59 -0
- package/dist/cookie-banner/index.d.ts +52 -0
- package/dist/cookie-banner/index.d.ts.map +1 -0
- package/dist/cookie-banner/index.js +26 -0
- package/dist/cookie-banner/theme.cjs +19 -0
- package/dist/cookie-banner/theme.d.ts +30 -0
- package/dist/cookie-banner/theme.d.ts.map +1 -0
- package/dist/cookie-banner/theme.js +0 -0
- package/dist/index.cjs +89 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/primitives/box.cjs +54 -0
- package/dist/primitives/box.d.ts +47 -0
- package/dist/primitives/box.d.ts.map +1 -0
- package/dist/primitives/box.js +20 -0
- package/dist/primitives/button.cjs +93 -0
- package/dist/primitives/button.d.ts +207 -0
- package/dist/primitives/button.d.ts.map +1 -0
- package/dist/primitives/button.js +59 -0
- package/dist/primitives/button.types.cjs +19 -0
- package/dist/primitives/button.types.d.ts +34 -0
- package/dist/primitives/button.types.d.ts.map +1 -0
- package/dist/primitives/button.types.js +0 -0
- package/dist/theme/context.cjs +44 -0
- package/dist/theme/context.d.ts +96 -0
- package/dist/theme/context.d.ts.map +1 -0
- package/dist/theme/context.js +9 -0
- package/dist/theme/index.cjs +39 -0
- package/dist/theme/index.d.ts +6 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +6 -0
- package/dist/theme/style-keys.cjs +39 -0
- package/dist/theme/style-keys.d.ts +77 -0
- package/dist/theme/style-keys.d.ts.map +1 -0
- package/dist/theme/style-keys.js +5 -0
- package/dist/theme/use-style.cjs +95 -0
- package/dist/theme/use-style.d.ts +32 -0
- package/dist/theme/use-style.d.ts.map +1 -0
- package/dist/theme/use-style.js +61 -0
- package/dist/theme/utils/merge-styles.cjs +62 -0
- package/dist/theme/utils/merge-styles.d.ts +3 -0
- package/dist/theme/utils/merge-styles.d.ts.map +1 -0
- package/dist/theme/utils/merge-styles.js +28 -0
- package/dist/ui/components/accordion.cjs +204 -0
- package/dist/ui/components/accordion.css +158 -0
- package/dist/ui/components/accordion.d.ts +45 -0
- package/dist/ui/components/accordion.d.ts.map +1 -0
- package/dist/ui/components/accordion.js +164 -0
- package/dist/ui/components/button.cjs +185 -0
- package/dist/ui/components/button.css +303 -0
- package/dist/ui/components/button.d.ts +445 -0
- package/dist/ui/components/button.d.ts.map +1 -0
- package/dist/ui/components/button.js +149 -0
- package/dist/ui/components/card.cjs +80 -0
- package/dist/ui/components/card.css +55 -0
- package/dist/ui/components/card.d.ts +10 -0
- package/dist/ui/components/card.d.ts.map +1 -0
- package/dist/ui/components/card.js +41 -0
- package/dist/ui/components/icon.cjs +57 -0
- package/dist/ui/components/icon.d.ts +8 -0
- package/dist/ui/components/icon.d.ts.map +1 -0
- package/dist/ui/components/icon.js +23 -0
- package/dist/ui/components/logo.cjs +101 -0
- package/dist/ui/components/logo.d.ts +8 -0
- package/dist/ui/components/logo.d.ts.map +1 -0
- package/dist/ui/components/logo.js +67 -0
- package/dist/ui/components/switch.cjs +81 -0
- package/dist/ui/components/switch.css +135 -0
- package/dist/ui/components/switch.d.ts +25 -0
- package/dist/ui/components/switch.d.ts.map +1 -0
- package/dist/ui/components/switch.js +47 -0
- package/dist/ui/libs/cn.cjs +55 -0
- package/dist/ui/libs/cn.d.ts +11 -0
- package/dist/ui/libs/cn.d.ts.map +1 -0
- package/dist/ui/libs/cn.js +6 -0
- package/dist/ui/libs/polymorphic.cjs +19 -0
- package/dist/ui/libs/polymorphic.d.ts +15 -0
- package/dist/ui/libs/polymorphic.d.ts.map +1 -0
- package/dist/ui/libs/polymorphic.js +0 -0
- package/dist/ui/libs/recursive-clone-children.cjs +49 -0
- package/dist/ui/libs/recursive-clone-children.d.ts +14 -0
- package/dist/ui/libs/recursive-clone-children.d.ts.map +1 -0
- package/dist/ui/libs/recursive-clone-children.js +15 -0
- package/dist/ui/theme/context.cjs +6 -0
- package/dist/ui/theme/context.d.ts +2 -0
- package/dist/ui/theme/context.d.ts.map +1 -0
- package/dist/ui/theme/context.js +0 -0
- package/package.json +71 -0
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = function(module) {
|
|
5
|
+
var getter = module && module.__esModule ? function() {
|
|
6
|
+
return module['default'];
|
|
7
|
+
} : function() {
|
|
8
|
+
return module;
|
|
9
|
+
};
|
|
10
|
+
__webpack_require__.d(getter, {
|
|
11
|
+
a: getter
|
|
12
|
+
});
|
|
13
|
+
return getter;
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
(()=>{
|
|
17
|
+
__webpack_require__.d = function(exports1, definition) {
|
|
18
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: definition[key]
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
(()=>{
|
|
25
|
+
__webpack_require__.o = function(obj, prop) {
|
|
26
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
27
|
+
};
|
|
28
|
+
})();
|
|
29
|
+
var __webpack_exports__ = {};
|
|
30
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
31
|
+
const external_vitest_namespaceObject = require("vitest");
|
|
32
|
+
const external_index_cjs_namespaceObject = require("../../index.cjs");
|
|
33
|
+
const external_utils_cjs_namespaceObject = require("./utils.cjs");
|
|
34
|
+
var external_utils_cjs_default = /*#__PURE__*/ __webpack_require__.n(external_utils_cjs_namespaceObject);
|
|
35
|
+
const ALL_COMPONENTS = [
|
|
36
|
+
{
|
|
37
|
+
testId: 'consent-manager-widget-root',
|
|
38
|
+
themeKey: 'consent-manager-widget.root',
|
|
39
|
+
styles: 'custom-root'
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
testId: 'consent-manager-widget-footer',
|
|
43
|
+
themeKey: 'consent-manager-widget.footer',
|
|
44
|
+
styles: 'custom-footer'
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
testId: 'consent-manager-widget-footer-sub-group',
|
|
48
|
+
themeKey: 'consent-manager-widget.footer.sub-group',
|
|
49
|
+
styles: 'custom-footer-sub-group'
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
testId: 'consent-manager-widget-reject-button',
|
|
53
|
+
themeKey: 'consent-manager-widget.footer.reject-button',
|
|
54
|
+
styles: 'custom-reject-button'
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
testId: 'consent-manager-widget-footer-accept-button',
|
|
58
|
+
themeKey: 'consent-manager-widget.footer.accept-button',
|
|
59
|
+
styles: 'custom-accept-button'
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
testId: 'consent-manager-widget-footer-save-button',
|
|
63
|
+
themeKey: 'consent-manager-widget.footer.save-button',
|
|
64
|
+
styles: 'custom-save-button'
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
testId: 'consent-manager-widget-accordion-trigger-marketing',
|
|
68
|
+
themeKey: 'consent-manager-widget.accordion.trigger',
|
|
69
|
+
styles: 'custom-accordion-trigger'
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
testId: 'consent-manager-widget-accordion-trigger-inner-marketing',
|
|
73
|
+
themeKey: 'consent-manager-widget.accordion.trigger-inner',
|
|
74
|
+
styles: 'custom-accordion-trigger-inner'
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
testId: 'consent-manager-widget-accordion-content-marketing',
|
|
78
|
+
themeKey: 'consent-manager-widget.accordion.content',
|
|
79
|
+
styles: 'custom-accordion-content'
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
testId: 'consent-manager-widget-switch-marketing',
|
|
83
|
+
themeKey: 'consent-manager-widget.switch',
|
|
84
|
+
styles: 'custom-switch'
|
|
85
|
+
}
|
|
86
|
+
];
|
|
87
|
+
(0, external_vitest_namespaceObject.test)('Theme prop applies string classnames to all components', async ()=>{
|
|
88
|
+
const test = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_cjs_namespaceObject.ConsentManagerWidget, {
|
|
89
|
+
theme: ALL_COMPONENTS.reduce((acc, { themeKey, styles })=>{
|
|
90
|
+
acc[themeKey] = styles;
|
|
91
|
+
return acc;
|
|
92
|
+
}, {})
|
|
93
|
+
});
|
|
94
|
+
await external_utils_cjs_default()({
|
|
95
|
+
component: test,
|
|
96
|
+
testCases: ALL_COMPONENTS.map(({ testId, styles })=>({
|
|
97
|
+
testId,
|
|
98
|
+
styles
|
|
99
|
+
}))
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
(0, external_vitest_namespaceObject.test)('Theme prop supports object format with className and style for all components', async ()=>{
|
|
103
|
+
const style = {
|
|
104
|
+
backgroundColor: '#ffffff',
|
|
105
|
+
padding: '20px',
|
|
106
|
+
border: '1px solid #000000'
|
|
107
|
+
};
|
|
108
|
+
const testCases = ALL_COMPONENTS.map(({ testId, themeKey, styles })=>({
|
|
109
|
+
testId,
|
|
110
|
+
themeKey,
|
|
111
|
+
className: styles,
|
|
112
|
+
style
|
|
113
|
+
}));
|
|
114
|
+
const test = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_cjs_namespaceObject.ConsentManagerWidget, {
|
|
115
|
+
theme: testCases.reduce((acc, { themeKey, className, style })=>{
|
|
116
|
+
acc[themeKey] = {
|
|
117
|
+
className,
|
|
118
|
+
style
|
|
119
|
+
};
|
|
120
|
+
return acc;
|
|
121
|
+
}, {})
|
|
122
|
+
});
|
|
123
|
+
await external_utils_cjs_default()({
|
|
124
|
+
component: test,
|
|
125
|
+
testCases: testCases.map(({ testId, className, style })=>({
|
|
126
|
+
testId,
|
|
127
|
+
styles: {
|
|
128
|
+
className,
|
|
129
|
+
style
|
|
130
|
+
}
|
|
131
|
+
}))
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
(0, external_vitest_namespaceObject.test)('No style prop removes default styles but keeps custom classNames', async ()=>{
|
|
135
|
+
const test = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_cjs_namespaceObject.ConsentManagerWidget, {
|
|
136
|
+
noStyle: true,
|
|
137
|
+
theme: ALL_COMPONENTS.reduce((acc, { themeKey, styles })=>{
|
|
138
|
+
acc[themeKey] = styles;
|
|
139
|
+
return acc;
|
|
140
|
+
}, {})
|
|
141
|
+
});
|
|
142
|
+
await external_utils_cjs_default()({
|
|
143
|
+
component: test,
|
|
144
|
+
testCases: ALL_COMPONENTS.map(({ testId, styles })=>({
|
|
145
|
+
testId,
|
|
146
|
+
styles
|
|
147
|
+
})),
|
|
148
|
+
noStyle: true
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
(0, external_vitest_namespaceObject.test)('Theme prop handles mixed format (string and object) correctly', async ()=>{
|
|
152
|
+
const mixedTheme = {
|
|
153
|
+
'consent-manager-widget.root': {
|
|
154
|
+
className: 'custom-root',
|
|
155
|
+
style: {
|
|
156
|
+
backgroundColor: 'rgb(255, 255, 255)',
|
|
157
|
+
padding: '16px'
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
'consent-manager-widget.accordion.trigger': 'custom-accordion-trigger'
|
|
161
|
+
};
|
|
162
|
+
const test = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_cjs_namespaceObject.ConsentManagerWidget, {
|
|
163
|
+
theme: mixedTheme
|
|
164
|
+
});
|
|
165
|
+
await external_utils_cjs_default()({
|
|
166
|
+
component: test,
|
|
167
|
+
testCases: [
|
|
168
|
+
{
|
|
169
|
+
testId: 'consent-manager-widget-root',
|
|
170
|
+
styles: {
|
|
171
|
+
className: 'custom-root',
|
|
172
|
+
style: {
|
|
173
|
+
backgroundColor: 'rgb(255, 255, 255)',
|
|
174
|
+
padding: '16px'
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
testId: 'consent-manager-widget-accordion-trigger-marketing',
|
|
180
|
+
styles: 'custom-accordion-trigger'
|
|
181
|
+
}
|
|
182
|
+
]
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
(0, external_vitest_namespaceObject.test)('Theme prop handles edge cases gracefully', async ()=>{
|
|
186
|
+
const edgeCaseTheme = {
|
|
187
|
+
'consent-manager-widget.root': '',
|
|
188
|
+
'consent-manager-widget.accordion': '',
|
|
189
|
+
'consent-manager-widget.footer': {
|
|
190
|
+
className: '',
|
|
191
|
+
style: {
|
|
192
|
+
margin: '0',
|
|
193
|
+
padding: '0'
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
const test = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_cjs_namespaceObject.ConsentManagerWidget, {
|
|
198
|
+
theme: edgeCaseTheme
|
|
199
|
+
});
|
|
200
|
+
await external_utils_cjs_default()({
|
|
201
|
+
component: test,
|
|
202
|
+
testCases: [
|
|
203
|
+
{
|
|
204
|
+
testId: 'consent-manager-widget-root',
|
|
205
|
+
styles: ''
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
testId: 'consent-manager-widget-accordion',
|
|
209
|
+
styles: ''
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
testId: 'consent-manager-widget-footer',
|
|
213
|
+
styles: {
|
|
214
|
+
className: '',
|
|
215
|
+
style: {
|
|
216
|
+
margin: '0',
|
|
217
|
+
padding: '0'
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
]
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
var __webpack_export_target__ = exports;
|
|
225
|
+
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
226
|
+
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
|
|
227
|
+
value: true
|
|
228
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.spec.d.ts","sourceRoot":"","sources":["../../../src/consent-manager-widget/__tests__/styles.spec.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_vitest__ from "vitest";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE__index_js_cbfda0f6__ from "../../index.js";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__ from "./utils.js";
|
|
5
|
+
const ALL_COMPONENTS = [
|
|
6
|
+
{
|
|
7
|
+
testId: 'consent-manager-widget-root',
|
|
8
|
+
themeKey: 'consent-manager-widget.root',
|
|
9
|
+
styles: 'custom-root'
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
testId: 'consent-manager-widget-footer',
|
|
13
|
+
themeKey: 'consent-manager-widget.footer',
|
|
14
|
+
styles: 'custom-footer'
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
testId: 'consent-manager-widget-footer-sub-group',
|
|
18
|
+
themeKey: 'consent-manager-widget.footer.sub-group',
|
|
19
|
+
styles: 'custom-footer-sub-group'
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
testId: 'consent-manager-widget-reject-button',
|
|
23
|
+
themeKey: 'consent-manager-widget.footer.reject-button',
|
|
24
|
+
styles: 'custom-reject-button'
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
testId: 'consent-manager-widget-footer-accept-button',
|
|
28
|
+
themeKey: 'consent-manager-widget.footer.accept-button',
|
|
29
|
+
styles: 'custom-accept-button'
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
testId: 'consent-manager-widget-footer-save-button',
|
|
33
|
+
themeKey: 'consent-manager-widget.footer.save-button',
|
|
34
|
+
styles: 'custom-save-button'
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
testId: 'consent-manager-widget-accordion-trigger-marketing',
|
|
38
|
+
themeKey: 'consent-manager-widget.accordion.trigger',
|
|
39
|
+
styles: 'custom-accordion-trigger'
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
testId: 'consent-manager-widget-accordion-trigger-inner-marketing',
|
|
43
|
+
themeKey: 'consent-manager-widget.accordion.trigger-inner',
|
|
44
|
+
styles: 'custom-accordion-trigger-inner'
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
testId: 'consent-manager-widget-accordion-content-marketing',
|
|
48
|
+
themeKey: 'consent-manager-widget.accordion.content',
|
|
49
|
+
styles: 'custom-accordion-content'
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
testId: 'consent-manager-widget-switch-marketing',
|
|
53
|
+
themeKey: 'consent-manager-widget.switch',
|
|
54
|
+
styles: 'custom-switch'
|
|
55
|
+
}
|
|
56
|
+
];
|
|
57
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vitest__.test)('Theme prop applies string classnames to all components', async ()=>{
|
|
58
|
+
const test = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__index_js_cbfda0f6__.ConsentManagerWidget, {
|
|
59
|
+
theme: ALL_COMPONENTS.reduce((acc, { themeKey, styles })=>{
|
|
60
|
+
acc[themeKey] = styles;
|
|
61
|
+
return acc;
|
|
62
|
+
}, {})
|
|
63
|
+
});
|
|
64
|
+
await (0, __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__["default"])({
|
|
65
|
+
component: test,
|
|
66
|
+
testCases: ALL_COMPONENTS.map(({ testId, styles })=>({
|
|
67
|
+
testId,
|
|
68
|
+
styles
|
|
69
|
+
}))
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vitest__.test)('Theme prop supports object format with className and style for all components', async ()=>{
|
|
73
|
+
const style = {
|
|
74
|
+
backgroundColor: '#ffffff',
|
|
75
|
+
padding: '20px',
|
|
76
|
+
border: '1px solid #000000'
|
|
77
|
+
};
|
|
78
|
+
const testCases = ALL_COMPONENTS.map(({ testId, themeKey, styles })=>({
|
|
79
|
+
testId,
|
|
80
|
+
themeKey,
|
|
81
|
+
className: styles,
|
|
82
|
+
style
|
|
83
|
+
}));
|
|
84
|
+
const test = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__index_js_cbfda0f6__.ConsentManagerWidget, {
|
|
85
|
+
theme: testCases.reduce((acc, { themeKey, className, style })=>{
|
|
86
|
+
acc[themeKey] = {
|
|
87
|
+
className,
|
|
88
|
+
style
|
|
89
|
+
};
|
|
90
|
+
return acc;
|
|
91
|
+
}, {})
|
|
92
|
+
});
|
|
93
|
+
await (0, __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__["default"])({
|
|
94
|
+
component: test,
|
|
95
|
+
testCases: testCases.map(({ testId, className, style })=>({
|
|
96
|
+
testId,
|
|
97
|
+
styles: {
|
|
98
|
+
className,
|
|
99
|
+
style
|
|
100
|
+
}
|
|
101
|
+
}))
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vitest__.test)('No style prop removes default styles but keeps custom classNames', async ()=>{
|
|
105
|
+
const test = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__index_js_cbfda0f6__.ConsentManagerWidget, {
|
|
106
|
+
noStyle: true,
|
|
107
|
+
theme: ALL_COMPONENTS.reduce((acc, { themeKey, styles })=>{
|
|
108
|
+
acc[themeKey] = styles;
|
|
109
|
+
return acc;
|
|
110
|
+
}, {})
|
|
111
|
+
});
|
|
112
|
+
await (0, __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__["default"])({
|
|
113
|
+
component: test,
|
|
114
|
+
testCases: ALL_COMPONENTS.map(({ testId, styles })=>({
|
|
115
|
+
testId,
|
|
116
|
+
styles
|
|
117
|
+
})),
|
|
118
|
+
noStyle: true
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vitest__.test)('Theme prop handles mixed format (string and object) correctly', async ()=>{
|
|
122
|
+
const mixedTheme = {
|
|
123
|
+
'consent-manager-widget.root': {
|
|
124
|
+
className: 'custom-root',
|
|
125
|
+
style: {
|
|
126
|
+
backgroundColor: 'rgb(255, 255, 255)',
|
|
127
|
+
padding: '16px'
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
'consent-manager-widget.accordion.trigger': 'custom-accordion-trigger'
|
|
131
|
+
};
|
|
132
|
+
const test = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__index_js_cbfda0f6__.ConsentManagerWidget, {
|
|
133
|
+
theme: mixedTheme
|
|
134
|
+
});
|
|
135
|
+
await (0, __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__["default"])({
|
|
136
|
+
component: test,
|
|
137
|
+
testCases: [
|
|
138
|
+
{
|
|
139
|
+
testId: 'consent-manager-widget-root',
|
|
140
|
+
styles: {
|
|
141
|
+
className: 'custom-root',
|
|
142
|
+
style: {
|
|
143
|
+
backgroundColor: 'rgb(255, 255, 255)',
|
|
144
|
+
padding: '16px'
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
testId: 'consent-manager-widget-accordion-trigger-marketing',
|
|
150
|
+
styles: 'custom-accordion-trigger'
|
|
151
|
+
}
|
|
152
|
+
]
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vitest__.test)('Theme prop handles edge cases gracefully', async ()=>{
|
|
156
|
+
const edgeCaseTheme = {
|
|
157
|
+
'consent-manager-widget.root': '',
|
|
158
|
+
'consent-manager-widget.accordion': '',
|
|
159
|
+
'consent-manager-widget.footer': {
|
|
160
|
+
className: '',
|
|
161
|
+
style: {
|
|
162
|
+
margin: '0',
|
|
163
|
+
padding: '0'
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
const test = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__index_js_cbfda0f6__.ConsentManagerWidget, {
|
|
168
|
+
theme: edgeCaseTheme
|
|
169
|
+
});
|
|
170
|
+
await (0, __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__["default"])({
|
|
171
|
+
component: test,
|
|
172
|
+
testCases: [
|
|
173
|
+
{
|
|
174
|
+
testId: 'consent-manager-widget-root',
|
|
175
|
+
styles: ''
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
testId: 'consent-manager-widget-accordion',
|
|
179
|
+
styles: ''
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
testId: 'consent-manager-widget-footer',
|
|
183
|
+
styles: {
|
|
184
|
+
className: '',
|
|
185
|
+
style: {
|
|
186
|
+
margin: '0',
|
|
187
|
+
padding: '0'
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
]
|
|
192
|
+
});
|
|
193
|
+
});
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = function(exports1, definition) {
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = function(obj, prop) {
|
|
13
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
(()=>{
|
|
17
|
+
__webpack_require__.r = function(exports1) {
|
|
18
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
19
|
+
value: 'Module'
|
|
20
|
+
});
|
|
21
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
22
|
+
value: true
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
})();
|
|
26
|
+
var __webpack_exports__ = {};
|
|
27
|
+
__webpack_require__.r(__webpack_exports__);
|
|
28
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
29
|
+
default: ()=>utils_rslib_entry_
|
|
30
|
+
});
|
|
31
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
32
|
+
const external_vitest_namespaceObject = require("vitest");
|
|
33
|
+
const external_vitest_browser_react_namespaceObject = require("vitest-browser-react");
|
|
34
|
+
const external_index_cjs_namespaceObject = require("../../index.cjs");
|
|
35
|
+
async function testComponentStyles({ component, testCases, noStyle = false }) {
|
|
36
|
+
const { getByTestId } = (0, external_vitest_browser_react_namespaceObject.render)(/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_cjs_namespaceObject.ConsentManagerProvider, {
|
|
37
|
+
noStyle: noStyle,
|
|
38
|
+
children: component
|
|
39
|
+
}));
|
|
40
|
+
for (const { testId, styles } of testCases){
|
|
41
|
+
const element = getByTestId(testId);
|
|
42
|
+
if ('string' == typeof styles || styles?.className) {
|
|
43
|
+
const classNames = 'string' == typeof styles ? styles : styles?.className;
|
|
44
|
+
if (classNames) await external_vitest_namespaceObject.expect.element(element).toHaveClass(classNames, {
|
|
45
|
+
exact: noStyle
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
if ('object' == typeof styles && styles?.style) {
|
|
49
|
+
const styleEntries = Object.entries(styles.style).map(([key, value])=>{
|
|
50
|
+
const cssKey = key.replace(/([A-Z])/g, '-$1').toLowerCase();
|
|
51
|
+
return [
|
|
52
|
+
cssKey,
|
|
53
|
+
value
|
|
54
|
+
];
|
|
55
|
+
});
|
|
56
|
+
await new Promise((resolve)=>setTimeout(resolve, 100));
|
|
57
|
+
for (const [property, value] of styleEntries)await external_vitest_namespaceObject.expect.element(element).toHaveStyle({
|
|
58
|
+
[property]: value
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const utils_rslib_entry_ = testComponentStyles;
|
|
64
|
+
var __webpack_export_target__ = exports;
|
|
65
|
+
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
66
|
+
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
|
|
67
|
+
value: true
|
|
68
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ThemeValue } from '../../theme/types/style-types';
|
|
3
|
+
interface ComponentStyles {
|
|
4
|
+
component: ReactNode;
|
|
5
|
+
testCases: {
|
|
6
|
+
testId: string;
|
|
7
|
+
styles: string | ThemeValue;
|
|
8
|
+
}[];
|
|
9
|
+
noStyle?: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare function testComponentStyles({ component, testCases, noStyle, }: ComponentStyles): Promise<void>;
|
|
12
|
+
export default testComponentStyles;
|
|
13
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/consent-manager-widget/__tests__/utils.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEhE,UAAU,eAAe;IACxB,SAAS,EAAE,SAAS,CAAC;IACrB,SAAS,EAAE;QACV,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,GAAG,UAAU,CAAC;KAC5B,EAAE,CAAC;IACJ,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,iBAAe,mBAAmB,CAAC,EAClC,SAAS,EACT,SAAS,EACT,OAAe,GACf,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAyCjC;AAED,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_vitest__ from "vitest";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE_vitest_browser_react_6a851916__ from "vitest-browser-react";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE__index_js_cbfda0f6__ from "../../index.js";
|
|
5
|
+
async function testComponentStyles({ component, testCases, noStyle = false }) {
|
|
6
|
+
const { getByTestId } = (0, __WEBPACK_EXTERNAL_MODULE_vitest_browser_react_6a851916__.render)(/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__index_js_cbfda0f6__.ConsentManagerProvider, {
|
|
7
|
+
noStyle: noStyle,
|
|
8
|
+
children: component
|
|
9
|
+
}));
|
|
10
|
+
for (const { testId, styles } of testCases){
|
|
11
|
+
const element = getByTestId(testId);
|
|
12
|
+
if ('string' == typeof styles || styles?.className) {
|
|
13
|
+
const classNames = 'string' == typeof styles ? styles : styles?.className;
|
|
14
|
+
if (classNames) await __WEBPACK_EXTERNAL_MODULE_vitest__.expect.element(element).toHaveClass(classNames, {
|
|
15
|
+
exact: noStyle
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
if ('object' == typeof styles && styles?.style) {
|
|
19
|
+
const styleEntries = Object.entries(styles.style).map(([key, value])=>{
|
|
20
|
+
const cssKey = key.replace(/([A-Z])/g, '-$1').toLowerCase();
|
|
21
|
+
return [
|
|
22
|
+
cssKey,
|
|
23
|
+
value
|
|
24
|
+
];
|
|
25
|
+
});
|
|
26
|
+
await new Promise((resolve)=>setTimeout(resolve, 100));
|
|
27
|
+
for (const [property, value] of styleEntries)await __WEBPACK_EXTERNAL_MODULE_vitest__.expect.element(element).toHaveStyle({
|
|
28
|
+
[property]: value
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const utils_rslib_entry_ = testComponentStyles;
|
|
34
|
+
export { utils_rslib_entry_ as default };
|