@medway-ui/core 1.33.0 → 1.33.1
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 +1 -1
- package/COMPONENTS_SUMMARY.md +1 -1
- package/dist/COMPONENTS.md +1 -1
- package/dist/COMPONENTS_SUMMARY.md +1 -1
- package/dist/components/Carousel.js +1 -1
- package/dist/components/Carousel.mjs +1 -1
- package/dist/components/Chip.js +1 -1
- package/dist/components/Chip.mjs +1 -1
- package/dist/components/Select.d.mts.map +1 -1
- package/dist/components/Select.d.ts.map +1 -1
- package/dist/components/Select.js +1 -1
- package/dist/components/Select.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.33.
|
|
4
|
+
> Package `@medway-ui/core` · v1.33.1 · Generated 2026-10-16
|
|
5
5
|
|
|
6
6
|
All components require React 18+ and are client components (`"use client"`).
|
|
7
7
|
|
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.33.
|
|
4
|
+
> Package `@medway-ui/core` · v1.33.1 · Generated 2026-10-16
|
|
5
5
|
|
|
6
6
|
All components require React 18+ and are client components (`"use client"`).
|
|
7
7
|
|
|
@@ -1,4 +1,4 @@
|
|
|
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"),nt=require("../hooks/use-composed-refs.js"),ot=require("../hooks/use-prefers-reduced-motion.js"),w=require("../lib/utils.js"),rt=Object.defineProperty,at=Object.defineProperties,lt=Object.getOwnPropertyDescriptors,oe=Object.getOwnPropertySymbols,je=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable,Oe=(e,t,n)=>t in e?rt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,S=(e,t)=>{for(var n in t||(t={}))je.call(t,n)&&Oe(e,n,t[n]);if(oe)for(var n of oe(t))Ae.call(t,n)&&Oe(e,n,t[n]);return e},A=(e,t)=>at(e,lt(t)),W=(e,t)=>{var n={};for(var r in e)je.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&oe)for(var r of oe(e))t.indexOf(r)<0&&Ae.call(e,r)&&(n[r]=e[r]);return n};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-[2] 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-[1]"},{orientation:"horizontal",controls:K,direction:"next",class:"!col-[3]"},{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",{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-[3px] 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:n,canScrollNext:r,isScrollable:c,scrollPrev:v,scrollNext:u,scrollTo:p,autoplay:s}=J();return a.useMemo(()=>({selectedIndex:e,snapCount:t,canScrollPrev:n,canScrollNext:r,isScrollable:c,scrollPrev:v,scrollNext:u,scrollTo:p,autoplay:s}),[e,t,n,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,n)=>{var r;return(r=t[0])!=null?r:n})}}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((n,r)=>n===t.snapFirstSlides[r])&&e.announcement===t.announcement}function Pt(e,t){const n=Object.keys(e);return n.length===Object.keys(t).length&&n.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(n=>{var r;if(!a.isValidElement(n))return[];const c=`${t}${(r=n.key)!=null?r:""}`;return n.type===a.Fragment?De(n.props.children,`${c}/`):[a.cloneElement(n,{key:c})]})}function Et(e,t,n){const r=document.activeElement;return r===n&&!e.canScrollNext&&e.canScrollPrev?"previous":r===t&&!e.canScrollPrev&&e.canScrollNext?"next":null}function zt(e,t){const n=getComputedStyle(e);return t==="horizontal"?/auto|scroll/.test(n.overflowX)&&e.scrollWidth>e.clientWidth:/auto|scroll/.test(n.overflowY)&&e.scrollHeight>e.clientHeight}function It(e,t){var n;return e instanceof HTMLElement&&e.isContentEditable||e instanceof HTMLInputElement&&!dt.includes(e.type)||ut.includes(e.tagName)||ft.includes((n=e.getAttribute("role"))!=null?n:"")||zt(e,t)}function Ft(e,t){const n=e.nativeEvent.composedPath();return n.slice(0,n.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,n;(n=(t=e.plugins())==null?void 0:t.autoplay)==null||n.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 n;const r=e.slideNodes().length;if(r===0)return"";const c=e.selectedScrollSnap();return t?`P\xE1gina ${c+1} de ${e.scrollSnapList().length}`:`Slide ${((n=$e(e)[0])!=null?n: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 n=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}=n,re=W(n,["orientation","align","step","loop","dragFree","transition","autoplay","controls","controlsFrom","edgeBehavior","hideControlsWhenFits","index","defaultIndex","onIndexChange","setApi","opts","className","children","onKeyDown","onFocus","onPointerEnter","onPointerLeave"]),C=ot.usePrefersReducedMotion(),j=h!==!1,U=jt(h),L=me(F),[ae]=a.useState(()=>{var o;return(o=L!=null?L:me(k))!=null?o:0}),He=a.useMemo(()=>{const o=[];return j&&o.push(Qe({delay:U,playOnInit:!1,stopOnInteraction:!0,stopOnFocusIn:!1,stopOnMouseEnter:!1})),s==="fade"&&o.push(et()),o},[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]),ne=a.useCallback(()=>{l&&(l.scrollNext(C),he(l))},[l,C]),fe=a.useCallback(o=>{if(!l)return;const i=o!==l.selectedScrollSnap();l.scrollTo(o,C),i&&he(l)},[l,C]),ve=a.useCallback(o=>{ue.current=!0;try{o==="previous"?te():ne()}finally{ue.current=!1}},[te,ne]),Pe=a.useCallback(()=>{var o;return(o=ee.current)==null?void 0:o.call(ee)},[]),Ee=a.useCallback(()=>xe(X?"playing":"paused"),[X]),Xe=o=>{O==null||O(o);const i=ct[r][o.key];!i||o.defaultPrevented||o.altKey||o.ctrlKey||o.metaKey||o.shiftKey||o.currentTarget.contains(o.target)&&(Ft(o,r)||(o.preventDefault(),ve(i)))},Ge=o=>{V==null||V(o),!(!j||le==="playing")&&kt(o.target)&&xe("paused")},Je=o=>{H==null||H(o),o.pointerType==="mouse"&&ye(!0)},Ye=o=>{Y==null||Y(o),o.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:ne,scrollTo:fe,scrollFromArrow:ve,syncFadeInert:Pe,autoplay:ze}),[_,r,s,b,d,R,z,Se,Q,be,te,ne,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 o=!1;const i=(N,m)=>{const g=wt(l),$=m==="select"&&o;$&&(o=!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){o=!m;try{l.scrollTo(g,!0)}finally{o=!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 o;const i=ce.current;i&&(ce.current=null,(o=(i==="previous"?ie:se).current)==null||o.focus({preventScroll:!0}))},[_]),a.useEffect(()=>{const o=Ne.current;if(!l||o&&Pt(o,e))return;if(Ne.current=e,L===void 0){Z.current=null;return}const i=l.selectedScrollSnap(),y=L===me(o==null?void 0:o.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 o=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&&o.has(g)&&(We(g),o.delete(g))});const m=N?y.find(g=>!g.inert):void 0;m&&(m.hasAttribute("tabindex")||(m.tabIndex=-1,o.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);o.forEach(We)}},[l,s]),a.useEffect(()=>{var o;const i=(o=l==null?void 0:l.plugins())==null?void 0:o.autoplay;i&&(D?i.play(C):i.stop())},[l,D,C]),a.useEffect(()=>{if(!l)return;const o=()=>{var i,y;we.current&&((y=(i=l.plugins())==null?void 0:i.autoplay)==null||y.play(Re.current))};return l.on("pointerUp",o).on("reInit",o),()=>{l.off("pointerUp",o).off("reInit",o)}},[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 n=e,{gap:r="md",fadeEdges:c=!1,fadeClassName:v,viewportClassName:u,className:p,children:s}=n,h=W(n,["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 n=e,{className:r,inert:c}=n,v=W(n,["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 n=e,{direction:r,variant:c="outlined",size:v="md",className:u,containerClassName:p,disabled:s,onClick:h}=n,b=W(n,["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=nt.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 n=e,{getDotLabel:r,dotClassName:c,indicatorClassName:v,className:u}=n,p=W(n,["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 n=e,{variant:r="outlined",size:c="sm",containerClassName:v,onClick:u}=n,p=W(n,["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 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"),nt=require("../hooks/use-composed-refs.js"),ot=require("../hooks/use-prefers-reduced-motion.js"),w=require("../lib/utils.js"),rt=Object.defineProperty,at=Object.defineProperties,lt=Object.getOwnPropertyDescriptors,oe=Object.getOwnPropertySymbols,je=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable,Oe=(e,t,n)=>t in e?rt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,S=(e,t)=>{for(var n in t||(t={}))je.call(t,n)&&Oe(e,n,t[n]);if(oe)for(var n of oe(t))Ae.call(t,n)&&Oe(e,n,t[n]);return e},A=(e,t)=>at(e,lt(t)),W=(e,t)=>{var n={};for(var r in e)je.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&oe)for(var r of oe(e))t.indexOf(r)<0&&Ae.call(e,r)&&(n[r]=e[r]);return n};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",{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-[3px] 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:n,canScrollNext:r,isScrollable:c,scrollPrev:v,scrollNext:u,scrollTo:p,autoplay:s}=J();return a.useMemo(()=>({selectedIndex:e,snapCount:t,canScrollPrev:n,canScrollNext:r,isScrollable:c,scrollPrev:v,scrollNext:u,scrollTo:p,autoplay:s}),[e,t,n,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,n)=>{var r;return(r=t[0])!=null?r:n})}}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((n,r)=>n===t.snapFirstSlides[r])&&e.announcement===t.announcement}function Pt(e,t){const n=Object.keys(e);return n.length===Object.keys(t).length&&n.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(n=>{var r;if(!a.isValidElement(n))return[];const c=`${t}${(r=n.key)!=null?r:""}`;return n.type===a.Fragment?De(n.props.children,`${c}/`):[a.cloneElement(n,{key:c})]})}function Et(e,t,n){const r=document.activeElement;return r===n&&!e.canScrollNext&&e.canScrollPrev?"previous":r===t&&!e.canScrollPrev&&e.canScrollNext?"next":null}function zt(e,t){const n=getComputedStyle(e);return t==="horizontal"?/auto|scroll/.test(n.overflowX)&&e.scrollWidth>e.clientWidth:/auto|scroll/.test(n.overflowY)&&e.scrollHeight>e.clientHeight}function It(e,t){var n;return e instanceof HTMLElement&&e.isContentEditable||e instanceof HTMLInputElement&&!dt.includes(e.type)||ut.includes(e.tagName)||ft.includes((n=e.getAttribute("role"))!=null?n:"")||zt(e,t)}function Ft(e,t){const n=e.nativeEvent.composedPath();return n.slice(0,n.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,n;(n=(t=e.plugins())==null?void 0:t.autoplay)==null||n.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 n;const r=e.slideNodes().length;if(r===0)return"";const c=e.selectedScrollSnap();return t?`P\xE1gina ${c+1} de ${e.scrollSnapList().length}`:`Slide ${((n=$e(e)[0])!=null?n: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 n=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}=n,re=W(n,["orientation","align","step","loop","dragFree","transition","autoplay","controls","controlsFrom","edgeBehavior","hideControlsWhenFits","index","defaultIndex","onIndexChange","setApi","opts","className","children","onKeyDown","onFocus","onPointerEnter","onPointerLeave"]),C=ot.usePrefersReducedMotion(),j=h!==!1,U=jt(h),L=me(F),[ae]=a.useState(()=>{var o;return(o=L!=null?L:me(k))!=null?o:0}),He=a.useMemo(()=>{const o=[];return j&&o.push(Qe({delay:U,playOnInit:!1,stopOnInteraction:!0,stopOnFocusIn:!1,stopOnMouseEnter:!1})),s==="fade"&&o.push(et()),o},[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]),ne=a.useCallback(()=>{l&&(l.scrollNext(C),he(l))},[l,C]),fe=a.useCallback(o=>{if(!l)return;const i=o!==l.selectedScrollSnap();l.scrollTo(o,C),i&&he(l)},[l,C]),ve=a.useCallback(o=>{ue.current=!0;try{o==="previous"?te():ne()}finally{ue.current=!1}},[te,ne]),Pe=a.useCallback(()=>{var o;return(o=ee.current)==null?void 0:o.call(ee)},[]),Ee=a.useCallback(()=>xe(X?"playing":"paused"),[X]),Xe=o=>{O==null||O(o);const i=ct[r][o.key];!i||o.defaultPrevented||o.altKey||o.ctrlKey||o.metaKey||o.shiftKey||o.currentTarget.contains(o.target)&&(Ft(o,r)||(o.preventDefault(),ve(i)))},Ge=o=>{V==null||V(o),!(!j||le==="playing")&&kt(o.target)&&xe("paused")},Je=o=>{H==null||H(o),o.pointerType==="mouse"&&ye(!0)},Ye=o=>{Y==null||Y(o),o.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:ne,scrollTo:fe,scrollFromArrow:ve,syncFadeInert:Pe,autoplay:ze}),[_,r,s,b,d,R,z,Se,Q,be,te,ne,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 o=!1;const i=(N,m)=>{const g=wt(l),$=m==="select"&&o;$&&(o=!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){o=!m;try{l.scrollTo(g,!0)}finally{o=!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 o;const i=ce.current;i&&(ce.current=null,(o=(i==="previous"?ie:se).current)==null||o.focus({preventScroll:!0}))},[_]),a.useEffect(()=>{const o=Ne.current;if(!l||o&&Pt(o,e))return;if(Ne.current=e,L===void 0){Z.current=null;return}const i=l.selectedScrollSnap(),y=L===me(o==null?void 0:o.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 o=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&&o.has(g)&&(We(g),o.delete(g))});const m=N?y.find(g=>!g.inert):void 0;m&&(m.hasAttribute("tabindex")||(m.tabIndex=-1,o.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);o.forEach(We)}},[l,s]),a.useEffect(()=>{var o;const i=(o=l==null?void 0:l.plugins())==null?void 0:o.autoplay;i&&(D?i.play(C):i.stop())},[l,D,C]),a.useEffect(()=>{if(!l)return;const o=()=>{var i,y;we.current&&((y=(i=l.plugins())==null?void 0:i.autoplay)==null||y.play(Re.current))};return l.on("pointerUp",o).on("reInit",o),()=>{l.off("pointerUp",o).off("reInit",o)}},[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 n=e,{gap:r="md",fadeEdges:c=!1,fadeClassName:v,viewportClassName:u,className:p,children:s}=n,h=W(n,["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 n=e,{className:r,inert:c}=n,v=W(n,["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 n=e,{direction:r,variant:c="outlined",size:v="md",className:u,containerClassName:p,disabled:s,onClick:h}=n,b=W(n,["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=nt.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 n=e,{getDotLabel:r,dotClassName:c,indicatorClassName:v,className:u}=n,p=W(n,["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 n=e,{variant:r="outlined",size:c="sm",containerClassName:v,onClick:u}=n,p=W(n,["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;
|
|
4
4
|
//# sourceMappingURL=Carousel.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
|
-
import{jsx as v,jsxs as De,Fragment as lt}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 ie,useMemo as le,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,Be=Object.prototype.propertyIsEnumerable,Ke=(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)&&Ke(e,o,t[o]);if(ae)for(var o of ae(t))Be.call(t,o)&&Ke(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&&Be.call(e,r)&&(o[r]=e[r]);return o};const wt=5e3,We="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-[2] 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-[1]"},{orientation:"horizontal",controls:q,direction:"next",class:"!col-[3]"},{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",{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-[3px] focus-visible:ring-state-focus",Bt="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 Kt(){const{selectedIndex:e,snapCount:t,canScrollPrev:o,canScrollNext:r,isScrollable:s,scrollPrev:d,scrollNext:c,scrollTo:f,autoplay:a}=Z();return le(()=>({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 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 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(We)}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:B,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]=ie(()=>{var n;return(n=M!=null?M:Ce(k))!=null?n:0}),Ze=le(()=>{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,i]=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]=ie(()=>T(N({},zt),{selectedIndex:ce})),[ue,Pe]=ie(null),[et,we]=ie(!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,K=A&&te&&!J&&!et,Fe=S(K),oe=S(null),Re=S(y),ne=H(()=>{i&&(i.scrollPrev(y),Ne(i))},[i,y]),re=H(()=>{i&&(i.scrollNext(y),Ne(i))},[i,y]),ge=H(n=>{if(!i)return;const l=n!==i.selectedScrollSnap();i.scrollTo(n,y),l&&Ne(i)},[i,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 l=It[r][n.key];!l||n.defaultPrevented||n.altKey||n.ctrlKey||n.metaKey||n.shiftKey||n.currentTarget.contains(n.target)&&(Xt(n,r)||(n.preventDefault(),he(l)))},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=le(()=>({isEnabled:A,isPaused:J,isRotating:K,toggle:Oe}),[A,J,K,Oe]),it=le(()=>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=K,Re.current=y}),O(()=>{i&&z&&z(i)},[i,z]),O(()=>{if(!i)return;let n=!1;const l=(C,m)=>{const p=Wt(i),W=m==="select"&&n;W&&(n=!1);const Le=m!=="select"?void 0:W?"":Yt(i,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<i.scrollSnapList().length;m&&(ee.current=null,j.current=C);const p=j.current;if(i.selectedScrollSnap()!==p){n=!m;try{i.scrollTo(p,!0)}finally{n=!1}}},F=()=>{var C;const m=i.selectedScrollSnap();m!==j.current&&(j.current=m,(C=me.current)==null||C.call(me,m))};return j.current=i.selectedScrollSnap(),l(),i.on("reInit",x).on("select",l).on("reInit",l).on("select",F).on("reInit",F),()=>{i.off("reInit",x).off("select",l).off("reInit",l).off("select",F).off("reInit",F)}},[i]),O(()=>{var n;const l=pe.current;l&&(pe.current=null,(n=(l==="previous"?de:fe).current)==null||n.focus({preventScroll:!0}))},[G]),O(()=>{const n=Ie.current;if(!i||n&&Vt(n,e))return;if(Ie.current=e,M===void 0){ee.current=null;return}const l=i.selectedScrollSnap(),x=M===Ce(n==null?void 0:n.index);if(l!==j.current&&x)return;const F=Math.max(0,i.scrollSnapList().length-1);ee.current=M>F?M:null;const C=Math.min(M,F);C!==l&&(j.current=C,ge(C))}),O(()=>{if(!i||a!=="fade")return;const n=new Set,l=()=>{const x=i.slideNodes(),F=new Set(_e(i)),C=x.some((p,W)=>!F.has(W)&&p.contains(document.activeElement));x.forEach((p,W)=>{p.inert=!F.has(W)||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=l,l(),i.on("select",l).on("reInit",l),()=>{oe.current=null,i.off("select",l).off("reInit",l);for(const x of i.slideNodes())x.inert=Xe(x);n.forEach(Ge)}},[i,a]),O(()=>{var n;const l=(n=i==null?void 0:i.plugins())==null?void 0:n.autoplay;l&&(K?l.play(y):l.stop())},[i,K,y]),O(()=>{if(!i)return;const n=()=>{var l,x;Fe.current&&((x=(l=i.plugins())==null?void 0:l.autoplay)==null||x.play(Re.current))};return i.on("pointerUp",n).on("reInit",n),()=>{i.off("pointerUp",n).off("reInit",n)}},[i]),v(ye.Provider,{value:it,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:B}))})}),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(($,B)=>{var D;return v(Ve.Provider,{value:{index:B,total:z.length,gapClassName:I.item,focusRingClassName:I.focusRing},children:$},(D=$.key)!=null?D:B)})})),v("div",{"data-slot":"carousel-live","aria-live":b.isRotating?"off":"polite","aria-atomic":"true",className:"sr-only",children:k}),s&&De(lt,{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={[We]: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:B,nextButtonRef:D}=Z(),U=r==="previous",_=U?z:I,Q=yt(t,U?B: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(Bt,d)})},b)})}))}),io=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,io as CarouselAutoplayToggle,eo as CarouselContent,ro as CarouselDots,to as CarouselItem,no as CarouselNext,oo as CarouselPrevious,Kt as useCarousel};
|
|
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,Be=Object.prototype.propertyIsEnumerable,Ke=(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)&&Ke(e,o,t[o]);if(ae)for(var o of ae(t))Be.call(t,o)&&Ke(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&&Be.call(e,r)&&(o[r]=e[r]);return o};const wt=5e3,We="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",{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-[3px] focus-visible:ring-state-focus",Bt="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 Kt(){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 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 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(We)}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:B,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,K=A&&te&&!J&&!et,Fe=S(K),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:K,toggle:Oe}),[A,J,K,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=K,Re.current=y}),O(()=>{l&&z&&z(l)},[l,z]),O(()=>{if(!l)return;let n=!1;const i=(C,m)=>{const p=Wt(l),W=m==="select"&&n;W&&(n=!1);const Le=m!=="select"?void 0:W?"":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,W)=>!F.has(W)&&p.contains(document.activeElement));x.forEach((p,W)=>{p.inert=!F.has(W)||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&&(K?i.play(y):i.stop())},[l,K,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:B}))})}),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(($,B)=>{var D;return v(Ve.Provider,{value:{index:B,total:z.length,gapClassName:I.item,focusRingClassName:I.focusRing},children:$},(D=$.key)!=null?D:B)})})),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={[We]: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:B,nextButtonRef:D}=Z(),U=r==="previous",_=U?z:I,Q=yt(t,U?B: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(Bt,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,Kt as useCarousel};
|
|
4
4
|
//# sourceMappingURL=Carousel.mjs.map
|
package/dist/components/Chip.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
|
-
"use strict";var s=require("react/jsx-runtime"),f=require("class-variance-authority"),c=require("@medway-ui/icons"),o=require("../lib/utils.js"),C=Object.defineProperty,O=Object.defineProperties,V=Object.getOwnPropertyDescriptors,l=Object.getOwnPropertySymbols,x=Object.prototype.hasOwnProperty,y=Object.prototype.propertyIsEnumerable,j=(a,e,r)=>e in a?C(a,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[e]=r,u=(a,e)=>{for(var r in e||(e={}))x.call(e,r)&&j(a,r,e[r]);if(l)for(var r of l(e))y.call(e,r)&&j(a,r,e[r]);return a},h=(a,e)=>O(a,V(e)),m=(a,e)=>{var r={};for(var t in a)x.call(a,t)&&e.indexOf(t)<0&&(r[t]=a[t]);if(a!=null&&l)for(var t of l(a))e.indexOf(t)<0&&y.call(a,t)&&(r[t]=a[t]);return r};const P={sm:"gap-2 px-3 py-2 text-xs leading-xs [&_svg:not([class*=
|
|
3
|
+
"use strict";var s=require("react/jsx-runtime"),f=require("class-variance-authority"),c=require("@medway-ui/icons"),o=require("../lib/utils.js"),C=Object.defineProperty,O=Object.defineProperties,V=Object.getOwnPropertyDescriptors,l=Object.getOwnPropertySymbols,x=Object.prototype.hasOwnProperty,y=Object.prototype.propertyIsEnumerable,j=(a,e,r)=>e in a?C(a,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[e]=r,u=(a,e)=>{for(var r in e||(e={}))x.call(e,r)&&j(a,r,e[r]);if(l)for(var r of l(e))y.call(e,r)&&j(a,r,e[r]);return a},h=(a,e)=>O(a,V(e)),m=(a,e)=>{var r={};for(var t in a)x.call(a,t)&&e.indexOf(t)<0&&(r[t]=a[t]);if(a!=null&&l)for(var t of l(a))e.indexOf(t)<0&&y.call(a,t)&&(r[t]=a[t]);return r};const P={sm:"gap-2 px-3 py-2 text-xs leading-xs [&_svg:not([class*=size-])]:size-4",md:"gap-2.5 px-3.5 py-2.5 text-sm leading-sm [&_svg:not([class*=size-])]:size-5",lg:"gap-3 px-4 py-3 text-md leading-md [&_svg:not([class*=size-])]:size-6"},p={variants:{size:P},defaultVariants:{size:"md"}},g="relative isolate inline-flex w-fit min-w-0 max-w-full shrink-0 items-center justify-center whitespace-nowrap transition-colors hover:cursor-pointer disabled:pointer-events-none [&_svg]:shrink-0",k=f.cva([g,"group/chip rounded-sm bg-surface-elevated font-semibold text-primary-foreground shadow-level-1-subtle disabled:bg-gray-background-soft-muted disabled:font-medium disabled:text-gray-foreground-muted disabled:shadow-none"],p),v=f.cva([g,"group/chip rounded-md bg-gray-background-soft font-medium text-gray-foreground [@media(hover:hover)]:data-[checked=false]:hover:bg-gray-background-soft-emphasis [@media(hover:hover)]:data-[checked=false]:hover:text-gray-foreground-emphasis enabled:data-[checked=true]:font-semibold enabled:data-[checked=true]:text-primary-foreground enabled:data-[checked=true]:before:absolute enabled:data-[checked=true]:before:inset-0.5 enabled:data-[checked=true]:before:-z-10 enabled:data-[checked=true]:before:rounded-[calc(var(--radius-md)-2px)] enabled:data-[checked=true]:before:bg-surface-card enabled:data-[checked=true]:before:shadow-level-1-subtle disabled:bg-gray-background-soft-muted disabled:text-gray-foreground-muted"],p),N=f.cva([g,"rounded-md bg-transparent font-semibold text-primary-foreground [@media(hover:hover)]:hover:bg-gray-background-soft-emphasis disabled:text-gray-foreground-muted"],p),M={sm:"w-[5px]",md:"w-[6px]",lg:"w-[7px]"};function q(a){var e=a,{className:r,size:t,dismissLabel:n="Remover",children:i}=e,d=m(e,["className","size","dismissLabel","children"]);return s.jsxs("button",h(u({"data-slot":"chip",className:o.cn(k({size:t}),r)},d),{type:"button",children:[s.jsx("span",{className:"truncate",children:i}),s.jsx("span",{className:"sr-only",children:n}),s.jsx(c.CloseMd,{"aria-hidden":"true","data-slot":"chip-dismiss",className:"text-gray-foreground-muted [@media(hover:hover)]:group-hover/chip:text-primary-foreground"})]}))}function F(a){var e=a,{className:r,size:t,icon:n,criteria:i,checked:d=!1,children:b}=e,z=m(e,["className","size","icon","criteria","checked","children"]);const w=i!=null&&typeof i!="boolean"&&i!=="";return s.jsxs("button",h(u({"data-slot":"chip-filter","data-checked":d,className:o.cn(v({size:t}),r)},z),{type:"button",children:[n,s.jsxs("span",{className:"inline-flex min-w-0",children:[s.jsx("span",{className:"truncate",children:b}),w&&s.jsxs(s.Fragment,{children:[s.jsx("span",{"aria-hidden":"true",className:o.cn("inline-flex shrink-0 justify-center",M[t!=null?t:p.defaultVariants.size]),children:":"}),s.jsx("span",{className:"truncate",children:i})]})]}),s.jsx(c.ChevronDown,{"aria-hidden":"true"})]}))}function L(a){var e=a,{className:r,size:t,icon:n,checked:i=!1,children:d}=e,b=m(e,["className","size","icon","checked","children"]);return s.jsxs("button",h(u({"data-slot":"chip-choice","data-checked":i,"aria-pressed":i,className:o.cn(v({size:t}),r)},b),{type:"button",children:[n,s.jsx("span",{className:"truncate",children:d}),i&&s.jsxs(s.Fragment,{children:[s.jsx(c.CheckMedium,{"aria-hidden":"true",className:"text-secondary-foreground group-disabled/chip:text-gray-foreground-muted [@media(hover:hover)]:group-hover/chip:hidden"}),s.jsx(c.CloseMd,{"aria-hidden":"true",className:"hidden text-primary-foreground [@media(hover:hover)]:group-hover/chip:block"})]})]}))}function _(a){var e=a,{className:r,size:t,children:n="Limpar"}=e,i=m(e,["className","size","children"]);return s.jsxs("button",h(u({"data-slot":"chip-clear",className:o.cn(N({size:t}),r)},i),{type:"button",children:[s.jsx("span",{className:"truncate",children:n}),s.jsx(c.CloseMd,{"aria-hidden":"true"})]}))}exports.Chip=q,exports.ChipChoice=L,exports.ChipClear=_,exports.ChipFilter=F,exports.chipClearVariants=N,exports.chipSelectableVariants=v,exports.chipVariants=k;
|
|
4
4
|
//# sourceMappingURL=Chip.js.map
|
package/dist/components/Chip.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
|
-
import{jsxs as n,jsx as i,Fragment as x}from"react/jsx-runtime";import{cva as f}from"class-variance-authority";import{CloseMd as g,CheckMedium as P,ChevronDown as V}from"@medway-ui/icons";import{cn as c}from"../lib/utils.mjs";var L=Object.defineProperty,_=Object.defineProperties,D=Object.getOwnPropertyDescriptors,l=Object.getOwnPropertySymbols,k=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable,z=(a,e,r)=>e in a?L(a,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[e]=r,h=(a,e)=>{for(var r in e||(e={}))k.call(e,r)&&z(a,r,e[r]);if(l)for(var r of l(e))N.call(e,r)&&z(a,r,e[r]);return a},u=(a,e)=>_(a,D(e)),m=(a,e)=>{var r={};for(var t in a)k.call(a,t)&&e.indexOf(t)<0&&(r[t]=a[t]);if(a!=null&&l)for(var t of l(a))e.indexOf(t)<0&&N.call(a,t)&&(r[t]=a[t]);return r};const F={sm:"gap-2 px-3 py-2 text-xs leading-xs [&_svg:not([class*=
|
|
3
|
+
import{jsxs as n,jsx as i,Fragment as x}from"react/jsx-runtime";import{cva as f}from"class-variance-authority";import{CloseMd as g,CheckMedium as P,ChevronDown as V}from"@medway-ui/icons";import{cn as c}from"../lib/utils.mjs";var L=Object.defineProperty,_=Object.defineProperties,D=Object.getOwnPropertyDescriptors,l=Object.getOwnPropertySymbols,k=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable,z=(a,e,r)=>e in a?L(a,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[e]=r,h=(a,e)=>{for(var r in e||(e={}))k.call(e,r)&&z(a,r,e[r]);if(l)for(var r of l(e))N.call(e,r)&&z(a,r,e[r]);return a},u=(a,e)=>_(a,D(e)),m=(a,e)=>{var r={};for(var t in a)k.call(a,t)&&e.indexOf(t)<0&&(r[t]=a[t]);if(a!=null&&l)for(var t of l(a))e.indexOf(t)<0&&N.call(a,t)&&(r[t]=a[t]);return r};const F={sm:"gap-2 px-3 py-2 text-xs leading-xs [&_svg:not([class*=size-])]:size-4",md:"gap-2.5 px-3.5 py-2.5 text-sm leading-sm [&_svg:not([class*=size-])]:size-5",lg:"gap-3 px-4 py-3 text-md leading-md [&_svg:not([class*=size-])]:size-6"},p={variants:{size:F},defaultVariants:{size:"md"}},v="relative isolate inline-flex w-fit min-w-0 max-w-full shrink-0 items-center justify-center whitespace-nowrap transition-colors hover:cursor-pointer disabled:pointer-events-none [&_svg]:shrink-0",w=f([v,"group/chip rounded-sm bg-surface-elevated font-semibold text-primary-foreground shadow-level-1-subtle disabled:bg-gray-background-soft-muted disabled:font-medium disabled:text-gray-foreground-muted disabled:shadow-none"],p),y=f([v,"group/chip rounded-md bg-gray-background-soft font-medium text-gray-foreground [@media(hover:hover)]:data-[checked=false]:hover:bg-gray-background-soft-emphasis [@media(hover:hover)]:data-[checked=false]:hover:text-gray-foreground-emphasis enabled:data-[checked=true]:font-semibold enabled:data-[checked=true]:text-primary-foreground enabled:data-[checked=true]:before:absolute enabled:data-[checked=true]:before:inset-0.5 enabled:data-[checked=true]:before:-z-10 enabled:data-[checked=true]:before:rounded-[calc(var(--radius-md)-2px)] enabled:data-[checked=true]:before:bg-surface-card enabled:data-[checked=true]:before:shadow-level-1-subtle disabled:bg-gray-background-soft-muted disabled:text-gray-foreground-muted"],p),j=f([v,"rounded-md bg-transparent font-semibold text-primary-foreground [@media(hover:hover)]:hover:bg-gray-background-soft-emphasis disabled:text-gray-foreground-muted"],p),M={sm:"w-[5px]",md:"w-[6px]",lg:"w-[7px]"};function R(a){var e=a,{className:r,size:t,dismissLabel:d="Remover",children:s}=e,o=m(e,["className","size","dismissLabel","children"]);return n("button",u(h({"data-slot":"chip",className:c(w({size:t}),r)},o),{type:"button",children:[i("span",{className:"truncate",children:s}),i("span",{className:"sr-only",children:d}),i(g,{"aria-hidden":"true","data-slot":"chip-dismiss",className:"text-gray-foreground-muted [@media(hover:hover)]:group-hover/chip:text-primary-foreground"})]}))}function S(a){var e=a,{className:r,size:t,icon:d,criteria:s,checked:o=!1,children:b}=e,C=m(e,["className","size","icon","criteria","checked","children"]);const O=s!=null&&typeof s!="boolean"&&s!=="";return n("button",u(h({"data-slot":"chip-filter","data-checked":o,className:c(y({size:t}),r)},C),{type:"button",children:[d,n("span",{className:"inline-flex min-w-0",children:[i("span",{className:"truncate",children:b}),O&&n(x,{children:[i("span",{"aria-hidden":"true",className:c("inline-flex shrink-0 justify-center",M[t!=null?t:p.defaultVariants.size]),children:":"}),i("span",{className:"truncate",children:s})]})]}),i(V,{"aria-hidden":"true"})]}))}function B(a){var e=a,{className:r,size:t,icon:d,checked:s=!1,children:o}=e,b=m(e,["className","size","icon","checked","children"]);return n("button",u(h({"data-slot":"chip-choice","data-checked":s,"aria-pressed":s,className:c(y({size:t}),r)},b),{type:"button",children:[d,i("span",{className:"truncate",children:o}),s&&n(x,{children:[i(P,{"aria-hidden":"true",className:"text-secondary-foreground group-disabled/chip:text-gray-foreground-muted [@media(hover:hover)]:group-hover/chip:hidden"}),i(g,{"aria-hidden":"true",className:"hidden text-primary-foreground [@media(hover:hover)]:group-hover/chip:block"})]})]}))}function E(a){var e=a,{className:r,size:t,children:d="Limpar"}=e,s=m(e,["className","size","children"]);return n("button",u(h({"data-slot":"chip-clear",className:c(j({size:t}),r)},s),{type:"button",children:[i("span",{className:"truncate",children:d}),i(g,{"aria-hidden":"true"})]}))}export{R as Chip,B as ChipChoice,E as ChipClear,S as ChipFilter,j as chipClearVariants,y as chipSelectableVariants,w as chipVariants};
|
|
4
4
|
//# sourceMappingURL=Chip.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../src/components/Select.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,EAKL,cAAc,EACd,cAAc,EAGd,SAAS,EAGV,MAAM,OAAO,CAAC;AAIf,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,CAAC;AAErC,UAAU,WAAY,SAAQ,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC;IACvE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AAED,UAAU,eAAgB,SAAQ,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC;IAC3E,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAOD,iBAAS,MAAM,CAAC,EAAE,OAAe,EAAE,IAAW,EAAE,GAAG,KAAK,EAAE,EAAE,WAAW,2CAQtE;AAED,UAAU,gBAAiB,SAAQ,cAAc,CAAC,gBAAgB,CAAC;IACjE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,iBAAS,aAAa,CAAC,EACrB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,cAAc,CAAC,2CAQhC;AAED,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,2CAevE;AAED,iBAAS,WAAW,CAAC,EACnB,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,2CAE9C;AAED,iBAAS,WAAW,CAAC,EACnB,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,2CAE9C;AAED,QAAA,MAAM,cAAc;;8EAqBnB,CAAC;AAiBF,QAAA,MAAM,aAAa,kMA8BjB,CAAC;AAEH,iBAAS,aAAa,CAAC,EACrB,SAAS,EACT,QAAQ,EACR,QAAmB,EACnB,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../src/components/Select.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,EAKL,cAAc,EACd,cAAc,EAGd,SAAS,EAGV,MAAM,OAAO,CAAC;AAIf,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,CAAC;AAErC,UAAU,WAAY,SAAQ,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC;IACvE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AAED,UAAU,eAAgB,SAAQ,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC;IAC3E,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAOD,iBAAS,MAAM,CAAC,EAAE,OAAe,EAAE,IAAW,EAAE,GAAG,KAAK,EAAE,EAAE,WAAW,2CAQtE;AAED,UAAU,gBAAiB,SAAQ,cAAc,CAAC,gBAAgB,CAAC;IACjE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,iBAAS,aAAa,CAAC,EACrB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,cAAc,CAAC,2CAQhC;AAED,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,2CAevE;AAED,iBAAS,WAAW,CAAC,EACnB,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,2CAE9C;AAED,iBAAS,WAAW,CAAC,EACnB,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,2CAE9C;AAED,QAAA,MAAM,cAAc;;8EAqBnB,CAAC;AAiBF,QAAA,MAAM,aAAa,kMA8BjB,CAAC;AAEH,iBAAS,aAAa,CAAC,EACrB,SAAS,EACT,QAAQ,EACR,QAAmB,EACnB,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,2CA4BhD;AAED,iBAAS,YAAY,CAAC,EACpB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,2CAW9C;AAED,iBAAS,UAAU,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,2CA4B3E;AAED,iBAAS,eAAe,CAAC,EACvB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,SAAS,CAAC,2CAQlD;AAED,iBAAS,oBAAoB,CAAC,EAC5B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,cAAc,CAAC,2CAavD;AAED,iBAAS,sBAAsB,CAAC,EAC9B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,gBAAgB,CAAC,2CAiBzD;AAED,iBAAS,UAAU,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,eAAe,CAAC,2CAc3E;AAED,OAAO,EACL,MAAM,EACN,aAAa,EACb,WAAW,EACX,UAAU,EACV,YAAY,EACZ,WAAW,EACX,sBAAsB,EACtB,oBAAoB,EACpB,eAAe,EACf,UAAU,EACV,aAAa,EACb,WAAW,EACX,aAAa,EACb,cAAc,GACf,CAAC;AACF,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../src/components/Select.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,EAKL,cAAc,EACd,cAAc,EAGd,SAAS,EAGV,MAAM,OAAO,CAAC;AAIf,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,CAAC;AAErC,UAAU,WAAY,SAAQ,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC;IACvE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AAED,UAAU,eAAgB,SAAQ,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC;IAC3E,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAOD,iBAAS,MAAM,CAAC,EAAE,OAAe,EAAE,IAAW,EAAE,GAAG,KAAK,EAAE,EAAE,WAAW,2CAQtE;AAED,UAAU,gBAAiB,SAAQ,cAAc,CAAC,gBAAgB,CAAC;IACjE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,iBAAS,aAAa,CAAC,EACrB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,cAAc,CAAC,2CAQhC;AAED,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,2CAevE;AAED,iBAAS,WAAW,CAAC,EACnB,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,2CAE9C;AAED,iBAAS,WAAW,CAAC,EACnB,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,2CAE9C;AAED,QAAA,MAAM,cAAc;;8EAqBnB,CAAC;AAiBF,QAAA,MAAM,aAAa,kMA8BjB,CAAC;AAEH,iBAAS,aAAa,CAAC,EACrB,SAAS,EACT,QAAQ,EACR,QAAmB,EACnB,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../src/components/Select.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,EAKL,cAAc,EACd,cAAc,EAGd,SAAS,EAGV,MAAM,OAAO,CAAC;AAIf,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,CAAC;AAErC,UAAU,WAAY,SAAQ,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC;IACvE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AAED,UAAU,eAAgB,SAAQ,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC;IAC3E,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAOD,iBAAS,MAAM,CAAC,EAAE,OAAe,EAAE,IAAW,EAAE,GAAG,KAAK,EAAE,EAAE,WAAW,2CAQtE;AAED,UAAU,gBAAiB,SAAQ,cAAc,CAAC,gBAAgB,CAAC;IACjE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,iBAAS,aAAa,CAAC,EACrB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,cAAc,CAAC,2CAQhC;AAED,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,2CAevE;AAED,iBAAS,WAAW,CAAC,EACnB,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,2CAE9C;AAED,iBAAS,WAAW,CAAC,EACnB,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,2CAE9C;AAED,QAAA,MAAM,cAAc;;8EAqBnB,CAAC;AAiBF,QAAA,MAAM,aAAa,kMA8BjB,CAAC;AAEH,iBAAS,aAAa,CAAC,EACrB,SAAS,EACT,QAAQ,EACR,QAAmB,EACnB,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,2CA4BhD;AAED,iBAAS,YAAY,CAAC,EACpB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,2CAW9C;AAED,iBAAS,UAAU,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,2CA4B3E;AAED,iBAAS,eAAe,CAAC,EACvB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,SAAS,CAAC,2CAQlD;AAED,iBAAS,oBAAoB,CAAC,EAC5B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,cAAc,CAAC,2CAavD;AAED,iBAAS,sBAAsB,CAAC,EAC9B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,gBAAgB,CAAC,2CAiBzD;AAED,iBAAS,UAAU,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,eAAe,CAAC,2CAc3E;AAED,OAAO,EACL,MAAM,EACN,aAAa,EACb,WAAW,EACX,UAAU,EACV,YAAY,EACZ,WAAW,EACX,sBAAsB,EACtB,oBAAoB,EACpB,eAAe,EACf,UAAU,EACV,aAAa,EACb,WAAW,EACX,aAAa,EACb,cAAc,GACf,CAAC;AACF,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
|
-
"use strict";var s=require("react/jsx-runtime"),m=require("@medway-ui/icons"),o=require("radix-ui"),
|
|
3
|
+
"use strict";var s=require("react/jsx-runtime"),m=require("@medway-ui/icons"),o=require("radix-ui"),c=require("react"),i=require("../lib/utils.js"),v=require("class-variance-authority"),z=Object.defineProperty,k=Object.defineProperties,C=Object.getOwnPropertyDescriptors,h=Object.getOwnPropertySymbols,b=Object.prototype.hasOwnProperty,y=Object.prototype.propertyIsEnumerable,j=(t,e,a)=>e in t?z(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a,n=(t,e)=>{for(var a in e||(e={}))b.call(e,a)&&j(t,a,e[a]);if(h)for(var a of h(e))y.call(e,a)&&j(t,a,e[a]);return t},u=(t,e)=>k(t,C(e)),d=(t,e)=>{var a={};for(var r in t)b.call(t,r)&&e.indexOf(r)<0&&(a[r]=t[r]);if(t!=null&&h)for(var r of h(t))e.indexOf(r)<0&&y.call(t,r)&&(a[r]=t[r]);return a};const x=c.createContext({invalid:!1,size:"lg"});function O(t){var e=t,{invalid:a=!1,size:r="lg"}=e,l=d(e,["invalid","size"]);return s.jsx(x.Provider,{value:c.useMemo(()=>({invalid:a,size:r}),[a,r]),children:s.jsx(o.Select.Root,n({},l))})}function I(t){var e=t,{className:a}=e,r=d(e,["className"]);return s.jsx("div",n({className:i.cn("group relative flex flex-col gap-2",a),"data-slot":"select-wrapper"},r))}function V(t){var e=t,{className:a,children:r}=e,l=d(e,["className","children"]);return s.jsx("label",u(n({className:i.cn("pointer-events-none absolute start-3 top-0 max-w-[calc(100%-1.5rem)] origin-left -translate-y-1/2 truncate bg-surface-card px-1 text-xs font-medium text-gray-foreground transition-all duration-200 ease-out","group-has-[[data-slot=select-trigger][data-placeholder]:not([data-state=open])]:start-4 group-has-[[data-slot=select-trigger][data-placeholder]:not([data-state=open])]:top-6 group-has-[[data-slot=select-trigger][data-placeholder]:not([data-state=open])]:max-w-[calc(100%-4rem)] group-has-[[data-slot=select-trigger][data-placeholder]:not([data-state=open])]:bg-transparent group-has-[[data-slot=select-trigger][data-placeholder]:not([data-state=open])]:px-0 group-has-[[data-slot=select-trigger][data-placeholder]:not([data-state=open])]:text-md group-has-[[data-slot=select-trigger][data-placeholder]:not([data-state=open])]:font-normal group-has-[[data-slot=select-trigger][data-placeholder]:not([data-state=open])]:text-gray-foreground","group-has-[[data-slot=select-trigger][data-size=md]]:group-has-[[data-slot=select-trigger][data-placeholder]:not([data-state=open])]:top-5 group-has-[[data-slot=select-trigger][data-size=md]]:group-has-[[data-slot=select-trigger][data-placeholder]:not([data-state=open])]:!text-sm",a),"data-slot":"select-label"},l),{children:r}))}function _(t){var e=d(t,[]);return s.jsx(o.Select.Group,n({"data-slot":"select-group"},e))}function q(t){var e=d(t,[]);return s.jsx(o.Select.Value,n({"data-slot":"select-value"},e))}const N=v.cva(["flex w-full items-center justify-between gap-2 rounded-md border-2 border-gray-stroke-muted bg-surface-card px-4 py-3 text-left text-gray-foreground outline-none transition-[color,box-shadow] hover:border-gray-stroke-emphasis hover:ring-[3px] hover:ring-state-focus disabled:cursor-default disabled:bg-gray-background-soft-muted disabled:hover:border-gray-stroke-muted disabled:hover:ring-0 aria-[invalid]:border-feedback-error-stroke aria-[invalid]:hover:ring-[3px] aria-[invalid]:hover:ring-state-error data-[placeholder]:text-gray-foreground-emphasis *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 disabled:data-[placeholder]:text-gray-foreground-muted [&>span]:line-clamp-1 [&_svg]:pointer-events-none [&_svg]:shrink-0"],{variants:{size:{lg:["h-12 max-h-12 text-md [&_svg]:size-6","group-has-[[data-slot=select-label]]:h-14"],md:["h-10 max-h-10 text-sm [&_svg]:size-5","group-has-[[data-slot=select-label]]:h-11"]}},defaultVariants:{size:"lg"}}),P=v.cva("data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[highlighted]:bg-secondary-background-soft-emphasis relative flex w-full cursor-default select-none items-center rounded pe-8 ps-2 font-medium text-gray-foreground outline-none hover:cursor-pointer hover:bg-secondary-background-soft-emphasis gap-3",{variants:{size:{lg:"py-2 text-sm [&_svg]:size-5",md:"py-2 text-sm [&_svg]:size-5"}},defaultVariants:{size:"lg"}}),D=c.forwardRef(function(t,e){var a=t,{className:r,children:l}=a,p=d(a,["className","children"]);const{invalid:g,size:f}=c.useContext(x);return s.jsxs(o.Select.Trigger,u(n({ref:e,className:i.cn(N({size:f}),!g&&"[&:not([data-placeholder]):not(:disabled)]:border-gray-stroke-emphasis","group-has-[[data-slot=select-label]]:py-3 group-has-[[data-slot=select-label]]:data-[placeholder]:text-transparent",r),"data-slot":"select-trigger","data-size":f,"aria-invalid":g?"true":void 0},p),{children:[l,s.jsx(o.Select.Icon,{asChild:!0,children:s.jsx(m.ChevronDown,{className:i.cn("flex-shrink-0 text-gray-foreground"),strokeWidth:1.6})})]}))});function W(t){var e=t,{className:a,children:r,position:l="popper"}=e,p=d(e,["className","children","position"]);return s.jsx(o.Select.Portal,{children:s.jsxs(o.Select.Content,u(n({className:i.cn("relative z-50 max-h-[min(24rem,var(--radix-select-content-available-height))] min-w-32 overflow-hidden rounded-md border border-gray-stroke-muted bg-surface-elevated text-gray-foreground shadow-md 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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 [&_[role=group]]:py-1",l==="popper"&&"w-full min-w-[var(--radix-select-trigger-width)] max-w-[var(--radix-select-content-available-width)] data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",a),"data-slot":"select-content",position:l},p),{children:[s.jsx(S,{}),s.jsx(o.Select.Viewport,{className:l==="popper"?"h-[var(--radix-select-trigger-height)] p-2":"p-2",children:r}),s.jsx(w,{})]}))})}function T(t){var e=t,{className:a}=e,r=d(e,["className"]);return s.jsx(o.Select.Label,n({className:i.cn("px-2 py-2 text-xs font-medium text-gray-foreground-muted",a),"data-slot":"select-header"},r))}function U(t){var e=t,{className:a,children:r,icon:l}=e,p=d(e,["className","children","icon"]);const{size:g}=c.useContext(x);return s.jsxs(o.Select.Item,u(n({className:i.cn(P({size:g}),a),"data-slot":"select-item"},p),{children:[l&&s.jsx("span",{className:"flex shrink-0 items-center justify-center text-gray-foreground",children:c.isValidElement(l)?c.cloneElement(l,{strokeWidth:1.6}):l}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:s.jsx(o.Select.ItemText,{children:r})}),s.jsx("span",{className:"absolute end-2 flex size-3.5 items-center justify-center",children:s.jsx(o.Select.ItemIndicator,{children:s.jsx(m.Check,{strokeWidth:1.6,className:"text-secondary-foreground"})})})]}))}function B(t){var e=t,{className:a}=e,r=d(e,["className"]);return s.jsx(o.Select.Separator,n({className:i.cn("-mx-1 my-1 h-px bg-gray-stroke-muted",a),"data-slot":"select-separator"},r))}function S(t){var e=t,{className:a}=e,r=d(e,["className"]);return s.jsx(o.Select.ScrollUpButton,u(n({className:i.cn("flex cursor-default items-center justify-center py-1",a),"data-slot":"select-scroll-up-button"},r),{children:s.jsx(m.ChevronUp,{size:16,strokeWidth:1.6,className:"text-gray-foreground"})}))}function w(t){var e=t,{className:a}=e,r=d(e,["className"]);return s.jsx(o.Select.ScrollDownButton,u(n({className:i.cn("flex cursor-default items-center justify-center py-1",a),"data-slot":"select-scroll-down-button"},r),{children:s.jsx(m.ChevronDown,{size:16,strokeWidth:1.6,className:"text-gray-foreground"})}))}function E(t){var e=t,{className:a}=e,r=d(e,["className"]);const{invalid:l}=c.useContext(x);return s.jsx("span",n({className:i.cn("-mt-1 text-xs",l?"text-feedback-error-foreground":"text-gray-foreground",a),"data-slot":"select-text"},r))}exports.Select=O,exports.SelectContent=W,exports.SelectGroup=_,exports.SelectHeader=T,exports.SelectItem=U,exports.SelectLabel=V,exports.SelectScrollDownButton=w,exports.SelectScrollUpButton=S,exports.SelectSeparator=B,exports.SelectText=E,exports.SelectTrigger=D,exports.SelectValue=q,exports.SelectWrapper=I,exports.selectVariants=N;
|
|
4
4
|
//# sourceMappingURL=Select.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
|
-
import{jsxs as h,jsx as s}from"react/jsx-runtime";import{ChevronDown as x,Check as j,ChevronUp as O}from"@medway-ui/icons";import{Select as l}from"radix-ui";import{createContext as C,forwardRef as I,useContext as f,useMemo as _,isValidElement as P,cloneElement as V}from"react";import{cn as i}from"../lib/utils.mjs";import{cva as b}from"class-variance-authority";var W=Object.defineProperty,D=Object.defineProperties,T=Object.getOwnPropertyDescriptors,g=Object.getOwnPropertySymbols,y=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable,w=(t,e,a)=>e in t?W(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a,n=(t,e)=>{for(var a in e||(e={}))y.call(e,a)&&w(t,a,e[a]);if(g)for(var a of g(e))N.call(e,a)&&w(t,a,e[a]);return t},c=(t,e)=>D(t,T(e)),d=(t,e)=>{var a={};for(var r in t)y.call(t,r)&&e.indexOf(r)<0&&(a[r]=t[r]);if(t!=null&&g)for(var r of g(t))e.indexOf(r)<0&&N.call(t,r)&&(a[r]=t[r]);return a};const m=C({invalid:!1,size:"lg"});function B(t){var e=t,{invalid:a=!1,size:r="lg"}=e,o=d(e,["invalid","size"]);return s(m.Provider,{value:_(()=>({invalid:a,size:r}),[a,r]),children:s(l.Root,n({},o))})}function E(t){var e=t,{className:a}=e,r=d(e,["className"]);return s("div",n({className:i("group relative flex flex-col gap-2",a),"data-slot":"select-wrapper"},r))}function U(t){var e=t,{className:a,children:r}=e,o=d(e,["className","children"]);return s("label",c(n({className:i("pointer-events-none absolute start-3 top-0 max-w-[calc(100%-1.5rem)] origin-left -translate-y-1/2 truncate bg-surface-card px-1 text-xs font-medium text-gray-foreground transition-all duration-200 ease-out","group-has-[[data-slot=select-trigger][data-placeholder]:not([data-state=open])]:start-4 group-has-[[data-slot=select-trigger][data-placeholder]:not([data-state=open])]:top-6 group-has-[[data-slot=select-trigger][data-placeholder]:not([data-state=open])]:max-w-[calc(100%-4rem)] group-has-[[data-slot=select-trigger][data-placeholder]:not([data-state=open])]:bg-transparent group-has-[[data-slot=select-trigger][data-placeholder]:not([data-state=open])]:px-0 group-has-[[data-slot=select-trigger][data-placeholder]:not([data-state=open])]:text-md group-has-[[data-slot=select-trigger][data-placeholder]:not([data-state=open])]:font-normal group-has-[[data-slot=select-trigger][data-placeholder]:not([data-state=open])]:text-gray-foreground","group-has-[[data-slot=select-trigger][data-size=md]]:group-has-[[data-slot=select-trigger][data-placeholder]:not([data-state=open])]:top-5 group-has-[[data-slot=select-trigger][data-size=md]]:group-has-[[data-slot=select-trigger][data-placeholder]:not([data-state=open])]:!text-sm",a),"data-slot":"select-label"},o),{children:r}))}function G(t){var e=d(t,[]);return s(l.Group,n({"data-slot":"select-group"},e))}function L(t){var e=d(t,[]);return s(l.Value,n({"data-slot":"select-value"},e))}const z=b(["flex w-full items-center justify-between gap-2 rounded-md border-2 border-gray-stroke-muted bg-surface-card px-4 py-3 text-left text-gray-foreground outline-none transition-[color,box-shadow] hover:border-gray-stroke-emphasis hover:ring-[3px] hover:ring-state-focus disabled:cursor-default disabled:bg-gray-background-soft-muted disabled:hover:border-gray-stroke-muted disabled:hover:ring-0 aria-[invalid]:border-feedback-error-stroke aria-[invalid]:hover:ring-[3px] aria-[invalid]:hover:ring-state-error data-[placeholder]:text-gray-foreground-emphasis *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 disabled:data-[placeholder]:text-gray-foreground-muted [&>span]:line-clamp-1 [&_svg]:pointer-events-none [&_svg]:shrink-0"],{variants:{size:{lg:["h-12 max-h-12 text-md [&_svg]:size-6","group-has-[[data-slot=select-label]]:h-14"],md:["h-10 max-h-10 text-sm [&_svg]:size-5","group-has-[[data-slot=select-label]]:h-11"]}},defaultVariants:{size:"lg"}}),R=b("data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[highlighted]:bg-secondary-background-soft-emphasis relative flex w-full cursor-default select-none items-center rounded pe-8 ps-2 font-medium text-gray-foreground outline-none hover:cursor-pointer hover:bg-secondary-background-soft-emphasis gap-3",{variants:{size:{lg:"py-2 text-sm [&_svg]:size-5",md:"py-2 text-sm [&_svg]:size-5"}},defaultVariants:{size:"lg"}}),q=I(function(t,e){var a=t,{className:r,children:o}=a,u=d(a,["className","children"]);const{invalid:p,size:v}=f(m);return h(l.Trigger,c(n({ref:e,className:i(z({size:v}),!p&&"[&:not([data-placeholder]):not(:disabled)]:border-gray-stroke-emphasis","group-has-[[data-slot=select-label]]:py-3 group-has-[[data-slot=select-label]]:data-[placeholder]:text-transparent",r),"data-slot":"select-trigger","data-size":v,"aria-invalid":p?"true":void 0},u),{children:[o,s(l.Icon,{asChild:!0,children:s(x,{className:i("flex-shrink-0 text-gray-foreground"),strokeWidth:1.6})})]}))});function A(t){var e=t,{className:a,children:r,position:o="popper"}=e,u=d(e,["className","children","position"]);return s(l.Portal,{children:h(l.Content,c(n({className:i("relative z-50 max-h-[min(24rem,var(--radix-select-content-available-height))] min-w-32 overflow-hidden rounded-md border border-gray-stroke-muted bg-surface-elevated text-gray-foreground shadow-md 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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 [&_[role=group]]:py-1",o==="popper"&&"w-full min-w-[var(--radix-select-trigger-width)] max-w-[var(--radix-select-content-available-width)] data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",a),"data-slot":"select-content",position:o},u),{children:[s(k,{}),s(l.Viewport,{className:
|
|
3
|
+
import{jsxs as h,jsx as s}from"react/jsx-runtime";import{ChevronDown as x,Check as j,ChevronUp as O}from"@medway-ui/icons";import{Select as l}from"radix-ui";import{createContext as C,forwardRef as I,useContext as f,useMemo as _,isValidElement as P,cloneElement as V}from"react";import{cn as i}from"../lib/utils.mjs";import{cva as b}from"class-variance-authority";var W=Object.defineProperty,D=Object.defineProperties,T=Object.getOwnPropertyDescriptors,g=Object.getOwnPropertySymbols,y=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable,w=(t,e,a)=>e in t?W(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a,n=(t,e)=>{for(var a in e||(e={}))y.call(e,a)&&w(t,a,e[a]);if(g)for(var a of g(e))N.call(e,a)&&w(t,a,e[a]);return t},c=(t,e)=>D(t,T(e)),d=(t,e)=>{var a={};for(var r in t)y.call(t,r)&&e.indexOf(r)<0&&(a[r]=t[r]);if(t!=null&&g)for(var r of g(t))e.indexOf(r)<0&&N.call(t,r)&&(a[r]=t[r]);return a};const m=C({invalid:!1,size:"lg"});function B(t){var e=t,{invalid:a=!1,size:r="lg"}=e,o=d(e,["invalid","size"]);return s(m.Provider,{value:_(()=>({invalid:a,size:r}),[a,r]),children:s(l.Root,n({},o))})}function E(t){var e=t,{className:a}=e,r=d(e,["className"]);return s("div",n({className:i("group relative flex flex-col gap-2",a),"data-slot":"select-wrapper"},r))}function U(t){var e=t,{className:a,children:r}=e,o=d(e,["className","children"]);return s("label",c(n({className:i("pointer-events-none absolute start-3 top-0 max-w-[calc(100%-1.5rem)] origin-left -translate-y-1/2 truncate bg-surface-card px-1 text-xs font-medium text-gray-foreground transition-all duration-200 ease-out","group-has-[[data-slot=select-trigger][data-placeholder]:not([data-state=open])]:start-4 group-has-[[data-slot=select-trigger][data-placeholder]:not([data-state=open])]:top-6 group-has-[[data-slot=select-trigger][data-placeholder]:not([data-state=open])]:max-w-[calc(100%-4rem)] group-has-[[data-slot=select-trigger][data-placeholder]:not([data-state=open])]:bg-transparent group-has-[[data-slot=select-trigger][data-placeholder]:not([data-state=open])]:px-0 group-has-[[data-slot=select-trigger][data-placeholder]:not([data-state=open])]:text-md group-has-[[data-slot=select-trigger][data-placeholder]:not([data-state=open])]:font-normal group-has-[[data-slot=select-trigger][data-placeholder]:not([data-state=open])]:text-gray-foreground","group-has-[[data-slot=select-trigger][data-size=md]]:group-has-[[data-slot=select-trigger][data-placeholder]:not([data-state=open])]:top-5 group-has-[[data-slot=select-trigger][data-size=md]]:group-has-[[data-slot=select-trigger][data-placeholder]:not([data-state=open])]:!text-sm",a),"data-slot":"select-label"},o),{children:r}))}function G(t){var e=d(t,[]);return s(l.Group,n({"data-slot":"select-group"},e))}function L(t){var e=d(t,[]);return s(l.Value,n({"data-slot":"select-value"},e))}const z=b(["flex w-full items-center justify-between gap-2 rounded-md border-2 border-gray-stroke-muted bg-surface-card px-4 py-3 text-left text-gray-foreground outline-none transition-[color,box-shadow] hover:border-gray-stroke-emphasis hover:ring-[3px] hover:ring-state-focus disabled:cursor-default disabled:bg-gray-background-soft-muted disabled:hover:border-gray-stroke-muted disabled:hover:ring-0 aria-[invalid]:border-feedback-error-stroke aria-[invalid]:hover:ring-[3px] aria-[invalid]:hover:ring-state-error data-[placeholder]:text-gray-foreground-emphasis *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 disabled:data-[placeholder]:text-gray-foreground-muted [&>span]:line-clamp-1 [&_svg]:pointer-events-none [&_svg]:shrink-0"],{variants:{size:{lg:["h-12 max-h-12 text-md [&_svg]:size-6","group-has-[[data-slot=select-label]]:h-14"],md:["h-10 max-h-10 text-sm [&_svg]:size-5","group-has-[[data-slot=select-label]]:h-11"]}},defaultVariants:{size:"lg"}}),R=b("data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[highlighted]:bg-secondary-background-soft-emphasis relative flex w-full cursor-default select-none items-center rounded pe-8 ps-2 font-medium text-gray-foreground outline-none hover:cursor-pointer hover:bg-secondary-background-soft-emphasis gap-3",{variants:{size:{lg:"py-2 text-sm [&_svg]:size-5",md:"py-2 text-sm [&_svg]:size-5"}},defaultVariants:{size:"lg"}}),q=I(function(t,e){var a=t,{className:r,children:o}=a,u=d(a,["className","children"]);const{invalid:p,size:v}=f(m);return h(l.Trigger,c(n({ref:e,className:i(z({size:v}),!p&&"[&:not([data-placeholder]):not(:disabled)]:border-gray-stroke-emphasis","group-has-[[data-slot=select-label]]:py-3 group-has-[[data-slot=select-label]]:data-[placeholder]:text-transparent",r),"data-slot":"select-trigger","data-size":v,"aria-invalid":p?"true":void 0},u),{children:[o,s(l.Icon,{asChild:!0,children:s(x,{className:i("flex-shrink-0 text-gray-foreground"),strokeWidth:1.6})})]}))});function A(t){var e=t,{className:a,children:r,position:o="popper"}=e,u=d(e,["className","children","position"]);return s(l.Portal,{children:h(l.Content,c(n({className:i("relative z-50 max-h-[min(24rem,var(--radix-select-content-available-height))] min-w-32 overflow-hidden rounded-md border border-gray-stroke-muted bg-surface-elevated text-gray-foreground shadow-md 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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 [&_[role=group]]:py-1",o==="popper"&&"w-full min-w-[var(--radix-select-trigger-width)] max-w-[var(--radix-select-content-available-width)] data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",a),"data-slot":"select-content",position:o},u),{children:[s(k,{}),s(l.Viewport,{className:o==="popper"?"h-[var(--radix-select-trigger-height)] p-2":"p-2",children:r}),s(S,{})]}))})}function F(t){var e=t,{className:a}=e,r=d(e,["className"]);return s(l.Label,n({className:i("px-2 py-2 text-xs font-medium text-gray-foreground-muted",a),"data-slot":"select-header"},r))}function H(t){var e=t,{className:a,children:r,icon:o}=e,u=d(e,["className","children","icon"]);const{size:p}=f(m);return h(l.Item,c(n({className:i(R({size:p}),a),"data-slot":"select-item"},u),{children:[o&&s("span",{className:"flex shrink-0 items-center justify-center text-gray-foreground",children:P(o)?V(o,{strokeWidth:1.6}):o}),s("span",{className:"min-w-0 flex-1 truncate",children:s(l.ItemText,{children:r})}),s("span",{className:"absolute end-2 flex size-3.5 items-center justify-center",children:s(l.ItemIndicator,{children:s(j,{strokeWidth:1.6,className:"text-secondary-foreground"})})})]}))}function J(t){var e=t,{className:a}=e,r=d(e,["className"]);return s(l.Separator,n({className:i("-mx-1 my-1 h-px bg-gray-stroke-muted",a),"data-slot":"select-separator"},r))}function k(t){var e=t,{className:a}=e,r=d(e,["className"]);return s(l.ScrollUpButton,c(n({className:i("flex cursor-default items-center justify-center py-1",a),"data-slot":"select-scroll-up-button"},r),{children:s(O,{size:16,strokeWidth:1.6,className:"text-gray-foreground"})}))}function S(t){var e=t,{className:a}=e,r=d(e,["className"]);return s(l.ScrollDownButton,c(n({className:i("flex cursor-default items-center justify-center py-1",a),"data-slot":"select-scroll-down-button"},r),{children:s(x,{size:16,strokeWidth:1.6,className:"text-gray-foreground"})}))}function K(t){var e=t,{className:a}=e,r=d(e,["className"]);const{invalid:o}=f(m);return s("span",n({className:i("-mt-1 text-xs",o?"text-feedback-error-foreground":"text-gray-foreground",a),"data-slot":"select-text"},r))}export{B as Select,A as SelectContent,G as SelectGroup,F as SelectHeader,H as SelectItem,U as SelectLabel,S as SelectScrollDownButton,k as SelectScrollUpButton,J as SelectSeparator,K as SelectText,q as SelectTrigger,L as SelectValue,E as SelectWrapper,z as selectVariants};
|
|
4
4
|
//# sourceMappingURL=Select.mjs.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medway-ui/core",
|
|
3
|
-
"version": "1.33.
|
|
3
|
+
"version": "1.33.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Biblioteca de componentes e assets para o sistema Medway",
|
|
6
6
|
"author": "Alekcarvalho",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"prepare": "husky install || true",
|
|
32
32
|
"prebuild:lib": "npm run build:notes-core",
|
|
33
33
|
"build:lib": "node scripts/build-lib.mjs && npm run generate:docs",
|
|
34
|
+
"check:dist-classes": "node scripts/check-dist-classes.mjs",
|
|
34
35
|
"prebuild:native": "npm run build:notes-core",
|
|
35
36
|
"build:native": "cd native && bob build",
|
|
36
37
|
"build:notes-core": "tsc -p notes-core/tsconfig.build.json",
|