@medway-ui/core 1.46.0 → 1.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  "use client";
3
- import{jsx as v,jsxs as De,Fragment as it}from"react/jsx-runtime";import at from"embla-carousel-autoplay";import st from"embla-carousel-fade";import ct from"embla-carousel-react";import{cva as Y}from"class-variance-authority";import{ArrowDownMd as ut,ArrowUpMd as dt,ArrowRightMd as ft,ArrowLeftMd as pt,Play as vt,Pause as mt}from"@medway-ui/icons";import{createContext as Me,forwardRef as L,useState as le,useMemo as ie,useRef as S,useCallback as H,useEffect as O,useContext as xe,Children as gt,isValidElement as ht,Fragment as bt,cloneElement as xt}from"react";import{Button as je}from"./Button.mjs";import{useComposedRefs as yt}from"../hooks/use-composed-refs.mjs";import{usePrefersReducedMotion as Ct}from"../hooks/use-prefers-reduced-motion.mjs";import{cn as P}from"../lib/utils.mjs";var Nt=Object.defineProperty,St=Object.defineProperties,Pt=Object.getOwnPropertyDescriptors,ae=Object.getOwnPropertySymbols,$e=Object.prototype.hasOwnProperty,We=Object.prototype.propertyIsEnumerable,Be=(e,t,o)=>t in e?Nt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,N=(e,t)=>{for(var o in t||(t={}))$e.call(t,o)&&Be(e,o,t[o]);if(ae)for(var o of ae(t))We.call(t,o)&&Be(e,o,t[o]);return e},T=(e,t)=>St(e,Pt(t)),V=(e,t)=>{var o={};for(var r in e)$e.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&ae)for(var r of ae(e))t.indexOf(r)<0&&We.call(e,r)&&(o[r]=e[r]);return o};const wt=5e3,Ke="data-consumer-inert",zt={selectedIndex:0,snapCount:0,canScrollPrev:!1,canScrollNext:!1,slideCount:0,snapFirstSlides:[],announcement:""},It={horizontal:{ArrowLeft:"previous",ArrowRight:"next"},vertical:{ArrowUp:"previous",ArrowDown:"next"}},Et=["TEXTAREA","SELECT","VIDEO","AUDIO"],Ft=["button","checkbox","color","file","image","reset","submit"],Rt=["combobox","grid","listbox","menu","menubar","radiogroup","searchbox","slider","spinbutton","tablist","textbox","toolbar","tree","treegrid"],kt={horizontal:{previous:pt,next:ft},vertical:{previous:dt,next:ut}},Ot={previous:"Anterior",next:"Pr\xF3ximo"},At={none:{horizontal:{content:"",item:"",focusRing:""},vertical:{content:"",item:"",focusRing:""}},xs:{horizontal:{content:"-ml-2",item:"pl-2",focusRing:"focus-visible:after:left-2"},vertical:{content:"-mt-2",item:"pt-2",focusRing:"focus-visible:after:top-2"}},sm:{horizontal:{content:"-ml-3",item:"pl-3",focusRing:"focus-visible:after:left-3"},vertical:{content:"-mt-3",item:"pt-3",focusRing:"focus-visible:after:top-3"}},md:{horizontal:{content:"-ml-4",item:"pl-4",focusRing:"focus-visible:after:left-4"},vertical:{content:"-mt-4",item:"pt-4",focusRing:"focus-visible:after:top-4"}},lg:{horizontal:{content:"-ml-6",item:"pl-6",focusRing:"focus-visible:after:left-6"},vertical:{content:"-mt-6",item:"pt-6",focusRing:"focus-visible:after:top-6"}},xl:{horizontal:{content:"-ml-8",item:"pl-8",focusRing:"focus-visible:after:left-8"},vertical:{content:"-mt-8",item:"pt-8",focusRing:"focus-visible:after:top-8"}}},q=["side","floating","outside"],Lt=Y("relative",{variants:{orientation:{horizontal:"",vertical:""},controls:{side:"",floating:"",outside:"",inline:""}},compoundVariants:[{orientation:"horizontal",controls:q,class:"grid grid-flow-row-dense grid-cols-[auto_minmax(0,1fr)_auto] items-center [&>*]:col-span-full"},{orientation:"vertical",controls:q,class:"flex flex-col"}]}),Tt=Y("relative overflow-hidden",{variants:{orientation:{horizontal:"",vertical:""},controls:{side:"",floating:"",outside:"",inline:""}},compoundVariants:[{orientation:"horizontal",controls:q,class:"!col-start-2 !col-span-1 min-w-0"}]}),Dt=Y("relative z-10 shrink-0",{variants:{orientation:{horizontal:"",vertical:""},controls:{side:"",floating:"",outside:"",inline:""},direction:{previous:"",next:""},controlsFrom:{always:"",md:"hidden md:block",lg:"hidden lg:block"}},compoundVariants:[{orientation:"horizontal",controls:q,direction:"previous",class:"!col-start-1 !col-span-1"},{orientation:"horizontal",controls:q,direction:"next",class:"!col-start-3 !col-span-1"},{orientation:"horizontal",controls:"side",direction:"previous",class:"mr-2"},{orientation:"horizontal",controls:"side",direction:"next",class:"ml-2"},{orientation:"horizontal",controls:["floating","outside"],class:"w-0"},{orientation:"vertical",controls:q,class:"self-center"},{orientation:"vertical",controls:"side",direction:"previous",class:"mb-2"},{orientation:"vertical",controls:"side",direction:"next",class:"mt-2"},{orientation:"vertical",controls:["floating","outside"],class:"h-0"}]}),Mt=Y("touch-manipulation disabled:opacity-50 dark:disabled:opacity-30",{variants:{orientation:{horizontal:"",vertical:""},controls:{side:"",floating:"",outside:"",inline:""},direction:{previous:"",next:""},opaque:{true:"",false:""}},compoundVariants:[{controls:["floating","outside"],class:"disabled:pointer-events-auto disabled:cursor-default"},{controls:"floating",class:"shadow-level-1"},{controls:"floating",opaque:!0,class:"bg-surface-elevated dark:bg-surface-elevated disabled:hover:bg-surface-elevated"},{controls:"outside",opaque:!0,class:"disabled:hover:bg-transparent"},{controls:["floating","outside"],opaque:!0,class:"disabled:hover:dark:border-gray-stroke-muted"},{orientation:"horizontal",controls:["floating","outside"],class:"absolute top-1/2 -translate-y-1/2"},{orientation:"horizontal",controls:"floating",direction:"previous",class:"left-2"},{orientation:"horizontal",controls:"floating",direction:"next",class:"right-2"},{orientation:"horizontal",controls:"outside",direction:"previous",class:"right-2"},{orientation:"horizontal",controls:"outside",direction:"next",class:"left-2"},{orientation:"vertical",controls:["floating","outside"],class:"absolute left-1/2 -translate-x-1/2"},{orientation:"vertical",controls:"floating",direction:"previous",class:"top-2"},{orientation:"vertical",controls:"floating",direction:"next",class:"bottom-2"},{orientation:"vertical",controls:"outside",direction:"previous",class:"bottom-2"},{orientation:"vertical",controls:"outside",direction:"next",class:"top-2"}]}),He=Y("pointer-events-none absolute z-[1] transition-opacity duration-200 motion-reduce:transition-none",{variants:{orientation:{horizontal:"inset-y-0 w-8",vertical:"inset-x-0 h-8"},edge:{start:"",end:""},visible:{true:"opacity-100",false:"opacity-0"}},compoundVariants:[{orientation:"horizontal",edge:"start",class:"left-0 bg-gradient-to-r from-background to-transparent"},{orientation:"horizontal",edge:"end",class:"right-0 bg-gradient-to-l from-background to-transparent"},{orientation:"vertical",edge:"start",class:"top-0 bg-gradient-to-b from-background to-transparent"},{orientation:"vertical",edge:"end",class:"bottom-0 bg-gradient-to-t from-background to-transparent"}]}),jt="focus:outline-0 focus-visible:after:pointer-events-none focus-visible:after:absolute focus-visible:after:inset-0 focus-visible:after:ring-[3px] focus-visible:after:ring-inset focus-visible:after:ring-state-focus",$t="group flex size-6 items-center justify-center rounded-pill hover:cursor-pointer focus:outline-0 focus-visible:ring-4 focus-visible:ring-state-focus",Wt="h-2 w-2 rounded-pill bg-gray-stroke transition-[width,background-color] duration-200 motion-reduce:transition-none group-hover:data-[active=false]:bg-gray-stroke-emphasis data-[active=true]:w-4 data-[active=true]:bg-primary-background-fill",ye=Me(null),Ve=Me(null);function Z(){const e=xe(ye);if(!e)throw new Error("useCarousel must be used within a Carousel component.");return e}function Bt(){const{selectedIndex:e,snapCount:t,canScrollPrev:o,canScrollNext:r,isScrollable:s,scrollPrev:d,scrollNext:c,scrollTo:f,autoplay:a}=Z();return ie(()=>({selectedIndex:e,snapCount:t,canScrollPrev:o,canScrollNext:r,isScrollable:s,scrollPrev:d,scrollNext:c,scrollTo:f,autoplay:a}),[e,t,o,r,s,d,c,f,a])}function Kt(e){return{selectedIndex:e.selectedScrollSnap(),snapCount:e.scrollSnapList().length,canScrollPrev:e.canScrollPrev(),canScrollNext:e.canScrollNext(),slideCount:e.slideNodes().length,snapFirstSlides:e.internalEngine().slideRegistry.map((t,o)=>{var r;return(r=t[0])!=null?r:o})}}function Ht(e,t){return e.selectedIndex===t.selectedIndex&&e.snapCount===t.snapCount&&e.canScrollPrev===t.canScrollPrev&&e.canScrollNext===t.canScrollNext&&e.slideCount===t.slideCount&&e.snapFirstSlides.length===t.snapFirstSlides.length&&e.snapFirstSlides.every((o,r)=>o===t.snapFirstSlides[r])&&e.announcement===t.announcement}function Vt(e,t){const o=Object.keys(e);return o.length===Object.keys(t).length&&o.every(r=>Object.is(e[r],t[r]))}function qe(e,t){return Number.isFinite(e)&&e>=1?Math.trunc(e):t}function Ce(e){if(!(e===void 0||!Number.isFinite(e)))return Math.max(0,Math.trunc(e))}function Ue(e,t=""){return gt.toArray(e).flatMap(o=>{var r;if(!ht(o))return[];const s=`${t}${(r=o.key)!=null?r:""}`;return o.type===bt?Ue(o.props.children,`${s}/`):[xt(o,{key:s})]})}function qt(e,t,o){const r=document.activeElement;return r===o&&!e.canScrollNext&&e.canScrollPrev?"previous":r===t&&!e.canScrollPrev&&e.canScrollNext?"next":null}function Ut(e,t){const o=getComputedStyle(e);return t==="horizontal"?/auto|scroll/.test(o.overflowX)&&e.scrollWidth>e.clientWidth:/auto|scroll/.test(o.overflowY)&&e.scrollHeight>e.clientHeight}function _t(e,t){var o;return e instanceof HTMLElement&&e.isContentEditable||e instanceof HTMLInputElement&&!Ft.includes(e.type)||Et.includes(e.tagName)||Rt.includes((o=e.getAttribute("role"))!=null?o:"")||Ut(e,t)}function Xt(e,t){const o=e.nativeEvent.composedPath();return o.slice(0,o.indexOf(e.currentTarget)).some(r=>r instanceof Element&&_t(r,t))}function Gt(e){try{return e.matches(":focus-visible")}catch(t){return!1}}function _e(e){var t;return(t=e.internalEngine().slideRegistry[e.selectedScrollSnap()])!=null?t:[]}function Xe(e){return e.hasAttribute(Ke)}function Ge(e){e.getAttribute("tabindex")==="-1"&&e.removeAttribute("tabindex")}function Ne(e){var t,o;(o=(t=e.plugins())==null?void 0:t.autoplay)==null||o.reset()}function Jt(e){const t=typeof e=="object"?e.delay:void 0;return t!==void 0&&Number.isFinite(t)&&t>0?t:wt}function Je(e,t){return e==="page"?t.snapCount!==t.slideCount:qe(e,1)>1}function Yt(e,t){var o;const r=e.slideNodes().length;if(r===0)return"";const s=e.selectedScrollSnap();return t?`P\xE1gina ${s+1} de ${e.scrollSnapList().length}`:`Slide ${((o=_e(e)[0])!=null?o:s)+1} de ${r}`}function Zt(e,t){return t?`Ir para a p\xE1gina ${e+1}`:`Ir para o slide ${e+1}`}const Qt=L(function(e,t){const o=e,{orientation:r="horizontal",align:s="start",step:d=1,loop:c=!1,dragFree:f=!1,transition:a="slide",autoplay:g=!1,controls:h="side",controlsFrom:u="always",edgeBehavior:w="disable",hideControlsWhenFits:E=!0,index:R,defaultIndex:k,onIndexChange:b,setApi:z,opts:I,className:$,children:W,onKeyDown:D,onFocus:U,onPointerEnter:_,onPointerLeave:Q}=o,se=V(o,["orientation","align","step","loop","dragFree","transition","autoplay","controls","controlsFrom","edgeBehavior","hideControlsWhenFits","index","defaultIndex","onIndexChange","setApi","opts","className","children","onKeyDown","onFocus","onPointerEnter","onPointerLeave"]),y=Ct(),A=g!==!1,X=Jt(g),M=Ce(R),[ce]=le(()=>{var n;return(n=M!=null?M:Ce(k))!=null?n:0}),Ze=ie(()=>{const n=[];return A&&n.push(at({delay:X,playOnInit:!1,stopOnInteraction:!0,stopOnFocusIn:!1,stopOnMouseEnter:!1})),a==="fade"&&n.push(st()),n},[A,X,a]),[Se,l]=ct(T(N({containScroll:"trimSnaps"},I),{axis:r==="horizontal"?"x":"y",align:s,loop:c,dragFree:f,slidesToScroll:d==="page"?"auto":qe(d,1),startIndex:ce}),Ze),[G,Qe]=le(()=>T(N({},zt),{selectedIndex:ce})),[ue,Pe]=le(null),[et,we]=le(!1),de=S(null),fe=S(null),pe=S(null),ve=S(!1),j=S(ce),me=S(b),ze=S(d),Ie=S(null),ee=S(null),te=G.snapCount>1,Ee=Je(d,G),J=ue?ue==="paused":y,B=A&&te&&!J&&!et,Fe=S(B),oe=S(null),Re=S(y),ne=H(()=>{l&&(l.scrollPrev(y),Ne(l))},[l,y]),re=H(()=>{l&&(l.scrollNext(y),Ne(l))},[l,y]),ge=H(n=>{if(!l)return;const i=n!==l.selectedScrollSnap();l.scrollTo(n,y),i&&Ne(l)},[l,y]),he=H(n=>{ve.current=!0;try{n==="previous"?ne():re()}finally{ve.current=!1}},[ne,re]),ke=H(()=>{var n;return(n=oe.current)==null?void 0:n.call(oe)},[]),Oe=H(()=>Pe(J?"playing":"paused"),[J]),tt=n=>{D==null||D(n);const i=It[r][n.key];!i||n.defaultPrevented||n.altKey||n.ctrlKey||n.metaKey||n.shiftKey||n.currentTarget.contains(n.target)&&(Xt(n,r)||(n.preventDefault(),he(i)))},ot=n=>{U==null||U(n),!(!A||ue==="playing")&&Gt(n.target)&&Pe("paused")},nt=n=>{_==null||_(n),n.pointerType==="mouse"&&we(!0)},rt=n=>{Q==null||Q(n),n.pointerType==="mouse"&&we(!1)},Ae=ie(()=>({isEnabled:A,isPaused:J,isRotating:B,toggle:Oe}),[A,J,B,Oe]),lt=ie(()=>T(N({},G),{orientation:r,transition:a,controls:h,controlsFrom:u,edgeBehavior:w,hideControlsWhenFits:E,isPaged:Ee,isScrollable:te,viewportRef:Se,previousButtonRef:de,nextButtonRef:fe,scrollPrev:ne,scrollNext:re,scrollTo:ge,scrollFromArrow:he,syncFadeInert:ke,autoplay:Ae}),[G,r,a,h,u,w,E,Ee,te,Se,ne,re,ge,he,ke,Ae]);return O(()=>{me.current=b,ze.current=d,Fe.current=B,Re.current=y}),O(()=>{l&&z&&z(l)},[l,z]),O(()=>{if(!l)return;let n=!1;const i=(C,m)=>{const p=Kt(l),K=m==="select"&&n;K&&(n=!1);const Le=m!=="select"?void 0:K?"":Yt(l,Je(ze.current,p));pe.current=ve.current?qt(p,de.current,fe.current):null,Qe(be=>{const Te=T(N({},p),{announcement:Le!=null?Le:be.announcement});return Ht(be,Te)?be:Te})},x=()=>{const C=ee.current,m=C!==null&&C<l.scrollSnapList().length;m&&(ee.current=null,j.current=C);const p=j.current;if(l.selectedScrollSnap()!==p){n=!m;try{l.scrollTo(p,!0)}finally{n=!1}}},F=()=>{var C;const m=l.selectedScrollSnap();m!==j.current&&(j.current=m,(C=me.current)==null||C.call(me,m))};return j.current=l.selectedScrollSnap(),i(),l.on("reInit",x).on("select",i).on("reInit",i).on("select",F).on("reInit",F),()=>{l.off("reInit",x).off("select",i).off("reInit",i).off("select",F).off("reInit",F)}},[l]),O(()=>{var n;const i=pe.current;i&&(pe.current=null,(n=(i==="previous"?de:fe).current)==null||n.focus({preventScroll:!0}))},[G]),O(()=>{const n=Ie.current;if(!l||n&&Vt(n,e))return;if(Ie.current=e,M===void 0){ee.current=null;return}const i=l.selectedScrollSnap(),x=M===Ce(n==null?void 0:n.index);if(i!==j.current&&x)return;const F=Math.max(0,l.scrollSnapList().length-1);ee.current=M>F?M:null;const C=Math.min(M,F);C!==i&&(j.current=C,ge(C))}),O(()=>{if(!l||a!=="fade")return;const n=new Set,i=()=>{const x=l.slideNodes(),F=new Set(_e(l)),C=x.some((p,K)=>!F.has(K)&&p.contains(document.activeElement));x.forEach((p,K)=>{p.inert=!F.has(K)||Xe(p),p.inert&&n.has(p)&&(Ge(p),n.delete(p))});const m=C?x.find(p=>!p.inert):void 0;m&&(m.hasAttribute("tabindex")||(m.tabIndex=-1,n.add(m)),m.focus({preventScroll:!0}))};return oe.current=i,i(),l.on("select",i).on("reInit",i),()=>{oe.current=null,l.off("select",i).off("reInit",i);for(const x of l.slideNodes())x.inert=Xe(x);n.forEach(Ge)}},[l,a]),O(()=>{var n;const i=(n=l==null?void 0:l.plugins())==null?void 0:n.autoplay;i&&(B?i.play(y):i.stop())},[l,B,y]),O(()=>{if(!l)return;const n=()=>{var i,x;Fe.current&&((x=(i=l.plugins())==null?void 0:i.autoplay)==null||x.play(Re.current))};return l.on("pointerUp",n).on("reInit",n),()=>{l.off("pointerUp",n).off("reInit",n)}},[l]),v(ye.Provider,{value:lt,children:v("div",T(N({ref:t,role:"region","aria-roledescription":"carousel","data-slot":"carousel","data-orientation":r,"data-scrollable":te,className:P(Lt({orientation:r,controls:h}),$),onKeyDown:tt,onFocus:ot,onPointerEnter:nt,onPointerLeave:rt},se),{children:W}))})}),eo=L(function(e,t){var o=e,{gap:r="md",fadeEdges:s=!1,fadeClassName:d,viewportClassName:c,className:f,children:a}=o,g=V(o,["gap","fadeEdges","fadeClassName","viewportClassName","className","children"]);const{viewportRef:h,orientation:u,controls:w,canScrollPrev:E,canScrollNext:R,announcement:k,autoplay:b}=Z(),z=Ue(a),I=At[r][u];return De("div",{ref:h,"data-slot":"carousel-viewport",className:P(Tt({orientation:u,controls:w}),c),children:[v("div",T(N({ref:t,"data-slot":"carousel-content",className:P("flex touch-pinch-zoom",u==="horizontal"?"touch-pan-y":"touch-pan-x flex-col",I.content,f)},g),{children:z.map(($,W)=>{var D;return v(Ve.Provider,{value:{index:W,total:z.length,gapClassName:I.item,focusRingClassName:I.focusRing},children:$},(D=$.key)!=null?D:W)})})),v("div",{"data-slot":"carousel-live","aria-live":b.isRotating?"off":"polite","aria-atomic":"true",className:"sr-only",children:k}),s&&De(it,{children:[v("div",{"aria-hidden":"true","data-slot":"carousel-fade-start",className:P(He({orientation:u,edge:"start",visible:E}),d)}),v("div",{"aria-hidden":"true","data-slot":"carousel-fade-end",className:P(He({orientation:u,edge:"end",visible:R}),d)})]})]})}),to=L(function(e,t){var o=e,{className:r,inert:s}=o,d=V(o,["className","inert"]);const c=xe(Ve),f=xe(ye),a=f==null?void 0:f.syncFadeInert,g=(f==null?void 0:f.transition)==="fade",h=!!s||s==="",u={[Ke]:h||void 0};return O(()=>{a==null||a()},[h,a]),v("div",N(T(N({ref:t,role:"group","aria-roledescription":"slide","aria-label":c?`${c.index+1} de ${c.total}`:void 0,"data-slot":"carousel-item"},u),{inert:s,className:P("min-w-0 shrink-0 grow-0 basis-full",c==null?void 0:c.gapClassName,g&&jt,g&&(c==null?void 0:c.focusRingClassName),r)}),d))}),Ye=L(function(e,t){var o=e,{direction:r,variant:s="outlined",size:d="md",className:c,containerClassName:f,disabled:a,onClick:g}=o,h=V(o,["direction","variant","size","className","containerClassName","disabled","onClick"]);const{orientation:u,controls:w,controlsFrom:E,edgeBehavior:R,hideControlsWhenFits:k,isScrollable:b,canScrollPrev:z,canScrollNext:I,scrollFromArrow:$,previousButtonRef:W,nextButtonRef:D}=Z(),U=r==="previous",_=U?z:I,Q=yt(t,U?W:D),se=R==="hide"&&!_||k&&!b,y=kt[u][r],A=X=>{g==null||g(X),!X.defaultPrevented&&$(r)};return v(je,N({ref:Q,"data-slot":`carousel-${r}`,variant:s,size:d,"aria-label":Ot[r],iconLeft:v(y,{"aria-hidden":"true"}),disabled:a||!_,containerClassName:P(Dt({orientation:u,controls:w,direction:r,controlsFrom:E}),se&&"invisible",f),className:P(Mt({orientation:u,controls:w,direction:r,opaque:s==="outlined"}),c),onClick:A},h))}),oo=L(function(e,t){return v(Ye,N({ref:t,direction:"previous"},e))}),no=L(function(e,t){return v(Ye,N({ref:t,direction:"next"},e))}),ro=L(function(e,t){var o=e,{getDotLabel:r,dotClassName:s,indicatorClassName:d,className:c}=o,f=V(o,["getDotLabel","dotClassName","indicatorClassName","className"]);const{snapCount:a,snapFirstSlides:g,selectedIndex:h,isPaged:u,isScrollable:w,hideControlsWhenFits:E,scrollTo:R}=Z();return v("div",T(N({ref:t,role:"group","aria-label":u?"Escolher p\xE1gina":"Escolher slide","data-slot":"carousel-dots",className:P("mt-2 flex min-h-6 items-center justify-center",E&&!w&&"invisible",c)},f),{children:Array.from({length:a},(k,b)=>{var z;const I=b===h;return v("button",{type:"button","data-slot":"carousel-dot","data-active":I,"aria-label":r?r(b,a):Zt(u?b:(z=g[b])!=null?z:b,u),"aria-current":I||void 0,onClick:()=>R(b),className:P($t,s),children:v("span",{"data-slot":"carousel-dot-indicator","data-active":I,className:P(Wt,d)})},b)})}))}),lo=L(function(e,t){var o=e,{variant:r="outlined",size:s="sm",containerClassName:d,onClick:c}=o,f=V(o,["variant","size","containerClassName","onClick"]);const{autoplay:a,isScrollable:g,hideControlsWhenFits:h}=Z(),u=a.isPaused?vt:mt,w=a.isPaused?"Iniciar rota\xE7\xE3o autom\xE1tica":"Pausar rota\xE7\xE3o autom\xE1tica",E=h&&!g,R=k=>{c==null||c(k),k.defaultPrevented||a.toggle()};return a.isEnabled?v(je,N({ref:t,"data-slot":"carousel-autoplay-toggle",variant:r,size:s,"aria-label":w,iconLeft:v(u,{"aria-hidden":"true"}),containerClassName:P("relative z-10",E&&"invisible",d),onClick:R},f)):null});export{Qt as Carousel,lo as CarouselAutoplayToggle,eo as CarouselContent,ro as CarouselDots,to as CarouselItem,no as CarouselNext,oo as CarouselPrevious,Bt as useCarousel};
3
+ import{jsx as h,jsxs as Ve,Fragment as ht}from"react/jsx-runtime";import xt from"embla-carousel-autoplay";import yt from"embla-carousel-fade";import{WheelGesturesPlugin as St}from"embla-carousel-wheel-gestures";import Ct from"embla-carousel-react";import{cva as ee}from"class-variance-authority";import{ArrowDownMd as Nt,ArrowUpMd as wt,ArrowRightMd as It,ArrowLeftMd as zt,Play as Pt,Pause as Et}from"@medway-ui/icons";import{createContext as qe,forwardRef as D,useState as G,useMemo as de,useRef as w,useCallback as K,useEffect as L,useLayoutEffect as Ft,useContext as Ne,Children as Rt,isValidElement as kt,Fragment as Lt,cloneElement as At}from"react";import{Button as He}from"./Button.mjs";import{useComposedRefs as Ue}from"../hooks/use-composed-refs.mjs";import{useId as Ot}from"../hooks/use-id.mjs";import{usePrefersReducedMotion as Tt}from"../hooks/use-prefers-reduced-motion.mjs";import{cn as I}from"../lib/utils.mjs";var Mt=Object.defineProperty,Dt=Object.defineProperties,jt=Object.getOwnPropertyDescriptors,fe=Object.getOwnPropertySymbols,_e=Object.prototype.hasOwnProperty,Ge=Object.prototype.propertyIsEnumerable,Qe=(e,t,o)=>t in e?Mt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,N=(e,t)=>{for(var o in t||(t={}))_e.call(t,o)&&Qe(e,o,t[o]);if(fe)for(var o of fe(t))Ge.call(t,o)&&Qe(e,o,t[o]);return e},A=(e,t)=>Dt(e,jt(t)),Q=(e,t)=>{var o={};for(var r in e)_e.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&fe)for(var r of fe(e))t.indexOf(r)<0&&Ge.call(e,r)&&(o[r]=e[r]);return o};const $t=5e3,Ze="data-consumer-inert",Wt={selectedIndex:0,snapCount:0,canScrollPrev:!1,canScrollNext:!1,slideCount:0,snapFirstSlides:[],announcement:""},Bt={horizontal:{ArrowLeft:"previous",ArrowRight:"next"},vertical:{ArrowUp:"previous",ArrowDown:"next"}},Kt={Home:"first",End:"last"},Vt=["a[href]","area[href]","button:not([disabled])","input:not([disabled]):not([type='hidden'])","select:not([disabled])","textarea:not([disabled])","iframe","audio[controls]","video[controls]","summary","[contenteditable]:not([contenteditable='false'])","[tabindex]:not([tabindex='-1'])"].join(","),qt="focus:outline-0 focus-visible:ring-4 focus-visible:ring-state-focus",Ht=["TEXTAREA","SELECT","VIDEO","AUDIO"],Ut=["button","checkbox","color","file","image","reset","submit"],_t=["combobox","grid","listbox","menu","menubar","radiogroup","searchbox","slider","spinbutton","tablist","textbox","toolbar","tree","treegrid"],Gt={horizontal:{previous:zt,next:It},vertical:{previous:wt,next:Nt}},Qt={previous:"Anterior",next:"Pr\xF3ximo"},Zt={none:{horizontal:{content:"",item:"",focusRing:""},vertical:{content:"",item:"",focusRing:""}},xs:{horizontal:{content:"-ml-2",item:"pl-2",focusRing:"focus-visible:after:left-2"},vertical:{content:"-mt-2",item:"pt-2",focusRing:"focus-visible:after:top-2"}},sm:{horizontal:{content:"-ml-3",item:"pl-3",focusRing:"focus-visible:after:left-3"},vertical:{content:"-mt-3",item:"pt-3",focusRing:"focus-visible:after:top-3"}},md:{horizontal:{content:"-ml-4",item:"pl-4",focusRing:"focus-visible:after:left-4"},vertical:{content:"-mt-4",item:"pt-4",focusRing:"focus-visible:after:top-4"}},lg:{horizontal:{content:"-ml-6",item:"pl-6",focusRing:"focus-visible:after:left-6"},vertical:{content:"-mt-6",item:"pt-6",focusRing:"focus-visible:after:top-6"}},xl:{horizontal:{content:"-ml-8",item:"pl-8",focusRing:"focus-visible:after:left-8"},vertical:{content:"-mt-8",item:"pt-8",focusRing:"focus-visible:after:top-8"}}},Z=["side","floating","outside"],Jt=ee("relative",{variants:{orientation:{horizontal:"",vertical:""},controls:{side:"",floating:"",outside:"",inline:""}},compoundVariants:[{orientation:"horizontal",controls:Z,class:"grid grid-flow-row-dense grid-cols-[auto_minmax(0,1fr)_auto] items-center [&>*]:col-span-full"},{orientation:"vertical",controls:Z,class:"flex flex-col"}]}),Xt=ee("relative overflow-hidden",{variants:{orientation:{horizontal:"",vertical:""},controls:{side:"",floating:"",outside:"",inline:""}},compoundVariants:[{orientation:"horizontal",controls:Z,class:"!col-start-2 !col-span-1 min-w-0"}]}),Yt=ee("relative z-10 shrink-0",{variants:{orientation:{horizontal:"",vertical:""},controls:{side:"",floating:"",outside:"",inline:""},direction:{previous:"",next:""},controlsFrom:{always:"",md:"hidden md:block",lg:"hidden lg:block"}},compoundVariants:[{orientation:"horizontal",controls:Z,direction:"previous",class:"!col-start-1 !col-span-1"},{orientation:"horizontal",controls:Z,direction:"next",class:"!col-start-3 !col-span-1"},{orientation:"horizontal",controls:"side",direction:"previous",class:"mr-2"},{orientation:"horizontal",controls:"side",direction:"next",class:"ml-2"},{orientation:"horizontal",controls:["floating","outside"],class:"w-0"},{orientation:"vertical",controls:Z,class:"self-center"},{orientation:"vertical",controls:"side",direction:"previous",class:"mb-2"},{orientation:"vertical",controls:"side",direction:"next",class:"mt-2"},{orientation:"vertical",controls:["floating","outside"],class:"h-0"}]}),en=ee("touch-manipulation disabled:opacity-50 dark:disabled:opacity-30",{variants:{orientation:{horizontal:"",vertical:""},controls:{side:"",floating:"",outside:"",inline:""},direction:{previous:"",next:""},opaque:{true:"",false:""}},compoundVariants:[{controls:["floating","outside"],class:"disabled:pointer-events-auto disabled:cursor-default"},{controls:"floating",class:"shadow-level-1"},{controls:"floating",opaque:!0,class:"bg-surface-elevated dark:bg-surface-elevated disabled:hover:bg-surface-elevated"},{controls:"outside",opaque:!0,class:"disabled:hover:bg-transparent"},{controls:["floating","outside"],opaque:!0,class:"disabled:hover:dark:border-gray-stroke-muted"},{orientation:"horizontal",controls:["floating","outside"],class:"absolute top-1/2 -translate-y-1/2"},{orientation:"horizontal",controls:"floating",direction:"previous",class:"left-2"},{orientation:"horizontal",controls:"floating",direction:"next",class:"right-2"},{orientation:"horizontal",controls:"outside",direction:"previous",class:"right-2"},{orientation:"horizontal",controls:"outside",direction:"next",class:"left-2"},{orientation:"vertical",controls:["floating","outside"],class:"absolute left-1/2 -translate-x-1/2"},{orientation:"vertical",controls:"floating",direction:"previous",class:"top-2"},{orientation:"vertical",controls:"floating",direction:"next",class:"bottom-2"},{orientation:"vertical",controls:"outside",direction:"previous",class:"bottom-2"},{orientation:"vertical",controls:"outside",direction:"next",class:"top-2"}]}),Je=ee("pointer-events-none absolute z-[1] transition-opacity duration-200 motion-reduce:transition-none",{variants:{orientation:{horizontal:"inset-y-0 w-8",vertical:"inset-x-0 h-8"},edge:{start:"",end:""},visible:{true:"opacity-100",false:"opacity-0"}},compoundVariants:[{orientation:"horizontal",edge:"start",class:"left-0 bg-gradient-to-r from-background to-transparent"},{orientation:"horizontal",edge:"end",class:"right-0 bg-gradient-to-l from-background to-transparent"},{orientation:"vertical",edge:"start",class:"top-0 bg-gradient-to-b from-background to-transparent"},{orientation:"vertical",edge:"end",class:"bottom-0 bg-gradient-to-t from-background to-transparent"}]}),tn="focus:outline-0 focus-visible:after:pointer-events-none focus-visible:after:absolute focus-visible:after:inset-0 focus-visible:after:ring-[3px] focus-visible:after:ring-inset focus-visible:after:ring-state-focus",nn="group flex size-6 items-center justify-center rounded-pill hover:cursor-pointer focus:outline-0 focus-visible:ring-4 focus-visible:ring-state-focus",on="h-2 w-2 rounded-pill bg-gray-stroke transition-[width,background-color] duration-200 motion-reduce:transition-none group-hover:data-[active=false]:bg-gray-stroke-emphasis data-[active=true]:w-4 data-[active=true]:bg-primary-background-fill",we=qe(null),Xe=qe(null);function te(){const e=Ne(we);if(!e)throw new Error("useCarousel must be used within a Carousel component.");return e}function rn(){const{selectedIndex:e,snapCount:t,canScrollPrev:o,canScrollNext:r,isScrollable:c,scrollPrev:f,scrollNext:d,scrollTo:p,autoplay:s}=te();return de(()=>({selectedIndex:e,snapCount:t,canScrollPrev:o,canScrollNext:r,isScrollable:c,scrollPrev:f,scrollNext:d,scrollTo:p,autoplay:s}),[e,t,o,r,c,f,d,p,s])}function ln(e){return{selectedIndex:e.selectedScrollSnap(),snapCount:e.scrollSnapList().length,canScrollPrev:e.canScrollPrev(),canScrollNext:e.canScrollNext(),slideCount:e.slideNodes().length,snapFirstSlides:e.internalEngine().slideRegistry.map((t,o)=>{var r;return(r=t[0])!=null?r:o})}}function an(e,t){return e.selectedIndex===t.selectedIndex&&e.snapCount===t.snapCount&&e.canScrollPrev===t.canScrollPrev&&e.canScrollNext===t.canScrollNext&&e.slideCount===t.slideCount&&e.snapFirstSlides.length===t.snapFirstSlides.length&&e.snapFirstSlides.every((o,r)=>o===t.snapFirstSlides[r])&&e.announcement===t.announcement}function sn(e,t){const o=Object.keys(e);return o.length===Object.keys(t).length&&o.every(r=>Object.is(e[r],t[r]))}function Ye(e,t){return Number.isFinite(e)&&e>=1?Math.trunc(e):t}function Ie(e){if(!(e===void 0||!Number.isFinite(e)))return Math.max(0,Math.trunc(e))}function et(e,t=""){return Rt.toArray(e).flatMap(o=>{var r;if(!kt(o))return[];const c=`${t}${(r=o.key)!=null?r:""}`;return o.type===Lt?et(o.props.children,`${c}/`):[At(o,{key:c})]})}function cn(e,t,o){const r=document.activeElement;return r===o&&!e.canScrollNext&&e.canScrollPrev?"previous":r===t&&!e.canScrollPrev&&e.canScrollNext?"next":null}function un(e,t){const o=getComputedStyle(e);return t==="horizontal"?/auto|scroll/.test(o.overflowX)&&e.scrollWidth>e.clientWidth:/auto|scroll/.test(o.overflowY)&&e.scrollHeight>e.clientHeight}function dn(e,t){var o;return e instanceof HTMLElement&&e.isContentEditable||e instanceof HTMLInputElement&&!Ut.includes(e.type)||Ht.includes(e.tagName)||_t.includes((o=e.getAttribute("role"))!=null?o:"")||un(e,t)}function fn(e,t){const o=e.nativeEvent.composedPath();return o.slice(0,o.indexOf(e.currentTarget)).some(r=>r instanceof Element&&dn(r,t))}function pn(e){try{return e.matches(":focus-visible")}catch(t){return!1}}function tt(e){var t;return(t=e.internalEngine().slideRegistry[e.selectedScrollSnap()])!=null?t:[]}function nt(e){return e.hasAttribute(Ze)}function ot(e){e.getAttribute("tabindex")==="-1"&&e.removeAttribute("tabindex")}function ze(e){var t,o;(o=(t=e.plugins())==null?void 0:t.autoplay)==null||o.reset()}function vn(e){const t=typeof e=="object"?e.delay:void 0;return t!==void 0&&Number.isFinite(t)&&t>0?t:$t}function rt(e,t){return e==="page"?t.snapCount!==t.slideCount:Ye(e,1)>1}function mn(e,t){var o;const r=e.slideNodes().length;if(r===0)return"";const c=e.selectedScrollSnap();return t?`P\xE1gina ${c+1} de ${e.scrollSnapList().length}`:`Slide ${((o=tt(e)[0])!=null?o:c)+1} de ${r}`}function gn(e,t){return t?`Ir para a p\xE1gina ${e+1}`:`Ir para o slide ${e+1}`}const bn=D(function(e,t){const o=e,{orientation:r="horizontal",align:c="start",step:f=1,loop:d=!1,dragFree:p=!1,transition:s="slide",autoplay:v=!1,controls:S="side",controlsFrom:x="always",edgeBehavior:y="disable",hideControlsWhenFits:E=!0,wheelGestures:F=!1,index:R,defaultIndex:V,onIndexChange:C,setApi:k,opts:z,className:q,children:j,onKeyDown:$,onFocus:O,onPointerEnter:T,onPointerLeave:ne,tabIndex:oe}=o,pe=Q(o,["orientation","align","step","loop","dragFree","transition","autoplay","controls","controlsFrom","edgeBehavior","hideControlsWhenFits","wheelGestures","index","defaultIndex","onIndexChange","setApi","opts","className","children","onKeyDown","onFocus","onPointerEnter","onPointerLeave","tabIndex"]),ve=Ot(),[J,lt]=G(),Pe=J!=null?J:ve,P=Tt(),H=v!==!1,Ee=vn(v),W=Ie(R),[me]=G(()=>{var n;return(n=W!=null?W:Ie(V))!=null?n:0}),at=de(()=>{const n=[];if(H&&n.push(xt({delay:Ee,playOnInit:!1,stopOnInteraction:!0,stopOnFocusIn:!1,stopOnMouseEnter:!1})),s==="fade"&&n.push(yt()),F){const l=St();n.push(A(N({},l),{init(a,m){a.scrollSnapList().length>1&&a.internalEngine().options.watchDrag!==!1&&l.init(a,m)}}))}return n},[H,Ee,s,F]),[Fe,i]=Ct(A(N({containScroll:"trimSnaps"},z),{axis:r==="horizontal"?"x":"y",align:c,loop:d,dragFree:p,slidesToScroll:f==="page"?"auto":Ye(f,1),startIndex:me}),at),[X,st]=G(()=>A(N({},Wt),{selectedIndex:me})),[ge,Re]=G(null),[ct,ke]=G(!1),[ut,dt]=G(!0),Le=w(null),ft=Ue(t,Le),re=w(null),ie=w(null),be=w(null),he=w(!1),B=w(me),xe=w(C),Ae=w(f),Oe=w(null),le=w(null),M=X.snapCount>1,Te=rt(f,X),Y=ge?ge==="paused":P,U=H&&M&&!Y&&!ct,Me=w(U),ae=w(null),De=w(P),se=K(()=>{i&&(i.scrollPrev(P),ze(i))},[i,P]),ce=K(()=>{i&&(i.scrollNext(P),ze(i))},[i,P]),ue=K(n=>{if(!i)return;const l=n!==i.selectedScrollSnap();i.scrollTo(n,P),l&&ze(i)},[i,P]),ye=K(n=>{he.current=!0;try{n()}finally{he.current=!1}},[]),Se=K(n=>ye(n==="previous"?se:ce),[ye,se,ce]),je=K(()=>{var n;return(n=ae.current)==null?void 0:n.call(ae)},[]),$e=K(()=>Re(Y?"playing":"paused"),[Y]),pt=n=>{$==null||$(n);const l=Bt[r][n.key],a=Kt[n.key];if(!(!l&&!a||n.defaultPrevented)&&!(n.altKey||n.ctrlKey||n.metaKey||n.shiftKey)&&n.currentTarget.contains(n.target)&&!fn(n,r)){if(a){const m=n.target===n.currentTarget||n.target===re.current||n.target===ie.current;if(!i||!M||!m)return;const g=a==="first"?0:i.scrollSnapList().length-1;n.preventDefault(),ye(()=>ue(g));return}l&&(n.preventDefault(),Se(l))}},vt=n=>{O==null||O(n),!(!H||ge==="playing")&&pn(n.target)&&Re("paused")},mt=n=>{T==null||T(n),n.pointerType==="mouse"&&ke(!0)},gt=n=>{ne==null||ne(n),n.pointerType==="mouse"&&ke(!1)},We=de(()=>({isEnabled:H,isPaused:Y,isRotating:U,toggle:$e}),[H,Y,U,$e]),bt=de(()=>A(N({},X),{orientation:r,transition:s,controls:S,controlsFrom:x,edgeBehavior:y,hideControlsWhenFits:E,isPaged:Te,isScrollable:M,contentId:Pe,setContentId:lt,viewportRef:Fe,previousButtonRef:re,nextButtonRef:ie,scrollPrev:se,scrollNext:ce,scrollTo:ue,scrollFromArrow:Se,syncFadeInert:je,autoplay:We}),[X,r,s,S,x,y,E,Te,M,Pe,Fe,se,ce,ue,Se,je,We]);return L(()=>{xe.current=C,Ae.current=f,Me.current=U,De.current=P}),L(()=>{i&&k&&k(i)},[i,k]),L(()=>{if(!i)return;let n=!1;const l=(g,u)=>{const b=ln(i),_=u==="select"&&n;_&&(n=!1);const Be=u!=="select"?void 0:_?"":mn(i,rt(Ae.current,b));be.current=he.current?cn(b,re.current,ie.current):null,st(Ce=>{const Ke=A(N({},b),{announcement:Be!=null?Be:Ce.announcement});return an(Ce,Ke)?Ce:Ke})},a=()=>{const g=le.current,u=g!==null&&g<i.scrollSnapList().length;u&&(le.current=null,B.current=g);const b=B.current;if(i.selectedScrollSnap()!==b){n=!u;try{i.scrollTo(b,!0)}finally{n=!1}}},m=()=>{var g;const u=i.selectedScrollSnap();u!==B.current&&(B.current=u,(g=xe.current)==null||g.call(xe,u))};return B.current=i.selectedScrollSnap(),l(),i.on("reInit",a).on("select",l).on("reInit",l).on("select",m).on("reInit",m),()=>{i.off("reInit",a).off("select",l).off("reInit",l).off("select",m).off("reInit",m)}},[i]),L(()=>{const n=Le.current;if(!n||!M)return;const l=n.ownerDocument.defaultView,a=()=>{const g=n.querySelectorAll(Vt);dt(Array.from(g).some(u=>!(u.hasAttribute("tabindex")&&u.tabIndex<0)&&!u.matches(":disabled")&&!u.closest("[hidden], [inert]")&&u.getClientRects().length>0&&getComputedStyle(u).visibility==="visible"))};a();const m=new MutationObserver(a);return m.observe(n,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["class","style","hidden","inert","disabled","href","type","tabindex","contenteditable","controls","open"]}),l==null||l.addEventListener("resize",a),()=>{m.disconnect(),l==null||l.removeEventListener("resize",a)}},[M]),L(()=>{var n;const l=be.current;l&&(be.current=null,(n=(l==="previous"?re:ie).current)==null||n.focus({preventScroll:!0}))},[X]),L(()=>{const n=Oe.current;if(!i||n&&sn(n,e))return;if(Oe.current=e,W===void 0){le.current=null;return}const l=i.selectedScrollSnap(),a=W===Ie(n==null?void 0:n.index);if(l!==B.current&&a)return;const m=Math.max(0,i.scrollSnapList().length-1);le.current=W>m?W:null;const g=Math.min(W,m);g!==l&&(B.current=g,ue(g))}),L(()=>{if(!i||s!=="fade")return;const n=new Set,l=()=>{const a=i.slideNodes(),m=new Set(tt(i)),g=a.some((b,_)=>!m.has(_)&&b.contains(document.activeElement));a.forEach((b,_)=>{b.inert=!m.has(_)||nt(b),b.inert&&n.has(b)&&(ot(b),n.delete(b))});const u=g?a.find(b=>!b.inert):void 0;u&&(u.hasAttribute("tabindex")||(u.tabIndex=-1,n.add(u)),u.focus({preventScroll:!0}))};return ae.current=l,l(),i.on("select",l).on("reInit",l),()=>{ae.current=null,i.off("select",l).off("reInit",l);for(const a of i.slideNodes())a.inert=nt(a);n.forEach(ot)}},[i,s]),L(()=>{var n;const l=(n=i==null?void 0:i.plugins())==null?void 0:n.autoplay;l&&(U?l.play(P):l.stop())},[i,U,P]),L(()=>{if(!i)return;const n=()=>{var l,a;Me.current&&((a=(l=i.plugins())==null?void 0:l.autoplay)==null||a.play(De.current))};return i.on("pointerUp",n).on("reInit",n),()=>{i.off("pointerUp",n).off("reInit",n)}},[i]),h(we.Provider,{value:bt,children:h("div",A(N({ref:ft,role:"region","aria-roledescription":"carousel","data-slot":"carousel","data-orientation":r,"data-scrollable":M,tabIndex:oe!=null?oe:M&&!ut?0:void 0,className:I(Jt({orientation:r,controls:S}),qt,q),onKeyDown:pt,onFocus:vt,onPointerEnter:mt,onPointerLeave:gt},pe),{children:j}))})}),hn=D(function(e,t){var o=e,{gap:r="md",fadeEdges:c=!1,fadeClassName:f,viewportClassName:d,className:p,children:s,id:v}=o,S=Q(o,["gap","fadeEdges","fadeClassName","viewportClassName","className","children","id"]);const{viewportRef:x,orientation:y,controls:E,canScrollPrev:F,canScrollNext:R,announcement:V,autoplay:C,contentId:k,setContentId:z}=te();Ft(()=>(z(v),()=>z(void 0)),[v,z]);const q=et(s),j=Zt[r][y];return Ve("div",{ref:x,"data-slot":"carousel-viewport",className:I(Xt({orientation:y,controls:E}),d),children:[h("div",A(N({ref:t,id:v!=null?v:k,"data-slot":"carousel-content",className:I("flex touch-pinch-zoom",y==="horizontal"?"touch-pan-y":"touch-pan-x flex-col",j.content,p)},S),{children:q.map(($,O)=>{var T;return h(Xe.Provider,{value:{index:O,total:q.length,gapClassName:j.item,focusRingClassName:j.focusRing},children:$},(T=$.key)!=null?T:O)})})),h("div",{"data-slot":"carousel-live","aria-live":C.isRotating?"off":"polite","aria-atomic":"true",className:"sr-only",children:V}),c&&Ve(ht,{children:[h("div",{"aria-hidden":"true","data-slot":"carousel-fade-start",className:I(Je({orientation:y,edge:"start",visible:F}),f)}),h("div",{"aria-hidden":"true","data-slot":"carousel-fade-end",className:I(Je({orientation:y,edge:"end",visible:R}),f)})]})]})}),xn=D(function(e,t){var o=e,{className:r,inert:c}=o,f=Q(o,["className","inert"]);const d=Ne(Xe),p=Ne(we),s=p==null?void 0:p.syncFadeInert,v=(p==null?void 0:p.transition)==="fade",S=!!c||c==="",x={[Ze]:S||void 0};return L(()=>{s==null||s()},[S,s]),h("div",N(A(N({ref:t,role:"group","aria-roledescription":"slide","aria-label":d?`${d.index+1} de ${d.total}`:void 0,"data-slot":"carousel-item"},x),{inert:c,className:I("min-w-0 shrink-0 grow-0 basis-full",d==null?void 0:d.gapClassName,v&&tn,v&&(d==null?void 0:d.focusRingClassName),r)}),f))}),it=D(function(e,t){var o=e,{direction:r,variant:c="outlined",size:f="md",className:d,containerClassName:p,disabled:s,onClick:v}=o,S=Q(o,["direction","variant","size","className","containerClassName","disabled","onClick"]);const{orientation:x,controls:y,controlsFrom:E,edgeBehavior:F,hideControlsWhenFits:R,isScrollable:V,canScrollPrev:C,canScrollNext:k,scrollFromArrow:z,previousButtonRef:q,nextButtonRef:j,contentId:$}=te(),O=r==="previous",T=O?C:k,ne=Ue(t,O?q:j),oe=F==="hide"&&!T||R&&!V,pe=Gt[x][r],ve=J=>{v==null||v(J),!J.defaultPrevented&&z(r)};return h(He,N({ref:ne,"data-slot":`carousel-${r}`,variant:c,size:f,"aria-label":Qt[r],"aria-controls":$,iconLeft:h(pe,{"aria-hidden":"true"}),disabled:s||!T,containerClassName:I(Yt({orientation:x,controls:y,direction:r,controlsFrom:E}),oe&&"invisible",p),className:I(en({orientation:x,controls:y,direction:r,opaque:c==="outlined"}),d),onClick:ve},S))}),yn=D(function(e,t){return h(it,N({ref:t,direction:"previous"},e))}),Sn=D(function(e,t){return h(it,N({ref:t,direction:"next"},e))}),Cn=D(function(e,t){var o=e,{getDotLabel:r,dotClassName:c,indicatorClassName:f,className:d}=o,p=Q(o,["getDotLabel","dotClassName","indicatorClassName","className"]);const{snapCount:s,snapFirstSlides:v,selectedIndex:S,isPaged:x,isScrollable:y,hideControlsWhenFits:E,scrollTo:F,contentId:R}=te();return h("div",A(N({ref:t,role:"group","aria-label":x?"Escolher p\xE1gina":"Escolher slide","data-slot":"carousel-dots",className:I("mt-2 flex min-h-6 items-center justify-center",E&&!y&&"invisible",d)},p),{children:Array.from({length:s},(V,C)=>{var k;const z=C===S;return h("button",{type:"button","data-slot":"carousel-dot","data-active":z,"aria-label":r?r(C,s):gn(x?C:(k=v[C])!=null?k:C,x),"aria-current":z||void 0,"aria-controls":R,onClick:()=>F(C),className:I(nn,c),children:h("span",{"data-slot":"carousel-dot-indicator","data-active":z,className:I(on,f)})},C)})}))}),Nn=D(function(e,t){var o=e,{variant:r="outlined",size:c="sm",containerClassName:f,onClick:d}=o,p=Q(o,["variant","size","containerClassName","onClick"]);const{autoplay:s,isScrollable:v,hideControlsWhenFits:S}=te(),x=s.isPaused?Pt:Et,y=s.isPaused?"Iniciar rota\xE7\xE3o autom\xE1tica":"Pausar rota\xE7\xE3o autom\xE1tica",E=S&&!v,F=R=>{d==null||d(R),R.defaultPrevented||s.toggle()};return s.isEnabled?h(He,N({ref:t,"data-slot":"carousel-autoplay-toggle",variant:r,size:c,"aria-label":y,iconLeft:h(x,{"aria-hidden":"true"}),containerClassName:I("relative z-10",E&&"invisible",f),onClick:F},p)):null});export{bn as Carousel,Nn as CarouselAutoplayToggle,hn as CarouselContent,Cn as CarouselDots,xn as CarouselItem,Sn as CarouselNext,yn as CarouselPrevious,rn as useCarousel};
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  "use client";
3
- import{jsx as o}from"react/jsx-runtime";import{createContext as b,forwardRef as v,useMemo as C,useContext as g}from"react";import{Collapsible as l}from"radix-ui";import{cn as O}from"../lib/utils.mjs";var x=Object.defineProperty,n=Object.getOwnPropertySymbols,c=Object.prototype.hasOwnProperty,f=Object.prototype.propertyIsEnumerable,m=(e,a,t)=>a in e?x(e,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[a]=t,i=(e,a)=>{for(var t in a||(a={}))c.call(a,t)&&m(e,t,a[t]);if(n)for(var t of n(a))f.call(a,t)&&m(e,t,a[t]);return e},p=(e,a)=>{var t={};for(var r in e)c.call(e,r)&&a.indexOf(r)<0&&(t[r]=e[r]);if(e!=null&&n)for(var r of n(e))a.indexOf(r)<0&&f.call(e,r)&&(t[r]=e[r]);return t};const d=b({animation:void 0});function y(e){var a=e,{animation:t}=a,r=p(a,["animation"]);return o(d.Provider,{value:C(()=>({animation:t}),[t]),children:o(l.Root,i({"data-slot":"collapsible"},r))})}const w=v(function(e,a){return o(l.Trigger,i({ref:a,"data-slot":"collapsible-trigger"},e))});function j(e){var a=e,{className:t}=a,r=p(a,["className"]);const{animation:s}=g(d),u={accordion:"overflow-hidden data-[state=closed]:animate-collapsible-up data-[state=open]:animate-collapsible-down motion-reduce:!animate-none",fade:"data-[state=closed]:animate-fade-out data-[state=open]:animate-fade-in"};return o(l.Content,i({"data-slot":"collapsible-content",className:O(s&&u[s],t)},r))}export{y as Collapsible,j as CollapsibleContent,w as CollapsibleTrigger};
3
+ import{jsx as o}from"react/jsx-runtime";import{createContext as b,forwardRef as v,useContext as C,useMemo as g}from"react";import{Collapsible as l}from"radix-ui";import{cn as O}from"../lib/utils.mjs";var x=Object.defineProperty,n=Object.getOwnPropertySymbols,c=Object.prototype.hasOwnProperty,f=Object.prototype.propertyIsEnumerable,m=(e,a,t)=>a in e?x(e,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[a]=t,i=(e,a)=>{for(var t in a||(a={}))c.call(a,t)&&m(e,t,a[t]);if(n)for(var t of n(a))f.call(a,t)&&m(e,t,a[t]);return e},p=(e,a)=>{var t={};for(var r in e)c.call(e,r)&&a.indexOf(r)<0&&(t[r]=e[r]);if(e!=null&&n)for(var r of n(e))a.indexOf(r)<0&&f.call(e,r)&&(t[r]=e[r]);return t};const d=b({animation:void 0});function y(e){var a=e,{animation:t}=a,r=p(a,["animation"]);return o(d.Provider,{value:g(()=>({animation:t}),[t]),children:o(l.Root,i({"data-slot":"collapsible"},r))})}const w=v(function(e,a){return o(l.Trigger,i({ref:a,"data-slot":"collapsible-trigger"},e))});function j(e){var a=e,{className:t}=a,r=p(a,["className"]);const{animation:s}=C(d),u={accordion:"overflow-hidden data-[state=closed]:animate-collapsible-up data-[state=open]:animate-collapsible-down motion-reduce:!animate-none",fade:"data-[state=closed]:animate-fade-out data-[state=open]:animate-fade-in"};return o(l.Content,i({"data-slot":"collapsible-content",className:O(s&&u[s],t)},r))}export{y as Collapsible,j as CollapsibleContent,w as CollapsibleTrigger};
@@ -1,30 +1,120 @@
1
1
  import { type ComponentProps, type MouseEventHandler, type ReactNode } from "react";
2
- import { type ConnectorPosition } from "./Connector.js";
2
+ import { type ConnectorAnchor, type ConnectorPosition } from "./Connector.js";
3
3
  type ConnectorNodeStatus = "done" | "current" | "upcoming";
4
+ type ConnectorNodeCard = {
5
+ badge?: string;
6
+ title: string;
7
+ description: ReactNode;
8
+ };
4
9
  type ConnectorNodeOwn = {
5
10
  status?: ConnectorNodeStatus | null;
6
11
  label: string;
7
12
  icon?: ReactNode;
8
- /**
9
- * Linha que sai da etapa. Com ela, a etapa ocupa a largura da trilha,
10
- * fica na âncora de início e desenha a linha embaixo. `null` não desenha.
11
- */
12
- connector?: ConnectorPosition | null;
13
- };
13
+ } & ({
14
+ connector: ConnectorPosition;
15
+ position?: never;
16
+ } | {
17
+ connector?: null;
18
+ position?: ConnectorAnchor;
19
+ });
14
20
  type ConnectorNodeButtonProps = ConnectorNodeOwn & Omit<ComponentProps<"button">, "children" | "type"> & {
15
- /**
16
- * Torna a etapa um botão. Mantenha estável durante a vida da etapa:
17
- * alternar entre função e `undefined` troca o elemento raiz e remonta a etapa.
18
- */
19
21
  onClick: MouseEventHandler<HTMLButtonElement>;
22
+ card?: ConnectorNodeCard | null;
23
+ };
24
+ type ConnectorNodeCardProps = ConnectorNodeOwn & Omit<ComponentProps<"button">, "children" | "type"> & {
25
+ onClick?: MouseEventHandler<HTMLButtonElement>;
26
+ card: ConnectorNodeCard;
20
27
  };
21
28
  type ButtonOnlyKey = Exclude<keyof ComponentProps<"button">, keyof ComponentProps<"div">>;
22
29
  type ConnectorNodeStaticProps = ConnectorNodeOwn & Omit<ComponentProps<"div">, "children" | "onClick"> & {
23
30
  onClick?: undefined;
31
+ card?: null;
24
32
  } & {
25
33
  [K in ButtonOnlyKey]?: never;
26
34
  };
27
- type ConnectorNodeProps = ConnectorNodeButtonProps | ConnectorNodeStaticProps;
28
- declare const ConnectorNode: import("react").ForwardRefExoticComponent<(Omit<ConnectorNodeButtonProps, "ref"> | Omit<ConnectorNodeStaticProps, "ref">) & import("react").RefAttributes<HTMLButtonElement | HTMLDivElement>>;
35
+ type ConnectorNodeProps = ConnectorNodeButtonProps | ConnectorNodeCardProps | ConnectorNodeStaticProps;
36
+ declare const ConnectorNode: import("react").ForwardRefExoticComponent<(Omit<{
37
+ status?: ConnectorNodeStatus | null;
38
+ label: string;
39
+ icon?: ReactNode;
40
+ } & {
41
+ connector: ConnectorPosition;
42
+ position?: never;
43
+ } & Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "type" | "children"> & {
44
+ onClick: MouseEventHandler<HTMLButtonElement>;
45
+ card?: ConnectorNodeCard | null;
46
+ }, "ref"> | Omit<{
47
+ status?: ConnectorNodeStatus | null;
48
+ label: string;
49
+ icon?: ReactNode;
50
+ } & {
51
+ connector?: null;
52
+ position?: ConnectorAnchor;
53
+ } & Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "type" | "children"> & {
54
+ onClick: MouseEventHandler<HTMLButtonElement>;
55
+ card?: ConnectorNodeCard | null;
56
+ }, "ref"> | Omit<{
57
+ status?: ConnectorNodeStatus | null;
58
+ label: string;
59
+ icon?: ReactNode;
60
+ } & {
61
+ connector: ConnectorPosition;
62
+ position?: never;
63
+ } & Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "type" | "children"> & {
64
+ onClick?: MouseEventHandler<HTMLButtonElement>;
65
+ card: ConnectorNodeCard;
66
+ }, "ref"> | Omit<{
67
+ status?: ConnectorNodeStatus | null;
68
+ label: string;
69
+ icon?: ReactNode;
70
+ } & {
71
+ connector?: null;
72
+ position?: ConnectorAnchor;
73
+ } & Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "type" | "children"> & {
74
+ onClick?: MouseEventHandler<HTMLButtonElement>;
75
+ card: ConnectorNodeCard;
76
+ }, "ref"> | Omit<{
77
+ status?: ConnectorNodeStatus | null;
78
+ label: string;
79
+ icon?: ReactNode;
80
+ } & {
81
+ connector: ConnectorPosition;
82
+ position?: never;
83
+ } & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "children" | "onClick"> & {
84
+ onClick?: undefined;
85
+ card?: null;
86
+ } & {
87
+ form?: undefined;
88
+ name?: undefined;
89
+ type?: undefined;
90
+ disabled?: undefined;
91
+ formAction?: undefined;
92
+ formEncType?: undefined;
93
+ formMethod?: undefined;
94
+ formNoValidate?: undefined;
95
+ formTarget?: undefined;
96
+ value?: undefined;
97
+ }, "ref"> | Omit<{
98
+ status?: ConnectorNodeStatus | null;
99
+ label: string;
100
+ icon?: ReactNode;
101
+ } & {
102
+ connector?: null;
103
+ position?: ConnectorAnchor;
104
+ } & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "children" | "onClick"> & {
105
+ onClick?: undefined;
106
+ card?: null;
107
+ } & {
108
+ form?: undefined;
109
+ name?: undefined;
110
+ type?: undefined;
111
+ disabled?: undefined;
112
+ formAction?: undefined;
113
+ formEncType?: undefined;
114
+ formMethod?: undefined;
115
+ formNoValidate?: undefined;
116
+ formTarget?: undefined;
117
+ value?: undefined;
118
+ }, "ref">) & import("react").RefAttributes<HTMLButtonElement | HTMLDivElement>>;
29
119
  export { ConnectorNode };
30
- export type { ConnectorNodeProps, ConnectorNodeStatus };
120
+ export type { ConnectorNodeCard, ConnectorNodeProps, ConnectorNodeStatus };
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  "use client";
3
- "use strict";var t=require("react/jsx-runtime"),s=require("class-variance-authority"),_=require("react"),x=require("./Connector.js"),h=require("../lib/utils.js"),E=Object.defineProperty,S=Object.defineProperties,z=Object.getOwnPropertyDescriptors,c=Object.getOwnPropertySymbols,y=Object.prototype.hasOwnProperty,k=Object.prototype.propertyIsEnumerable,j=(e,r,n)=>r in e?E(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n,i=(e,r)=>{for(var n in r||(r={}))y.call(r,n)&&j(e,n,r[n]);if(c)for(var n of c(r))k.call(r,n)&&j(e,n,r[n]);return e},N=(e,r)=>S(e,z(r)),C=(e,r)=>{var n={};for(var o in e)y.call(e,o)&&r.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&c)for(var o of c(e))r.indexOf(o)<0&&k.call(e,o)&&(n[o]=e[o]);return n};const D={done:"Conclu\xEDdo",current:"Atual",upcoming:"Pr\xF3ximo"},$=s.cva("pointer-events-none absolute inset-0 block origin-center rounded-lg border-2 group-disabled/connector-node:border-gray-stroke-muted group-disabled/connector-node:animate-none",{variants:{status:{done:"border-solid border-secondary-stroke-emphasis",current:"border-solid border-secondary-stroke-emphasis animate-connector-node-pulse motion-reduce:animate-none",upcoming:"border-dashed border-gray-stroke-muted"}}}),F=s.cva("absolute inset-2 flex flex-col overflow-hidden rounded-[10px] px-0.5 pb-1.5 pt-0.5 transition-colors motion-reduce:transition-none group-disabled/connector-node:bg-gray-stroke-muted",{variants:{status:{done:"bg-secondary-stroke-emphasis",current:"bg-gray-stroke-muted [@media(hover:hover)]:group-hover/connector-node:bg-gray-stroke",upcoming:"bg-gray-stroke-muted [@media(hover:hover)]:group-hover/connector-node:bg-gray-stroke"}}}),H=s.cva("flex w-full flex-1 items-center justify-center rounded-md [&_svg]:size-6 [&_svg]:shrink-0 group-disabled/connector-node:text-gray-foreground-muted group-disabled/connector-node:[background:var(--color-surface-card)]",{variants:{status:{done:"text-secondary-foreground-muted [background:linear-gradient(0deg,var(--color-secondary-background-soft-muted),var(--color-secondary-background-soft-muted)),var(--color-surface-card)]",current:"bg-surface-card text-gray-stroke-emphasis",upcoming:"bg-surface-card text-gray-stroke-emphasis"}}}),I=s.cva("w-full text-center text-sm font-semibold leading-sm group-disabled/connector-node:text-gray-foreground-muted",{variants:{status:{done:"text-gray-stroke-emphasis line-through",current:"text-primary-foreground",upcoming:"text-gray-stroke-emphasis"}}}),L=_.forwardRef(function(e,r){var n;const o=(n=e.status)!=null?n:"current",{label:g,className:O,icon:w,connector:d}=e,l=typeof e.onClick=="function",u=l&&o==="current"?void 0:D[o],p=t.jsxs(t.Fragment,{children:[t.jsxs("span",{"data-slot":"connector-node-shape",className:"relative block size-[72px] shrink-0",children:[t.jsx("span",{"data-slot":"connector-node-ring",className:$({status:o})}),t.jsx("span",{"data-slot":"connector-node-base",className:F({status:o}),children:t.jsx("span",{"data-slot":"connector-node-face",className:H({status:o}),children:w})})]}),t.jsx("span",{"data-slot":"connector-node-label","aria-hidden":u?!0:void 0,className:I({status:o}),children:g}),u?t.jsx("span",{className:"sr-only",children:`${g}, ${u}`}):null]}),P=h.cn("inline-flex w-[72px] shrink-0 flex-col items-center gap-1.5 border-0 bg-transparent p-0",l&&"group/connector-node rounded-lg hover:cursor-pointer disabled:pointer-events-none focus:outline-0 focus-visible:ring-4 focus-visible:ring-state-focus",O),m={"data-slot":"connector-node","data-status":o,"aria-current":o==="current"?"step":void 0,className:P};if(l){const a=e,{status:v,label:V,className:W,icon:X,connector:Y,onClick:A}=a,R=C(a,["status","label","className","icon","connector","onClick"]);return f(t.jsx("button",N(i(i({ref:r},R),m),{type:"button",onClick:A,children:p})))}const b=e,{status:T,label:B,className:G,icon:J,connector:Q,onClick:U}=b,q=C(b,["status","label","className","icon","connector","onClick"]);return f(t.jsx("div",N(i(i({ref:r},q),m),{children:p})));function f(a){if(!d)return a;const v=d.split("-to-")[0];return t.jsxs("div",{"data-slot":"connector-node-item",className:"flex w-[400px] min-w-0 max-w-full flex-col",children:[t.jsx("div",{className:h.cn("w-fit",x.CONNECTOR_ANCHOR_CLASS[v]),children:a}),t.jsx(x.Connector,{position:d,done:o==="done"})]})}});exports.ConnectorNode=L;
3
+ "use strict";var e=require("react/jsx-runtime"),i=require("class-variance-authority"),D=require("react"),F=require("./Badge.js"),v=require("./Collapsible.js"),h=require("./Connector.js"),H=require("../hooks/use-id.js"),d=require("../lib/utils.js"),L=Object.defineProperty,T=Object.defineProperties,$=Object.getOwnPropertyDescriptors,u=Object.getOwnPropertySymbols,w=Object.prototype.hasOwnProperty,q=Object.prototype.propertyIsEnumerable,A=(r,t,n)=>t in r?L(r,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[t]=n,p=(r,t)=>{for(var n in t||(t={}))w.call(t,n)&&A(r,n,t[n]);if(u)for(var n of u(t))q.call(t,n)&&A(r,n,t[n]);return r},P=(r,t)=>T(r,$(t)),R=(r,t)=>{var n={};for(var o in r)w.call(r,o)&&t.indexOf(o)<0&&(n[o]=r[o]);if(r!=null&&u)for(var o of u(r))t.indexOf(o)<0&&q.call(r,o)&&(n[o]=r[o]);return n};const V={done:"Conclu\xEDdo",current:"Atual",upcoming:"Pr\xF3ximo"},K=i.cva("pointer-events-none absolute inset-0 block origin-center rounded-lg border-2 group-disabled/connector-node:border-gray-stroke-muted group-disabled/connector-node:animate-none",{variants:{status:{done:"border-solid border-secondary-stroke-emphasis",current:"border-solid border-secondary-stroke-emphasis animate-connector-node-pulse motion-reduce:animate-none",upcoming:"border-dashed border-gray-stroke-muted"}}}),M=i.cva("absolute inset-2 flex flex-col overflow-hidden rounded-[10px] px-0.5 pb-1.5 pt-0.5 transition-colors motion-reduce:transition-none group-disabled/connector-node:bg-gray-stroke-muted",{variants:{status:{done:"bg-secondary-stroke-emphasis",current:"bg-gray-stroke-muted [@media(hover:hover)]:group-hover/connector-node:bg-gray-stroke",upcoming:"bg-gray-stroke-muted [@media(hover:hover)]:group-hover/connector-node:bg-gray-stroke"}}}),Q=i.cva("flex w-full flex-1 items-center justify-center rounded-md [&_svg]:size-6 [&_svg]:shrink-0 group-disabled/connector-node:text-gray-foreground-muted group-disabled/connector-node:[background:var(--color-surface-card)]",{variants:{status:{done:"text-secondary-foreground-muted [background:linear-gradient(0deg,var(--color-secondary-background-soft-muted),var(--color-secondary-background-soft-muted)),var(--color-surface-card)]",current:"bg-surface-card text-gray-stroke-emphasis",upcoming:"bg-surface-card text-gray-stroke-emphasis"}}}),X=i.cva("w-full text-center text-sm font-semibold leading-sm group-disabled/connector-node:text-gray-foreground-muted",{variants:{status:{done:"text-gray-stroke-emphasis line-through",current:"text-primary-foreground",upcoming:"text-gray-stroke-emphasis"}}}),Y={left:"left-[calc(16.75%-6px)]",center:"left-[calc(50%-6px)]",right:"left-[calc(83.25%-6px)]"},Z=D.forwardRef(function(r,t){var n;const o=(n=r.status)!=null?n:"current",{label:y,className:_,icon:z,connector:c,position:l,card:a}=r,k=H.useId(),g=typeof r.onClick=="function"||a!=null,m=g&&o==="current"?void 0:V[o],j=e.jsxs(e.Fragment,{children:[e.jsxs("span",{"data-slot":"connector-node-shape",className:"relative block size-[72px] shrink-0",children:[e.jsx("span",{"data-slot":"connector-node-ring",className:K({status:o})}),e.jsx("span",{"data-slot":"connector-node-base",className:M({status:o}),children:e.jsx("span",{"data-slot":"connector-node-face",className:Q({status:o}),children:z})})]}),e.jsx("span",{"data-slot":"connector-node-label","aria-hidden":m?!0:void 0,className:X({status:o}),children:y}),m?e.jsx("span",{className:"sr-only",children:`${y}, ${m}`}):null]}),E=d.cn("inline-flex w-[72px] shrink-0 flex-col items-center gap-1.5 border-0 bg-transparent p-0",g&&"group/connector-node rounded-lg hover:cursor-pointer disabled:pointer-events-none focus:outline-0 focus-visible:ring-4 focus-visible:ring-state-focus",_),N={"data-slot":"connector-node","data-status":o,"aria-current":o==="current"?"step":void 0,className:E};if(g){const s=r,{status:b,label:f,className:x,icon:ne,connector:ae,position:se,card:ce,onClick:I}=s,B=R(s,["status","label","className","icon","connector","position","card","onClick"]);return O(e.jsx("button",P(p(p({ref:t},B),N),{type:"button",onClick:I,children:j})))}const C=r,{status:G,label:J,className:U,icon:W,connector:ee,position:re,card:oe,onClick:te}=C,S=R(C,["status","label","className","icon","connector","position","card","onClick"]);return O(e.jsx("div",P(p(p({ref:t},S),N),{children:j})));function O(s){if(!c&&!a)return l?e.jsx("div",{"data-slot":"connector-node-anchor",className:d.cn("w-fit",h.CONNECTOR_ANCHOR_CLASS[l]),children:s}):s;const b=c?c.split("-to-")[0]:l!=null?l:"center",f="flex w-[400px] min-w-0 max-w-full flex-col",x=e.jsxs(e.Fragment,{children:[e.jsx("div",{className:d.cn("w-fit",h.CONNECTOR_ANCHOR_CLASS[b]),children:a?e.jsx(v.CollapsibleTrigger,{asChild:!0,children:s}):s}),a?e.jsx(v.CollapsibleContent,{role:"region","aria-labelledby":k,"data-slot":"connector-node-card",className:"w-full",children:e.jsxs("div",{className:"relative pb-2 pt-2",children:[e.jsxs("div",{className:"flex flex-col items-start gap-2 rounded-lg border border-gray-stroke-muted bg-surface-card p-5",children:[a.badge?e.jsx(F.Badge,{size:"lg",variant:o==="upcoming"?"primary-soft":"secondary-soft",className:"mb-1 uppercase",children:a.badge}):null,e.jsx("p",{id:k,className:"m-0 text-md font-bold leading-md text-primary-foreground",children:a.title}),e.jsx("div",{className:"text-sm leading-sm text-gray-foreground",children:a.description})]}),e.jsx("span",{"aria-hidden":"true","data-slot":"connector-node-card-arrow",className:d.cn("absolute top-0.5 size-3 rotate-45 border-l border-t border-gray-stroke-muted bg-surface-card",Y[b])})]})}):null,c?e.jsx(h.Connector,{position:c,done:o==="done"}):null]});return a?e.jsx(v.Collapsible,{animation:"accordion","data-slot":"connector-node-item",className:f,children:x}):e.jsx("div",{"data-slot":"connector-node-item",className:f,children:x})}});exports.ConnectorNode=Z;
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  "use client";
3
- import{jsxs as m,Fragment as R,jsx as n}from"react/jsx-runtime";import{cva as s}from"class-variance-authority";import{forwardRef as S}from"react";import{CONNECTOR_ANCHOR_CLASS as $,Connector as z}from"./Connector.mjs";import{cn as x}from"../lib/utils.mjs";var D=Object.defineProperty,F=Object.defineProperties,H=Object.getOwnPropertyDescriptors,c=Object.getOwnPropertySymbols,y=Object.prototype.hasOwnProperty,k=Object.prototype.propertyIsEnumerable,N=(e,r,t)=>r in e?D(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,d=(e,r)=>{for(var t in r||(r={}))y.call(r,t)&&N(e,t,r[t]);if(c)for(var t of c(r))k.call(r,t)&&N(e,t,r[t]);return e},O=(e,r)=>F(e,H(r)),C=(e,r)=>{var t={};for(var o in e)y.call(e,o)&&r.indexOf(o)<0&&(t[o]=e[o]);if(e!=null&&c)for(var o of c(e))r.indexOf(o)<0&&k.call(e,o)&&(t[o]=e[o]);return t};const I={done:"Conclu\xEDdo",current:"Atual",upcoming:"Pr\xF3ximo"},L=s("pointer-events-none absolute inset-0 block origin-center rounded-lg border-2 group-disabled/connector-node:border-gray-stroke-muted group-disabled/connector-node:animate-none",{variants:{status:{done:"border-solid border-secondary-stroke-emphasis",current:"border-solid border-secondary-stroke-emphasis animate-connector-node-pulse motion-reduce:animate-none",upcoming:"border-dashed border-gray-stroke-muted"}}}),T=s("absolute inset-2 flex flex-col overflow-hidden rounded-[10px] px-0.5 pb-1.5 pt-0.5 transition-colors motion-reduce:transition-none group-disabled/connector-node:bg-gray-stroke-muted",{variants:{status:{done:"bg-secondary-stroke-emphasis",current:"bg-gray-stroke-muted [@media(hover:hover)]:group-hover/connector-node:bg-gray-stroke",upcoming:"bg-gray-stroke-muted [@media(hover:hover)]:group-hover/connector-node:bg-gray-stroke"}}}),q=s("flex w-full flex-1 items-center justify-center rounded-md [&_svg]:size-6 [&_svg]:shrink-0 group-disabled/connector-node:text-gray-foreground-muted group-disabled/connector-node:[background:var(--color-surface-card)]",{variants:{status:{done:"text-secondary-foreground-muted [background:linear-gradient(0deg,var(--color-secondary-background-soft-muted),var(--color-secondary-background-soft-muted)),var(--color-surface-card)]",current:"bg-surface-card text-gray-stroke-emphasis",upcoming:"bg-surface-card text-gray-stroke-emphasis"}}}),B=s("w-full text-center text-sm font-semibold leading-sm group-disabled/connector-node:text-gray-foreground-muted",{variants:{status:{done:"text-gray-stroke-emphasis line-through",current:"text-primary-foreground",upcoming:"text-gray-stroke-emphasis"}}}),G=S(function(e,r){var t;const o=(t=e.status)!=null?t:"current",{label:p,className:w,icon:j,connector:i}=e,l=typeof e.onClick=="function",u=l&&o==="current"?void 0:I[o],g=m(R,{children:[m("span",{"data-slot":"connector-node-shape",className:"relative block size-[72px] shrink-0",children:[n("span",{"data-slot":"connector-node-ring",className:L({status:o})}),n("span",{"data-slot":"connector-node-base",className:T({status:o}),children:n("span",{"data-slot":"connector-node-face",className:q({status:o}),children:j})})]}),n("span",{"data-slot":"connector-node-label","aria-hidden":u?!0:void 0,className:B({status:o}),children:p}),u?n("span",{className:"sr-only",children:`${p}, ${u}`}):null]}),P=x("inline-flex w-[72px] shrink-0 flex-col items-center gap-1.5 border-0 bg-transparent p-0",l&&"group/connector-node rounded-lg hover:cursor-pointer disabled:pointer-events-none focus:outline-0 focus-visible:ring-4 focus-visible:ring-state-focus",w),f={"data-slot":"connector-node","data-status":o,"aria-current":o==="current"?"step":void 0,className:P};if(l){const a=e,{status:h,label:Y,className:Z,icon:K,connector:M,onClick:A}=a,E=C(a,["status","label","className","icon","connector","onClick"]);return v(n("button",O(d(d({ref:r},E),f),{type:"button",onClick:A,children:g})))}const b=e,{status:J,label:Q,className:U,icon:V,connector:W,onClick:X}=b,_=C(b,["status","label","className","icon","connector","onClick"]);return v(n("div",O(d(d({ref:r},_),f),{children:g})));function v(a){if(!i)return a;const h=i.split("-to-")[0];return m("div",{"data-slot":"connector-node-item",className:"flex w-[400px] min-w-0 max-w-full flex-col",children:[n("div",{className:x("w-fit",$[h]),children:a}),n(z,{position:i,done:o==="done"})]})}});export{G as ConnectorNode};
3
+ import{jsxs as l,Fragment as O,jsx as t}from"react/jsx-runtime";import{cva as i}from"class-variance-authority";import{forwardRef as F}from"react";import{Badge as H}from"./Badge.mjs";import{CollapsibleTrigger as L,CollapsibleContent as T,Collapsible as V}from"./Collapsible.mjs";import{CONNECTOR_ANCHOR_CLASS as j,Connector as K}from"./Connector.mjs";import{useId as M}from"../hooks/use-id.mjs";import{cn as u}from"../lib/utils.mjs";var Q=Object.defineProperty,X=Object.defineProperties,Y=Object.getOwnPropertyDescriptors,m=Object.getOwnPropertySymbols,P=Object.prototype.hasOwnProperty,$=Object.prototype.propertyIsEnumerable,z=(e,o,n)=>o in e?Q(e,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[o]=n,p=(e,o)=>{for(var n in o||(o={}))P.call(o,n)&&z(e,n,o[n]);if(m)for(var n of m(o))$.call(o,n)&&z(e,n,o[n]);return e},R=(e,o)=>X(e,Y(o)),_=(e,o)=>{var n={};for(var r in e)P.call(e,r)&&o.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&m)for(var r of m(e))o.indexOf(r)<0&&$.call(e,r)&&(n[r]=e[r]);return n};const Z={done:"Conclu\xEDdo",current:"Atual",upcoming:"Pr\xF3ximo"},q=i("pointer-events-none absolute inset-0 block origin-center rounded-lg border-2 group-disabled/connector-node:border-gray-stroke-muted group-disabled/connector-node:animate-none",{variants:{status:{done:"border-solid border-secondary-stroke-emphasis",current:"border-solid border-secondary-stroke-emphasis animate-connector-node-pulse motion-reduce:animate-none",upcoming:"border-dashed border-gray-stroke-muted"}}}),G=i("absolute inset-2 flex flex-col overflow-hidden rounded-[10px] px-0.5 pb-1.5 pt-0.5 transition-colors motion-reduce:transition-none group-disabled/connector-node:bg-gray-stroke-muted",{variants:{status:{done:"bg-secondary-stroke-emphasis",current:"bg-gray-stroke-muted [@media(hover:hover)]:group-hover/connector-node:bg-gray-stroke",upcoming:"bg-gray-stroke-muted [@media(hover:hover)]:group-hover/connector-node:bg-gray-stroke"}}}),J=i("flex w-full flex-1 items-center justify-center rounded-md [&_svg]:size-6 [&_svg]:shrink-0 group-disabled/connector-node:text-gray-foreground-muted group-disabled/connector-node:[background:var(--color-surface-card)]",{variants:{status:{done:"text-secondary-foreground-muted [background:linear-gradient(0deg,var(--color-secondary-background-soft-muted),var(--color-secondary-background-soft-muted)),var(--color-surface-card)]",current:"bg-surface-card text-gray-stroke-emphasis",upcoming:"bg-surface-card text-gray-stroke-emphasis"}}}),U=i("w-full text-center text-sm font-semibold leading-sm group-disabled/connector-node:text-gray-foreground-muted",{variants:{status:{done:"text-gray-stroke-emphasis line-through",current:"text-primary-foreground",upcoming:"text-gray-stroke-emphasis"}}}),W={left:"left-[calc(16.75%-6px)]",center:"left-[calc(50%-6px)]",right:"left-[calc(83.25%-6px)]"},ee=F(function(e,o){var n;const r=(n=e.status)!=null?n:"current",{label:x,className:A,icon:E,connector:c,position:d,card:a}=e,y=M(),g=typeof e.onClick=="function"||a!=null,f=g&&r==="current"?void 0:Z[r],k=l(O,{children:[l("span",{"data-slot":"connector-node-shape",className:"relative block size-[72px] shrink-0",children:[t("span",{"data-slot":"connector-node-ring",className:q({status:r})}),t("span",{"data-slot":"connector-node-base",className:G({status:r}),children:t("span",{"data-slot":"connector-node-face",className:J({status:r}),children:E})})]}),t("span",{"data-slot":"connector-node-label","aria-hidden":f?!0:void 0,className:U({status:r}),children:x}),f?t("span",{className:"sr-only",children:`${x}, ${f}`}):null]}),I=u("inline-flex w-[72px] shrink-0 flex-col items-center gap-1.5 border-0 bg-transparent p-0",g&&"group/connector-node rounded-lg hover:cursor-pointer disabled:pointer-events-none focus:outline-0 focus-visible:ring-4 focus-visible:ring-state-focus",A),N={"data-slot":"connector-node","data-status":r,"aria-current":r==="current"?"step":void 0,className:I};if(g){const s=e,{status:b,label:v,className:h,icon:de,connector:ie,position:ue,card:me,onClick:S}=s,B=_(s,["status","label","className","icon","connector","position","card","onClick"]);return w(t("button",R(p(p({ref:o},B),N),{type:"button",onClick:S,children:k})))}const C=e,{status:re,label:oe,className:te,icon:ne,connector:ae,position:se,card:ce,onClick:le}=C,D=_(C,["status","label","className","icon","connector","position","card","onClick"]);return w(t("div",R(p(p({ref:o},D),N),{children:k})));function w(s){if(!c&&!a)return d?t("div",{"data-slot":"connector-node-anchor",className:u("w-fit",j[d]),children:s}):s;const b=c?c.split("-to-")[0]:d!=null?d:"center",v="flex w-[400px] min-w-0 max-w-full flex-col",h=l(O,{children:[t("div",{className:u("w-fit",j[b]),children:a?t(L,{asChild:!0,children:s}):s}),a?t(T,{role:"region","aria-labelledby":y,"data-slot":"connector-node-card",className:"w-full",children:l("div",{className:"relative pb-2 pt-2",children:[l("div",{className:"flex flex-col items-start gap-2 rounded-lg border border-gray-stroke-muted bg-surface-card p-5",children:[a.badge?t(H,{size:"lg",variant:r==="upcoming"?"primary-soft":"secondary-soft",className:"mb-1 uppercase",children:a.badge}):null,t("p",{id:y,className:"m-0 text-md font-bold leading-md text-primary-foreground",children:a.title}),t("div",{className:"text-sm leading-sm text-gray-foreground",children:a.description})]}),t("span",{"aria-hidden":"true","data-slot":"connector-node-card-arrow",className:u("absolute top-0.5 size-3 rotate-45 border-l border-t border-gray-stroke-muted bg-surface-card",W[b])})]})}):null,c?t(K,{position:c,done:r==="done"}):null]});return a?t(V,{animation:"accordion","data-slot":"connector-node-item",className:v,children:h}):t("div",{"data-slot":"connector-node-item",className:v,children:h})}});export{ee as ConnectorNode};
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  "use client";
3
- "use strict";var r=require("react/jsx-runtime"),f=require("radix-ui"),d=require("react"),C=require("./Dismiss.js"),D=require("./Separator.js"),c=require("../lib/utils.js"),z=Object.defineProperty,q=Object.defineProperties,M=Object.getOwnPropertyDescriptors,P=Object.getOwnPropertySymbols,N=Object.prototype.hasOwnProperty,j=Object.prototype.propertyIsEnumerable,y=(t,e,a)=>e in t?z(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a,m=(t,e)=>{for(var a in e||(e={}))N.call(e,a)&&y(t,a,e[a]);if(P)for(var a of P(e))j.call(e,a)&&y(t,a,e[a]);return t},w=(t,e)=>q(t,M(e)),p=(t,e)=>{var a={};for(var o in t)N.call(t,o)&&e.indexOf(o)<0&&(a[o]=t[o]);if(t!=null&&P)for(var o of P(t))e.indexOf(o)<0&&j.call(t,o)&&(a[o]=t[o]);return a};const R=40,k=.25,U=.5,Y=16,E="button, a, input, select, textarea, label, [role='button'], [contenteditable='true']",O=d.createContext(!1),I=d.createContext(()=>{});function F(t){var e=t,{open:a,defaultOpen:o=!1,onOpenChange:s}=e,n=p(e,["open","defaultOpen","onOpenChange"]);const l=a!==void 0,[i,u]=d.useState(o),h=l?a:i,g=d.useCallback(v=>{l||u(v),s==null||s(v)},[l,s]),x=d.useCallback(()=>g(!1),[g]);return r.jsx(I.Provider,{value:x,children:r.jsx(f.Dialog.Root,m({"data-slot":"dialog",open:h,onOpenChange:g},n))})}function b(t,e){return a=>{t==null||t(a),a.defaultPrevented||e(a)}}function L(t){const e=t.currentTarget,a=t.target,o=e.querySelector('[data-slot="dialog-handle"]');return t.button!==0||!(o!=null&&o.getClientRects().length)||a.closest('[data-slot="dialog-container"]')!==e||a.closest(E)?!1:t.clientY-e.getBoundingClientRect().top<=R||!!a.closest('[data-slot="dialog-header"]')}function $(t){const e=d.useRef(null),a=n=>{if(!L(n))return;const l=n.currentTarget;l.setPointerCapture(n.pointerId),l.dataset.dragging="",e.current={pointerId:n.pointerId,startY:n.clientY,startTime:n.timeStamp,offset:0}},o=n=>{const l=e.current;(l==null?void 0:l.pointerId)===n.pointerId&&(l.offset=Math.max(0,n.clientY-l.startY),n.currentTarget.style.transform=`translateY(${l.offset}px)`)},s=n=>{const l=e.current;if((l==null?void 0:l.pointerId)!==n.pointerId)return;const i=n.currentTarget;e.current=null,delete i.dataset.dragging,i.hasPointerCapture(n.pointerId)&&i.releasePointerCapture(n.pointerId);const u=l.offset/Math.max(n.timeStamp-l.startTime,1);if(!(n.type==="pointerup"&&(l.offset>i.offsetHeight*k||l.offset>Y&&u>U))){i.style.transform="";return}t(),requestAnimationFrame(()=>{i.dataset.state==="open"&&(i.style.transform="")})};return{onPointerDown:a,onPointerMove:o,onPointerUp:s,onPointerCancel:s}}const _=d.forwardRef(function(t,e){return r.jsx(f.Dialog.Trigger,m({ref:e,"data-slot":"dialog-trigger"},t))});function S(t){var e=p(t,[]);return r.jsx(f.Dialog.Portal,m({"data-slot":"dialog-portal"},e))}const A=d.forwardRef(function(t,e){return r.jsx(f.Dialog.Close,m({ref:e,"data-slot":"dialog-close"},t))});function T(t){var e=t,{className:a}=e,o=p(e,["className"]);return r.jsx(f.Dialog.Overlay,m({"data-slot":"dialog-overlay",className:c.cn("fixed inset-0 z-50 bg-backdrop data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 motion-reduce:!animate-none",a)},o))}function B(t){var e=t,{className:a,overlayClassName:o,children:s,showCloseButton:n=!0,closeLabel:l="Fechar",onPointerDown:i,onPointerMove:u,onPointerUp:h,onPointerCancel:g}=e,x=p(e,["className","overlayClassName","children","showCloseButton","closeLabel","onPointerDown","onPointerMove","onPointerUp","onPointerCancel"]);const v=$(d.useContext(I));return r.jsxs(S,{"data-slot":"dialog-portal",children:[r.jsx(T,{className:c.cn("modal-overlay",o)}),r.jsxs(f.Dialog.Content,w(m({"data-slot":"dialog-container",className:c.cn("modal-overlay fixed left-1/2 top-1/2 z-50 flex max-h-[85dvh] w-full max-w-[568px] -translate-x-1/2 -translate-y-1/2 flex-col gap-0 overflow-y-auto rounded-lg bg-surface-elevated p-0 shadow-level-5 duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-1/2 data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-1/2 motion-reduce:!animate-none md:max-h-[85vh]","max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:max-w-none max-md:translate-x-0 max-md:translate-y-0 max-md:rounded-b-none max-md:data-[state=closed]:zoom-out-100 max-md:data-[state=open]:zoom-in-100 max-md:data-[state=closed]:slide-out-to-bottom max-md:data-[state=closed]:slide-out-to-left-0 max-md:data-[state=open]:slide-in-from-bottom max-md:data-[state=open]:slide-in-from-left-0","data-[dragging]:transition-none max-md:ease-out max-md:motion-safe:transition-transform max-md:[&>[data-slot=dialog-handle]+[data-slot=dialog-header]]:pt-10 max-md:[&_[data-slot=dialog-header]]:touch-none",a)},x),{onPointerDown:b(i,v.onPointerDown),onPointerMove:b(u,v.onPointerMove),onPointerUp:b(h,v.onPointerUp),onPointerCancel:b(g,v.onPointerCancel),children:[r.jsx("div",{"aria-hidden":!0,"data-slot":"dialog-handle",className:"pointer-events-none absolute left-1/2 top-4 z-10 h-1 w-11 -translate-x-1/2 rounded-pill bg-gray-stroke md:hidden"}),r.jsx(O.Provider,{value:n,children:s}),n&&r.jsx(f.Dialog.Close,{"data-slot":"dialog-close",asChild:!0,children:r.jsx(C.Dismiss,{label:l,className:c.cn(C.DISMISS_PANEL_POSITION,"max-md:top-[34px]")})})]}))]})}function H(t){var e=t,{containerClassName:a,className:o}=e,s=p(e,["containerClassName","className"]);return r.jsx("div",{className:c.cn("mb-auto overflow-y-auto",a),children:r.jsx("div",m({"data-slot":"dialog-content",className:c.cn("px-8 py-6 text-md leading-md text-primary-foreground",o)},s))})}function V(t){var e=t,{className:a,separator:o=!1}=e,s=p(e,["className","separator"]);const n=d.useContext(O);return r.jsxs(r.Fragment,{children:[r.jsx("div",m({"data-slot":"dialog-header",className:c.cn("flex flex-col gap-2 px-8 py-6 text-left",n&&"pr-14",a)},s)),o&&r.jsx(D.Separator,{})]})}function W(t){var e=t,{className:a,separator:o=!1}=e,s=p(e,["className","separator"]);return r.jsxs(r.Fragment,{children:[o&&r.jsx(D.Separator,{}),r.jsx("div",m({"data-slot":"dialog-footer",className:c.cn("flex justify-end gap-2 px-8 py-6",a)},s))]})}function G(t){var e=t,{className:a,iconLeft:o,iconRight:s,children:n}=e,l=p(e,["className","iconLeft","iconRight","children"]);const i=u=>{var h,g;if(d.isValidElement(u)){const x=u;return d.cloneElement(x,{size:(h=x.props.size)!=null?h:32,strokeWidth:(g=x.props.strokeWidth)!=null?g:2.2,className:c.cn("flex-shrink-0",x.props.className)})}return u};return r.jsxs(f.Dialog.Title,w(m({"data-slot":"dialog-title",className:c.cn("flex items-center gap-3 text-title-md font-semibold leading-title-md !text-content-title",a)},l),{children:[o&&i(o),n,s&&i(s)]}))}function J(t){var e=t,{className:a}=e,o=p(e,["className"]);return r.jsx(f.Dialog.Description,m({"data-slot":"dialog-description",className:c.cn("text-md leading-md text-content-paragraph",a)},o))}exports.Dialog=F,exports.DialogClose=A,exports.DialogContainer=B,exports.DialogContent=H,exports.DialogDescription=J,exports.DialogFooter=W,exports.DialogHeader=V,exports.DialogOverlay=T,exports.DialogPortal=S,exports.DialogTitle=G,exports.DialogTrigger=_;
3
+ "use strict";var r=require("react/jsx-runtime"),p=require("radix-ui"),d=require("react"),I=require("./Dismiss.js"),P=require("./Separator.js"),m=require("../lib/utils.js"),q=Object.defineProperty,R=Object.defineProperties,S=Object.getOwnPropertyDescriptors,b=Object.getOwnPropertySymbols,j=Object.prototype.hasOwnProperty,y=Object.prototype.propertyIsEnumerable,D=(t,e,a)=>e in t?q(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a,c=(t,e)=>{for(var a in e||(e={}))j.call(e,a)&&D(t,a,e[a]);if(b)for(var a of b(e))y.call(e,a)&&D(t,a,e[a]);return t},N=(t,e)=>R(t,S(e)),f=(t,e)=>{var a={};for(var o in t)j.call(t,o)&&e.indexOf(o)<0&&(a[o]=t[o]);if(t!=null&&b)for(var o of b(t))e.indexOf(o)<0&&y.call(t,o)&&(a[o]=t[o]);return a};const k=40,M=.25,U=.5,Y=16,F="button, a, input, select, textarea, label, [role='button'], [contenteditable='true']",L="sticky top-[18px] z-10 order-first -mb-[46px] mr-[18px] mt-[18px] self-end max-md:top-[34px] max-md:-mb-[62px] max-md:mt-[34px]",w=d.createContext(!1),O=d.createContext(()=>{});function $(t){var e=t,{open:a,defaultOpen:o=!1,onOpenChange:l}=e,n=f(e,["open","defaultOpen","onOpenChange"]);const s=a!==void 0,[i,u]=d.useState(o),h=s?a:i,x=d.useCallback(v=>{s||u(v),l==null||l(v)},[s,l]),g=d.useCallback(()=>x(!1),[x]);return r.jsx(O.Provider,{value:g,children:r.jsx(p.Dialog.Root,c({"data-slot":"dialog",open:h,onOpenChange:x},n))})}function C(t,e){return a=>{t==null||t(a),a.defaultPrevented||e(a)}}function B(t){const e=t.currentTarget,a=t.target,o=e.querySelector('[data-slot="dialog-handle"]');return t.button!==0||!(o!=null&&o.getClientRects().length)||a.closest('[data-slot="dialog-container"]')!==e||a.closest(F)?!1:t.clientY-e.getBoundingClientRect().top<=k||!!a.closest('[data-slot="dialog-header"]')}function E(t){const e=d.useRef(null),a=n=>{if(!B(n))return;const s=n.currentTarget;s.setPointerCapture(n.pointerId),s.dataset.dragging="",e.current={pointerId:n.pointerId,startY:n.clientY,startTime:n.timeStamp,offset:0}},o=n=>{const s=e.current;(s==null?void 0:s.pointerId)===n.pointerId&&(s.offset=Math.max(0,n.clientY-s.startY),n.currentTarget.style.transform=`translateY(${s.offset}px)`)},l=n=>{const s=e.current;if((s==null?void 0:s.pointerId)!==n.pointerId)return;const i=n.currentTarget;e.current=null,delete i.dataset.dragging,i.hasPointerCapture(n.pointerId)&&i.releasePointerCapture(n.pointerId);const u=s.offset/Math.max(n.timeStamp-s.startTime,1);if(!(n.type==="pointerup"&&(s.offset>i.offsetHeight*M||s.offset>Y&&u>U))){i.style.transform="";return}t(),requestAnimationFrame(()=>{i.dataset.state==="open"&&(i.style.transform="")})};return{onPointerDown:a,onPointerMove:o,onPointerUp:l,onPointerCancel:l}}const H=d.forwardRef(function(t,e){return r.jsx(p.Dialog.Trigger,c({ref:e,"data-slot":"dialog-trigger"},t))});function z(t){var e=f(t,[]);return r.jsx(p.Dialog.Portal,c({"data-slot":"dialog-portal"},e))}const V=d.forwardRef(function(t,e){return r.jsx(p.Dialog.Close,c({ref:e,"data-slot":"dialog-close"},t))});function T(t){var e=t,{className:a}=e,o=f(e,["className"]);return r.jsx(p.Dialog.Overlay,c({"data-slot":"dialog-overlay",className:m.cn("fixed inset-0 z-50 bg-backdrop data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 motion-reduce:!animate-none",a)},o))}function W(t){var e=t,{className:a,overlayClassName:o,children:l,showCloseButton:n=!0,closeLabel:s="Fechar",onPointerDown:i,onPointerMove:u,onPointerUp:h,onPointerCancel:x}=e,g=f(e,["className","overlayClassName","children","showCloseButton","closeLabel","onPointerDown","onPointerMove","onPointerUp","onPointerCancel"]);const v=E(d.useContext(O));return r.jsxs(z,{"data-slot":"dialog-portal",children:[r.jsx(T,{className:m.cn("modal-overlay",o)}),r.jsxs(p.Dialog.Content,N(c({"data-slot":"dialog-container",className:m.cn("modal-overlay fixed left-1/2 top-1/2 z-50 flex max-h-[85dvh] w-full max-w-[568px] -translate-x-1/2 -translate-y-1/2 flex-col gap-0 overflow-y-auto rounded-lg bg-surface-elevated p-0 shadow-level-5 duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-1/2 data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-1/2 motion-reduce:!animate-none md:max-h-[85vh]","max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:max-w-none max-md:translate-x-0 max-md:translate-y-0 max-md:rounded-b-none max-md:data-[state=closed]:zoom-out-100 max-md:data-[state=open]:zoom-in-100 max-md:data-[state=closed]:slide-out-to-bottom max-md:data-[state=closed]:slide-out-to-left-0 max-md:data-[state=open]:slide-in-from-bottom max-md:data-[state=open]:slide-in-from-left-0","data-[dragging]:transition-none max-md:ease-out max-md:motion-safe:transition-transform max-md:[&>[data-slot=dialog-handle]+[data-slot=dialog-header]]:pt-10 max-md:[&_[data-slot=dialog-header]]:touch-none",a)},g),{onPointerDown:C(i,v.onPointerDown),onPointerMove:C(u,v.onPointerMove),onPointerUp:C(h,v.onPointerUp),onPointerCancel:C(x,v.onPointerCancel),children:[r.jsx("div",{"aria-hidden":!0,"data-slot":"dialog-handle",className:"pointer-events-none absolute left-1/2 top-4 z-10 h-1 w-11 -translate-x-1/2 rounded-pill bg-gray-stroke md:hidden"}),r.jsx(w.Provider,{value:n,children:l}),n&&r.jsx(p.Dialog.Close,{"data-slot":"dialog-close",asChild:!0,children:r.jsx(I.Dismiss,{label:s,className:L})})]}))]})}function _(t){var e=t,{containerClassName:a,className:o}=e,l=f(e,["containerClassName","className"]);return r.jsx("div",{className:m.cn("mb-auto overflow-y-auto",a),children:r.jsx("div",c({"data-slot":"dialog-content",className:m.cn("px-8 py-6 text-md leading-md text-primary-foreground",o)},l))})}function A(t){var e=t,{className:a,separator:o=!1}=e,l=f(e,["className","separator"]);const n=d.useContext(w);return r.jsxs(r.Fragment,{children:[r.jsx("div",c({"data-slot":"dialog-header",className:m.cn("flex flex-col gap-2 px-8 py-6 text-left",n&&"pr-14",a)},l)),o&&r.jsx(P.Separator,{})]})}function G(t){var e=t,{className:a,separator:o=!1}=e,l=f(e,["className","separator"]);return r.jsxs(r.Fragment,{children:[o&&r.jsx(P.Separator,{}),r.jsx("div",c({"data-slot":"dialog-footer",className:m.cn("flex justify-end gap-2 px-8 py-6",a)},l))]})}function J(t){var e=t,{className:a,iconLeft:o,iconRight:l,children:n}=e,s=f(e,["className","iconLeft","iconRight","children"]);const i=u=>{var h,x;if(d.isValidElement(u)){const g=u;return d.cloneElement(g,{size:(h=g.props.size)!=null?h:32,strokeWidth:(x=g.props.strokeWidth)!=null?x:2.2,className:m.cn("flex-shrink-0",g.props.className)})}return u};return r.jsxs(p.Dialog.Title,N(c({"data-slot":"dialog-title",className:m.cn("flex items-center gap-3 text-title-md font-semibold leading-title-md !text-content-title",a)},s),{children:[o&&i(o),n,l&&i(l)]}))}function K(t){var e=t,{className:a}=e,o=f(e,["className"]);return r.jsx(p.Dialog.Description,c({"data-slot":"dialog-description",className:m.cn("text-md leading-md text-content-paragraph",a)},o))}exports.Dialog=$,exports.DialogClose=V,exports.DialogContainer=W,exports.DialogContent=_,exports.DialogDescription=K,exports.DialogFooter=G,exports.DialogHeader=A,exports.DialogOverlay=T,exports.DialogPortal=z,exports.DialogTitle=J,exports.DialogTrigger=H;
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  "use client";
3
- import{jsx as l,jsxs as h,Fragment as b}from"react/jsx-runtime";import{Dialog as u}from"radix-ui";import{createContext as y,forwardRef as C,useState as U,useCallback as D,useContext as w,useRef as Y,isValidElement as E,cloneElement as L}from"react";import{Dismiss as F,DISMISS_PANEL_POSITION as _}from"./Dismiss.mjs";import{Separator as O}from"./Separator.mjs";import{cn as d}from"../lib/utils.mjs";var q=Object.defineProperty,A=Object.defineProperties,B=Object.getOwnPropertyDescriptors,P=Object.getOwnPropertySymbols,I=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable,j=(t,e,a)=>e in t?q(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a,c=(t,e)=>{for(var a in e||(e={}))I.call(e,a)&&j(t,a,e[a]);if(P)for(var a of P(e))T.call(e,a)&&j(t,a,e[a]);return t},z=(t,e)=>A(t,B(e)),f=(t,e)=>{var a={};for(var o in t)I.call(t,o)&&e.indexOf(o)<0&&(a[o]=t[o]);if(t!=null&&P)for(var o of P(t))e.indexOf(o)<0&&T.call(t,o)&&(a[o]=t[o]);return a};const H=40,$=.25,V=.5,W=16,G="button, a, input, select, textarea, label, [role='button'], [contenteditable='true']",S=y(!1),M=y(()=>{});function J(t){var e=t,{open:a,defaultOpen:o=!1,onOpenChange:s}=e,n=f(e,["open","defaultOpen","onOpenChange"]);const r=a!==void 0,[i,m]=U(o),v=r?a:i,p=D(x=>{r||m(x),s==null||s(x)},[r,s]),g=D(()=>p(!1),[p]);return l(M.Provider,{value:g,children:l(u.Root,c({"data-slot":"dialog",open:v,onOpenChange:p},n))})}function N(t,e){return a=>{t==null||t(a),a.defaultPrevented||e(a)}}function K(t){const e=t.currentTarget,a=t.target,o=e.querySelector('[data-slot="dialog-handle"]');return t.button!==0||!(o!=null&&o.getClientRects().length)||a.closest('[data-slot="dialog-container"]')!==e||a.closest(G)?!1:t.clientY-e.getBoundingClientRect().top<=H||!!a.closest('[data-slot="dialog-header"]')}function Q(t){const e=Y(null),a=n=>{if(!K(n))return;const r=n.currentTarget;r.setPointerCapture(n.pointerId),r.dataset.dragging="",e.current={pointerId:n.pointerId,startY:n.clientY,startTime:n.timeStamp,offset:0}},o=n=>{const r=e.current;(r==null?void 0:r.pointerId)===n.pointerId&&(r.offset=Math.max(0,n.clientY-r.startY),n.currentTarget.style.transform=`translateY(${r.offset}px)`)},s=n=>{const r=e.current;if((r==null?void 0:r.pointerId)!==n.pointerId)return;const i=n.currentTarget;e.current=null,delete i.dataset.dragging,i.hasPointerCapture(n.pointerId)&&i.releasePointerCapture(n.pointerId);const m=r.offset/Math.max(n.timeStamp-r.startTime,1);if(!(n.type==="pointerup"&&(r.offset>i.offsetHeight*$||r.offset>W&&m>V))){i.style.transform="";return}t(),requestAnimationFrame(()=>{i.dataset.state==="open"&&(i.style.transform="")})};return{onPointerDown:a,onPointerMove:o,onPointerUp:s,onPointerCancel:s}}const X=C(function(t,e){return l(u.Trigger,c({ref:e,"data-slot":"dialog-trigger"},t))});function R(t){var e=f(t,[]);return l(u.Portal,c({"data-slot":"dialog-portal"},e))}const Z=C(function(t,e){return l(u.Close,c({ref:e,"data-slot":"dialog-close"},t))});function k(t){var e=t,{className:a}=e,o=f(e,["className"]);return l(u.Overlay,c({"data-slot":"dialog-overlay",className:d("fixed inset-0 z-50 bg-backdrop data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 motion-reduce:!animate-none",a)},o))}function ee(t){var e=t,{className:a,overlayClassName:o,children:s,showCloseButton:n=!0,closeLabel:r="Fechar",onPointerDown:i,onPointerMove:m,onPointerUp:v,onPointerCancel:p}=e,g=f(e,["className","overlayClassName","children","showCloseButton","closeLabel","onPointerDown","onPointerMove","onPointerUp","onPointerCancel"]);const x=Q(w(M));return h(R,{"data-slot":"dialog-portal",children:[l(k,{className:d("modal-overlay",o)}),h(u.Content,z(c({"data-slot":"dialog-container",className:d("modal-overlay fixed left-1/2 top-1/2 z-50 flex max-h-[85dvh] w-full max-w-[568px] -translate-x-1/2 -translate-y-1/2 flex-col gap-0 overflow-y-auto rounded-lg bg-surface-elevated p-0 shadow-level-5 duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-1/2 data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-1/2 motion-reduce:!animate-none md:max-h-[85vh]","max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:max-w-none max-md:translate-x-0 max-md:translate-y-0 max-md:rounded-b-none max-md:data-[state=closed]:zoom-out-100 max-md:data-[state=open]:zoom-in-100 max-md:data-[state=closed]:slide-out-to-bottom max-md:data-[state=closed]:slide-out-to-left-0 max-md:data-[state=open]:slide-in-from-bottom max-md:data-[state=open]:slide-in-from-left-0","data-[dragging]:transition-none max-md:ease-out max-md:motion-safe:transition-transform max-md:[&>[data-slot=dialog-handle]+[data-slot=dialog-header]]:pt-10 max-md:[&_[data-slot=dialog-header]]:touch-none",a)},g),{onPointerDown:N(i,x.onPointerDown),onPointerMove:N(m,x.onPointerMove),onPointerUp:N(v,x.onPointerUp),onPointerCancel:N(p,x.onPointerCancel),children:[l("div",{"aria-hidden":!0,"data-slot":"dialog-handle",className:"pointer-events-none absolute left-1/2 top-4 z-10 h-1 w-11 -translate-x-1/2 rounded-pill bg-gray-stroke md:hidden"}),l(S.Provider,{value:n,children:s}),n&&l(u.Close,{"data-slot":"dialog-close",asChild:!0,children:l(F,{label:r,className:d(_,"max-md:top-[34px]")})})]}))]})}function te(t){var e=t,{containerClassName:a,className:o}=e,s=f(e,["containerClassName","className"]);return l("div",{className:d("mb-auto overflow-y-auto",a),children:l("div",c({"data-slot":"dialog-content",className:d("px-8 py-6 text-md leading-md text-primary-foreground",o)},s))})}function ae(t){var e=t,{className:a,separator:o=!1}=e,s=f(e,["className","separator"]);const n=w(S);return h(b,{children:[l("div",c({"data-slot":"dialog-header",className:d("flex flex-col gap-2 px-8 py-6 text-left",n&&"pr-14",a)},s)),o&&l(O,{})]})}function oe(t){var e=t,{className:a,separator:o=!1}=e,s=f(e,["className","separator"]);return h(b,{children:[o&&l(O,{}),l("div",c({"data-slot":"dialog-footer",className:d("flex justify-end gap-2 px-8 py-6",a)},s))]})}function ne(t){var e=t,{className:a,iconLeft:o,iconRight:s,children:n}=e,r=f(e,["className","iconLeft","iconRight","children"]);const i=m=>{var v,p;if(E(m)){const g=m;return L(g,{size:(v=g.props.size)!=null?v:32,strokeWidth:(p=g.props.strokeWidth)!=null?p:2.2,className:d("flex-shrink-0",g.props.className)})}return m};return h(u.Title,z(c({"data-slot":"dialog-title",className:d("flex items-center gap-3 text-title-md font-semibold leading-title-md !text-content-title",a)},r),{children:[o&&i(o),n,s&&i(s)]}))}function re(t){var e=t,{className:a}=e,o=f(e,["className"]);return l(u.Description,c({"data-slot":"dialog-description",className:d("text-md leading-md text-content-paragraph",a)},o))}export{J as Dialog,Z as DialogClose,ee as DialogContainer,te as DialogContent,re as DialogDescription,oe as DialogFooter,ae as DialogHeader,k as DialogOverlay,R as DialogPortal,ne as DialogTitle,X as DialogTrigger};
3
+ import{jsx as l,jsxs as h,Fragment as y}from"react/jsx-runtime";import{Dialog as u}from"radix-ui";import{createContext as N,forwardRef as C,useState as U,useCallback as D,useContext as w,useRef as Y,isValidElement as L,cloneElement as B}from"react";import{Dismiss as E}from"./Dismiss.mjs";import{Separator as O}from"./Separator.mjs";import{cn as c}from"../lib/utils.mjs";var F=Object.defineProperty,q=Object.defineProperties,H=Object.getOwnPropertyDescriptors,b=Object.getOwnPropertySymbols,z=Object.prototype.hasOwnProperty,I=Object.prototype.propertyIsEnumerable,T=(e,t,a)=>t in e?F(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,d=(e,t)=>{for(var a in t||(t={}))z.call(t,a)&&T(e,a,t[a]);if(b)for(var a of b(t))I.call(t,a)&&T(e,a,t[a]);return e},j=(e,t)=>q(e,H(t)),p=(e,t)=>{var a={};for(var o in e)z.call(e,o)&&t.indexOf(o)<0&&(a[o]=e[o]);if(e!=null&&b)for(var o of b(e))t.indexOf(o)<0&&I.call(e,o)&&(a[o]=e[o]);return a};const V=40,W=.25,_=.5,$=16,A="button, a, input, select, textarea, label, [role='button'], [contenteditable='true']",G="sticky top-[18px] z-10 order-first -mb-[46px] mr-[18px] mt-[18px] self-end max-md:top-[34px] max-md:-mb-[62px] max-md:mt-[34px]",M=N(!1),k=N(()=>{});function J(e){var t=e,{open:a,defaultOpen:o=!1,onOpenChange:s}=t,n=p(t,["open","defaultOpen","onOpenChange"]);const r=a!==void 0,[i,m]=U(o),v=r?a:i,f=D(x=>{r||m(x),s==null||s(x)},[r,s]),g=D(()=>f(!1),[f]);return l(k.Provider,{value:g,children:l(u.Root,d({"data-slot":"dialog",open:v,onOpenChange:f},n))})}function P(e,t){return a=>{e==null||e(a),a.defaultPrevented||t(a)}}function K(e){const t=e.currentTarget,a=e.target,o=t.querySelector('[data-slot="dialog-handle"]');return e.button!==0||!(o!=null&&o.getClientRects().length)||a.closest('[data-slot="dialog-container"]')!==t||a.closest(A)?!1:e.clientY-t.getBoundingClientRect().top<=V||!!a.closest('[data-slot="dialog-header"]')}function Q(e){const t=Y(null),a=n=>{if(!K(n))return;const r=n.currentTarget;r.setPointerCapture(n.pointerId),r.dataset.dragging="",t.current={pointerId:n.pointerId,startY:n.clientY,startTime:n.timeStamp,offset:0}},o=n=>{const r=t.current;(r==null?void 0:r.pointerId)===n.pointerId&&(r.offset=Math.max(0,n.clientY-r.startY),n.currentTarget.style.transform=`translateY(${r.offset}px)`)},s=n=>{const r=t.current;if((r==null?void 0:r.pointerId)!==n.pointerId)return;const i=n.currentTarget;t.current=null,delete i.dataset.dragging,i.hasPointerCapture(n.pointerId)&&i.releasePointerCapture(n.pointerId);const m=r.offset/Math.max(n.timeStamp-r.startTime,1);if(!(n.type==="pointerup"&&(r.offset>i.offsetHeight*W||r.offset>$&&m>_))){i.style.transform="";return}e(),requestAnimationFrame(()=>{i.dataset.state==="open"&&(i.style.transform="")})};return{onPointerDown:a,onPointerMove:o,onPointerUp:s,onPointerCancel:s}}const X=C(function(e,t){return l(u.Trigger,d({ref:t,"data-slot":"dialog-trigger"},e))});function R(e){var t=p(e,[]);return l(u.Portal,d({"data-slot":"dialog-portal"},t))}const Z=C(function(e,t){return l(u.Close,d({ref:t,"data-slot":"dialog-close"},e))});function S(e){var t=e,{className:a}=t,o=p(t,["className"]);return l(u.Overlay,d({"data-slot":"dialog-overlay",className:c("fixed inset-0 z-50 bg-backdrop data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 motion-reduce:!animate-none",a)},o))}function tt(e){var t=e,{className:a,overlayClassName:o,children:s,showCloseButton:n=!0,closeLabel:r="Fechar",onPointerDown:i,onPointerMove:m,onPointerUp:v,onPointerCancel:f}=t,g=p(t,["className","overlayClassName","children","showCloseButton","closeLabel","onPointerDown","onPointerMove","onPointerUp","onPointerCancel"]);const x=Q(w(k));return h(R,{"data-slot":"dialog-portal",children:[l(S,{className:c("modal-overlay",o)}),h(u.Content,j(d({"data-slot":"dialog-container",className:c("modal-overlay fixed left-1/2 top-1/2 z-50 flex max-h-[85dvh] w-full max-w-[568px] -translate-x-1/2 -translate-y-1/2 flex-col gap-0 overflow-y-auto rounded-lg bg-surface-elevated p-0 shadow-level-5 duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-1/2 data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-1/2 motion-reduce:!animate-none md:max-h-[85vh]","max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:max-w-none max-md:translate-x-0 max-md:translate-y-0 max-md:rounded-b-none max-md:data-[state=closed]:zoom-out-100 max-md:data-[state=open]:zoom-in-100 max-md:data-[state=closed]:slide-out-to-bottom max-md:data-[state=closed]:slide-out-to-left-0 max-md:data-[state=open]:slide-in-from-bottom max-md:data-[state=open]:slide-in-from-left-0","data-[dragging]:transition-none max-md:ease-out max-md:motion-safe:transition-transform max-md:[&>[data-slot=dialog-handle]+[data-slot=dialog-header]]:pt-10 max-md:[&_[data-slot=dialog-header]]:touch-none",a)},g),{onPointerDown:P(i,x.onPointerDown),onPointerMove:P(m,x.onPointerMove),onPointerUp:P(v,x.onPointerUp),onPointerCancel:P(f,x.onPointerCancel),children:[l("div",{"aria-hidden":!0,"data-slot":"dialog-handle",className:"pointer-events-none absolute left-1/2 top-4 z-10 h-1 w-11 -translate-x-1/2 rounded-pill bg-gray-stroke md:hidden"}),l(M.Provider,{value:n,children:s}),n&&l(u.Close,{"data-slot":"dialog-close",asChild:!0,children:l(E,{label:r,className:G})})]}))]})}function et(e){var t=e,{containerClassName:a,className:o}=t,s=p(t,["containerClassName","className"]);return l("div",{className:c("mb-auto overflow-y-auto",a),children:l("div",d({"data-slot":"dialog-content",className:c("px-8 py-6 text-md leading-md text-primary-foreground",o)},s))})}function at(e){var t=e,{className:a,separator:o=!1}=t,s=p(t,["className","separator"]);const n=w(M);return h(y,{children:[l("div",d({"data-slot":"dialog-header",className:c("flex flex-col gap-2 px-8 py-6 text-left",n&&"pr-14",a)},s)),o&&l(O,{})]})}function ot(e){var t=e,{className:a,separator:o=!1}=t,s=p(t,["className","separator"]);return h(y,{children:[o&&l(O,{}),l("div",d({"data-slot":"dialog-footer",className:c("flex justify-end gap-2 px-8 py-6",a)},s))]})}function nt(e){var t=e,{className:a,iconLeft:o,iconRight:s,children:n}=t,r=p(t,["className","iconLeft","iconRight","children"]);const i=m=>{var v,f;if(L(m)){const g=m;return B(g,{size:(v=g.props.size)!=null?v:32,strokeWidth:(f=g.props.strokeWidth)!=null?f:2.2,className:c("flex-shrink-0",g.props.className)})}return m};return h(u.Title,j(d({"data-slot":"dialog-title",className:c("flex items-center gap-3 text-title-md font-semibold leading-title-md !text-content-title",a)},r),{children:[o&&i(o),n,s&&i(s)]}))}function rt(e){var t=e,{className:a}=t,o=p(t,["className"]);return l(u.Description,d({"data-slot":"dialog-description",className:c("text-md leading-md text-content-paragraph",a)},o))}export{J as Dialog,Z as DialogClose,tt as DialogContainer,et as DialogContent,rt as DialogDescription,ot as DialogFooter,at as DialogHeader,S as DialogOverlay,R as DialogPortal,nt as DialogTitle,X as DialogTrigger};
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  "use client";
3
- "use strict";var r=require("react/jsx-runtime"),j=require("@medway-ui/icons"),ce=require("class-variance-authority"),i=require("radix-ui"),c=require("react"),E=require("./Button.js"),pe=require("./Separator.js"),R=require("./Tooltip.js"),A=require("../lib/utils.js"),me=Object.defineProperty,he=Object.defineProperties,be=Object.getOwnPropertyDescriptors,W=Object.getOwnPropertySymbols,xe=Object.prototype.hasOwnProperty,fe=Object.prototype.propertyIsEnumerable,J=(e,n,a)=>n in e?me(e,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[n]=a,C=(e,n)=>{for(var a in n||(n={}))xe.call(n,a)&&J(e,a,n[a]);if(W)for(var a of W(n))fe.call(n,a)&&J(e,a,n[a]);return e},X=(e,n)=>he(e,be(n));const S=Object.freeze(["cm","go","cir","ped","prev"]),ge={cm:"Azul",go:"Rosa",cir:"Verde",ped:"Amarelo",prev:"Roxo"},ve={toolbar:"Marca\xE7\xE3o da sele\xE7\xE3o",color:"Cor",strikethrough:"Riscar",strikethroughHint:"Riscar: passa um tra\xE7o sobre o trecho para destacar o que n\xE3o importa",underline:"Sublinhar",underlineHint:"Sublinhar: passa um tra\xE7o sob o trecho para destacar o que importa",annotate:"Anotar",annotateHint:"Anotar: abre a nota com o trecho selecionado",pin:"Fixar",pinHint:"Fixar: escolha uma cor ou uma a\xE7\xE3o e as pr\xF3ximas sele\xE7\xF5es j\xE1 saem com ela",pinArmedHint:"Escolha a cor ou a a\xE7\xE3o que vai ficar fixada",unpinHint:"Desafixar: as pr\xF3ximas sele\xE7\xF5es voltam a abrir esta ferramenta",remove:"Remover marca\xE7\xE3o",removeHint:"Remover a marca\xE7\xE3o deste trecho",colorName:e=>ge[e]},ke={pinHint:"Fixar: escolha uma cor e as pr\xF3ximas sele\xE7\xF5es j\xE1 saem marcadas com ela",pinArmedHint:"Escolha a cor que vai ficar fixada"},je={cm:"bg-cm-background-fill",go:"bg-go-background-fill",cir:"bg-cir-background-fill",ped:"bg-ped-background-fill",prev:"bg-prev-background-fill"},Ee={cm:"bg-cm-16 dark:bg-cm-48",go:"bg-go-16 dark:bg-go-48",cir:"bg-cir-16 dark:bg-cir-24",ped:"bg-ped-24 dark:bg-ped-48",prev:"bg-prev-16 dark:bg-prev-48"},Ce=ce.cva("rounded-[2px] [-webkit-box-decoration-clone:clone] [box-decoration-clone:clone]",{variants:{color:X(C({},Ee),{none:"bg-transparent"}),strikethrough:{true:"text-gray-foreground-muted line-through",false:"text-inherit"},underline:{true:"underline underline-offset-2",false:""}},defaultVariants:{color:"none",strikethrough:!1,underline:!1}}),ye={cm:"aria-pressed:border-cm-background-fill",go:"aria-pressed:border-go-background-fill",cir:"aria-pressed:border-cir-background-fill",ped:"aria-pressed:border-ped-background-fill",prev:"aria-pressed:border-prev-background-fill"},we="inline-flex max-w-[calc(100vw-32px)] items-center rounded-pill border border-gray-stroke-muted bg-surface-elevated text-gray-foreground shadow-level-1",Re="flex min-w-0 items-center gap-2 overflow-x-auto overscroll-x-contain rounded-pill py-2 pl-3 pr-2 [&>*]:shrink-0",G="aria-pressed:bg-primary-background-soft-emphasis aria-pressed:text-primary-foreground-emphasis",Te="aria-pressed:bg-primary-background-fill aria-pressed:text-primary-foreground-onfill aria-pressed:hover:bg-primary-background-fill-emphasis aria-pressed:hover:text-primary-foreground-onfill";function g({label:e,children:n}){return r.jsxs(R.Tooltip,{children:[r.jsx(R.TooltipTrigger,{asChild:!0,children:n}),r.jsx(R.TooltipContent,{side:"bottom",className:"max-w-64",children:e})]})}function Ne({color:e,pressed:n,name:a,hint:l,disabled:p,onSelect:h}){return r.jsx(g,{label:l?`${a}. ${l}`:a,children:r.jsx(i.Toolbar.Button,{"data-slot":"text-marker-swatch","data-color":e,"aria-label":a,"aria-pressed":n,disabled:p,onClick:()=>h(e),className:A.cn("inline-flex size-8 shrink-0 items-center justify-center rounded-circular border border-transparent p-1 outline-none hover:cursor-pointer focus-visible:ring-[3px] focus-visible:ring-state-focus disabled:pointer-events-none disabled:opacity-50",ye[e]),children:r.jsx("span",{"aria-hidden":"true",className:A.cn("size-6 shrink-0 rounded-circular",je[e])})})})}function Q(){return r.jsx(pe.Separator,{orientation:"vertical",decorative:!0,className:"h-7 self-center"})}function Oe(e){var n;if("getBoundingClientRect"in e){const b="commonAncestorContainer"in e?e.commonAncestorContainer:e,y=b.nodeType===Node.ELEMENT_NODE?b:(n=b.parentElement)!=null?n:void 0;return{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:y}}const{top:a,left:l,width:p,height:h}=e,v={x:l,y:a,top:a,left:l,width:p,height:h,right:l+p,bottom:a+h};return{getBoundingClientRect:()=>X(C({},v),{toJSON:()=>v})}}function Be(){const e=c.useRef(!1);return c.useEffect(()=>{const n=()=>{e.current=!1},a=()=>{e.current=!0};return document.addEventListener("pointerdown",n,!0),document.addEventListener("keydown",a,!0),()=>{document.removeEventListener("pointerdown",n,!0),document.removeEventListener("keydown",a,!0)}},[]),e}function Y(e,n){return!e||!n||"getBoundingClientRect"in e||"getBoundingClientRect"in n?!1:e.top===n.top&&e.left===n.left&&e.bottom===n.bottom&&e.width===n.width&&e.height===n.height}function He(e){const[n,a]=c.useState(e);return e!==n&&!Y(e,n)&&a(e),Y(e,n)?n:e}function P(e){return S.includes(e)}function ze({open:e=!1,anchor:n=null,mode:a="create",selectedText:l,color:p,colors:h=S,strikethrough:v=!1,underline:b=!1,pinned:y,pinnedColor:q,disabled:x=!1,className:Z,labels:$,onHighlight:F,onStrikethrough:L,onUnderline:D,onPinnedChange:T,onPinnedColorChange:M,onNote:_,onRemove:s,onClose:d}){const V=!!T,o=C(C(C({},ve),V?null:ke),$),ee=Be(),N=He(n),k=c.useMemo(()=>N?{current:Oe(N)}:null,[N]),O=c.useRef(null),B=c.useRef(!1),[I,H]=c.useState(null),[re,ne]=c.useState(e);e!==re&&(ne(e),e||H(null));const u=y!==void 0?y:q!=null?q:null,f=e&&I!==null&&I===k,te=!!u||f,ae=u?o.unpinHint:f?o.pinArmedHint:o.pinHint,U=t=>{T==null||T(t),(t===null||P(t))&&(M==null||M(t))},K=t=>V||P(t),z=(t,m,ue)=>f&&K(t)?`${m}. ${o.pinArmedHint}`:ue,w=t=>!f||!K(t)?!1:(H(null),U(t),!0),oe=t=>{const m=w(t);if(t===p){m?d==null||d():s==null||s();return}F==null||F(t)},ie=()=>{const t=w("strikethrough");if(v){t?d==null||d():s==null||s();return}L==null||L()},le=()=>{const t=w("underline");if(b){t?d==null||d():s==null||s();return}D==null||D()},se=()=>{w("note"),_==null||_(l!=null?l:"")},de=()=>{if(u){U(null);return}H(f?null:k)};return r.jsxs(i.Popover.Root,{open:e&&!!k,onOpenChange:t=>{t||d==null||d()},children:[k?r.jsx(i.Popover.Anchor,{virtualRef:k}):null,r.jsx(i.Popover.Portal,{children:r.jsx(i.Popover.Content,{asChild:!0,role:"toolbar",side:"top",sideOffset:4,collisionPadding:16,sticky:"always",hideWhenDetached:!0,onOpenAutoFocus:t=>{O.current=document.activeElement instanceof HTMLElement?document.activeElement:null,B.current=!1,ee.current||t.preventDefault()},onInteractOutside:()=>{B.current=!0},onCloseAutoFocus:t=>{t.preventDefault();const m=O.current;O.current=null,!B.current&&m!=null&&m.isConnected&&m.focus({preventScroll:!0})},children:r.jsxs(i.Toolbar.Root,{"aria-label":o.toolbar,"data-slot":"text-marker","data-mode":a,"data-text-marker-chrome":"",className:A.cn("z-50",we,Z),children:[r.jsx(R.TooltipProvider,{delayDuration:200,children:r.jsxs("div",{className:Re,children:[r.jsx("div",{role:"group","aria-label":o.color,className:"flex items-center gap-2",children:h.map(t=>r.jsx(Ne,{color:t,name:o.colorName(t),hint:f?o.pinArmedHint:void 0,pressed:p===t,disabled:x,onSelect:oe},t))}),r.jsx(Q,{}),r.jsx(g,{label:z("strikethrough",o.strikethrough,o.strikethroughHint),children:r.jsx(i.Toolbar.Button,{asChild:!0,children:r.jsx(E.Button,{variant:"regular-basic",size:"sm","aria-label":o.strikethrough,"aria-pressed":v,disabled:x,className:G,iconLeft:r.jsx(j.Strikethrough,{size:16,"aria-hidden":"true"}),onClick:ie})})}),r.jsx(g,{label:z("underline",o.underline,o.underlineHint),children:r.jsx(i.Toolbar.Button,{asChild:!0,children:r.jsx(E.Button,{variant:"regular-basic",size:"sm","aria-label":o.underline,"aria-pressed":b,disabled:x,className:G,iconLeft:r.jsx(j.Underline,{size:16,"aria-hidden":"true"}),onClick:le})})}),r.jsx(g,{label:z("note",o.annotate,o.annotateHint),children:r.jsx(i.Toolbar.Button,{asChild:!0,children:r.jsx(E.Button,{variant:"regular-basic",size:"sm","aria-label":o.annotate,disabled:x,iconLeft:r.jsx(j.Note,{size:16,"aria-hidden":"true"}),onClick:se})})}),r.jsx(Q,{}),r.jsx(g,{label:ae,children:r.jsx(i.Toolbar.Button,{asChild:!0,children:r.jsx(E.Button,{variant:"regular-basic",size:"sm","aria-label":o.pin,"aria-pressed":te,"data-pinned":u!=null?u:void 0,"data-pinned-color":u&&P(u)?u:void 0,disabled:x,className:Te,iconLeft:r.jsx(j.Pin,{size:16,"aria-hidden":"true"}),onClick:de})})}),a==="edit"?r.jsx(g,{label:o.removeHint,children:r.jsx(i.Toolbar.Button,{asChild:!0,children:r.jsx(E.Button,{variant:"error-soft",size:"sm","aria-label":o.remove,disabled:x,iconLeft:r.jsx(j.CloseSm,{size:16,"aria-hidden":"true"}),onClick:()=>s==null?void 0:s()})})}):null]})}),r.jsx(i.Popover.Arrow,{width:16,height:10,className:"-my-px fill-surface-elevated drop-shadow-[0_1px_0_var(--color-gray-stroke-muted)]"})]})})})]})}exports.TEXT_MARKER_COLORS=S,exports.TextMarker=ze,exports.textMarkerMarkVariants=Ce;
3
+ "use strict";var r=require("react/jsx-runtime"),j=require("@medway-ui/icons"),de=require("class-variance-authority"),i=require("radix-ui"),d=require("react"),E=require("./Button.js"),pe=require("./Separator.js"),R=require("./Tooltip.js"),S=require("../lib/utils.js"),me=Object.defineProperty,he=Object.defineProperties,fe=Object.getOwnPropertyDescriptors,J=Object.getOwnPropertySymbols,be=Object.prototype.hasOwnProperty,xe=Object.prototype.propertyIsEnumerable,K=(e,n,o)=>n in e?me(e,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[n]=o,C=(e,n)=>{for(var o in n||(n={}))be.call(n,o)&&K(e,o,n[o]);if(J)for(var o of J(n))xe.call(n,o)&&K(e,o,n[o]);return e},X=(e,n)=>he(e,fe(n));const N=Object.freeze(["cm","go","cir","ped","prev"]),ge={cm:"Azul",go:"Rosa",cir:"Verde",ped:"Amarelo",prev:"Roxo"},ve={toolbar:"Marca\xE7\xE3o da sele\xE7\xE3o",color:"Cor",strikethrough:"Riscar",strikethroughHint:"Riscar: passa um tra\xE7o sobre o trecho para destacar o que n\xE3o importa",underline:"Sublinhar",underlineHint:"Sublinhar: passa um tra\xE7o sob o trecho para destacar o que importa",annotate:"Anotar",annotateHint:"Anotar: abre a nota com o trecho selecionado",pin:"Fixar",pinHint:"Fixar: escolha uma cor ou uma a\xE7\xE3o e as pr\xF3ximas sele\xE7\xF5es j\xE1 saem com ela",pinArmedHint:"Escolha a cor ou a a\xE7\xE3o que vai ficar fixada",unpinHint:"Desafixar: as pr\xF3ximas sele\xE7\xF5es voltam a abrir esta ferramenta",remove:"Remover marca\xE7\xE3o",removeHint:"Remover a marca\xE7\xE3o deste trecho",colorName:e=>ge[e]},ke={pinHint:"Fixar: escolha uma cor e as pr\xF3ximas sele\xE7\xF5es j\xE1 saem marcadas com ela",pinArmedHint:"Escolha a cor que vai ficar fixada"},je={cm:"bg-cm-background-fill",go:"bg-go-background-fill",cir:"bg-cir-background-fill",ped:"bg-ped-background-fill",prev:"bg-prev-background-fill"},Ee={cm:"bg-cm-background-soft",go:"bg-go-background-soft",cir:"bg-cir-background-soft",ped:"bg-ped-background-soft",prev:"bg-prev-background-soft"},Ce={cm:"text-cm-foreground",go:"text-go-foreground",cir:"text-cir-foreground",ped:"text-ped-foreground",prev:"text-prev-foreground"},ye=N.map(e=>({color:e,strikethrough:!1,className:Ce[e]})),we=de.cva("rounded-[2px] font-semibold [-webkit-box-decoration-clone:clone] [box-decoration-clone:clone]",{variants:{color:X(C({},Ee),{none:"bg-transparent"}),strikethrough:{true:"text-gray-foreground-muted line-through",false:""},underline:{true:"underline underline-offset-2",false:""}},compoundVariants:[...ye,{color:"none",strikethrough:!1,className:"text-inherit"}],defaultVariants:{color:"none",strikethrough:!1,underline:!1}}),Re={cm:"aria-pressed:border-cm-background-fill",go:"aria-pressed:border-go-background-fill",cir:"aria-pressed:border-cir-background-fill",ped:"aria-pressed:border-ped-background-fill",prev:"aria-pressed:border-prev-background-fill"},Ne="inline-flex max-w-[calc(100vw-32px)] items-center rounded-pill border border-gray-stroke-muted bg-surface-elevated text-gray-foreground shadow-level-1",Oe="flex min-w-0 items-center gap-2 overflow-x-auto overscroll-x-contain rounded-pill py-2 pl-3 pr-2 [&>*]:shrink-0",G="aria-pressed:bg-primary-background-soft-emphasis aria-pressed:text-primary-foreground-emphasis",Te="aria-pressed:bg-primary-background-fill aria-pressed:text-primary-foreground-onfill aria-pressed:hover:bg-primary-background-fill-emphasis aria-pressed:hover:text-primary-foreground-onfill";function g({label:e,children:n}){return r.jsxs(R.Tooltip,{children:[r.jsx(R.TooltipTrigger,{asChild:!0,children:n}),r.jsx(R.TooltipContent,{side:"bottom",className:"max-w-64",children:e})]})}function Be({color:e,pressed:n,name:o,hint:l,disabled:p,onSelect:h}){return r.jsx(g,{label:l?`${o}. ${l}`:o,children:r.jsx(i.Toolbar.Button,{"data-slot":"text-marker-swatch","data-color":e,"aria-label":o,"aria-pressed":n,disabled:p,onClick:()=>h(e),className:S.cn("inline-flex size-8 shrink-0 items-center justify-center rounded-circular border border-transparent p-1 outline-none hover:cursor-pointer focus-visible:ring-[3px] focus-visible:ring-state-focus disabled:pointer-events-none disabled:opacity-50",Re[e]),children:r.jsx("span",{"aria-hidden":"true",className:S.cn("size-6 shrink-0 rounded-circular",je[e])})})})}function Q(){return r.jsx(pe.Separator,{orientation:"vertical",decorative:!0,className:"h-7 self-center"})}function He(e){var n;if("getBoundingClientRect"in e){const f="commonAncestorContainer"in e?e.commonAncestorContainer:e,y=f.nodeType===Node.ELEMENT_NODE?f:(n=f.parentElement)!=null?n:void 0;return{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:y}}const{top:o,left:l,width:p,height:h}=e,v={x:l,y:o,top:o,left:l,width:p,height:h,right:l+p,bottom:o+h};return{getBoundingClientRect:()=>X(C({},v),{toJSON:()=>v})}}function ze(){const e=d.useRef(!1);return d.useEffect(()=>{const n=()=>{e.current=!1},o=()=>{e.current=!0};return document.addEventListener("pointerdown",n,!0),document.addEventListener("keydown",o,!0),()=>{document.removeEventListener("pointerdown",n,!0),document.removeEventListener("keydown",o,!0)}},[]),e}function Y(e,n){return!e||!n||"getBoundingClientRect"in e||"getBoundingClientRect"in n?!1:e.top===n.top&&e.left===n.left&&e.bottom===n.bottom&&e.width===n.width&&e.height===n.height}function Ae(e){const[n,o]=d.useState(e);return e!==n&&!Y(e,n)&&o(e),Y(e,n)?n:e}function q(e){return N.includes(e)}function Se({open:e=!1,anchor:n=null,mode:o="create",selectedText:l,color:p,colors:h=N,strikethrough:v=!1,underline:f=!1,pinned:y,pinnedColor:P,disabled:b=!1,className:Z,labels:$,onHighlight:F,onStrikethrough:L,onUnderline:D,onPinnedChange:O,onPinnedColorChange:M,onNote:_,onRemove:s,onClose:u}){const V=!!O,a=C(C(C({},ve),V?null:ke),$),ee=ze(),T=Ae(n),k=d.useMemo(()=>T?{current:He(T)}:null,[T]),B=d.useRef(null),H=d.useRef(!1),[I,z]=d.useState(null),[re,ne]=d.useState(e);e!==re&&(ne(e),e||z(null));const c=y!==void 0?y:P!=null?P:null,x=e&&I!==null&&I===k,te=!!c||x,oe=c?a.unpinHint:x?a.pinArmedHint:a.pinHint,U=t=>{O==null||O(t),(t===null||q(t))&&(M==null||M(t))},W=t=>V||q(t),A=(t,m,ce)=>x&&W(t)?`${m}. ${a.pinArmedHint}`:ce,w=t=>!x||!W(t)?!1:(z(null),U(t),!0),ae=t=>{const m=w(t);if(t===p){m?u==null||u():s==null||s();return}F==null||F(t)},ie=()=>{const t=w("strikethrough");if(v){t?u==null||u():s==null||s();return}L==null||L()},le=()=>{const t=w("underline");if(f){t?u==null||u():s==null||s();return}D==null||D()},se=()=>{w("note"),_==null||_(l!=null?l:"")},ue=()=>{if(c){U(null);return}z(x?null:k)};return r.jsxs(i.Popover.Root,{open:e&&!!k,onOpenChange:t=>{t||u==null||u()},children:[k?r.jsx(i.Popover.Anchor,{virtualRef:k}):null,r.jsx(i.Popover.Portal,{children:r.jsx(i.Popover.Content,{asChild:!0,role:"toolbar",side:"top",sideOffset:4,collisionPadding:16,sticky:"always",hideWhenDetached:!0,onOpenAutoFocus:t=>{B.current=document.activeElement instanceof HTMLElement?document.activeElement:null,H.current=!1,ee.current||t.preventDefault()},onInteractOutside:()=>{H.current=!0},onCloseAutoFocus:t=>{t.preventDefault();const m=B.current;B.current=null,!H.current&&m!=null&&m.isConnected&&m.focus({preventScroll:!0})},children:r.jsxs(i.Toolbar.Root,{"aria-label":a.toolbar,"data-slot":"text-marker","data-mode":o,"data-text-marker-chrome":"",className:S.cn("z-50",Ne,Z),children:[r.jsx(R.TooltipProvider,{delayDuration:200,children:r.jsxs("div",{className:Oe,children:[r.jsx("div",{role:"group","aria-label":a.color,className:"flex items-center gap-2",children:h.map(t=>r.jsx(Be,{color:t,name:a.colorName(t),hint:x?a.pinArmedHint:void 0,pressed:p===t,disabled:b,onSelect:ae},t))}),r.jsx(Q,{}),r.jsx(g,{label:A("strikethrough",a.strikethrough,a.strikethroughHint),children:r.jsx(i.Toolbar.Button,{asChild:!0,children:r.jsx(E.Button,{variant:"regular-basic",size:"sm","aria-label":a.strikethrough,"aria-pressed":v,disabled:b,className:G,iconLeft:r.jsx(j.Strikethrough,{size:16,"aria-hidden":"true"}),onClick:ie})})}),r.jsx(g,{label:A("underline",a.underline,a.underlineHint),children:r.jsx(i.Toolbar.Button,{asChild:!0,children:r.jsx(E.Button,{variant:"regular-basic",size:"sm","aria-label":a.underline,"aria-pressed":f,disabled:b,className:G,iconLeft:r.jsx(j.Underline,{size:16,"aria-hidden":"true"}),onClick:le})})}),r.jsx(g,{label:A("note",a.annotate,a.annotateHint),children:r.jsx(i.Toolbar.Button,{asChild:!0,children:r.jsx(E.Button,{variant:"regular-basic",size:"sm","aria-label":a.annotate,disabled:b,iconLeft:r.jsx(j.Note,{size:16,"aria-hidden":"true"}),onClick:se})})}),r.jsx(Q,{}),r.jsx(g,{label:oe,children:r.jsx(i.Toolbar.Button,{asChild:!0,children:r.jsx(E.Button,{variant:"regular-basic",size:"sm","aria-label":a.pin,"aria-pressed":te,"data-pinned":c!=null?c:void 0,"data-pinned-color":c&&q(c)?c:void 0,disabled:b,className:Te,iconLeft:r.jsx(j.Pin,{size:16,"aria-hidden":"true"}),onClick:ue})})}),o==="edit"?r.jsx(g,{label:a.removeHint,children:r.jsx(i.Toolbar.Button,{asChild:!0,children:r.jsx(E.Button,{variant:"error-soft",size:"sm","aria-label":a.remove,disabled:b,iconLeft:r.jsx(j.CloseSm,{size:16,"aria-hidden":"true"}),onClick:()=>s==null?void 0:s()})})}):null]})}),r.jsx(i.Popover.Arrow,{width:16,height:10,className:"-my-px fill-surface-elevated drop-shadow-[0_1px_0_var(--color-gray-stroke-muted)]"})]})})})]})}exports.TEXT_MARKER_COLORS=N,exports.TextMarker=Se,exports.textMarkerMarkVariants=we;
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  "use client";
3
- import{jsxs as R,jsx as n}from"react/jsx-runtime";import{Strikethrough as me,Underline as pe,Note as he,Pin as fe,CloseSm as be}from"@medway-ui/icons";import{cva as ge}from"class-variance-authority";import{Popover as k,Toolbar as m}from"radix-ui";import{useMemo as ve,useRef as j,useState as B,useEffect as xe}from"react";import{Button as E}from"./Button.mjs";import{Separator as ke}from"./Separator.mjs";import{TooltipProvider as Ee,Tooltip as Ce,TooltipTrigger as ye,TooltipContent as we}from"./Tooltip.mjs";import{cn as S}from"../lib/utils.mjs";var Re=Object.defineProperty,Ne=Object.defineProperties,Oe=Object.getOwnPropertyDescriptors,U=Object.getOwnPropertySymbols,He=Object.prototype.hasOwnProperty,ze=Object.prototype.propertyIsEnumerable,J=(e,r,a)=>r in e?Re(e,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[r]=a,C=(e,r)=>{for(var a in r||(r={}))He.call(r,a)&&J(e,a,r[a]);if(U)for(var a of U(r))ze.call(r,a)&&J(e,a,r[a]);return e},X=(e,r)=>Ne(e,Oe(r));const F=Object.freeze(["cm","go","cir","ped","prev"]),Ae={cm:"Azul",go:"Rosa",cir:"Verde",ped:"Amarelo",prev:"Roxo"},Te={toolbar:"Marca\xE7\xE3o da sele\xE7\xE3o",color:"Cor",strikethrough:"Riscar",strikethroughHint:"Riscar: passa um tra\xE7o sobre o trecho para destacar o que n\xE3o importa",underline:"Sublinhar",underlineHint:"Sublinhar: passa um tra\xE7o sob o trecho para destacar o que importa",annotate:"Anotar",annotateHint:"Anotar: abre a nota com o trecho selecionado",pin:"Fixar",pinHint:"Fixar: escolha uma cor ou uma a\xE7\xE3o e as pr\xF3ximas sele\xE7\xF5es j\xE1 saem com ela",pinArmedHint:"Escolha a cor ou a a\xE7\xE3o que vai ficar fixada",unpinHint:"Desafixar: as pr\xF3ximas sele\xE7\xF5es voltam a abrir esta ferramenta",remove:"Remover marca\xE7\xE3o",removeHint:"Remover a marca\xE7\xE3o deste trecho",colorName:e=>Ae[e]},je={pinHint:"Fixar: escolha uma cor e as pr\xF3ximas sele\xE7\xF5es j\xE1 saem marcadas com ela",pinArmedHint:"Escolha a cor que vai ficar fixada"},Be={cm:"bg-cm-background-fill",go:"bg-go-background-fill",cir:"bg-cir-background-fill",ped:"bg-ped-background-fill",prev:"bg-prev-background-fill"},Se={cm:"bg-cm-16 dark:bg-cm-48",go:"bg-go-16 dark:bg-go-48",cir:"bg-cir-16 dark:bg-cir-24",ped:"bg-ped-24 dark:bg-ped-48",prev:"bg-prev-16 dark:bg-prev-48"},Fe=ge("rounded-[2px] [-webkit-box-decoration-clone:clone] [box-decoration-clone:clone]",{variants:{color:X(C({},Se),{none:"bg-transparent"}),strikethrough:{true:"text-gray-foreground-muted line-through",false:"text-inherit"},underline:{true:"underline underline-offset-2",false:""}},defaultVariants:{color:"none",strikethrough:!1,underline:!1}}),Le={cm:"aria-pressed:border-cm-background-fill",go:"aria-pressed:border-go-background-fill",cir:"aria-pressed:border-cir-background-fill",ped:"aria-pressed:border-ped-background-fill",prev:"aria-pressed:border-prev-background-fill"},Pe="inline-flex max-w-[calc(100vw-32px)] items-center rounded-pill border border-gray-stroke-muted bg-surface-elevated text-gray-foreground shadow-level-1",De="flex min-w-0 items-center gap-2 overflow-x-auto overscroll-x-contain rounded-pill py-2 pl-3 pr-2 [&>*]:shrink-0",G="aria-pressed:bg-primary-background-soft-emphasis aria-pressed:text-primary-foreground-emphasis",$e="aria-pressed:bg-primary-background-fill aria-pressed:text-primary-foreground-onfill aria-pressed:hover:bg-primary-background-fill-emphasis aria-pressed:hover:text-primary-foreground-onfill";function g({label:e,children:r}){return R(Ce,{children:[n(ye,{asChild:!0,children:r}),n(we,{side:"bottom",className:"max-w-64",children:e})]})}function Me({color:e,pressed:r,name:a,hint:i,disabled:c,onSelect:p}){return n(g,{label:i?`${a}. ${i}`:a,children:n(m.Button,{"data-slot":"text-marker-swatch","data-color":e,"aria-label":a,"aria-pressed":r,disabled:c,onClick:()=>p(e),className:S("inline-flex size-8 shrink-0 items-center justify-center rounded-circular border border-transparent p-1 outline-none hover:cursor-pointer focus-visible:ring-[3px] focus-visible:ring-state-focus disabled:pointer-events-none disabled:opacity-50",Le[e]),children:n("span",{"aria-hidden":"true",className:S("size-6 shrink-0 rounded-circular",Be[e])})})})}function Q(){return n(ke,{orientation:"vertical",decorative:!0,className:"h-7 self-center"})}function _e(e){var r;if("getBoundingClientRect"in e){const h="commonAncestorContainer"in e?e.commonAncestorContainer:e,y=h.nodeType===Node.ELEMENT_NODE?h:(r=h.parentElement)!=null?r:void 0;return{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:y}}const{top:a,left:i,width:c,height:p}=e,v={x:i,y:a,top:a,left:i,width:c,height:p,right:i+c,bottom:a+p};return{getBoundingClientRect:()=>X(C({},v),{toJSON:()=>v})}}function qe(){const e=j(!1);return xe(()=>{const r=()=>{e.current=!1},a=()=>{e.current=!0};return document.addEventListener("pointerdown",r,!0),document.addEventListener("keydown",a,!0),()=>{document.removeEventListener("pointerdown",r,!0),document.removeEventListener("keydown",a,!0)}},[]),e}function Y(e,r){return!e||!r||"getBoundingClientRect"in e||"getBoundingClientRect"in r?!1:e.top===r.top&&e.left===r.left&&e.bottom===r.bottom&&e.width===r.width&&e.height===r.height}function Ie(e){const[r,a]=B(e);return e!==r&&!Y(e,r)&&a(e),Y(e,r)?r:e}function L(e){return F.includes(e)}function Ve({open:e=!1,anchor:r=null,mode:a="create",selectedText:i,color:c,colors:p=F,strikethrough:v=!1,underline:h=!1,pinned:y,pinnedColor:P,disabled:f=!1,className:Z,labels:ee,onHighlight:D,onStrikethrough:$,onUnderline:M,onPinnedChange:N,onPinnedColorChange:_,onNote:q,onRemove:l,onClose:s}){const I=!!N,o=C(C(C({},Te),I?null:je),ee),re=qe(),O=Ie(r),x=ve(()=>O?{current:_e(O)}:null,[O]),H=j(null),z=j(!1),[V,A]=B(null),[ne,te]=B(e);e!==ne&&(te(e),e||A(null));const d=y!==void 0?y:P!=null?P:null,b=e&&V!==null&&V===x,ae=!!d||b,oe=d?o.unpinHint:b?o.pinArmedHint:o.pinHint,W=t=>{N==null||N(t),(t===null||L(t))&&(_==null||_(t))},K=t=>I||L(t),T=(t,u,ue)=>b&&K(t)?`${u}. ${o.pinArmedHint}`:ue,w=t=>!b||!K(t)?!1:(A(null),W(t),!0),ie=t=>{const u=w(t);if(t===c){u?s==null||s():l==null||l();return}D==null||D(t)},le=()=>{const t=w("strikethrough");if(v){t?s==null||s():l==null||l();return}$==null||$()},se=()=>{const t=w("underline");if(h){t?s==null||s():l==null||l();return}M==null||M()},de=()=>{w("note"),q==null||q(i!=null?i:"")},ce=()=>{if(d){W(null);return}A(b?null:x)};return R(k.Root,{open:e&&!!x,onOpenChange:t=>{t||s==null||s()},children:[x?n(k.Anchor,{virtualRef:x}):null,n(k.Portal,{children:n(k.Content,{asChild:!0,role:"toolbar",side:"top",sideOffset:4,collisionPadding:16,sticky:"always",hideWhenDetached:!0,onOpenAutoFocus:t=>{H.current=document.activeElement instanceof HTMLElement?document.activeElement:null,z.current=!1,re.current||t.preventDefault()},onInteractOutside:()=>{z.current=!0},onCloseAutoFocus:t=>{t.preventDefault();const u=H.current;H.current=null,!z.current&&u!=null&&u.isConnected&&u.focus({preventScroll:!0})},children:R(m.Root,{"aria-label":o.toolbar,"data-slot":"text-marker","data-mode":a,"data-text-marker-chrome":"",className:S("z-50",Pe,Z),children:[n(Ee,{delayDuration:200,children:R("div",{className:De,children:[n("div",{role:"group","aria-label":o.color,className:"flex items-center gap-2",children:p.map(t=>n(Me,{color:t,name:o.colorName(t),hint:b?o.pinArmedHint:void 0,pressed:c===t,disabled:f,onSelect:ie},t))}),n(Q,{}),n(g,{label:T("strikethrough",o.strikethrough,o.strikethroughHint),children:n(m.Button,{asChild:!0,children:n(E,{variant:"regular-basic",size:"sm","aria-label":o.strikethrough,"aria-pressed":v,disabled:f,className:G,iconLeft:n(me,{size:16,"aria-hidden":"true"}),onClick:le})})}),n(g,{label:T("underline",o.underline,o.underlineHint),children:n(m.Button,{asChild:!0,children:n(E,{variant:"regular-basic",size:"sm","aria-label":o.underline,"aria-pressed":h,disabled:f,className:G,iconLeft:n(pe,{size:16,"aria-hidden":"true"}),onClick:se})})}),n(g,{label:T("note",o.annotate,o.annotateHint),children:n(m.Button,{asChild:!0,children:n(E,{variant:"regular-basic",size:"sm","aria-label":o.annotate,disabled:f,iconLeft:n(he,{size:16,"aria-hidden":"true"}),onClick:de})})}),n(Q,{}),n(g,{label:oe,children:n(m.Button,{asChild:!0,children:n(E,{variant:"regular-basic",size:"sm","aria-label":o.pin,"aria-pressed":ae,"data-pinned":d!=null?d:void 0,"data-pinned-color":d&&L(d)?d:void 0,disabled:f,className:$e,iconLeft:n(fe,{size:16,"aria-hidden":"true"}),onClick:ce})})}),a==="edit"?n(g,{label:o.removeHint,children:n(m.Button,{asChild:!0,children:n(E,{variant:"error-soft",size:"sm","aria-label":o.remove,disabled:f,iconLeft:n(be,{size:16,"aria-hidden":"true"}),onClick:()=>l==null?void 0:l()})})}):null]})}),n(k.Arrow,{width:16,height:10,className:"-my-px fill-surface-elevated drop-shadow-[0_1px_0_var(--color-gray-stroke-muted)]"})]})})})]})}export{F as TEXT_MARKER_COLORS,Ve as TextMarker,Fe as textMarkerMarkVariants};
3
+ import{jsxs as N,jsx as n}from"react/jsx-runtime";import{Strikethrough as me,Underline as pe,Note as he,Pin as fe,CloseSm as be}from"@medway-ui/icons";import{cva as ge}from"class-variance-authority";import{Popover as k,Toolbar as m}from"radix-ui";import{useMemo as xe,useRef as F,useState as S,useEffect as ve}from"react";import{Button as E}from"./Button.mjs";import{Separator as ke}from"./Separator.mjs";import{TooltipProvider as Ee,Tooltip as Ce,TooltipTrigger as ye,TooltipContent as we}from"./Tooltip.mjs";import{cn as T}from"../lib/utils.mjs";var Ne=Object.defineProperty,Oe=Object.defineProperties,Re=Object.getOwnPropertyDescriptors,J=Object.getOwnPropertySymbols,He=Object.prototype.hasOwnProperty,ze=Object.prototype.propertyIsEnumerable,K=(e,r,o)=>r in e?Ne(e,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[r]=o,C=(e,r)=>{for(var o in r||(r={}))He.call(r,o)&&K(e,o,r[o]);if(J)for(var o of J(r))ze.call(r,o)&&K(e,o,r[o]);return e},X=(e,r)=>Oe(e,Re(r));const O=Object.freeze(["cm","go","cir","ped","prev"]),Ae={cm:"Azul",go:"Rosa",cir:"Verde",ped:"Amarelo",prev:"Roxo"},je={toolbar:"Marca\xE7\xE3o da sele\xE7\xE3o",color:"Cor",strikethrough:"Riscar",strikethroughHint:"Riscar: passa um tra\xE7o sobre o trecho para destacar o que n\xE3o importa",underline:"Sublinhar",underlineHint:"Sublinhar: passa um tra\xE7o sob o trecho para destacar o que importa",annotate:"Anotar",annotateHint:"Anotar: abre a nota com o trecho selecionado",pin:"Fixar",pinHint:"Fixar: escolha uma cor ou uma a\xE7\xE3o e as pr\xF3ximas sele\xE7\xF5es j\xE1 saem com ela",pinArmedHint:"Escolha a cor ou a a\xE7\xE3o que vai ficar fixada",unpinHint:"Desafixar: as pr\xF3ximas sele\xE7\xF5es voltam a abrir esta ferramenta",remove:"Remover marca\xE7\xE3o",removeHint:"Remover a marca\xE7\xE3o deste trecho",colorName:e=>Ae[e]},Be={pinHint:"Fixar: escolha uma cor e as pr\xF3ximas sele\xE7\xF5es j\xE1 saem marcadas com ela",pinArmedHint:"Escolha a cor que vai ficar fixada"},Fe={cm:"bg-cm-background-fill",go:"bg-go-background-fill",cir:"bg-cir-background-fill",ped:"bg-ped-background-fill",prev:"bg-prev-background-fill"},Se={cm:"bg-cm-background-soft",go:"bg-go-background-soft",cir:"bg-cir-background-soft",ped:"bg-ped-background-soft",prev:"bg-prev-background-soft"},Te={cm:"text-cm-foreground",go:"text-go-foreground",cir:"text-cir-foreground",ped:"text-ped-foreground",prev:"text-prev-foreground"},Le=O.map(e=>({color:e,strikethrough:!1,className:Te[e]})),Pe=ge("rounded-[2px] font-semibold [-webkit-box-decoration-clone:clone] [box-decoration-clone:clone]",{variants:{color:X(C({},Se),{none:"bg-transparent"}),strikethrough:{true:"text-gray-foreground-muted line-through",false:""},underline:{true:"underline underline-offset-2",false:""}},compoundVariants:[...Le,{color:"none",strikethrough:!1,className:"text-inherit"}],defaultVariants:{color:"none",strikethrough:!1,underline:!1}}),$e={cm:"aria-pressed:border-cm-background-fill",go:"aria-pressed:border-go-background-fill",cir:"aria-pressed:border-cir-background-fill",ped:"aria-pressed:border-ped-background-fill",prev:"aria-pressed:border-prev-background-fill"},De="inline-flex max-w-[calc(100vw-32px)] items-center rounded-pill border border-gray-stroke-muted bg-surface-elevated text-gray-foreground shadow-level-1",Me="flex min-w-0 items-center gap-2 overflow-x-auto overscroll-x-contain rounded-pill py-2 pl-3 pr-2 [&>*]:shrink-0",G="aria-pressed:bg-primary-background-soft-emphasis aria-pressed:text-primary-foreground-emphasis",_e="aria-pressed:bg-primary-background-fill aria-pressed:text-primary-foreground-onfill aria-pressed:hover:bg-primary-background-fill-emphasis aria-pressed:hover:text-primary-foreground-onfill";function g({label:e,children:r}){return N(Ce,{children:[n(ye,{asChild:!0,children:r}),n(we,{side:"bottom",className:"max-w-64",children:e})]})}function qe({color:e,pressed:r,name:o,hint:i,disabled:c,onSelect:p}){return n(g,{label:i?`${o}. ${i}`:o,children:n(m.Button,{"data-slot":"text-marker-swatch","data-color":e,"aria-label":o,"aria-pressed":r,disabled:c,onClick:()=>p(e),className:T("inline-flex size-8 shrink-0 items-center justify-center rounded-circular border border-transparent p-1 outline-none hover:cursor-pointer focus-visible:ring-[3px] focus-visible:ring-state-focus disabled:pointer-events-none disabled:opacity-50",$e[e]),children:n("span",{"aria-hidden":"true",className:T("size-6 shrink-0 rounded-circular",Fe[e])})})})}function Q(){return n(ke,{orientation:"vertical",decorative:!0,className:"h-7 self-center"})}function Ve(e){var r;if("getBoundingClientRect"in e){const h="commonAncestorContainer"in e?e.commonAncestorContainer:e,y=h.nodeType===Node.ELEMENT_NODE?h:(r=h.parentElement)!=null?r:void 0;return{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:y}}const{top:o,left:i,width:c,height:p}=e,x={x:i,y:o,top:o,left:i,width:c,height:p,right:i+c,bottom:o+p};return{getBoundingClientRect:()=>X(C({},x),{toJSON:()=>x})}}function Ie(){const e=F(!1);return ve(()=>{const r=()=>{e.current=!1},o=()=>{e.current=!0};return document.addEventListener("pointerdown",r,!0),document.addEventListener("keydown",o,!0),()=>{document.removeEventListener("pointerdown",r,!0),document.removeEventListener("keydown",o,!0)}},[]),e}function Y(e,r){return!e||!r||"getBoundingClientRect"in e||"getBoundingClientRect"in r?!1:e.top===r.top&&e.left===r.left&&e.bottom===r.bottom&&e.width===r.width&&e.height===r.height}function We(e){const[r,o]=S(e);return e!==r&&!Y(e,r)&&o(e),Y(e,r)?r:e}function L(e){return O.includes(e)}function Ue({open:e=!1,anchor:r=null,mode:o="create",selectedText:i,color:c,colors:p=O,strikethrough:x=!1,underline:h=!1,pinned:y,pinnedColor:P,disabled:f=!1,className:Z,labels:ee,onHighlight:$,onStrikethrough:D,onUnderline:M,onPinnedChange:R,onPinnedColorChange:_,onNote:q,onRemove:l,onClose:s}){const V=!!R,a=C(C(C({},je),V?null:Be),ee),re=Ie(),H=We(r),v=xe(()=>H?{current:Ve(H)}:null,[H]),z=F(null),A=F(!1),[I,j]=S(null),[ne,te]=S(e);e!==ne&&(te(e),e||j(null));const d=y!==void 0?y:P!=null?P:null,b=e&&I!==null&&I===v,oe=!!d||b,ae=d?a.unpinHint:b?a.pinArmedHint:a.pinHint,W=t=>{R==null||R(t),(t===null||L(t))&&(_==null||_(t))},U=t=>V||L(t),B=(t,u,ue)=>b&&U(t)?`${u}. ${a.pinArmedHint}`:ue,w=t=>!b||!U(t)?!1:(j(null),W(t),!0),ie=t=>{const u=w(t);if(t===c){u?s==null||s():l==null||l();return}$==null||$(t)},le=()=>{const t=w("strikethrough");if(x){t?s==null||s():l==null||l();return}D==null||D()},se=()=>{const t=w("underline");if(h){t?s==null||s():l==null||l();return}M==null||M()},de=()=>{w("note"),q==null||q(i!=null?i:"")},ce=()=>{if(d){W(null);return}j(b?null:v)};return N(k.Root,{open:e&&!!v,onOpenChange:t=>{t||s==null||s()},children:[v?n(k.Anchor,{virtualRef:v}):null,n(k.Portal,{children:n(k.Content,{asChild:!0,role:"toolbar",side:"top",sideOffset:4,collisionPadding:16,sticky:"always",hideWhenDetached:!0,onOpenAutoFocus:t=>{z.current=document.activeElement instanceof HTMLElement?document.activeElement:null,A.current=!1,re.current||t.preventDefault()},onInteractOutside:()=>{A.current=!0},onCloseAutoFocus:t=>{t.preventDefault();const u=z.current;z.current=null,!A.current&&u!=null&&u.isConnected&&u.focus({preventScroll:!0})},children:N(m.Root,{"aria-label":a.toolbar,"data-slot":"text-marker","data-mode":o,"data-text-marker-chrome":"",className:T("z-50",De,Z),children:[n(Ee,{delayDuration:200,children:N("div",{className:Me,children:[n("div",{role:"group","aria-label":a.color,className:"flex items-center gap-2",children:p.map(t=>n(qe,{color:t,name:a.colorName(t),hint:b?a.pinArmedHint:void 0,pressed:c===t,disabled:f,onSelect:ie},t))}),n(Q,{}),n(g,{label:B("strikethrough",a.strikethrough,a.strikethroughHint),children:n(m.Button,{asChild:!0,children:n(E,{variant:"regular-basic",size:"sm","aria-label":a.strikethrough,"aria-pressed":x,disabled:f,className:G,iconLeft:n(me,{size:16,"aria-hidden":"true"}),onClick:le})})}),n(g,{label:B("underline",a.underline,a.underlineHint),children:n(m.Button,{asChild:!0,children:n(E,{variant:"regular-basic",size:"sm","aria-label":a.underline,"aria-pressed":h,disabled:f,className:G,iconLeft:n(pe,{size:16,"aria-hidden":"true"}),onClick:se})})}),n(g,{label:B("note",a.annotate,a.annotateHint),children:n(m.Button,{asChild:!0,children:n(E,{variant:"regular-basic",size:"sm","aria-label":a.annotate,disabled:f,iconLeft:n(he,{size:16,"aria-hidden":"true"}),onClick:de})})}),n(Q,{}),n(g,{label:ae,children:n(m.Button,{asChild:!0,children:n(E,{variant:"regular-basic",size:"sm","aria-label":a.pin,"aria-pressed":oe,"data-pinned":d!=null?d:void 0,"data-pinned-color":d&&L(d)?d:void 0,disabled:f,className:_e,iconLeft:n(fe,{size:16,"aria-hidden":"true"}),onClick:ce})})}),o==="edit"?n(g,{label:a.removeHint,children:n(m.Button,{asChild:!0,children:n(E,{variant:"error-soft",size:"sm","aria-label":a.remove,disabled:f,iconLeft:n(be,{size:16,"aria-hidden":"true"}),onClick:()=>l==null?void 0:l()})})}):null]})}),n(k.Arrow,{width:16,height:10,className:"-my-px fill-surface-elevated drop-shadow-[0_1px_0_var(--color-gray-stroke-muted)]"})]})})})]})}export{O as TEXT_MARKER_COLORS,Ue as TextMarker,Pe as textMarkerMarkVariants};