@tribepad/themis 1.5.7 → 1.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- import {createContext,forwardRef,memo,useId,Children,useState,useEffect,useRef,useCallback,useMemo,useContext,isValidElement}from'react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {cva}from'class-variance-authority';import {jsxs,jsx,Fragment}from'react/jsx-runtime';import {Loader2,Zap,Check,ArrowLeft,ArrowRight}from'lucide-react';import {Button}from'react-aria-components';import {z}from'zod';function x(...p){return twMerge(clsx(p))}var et=createContext(null);function W(){let p=useContext(et);if(!p)throw new Error("Wizard compound components must be used within <Wizard>");return p}var B=["motion-reduce:transition-none","motion-reduce:animate-none"],rt=["transition-colors","duration-200"];function G(...p){return p.flatMap(t=>Array.isArray(t)?[...t]:[t])}var it=cva("flex min-h-0 flex-1 flex-col"),ot=cva("flex min-h-0 flex-1 flex-col lg:flex-row"),nt=cva("flex min-w-0 flex-1 justify-center gap-8 overflow-y-auto bg-[var(--page-background)] p-6"),st=cva("hidden w-56 shrink-0 pt-2 lg:block"),dt=cva("flex w-full max-w-2xl flex-col"),pt=cva("mt-3 text-center text-xs text-[var(--menu-muted)]"),lt=cva("hidden w-80 shrink-0 border-l border-[var(--border)] bg-[var(--accent-background)] p-6 xl:block"),ct=cva("flex flex-col gap-2"),ut=cva("text-xs font-semibold uppercase tracking-wide text-[var(--primary)]"),mt=cva("text-sm font-bold text-[var(--content-foreground)]"),ft=cva("mt-6 flex flex-col"),gt=cva("flex items-start"),xt=cva("flex w-11 shrink-0 flex-col items-center"),vt=cva(G("flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-sm font-semibold",rt,B),{variants:{state:{completed:"bg-[var(--primary)] text-[var(--primary-foreground)]",current:"border-2 border-[var(--primary)] bg-[var(--content-background)] text-[var(--primary)]",upcoming:"border border-[var(--border)] bg-[var(--content-background)] text-[var(--menu-muted)]"}},defaultVariants:{state:"upcoming"}}),zt=cva(G("my-0.5 h-5 w-0.5",rt,B),{variants:{completed:{true:"bg-[var(--primary)]",false:"bg-[var(--border)]"}},defaultVariants:{completed:false}}),bt=cva("flex min-h-11 items-center pl-3"),St=cva("flex flex-col justify-center"),ht=cva("text-sm",{variants:{state:{completed:"font-medium text-[var(--content-foreground)]",current:"font-semibold text-[var(--content-foreground)]",upcoming:"text-[var(--menu-muted)]"}},defaultVariants:{state:"upcoming"}}),wt=cva("text-xs text-[var(--primary)]"),Nt=cva("flex flex-col gap-6"),Wt=cva("flex items-start gap-4"),Vt=cva("flex h-12 w-12 shrink-0 items-center justify-center rounded-full bg-[var(--accent-background)] text-[var(--primary)]"),yt=cva("text-lg font-bold text-[var(--content-foreground)] focus:outline-none"),Ct=cva("mt-1 text-sm text-[var(--menu-muted)]"),Lt=cva("rounded-lg border border-[var(--border)] bg-[var(--content-background)] p-6 text-[var(--content-foreground)]"),Et=cva("mt-4 flex items-center justify-between border-t border-[var(--border)] pt-4"),Rt=cva(""),Pt=cva("flex items-center gap-3"),Tt=cva("flex flex-col items-center gap-1.5 py-3 lg:hidden"),It=cva("flex items-center justify-center gap-2"),_t=cva(G("h-2 rounded-full transition-all duration-200",B),{variants:{state:{completed:"w-2 bg-[var(--primary)] opacity-60",current:"w-8 bg-[var(--primary)]",upcoming:"w-2 bg-[var(--border)]"}},defaultVariants:{state:"upcoming"}}),At=cva("text-xs font-medium text-[var(--menu-muted)]"),kt=cva("text-[var(--content-foreground)]"),$=cva("sr-only");var U=forwardRef(function({children:t,stepper:u,preview:l,helpText:c,className:f,"data-testid":i="wizard-layout"},o){return jsxs("div",{ref:o,className:x(ot(),f),"data-testid":i,children:[jsxs("div",{className:nt(),children:[u?jsx("nav",{className:st(),"aria-label":"Wizard steps","data-testid":`${i}-stepper-slot`,children:u}):null,jsxs("div",{className:dt(),children:[t,c?jsx("p",{className:pt(),children:c}):null]})]}),l?jsx("aside",{className:lt(),"aria-hidden":"true","data-testid":`${i}-preview`,children:l}):null]})});U.displayName="Wizard.Layout";var qt=cva("inline-flex justify-center min-h-[44px] min-w-[44px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)] focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50",{variants:{fullWidth:{true:"w-full",false:""},inVerticalGroup:{true:"items-stretch",false:"items-center"}},defaultVariants:{fullWidth:false,inVerticalGroup:false}}),Xt=cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background motion-safe:transition-transform motion-safe:duration-200 motion-safe:[transition-timing-function:cubic-bezier(0.34,1.56,0.64,1)] motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 relative cursor-pointer",{variants:{variant:{default:"bg-[var(--primary-action)] text-[var(--primary-action-foreground)] shadow-md hover:bg-[var(--primary-action-hover)] hover:-translate-y-1",destructive:"bg-[var(--destructive-background)] text-[var(--destructive-foreground)] shadow-md hover:bg-[var(--destructive-background-hover,var(--destructive-background))] motion-safe:hover:btn-warn-shake",outline:"border border-[var(--input-border)] bg-[var(--page-background)] hover:bg-[var(--input-border)]",secondary:"bg-[var(--secondary)] text-[var(--secondary-foreground)] shadow-md hover:bg-[var(--secondary-hover,var(--secondary))]",ghost:"hover:bg-[var(--accent)] hover:text-[var(--accent-foreground)]",link:"text-[var(--text-link)] underline underline-offset-4 hover:bg-[var(--accent)] hover:text-[var(--text-link-hover)]"},fullWidth:{true:"w-full",false:""},visualSize:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3 text-xs",lg:"h-11 rounded-md px-8",icon:"h-10 w-10",dot:"h-5 w-5 rounded-full p-0 min-h-0 min-w-0"},paywall:{true:"!bg-[var(--paywall)] !text-[var(--paywall-foreground)] !shadow-md hover:!bg-[var(--paywall)]/90 !cursor-not-allowed !border-transparent",false:""}},defaultVariants:{variant:"default",visualSize:"default",paywall:false}});var Ht="data-[pressed]:scale-[0.97]";var Ot="data-[hovered]:shadow-md";var F="hc:data-[hovered]:outline hc:data-[hovered]:outline-2 hc:data-[hovered]:outline-foreground",Y="hc:data-[pressed]:outline hc:data-[pressed]:outline-2 hc:data-[pressed]:outline-offset-1 hc:data-[pressed]:outline-foreground";var te=createContext(null);te.displayName="ButtonGroupContext";function ee(){return useContext(te)}var ae=createContext(null);ae.displayName="ButtonGroupItemContext";function re(){return useContext(ae)}cva("inline-flex items-center gap-0",{variants:{orientation:{horizontal:"flex-row",vertical:"flex-col w-full"}},defaultVariants:{orientation:"horizontal"}});var ie=cva("",{variants:{orientation:{horizontal:"min-w-[44px]",vertical:"flex min-h-[44px]"},position:{first:"",middle:"",last:"",only:""}},compoundVariants:[{orientation:"horizontal",position:"first",className:"rounded-r-none border-r-0"},{orientation:"horizontal",position:"middle",className:"rounded-none border-r-0"},{orientation:"horizontal",position:"last",className:"rounded-l-none"},{orientation:"vertical",position:"first",className:"rounded-b-none border-b-0"},{orientation:"vertical",position:"middle",className:"rounded-none border-b-0"},{orientation:"vertical",position:"last",className:"rounded-t-none"}],defaultVariants:{orientation:"horizontal",position:"only"}});cva("bg-[var(--border)]",{variants:{orientation:{horizontal:"w-px h-6 mx-1",vertical:"h-px w-full my-1"}},defaultVariants:{orientation:"horizontal"}});var I=memo(forwardRef(({className:p,buttonVisualClassName:t,variant:u,size:l,visualSize:c,fullWidth:f,loading:i=false,loadingText:o="Loading...",shortcut:h,children:n,isDisabled:v,paywall:s=false,paywallRedirect:m,paywallDescription:a,onPress:z,...d},g)=>{let w=useId(),b=ee(),V=re(),E=u??b?.variant??"default",C=l??b?.size,A=v??b?.isDisabled??false,R=b?.orientation==="vertical",P=f||R,k=V?ie({orientation:b?.orientation??"horizontal",position:V.position}):"",T=c??C??"default";return process.env.NODE_ENV!=="production"&&(T==="dot"||T==="icon")&&!d["aria-label"]&&!n&&console.warn('[Button] visualSize="dot" or "icon" requires aria-label when no visible text is provided (WCAG 1.1.1)'),jsx(Button,{ref:g,isDisabled:A||i||void 0,"aria-disabled":s?true:void 0,"aria-describedby":s?w:void 0,onPress:O=>{if(s){m&&window.open(m,"_blank","noopener,noreferrer");return}z?.(O);},className:x(qt({fullWidth:P,inVerticalGroup:R}),p),...d,children:O=>jsxs("span",{className:x(Xt({variant:E,visualSize:T,paywall:s,fullWidth:P}),k,t,Ht,Ot,F,Y),"data-pressed":O.isPressed||void 0,children:[i&&jsxs(Fragment,{children:[jsx(Loader2,{className:"motion-safe:animate-spin","aria-hidden":"true"}),jsx("span",{className:"sr-only","aria-live":"polite",children:o})]}),!i&&n,s&&jsx(Zap,{"data-testid":"zap-icon","aria-hidden":"true",className:"ml-1"}),s&&jsxs("span",{id:w,className:"sr-only",children:["Premium feature: ",a||"Upgrade required to access this feature"]}),O.isFocusVisible&&h&&jsx("kbd",{className:"ml-auto hidden text-xs opacity-60 lg:inline",children:h})]})})}));I.displayName="Button";var j=forwardRef(function({sectionLabel:t,sectionNumber:u,totalSections:l,allowClickOnCompleted:c=true,className:f,"aria-label":i,"data-testid":o="wizard-stepper"},h){let{currentStepIndex:n,steps:v,onStepChange:s,isLoading:m}=W();return jsxs("div",{ref:h,className:x(ct(),f),"aria-label":i,"data-testid":o,children:[t&&u!==void 0&&l!==void 0?jsxs(Fragment,{children:[jsxs("p",{className:ut(),children:["Section ",u," of ",l]}),jsx("h2",{className:mt(),children:t})]}):null,jsx("ol",{className:ft(),children:v.map((a,z)=>{let d=z<n,g=z===n,w=d?"completed":g?"current":"upcoming",b=d&&c&&!m,V=z===v.length-1,E=vt({state:w}),C=jsx("span",{className:E,"aria-hidden":"true",children:d?jsx(Check,{className:"h-4 w-4"}):jsx("span",{children:z+1})});return jsx("li",{"data-testid":`${o}-item-${a.id}`,"aria-current":g?"step":void 0,children:jsxs("div",{className:gt(),children:[jsxs("div",{className:xt(),children:[b?jsx(I,{variant:"ghost",visualSize:"icon",buttonVisualClassName:"rounded-full","aria-label":`Go back to ${a.label}`,onPress:()=>s({index:z,id:a.id,label:a.label,reason:"jump"}),"data-testid":`${o}-button-${a.id}`,children:C}):jsx("span",{className:"flex h-11 w-11 items-center justify-center",children:C}),V?null:jsx("span",{className:zt({completed:d}),"aria-hidden":"true"})]}),jsxs("div",{className:bt(),children:[jsxs("span",{className:St(),children:[jsx("span",{className:ht({state:w}),children:a.label}),g?jsx("span",{className:wt(),children:"Current step"}):null]}),g?null:jsx("span",{className:"sr-only",children:d?"(completed)":"(upcoming)"})]})]})},a.id)})})]})});j.displayName="Wizard.Stepper";function Ee(p){if(!isValidElement(p))return false;let t=p.type;return typeof t=="string"?false:t?.displayName==="Wizard.Step"}var Z=forwardRef(function({children:t,className:u,"data-testid":l="wizard-content"},c){let{currentStepId:f,steps:i}=W(),o=Children.toArray(t).filter(Ee);if(process.env.NODE_ENV!=="production"){let n=o.map(a=>a.props.id),v=i.map(a=>a.id),s=v.filter(a=>!n.includes(a)),m=n.filter(a=>!v.includes(a));(s.length>0||m.length>0)&&console.warn("[Wizard] Wizard.Step children do not match `steps` descriptors. "+(s.length?`Missing steps: ${s.join(", ")}. `:"")+(m.length?`Unknown step ids: ${m.join(", ")}.`:""));}let h=o.find(n=>n.props.id===f)??null;return jsx("div",{ref:c,className:x(Lt(),u),"data-testid":l,children:h})});Z.displayName="Wizard.Content";var X=forwardRef(function({id:t,icon:u,children:l,className:c,"data-testid":f},i){let{steps:o,currentStepIndex:h,registerStepHeading:n,stepHeadingLevel:v}=W(),s=o.find(b=>b.id===t),m=s?.label??t,a=s?.description,z=useId(),d=useId(),g=f??`wizard-step-${t}`,w=v;return jsxs("section",{ref:i,className:x(Nt(),c),"aria-labelledby":z,"aria-describedby":a?d:void 0,"data-testid":g,"data-wizard-step-id":t,"data-wizard-step-index":h,children:[jsxs("div",{className:Wt(),children:[u?jsx("span",{className:Vt(),"aria-hidden":"true",children:u}):null,jsxs("div",{children:[jsx(w,{id:z,ref:n,tabIndex:-1,className:yt(),children:m}),a?jsx("p",{id:d,className:Ct(),children:a}):null]})]}),jsx("div",{children:l})]})});X.displayName="Wizard.Step";var D={back:"Back",skip:"Skip for now",next:"Next",start:"Next",finish:"Finish"};function H(p,t){return typeof p=="function"?p(t):p}var J=forwardRef(function({labels:t,showSkip:u=false,onBack:l,onNext:c,onSkip:f,className:i,"data-testid":o="wizard-navigation"},h){let{currentStepIndex:n,currentStepId:v,totalSteps:s,steps:m,isLoading:a,onStepChange:z}=W(),d={index:n,total:s,id:v},g={back:H(t?.back??D.back,d),skip:H(t?.skip??D.skip,d),next:H(t?.next??D.next,d),start:H(t?.start??t?.next??D.start,d),finish:H(t?.finish??D.finish,d)},w=n===0,b=n===s-1,V=n===s-2,E=!w&&!b,C=!b,A=u&&!w&&!b&&!V,R=w?g.start:V?g.finish:g.next,P=()=>{let S=Math.max(0,n-1);z({index:S,id:m[S]?.id??"",label:m[S]?.label??"",reason:"back"}),l?.();},k=()=>{let S=Math.min(s-1,n+1);z({index:S,id:m[S]?.id??"",label:m[S]?.label??"",reason:"next"}),c?.();},T=()=>{let S=Math.min(s-1,n+1);z({index:S,id:m[S]?.id??"",label:m[S]?.label??"",reason:"skip"}),f?.();};return jsxs("div",{ref:h,className:x(Et(),i),"data-testid":o,children:[jsx("div",{className:Rt(),children:E?jsxs(I,{variant:"secondary",onPress:P,isDisabled:a,"data-testid":`${o}-back`,children:[jsx(ArrowLeft,{className:"mr-1 h-4 w-4 rtl:rotate-180","aria-hidden":"true"}),g.back]}):null}),jsxs("div",{className:Pt(),children:[A?jsx(I,{variant:"ghost",onPress:T,isDisabled:a,"data-testid":`${o}-skip`,children:g.skip}):null,C?jsxs(I,{variant:"default",onPress:k,isDisabled:a,loading:a,"data-testid":`${o}-next`,children:[R,V?null:jsx(ArrowRight,{className:"ml-1 h-4 w-4 rtl:rotate-180","aria-hidden":"true"})]}):null]})]})});J.displayName="Wizard.Navigation";var tt=forwardRef(function({className:t,"data-testid":u="wizard-mobile-progress"},l){let{currentStepIndex:c,steps:f,totalSteps:i}=W(),o=f[c]?.label,h=o?`Step ${c+1} of ${i}: ${o}`:`Step ${c+1} of ${i}`;return jsxs("div",{ref:l,className:x(Tt(),t),role:"progressbar","aria-label":"Wizard progress","aria-valuemin":1,"aria-valuemax":i,"aria-valuenow":c+1,"aria-valuetext":h,"data-testid":u,children:[jsx("div",{className:It(),children:f.map((n,v)=>{let s=v<c?"completed":v===c?"current":"upcoming";return jsx("span",{className:_t({state:s}),"aria-hidden":"true","data-testid":`${u}-dot-${n.id}`},n.id)})}),o?jsxs("p",{className:At(),"aria-hidden":"true","data-testid":`${u}-caption`,children:["Step ",c+1," of ",i," \xB7 ",jsx("span",{className:kt(),children:o})]}):null]})});tt.displayName="Wizard.MobileProgress";var He=(p,t)=>`Step ${p} of ${t}`,pe=forwardRef(function({children:t,currentStep:u,steps:l,onStepChange:c,isLoading:f=false,errors:i,announceTemplate:o=He,stepHeadingLevel:h="h3",className:n,id:v,"aria-label":s,"aria-labelledby":m,"data-testid":a="wizard"},z){let d=Math.min(Math.max(u,0),Math.max(l.length-1,0)),g=l[d],w=g?.id??"",b=g?.label??"",[V,E]=useState("");useEffect(()=>{l.length!==0&&E(o(d+1,l.length,b));},[d,l.length,b,o]);let[C,A]=useState("");useEffect(()=>{if(!i||i.length===0){A("");return}A(i.join(". "));},[i]);let R=useRef(null),P=useRef(true),k=useCallback(S=>{R.current=S;},[]);useEffect(()=>{if(P.current){P.current=false;return}let S=requestAnimationFrame(()=>{R.current?.focus();});return ()=>cancelAnimationFrame(S)},[d]);let T=useMemo(()=>({currentStepIndex:d,currentStepId:w,steps:l,totalSteps:l.length,isLoading:f,errors:i??[],announceTemplate:o,stepHeadingLevel:h,onStepChange:c,registerStepHeading:k}),[d,w,l,f,i,o,h,c,k]);return jsx(et.Provider,{value:T,children:jsxs("div",{ref:z,id:v,className:x(it(),n),"aria-label":s,"aria-labelledby":m,"data-testid":a,"data-wizard-step":d,children:[t,jsx("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:$(),"data-testid":`${a}-live-polite`,children:V}),jsx("div",{role:"alert","aria-live":"assertive","aria-atomic":"true",className:$(),"data-testid":`${a}-live-assertive`,children:C})]})})});pe.displayName="Wizard";var Oe=Object.assign(pe,{Layout:U,Stepper:j,Content:Z,Step:X,Navigation:J,MobileProgress:tt});var L=z.object({className:z.string().optional(),children:z.any().optional(),id:z.string().optional(),"aria-label":z.string().optional(),"aria-labelledby":z.string().optional(),"aria-describedby":z.string().optional(),"aria-live":z.enum(["off","polite","assertive"]).optional(),"aria-hidden":z.boolean().optional(),"data-testid":z.string().optional()});var Ge=z.enum(["next","back","skip","jump"]),le=z.object({id:z.string().min(1),label:z.string().min(1),description:z.string().optional()}),$e=z.enum(["h2","h3","h4","h5","h6"]),Ue=L.extend({children:z.custom(),currentStep:z.number().int().min(0),steps:z.array(le).min(1),onStepChange:z.custom(),isLoading:z.boolean().optional().default(false),errors:z.array(z.string()).optional(),announceTemplate:z.custom().optional(),stepHeadingLevel:$e.optional().default("h3")}),Fe=L.extend({children:z.custom(),preview:z.custom().optional(),helpText:z.string().optional()}),Ye=L.extend({sectionLabel:z.string().optional(),sectionNumber:z.number().int().min(1).optional(),totalSections:z.number().int().min(1).optional(),allowClickOnCompleted:z.boolean().optional().default(true)}),je=L.extend({id:z.string().min(1),children:z.custom(),icon:z.custom().optional()}),Ze=L.extend({children:z.custom()}),qe=L.extend({labels:z.custom().optional(),showSkip:z.boolean().optional().default(false),onBack:z.custom().optional(),onNext:z.custom().optional(),onSkip:z.custom().optional()}),Xe=L.extend({});export{Oe as Wizard,Ge as WizardChangeReasonSchema,Z as WizardContent,Ze as WizardContentPropsSchema,U as WizardLayout,Fe as WizardLayoutPropsSchema,tt as WizardMobileProgress,Xe as WizardMobileProgressPropsSchema,J as WizardNavigation,qe as WizardNavigationPropsSchema,Ue as WizardPropsSchema,X as WizardStep,le as WizardStepDescriptorSchema,je as WizardStepPropsSchema,j as WizardStepper,Ye as WizardStepperPropsSchema,W as useWizardContext,Lt as wizardContentCardVariants,dt as wizardLayoutContentSlotVariants,pt as wizardLayoutHelpTextVariants,nt as wizardLayoutMainVariants,lt as wizardLayoutPreviewVariants,st as wizardLayoutStepperSlotVariants,ot as wizardLayoutVariants,$ as wizardLiveRegionVariants,kt as wizardMobileProgressCaptionTitleVariants,At as wizardMobileProgressCaptionVariants,Tt as wizardMobileProgressContainerVariants,It as wizardMobileProgressDotRowVariants,_t as wizardMobileProgressDotVariants,Rt as wizardNavigationLeftVariants,Pt as wizardNavigationRightVariants,Et as wizardNavigationVariants,it as wizardRootVariants,Nt as wizardStepContainerVariants,Ct as wizardStepDescriptionVariants,Wt as wizardStepHeaderRowVariants,yt as wizardStepHeadingVariants,Vt as wizardStepIconVariants,vt as wizardStepperCircleVariants,zt as wizardStepperConnectorVariants,ct as wizardStepperContainerVariants,wt as wizardStepperCurrentSubtitleVariants,xt as wizardStepperIndicatorColumnVariants,gt as wizardStepperItemVariants,bt as wizardStepperLabelColumnVariants,ht as wizardStepperLabelTextVariants,St as wizardStepperLabelVariants,ft as wizardStepperListVariants,mt as wizardStepperSectionHeadingVariants,ut as wizardStepperSectionLabelVariants};//# sourceMappingURL=index.mjs.map
2
+ import {createContext,forwardRef,memo,useId,Children,Activity,useState,useEffect,useRef,useCallback,useMemo,useContext,isValidElement}from'react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {cva}from'class-variance-authority';import {jsxs,jsx,Fragment}from'react/jsx-runtime';import {Loader2,Zap,Check,ArrowLeft,ArrowRight}from'lucide-react';import {Button}from'react-aria-components';import {z}from'zod';function v(...n){return twMerge(clsx(n))}var rt=createContext(null);function W(){let n=useContext(rt);if(!n)throw new Error("Wizard compound components must be used within <Wizard>");return n}var B=["motion-reduce:transition-none","motion-reduce:animate-none"],ot=["transition-colors","duration-200"];function G(...n){return n.flatMap(t=>Array.isArray(t)?[...t]:[t])}var nt=cva("flex min-h-0 flex-1 flex-col"),st=cva("flex min-h-0 flex-1 flex-col lg:flex-row"),dt=cva("flex min-w-0 flex-1 justify-center gap-8 overflow-y-auto bg-[var(--page-background)] p-6"),pt=cva("hidden w-56 shrink-0 pt-2 lg:block"),lt=cva("flex w-full max-w-2xl flex-col"),ct=cva("mt-3 text-center text-xs text-[var(--menu-muted)]"),ut=cva("hidden w-80 shrink-0 border-l border-[var(--border)] bg-[var(--accent-background)] p-6 xl:block"),mt=cva("flex flex-col gap-2"),ft=cva("text-xs font-semibold uppercase tracking-wide text-[var(--primary)]"),gt=cva("text-sm font-bold text-[var(--content-foreground)]"),xt=cva("mt-6 flex flex-col"),vt=cva("flex items-start"),zt=cva("flex w-11 shrink-0 flex-col items-center"),bt=cva(G("flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-sm font-semibold",ot,B),{variants:{state:{completed:"bg-[var(--primary)] text-[var(--primary-foreground)]",current:"border-2 border-[var(--primary)] bg-[var(--content-background)] text-[var(--primary)]",upcoming:"border border-[var(--border)] bg-[var(--content-background)] text-[var(--menu-muted)]"}},defaultVariants:{state:"upcoming"}}),St=cva(G("my-0.5 h-5 w-0.5",ot,B),{variants:{completed:{true:"bg-[var(--primary)]",false:"bg-[var(--border)]"}},defaultVariants:{completed:false}}),ht=cva("flex min-h-11 items-center pl-3"),wt=cva("flex flex-col justify-center"),Nt=cva("text-sm",{variants:{state:{completed:"font-medium text-[var(--content-foreground)]",current:"font-semibold text-[var(--content-foreground)]",upcoming:"text-[var(--menu-muted)]"}},defaultVariants:{state:"upcoming"}}),Wt=cva("text-xs text-[var(--primary)]"),yt=cva("flex flex-col gap-6"),Vt=cva("flex items-start gap-4"),Ct=cva("flex h-12 w-12 shrink-0 items-center justify-center rounded-full bg-[var(--accent-background)] text-[var(--primary)]"),Lt=cva("text-lg font-bold text-[var(--content-foreground)] focus:outline-none"),Et=cva("mt-1 text-sm text-[var(--menu-muted)]"),$=cva("rounded-lg border border-[var(--border)] bg-[var(--content-background)] p-6 text-[var(--content-foreground)]"),Rt=cva("mt-4 flex items-center justify-between border-t border-[var(--border)] pt-4"),Pt=cva(""),Tt=cva("flex items-center gap-3"),It=cva("flex flex-col items-center gap-1.5 py-3 lg:hidden"),_t=cva("flex items-center justify-center gap-2"),At=cva(G("h-2 rounded-full transition-all duration-200",B),{variants:{state:{completed:"w-2 bg-[var(--primary)] opacity-60",current:"w-8 bg-[var(--primary)]",upcoming:"w-2 bg-[var(--border)]"}},defaultVariants:{state:"upcoming"}}),kt=cva("text-xs font-medium text-[var(--menu-muted)]"),Mt=cva("text-[var(--content-foreground)]"),U=cva("sr-only");var F=forwardRef(function({children:t,stepper:c,preview:s,helpText:u,className:x,"data-testid":r="wizard-layout"},i){return jsxs("div",{ref:i,className:v(st(),x),"data-testid":r,children:[jsxs("div",{className:dt(),children:[c?jsx("nav",{className:pt(),"aria-label":"Wizard steps","data-testid":`${r}-stepper-slot`,children:c}):null,jsxs("div",{className:lt(),children:[t,u?jsx("p",{className:ct(),children:u}):null]})]}),s?jsx("aside",{className:ut(),"aria-hidden":"true","data-testid":`${r}-preview`,children:s}):null]})});F.displayName="Wizard.Layout";var Xt=cva("inline-flex justify-center min-h-[44px] min-w-[44px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)] focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50",{variants:{fullWidth:{true:"w-full",false:""},inVerticalGroup:{true:"items-stretch",false:"items-center"}},defaultVariants:{fullWidth:false,inVerticalGroup:false}}),Kt=cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background motion-safe:transition-transform motion-safe:duration-200 motion-safe:[transition-timing-function:cubic-bezier(0.34,1.56,0.64,1)] motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 relative cursor-pointer",{variants:{variant:{default:"bg-[var(--primary-action)] text-[var(--primary-action-foreground)] shadow-md hover:bg-[var(--primary-action-hover)] hover:-translate-y-1",destructive:"bg-[var(--destructive-background)] text-[var(--destructive-foreground)] shadow-md hover:bg-[var(--destructive-background-hover,var(--destructive-background))] motion-safe:hover:btn-warn-shake",outline:"border border-[var(--input-border)] bg-[var(--page-background)] hover:bg-[var(--input-border)]",secondary:"bg-[var(--secondary)] text-[var(--secondary-foreground)] shadow-md hover:bg-[var(--secondary-hover,var(--secondary))]",ghost:"hover:bg-[var(--accent)] hover:text-[var(--accent-foreground)]",link:"text-[var(--text-link)] underline underline-offset-4 hover:bg-[var(--accent)] hover:text-[var(--text-link-hover)]"},fullWidth:{true:"w-full",false:""},visualSize:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3 text-xs",lg:"h-11 rounded-md px-8",icon:"h-10 w-10",dot:"h-5 w-5 rounded-full p-0 min-h-0 min-w-0"},paywall:{true:"!bg-[var(--paywall)] !text-[var(--paywall-foreground)] !shadow-md hover:!bg-[var(--paywall)]/90 !cursor-not-allowed !border-transparent",false:""}},defaultVariants:{variant:"default",visualSize:"default",paywall:false}});var Ot="data-[pressed]:scale-[0.97]";var Bt="data-[hovered]:shadow-md";var Y="hc:data-[hovered]:outline hc:data-[hovered]:outline-2 hc:data-[hovered]:outline-foreground",j="hc:data-[pressed]:outline hc:data-[pressed]:outline-2 hc:data-[pressed]:outline-offset-1 hc:data-[pressed]:outline-foreground";var ee=createContext(null);ee.displayName="ButtonGroupContext";function ae(){return useContext(ee)}var re=createContext(null);re.displayName="ButtonGroupItemContext";function ie(){return useContext(re)}cva("inline-flex items-center gap-0",{variants:{orientation:{horizontal:"flex-row",vertical:"flex-col w-full"}},defaultVariants:{orientation:"horizontal"}});var oe=cva("",{variants:{orientation:{horizontal:"min-w-[44px]",vertical:"flex min-h-[44px]"},position:{first:"",middle:"",last:"",only:""}},compoundVariants:[{orientation:"horizontal",position:"first",className:"rounded-r-none border-r-0"},{orientation:"horizontal",position:"middle",className:"rounded-none border-r-0"},{orientation:"horizontal",position:"last",className:"rounded-l-none"},{orientation:"vertical",position:"first",className:"rounded-b-none border-b-0"},{orientation:"vertical",position:"middle",className:"rounded-none border-b-0"},{orientation:"vertical",position:"last",className:"rounded-t-none"}],defaultVariants:{orientation:"horizontal",position:"only"}});cva("bg-[var(--border)]",{variants:{orientation:{horizontal:"w-px h-6 mx-1",vertical:"h-px w-full my-1"}},defaultVariants:{orientation:"horizontal"}});var I=memo(forwardRef(({className:n,buttonVisualClassName:t,variant:c,size:s,visualSize:u,fullWidth:x,loading:r=false,loadingText:i="Loading...",shortcut:z,children:m,isDisabled:f,paywall:p=false,paywallRedirect:g,paywallDescription:o,onPress:l,...d},b)=>{let w=useId(),S=ae(),y=ie(),E=c??S?.variant??"default",C=s??S?.size,A=f??S?.isDisabled??false,R=S?.orientation==="vertical",P=x||R,k=y?oe({orientation:S?.orientation??"horizontal",position:y.position}):"",T=u??C??"default";return process.env.NODE_ENV!=="production"&&(T==="dot"||T==="icon")&&!d["aria-label"]&&!m&&console.warn('[Button] visualSize="dot" or "icon" requires aria-label when no visible text is provided (WCAG 1.1.1)'),jsx(Button,{ref:b,isDisabled:A||r||void 0,"aria-disabled":p?true:void 0,"aria-describedby":p?w:void 0,onPress:O=>{if(p){g&&window.open(g,"_blank","noopener,noreferrer");return}l?.(O);},className:v(Xt({fullWidth:P,inVerticalGroup:R}),n),...d,children:O=>jsxs("span",{className:v(Kt({variant:E,visualSize:T,paywall:p,fullWidth:P}),k,t,Ot,Bt,Y,j),"data-pressed":O.isPressed||void 0,children:[r&&jsxs(Fragment,{children:[jsx(Loader2,{className:"motion-safe:animate-spin","aria-hidden":"true"}),jsx("span",{className:"sr-only","aria-live":"polite",children:i})]}),!r&&m,p&&jsx(Zap,{"data-testid":"zap-icon","aria-hidden":"true",className:"ml-1"}),p&&jsxs("span",{id:w,className:"sr-only",children:["Premium feature: ",o||"Upgrade required to access this feature"]}),O.isFocusVisible&&z&&jsx("kbd",{className:"ml-auto hidden text-xs opacity-60 lg:inline",children:z})]})})}));I.displayName="Button";var Z=forwardRef(function({sectionLabel:t,sectionNumber:c,totalSections:s,allowClickOnCompleted:u=true,className:x,"aria-label":r,"data-testid":i="wizard-stepper"},z){let{currentStepIndex:m,steps:f,onStepChange:p,isLoading:g}=W();return jsxs("div",{ref:z,className:v(mt(),x),"aria-label":r,"data-testid":i,children:[t&&c!==void 0&&s!==void 0?jsxs(Fragment,{children:[jsxs("p",{className:ft(),children:["Section ",c," of ",s]}),jsx("h2",{className:gt(),children:t})]}):null,jsx("ol",{className:xt(),children:f.map((o,l)=>{let d=l<m,b=l===m,w=d?"completed":b?"current":"upcoming",S=d&&u&&!g,y=l===f.length-1,E=bt({state:w}),C=jsx("span",{className:E,"aria-hidden":"true",children:d?jsx(Check,{className:"h-4 w-4"}):jsx("span",{children:l+1})});return jsx("li",{"data-testid":`${i}-item-${o.id}`,"aria-current":b?"step":void 0,children:jsxs("div",{className:vt(),children:[jsxs("div",{className:zt(),children:[S?jsx(I,{variant:"ghost",visualSize:"icon",buttonVisualClassName:"rounded-full","aria-label":`Go back to ${o.label}`,onPress:()=>p({index:l,id:o.id,label:o.label,reason:"jump"}),"data-testid":`${i}-button-${o.id}`,children:C}):jsx("span",{className:"flex h-11 w-11 items-center justify-center",children:C}),y?null:jsx("span",{className:St({completed:d}),"aria-hidden":"true"})]}),jsxs("div",{className:ht(),children:[jsxs("span",{className:wt(),children:[jsx("span",{className:Nt({state:w}),children:o.label}),b?jsx("span",{className:Wt(),children:"Current step"}):null]}),b?null:jsx("span",{className:"sr-only",children:d?"(completed)":"(upcoming)"})]})]})},o.id)})})]})});Z.displayName="Wizard.Stepper";var Pe=Activity??function({children:t,mode:c}){return jsx("div",{"data-activity-mode":c,children:t})};function Te(n){if(!isValidElement(n))return false;let t=n.type;return typeof t=="string"?false:t?.displayName==="Wizard.Step"}var X=forwardRef(function({children:t,className:c,"data-testid":s="wizard-content",preserveState:u=false},x){let{currentStepId:r,steps:i}=W(),z=Children.toArray(t).filter(Te);if(process.env.NODE_ENV!=="production"){let f=z.map(l=>l.props.id),p=i.map(l=>l.id),g=p.filter(l=>!f.includes(l)),o=f.filter(l=>!p.includes(l));(g.length>0||o.length>0)&&console.warn("[Wizard] Wizard.Step children do not match `steps` descriptors. "+(g.length?`Missing steps: ${g.join(", ")}. `:"")+(o.length?`Unknown step ids: ${o.join(", ")}.`:""));}if(u)return jsx("div",{ref:x,className:v($(),c),"data-testid":s,children:z.map(f=>jsx(Pe,{mode:f.props.id===r?"visible":"hidden",children:f},f.props.id))});let m=z.find(f=>f.props.id===r)??null;return jsx("div",{ref:x,className:v($(),c),"data-testid":s,children:m})});X.displayName="Wizard.Content";var Q=forwardRef(function({id:t,icon:c,children:s,className:u,"data-testid":x},r){let{steps:i,currentStepIndex:z,registerStepHeading:m,stepHeadingLevel:f}=W(),p=i.find(S=>S.id===t),g=p?.label??t,o=p?.description,l=useId(),d=useId(),b=x??`wizard-step-${t}`,w=f;return jsxs("section",{ref:r,className:v(yt(),u),"aria-labelledby":l,"aria-describedby":o?d:void 0,"data-testid":b,"data-wizard-step-id":t,"data-wizard-step-index":z,children:[jsxs("div",{className:Vt(),children:[c?jsx("span",{className:Ct(),"aria-hidden":"true",children:c}):null,jsxs("div",{children:[jsx(w,{id:l,ref:m,tabIndex:-1,className:Lt(),children:g}),o?jsx("p",{id:d,className:Et(),children:o}):null]})]}),jsx("div",{children:s})]})});Q.displayName="Wizard.Step";var D={back:"Back",skip:"Skip for now",next:"Next",start:"Next",finish:"Finish"};function H(n,t){return typeof n=="function"?n(t):n}var et=forwardRef(function({labels:t,showSkip:c=false,onBack:s,onNext:u,onSkip:x,className:r,"data-testid":i="wizard-navigation"},z){let{currentStepIndex:m,currentStepId:f,totalSteps:p,steps:g,isLoading:o,onStepChange:l}=W(),d={index:m,total:p,id:f},b={back:H(t?.back??D.back,d),skip:H(t?.skip??D.skip,d),next:H(t?.next??D.next,d),start:H(t?.start??t?.next??D.start,d),finish:H(t?.finish??D.finish,d)},w=m===0,S=m===p-1,y=m===p-2,E=!w&&!S,C=!S,A=c&&!w&&!S&&!y,R=w?b.start:y?b.finish:b.next,P=()=>{let h=Math.max(0,m-1);l({index:h,id:g[h]?.id??"",label:g[h]?.label??"",reason:"back"}),s?.();},k=()=>{let h=Math.min(p-1,m+1);l({index:h,id:g[h]?.id??"",label:g[h]?.label??"",reason:"next"}),u?.();},T=()=>{let h=Math.min(p-1,m+1);l({index:h,id:g[h]?.id??"",label:g[h]?.label??"",reason:"skip"}),x?.();};return jsxs("div",{ref:z,className:v(Rt(),r),"data-testid":i,children:[jsx("div",{className:Pt(),children:E?jsxs(I,{variant:"secondary",onPress:P,isDisabled:o,"data-testid":`${i}-back`,children:[jsx(ArrowLeft,{className:"mr-1 h-4 w-4 rtl:rotate-180","aria-hidden":"true"}),b.back]}):null}),jsxs("div",{className:Tt(),children:[A?jsx(I,{variant:"ghost",onPress:T,isDisabled:o,"data-testid":`${i}-skip`,children:b.skip}):null,C?jsxs(I,{variant:"default",onPress:k,isDisabled:o,loading:o,"data-testid":`${i}-next`,children:[R,y?null:jsx(ArrowRight,{className:"ml-1 h-4 w-4 rtl:rotate-180","aria-hidden":"true"})]}):null]})]})});et.displayName="Wizard.Navigation";var at=forwardRef(function({className:t,"data-testid":c="wizard-mobile-progress"},s){let{currentStepIndex:u,steps:x,totalSteps:r}=W(),i=x[u]?.label,z=i?`Step ${u+1} of ${r}: ${i}`:`Step ${u+1} of ${r}`;return jsxs("div",{ref:s,className:v(It(),t),role:"progressbar","aria-label":"Wizard progress","aria-valuemin":1,"aria-valuemax":r,"aria-valuenow":u+1,"aria-valuetext":z,"data-testid":c,children:[jsx("div",{className:_t(),children:x.map((m,f)=>{let p=f<u?"completed":f===u?"current":"upcoming";return jsx("span",{className:At({state:p}),"aria-hidden":"true","data-testid":`${c}-dot-${m.id}`},m.id)})}),i?jsxs("p",{className:kt(),"aria-hidden":"true","data-testid":`${c}-caption`,children:["Step ",u+1," of ",r," \xB7 ",jsx("span",{className:Mt(),children:i})]}):null]})});at.displayName="Wizard.MobileProgress";var Be=(n,t)=>`Step ${n} of ${t}`,le=forwardRef(function({children:t,currentStep:c,steps:s,onStepChange:u,isLoading:x=false,errors:r,announceTemplate:i=Be,stepHeadingLevel:z="h3",className:m,id:f,"aria-label":p,"aria-labelledby":g,"data-testid":o="wizard"},l){let d=Math.min(Math.max(c,0),Math.max(s.length-1,0)),b=s[d],w=b?.id??"",S=b?.label??"",[y,E]=useState("");useEffect(()=>{s.length!==0&&E(i(d+1,s.length,S));},[d,s.length,S,i]);let[C,A]=useState("");useEffect(()=>{if(!r||r.length===0){A("");return}A(r.join(". "));},[r]);let R=useRef(null),P=useRef(true),k=useCallback(h=>{R.current=h;},[]);useEffect(()=>{if(P.current){P.current=false;return}let h=requestAnimationFrame(()=>{R.current?.focus();});return ()=>cancelAnimationFrame(h)},[d]);let T=useMemo(()=>({currentStepIndex:d,currentStepId:w,steps:s,totalSteps:s.length,isLoading:x,errors:r??[],announceTemplate:i,stepHeadingLevel:z,onStepChange:u,registerStepHeading:k}),[d,w,s,x,r,i,z,u,k]);return jsx(rt.Provider,{value:T,children:jsxs("div",{ref:l,id:f,className:v(nt(),m),"aria-label":p,"aria-labelledby":g,"data-testid":o,"data-wizard-step":d,children:[t,jsx("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:U(),"data-testid":`${o}-live-polite`,children:y}),jsx("div",{role:"alert","aria-live":"assertive","aria-atomic":"true",className:U(),"data-testid":`${o}-live-assertive`,children:C})]})})});le.displayName="Wizard";var Ge=Object.assign(le,{Layout:F,Stepper:Z,Content:X,Step:Q,Navigation:et,MobileProgress:at});var L=z.object({className:z.string().optional(),children:z.any().optional(),id:z.string().optional(),"aria-label":z.string().optional(),"aria-labelledby":z.string().optional(),"aria-describedby":z.string().optional(),"aria-live":z.enum(["off","polite","assertive"]).optional(),"aria-hidden":z.boolean().optional(),"data-testid":z.string().optional()});var Ue=z.enum(["next","back","skip","jump"]),ce=z.object({id:z.string().min(1),label:z.string().min(1),description:z.string().optional()}),Fe=z.enum(["h2","h3","h4","h5","h6"]),Ye=L.extend({children:z.custom(),currentStep:z.number().int().min(0),steps:z.array(ce).min(1),onStepChange:z.custom(),isLoading:z.boolean().optional().default(false),errors:z.array(z.string()).optional(),announceTemplate:z.custom().optional(),stepHeadingLevel:Fe.optional().default("h3")}),je=L.extend({children:z.custom(),preview:z.custom().optional(),helpText:z.string().optional()}),Ze=L.extend({sectionLabel:z.string().optional(),sectionNumber:z.number().int().min(1).optional(),totalSections:z.number().int().min(1).optional(),allowClickOnCompleted:z.boolean().optional().default(true)}),qe=L.extend({id:z.string().min(1),children:z.custom(),icon:z.custom().optional()}),Xe=L.extend({children:z.custom(),preserveState:z.boolean().optional().default(false)}),Ke=L.extend({labels:z.custom().optional(),showSkip:z.boolean().optional().default(false),onBack:z.custom().optional(),onNext:z.custom().optional(),onSkip:z.custom().optional()}),Qe=L.extend({});export{Ge as Wizard,Ue as WizardChangeReasonSchema,X as WizardContent,Xe as WizardContentPropsSchema,F as WizardLayout,je as WizardLayoutPropsSchema,at as WizardMobileProgress,Qe as WizardMobileProgressPropsSchema,et as WizardNavigation,Ke as WizardNavigationPropsSchema,Ye as WizardPropsSchema,Q as WizardStep,ce as WizardStepDescriptorSchema,qe as WizardStepPropsSchema,Z as WizardStepper,Ze as WizardStepperPropsSchema,W as useWizardContext,$ as wizardContentCardVariants,lt as wizardLayoutContentSlotVariants,ct as wizardLayoutHelpTextVariants,dt as wizardLayoutMainVariants,ut as wizardLayoutPreviewVariants,pt as wizardLayoutStepperSlotVariants,st as wizardLayoutVariants,U as wizardLiveRegionVariants,Mt as wizardMobileProgressCaptionTitleVariants,kt as wizardMobileProgressCaptionVariants,It as wizardMobileProgressContainerVariants,_t as wizardMobileProgressDotRowVariants,At as wizardMobileProgressDotVariants,Pt as wizardNavigationLeftVariants,Tt as wizardNavigationRightVariants,Rt as wizardNavigationVariants,nt as wizardRootVariants,yt as wizardStepContainerVariants,Et as wizardStepDescriptionVariants,Vt as wizardStepHeaderRowVariants,Lt as wizardStepHeadingVariants,Ct as wizardStepIconVariants,bt as wizardStepperCircleVariants,St as wizardStepperConnectorVariants,mt as wizardStepperContainerVariants,Wt as wizardStepperCurrentSubtitleVariants,zt as wizardStepperIndicatorColumnVariants,vt as wizardStepperItemVariants,ht as wizardStepperLabelColumnVariants,Nt as wizardStepperLabelTextVariants,wt as wizardStepperLabelVariants,xt as wizardStepperListVariants,gt as wizardStepperSectionHeadingVariants,ft as wizardStepperSectionLabelVariants};//# sourceMappingURL=index.mjs.map
3
3
  //# sourceMappingURL=index.mjs.map