@c15t/react 2.0.0-rc.7 → 2.0.0-rc.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -0
- package/dist/components/consent-banner/consent-banner.cjs +1 -1
- package/dist/components/consent-banner/consent-banner.js +1 -1
- package/dist/components/consent-banner/index.cjs +1 -1
- package/dist/components/consent-banner/index.js +1 -1
- package/dist/components/consent-banner/policy-actions.cjs +1 -0
- package/dist/components/consent-banner/policy-actions.js +1 -0
- package/dist/components/consent-dialog/atoms/card.cjs +1 -1
- package/dist/components/consent-dialog/atoms/card.js +1 -1
- package/dist/components/consent-dialog-trigger/atoms/icon.cjs +1 -1
- package/dist/components/consent-dialog-trigger/atoms/icon.js +1 -1
- package/dist/components/consent-widget/atoms/footer.cjs +1 -1
- package/dist/components/consent-widget/atoms/footer.js +1 -1
- package/dist/components/consent-widget/consent-widget.cjs +1 -1
- package/dist/components/consent-widget/consent-widget.js +1 -1
- package/dist/components/consent-widget/index.cjs +1 -1
- package/dist/components/consent-widget/index.js +1 -1
- package/dist/components/consent-widget/policy-actions.cjs +1 -0
- package/dist/components/consent-widget/policy-actions.js +1 -0
- package/dist/components/iab-consent-banner/iab-consent-banner.cjs +1 -1
- package/dist/components/iab-consent-banner/iab-consent-banner.js +1 -1
- package/dist/components/iab-consent-dialog/iab-consent-dialog.cjs +1 -1
- package/dist/components/iab-consent-dialog/iab-consent-dialog.js +1 -1
- package/dist/components/shared/policy-actions.cjs +1 -0
- package/dist/components/shared/policy-actions.js +1 -0
- package/dist/components/shared/ui/branding.cjs +1 -0
- package/dist/components/shared/ui/branding.js +1 -0
- package/dist/components/shared/ui/logo.cjs +1 -1
- package/dist/components/shared/ui/logo.js +1 -1
- package/dist/components/shared/ui/switch/index.cjs +1 -1
- package/dist/components/shared/ui/switch/index.js +1 -1
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/use-consent-manager.cjs +1 -1
- package/dist/hooks/use-consent-manager.js +1 -1
- package/dist/hooks/use-headless-consent-ui.cjs +1 -1
- package/dist/hooks/use-headless-consent-ui.js +1 -1
- package/dist/iab/styles.css +11 -1
- package/dist/iab/styles.tw3.css +14 -1
- package/dist/providers/consent-manager-provider.cjs +1 -1
- package/dist/providers/consent-manager-provider.js +1 -1
- package/dist/server/fetch-ssr-data.cjs +1 -1
- package/dist/server/fetch-ssr-data.js +1 -1
- package/dist/styles.css +10 -1
- package/dist/styles.tw3.css +13 -1
- package/dist/version.cjs +1 -1
- package/dist/version.js +1 -1
- package/dist-types/components/consent-banner/atoms/root.d.ts +1 -1
- package/dist-types/components/consent-banner/consent-banner.d.ts +7 -2
- package/dist-types/components/consent-banner/index.d.ts +3 -0
- package/dist-types/components/consent-banner/policy-actions.d.ts +11 -0
- package/dist-types/components/consent-dialog/atoms/card.d.ts +7 -2
- package/dist-types/components/consent-dialog/atoms/root.d.ts +1 -1
- package/dist-types/components/consent-dialog/consent-dialog.d.ts +1 -1
- package/dist-types/components/consent-dialog-trigger/atoms/icon.d.ts +1 -1
- package/dist-types/components/consent-dialog-trigger/types.d.ts +1 -1
- package/dist-types/components/consent-widget/index.d.ts +3 -0
- package/dist-types/components/consent-widget/policy-actions.d.ts +11 -0
- package/dist-types/components/frame/atoms.d.ts +1 -1
- package/dist-types/components/frame/types.d.ts +1 -1
- package/dist-types/components/iab-consent-banner/atoms/root.d.ts +1 -1
- package/dist-types/components/iab-consent-banner/iab-consent-banner.d.ts +1 -1
- package/dist-types/components/iab-consent-dialog/atoms/root.d.ts +1 -1
- package/dist-types/components/iab-consent-dialog/atoms/vendor-list.d.ts +1 -1
- package/dist-types/components/iab-consent-dialog/iab-consent-dialog.d.ts +1 -1
- package/dist-types/components/shared/policy-actions.d.ts +29 -0
- package/dist-types/components/shared/primitives/button.d.ts +1 -1
- package/dist-types/components/shared/primitives/button.types.d.ts +1 -1
- package/dist-types/components/shared/primitives/legal-links/index.d.ts +1 -1
- package/dist-types/components/shared/ui/accordion/accordion.d.ts +2 -2
- package/dist-types/components/shared/ui/accordion/accordion.types.d.ts +1 -1
- package/dist-types/components/shared/ui/branding.d.ts +23 -0
- package/dist-types/components/shared/ui/button/button.d.ts +1 -1
- package/dist-types/components/shared/ui/logo.d.ts +8 -0
- package/dist-types/components/shared/ui/preference-item/preference-item.d.ts +1 -1
- package/dist-types/components/shared/ui/switch/index.d.ts +1 -1
- package/dist-types/components/shared/ui/switch/switch.d.ts +1 -1
- package/dist-types/components/shared/ui/switch/switch.types.d.ts +1 -1
- package/dist-types/components/shared/ui/tabs/tabs.d.ts +1 -1
- package/dist-types/context/consent-manager-context.d.ts +1 -1
- package/dist-types/headless.d.ts +1 -1
- package/dist-types/hooks/use-component-config.d.ts +1 -1
- package/dist-types/hooks/use-consent-manager.d.ts +1 -1
- package/dist-types/hooks/use-headless-consent-ui.d.ts +1 -1
- package/dist-types/hooks/use-ssr-status.d.ts +2 -1
- package/dist-types/hooks/use-translations.d.ts +1 -1
- package/dist-types/index.d.ts +2 -2
- package/dist-types/server/fetch-ssr-data.d.ts +1 -1
- package/dist-types/server/init-cache-key.d.ts +1 -1
- package/dist-types/server/types.d.ts +1 -1
- package/dist-types/types/consent-manager.d.ts +1 -1
- package/dist-types/types/theme/style-keys.d.ts +1 -1
- package/dist-types/types/theme/style-types.d.ts +2 -2
- package/dist-types/utils/cn.d.ts +1 -1
- package/dist-types/utils/theme-utils.d.ts +1 -1
- package/dist-types/version.d.ts +1 -1
- package/docs/building-headless-components.md +40 -22
- package/docs/callbacks.md +76 -9
- package/docs/components/consent-banner.md +83 -9
- package/docs/components/consent-dialog.md +12 -2
- package/docs/components/consent-manager-provider.md +3 -1
- package/docs/components/consent-widget.md +61 -8
- package/docs/concepts/client-modes.md +16 -4
- package/docs/concepts/initialization-flow.md +9 -2
- package/docs/concepts/policy-packs.md +2 -2
- package/docs/hooks/use-consent-manager/overview.md +17 -3
- package/docs/hooks/use-ssr-status.md +1 -1
- package/docs/hooks/use-translations.md +1 -0
- package/docs/iab/consent-banner.md +2 -5
- package/docs/iab/consent-dialog.md +3 -6
- package/docs/iab/overview.md +11 -5
- package/docs/integrations/building-integrations.md +405 -0
- package/docs/integrations/databuddy.md +22 -5
- package/docs/integrations/google-tag-manager.md +2 -2
- package/docs/integrations/google-tag.md +2 -29
- package/docs/integrations/linkedin-insights.md +1 -1
- package/docs/integrations/meta-pixel.md +1 -1
- package/docs/integrations/microsoft-uet.md +1 -1
- package/docs/integrations/overview.md +18 -2
- package/docs/integrations/posthog.md +39 -17
- package/docs/integrations/tiktok-pixel.md +1 -1
- package/docs/integrations/x-pixel.md +1 -1
- package/docs/optimization.md +2 -6
- package/docs/policy-packs.md +7 -7
- package/docs/quickstart.md +11 -5
- package/docs/script-loader.md +22 -1
- package/docs/styling/tailwind.md +23 -17
- package/iab/styles.css +1 -0
- package/package.json +13 -11
- package/readme.json +6 -0
- package/src/iab/styles.css +11 -0
- package/src/iab/styles.tw3.css +8 -4
- package/src/styles.css +10 -0
- package/src/styles.tw3.css +7 -4
- package/styles.css +1 -0
- package/dist/components/shared/libs/policy-actions.cjs +0 -1
- package/dist/components/shared/libs/policy-actions.js +0 -1
- package/dist-types/components/shared/libs/policy-actions.d.ts +0 -26
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import { type BoxProps } from '../../shared/primitives/box';
|
|
3
3
|
import type { InlineLegalLinksProps } from '../../shared/primitives/legal-links';
|
|
4
|
+
import { type BrandingVariant } from '../../shared/ui/branding';
|
|
4
5
|
import type { ClassNameStyle } from '../../../types/theme';
|
|
5
6
|
declare const ConsentDialogCard: import("react").ForwardRefExoticComponent<{
|
|
6
7
|
/** The content to be rendered inside the consent dialog card */
|
|
@@ -57,9 +58,13 @@ declare const ConsentDialogFooter: import("react").ForwardRefExoticComponent<Box
|
|
|
57
58
|
hideBranding?: boolean;
|
|
58
59
|
'data-testid'?: string;
|
|
59
60
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
60
|
-
|
|
61
|
+
type BrandingProps = {
|
|
61
62
|
hideBranding: boolean;
|
|
62
|
-
|
|
63
|
+
variant?: BrandingVariant;
|
|
64
|
+
className?: string;
|
|
65
|
+
'data-testid'?: string;
|
|
66
|
+
};
|
|
67
|
+
export declare function Branding(props: BrandingProps): import("react/jsx-runtime").JSX.Element;
|
|
63
68
|
/**
|
|
64
69
|
* A pre-configured privacy settings card.
|
|
65
70
|
* Combines all consent dialog components with default content for privacy customization.
|
|
@@ -19,7 +19,7 @@ export interface ConsentDialogRootProps extends HTMLAttributes<HTMLDialogElement
|
|
|
19
19
|
* Which consent models this dialog responds to.
|
|
20
20
|
* @default ['opt-in', 'opt-out']
|
|
21
21
|
*/
|
|
22
|
-
models?: import('
|
|
22
|
+
models?: import('c15t').Model[];
|
|
23
23
|
/**
|
|
24
24
|
* When true, the component will not apply any internal styles.
|
|
25
25
|
*/
|
|
@@ -85,7 +85,7 @@ export interface ConsentDialogProps {
|
|
|
85
85
|
* Which consent models this dialog responds to.
|
|
86
86
|
* @default ['opt-in', 'opt-out']
|
|
87
87
|
*/
|
|
88
|
-
models?: import('
|
|
88
|
+
models?: import('c15t').Model[];
|
|
89
89
|
/**
|
|
90
90
|
* Override the UI source identifier sent with consent API calls.
|
|
91
91
|
* @default 'dialog'
|
|
@@ -6,7 +6,7 @@ import type { TriggerIcon as TriggerIconType } from '../types';
|
|
|
6
6
|
export interface TriggerIconProps {
|
|
7
7
|
/**
|
|
8
8
|
* Icon to display.
|
|
9
|
-
* - 'branding' - c15t or
|
|
9
|
+
* - 'branding' - c15t or INTH logo based on branding setting
|
|
10
10
|
* - 'fingerprint' - Generic fingerprint icon
|
|
11
11
|
* - 'settings' - Generic settings/gear icon
|
|
12
12
|
* - ReactNode - Custom icon element
|
|
@@ -8,7 +8,7 @@ import type { ReactNode } from 'react';
|
|
|
8
8
|
/**
|
|
9
9
|
* Icon options for the trigger button.
|
|
10
10
|
*
|
|
11
|
-
* - `'branding'` - Shows c15t or
|
|
11
|
+
* - `'branding'` - Shows c15t or INTH logo based on branding setting
|
|
12
12
|
* - `'fingerprint'` - Generic fingerprint/privacy icon
|
|
13
13
|
* - `'settings'` - Generic settings/gear icon
|
|
14
14
|
* - `ReactNode` - Custom icon element
|
|
@@ -12,6 +12,7 @@ import { Accordion, AccordionArrow, AccordionContent, AccordionItem, AccordionIt
|
|
|
12
12
|
import { AcceptAllButton, CustomizeButton, RejectButton, SaveButton } from './atoms/button';
|
|
13
13
|
import { Footer, FooterSubGroup } from './atoms/footer';
|
|
14
14
|
import { Root } from './atoms/root';
|
|
15
|
+
import { PolicyActions } from './policy-actions';
|
|
15
16
|
import type { ConsentWidgetProps } from './types';
|
|
16
17
|
export type { ConsentWidgetProps };
|
|
17
18
|
/**
|
|
@@ -35,6 +36,7 @@ export interface ConsentWidgetCompoundComponent extends FC<ConsentWidgetProps> {
|
|
|
35
36
|
CustomizeButton: typeof CustomizeButton;
|
|
36
37
|
SaveButton: typeof SaveButton;
|
|
37
38
|
RejectButton: typeof RejectButton;
|
|
39
|
+
PolicyActions: typeof PolicyActions;
|
|
38
40
|
Footer: typeof Footer;
|
|
39
41
|
FooterSubGroup: typeof FooterSubGroup;
|
|
40
42
|
}
|
|
@@ -93,4 +95,5 @@ export { Accordion, AccordionArrow, AccordionContent, AccordionItem, AccordionIt
|
|
|
93
95
|
export { AcceptAllButton, ConsentWidgetAcceptAllButton, ConsentWidgetCustomizeButton, ConsentWidgetRejectButton, ConsentWidgetSaveButton, CustomizeButton, RejectButton, SaveButton, } from './atoms/button';
|
|
94
96
|
export { ConsentWidgetFooter, ConsentWidgetFooterSubGroup, Footer, FooterSubGroup, } from './atoms/footer';
|
|
95
97
|
export { ConsentWidgetRoot, Root, } from './atoms/root';
|
|
98
|
+
export { type ConsentWidgetPolicyActionRenderProps, ConsentWidgetPolicyActions, type ConsentWidgetPolicyActionsProps, PolicyActions, } from './policy-actions';
|
|
96
99
|
export { ConsentWidget };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { type HeadlessConsentDialogAction } from '../../hooks/use-headless-consent-ui';
|
|
3
|
+
import { type PolicyActionRenderProps } from '../shared/policy-actions';
|
|
4
|
+
export interface ConsentWidgetPolicyActionRenderProps extends PolicyActionRenderProps<HeadlessConsentDialogAction> {
|
|
5
|
+
}
|
|
6
|
+
export interface ConsentWidgetPolicyActionsProps {
|
|
7
|
+
renderAction?: (action: HeadlessConsentDialogAction, props: ConsentWidgetPolicyActionRenderProps) => ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export declare function ConsentWidgetPolicyActions({ renderAction, }: ConsentWidgetPolicyActionsProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
declare const PolicyActions: typeof ConsentWidgetPolicyActions;
|
|
11
|
+
export { PolicyActions };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AllConsentNames } from '
|
|
1
|
+
import type { AllConsentNames } from 'c15t';
|
|
2
2
|
import { type BoxProps } from '../shared/primitives/box';
|
|
3
3
|
import type { ConsentButtonProps } from '../shared/primitives/button.types';
|
|
4
4
|
declare const FrameRoot: import("react").ForwardRefExoticComponent<Omit<BoxProps, "themeKey"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AllConsentNames } from '
|
|
1
|
+
import type { AllConsentNames } from 'c15t';
|
|
2
2
|
import type { ComponentPropsWithRef, FC, ReactNode } from 'react';
|
|
3
3
|
import type * as Atom from './atoms';
|
|
4
4
|
export interface FrameProps extends ComponentPropsWithRef<'div'> {
|
|
@@ -9,7 +9,7 @@ interface IABConsentBannerRootProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
9
9
|
* Which consent models this banner responds to.
|
|
10
10
|
* @default ['iab']
|
|
11
11
|
*/
|
|
12
|
-
models?: import('
|
|
12
|
+
models?: import('c15t').Model[];
|
|
13
13
|
/**
|
|
14
14
|
* Override the UI source identifier sent with consent API calls.
|
|
15
15
|
* @default 'iab_banner'
|
|
@@ -33,7 +33,7 @@ export interface IABConsentBannerProps {
|
|
|
33
33
|
* Which consent models this banner responds to.
|
|
34
34
|
* @default ['iab']
|
|
35
35
|
*/
|
|
36
|
-
models?: import('
|
|
36
|
+
models?: import('c15t').Model[];
|
|
37
37
|
/**
|
|
38
38
|
* Override the UI source identifier sent with consent API calls.
|
|
39
39
|
* @default 'iab_banner'
|
|
@@ -13,7 +13,7 @@ interface IABConsentDialogRootProps {
|
|
|
13
13
|
* Which consent models this dialog responds to.
|
|
14
14
|
* @default ['iab']
|
|
15
15
|
*/
|
|
16
|
-
models?: import('
|
|
16
|
+
models?: import('c15t').Model[];
|
|
17
17
|
/**
|
|
18
18
|
* Override the UI source identifier sent with consent API calls.
|
|
19
19
|
* @default 'iab_dialog'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GlobalVendorList } from '
|
|
1
|
+
import type { GlobalVendorList } from 'c15t';
|
|
2
2
|
import { type FC } from 'react';
|
|
3
3
|
import type { ProcessedPurpose, VendorId } from '../types';
|
|
4
4
|
/** Custom vendor not registered with IAB */
|
|
@@ -49,7 +49,7 @@ export interface IABConsentDialogProps {
|
|
|
49
49
|
* Which consent models this dialog responds to.
|
|
50
50
|
* @default ['iab']
|
|
51
51
|
*/
|
|
52
|
-
models?: import('
|
|
52
|
+
models?: import('c15t').Model[];
|
|
53
53
|
/**
|
|
54
54
|
* Override the UI source identifier sent with consent API calls.
|
|
55
55
|
* @default 'iab_dialog'
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type ComponentType, type ReactNode } from 'react';
|
|
2
|
+
import type { HeadlessConsentSurfaceState } from '../../hooks/use-headless-consent-ui';
|
|
3
|
+
import type { CSSPropertiesWithVars, CSSVariables } from '../../types/theme';
|
|
4
|
+
export interface PolicyActionRenderProps<TAction extends string> {
|
|
5
|
+
key: string;
|
|
6
|
+
consentAction: TAction;
|
|
7
|
+
isPrimary: boolean;
|
|
8
|
+
style?: CSSPropertiesWithVars<CSSVariables>;
|
|
9
|
+
}
|
|
10
|
+
interface PolicyActionsLayoutProps {
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
interface PolicyActionsClassNames {
|
|
15
|
+
footerFill?: string;
|
|
16
|
+
footerColumn?: string;
|
|
17
|
+
footerSubGroupFill?: string;
|
|
18
|
+
footerSubGroupColumn?: string;
|
|
19
|
+
}
|
|
20
|
+
interface PolicyActionsRendererProps<TAction extends string> {
|
|
21
|
+
state: Pick<HeadlessConsentSurfaceState<TAction>, 'actionGroups' | 'primaryActions' | 'shouldFillActions' | 'direction'>;
|
|
22
|
+
Footer: ComponentType<PolicyActionsLayoutProps>;
|
|
23
|
+
FooterSubGroup: ComponentType<PolicyActionsLayoutProps>;
|
|
24
|
+
classNames: PolicyActionsClassNames;
|
|
25
|
+
renderDefaultAction: (action: TAction, props: PolicyActionRenderProps<TAction>) => ReactNode;
|
|
26
|
+
renderAction?: (action: TAction, props: PolicyActionRenderProps<TAction>) => ReactNode;
|
|
27
|
+
}
|
|
28
|
+
export declare function PolicyActionsRenderer<TAction extends string>({ state, Footer, FooterSubGroup, classNames, renderDefaultAction, renderAction, }: PolicyActionsRendererProps<TAction>): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AllConsentNames } from '
|
|
1
|
+
import type { AllConsentNames } from 'c15t';
|
|
2
2
|
import * as Button from '../ui/button';
|
|
3
3
|
import type { ConsentButtonProps } from './button.types';
|
|
4
4
|
type ConsentActionThemeKey = 'accept' | 'reject' | 'customize';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ButtonMode } from '
|
|
1
|
+
import type { ButtonMode } from '@c15t/ui/styles/primitives';
|
|
2
2
|
import type { ComponentRef, HTMLAttributes, MouseEvent } from 'react';
|
|
3
3
|
import type { CSSVariables, ExtendThemeKeys } from '../../../types/theme';
|
|
4
4
|
export type ConsentButtonElement = ComponentRef<'button'>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LegalLinks as LegalLinksType } from '
|
|
1
|
+
import type { LegalLinks as LegalLinksType } from 'c15t';
|
|
2
2
|
import type { AllThemeKeys } from '../../../../types/theme/style-keys';
|
|
3
3
|
/**
|
|
4
4
|
* Hook to filter legal links based on the provided links prop.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type AccordionType } from '
|
|
2
|
-
import { type AccordionSize, type AccordionVariant, type AccordionVariantsProps, accordionVariants } from '
|
|
1
|
+
import { type AccordionType } from '@c15t/ui/primitives/accordion';
|
|
2
|
+
import { type AccordionSize, type AccordionVariant, type AccordionVariantsProps, accordionVariants } from '@c15t/ui/styles/primitives/accordion';
|
|
3
3
|
import { type ButtonHTMLAttributes, type ElementType, type HTMLAttributes } from 'react';
|
|
4
4
|
import type { PolymorphicComponentProps } from '../../libs/polymorphic';
|
|
5
5
|
import type { ThemeValue } from '../../../../types/theme';
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Re-export accordion variant types from @c15t/ui for convenience.
|
|
3
3
|
* The canonical definitions are in @c15t/ui/styles/primitives.
|
|
4
4
|
*/
|
|
5
|
-
export type { AccordionColorCSSVariables, AccordionContentCSSVariables, AccordionCSSVariables, AccordionIconCSSVariables, AccordionItemCSSVariables, AccordionLayoutCSSVariables, AccordionRootCSSVariables, AccordionSize, AccordionTriggerCSSVariables, AccordionVariant, AccordionVariantsProps, } from '
|
|
5
|
+
export type { AccordionColorCSSVariables, AccordionContentCSSVariables, AccordionCSSVariables, AccordionIconCSSVariables, AccordionItemCSSVariables, AccordionLayoutCSSVariables, AccordionRootCSSVariables, AccordionSize, AccordionTriggerCSSVariables, AccordionVariant, AccordionVariantsProps, } from '@c15t/ui/styles/primitives';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Branding } from 'c15t';
|
|
2
|
+
import type { SVGProps } from 'react';
|
|
3
|
+
export type ResolvedBranding = 'c15t' | 'inth' | 'none';
|
|
4
|
+
export type BrandingVariant = 'footer' | 'dialog-tag' | 'banner-tag';
|
|
5
|
+
type BrandingProps = {
|
|
6
|
+
hideBranding: boolean;
|
|
7
|
+
variant?: BrandingVariant;
|
|
8
|
+
className?: string;
|
|
9
|
+
'data-testid'?: string;
|
|
10
|
+
};
|
|
11
|
+
type BrandingFullLogoProps = {
|
|
12
|
+
branding: Branding | string;
|
|
13
|
+
className?: string;
|
|
14
|
+
};
|
|
15
|
+
type BrandingCompactLogoProps = SVGProps<SVGSVGElement> & {
|
|
16
|
+
branding: Branding | string;
|
|
17
|
+
};
|
|
18
|
+
export declare function resolveBranding(branding: Branding | string): ResolvedBranding;
|
|
19
|
+
export declare function getBrandingHref(branding: Branding | string, refParam?: string): string;
|
|
20
|
+
export declare function BrandingFullLogo({ branding, className, }: BrandingFullLogoProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare function BrandingCompactLogo({ branding, ...props }: BrandingCompactLogoProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare function BrandingLink({ hideBranding, variant, className, 'data-testid': testId, }: BrandingProps): import("react/jsx-runtime").JSX.Element | null;
|
|
23
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ButtonMode, type ButtonSize, type ButtonVariant, type ButtonVariantsProps, buttonVariants } from '
|
|
1
|
+
import { type ButtonMode, type ButtonSize, type ButtonVariant, type ButtonVariantsProps, buttonVariants } from '@c15t/ui/styles/primitives/button';
|
|
2
2
|
import { type ButtonHTMLAttributes, type ElementType } from 'react';
|
|
3
3
|
import type { PolymorphicComponentProps } from '../../libs/polymorphic';
|
|
4
4
|
export type { ButtonMode, ButtonSize, ButtonVariant, ButtonVariantsProps };
|
|
@@ -13,6 +13,14 @@ export declare const C15TIconOnly: ({ title, titleId, ...props }: SVGProps<SVGSV
|
|
|
13
13
|
* Use this for branding displays.
|
|
14
14
|
*/
|
|
15
15
|
export declare const C15TIcon: ({ title, titleId, ...props }: SVGProps<SVGSVGElement> & IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
/**
|
|
17
|
+
* INTH logo for partner branding displays.
|
|
18
|
+
*/
|
|
19
|
+
export declare const InthLogo: (props: SVGProps<SVGSVGElement> & IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
/**
|
|
21
|
+
* INTH icon-only mark for compact placements like floating triggers.
|
|
22
|
+
*/
|
|
23
|
+
export declare const InthIconOnly: (props: SVGProps<SVGSVGElement> & IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
24
|
export declare const ConsentLogo: ({ title, titleId, ...props }: SVGProps<SVGSVGElement> & IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
25
|
/**
|
|
18
26
|
* Consent icon only (without text).
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type PreferenceItemVariantsProps } from '
|
|
1
|
+
import { type PreferenceItemVariantsProps } from '@c15t/ui/styles/primitives/preference-item';
|
|
2
2
|
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
3
3
|
export interface PreferenceItemRootProps extends HTMLAttributes<HTMLDivElement>, PreferenceItemVariantsProps {
|
|
4
4
|
children: ReactNode;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './switch';
|
|
2
|
-
export
|
|
2
|
+
export type { SwitchCSSVariables, SwitchRootCSSVariables, SwitchThumbCSSVariables, SwitchTrackCSSVariables, } from './switch.types';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type SwitchSize, type SwitchVariantsProps, switchVariants } from '
|
|
1
|
+
import { type SwitchSize, type SwitchVariantsProps, switchVariants } from '@c15t/ui/styles/primitives/switch';
|
|
2
2
|
import { type ButtonHTMLAttributes } from 'react';
|
|
3
3
|
import type { AllThemeKeys, ThemeValue } from '../../../../types/theme';
|
|
4
4
|
export type { SwitchSize, SwitchVariantsProps };
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Re-export switch variant types from @c15t/ui for convenience.
|
|
3
3
|
* The canonical definitions are in @c15t/ui/styles/primitives.
|
|
4
4
|
*/
|
|
5
|
-
export type { SwitchCSSVariables, SwitchRootCSSVariables, SwitchSize, SwitchThumbCSSVariables, SwitchTrackCSSVariables, SwitchVariantsProps, } from '
|
|
5
|
+
export type { SwitchCSSVariables, SwitchRootCSSVariables, SwitchSize, SwitchThumbCSSVariables, SwitchTrackCSSVariables, SwitchVariantsProps, } from '@c15t/ui/styles/primitives';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type TabsVariantsProps } from '
|
|
1
|
+
import { type TabsVariantsProps } from '@c15t/ui/styles/primitives/tabs';
|
|
2
2
|
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
3
3
|
export interface TabsRootProps extends Omit<HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'onChange'>, TabsVariantsProps {
|
|
4
4
|
children: ReactNode;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @packageDocumentation
|
|
3
3
|
* Provides the context for sharing consent management state across components.
|
|
4
4
|
*/
|
|
5
|
-
import type { ConsentManagerInterface, ConsentStoreState } from '
|
|
5
|
+
import type { ConsentManagerInterface, ConsentStoreState } from 'c15t';
|
|
6
6
|
/**
|
|
7
7
|
* The context value provided by ConsentManagerProvider.
|
|
8
8
|
*/
|
package/dist-types/headless.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { type ConsentManagerInterface, configureConsentManager, defaultTranslationConfig, detectBrowserLanguage, type EuropePolicyMode, mergeTranslationConfigs, type PolicyPackPresets, policyPackPresets, prepareTranslationConfig, } from '
|
|
1
|
+
export { type ConsentManagerInterface, configureConsentManager, defaultTranslationConfig, detectBrowserLanguage, type EuropePolicyMode, mergeTranslationConfigs, type PolicyPackPresets, policyPackPresets, prepareTranslationConfig, } from 'c15t';
|
|
2
2
|
export { useColorScheme } from './hooks/use-color-scheme';
|
|
3
3
|
export { type ConsentDialogTriggerVisibility, type UseConsentDialogTriggerOptions, type UseConsentDialogTriggerResult, useConsentDialogTrigger, } from './hooks/use-consent-dialog-trigger';
|
|
4
4
|
export { useConsentManager } from './hooks/use-consent-manager';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @packageDocumentation
|
|
3
3
|
* Hook for accessing and managing consent state.
|
|
4
4
|
*/
|
|
5
|
-
import type { ConsentManagerInterface, ConsentStoreState } from '
|
|
5
|
+
import type { ConsentManagerInterface, ConsentStoreState } from 'c15t';
|
|
6
6
|
/**
|
|
7
7
|
* Hook for accessing and managing consent state.
|
|
8
8
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type PolicyUiAction, type PolicyUiActionDirection, type PolicyUiActionGroup, type PolicyUiProfile } from '
|
|
1
|
+
import { type PolicyUiAction, type PolicyUiActionDirection, type PolicyUiActionGroup, type PolicyUiProfile } from '@c15t/ui/utils';
|
|
2
2
|
import { useConsentManager } from './use-consent-manager';
|
|
3
3
|
export type HeadlessConsentSurface = 'banner' | 'dialog';
|
|
4
4
|
export type HeadlessConsentSurfaceAction = PolicyUiAction;
|
|
@@ -20,8 +20,9 @@ export interface SSRStatus {
|
|
|
20
20
|
*
|
|
21
21
|
* - `'no_data'` — no `ssrData` prop was provided to the provider
|
|
22
22
|
* - `'fetch_failed'` — `ssrData` was provided but the Promise resolved with no data
|
|
23
|
+
* - `'context_mismatch'` — `ssrData` did not match the current runtime request context
|
|
23
24
|
*/
|
|
24
|
-
ssrSkippedReason: 'no_data' | 'fetch_failed' | null;
|
|
25
|
+
ssrSkippedReason: 'no_data' | 'fetch_failed' | 'context_mismatch' | null;
|
|
25
26
|
}
|
|
26
27
|
/**
|
|
27
28
|
* Returns information about SSR data usage.
|
package/dist-types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export type { AllConsentNames, ConsentManagerInterface, ConsentStoreState, ConsentType, EuropePolicyMode, Overrides, PolicyPackPresets, Translations, } from '
|
|
2
|
-
export { configureConsentManager, defaultTranslationConfig, detectBrowserLanguage, mergeTranslationConfigs, policyPackPresets, prepareTranslationConfig, } from '
|
|
1
|
+
export type { AllConsentNames, ConsentManagerInterface, ConsentStoreState, ConsentType, EuropePolicyMode, Overrides, PolicyPackPresets, Translations, } from 'c15t';
|
|
2
|
+
export { configureConsentManager, defaultTranslationConfig, detectBrowserLanguage, mergeTranslationConfigs, policyPackPresets, prepareTranslationConfig, } from 'c15t';
|
|
3
3
|
export { ConsentBanner, type ConsentBannerProps, } from './components/consent-banner';
|
|
4
4
|
export * from './components/consent-banner/components';
|
|
5
5
|
export { ConsentDialog, type ConsentDialogProps, } from './components/consent-dialog';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type { AllThemeKeys } from '
|
|
1
|
+
export type { AllThemeKeys } from '@c15t/ui/theme';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ClassNameStyle as BaseClassNameStyle, Theme as BaseTheme } from '
|
|
1
|
+
import type { ClassNameStyle as BaseClassNameStyle, Theme as BaseTheme } from '@c15t/ui/theme';
|
|
2
2
|
import type { CSSProperties } from 'react';
|
|
3
3
|
import type { AllThemeKeys } from './style-keys';
|
|
4
|
-
export type { ColorTokens, ComponentSlots, CSSVariables, MotionTokens, RadiusTokens, ShadowTokens, SlotStyle, SpacingTokens, TypographyTokens, } from '
|
|
4
|
+
export type { ColorTokens, ComponentSlots, CSSVariables, MotionTokens, RadiusTokens, ShadowTokens, SlotStyle, SpacingTokens, TypographyTokens, } from '@c15t/ui/theme';
|
|
5
5
|
/**
|
|
6
6
|
* Represents CSS properties with optional CSS variables.
|
|
7
7
|
* @public
|
package/dist-types/utils/cn.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Utility functions for processing the v2 theme system.
|
|
3
3
|
* Handles token-to-CSS variable conversion and dark mode overrides.
|
|
4
4
|
*/
|
|
5
|
-
import type { ThemeCSSVariables } from '
|
|
5
|
+
import type { ThemeCSSVariables } from '@c15t/ui/theme';
|
|
6
6
|
import type { Theme } from '../types/theme/style-types';
|
|
7
7
|
/**
|
|
8
8
|
* Default design tokens for the v2 theme system.
|
package/dist-types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "2.0.0-rc.
|
|
1
|
+
export declare const version = "2.0.0-rc.8";
|
|
@@ -2,18 +2,27 @@
|
|
|
2
2
|
title: Building Headless Components
|
|
3
3
|
description: Build policy-aware custom consent components in React using the headless hooks and policy-pack tooling.
|
|
4
4
|
---
|
|
5
|
-
Building
|
|
5
|
+
Building custom consent UI is easier now because c15t exposes multiple layers of policy-aware primitives instead of forcing you to reconstruct banner rules by hand.
|
|
6
|
+
|
|
7
|
+
The layering is:
|
|
8
|
+
|
|
9
|
+
* stock component props for the shortest path
|
|
10
|
+
* `ConsentBanner.PolicyActions` and `ConsentWidget.PolicyActions` for custom structure with policy-aware actions
|
|
11
|
+
* `useHeadlessConsentUI()` for fully manual action rendering and non-standard controls
|
|
6
12
|
|
|
7
13
|
> ⚠️ **Warning:**
|
|
8
14
|
> Headless is the last step in the customization ladder. Use this guide only when pre-built components, tokens, slots, compound components, and noStyle are no longer sufficient.
|
|
9
15
|
|
|
10
|
-
The headless stack is:
|
|
16
|
+
The headless stack underneath that is:
|
|
11
17
|
|
|
12
18
|
* `useHeadlessConsentUI()` for policy-aware banner/dialog actions, ordering, layout, and primary actions hints
|
|
19
|
+
* `@c15t/ui/utils` for the pure policy-action helpers that framework packages build on
|
|
13
20
|
* `useConsentManager()` for runtime state, categories, selected consent state, and policy metadata
|
|
14
21
|
* `useTranslations()` for the resolved copy
|
|
15
22
|
* `offlinePolicy.policyPacks` for offline previews that behave like backend policy resolution
|
|
16
23
|
|
|
24
|
+
The split is intentional: `@c15t/ui` owns pure policy-action resolution, while the framework hooks own visibility, consent mutations, and reactive state.
|
|
25
|
+
|
|
17
26
|
> ℹ️ **Info:**
|
|
18
27
|
> This guide is about building your own components while still respecting resolved policy-pack behavior. For the general headless overview, see Headless Mode.
|
|
19
28
|
|
|
@@ -33,6 +42,11 @@ The main win is that your custom UI can stay aligned with policy packs without d
|
|
|
33
42
|
|
|
34
43
|
That means your component mostly focuses on markup and design-system concerns instead of re-implementing policy interpretation.
|
|
35
44
|
|
|
45
|
+
For most compound-component layouts, start with `ConsentBanner.PolicyActions` or `ConsentWidget.PolicyActions`. They render stock c15t buttons and translations by default, and `renderAction` is only needed when you want to override the action mapping. Reach for manual `actionGroups` mapping when you need action rendering that no longer fits the stock button compounds.
|
|
46
|
+
|
|
47
|
+
> ℹ️ **Info:**
|
|
48
|
+
> For custom layouts built from c15t compound components, prefer ConsentBanner.PolicyActions and ConsentWidget.PolicyActions. The examples below intentionally use manual actionGroups mapping to show the fully headless escape hatch.
|
|
49
|
+
|
|
36
50
|
## Provider Setup for Local Policy Testing
|
|
37
51
|
|
|
38
52
|
```tsx
|
|
@@ -168,25 +182,29 @@ export function CustomConsentDialog() {
|
|
|
168
182
|
))}
|
|
169
183
|
</div>
|
|
170
184
|
|
|
171
|
-
<div className="mt-4
|
|
172
|
-
{dialog.
|
|
173
|
-
<
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
185
|
+
<div className="mt-4 space-y-2">
|
|
186
|
+
{dialog.actionGroups.map((group, index) => (
|
|
187
|
+
<div key={`${group.join('-')}-${index}`} className="flex gap-2">
|
|
188
|
+
{group.map((action) => (
|
|
189
|
+
<button
|
|
190
|
+
key={action}
|
|
191
|
+
type="button"
|
|
192
|
+
onClick={() => {
|
|
193
|
+
if (action === 'customize') {
|
|
194
|
+
void saveCustomPreferences();
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
void performDialogAction(action);
|
|
198
|
+
}}
|
|
199
|
+
>
|
|
200
|
+
{action === 'accept'
|
|
201
|
+
? translations.common.acceptAll
|
|
202
|
+
: action === 'reject'
|
|
203
|
+
? translations.common.rejectAll
|
|
204
|
+
: translations.common.save}
|
|
205
|
+
</button>
|
|
206
|
+
))}
|
|
207
|
+
</div>
|
|
190
208
|
))}
|
|
191
209
|
</div>
|
|
192
210
|
</section>
|
|
@@ -199,7 +217,7 @@ export function CustomConsentDialog() {
|
|
|
199
217
|
When you build custom banner or dialog components, make sure they use:
|
|
200
218
|
|
|
201
219
|
* `activeUI` or `banner.isVisible` / `dialog.isVisible` for visibility
|
|
202
|
-
* `allowedActions`, `
|
|
220
|
+
* `allowedActions`, `actionGroups`, and `primaryActions` instead of hard-coding buttons
|
|
203
221
|
* `primaryActions` for visual emphasis
|
|
204
222
|
* `consentCategories` when deciding which category toggles to render
|
|
205
223
|
* `policyDecision` when you want to debug why a specific UI state was chosen
|