@c15t/react 2.2.0 → 3.0.0-alpha.0
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 +88 -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 +133 -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 +173 -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 +144 -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 +88 -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 +41 -249
- 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 +35 -535
- package/docs/frameworks/react/styling/overview.md +160 -255
- 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/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,44 +1,60 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: ConsentDialogTrigger
|
|
3
|
-
description:
|
|
4
|
-
|
|
3
|
+
description: Floating button and toolbar that reopen the preference center after
|
|
4
|
+
the first prompt.
|
|
5
5
|
group: frameworks
|
|
6
6
|
---
|
|
7
|
-
`ConsentDialogTrigger` is a floating button that opens the consent dialog when clicked. Users can drag it to any corner of the screen, and the position persists across sessions. Use it to give users a persistent way to manage their privacy settings.
|
|
8
7
|
|
|
9
|
-
##
|
|
8
|
+
## Usage
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
`ConsentDialogTrigger` is a draggable floating button that opens the preference center. Place it once, next to the banner and dialog, so visitors can revisit their choices without a footer link.
|
|
12
11
|
|
|
13
12
|
```tsx
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
import {
|
|
14
|
+
ConsentBanner,
|
|
15
|
+
ConsentDialog,
|
|
16
|
+
ConsentDialogTrigger,
|
|
17
|
+
ConsentProvider,
|
|
18
|
+
offline,
|
|
19
|
+
} from 'c15t/react';
|
|
20
|
+
import { policyRulePresets } from '@c15t/schema';
|
|
21
|
+
|
|
22
|
+
const mode = offline({ policyRules: [policyRulePresets.europeOptIn()] });
|
|
23
|
+
|
|
24
|
+
export function App() {
|
|
25
|
+
return (
|
|
26
|
+
<ConsentProvider options={{ mode }}>
|
|
27
|
+
<ConsentBanner />
|
|
28
|
+
<ConsentDialog />
|
|
29
|
+
<ConsentDialogTrigger showWhen="after-prompt" />
|
|
30
|
+
</ConsentProvider>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
21
33
|
```
|
|
22
34
|
|
|
23
|
-
|
|
35
|
+
`showWhen="after-prompt"` keeps the button out of the way while a choice or notice is still owed and shows it once the visitor has answered, so the banner and the trigger never compete for the same corner. The default, `always`, shows it whenever the preference center is closed.
|
|
24
36
|
|
|
25
|
-
|
|
37
|
+
The button carries `data-c15t-rights` with the rights the active policy guarantees, so a stylesheet can label it differently under an opt-out rule.
|
|
26
38
|
|
|
27
|
-
|
|
28
|
-
{/* Built-in icons */}
|
|
29
|
-
<ConsentDialogTrigger icon="branding" /> {/* c15t logo (default) */}
|
|
30
|
-
<ConsentDialogTrigger icon="fingerprint" /> {/* Privacy icon */}
|
|
31
|
-
<ConsentDialogTrigger icon="settings" /> {/* Gear icon */}
|
|
39
|
+
## Props
|
|
32
40
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
41
|
+
| Prop | Type | Default | Description |
|
|
42
|
+
| ----------------- | ----------------------------------------------------------- | ------------------------- | ----------------------------------------------------------------------------------- |
|
|
43
|
+
| `icon` | `'branding' \|'fingerprint' \|'settings' \|ReactNode` | `'branding'` | Icon rendered inside the button. |
|
|
44
|
+
| `defaultPosition` | `'bottom-left' \|'bottom-right' \|'top-left' \|'top-right'` | `'bottom-right'` | Corner the button starts in. |
|
|
45
|
+
| `persistPosition` | `boolean` | `true` | Remember the corner the visitor dragged it to. |
|
|
46
|
+
| `showWhen` | `'always' \|'after-prompt' \|'never'` | `'always'` | When the button is visible. `after-prompt` waits until no choice or notice is owed. |
|
|
47
|
+
| `size` | `'sm' \|'md' \|'lg'` | `'md'` | Button size. |
|
|
48
|
+
| `ariaLabel` | `string` | `'Open privacy settings'` | Accessible name. |
|
|
49
|
+
| `noStyle` | `boolean` | `false` | Remove the default styling. |
|
|
36
50
|
|
|
37
|
-
## Configurable
|
|
51
|
+
## Configurable toolbar
|
|
38
52
|
|
|
39
|
-
Use
|
|
53
|
+
Use `ConsentDialogTriggerToolbar` when you want app-owned controls beside the privacy trigger. It always renders exactly one built-in action that opens the preference center, so `actions` only holds controls your app owns.
|
|
40
54
|
|
|
41
55
|
```tsx
|
|
56
|
+
import { ConsentDialogTriggerToolbar } from 'c15t/react';
|
|
57
|
+
|
|
42
58
|
<ConsentDialogTriggerToolbar
|
|
43
59
|
ariaLabel="Site controls"
|
|
44
60
|
actions={[
|
|
@@ -63,36 +79,53 @@ Use the separate `ConsentDialogTriggerToolbar` when you want to place app-owned
|
|
|
63
79
|
/>
|
|
64
80
|
```
|
|
65
81
|
|
|
66
|
-
Each custom action
|
|
82
|
+
Each custom action needs a stable `id`, an accessible `label`, an `icon`, and an `onSelect` callback. Use `pressed` for toggle actions and `disabled` for unavailable ones. Your app owns the state behind each action. The preferences action moves to the edge nearest the toolbar's snapped corner while custom actions keep their configured order.
|
|
83
|
+
|
|
84
|
+
The toolbar does not depend on the consent policy. Your actions always render, so a theme toggle stays available while a banner is up. On the toolbar, `showWhen` applies only to the built-in preferences action: `after-prompt` hides that one item while a choice or notice is owed and shows it once the visitor has answered, and `never` leaves it out. The toolbar renders nothing only when it has no visible item. On the single `ConsentDialogTrigger`, `showWhen` applies to the whole control.
|
|
67
85
|
|
|
68
|
-
|
|
86
|
+
No policy, no UI. When no rule has resolved, because resolution failed, no rule matched and you set no default, or init is still withheld, the built-in preferences action and the single `ConsentDialogTrigger` render nothing; app-owned toolbar actions still do. They appear as soon as a rule resolves, without a remount. A rule with `model: 'none'` owes no rights, so the built-in action and the single trigger hide under it too, unless the rule adds `rights: ['preferences']`. The policy chooses what the control says, you choose where and when it sits, and it disappears only when there is nothing to manage.
|
|
87
|
+
|
|
88
|
+
The built-in action names the strongest right the active rule guarantees. Under a rule that carries the `opt-out` right, such as a US opt-out notice, its accessible name is the translated "Do not sell or share my data" and the button carries `data-right="opt-out"`. Under any other rule it reads "Manage preferences" with `data-right="preferences"`. Either way it opens the preference center, and a `preferences.label` you pass replaces the default. The button also carries `data-c15t-rights` with every right on the rule.
|
|
89
|
+
|
|
90
|
+
Toolbars are horizontal by default. Set `orientation="vertical"` to stack the actions and switch arrow-key navigation to up and down:
|
|
69
91
|
|
|
70
92
|
```tsx
|
|
71
|
-
<ConsentDialogTriggerToolbar
|
|
72
|
-
orientation="vertical"
|
|
73
|
-
actions={toolbarActions}
|
|
74
|
-
/>
|
|
93
|
+
<ConsentDialogTriggerToolbar orientation="vertical" actions={toolbarActions} />
|
|
75
94
|
```
|
|
76
95
|
|
|
77
|
-
### Toolbar
|
|
96
|
+
### Toolbar props
|
|
97
|
+
|
|
98
|
+
| Prop | Type | Default | Description |
|
|
99
|
+
| ----------------- | ---------------------------------------- | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
100
|
+
| `actions` | `ConsentDialogTriggerToolbarAction[]` | `[]` | App-owned actions rendered beside the preferences action. |
|
|
101
|
+
| `preferences` | `ConsentDialogTriggerToolbarPreferences` | `{}` | Overrides for the built-in action: `icon`, `label`, `onSelect`, `className`, `style`. The label defaults to the opt-out or preferences right on the active rule. |
|
|
102
|
+
| `orientation` | `'horizontal' \|'vertical'` | `'horizontal'` | Layout direction. |
|
|
103
|
+
| `defaultPosition` | `CornerPosition` | `'bottom-right'` | Corner the toolbar starts in. |
|
|
104
|
+
| `persistPosition` | `boolean` | `true` | Remember the dragged corner. |
|
|
105
|
+
| `showWhen` | `'always' \|'after-prompt' \|'never'` | `'always'` | When the built-in preferences action is visible. App-owned actions always render. `after-prompt` waits until no choice or notice is owed. |
|
|
106
|
+
| `size` | `'sm' \|'md' \|'lg'` | `'md'` | Size of each action. |
|
|
107
|
+
| `ariaLabel` | `string` | `'Privacy controls'` | Accessible name for the toolbar group. |
|
|
108
|
+
| `noStyle` | `boolean` | `false` | Remove the default styling. |
|
|
109
|
+
|
|
110
|
+
### Toolbar styling
|
|
78
111
|
|
|
79
|
-
The toolbar follows the standard
|
|
112
|
+
The toolbar follows the standard precedence: bundled styles, then provider slots, then direct `className` and `style` on the toolbar or on one action. Use `noStyle` for a fully custom implementation.
|
|
80
113
|
|
|
81
114
|
```tsx
|
|
82
|
-
<
|
|
115
|
+
<ConsentProvider
|
|
83
116
|
options={{
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
117
|
+
mode: offline({ policyRules: [policyRulePresets.europeOptIn()] }),
|
|
118
|
+
components: {
|
|
119
|
+
trigger: {
|
|
120
|
+
toolbar: { className: 'my-toolbar' },
|
|
121
|
+
toolbarItem: { className: 'my-toolbar-item' },
|
|
122
|
+
toolbarIcon: { className: 'my-toolbar-icon' },
|
|
89
123
|
},
|
|
90
124
|
},
|
|
91
125
|
}}
|
|
92
126
|
>
|
|
93
127
|
<ConsentDialogTriggerToolbar
|
|
94
128
|
className="fixed-toolbar"
|
|
95
|
-
style={{ '--cdtt-offset': '24px' }}
|
|
96
129
|
actions={[
|
|
97
130
|
{
|
|
98
131
|
id: 'support',
|
|
@@ -103,100 +136,7 @@ The toolbar follows the standard styling precedence: internal CSS module styles,
|
|
|
103
136
|
},
|
|
104
137
|
]}
|
|
105
138
|
/>
|
|
106
|
-
</
|
|
139
|
+
</ConsentProvider>
|
|
107
140
|
```
|
|
108
141
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
With `noStyle`, use `data-corner`, `data-dragging`, and `data-snapping` on the toolbar to style its current position and interaction state.
|
|
112
|
-
|
|
113
|
-
## Visibility
|
|
114
|
-
|
|
115
|
-
Control when the trigger is visible:
|
|
116
|
-
|
|
117
|
-
```tsx
|
|
118
|
-
{/* Always visible (default) */}
|
|
119
|
-
<ConsentDialogTrigger showWhen="always" />
|
|
120
|
-
|
|
121
|
-
{/* Only after user has made a consent choice */}
|
|
122
|
-
<ConsentDialogTrigger showWhen="after-consent" />
|
|
123
|
-
|
|
124
|
-
{/* Hidden (control visibility programmatically) */}
|
|
125
|
-
<ConsentDialogTrigger showWhen="never" />
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
## Position
|
|
129
|
-
|
|
130
|
-
Set the default corner and control persistence:
|
|
131
|
-
|
|
132
|
-
```tsx
|
|
133
|
-
<ConsentDialogTrigger
|
|
134
|
-
defaultPosition="bottom-left"
|
|
135
|
-
persistPosition={true} // Remembers user's drag position
|
|
136
|
-
onPositionChange={(position) => console.log('Moved to:', position)}
|
|
137
|
-
/>
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
## Size
|
|
141
|
-
|
|
142
|
-
```tsx
|
|
143
|
-
<ConsentDialogTrigger size="sm" /> {/* Small */}
|
|
144
|
-
<ConsentDialogTrigger size="md" /> {/* Medium (default) */}
|
|
145
|
-
<ConsentDialogTrigger size="lg" /> {/* Large */}
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
## Compound Components
|
|
149
|
-
|
|
150
|
-
Build fully custom trigger layouts using sub-components:
|
|
151
|
-
|
|
152
|
-
```tsx
|
|
153
|
-
<ConsentDialogTrigger.Root defaultPosition="bottom-right">
|
|
154
|
-
<ConsentDialogTrigger.Button size="md">
|
|
155
|
-
<ConsentDialogTrigger.Icon icon="settings" />
|
|
156
|
-
<ConsentDialogTrigger.Text>Privacy</ConsentDialogTrigger.Text>
|
|
157
|
-
</ConsentDialogTrigger.Button>
|
|
158
|
-
</ConsentDialogTrigger.Root>
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
* `ConsentDialogTrigger.Root` — Portal wrapper with drag handling and position persistence
|
|
162
|
-
* `ConsentDialogTrigger.Button` — Draggable button element with size variants
|
|
163
|
-
* `ConsentDialogTrigger.Icon` — Icon display (branding, fingerprint, settings, or custom)
|
|
164
|
-
* `ConsentDialogTrigger.Text` — Optional text label
|
|
165
|
-
|
|
166
|
-
## Props
|
|
167
|
-
|
|
168
|
-
### ConsentDialogTrigger
|
|
169
|
-
|
|
170
|
-
|Property|Value|
|
|
171
|
-
|:--|:--|
|
|
172
|
-
|Type Name|\`ConsentDialogTriggerProps\`|
|
|
173
|
-
|Source Path|\`./packages/react/src/components/consent-dialog-trigger/types.ts\`|
|
|
174
|
-
|
|
175
|
-
\*ExtractedTypeTable: Could not extract "ConsentDialogTriggerProps" from "./packages/react/src/components/consent-dialog-trigger/types.ts" using base path "/home/runner/work/c15t/c15t". Verify the path/name and that the file is included by your tsconfig.\*
|
|
176
|
-
|
|
177
|
-
### ConsentDialogTriggerToolbar
|
|
178
|
-
|
|
179
|
-
|Property|Value|
|
|
180
|
-
|:--|:--|
|
|
181
|
-
|Type Name|\`ConsentDialogTriggerToolbarProps\`|
|
|
182
|
-
|Source Path|\`./packages/react/src/components/consent-dialog-trigger/types.ts\`|
|
|
183
|
-
|
|
184
|
-
\*ExtractedTypeTable: Could not extract "ConsentDialogTriggerToolbarProps" from "./packages/react/src/components/consent-dialog-trigger/types.ts" using base path "/home/runner/work/c15t/c15t". Verify the path/name and that the file is included by your tsconfig.\*
|
|
185
|
-
|
|
186
|
-
### Toolbar Actions
|
|
187
|
-
|
|
188
|
-
|Property|Value|
|
|
189
|
-
|:--|:--|
|
|
190
|
-
|Type Name|\`ConsentDialogTriggerToolbarAction\`|
|
|
191
|
-
|Source Path|\`./packages/react/src/components/consent-dialog-trigger/types.ts\`|
|
|
192
|
-
|
|
193
|
-
\*ExtractedTypeTable: Could not extract "ConsentDialogTriggerToolbarAction" from "./packages/react/src/components/consent-dialog-trigger/types.ts" using base path "/home/runner/work/c15t/c15t". Verify the path/name and that the file is included by your tsconfig.\*
|
|
194
|
-
|
|
195
|
-
### Preferences Action
|
|
196
|
-
|
|
197
|
-
|Property|Value|
|
|
198
|
-
|:--|:--|
|
|
199
|
-
|Type Name|\`ConsentDialogTriggerToolbarPreferences\`|
|
|
200
|
-
|Source Path|\`./packages/react/src/components/consent-dialog-trigger/types.ts\`|
|
|
201
|
-
|
|
202
|
-
\*ExtractedTypeTable: Could not extract "ConsentDialogTriggerToolbarPreferences" from "./packages/react/src/components/consent-dialog-trigger/types.ts" using base path "/home/runner/work/c15t/c15t". Verify the path/name and that the file is included by your tsconfig.\*
|
|
142
|
+
The toolbar slot keys are `trigger.toolbar`, `trigger.toolbarItem`, and `trigger.toolbarIcon`. With `noStyle`, style the current position and interaction state through `data-corner`, `data-dragging`, and `data-snapping` on the toolbar element.
|
|
@@ -1,169 +1,204 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: ConsentDialog
|
|
3
|
-
description:
|
|
3
|
+
description: Open the c15t preference center as a modal ConsentDialog in a React
|
|
4
|
+
app, wire its triggers and control blocking, focus and policy gating.
|
|
4
5
|
group: frameworks
|
|
5
6
|
---
|
|
6
|
-
`ConsentDialog` is a modal that shows toggles for each consent category. In **opt-in jurisdictions**, it typically opens when users click "Customize" on `ConsentBanner`. It can also be controlled programmatically for use on settings pages regardless of jurisdiction.
|
|
7
7
|
|
|
8
|
-
##
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
## Open the preference center
|
|
9
|
+
|
|
10
|
+
`ConsentDialog` is the modal preference center. Mount it once inside
|
|
11
|
+
`ConsentProvider`, next to the banner, and it opens whenever something makes
|
|
12
|
+
`dialog` the active surface: the banner's Customize button, a
|
|
13
|
+
`ConsentDialogLink` in your footer, a `ConsentDialogTrigger`, or your own
|
|
14
|
+
code.
|
|
15
|
+
|
|
16
|
+
```tsx title="src/consent.tsx"
|
|
17
|
+
import type { ReactNode } from 'react';
|
|
18
|
+
import {
|
|
19
|
+
ConsentBanner,
|
|
20
|
+
ConsentDialog,
|
|
21
|
+
ConsentDialogLink,
|
|
22
|
+
ConsentProvider,
|
|
23
|
+
hosted,
|
|
24
|
+
} from 'c15t/react';
|
|
25
|
+
import 'c15t/react/styles.css';
|
|
26
|
+
|
|
27
|
+
const backendURL = import.meta.env.VITE_C15T_BACKEND_URL;
|
|
28
|
+
if (!backendURL) throw new Error('Set VITE_C15T_BACKEND_URL');
|
|
29
|
+
const mode = hosted({ url: backendURL });
|
|
30
|
+
|
|
31
|
+
export function Consent({ children }: { children: ReactNode }) {
|
|
14
32
|
return (
|
|
15
|
-
<
|
|
33
|
+
<ConsentProvider options={{ mode }}>
|
|
34
|
+
{children}
|
|
16
35
|
<ConsentBanner />
|
|
17
|
-
<ConsentDialog />
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
## Controlled State
|
|
24
|
-
|
|
25
|
-
By default, the dialog follows `activeUI === 'dialog'` from the consent store. Use the `open` prop for manual control:
|
|
26
|
-
|
|
27
|
-
```tsx
|
|
28
|
-
import { useState } from 'react';
|
|
29
|
-
|
|
30
|
-
function SettingsPage() {
|
|
31
|
-
const [open, setOpen] = useState(false);
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<>
|
|
35
|
-
<button onClick={() => setOpen(true)}>Privacy Settings</button>
|
|
36
|
-
<ConsentDialog open={open} />
|
|
37
|
-
</>
|
|
36
|
+
<ConsentDialog hideBranding />
|
|
37
|
+
<footer>
|
|
38
|
+
<ConsentDialogLink>Privacy settings</ConsentDialogLink>
|
|
39
|
+
</footer>
|
|
40
|
+
</ConsentProvider>
|
|
38
41
|
);
|
|
39
42
|
}
|
|
40
43
|
```
|
|
41
44
|
|
|
42
|
-
|
|
45
|
+
To open it from your own component, set the active surface:
|
|
43
46
|
|
|
44
47
|
```tsx
|
|
45
|
-
import {
|
|
46
|
-
|
|
47
|
-
function PrivacyLink() {
|
|
48
|
-
const { setActiveUI } = useConsentManager();
|
|
48
|
+
import { useSetActiveUI } from 'c15t/react';
|
|
49
49
|
|
|
50
|
+
export function PrivacyMenuItem() {
|
|
51
|
+
const setActiveUI = useSetActiveUI();
|
|
50
52
|
return (
|
|
51
|
-
<button onClick={() => setActiveUI('dialog')}>
|
|
52
|
-
|
|
53
|
+
<button type="button" onClick={() => setActiveUI('dialog')}>
|
|
54
|
+
Cookie preferences
|
|
53
55
|
</button>
|
|
54
56
|
);
|
|
55
57
|
}
|
|
56
58
|
```
|
|
57
59
|
|
|
58
|
-
|
|
60
|
+
`ConsentDialogLink` does the same with the policy's rights exposed for
|
|
61
|
+
styling; see [ConsentDialogLink](./consent-dialog-link.md). For a floating
|
|
62
|
+
button, see [ConsentDialogTrigger](./consent-dialog-trigger.md). Under an IAB
|
|
63
|
+
policy, mount `IABConsentDialog` from the [IAB guide](../iab/overview.md)
|
|
64
|
+
instead; this dialog stays closed for the `iab` model.
|
|
59
65
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
```tsx
|
|
63
|
-
{/* Default trigger */}
|
|
64
|
-
<ConsentDialog showTrigger />
|
|
65
|
-
|
|
66
|
-
{/* Custom trigger */}
|
|
67
|
-
<ConsentDialog
|
|
68
|
-
showTrigger={{
|
|
69
|
-
icon: 'settings',
|
|
70
|
-
defaultPosition: 'bottom-left',
|
|
71
|
-
showWhen: 'after-consent',
|
|
72
|
-
size: 'sm',
|
|
73
|
-
}}
|
|
74
|
-
/>
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
## Branding
|
|
78
|
-
|
|
79
|
-
Hide the c15t branding tag:
|
|
80
|
-
|
|
81
|
-
```tsx
|
|
82
|
-
<ConsentDialog hideBranding />
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
## Styling First
|
|
86
|
-
|
|
87
|
-
> ℹ️ **Info:**
|
|
88
|
-
> If you are only changing visuals, stay with the stock dialog and use the theme system first. Start with tokens and slots such as consentDialogCard, consentWidgetFooter, and consentDialogTag. See Styling Overview.
|
|
89
|
-
|
|
90
|
-
```tsx
|
|
91
|
-
<ConsentManagerProvider
|
|
92
|
-
options={{
|
|
93
|
-
theme: {
|
|
94
|
-
colors: {
|
|
95
|
-
surface: '#fffdf8',
|
|
96
|
-
surfaceHover: '#f6f3ee',
|
|
97
|
-
},
|
|
98
|
-
slots: {
|
|
99
|
-
consentDialogCard: 'rounded-[32px] shadow-xl',
|
|
100
|
-
consentDialogHeader: 'gap-3',
|
|
101
|
-
consentWidgetFooter: 'gap-3 pt-6',
|
|
102
|
-
consentDialogTag: 'shadow-none',
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
}}
|
|
106
|
-
>
|
|
107
|
-
<ConsentDialog />
|
|
108
|
-
</ConsentManagerProvider>
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
Dialog copy should be changed through `ConsentManagerProvider.options.i18n`, not by rebuilding the dialog structure.
|
|
112
|
-
|
|
113
|
-
## Advanced: Compound Components
|
|
66
|
+
## Props
|
|
114
67
|
|
|
115
|
-
|
|
68
|
+
| Prop | Type | Default | Description |
|
|
69
|
+
| ------------------------- | ------------------------------------- | ------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
70
|
+
| `open` | `boolean` | follows the active surface | Controls the open state. When set, Escape and the dialog's own Save, Accept all and Reject all buttons no longer close it; change the prop instead. A missing policy or an unlisted model still keeps it closed. |
|
|
71
|
+
| `showTrigger` | `boolean \|ConsentDialogTriggerProps` | `false` | Renders a floating `ConsentDialogTrigger` next to the dialog. Pass an object to configure that trigger. |
|
|
72
|
+
| `models` | `Model[]` | `['opt-in', 'opt-out', 'none']` | Policy models the dialog responds to. Under a model that is not listed, such as `iab`, it stays closed. |
|
|
73
|
+
| `legalLinks` | `(keyof LegalLinks)[] \|null` | none | Which of the links configured in the provider `options.legalLinks` render after the description. Omitting the prop renders none. `null` hides them. |
|
|
74
|
+
| `hideBranding` | `boolean` | `false` | Hides the "Secured by" tag in the card. |
|
|
75
|
+
| `uiSource` | `string` | `'dialog'` | Source identifier recorded with saves made from this dialog. |
|
|
76
|
+
| `scrollLock`, `trapFocus` | `boolean` | from `blocking` | Deprecated. Either one set to `false` makes the dialog non-blocking, unless the provider sets `presentation.preferences.blocking` explicitly, which wins. Prefer the provider option. |
|
|
77
|
+
| `disableAnimation` | `boolean` | `false` | Skips the enter and exit animation of the backdrop and the card. |
|
|
78
|
+
| `noStyle` | `boolean` | `false` | Removes the built-in styling from every part. |
|
|
79
|
+
|
|
80
|
+
## Behavior
|
|
81
|
+
|
|
82
|
+
The dialog is a modal wrapper around the preference center. Its card has a
|
|
83
|
+
header with the title `consentManagerDialog.title` and the description
|
|
84
|
+
`consentManagerDialog.description` followed by the legal links, then the
|
|
85
|
+
same category accordion and Reject all, Accept all and Save actions that
|
|
86
|
+
`ConsentWidget` renders, then the branding tag. It mounts through a portal
|
|
87
|
+
into `document.body` after hydration, so it is never part of the server
|
|
88
|
+
HTML.
|
|
89
|
+
|
|
90
|
+
Without an `open` prop, the dialog follows the active surface and opens while
|
|
91
|
+
it is `dialog`. These set that surface:
|
|
92
|
+
|
|
93
|
+
* The Customize button on a `ConsentBanner`, and the "Manage preferences"
|
|
94
|
+
or "Do not sell or share my data" button a notice renders.
|
|
95
|
+
* `ConsentDialogLink` and `ConsentDialogTrigger`.
|
|
96
|
+
* The button in a `Frame` placeholder.
|
|
97
|
+
* `useSetActiveUI()('dialog')` in your own component, or `openDialog()`
|
|
98
|
+
from `useHeadlessConsentUI()` on the headless subpath.
|
|
99
|
+
|
|
100
|
+
The component code is split into its own chunk. It downloads when the
|
|
101
|
+
dialog first opens or when a visitor hovers or focuses a Customize button,
|
|
102
|
+
and renders nothing until that chunk is ready. Passing `open={true}` or
|
|
103
|
+
`showTrigger` loads it on mount.
|
|
104
|
+
|
|
105
|
+
Without an `open` prop, Escape closes the dialog. Save, Accept all and
|
|
106
|
+
Reject all close it after the save succeeds; a save that fails keeps it
|
|
107
|
+
open. With `open={true}`, these actions leave the dialog visible; the
|
|
108
|
+
parent must set `open={false}` to close it. Clicking the backdrop does not
|
|
109
|
+
close it. Closing discards toggles that were not saved: the next open starts
|
|
110
|
+
from the recorded choice again. After a save from an uncontrolled dialog,
|
|
111
|
+
every consent surface hides unless the policy still owes a prompt, in which
|
|
112
|
+
case the banner returns.
|
|
113
|
+
|
|
114
|
+
The preference center is blocking by default: a backdrop, body scroll lock
|
|
115
|
+
and focus trap, all as one value. Set `presentation.preferences.blocking`
|
|
116
|
+
to `false` in the provider options to remove all three; the deprecated
|
|
117
|
+
`scrollLock` and `trapFocus` props do the same for one dialog. `variant`
|
|
118
|
+
and `position` are prompt options. Setting them under
|
|
119
|
+
`presentation.preferences` logs an `invalid-variant` diagnostic in
|
|
120
|
+
development and changes nothing; the dialog is always centered.
|
|
121
|
+
|
|
122
|
+
The dialog never opens without a resolved policy rule, even when the
|
|
123
|
+
active surface is already `dialog`; it appears as soon as a rule resolves,
|
|
124
|
+
without a remount. A rule with `model: 'none'` and no rights owes no consent
|
|
125
|
+
UI, so the dialog stays closed under it. When such a rule lists any right,
|
|
126
|
+
for example `rights: ['disclosure']` or `rights: ['preferences']`, the dialog
|
|
127
|
+
can open as a settings route and Save completes without writing a consent
|
|
128
|
+
record.
|
|
129
|
+
|
|
130
|
+
Copy comes from these translation keys: `consentManagerDialog.title`,
|
|
131
|
+
`consentManagerDialog.description`, `common.acceptAll`, `common.rejectAll`,
|
|
132
|
+
`common.save`, and `consentTypes.<category>.title` and `.description` for
|
|
133
|
+
each row.
|
|
134
|
+
|
|
135
|
+
## Accessibility
|
|
136
|
+
|
|
137
|
+
The panel carries `role="dialog"`, `aria-labelledby="consent-dialog-title"`
|
|
138
|
+
and `aria-describedby="consent-dialog-description"`, plus `aria-modal="true"`
|
|
139
|
+
while it is blocking. Its `dir` attribute follows the active language.
|
|
140
|
+
|
|
141
|
+
While blocking, focus moves on open to the panel itself rather than to a
|
|
142
|
+
button, so a screen reader announces the title and description first; Tab
|
|
143
|
+
then enters the legal links and category switches, Tab and Shift+Tab wrap
|
|
144
|
+
inside the panel, and on close focus returns to the element that opened the
|
|
145
|
+
dialog. A non-blocking dialog manages no focus: nothing moves focus into the
|
|
146
|
+
panel or back to the opener. The backdrop is `aria-hidden` and is not
|
|
147
|
+
focusable.
|
|
148
|
+
|
|
149
|
+
Each category switch has the category title as its accessible name. The
|
|
150
|
+
`necessary` switch is disabled and always on. A saved grant that the current
|
|
151
|
+
policy or a privacy signal overrides gets a note under its row, linked to
|
|
152
|
+
the switch through `aria-describedby`.
|
|
153
|
+
|
|
154
|
+
## Composition
|
|
155
|
+
|
|
156
|
+
Every part is available as `ConsentDialog.<Part>`: `Root`, `Overlay`,
|
|
157
|
+
`Card`, `Header`, `HeaderTitle`, `HeaderDescription`, `Content`, `Footer`
|
|
158
|
+
and `ConsentCustomizationCard`, the stock card. `Root` provides the portal,
|
|
159
|
+
open state, focus trap, scroll lock and backdrop, and accepts `open`,
|
|
160
|
+
`models`, `noStyle`, `disableAnimation`, `scrollLock`, `trapFocus`,
|
|
161
|
+
`uiSource` and `overlay`. Pass `overlay={false}` to render no backdrop, or a
|
|
162
|
+
node to replace the built-in one.
|
|
116
163
|
|
|
117
164
|
```tsx
|
|
118
165
|
<ConsentDialog.Root>
|
|
119
|
-
<ConsentDialog.Overlay />
|
|
120
166
|
<ConsentDialog.Card>
|
|
121
167
|
<ConsentDialog.Header>
|
|
122
|
-
<ConsentDialog.HeaderTitle
|
|
123
|
-
<ConsentDialog.HeaderDescription />
|
|
168
|
+
<ConsentDialog.HeaderTitle>Your privacy choices</ConsentDialog.HeaderTitle>
|
|
169
|
+
<ConsentDialog.HeaderDescription legalLinks={['privacyPolicy']} />
|
|
124
170
|
</ConsentDialog.Header>
|
|
125
171
|
<ConsentDialog.Content>
|
|
126
|
-
<ConsentWidget
|
|
127
|
-
<ConsentWidget.Accordion type="single">
|
|
128
|
-
<ConsentWidget.AccordionItems />
|
|
129
|
-
</ConsentWidget.Accordion>
|
|
130
|
-
<ConsentWidget.PolicyActions />
|
|
131
|
-
</ConsentWidget.Root>
|
|
172
|
+
<ConsentWidget />
|
|
132
173
|
</ConsentDialog.Content>
|
|
133
|
-
<ConsentDialog.Footer />
|
|
174
|
+
<ConsentDialog.Footer hideBranding />
|
|
134
175
|
</ConsentDialog.Card>
|
|
135
176
|
</ConsentDialog.Root>
|
|
136
177
|
```
|
|
137
178
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|Property|Value|
|
|
165
|
-
|:--|:--|
|
|
166
|
-
|Type Name|\`ConsentDialogProps\`|
|
|
167
|
-
|Source Path|\`./packages/react/src/components/consent-dialog/consent-dialog.tsx\`|
|
|
168
|
-
|
|
169
|
-
\*ExtractedTypeTable: Could not extract "ConsentDialogProps" from "./packages/react/src/components/consent-dialog/consent-dialog.tsx" using base path "/home/runner/work/c15t/c15t". Verify the path/name and that the file is included by your tsconfig.\*
|
|
179
|
+
Keep `ConsentWidget` inside `Content`: it owns the draft, the switches and
|
|
180
|
+
the policy actions, and inherits the dialog's `uiSource`. `Footer` renders
|
|
181
|
+
the branding tag unless you pass children or `hideBranding`.
|
|
182
|
+
|
|
183
|
+
The positioner carries `data-slot="dialog-positioner"`, and both it and the
|
|
184
|
+
panel carry `data-blocking="true"` while blocking. Provider component slots
|
|
185
|
+
for the stock structure are `dialog.root`, `dialog.container`,
|
|
186
|
+
`dialog.card`, `dialog.header`, `dialog.title`, `dialog.content`,
|
|
187
|
+
`dialog.overlay`, `description.dialog`, `manager.footer` and `tag.dialog`.
|
|
188
|
+
|
|
189
|
+
The compound parts import from `c15t/react` as properties of `ConsentDialog`,
|
|
190
|
+
and `ConsentWidget` from the same module. See
|
|
191
|
+
[Styling](../styling/overview.md) for slots and tokens.
|
|
192
|
+
|
|
193
|
+
## Verify
|
|
194
|
+
|
|
195
|
+
Use the default blocking, uncontrolled dialog and an optional in-scope
|
|
196
|
+
category that is not restricted by policy or privacy signals such as GPC.
|
|
197
|
+
Open the dialog from the banner's Customize button or a preferences link.
|
|
198
|
+
A centered card appears over a dimmed backdrop, the page behind it stops
|
|
199
|
+
scrolling, and Tab stays inside the card. Press Escape: the card closes and
|
|
200
|
+
focus returns to the button you used. Open it again, turn a category on and
|
|
201
|
+
choose Save. The dialog closes and `useConsent('<category>')` reports
|
|
202
|
+
`true` in your components; under a choice prompt the banner does not return,
|
|
203
|
+
while a `notice` prompt keeps its banner until it is acknowledged. Reload the
|
|
204
|
+
page and reopen the dialog: the switch reflects the saved choice.
|