@medway-ui/core 1.46.0 → 1.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/COMPONENTS.md +2 -1
- package/COMPONENTS_SUMMARY.md +1 -1
- package/dist/COMPONENTS.md +2 -1
- package/dist/COMPONENTS_SUMMARY.md +1 -1
- package/dist/components/Carousel.d.ts +1 -0
- package/dist/components/Carousel.js +1 -1
- package/dist/components/Carousel.mjs +1 -1
- package/dist/components/Dialog.js +1 -1
- package/dist/components/Dialog.mjs +1 -1
- package/dist/components/TextMarker.js +1 -1
- package/dist/components/TextMarker.mjs +1 -1
- package/package.json +2 -1
package/COMPONENTS.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @medway-ui/core — Component Reference
|
|
2
2
|
|
|
3
3
|
> **Auto-generated — do not edit manually.**
|
|
4
|
-
> Package `@medway-ui/core` · v1.
|
|
4
|
+
> Package `@medway-ui/core` · v1.47.0 · Generated 2026-11-18
|
|
5
5
|
|
|
6
6
|
All components require React 18+ and are client components (`"use client"`).
|
|
7
7
|
|
|
@@ -826,6 +826,7 @@ type CardLessonProps = | (ComponentProps<"div"> & {
|
|
|
826
826
|
| `controlsFrom` | `CarouselControlsFrom` | |
|
|
827
827
|
| `edgeBehavior` | `CarouselEdgeBehavior` | |
|
|
828
828
|
| `hideControlsWhenFits` | `boolean` | |
|
|
829
|
+
| `wheelGestures` | `boolean` | |
|
|
829
830
|
| `index` | `number` | |
|
|
830
831
|
| `defaultIndex` | `number` | |
|
|
831
832
|
| `onIndexChange` | `(index: number) => void` | |
|
package/COMPONENTS_SUMMARY.md
CHANGED
package/dist/COMPONENTS.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @medway-ui/core — Component Reference
|
|
2
2
|
|
|
3
3
|
> **Auto-generated — do not edit manually.**
|
|
4
|
-
> Package `@medway-ui/core` · v1.
|
|
4
|
+
> Package `@medway-ui/core` · v1.47.0 · Generated 2026-11-18
|
|
5
5
|
|
|
6
6
|
All components require React 18+ and are client components (`"use client"`).
|
|
7
7
|
|
|
@@ -826,6 +826,7 @@ type CardLessonProps = | (ComponentProps<"div"> & {
|
|
|
826
826
|
| `controlsFrom` | `CarouselControlsFrom` | |
|
|
827
827
|
| `edgeBehavior` | `CarouselEdgeBehavior` | |
|
|
828
828
|
| `hideControlsWhenFits` | `boolean` | |
|
|
829
|
+
| `wheelGestures` | `boolean` | |
|
|
829
830
|
| `index` | `number` | |
|
|
830
831
|
| `defaultIndex` | `number` | |
|
|
831
832
|
| `onIndexChange` | `(index: number) => void` | |
|
|
@@ -29,6 +29,7 @@ interface CarouselProps extends Omit<ComponentProps<"div">, "aria-label"> {
|
|
|
29
29
|
controlsFrom?: CarouselControlsFrom;
|
|
30
30
|
edgeBehavior?: CarouselEdgeBehavior;
|
|
31
31
|
hideControlsWhenFits?: boolean;
|
|
32
|
+
wheelGestures?: boolean;
|
|
32
33
|
index?: number;
|
|
33
34
|
defaultIndex?: number;
|
|
34
35
|
onIndexChange?: (index: number) => void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
|
-
"use strict";var f=require("react/jsx-runtime"),Qe=require("embla-carousel-autoplay"),et=require("embla-carousel-fade"),tt=require("embla-carousel-react"),G=require("class-variance-authority"),B=require("@medway-ui/icons"),a=require("react"),ke=require("./Button.js"),ot=require("../hooks/use-composed-refs.js"),nt=require("../hooks/use-prefers-reduced-motion.js"),w=require("../lib/utils.js"),rt=Object.defineProperty,at=Object.defineProperties,lt=Object.getOwnPropertyDescriptors,ne=Object.getOwnPropertySymbols,je=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable,Oe=(e,t,o)=>t in e?rt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,S=(e,t)=>{for(var o in t||(t={}))je.call(t,o)&&Oe(e,o,t[o]);if(ne)for(var o of ne(t))Ae.call(t,o)&&Oe(e,o,t[o]);return e},A=(e,t)=>at(e,lt(t)),W=(e,t)=>{var o={};for(var r in e)je.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&ne)for(var r of ne(e))t.indexOf(r)<0&&Ae.call(e,r)&&(o[r]=e[r]);return o};const it=5e3,Le="data-consumer-inert",st={selectedIndex:0,snapCount:0,canScrollPrev:!1,canScrollNext:!1,slideCount:0,snapFirstSlides:[],announcement:""},ct={horizontal:{ArrowLeft:"previous",ArrowRight:"next"},vertical:{ArrowUp:"previous",ArrowDown:"next"}},ut=["TEXTAREA","SELECT","VIDEO","AUDIO"],dt=["button","checkbox","color","file","image","reset","submit"],ft=["combobox","grid","listbox","menu","menubar","radiogroup","searchbox","slider","spinbutton","tablist","textbox","toolbar","tree","treegrid"],vt={horizontal:{previous:B.ArrowLeftMd,next:B.ArrowRightMd},vertical:{previous:B.ArrowUpMd,next:B.ArrowDownMd}},pt={previous:"Anterior",next:"Pr\xF3ximo"},gt={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"}}},K=["side","floating","outside"],mt=G.cva("relative",{variants:{orientation:{horizontal:"",vertical:""},controls:{side:"",floating:"",outside:"",inline:""}},compoundVariants:[{orientation:"horizontal",controls:K,class:"grid grid-flow-row-dense grid-cols-[auto_minmax(0,1fr)_auto] items-center [&>*]:col-span-full"},{orientation:"vertical",controls:K,class:"flex flex-col"}]}),ht=G.cva("relative overflow-hidden",{variants:{orientation:{horizontal:"",vertical:""},controls:{side:"",floating:"",outside:"",inline:""}},compoundVariants:[{orientation:"horizontal",controls:K,class:"!col-start-2 !col-span-1 min-w-0"}]}),bt=G.cva("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:K,direction:"previous",class:"!col-start-1 !col-span-1"},{orientation:"horizontal",controls:K,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:K,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"}]}),xt=G.cva("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"}]}),Te=G.cva("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"}]}),yt="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",Ct="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",Nt="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",ge=a.createContext(null),Me=a.createContext(null);function J(){const e=a.useContext(ge);if(!e)throw new Error("useCarousel must be used within a Carousel component.");return e}function St(){const{selectedIndex:e,snapCount:t,canScrollPrev:o,canScrollNext:r,isScrollable:c,scrollPrev:v,scrollNext:u,scrollTo:p,autoplay:s}=J();return a.useMemo(()=>({selectedIndex:e,snapCount:t,canScrollPrev:o,canScrollNext:r,isScrollable:c,scrollPrev:v,scrollNext:u,scrollTo:p,autoplay:s}),[e,t,o,r,c,v,u,p,s])}function wt(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 Rt(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 Pt(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 me(e){if(!(e===void 0||!Number.isFinite(e)))return Math.max(0,Math.trunc(e))}function De(e,t=""){return a.Children.toArray(e).flatMap(o=>{var r;if(!a.isValidElement(o))return[];const c=`${t}${(r=o.key)!=null?r:""}`;return o.type===a.Fragment?De(o.props.children,`${c}/`):[a.cloneElement(o,{key:c})]})}function Et(e,t,o){const r=document.activeElement;return r===o&&!e.canScrollNext&&e.canScrollPrev?"previous":r===t&&!e.canScrollPrev&&e.canScrollNext?"next":null}function zt(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 It(e,t){var o;return e instanceof HTMLElement&&e.isContentEditable||e instanceof HTMLInputElement&&!dt.includes(e.type)||ut.includes(e.tagName)||ft.includes((o=e.getAttribute("role"))!=null?o:"")||zt(e,t)}function Ft(e,t){const o=e.nativeEvent.composedPath();return o.slice(0,o.indexOf(e.currentTarget)).some(r=>r instanceof Element&&It(r,t))}function kt(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 Be(e){return e.hasAttribute(Le)}function We(e){e.getAttribute("tabindex")==="-1"&&e.removeAttribute("tabindex")}function he(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:it}function Ke(e,t){return e==="page"?t.snapCount!==t.slideCount:qe(e,1)>1}function At(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=$e(e)[0])!=null?o:c)+1} de ${r}`}function Ot(e,t){return t?`Ir para a p\xE1gina ${e+1}`:`Ir para o slide ${e+1}`}const Lt=a.forwardRef(function(e,t){const o=e,{orientation:r="horizontal",align:c="start",step:v=1,loop:u=!1,dragFree:p=!1,transition:s="slide",autoplay:h=!1,controls:b="side",controlsFrom:d="always",edgeBehavior:R="disable",hideControlsWhenFits:z=!0,index:F,defaultIndex:k,onIndexChange:x,setApi:P,opts:E,className:M,children:q,onKeyDown:O,onFocus:V,onPointerEnter:H,onPointerLeave:Y}=o,re=W(o,["orientation","align","step","loop","dragFree","transition","autoplay","controls","controlsFrom","edgeBehavior","hideControlsWhenFits","index","defaultIndex","onIndexChange","setApi","opts","className","children","onKeyDown","onFocus","onPointerEnter","onPointerLeave"]),C=nt.usePrefersReducedMotion(),j=h!==!1,U=jt(h),L=me(F),[ae]=a.useState(()=>{var n;return(n=L!=null?L:me(k))!=null?n:0}),He=a.useMemo(()=>{const n=[];return j&&n.push(Qe({delay:U,playOnInit:!1,stopOnInteraction:!0,stopOnFocusIn:!1,stopOnMouseEnter:!1})),s==="fade"&&n.push(et()),n},[j,U,s]),[be,l]=tt(A(S({containScroll:"trimSnaps"},E),{axis:r==="horizontal"?"x":"y",align:c,loop:u,dragFree:p,slidesToScroll:v==="page"?"auto":qe(v,1),startIndex:ae}),He),[_,Ue]=a.useState(()=>A(S({},st),{selectedIndex:ae})),[le,xe]=a.useState(null),[_e,ye]=a.useState(!1),ie=a.useRef(null),se=a.useRef(null),ce=a.useRef(null),ue=a.useRef(!1),T=a.useRef(ae),de=a.useRef(x),Ce=a.useRef(v),Ne=a.useRef(null),Z=a.useRef(null),Q=_.snapCount>1,Se=Ke(v,_),X=le?le==="paused":C,D=j&&Q&&!X&&!_e,we=a.useRef(D),ee=a.useRef(null),Re=a.useRef(C),te=a.useCallback(()=>{l&&(l.scrollPrev(C),he(l))},[l,C]),oe=a.useCallback(()=>{l&&(l.scrollNext(C),he(l))},[l,C]),fe=a.useCallback(n=>{if(!l)return;const i=n!==l.selectedScrollSnap();l.scrollTo(n,C),i&&he(l)},[l,C]),ve=a.useCallback(n=>{ue.current=!0;try{n==="previous"?te():oe()}finally{ue.current=!1}},[te,oe]),Pe=a.useCallback(()=>{var n;return(n=ee.current)==null?void 0:n.call(ee)},[]),Ee=a.useCallback(()=>xe(X?"playing":"paused"),[X]),Xe=n=>{O==null||O(n);const i=ct[r][n.key];!i||n.defaultPrevented||n.altKey||n.ctrlKey||n.metaKey||n.shiftKey||n.currentTarget.contains(n.target)&&(Ft(n,r)||(n.preventDefault(),ve(i)))},Ge=n=>{V==null||V(n),!(!j||le==="playing")&&kt(n.target)&&xe("paused")},Je=n=>{H==null||H(n),n.pointerType==="mouse"&&ye(!0)},Ye=n=>{Y==null||Y(n),n.pointerType==="mouse"&&ye(!1)},ze=a.useMemo(()=>({isEnabled:j,isPaused:X,isRotating:D,toggle:Ee}),[j,X,D,Ee]),Ze=a.useMemo(()=>A(S({},_),{orientation:r,transition:s,controls:b,controlsFrom:d,edgeBehavior:R,hideControlsWhenFits:z,isPaged:Se,isScrollable:Q,viewportRef:be,previousButtonRef:ie,nextButtonRef:se,scrollPrev:te,scrollNext:oe,scrollTo:fe,scrollFromArrow:ve,syncFadeInert:Pe,autoplay:ze}),[_,r,s,b,d,R,z,Se,Q,be,te,oe,fe,ve,Pe,ze]);return a.useEffect(()=>{de.current=x,Ce.current=v,we.current=D,Re.current=C}),a.useEffect(()=>{l&&P&&P(l)},[l,P]),a.useEffect(()=>{if(!l)return;let n=!1;const i=(N,m)=>{const g=wt(l),$=m==="select"&&n;$&&(n=!1);const Ie=m!=="select"?void 0:$?"":At(l,Ke(Ce.current,g));ce.current=ue.current?Et(g,ie.current,se.current):null,Ue(pe=>{const Fe=A(S({},g),{announcement:Ie!=null?Ie:pe.announcement});return Rt(pe,Fe)?pe:Fe})},y=()=>{const N=Z.current,m=N!==null&&N<l.scrollSnapList().length;m&&(Z.current=null,T.current=N);const g=T.current;if(l.selectedScrollSnap()!==g){n=!m;try{l.scrollTo(g,!0)}finally{n=!1}}},I=()=>{var N;const m=l.selectedScrollSnap();m!==T.current&&(T.current=m,(N=de.current)==null||N.call(de,m))};return T.current=l.selectedScrollSnap(),i(),l.on("reInit",y).on("select",i).on("reInit",i).on("select",I).on("reInit",I),()=>{l.off("reInit",y).off("select",i).off("reInit",i).off("select",I).off("reInit",I)}},[l]),a.useEffect(()=>{var n;const i=ce.current;i&&(ce.current=null,(n=(i==="previous"?ie:se).current)==null||n.focus({preventScroll:!0}))},[_]),a.useEffect(()=>{const n=Ne.current;if(!l||n&&Pt(n,e))return;if(Ne.current=e,L===void 0){Z.current=null;return}const i=l.selectedScrollSnap(),y=L===me(n==null?void 0:n.index);if(i!==T.current&&y)return;const I=Math.max(0,l.scrollSnapList().length-1);Z.current=L>I?L:null;const N=Math.min(L,I);N!==i&&(T.current=N,fe(N))}),a.useEffect(()=>{if(!l||s!=="fade")return;const n=new Set,i=()=>{const y=l.slideNodes(),I=new Set($e(l)),N=y.some((g,$)=>!I.has($)&&g.contains(document.activeElement));y.forEach((g,$)=>{g.inert=!I.has($)||Be(g),g.inert&&n.has(g)&&(We(g),n.delete(g))});const m=N?y.find(g=>!g.inert):void 0;m&&(m.hasAttribute("tabindex")||(m.tabIndex=-1,n.add(m)),m.focus({preventScroll:!0}))};return ee.current=i,i(),l.on("select",i).on("reInit",i),()=>{ee.current=null,l.off("select",i).off("reInit",i);for(const y of l.slideNodes())y.inert=Be(y);n.forEach(We)}},[l,s]),a.useEffect(()=>{var n;const i=(n=l==null?void 0:l.plugins())==null?void 0:n.autoplay;i&&(D?i.play(C):i.stop())},[l,D,C]),a.useEffect(()=>{if(!l)return;const n=()=>{var i,y;we.current&&((y=(i=l.plugins())==null?void 0:i.autoplay)==null||y.play(Re.current))};return l.on("pointerUp",n).on("reInit",n),()=>{l.off("pointerUp",n).off("reInit",n)}},[l]),f.jsx(ge.Provider,{value:Ze,children:f.jsx("div",A(S({ref:t,role:"region","aria-roledescription":"carousel","data-slot":"carousel","data-orientation":r,"data-scrollable":Q,className:w.cn(mt({orientation:r,controls:b}),M),onKeyDown:Xe,onFocus:Ge,onPointerEnter:Je,onPointerLeave:Ye},re),{children:q}))})}),Tt=a.forwardRef(function(e,t){var o=e,{gap:r="md",fadeEdges:c=!1,fadeClassName:v,viewportClassName:u,className:p,children:s}=o,h=W(o,["gap","fadeEdges","fadeClassName","viewportClassName","className","children"]);const{viewportRef:b,orientation:d,controls:R,canScrollPrev:z,canScrollNext:F,announcement:k,autoplay:x}=J(),P=De(s),E=gt[r][d];return f.jsxs("div",{ref:b,"data-slot":"carousel-viewport",className:w.cn(ht({orientation:d,controls:R}),u),children:[f.jsx("div",A(S({ref:t,"data-slot":"carousel-content",className:w.cn("flex touch-pinch-zoom",d==="horizontal"?"touch-pan-y":"touch-pan-x flex-col",E.content,p)},h),{children:P.map((M,q)=>{var O;return f.jsx(Me.Provider,{value:{index:q,total:P.length,gapClassName:E.item,focusRingClassName:E.focusRing},children:M},(O=M.key)!=null?O:q)})})),f.jsx("div",{"data-slot":"carousel-live","aria-live":x.isRotating?"off":"polite","aria-atomic":"true",className:"sr-only",children:k}),c&&f.jsxs(f.Fragment,{children:[f.jsx("div",{"aria-hidden":"true","data-slot":"carousel-fade-start",className:w.cn(Te({orientation:d,edge:"start",visible:z}),v)}),f.jsx("div",{"aria-hidden":"true","data-slot":"carousel-fade-end",className:w.cn(Te({orientation:d,edge:"end",visible:F}),v)})]})]})}),Mt=a.forwardRef(function(e,t){var o=e,{className:r,inert:c}=o,v=W(o,["className","inert"]);const u=a.useContext(Me),p=a.useContext(ge),s=p==null?void 0:p.syncFadeInert,h=(p==null?void 0:p.transition)==="fade",b=!!c||c==="",d={[Le]:b||void 0};return a.useEffect(()=>{s==null||s()},[b,s]),f.jsx("div",S(A(S({ref:t,role:"group","aria-roledescription":"slide","aria-label":u?`${u.index+1} de ${u.total}`:void 0,"data-slot":"carousel-item"},d),{inert:c,className:w.cn("min-w-0 shrink-0 grow-0 basis-full",u==null?void 0:u.gapClassName,h&&yt,h&&(u==null?void 0:u.focusRingClassName),r)}),v))}),Ve=a.forwardRef(function(e,t){var o=e,{direction:r,variant:c="outlined",size:v="md",className:u,containerClassName:p,disabled:s,onClick:h}=o,b=W(o,["direction","variant","size","className","containerClassName","disabled","onClick"]);const{orientation:d,controls:R,controlsFrom:z,edgeBehavior:F,hideControlsWhenFits:k,isScrollable:x,canScrollPrev:P,canScrollNext:E,scrollFromArrow:M,previousButtonRef:q,nextButtonRef:O}=J(),V=r==="previous",H=V?P:E,Y=ot.useComposedRefs(t,V?q:O),re=F==="hide"&&!H||k&&!x,C=vt[d][r],j=U=>{h==null||h(U),!U.defaultPrevented&&M(r)};return f.jsx(ke.Button,S({ref:Y,"data-slot":`carousel-${r}`,variant:c,size:v,"aria-label":pt[r],iconLeft:f.jsx(C,{"aria-hidden":"true"}),disabled:s||!H,containerClassName:w.cn(bt({orientation:d,controls:R,direction:r,controlsFrom:z}),re&&"invisible",p),className:w.cn(xt({orientation:d,controls:R,direction:r,opaque:c==="outlined"}),u),onClick:j},b))}),qt=a.forwardRef(function(e,t){return f.jsx(Ve,S({ref:t,direction:"previous"},e))}),Dt=a.forwardRef(function(e,t){return f.jsx(Ve,S({ref:t,direction:"next"},e))}),$t=a.forwardRef(function(e,t){var o=e,{getDotLabel:r,dotClassName:c,indicatorClassName:v,className:u}=o,p=W(o,["getDotLabel","dotClassName","indicatorClassName","className"]);const{snapCount:s,snapFirstSlides:h,selectedIndex:b,isPaged:d,isScrollable:R,hideControlsWhenFits:z,scrollTo:F}=J();return f.jsx("div",A(S({ref:t,role:"group","aria-label":d?"Escolher p\xE1gina":"Escolher slide","data-slot":"carousel-dots",className:w.cn("mt-2 flex min-h-6 items-center justify-center",z&&!R&&"invisible",u)},p),{children:Array.from({length:s},(k,x)=>{var P;const E=x===b;return f.jsx("button",{type:"button","data-slot":"carousel-dot","data-active":E,"aria-label":r?r(x,s):Ot(d?x:(P=h[x])!=null?P:x,d),"aria-current":E||void 0,onClick:()=>F(x),className:w.cn(Ct,c),children:f.jsx("span",{"data-slot":"carousel-dot-indicator","data-active":E,className:w.cn(Nt,v)})},x)})}))}),Bt=a.forwardRef(function(e,t){var o=e,{variant:r="outlined",size:c="sm",containerClassName:v,onClick:u}=o,p=W(o,["variant","size","containerClassName","onClick"]);const{autoplay:s,isScrollable:h,hideControlsWhenFits:b}=J(),d=s.isPaused?B.Play:B.Pause,R=s.isPaused?"Iniciar rota\xE7\xE3o autom\xE1tica":"Pausar rota\xE7\xE3o autom\xE1tica",z=b&&!h,F=k=>{u==null||u(k),k.defaultPrevented||s.toggle()};return s.isEnabled?f.jsx(ke.Button,S({ref:t,"data-slot":"carousel-autoplay-toggle",variant:r,size:c,"aria-label":R,iconLeft:f.jsx(d,{"aria-hidden":"true"}),containerClassName:w.cn("relative z-10",z&&"invisible",v),onClick:F},p)):null});exports.Carousel=Lt,exports.CarouselAutoplayToggle=Bt,exports.CarouselContent=Tt,exports.CarouselDots=$t,exports.CarouselItem=Mt,exports.CarouselNext=Dt,exports.CarouselPrevious=qt,exports.useCarousel=St;
|
|
3
|
+
"use strict";var v=require("react/jsx-runtime"),dt=require("embla-carousel-autoplay"),ft=require("embla-carousel-fade"),vt=require("embla-carousel-wheel-gestures"),pt=require("embla-carousel-react"),J=require("class-variance-authority"),H=require("@medway-ui/icons"),r=require("react"),qe=require("./Button.js"),De=require("../hooks/use-composed-refs.js"),mt=require("../hooks/use-id.js"),gt=require("../hooks/use-prefers-reduced-motion.js"),w=require("../lib/utils.js"),bt=Object.defineProperty,ht=Object.defineProperties,xt=Object.getOwnPropertyDescriptors,se=Object.getOwnPropertySymbols,We=Object.prototype.hasOwnProperty,$e=Object.prototype.propertyIsEnumerable,Be=(e,t,o)=>t in e?bt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,R=(e,t)=>{for(var o in t||(t={}))We.call(t,o)&&Be(e,o,t[o]);if(se)for(var o of se(t))$e.call(t,o)&&Be(e,o,t[o]);return e},j=(e,t)=>ht(e,xt(t)),U=(e,t)=>{var o={};for(var i in e)We.call(e,i)&&t.indexOf(i)<0&&(o[i]=e[i]);if(e!=null&&se)for(var i of se(e))t.indexOf(i)<0&&$e.call(e,i)&&(o[i]=e[i]);return o};const yt=5e3,Ve="data-consumer-inert",St={selectedIndex:0,snapCount:0,canScrollPrev:!1,canScrollNext:!1,slideCount:0,snapFirstSlides:[],announcement:""},Ct={horizontal:{ArrowLeft:"previous",ArrowRight:"next"},vertical:{ArrowUp:"previous",ArrowDown:"next"}},Nt={Home:"first",End:"last"},Rt=["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(","),wt="focus:outline-0 focus-visible:ring-4 focus-visible:ring-state-focus",Et=["TEXTAREA","SELECT","VIDEO","AUDIO"],It=["button","checkbox","color","file","image","reset","submit"],Pt=["combobox","grid","listbox","menu","menubar","radiogroup","searchbox","slider","spinbutton","tablist","textbox","toolbar","tree","treegrid"],zt={horizontal:{previous:H.ArrowLeftMd,next:H.ArrowRightMd},vertical:{previous:H.ArrowUpMd,next:H.ArrowDownMd}},Ft={previous:"Anterior",next:"Pr\xF3ximo"},kt={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"}}},_=["side","floating","outside"],jt=J.cva("relative",{variants:{orientation:{horizontal:"",vertical:""},controls:{side:"",floating:"",outside:"",inline:""}},compoundVariants:[{orientation:"horizontal",controls:_,class:"grid grid-flow-row-dense grid-cols-[auto_minmax(0,1fr)_auto] items-center [&>*]:col-span-full"},{orientation:"vertical",controls:_,class:"flex flex-col"}]}),Lt=J.cva("relative overflow-hidden",{variants:{orientation:{horizontal:"",vertical:""},controls:{side:"",floating:"",outside:"",inline:""}},compoundVariants:[{orientation:"horizontal",controls:_,class:"!col-start-2 !col-span-1 min-w-0"}]}),At=J.cva("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:_,direction:"previous",class:"!col-start-1 !col-span-1"},{orientation:"horizontal",controls:_,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:_,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=J.cva("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"}]}),Ke=J.cva("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"}]}),Ot="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",Tt="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",qt="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",xe=r.createContext(null),He=r.createContext(null);function X(){const e=r.useContext(xe);if(!e)throw new Error("useCarousel must be used within a Carousel component.");return e}function Dt(){const{selectedIndex:e,snapCount:t,canScrollPrev:o,canScrollNext:i,isScrollable:u,scrollPrev:p,scrollNext:f,scrollTo:m,autoplay:c}=X();return r.useMemo(()=>({selectedIndex:e,snapCount:t,canScrollPrev:o,canScrollNext:i,isScrollable:u,scrollPrev:p,scrollNext:f,scrollTo:m,autoplay:c}),[e,t,o,i,u,p,f,m,c])}function Wt(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 i;return(i=t[0])!=null?i:o})}}function $t(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,i)=>o===t.snapFirstSlides[i])&&e.announcement===t.announcement}function Bt(e,t){const o=Object.keys(e);return o.length===Object.keys(t).length&&o.every(i=>Object.is(e[i],t[i]))}function Ue(e,t){return Number.isFinite(e)&&e>=1?Math.trunc(e):t}function ye(e){if(!(e===void 0||!Number.isFinite(e)))return Math.max(0,Math.trunc(e))}function _e(e,t=""){return r.Children.toArray(e).flatMap(o=>{var i;if(!r.isValidElement(o))return[];const u=`${t}${(i=o.key)!=null?i:""}`;return o.type===r.Fragment?_e(o.props.children,`${u}/`):[r.cloneElement(o,{key:u})]})}function Vt(e,t,o){const i=document.activeElement;return i===o&&!e.canScrollNext&&e.canScrollPrev?"previous":i===t&&!e.canScrollPrev&&e.canScrollNext?"next":null}function Kt(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 Ht(e,t){var o;return e instanceof HTMLElement&&e.isContentEditable||e instanceof HTMLInputElement&&!It.includes(e.type)||Et.includes(e.tagName)||Pt.includes((o=e.getAttribute("role"))!=null?o:"")||Kt(e,t)}function Ut(e,t){const o=e.nativeEvent.composedPath();return o.slice(0,o.indexOf(e.currentTarget)).some(i=>i instanceof Element&&Ht(i,t))}function _t(e){try{return e.matches(":focus-visible")}catch(t){return!1}}function Ge(e){var t;return(t=e.internalEngine().slideRegistry[e.selectedScrollSnap()])!=null?t:[]}function Qe(e){return e.hasAttribute(Ve)}function Ze(e){e.getAttribute("tabindex")==="-1"&&e.removeAttribute("tabindex")}function Se(e){var t,o;(o=(t=e.plugins())==null?void 0:t.autoplay)==null||o.reset()}function Gt(e){const t=typeof e=="object"?e.delay:void 0;return t!==void 0&&Number.isFinite(t)&&t>0?t:yt}function Je(e,t){return e==="page"?t.snapCount!==t.slideCount:Ue(e,1)>1}function Qt(e,t){var o;const i=e.slideNodes().length;if(i===0)return"";const u=e.selectedScrollSnap();return t?`P\xE1gina ${u+1} de ${e.scrollSnapList().length}`:`Slide ${((o=Ge(e)[0])!=null?o:u)+1} de ${i}`}function Zt(e,t){return t?`Ir para a p\xE1gina ${e+1}`:`Ir para o slide ${e+1}`}const Jt=r.forwardRef(function(e,t){const o=e,{orientation:i="horizontal",align:u="start",step:p=1,loop:f=!1,dragFree:m=!1,transition:c="slide",autoplay:g=!1,controls:C="side",controlsFrom:y="always",edgeBehavior:S="disable",hideControlsWhenFits:P=!0,wheelGestures:z=!1,index:F,defaultIndex:W,onIndexChange:N,setApi:k,opts:E,className:$,children:O,onKeyDown:T,onFocus:L,onPointerEnter:A,onPointerLeave:Y,tabIndex:ee}=o,ce=U(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"]),ue=mt.useId(),[G,Ye]=r.useState(),Ce=G!=null?G:ue,I=gt.usePrefersReducedMotion(),B=g!==!1,Ne=Gt(g),q=ye(F),[de]=r.useState(()=>{var n;return(n=q!=null?q:ye(W))!=null?n:0}),et=r.useMemo(()=>{const n=[];if(B&&n.push(dt({delay:Ne,playOnInit:!1,stopOnInteraction:!0,stopOnFocusIn:!1,stopOnMouseEnter:!1})),c==="fade"&&n.push(ft()),z){const a=vt.WheelGesturesPlugin();n.push(j(R({},a),{init(s,b){s.scrollSnapList().length>1&&s.internalEngine().options.watchDrag!==!1&&a.init(s,b)}}))}return n},[B,Ne,c,z]),[Re,l]=pt(j(R({containScroll:"trimSnaps"},E),{axis:i==="horizontal"?"x":"y",align:u,loop:f,dragFree:m,slidesToScroll:p==="page"?"auto":Ue(p,1),startIndex:de}),et),[Q,tt]=r.useState(()=>j(R({},St),{selectedIndex:de})),[fe,we]=r.useState(null),[nt,Ee]=r.useState(!1),[ot,rt]=r.useState(!0),Ie=r.useRef(null),it=De.useComposedRefs(t,Ie),te=r.useRef(null),ne=r.useRef(null),ve=r.useRef(null),pe=r.useRef(!1),D=r.useRef(de),me=r.useRef(N),Pe=r.useRef(p),ze=r.useRef(null),oe=r.useRef(null),M=Q.snapCount>1,Fe=Je(p,Q),Z=fe?fe==="paused":I,V=B&&M&&!Z&&!nt,ke=r.useRef(V),re=r.useRef(null),je=r.useRef(I),ie=r.useCallback(()=>{l&&(l.scrollPrev(I),Se(l))},[l,I]),le=r.useCallback(()=>{l&&(l.scrollNext(I),Se(l))},[l,I]),ae=r.useCallback(n=>{if(!l)return;const a=n!==l.selectedScrollSnap();l.scrollTo(n,I),a&&Se(l)},[l,I]),ge=r.useCallback(n=>{pe.current=!0;try{n()}finally{pe.current=!1}},[]),be=r.useCallback(n=>ge(n==="previous"?ie:le),[ge,ie,le]),Le=r.useCallback(()=>{var n;return(n=re.current)==null?void 0:n.call(re)},[]),Ae=r.useCallback(()=>we(Z?"playing":"paused"),[Z]),lt=n=>{T==null||T(n);const a=Ct[i][n.key],s=Nt[n.key];if(!(!a&&!s||n.defaultPrevented)&&!(n.altKey||n.ctrlKey||n.metaKey||n.shiftKey)&&n.currentTarget.contains(n.target)&&!Ut(n,i)){if(s){const b=n.target===n.currentTarget||n.target===te.current||n.target===ne.current;if(!l||!M||!b)return;const h=s==="first"?0:l.scrollSnapList().length-1;n.preventDefault(),ge(()=>ae(h));return}a&&(n.preventDefault(),be(a))}},at=n=>{L==null||L(n),!(!B||fe==="playing")&&_t(n.target)&&we("paused")},st=n=>{A==null||A(n),n.pointerType==="mouse"&&Ee(!0)},ct=n=>{Y==null||Y(n),n.pointerType==="mouse"&&Ee(!1)},Me=r.useMemo(()=>({isEnabled:B,isPaused:Z,isRotating:V,toggle:Ae}),[B,Z,V,Ae]),ut=r.useMemo(()=>j(R({},Q),{orientation:i,transition:c,controls:C,controlsFrom:y,edgeBehavior:S,hideControlsWhenFits:P,isPaged:Fe,isScrollable:M,contentId:Ce,setContentId:Ye,viewportRef:Re,previousButtonRef:te,nextButtonRef:ne,scrollPrev:ie,scrollNext:le,scrollTo:ae,scrollFromArrow:be,syncFadeInert:Le,autoplay:Me}),[Q,i,c,C,y,S,P,Fe,M,Ce,Re,ie,le,ae,be,Le,Me]);return r.useEffect(()=>{me.current=N,Pe.current=p,ke.current=V,je.current=I}),r.useEffect(()=>{l&&k&&k(l)},[l,k]),r.useEffect(()=>{if(!l)return;let n=!1;const a=(h,d)=>{const x=Wt(l),K=d==="select"&&n;K&&(n=!1);const Oe=d!=="select"?void 0:K?"":Qt(l,Je(Pe.current,x));ve.current=pe.current?Vt(x,te.current,ne.current):null,tt(he=>{const Te=j(R({},x),{announcement:Oe!=null?Oe:he.announcement});return $t(he,Te)?he:Te})},s=()=>{const h=oe.current,d=h!==null&&h<l.scrollSnapList().length;d&&(oe.current=null,D.current=h);const x=D.current;if(l.selectedScrollSnap()!==x){n=!d;try{l.scrollTo(x,!0)}finally{n=!1}}},b=()=>{var h;const d=l.selectedScrollSnap();d!==D.current&&(D.current=d,(h=me.current)==null||h.call(me,d))};return D.current=l.selectedScrollSnap(),a(),l.on("reInit",s).on("select",a).on("reInit",a).on("select",b).on("reInit",b),()=>{l.off("reInit",s).off("select",a).off("reInit",a).off("select",b).off("reInit",b)}},[l]),r.useEffect(()=>{const n=Ie.current;if(!n||!M)return;const a=n.ownerDocument.defaultView,s=()=>{const h=n.querySelectorAll(Rt);rt(Array.from(h).some(d=>!(d.hasAttribute("tabindex")&&d.tabIndex<0)&&!d.matches(":disabled")&&!d.closest("[hidden], [inert]")&&d.getClientRects().length>0&&getComputedStyle(d).visibility==="visible"))};s();const b=new MutationObserver(s);return b.observe(n,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["class","style","hidden","inert","disabled","href","type","tabindex","contenteditable","controls","open"]}),a==null||a.addEventListener("resize",s),()=>{b.disconnect(),a==null||a.removeEventListener("resize",s)}},[M]),r.useEffect(()=>{var n;const a=ve.current;a&&(ve.current=null,(n=(a==="previous"?te:ne).current)==null||n.focus({preventScroll:!0}))},[Q]),r.useEffect(()=>{const n=ze.current;if(!l||n&&Bt(n,e))return;if(ze.current=e,q===void 0){oe.current=null;return}const a=l.selectedScrollSnap(),s=q===ye(n==null?void 0:n.index);if(a!==D.current&&s)return;const b=Math.max(0,l.scrollSnapList().length-1);oe.current=q>b?q:null;const h=Math.min(q,b);h!==a&&(D.current=h,ae(h))}),r.useEffect(()=>{if(!l||c!=="fade")return;const n=new Set,a=()=>{const s=l.slideNodes(),b=new Set(Ge(l)),h=s.some((x,K)=>!b.has(K)&&x.contains(document.activeElement));s.forEach((x,K)=>{x.inert=!b.has(K)||Qe(x),x.inert&&n.has(x)&&(Ze(x),n.delete(x))});const d=h?s.find(x=>!x.inert):void 0;d&&(d.hasAttribute("tabindex")||(d.tabIndex=-1,n.add(d)),d.focus({preventScroll:!0}))};return re.current=a,a(),l.on("select",a).on("reInit",a),()=>{re.current=null,l.off("select",a).off("reInit",a);for(const s of l.slideNodes())s.inert=Qe(s);n.forEach(Ze)}},[l,c]),r.useEffect(()=>{var n;const a=(n=l==null?void 0:l.plugins())==null?void 0:n.autoplay;a&&(V?a.play(I):a.stop())},[l,V,I]),r.useEffect(()=>{if(!l)return;const n=()=>{var a,s;ke.current&&((s=(a=l.plugins())==null?void 0:a.autoplay)==null||s.play(je.current))};return l.on("pointerUp",n).on("reInit",n),()=>{l.off("pointerUp",n).off("reInit",n)}},[l]),v.jsx(xe.Provider,{value:ut,children:v.jsx("div",j(R({ref:it,role:"region","aria-roledescription":"carousel","data-slot":"carousel","data-orientation":i,"data-scrollable":M,tabIndex:ee!=null?ee:M&&!ot?0:void 0,className:w.cn(jt({orientation:i,controls:C}),wt,$),onKeyDown:lt,onFocus:at,onPointerEnter:st,onPointerLeave:ct},ce),{children:O}))})}),Xt=r.forwardRef(function(e,t){var o=e,{gap:i="md",fadeEdges:u=!1,fadeClassName:p,viewportClassName:f,className:m,children:c,id:g}=o,C=U(o,["gap","fadeEdges","fadeClassName","viewportClassName","className","children","id"]);const{viewportRef:y,orientation:S,controls:P,canScrollPrev:z,canScrollNext:F,announcement:W,autoplay:N,contentId:k,setContentId:E}=X();r.useLayoutEffect(()=>(E(g),()=>E(void 0)),[g,E]);const $=_e(c),O=kt[i][S];return v.jsxs("div",{ref:y,"data-slot":"carousel-viewport",className:w.cn(Lt({orientation:S,controls:P}),f),children:[v.jsx("div",j(R({ref:t,id:g!=null?g:k,"data-slot":"carousel-content",className:w.cn("flex touch-pinch-zoom",S==="horizontal"?"touch-pan-y":"touch-pan-x flex-col",O.content,m)},C),{children:$.map((T,L)=>{var A;return v.jsx(He.Provider,{value:{index:L,total:$.length,gapClassName:O.item,focusRingClassName:O.focusRing},children:T},(A=T.key)!=null?A:L)})})),v.jsx("div",{"data-slot":"carousel-live","aria-live":N.isRotating?"off":"polite","aria-atomic":"true",className:"sr-only",children:W}),u&&v.jsxs(v.Fragment,{children:[v.jsx("div",{"aria-hidden":"true","data-slot":"carousel-fade-start",className:w.cn(Ke({orientation:S,edge:"start",visible:z}),p)}),v.jsx("div",{"aria-hidden":"true","data-slot":"carousel-fade-end",className:w.cn(Ke({orientation:S,edge:"end",visible:F}),p)})]})]})}),Yt=r.forwardRef(function(e,t){var o=e,{className:i,inert:u}=o,p=U(o,["className","inert"]);const f=r.useContext(He),m=r.useContext(xe),c=m==null?void 0:m.syncFadeInert,g=(m==null?void 0:m.transition)==="fade",C=!!u||u==="",y={[Ve]:C||void 0};return r.useEffect(()=>{c==null||c()},[C,c]),v.jsx("div",R(j(R({ref:t,role:"group","aria-roledescription":"slide","aria-label":f?`${f.index+1} de ${f.total}`:void 0,"data-slot":"carousel-item"},y),{inert:u,className:w.cn("min-w-0 shrink-0 grow-0 basis-full",f==null?void 0:f.gapClassName,g&&Ot,g&&(f==null?void 0:f.focusRingClassName),i)}),p))}),Xe=r.forwardRef(function(e,t){var o=e,{direction:i,variant:u="outlined",size:p="md",className:f,containerClassName:m,disabled:c,onClick:g}=o,C=U(o,["direction","variant","size","className","containerClassName","disabled","onClick"]);const{orientation:y,controls:S,controlsFrom:P,edgeBehavior:z,hideControlsWhenFits:F,isScrollable:W,canScrollPrev:N,canScrollNext:k,scrollFromArrow:E,previousButtonRef:$,nextButtonRef:O,contentId:T}=X(),L=i==="previous",A=L?N:k,Y=De.useComposedRefs(t,L?$:O),ee=z==="hide"&&!A||F&&!W,ce=zt[y][i],ue=G=>{g==null||g(G),!G.defaultPrevented&&E(i)};return v.jsx(qe.Button,R({ref:Y,"data-slot":`carousel-${i}`,variant:u,size:p,"aria-label":Ft[i],"aria-controls":T,iconLeft:v.jsx(ce,{"aria-hidden":"true"}),disabled:c||!A,containerClassName:w.cn(At({orientation:y,controls:S,direction:i,controlsFrom:P}),ee&&"invisible",m),className:w.cn(Mt({orientation:y,controls:S,direction:i,opaque:u==="outlined"}),f),onClick:ue},C))}),en=r.forwardRef(function(e,t){return v.jsx(Xe,R({ref:t,direction:"previous"},e))}),tn=r.forwardRef(function(e,t){return v.jsx(Xe,R({ref:t,direction:"next"},e))}),nn=r.forwardRef(function(e,t){var o=e,{getDotLabel:i,dotClassName:u,indicatorClassName:p,className:f}=o,m=U(o,["getDotLabel","dotClassName","indicatorClassName","className"]);const{snapCount:c,snapFirstSlides:g,selectedIndex:C,isPaged:y,isScrollable:S,hideControlsWhenFits:P,scrollTo:z,contentId:F}=X();return v.jsx("div",j(R({ref:t,role:"group","aria-label":y?"Escolher p\xE1gina":"Escolher slide","data-slot":"carousel-dots",className:w.cn("mt-2 flex min-h-6 items-center justify-center",P&&!S&&"invisible",f)},m),{children:Array.from({length:c},(W,N)=>{var k;const E=N===C;return v.jsx("button",{type:"button","data-slot":"carousel-dot","data-active":E,"aria-label":i?i(N,c):Zt(y?N:(k=g[N])!=null?k:N,y),"aria-current":E||void 0,"aria-controls":F,onClick:()=>z(N),className:w.cn(Tt,u),children:v.jsx("span",{"data-slot":"carousel-dot-indicator","data-active":E,className:w.cn(qt,p)})},N)})}))}),on=r.forwardRef(function(e,t){var o=e,{variant:i="outlined",size:u="sm",containerClassName:p,onClick:f}=o,m=U(o,["variant","size","containerClassName","onClick"]);const{autoplay:c,isScrollable:g,hideControlsWhenFits:C}=X(),y=c.isPaused?H.Play:H.Pause,S=c.isPaused?"Iniciar rota\xE7\xE3o autom\xE1tica":"Pausar rota\xE7\xE3o autom\xE1tica",P=C&&!g,z=F=>{f==null||f(F),F.defaultPrevented||c.toggle()};return c.isEnabled?v.jsx(qe.Button,R({ref:t,"data-slot":"carousel-autoplay-toggle",variant:i,size:u,"aria-label":S,iconLeft:v.jsx(y,{"aria-hidden":"true"}),containerClassName:w.cn("relative z-10",P&&"invisible",p),onClick:z},m)):null});exports.Carousel=Jt,exports.CarouselAutoplayToggle=on,exports.CarouselContent=Xt,exports.CarouselDots=nn,exports.CarouselItem=Yt,exports.CarouselNext=tn,exports.CarouselPrevious=en,exports.useCarousel=Dt;
|
|
@@ -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
|
-
"use strict";var r=require("react/jsx-runtime"),
|
|
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
|
|
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"),
|
|
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
|
|
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};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medway-ui/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.47.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Biblioteca de componentes e assets para o sistema Medway",
|
|
6
6
|
"author": "Alekcarvalho",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"embla-carousel-autoplay": "8.6.0",
|
|
39
39
|
"embla-carousel-fade": "8.6.0",
|
|
40
40
|
"embla-carousel-react": "8.6.0",
|
|
41
|
+
"embla-carousel-wheel-gestures": "8.1.0",
|
|
41
42
|
"radix-ui": "^1.4.3",
|
|
42
43
|
"tailwind-merge": "^3.2.0",
|
|
43
44
|
"use-sync-external-store": "^1.5.0"
|