@c15t/react 2.2.1 → 3.0.0-alpha.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/AGENTS.md +89 -141
- package/README.md +2 -2
- package/dist/aggregate-components.js +2 -0
- package/dist/chunk-warming.js +1 -0
- package/dist/component-hooks/use-headless-consent-ui.js +2 -0
- package/dist/component-hooks/use-headless-iab-consent-ui.js +2 -0
- package/dist/component-hooks/use-manager.js +2 -0
- package/dist/component-hooks/use-panel-trigger.js +2 -0
- package/dist/component-hooks/use-translations.js +2 -0
- package/dist/components/consent-preferences-link/consent-preferences-link.js +2 -1
- package/dist/components/consent-preferences-link/index.js +1 -0
- package/dist/components/frame/atoms.js +1 -1
- package/dist/components/frame/frame.js +2 -1
- package/dist/components/frame/index.js +2 -1
- package/dist/components/iab-panel/atoms/card.js +2 -0
- package/dist/components/iab-panel/atoms/content.js +2 -0
- package/dist/components/iab-panel/atoms/footer.js +2 -0
- package/dist/components/iab-panel/atoms/header.js +2 -0
- package/dist/components/iab-panel/atoms/overlay.js +2 -0
- package/dist/components/iab-panel/atoms/purpose-item.js +2 -0
- package/dist/components/iab-panel/atoms/root.js +2 -0
- package/dist/components/iab-panel/atoms/stack-item.js +2 -0
- package/dist/components/iab-panel/atoms/tabs.js +2 -0
- package/dist/components/iab-panel/atoms/vendor-list.js +2 -0
- package/dist/components/iab-panel/hooks/use-display-model.js +2 -0
- package/dist/components/iab-panel/hooks/use-gvl-data.js +2 -0
- package/dist/components/iab-panel/iab-panel.js +2 -0
- package/dist/components/iab-panel/index.js +2 -0
- package/dist/components/iab-panel/use-iab-translations.js +1 -0
- package/dist/components/iab-prompt/atoms/button-group.js +2 -0
- package/dist/components/iab-prompt/atoms/card.js +2 -0
- package/dist/components/iab-prompt/atoms/description.js +2 -0
- package/dist/components/iab-prompt/atoms/footer.js +2 -0
- package/dist/components/iab-prompt/atoms/header.js +2 -0
- package/dist/components/iab-prompt/atoms/overlay.js +2 -0
- package/dist/components/iab-prompt/atoms/root.js +2 -0
- package/dist/components/iab-prompt/atoms/title.js +2 -0
- package/dist/components/iab-prompt/iab-prompt.js +2 -0
- package/dist/components/iab-prompt/index.js +2 -0
- package/dist/components/panel/atoms/card.js +2 -0
- package/dist/components/panel/atoms/overlay.js +1 -0
- package/dist/components/panel/atoms/root.js +2 -0
- package/dist/components/panel/index.js +2 -0
- package/dist/components/panel/panel.js +2 -0
- package/dist/components/{consent-dialog-link → panel-link}/index.js +1 -0
- package/dist/components/panel-trigger/atoms/button.js +2 -0
- package/dist/components/panel-trigger/atoms/icon.js +2 -0
- package/dist/components/panel-trigger/atoms/root.js +2 -0
- package/dist/components/panel-trigger/atoms/text.js +2 -0
- package/dist/components/panel-trigger/atoms/toolbar.js +2 -0
- package/dist/components/panel-trigger/index.js +2 -0
- package/dist/components/panel-trigger/panel-trigger-toolbar.js +2 -0
- package/dist/components/panel-trigger/panel-trigger.js +2 -0
- package/dist/components/panel-trigger/use-draggable.js +2 -0
- package/dist/components/preferences/atoms/accordion.js +1 -0
- package/dist/components/preferences/atoms/button.js +1 -0
- package/dist/components/preferences/atoms/footer.js +1 -0
- package/dist/components/preferences/atoms/root.js +2 -0
- package/dist/components/preferences/index.js +2 -0
- package/dist/components/preferences/policy-actions.js +2 -0
- package/dist/components/preferences/preferences.js +2 -0
- package/dist/components/prompt/atoms/overlay.js +1 -0
- package/dist/components/prompt/atoms/root.js +2 -0
- package/dist/components/prompt/components.js +1 -0
- package/dist/components/prompt/error-boundary.js +2 -0
- package/dist/components/prompt/index.js +2 -0
- package/dist/components/prompt/policy-actions.js +2 -0
- package/dist/components/prompt/prompt.js +2 -0
- package/dist/components/prompt/resolve-banner-primary-actions.js +1 -0
- package/dist/components/prompt/surface-context.js +2 -0
- package/dist/components/prompt/use-banner-copy.js +2 -0
- package/dist/components/shared/libs/recursive-clone-children.js +1 -1
- package/dist/components/shared/libs/slot.js +1 -1
- package/dist/components/shared/libs/use-controllable-state.js +1 -1
- package/dist/components/shared/policy-actions.js +2 -1
- package/dist/components/shared/primitives/box.js +2 -1
- package/dist/components/shared/primitives/button.js +1 -1
- package/dist/components/shared/primitives/legal-links/index.js +1 -1
- package/dist/components/shared/ui/accordion/accordion.js +2 -1
- package/dist/components/shared/ui/animated-collapse/animated-collapse.js +2 -1
- package/dist/components/shared/ui/branding.js +1 -1
- package/dist/components/shared/ui/button/button.js +1 -1
- package/dist/components/shared/ui/collapsible/collapsible.js +2 -1
- package/dist/components/shared/ui/dialog/dialog.js +2 -1
- package/dist/components/shared/ui/icon.js +1 -1
- package/dist/components/shared/ui/logo.js +1 -1
- package/dist/components/shared/ui/preference-item/preference-item.js +2 -1
- package/dist/components/shared/ui/switch/switch.js +1 -1
- package/dist/components/shared/ui/tabs/tabs.js +2 -1
- package/dist/context/consent-tracking-context.js +1 -0
- package/dist/context/iab-context-value.js +1 -0
- package/dist/context/index.js +1 -0
- package/dist/context/theme-context.js +2 -1
- package/dist/context.js +1 -0
- package/dist/devtools.js +2 -0
- package/dist/draft.js +2 -0
- package/dist/external-iab-context.js +2 -0
- package/dist/frame.js +2 -0
- package/dist/headless.js +1 -1
- package/dist/hooks/use-color-scheme.js +2 -1
- package/dist/hooks/use-component-config.js +2 -1
- package/dist/hooks/use-focus-trap.js +2 -1
- package/dist/hooks/use-headless-iab-consent-ui.js +2 -1
- package/dist/hooks/use-iab-manager.js +2 -0
- package/dist/hooks/use-is-hydrated.js +2 -0
- package/dist/hooks/use-reduced-motion.js +2 -1
- package/dist/hooks/use-scroll-lock.js +2 -1
- package/dist/hooks/use-text-direction.js +2 -1
- package/dist/hooks/use-theme.js +2 -1
- package/dist/hooks.js +1 -0
- package/dist/iab/styles.css +1 -1
- package/dist/iab/styles.tw3.css +27 -19
- package/dist/iab-context.js +2 -0
- package/dist/iab.js +1 -1
- package/dist/index.js +1 -1
- package/dist/module-hooks/iframe-blocker.js +2 -0
- package/dist/module-hooks/network-blocker.js +2 -0
- package/dist/module-hooks/persistence.js +2 -0
- package/dist/module-hooks/script-loader.js +2 -0
- package/dist/module-hooks/shared.js +2 -0
- package/dist/module-hooks.js +2 -0
- package/dist/panel-link.js +2 -0
- package/dist/panel-trigger.js +2 -0
- package/dist/panel.js +2 -0
- package/dist/preferences.js +2 -0
- package/dist/primitives.js +1 -1
- package/dist/prompt.js +2 -0
- package/dist/provider.js +2 -0
- package/dist/server/fetch-ssr-data.js +1 -1
- package/dist/server/headers.js +1 -1
- package/dist/server/init-cache-key.js +1 -1
- package/dist/server/normalize-url.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.tw3.css +67 -29
- package/dist/theme-provider.js +2 -0
- package/dist/transports/offline.js +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/theme/index.js +1 -1
- package/dist/types/theme/style-types.js +1 -1
- package/dist/ui-config-context.js +2 -0
- package/dist/ui-save.js +1 -0
- package/dist/utils/cn.js +1 -1
- package/dist/utils/default-translation-config.js +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/merge-slot-props.js +1 -0
- package/dist/utils/merge-styles.js +1 -1
- package/dist/utils/theme-utils.js +1 -1
- package/dist/version.js +1 -1
- package/dist-types/aggregate-components.d.ts +4 -0
- package/dist-types/chunk-warming.d.ts +19 -0
- package/dist-types/component-hooks/use-headless-consent-ui.d.ts +68 -0
- package/dist-types/component-hooks/use-headless-iab-consent-ui.d.ts +22 -0
- package/dist-types/component-hooks/use-manager.d.ts +40 -0
- package/dist-types/component-hooks/use-panel-trigger.d.ts +20 -0
- package/dist-types/component-hooks/use-translations.d.ts +2 -0
- package/dist-types/components/consent-preferences-link/consent-preferences-link.d.ts +1 -1
- package/dist-types/components/frame/atoms.d.ts +5 -5
- package/dist-types/components/frame/types.d.ts +3 -2
- package/dist-types/components/{iab-consent-dialog → iab-panel}/atoms/card.d.ts +2 -1
- package/dist-types/components/{iab-consent-dialog → iab-panel}/atoms/content.d.ts +1 -1
- package/dist-types/components/{iab-consent-dialog → iab-panel}/atoms/footer.d.ts +1 -1
- package/dist-types/components/{iab-consent-dialog → iab-panel}/atoms/header.d.ts +1 -1
- package/dist-types/components/{iab-consent-dialog → iab-panel}/atoms/overlay.d.ts +1 -1
- package/dist-types/components/{iab-consent-dialog → iab-panel}/atoms/purpose-item.d.ts +7 -1
- package/dist-types/components/{iab-consent-dialog → iab-panel}/atoms/root.d.ts +3 -2
- package/dist-types/components/{iab-consent-dialog → iab-panel}/atoms/stack-item.d.ts +1 -1
- package/dist-types/components/{iab-consent-dialog → iab-panel}/atoms/tabs.d.ts +1 -1
- package/dist-types/components/{iab-consent-dialog → iab-panel}/atoms/vendor-list.d.ts +2 -3
- package/dist-types/components/iab-panel/hooks/use-display-model.d.ts +18 -0
- package/dist-types/components/iab-panel/hooks/use-gvl-data.d.ts +17 -0
- package/dist-types/components/{iab-consent-dialog/iab-consent-dialog.d.ts → iab-panel/iab-panel.d.ts} +10 -3
- package/dist-types/components/{iab-consent-dialog → iab-panel}/index.d.ts +3 -2
- package/dist-types/components/iab-panel/types.d.ts +1 -0
- package/dist-types/components/{iab-consent-dialog → iab-panel}/use-iab-translations.d.ts +3 -1
- package/dist-types/components/{iab-consent-banner → iab-prompt}/atoms/button-group.d.ts +1 -1
- package/dist-types/components/{iab-consent-banner → iab-prompt}/atoms/card.d.ts +2 -1
- package/dist-types/components/{iab-consent-banner → iab-prompt}/atoms/description.d.ts +1 -1
- package/dist-types/components/{iab-consent-banner → iab-prompt}/atoms/footer.d.ts +2 -1
- package/dist-types/components/{iab-consent-banner → iab-prompt}/atoms/header.d.ts +2 -1
- package/dist-types/components/{iab-consent-banner → iab-prompt}/atoms/overlay.d.ts +1 -1
- package/dist-types/components/{iab-consent-banner → iab-prompt}/atoms/root.d.ts +3 -2
- package/dist-types/components/{iab-consent-banner → iab-prompt}/atoms/title.d.ts +1 -1
- package/dist-types/components/{iab-consent-banner/iab-consent-banner.d.ts → iab-prompt/iab-prompt.d.ts} +10 -4
- package/dist-types/components/{iab-consent-banner → iab-prompt}/index.d.ts +1 -1
- package/dist-types/components/{consent-dialog → panel}/atoms/card.d.ts +15 -15
- package/dist-types/components/{consent-dialog → panel}/atoms/overlay.d.ts +24 -8
- package/dist-types/components/{consent-dialog → panel}/atoms/root.d.ts +4 -3
- package/dist-types/components/{consent-dialog → panel}/index.d.ts +13 -8
- package/dist-types/components/{consent-dialog/consent-dialog.d.ts → panel/panel.d.ts} +6 -5
- package/dist-types/components/{consent-dialog-trigger → panel-trigger}/atoms/button.d.ts +2 -1
- package/dist-types/components/{consent-dialog-trigger → panel-trigger}/atoms/icon.d.ts +1 -16
- package/dist-types/components/{consent-dialog-trigger → panel-trigger}/atoms/root.d.ts +11 -23
- package/dist-types/components/{consent-dialog-trigger → panel-trigger}/atoms/text.d.ts +0 -11
- package/dist-types/components/{consent-dialog-trigger → panel-trigger}/atoms/toolbar.d.ts +15 -4
- package/dist-types/components/{consent-dialog-trigger → panel-trigger}/index.d.ts +2 -2
- package/dist-types/components/{consent-dialog-trigger/consent-dialog-trigger-toolbar.d.ts → panel-trigger/panel-trigger-toolbar.d.ts} +0 -23
- package/dist-types/components/{consent-dialog-trigger/consent-dialog-trigger.d.ts → panel-trigger/panel-trigger.d.ts} +8 -4
- package/dist-types/components/{consent-dialog-trigger → panel-trigger}/types.d.ts +16 -7
- package/dist-types/components/{consent-dialog-trigger → panel-trigger}/use-draggable.d.ts +2 -9
- package/dist-types/components/{consent-widget → preferences}/atoms/accordion.d.ts +5 -5
- package/dist-types/components/{consent-widget → preferences}/atoms/footer.d.ts +3 -3
- package/dist-types/components/{consent-widget → preferences}/atoms/root.d.ts +1 -1
- package/dist-types/components/{consent-widget → preferences}/index.d.ts +11 -9
- package/dist-types/components/preferences/policy-actions.d.ts +10 -0
- package/dist-types/components/{consent-banner → prompt}/atoms/overlay.d.ts +1 -1
- package/dist-types/components/prompt/atoms/root.d.ts +78 -0
- package/dist-types/components/{consent-banner → prompt}/components.d.ts +99 -14
- package/dist-types/components/{consent-banner → prompt}/error-boundary.d.ts +3 -1
- package/dist-types/components/{consent-banner → prompt}/index.d.ts +18 -10
- package/dist-types/components/prompt/policy-actions.d.ts +12 -0
- package/dist-types/components/{consent-banner/consent-banner.d.ts → prompt/prompt.d.ts} +36 -10
- package/dist-types/components/prompt/resolve-banner-primary-actions.d.ts +14 -0
- package/dist-types/components/prompt/surface-context.d.ts +45 -0
- package/dist-types/components/prompt/use-banner-copy.d.ts +16 -0
- package/dist-types/components/shared/libs/polymorphic.d.ts +2 -2
- package/dist-types/components/shared/libs/recursive-clone-children.d.ts +2 -2
- package/dist-types/components/shared/libs/slot.d.ts +1 -1
- package/dist-types/components/shared/libs/use-controllable-state.d.ts +1 -1
- package/dist-types/components/shared/policy-actions.d.ts +8 -3
- package/dist-types/components/shared/primitives/box.d.ts +3 -1
- package/dist-types/components/shared/primitives/button.d.ts +4 -37
- package/dist-types/components/shared/primitives/button.types.d.ts +3 -1
- package/dist-types/components/shared/primitives/legal-links/index.d.ts +7 -11
- package/dist-types/components/shared/ui/accordion/accordion.d.ts +45 -12
- package/dist-types/components/shared/ui/accordion/accordion.types.d.ts +1 -1
- package/dist-types/components/shared/ui/animated-collapse/animated-collapse.d.ts +1 -1
- package/dist-types/components/shared/ui/branding.d.ts +12 -12
- package/dist-types/components/shared/ui/button/button.d.ts +19 -25
- package/dist-types/components/shared/ui/button/button.types.d.ts +2 -2
- package/dist-types/components/shared/ui/collapsible/collapsible.d.ts +18 -1
- package/dist-types/components/shared/ui/dialog/dialog.d.ts +6 -6
- package/dist-types/components/shared/ui/icon.d.ts +1 -1
- package/dist-types/components/shared/ui/logo.d.ts +0 -21
- package/dist-types/components/shared/ui/preference-item/preference-item.d.ts +46 -2
- package/dist-types/components/shared/ui/switch/switch.d.ts +19 -8
- package/dist-types/components/shared/ui/tabs/tabs.d.ts +19 -2
- package/dist-types/context/iab-context-value.d.ts +37 -0
- package/dist-types/context/index.d.ts +3 -0
- package/dist-types/context/theme-context.d.ts +2 -2
- package/dist-types/context.d.ts +17 -0
- package/dist-types/devtools.d.ts +54 -0
- package/dist-types/draft.d.ts +31 -0
- package/dist-types/external-iab-context.d.ts +29 -0
- package/dist-types/frame.d.ts +1 -0
- package/dist-types/headless.d.ts +12 -8
- package/dist-types/hooks/use-color-scheme.d.ts +1 -1
- package/dist-types/hooks/use-component-config.d.ts +2 -2
- package/dist-types/hooks/use-focus-trap.d.ts +2 -2
- package/dist-types/hooks/use-headless-iab-consent-ui.d.ts +7 -8
- package/dist-types/hooks/use-iab-manager.d.ts +52 -0
- package/dist-types/hooks/use-is-hydrated.d.ts +8 -0
- package/dist-types/hooks/use-reduced-motion.d.ts +1 -1
- package/dist-types/hooks/use-scroll-lock.d.ts +1 -1
- package/dist-types/hooks/use-text-direction.d.ts +1 -1
- package/dist-types/hooks/use-theme.d.ts +2 -1
- package/dist-types/hooks.d.ts +148 -0
- package/dist-types/iab-context.d.ts +28 -0
- package/dist-types/iab.d.ts +14 -8
- package/dist-types/index.d.ts +61 -22
- package/dist-types/module-hooks/iframe-blocker.d.ts +6 -0
- package/dist-types/module-hooks/network-blocker.d.ts +9 -0
- package/dist-types/module-hooks/persistence.d.ts +4 -0
- package/dist-types/module-hooks/script-loader.d.ts +6 -0
- package/dist-types/module-hooks/shared.d.ts +2 -0
- package/dist-types/module-hooks.d.ts +4 -0
- package/dist-types/panel-link.d.ts +1 -0
- package/dist-types/panel-trigger.d.ts +1 -0
- package/dist-types/panel.d.ts +1 -0
- package/dist-types/preferences.d.ts +1 -0
- package/dist-types/prompt.d.ts +1 -0
- package/dist-types/provider.d.ts +149 -0
- package/dist-types/server/fetch-ssr-data.d.ts +2 -2
- package/dist-types/server/headers.d.ts +3 -3
- package/dist-types/server/init-cache-key.d.ts +3 -3
- package/dist-types/server/normalize-url.d.ts +2 -2
- package/dist-types/server/types.d.ts +1 -1
- package/dist-types/theme-provider.d.ts +10 -0
- package/dist-types/transports/offline.d.ts +18 -0
- package/dist-types/types/index.d.ts +3 -0
- package/dist-types/types/manager.d.ts +15 -0
- package/dist-types/types/slots.d.ts +5 -0
- package/dist-types/types/theme/index.d.ts +0 -1
- package/dist-types/types/theme/style-types.d.ts +3 -9
- package/dist-types/ui-config-context.d.ts +9 -0
- package/dist-types/ui-save.d.ts +5 -0
- package/dist-types/utils/cn.d.ts +1 -1
- package/dist-types/utils/default-translation-config.d.ts +6 -0
- package/dist-types/utils/index.d.ts +4 -0
- package/dist-types/utils/merge-slot-props.d.ts +14 -0
- package/dist-types/utils/merge-styles.d.ts +1 -1
- package/dist-types/utils/theme-utils.d.ts +2 -2
- package/dist-types/version.d.ts +1 -1
- package/docs/README.md +89 -141
- package/docs/assets/v3/brand-bar.png +0 -0
- package/docs/assets/v3/brand-card.png +0 -0
- package/docs/assets/v3/choice-wall.png +0 -0
- package/docs/assets/v3/mobile-card.png +0 -0
- package/docs/assets/v3/preferences.png +0 -0
- package/docs/customization/overview.md +45 -0
- package/docs/customization/recipes.md +79 -0
- package/docs/customization/slots.md +55 -0
- package/docs/customization/tokens.md +76 -0
- package/docs/customization/translations.md +49 -0
- package/docs/frameworks/react/components/consent-banner.md +219 -202
- package/docs/frameworks/react/components/consent-dialog-link.md +88 -35
- package/docs/frameworks/react/components/consent-dialog-trigger.md +74 -134
- package/docs/frameworks/react/components/consent-dialog.md +170 -135
- package/docs/frameworks/react/components/consent-manager-provider.md +57 -256
- package/docs/frameworks/react/components/consent-widget.md +154 -118
- package/docs/frameworks/react/components/dev-tools.md +198 -33
- package/docs/frameworks/react/components/frame.md +120 -42
- package/docs/frameworks/react/concepts/consent-categories.md +24 -89
- package/docs/frameworks/react/concepts/policy-presets.md +123 -0
- package/docs/frameworks/react/headless.md +91 -185
- package/docs/frameworks/react/hooks/use-consent-manager/overview.md +39 -153
- package/docs/frameworks/react/iab/overview.md +33 -108
- package/docs/frameworks/react/quickstart.md +116 -112
- package/docs/frameworks/react/script-loader.md +41 -533
- package/docs/frameworks/react/styling/overview.md +168 -253
- package/docs/frameworks/react/troubleshooting.md +47 -119
- package/docs/guides/consent-state.md +60 -0
- package/docs/guides/data-fetching.md +163 -0
- package/docs/guides/deployment-modes.md +63 -0
- package/docs/guides/troubleshooting.md +68 -0
- package/docs/guides/verify-consent.md +62 -0
- package/docs/integrations/adobe-analytics.md +239 -105
- package/docs/integrations/ahrefs-analytics.md +238 -104
- package/docs/integrations/amplitude.md +219 -157
- package/docs/integrations/building-integrations.md +32 -224
- package/docs/integrations/clear-on-revocation.md +167 -0
- package/docs/integrations/clearbit.md +247 -86
- package/docs/integrations/cloudflare-web-analytics.md +250 -84
- package/docs/integrations/crisp.md +251 -97
- package/docs/integrations/databuddy.md +259 -153
- package/docs/integrations/fathom-analytics.md +239 -96
- package/docs/integrations/google-maps.md +328 -207
- package/docs/integrations/google-tag-manager.md +248 -96
- package/docs/integrations/google-tag.md +261 -90
- package/docs/integrations/heap.md +222 -149
- package/docs/integrations/hightouch.md +225 -131
- package/docs/integrations/hotjar.md +239 -90
- package/docs/integrations/intercom.md +239 -98
- package/docs/integrations/linkedin-insights.md +243 -113
- package/docs/integrations/logrocket.md +241 -123
- package/docs/integrations/matomo-analytics.md +256 -111
- package/docs/integrations/meta-pixel.md +197 -324
- package/docs/integrations/microsoft-clarity.md +233 -114
- package/docs/integrations/microsoft-uet.md +245 -110
- package/docs/integrations/mixpanel-analytics.md +252 -87
- package/docs/integrations/openai-pixel.md +441 -0
- package/docs/integrations/overview.md +95 -133
- package/docs/integrations/pirsch.md +249 -96
- package/docs/integrations/plausible-analytics.md +241 -100
- package/docs/integrations/posthog.md +353 -214
- package/docs/integrations/promptwatch.md +251 -81
- package/docs/integrations/reddit-pixel.md +226 -173
- package/docs/integrations/rudderstack.md +244 -187
- package/docs/integrations/rybbit-analytics.md +244 -91
- package/docs/integrations/segment.md +238 -92
- package/docs/integrations/snapchat-pixel.md +240 -110
- package/docs/integrations/tiktok-pixel.md +249 -81
- package/docs/integrations/umami-analytics.md +242 -95
- package/docs/integrations/vercel-analytics.md +242 -90
- package/docs/integrations/x-pixel.md +238 -104
- package/docs/integrations/youtube.md +354 -142
- package/docs/upgrade-v3.md +334 -0
- package/iab/styles.css +1 -1
- package/iab/styles.tw3.css +1 -1
- package/package.json +187 -102
- package/readme.json +1 -1
- package/src/iab/styles.css +1 -1
- package/src/iab/styles.tw3.css +1 -1
- package/src/styles.css +1 -1
- package/src/styles.tw3.css +1 -1
- package/styles.css +1 -1
- package/styles.tw3.css +1 -1
- package/client/components/consent-banner.js +0 -4
- package/client/components/consent-dialog-link.js +0 -3
- package/client/components/consent-dialog-trigger.js +0 -3
- package/client/components/consent-dialog.js +0 -4
- package/client/components/consent-widget.js +0 -4
- package/client/components/frame.js +0 -3
- package/client/components/integrations.js +0 -3
- package/dist/components/consent-banner/atoms/overlay.cjs +0 -1
- package/dist/components/consent-banner/atoms/overlay.js +0 -1
- package/dist/components/consent-banner/atoms/root.cjs +0 -1
- package/dist/components/consent-banner/atoms/root.js +0 -1
- package/dist/components/consent-banner/components.cjs +0 -1
- package/dist/components/consent-banner/components.js +0 -1
- package/dist/components/consent-banner/consent-banner.cjs +0 -1
- package/dist/components/consent-banner/consent-banner.js +0 -1
- package/dist/components/consent-banner/error-boundary.cjs +0 -1
- package/dist/components/consent-banner/error-boundary.js +0 -1
- package/dist/components/consent-banner/index.cjs +0 -1
- package/dist/components/consent-banner/index.js +0 -1
- package/dist/components/consent-banner/policy-actions.cjs +0 -1
- package/dist/components/consent-banner/policy-actions.js +0 -1
- package/dist/components/consent-dialog/atoms/card.cjs +0 -1
- package/dist/components/consent-dialog/atoms/card.js +0 -1
- package/dist/components/consent-dialog/atoms/overlay.cjs +0 -1
- package/dist/components/consent-dialog/atoms/overlay.js +0 -1
- package/dist/components/consent-dialog/atoms/root.cjs +0 -1
- package/dist/components/consent-dialog/atoms/root.js +0 -1
- package/dist/components/consent-dialog/consent-dialog.cjs +0 -1
- package/dist/components/consent-dialog/consent-dialog.js +0 -1
- package/dist/components/consent-dialog/index.cjs +0 -1
- package/dist/components/consent-dialog/index.js +0 -1
- package/dist/components/consent-dialog-link/index.cjs +0 -1
- package/dist/components/consent-dialog-trigger/atoms/button.cjs +0 -1
- package/dist/components/consent-dialog-trigger/atoms/button.js +0 -1
- package/dist/components/consent-dialog-trigger/atoms/icon.cjs +0 -1
- package/dist/components/consent-dialog-trigger/atoms/icon.js +0 -1
- package/dist/components/consent-dialog-trigger/atoms/root.cjs +0 -1
- package/dist/components/consent-dialog-trigger/atoms/root.js +0 -1
- package/dist/components/consent-dialog-trigger/atoms/text.cjs +0 -1
- package/dist/components/consent-dialog-trigger/atoms/text.js +0 -1
- package/dist/components/consent-dialog-trigger/atoms/toolbar.cjs +0 -1
- package/dist/components/consent-dialog-trigger/atoms/toolbar.js +0 -1
- package/dist/components/consent-dialog-trigger/consent-dialog-trigger-toolbar.cjs +0 -1
- package/dist/components/consent-dialog-trigger/consent-dialog-trigger-toolbar.js +0 -1
- package/dist/components/consent-dialog-trigger/consent-dialog-trigger.cjs +0 -1
- package/dist/components/consent-dialog-trigger/consent-dialog-trigger.js +0 -1
- package/dist/components/consent-dialog-trigger/index.cjs +0 -1
- package/dist/components/consent-dialog-trigger/index.js +0 -1
- package/dist/components/consent-dialog-trigger/types.cjs +0 -1
- package/dist/components/consent-dialog-trigger/use-draggable.cjs +0 -1
- package/dist/components/consent-dialog-trigger/use-draggable.js +0 -1
- package/dist/components/consent-preferences-link/consent-preferences-link.cjs +0 -1
- package/dist/components/consent-preferences-link/index.cjs +0 -1
- package/dist/components/consent-widget/atoms/accordion.cjs +0 -1
- package/dist/components/consent-widget/atoms/accordion.js +0 -1
- package/dist/components/consent-widget/atoms/button.cjs +0 -1
- package/dist/components/consent-widget/atoms/button.js +0 -1
- package/dist/components/consent-widget/atoms/footer.cjs +0 -1
- package/dist/components/consent-widget/atoms/footer.js +0 -1
- package/dist/components/consent-widget/atoms/root.cjs +0 -1
- package/dist/components/consent-widget/atoms/root.js +0 -1
- package/dist/components/consent-widget/consent-widget.cjs +0 -1
- package/dist/components/consent-widget/consent-widget.js +0 -1
- package/dist/components/consent-widget/index.cjs +0 -1
- package/dist/components/consent-widget/index.js +0 -1
- package/dist/components/consent-widget/policy-actions.cjs +0 -1
- package/dist/components/consent-widget/policy-actions.js +0 -1
- package/dist/components/consent-widget/types.cjs +0 -1
- package/dist/components/frame/atoms.cjs +0 -1
- package/dist/components/frame/frame.cjs +0 -1
- package/dist/components/frame/index.cjs +0 -1
- package/dist/components/frame/types.cjs +0 -1
- package/dist/components/iab-consent-banner/atoms/button-group.cjs +0 -1
- package/dist/components/iab-consent-banner/atoms/button-group.js +0 -1
- package/dist/components/iab-consent-banner/atoms/card.cjs +0 -1
- package/dist/components/iab-consent-banner/atoms/card.js +0 -1
- package/dist/components/iab-consent-banner/atoms/description.cjs +0 -1
- package/dist/components/iab-consent-banner/atoms/description.js +0 -1
- package/dist/components/iab-consent-banner/atoms/footer.cjs +0 -1
- package/dist/components/iab-consent-banner/atoms/footer.js +0 -1
- package/dist/components/iab-consent-banner/atoms/header.cjs +0 -1
- package/dist/components/iab-consent-banner/atoms/header.js +0 -1
- package/dist/components/iab-consent-banner/atoms/overlay.cjs +0 -1
- package/dist/components/iab-consent-banner/atoms/overlay.js +0 -1
- package/dist/components/iab-consent-banner/atoms/root.cjs +0 -1
- package/dist/components/iab-consent-banner/atoms/root.js +0 -1
- package/dist/components/iab-consent-banner/atoms/title.cjs +0 -1
- package/dist/components/iab-consent-banner/atoms/title.js +0 -1
- package/dist/components/iab-consent-banner/iab-consent-banner.cjs +0 -1
- package/dist/components/iab-consent-banner/iab-consent-banner.js +0 -1
- package/dist/components/iab-consent-banner/index.cjs +0 -1
- package/dist/components/iab-consent-banner/index.js +0 -1
- package/dist/components/iab-consent-dialog/atoms/card.cjs +0 -1
- package/dist/components/iab-consent-dialog/atoms/card.js +0 -1
- package/dist/components/iab-consent-dialog/atoms/content.cjs +0 -1
- package/dist/components/iab-consent-dialog/atoms/content.js +0 -1
- package/dist/components/iab-consent-dialog/atoms/footer.cjs +0 -1
- package/dist/components/iab-consent-dialog/atoms/footer.js +0 -1
- package/dist/components/iab-consent-dialog/atoms/header.cjs +0 -1
- package/dist/components/iab-consent-dialog/atoms/header.js +0 -1
- package/dist/components/iab-consent-dialog/atoms/overlay.cjs +0 -1
- package/dist/components/iab-consent-dialog/atoms/overlay.js +0 -1
- package/dist/components/iab-consent-dialog/atoms/purpose-item.cjs +0 -1
- package/dist/components/iab-consent-dialog/atoms/purpose-item.js +0 -1
- package/dist/components/iab-consent-dialog/atoms/root.cjs +0 -1
- package/dist/components/iab-consent-dialog/atoms/root.js +0 -1
- package/dist/components/iab-consent-dialog/atoms/stack-item.cjs +0 -1
- package/dist/components/iab-consent-dialog/atoms/stack-item.js +0 -1
- package/dist/components/iab-consent-dialog/atoms/tabs.cjs +0 -1
- package/dist/components/iab-consent-dialog/atoms/tabs.js +0 -1
- package/dist/components/iab-consent-dialog/atoms/vendor-list.cjs +0 -1
- package/dist/components/iab-consent-dialog/atoms/vendor-list.js +0 -1
- package/dist/components/iab-consent-dialog/hooks/use-gvl-data.cjs +0 -1
- package/dist/components/iab-consent-dialog/hooks/use-gvl-data.js +0 -1
- package/dist/components/iab-consent-dialog/iab-consent-dialog.cjs +0 -1
- package/dist/components/iab-consent-dialog/iab-consent-dialog.js +0 -1
- package/dist/components/iab-consent-dialog/index.cjs +0 -1
- package/dist/components/iab-consent-dialog/index.js +0 -1
- package/dist/components/iab-consent-dialog/types.cjs +0 -1
- package/dist/components/iab-consent-dialog/use-iab-translations.cjs +0 -1
- package/dist/components/iab-consent-dialog/use-iab-translations.js +0 -1
- package/dist/components/integrations/google-map.cjs +0 -1
- package/dist/components/integrations/google-map.js +0 -1
- package/dist/components/integrations/index.cjs +0 -1
- package/dist/components/integrations/index.js +0 -1
- package/dist/components/integrations/shared.cjs +0 -1
- package/dist/components/integrations/shared.js +0 -1
- package/dist/components/integrations/youtube-embed.cjs +0 -1
- package/dist/components/integrations/youtube-embed.js +0 -1
- package/dist/components/shared/libs/polymorphic.cjs +0 -1
- package/dist/components/shared/libs/recursive-clone-children.cjs +0 -1
- package/dist/components/shared/libs/slot.cjs +0 -1
- package/dist/components/shared/libs/use-controllable-state.cjs +0 -1
- package/dist/components/shared/policy-actions.cjs +0 -1
- package/dist/components/shared/primitives/box.cjs +0 -1
- package/dist/components/shared/primitives/button.cjs +0 -1
- package/dist/components/shared/primitives/button.types.cjs +0 -1
- package/dist/components/shared/primitives/legal-links/index.cjs +0 -1
- package/dist/components/shared/ui/accordion/accordion.cjs +0 -1
- package/dist/components/shared/ui/accordion/accordion.types.cjs +0 -1
- package/dist/components/shared/ui/accordion/index.cjs +0 -1
- package/dist/components/shared/ui/animated-collapse/animated-collapse.cjs +0 -1
- package/dist/components/shared/ui/animated-collapse/index.cjs +0 -1
- package/dist/components/shared/ui/branding.cjs +0 -1
- package/dist/components/shared/ui/button/button.cjs +0 -1
- package/dist/components/shared/ui/button/button.types.cjs +0 -1
- package/dist/components/shared/ui/button/index.cjs +0 -1
- package/dist/components/shared/ui/collapsible/collapsible.cjs +0 -1
- package/dist/components/shared/ui/collapsible/index.cjs +0 -1
- package/dist/components/shared/ui/dialog/dialog.cjs +0 -1
- package/dist/components/shared/ui/dialog/index.cjs +0 -1
- package/dist/components/shared/ui/icon.cjs +0 -1
- package/dist/components/shared/ui/logo.cjs +0 -1
- package/dist/components/shared/ui/preference-item/index.cjs +0 -1
- package/dist/components/shared/ui/preference-item/preference-item.cjs +0 -1
- package/dist/components/shared/ui/switch/index.cjs +0 -1
- package/dist/components/shared/ui/switch/switch.cjs +0 -1
- package/dist/components/shared/ui/switch/switch.types.cjs +0 -1
- package/dist/components/shared/ui/tabs/index.cjs +0 -1
- package/dist/components/shared/ui/tabs/tabs.cjs +0 -1
- package/dist/context/consent-manager-context.cjs +0 -1
- package/dist/context/consent-manager-context.js +0 -1
- package/dist/context/consent-tracking-context.cjs +0 -1
- package/dist/context/theme-context.cjs +0 -1
- package/dist/headless.cjs +0 -1
- package/dist/hooks/index.cjs +0 -1
- package/dist/hooks/index.js +0 -1
- package/dist/hooks/use-color-scheme.cjs +0 -1
- package/dist/hooks/use-component-config.cjs +0 -1
- package/dist/hooks/use-consent-dialog-trigger.cjs +0 -1
- package/dist/hooks/use-consent-dialog-trigger.js +0 -1
- package/dist/hooks/use-consent-manager.cjs +0 -1
- package/dist/hooks/use-consent-manager.js +0 -1
- package/dist/hooks/use-consent-script.cjs +0 -1
- package/dist/hooks/use-consent-script.js +0 -1
- package/dist/hooks/use-focus-trap.cjs +0 -1
- package/dist/hooks/use-headless-consent-ui.cjs +0 -1
- package/dist/hooks/use-headless-consent-ui.js +0 -1
- package/dist/hooks/use-headless-iab-consent-ui.cjs +0 -1
- package/dist/hooks/use-reduced-motion.cjs +0 -1
- package/dist/hooks/use-scroll-lock.cjs +0 -1
- package/dist/hooks/use-ssr-status.cjs +0 -1
- package/dist/hooks/use-ssr-status.js +0 -1
- package/dist/hooks/use-styles.cjs +0 -1
- package/dist/hooks/use-styles.js +0 -1
- package/dist/hooks/use-text-direction.cjs +0 -1
- package/dist/hooks/use-theme.cjs +0 -1
- package/dist/hooks/use-translations.cjs +0 -1
- package/dist/hooks/use-translations.js +0 -1
- package/dist/iab.cjs +0 -1
- package/dist/index.cjs +0 -1
- package/dist/primitives/accordion.cjs +0 -1
- package/dist/primitives/button.cjs +0 -1
- package/dist/primitives/collapsible.cjs +0 -1
- package/dist/primitives/dialog.cjs +0 -1
- package/dist/primitives/preference-item.cjs +0 -1
- package/dist/primitives/switch.cjs +0 -1
- package/dist/primitives/tabs.cjs +0 -1
- package/dist/primitives.cjs +0 -1
- package/dist/providers/consent-manager-provider.cjs +0 -1
- package/dist/providers/consent-manager-provider.js +0 -1
- package/dist/server/fetch-ssr-data.cjs +0 -1
- package/dist/server/headers.cjs +0 -1
- package/dist/server/index.cjs +0 -1
- package/dist/server/init-cache-key.cjs +0 -1
- package/dist/server/normalize-url.cjs +0 -1
- package/dist/server/types.cjs +0 -1
- package/dist/types/consent-manager.cjs +0 -1
- package/dist/types/theme/index.cjs +0 -1
- package/dist/types/theme/style-keys.cjs +0 -1
- package/dist/types/theme/style-types.cjs +0 -1
- package/dist/utils/cn.cjs +0 -1
- package/dist/utils/merge-styles.cjs +0 -1
- package/dist/utils/test-helpers.cjs +0 -1
- package/dist/utils/test-helpers.js +0 -1
- package/dist/utils/theme-utils.cjs +0 -1
- package/dist/version.cjs +0 -1
- package/dist-types/components/consent-banner/atoms/root.d.ts +0 -126
- package/dist-types/components/consent-banner/policy-actions.d.ts +0 -11
- package/dist-types/components/consent-widget/policy-actions.d.ts +0 -11
- package/dist-types/components/iab-consent-dialog/hooks/use-gvl-data.d.ts +0 -27
- package/dist-types/components/iab-consent-dialog/types.d.ts +0 -72
- package/dist-types/components/integrations/google-map.d.ts +0 -82
- package/dist-types/components/integrations/index.d.ts +0 -2
- package/dist-types/components/integrations/shared.d.ts +0 -12
- package/dist-types/components/integrations/youtube-embed.d.ts +0 -95
- package/dist-types/context/consent-manager-context.d.ts +0 -31
- package/dist-types/hooks/index.d.ts +0 -12
- package/dist-types/hooks/use-consent-dialog-trigger.d.ts +0 -10
- package/dist-types/hooks/use-consent-manager.d.ts +0 -27
- package/dist-types/hooks/use-consent-script.d.ts +0 -80
- package/dist-types/hooks/use-headless-consent-ui.d.ts +0 -46
- package/dist-types/hooks/use-ssr-status.d.ts +0 -57
- package/dist-types/hooks/use-styles.d.ts +0 -21
- package/dist-types/hooks/use-translations.d.ts +0 -28
- package/dist-types/providers/consent-manager-provider.d.ts +0 -40
- package/dist-types/types/consent-manager.d.ts +0 -39
- package/dist-types/types/theme/style-keys.d.ts +0 -1
- package/dist-types/utils/test-helpers.d.ts +0 -31
- package/docs/frameworks/react/building-headless-components.md +0 -370
- package/docs/frameworks/react/callbacks.md +0 -186
- package/docs/frameworks/react/concepts/client-modes.md +0 -177
- package/docs/frameworks/react/concepts/consent-models.md +0 -113
- package/docs/frameworks/react/concepts/cookie-management.md +0 -122
- package/docs/frameworks/react/concepts/glossary.md +0 -24
- package/docs/frameworks/react/concepts/initialization-flow.md +0 -149
- package/docs/frameworks/react/concepts/policy-packs.md +0 -228
- package/docs/frameworks/react/hooks/use-color-scheme.md +0 -41
- package/docs/frameworks/react/hooks/use-consent-manager/checking-consent.md +0 -96
- package/docs/frameworks/react/hooks/use-consent-manager/location-info.md +0 -97
- package/docs/frameworks/react/hooks/use-consent-manager/setting-consent.md +0 -94
- package/docs/frameworks/react/hooks/use-draggable.md +0 -59
- package/docs/frameworks/react/hooks/use-focus-trap.md +0 -42
- package/docs/frameworks/react/hooks/use-reduced-motion.md +0 -37
- package/docs/frameworks/react/hooks/use-ssr-status.md +0 -32
- package/docs/frameworks/react/hooks/use-text-direction.md +0 -50
- package/docs/frameworks/react/hooks/use-translations.md +0 -55
- package/docs/frameworks/react/iab/consent-banner.md +0 -91
- package/docs/frameworks/react/iab/consent-dialog.md +0 -129
- package/docs/frameworks/react/iab/use-gvl-data.md +0 -21
- package/docs/frameworks/react/iframe-blocking.md +0 -106
- package/docs/frameworks/react/internationalization.md +0 -207
- package/docs/frameworks/react/network-blocker.md +0 -140
- package/docs/frameworks/react/optimization.md +0 -148
- package/docs/frameworks/react/policy-packs.md +0 -242
- package/docs/frameworks/react/server-side.md +0 -158
- package/docs/frameworks/react/styling/classnames.md +0 -94
- package/docs/frameworks/react/styling/color-scheme.md +0 -84
- package/docs/frameworks/react/styling/css-variables.md +0 -53
- package/docs/frameworks/react/styling/slots.md +0 -94
- package/docs/frameworks/react/styling/tailwind.md +0 -119
- package/docs/frameworks/react/styling/tokens.md +0 -156
- package/docs/shared/concepts/client-modes.md +0 -103
- package/docs/shared/concepts/consent-categories.md +0 -41
- package/docs/shared/concepts/consent-models.md +0 -72
- package/docs/shared/concepts/cookie-management.md +0 -88
- package/docs/shared/concepts/glossary.md +0 -24
- package/docs/shared/concepts/initialization-flow.md +0 -105
- package/docs/shared/concepts/policy-packs.md +0 -225
- package/docs/shared/react/components/consent-banner.md +0 -242
- package/docs/shared/react/components/consent-dialog-link.md +0 -45
- package/docs/shared/react/components/consent-dialog-trigger.md +0 -185
- package/docs/shared/react/components/consent-dialog.md +0 -119
- package/docs/shared/react/components/consent-manager-provider.md +0 -225
- package/docs/shared/react/components/consent-widget.md +0 -121
- package/docs/shared/react/components/dev-tools.md +0 -81
- package/docs/shared/react/components/frame.md +0 -52
- package/docs/shared/react/guides/building-headless-components.md +0 -110
- package/docs/shared/react/guides/callbacks.md +0 -89
- package/docs/shared/react/guides/headless.md +0 -31
- package/docs/shared/react/guides/iframe-blocking.md +0 -65
- package/docs/shared/react/guides/internationalization.md +0 -123
- package/docs/shared/react/guides/network-blocker.md +0 -72
- package/docs/shared/react/guides/optimization.md +0 -44
- package/docs/shared/react/guides/policy-packs.md +0 -173
- package/docs/shared/react/guides/script-loader.md +0 -311
- package/docs/shared/react/hooks/use-color-scheme.md +0 -31
- package/docs/shared/react/hooks/use-consent-manager/checking-consent.md +0 -95
- package/docs/shared/react/hooks/use-consent-manager/location-info.md +0 -96
- package/docs/shared/react/hooks/use-consent-manager/overview.md +0 -74
- package/docs/shared/react/hooks/use-consent-manager/setting-consent.md +0 -93
- package/docs/shared/react/hooks/use-draggable.md +0 -30
- package/docs/shared/react/hooks/use-focus-trap.md +0 -20
- package/docs/shared/react/hooks/use-reduced-motion.md +0 -33
- package/docs/shared/react/hooks/use-ssr-status.md +0 -16
- package/docs/shared/react/hooks/use-text-direction.md +0 -38
- package/docs/shared/react/hooks/use-translations.md +0 -15
- package/docs/shared/react/iab/consent-banner.md +0 -60
- package/docs/shared/react/iab/consent-dialog.md +0 -76
- package/docs/shared/react/iab/overview.md +0 -80
- package/docs/shared/react/iab/use-gvl-data.md +0 -21
- package/docs/shared/react/styling/classnames.md +0 -93
- package/docs/shared/react/styling/color-scheme.md +0 -35
- package/docs/shared/react/styling/css-variables.md +0 -53
- package/docs/shared/react/styling/overview.md +0 -261
- package/docs/shared/react/styling/slots.md +0 -93
- package/docs/shared/react/styling/stylesheet-entrypoint.md +0 -8
- package/docs/shared/react/styling/tailwind.md +0 -88
- package/docs/shared/react/styling/tokens.md +0 -155
- package/docs/shared/troubleshooting.md +0 -82
- /package/dist/components/{consent-dialog-trigger → iab-panel}/types.js +0 -0
- /package/dist/components/{consent-widget → panel-trigger}/types.js +0 -0
- /package/dist/components/{iab-consent-dialog → preferences}/types.js +0 -0
- /package/dist/types/{consent-manager.js → manager.js} +0 -0
- /package/dist/types/{theme/style-keys.js → slots.js} +0 -0
- /package/dist-types/components/{consent-dialog-link → panel-link}/index.d.ts +0 -0
- /package/dist-types/components/{consent-widget → preferences}/atoms/button.d.ts +0 -0
- /package/dist-types/components/{consent-widget/consent-widget.d.ts → preferences/preferences.d.ts} +0 -0
- /package/dist-types/components/{consent-widget → preferences}/types.d.ts +0 -0
|
@@ -1,258 +1,275 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: ConsentBanner
|
|
3
|
-
description:
|
|
4
|
-
needed. Supports policy-aware layout, theming, and advanced composition when
|
|
5
|
-
markup must change.
|
|
3
|
+
description: Pre-built consent banner shown when consent is required.
|
|
6
4
|
group: frameworks
|
|
7
5
|
---
|
|
8
|
-
`ConsentBanner` is a ready-to-use consent banner that appears automatically in **opt-in jurisdictions** (like GDPR) where explicit consent is required before tracking. In opt-out jurisdictions (like CCPA), the banner won't appear — users get an opt-out mechanism instead. It includes reject, accept, and customize buttons with configurable layout.
|
|
9
6
|
|
|
10
|
-
##
|
|
7
|
+
## Usage
|
|
11
8
|
|
|
12
9
|
```tsx
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
10
|
+
import { ConsentBanner, ConsentDialog, ConsentProvider, offline } from 'c15t/react';
|
|
11
|
+
import { policyRulePresets } from '@c15t/schema';
|
|
12
|
+
|
|
13
|
+
const mode = offline({ policyRules: [policyRulePresets.europeOptIn()] });
|
|
14
|
+
|
|
15
|
+
export function Consent({ children }: { children: React.ReactNode }) {
|
|
16
|
+
return (
|
|
17
|
+
<ConsentProvider options={{ mode }}>
|
|
18
|
+
{children}
|
|
19
|
+
<ConsentBanner />
|
|
20
|
+
<ConsentDialog />
|
|
21
|
+
</ConsentProvider>
|
|
22
|
+
);
|
|
21
23
|
}
|
|
22
24
|
```
|
|
23
25
|
|
|
24
|
-
|
|
26
|
+
The banner renders whatever the active policy rule requires. It reads the rule
|
|
27
|
+
through the provider, so the same component serves every region:
|
|
28
|
+
|
|
29
|
+
* A `choice` prompt shows the actions the rule allows: reject and accept at
|
|
30
|
+
equal prominence, plus customize when the rule offers it.
|
|
31
|
+
* A `notice` prompt shows an "OK" button and a button styled as
|
|
32
|
+
underlined text, labeled "Do not sell or share my data". The latter opens
|
|
33
|
+
preferences. A notice never traps focus or locks scroll.
|
|
34
|
+
* A rule with `prompt: 'none'` renders nothing.
|
|
35
|
+
|
|
36
|
+
An opt-out rule with `prompt: 'none'` still has rights, so the preference
|
|
37
|
+
center and the dialog trigger stay available as the route to preferences. A
|
|
38
|
+
rule with `model: 'none'` owes no rights, so nothing renders unless you add
|
|
39
|
+
`rights: ['preferences']`. With no resolved rule at all, because resolution
|
|
40
|
+
failed, no rule matched and you set no default, or init is still withheld, no
|
|
41
|
+
consent surface renders: not the banner, the dialog, the widget, the
|
|
42
|
+
preferences link, or the trigger. They appear as soon as a rule resolves,
|
|
43
|
+
without a remount. `offline()` without `policyRules` resolves the recommended
|
|
44
|
+
pack, so it shows the strict opt-in banner until you pass a country.
|
|
45
|
+
|
|
46
|
+
Acknowledging a notice records its dismissal. It does not record consent or
|
|
47
|
+
change category permissions, including existing denials and privacy-signal
|
|
48
|
+
restrictions. Customize the label through `common.acknowledge` in your
|
|
49
|
+
translations, or use `dismissButtonText` for one banner.
|
|
50
|
+
|
|
51
|
+
The additional preferences button uses the opt-out label when appropriate.
|
|
52
|
+
A choice prompt without Customize renders a "Manage preferences" button.
|
|
53
|
+
Both are button elements that open the preference center; CSS gives them
|
|
54
|
+
an underlined text appearance. They do not submit an opt-out by themselves.
|
|
55
|
+
|
|
56
|
+
`preferenceControls` recommends these extra buttons for the stock UI.
|
|
57
|
+
It does not verify disclosure or access to rights. Configure your legal links
|
|
58
|
+
and keep preferences reachable after the banner closes.
|
|
25
59
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
```tsx
|
|
29
|
-
{/* Default: reject and accept grouped, customize separate */}
|
|
30
|
-
<ConsentBanner layout={[['reject', 'accept'], 'customize']} />
|
|
31
|
-
|
|
32
|
-
{/* All buttons in one group */}
|
|
33
|
-
<ConsentBanner layout={[['reject', 'customize', 'accept']]} />
|
|
34
|
-
|
|
35
|
-
{/* Accept first, then reject and customize grouped */}
|
|
36
|
-
<ConsentBanner layout={['accept', ['reject', 'customize']]} />
|
|
37
|
-
```
|
|
60
|
+
## Props
|
|
38
61
|
|
|
39
|
-
|
|
62
|
+
| Prop | Type | Default | Description |
|
|
63
|
+
| --------------------- | --------------------------------------------- | -------------------- | ---------------------------------------------------------------------------------------------------- |
|
|
64
|
+
| `title` | `ReactNode` | translation | Overrides the title. Under a notice the default is `cookieBanner.noticeTitle`. |
|
|
65
|
+
| `description` | `ReactNode` | translation | Overrides the description. Under a notice the default is `cookieBanner.noticeDescription`. |
|
|
66
|
+
| `acceptButtonText` | `ReactNode` | `common.acceptAll` | Accept label. |
|
|
67
|
+
| `rejectButtonText` | `ReactNode` | `common.rejectAll` | Reject label. |
|
|
68
|
+
| `customizeButtonText` | `ReactNode` | `common.customize` | Customize label. |
|
|
69
|
+
| `dismissButtonText` | `ReactNode` | `common.acknowledge` | Label of the notice acknowledgement. |
|
|
70
|
+
| `variant` | `PromptVariant` | `floating` | Shape of the prompt. See [Variants](#variants). |
|
|
71
|
+
| `position` | `PromptPosition` | per variant | Where the prompt sits. Must be valid for the variant. |
|
|
72
|
+
| `blocking` | `boolean` | `true` on `wall` | Backdrop, scroll lock, focus trap, and no outside dismissal, as one value. |
|
|
73
|
+
| `layout` | `ConsentBannerLayout` | policy default | Orders and groups actions. Required actions the layout omits are restored. |
|
|
74
|
+
| `primaryButton` | `ConsentBannerButton \|ConsentBannerButton[]` | `'customize'` | Which actions get the primary treatment. On a notice, dismiss is primary when it is the only action. |
|
|
75
|
+
| `direction` | `'row' \|'column'` | `'row'` | How action groups flow. |
|
|
76
|
+
| `legalLinks` | `(keyof LegalLinks)[] \|null` | none | Which configured legal links render inline. |
|
|
77
|
+
| `hideBranding` | `boolean` | `false` | Hides the "Secured by" tag. |
|
|
78
|
+
| `scrollLock` | `boolean` | unset | Deprecated. Use `blocking` to control scrolling, focus and backdrop together. |
|
|
79
|
+
| `trapFocus` | `boolean` | unset | Deprecated. Use `blocking`. |
|
|
80
|
+
| `disableAnimation` | `boolean` | `false` | Skips enter and exit animations. |
|
|
81
|
+
| `noStyle` | `boolean` | `false` | Removes the built-in styling from every part. |
|
|
82
|
+
|
|
83
|
+
## Per-policy buttons
|
|
84
|
+
|
|
85
|
+
The default already makes Customize primary on a choice banner and OK
|
|
86
|
+
primary on a notice. To set button order and treatment for specific rules,
|
|
87
|
+
read the active policy inside the provider:
|
|
40
88
|
|
|
41
89
|
```tsx
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
90
|
+
import { ConsentBanner, usePolicyRule } from 'c15t/react';
|
|
91
|
+
import type { ConsentBannerProps } from 'c15t/react';
|
|
92
|
+
|
|
93
|
+
const banners: Record<
|
|
94
|
+
string,
|
|
95
|
+
Pick<ConsentBannerProps, 'layout' | 'primaryButton' | 'variant'>
|
|
96
|
+
> = {
|
|
97
|
+
europe_opt_in: {
|
|
98
|
+
layout: [['reject', 'accept'], 'customize'],
|
|
99
|
+
primaryButton: 'customize',
|
|
100
|
+
},
|
|
101
|
+
us_privacy_states: {
|
|
102
|
+
layout: ['dismiss'],
|
|
103
|
+
primaryButton: 'dismiss',
|
|
104
|
+
variant: 'bar',
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export function RegionalBanner() {
|
|
109
|
+
const policy = usePolicyRule();
|
|
110
|
+
return <ConsentBanner {...(policy ? banners[policy.id] : undefined)} />;
|
|
111
|
+
}
|
|
46
112
|
```
|
|
47
113
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
theme: {
|
|
64
|
-
consentActions: {
|
|
65
|
-
default: { mode: 'stroke' },
|
|
66
|
-
accept: { variant: 'primary', mode: 'stroke' },
|
|
67
|
-
customize: { variant: 'neutral', mode: 'ghost' },
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
}}
|
|
71
|
-
>
|
|
72
|
-
<ConsentBanner />
|
|
73
|
-
</ConsentManagerProvider>
|
|
114
|
+
Render `RegionalBanner` inside `ConsentProvider`. The layout controls the
|
|
115
|
+
action groups; the opt-out preferences button still appears on a notice.
|
|
116
|
+
Required actions omitted from a layout are restored. Accept and Reject
|
|
117
|
+
keep equivalent default prominence.
|
|
118
|
+
|
|
119
|
+
Choose one brand color and make whichever action is primary use a filled
|
|
120
|
+
button through the provider's theme:
|
|
121
|
+
|
|
122
|
+
```ts
|
|
123
|
+
const theme = {
|
|
124
|
+
colors: { primary: '#2f6f4e', primaryHover: '#24563c' },
|
|
125
|
+
consentActions: {
|
|
126
|
+
primary: { variant: 'primary', mode: 'filled' },
|
|
127
|
+
},
|
|
128
|
+
} as const;
|
|
74
129
|
```
|
|
75
130
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
131
|
+
Pass `theme` in `ConsentProvider` options. Per-action theme overrides such
|
|
132
|
+
as `consentActions.dismiss` take precedence over this primary style.
|
|
133
|
+
See [Styling](../styling/overview.md) for tokens and slots, and
|
|
134
|
+
[Policy presets](../concepts/policy-presets.md) for the rule IDs and coverage.
|
|
79
135
|
|
|
80
|
-
|
|
81
|
-
> For pure theming, stay inside the pre-built banner. Start with layout props, theme.consentActions, design tokens, and theme.slots before reaching for compound components. See Styling Overview.
|
|
136
|
+
## Variants
|
|
82
137
|
|
|
83
|
-
The
|
|
138
|
+
The policy decides which actions the banner offers. The variant decides the
|
|
139
|
+
shape those actions take. Both come from the same component, so a bar for a
|
|
140
|
+
notice region and a card for an opt-in region need no extra components.
|
|
84
141
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
* Card, footer, and title tweaks -> `theme.slots.consentBannerCard`, `consentBannerFooter`, and `consentBannerTitle`
|
|
142
|
+
Set the variant on the banner, or on the provider under
|
|
143
|
+
`presentation.prompt` when every banner should share it. The prop wins.
|
|
88
144
|
|
|
89
145
|
```tsx
|
|
90
|
-
<
|
|
91
|
-
options={{
|
|
92
|
-
theme: {
|
|
93
|
-
colors: {
|
|
94
|
-
surface: '#fffdf8',
|
|
95
|
-
surfaceHover: '#f6f3ee',
|
|
96
|
-
},
|
|
97
|
-
slots: {
|
|
98
|
-
consentBannerCard: 'rounded-[28px] shadow-xl',
|
|
99
|
-
consentBannerFooter: 'border-t border-black/10 px-6',
|
|
100
|
-
consentBannerTitle: 'tracking-tight',
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
}}
|
|
104
|
-
>
|
|
105
|
-
<ConsentBanner />
|
|
106
|
-
</ConsentManagerProvider>
|
|
146
|
+
<ConsentBanner variant="floating" position="bottom-center" />
|
|
107
147
|
```
|
|
108
148
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
Highlight specific button(s) as the primary action:
|
|
149
|
+
A floating card in a corner or centered on an edge. This is the default for
|
|
150
|
+
every prompt. A notice keeps the same card, with its right link and "OK" in the footer.
|
|
112
151
|
|
|
113
152
|
```tsx
|
|
114
|
-
|
|
115
|
-
<ConsentBanner primaryButton="accept" />
|
|
116
|
-
|
|
117
|
-
{/* Multiple primaries */}
|
|
118
|
-
<ConsentBanner primaryButton={['accept', 'customize']} />
|
|
153
|
+
<ConsentBanner variant="bar" position="top" />
|
|
119
154
|
```
|
|
120
155
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
156
|
+
A bar across the full width of the viewport. From 1024px wide the text, the
|
|
157
|
+
right links, and the controls share one row. Opt in to it for regions that
|
|
158
|
+
expect a classic cookie bar.
|
|
124
159
|
|
|
125
160
|
```tsx
|
|
126
|
-
|
|
127
|
-
<ConsentBanner legalLinks={undefined} />
|
|
128
|
-
|
|
129
|
-
{/* Show no links */}
|
|
130
|
-
<ConsentBanner legalLinks={null} />
|
|
131
|
-
|
|
132
|
-
{/* Show specific links */}
|
|
133
|
-
<ConsentBanner legalLinks={['privacyPolicy', 'cookiePolicy']} />
|
|
161
|
+
<ConsentBanner variant="widget" position="bottom-right" />
|
|
134
162
|
```
|
|
135
163
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
## Customizing Copy
|
|
140
|
-
|
|
141
|
-
Prefer provider `i18n` when you want to rename the stock banner content:
|
|
164
|
+
A compact card with smaller type. The full description and its legal links
|
|
165
|
+
remain visible. Pair it with a short notice.
|
|
142
166
|
|
|
143
167
|
```tsx
|
|
144
|
-
<
|
|
145
|
-
options={{
|
|
146
|
-
i18n: {
|
|
147
|
-
locale: 'en',
|
|
148
|
-
messages: {
|
|
149
|
-
en: {
|
|
150
|
-
cookieBanner: {
|
|
151
|
-
title: 'We value your privacy',
|
|
152
|
-
description: 'We use cookies to improve the site and measure performance.',
|
|
153
|
-
},
|
|
154
|
-
common: {
|
|
155
|
-
acceptAll: 'Accept all',
|
|
156
|
-
rejectAll: 'Reject all',
|
|
157
|
-
customize: 'Manage preferences',
|
|
158
|
-
},
|
|
159
|
-
},
|
|
160
|
-
},
|
|
161
|
-
},
|
|
162
|
-
}}
|
|
163
|
-
>
|
|
164
|
-
<ConsentBanner />
|
|
165
|
-
</ConsentManagerProvider>
|
|
168
|
+
<ConsentBanner variant="wall" />
|
|
166
169
|
```
|
|
167
170
|
|
|
168
|
-
|
|
171
|
+
A centered card over a backdrop that blocks the page until the visitor
|
|
172
|
+
answers. A wall is always blocking.
|
|
169
173
|
|
|
170
|
-
|
|
174
|
+
Each variant accepts its own positions:
|
|
171
175
|
|
|
172
|
-
|
|
176
|
+
| Variant | Positions | Default |
|
|
177
|
+
| ---------- | ------------------------------------------------------------------------------------- | -------------- |
|
|
178
|
+
| `floating` | `bottom-left`, `bottom-right`, `top-left`, `top-right`, `bottom-center`, `top-center` | `bottom-left` |
|
|
179
|
+
| `bar` | `top`, `bottom` | `bottom` |
|
|
180
|
+
| `widget` | `bottom-left`, `bottom-right`, `top-left`, `top-right` | `bottom-right` |
|
|
181
|
+
| `wall` | `center` | `center` |
|
|
173
182
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
<ConsentBanner.Header>
|
|
179
|
-
<ConsentBanner.Title />
|
|
180
|
-
<ConsentBanner.Description />
|
|
181
|
-
</ConsentBanner.Header>
|
|
182
|
-
<ConsentBanner.PolicyActions />
|
|
183
|
-
</ConsentBanner.Card>
|
|
184
|
-
</ConsentBanner.Root>
|
|
185
|
-
```
|
|
183
|
+
A default corner mirrors left and right for right-to-left languages. A
|
|
184
|
+
position you set is never mirrored. A position that is not valid for the
|
|
185
|
+
variant falls back to the default and logs an `invalid-position` diagnostic
|
|
186
|
+
in development.
|
|
186
187
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
* `ConsentBanner.Description` — Description text, supports `legalLinks` prop
|
|
192
|
-
* `ConsentBanner.PolicyActions` — Renders policy-aware grouped actions inside the banner footer
|
|
193
|
-
* `ConsentBanner.Footer` — Action buttons container
|
|
194
|
-
* `ConsentBanner.FooterSubGroup` — Groups related buttons together
|
|
195
|
-
* `ConsentBanner.RejectButton` — Rejects all consent
|
|
196
|
-
* `ConsentBanner.CustomizeButton` — Opens the consent dialog
|
|
197
|
-
* `ConsentBanner.AcceptButton` — Accepts all consent
|
|
198
|
-
* `ConsentBanner.Overlay` — Optional backdrop overlay
|
|
199
|
-
|
|
200
|
-
For a fixed layout that intentionally ignores policy grouping, render the footer manually:
|
|
188
|
+
`blocking` controls the backdrop, scroll lock, and focus trap together.
|
|
189
|
+
An explicit value overrides the deprecated `scrollLock` and `trapFocus`
|
|
190
|
+
options. Without `blocking`, either legacy option set to `false` selects
|
|
191
|
+
non-blocking behavior; otherwise a legacy `true` selects blocking behavior.
|
|
201
192
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
<ConsentBanner.Title />
|
|
207
|
-
<ConsentBanner.Description />
|
|
208
|
-
</ConsentBanner.Header>
|
|
209
|
-
<ConsentBanner.Footer>
|
|
210
|
-
<ConsentBanner.FooterSubGroup>
|
|
211
|
-
<ConsentBanner.RejectButton />
|
|
212
|
-
<ConsentBanner.AcceptButton />
|
|
213
|
-
</ConsentBanner.FooterSubGroup>
|
|
214
|
-
<ConsentBanner.CustomizeButton />
|
|
215
|
-
</ConsentBanner.Footer>
|
|
216
|
-
</ConsentBanner.Card>
|
|
217
|
-
</ConsentBanner.Root>
|
|
218
|
-
```
|
|
193
|
+
A choice `wall` always blocks. Notices always stay non-blocking, and asking
|
|
194
|
+
for a notice `wall` falls back to `floating` with an `invalid-variant`
|
|
195
|
+
diagnostic. Blocking banners carry `role="dialog"` and `aria-modal="true"`.
|
|
196
|
+
Non-blocking banners leave page controls usable by keyboard and pointer.
|
|
219
197
|
|
|
220
|
-
|
|
198
|
+
`PromptVariant` and `PromptPosition` are exported from `c15t/react`.
|
|
199
|
+
Compound parts can read the resolved shape with `useConsentBannerSurface()`,
|
|
200
|
+
which returns `variant`, `position`, `positionSource` (`host` or `default`),
|
|
201
|
+
and `blocking`.
|
|
221
202
|
|
|
222
|
-
|
|
203
|
+
## Composition
|
|
204
|
+
|
|
205
|
+
Every part is available as `ConsentBanner.<Part>` for custom layouts. The
|
|
206
|
+
parts read the same policy state the pre-built banner does, so a custom layout
|
|
207
|
+
still gets the right actions for the active rule.
|
|
223
208
|
|
|
224
209
|
```tsx
|
|
225
|
-
|
|
210
|
+
import { ConsentBanner } from 'c15t/react';
|
|
211
|
+
|
|
212
|
+
export function CompactBanner() {
|
|
213
|
+
return (
|
|
214
|
+
<ConsentBanner.Root>
|
|
215
|
+
<ConsentBanner.Card>
|
|
216
|
+
<ConsentBanner.Header>
|
|
217
|
+
<ConsentBanner.Title />
|
|
218
|
+
<ConsentBanner.Description />
|
|
219
|
+
</ConsentBanner.Header>
|
|
220
|
+
<ConsentBanner.PolicyActions />
|
|
221
|
+
</ConsentBanner.Card>
|
|
222
|
+
</ConsentBanner.Root>
|
|
223
|
+
);
|
|
224
|
+
}
|
|
226
225
|
```
|
|
227
226
|
|
|
228
|
-
`
|
|
227
|
+
`ConsentBanner.PolicyActions` renders the resolved action groups and, before
|
|
228
|
+
them, the additional preferences buttons. Pass children to replace those
|
|
229
|
+
buttons while retaining the policy action groups. This supports custom labels
|
|
230
|
+
and button markup.
|
|
231
|
+
|
|
232
|
+
Use the individual parts when you need a different order or your own markup:
|
|
233
|
+
|
|
234
|
+
* `ConsentBanner.AcceptButton`, `ConsentBanner.RejectButton`,
|
|
235
|
+
`ConsentBanner.CustomizeButton`, and `ConsentBanner.DismissButton` render one
|
|
236
|
+
action each. `DismissButton` defaults its label to `common.acknowledge`.
|
|
237
|
+
* `ConsentBanner.Rights` renders the additional preferences buttons. It
|
|
238
|
+
renders nothing when the list is empty. Pass `rights` to override the
|
|
239
|
+
list.
|
|
240
|
+
* `ConsentBanner.RightLink` renders a single right. `right` is `'opt-out'`
|
|
241
|
+
or `'preferences'`. By default it is a button element styled as an
|
|
242
|
+
underlined text link, carrying `data-action="right"` and `data-right`; it
|
|
243
|
+
opens the preference center on click and accepts `asChild` to render your
|
|
244
|
+
own element, such as an anchor to a dedicated opt-out page.
|
|
229
245
|
|
|
230
246
|
```tsx
|
|
231
|
-
<ConsentBanner.
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
case 'accept':
|
|
237
|
-
return <ConsentBanner.AcceptButton key={key} {...buttonProps} />
|
|
238
|
-
case 'reject':
|
|
239
|
-
return <ConsentBanner.RejectButton key={key} {...buttonProps} />
|
|
240
|
-
case 'customize':
|
|
241
|
-
return <ConsentBanner.CustomizeButton key={key} {...buttonProps} />
|
|
242
|
-
}
|
|
243
|
-
}}
|
|
244
|
-
/>
|
|
247
|
+
<ConsentBanner.Rights>
|
|
248
|
+
<ConsentBanner.RightLink right="opt-out" asChild>
|
|
249
|
+
<a href="/privacy/do-not-sell">Do not sell or share my data</a>
|
|
250
|
+
</ConsentBanner.RightLink>
|
|
251
|
+
</ConsentBanner.Rights>
|
|
245
252
|
```
|
|
246
253
|
|
|
247
|
-
`
|
|
254
|
+
`useBannerCopy()` returns the title, description, and prompt kind the banner
|
|
255
|
+
would use, for custom headers that still follow the notice copy.
|
|
248
256
|
|
|
249
|
-
|
|
257
|
+
## Data attributes
|
|
250
258
|
|
|
251
|
-
|
|
259
|
+
The root element carries attributes you can target from CSS or Tailwind. The
|
|
260
|
+
card carries `data-state` (`open` or `closed`) for the enter and exit
|
|
261
|
+
animations.
|
|
252
262
|
|
|
253
|
-
|
|
|
254
|
-
|
|
255
|
-
|
|
|
256
|
-
|
|
|
263
|
+
| Attribute | Values |
|
|
264
|
+
| --------------- | ------------------------------------- |
|
|
265
|
+
| `data-prompt` | `choice`, `notice` |
|
|
266
|
+
| `data-model` | `opt-in`, `opt-out`, `iab` |
|
|
267
|
+
| `data-variant` | `floating`, `bar`, `widget`, `wall` |
|
|
268
|
+
| `data-position` | The resolved position for the variant |
|
|
269
|
+
| `data-blocking` | `true`, present only while blocking |
|
|
257
270
|
|
|
258
|
-
|
|
271
|
+
Each action button carries `data-action`, and each right link carries
|
|
272
|
+
`data-action="right"` plus `data-right`. The built-in stylesheet keys every
|
|
273
|
+
variant's geometry on `data-variant` and `data-position`, and uses
|
|
274
|
+
`data-prompt="notice"` to lay the footer out as one row with the right
|
|
275
|
+
links leading and "OK" trailing.
|
|
@@ -1,62 +1,115 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: ConsentDialogLink
|
|
3
|
-
description:
|
|
4
|
-
|
|
3
|
+
description: Add a ConsentDialogLink to a React footer so visitors reopen the
|
|
4
|
+
c15t preference center from your own text link, with asChild and rights data.
|
|
5
5
|
group: frameworks
|
|
6
6
|
---
|
|
7
|
-
`ConsentDialogLink` is an inline trigger for opening the consent dialog from places like site footers, legal pages, or account settings. It is unstyled by default, so it inherits your app's typography and link/button styles.
|
|
8
7
|
|
|
9
|
-
##
|
|
8
|
+
## Reopen the preference center from your footer
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
`ConsentDialogLink` is an unstyled button that opens the consent dialog.
|
|
11
|
+
Put it where your site already keeps its legal links, so preferences stay
|
|
12
|
+
reachable after the banner closes. It needs a mounted `ConsentDialog` in the
|
|
13
|
+
same `ConsentProvider`; the [quickstart](../quickstart.md) mounts both.
|
|
14
|
+
|
|
15
|
+
```tsx title="src/site-footer.tsx"
|
|
16
|
+
import { ConsentDialogLink } from 'c15t/react';
|
|
13
17
|
|
|
14
18
|
export function SiteFooter() {
|
|
15
19
|
return (
|
|
16
20
|
<footer>
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
<nav aria-label="Legal">
|
|
22
|
+
<a href="/privacy">Privacy policy</a>
|
|
23
|
+
<a href="/terms">Terms</a>
|
|
24
|
+
<ConsentDialogLink className="footer-link">Privacy settings</ConsentDialogLink>
|
|
25
|
+
</nav>
|
|
20
26
|
</footer>
|
|
21
27
|
);
|
|
22
28
|
}
|
|
23
29
|
```
|
|
24
30
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
<ConsentDialogLink>
|
|
30
|
-
Your privacy settings
|
|
31
|
-
</ConsentDialogLink>
|
|
32
|
-
</footer>
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
## Render as an Anchor
|
|
31
|
+
Render `SiteFooter` inside the `Consent` wrapper from your quickstart so the
|
|
32
|
+
link can reach the provider. It renders a `button`, so the CSS for
|
|
33
|
+
`.footer-link` should reset button chrome if your footer styles target
|
|
34
|
+
anchors only.
|
|
36
35
|
|
|
37
|
-
|
|
36
|
+
To reuse an existing link component, pass `asChild`:
|
|
38
37
|
|
|
39
38
|
```tsx
|
|
40
39
|
<ConsentDialogLink asChild>
|
|
41
|
-
<a href="#
|
|
40
|
+
<a href="#cookie-preferences">Manage cookies</a>
|
|
42
41
|
</ConsentDialogLink>
|
|
43
42
|
```
|
|
44
43
|
|
|
45
|
-
##
|
|
44
|
+
## Props
|
|
46
45
|
|
|
47
|
-
|
|
46
|
+
| Prop | Type | Default | Description |
|
|
47
|
+
| ---------- | ----------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
48
|
+
| `children` | `ReactNode` | required | The visible label, such as "Privacy settings" or "Manage preferences". It is also the accessible name. |
|
|
49
|
+
| `asChild` | `boolean` | `false` | Renders your own element, such as an anchor, instead of a `button`, and attaches the click handler to it. |
|
|
50
|
+
| `noStyle` | `boolean` | `true` | Omits c15t button classes. Native browser styles remain unless your CSS resets them. Pass `false` to render it as a consent button with `variant` and `mode`. |
|
|
51
|
+
| `onClick` | `(event) => void` | none | Runs before the dialog opens. Call `event.preventDefault()` to keep it closed. |
|
|
48
52
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
Privacy Settings
|
|
52
|
-
</ConsentDialogLink>
|
|
53
|
-
```
|
|
53
|
+
Other `button` attributes such as `className`, `style`, `id` and `aria-*`
|
|
54
|
+
pass through to the rendered element.
|
|
54
55
|
|
|
55
|
-
##
|
|
56
|
+
## Behavior
|
|
57
|
+
|
|
58
|
+
`ConsentDialogLink` renders a `button` with `type="button"` and no c15t
|
|
59
|
+
styling by default. Clicking it makes `dialog` the active surface, which opens a
|
|
60
|
+
mounted `ConsentDialog`. It performs no save and does not change any
|
|
61
|
+
permission.
|
|
62
|
+
|
|
63
|
+
The element carries `data-c15t-rights` listing the rights of the active
|
|
64
|
+
policy rule, for example `disclosure opt-out preferences` under a US
|
|
65
|
+
opt-out rule and `disclosure preferences` under an opt-in rule, so a
|
|
66
|
+
stylesheet or a `::after` label can adapt the wording by region.
|
|
67
|
+
|
|
68
|
+
Without a resolved policy rule the link renders nothing and appears as soon
|
|
69
|
+
as a rule resolves, without a remount. A rule with `model: 'none'` and an
|
|
70
|
+
empty `rights` list owes no consent UI, so the link hides under it; a `none`
|
|
71
|
+
rule that lists any right, such as `['disclosure']`, shows the link and the
|
|
72
|
+
dialog opens as a settings route.
|
|
73
|
+
|
|
74
|
+
Mount exactly one `ConsentDialog` inside the same provider. If none is
|
|
75
|
+
mounted, the click still switches the active surface: nothing opens, and a
|
|
76
|
+
banner that was showing closes because the surface is no longer `banner`.
|
|
77
|
+
|
|
78
|
+
With `asChild`, the child's own `onClick` runs first; if it calls
|
|
79
|
+
`event.preventDefault()` the dialog stays closed. c15t does not prevent the
|
|
80
|
+
child's native behavior, so an anchor still follows its `href`. Use a
|
|
81
|
+
fragment or the current page as the destination, or render a `button`.
|
|
82
|
+
|
|
83
|
+
### ConsentDialogLink or ConsentDialogTrigger
|
|
84
|
+
|
|
85
|
+
Both open the same dialog and carry `data-c15t-rights`. Use
|
|
86
|
+
`ConsentDialogLink` where the control belongs in your own layout: a footer,
|
|
87
|
+
a privacy page, a settings menu. It has no position, icon or visibility
|
|
88
|
+
rule of its own. Use `ConsentDialogTrigger` when you want a floating,
|
|
89
|
+
draggable button that positions itself in a corner and can wait until the
|
|
90
|
+
prompt is answered.
|
|
91
|
+
|
|
92
|
+
`ConsentDialogTrigger` has its own page: [ConsentDialogTrigger](./consent-dialog-trigger.md).
|
|
93
|
+
|
|
94
|
+
## Accessibility
|
|
95
|
+
|
|
96
|
+
The rendered `button` is keyboard-focusable and activates with Enter and
|
|
97
|
+
Space; its accessible name is the text you pass as `children`, so give it
|
|
98
|
+
words that describe the destination rather than "click here". Because the
|
|
99
|
+
dialog it opens is labelled by its own title and, while blocking, returns
|
|
100
|
+
focus to the link on close, no additional `aria-haspopup` or
|
|
101
|
+
`aria-controls` is added; a non-blocking dialog manages no focus, so the
|
|
102
|
+
link does not regain it. With `asChild`,
|
|
103
|
+
focusability comes from your element: use a `button` or an anchor with an
|
|
104
|
+
`href`.
|
|
56
105
|
|
|
57
|
-
|
|
58
|
-
|:--|:--|
|
|
59
|
-
|Type Name|\`ConsentDialogLinkProps\`|
|
|
60
|
-
|Source Path|\`./packages/react/src/components/consent-preferences-link/consent-preferences-link.tsx\`|
|
|
106
|
+
## Verify
|
|
61
107
|
|
|
62
|
-
|
|
108
|
+
Scroll to the footer. With the footer button reset applied, the link uses
|
|
109
|
+
your footer's text styles and has no button chrome. Activate it with a click or with Enter: the preference
|
|
110
|
+
center opens as a centered dialog. Close it with Escape: with the default
|
|
111
|
+
blocking dialog, focus returns to the link. In your browser's element
|
|
112
|
+
inspector the link has
|
|
113
|
+
`data-c15t-rights`; change the visitor's region to a US opt-out rule and
|
|
114
|
+
the value includes `opt-out`. Under a rule with `model: 'none'` and no
|
|
115
|
+
rights, the link is absent.
|