@c15t/nextjs 2.0.0-rc.9 → 2.0.2
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 +26 -21
- package/dist/iab/styles.tw3.css +54 -11
- package/dist/styles.tw3.css +70 -10
- package/dist/version.cjs +1 -1
- package/dist/version.js +1 -1
- package/dist-types/libs/initial-data.d.ts +7 -1
- package/dist-types/version.d.ts +1 -1
- package/docs/ai-agents.md +111 -0
- package/docs/building-headless-components.md +122 -16
- package/docs/components/consent-banner.md +1 -30
- package/docs/components/consent-dialog.md +4 -3
- package/docs/components/consent-manager-provider.md +13 -13
- package/docs/components/consent-widget.md +1 -28
- package/docs/components/dev-tools.md +33 -0
- package/docs/concepts/client-modes.md +1 -1
- package/docs/concepts/policy-packs.md +1 -1
- package/docs/hooks/use-consent-manager/overview.md +18 -2
- package/docs/iab/consent-banner.md +8 -6
- package/docs/iab/consent-dialog.md +8 -6
- package/docs/iab/overview.md +13 -12
- package/docs/iab/use-gvl-data.md +11 -199
- package/docs/internationalization.md +1 -1
- package/docs/optimization.md +42 -23
- package/docs/policy-packs.md +1 -1
- package/docs/quickstart.md +9 -9
- package/docs/server-side.md +10 -5
- package/docs/styling/color-scheme.md +1 -1
- package/docs/styling/css-variables.md +1 -1
- package/docs/styling/overview.md +11 -4
- package/docs/styling/slots.md +7 -3
- package/docs/styling/tailwind.md +23 -1
- package/docs/styling/tokens.md +3 -1
- package/iab/styles.tw3.css +1 -0
- package/package.json +31 -14
- package/readme.json +5 -5
- package/styles.tw3.css +1 -0
package/docs/styling/slots.md
CHANGED
|
@@ -4,7 +4,7 @@ description: Target individual component parts with styles using the slot system
|
|
|
4
4
|
---
|
|
5
5
|
## What are Slots?
|
|
6
6
|
|
|
7
|
-
Slots let you target specific parts of consent components with styles. Each component is built from named slots such as `consentBannerTitle` and `
|
|
7
|
+
Slots let you target specific parts of consent components with styles. Each component is built from named slots such as `consentBannerTitle` and `consentDialogTag`.
|
|
8
8
|
|
|
9
9
|
Use slots after the stock component APIs and design tokens:
|
|
10
10
|
|
|
@@ -88,6 +88,7 @@ Use the typed API reference below for the full slot list and descriptions. It st
|
|
|
88
88
|
|consentBannerDescription|SlotStyle \|undefined|Banner description text element.|-|Optional|
|
|
89
89
|
|consentBannerFooter|SlotStyle \|undefined|Footer container for banner action buttons.|-|Optional|
|
|
90
90
|
|consentBannerFooterSubGroup|SlotStyle \|undefined|Nested button group inside the banner footer.|-|Optional|
|
|
91
|
+
|consentBannerTag|SlotStyle \|undefined|Branding tag rendered above the consent banner card.|-|Optional|
|
|
91
92
|
|consentBannerOverlay|SlotStyle \|undefined|Backdrop overlay rendered behind the banner when enabled.|-|Optional|
|
|
92
93
|
|consentDialog|SlotStyle \|undefined|Root wrapper for the consent dialog modal.|-|Optional|
|
|
93
94
|
|consentDialogCard|SlotStyle \|undefined|Main dialog card container.|-|Optional|
|
|
@@ -95,22 +96,25 @@ Use the typed API reference below for the full slot list and descriptions. It st
|
|
|
95
96
|
|consentDialogTitle|SlotStyle \|undefined|Dialog title text element.|-|Optional|
|
|
96
97
|
|consentDialogDescription|SlotStyle \|undefined|Dialog description text element.|-|Optional|
|
|
97
98
|
|consentDialogContent|SlotStyle \|undefined|Dialog content region (typically holds ConsentWidget).|-|Optional|
|
|
98
|
-
|consentDialogFooter|SlotStyle \|undefined|
|
|
99
|
+
|consentDialogFooter|SlotStyle \|undefined|Footer container used by compound dialog layouts.|-|Optional|
|
|
100
|
+
|consentDialogTag|SlotStyle \|undefined|Branding tag rendered below the stock consent dialog card.|-|Optional|
|
|
99
101
|
|consentDialogOverlay|SlotStyle \|undefined|Backdrop overlay rendered behind the dialog.|-|Optional|
|
|
100
102
|
|consentWidget|SlotStyle \|undefined|Root wrapper for the consent widget/preferences panel.|-|Optional|
|
|
101
103
|
|consentWidgetAccordion|SlotStyle \|undefined|Accordion region listing consent categories.|-|Optional|
|
|
102
104
|
|consentWidgetFooter|SlotStyle \|undefined|Footer area for widget actions and links.|-|Optional|
|
|
103
|
-
|
|
|
105
|
+
|consentWidgetTag|SlotStyle \|undefined|Branding tag rendered below the standalone consent widget.|-|Optional|
|
|
104
106
|
|frame|SlotStyle \|undefined|Frame wrapper used by blocking placeholders (e.g., iframe blocking).|-|Optional|
|
|
105
107
|
|iabConsentBanner|SlotStyle \|undefined|Root wrapper for the IAB consent banner.|-|Optional|
|
|
106
108
|
|iabConsentBannerCard|SlotStyle \|undefined|Main card container for IAB banner content.|-|Optional|
|
|
107
109
|
|iabConsentBannerHeader|SlotStyle \|undefined|Header region for IAB banner title/description.|-|Optional|
|
|
108
110
|
|iabConsentBannerFooter|SlotStyle \|undefined|Footer container for IAB banner actions.|-|Optional|
|
|
111
|
+
|iabConsentBannerTag|SlotStyle \|undefined|Branding tag rendered above the IAB banner card.|-|Optional|
|
|
109
112
|
|iabConsentBannerOverlay|SlotStyle \|undefined|Backdrop overlay rendered behind the IAB banner.|-|Optional|
|
|
110
113
|
|iabConsentDialog|SlotStyle \|undefined|Root wrapper for the IAB consent dialog.|-|Optional|
|
|
111
114
|
|iabConsentDialogCard|SlotStyle \|undefined|Main card container for IAB dialog content.|-|Optional|
|
|
112
115
|
|iabConsentDialogHeader|SlotStyle \|undefined|Header region for IAB dialog title/description.|-|Optional|
|
|
113
116
|
|iabConsentDialogFooter|SlotStyle \|undefined|Footer container for IAB dialog actions.|-|Optional|
|
|
117
|
+
|iabConsentDialogTag|SlotStyle \|undefined|Branding tag rendered below the IAB dialog card.|-|Optional|
|
|
114
118
|
|iabConsentDialogOverlay|SlotStyle \|undefined|Backdrop overlay rendered behind the IAB dialog.|-|Optional|
|
|
115
119
|
|buttonPrimary|SlotStyle \|undefined|Shared primary button style used across consent components.|-|Optional|
|
|
116
120
|
|buttonSecondary|SlotStyle \|undefined|Shared secondary button style used across consent components.|-|Optional|
|
package/docs/styling/tailwind.md
CHANGED
|
@@ -18,17 +18,21 @@ Import the standard c15t stylesheet once in your app-level CSS entrypoint:
|
|
|
18
18
|
|
|
19
19
|
Keeping the c15t stylesheet in your global CSS entrypoint makes layer and cascade order explicit. JS/TSX side-effect imports can load in a different order across framework and Tailwind tooling, which makes style regressions harder to debug.
|
|
20
20
|
|
|
21
|
+
With Tailwind v4, keep c15t at the end of the top-level `@import` block so Fumadocs, `tw-animate-css`, and other preset imports do not override c15t theme tokens.
|
|
22
|
+
|
|
21
23
|
### Tailwind v4
|
|
22
24
|
|
|
23
|
-
Tailwind v4 automatically scans your source files. Import Tailwind normally, then
|
|
25
|
+
Tailwind v4 automatically scans your source files. Import Tailwind normally, then keep the c15t stylesheet last in the top-level `@import` block so Fumadocs, `tw-animate-css`, or other preset styles load first. c15t component styles join Tailwind's `components` layer automatically, so no extra c15t-specific layer declaration is needed:
|
|
24
26
|
|
|
25
27
|
```css title="src/index.css"
|
|
26
28
|
@import "tailwindcss";
|
|
29
|
+
@import "tw-animate-css";
|
|
27
30
|
@import "@c15t/react/styles.css";
|
|
28
31
|
```
|
|
29
32
|
|
|
30
33
|
```css title="app/globals.css"
|
|
31
34
|
@import "tailwindcss";
|
|
35
|
+
@import "tw-animate-css";
|
|
32
36
|
@import "@c15t/nextjs/styles.css";
|
|
33
37
|
```
|
|
34
38
|
|
|
@@ -50,6 +54,24 @@ Import the Tailwind 3-compatible c15t stylesheet after `@tailwind components;` a
|
|
|
50
54
|
@tailwind utilities;
|
|
51
55
|
```
|
|
52
56
|
|
|
57
|
+
## Troubleshooting: Fumadocs Overrides c15t Styles
|
|
58
|
+
|
|
59
|
+
If c15t components render partially unstyled or lose their theme tokens inside a Fumadocs site, check the order of the imports in `app/globals.css`.
|
|
60
|
+
|
|
61
|
+
**Cause:** Fumadocs preset imports can load after c15t and override the tokens and layer output that c15t components depend on.
|
|
62
|
+
|
|
63
|
+
**Fix:** Keep `@c15t/nextjs/styles.css` at the end of the top-level `@import` block:
|
|
64
|
+
|
|
65
|
+
```css title="app/globals.css"
|
|
66
|
+
@import "tailwindcss";
|
|
67
|
+
@import "tw-animate-css";
|
|
68
|
+
@import "fumadocs-ui/css/shadcn.css";
|
|
69
|
+
@import "fumadocs-ui/css/preset.css";
|
|
70
|
+
@import "@c15t/nextjs/styles.css";
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
If you use other preset or docs-site stylesheets, apply the same rule: load them first, then import c15t last in the top-level import block.
|
|
74
|
+
|
|
53
75
|
## Using Tailwind with Slots
|
|
54
76
|
|
|
55
77
|
Apply Tailwind classes via the theme's `slots` object:
|
package/docs/styling/tokens.md
CHANGED
|
@@ -6,6 +6,8 @@ description: The six base token categories that control colors, typography, spac
|
|
|
6
6
|
|
|
7
7
|
Color tokens define the palette for all consent components. Set `colors` for light mode and `dark` for dark mode overrides.
|
|
8
8
|
|
|
9
|
+
When `textOnPrimary` is omitted, c15t derives it automatically from `primary` to keep text readable on primary-filled surfaces such as stock branding tags and buttons. Set `textOnPrimary` explicitly when you need a specific foreground color.
|
|
10
|
+
|
|
9
11
|
```tsx
|
|
10
12
|
const theme = {
|
|
11
13
|
colors: {
|
|
@@ -45,7 +47,7 @@ const theme = {
|
|
|
45
47
|
|borderHover|string \|undefined|Hover state for bordered elements.|-|Optional|
|
|
46
48
|
|text|string \|undefined|Primary text color for headings and body.|-|Optional|
|
|
47
49
|
|textMuted|string \|undefined|Muted text color for secondary content.|-|Optional|
|
|
48
|
-
|textOnPrimary|string \|undefined|Text color for content on primary background.|-|Optional|
|
|
50
|
+
|textOnPrimary|string \|undefined|Text color for content on primary background. Auto-derived from \`primary\` when omitted.|-|Optional|
|
|
49
51
|
|overlay|string \|undefined|Overlay color for modal backdrops.|-|Optional|
|
|
50
52
|
|switchTrack|string \|undefined|Toggle track color (off state).|-|Optional|
|
|
51
53
|
|switchTrackActive|string \|undefined|Toggle track color (on state).|-|Optional|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import "../dist/iab/styles.tw3.css";
|
package/package.json
CHANGED
|
@@ -1,32 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c15t/nextjs",
|
|
3
|
-
"version": "2.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.0.2",
|
|
4
|
+
"description": "Headless cookie banner, consent manager & preference center for Next.js. App Router & Pages Router, RSC, GDPR/CCPA/LGPD/TCF compliant.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nextjs",
|
|
7
|
+
"next",
|
|
8
|
+
"next-cookie-banner",
|
|
9
|
+
"nextjs-consent",
|
|
10
|
+
"next-cmp",
|
|
7
11
|
"consent",
|
|
8
12
|
"privacy",
|
|
9
13
|
"gdpr",
|
|
10
14
|
"ccpa",
|
|
11
15
|
"lgpd",
|
|
12
|
-
"
|
|
16
|
+
"tcf",
|
|
17
|
+
"iab",
|
|
18
|
+
"cmp",
|
|
13
19
|
"react",
|
|
20
|
+
"headless",
|
|
14
21
|
"typescript",
|
|
15
22
|
"cookie-banner",
|
|
23
|
+
"cookie-consent",
|
|
16
24
|
"consent-management-platform",
|
|
17
|
-
"
|
|
25
|
+
"consent-management",
|
|
18
26
|
"consent-banner",
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
27
|
+
"preference-center",
|
|
28
|
+
"app-router",
|
|
29
|
+
"pages-router",
|
|
30
|
+
"server-components",
|
|
31
|
+
"rsc",
|
|
32
|
+
"ssr",
|
|
33
|
+
"server-side-rendering",
|
|
34
|
+
"tracking-consent"
|
|
22
35
|
],
|
|
23
36
|
"homepage": "https://c15t.com/docs/frameworks/next/quickstart",
|
|
37
|
+
"bugs": {
|
|
38
|
+
"url": "https://github.com/c15t/c15t/issues"
|
|
39
|
+
},
|
|
24
40
|
"repository": {
|
|
25
41
|
"type": "git",
|
|
26
42
|
"url": "https://github.com/c15t/c15t.git",
|
|
27
43
|
"directory": "packages/nextjs"
|
|
28
44
|
},
|
|
29
|
-
"license": "
|
|
45
|
+
"license": "Apache-2.0",
|
|
30
46
|
"sideEffects": [
|
|
31
47
|
"**/*.css"
|
|
32
48
|
],
|
|
@@ -61,6 +77,7 @@
|
|
|
61
77
|
"dist-types",
|
|
62
78
|
"client",
|
|
63
79
|
"styles.css",
|
|
80
|
+
"styles.tw3.css",
|
|
64
81
|
"iab",
|
|
65
82
|
"src/styles.css",
|
|
66
83
|
"src/styles.tw3.css",
|
|
@@ -72,20 +89,20 @@
|
|
|
72
89
|
"build": "bun prebuild && rslib build && bun ../../scripts/normalize-dist-types.mjs && bun scripts/generate-distribution-css.ts && bun ../../scripts/agent-docs/generate-package-docs.ts @c15t/nextjs",
|
|
73
90
|
"build:agent-docs": "bun ../../scripts/agent-docs/generate-package-docs.ts @c15t/nextjs",
|
|
74
91
|
"check-types": "bun prebuild && tsc --noEmit",
|
|
75
|
-
"dev": "bun prebuild && rslib build
|
|
92
|
+
"dev": "sh -c 'bun prebuild && rslib build --no-dts --no-clean && bun scripts/generate-distribution-css.ts && rslib build --watch --no-dts --no-clean'",
|
|
76
93
|
"fmt": "bun biome format --write . && bun biome check --formatter-enabled=false --linter-enabled=false --write",
|
|
77
94
|
"lint": "bun biome lint ./src",
|
|
78
|
-
"prepack": "
|
|
95
|
+
"prepack": "bun run build",
|
|
79
96
|
"test": "bun prebuild && vitest run --passWithNoTests",
|
|
80
97
|
"test:watch": "bun prebuild && vitest --passWithNoTests"
|
|
81
98
|
},
|
|
82
99
|
"dependencies": {
|
|
83
|
-
"@c15t/react": "2.0.
|
|
84
|
-
"@c15t/translations": "2.0.0
|
|
85
|
-
"c15t": "2.0.0
|
|
100
|
+
"@c15t/react": "2.0.2",
|
|
101
|
+
"@c15t/translations": "2.0.0",
|
|
102
|
+
"c15t": "2.0.0"
|
|
86
103
|
},
|
|
87
104
|
"devDependencies": {
|
|
88
|
-
"@c15t/typescript-config": "0.0.1
|
|
105
|
+
"@c15t/typescript-config": "0.0.1",
|
|
89
106
|
"@c15t/vitest-config": "1.0.0",
|
|
90
107
|
"genversion": "3.2.0",
|
|
91
108
|
"typescript": "6.0.2"
|
package/readme.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"title": "@c15t/nextjs: Next.js Integration",
|
|
3
|
-
"description": "
|
|
3
|
+
"description": "Headless cookie banner, consent manager & preference center for Next.js. App Router & Pages Router, RSC, GDPR/CCPA/LGPD/TCF compliant.",
|
|
4
4
|
"features": [
|
|
5
5
|
"Works with Next.js 15, 14, and 13",
|
|
6
6
|
"Full 'use client' support for React Server Components",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"Next.js 13.5.4 or later",
|
|
16
16
|
"React 18 or later",
|
|
17
17
|
"Node.js 18.17.0 or later",
|
|
18
|
-
"A hosted [c15t instance](https://
|
|
18
|
+
"A hosted [c15t instance](https://inth.com) (free sign-up) or [self-hosted deployment](https://c15t.com/docs/self-host/v2)"
|
|
19
19
|
],
|
|
20
20
|
"manualInstallation": [
|
|
21
21
|
"",
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
"",
|
|
26
26
|
"```css\n/* app/globals.css */\n@import \"@c15t/nextjs/styles.css\";\n```",
|
|
27
27
|
"",
|
|
28
|
-
"To manually install, follow the guide in our [docs – manual setup](https://c15t.com/docs/frameworks/
|
|
28
|
+
"To manually install, follow the guide in our [docs – manual setup](https://c15t.com/docs/frameworks/next/quickstart#manual-setup)."
|
|
29
29
|
],
|
|
30
30
|
"usage": [
|
|
31
31
|
"Import `ConsentManagerProvider` in your app's root layout",
|
|
32
|
-
"Add `
|
|
32
|
+
"Add `ConsentBanner` and `ConsentDialog` components",
|
|
33
33
|
"Customise styling and behaviour to fit your app",
|
|
34
34
|
"For full implementation details, see the [Next.js quickstart docs](https://c15t.com/docs/frameworks/next/quickstart)",
|
|
35
|
-
"```tsx\n// app/layout.tsx\nimport {
|
|
35
|
+
"```tsx\n// app/layout.tsx\nimport {\n ConsentManagerProvider,\n ConsentBanner,\n ConsentDialog,\n} from '@c15t/nextjs'\n\nexport default function RootLayout({ children }: { children: React.ReactNode }) {\n return (\n <html lang=\"en\">\n <body>\n <ConsentManagerProvider>\n {children}\n <ConsentBanner />\n <ConsentDialog />\n </ConsentManagerProvider>\n </body>\n </html>\n )\n}\n```"
|
|
36
36
|
],
|
|
37
37
|
"docsLink": "https://c15t.com/docs/frameworks/next/quickstart",
|
|
38
38
|
"quickStartLink": "https://c15t.com/docs/frameworks/next/quickstart",
|
package/styles.tw3.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import "./dist/styles.tw3.css";
|