@c15t/react 3.0.0-alpha.2 → 3.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +6 -1
- package/dist/aggregate-components.js +1 -1
- package/dist/chunk-warming.js +1 -1
- package/dist/component-hooks/use-headless-iab-consent-ui.js +1 -1
- package/dist/component-hooks/use-panel-trigger.js +1 -1
- package/dist/components/consent-gate/consent-gate.js +1 -1
- package/dist/components/consent-preferences-link/consent-preferences-link.js +1 -1
- package/dist/components/iab-panel/atoms/purpose-item.js +1 -1
- package/dist/components/iab-panel/atoms/stack-item.js +1 -1
- package/dist/components/iab-panel/iab-panel.js +1 -1
- package/dist/components/iab-panel/index.js +1 -1
- package/dist/components/panel/atoms/overlay.js +1 -1
- package/dist/components/panel/atoms/root.js +1 -1
- package/dist/components/panel/index.js +1 -1
- package/dist/components/panel/panel.js +1 -1
- package/dist/components/panel-trigger/atoms/button.js +1 -1
- package/dist/components/panel-trigger/atoms/icon.js +1 -1
- package/dist/components/panel-trigger/atoms/root.js +1 -1
- package/dist/components/panel-trigger/atoms/trigger-icons.js +1 -0
- package/dist/components/panel-trigger/panel-trigger-toolbar.js +1 -1
- package/dist/components/preferences/atoms/accordion.js +1 -1
- package/dist/components/preferences/atoms/root.js +1 -1
- package/dist/components/preferences/atoms/vendor-list.js +1 -1
- package/dist/components/preferences/index.js +1 -1
- package/dist/components/prompt/policy-actions.js +1 -1
- package/dist/components/shared/primitives/button.js +1 -1
- package/dist/components/shared/ui/accordion/accordion.js +1 -1
- package/dist/components/shared/ui/collapsible/collapsible.js +1 -1
- package/dist/components/shared/ui/logo.js +1 -1
- package/dist/components/shared/ui/preference-item/preference-item.js +1 -1
- package/dist/components/shared/ui/switch/switch.js +1 -1
- package/dist/components/shared/ui/tabs/tabs.js +1 -1
- package/dist/consent-theme.js +1 -0
- package/dist/draft.js +1 -1
- package/dist/external-iab-context.js +1 -1
- package/dist/headless.js +1 -1
- package/dist/hooks/use-committed-ref.js +2 -0
- package/dist/hooks.js +1 -1
- package/dist/iab/styles.tw3.css +1 -41
- package/dist/iab-context.js +1 -1
- package/dist/index.js +1 -1
- package/dist/kernel-selector.js +1 -0
- package/dist/module-hooks/iframe-blocker.js +1 -1
- package/dist/module-hooks/network-blocker.js +1 -1
- package/dist/module-hooks/network-hold.js +2 -0
- package/dist/module-hooks/persistence.js +1 -1
- package/dist/panel.js +1 -1
- package/dist/preferences.js +1 -2
- package/dist/provider.js +1 -1
- package/dist/styles.tw3.css +0 -45
- package/dist/ui-save.js +1 -1
- package/dist/utils/deferred-module.js +1 -1
- package/dist/version.js +1 -1
- package/dist-types/chunk-warming.d.ts +41 -8
- package/dist-types/component-hooks/use-headless-iab-consent-ui.d.ts +1 -1
- package/dist-types/components/iab-panel/atoms/purpose-item.d.ts +4 -1
- package/dist-types/components/iab-panel/atoms/stack-item.d.ts +6 -1
- package/dist-types/components/iab-panel/index.d.ts +1 -0
- package/dist-types/components/panel/index.d.ts +1 -0
- package/dist-types/components/panel/panel.d.ts +1 -1
- package/dist-types/components/panel-trigger/atoms/trigger-icons.d.ts +20 -0
- package/dist-types/components/preferences/index.d.ts +1 -0
- package/dist-types/components/shared/ui/accordion/accordion.d.ts +1 -0
- package/dist-types/components/shared/ui/collapsible/collapsible.d.ts +1 -0
- package/dist-types/components/shared/ui/logo.d.ts +0 -10
- package/dist-types/components/shared/ui/preference-item/preference-item.d.ts +14 -0
- package/dist-types/components/shared/ui/switch/switch.d.ts +1 -0
- package/dist-types/components/shared/ui/tabs/tabs.d.ts +1 -0
- package/dist-types/consent-theme.d.ts +38 -0
- package/dist-types/draft.d.ts +43 -6
- package/dist-types/headless.d.ts +0 -1
- package/dist-types/hooks/use-committed-ref.d.ts +24 -0
- package/dist-types/hooks.d.ts +2 -0
- package/dist-types/index.d.ts +3 -2
- package/dist-types/kernel-selector.d.ts +66 -0
- package/dist-types/module-hooks/iframe-blocker.d.ts +27 -0
- package/dist-types/module-hooks/network-blocker.d.ts +23 -0
- package/dist-types/module-hooks/network-hold.d.ts +47 -0
- package/dist-types/panel.d.ts +13 -1
- package/dist-types/preferences.d.ts +12 -1
- package/dist-types/provider.d.ts +41 -8
- package/dist-types/ui-config-context.d.ts +2 -0
- package/dist-types/ui-save.d.ts +21 -1
- package/dist-types/utils/deferred-module.d.ts +3 -1
- package/dist-types/version.d.ts +1 -1
- package/docs/README.md +6 -1
- package/docs/customization/overview.md +4 -3
- package/docs/customization/recipes.md +4 -2
- package/docs/customization/tokens.md +66 -3
- package/docs/frameworks/react/components/consent-dialog.md +45 -6
- package/docs/frameworks/react/components/consent-gate.md +8 -4
- package/docs/frameworks/react/components/consent-manager-provider.md +34 -14
- package/docs/frameworks/react/components/consent-widget.md +9 -0
- package/docs/frameworks/react/concepts/consent-categories.md +8 -1
- package/docs/frameworks/react/hooks/{use-consent-manager/overview.md → overview.md} +7 -5
- package/docs/frameworks/react/iab/overview.md +121 -1
- package/docs/frameworks/react/network-blocker.md +146 -0
- package/docs/frameworks/react/script-loader.md +6 -0
- package/docs/frameworks/react/styling/overview.md +71 -22
- package/docs/guides/consent-state.md +327 -0
- package/docs/guides/shared-consent-controls.md +158 -0
- package/docs/integrations/adobe-analytics.md +1 -1
- package/docs/integrations/ahrefs-analytics.md +1 -1
- package/docs/integrations/amplitude.md +1 -1
- package/docs/integrations/clearbit.md +1 -1
- package/docs/integrations/cloudflare-web-analytics.md +1 -1
- package/docs/integrations/cloudflare-zaraz.md +1 -1
- package/docs/integrations/crisp.md +1 -1
- package/docs/integrations/databuddy.md +1 -1
- package/docs/integrations/fathom-analytics.md +1 -1
- package/docs/integrations/front-chat.md +322 -0
- package/docs/integrations/google-maps.md +1 -1
- package/docs/integrations/google-tag-manager.md +1 -1
- package/docs/integrations/google-tag.md +1 -1
- package/docs/integrations/granular-consent.md +3 -1
- package/docs/integrations/heap.md +1 -1
- package/docs/integrations/hightouch.md +1 -1
- package/docs/integrations/hotjar.md +1 -1
- package/docs/integrations/intercom.md +1 -1
- package/docs/integrations/linkedin-insights.md +1 -1
- package/docs/integrations/logrocket.md +1 -1
- package/docs/integrations/matomo-analytics.md +1 -1
- package/docs/integrations/meta-pixel.md +1 -1
- package/docs/integrations/microsoft-clarity.md +1 -1
- package/docs/integrations/microsoft-uet.md +1 -1
- package/docs/integrations/mixpanel-analytics.md +1 -1
- package/docs/integrations/one-dollar-stats.md +305 -0
- package/docs/integrations/openai-pixel.md +1 -1
- package/docs/integrations/overview.md +17 -14
- package/docs/integrations/pinterest-tag.md +321 -0
- package/docs/integrations/pirsch.md +1 -1
- package/docs/integrations/plausible-analytics.md +1 -1
- package/docs/integrations/posthog.md +1 -1
- package/docs/integrations/promptwatch.md +1 -1
- package/docs/integrations/reddit-pixel.md +1 -1
- package/docs/integrations/rudderstack.md +1 -1
- package/docs/integrations/rybbit-analytics.md +1 -1
- package/docs/integrations/segment.md +1 -1
- package/docs/integrations/snapchat-pixel.md +1 -1
- package/docs/integrations/tiktok-pixel.md +1 -1
- package/docs/integrations/umami-analytics.md +1 -1
- package/docs/integrations/vercel-analytics.md +1 -1
- package/docs/integrations/x-pixel.md +1 -1
- package/docs/integrations/youtube.md +1 -1
- package/docs/upgrade-v3.md +129 -1
- package/package.json +7 -7
- package/dist/component-hooks/use-manager.js +0 -2
- package/dist-types/component-hooks/use-manager.d.ts +0 -45
package/AGENTS.md
CHANGED
|
@@ -32,8 +32,9 @@ These docs describe v3. Start with Inth hosted setup, identify the framework, ro
|
|
|
32
32
|
- [Consent categories](./docs/frameworks/react/concepts/consent-categories.md): Assign optional features to categories and understand how policy scope affects permission.
|
|
33
33
|
- [Policy presets](./docs/frameworks/react/concepts/policy-presets.md): Understand how policy rules affect React prompts, permissions and persistent privacy controls.
|
|
34
34
|
- [Headless](./docs/frameworks/react/headless.md): Build a custom consent banner in React with the c15t/react/headless hooks inside your ConsentProvider.
|
|
35
|
-
- [Hooks](./docs/frameworks/react/hooks/
|
|
35
|
+
- [Hooks](./docs/frameworks/react/hooks/overview.md): Gate features and save consent choices in React components with the focused hooks exported from c15t/react.
|
|
36
36
|
- [IAB TCF](./docs/frameworks/react/iab/overview.md): Mount the IAB TCF banner and dialog inside a React ConsentProvider and configure the CMP ID, policy and vendor data.
|
|
37
|
+
- [Block network requests](./docs/frameworks/react/network-blocker.md): Block fetch and XHR calls to third-party domains in a React app until the visitor grants their consent category.
|
|
37
38
|
- [Quickstart](./docs/frameworks/react/quickstart.md): Connect a React application to Inth and add consent UI, persistence and a preferences link.
|
|
38
39
|
- [Load scripts with consent](./docs/frameworks/react/script-loader.md): Register vendor scripts once and let effective permissions control loading.
|
|
39
40
|
- [Styling](./docs/frameworks/react/styling/overview.md): Import the React stylesheet and theme c15t components with tokens, slots, and class names on ConsentProvider.
|
|
@@ -44,6 +45,7 @@ These docs describe v3. Start with Inth hosted setup, identify the framework, ro
|
|
|
44
45
|
- [Understand consent state](./docs/guides/consent-state.md): Distinguish policy resolution, effective permissions, explicit choices, notices and privacy signals.
|
|
45
46
|
- [Data fetching and transports](./docs/guides/data-fetching.md): Choose cached manifests, backend init or offline policy resolution, and understand where consent records are saved.
|
|
46
47
|
- [Choose a deployment mode](./docs/guides/deployment-modes.md): Choose who runs your consent backend, then select manifest, init or offline resolution for your deployment.
|
|
48
|
+
- [Share consent controls across frameworks](./docs/guides/shared-consent-controls.md): Use the same c15t script lifecycle, external consent source, and event controls in every framework.
|
|
47
49
|
- [Troubleshoot consent](./docs/guides/troubleshooting.md): Diagnose missing banners, early vendor requests, lost choices and hydration differences.
|
|
48
50
|
- [Verify consent before shipping](./docs/guides/verify-consent.md): Test requests, policy resolution, persistence, navigation and preference changes in a production build.
|
|
49
51
|
|
|
@@ -68,6 +70,7 @@ These docs describe v3. Start with Inth hosted setup, identify the framework, ro
|
|
|
68
70
|
- [Crisp](./docs/integrations/crisp.md): Configure Crisp with c15t v3, understand functionality permission and verify loading and revocation.
|
|
69
71
|
- [Databuddy](./docs/integrations/databuddy.md): Configure Databuddy's initial and updated consent state with c15t v3.
|
|
70
72
|
- [Fathom Analytics](./docs/integrations/fathom-analytics.md): Configure Fathom Analytics with c15t v3, understand measurement permission and verify loading and revocation.
|
|
73
|
+
- [Front Chat](./docs/integrations/front-chat.md): Load the Front Chat widget with functionality permission, forward CSP nonces and clear the session on revocation.
|
|
71
74
|
- [Google Maps](./docs/integrations/google-maps.md): Prevent a map iframe from mounting before the required permission.
|
|
72
75
|
- [Google Tag](./docs/integrations/google-tag.md): Configure gtag with c15t Consent Mode signals and understand its loading behavior.
|
|
73
76
|
- [Google Tag Manager](./docs/integrations/google-tag-manager.md): Load GTM with c15t consent signals and verify the tags inside your container.
|
|
@@ -83,8 +86,10 @@ These docs describe v3. Start with Inth hosted setup, identify the framework, ro
|
|
|
83
86
|
- [Microsoft Clarity](./docs/integrations/microsoft-clarity.md): Configure Microsoft Clarity with c15t v3, understand measurement permission and verify loading and revocation.
|
|
84
87
|
- [Microsoft UET](./docs/integrations/microsoft-uet.md): Configure Microsoft UET with c15t v3, understand marketing permission and verify loading and revocation.
|
|
85
88
|
- [Mixpanel](./docs/integrations/mixpanel-analytics.md): Configure Mixpanel with c15t v3, understand measurement permission and verify loading and revocation.
|
|
89
|
+
- [OneDollarStats](./docs/integrations/one-dollar-stats.md): Load the OneDollarStats tracker with measurement permission, forward its settings and verify loading and revocation.
|
|
86
90
|
- [OpenAI Pixel](./docs/integrations/openai-pixel.md): Configure the OpenAI Measurement Pixel for ChatGPT Ads with c15t v3, manage marketing permission and verify conversion delivery.
|
|
87
91
|
- [Overview](./docs/integrations/overview.md): Find all c15t integrations for analytics, tag managers, advertising, chat and embedded content.
|
|
92
|
+
- [Pinterest Tag](./docs/integrations/pinterest-tag.md): Configure the Pinterest Tag with c15t v3, track typed events and verify marketing permission, revocation and reload.
|
|
88
93
|
- [Pirsch](./docs/integrations/pirsch.md): Configure Pirsch with c15t v3, understand measurement permission and verify loading and revocation.
|
|
89
94
|
- [Plausible Analytics](./docs/integrations/plausible-analytics.md): Configure Plausible Analytics with c15t v3, understand measurement permission and verify loading and revocation.
|
|
90
95
|
- [PostHog](./docs/integrations/posthog.md): Choose PostHog loading and cookieless behavior, configure the region, and synchronize v3 permissions.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as o}from"react/jsx-runtime";import{registerDialogChunkWarmer as e}from"./chunk-warming.js";import{useActiveUI as t}from"./hooks.js";import{createDeferredModule as
|
|
2
|
+
import{jsx as o}from"react/jsx-runtime";import{registerDialogChunkWarmer as e,useIdleDialogWarming as n}from"./chunk-warming.js";import{useActiveUI as t}from"./hooks.js";import{createDeferredModule as r}from"./utils/deferred-module.js";let i=r(()=>import("./components/panel/index.js")),c=r(()=>import("./components/preferences/index.js"));e(()=>{i.preload()});let s=i.component(o=>o.ConsentDialog),l=c.component(o=>o.ConsentWidget),a=function(o,e,n){let t={};for(let r of e)Object.defineProperty(o,r,{configurable:!0,enumerable:!0,get:()=>(t[r]??=n(r),t[r])});return o},d=a(e=>{let r=t();return(n("banner"===r),!0===e.open||"dialog"===r||e.showTrigger)?o(s,{...e}):null},["Card","Header","HeaderTitle","HeaderDescription","Content","Footer","ConsentCustomizationCard","ConsentDialogFooter","ConsentDialogHeader","ConsentDialogHeaderTitle","ConsentDialogHeaderDescription","ConsentDialogContent","Overlay","Root"],o=>i.component(e=>e[o])),m=a(e=>o(l,{...e}),["AccordionTrigger","AccordionTriggerInner","AccordionContent","AccordionArrow","Accordion","Switch","AccordionItems","AccordionItem","VendorList","Root","AcceptAllButton","CustomizeButton","SaveButton","RejectButton","PolicyActions","Footer","FooterSubGroup"],o=>c.component(e=>e[o]));export{d as ConsentDialog,m as ConsentWidget};
|
package/dist/chunk-warming.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
let
|
|
1
|
+
import{useEffect as e}from"react";import{useUIConfig as n}from"./ui-config-context.js";let t=new Set,i=!1,r=function(e){return t.add(e),i&&e(),()=>{t.delete(e)}},a=function(){for(let e of(i=!0,t))e()},o=new Set(["slow-2g","2g"]),u=function(){if("u"<typeof navigator||!1===navigator.onLine)return!1;let{connection:e}=navigator;return e?.saveData!==!0&&!o.has(e?.effectiveType??"")},l=0,g=!1,s=function(){g=!1,l>0&&u()&&a()},c=function(){if(g||i||!u())return;g=!0;let e=()=>{"function"==typeof window.requestIdleCallback?window.requestIdleCallback(s):window.setTimeout(s,200)};"complete"===document.readyState?e():window.addEventListener("load",e,{once:!0})},f=function(t){let{preloadDialog:i="idle"}=n(),r=t&&"idle"===i;e(()=>{if(r)return l+=1,c(),()=>{l-=1}},[r])},m=function(){i=!1,l=0,g=!1};export{r as registerDialogChunkWarmer,m as resetDialogChunkWarmingForTests,f as useIdleDialogWarming,a as warmDialogChunk};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{resolveIABBannerSummary as e}from"@c15t/iab/headless";import{useCallback as
|
|
2
|
+
import{resolveIABBannerSummary as e}from"@c15t/iab/headless";import{useCallback as o,useContext as s,useMemo as t}from"react";import{KernelContext as r}from"../context.js";import{useActiveUI as a,usePreferencesPresentation as c,usePromptPresentation as n,useSetActiveUI as l}from"../hooks.js";import{useIAB as i}from"../iab-context.js";import{saveIABConsentUI as m}from"../ui-save.js";let d=function(){let d=i(),f=s(r),p=a()??"none",u=n(),b=c(),v=l(),j=t(()=>e(d),[d]),g=o(()=>{d?.setPreferenceCenterTab("vendors"),v("dialog")},[d,v]),k=o(()=>v("none"),[v]),_=o(e=>{e?.tab&&d?.setPreferenceCenterTab(e.tab),v("dialog")},[d,v]),A=o(async e=>{d&&("accept"===e?d.acceptAll():"reject"===e&&d.rejectAll(),await (f?m(f,d.save):d.save()))},[d,f]),C=o(async e=>{"customize"===e?_():await A(e)},[_,A]),I=o(e=>A("customize"===e?void 0:e),[A]);return{activeUI:p,banner:{...j,scrollLock:u.scrollLock},closeUI:k,dialog:{isReady:!!(d?.gvl||d?.gvlReference),scrollLock:b.scrollLock},iab:d,openDialog:_,openVendorsDialog:g,performBannerAction:C,performDialogAction:I}};export{d as useHeadlessIABConsentUI};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{useCallback as e}from"react";import{useActiveUI as r,
|
|
2
|
+
import{useCallback as e}from"react";import{useActiveUI as r,useHasConsentPreferences as o,usePromptRequirement as i,useSetActiveUI as t}from"../hooks.js";let n=function(n={}){let{showWhen:s="always",onClick:a}=n,g=t(),l=r(),p=i(),m=o(),u=e(()=>{a?.(),g("dialog")},[a,g]),f="after-prompt"!==s||"none"===p.kind;return{isVisible:m&&"never"!==s&&"dialog"!==l&&f,openDialog:u}};export{n as useConsentDialogTrigger};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e,jsxs as o}from"react/jsx-runtime";import{forwardRef as r,useEffect as t}from"react";import{
|
|
2
|
+
import{jsx as e,jsxs as o}from"react/jsx-runtime";import{forwardRef as r,useEffect as t}from"react";import{useTranslations as s}from"../../component-hooks/use-translations.js";import{usePolicyCategories as i,usePolicyScopeMode as l,useRegisterConsentCategories as n}from"../../hooks.js";import{useIsHydrated as c}from"../../hooks/use-is-hydrated.js";import{useCategoryAllowed as a}from"../../kernel-selector.js";import{ConsentGateButton as m,ConsentGateRoot as d,ConsentGateTitle as p}from"./atoms.js";let y=({category:r,policyBlocked:t,policyBlockedMessage:s})=>o(d,{children:[e(p,{category:r,children:t?s??"This content is unavailable under your region's consent policy.":void 0}),t?null:e(m,{category:r})]}),u=r(({children:o,category:r,placeholder:m,noStyle:d,className:p,theme:u,...h},f)=>{let k=a(r),j=c(),g=i(),v=l(),B=n(),{frame:x}=s(),C="necessary"!==r&&!g.includes("*")&&!g.includes(r);return t(()=>{B([r])},[r,B]),e("div",{ref:f,className:p,...h,children:k?j?o:null:m||e(y,{category:r,policyBlocked:"strict"===v&&C,policyBlockedMessage:x?.policyBlocked})})});u.displayName="ConsentGate";let h=u;export{h as ConsentGate};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as t}from"react/jsx-runtime";import{forwardRef as o}from"react";import{ConsentButton as i}from"../shared/primitives/button.js";import{
|
|
2
|
+
import{jsx as t}from"react/jsx-runtime";import{forwardRef as o}from"react";import{ConsentButton as i}from"../shared/primitives/button.js";import{useHasConsentPreferences as n,usePolicyRule as r}from"../../hooks.js";let e=o(({children:o,noStyle:e=!0,...a},s)=>{let l=r();return n()?t(i,{ref:s,action:"open-consent-dialog",noStyle:e,"data-testid":"consent-dialog-link","data-c15t-rights":l.rights.join(" "),...a,children:o}):null});e.displayName="ConsentDialogLink";export{e as ConsentDialogLink};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{Fragment as e,jsx as t,jsxs as r}from"react/jsx-runtime";import{iabDisplayTestId as n}from"@c15t/iab/headless";import i from"@c15t/ui/styles/components/iab-consent-dialog";import{useState as o}from"react";import{useTheme as s}from"../../../hooks/use-theme.js";import{useUIConfig as l}from"../../../ui-config-context.js";import{mergeSlotProps as a}from"../../../utils/merge-slot-props.js";import{useIABTranslations as c}from"../use-iab-translations.js";import*as d from"../../shared/ui/preference-item/index.js";import*as p from"../../shared/ui/switch/index.js";let m={},h={},g=({vendor:e,isConsented:n,onToggle:o,onClick:s,isLegitimateInterest:l=!1,isLegitimateInterestAllowed:a=!0,onLegitimateInterestToggle:d})=>{let m=c(),h=l&&d;return r("div",{className:`${i.vendorRow} ${l?i.vendorRowLi:""}`,children:[r("div",{className:i.vendorInfo,children:[r("button",{type:"button",onClick:s,className:i.vendorName,children:[t("span",{children:e.name}),e.isCustom&&r("svg",{className:i.customVendorIcon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-label":m.common.customPartner,children:[t("circle",{cx:"12",cy:"12",r:"10"}),t("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),t("path",{d:"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"})]})]}),r("div",{className:i.vendorDetails,children:[l&&t("span",{className:`${i.vendorDetail} ${i.vendorDetailLi}`,children:m.preferenceCenter.purposeItem.legitimateInterest}),e.usesCookies&&t("span",{className:i.vendorDetail,children:m.preferenceCenter.vendorList.usesCookies}),e.usesNonCookieAccess&&t("span",{className:i.vendorDetail,children:m.preferenceCenter.vendorList.nonCookieAccess})]})]}),h?t("button",{type:"button",onClick:()=>d(!a),className:`${i.objectButton} ${a?"":i.objectButtonActive}`,"aria-pressed":!a,children:a?m.preferenceCenter.purposeItem.objectButton:m.preferenceCenter.purposeItem.objected}):t(p.Root,{"aria-label":e.name,checked:n,onCheckedChange:o,size:"small"})]})},u=({purpose:u,testId:v,isEnabled:C,onToggle:f,vendorConsents:I,onVendorToggle:N,onVendorClick:k,isLocked:y=!1,vendorLegitimateInterests:b=m,onVendorLegitimateInterestToggle:x,purposeLegitimateInterests:S=h,onPurposeLegitimateInterestToggle:M})=>{let{components:L}=l(),{noStyle:w}=s(),[T
|
|
2
|
+
import{Fragment as e,jsx as t,jsxs as r}from"react/jsx-runtime";import{iabDisplayTestId as n}from"@c15t/iab/headless";import i from"@c15t/ui/styles/components/iab-consent-dialog";import{useState as o}from"react";import{useTheme as s}from"../../../hooks/use-theme.js";import{useUIConfig as l}from"../../../ui-config-context.js";import{mergeSlotProps as a}from"../../../utils/merge-slot-props.js";import{useIABTranslations as c}from"../use-iab-translations.js";import*as d from"../../shared/ui/preference-item/index.js";import*as p from"../../shared/ui/switch/index.js";let m={},h={},g=({vendor:e,isConsented:n,onToggle:o,onClick:s,isLegitimateInterest:l=!1,isLegitimateInterestAllowed:a=!0,onLegitimateInterestToggle:d})=>{let m=c(),h=l&&d;return r("div",{className:`${i.vendorRow} ${l?i.vendorRowLi:""}`,children:[r("div",{className:i.vendorInfo,children:[r("button",{type:"button",onClick:s,className:i.vendorName,children:[t("span",{children:e.name}),e.isCustom&&r("svg",{className:i.customVendorIcon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-label":m.common.customPartner,children:[t("circle",{cx:"12",cy:"12",r:"10"}),t("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),t("path",{d:"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"})]})]}),r("div",{className:i.vendorDetails,children:[l&&t("span",{className:`${i.vendorDetail} ${i.vendorDetailLi}`,children:m.preferenceCenter.purposeItem.legitimateInterest}),e.usesCookies&&t("span",{className:i.vendorDetail,children:m.preferenceCenter.vendorList.usesCookies}),e.usesNonCookieAccess&&t("span",{className:i.vendorDetail,children:m.preferenceCenter.vendorList.nonCookieAccess})]})]}),h?t("button",{type:"button",onClick:()=>d(!a),className:`${i.objectButton} ${a?"":i.objectButtonActive}`,"aria-pressed":!a,children:a?m.preferenceCenter.purposeItem.objectButton:m.preferenceCenter.purposeItem.objected}):t(p.Root,{"aria-label":e.name,checked:n,onCheckedChange:o,size:"small"})]})},u=({purpose:u,testId:v,isEnabled:C,onToggle:f,vendorConsents:I,onVendorToggle:N,onVendorClick:k,isLocked:y=!1,vendorLegitimateInterests:b=m,onVendorLegitimateInterestToggle:x,purposeLegitimateInterests:S=h,onPurposeLegitimateInterestToggle:M})=>{let{components:L}=l(),{noStyle:w}=s(),[B,T]=o(!1),[j,W]=o(!1),[$,A]=o(!1),R=c(),D=u.vendors.filter(e=>e.usesLegitimateInterest),O=u.vendors.filter(e=>!e.usesLegitimateInterest),P=e=>I[String(e)]??!1,H=e=>b[String(e)]??!0,U=S[u.id]??!0,V=O.filter(e=>!e.isCustom),z=O.filter(e=>e.isCustom),K=D.filter(e=>!e.isCustom),E=D.filter(e=>e.isCustom),Y=!1!==u.hasConsentBasis||!M,q=a(L?.["iab-purpose-item"]?.header,{baseClassName:i.purposeHeader,noStyle:w}),F=a(L?.["iab-purpose-item"]?.legitimateInterest,{baseClassName:i.purposeLiSection,noStyle:w}),G=a(L?.["iab-purpose-item"]?.examples,{noStyle:w}),J=a(L?.["iab-purpose-item"]?.vendors,{noStyle:w});return r(d.Root,{className:w?void 0:i.purposeItem,"data-testid":v??n("purpose",u.id),noStyle:!0,onOpenChange:T,open:B,slotKey:"iab-purpose-item.root",children:[r("div",{...q,children:[r(d.Trigger,{className:w?void 0:i.purposeTrigger,noStyle:!0,slotKey:"iab-purpose-item.trigger",children:[t(d.Leading,{noStyle:!0,children:t("svg",{className:i.purposeArrow,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:B?t("path",{d:"M19 9l-7 7-7-7"}):t("path",{d:"M9 5l7 7-7 7"})})}),r(d.Header,{className:i.purposeInfo,noStyle:!0,children:[r(d.Title,{className:i.purposeName,noStyle:!0,children:[u.name,y&&r("svg",{className:i.lockIcon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),t("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})]}),t(d.Meta,{className:i.purposeMeta,noStyle:!0,children:R.preferenceCenter.purposeItem.partners.replace("{count}",String(u.vendors.length))}),D.length>0&&r(d.Auxiliary,{className:i.legitimateInterestBadge,noStyle:!0,children:[t("svg",{className:i.legitimateInterestIcon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t("path",{d:"M12 3v18M3 12h18M4.93 4.93l14.14 14.14M19.07 4.93L4.93 19.07"})}),R.preferenceCenter.purposeItem.vendorsUseLegitimateInterest.replace("{count}",String(D.length))]})]})]}),Y&&t(d.Control,{noStyle:!0,children:t(p.Root,{"aria-label":u.name,checked:C,onCheckedChange:e=>{for(let t of(f(e),O))N(t.id,e)},disabled:y})})]}),r(d.Content,{innerClassName:w?void 0:i.purposeContent,innerSlotKey:"iab-purpose-item.content",noStyle:w,children:[t("p",{className:i.purposeDescription,children:u.description}),D.length>0&&M&&r("div",{...F,children:[r("div",{className:i.purposeLiSectionHeader,children:[r("div",{className:i.purposeLiInfo,children:[t("svg",{className:i.legitimateInterestIcon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t("path",{d:"M12 3v18M3 12h18M4.93 4.93l14.14 14.14M19.07 4.93L4.93 19.07"})}),t("span",{children:R.preferenceCenter.purposeItem.vendorsUseLegitimateInterest.replace("{count}",String(D.length))})]}),t("button",{type:"button",onClick:()=>{let e=!U;if(M&&M(u.id,e),x)for(let t of D)x(t.id,e)},className:`${i.objectButton} ${U?"":i.objectButtonActive}`,"aria-pressed":!U,children:U?R.preferenceCenter.purposeItem.objectButton:R.preferenceCenter.purposeItem.objected})]}),t("p",{className:i.liExplanation,children:R.preferenceCenter.purposeItem.rightToObject})]}),D.length>0&&!M&&r("div",{className:i.legitimateInterestBadge,children:[t("svg",{className:i.legitimateInterestIcon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t("path",{d:"M12 3v18M3 12h18M4.93 4.93l14.14 14.14M19.07 4.93L4.93 19.07"})}),R.preferenceCenter.purposeItem.vendorsUseLegitimateInterest.replace("{count}",String(D.length))]}),u.illustrations&&u.illustrations.length>0&&t("div",{...G,children:r(d.Root,{noStyle:!0,onOpenChange:W,open:j,children:[r(d.Trigger,{className:i.examplesToggle,noStyle:!0,children:[t("svg",{style:{height:"0.75rem",width:"0.75rem"},viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:j?t("path",{d:"M19 9l-7 7-7-7"}):t("path",{d:"M9 5l7 7-7 7"})}),R.preferenceCenter.purposeItem.examples," (",u.illustrations.length,")"]}),t(d.Content,{noStyle:w,children:t("ul",{className:i.examplesList,children:u.illustrations.map((e,r)=>t("li",{children:e},r))})})]})}),t("div",{...J,children:r(d.Root,{noStyle:!0,onOpenChange:A,open:$,children:[r(d.Trigger,{className:i.vendorsToggle,noStyle:!0,children:[t("svg",{style:{height:"0.75rem",width:"0.75rem"},viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:$?t("path",{d:"M19 9l-7 7-7-7"}):t("path",{d:"M9 5l7 7-7 7"})}),R.preferenceCenter.purposeItem.partnersUsingPurpose," (",u.vendors.length,")"]}),r(d.Content,{innerClassName:i.vendorSection,noStyle:w,children:[V.length>0&&r(e,{children:[r("h5",{className:i.vendorSectionTitle,children:[R.preferenceCenter.purposeItem.withYourPermission," (",V.length,")"]}),V.map(e=>t(g,{vendor:e,isConsented:P(e.id),onToggle:t=>N(e.id,t),onClick:()=>k(e.id)},e.id))]}),K.length>0&&r(e,{children:[r("h5",{className:`${i.vendorSectionTitle} ${i.vendorSectionTitleLi}`,children:[t("svg",{className:i.legitimateInterestIcon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t("path",{d:"M12 3v18M3 12h18M4.93 4.93l14.14 14.14M19.07 4.93L4.93 19.07"})}),R.preferenceCenter.purposeItem.legitimateInterest," (",K.length,")"]}),t("p",{className:i.liExplanation,children:R.preferenceCenter.purposeItem.rightToObject}),K.map(e=>t(g,{vendor:e,isConsented:P(e.id),onToggle:t=>N(e.id,t),onClick:()=>k(e.id),isLegitimateInterest:!0,isLegitimateInterestAllowed:H(e.id),onLegitimateInterestToggle:x?t=>x(e.id,t):void 0},e.id))]}),(z.length>0||E.length>0)&&r("div",{className:i.customVendorPurposeSection,children:[r("h5",{className:i.vendorSectionTitleCustom,children:[r("svg",{className:i.legitimateInterestIcon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t("circle",{cx:"12",cy:"12",r:"10"}),t("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),t("path",{d:"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"})]}),R.preferenceCenter.vendorList.customVendorsHeading," (",z.length+E.length,")"]}),z.map(e=>t(g,{vendor:e,isConsented:P(e.id),onToggle:t=>N(e.id,t),onClick:()=>k(e.id)},e.id)),E.map(e=>t(g,{vendor:e,isConsented:P(e.id),onToggle:t=>N(e.id,t),onClick:()=>k(e.id),isLegitimateInterest:!0,isLegitimateInterestAllowed:H(e.id),onLegitimateInterestToggle:x?t=>x(e.id,t):void 0},e.id))]})]})]})})]})]})};export{u as PurposeItem};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{Fragment as e,jsx as t,jsxs as r}from"react/jsx-runtime";import s from"@c15t/ui/styles/components/iab-consent-dialog";import{useState as o}from"react";import{useTheme as i}from"../../../hooks/use-theme.js";import{useUIConfig as a}from"../../../ui-config-context.js";import{mergeSlotProps as n}from"../../../utils/merge-slot-props.js";import{useIABTranslations as l}from"../use-iab-translations.js";import{PurposeItem as c}from"./purpose-item.js";import*as d from"../../shared/ui/preference-item/index.js";import*as m from"../../shared/ui/switch/index.js";let p={},h={},g=({stack:g,consents:
|
|
2
|
+
import{Fragment as e,jsx as t,jsxs as r}from"react/jsx-runtime";import s from"@c15t/ui/styles/components/iab-consent-dialog";import{useState as o}from"react";import{useTheme as i}from"../../../hooks/use-theme.js";import{useUIConfig as a}from"../../../ui-config-context.js";import{mergeSlotProps as n}from"../../../utils/merge-slot-props.js";import{useIABTranslations as l}from"../use-iab-translations.js";import{PurposeItem as c}from"./purpose-item.js";import*as d from"../../shared/ui/preference-item/index.js";import*as m from"../../shared/ui/switch/index.js";let p={},h={},g=({stack:g,consents:f,onToggle:k,vendorConsents:u,onVendorToggle:v,onVendorClick:C,vendorLegitimateInterests:y=p,onVendorLegitimateInterestToggle:N,purposeLegitimateInterests:b=h,onPurposeLegitimateInterestToggle:S})=>{let{components:I}=a(),{noStyle:j}=i(),L=l(),[T,x]=o(!1),M=g.purposes.filter(e=>!1!==e.hasConsentBasis||void 0===S),w=M.every(e=>f[e.id]??!1),P=M.some(e=>f[e.id]??!1)&&!w,V=n(I?.["iab-stack-item"]?.header,{baseClassName:s.stackHeader,noStyle:j}),B=new Set(g.purposes.flatMap(e=>e.vendors.map(e=>e.id))).size;return r(d.Root,{className:j?void 0:s.stackItem,"data-testid":`stack-item-${g.id}`,noStyle:!0,onOpenChange:x,open:T,slotKey:"iab-stack-item.root",children:[r("div",{...V,children:[r(d.Trigger,{className:j?void 0:s.stackTrigger,noStyle:!0,slotKey:"iab-stack-item.trigger",children:[t(d.Leading,{noStyle:!0,children:t("svg",{className:s.purposeArrow,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:T?t("path",{d:"M19 9l-7 7-7-7"}):t("path",{d:"M9 5l7 7-7 7"})})}),r(d.Header,{className:s.stackInfo,noStyle:!0,children:[t(d.Title,{className:s.stackName,noStyle:!0,children:g.name}),r(d.Meta,{className:s.stackMeta,noStyle:!0,children:[B," ",1===B?L.preferenceCenter.vendorList.partnerSingular:L.preferenceCenter.vendorList.partnerPlural]})]})]}),r(d.Control,{className:s.stackControls,noStyle:!0,children:[P&&r(e,{children:[t("span",{className:s.srOnly,children:"Partially enabled"}),t("div",{className:s.partialIndicator})]}),M.length>0&&t(m.Root,{"aria-label":g.name,checked:w,onCheckedChange:e=>{for(let t of M)for(let r of(k(t.id,e),t.vendors))r.usesLegitimateInterest||v(r.id,e)}})]})]}),r(d.Content,{noStyle:j,children:[t("div",{className:s.stackDescription,children:t("p",{children:g.description})}),t("div",{...n(I?.["iab-stack-item"]?.content,{baseClassName:s.stackContent,noStyle:j}),children:g.purposes.map(e=>t(c,{purpose:e,isEnabled:f[e.id]??!1,onToggle:t=>k(e.id,t),vendorConsents:u,onVendorToggle:v,onVendorClick:C,vendorLegitimateInterests:y,onVendorLegitimateInterestToggle:N,purposeLegitimateInterests:b,onPurposeLegitimateInterestToggle:S},e.id))})]})]})};export{g as StackItem};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{Fragment as e,jsx as t,jsxs as o}from"react/jsx-runtime";import{isDialogDismissKey as n}from"@c15t/ui/primitives/dialog";import r from"@c15t/ui/styles/components/consent-actions";import i from"@c15t/ui/styles/components/iab-consent-dialog";import{useCallback as a,useEffect as s,useLayoutEffect as l,useMemo as d,useRef as c,useState as m}from"react";import{createPortal as p}from"react-dom";import{useHeadlessIABConsentUI as u}from"../../component-hooks/use-headless-iab-consent-ui.js";import{useTranslations as g}from"../../component-hooks/use-translations.js";import{ConsentDialogTrigger as h}from"../panel-trigger/index.js";import{Branding as b}from"../panel/atoms/card.js";import{ConsentTrackingContext as y}from"../../context/consent-tracking-context.js";import{LocalThemeContext as v}from"../../context/theme-context.js";import{useComponentConfig as f}from"../../hooks/use-component-config.js";import{useFocusTrap as C}from"../../hooks/use-focus-trap.js";import{useIABConsentManager as S}from"../../hooks/use-iab-manager.js";import{useScrollLock as k}from"../../hooks/use-scroll-lock.js";import{useTextDirection as I}from"../../hooks/use-text-direction.js";import{useUIConfig as N}from"../../ui-config-context.js";import{mergeSlotProps as x}from"../../utils/merge-slot-props.js";import{IABConsentDialogOverlay as L}from"./atoms/overlay.js";import{PurposeItem as j}from"./atoms/purpose-item.js";import{StackItem as T}from"./atoms/stack-item.js";import{VendorList as A}from"./atoms/vendor-list.js";import{useIABDisplayModel as V}from"./hooks/use-display-model.js";import{useIABTranslations as F}from"./use-iab-translations.js";import*as w from"../shared/ui/button/index.js";import*as P from"../shared/ui/tabs/index.js";let B=["iab"],R={tabIndex:-1},$=({open:$,noStyle:M,disableAnimation:q,scrollLock:z,trapFocus:E,hideBranding:H,initialTab:W,showTrigger:D=!1,models:G=B,uiSource:O})=>{let _=F(),{common:J}=g(),{components:K}=N(),{iab:Q,activeUI:U,policyDialog:X,translationConfig:Y,model:Z}=S({preferences:{scrollLock:z,trapFocus:E}}),{banner:ee,closeUI:et,openDialog:eo,performDialogAction:en}=u(),er=X.blocking,ei=I(Y.defaultLanguage),ea=c(null),es=c(null),el=c(null),[ed,ec]=m(W??Q?.preferenceCenterTab??"purposes"),[em,ep]=m(null),[eu,eg]=m(!1),[eh,eb]=m(!1),[ey,ev]=m(!1),ef=null!==Z&&G.includes(Z)&&($??"dialog"===U),eC=f({disableAnimation:q,noStyle:M,scrollLock:er,trapFocus:X.blocking}),{consentRows:eS,essentialRows:ek,essentialPartnerCount:eI,purposeTabCount:eN,vendorTabCount:ex,data:{purposes:eL}}=V(),ej=a((e,t)=>{Q?.setPurposeConsent(e,t)},[Q]),eT=a((e,t)=>{Q?.setSpecialFeatureOptIn(e,t)},[Q]),eA=a((e,t)=>{Q?.setVendorConsent(e,t)},[Q]),eV=a((e,t)=>{Q?.setVendorLegitimateInterest(e,t)},[Q]),eF=a((e,t)=>{Q?.setPurposeLegitimateInterest(e,t)},[Q]),ew=async()=>{try{await en("accept")}catch{}},eP=async()=>{try{await en("reject")}catch{}},eB=async()=>{try{await en("customize")}catch{}},eR=a(()=>{et()},[et]),e$=e=>{ep(e),ec("vendors"),eo({tab:"vendors"})};C(!!(eh&&ef&&eC.trapFocus),ea),k(!!(ef&&eC.scrollLock)),s(()=>{if(!ef)return;let e=e=>{n(e.key)&&(e.preventDefault(),eR())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[eR,ef]),s(()=>{let e=requestAnimationFrame(()=>eb(!0));return()=>cancelAnimationFrame(e)},[]),s(()=>{if(ef){let e=requestAnimationFrame(()=>ev(!0));return()=>cancelAnimationFrame(e)}if(eC.disableAnimation){let e=requestAnimationFrame(()=>ev(!1));return()=>cancelAnimationFrame(e)}let e=setTimeout(()=>{ev(!1)},150);return()=>clearTimeout(e)},[ef,eC.disableAnimation]);let eM=c(!!W);s(()=>{let e=Q?.preferenceCenterTab;if(!(ef&&e))return;if(eM.current){eM.current=!1;return}let t=requestAnimationFrame(()=>{ec(e)});return()=>cancelAnimationFrame(t)},[ef,Q?.preferenceCenterTab]),l(()=>{let e,t;if("purposes"!==ed&&"vendors"!==ed)return;let o=es.current;if(!o||null===el.current)return;let n=el.current;if(el.current=null,!window.matchMedia("(prefers-reduced-motion: reduce)").matches)return o.style.height=`${n}px`,o.style.overflow="hidden",o.style.transition="none",e=requestAnimationFrame(()=>{t=requestAnimationFrame(()=>{if(!o)return;o.style.height="auto";let e=o.getBoundingClientRect().height;if(o.style.height=`${n}px`,1>Math.abs(n-e)){o.style.height="",o.style.overflow="",o.style.transition="";return}o.getBoundingClientRect(),o.style.transition="height 180ms cubic-bezier(0.33, 1, 0.68, 1)",o.style.height=`${e}px`,o.addEventListener("transitionend",e=>{"height"===e.propertyName&&(o.style.height="",o.style.overflow="",o.style.transition="")},{once:!0})})}),()=>{cancelAnimationFrame(e),cancelAnimationFrame(t)}},[ed]);let eq=a(e=>{es.current&&(el.current=es.current.offsetHeight),ec(e),eo({tab:e})},[eo]),ez=d(()=>({uiSource:O??"iab_dialog"}),[O]);if(!eh||!Q?.config.enabled)return null;let eE=Q.isLoadingGVL||!Q.gvl,eH=x(K?.["iab-dialog"]?.root,{baseClassName:`${i.root} ${ey?i.dialogVisible:i.dialogHidden}`,noStyle:eC.noStyle}),eW=x(K?.["iab-dialog"]?.card,{baseClassName:`${i.card} ${ey?i.contentVisible:i.contentHidden}`,noStyle:eC.noStyle}),eD=x(K?.["iab-dialog"]?.header,{baseClassName:i.header,noStyle:eC.noStyle}),eG=x(K?.["iab-dialog"]?.headerContent,{baseClassName:i.headerContent,noStyle:eC.noStyle}),eO=x(K?.["iab-dialog"]?.title,{baseClassName:i.title,noStyle:eC.noStyle}),e_=x(K?.["iab-dialog"]?.description,{baseClassName:i.description,noStyle:eC.noStyle}),eJ=x(K?.["iab-dialog"]?.closeButton,{baseClassName:i.closeButton,noStyle:eC.noStyle}),eK=x(K?.["iab-dialog"]?.body,{baseClassName:i.body,noStyle:eC.noStyle}),eQ=x(K?.["iab-dialog"]?.tabs,{baseClassName:i.tabsContainer,noStyle:eC.noStyle}),eU=x(K?.["iab-dialog"]?.tabsList,{baseClassName:i.tabsList,noStyle:eC.noStyle}),eX=x(K?.["iab-dialog"]?.tabTrigger,{baseClassName:i.tabButton,noStyle:eC.noStyle}),eY=x(K?.["iab-dialog"]?.tabIndicator,{baseClassName:i.tabIndicator,noStyle:eC.noStyle}),eZ=x(K?.["iab-dialog"]?.content,{baseClassName:i.content,noStyle:eC.noStyle}),e1=x(K?.["iab-dialog"]?.loading,{baseClassName:i.loadingContainer,noStyle:eC.noStyle}),e0=x(K?.["iab-dialog"]?.tabPanel,{baseClassName:i.tabPanel,noStyle:eC.noStyle}),e2=x(K?.["iab-dialog"]?.specialPurposes,{baseClassName:i.specialPurposesSection,noStyle:eC.noStyle}),e7=x(K?.["iab-dialog"]?.consentNotice,{baseClassName:i.consentNotice,noStyle:eC.noStyle}),e4=x(K?.["iab-dialog"]?.actions,{baseClassName:r.actionRoot,noStyle:eC.noStyle}),e8=x(K?.["iab-dialog"]?.footer,{baseClassName:i.footer,noStyle:eC.noStyle,...e4}),e5=x(K?.["iab-dialog"]?.actionGroup,{baseClassName:r.actionGroup,"data-direction":"row",noStyle:eC.noStyle}),e6=t(y.Provider,{value:ez,children:o(v.Provider,{value:eC,children:[t(L,{isOpen:ef}),t("div",{...eH,"data-testid":"iab-consent-dialog-root",dir:ei,children:o("div",{...eW,ref:ea,"aria-label":_.preferenceCenter.title,"aria-modal":eC.trapFocus?"true":void 0,role:"dialog",...R,"data-testid":"iab-consent-dialog-card",children:[o("div",{...eD,children:[o("div",{...eG,children:[t("h2",{...eO,children:_.preferenceCenter.title}),t("p",{...e_,children:_.preferenceCenter.description})]}),t("button",{...eJ,type:"button","data-testid":"iab-consent-dialog-close",onClick:eR,"aria-label":J.close,children:o("svg",{"aria-hidden":"true",style:{height:"1rem",width:"1rem"},viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),t("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),o(P.Root,{...eK,noStyle:!0,onValueChange:e=>eq(e),value:ed,children:[t("div",{...eQ,children:o(P.List,{...eU,noStyle:!0,children:[o(P.Trigger,{...eX,noStyle:!0,value:"purposes",children:[_.preferenceCenter.tabs.purposes,!eE&&` (${eN})`]}),o(P.Trigger,{...eX,noStyle:!0,value:"vendors",children:[_.preferenceCenter.tabs.vendors,!eE&&` (${ex})`]}),t("div",{...eY,"aria-hidden":"true","data-active-tab":ed})]})}),t("div",{...eZ,ref:es,children:eE?o("div",{...e1,children:[t("div",{className:i.loadingSpinner}),t("p",{className:i.loadingText,children:_.common.loading})]}):o(e,{children:[o(P.Content,{...e0,forceMount:!0,noStyle:!0,value:"purposes",children:[eS.map(e=>"stack"===e.kind?t(T,{stack:e,consents:Q.purposeConsents,onToggle:ej,vendorConsents:Q.vendorConsents,onVendorToggle:eA,onVendorClick:e$,vendorLegitimateInterests:Q.vendorLegitimateInterests,onVendorLegitimateInterestToggle:eV,purposeLegitimateInterests:Q.purposeLegitimateInterests,onPurposeLegitimateInterestToggle:eF},e.testId):t(j,{purpose:e,testId:e.testId,isEnabled:"special-feature"===e.toggle?Q.specialFeatureOptIns[e.id]??!1:Q.purposeConsents[e.id]??!1,onToggle:t=>{"special-feature"===e.toggle?eT(e.id,t):ej(e.id,t)},vendorConsents:Q.vendorConsents,onVendorToggle:eA,onVendorClick:e$,vendorLegitimateInterests:Q.vendorLegitimateInterests,onVendorLegitimateInterestToggle:eV,purposeLegitimateInterests:"purpose"===e.kind?Q.purposeLegitimateInterests:void 0,onPurposeLegitimateInterestToggle:"purpose"===e.kind?eF:void 0},e.testId)),ek.length>0&&o("div",{...e2,children:[o("div",{className:i.specialPurposesHeader,children:[o("button",{type:"button","aria-expanded":eu,onClick:()=>eg(!eu),className:i.purposeTrigger,children:[t("svg",{"aria-hidden":"true",className:i.purposeArrow,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:eu?t("path",{d:"M19 9l-7 7-7-7"}):t("path",{d:"M9 5l7 7-7 7"})}),o("div",{className:i.purposeInfo,children:[o("h3",{className:i.specialPurposesTitle,children:[_.preferenceCenter.specialPurposes.title,o("svg",{"aria-hidden":"true",className:i.lockIcon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),t("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})]}),o("p",{className:i.purposeMeta,children:[eI," ",1===eI?_.preferenceCenter.vendorList.partnerSingular:_.preferenceCenter.vendorList.partnerPlural]})]})]}),t("div",{style:{position:"relative"},children:o("svg",{className:i.infoIcon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-label":_.preferenceCenter.specialPurposes.tooltip,children:[t("circle",{cx:"12",cy:"12",r:"10"}),t("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),t("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]})})]}),eu&&t("div",{style:{padding:"0.75rem"},children:ek.map(e=>t(j,{purpose:e,testId:e.testId,isEnabled:!0,onToggle:()=>{},vendorConsents:Q.vendorConsents,onVendorToggle:eA,onVendorClick:e$,isLocked:!0},e.testId))})]}),t("div",{...e7,children:t("p",{className:i.consentNoticeText,children:_.preferenceCenter.footer.consentStorage})})]}),t(P.Content,{...e0,forceMount:!0,noStyle:!0,value:"vendors",children:t(A,{vendorData:Q.gvl,purposes:eL,vendorConsents:Q.vendorConsents,onVendorToggle:eA,selectedVendorId:em,onClearSelection:()=>ep(null),customVendors:Q.nonIABVendors,vendorLegitimateInterests:Q.vendorLegitimateInterests,onVendorLegitimateInterestToggle:eV})})]})})]}),o("div",{...e8,children:[o("div",{...e5,children:[t(w.Root,{variant:"neutral",mode:"stroke",size:"small",onClick:eP,disabled:!ee.isReady,"data-action":"reject",children:_.common.rejectAll}),t(w.Root,{variant:"neutral",mode:"stroke",size:"small",onClick:ew,disabled:!ee.isReady,"data-action":"accept",children:_.common.acceptAll})]}),t("div",{...e5,children:t(w.Root,{variant:"primary",mode:"filled",size:"small",onClick:eB,disabled:eE,"data-action":"customize",children:_.common.saveSettings})})]}),t(b,{hideBranding:H??!1,variant:"dialog-tag",slotContext:"iab-dialog","data-testid":"iab-consent-dialog-branding"})]})})]})}),e3=!0===D?{}:!1===D?null:D,e9=e3?t(h,{...e3}):null;return ef||ey?o(e,{children:[e9,p(e6,document.body)]}):e9};export{$ as IABConsentDialog};
|
|
2
|
+
import{Fragment as e,jsx as t,jsxs as o}from"react/jsx-runtime";import{applyPublisherRestrictionsToGVL as n}from"@c15t/iab/headless";import{isDialogDismissKey as r}from"@c15t/ui/primitives/dialog";import i from"@c15t/ui/styles/components/consent-actions";import a from"@c15t/ui/styles/components/iab-consent-dialog";import{useCallback as s,useEffect as l,useLayoutEffect as d,useMemo as c,useRef as m,useState as p}from"react";import{createPortal as u}from"react-dom";import{useHeadlessIABConsentUI as g}from"../../component-hooks/use-headless-iab-consent-ui.js";import{useTranslations as h}from"../../component-hooks/use-translations.js";import{ConsentDialogTrigger as b}from"../panel-trigger/index.js";import{Branding as y}from"../panel/atoms/card.js";import{ConsentTrackingContext as v}from"../../context/consent-tracking-context.js";import{LocalThemeContext as f}from"../../context/theme-context.js";import{useComponentConfig as C}from"../../hooks/use-component-config.js";import{useFocusTrap as S}from"../../hooks/use-focus-trap.js";import{useIABConsentManager as k}from"../../hooks/use-iab-manager.js";import{useScrollLock as I}from"../../hooks/use-scroll-lock.js";import{useTextDirection as N}from"../../hooks/use-text-direction.js";import{useUIConfig as x}from"../../ui-config-context.js";import{mergeSlotProps as L}from"../../utils/merge-slot-props.js";import{IABConsentDialogOverlay as j}from"./atoms/overlay.js";import{PurposeItem as T}from"./atoms/purpose-item.js";import{StackItem as A}from"./atoms/stack-item.js";import{VendorList as V}from"./atoms/vendor-list.js";import{useIABDisplayModel as F}from"./hooks/use-display-model.js";import{useIABTranslations as w}from"./use-iab-translations.js";import*as P from"../shared/ui/button/index.js";import*as B from"../shared/ui/tabs/index.js";let R=["iab"],$={tabIndex:-1},M=({open:M,noStyle:q,disableAnimation:z,scrollLock:E,trapFocus:H,hideBranding:W,initialTab:D,showTrigger:G=!1,models:O=R,uiSource:_})=>{let J=w(),{common:K}=h(),{components:Q}=x(),{iab:U,activeUI:X,policyDialog:Y,translationConfig:Z,model:ee}=k({preferences:{scrollLock:E,trapFocus:H}}),{banner:et,closeUI:eo,openDialog:en,performDialogAction:er}=g(),ei=Y.blocking,ea=N(Z.defaultLanguage),es=m(null),el=m(null),ed=m(null),[ec,em]=p(D??U?.preferenceCenterTab??"purposes"),[ep,eu]=p(null),[eg,eh]=p(!1),[eb,ey]=p(!1),[ev,ef]=p(!1),eC=null!==ee&&O.includes(ee)&&(M??"dialog"===X),eS=C({disableAnimation:z,noStyle:q,scrollLock:ei,trapFocus:Y.blocking}),{consentRows:ek,essentialRows:eI,essentialPartnerCount:eN,purposeTabCount:ex,vendorTabCount:eL,data:{purposes:ej}}=F(),eT=U?.gvl??null,eA=U?.publisherRestrictions,eV=c(()=>eT?n(eT,eA):null,[eT,eA]),eF=s((e,t)=>{U?.setPurposeConsent(e,t)},[U]),ew=s((e,t)=>{U?.setSpecialFeatureOptIn(e,t)},[U]),eP=s((e,t)=>{U?.setVendorConsent(e,t)},[U]),eB=s((e,t)=>{U?.setVendorLegitimateInterest(e,t)},[U]),eR=s((e,t)=>{U?.setPurposeLegitimateInterest(e,t)},[U]),e$=async()=>{try{await er("accept")}catch{}},eM=async()=>{try{await er("reject")}catch{}},eq=async()=>{try{await er("customize")}catch{}},ez=s(()=>{eo()},[eo]),eE=e=>{eu(e),em("vendors"),en({tab:"vendors"})};S(!!(eb&&eC&&eS.trapFocus),es),I(!!(eC&&eS.scrollLock)),l(()=>{if(!eC)return;let e=e=>{r(e.key)&&(e.preventDefault(),ez())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[ez,eC]),l(()=>{let e=requestAnimationFrame(()=>ey(!0));return()=>cancelAnimationFrame(e)},[]),l(()=>{if(eC){let e=requestAnimationFrame(()=>ef(!0));return()=>cancelAnimationFrame(e)}if(eS.disableAnimation){let e=requestAnimationFrame(()=>ef(!1));return()=>cancelAnimationFrame(e)}let e=setTimeout(()=>{ef(!1)},150);return()=>clearTimeout(e)},[eC,eS.disableAnimation]);let eH=m(!!D);l(()=>{let e=U?.preferenceCenterTab;if(!(eC&&e))return;if(eH.current){eH.current=!1;return}let t=requestAnimationFrame(()=>{em(e)});return()=>cancelAnimationFrame(t)},[eC,U?.preferenceCenterTab]),d(()=>{let e,t;if("purposes"!==ec&&"vendors"!==ec)return;let o=el.current;if(!o||null===ed.current)return;let n=ed.current;if(ed.current=null,!window.matchMedia("(prefers-reduced-motion: reduce)").matches)return o.style.height=`${n}px`,o.style.overflow="hidden",o.style.transition="none",e=requestAnimationFrame(()=>{t=requestAnimationFrame(()=>{if(!o)return;o.style.height="auto";let e=o.getBoundingClientRect().height;if(o.style.height=`${n}px`,1>Math.abs(n-e)){o.style.height="",o.style.overflow="",o.style.transition="";return}o.getBoundingClientRect(),o.style.transition="height 180ms cubic-bezier(0.33, 1, 0.68, 1)",o.style.height=`${e}px`,o.addEventListener("transitionend",e=>{"height"===e.propertyName&&(o.style.height="",o.style.overflow="",o.style.transition="")},{once:!0})})}),()=>{cancelAnimationFrame(e),cancelAnimationFrame(t)}},[ec]);let eW=s(e=>{el.current&&(ed.current=el.current.offsetHeight),em(e),en({tab:e})},[en]),eD=c(()=>({uiSource:_??"iab_dialog"}),[_]);if(!eb||!U?.config.enabled)return null;let eG=U.isLoadingGVL||!U.gvl,eO=L(Q?.["iab-dialog"]?.root,{baseClassName:`${a.root} ${ev?a.dialogVisible:a.dialogHidden}`,noStyle:eS.noStyle}),e_=L(Q?.["iab-dialog"]?.card,{baseClassName:`${a.card} ${ev?a.contentVisible:a.contentHidden}`,noStyle:eS.noStyle}),eJ=L(Q?.["iab-dialog"]?.header,{baseClassName:a.header,noStyle:eS.noStyle}),eK=L(Q?.["iab-dialog"]?.headerContent,{baseClassName:a.headerContent,noStyle:eS.noStyle}),eQ=L(Q?.["iab-dialog"]?.title,{baseClassName:a.title,noStyle:eS.noStyle}),eU=L(Q?.["iab-dialog"]?.description,{baseClassName:a.description,noStyle:eS.noStyle}),eX=L(Q?.["iab-dialog"]?.closeButton,{baseClassName:a.closeButton,noStyle:eS.noStyle}),eY=L(Q?.["iab-dialog"]?.body,{baseClassName:a.body,noStyle:eS.noStyle}),eZ=L(Q?.["iab-dialog"]?.tabs,{baseClassName:a.tabsContainer,noStyle:eS.noStyle}),e1=L(Q?.["iab-dialog"]?.tabsList,{baseClassName:a.tabsList,noStyle:eS.noStyle}),e0=L(Q?.["iab-dialog"]?.tabTrigger,{baseClassName:a.tabButton,noStyle:eS.noStyle}),e2=L(Q?.["iab-dialog"]?.tabIndicator,{baseClassName:a.tabIndicator,noStyle:eS.noStyle}),e7=L(Q?.["iab-dialog"]?.content,{baseClassName:a.content,noStyle:eS.noStyle}),e4=L(Q?.["iab-dialog"]?.loading,{baseClassName:a.loadingContainer,noStyle:eS.noStyle}),e5=L(Q?.["iab-dialog"]?.tabPanel,{baseClassName:a.tabPanel,noStyle:eS.noStyle}),e8=L(Q?.["iab-dialog"]?.specialPurposes,{baseClassName:a.specialPurposesSection,noStyle:eS.noStyle}),e6=L(Q?.["iab-dialog"]?.consentNotice,{baseClassName:a.consentNotice,noStyle:eS.noStyle}),e3=L(Q?.["iab-dialog"]?.actions,{baseClassName:i.actionRoot,noStyle:eS.noStyle}),e9=L(Q?.["iab-dialog"]?.footer,{baseClassName:a.footer,noStyle:eS.noStyle,...e3}),te=L(Q?.["iab-dialog"]?.actionGroup,{baseClassName:i.actionGroup,"data-direction":"row",noStyle:eS.noStyle}),tt=t(v.Provider,{value:eD,children:o(f.Provider,{value:eS,children:[t(j,{isOpen:eC}),t("div",{...eO,"data-testid":"iab-consent-dialog-root",dir:ea,children:o("div",{...e_,ref:es,"aria-label":J.preferenceCenter.title,"aria-modal":eS.trapFocus?"true":void 0,role:"dialog",...$,"data-testid":"iab-consent-dialog-card",children:[o("div",{...eJ,children:[o("div",{...eK,children:[t("h2",{...eQ,children:J.preferenceCenter.title}),t("p",{...eU,children:J.preferenceCenter.description})]}),t("button",{...eX,type:"button","data-testid":"iab-consent-dialog-close",onClick:ez,"aria-label":K.close,children:o("svg",{"aria-hidden":"true",style:{height:"1rem",width:"1rem"},viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),t("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),o(B.Root,{...eY,noStyle:!0,onValueChange:e=>eW(e),value:ec,children:[t("div",{...eZ,children:o(B.List,{...e1,noStyle:!0,children:[o(B.Trigger,{...e0,noStyle:!0,value:"purposes",children:[J.preferenceCenter.tabs.purposes,!eG&&` (${ex})`]}),o(B.Trigger,{...e0,noStyle:!0,value:"vendors",children:[J.preferenceCenter.tabs.vendors,!eG&&` (${eL})`]}),t("div",{...e2,"aria-hidden":"true","data-active-tab":ec})]})}),t("div",{...e7,ref:el,children:eG?o("div",{...e4,children:[t("div",{className:a.loadingSpinner}),t("p",{className:a.loadingText,children:J.common.loading})]}):o(e,{children:[o(B.Content,{...e5,forceMount:!0,noStyle:!0,value:"purposes",children:[ek.map(e=>"stack"===e.kind?t(A,{stack:e,consents:U.purposeConsents,onToggle:eF,vendorConsents:U.vendorConsents,onVendorToggle:eP,onVendorClick:eE,vendorLegitimateInterests:U.vendorLegitimateInterests,onVendorLegitimateInterestToggle:eB,purposeLegitimateInterests:U.purposeLegitimateInterests,onPurposeLegitimateInterestToggle:eR},e.testId):t(T,{purpose:e,testId:e.testId,isEnabled:"special-feature"===e.toggle?U.specialFeatureOptIns[e.id]??!1:U.purposeConsents[e.id]??!1,onToggle:t=>{"special-feature"===e.toggle?ew(e.id,t):eF(e.id,t)},vendorConsents:U.vendorConsents,onVendorToggle:eP,onVendorClick:eE,vendorLegitimateInterests:U.vendorLegitimateInterests,onVendorLegitimateInterestToggle:eB,purposeLegitimateInterests:"purpose"===e.kind?U.purposeLegitimateInterests:void 0,onPurposeLegitimateInterestToggle:"purpose"===e.kind?eR:void 0},e.testId)),eI.length>0&&o("div",{...e8,children:[o("div",{className:a.specialPurposesHeader,children:[o("button",{type:"button","aria-expanded":eg,onClick:()=>eh(!eg),className:a.purposeTrigger,children:[t("svg",{"aria-hidden":"true",className:a.purposeArrow,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:eg?t("path",{d:"M19 9l-7 7-7-7"}):t("path",{d:"M9 5l7 7-7 7"})}),o("div",{className:a.purposeInfo,children:[o("h3",{className:a.specialPurposesTitle,children:[J.preferenceCenter.specialPurposes.title,o("svg",{"aria-hidden":"true",className:a.lockIcon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),t("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})]}),o("p",{className:a.purposeMeta,children:[eN," ",1===eN?J.preferenceCenter.vendorList.partnerSingular:J.preferenceCenter.vendorList.partnerPlural]})]})]}),t("div",{style:{position:"relative"},children:o("svg",{className:a.infoIcon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-label":J.preferenceCenter.specialPurposes.tooltip,children:[t("circle",{cx:"12",cy:"12",r:"10"}),t("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),t("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]})})]}),eg&&t("div",{style:{padding:"0.75rem"},children:eI.map(e=>t(T,{purpose:e,testId:e.testId,isEnabled:!0,onToggle:()=>{},vendorConsents:U.vendorConsents,onVendorToggle:eP,onVendorClick:eE,isLocked:!0},e.testId))})]}),t("div",{...e6,children:t("p",{className:a.consentNoticeText,children:J.preferenceCenter.footer.consentStorage})})]}),t(B.Content,{...e5,forceMount:!0,noStyle:!0,value:"vendors",children:t(V,{vendorData:eV,purposes:ej,vendorConsents:U.vendorConsents,onVendorToggle:eP,selectedVendorId:ep,onClearSelection:()=>eu(null),customVendors:U.nonIABVendors,vendorLegitimateInterests:U.vendorLegitimateInterests,onVendorLegitimateInterestToggle:eB})})]})})]}),o("div",{...e9,children:[o("div",{...te,children:[t(P.Root,{variant:"neutral",mode:"stroke",size:"small",onClick:eM,disabled:!et.isReady,"data-action":"reject",children:J.common.rejectAll}),t(P.Root,{variant:"neutral",mode:"stroke",size:"small",onClick:e$,disabled:!et.isReady,"data-action":"accept",children:J.common.acceptAll})]}),t("div",{...te,children:t(P.Root,{variant:"primary",mode:"filled",size:"small",onClick:eq,disabled:eG,"data-action":"customize",children:J.common.saveSettings})})]}),t(y,{hideBranding:W??!1,variant:"dialog-tag",slotContext:"iab-dialog","data-testid":"iab-consent-dialog-branding"})]})})]})}),to=!0===G?{}:!1===G?null:G,tn=to?t(b,{...to}):null;return eC||ev?o(e,{children:[tn,u(tt,document.body)]}):tn};export{M as IABConsentDialog};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{IABConsentDialogCard as o}from"./atoms/card.js";import{IABConsentDialogContent as t}from"./atoms/content.js";import{IABConsentDialogFooter as s}from"./atoms/footer.js";import{IABConsentDialogHeader as e}from"./atoms/header.js";import{IABConsentDialogOverlay as a}from"./atoms/overlay.js";import{PurposeItem as r}from"./atoms/purpose-item.js";import{IABConsentDialogRoot as m}from"./atoms/root.js";import{StackItem as
|
|
2
|
+
import"@c15t/ui/styles/dialog";import{IABConsentDialogCard as o}from"./atoms/card.js";import{IABConsentDialogContent as t}from"./atoms/content.js";import{IABConsentDialogFooter as s}from"./atoms/footer.js";import{IABConsentDialogHeader as e}from"./atoms/header.js";import{IABConsentDialogOverlay as a}from"./atoms/overlay.js";import{PurposeItem as r}from"./atoms/purpose-item.js";import{IABConsentDialogRoot as m}from"./atoms/root.js";import{StackItem as i}from"./atoms/stack-item.js";import{IABConsentDialogTabButton as n,IABConsentDialogTabs as l}from"./atoms/tabs.js";import{VendorList as p}from"./atoms/vendor-list.js";import{IABConsentDialog as d}from"./iab-panel.js";let f=Object.assign(d,{Card:o,Content:t,Footer:s,Header:e,Overlay:a,PurposeItem:r,Root:m,StackItem:i,TabButton:n,Tabs:l,VendorList:p});export{useIABDisplayModel}from"./hooks/use-display-model.js";export{useGVLData}from"./hooks/use-gvl-data.js";export default f;export{o as IABConsentDialogCard,t as IABConsentDialogContent,s as IABConsentDialogFooter,e as IABConsentDialogHeader,a as IABConsentDialogOverlay,m as IABConsentDialogRoot,n as IABConsentDialogTabButton,l as IABConsentDialogTabs,r as PurposeItem,i as StackItem,p as VendorList,f as IABConsentDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import t from"@c15t/ui/styles/components/consent-dialog";import{useEffect as o,useState as r}from"react";import{
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import t from"@c15t/ui/styles/components/consent-dialog";import{useEffect as o,useState as r}from"react";import{useActiveUI as a}from"../../../hooks.js";import{useTheme as i}from"../../../hooks/use-theme.js";import{useUIConfig as l}from"../../../ui-config-context.js";import{cnExt as n}from"../../../utils/cn.js";import{mergeSlotProps as s}from"../../../utils/merge-slot-props.js";let m=({noStyle:m,style:c,open:u})=>{let d,p=a(),{components:y}=l(),{disableAnimation:f,noStyle:g,scrollLock:v=!0}=i(),j=u??"dialog"===p,[N,b]=r(!1);o(()=>{if(j){let e=requestAnimationFrame(()=>b(!0));return()=>cancelAnimationFrame(e)}if(f){let e=requestAnimationFrame(()=>b(!1));return()=>cancelAnimationFrame(e)}let e=setTimeout(()=>{b(!1)},Number.parseInt(getComputedStyle(document.documentElement).getPropertyValue("--consent-dialog-animation-duration")||"200",10));return()=>clearTimeout(e)},[j,f]);let h="string"==typeof c?c:c?.className,A=s(y?.dialog?.overlay,{baseClassName:t.overlay,className:h,noStyle:g||m,style:"object"==typeof c&&"style"in c?c.style:void 0});d=g||m||f?void 0:N?t.overlayVisible:t.overlayHidden;let F=n(A.className,d);return e("div",{...A,role:"presentation","aria-hidden":"true",className:F,"data-testid":"consent-dialog-overlay"})},c=m;export{m as ConsentDialogOverlay,c as Overlay};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{Fragment as o,jsx as e,jsxs as t}from"react/jsx-runtime";import{isDialogDismissKey as r}from"@c15t/ui/primitives/dialog";import i from"@c15t/ui/styles/components/consent-dialog";import{useEffect as n,useMemo as s,useRef as
|
|
2
|
+
import{Fragment as o,jsx as e,jsxs as t}from"react/jsx-runtime";import{isDialogDismissKey as r}from"@c15t/ui/primitives/dialog";import i from"@c15t/ui/styles/components/consent-dialog";import{useEffect as n,useMemo as s,useRef as l,useState as a}from"react";import{createPortal as m}from"react-dom";import{useHeadlessConsentUI as c}from"../../../component-hooks/use-headless-consent-ui.js";import{ConsentTrackingContext as d}from"../../../context/consent-tracking-context.js";import{LocalThemeContext as u}from"../../../context/theme-context.js";import{useActiveUI as p,useHasConsentUI as f,useModel as g}from"../../../hooks.js";import{useFocusTrap as k}from"../../../hooks/use-focus-trap.js";import{useIsHydrated as h}from"../../../hooks/use-is-hydrated.js";import{useScrollLock as b}from"../../../hooks/use-scroll-lock.js";import{useTextDirection as j}from"../../../hooks/use-text-direction.js";import{useTheme as v}from"../../../hooks/use-theme.js";import{useTranslationLanguage as y}from"../../../kernel-selector.js";import{useUIConfig as x}from"../../../ui-config-context.js";import{cnExt as A}from"../../../utils/cn.js";import{mergeSlotProps as F}from"../../../utils/merge-slot-props.js";import{Overlay as L}from"./overlay.js";let N=["opt-in","opt-out","none"],S=({children:S,open:C,models:q=N,noStyle:w,disableAnimation:D,scrollLock:E,trapFocus:H,overlay:I,uiSource:P,className:R,style:T,...V})=>{var z;let B,G,J,K=v(),{components:M}=x(),O=p(),Q=g(),U=y(),{closeUI:W,dialog:X}=c({preferences:{scrollLock:E,trapFocus:H}}),{disableAnimation:Y,noStyle:Z,scrollLock:$,trapFocus:_}=(B=K.disableAnimation,G=K.noStyle,{disableAnimation:D??B??!1,noStyle:w??G??!1,scrollLock:J=X.blocking,trapFocus:J}),oo=j(U),oe=(z=f(),!!z&&!!q.includes(Q??"opt-in")&&(C??"dialog"===O)),[ot,or]=a(!1),oi=l(null),on=l(null),os=h(),ol=K.theme?.motion?.duration?.normal;n(()=>{if(oe){let o=requestAnimationFrame(()=>or(!0));return()=>cancelAnimationFrame(o)}if(Y){let o=requestAnimationFrame(()=>or(!1));return()=>cancelAnimationFrame(o)}let o=setTimeout(()=>or(!1),Number.parseInt((ol||"200ms").replace("ms",""),10));return()=>clearTimeout(o)},[oe,Y,ol]),k(oe&&_,on),n(()=>{if(!oe)return;let o=o=>{r(o.key)&&(o.preventDefault(),W())};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[W,oe]),b(oe&&$);let oa=Y?i.root:A(i.root,ot?i.dialogVisible:i.dialogHidden),om=F(M?.dialog?.root,{baseClassName:oa,className:R,noStyle:Z,style:T,...V}),oc=F(M?.dialog?.container,{baseClassName:A(i.container,!Y&&(ot?i.contentVisible:i.contentHidden)),noStyle:Z}),od=s(()=>({disableAnimation:Y,noStyle:Z,scrollLock:$,theme:K.theme,trapFocus:_}),[Y,K.theme,Z,$,_]),ou=s(()=>({uiSource:P??"dialog"}),[P]),op=X.blocking?"true":void 0,of=e(d.Provider,{value:ou,children:e(u.Provider,{value:od,children:oe&&t(o,{children:[X.blocking&&!1!==I?I??e(L,{open:oe}):null,e("div",{ref:oi,"data-slot":"dialog-positioner","data-blocking":op,...om,className:om.className,children:e("div",{ref:on,...oc,"aria-describedby":"consent-dialog-description","aria-labelledby":"consent-dialog-title","aria-modal":_?"true":void 0,"data-blocking":op,"data-testid":"consent-dialog-root",dir:oo,role:"dialog",tabIndex:-1,children:S})})]})})});return os?m(of,document.body):null},C=S;export{S as ConsentDialogRoot,C as Root};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{Card as o,ConsentCustomizationCard as e,ConsentDialogContent as t,ConsentDialogFooter as n,ConsentDialogHeader as a,ConsentDialogHeaderDescription as r,ConsentDialogHeaderTitle as i,Content as s,Footer as l,Header as C,HeaderDescription as d,HeaderTitle as D}from"./atoms/card.js";import{ConsentDialogOverlay as g,Overlay as m}from"./atoms/overlay.js";import{ConsentDialogRoot as p,Root as H}from"./atoms/root.js";import{ConsentDialog as c}from"./panel.js";let f=Object.assign(c,{Card:o,ConsentCustomizationCard:e,ConsentDialogContent:t,ConsentDialogFooter:n,ConsentDialogHeader:a,ConsentDialogHeaderDescription:r,ConsentDialogHeaderTitle:i,Content:s,Footer:l,Header:C,HeaderDescription:d,HeaderTitle:D,Overlay:m,Root:H});export default f;export{o as Card,e as ConsentCustomizationCard,t as ConsentDialogContent,n as ConsentDialogFooter,a as ConsentDialogHeader,r as ConsentDialogHeaderDescription,i as ConsentDialogHeaderTitle,g as ConsentDialogOverlay,p as ConsentDialogRoot,s as Content,l as Footer,C as Header,d as HeaderDescription,D as HeaderTitle,m as Overlay,H as Root,f as ConsentDialog};
|
|
2
|
+
import"@c15t/ui/styles/dialog";import{Card as o,ConsentCustomizationCard as e,ConsentDialogContent as t,ConsentDialogFooter as n,ConsentDialogHeader as a,ConsentDialogHeaderDescription as r,ConsentDialogHeaderTitle as i,Content as s,Footer as l,Header as C,HeaderDescription as d,HeaderTitle as D}from"./atoms/card.js";import{ConsentDialogOverlay as g,Overlay as m}from"./atoms/overlay.js";import{ConsentDialogRoot as p,Root as H}from"./atoms/root.js";import{ConsentDialog as c}from"./panel.js";let f=Object.assign(c,{Card:o,ConsentCustomizationCard:e,ConsentDialogContent:t,ConsentDialogFooter:n,ConsentDialogHeader:a,ConsentDialogHeaderDescription:r,ConsentDialogHeaderTitle:i,Content:s,Footer:l,Header:C,HeaderDescription:d,HeaderTitle:D,Overlay:m,Root:H});export default f;export{o as Card,e as ConsentCustomizationCard,t as ConsentDialogContent,n as ConsentDialogFooter,a as ConsentDialogHeader,r as ConsentDialogHeaderDescription,i as ConsentDialogHeaderTitle,g as ConsentDialogOverlay,p as ConsentDialogRoot,s as Content,l as Footer,C as Header,d as HeaderDescription,D as HeaderTitle,m as Overlay,H as Root,f as ConsentDialog};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{Fragment as o,jsx as r,jsxs as
|
|
2
|
+
import{Fragment as o,jsx as r,jsxs as t}from"react/jsx-runtime";import{ConsentDialogTrigger as n}from"../panel-trigger/index.js";import{useActiveUI as e}from"../../hooks.js";import{useComponentConfig as i}from"../../hooks/use-component-config.js";import{ConsentCustomizationCard as l}from"./atoms/card.js";import{Root as s}from"./atoms/root.js";let m=({open:m,noStyle:a,disableAnimation:c,scrollLock:p,trapFocus:d,hideBranding:f,legalLinks:g,showTrigger:j=!1,models:u,uiSource:h})=>{let k=e(),y={open:m??"dialog"===k,...i({disableAnimation:c,noStyle:a}),models:u,scrollLock:p,trapFocus:d,uiSource:h},S=!0===j?{}:!1===j?null:j;return t(o,{children:[S&&r(n,{...S}),r(s,{...y,children:r(l,{noStyle:y.noStyle,legalLinks:g,hideBranding:f})})]})};export{m as ConsentDialog};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as t}from"react/jsx-runtime";import o from"@c15t/ui/styles/components/consent-dialog-trigger";import{forwardRef as r}from"react";import{
|
|
2
|
+
import{jsx as t}from"react/jsx-runtime";import o from"@c15t/ui/styles/components/consent-dialog-trigger";import{forwardRef as r}from"react";import{useIdleDialogWarming as e,warmDialogChunk as i}from"../../../chunk-warming.js";import{usePolicyRule as n}from"../../../hooks.js";import{useTheme as s}from"../../../hooks/use-theme.js";import{useUIConfig as m}from"../../../ui-config-context.js";import{mergeSlotProps as g}from"../../../utils/merge-slot-props.js";import{useTriggerContext as a}from"./root.js";let l={"bottom-left":o.bottomLeft,"bottom-right":o.bottomRight,"top-left":o.topLeft,"top-right":o.topRight},p={lg:o.lg,md:o.md,sm:o.sm},c=r(({children:r,size:c="md",ariaLabel:d="Open privacy settings",className:f,"data-testid":u="consent-dialog-trigger",noStyle:h},b)=>{let j=n(),{components:y}=m(),{noStyle:k}=s(),{corner:x,isDragging:C,isSnapping:B,wasDragged:E,handlers:F,dragStyle:L,openDialog:N}=a();e(!0);let P=g(y?.trigger?.root,{baseClassName:[o.trigger,l[x],p[c],C&&o.dragging,B&&o.snapping],className:f,"data-testid":u,noStyle:h??k,style:L,...F});return t("button",{...P,ref:b,type:"button","data-c15t-trigger":"true","data-c15t-rights":j.rights.join(" "),"aria-label":d,onClick:t=>{0!==t.detail&&E()||N()},onFocus:t=>{P.onFocus?.(t),i()},onPointerEnter:t=>{P.onPointerEnter?.(t),i()},children:r})});c.displayName="ConsentDialogTrigger.Button";export{c as TriggerButton};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as r}from"react/jsx-runtime";import e from"@c15t/ui/styles/components/consent-dialog-trigger";import{isValidElement as
|
|
2
|
+
import{jsx as r}from"react/jsx-runtime";import e from"@c15t/ui/styles/components/consent-dialog-trigger";import{isValidElement as i}from"react";import{BrandingCompactLogo as o}from"../../shared/ui/branding.js";import{useTheme as t}from"../../../hooks/use-theme.js";import{useUIConfig as n}from"../../../ui-config-context.js";import{mergeSlotProps as s}from"../../../utils/merge-slot-props.js";import{useTriggerContext as a}from"./root.js";import{FingerprintIcon as m,SettingsIcon as g}from"./trigger-icons.js";let c=({icon:c="branding",className:p,noStyle:l})=>{let d,{components:f}=n(),{noStyle:u}=t(),{branding:h}=a(),j=s(f?.trigger?.icon,{baseClassName:e.icon,className:p,noStyle:l??u});if(i(c))return r("span",{...j,"aria-hidden":"true",children:c});switch(c){case"fingerprint":d=r(m,{});break;case"settings":d=r(g,{});break;default:d=r(o,{branding:h})}return r("span",{...j,"aria-hidden":"true",children:d})};c.displayName="ConsentDialogTrigger.Icon";export{c as TriggerIcon};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as o}from"react/jsx-runtime";import{createContext as r,useContext as
|
|
2
|
+
import{jsx as o}from"react/jsx-runtime";import{createContext as r,useContext as t,useMemo as e}from"react";import{createPortal as i}from"react-dom";import{useConsentDialogTrigger as s}from"../../../component-hooks/use-panel-trigger.js";import{useBranding as n}from"../../../hooks.js";import{useIsHydrated as g}from"../../../hooks/use-is-hydrated.js";import{useDraggable as m}from"../use-draggable.js";let a=r(null),l=function(){let o=t(a);if(!o)throw Error("ConsentDialogTrigger components must be used within a ConsentDialogTrigger.Root");return o},u=({children:r,defaultPosition:t="bottom-right",persistPosition:l=!0,showWhen:u="always",visible:p,onPositionChange:d,onClick:c})=>{let f=n()??"c15t",{isVisible:h,openDialog:T}=s({onClick:c,showWhen:u}),C=p??h,{corner:b,isDragging:j,isSnapping:x,wasDragged:y,handlers:k,dragStyle:w}=m({defaultPosition:t,onPositionChange:d,persistPosition:l}),D=g(),P=e(()=>({branding:f,corner:b,dragStyle:w,handlers:k,isDragging:j,isSnapping:x,isVisible:C,openDialog:T,wasDragged:y}),[f,b,w,k,j,x,C,T,y]);return D&&C?i(o(a.Provider,{value:P,children:r}),document.body):null};u.displayName="ConsentDialogTrigger.Root";export{a as TriggerContext,u as TriggerRoot,l as useTriggerContext};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as a,jsxs as t}from"react/jsx-runtime";let e=({title:e="Privacy",titleId:l="fingerprint-icon",...r})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-labelledby":l,...r,children:[a("title",{id:l,children:e}),a("path",{d:"M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4"}),a("path",{d:"M14 13.12c0 2.38 0 6.38-1 8.88"}),a("path",{d:"M17.29 21.02c.12-.6.43-2.3.5-3.02"}),a("path",{d:"M2 12a10 10 0 0 1 18-6"}),a("path",{d:"M2 16h.01"}),a("path",{d:"M21.8 16c.2-2 .131-5.354 0-6"}),a("path",{d:"M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2"}),a("path",{d:"M8.65 22c.21-.66.45-1.32.57-2"}),a("path",{d:"M9 6.8a6 6 0 0 1 9 5.2v2"})]}),l=({title:e="Settings",titleId:l="settings-icon",...r})=>t("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-labelledby":l,...r,children:[a("title",{id:l,children:e}),a("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}),a("circle",{cx:"12",cy:"12",r:"3"})]});export{e as FingerprintIcon,l as SettingsIcon};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as o}from"react/jsx-runtime";import{
|
|
2
|
+
import{jsx as o}from"react/jsx-runtime";import{useHasConsentPreferences as r,usePromptRequirement as e}from"../../hooks.js";import{TriggerRoot as t}from"./atoms/root.js";import{TriggerToolbar as i}from"./atoms/toolbar.js";let s=[],n={},a=({actions:a=s,preferences:l=n,orientation:m="horizontal",defaultPosition:p="bottom-right",persistPosition:g=!0,ariaLabel:c="Privacy controls",showWhen:f="always",size:h="md",className:b,style:d,noStyle:y=!1,onPositionChange:P})=>{let j=e(),T=r(),u="after-prompt"!==f||"none"===j.kind,v=T&&"never"!==f&&u;return o(t,{defaultPosition:p,onPositionChange:P,persistPosition:g,visible:a.length>0||v,children:o(i,{actions:a,ariaLabel:c,className:b,noStyle:y,orientation:m,preferences:l,showPreferences:v,size:h,style:d})})};a.displayName="ConsentDialogTriggerToolbar";export{a as ConsentDialogTriggerToolbar};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t}from"react/jsx-runtime";import o from"@c15t/ui/styles/components/accordion";import{createContext as n,forwardRef as i,useCallback as r,useContext as
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import o from"@c15t/ui/styles/components/accordion";import{createContext as n,forwardRef as i,useCallback as r,useContext as a,useMemo as c}from"react";import{useTranslations as s}from"../../../component-hooks/use-translations.js";import{Box as d}from"../../shared/primitives/box.js";import{LucideIcon as l}from"../../shared/ui/icon.js";import{useConsentDraftSlice as m,useConsentDraftStore as p}from"../../../draft.js";import{useExplicitChoice as g,useRestrictions as u}from"../../../hooks.js";import{useTheme as y}from"../../../hooks/use-theme.js";import{useDisplayedCategories as h}from"../../../kernel-selector.js";import{ConsentWidgetVendorList as f}from"./vendor-list.js";import*as w from"../../shared/ui/preference-item/index.js";import*as C from"../../shared/ui/switch/index.js";let v=[{defaultValue:!0,description:"Required for basic site functionality",disabled:!0,display:!0,gdprType:1,name:"necessary"},{defaultValue:!1,description:"Enables enhanced features",display:!0,gdprType:2,name:"functionality"},{defaultValue:!1,description:"Analytics and performance measurement",display:!0,gdprType:4,name:"measurement"},{defaultValue:!1,description:"Improves your experience",display:!0,gdprType:3,name:"experience"},{defaultValue:!1,description:"Advertising and marketing",display:!0,gdprType:5,name:"marketing"}],A=n(null),S=function(){let e=a(A);if(!e)throw Error("ConsentWidgetAccordion components must be used within ConsentWidgetAccordion");return e},N=i(({children:t,...n},i)=>e(d,{ref:i,baseClassName:o.triggerRow,...n,children:t}));N.displayName="ConsentWidgetAccordionTrigger";let b=w.Trigger,T=w.Content,W=w.Leading,j=C.Root,I=({"data-testid":t,children:n,className:i,noStyle:a,onValueChange:s,style:l,type:m="multiple",value:p,...g})=>{let{noStyle:u}=y(),h=a??u,f=c(()=>Array.isArray(p)?p:p?[p]:[],[p]),w=r((e,t)=>{if("single"===m)return void s?.(t?e:"");let o=t?[...new Set([...f,e])]:f.filter(t=>t!==e);s?.(o)},[s,f,m]),C=c(()=>({noStyle:h,onToggleItem:w,openValues:f}),[h,w,f]);return e(A.Provider,{value:C,children:e(d,{className:i,"data-testid":t??"consent-widget-accordion",noStyle:a,style:l,slotKey:"accordion.root",baseClassName:o.list,...g,children:n})})},K=l({iconPath:e("path",{d:"M5 12h14M12 5v14"}),title:"Open"}),V=l({iconPath:e("path",{d:"M5 12h14"}),title:"Close"}),k=({consent:n,title:i,description:r,restricted:a,open:c,noStyle:s,onToggleItem:d})=>{let l=p(),g=m(l,e=>e.values[n.name]);return t(w.Root,{className:s?void 0:o.item,"data-testid":`consent-widget-accordion-item-${n.name}`,noStyle:!0,onOpenChange:e=>d(n.name,e),open:c,slotKey:"accordion-item.root",children:[t(N,{slotKey:"accordion.triggerRow",children:[t(b,{className:s?void 0:o.trigger,"data-testid":`consent-widget-accordion-trigger-${n.name}`,noStyle:!0,slotKey:"accordion-item.trigger",children:[e(W,{className:s?void 0:o.arrow,"data-testid":`consent-widget-accordion-arrow-${n.name}`,noStyle:!0,slotKey:"accordion.arrow",children:c?e(V,{}):e(K,{})}),e(w.Header,{noStyle:!0,slotKey:"accordion.header",children:e(w.Title,{className:s?void 0:o.title,noStyle:!0,slotKey:"accordion.title",children:i})})]}),e(w.Control,{className:s?void 0:o.control,noStyle:!0,slotKey:"accordion.control",children:e(j,{"aria-label":i,checked:g,"aria-describedby":a?`c15t-restriction-${n.name}`:void 0,onCheckedChange:e=>l.set(n.name,e),disabled:n.disabled,size:"small","data-testid":`consent-widget-switch-${n.name}`})})]}),a?e("output",{className:s?void 0:o.restriction,"data-testid":`consent-widget-restriction-${n.name}`,id:`c15t-restriction-${n.name}`,children:"Your saved choice is restricted by the current privacy settings."}):null,t(T,{className:s?void 0:o.content,"data-testid":`consent-widget-accordion-content-${n.name}`,innerClassName:s?void 0:o.contentInner,innerSlotKey:"accordion.contentInner",slotKey:"accordion-item.content",viewportClassName:s?void 0:o.contentViewport,viewportSlotKey:"accordion.contentViewport",children:[r,e(f,{category:n.name,noStyle:s})]})]})},$=()=>{let t=h(),o=g(),n=u(),i=function(e){if("necessary"===e)return!1;let t=o?.categories[e];return t?.value===!0&&(n[e]?.length??0)>0},{noStyle:r,onToggleItem:a,openValues:d}=S(),{consentTypes:l}=s();return c(()=>{let e=new Set(t);return v.filter(t=>e.has(t.name))},[t]).map(t=>e(k,{consent:t,description:l[t.name]?.description??t.description,noStyle:r,onToggleItem:a,open:d.includes(t.name),restricted:i(t.name),title:l[t.name]?.title??t.name.replace(/_/gu," ").replace(/\b\w/gu,e=>e.toUpperCase())},t.name))},x=i(({className:t,...n},i)=>e(w.Root,{ref:i,className:[o.item,t].filter(Boolean).join(" "),noStyle:!0,...n}));x.displayName="ConsentWidgetAccordionItem";let R=b,L=N,M=T,P=W,E=I,O=j,q=$,z=x,B=f;export{E as Accordion,P as AccordionArrow,M as AccordionContent,z as AccordionItem,q as AccordionItems,L as AccordionTrigger,R as AccordionTriggerInner,I as ConsentWidgetAccordion,W as ConsentWidgetAccordionArrow,T as ConsentWidgetAccordionContent,x as ConsentWidgetAccordionItem,$ as ConsentWidgetAccordionItems,N as ConsentWidgetAccordionTrigger,b as ConsentWidgetAccordionTriggerInner,j as ConsentWidgetSwitch,f as ConsentWidgetVendorList,O as Switch,B as VendorList};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as
|
|
2
|
+
import{jsx as r}from"react/jsx-runtime";import e from"@c15t/ui/styles/components/consent-manager";import{useMemo as t}from"react";import{Box as o}from"../../shared/primitives/box.js";import{ConsentTrackingContext as i,useConsentTracking as n}from"../../../context/consent-tracking-context.js";import{LocalThemeContext as m}from"../../../context/theme-context.js";import{ConsentDraftProvider as s}from"../../../draft.js";import{useHasConsentUI as c}from"../../../hooks.js";import{useTextDirection as a}from"../../../hooks/use-text-direction.js";import{useTranslationLanguage as l}from"../../../kernel-selector.js";let d=({children:d,noStyle:p=!1,disableAnimation:u=!1,useProvider:f=!0,uiSource:h})=>{let j=a(l()),x=n(),g=t(()=>({disableAnimation:u,noStyle:p}),[u,p]),v=h??x.uiSource??"widget",k=t(()=>({uiSource:v}),[v]);if(!c())return null;let P=r(o,{baseClassName:e.manager,"data-testid":"consent-widget-root",slotKey:"manager.root",dir:j,children:d});return f?r(i.Provider,{value:k,children:r(m.Provider,{value:g,children:r(s,{children:P})})}):r(i.Provider,{value:k,children:r(s,{children:P})})},p=d;export{d as ConsentWidgetRoot,p as Root};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t}from"react/jsx-runtime";import n from"@c15t/ui/styles/components/vendor-list";import{useId as
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{vendorsListedUnder as o}from"@c15t/core";import n from"@c15t/ui/styles/components/vendor-list";import{useId as r,useMemo as i,useState as s}from"react";import{useTranslations as l}from"../../../component-hooks/use-translations.js";import{Box as d}from"../../shared/primitives/box.js";import{useConsentDraftSlice as a,useConsentDraftStore as c}from"../../../draft.js";import{useDeclaredVendors as h}from"../../../hooks.js";import{useTheme as m}from"../../../hooks/use-theme.js";import*as y from"../../shared/ui/preference-item/index.js";import*as p from"../../shared/ui/switch/index.js";let v=({open:o})=>t("svg",{"aria-hidden":"true",fill:"none",focusable:"false",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",viewBox:"0 0 24 24",children:[e("title",{children:o?"Close":"Open"}),o?e("path",{d:"M5 12h14"}):e("path",{d:"M5 12h14M12 5v14"})]}),g={disabledByCategory:"Turn on this category to choose vendors.",privacyPolicy:"Privacy policy",switchLabel:"Allow {vendor}",title:"Vendors ({count})"},u=({category:o,categoryOn:n,checked:r,copy:i,labelId:l,noStyle:a,onCheckedChange:c,styles:h,vendor:m})=>{let[g,u]=s(!1),C=m.name??m.id,b=!0!==m.disabled,f=!!(m.description||m.privacyPolicyUrl);return t(y.Root,{className:h?.item,"data-testid":`consent-widget-vendor-item-${o}-${m.id}`,disabled:!f,noStyle:a,onOpenChange:u,open:g,slotKey:"vendor-list.item",children:[t(d,{noStyle:a,baseClassName:h?.header,slotKey:"vendor-list.header",children:[t(y.Trigger,{className:h?.trigger,"data-testid":`consent-widget-vendor-trigger-${o}-${m.id}`,noStyle:a,slotKey:"vendor-list.trigger",children:[e(y.Leading,{className:h?.arrow,noStyle:a,children:e(v,{open:g})}),e(d,{asChild:!0,noStyle:a,baseClassName:h?.name,slotKey:"vendor-list.name",children:e("span",{"data-testid":`consent-widget-vendor-name-${o}-${m.id}`,id:l,children:C})})]}),b?e(d,{noStyle:a,baseClassName:h?.control,slotKey:"vendor-list.control",children:e(p.Root,{"aria-label":i.switchLabel.replace("{vendor}",C),"aria-describedby":l,checked:r,"data-testid":`consent-widget-vendor-switch-${o}-${m.id}`,disabled:!n,onCheckedChange:c,size:"small"})}):null]}),f?t(y.Content,{className:h?.content,"data-testid":`consent-widget-vendor-content-${o}-${m.id}`,innerClassName:h?.contentInner,noStyle:a,slotKey:"vendor-list.content",children:[m.description?e(d,{asChild:!0,noStyle:a,baseClassName:h?.description,slotKey:"vendor-list.description",children:e("p",{children:m.description})}):null,m.privacyPolicyUrl?e(d,{asChild:!0,noStyle:a,baseClassName:h?.link,slotKey:"vendor-list.link",children:e("a",{href:m.privacyPolicyUrl,rel:"noopener noreferrer",target:"_blank",children:i.privacyPolicy})}):null]}):null]})},C=({category:s,className:y,noStyle:p,...v})=>{let C=h(),b=i(()=>o(C,s),[C,s]),f=c(),$=a(f,e=>!0===e.values[s]),k=a(f,e=>e.vendors),{consentManagerDialog:w}=l(),{noStyle:N}=m(),S=r(),j=p??N??!1;if(0===b.length)return null;let K={...g,...w.vendors},x=j?void 0:n,L=K.title.replace("{count}",String(b.length));return e(d,{asChild:!0,className:y,"data-testid":`consent-widget-vendor-list-${s}`,noStyle:j,baseClassName:x?.root,slotKey:"vendor-list.root",...v,children:t("section",{"aria-label":L,children:[$?null:e("p",{className:x?.hint,"data-testid":`consent-widget-vendor-hint-${s}`,children:K.disabledByCategory}),b.map(t=>e(u,{category:s,categoryOn:$,checked:k[t.id]??!0,copy:K,labelId:`${S}vendor-${s}-${t.id}`,noStyle:j,onCheckedChange:e=>f.setVendor(t.id,e),styles:x,vendor:t},t.id))]})})};export{C as ConsentWidgetVendorList};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{Accordion as o,AccordionArrow as t,AccordionContent as
|
|
2
|
+
import"@c15t/ui/styles/dialog";import{Accordion as o,AccordionArrow as t,AccordionContent as e,AccordionItem as n,AccordionItems as r,AccordionTrigger as i,AccordionTriggerInner as c,ConsentWidgetAccordion as s,ConsentWidgetAccordionArrow as d,ConsentWidgetAccordionContent as g,ConsentWidgetAccordionItem as A,ConsentWidgetAccordionItems as m,ConsentWidgetAccordionTrigger as C,ConsentWidgetAccordionTriggerInner as u,ConsentWidgetSwitch as W,ConsentWidgetVendorList as p,Switch as l,VendorList as a}from"./atoms/accordion.js";import{AcceptAllButton as B,ConsentWidgetAcceptAllButton as f,ConsentWidgetCustomizeButton as j,ConsentWidgetRejectButton as I,ConsentWidgetSaveButton as S,CustomizeButton as w,RejectButton as F,SaveButton as R}from"./atoms/button.js";import{ConsentWidgetFooter as T,ConsentWidgetFooterSubGroup as b,Footer as y,FooterSubGroup as h}from"./atoms/footer.js";import{ConsentWidgetRoot as v,Root as z}from"./atoms/root.js";import{ConsentWidgetPolicyActions as G,PolicyActions as L}from"./policy-actions.js";import{ConsentWidget as P}from"./preferences.js";let V=Object.assign(P,{AcceptAllButton:B,Accordion:o,AccordionArrow:t,AccordionContent:e,AccordionItem:n,AccordionItems:r,AccordionTrigger:i,AccordionTriggerInner:c,CustomizeButton:w,Footer:y,FooterSubGroup:h,PolicyActions:L,RejectButton:F,Root:z,SaveButton:R,Switch:l,VendorList:a});export default V;export{B as AcceptAllButton,o as Accordion,t as AccordionArrow,e as AccordionContent,n as AccordionItem,r as AccordionItems,i as AccordionTrigger,c as AccordionTriggerInner,f as ConsentWidgetAcceptAllButton,s as ConsentWidgetAccordion,d as ConsentWidgetAccordionArrow,g as ConsentWidgetAccordionContent,A as ConsentWidgetAccordionItem,m as ConsentWidgetAccordionItems,C as ConsentWidgetAccordionTrigger,u as ConsentWidgetAccordionTriggerInner,j as ConsentWidgetCustomizeButton,T as ConsentWidgetFooter,b as ConsentWidgetFooterSubGroup,G as ConsentWidgetPolicyActions,I as ConsentWidgetRejectButton,v as ConsentWidgetRoot,S as ConsentWidgetSaveButton,W as ConsentWidgetSwitch,p as ConsentWidgetVendorList,w as CustomizeButton,y as Footer,h as FooterSubGroup,L as PolicyActions,F as RejectButton,z as Root,R as SaveButton,l as Switch,a as VendorList,V as ConsentWidget};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as t}from"react/jsx-runtime";import{useHeadlessConsentUI as n}from"../../component-hooks/use-headless-consent-ui.js";import{
|
|
2
|
+
import{jsx as t}from"react/jsx-runtime";import{useHeadlessConsentUI as n}from"../../component-hooks/use-headless-consent-ui.js";import{PolicyActionsRenderer as e}from"../shared/policy-actions.js";import{ConsentBannerAcceptButton as o,ConsentBannerCustomizeButton as r,ConsentBannerDismissButton as s,ConsentBannerFooter as c,ConsentBannerFooterSubGroup as i,ConsentBannerRejectButton as a,ConsentBannerRights as d}from"./components.js";import{resolveBannerPrimaryActions as m}from"./resolve-banner-primary-actions.js";let u=function(n,e){let{key:c,consentAction:i,...d}=e;switch(n){case"accept":return t(o,{consentAction:i,"data-testid":"consent-banner-accept-button",...d},c);case"reject":return t(a,{consentAction:i,"data-testid":"consent-banner-reject-button",...d},c);case"customize":return t(r,{consentAction:i,"data-testid":"consent-banner-customize-button",...d},c);case"dismiss":return t(s,{consentAction:i,"data-testid":"consent-banner-dismiss-button",...d},c);case"save":return null;default:throw Error(`Unhandled consent banner action: ${n}`)}},l=({children:o,renderAction:r})=>{let{banner:s}=n();return t(e,{state:{...s,primaryActions:[...m(s.primaryActions,s.orderedActions)]},leading:void 0===o?t(d,{rights:s.preferenceControls}):o,Footer:c,FooterSubGroup:i,classNames:{},renderAction:r,renderDefaultAction:u})},p=l;export{l as ConsentBannerPolicyActions,p as PolicyActions};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as t}from"react/jsx-runtime";import{forwardRef as
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import{forwardRef as o,useCallback as e}from"react";import{useIdleDialogWarming as n,warmDialogChunk as r}from"../../../chunk-warming.js";import{useConsentSaveAction as a}from"../../../draft.js";import{useDismissNotice as i,useSetActiveUI as s}from"../../../hooks.js";import{useTheme as c}from"../../../hooks/use-theme.js";import{useUIConfig as m}from"../../../ui-config-context.js";import{getSlotProps as d,mergeSlotProps as l}from"../../../utils/merge-slot-props.js";import{Slot as u}from"../libs/slot.js";import*as f from"../ui/button/index.js";let p=["primary","secondary","neutral","consentAction","isPrimary","performDefaultAction"],v=function(t){if(t.variant||t.mode)return{mode:t.mode??"stroke",variant:t.variant??"neutral"};let o=t.theme?.consentActions,e=[t.consentAction&&"save"!==t.consentAction?o?.[t.consentAction]:void 0,t.isPrimary?o?.primary:void 0,o?.default,{mode:"stroke",variant:t.isPrimary?"primary":"neutral"}];return{mode:e.find(t=>t?.mode)?.mode??"stroke",variant:e.find(t=>t?.variant)?.variant??"neutral"}},y=o(({asChild:o,className:y,style:b,noStyle:j,action:k,slotKey:g,baseClassName:h,variant:C,mode:P,size:A="small",consentAction:E,isPrimary:w,onClick:x,onFocus:N,onPointerEnter:F,closeConsentBanner:q=!1,closeConsentDialog:B=!1,performDefaultAction:O=!0,category:S,...z},D)=>{let V=a(),G=s(),H=i(),{noStyle:I,theme:J}=c(),{components:K}=m(),L=v({consentAction:E,isPrimary:w,mode:P,theme:J,variant:C}),M="primary"===L.variant?"button.primary":"button.secondary",Q=l(d(K,g??M),{baseClassName:[f.buttonVariants({mode:L.mode,size:A,variant:L.variant}).root(),h],className:y,noStyle:I||j,style:{...b}});if(!S&&"set-consent"===k)throw Error("Category is required for set-consent action");let R=e(t=>{if(x?.(t),t.defaultPrevented)return;let o="accept-consent"===k||"reject-consent"===k||"custom-consent"===k;if((q||B)&&!o&&G("none"),"open-consent-dialog"===k&&G("dialog"),O&&"open-consent-dialog"!==k)switch(k){case"accept-consent":V("all");break;case"reject-consent":V("none");break;case"custom-consent":V();break;case"dismiss-notice":H();break;case"set-consent":if(!S)throw Error("Category is required for set-consent action");V({[S]:!0})}},[q,B,x,V,G,k,S,H,O]),T="open-consent-dialog"===k;n(T);let U=N??Q.onFocus,W=F??Q.onPointerEnter,X=e(t=>{U?.(t),T&&r()},[U,T]),Y=e(t=>{W?.(t),T&&r()},[W,T]),Z=Object.fromEntries(Object.entries(z).filter(([t])=>!p.includes(t))),$=!(I||j);return t(o?u:"button",{ref:D,type:o?void 0:"button","data-variant":$?L.variant:void 0,"data-mode":$?L.mode:void 0,"data-size":$?A:void 0,"data-action":E,...Q,onClick:R,onFocus:X,onPointerEnter:Y,...Z})});y.displayName="ConsentButton";export{y as ConsentButton};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as o}from"react/jsx-runtime";import{isAccordionItemOpen as e,toggleAccordionValue as t}from"@c15t/ui/primitives/accordion";import{getDataDisabled as a}from"@c15t/ui/primitives/data-state";import r from"@c15t/ui/styles/components/accordion";import{createContext as n,forwardRef as i,useContext as c,useId as l,useMemo as d}from"react";import{useControllableState as s}from"../../libs/use-controllable-state.js";import{LucideIcon as m}from"../icon.js";import{useTheme as p}from"../../../../hooks/use-theme.js";let u=()=>({arrowClose:o=>[r.arrow,o?.class].filter(Boolean).join(" "),arrowOpen:o=>[r.arrow,o?.class].filter(Boolean).join(" "),content:o=>[r.content,o?.class].filter(Boolean).join(" "),contentInner:o=>[r.contentInner,o?.class].filter(Boolean).join(" "),contentViewport:o=>[r.contentViewport,o?.class].filter(Boolean).join(" "),icon:o=>[r.control,o?.class].filter(Boolean).join(" "),item:o=>[r.item,o?.class].filter(Boolean).join(" "),root:o=>[r.list,o?.class].filter(Boolean).join(" "),trigger:o=>[r.trigger,o?.class].filter(Boolean).join(" ")}),f=n(null),g=n(null),v=function(){let o=c(f);if(!o)throw Error("Accordion components must be used within AccordionRoot");return o},h=function(){let o=c(g);if(!o)throw Error("Accordion components must be used within AccordionItem");return o},
|
|
2
|
+
import{jsx as o}from"react/jsx-runtime";import{isAccordionItemOpen as e,toggleAccordionValue as t}from"@c15t/ui/primitives/accordion";import{getDataDisabled as a}from"@c15t/ui/primitives/data-state";import r from"@c15t/ui/styles/components/accordion";import"@c15t/ui/styles/dialog";import{createContext as n,forwardRef as i,useContext as c,useId as l,useMemo as d}from"react";import{useControllableState as s}from"../../libs/use-controllable-state.js";import{LucideIcon as m}from"../icon.js";import{useTheme as p}from"../../../../hooks/use-theme.js";let u=()=>({arrowClose:o=>[r.arrow,o?.class].filter(Boolean).join(" "),arrowOpen:o=>[r.arrow,o?.class].filter(Boolean).join(" "),content:o=>[r.content,o?.class].filter(Boolean).join(" "),contentInner:o=>[r.contentInner,o?.class].filter(Boolean).join(" "),contentViewport:o=>[r.contentViewport,o?.class].filter(Boolean).join(" "),icon:o=>[r.control,o?.class].filter(Boolean).join(" "),item:o=>[r.item,o?.class].filter(Boolean).join(" "),root:o=>[r.list,o?.class].filter(Boolean).join(" "),trigger:o=>[r.trigger,o?.class].filter(Boolean).join(" ")}),f=n(null),g=n(null),v=function(){let o=c(f);if(!o)throw Error("Accordion components must be used within AccordionRoot");return o},h=function(){let o=c(g);if(!o)throw Error("Accordion components must be used within AccordionItem");return o},y=i(({children:e,className:a,collapsible:r,defaultValue:n,noStyle:i,onValueChange:c,size:l="medium",type:m,value:g,variant:v="default",...h},y)=>{let{noStyle:A}=p(),w=u(),N=A||i,[I,b]=s({defaultValue:n??("multiple"===m?[]:void 0),onChange:o=>{void 0!==o&&c?.(o)},value:g}),j=N?a:w.root({class:a}),B=d(()=>({collapsible:r,noStyle:N,onItemToggle:o=>{b(t({collapsible:r,itemValue:o,type:m,value:I}))},type:m,value:I}),[r,I,N,b,m]);return o(f.Provider,{value:B,children:o("div",{ref:y,className:j,"data-size":N?void 0:l,"data-slot":"accordion-root","data-variant":N?void 0:v,...h,children:e})})});y.displayName="AccordionRoot";let A=i(({children:t,className:r,disabled:n,noStyle:i,value:c,...s},m)=>{let{noStyle:f}=p(),h=u(),y=v(),A=e(y.type,y.value,c),w=y.noStyle||f||i?r:h.item({class:r}),N=l().replace(/:/gu,""),I=`c15t-accordion-content-${N}`,b=`c15t-accordion-trigger-${N}`,j=d(()=>({contentId:I,disabled:n,open:A,triggerId:b,value:c}),[I,n,A,b,c]);return o(g.Provider,{value:j,children:o("div",{ref:m,className:w,"data-disabled":a(n),"data-slot":"accordion-item","data-state":A?"open":"closed",...s,children:t})})});A.displayName="AccordionItem";let w=i(({children:e,className:t,...a},r)=>o("div",{ref:r,className:t,"data-slot":"accordion-header",...a,children:e}));w.displayName="AccordionHeader";let N=i(({children:e,className:t,noStyle:n,onClick:i,...c},l)=>{let{noStyle:d}=p(),s=v(),m=h(),u=s.noStyle||d||n?t:[r.triggerRow,t].filter(Boolean).join(" ");return o("button",{ref:l,"aria-controls":m.contentId,"aria-disabled":m.disabled||void 0,"aria-expanded":m.open,className:u,"data-disabled":a(m.disabled),"data-slot":"accordion-trigger","data-state":m.open?"open":"closed",disabled:m.disabled,id:m.triggerId,onClick:o=>{s.onItemToggle(m.value),i?.(o)},type:"button",...c,children:e})});N.displayName="AccordionTrigger";let I=({className:e,noStyle:t,as:a,...r})=>{let n=u(),i="string"==typeof e?e:void 0;return o(a||"div",{className:t?i:n.icon({class:i}),"data-slot":"accordion-icon",...r})};I.displayName="AccordionIcon";let b=m({iconPath:o("path",{d:"M5 12h14M12 5v14"}),title:"Open"}),j=({children:e,closeIcon:t,className:a,noStyle:r,openIcon:n,...i})=>{let c=h(),l=u(),d=r?a:l.arrowOpen({class:a}),s=n??t,m=s?.Element??b;return o("span",{className:d,"data-slot":"accordion-arrow","data-state":c.open?"open":"closed",...i,children:e??o(m,{"aria-hidden":"true",className:s?.className,"data-slot":"accordion-arrow-icon"})})};j.displayName="AccordionArrow";let B=i(({children:e,className:t,innerClassName:a,noStyle:r,...n},i)=>{let{noStyle:c}=p(),l=u(),d=v(),s=h(),m=d.noStyle||c||r,f=m?t:l.content({class:t}),g=m?a:l.contentInner({class:a});return o("section",{ref:i,"aria-hidden":!s.open,"aria-labelledby":s.triggerId,className:f,"data-slot":"accordion-content","data-state":s.open?"open":"closed",id:s.contentId,...n,children:o("div",{className:m?void 0:l.contentViewport({class:void 0}),"data-slot":"accordion-content-viewport",children:o("div",{className:g,children:e})})})});B.displayName="AccordionContent";export{j as Arrow,B as Content,w as Header,I as Icon,A as Item,y as Root,N as Trigger,u as accordionVariants};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e}from"react/jsx-runtime";import{getCollapsibleState as t,toggleCollapsibleValue as l}from"@c15t/ui/primitives/collapsible";import{getDataDisabled as o}from"@c15t/ui/primitives/data-state";import a from"@c15t/ui/styles/components/collapsible";import{createContext as i,forwardRef as r,useContext as n,useId as s,useMemo as c}from"react";import{useControllableState as d}from"../../libs/use-controllable-state.js";import{useTheme as p}from"../../../../hooks/use-theme.js";let m=()=>({content:e=>[a.content,e?.class].filter(Boolean).join(" "),contentInner:e=>[a.contentInner,e?.class].filter(Boolean).join(" "),contentViewport:e=>[a.contentViewport,e?.class].filter(Boolean).join(" "),root:e=>[a.root,e?.class].filter(Boolean).join(" "),trigger:e=>[a.trigger,e?.class].filter(Boolean).join(" ")}),b=i(null),u=function(){let e=n(b);if(!e)throw Error("Collapsible components must be used within CollapsibleRoot");return e},g=r(({children:l,className:a,defaultOpen:i=!1,disabled:r,noStyle:n,onOpenChange:u,open:g,...f},
|
|
2
|
+
import{jsx as e}from"react/jsx-runtime";import{getCollapsibleState as t,toggleCollapsibleValue as l}from"@c15t/ui/primitives/collapsible";import{getDataDisabled as o}from"@c15t/ui/primitives/data-state";import a from"@c15t/ui/styles/components/collapsible";import"@c15t/ui/styles/dialog";import{createContext as i,forwardRef as r,useContext as n,useId as s,useMemo as c}from"react";import{useControllableState as d}from"../../libs/use-controllable-state.js";import{useTheme as p}from"../../../../hooks/use-theme.js";let m=()=>({content:e=>[a.content,e?.class].filter(Boolean).join(" "),contentInner:e=>[a.contentInner,e?.class].filter(Boolean).join(" "),contentViewport:e=>[a.contentViewport,e?.class].filter(Boolean).join(" "),root:e=>[a.root,e?.class].filter(Boolean).join(" "),trigger:e=>[a.trigger,e?.class].filter(Boolean).join(" ")}),b=i(null),u=function(){let e=n(b);if(!e)throw Error("Collapsible components must be used within CollapsibleRoot");return e},g=r(({children:l,className:a,defaultOpen:i=!1,disabled:r,noStyle:n,onOpenChange:u,open:g,...f},y)=>{let C=s().replace(/:/gu,""),{noStyle:h}=p(),v=m(),[j,N]=d({defaultValue:i,onChange:u,value:g}),w=h||n,S=c(()=>({contentId:`c15t-collapsible-content-${C}`,disabled:r,noStyle:w,open:j,setOpen:N,triggerId:`c15t-collapsible-trigger-${C}`}),[r,w,j,C,N]);return e(b.Provider,{value:S,children:e("div",{ref:y,className:w?a:v.root({class:a}),"data-disabled":o(r),"data-slot":"collapsible-root","data-state":t(j),...f,children:l})})});g.displayName="CollapsibleRoot";let f=r(({children:a,className:i,noStyle:r,onClick:n,...s},c)=>{let{noStyle:d}=p(),b=m(),{contentId:g,disabled:f,noStyle:y,open:C,setOpen:h,triggerId:v}=u();return e("button",{ref:c,"aria-controls":g,"aria-disabled":f||void 0,"aria-expanded":C,className:y||d||r?i:b.trigger({class:i}),"data-disabled":o(f),"data-slot":"collapsible-trigger","data-state":t(C),disabled:f,id:v,onClick:e=>{f||h(l(C)),n?.(e)},type:"button",...s,children:a})});f.displayName="CollapsibleTrigger";let y=r(({children:l,className:o,innerClassName:a,noStyle:i,...r},n)=>{let{noStyle:s}=p(),c=m(),{contentId:d,noStyle:b,open:g,triggerId:f}=u();return e("div",{ref:n,"aria-hidden":!g,"aria-labelledby":f,className:c.content({class:o}),"data-slot":"collapsible-content","data-state":t(g),id:d,inert:!g,...r,children:e("div",{className:c.contentViewport({class:void 0}),"data-slot":"collapsible-content-viewport",children:e("div",{className:c.contentInner({class:a}),children:l})})})});y.displayName="CollapsibleContent";export{y as Content,g as Root,f as Trigger,m as collapsibleVariants};
|