@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,207 @@
|
|
|
1
|
+
import type { VariantProps } from 'tailwind-variants';
|
|
2
|
+
import type { ConsentButtonProps } from './button.types';
|
|
3
|
+
/**
|
|
4
|
+
* Button component that allows users to reject non-essential cookies.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* When clicked, this button saves only necessary cookie consents and closes the banner.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* <CookieBannerRejectButton>
|
|
12
|
+
* Reject All Cookies
|
|
13
|
+
* </CookieBannerRejectButton>
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
export declare const ConsentButton: import("react").ForwardRefExoticComponent<ConsentButtonProps & VariantProps<import("tailwind-variants").TVReturnType<{
|
|
19
|
+
variant: {
|
|
20
|
+
primary: {};
|
|
21
|
+
neutral: {};
|
|
22
|
+
};
|
|
23
|
+
mode: {
|
|
24
|
+
filled: {};
|
|
25
|
+
stroke: {};
|
|
26
|
+
lighter: {};
|
|
27
|
+
ghost: {};
|
|
28
|
+
};
|
|
29
|
+
size: {
|
|
30
|
+
medium: {
|
|
31
|
+
root: string;
|
|
32
|
+
};
|
|
33
|
+
small: {
|
|
34
|
+
root: string;
|
|
35
|
+
};
|
|
36
|
+
xsmall: {
|
|
37
|
+
root: string;
|
|
38
|
+
};
|
|
39
|
+
xxsmall: {
|
|
40
|
+
root: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
}, {
|
|
44
|
+
root: string[];
|
|
45
|
+
icon: string[];
|
|
46
|
+
}, undefined, import("tailwind-variants/dist/config").TVConfig<{
|
|
47
|
+
variant: {
|
|
48
|
+
primary: {};
|
|
49
|
+
neutral: {};
|
|
50
|
+
};
|
|
51
|
+
mode: {
|
|
52
|
+
filled: {};
|
|
53
|
+
stroke: {};
|
|
54
|
+
lighter: {};
|
|
55
|
+
ghost: {};
|
|
56
|
+
};
|
|
57
|
+
size: {
|
|
58
|
+
medium: {
|
|
59
|
+
root: string;
|
|
60
|
+
};
|
|
61
|
+
small: {
|
|
62
|
+
root: string;
|
|
63
|
+
};
|
|
64
|
+
xsmall: {
|
|
65
|
+
root: string;
|
|
66
|
+
};
|
|
67
|
+
xxsmall: {
|
|
68
|
+
root: string;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
}, {
|
|
72
|
+
variant: {
|
|
73
|
+
primary: {};
|
|
74
|
+
neutral: {};
|
|
75
|
+
};
|
|
76
|
+
mode: {
|
|
77
|
+
filled: {};
|
|
78
|
+
stroke: {};
|
|
79
|
+
lighter: {};
|
|
80
|
+
ghost: {};
|
|
81
|
+
};
|
|
82
|
+
size: {
|
|
83
|
+
medium: {
|
|
84
|
+
root: string;
|
|
85
|
+
};
|
|
86
|
+
small: {
|
|
87
|
+
root: string;
|
|
88
|
+
};
|
|
89
|
+
xsmall: {
|
|
90
|
+
root: string;
|
|
91
|
+
};
|
|
92
|
+
xxsmall: {
|
|
93
|
+
root: string;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
}>, {
|
|
97
|
+
variant: {
|
|
98
|
+
primary: {};
|
|
99
|
+
neutral: {};
|
|
100
|
+
};
|
|
101
|
+
mode: {
|
|
102
|
+
filled: {};
|
|
103
|
+
stroke: {};
|
|
104
|
+
lighter: {};
|
|
105
|
+
ghost: {};
|
|
106
|
+
};
|
|
107
|
+
size: {
|
|
108
|
+
medium: {
|
|
109
|
+
root: string;
|
|
110
|
+
};
|
|
111
|
+
small: {
|
|
112
|
+
root: string;
|
|
113
|
+
};
|
|
114
|
+
xsmall: {
|
|
115
|
+
root: string;
|
|
116
|
+
};
|
|
117
|
+
xxsmall: {
|
|
118
|
+
root: string;
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
}, {
|
|
122
|
+
root: string[];
|
|
123
|
+
icon: string[];
|
|
124
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
125
|
+
variant: {
|
|
126
|
+
primary: {};
|
|
127
|
+
neutral: {};
|
|
128
|
+
};
|
|
129
|
+
mode: {
|
|
130
|
+
filled: {};
|
|
131
|
+
stroke: {};
|
|
132
|
+
lighter: {};
|
|
133
|
+
ghost: {};
|
|
134
|
+
};
|
|
135
|
+
size: {
|
|
136
|
+
medium: {
|
|
137
|
+
root: string;
|
|
138
|
+
};
|
|
139
|
+
small: {
|
|
140
|
+
root: string;
|
|
141
|
+
};
|
|
142
|
+
xsmall: {
|
|
143
|
+
root: string;
|
|
144
|
+
};
|
|
145
|
+
xxsmall: {
|
|
146
|
+
root: string;
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
}, {
|
|
150
|
+
root: string[];
|
|
151
|
+
icon: string[];
|
|
152
|
+
}, undefined, import("tailwind-variants/dist/config").TVConfig<{
|
|
153
|
+
variant: {
|
|
154
|
+
primary: {};
|
|
155
|
+
neutral: {};
|
|
156
|
+
};
|
|
157
|
+
mode: {
|
|
158
|
+
filled: {};
|
|
159
|
+
stroke: {};
|
|
160
|
+
lighter: {};
|
|
161
|
+
ghost: {};
|
|
162
|
+
};
|
|
163
|
+
size: {
|
|
164
|
+
medium: {
|
|
165
|
+
root: string;
|
|
166
|
+
};
|
|
167
|
+
small: {
|
|
168
|
+
root: string;
|
|
169
|
+
};
|
|
170
|
+
xsmall: {
|
|
171
|
+
root: string;
|
|
172
|
+
};
|
|
173
|
+
xxsmall: {
|
|
174
|
+
root: string;
|
|
175
|
+
};
|
|
176
|
+
};
|
|
177
|
+
}, {
|
|
178
|
+
variant: {
|
|
179
|
+
primary: {};
|
|
180
|
+
neutral: {};
|
|
181
|
+
};
|
|
182
|
+
mode: {
|
|
183
|
+
filled: {};
|
|
184
|
+
stroke: {};
|
|
185
|
+
lighter: {};
|
|
186
|
+
ghost: {};
|
|
187
|
+
};
|
|
188
|
+
size: {
|
|
189
|
+
medium: {
|
|
190
|
+
root: string;
|
|
191
|
+
};
|
|
192
|
+
small: {
|
|
193
|
+
root: string;
|
|
194
|
+
};
|
|
195
|
+
xsmall: {
|
|
196
|
+
root: string;
|
|
197
|
+
};
|
|
198
|
+
xxsmall: {
|
|
199
|
+
root: string;
|
|
200
|
+
};
|
|
201
|
+
};
|
|
202
|
+
}>, unknown, unknown, undefined>>> & {
|
|
203
|
+
action: "accept-consent" | "reject-consent" | "custom-consent" | "open-consent-dialog";
|
|
204
|
+
closeCustomizeDialog?: boolean;
|
|
205
|
+
closeCookieBanner?: boolean;
|
|
206
|
+
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
207
|
+
//# sourceMappingURL=button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/primitives/button.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,KAAK,EAAwB,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAE/E;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAKpB,gBAAgB,GAChB,gBAAgB,GAChB,gBAAgB,GAChB,qBAAqB;2BACD,OAAO;wBACV,OAAO;qDAqF7B,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE__radix_ui_react_slot_85c2da36__ from "@radix-ui/react-slot";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE__ui_components_button_js_471e9fd6__ from "../ui/components/button.js";
|
|
5
|
+
import * as __WEBPACK_EXTERNAL_MODULE__theme_index_js_46d040bc__ from "../theme/index.js";
|
|
6
|
+
const ConsentButton = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.forwardRef)(({ asChild, className: forwardedClassName, style, noStyle, action, themeKey, baseClassName, variant = 'neutral', mode = 'stroke', size = 'small', onClick: forwardedOnClick, closeCookieBanner = false, closeCustomizeDialog = false, ...props }, ref)=>{
|
|
7
|
+
const { saveConsents, setShowPopup, setIsPrivacyDialogOpen, noStyle: contextNoStyle } = (0, __WEBPACK_EXTERNAL_MODULE__theme_index_js_46d040bc__.useThemeContext)();
|
|
8
|
+
const buttonStyle = (0, __WEBPACK_EXTERNAL_MODULE__theme_index_js_46d040bc__.useStyles)(themeKey ?? 'button', {
|
|
9
|
+
baseClassName: [
|
|
10
|
+
!(contextNoStyle || noStyle) && __WEBPACK_EXTERNAL_MODULE__ui_components_button_js_471e9fd6__.buttonVariants({
|
|
11
|
+
variant,
|
|
12
|
+
mode,
|
|
13
|
+
size
|
|
14
|
+
}).root()
|
|
15
|
+
],
|
|
16
|
+
style,
|
|
17
|
+
className: forwardedClassName,
|
|
18
|
+
noStyle: noStyle
|
|
19
|
+
});
|
|
20
|
+
const buttonClick = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)(()=>{
|
|
21
|
+
switch(action){
|
|
22
|
+
case 'accept-consent':
|
|
23
|
+
saveConsents('all');
|
|
24
|
+
break;
|
|
25
|
+
case 'reject-consent':
|
|
26
|
+
saveConsents('necessary');
|
|
27
|
+
break;
|
|
28
|
+
case 'custom-consent':
|
|
29
|
+
saveConsents('custom');
|
|
30
|
+
break;
|
|
31
|
+
case 'open-consent-dialog':
|
|
32
|
+
setIsPrivacyDialogOpen(true);
|
|
33
|
+
setShowPopup(false);
|
|
34
|
+
break;
|
|
35
|
+
default:
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
if (closeCookieBanner) setShowPopup(false);
|
|
39
|
+
if (closeCustomizeDialog) setIsPrivacyDialogOpen(false);
|
|
40
|
+
if (forwardedOnClick) forwardedOnClick();
|
|
41
|
+
}, [
|
|
42
|
+
closeCookieBanner,
|
|
43
|
+
closeCustomizeDialog,
|
|
44
|
+
forwardedOnClick,
|
|
45
|
+
saveConsents,
|
|
46
|
+
setIsPrivacyDialogOpen,
|
|
47
|
+
setShowPopup,
|
|
48
|
+
action
|
|
49
|
+
]);
|
|
50
|
+
const Comp = asChild ? __WEBPACK_EXTERNAL_MODULE__radix_ui_react_slot_85c2da36__.Slot : 'button';
|
|
51
|
+
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Comp, {
|
|
52
|
+
ref: ref,
|
|
53
|
+
...buttonStyle,
|
|
54
|
+
onClick: buttonClick,
|
|
55
|
+
...props
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
ConsentButton.displayName = 'ConsentButton';
|
|
59
|
+
export { ConsentButton };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.r = function(exports1) {
|
|
5
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
6
|
+
value: 'Module'
|
|
7
|
+
});
|
|
8
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
9
|
+
value: true
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
})();
|
|
13
|
+
var __webpack_exports__ = {};
|
|
14
|
+
__webpack_require__.r(__webpack_exports__);
|
|
15
|
+
var __webpack_export_target__ = exports;
|
|
16
|
+
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
17
|
+
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
|
|
18
|
+
value: true
|
|
19
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ComponentRef, HTMLAttributes } from 'react';
|
|
2
|
+
import type { ExtendThemeKeys, ThemeValue } from '../theme';
|
|
3
|
+
import type { ButtonSharedProps } from '../ui/components/button';
|
|
4
|
+
export type ConsentButtonElement = ComponentRef<'button'>;
|
|
5
|
+
/**
|
|
6
|
+
* Props for CookieBanner button components.
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export interface ConsentButtonProps extends HTMLAttributes<HTMLButtonElement>, ExtendThemeKeys {
|
|
11
|
+
/**
|
|
12
|
+
* @remarks
|
|
13
|
+
* When true, the button will not apply any styles.
|
|
14
|
+
*/
|
|
15
|
+
noStyle?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* @remarks
|
|
18
|
+
* When true, the button will render its children directly without wrapping them in a button element.
|
|
19
|
+
* This enables better composition with custom button implementations.
|
|
20
|
+
*/
|
|
21
|
+
asChild?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* @remarks
|
|
24
|
+
* Allows for custom click handling.
|
|
25
|
+
*/
|
|
26
|
+
onClick?: () => void;
|
|
27
|
+
}
|
|
28
|
+
export interface ConsentButtonStyles {
|
|
29
|
+
/** @remarks Styles for the root container element */
|
|
30
|
+
acceptButton?: ThemeValue & ButtonSharedProps;
|
|
31
|
+
rejectButton?: ThemeValue & ButtonSharedProps;
|
|
32
|
+
customizeButton?: ThemeValue & ButtonSharedProps;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=button.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.types.d.ts","sourceRoot":"","sources":["../../src/primitives/button.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,MAAM,MAAM,oBAAoB,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;AAE1D;;;;GAIG;AACH,MAAM,WAAW,kBAChB,SAAQ,cAAc,CAAC,iBAAiB,CAAC,EACxC,eAAe;IAChB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,mBAAmB;IACnC,qDAAqD;IACrD,YAAY,CAAC,EAAE,UAAU,GAAG,iBAAiB,CAAC;IAC9C,YAAY,CAAC,EAAE,UAAU,GAAG,iBAAiB,CAAC;IAC9C,eAAe,CAAC,EAAE,UAAU,GAAG,iBAAiB,CAAC;CACjD"}
|
|
File without changes
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
var __webpack_require__ = {};
|
|
4
|
+
(()=>{
|
|
5
|
+
__webpack_require__.d = function(exports1, definition) {
|
|
6
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: definition[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.o = function(obj, prop) {
|
|
14
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
(()=>{
|
|
18
|
+
__webpack_require__.r = function(exports1) {
|
|
19
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
20
|
+
value: 'Module'
|
|
21
|
+
});
|
|
22
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
23
|
+
value: true
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
})();
|
|
27
|
+
var __webpack_exports__ = {};
|
|
28
|
+
__webpack_require__.r(__webpack_exports__);
|
|
29
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
30
|
+
useThemeContext: ()=>useThemeContext,
|
|
31
|
+
ThemeContext: ()=>ThemeContext
|
|
32
|
+
});
|
|
33
|
+
const external_react_namespaceObject = require("react");
|
|
34
|
+
const ThemeContext = /*#__PURE__*/ (0, external_react_namespaceObject.createContext)(null);
|
|
35
|
+
const useThemeContext = ()=>{
|
|
36
|
+
const context = (0, external_react_namespaceObject.useContext)(ThemeContext);
|
|
37
|
+
if (!context) throw new Error('Theme components must be used within Theme.Root');
|
|
38
|
+
return context;
|
|
39
|
+
};
|
|
40
|
+
var __webpack_export_target__ = exports;
|
|
41
|
+
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
42
|
+
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
|
|
43
|
+
value: true
|
|
44
|
+
});
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration value type for the ThemeContext.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Provides type-safe theme customization options for components.
|
|
6
|
+
* Supports generic theme types for different component variants.
|
|
7
|
+
* Includes animation and style control features.
|
|
8
|
+
*
|
|
9
|
+
* @typeParam Theme - The theme configuration type for the component
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* type MyTheme = {
|
|
14
|
+
* colors: {
|
|
15
|
+
* primary: string;
|
|
16
|
+
* secondary: string;
|
|
17
|
+
* };
|
|
18
|
+
* };
|
|
19
|
+
*
|
|
20
|
+
* const value: ThemeContextValue<MyTheme> = {
|
|
21
|
+
* theme: {
|
|
22
|
+
* colors: {
|
|
23
|
+
* primary: '#007bff',
|
|
24
|
+
* secondary: '#6c757d'
|
|
25
|
+
* }
|
|
26
|
+
* },
|
|
27
|
+
* noStyle: false,
|
|
28
|
+
* disableAnimation: false
|
|
29
|
+
* };
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
export type ThemeContextValue<Theme = unknown> = {
|
|
35
|
+
/**
|
|
36
|
+
* Theme configuration object for styling components
|
|
37
|
+
* @remarks Partial to allow incremental theme overrides
|
|
38
|
+
*/
|
|
39
|
+
theme?: Partial<Theme>;
|
|
40
|
+
/**
|
|
41
|
+
* Disables all animations when true
|
|
42
|
+
* @remarks Useful for reduced motion preferences
|
|
43
|
+
*/
|
|
44
|
+
disableAnimation?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Removes default styles when true
|
|
47
|
+
* @remarks Enables fully custom styling
|
|
48
|
+
*/
|
|
49
|
+
noStyle?: boolean;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Context for providing theme values to components.
|
|
53
|
+
*
|
|
54
|
+
* @remarks
|
|
55
|
+
* Combines consent management state with theme configuration.
|
|
56
|
+
* Must be provided by a parent Theme.Root component.
|
|
57
|
+
* Supports TypeScript generic themes for type safety.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```tsx
|
|
61
|
+
* <ThemeContext.Provider value={{ theme: myTheme, noStyle: false }}>
|
|
62
|
+
* <App />
|
|
63
|
+
* </ThemeContext.Provider>
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* @public
|
|
67
|
+
*/
|
|
68
|
+
export declare const ThemeContext: import("react").Context<any>;
|
|
69
|
+
/**
|
|
70
|
+
* Hook to access the current theme context.
|
|
71
|
+
*
|
|
72
|
+
* @remarks
|
|
73
|
+
* Provides type-safe access to theme values and consent management state.
|
|
74
|
+
* Throws an error if used outside of a Theme.Root component.
|
|
75
|
+
* Supports TypeScript inference for theme types.
|
|
76
|
+
*
|
|
77
|
+
* @throws {Error} When used outside of a Theme.Root component
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```tsx
|
|
81
|
+
* const MyComponent = () => {
|
|
82
|
+
* const { theme, noStyle, disableAnimation } = useThemeContext();
|
|
83
|
+
*
|
|
84
|
+
* return (
|
|
85
|
+
* <div className={theme?.myClass}>
|
|
86
|
+
* {!disableAnimation && <AnimatedContent />}
|
|
87
|
+
* </div>
|
|
88
|
+
* );
|
|
89
|
+
* };
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
92
|
+
* @returns The current theme context value
|
|
93
|
+
* @public
|
|
94
|
+
*/
|
|
95
|
+
export declare const useThemeContext: () => any;
|
|
96
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/theme/context.tsx"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,MAAM,iBAAiB,CAAC,KAAK,GAAG,OAAO,IAAI;IAChD;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IAEvB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,YAAY,8BAElB,CAAC;AAER;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,eAAe,WAM3B,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
|
|
3
|
+
const ThemeContext = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.createContext)(null);
|
|
4
|
+
const useThemeContext = ()=>{
|
|
5
|
+
const context = (0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(ThemeContext);
|
|
6
|
+
if (!context) throw new Error('Theme components must be used within Theme.Root');
|
|
7
|
+
return context;
|
|
8
|
+
};
|
|
9
|
+
export { ThemeContext, useThemeContext };
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
useStyles: ()=>external_use_style_cjs_namespaceObject.useStyles,
|
|
30
|
+
useThemeContext: ()=>external_context_cjs_namespaceObject.useThemeContext,
|
|
31
|
+
ThemeContext: ()=>external_context_cjs_namespaceObject.ThemeContext
|
|
32
|
+
});
|
|
33
|
+
const external_context_cjs_namespaceObject = require("./context.cjs");
|
|
34
|
+
const external_use_style_cjs_namespaceObject = require("./use-style.cjs");
|
|
35
|
+
var __webpack_export_target__ = exports;
|
|
36
|
+
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
37
|
+
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
|
|
38
|
+
value: true
|
|
39
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { useThemeContext, ThemeContext } from './context';
|
|
2
|
+
export type { ThemeContextValue } from './context';
|
|
3
|
+
export type { AllThemeKeys } from './types/style-keys';
|
|
4
|
+
export type { ClassNameStyle, ThemeValue, ExtendThemeKeys, } from './types/style-types';
|
|
5
|
+
export { useStyles } from './use-style';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC1D,YAAY,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACnD,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,YAAY,EACX,cAAc,EACd,UAAU,EACV,eAAe,GACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE__context_js_80e2871f__ from "./context.js";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE__use_style_js_4cf67f88__ from "./use-style.js";
|
|
3
|
+
var __webpack_exports__ThemeContext = __WEBPACK_EXTERNAL_MODULE__context_js_80e2871f__.ThemeContext;
|
|
4
|
+
var __webpack_exports__useStyles = __WEBPACK_EXTERNAL_MODULE__use_style_js_4cf67f88__.useStyles;
|
|
5
|
+
var __webpack_exports__useThemeContext = __WEBPACK_EXTERNAL_MODULE__context_js_80e2871f__.useThemeContext;
|
|
6
|
+
export { __webpack_exports__ThemeContext as ThemeContext, __webpack_exports__useStyles as useStyles, __webpack_exports__useThemeContext as useThemeContext };
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
getNestedValue: ()=>getNestedValue
|
|
30
|
+
});
|
|
31
|
+
const getNestedValue = (obj, key)=>{
|
|
32
|
+
const [root, ...path] = key.split('.');
|
|
33
|
+
return path.reduce((acc, part)=>acc?.[part], obj[root]);
|
|
34
|
+
};
|
|
35
|
+
var __webpack_export_target__ = exports;
|
|
36
|
+
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
37
|
+
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
|
|
38
|
+
value: true
|
|
39
|
+
});
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* Provides utilities for type-safe theme key management and value access.
|
|
4
|
+
* Implements nested key type generation and value retrieval for theming system.
|
|
5
|
+
*/
|
|
6
|
+
import type { ConsentManagerDialogTheme } from '../consent-manager-dialog/theme';
|
|
7
|
+
import type { ConsentManagerWidgetTheme } from '../consent-manager-widget/theme';
|
|
8
|
+
import type { CookieBannerTheme } from '../cookie-banner';
|
|
9
|
+
/**
|
|
10
|
+
* Utility type that generates dot-notation string keys for nested objects.
|
|
11
|
+
*
|
|
12
|
+
* @remarks
|
|
13
|
+
* Creates union type of all possible nested paths in an object type using dot notation.
|
|
14
|
+
* Useful for type-safe theme key access in deeply nested theme objects.
|
|
15
|
+
*
|
|
16
|
+
* @typeParam T - The object type to generate nested keys for
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* type Theme = {
|
|
21
|
+
* colors: {
|
|
22
|
+
* primary: string;
|
|
23
|
+
* secondary: string;
|
|
24
|
+
* };
|
|
25
|
+
* };
|
|
26
|
+
*
|
|
27
|
+
* type Keys = NestedKeys<Theme>; // "colors.primary" | "colors.secondary"
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
32
|
+
export type NestedKeys<T> = {
|
|
33
|
+
[P in keyof T]: T[P] extends object ? `${string & P}.${NestedKeys<T[P]>}` : string & P;
|
|
34
|
+
}[keyof T];
|
|
35
|
+
/**
|
|
36
|
+
* Union type of all valid style keys for the theming system.
|
|
37
|
+
*
|
|
38
|
+
* @remarks
|
|
39
|
+
* Combines consent manager and cookie banner theme keys into a single type.
|
|
40
|
+
* Ensures type safety when accessing theme values across different components.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* const key: StyleKeys = "cookieBanner.root";
|
|
45
|
+
* const key2: StyleKeys = "consentManager.footer.accept-button";
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @public
|
|
49
|
+
*/
|
|
50
|
+
export type StyleKeys = `consentManager.${keyof ConsentManagerWidgetTheme}` | `consentManagerDialog.${keyof ConsentManagerDialogTheme}` | `cookieBanner.${keyof CookieBannerTheme}`;
|
|
51
|
+
/**
|
|
52
|
+
* Safely retrieves a nested value from an object using a dot-notation key.
|
|
53
|
+
*
|
|
54
|
+
* @remarks
|
|
55
|
+
* Provides type-safe access to nested theme values.
|
|
56
|
+
* Handles undefined values gracefully through optional chaining.
|
|
57
|
+
*
|
|
58
|
+
* @typeParam K - The specific StyleKeys type to retrieve
|
|
59
|
+
* @param obj - The source object to retrieve the value from
|
|
60
|
+
* @param key - The dot-notation path to the desired value
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```typescript
|
|
64
|
+
* const theme = {
|
|
65
|
+
* cookieBanner: {
|
|
66
|
+
* root: { backgroundColor: 'white' }
|
|
67
|
+
* }
|
|
68
|
+
* };
|
|
69
|
+
*
|
|
70
|
+
* const value = getNestedValue(theme, 'cookieBanner.root');
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* @returns The value at the specified path or undefined if not found
|
|
74
|
+
* @public
|
|
75
|
+
*/
|
|
76
|
+
export declare const getNestedValue: <K extends StyleKeys>(obj: Record<string, unknown>, key: K) => unknown;
|
|
77
|
+
//# sourceMappingURL=style-keys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style-keys.d.ts","sourceRoot":"","sources":["../../src/theme/style-keys.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AACjF,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AACjF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI;KAC1B,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GAChC,GAAG,MAAM,GAAG,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,GACnC,MAAM,GAAG,CAAC;CACb,CAAC,MAAM,CAAC,CAAC,CAAC;AAEX;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,SAAS,GAClB,kBAAkB,MAAM,yBAAyB,EAAE,GACnD,wBAAwB,MAAM,yBAAyB,EAAE,GACzD,gBAAgB,MAAM,iBAAiB,EAAE,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,SAAS,OAC5C,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,OACvB,CAAC,KACJ,OAMF,CAAC"}
|