@medway-ui/core 1.33.0 → 1.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/COMPONENTS.md +110 -2
  2. package/COMPONENTS_SUMMARY.md +4 -2
  3. package/dist/COMPONENTS.md +110 -2
  4. package/dist/COMPONENTS_SUMMARY.md +4 -2
  5. package/dist/assets/css/tokens.css +49 -22
  6. package/dist/components/Alert.mjs +1 -1
  7. package/dist/components/AlertDialog.js +1 -1
  8. package/dist/components/AlertDialog.mjs +1 -1
  9. package/dist/components/Autocomplete.mjs +1 -1
  10. package/dist/components/Button.d.mts +2 -0
  11. package/dist/components/Button.d.mts.map +1 -1
  12. package/dist/components/Button.d.ts +2 -0
  13. package/dist/components/Button.d.ts.map +1 -1
  14. package/dist/components/Button.js +1 -1
  15. package/dist/components/Button.mjs +1 -1
  16. package/dist/components/CardContinue.mjs +1 -1
  17. package/dist/components/CardLesson.mjs +1 -1
  18. package/dist/components/CardModule.mjs +1 -1
  19. package/dist/components/CardNews.mjs +1 -1
  20. package/dist/components/CardTopic.mjs +1 -1
  21. package/dist/components/CardWeek.mjs +1 -1
  22. package/dist/components/Carousel.js +1 -1
  23. package/dist/components/Carousel.mjs +1 -1
  24. package/dist/components/Chip.d.mts +1 -1
  25. package/dist/components/Chip.d.mts.map +1 -1
  26. package/dist/components/Chip.d.ts +1 -1
  27. package/dist/components/Chip.d.ts.map +1 -1
  28. package/dist/components/Chip.js +1 -1
  29. package/dist/components/Chip.mjs +1 -1
  30. package/dist/components/ConfirmDeleteButton.d.mts +26 -0
  31. package/dist/components/ConfirmDeleteButton.d.mts.map +1 -0
  32. package/dist/components/ConfirmDeleteButton.d.ts +26 -0
  33. package/dist/components/ConfirmDeleteButton.d.ts.map +1 -0
  34. package/dist/components/ConfirmDeleteButton.js +4 -0
  35. package/dist/components/ConfirmDeleteButton.js.map +1 -0
  36. package/dist/components/ConfirmDeleteButton.mjs +4 -0
  37. package/dist/components/ConfirmDeleteButton.mjs.map +1 -0
  38. package/dist/components/NoteEditor.d.mts.map +1 -1
  39. package/dist/components/NoteEditor.d.ts.map +1 -1
  40. package/dist/components/NoteEditor.js +1 -1
  41. package/dist/components/NoteEditor.mjs +1 -1
  42. package/dist/components/NoteEditorLinkDialog.d.mts +36 -0
  43. package/dist/components/NoteEditorLinkDialog.d.mts.map +1 -0
  44. package/dist/components/NoteEditorLinkDialog.d.ts +36 -0
  45. package/dist/components/NoteEditorLinkDialog.d.ts.map +1 -0
  46. package/dist/components/NoteEditorLinkDialog.js +4 -0
  47. package/dist/components/NoteEditorLinkDialog.js.map +1 -0
  48. package/dist/components/NoteEditorLinkDialog.mjs +4 -0
  49. package/dist/components/NoteEditorLinkDialog.mjs.map +1 -0
  50. package/dist/components/Pagination.mjs +1 -1
  51. package/dist/components/Ranking.mjs +1 -1
  52. package/dist/components/Select.d.mts.map +1 -1
  53. package/dist/components/Select.d.ts.map +1 -1
  54. package/dist/components/Select.js +1 -1
  55. package/dist/components/Select.mjs +1 -1
  56. package/dist/components/Skeleton.js +1 -1
  57. package/dist/components/Skeleton.mjs +1 -1
  58. package/dist/components/Tag.d.mts +2 -1
  59. package/dist/components/Tag.d.mts.map +1 -1
  60. package/dist/components/Tag.d.ts +2 -1
  61. package/dist/components/Tag.d.ts.map +1 -1
  62. package/dist/components/Tag.js +1 -1
  63. package/dist/components/TagPicker.d.mts +91 -0
  64. package/dist/components/TagPicker.d.mts.map +1 -0
  65. package/dist/components/TagPicker.d.ts +91 -0
  66. package/dist/components/TagPicker.d.ts.map +1 -0
  67. package/dist/components/TagPicker.js +4 -0
  68. package/dist/components/TagPicker.js.map +1 -0
  69. package/dist/components/TagPicker.mjs +4 -0
  70. package/dist/components/TagPicker.mjs.map +1 -0
  71. package/dist/components/Toast.mjs +1 -1
  72. package/dist/index.d.mts +5 -1
  73. package/dist/index.d.mts.map +1 -1
  74. package/dist/index.d.ts +5 -1
  75. package/dist/index.d.ts.map +1 -1
  76. package/dist/index.js +1 -1
  77. package/dist/index.mjs +1 -1
  78. package/package.json +3 -2
@@ -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,We=(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)&&We(e,o,t[o]);if(ae)for(var o of ae(t))Be.call(t,o)&&We(e,o,t[o]);return e},T=(e,t)=>St(e,Pt(t)),U=(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,Ke="data-consumer-inert",zt={selectedIndex:0,snapCount:0,canScrollPrev:!1,canScrollNext:!1,slideCount:0,snapFirstSlides:[],announcement:""},It={horizontal:{ArrowLeft:"previous",ArrowRight:"next"},vertical:{ArrowUp:"previous",ArrowDown:"next"}},Et=["TEXTAREA","SELECT","VIDEO","AUDIO"],Ft=["button","checkbox","color","file","image","reset","submit"],Rt=["combobox","grid","listbox","menu","menubar","radiogroup","searchbox","slider","spinbutton","tablist","textbox","toolbar","tree","treegrid"],kt={horizontal:{previous:pt,next:ft},vertical:{previous:dt,next:ut}},Ot={previous:"Anterior",next:"Pr\xF3ximo"},At={none:{horizontal:{content:"",item:"",focusRing:""},vertical:{content:"",item:"",focusRing:""}},xs:{horizontal:{content:"-ml-2",item:"pl-2",focusRing:"focus-visible:after:left-2"},vertical:{content:"-mt-2",item:"pt-2",focusRing:"focus-visible:after:top-2"}},sm:{horizontal:{content:"-ml-3",item:"pl-3",focusRing:"focus-visible:after:left-3"},vertical:{content:"-mt-3",item:"pt-3",focusRing:"focus-visible:after:top-3"}},md:{horizontal:{content:"-ml-4",item:"pl-4",focusRing:"focus-visible:after:left-4"},vertical:{content:"-mt-4",item:"pt-4",focusRing:"focus-visible:after:top-4"}},lg:{horizontal:{content:"-ml-6",item:"pl-6",focusRing:"focus-visible:after:left-6"},vertical:{content:"-mt-6",item:"pt-6",focusRing:"focus-visible:after:top-6"}},xl:{horizontal:{content:"-ml-8",item:"pl-8",focusRing:"focus-visible:after:left-8"},vertical:{content:"-mt-8",item:"pt-8",focusRing:"focus-visible:after:top-8"}}},V=["side","floating","outside"],Lt=Y("relative",{variants:{orientation:{horizontal:"",vertical:""},controls:{side:"",floating:"",outside:"",inline:""}},compoundVariants:[{orientation:"horizontal",controls:V,class:"grid grid-flow-row-dense grid-cols-[auto_minmax(0,1fr)_auto] items-center [&>*]:col-span-full"},{orientation:"vertical",controls:V,class:"flex flex-col"}]}),Tt=Y("relative overflow-hidden",{variants:{orientation:{horizontal:"",vertical:""},controls:{side:"",floating:"",outside:"",inline:""}},compoundVariants:[{orientation:"horizontal",controls:V,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:V,direction:"previous",class:"!col-start-1 !col-span-1"},{orientation:"horizontal",controls:V,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:V,class:"self-center"},{orientation:"vertical",controls:"side",direction:"previous",class:"mb-2"},{orientation:"vertical",controls:"side",direction:"next",class:"mt-2"},{orientation:"vertical",controls:["floating","outside"],class:"h-0"}]}),Mt=Y("touch-manipulation disabled:opacity-50 dark:disabled:opacity-30",{variants:{orientation:{horizontal:"",vertical:""},controls:{side:"",floating:"",outside:"",inline:""},direction:{previous:"",next:""},opaque:{true:"",false:""}},compoundVariants:[{controls:["floating","outside"],class:"disabled:pointer-events-auto disabled:cursor-default"},{controls:"floating",class:"shadow-level-1"},{controls:"floating",opaque:!0,class:"bg-surface-elevated dark:bg-surface-elevated disabled:hover:bg-surface-elevated"},{controls:"outside",opaque:!0,class:"disabled:hover:bg-transparent"},{controls:["floating","outside"],opaque:!0,class:"disabled:hover:dark:border-gray-stroke-muted"},{orientation:"horizontal",controls:["floating","outside"],class:"absolute top-1/2 -translate-y-1/2"},{orientation:"horizontal",controls:"floating",direction:"previous",class:"left-2"},{orientation:"horizontal",controls:"floating",direction:"next",class:"right-2"},{orientation:"horizontal",controls:"outside",direction:"previous",class:"right-2"},{orientation:"horizontal",controls:"outside",direction:"next",class:"left-2"},{orientation:"vertical",controls:["floating","outside"],class:"absolute left-1/2 -translate-x-1/2"},{orientation:"vertical",controls:"floating",direction:"previous",class:"top-2"},{orientation:"vertical",controls:"floating",direction:"next",class:"bottom-2"},{orientation:"vertical",controls:"outside",direction:"previous",class:"bottom-2"},{orientation:"vertical",controls:"outside",direction:"next",class:"top-2"}]}),He=Y("pointer-events-none absolute z-[1] transition-opacity duration-200 motion-reduce:transition-none",{variants:{orientation:{horizontal:"inset-y-0 w-8",vertical:"inset-x-0 h-8"},edge:{start:"",end:""},visible:{true:"opacity-100",false:"opacity-0"}},compoundVariants:[{orientation:"horizontal",edge:"start",class:"left-0 bg-gradient-to-r from-background to-transparent"},{orientation:"horizontal",edge:"end",class:"right-0 bg-gradient-to-l from-background to-transparent"},{orientation:"vertical",edge:"start",class:"top-0 bg-gradient-to-b from-background to-transparent"},{orientation:"vertical",edge:"end",class:"bottom-0 bg-gradient-to-t from-background to-transparent"}]}),jt="focus:outline-0 focus-visible:after:pointer-events-none focus-visible:after:absolute focus-visible:after:inset-0 focus-visible:after:ring-[3px] focus-visible:after:ring-inset focus-visible:after:ring-state-focus",$t="group flex size-6 items-center justify-center rounded-pill hover:cursor-pointer focus:outline-0 focus-visible:ring-[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),Ue=Me(null);function Z(){const e=xe(ye);if(!e)throw new Error("useCarousel must be used within a Carousel component.");return e}function Wt(){const{selectedIndex:e,snapCount:t,canScrollPrev:o,canScrollNext:r,isScrollable:s,scrollPrev:d,scrollNext:c,scrollTo:f,autoplay:a}=Z();return ie(()=>({selectedIndex:e,snapCount:t,canScrollPrev:o,canScrollNext:r,isScrollable:s,scrollPrev:d,scrollNext:c,scrollTo:f,autoplay:a}),[e,t,o,r,s,d,c,f,a])}function Kt(e){return{selectedIndex:e.selectedScrollSnap(),snapCount:e.scrollSnapList().length,canScrollPrev:e.canScrollPrev(),canScrollNext:e.canScrollNext(),slideCount:e.slideNodes().length,snapFirstSlides:e.internalEngine().slideRegistry.map((t,o)=>{var r;return(r=t[0])!=null?r:o})}}function Ht(e,t){return e.selectedIndex===t.selectedIndex&&e.snapCount===t.snapCount&&e.canScrollPrev===t.canScrollPrev&&e.canScrollNext===t.canScrollNext&&e.slideCount===t.slideCount&&e.snapFirstSlides.length===t.snapFirstSlides.length&&e.snapFirstSlides.every((o,r)=>o===t.snapFirstSlides[r])&&e.announcement===t.announcement}function Ut(e,t){const o=Object.keys(e);return o.length===Object.keys(t).length&&o.every(r=>Object.is(e[r],t[r]))}function Ve(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 qe(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?qe(o.props.children,`${s}/`):[xt(o,{key:s})]})}function Vt(e,t,o){const r=document.activeElement;return r===o&&!e.canScrollNext&&e.canScrollPrev?"previous":r===t&&!e.canScrollPrev&&e.canScrollNext?"next":null}function qt(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:"")||qt(e,t)}function Xt(e,t){const o=e.nativeEvent.composedPath();return o.slice(0,o.indexOf(e.currentTarget)).some(r=>r instanceof Element&&_t(r,t))}function Gt(e){try{return e.matches(":focus-visible")}catch(t){return!1}}function _e(e){var t;return(t=e.internalEngine().slideRegistry[e.selectedScrollSnap()])!=null?t:[]}function Xe(e){return e.hasAttribute(Ke)}function Ge(e){e.getAttribute("tabindex")==="-1"&&e.removeAttribute("tabindex")}function Ne(e){var t,o;(o=(t=e.plugins())==null?void 0:t.autoplay)==null||o.reset()}function Jt(e){const t=typeof e=="object"?e.delay:void 0;return t!==void 0&&Number.isFinite(t)&&t>0?t:wt}function Je(e,t){return e==="page"?t.snapCount!==t.slideCount:Ve(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:q,onPointerEnter:_,onPointerLeave:Q}=o,se=U(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":Ve(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,W=A&&te&&!J&&!et,Fe=S(W),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=>{q==null||q(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:W,toggle:Oe}),[A,J,W,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=W,Re.current=y}),O(()=>{l&&z&&z(l)},[l,z]),O(()=>{if(!l)return;let n=!1;const i=(C,m)=>{const p=Kt(l),K=m==="select"&&n;K&&(n=!1);const Le=m!=="select"?void 0:K?"":Yt(l,Je(ze.current,p));pe.current=ve.current?Vt(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&&Ut(n,e))return;if(Ie.current=e,M===void 0){ee.current=null;return}const i=l.selectedScrollSnap(),x=M===Ce(n==null?void 0:n.index);if(i!==j.current&&x)return;const F=Math.max(0,l.scrollSnapList().length-1);ee.current=M>F?M:null;const C=Math.min(M,F);C!==i&&(j.current=C,ge(C))}),O(()=>{if(!l||a!=="fade")return;const n=new Set,i=()=>{const x=l.slideNodes(),F=new Set(_e(l)),C=x.some((p,K)=>!F.has(K)&&p.contains(document.activeElement));x.forEach((p,K)=>{p.inert=!F.has(K)||Xe(p),p.inert&&n.has(p)&&(Ge(p),n.delete(p))});const m=C?x.find(p=>!p.inert):void 0;m&&(m.hasAttribute("tabindex")||(m.tabIndex=-1,n.add(m)),m.focus({preventScroll:!0}))};return oe.current=i,i(),l.on("select",i).on("reInit",i),()=>{oe.current=null,l.off("select",i).off("reInit",i);for(const x of l.slideNodes())x.inert=Xe(x);n.forEach(Ge)}},[l,a]),O(()=>{var n;const i=(n=l==null?void 0:l.plugins())==null?void 0:n.autoplay;i&&(W?i.play(y):i.stop())},[l,W,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=U(o,["gap","fadeEdges","fadeClassName","viewportClassName","className","children"]);const{viewportRef:h,orientation:u,controls:w,canScrollPrev:E,canScrollNext:R,announcement:k,autoplay:b}=Z(),z=qe(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(Ue.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=U(o,["className","inert"]);const c=xe(Ue),f=xe(ye),a=f==null?void 0:f.syncFadeInert,g=(f==null?void 0:f.transition)==="fade",h=!!s||s==="",u={[Ke]:h||void 0};return O(()=>{a==null||a()},[h,a]),v("div",N(T(N({ref:t,role:"group","aria-roledescription":"slide","aria-label":c?`${c.index+1} de ${c.total}`:void 0,"data-slot":"carousel-item"},u),{inert:s,className:P("min-w-0 shrink-0 grow-0 basis-full",c==null?void 0:c.gapClassName,g&&jt,g&&(c==null?void 0:c.focusRingClassName),r)}),d))}),Ye=L(function(e,t){var o=e,{direction:r,variant:s="outlined",size:d="md",className:c,containerClassName:f,disabled:a,onClick:g}=o,h=U(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(),q=r==="previous",_=q?z:I,Q=yt(t,q?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=U(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=U(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,Wt as useCarousel};
4
4
  //# sourceMappingURL=Carousel.mjs.map
@@ -28,7 +28,7 @@ declare const chipClearVariants: (props?: ({
28
28
  size?: "sm" | "md" | "lg" | null | undefined;
29
29
  } & ({ class: import("clsx").ClassValue; className?: never } | { class?: never; className: import("clsx").ClassValue } | { class?: never; className?: never })) | undefined) => string;
30
30
  declare function Chip({ className, size, dismissLabel, children, ...props }: ChipProps): import("react/jsx-runtime").JSX.Element;
31
- declare function ChipFilter({ className, size, icon, criteria, checked, children, ...props }: ChipFilterProps): import("react/jsx-runtime").JSX.Element;
31
+ declare const ChipFilter: import("react").ForwardRefExoticComponent<Omit<ChipFilterProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
32
32
  declare function ChipChoice({ className, size, icon, checked, children, ...props }: ChipChoiceProps): import("react/jsx-runtime").JSX.Element;
33
33
  declare function ChipClear({ className, size, children, ...props }: ChipClearProps): import("react/jsx-runtime").JSX.Element;
34
34
  export { Chip, ChipChoice, ChipClear, ChipFilter, chipClearVariants, chipSelectableVariants, chipVariants, };
@@ -1 +1 @@
1
- {"version":3,"file":"Chip.d.ts","sourceRoot":"","sources":["../../src/components/Chip.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAKlE,KAAK,QAAQ,GAAG,MAAM,OAAO,SAAS,CAAC;AAEvC,UAAU,SACR,SAAQ,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,EAC5C,YAAY,CAAC,OAAO,YAAY,CAAC;IACnC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,mBACR,SAAQ,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,EAC5C,YAAY,CAAC,OAAO,sBAAsB,CAAC;IAC7C,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,UAAU,eAAgB,SAAQ,mBAAmB;IACnD,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,KAAK,eAAe,GAAG,mBAAmB,CAAC;AAE3C,KAAK,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,GAC1D,YAAY,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEzC,QAAA,MAAM,SAAS;;;;CAId,CAAC;AAUF,QAAA,MAAM,YAAY;;8EAMjB,CAAC;AAEF,QAAA,MAAM,sBAAsB;;8EAM3B,CAAC;AAEF,QAAA,MAAM,iBAAiB;;8EAMtB,CAAC;AAQF,iBAAS,IAAI,CAAC,EACZ,SAAS,EACT,IAAI,EACJ,YAAwB,EACxB,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,SAAS,2CAiBX;AAED,iBAAS,UAAU,CAAC,EAClB,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,OAAe,EACf,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,eAAe,2CAmCjB;AAED,iBAAS,UAAU,CAAC,EAClB,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,OAAe,EACf,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,eAAe,2CA0BjB;AAED,iBAAS,SAAS,CAAC,EACjB,SAAS,EACT,IAAI,EACJ,QAAmB,EACnB,GAAG,KAAK,EACT,EAAE,cAAc,2CAYhB;AAED,OAAO,EACL,IAAI,EACJ,UAAU,EACV,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,sBAAsB,EACtB,YAAY,GACb,CAAC;AACF,YAAY,EACV,eAAe,EACf,cAAc,EACd,eAAe,EACf,SAAS,EACT,QAAQ,GACT,CAAC"}
1
+ {"version":3,"file":"Chip.d.ts","sourceRoot":"","sources":["../../src/components/Chip.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACxE,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAKlE,KAAK,QAAQ,GAAG,MAAM,OAAO,SAAS,CAAC;AAEvC,UAAU,SACR,SAAQ,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,EAC5C,YAAY,CAAC,OAAO,YAAY,CAAC;IACnC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,mBACR,SAAQ,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,EAC5C,YAAY,CAAC,OAAO,sBAAsB,CAAC;IAC7C,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,UAAU,eAAgB,SAAQ,mBAAmB;IACnD,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,KAAK,eAAe,GAAG,mBAAmB,CAAC;AAE3C,KAAK,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,GAC1D,YAAY,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEzC,QAAA,MAAM,SAAS;;;;CAId,CAAC;AAUF,QAAA,MAAM,YAAY;;8EAMjB,CAAC;AAEF,QAAA,MAAM,sBAAsB;;8EAM3B,CAAC;AAEF,QAAA,MAAM,iBAAiB;;8EAMtB,CAAC;AAQF,iBAAS,IAAI,CAAC,EACZ,SAAS,EACT,IAAI,EACJ,YAAwB,EACxB,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,SAAS,2CAiBX;AAID,QAAA,MAAM,UAAU,4HAyCf,CAAC;AAEF,iBAAS,UAAU,CAAC,EAClB,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,OAAe,EACf,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,eAAe,2CA0BjB;AAED,iBAAS,SAAS,CAAC,EACjB,SAAS,EACT,IAAI,EACJ,QAAmB,EACnB,GAAG,KAAK,EACT,EAAE,cAAc,2CAYhB;AAED,OAAO,EACL,IAAI,EACJ,UAAU,EACV,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,sBAAsB,EACtB,YAAY,GACb,CAAC;AACF,YAAY,EACV,eAAe,EACf,cAAc,EACd,eAAe,EACf,SAAS,EACT,QAAQ,GACT,CAAC"}
@@ -28,7 +28,7 @@ declare const chipClearVariants: (props?: ({
28
28
  size?: "sm" | "md" | "lg" | null | undefined;
29
29
  } & ({ class: import("clsx").ClassValue; className?: never } | { class?: never; className: import("clsx").ClassValue } | { class?: never; className?: never })) | undefined) => string;
30
30
  declare function Chip({ className, size, dismissLabel, children, ...props }: ChipProps): import("react/jsx-runtime").JSX.Element;
31
- declare function ChipFilter({ className, size, icon, criteria, checked, children, ...props }: ChipFilterProps): import("react/jsx-runtime").JSX.Element;
31
+ declare const ChipFilter: import("react").ForwardRefExoticComponent<Omit<ChipFilterProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
32
32
  declare function ChipChoice({ className, size, icon, checked, children, ...props }: ChipChoiceProps): import("react/jsx-runtime").JSX.Element;
33
33
  declare function ChipClear({ className, size, children, ...props }: ChipClearProps): import("react/jsx-runtime").JSX.Element;
34
34
  export { Chip, ChipChoice, ChipClear, ChipFilter, chipClearVariants, chipSelectableVariants, chipVariants, };
@@ -1 +1 @@
1
- {"version":3,"file":"Chip.d.ts","sourceRoot":"","sources":["../../src/components/Chip.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAKlE,KAAK,QAAQ,GAAG,MAAM,OAAO,SAAS,CAAC;AAEvC,UAAU,SACR,SAAQ,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,EAC5C,YAAY,CAAC,OAAO,YAAY,CAAC;IACnC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,mBACR,SAAQ,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,EAC5C,YAAY,CAAC,OAAO,sBAAsB,CAAC;IAC7C,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,UAAU,eAAgB,SAAQ,mBAAmB;IACnD,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,KAAK,eAAe,GAAG,mBAAmB,CAAC;AAE3C,KAAK,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,GAC1D,YAAY,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEzC,QAAA,MAAM,SAAS;;;;CAId,CAAC;AAUF,QAAA,MAAM,YAAY;;8EAMjB,CAAC;AAEF,QAAA,MAAM,sBAAsB;;8EAM3B,CAAC;AAEF,QAAA,MAAM,iBAAiB;;8EAMtB,CAAC;AAQF,iBAAS,IAAI,CAAC,EACZ,SAAS,EACT,IAAI,EACJ,YAAwB,EACxB,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,SAAS,2CAiBX;AAED,iBAAS,UAAU,CAAC,EAClB,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,OAAe,EACf,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,eAAe,2CAmCjB;AAED,iBAAS,UAAU,CAAC,EAClB,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,OAAe,EACf,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,eAAe,2CA0BjB;AAED,iBAAS,SAAS,CAAC,EACjB,SAAS,EACT,IAAI,EACJ,QAAmB,EACnB,GAAG,KAAK,EACT,EAAE,cAAc,2CAYhB;AAED,OAAO,EACL,IAAI,EACJ,UAAU,EACV,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,sBAAsB,EACtB,YAAY,GACb,CAAC;AACF,YAAY,EACV,eAAe,EACf,cAAc,EACd,eAAe,EACf,SAAS,EACT,QAAQ,GACT,CAAC"}
1
+ {"version":3,"file":"Chip.d.ts","sourceRoot":"","sources":["../../src/components/Chip.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACxE,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAKlE,KAAK,QAAQ,GAAG,MAAM,OAAO,SAAS,CAAC;AAEvC,UAAU,SACR,SAAQ,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,EAC5C,YAAY,CAAC,OAAO,YAAY,CAAC;IACnC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,mBACR,SAAQ,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,EAC5C,YAAY,CAAC,OAAO,sBAAsB,CAAC;IAC7C,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,UAAU,eAAgB,SAAQ,mBAAmB;IACnD,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,KAAK,eAAe,GAAG,mBAAmB,CAAC;AAE3C,KAAK,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,GAC1D,YAAY,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEzC,QAAA,MAAM,SAAS;;;;CAId,CAAC;AAUF,QAAA,MAAM,YAAY;;8EAMjB,CAAC;AAEF,QAAA,MAAM,sBAAsB;;8EAM3B,CAAC;AAEF,QAAA,MAAM,iBAAiB;;8EAMtB,CAAC;AAQF,iBAAS,IAAI,CAAC,EACZ,SAAS,EACT,IAAI,EACJ,YAAwB,EACxB,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,SAAS,2CAiBX;AAID,QAAA,MAAM,UAAU,4HAyCf,CAAC;AAEF,iBAAS,UAAU,CAAC,EAClB,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,OAAe,EACf,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,eAAe,2CA0BjB;AAED,iBAAS,SAAS,CAAC,EACjB,SAAS,EACT,IAAI,EACJ,QAAmB,EACnB,GAAG,KAAK,EACT,EAAE,cAAc,2CAYhB;AAED,OAAO,EACL,IAAI,EACJ,UAAU,EACV,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,sBAAsB,EACtB,YAAY,GACb,CAAC;AACF,YAAY,EACV,eAAe,EACf,cAAc,EACd,eAAe,EACf,SAAS,EACT,QAAQ,GACT,CAAC"}
@@ -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*='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;
3
+ "use strict";var s=require("react/jsx-runtime"),O=require("react"),f=require("class-variance-authority"),c=require("@medway-ui/icons"),o=require("../lib/utils.js"),P=Object.defineProperty,V=Object.defineProperties,q=Object.getOwnPropertyDescriptors,l=Object.getOwnPropertySymbols,x=Object.prototype.hasOwnProperty,y=Object.prototype.propertyIsEnumerable,j=(r,e,a)=>e in r?P(r,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[e]=a,u=(r,e)=>{for(var a in e||(e={}))x.call(e,a)&&j(r,a,e[a]);if(l)for(var a of l(e))y.call(e,a)&&j(r,a,e[a]);return r},h=(r,e)=>V(r,q(e)),m=(r,e)=>{var a={};for(var t in r)x.call(r,t)&&e.indexOf(t)<0&&(a[t]=r[t]);if(r!=null&&l)for(var t of l(r))e.indexOf(t)<0&&y.call(r,t)&&(a[t]=r[t]);return a};const _={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:_},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),F={sm:"w-[5px]",md:"w-[6px]",lg:"w-[7px]"};function M(r){var e=r,{className:a,size:t,dismissLabel:i="Remover",children:n}=e,d=m(e,["className","size","dismissLabel","children"]);return s.jsxs("button",h(u({"data-slot":"chip",className:o.cn(k({size:t}),a)},d),{type:"button",children:[s.jsx("span",{className:"truncate",children:n}),s.jsx("span",{className:"sr-only",children:i}),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"})]}))}const R=O.forwardRef(function(r,e){var a=r,{className:t,size:i,icon:n,criteria:d,checked:b=!1,children:z}=a,w=m(a,["className","size","icon","criteria","checked","children"]);const C=d!=null&&typeof d!="boolean"&&d!=="";return s.jsxs("button",h(u({ref:e,"data-slot":"chip-filter","data-checked":b,className:o.cn(v({size:i}),t)},w),{type:"button",children:[n,s.jsxs("span",{className:"inline-flex min-w-0",children:[s.jsx("span",{className:"truncate",children:z}),C&&s.jsxs(s.Fragment,{children:[s.jsx("span",{"aria-hidden":"true",className:o.cn("inline-flex shrink-0 justify-center",F[i!=null?i:p.defaultVariants.size]),children:":"}),s.jsx("span",{className:"truncate",children:d})]})]}),s.jsx(c.ChevronDown,{"aria-hidden":"true"})]}))});function D(r){var e=r,{className:a,size:t,icon:i,checked:n=!1,children:d}=e,b=m(e,["className","size","icon","checked","children"]);return s.jsxs("button",h(u({"data-slot":"chip-choice","data-checked":n,"aria-pressed":n,className:o.cn(v({size:t}),a)},b),{type:"button",children:[i,s.jsx("span",{className:"truncate",children:d}),n&&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 L(r){var e=r,{className:a,size:t,children:i="Limpar"}=e,n=m(e,["className","size","children"]);return s.jsxs("button",h(u({"data-slot":"chip-clear",className:o.cn(N({size:t}),a)},n),{type:"button",children:[s.jsx("span",{className:"truncate",children:i}),s.jsx(c.CloseMd,{"aria-hidden":"true"})]}))}exports.Chip=M,exports.ChipChoice=D,exports.ChipClear=L,exports.ChipFilter=R,exports.chipClearVariants=N,exports.chipSelectableVariants=v,exports.chipVariants=k;
4
4
  //# sourceMappingURL=Chip.js.map
@@ -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*='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};
3
+ import{jsxs as o,jsx as s,Fragment as x}from"react/jsx-runtime";import{forwardRef as V}from"react";import{cva as b}from"class-variance-authority";import{ChevronDown as _,CloseMd as g,CheckMedium as D}from"@medway-ui/icons";import{cn as c}from"../lib/utils.mjs";var F=Object.defineProperty,L=Object.defineProperties,R=Object.getOwnPropertyDescriptors,l=Object.getOwnPropertySymbols,k=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable,z=(r,e,a)=>e in r?F(r,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[e]=a,u=(r,e)=>{for(var a in e||(e={}))k.call(e,a)&&z(r,a,e[a]);if(l)for(var a of l(e))N.call(e,a)&&z(r,a,e[a]);return r},h=(r,e)=>L(r,R(e)),m=(r,e)=>{var a={};for(var t in r)k.call(r,t)&&e.indexOf(t)<0&&(a[t]=r[t]);if(r!=null&&l)for(var t of l(r))e.indexOf(t)<0&&N.call(r,t)&&(a[t]=r[t]);return a};const E={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:E},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=b([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=b([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=b([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 S(r){var e=r,{className:a,size:t,dismissLabel:i="Remover",children:d}=e,n=m(e,["className","size","dismissLabel","children"]);return o("button",h(u({"data-slot":"chip",className:c(w({size:t}),a)},n),{type:"button",children:[s("span",{className:"truncate",children:d}),s("span",{className:"sr-only",children:i}),s(g,{"aria-hidden":"true","data-slot":"chip-dismiss",className:"text-gray-foreground-muted [@media(hover:hover)]:group-hover/chip:text-primary-foreground"})]}))}const B=V(function(r,e){var a=r,{className:t,size:i,icon:d,criteria:n,checked:f=!1,children:C}=a,O=m(a,["className","size","icon","criteria","checked","children"]);const P=n!=null&&typeof n!="boolean"&&n!=="";return o("button",h(u({ref:e,"data-slot":"chip-filter","data-checked":f,className:c(y({size:i}),t)},O),{type:"button",children:[d,o("span",{className:"inline-flex min-w-0",children:[s("span",{className:"truncate",children:C}),P&&o(x,{children:[s("span",{"aria-hidden":"true",className:c("inline-flex shrink-0 justify-center",M[i!=null?i:p.defaultVariants.size]),children:":"}),s("span",{className:"truncate",children:n})]})]}),s(_,{"aria-hidden":"true"})]}))});function H(r){var e=r,{className:a,size:t,icon:i,checked:d=!1,children:n}=e,f=m(e,["className","size","icon","checked","children"]);return o("button",h(u({"data-slot":"chip-choice","data-checked":d,"aria-pressed":d,className:c(y({size:t}),a)},f),{type:"button",children:[i,s("span",{className:"truncate",children:n}),d&&o(x,{children:[s(D,{"aria-hidden":"true",className:"text-secondary-foreground group-disabled/chip:text-gray-foreground-muted [@media(hover:hover)]:group-hover/chip:hidden"}),s(g,{"aria-hidden":"true",className:"hidden text-primary-foreground [@media(hover:hover)]:group-hover/chip:block"})]})]}))}function I(r){var e=r,{className:a,size:t,children:i="Limpar"}=e,d=m(e,["className","size","children"]);return o("button",h(u({"data-slot":"chip-clear",className:c(j({size:t}),a)},d),{type:"button",children:[s("span",{className:"truncate",children:i}),s(g,{"aria-hidden":"true"})]}))}export{S as Chip,H as ChipChoice,I as ChipClear,B as ChipFilter,j as chipClearVariants,y as chipSelectableVariants,w as chipVariants};
4
4
  //# sourceMappingURL=Chip.mjs.map
@@ -0,0 +1,26 @@
1
+ import { type ComponentProps } from "react";
2
+ import { type ButtonProps } from "./Button.mjs";
3
+ interface ConfirmDeleteButtonProps extends Omit<ComponentProps<"div">, "children" | "onChange"> {
4
+ onConfirm: () => void | Promise<void>;
5
+ /** Nome acessível da lixeira (ex.: "Excluir tag Pediatria"). */
6
+ label?: string;
7
+ /** Texto visível do botão de confirmação. */
8
+ confirmLabel?: string;
9
+ /** Nome acessível do botão de confirmação. Sem valor, usa o texto visível. */
10
+ confirmAriaLabel?: string;
11
+ /** Nome acessível do botão de cancelar. */
12
+ cancelLabel?: string;
13
+ /** Estado de confirmação controlado. */
14
+ confirming?: boolean;
15
+ /** Estado inicial de confirmação quando não controlado. */
16
+ defaultConfirming?: boolean;
17
+ /** Avisa quando entra ou sai do estado de confirmação. */
18
+ onConfirmingChange?: (confirming: boolean) => void;
19
+ /** Tamanho dos botões. */
20
+ size?: Extract<ButtonProps["size"], "sm" | "md">;
21
+ disabled?: boolean;
22
+ }
23
+ declare function ConfirmDeleteButton({ onConfirm, label, confirmLabel, confirmAriaLabel, cancelLabel, confirming: confirmingProp, defaultConfirming, onConfirmingChange, size, disabled, className, onKeyDown, ...props }: ConfirmDeleteButtonProps): import("react/jsx-runtime").JSX.Element;
24
+ export { ConfirmDeleteButton };
25
+ export type { ConfirmDeleteButtonProps };
26
+ //# sourceMappingURL=ConfirmDeleteButton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfirmDeleteButton.d.ts","sourceRoot":"","sources":["../../src/components/ConfirmDeleteButton.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA+B,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAGzE,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAG/D,UAAU,wBACR,SAAQ,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;IAC5D,SAAS,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,gEAAgE;IAChE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6CAA6C;IAC7C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8EAA8E;IAC9E,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,2CAA2C;IAC3C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wCAAwC;IACxC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,2DAA2D;IAC3D,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,0DAA0D;IAC1D,kBAAkB,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;IACnD,0BAA0B;IAC1B,IAAI,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC,CAAC;IACjD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAID,iBAAS,mBAAmB,CAAC,EAC3B,SAAS,EACT,KAAiB,EACjB,YAA0B,EAC1B,gBAAgB,EAChB,WAAiC,EACjC,UAAU,EAAE,cAAc,EAC1B,iBAAyB,EACzB,kBAAkB,EAClB,IAAW,EACX,QAAgB,EAChB,SAAS,EACT,SAAS,EACT,GAAG,KAAK,EACT,EAAE,wBAAwB,2CAwF1B;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAC/B,YAAY,EAAE,wBAAwB,EAAE,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { type ComponentProps } from "react";
2
+ import { type ButtonProps } from "./Button.js";
3
+ interface ConfirmDeleteButtonProps extends Omit<ComponentProps<"div">, "children" | "onChange"> {
4
+ onConfirm: () => void | Promise<void>;
5
+ /** Nome acessível da lixeira (ex.: "Excluir tag Pediatria"). */
6
+ label?: string;
7
+ /** Texto visível do botão de confirmação. */
8
+ confirmLabel?: string;
9
+ /** Nome acessível do botão de confirmação. Sem valor, usa o texto visível. */
10
+ confirmAriaLabel?: string;
11
+ /** Nome acessível do botão de cancelar. */
12
+ cancelLabel?: string;
13
+ /** Estado de confirmação controlado. */
14
+ confirming?: boolean;
15
+ /** Estado inicial de confirmação quando não controlado. */
16
+ defaultConfirming?: boolean;
17
+ /** Avisa quando entra ou sai do estado de confirmação. */
18
+ onConfirmingChange?: (confirming: boolean) => void;
19
+ /** Tamanho dos botões. */
20
+ size?: Extract<ButtonProps["size"], "sm" | "md">;
21
+ disabled?: boolean;
22
+ }
23
+ declare function ConfirmDeleteButton({ onConfirm, label, confirmLabel, confirmAriaLabel, cancelLabel, confirming: confirmingProp, defaultConfirming, onConfirmingChange, size, disabled, className, onKeyDown, ...props }: ConfirmDeleteButtonProps): import("react/jsx-runtime").JSX.Element;
24
+ export { ConfirmDeleteButton };
25
+ export type { ConfirmDeleteButtonProps };
26
+ //# sourceMappingURL=ConfirmDeleteButton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfirmDeleteButton.d.ts","sourceRoot":"","sources":["../../src/components/ConfirmDeleteButton.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA+B,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAGzE,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAG/D,UAAU,wBACR,SAAQ,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;IAC5D,SAAS,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,gEAAgE;IAChE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6CAA6C;IAC7C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8EAA8E;IAC9E,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,2CAA2C;IAC3C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wCAAwC;IACxC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,2DAA2D;IAC3D,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,0DAA0D;IAC1D,kBAAkB,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;IACnD,0BAA0B;IAC1B,IAAI,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC,CAAC;IACjD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAID,iBAAS,mBAAmB,CAAC,EAC3B,SAAS,EACT,KAAiB,EACjB,YAA0B,EAC1B,gBAAgB,EAChB,WAAiC,EACjC,UAAU,EAAE,cAAc,EAC1B,iBAAyB,EACzB,kBAAkB,EAClB,IAAW,EACX,QAAgB,EAChB,SAAS,EACT,SAAS,EACT,GAAG,KAAK,EACT,EAAE,wBAAwB,2CAwF1B;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAC/B,YAAY,EAAE,wBAAwB,EAAE,CAAC"}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ "use client";
3
+ "use strict";var s=require("react/jsx-runtime"),l=require("react"),O=require("@medway-ui/icons"),h=require("./Button.js"),K=require("../lib/utils.js"),F=Object.defineProperty,H=Object.defineProperties,I=Object.getOwnPropertyDescriptors,u=Object.getOwnPropertySymbols,L=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable,E=(e,r,n)=>r in e?F(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n,M=(e,r)=>{for(var n in r||(r={}))L.call(r,n)&&E(e,n,r[n]);if(u)for(var n of u(r))w.call(r,n)&&E(e,n,r[n]);return e},T=(e,r)=>H(e,I(r)),U=(e,r)=>{var n={};for(var t in e)L.call(e,t)&&r.indexOf(t)<0&&(n[t]=e[t]);if(e!=null&&u)for(var t of u(e))r.indexOf(t)<0&&w.call(e,t)&&(n[t]=e[t]);return n};const V={sm:14,md:16};function W(e){var r=e,{onConfirm:n,label:t="Excluir",confirmLabel:z="Confirmar",confirmAriaLabel:D,cancelLabel:P="Cancelar exclus\xE3o",confirming:f,defaultConfirming:k=!1,onConfirmingChange:p,size:c="sm",disabled:q=!1,className:R,onKeyDown:g}=r,S=U(r,["onConfirm","label","confirmLabel","confirmAriaLabel","cancelLabel","confirming","defaultConfirming","onConfirmingChange","size","disabled","className","onKeyDown"]);const[B,N]=l.useState(k),i=f!=null?f:B,[o,C]=l.useState(!1),m=l.useRef(!1),d=l.useRef(!1),b=l.useRef(null),x=V[c!=null?c:"sm"];l.useEffect(()=>{var a;if(o||!d.current)return;d.current=!1;const y=document.activeElement;(!y||y===document.body)&&((a=b.current)==null||a.focus())},[o]);const v=a=>{f===void 0&&N(a),p==null||p(a)},j=()=>{var a;v(!1),(a=b.current)==null||a.focus()},A=async()=>{if(!i){v(!0);return}if(m.current)return;m.current=!0,C(!0);let a=!1;try{await n(),a=!0}catch(y){}m.current=!1,d.current=!0,C(!1),a&&v(!1)};return s.jsxs("div",T(M({"data-slot":"confirm-delete-button","data-state":i?"confirming":"idle",className:K.cn("inline-flex shrink-0 items-center gap-1",R),onKeyDown:a=>{g==null||g(a),a.key==="Escape"&&i&&!o&&j()}},S),{children:[s.jsx(h.Button,{ref:b,type:"button",variant:"error-soft",size:c,"aria-label":i?D:t,disabled:q,loading:o,onClick:A,iconLeft:s.jsx(O.TrashEmpty,{size:x,"aria-hidden":"true"}),children:i&&z}),i&&s.jsx(h.Button,{type:"button",variant:"regular-basic",size:c,"aria-label":P,disabled:o,onClick:j,iconLeft:s.jsx(O.CloseSm,{size:x,"aria-hidden":"true"})})]}))}exports.ConfirmDeleteButton=W;
4
+ //# sourceMappingURL=ConfirmDeleteButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfirmDeleteButton.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ "use client";
3
+ import{jsxs as U,jsx as c}from"react/jsx-runtime";import{useState as x,useRef as v,useEffect as F}from"react";import{TrashEmpty as H,CloseSm as I}from"@medway-ui/icons";import{Button as L}from"./Button.mjs";import{cn as M}from"../lib/utils.mjs";var T=Object.defineProperty,V=Object.defineProperties,W=Object.getOwnPropertyDescriptors,f=Object.getOwnPropertySymbols,j=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable,E=(e,r,n)=>r in e?T(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n,Z=(e,r)=>{for(var n in r||(r={}))j.call(r,n)&&E(e,n,r[n]);if(f)for(var n of f(r))w.call(r,n)&&E(e,n,r[n]);return e},_=(e,r)=>V(e,W(r)),$=(e,r)=>{var n={};for(var t in e)j.call(e,t)&&r.indexOf(t)<0&&(n[t]=e[t]);if(e!=null&&f)for(var t of f(e))r.indexOf(t)<0&&w.call(e,t)&&(n[t]=e[t]);return n};const q={sm:14,md:16};function G(e){var r=e,{onConfirm:n,label:t="Excluir",confirmLabel:z="Confirmar",confirmAriaLabel:D,cancelLabel:P="Cancelar exclus\xE3o",confirming:s,defaultConfirming:k=!1,onConfirmingChange:y,size:o="sm",disabled:N=!1,className:S,onKeyDown:g}=r,A=$(r,["onConfirm","label","confirmLabel","confirmAriaLabel","cancelLabel","confirming","defaultConfirming","onConfirmingChange","size","disabled","className","onKeyDown"]);const[K,B]=x(k),l=s!=null?s:K,[i,C]=x(!1),u=v(!1),m=v(!1),d=v(null),O=q[o!=null?o:"sm"];F(()=>{var a;if(i||!m.current)return;m.current=!1;const p=document.activeElement;(!p||p===document.body)&&((a=d.current)==null||a.focus())},[i]);const b=a=>{s===void 0&&B(a),y==null||y(a)},h=()=>{var a;b(!1),(a=d.current)==null||a.focus()},R=async()=>{if(!l){b(!0);return}if(u.current)return;u.current=!0,C(!0);let a=!1;try{await n(),a=!0}catch(p){}u.current=!1,m.current=!0,C(!1),a&&b(!1)};return U("div",_(Z({"data-slot":"confirm-delete-button","data-state":l?"confirming":"idle",className:M("inline-flex shrink-0 items-center gap-1",S),onKeyDown:a=>{g==null||g(a),a.key==="Escape"&&l&&!i&&h()}},A),{children:[c(L,{ref:d,type:"button",variant:"error-soft",size:o,"aria-label":l?D:t,disabled:N,loading:i,onClick:R,iconLeft:c(H,{size:O,"aria-hidden":"true"}),children:l&&z}),l&&c(L,{type:"button",variant:"regular-basic",size:o,"aria-label":P,disabled:i,onClick:h,iconLeft:c(I,{size:O,"aria-hidden":"true"})})]}))}export{G as ConfirmDeleteButton};
4
+ //# sourceMappingURL=ConfirmDeleteButton.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfirmDeleteButton.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"NoteEditor.d.ts","sourceRoot":"","sources":["../../src/components/NoteEditor.tsx"],"names":[],"mappings":"AAEA,OAAO,EAWL,KAAK,cAAc,EAKpB,MAAM,OAAO,CAAC;AAUf,OAAO,KAAK,EACV,cAAc,EAGf,MAAM,uBAAuB,CAAC;AAY/B,OAAO,EACL,MAAM,EAMN,KAAK,sBAAsB,EAE5B,MAAM,8BAA8B,CAAC;AA2BtC;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,cAAc,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,yEAAyE;AACzE,MAAM,MAAM,kBAAkB,GAAG,eAAe,CAAC;AAEjD;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,KAAK,EAAE,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,KAAK,KAAK,IAAI,CAAC;IAC5C,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,WAAW,EAAE,MAAM,cAAc,CAAC;IAClC;;;;;;OAMG;IACH,WAAW,EAAE,MAAM,eAAe,CAAC;IACnC;;;OAGG;IACH,WAAW,EAAE,CACX,GAAG,EAAE,cAAc,GAAG,MAAM,EAC5B,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,KAC1B,IAAI,CAAC;CACX,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG;IACtE;;;;;;;;OAQG;IACH,QAAQ,CAAC,EAAE,cAAc,GAAG,MAAM,CAAC;IACnC;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sEAAsE;IACtE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,cAAc,KAAK,IAAI,CAAC;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,KAAK,CAAC;IACtC;;;OAGG;IACH,eAAe,CAAC,EAAE,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAClD;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;;;;OAUG;IACH,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAChD;;;;;;;;OAQG;IACH,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,+EAA+E;IAC/E,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAu1BF;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,UAAU,2HA8qBf,CAAC;AAIF,OAAO,EAAE,UAAU,EAAE,CAAC"}
1
+ {"version":3,"file":"NoteEditor.d.ts","sourceRoot":"","sources":["../../src/components/NoteEditor.tsx"],"names":[],"mappings":"AAEA,OAAO,EAYL,KAAK,cAAc,EAOpB,MAAM,OAAO,CAAC;AAUf,OAAO,KAAK,EACV,cAAc,EAGf,MAAM,uBAAuB,CAAC;AAY/B,OAAO,EACL,MAAM,EAMN,KAAK,sBAAsB,EAE5B,MAAM,8BAA8B,CAAC;AAgDtC;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,cAAc,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,yEAAyE;AACzE,MAAM,MAAM,kBAAkB,GAAG,eAAe,CAAC;AAEjD;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,KAAK,EAAE,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,KAAK,KAAK,IAAI,CAAC;IAC5C,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,WAAW,EAAE,MAAM,cAAc,CAAC;IAClC;;;;;;OAMG;IACH,WAAW,EAAE,MAAM,eAAe,CAAC;IACnC;;;OAGG;IACH,WAAW,EAAE,CACX,GAAG,EAAE,cAAc,GAAG,MAAM,EAC5B,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,KAC1B,IAAI,CAAC;CACX,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG;IACtE;;;;;;;;OAQG;IACH,QAAQ,CAAC,EAAE,cAAc,GAAG,MAAM,CAAC;IACnC;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sEAAsE;IACtE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,cAAc,KAAK,IAAI,CAAC;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,KAAK,CAAC;IACtC;;;OAGG;IACH,eAAe,CAAC,EAAE,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAClD;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;;;;OAUG;IACH,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAChD;;;;;;;;OAQG;IACH,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,+EAA+E;IAC/E,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAqxCF;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,UAAU,2HA0uBf,CAAC;AAIF,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"NoteEditor.d.ts","sourceRoot":"","sources":["../../src/components/NoteEditor.tsx"],"names":[],"mappings":"AAEA,OAAO,EAWL,KAAK,cAAc,EAKpB,MAAM,OAAO,CAAC;AAUf,OAAO,KAAK,EACV,cAAc,EAGf,MAAM,uBAAuB,CAAC;AAY/B,OAAO,EACL,MAAM,EAMN,KAAK,sBAAsB,EAE5B,MAAM,8BAA8B,CAAC;AA2BtC;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,cAAc,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,yEAAyE;AACzE,MAAM,MAAM,kBAAkB,GAAG,eAAe,CAAC;AAEjD;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,KAAK,EAAE,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,KAAK,KAAK,IAAI,CAAC;IAC5C,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,WAAW,EAAE,MAAM,cAAc,CAAC;IAClC;;;;;;OAMG;IACH,WAAW,EAAE,MAAM,eAAe,CAAC;IACnC;;;OAGG;IACH,WAAW,EAAE,CACX,GAAG,EAAE,cAAc,GAAG,MAAM,EAC5B,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,KAC1B,IAAI,CAAC;CACX,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG;IACtE;;;;;;;;OAQG;IACH,QAAQ,CAAC,EAAE,cAAc,GAAG,MAAM,CAAC;IACnC;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sEAAsE;IACtE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,cAAc,KAAK,IAAI,CAAC;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,KAAK,CAAC;IACtC;;;OAGG;IACH,eAAe,CAAC,EAAE,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAClD;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;;;;OAUG;IACH,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAChD;;;;;;;;OAQG;IACH,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,+EAA+E;IAC/E,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAu1BF;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,UAAU,2HA8qBf,CAAC;AAIF,OAAO,EAAE,UAAU,EAAE,CAAC"}
1
+ {"version":3,"file":"NoteEditor.d.ts","sourceRoot":"","sources":["../../src/components/NoteEditor.tsx"],"names":[],"mappings":"AAEA,OAAO,EAYL,KAAK,cAAc,EAOpB,MAAM,OAAO,CAAC;AAUf,OAAO,KAAK,EACV,cAAc,EAGf,MAAM,uBAAuB,CAAC;AAY/B,OAAO,EACL,MAAM,EAMN,KAAK,sBAAsB,EAE5B,MAAM,8BAA8B,CAAC;AAgDtC;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,cAAc,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,yEAAyE;AACzE,MAAM,MAAM,kBAAkB,GAAG,eAAe,CAAC;AAEjD;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,KAAK,EAAE,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,KAAK,KAAK,IAAI,CAAC;IAC5C,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,WAAW,EAAE,MAAM,cAAc,CAAC;IAClC;;;;;;OAMG;IACH,WAAW,EAAE,MAAM,eAAe,CAAC;IACnC;;;OAGG;IACH,WAAW,EAAE,CACX,GAAG,EAAE,cAAc,GAAG,MAAM,EAC5B,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,KAC1B,IAAI,CAAC;CACX,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG;IACtE;;;;;;;;OAQG;IACH,QAAQ,CAAC,EAAE,cAAc,GAAG,MAAM,CAAC;IACnC;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sEAAsE;IACtE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,cAAc,KAAK,IAAI,CAAC;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,KAAK,CAAC;IACtC;;;OAGG;IACH,eAAe,CAAC,EAAE,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAClD;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;;;;OAUG;IACH,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAChD;;;;;;;;OAQG;IACH,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,+EAA+E;IAC/E,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAqxCF;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,UAAU,2HA0uBf,CAAC;AAIF,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  "use client";
3
- "use strict";var p=require("react/jsx-runtime"),o=require("react"),ve=require("react-dom"),Me=require("@tiptap/react"),re=require("@tiptap/pm/state"),L=require("@medway-ui/notes-core"),Y=require("@medway-ui/notes-core/schema"),We=require("../lib/image-toolbar-placement.js"),Z=require("../lib/utils.js"),be=require("./Separator.js"),y=require("@medway-ui/icons"),Fe=Object.defineProperty,Ke=Object.defineProperties,Ye=Object.getOwnPropertyDescriptors,de=Object.getOwnPropertySymbols,Ee=Object.prototype.hasOwnProperty,Pe=Object.prototype.propertyIsEnumerable,ke=(e,r,s)=>r in e?Fe(e,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[r]=s,Ce=(e,r)=>{for(var s in r||(r={}))Ee.call(r,s)&&ke(e,s,r[s]);if(de)for(var s of de(r))Pe.call(r,s)&&ke(e,s,r[s]);return e},Le=(e,r)=>Ke(e,Ye(r)),Ge=(e,r)=>{var s={};for(var m in e)Ee.call(e,m)&&r.indexOf(m)<0&&(s[m]=e[m]);if(e!=null&&de)for(var m of de(e))r.indexOf(m)<0&&Pe.call(e,m)&&(s[m]=e[m]);return s};const _e=e=>Array.from(e!=null?e:[]).filter(r=>r.type.startsWith("image/")),Ne=e=>e.replace(/\r?\n/g," "),Je=e=>{const{selection:r}=e;return r.empty&&r.from===re.Selection.atStart(e.doc).from},Xe=e=>{const r=new Set,s=m=>{var a;if(!m||typeof m!="object")return;const I=m;if(I.type==="image"){const P=(a=I.attrs)==null?void 0:a.src;typeof P=="string"&&r.add(P)}Array.isArray(I.content)&&I.content.forEach(s)};return s(e),r},Ae=e=>{const r=typeof e=="string"?Y.generateJSON(e,Y.buildExtensions()):e;return L.toEditorContent(L.normalizeDocument(r!=null?r:L.EMPTY_DOCUMENT))},$e=4e3,Ve=e=>{e.chain().focus().undo().run()},Ze=e=>{e.chain().focus().redo().run()},Qe=e=>e.can().undo(),et=e=>e.can().redo(),fe=e=>{e.preventDefault()},tt=e=>{const r=e.getAttributes("link").href,s=window.prompt("URL do link",r||"https://");if(s===null)return;const m=e.chain().focus().extendMarkRange("link");if(s.trim()===""){m.unsetLink().run();return}const a=L.sanitizeLinkHref(s);if(!a){console.error("@medway-ui/core NoteEditor: rejected invalid link URL",s);return}m.setLink({href:a}).run()},rt=[[{id:"bold",title:"Negrito (Ctrl/Cmd+B)",icon:y.Bold,isActive:e=>e.isActive("bold"),run:e=>e.chain().focus().toggleMark("bold").run()},{id:"italic",title:"It\xE1lico (Ctrl/Cmd+I)",icon:y.Italic,isActive:e=>e.isActive("italic"),run:e=>e.chain().focus().toggleMark("italic").run()},{id:"underline",title:"Sublinhado (Ctrl/Cmd+U)",icon:y.Underline,isActive:e=>e.isActive("underline"),run:e=>e.chain().focus().toggleMark("underline").run()},{id:"strike",title:"Tachado (Ctrl/Cmd+Shift+S)",icon:y.Strikethrough,isActive:e=>e.isActive("strike"),run:e=>e.chain().focus().toggleMark("strike").run()},{id:"code",title:"C\xF3digo",icon:y.Code,isActive:e=>e.isActive("code"),run:e=>e.chain().focus().toggleMark("code").run()}],[{id:"heading2",title:"T\xEDtulo 2",icon:y.HeadingH2,isActive:e=>e.isActive("heading",{level:2}),run:e=>e.chain().focus().toggleNode("heading","paragraph",{level:2}).run()},{id:"heading3",title:"T\xEDtulo 3",icon:y.HeadingH3,isActive:e=>e.isActive("heading",{level:3}),run:e=>e.chain().focus().toggleNode("heading","paragraph",{level:3}).run()}],[{id:"bulletList",title:"Lista com marcadores",icon:y.ListUnordered,isActive:e=>e.isActive("bulletList"),run:e=>e.chain().focus().toggleList("bulletList","listItem").run()},{id:"orderedList",title:"Lista numerada",icon:y.ListOrdered,isActive:e=>e.isActive("orderedList"),run:e=>e.chain().focus().toggleList("orderedList","listItem").run()},{id:"blockquote",title:"Cita\xE7\xE3o",icon:y.DoubleQuotesL,isActive:e=>e.isActive("blockquote"),run:e=>e.chain().focus().toggleWrap("blockquote").run()},{id:"codeBlock",title:"Bloco de c\xF3digo",icon:y.WindowCodeBlock,isActive:e=>e.isActive("codeBlock"),run:e=>e.chain().focus().toggleNode("codeBlock","paragraph").run()}],[{id:"link",title:"Inserir link",icon:y.Link,isActive:e=>e.isActive("link"),run:e=>tt(e)}],[{id:"undo",title:"Desfazer",icon:y.ArrowUndoUpLeft,isDisabled:e=>!Qe(e),run:e=>Ve(e)},{id:"redo",title:"Refazer",icon:y.Redo,isDisabled:e=>!et(e),run:e=>Ze(e)}]],we="mx-1 data-[orientation=vertical]:h-5",De=(e,r)=>r?e:e.filter(s=>s!=="image"),ot=["max-w-none focus:outline-none","[&_.ProseMirror]:min-h-[8rem] [&_.ProseMirror]:outline-none","[&_.ProseMirror]:text-content-paragraph [&_.ProseMirror]:text-md [&_.ProseMirror]:leading-md","[&_.ProseMirror>*+*]:mt-3","[&_.ProseMirror_p]:my-0","[&_.ProseMirror_h1]:mt-4 [&_.ProseMirror_h1]:text-title-lg [&_.ProseMirror_h1]:font-bold [&_.ProseMirror_h1]:leading-title-lg [&_.ProseMirror_h1]:text-content-title","[&_.ProseMirror_h2]:mt-3 [&_.ProseMirror_h2]:text-title-md [&_.ProseMirror_h2]:font-bold [&_.ProseMirror_h2]:leading-title-md [&_.ProseMirror_h2]:text-content-title","[&_.ProseMirror_h3]:mt-3 [&_.ProseMirror_h3]:text-title-sm [&_.ProseMirror_h3]:font-semibold [&_.ProseMirror_h3]:leading-title-sm [&_.ProseMirror_h3]:text-content-title","[&_.ProseMirror>h1:first-child]:mt-0 [&_.ProseMirror>h2:first-child]:mt-0 [&_.ProseMirror>h3:first-child]:mt-0","[&_.ProseMirror_ul]:list-disc [&_.ProseMirror_ol]:list-decimal [&_.ProseMirror_ul]:pl-5 [&_.ProseMirror_ol]:pl-5","[&_.ProseMirror_li]:my-1 [&_.ProseMirror_li_p]:my-0","[&_.ProseMirror_ul[data-type=taskList]]:list-none [&_.ProseMirror_ul[data-type=taskList]]:pl-0","[&_.ProseMirror_ul[data-type=taskList]_li]:flex [&_.ProseMirror_ul[data-type=taskList]_li]:items-start [&_.ProseMirror_ul[data-type=taskList]_li]:gap-2","[&_.ProseMirror_ul[data-type=taskList]_li>label]:mt-0.5","[&_.ProseMirror_ul[data-type=taskList]_li[data-checked=true]>div>p]:text-gray-foreground-muted [&_.ProseMirror_ul[data-type=taskList]_li[data-checked=true]>div>p]:line-through","[&_.ProseMirror_blockquote]:border-l-2 [&_.ProseMirror_blockquote]:border-gray-stroke-muted [&_.ProseMirror_blockquote]:pl-3 [&_.ProseMirror_blockquote]:text-gray-foreground-muted","[&_.ProseMirror_code]:rounded [&_.ProseMirror_code]:bg-gray-background-soft [&_.ProseMirror_code]:px-1 [&_.ProseMirror_code]:py-0.5 [&_.ProseMirror_code]:font-mono [&_.ProseMirror_code]:text-xs","[&_.ProseMirror_pre]:rounded-md [&_.ProseMirror_pre]:bg-gray-background-soft [&_.ProseMirror_pre]:p-3 [&_.ProseMirror_pre_code]:bg-transparent [&_.ProseMirror_pre_code]:p-0","[&_.ProseMirror_hr]:my-4 [&_.ProseMirror_hr]:border-gray-stroke-muted","[&_.ProseMirror_a]:text-content-link [&_.ProseMirror_a]:underline","[&_.ProseMirror_img]:max-w-full [&_.ProseMirror_img]:rounded-md","[&_.ProseMirror_img.ProseMirror-selectednode]:outline [&_.ProseMirror_img.ProseMirror-selectednode]:outline-2 [&_.ProseMirror_img.ProseMirror-selectednode]:outline-offset-2 [&_.ProseMirror_img.ProseMirror-selectednode]:outline-gray-stroke","[&_.ProseMirror_p.is-empty]:before:content-[attr(data-placeholder)] [&_.ProseMirror_p.is-empty]:before:pointer-events-none [&_.ProseMirror_p.is-empty]:before:float-left [&_.ProseMirror_p.is-empty]:before:h-0 [&_.ProseMirror_p.is-empty]:before:text-gray-foreground-muted [&_.ProseMirror_p.is-empty]:before:opacity-50","[&_.ProseMirror_.medway-slash]:rounded [&_.ProseMirror_.medway-slash]:bg-gray-background-soft"].join(" "),nt=["mb-1 block w-full resize-none overflow-hidden border-0 bg-transparent p-0","text-title-lg font-bold leading-title-lg text-content-title","focus:outline-none focus:ring-0","placeholder:text-gray-foreground-muted placeholder:opacity-50"].join(" "),it=(e,r)=>{const{selection:s}=e.state;return!e.isEditable||!(e.isFocused||r)||!(s instanceof re.NodeSelection)||s.node.type.name!=="image"?null:{pos:s.from,width:L.sanitizeImageWidth(s.node.attrs.width)}},lt=[{label:"25%",title:"Pequena (25% da largura)",width:25},{label:"50%",title:"M\xE9dia (50% da largura)",width:50},{label:"75%",title:"Grande (75% da largura)",width:75},{label:"100%",title:"Largura total (100% da largura)",width:100}],at=42,Se=e=>{var r;return{width:(r=e==null?void 0:e.offsetWidth)!=null?r:0,height:(e==null?void 0:e.offsetHeight)||at}},st=e=>{const r=e.parentElement;if(!r)return e.getBoundingClientRect().width||1;const s=window.getComputedStyle(r),m=r.clientWidth-parseFloat(s.paddingLeft||"0")-parseFloat(s.paddingRight||"0");return m>0?m:1},ct=e=>{const r={top:0,left:0,right:window.innerWidth,bottom:window.innerHeight};for(let s=e.parentElement;s&&s!==document.body&&s!==document.documentElement;s=s.parentElement){const m=window.getComputedStyle(s);if(m.overflowX==="visible"&&m.overflowY==="visible")continue;const a=s.getBoundingClientRect();r.top=Math.max(r.top,a.top),r.left=Math.max(r.left,a.left),r.right=Math.min(r.right,a.right),r.bottom=Math.min(r.bottom,a.bottom)}return r},je=(e,r,s)=>e.chain().command(({tr:m})=>{const a=m.doc.nodeAt(r);return!a||a.type.name!=="image"?!1:(m.setNodeMarkup(r,void 0,Le(Ce({},a.attrs),{width:s})),m.setSelection(re.NodeSelection.create(m.doc,r)),!0)}).run(),ut=["nw","ne","sw","se"],me=6,dt={nw:"-left-1.5 -top-1.5 cursor-nwse-resize",ne:"-right-1.5 -top-1.5 cursor-nesw-resize",sw:"-bottom-1.5 -left-1.5 cursor-nesw-resize",se:"-bottom-1.5 -right-1.5 cursor-nwse-resize"},ft=(e,r)=>e.top===r.top&&e.left===r.left&&e.width===r.width&&e.height===r.height&&e.clip.top===r.clip.top&&e.clip.left===r.clip.left&&e.clip.right===r.clip.right&&e.clip.bottom===r.clip.bottom&&e.originTop===r.originTop&&e.originLeft===r.originLeft&&e.toolbarWidth===r.toolbarWidth&&e.toolbarHeight===r.toolbarHeight&&e.toolbar.side===r.toolbar.side&&e.toolbar.top===r.toolbar.top&&e.toolbar.left===r.toolbar.left,mt=({editor:e,image:r,toolbarRef:s,onFocusLeave:m})=>{const[a,I]=o.useState(null),[P,Q]=o.useState(null),[_,ee]=o.useState(null),te=o.useRef(null),R=o.useRef(null),z=o.useRef(null),G=o.useMemo(()=>{var i;return(i=e.view.dom.closest('[role="dialog"]'))!=null?i:document.body},[e]),O=o.useCallback(()=>{const i=e.view.nodeDOM(r.pos);return i instanceof HTMLElement?i:null},[e,r.pos]),J=o.useCallback(()=>{var i;const d=O();if(!d){I(null);return}const g=d.getBoundingClientRect(),v=(i=te.current)==null?void 0:i.getBoundingClientRect(),b=ct(d),f=Se(s.current),q=R.current!==null,D=z.current===d;z.current=d,I(N=>{var k,M,K;const U={top:g.top,left:g.left,width:g.width,height:g.height,clip:b,originTop:(k=v==null?void 0:v.top)!=null?k:0,originLeft:(M=v==null?void 0:v.left)!=null?M:0,toolbarWidth:f.width,toolbarHeight:f.height,toolbar:We.getImageToolbarPlacement({imageTop:g.top,imageLeft:g.left,imageHeight:g.height,clip:b,toolbarWidth:f.width,toolbarHeight:f.height,previousSide:D&&(K=N==null?void 0:N.toolbar.side)!=null?K:null,keepSide:q})};return N&&ft(N,U)?N:U})},[O,s]);o.useLayoutEffect(()=>{J();const i=O();let d=0;const g=()=>{d||(d=requestAnimationFrame(()=>{d=0,J()}))},v=typeof ResizeObserver!="undefined"?new ResizeObserver(g):null;return i&&(v==null||v.observe(i)),v==null||v.observe(e.view.dom),window.addEventListener("scroll",g,!0),window.addEventListener("resize",g),e.on("transaction",g),()=>{v==null||v.disconnect(),window.removeEventListener("scroll",g,!0),window.removeEventListener("resize",g),e.off("transaction",g),d&&cancelAnimationFrame(d)}},[e,O,J,r.width]),o.useLayoutEffect(()=>{if(!a||!s.current||R.current)return;const i=Se(s.current);(i.width!==a.toolbarWidth||i.height!==a.toolbarHeight)&&J()}),o.useEffect(()=>()=>{var i;return(i=R.current)==null?void 0:i.cancel()},[]);const pe=i=>d=>{var g,v;const b=O();if(!b||d.button!==0)return;d.preventDefault(),d.stopPropagation(),(g=R.current)==null||g.cancel();const f=d.currentTarget,q=d.pointerId;f.setPointerCapture(q);const D=i==="nw"||i==="sw"?-1:1,N=d.clientX,k=b.getBoundingClientRect().width,M=st(b),K=b.style.width,U=(v=e.state.doc.nodeAt(r.pos))==null?void 0:v.attrs.src;let B=r.pos,S=!1,j=null;const le=({transaction:E})=>{const H=E.mapping.mapResult(B);H.deleted&&(S=!0),B=H.pos},ae=E=>{var H;const se=k+D*(E.clientX-N);j=(H=L.sanitizeImageWidth(se/M*100))!=null?H:L.MIN_IMAGE_WIDTH,b.style.width=`${j}%`,Q(j)},A=()=>{var E;f.removeEventListener("pointermove",ae),f.removeEventListener("pointerup",V),f.removeEventListener("pointercancel",A),f.removeEventListener("lostpointercapture",A),e.off("transaction",le),(E=f.hasPointerCapture)!=null&&E.call(f,q)&&f.releasePointerCapture(q),b.style.width=K,R.current=null,Q(null),ee(null)},V=()=>{if(A(),j===null||S)return;const E=e.state.doc.nodeAt(B);!E||E.type.name!=="image"||E.attrs.src!==U||j!==L.sanitizeImageWidth(E.attrs.width)&&je(e,B,j)};e.on("transaction",le),f.addEventListener("pointermove",ae),f.addEventListener("pointerup",V),f.addEventListener("pointercancel",A),f.addEventListener("lostpointercapture",A),R.current={cancel:A},ee(i)},oe=i=>{i!==r.width&&je(e,r.pos,i)},W=i=>{var d,g,v,b;const f=Array.from(i.currentTarget.querySelectorAll("button")),q=f.indexOf(document.activeElement);switch(i.key){case"ArrowRight":case"ArrowLeft":{i.preventDefault();const D=i.key==="ArrowRight"?1:-1;(d=f[(q+D+f.length)%f.length])==null||d.focus();return}case"Home":i.preventDefault(),(g=f[0])==null||g.focus();return;case"End":i.preventDefault(),(v=f[f.length-1])==null||v.focus();return;case"Escape":i.preventDefault(),e.view.focus();return;case"Tab":{if(i.preventDefault(),i.shiftKey){e.view.focus();return}const D=e.state.doc.nodeAt(r.pos),N=r.pos+((b=D==null?void 0:D.nodeSize)!=null?b:1);e.chain().focus().command(({tr:k})=>(k.setSelection(re.Selection.near(k.doc.resolve(N))),!0)).run();return}default:return}},ne=p.jsx("span",{ref:te,"aria-hidden":!0,className:"pointer-events-none fixed left-0 top-0 h-0 w-0"}),X=a!==null&&(a.width>0||a.height>0)&&a.top<a.clip.bottom&&a.top+a.height>a.clip.top&&a.left<a.clip.right&&a.left+a.width>a.clip.left;if(!a||!X)return ve.createPortal(ne,G);const{clip:F}=a,$=P!=null?P:r.width,ge=i=>{const d=i==="nw"||i==="sw"?a.left-me:a.left+a.width+me,g=i==="nw"||i==="ne"?a.top-me:a.top+a.height+me;return d>=F.left&&d<=F.right&&g>=F.top&&g<=F.bottom},ie=i=>Z.cn("flex h-8 min-w-8 items-center justify-center rounded-md px-2 text-xs font-medium transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-stroke",i?"bg-primary-background-soft text-primary-foreground":"text-content-paragraph hover:bg-state-hover");return ve.createPortal(p.jsxs(p.Fragment,{children:[ne,p.jsxs("div",{ref:s,role:"toolbar","aria-label":"Tamanho da imagem",className:"pointer-events-auto fixed z-50 flex items-center gap-0.5 rounded-md border bg-surface-elevated p-1 shadow-lg",style:{left:a.toolbar.left-a.originLeft,top:a.toolbar.top-a.originTop},onMouseDown:fe,onKeyDown:W,onBlur:i=>{i.currentTarget.contains(i.relatedTarget)||m(i.relatedTarget)},children:[lt.map(i=>{const d=$===i.width;return p.jsx("button",{type:"button",title:i.title,"aria-label":i.title,"aria-pressed":d,onClick:()=>oe(i.width),className:ie(d),children:i.label},i.width)}),p.jsx(be.Separator,{orientation:"vertical",className:we}),p.jsx("button",{type:"button",title:"Tamanho original","aria-label":"Tamanho original","aria-pressed":$===null,onClick:()=>oe(null),className:ie($===null),children:"Original"})]}),p.jsxs("div",{"aria-hidden":!0,className:"pointer-events-none fixed z-50",style:{left:a.left-a.originLeft,top:a.top-a.originTop,width:a.width,height:a.height},children:[ut.filter(i=>i===_||ge(i)).map(i=>p.jsx("span",{onPointerDown:pe(i),onMouseDown:fe,className:Z.cn("pointer-events-auto absolute h-3 w-3 touch-none rounded-full border-2 border-surface-elevated bg-primary-stroke shadow-sm","before:absolute before:-inset-2 before:content-['']",dt[i])},i)),P!==null?p.jsxs("span",{className:"absolute bottom-2 right-2 rounded bg-gray-foreground px-1.5 py-0.5 text-xs font-medium text-surface-elevated",children:[P,"%"]}):null]})]}),G)},Re=o.forwardRef((e,r)=>{var s=e,{document:m,initialTitle:a,titlePlaceholder:I="T\xEDtulo",showTitle:P=!0,onChange:Q,editable:_=!0,autofocus:ee=!1,extraExtensions:te,toolbar:R=!1,onImageUpload:z,onImageRemoved:G,imageDeleteGraceMs:O=$e,className:J}=s,pe=Ge(s,["document","initialTitle","titlePlaceholder","showTitle","onChange","editable","autofocus","extraExtensions","toolbar","onImageUpload","onImageRemoved","imageDeleteGraceMs","className"]);const oe=o.useMemo(()=>Ae(m),[]),[W,ne]=o.useState(()=>Ne(a!=null?a:"")),X=o.useRef(null),F=o.useRef(P&&!!ee&&W.length===0),$=o.useCallback(()=>{const t=X.current;t&&(t.style.height="auto",t.style.height=`${t.scrollHeight}px`)},[]);o.useLayoutEffect(()=>{$()},[W,$]),o.useEffect(()=>{var t;F.current&&((t=X.current)==null||t.focus())},[]);const ge=o.useCallback(t=>{ne(Ne(t.target.value))},[]),ie=o.useCallback(()=>{const t=X.current;if(!t)return;t.focus();const n=t.value.length;t.setSelectionRange(n,n)},[]),i=o.useRef(P);o.useEffect(()=>{i.current=P},[P]);const[d,g]=o.useState(L.EMPTY_SLASH_STATE),[v,b]=o.useState(0),f=o.useRef(null);f.current||(f.current=Y.createSlashCommand(g));const q=f.current,D=o.useRef(d),N=o.useRef(v);o.useEffect(()=>{D.current=d},[d]),o.useEffect(()=>{N.current=v},[v]),o.useEffect(()=>{b(0)},[d.query,d.active]);const k=o.useRef(z),M=o.useRef(G),K=o.useRef(O);o.useEffect(()=>{k.current=z},[z]),o.useEffect(()=>{M.current=G},[G]),o.useEffect(()=>{K.current=O},[O]);const U=o.useRef(new Set),B=o.useRef(new Set),S=o.useRef(new Map),j=o.useRef(!0),le=o.useCallback(t=>{const n=S.current.get(t);n&&clearTimeout(n);const c=setTimeout(()=>{var u;S.current.delete(t),U.current.delete(t),(u=M.current)==null||u.call(M,t)},K.current);S.current.set(t,c)},[]),ae=o.useCallback(t=>{const n=S.current.get(t);n&&(clearTimeout(n),S.current.delete(t))},[]);o.useEffect(()=>{j.current=!0;const t=S.current;return()=>{j.current=!1,t.forEach(n=>clearTimeout(n)),t.clear()}},[]);const A=o.useRef(_),V=o.useRef(null);A.current=_;const E=o.useRef(null),H=o.useCallback(()=>{var t;A.current&&((t=E.current)==null||t.click())},[]),[se,xe]=o.useState(0),he=o.useRef(()=>{}),Te=o.useMemo(()=>Y.buildExtensions({extra:[...te!=null?te:[],q.extension]}),[]),Ie=o.useMemo(()=>({attributes:{role:"textbox","aria-label":"Conte\xFAdo da anota\xE7\xE3o","aria-multiline":"true","aria-readonly":_?"false":"true"},handleKeyDown:(t,n)=>{var c,u,h;const w=D.current;if(i.current&&n.key==="Backspace"&&!w.active&&Je(t.state))return n.preventDefault(),ie(),!0;const{selection:T}=t.state;if(n.key==="Tab"&&!n.shiftKey&&!n.altKey&&!n.ctrlKey&&!n.metaKey&&!w.active&&A.current&&T instanceof re.NodeSelection&&T.node.type.name==="image"){const x=(c=V.current)==null?void 0:c.querySelector("button");if(x)return n.preventDefault(),x.focus(),!0}const C=De(w.commandIds,!!k.current);if(!w.active||C.length===0)return!1;switch(n.key){case"ArrowDown":return n.preventDefault(),b(x=>(x+1)%C.length),!0;case"ArrowUp":return n.preventDefault(),b(x=>(x-1+C.length)%C.length),!0;case"Enter":case"Tab":{if(!A.current)return!1;n.preventDefault();const x=(u=C[N.current])!=null?u:C[0];return(h=f.current)==null||h.run(x),x==="image"&&H(),!0}default:return!1}},handleDrop:(t,n)=>{var c,u;const h=_e((c=n.dataTransfer)==null?void 0:c.files);if(!h.length||!k.current)return!1;n.preventDefault();const w=(u=t.posAtCoords({left:n.clientX,top:n.clientY}))==null?void 0:u.pos;return h.forEach(T=>he.current(T,w)),!0},handlePaste:(t,n)=>{var c;const u=_e((c=n.clipboardData)==null?void 0:c.files);return!u.length||!k.current?!1:(n.preventDefault(),u.forEach(h=>he.current(h)),!0)}}),[_]),l=Me.useEditor({extensions:Te,content:oe,editable:_,autofocus:F.current?!1:ee,editorProps:Ie,onUpdate:({editor:t})=>{const n=t.getJSON();Q==null||Q(n);const c=Xe(n);B.current.forEach(u=>{!c.has(u)&&U.current.has(u)&&le(u)}),c.forEach(u=>ae(u)),B.current=c}}),ze=o.useCallback(t=>{t.key!=="Enter"||t.nativeEvent.isComposing||(t.preventDefault(),l==null||l.commands.focus("start"))},[l]);o.useEffect(()=>{if(!l)return;const t=Y.assertSchemaContract(l.schema);t.length&&process.env.NODE_ENV!=="production"&&console.error(`@medway-ui/core NoteEditor: schema is missing ${t.join(", ")}`)},[l]),o.useEffect(()=>{l&&l.isEditable!==_&&l.setEditable(_)},[l,_]);const ce=o.useCallback((t,n)=>{const c=k.current;!c||!l||!l.isEditable||(xe(u=>u+1),c(t).then(u=>{var h,w,T;if(!j.current||l.isDestroyed){(h=M.current)==null||h.call(M,u);return}if(!A.current){(w=M.current)==null||w.call(M,u);return}const C=L.sanitizeImageSrc(u);if(!C){console.error("@medway-ui/core NoteEditor: rejected invalid image URL",u),(T=M.current)==null||T.call(M,u);return}U.current.add(C);const x=l.chain().focus();typeof n=="number"?x.insertContentAt(n,{type:"image",attrs:{src:C,alt:t.name}}).run():x.setImage({src:C,alt:t.name}).run()}).catch(u=>{console.error("@medway-ui/core NoteEditor: onImageUpload failed",u)}).finally(()=>{j.current&&xe(u=>u-1)}))},[l]);o.useEffect(()=>{he.current=ce},[ce]);const Oe=o.useCallback(t=>{const n=_e(t.target.files);t.target.value="",n.forEach(c=>ce(c))},[ce]);o.useEffect(()=>{if(!l)return;let t=0;const n=()=>{t||(t=requestAnimationFrame(()=>{var c;t=0,(c=f.current)==null||c.refreshCaret()}))};return window.addEventListener("scroll",n,!0),window.addEventListener("resize",n),()=>{window.removeEventListener("scroll",n,!0),window.removeEventListener("resize",n),t&&cancelAnimationFrame(t)}},[l]);const[,qe]=o.useReducer(t=>t+1,0);o.useEffect(()=>{if(!l||!R)return;const t=()=>qe();return l.on("transaction",t),l.on("selectionUpdate",t),()=>{l.off("transaction",t),l.off("selectionUpdate",t)}},[l,R]);const[ye,Ue]=o.useState(null),ue=o.useCallback(t=>{if(!l)return;const n=V.current,c=t instanceof Node&&!!(n!=null&&n.contains(t)),u=it(l,c);Ue(h=>(h==null?void 0:h.pos)===(u==null?void 0:u.pos)&&(h==null?void 0:h.width)===(u==null?void 0:u.width)?h:u)},[l]);o.useEffect(()=>{if(!l)return;const t=({transaction:n}={})=>{var c,u;const h=n==null?void 0:n.getMeta("blur");ue(h?(u=(c=h.event)==null?void 0:c.relatedTarget)!=null?u:null:document.activeElement)};return t(),l.on("transaction",t),()=>{l.off("transaction",t)}},[l,ue]);const He=o.useCallback(t=>{t instanceof Node&&l!=null&&l.view.dom.contains(t)||ue(t)},[l,ue]);return o.useImperativeHandle(r,()=>({editor:l!=null?l:null,focus:t=>l==null?void 0:l.commands.focus(t!=null?t:"end"),blur:()=>l==null?void 0:l.commands.blur(),getDocument:()=>{var t;return(t=l==null?void 0:l.getJSON())!=null?t:L.EMPTY_DOCUMENT},getSaveData:()=>{var t;const n=(t=l==null?void 0:l.getJSON())!=null?t:L.EMPTY_DOCUMENT,c=l?Y.generateHTML(n,Y.buildExtensions()):"";return{title:W,json:n,html:c}},setDocument:(t,n)=>{l&&(S.current.forEach(c=>clearTimeout(c)),S.current.clear(),U.current=new Set,B.current=new Set,l.commands.setContent(Ae(t),{emitUpdate:!1}),n!=null&&n.focus&&l.commands.focus("end"))}}),[l,W]),p.jsxs("div",Le(Ce({className:Z.cn(ot,J)},pe),{children:[R&&l&&p.jsxs("div",{role:"toolbar","aria-label":"Formata\xE7\xE3o",className:"sticky top-0 z-10 mb-2 flex flex-wrap items-center gap-0.5 border-b border-gray-stroke-muted bg-surface-elevated pb-2",children:[rt.map((t,n)=>p.jsxs("div",{className:"flex items-center gap-0.5",children:[n>0?p.jsx(be.Separator,{orientation:"vertical",className:we}):null,t.map(c=>{var u,h,w,T;const C=c.icon,x=(h=(u=c.isActive)==null?void 0:u.call(c,l))!=null?h:!1,Be=!_||((T=(w=c.isDisabled)==null?void 0:w.call(c,l))!=null?T:!1);return p.jsx("button",{type:"button",title:c.title,"aria-label":c.title,"aria-pressed":c.isActive?x:void 0,disabled:Be,onMouseDown:fe,onClick:()=>{l.isEditable&&c.run(l)},className:Z.cn("flex h-8 w-8 items-center justify-center rounded-md transition-colors","disabled:cursor-not-allowed disabled:opacity-40",x?"bg-primary-background-soft text-primary-foreground":"text-content-paragraph hover:bg-state-hover"),children:p.jsx(C,{size:16})},c.id)})]},n)),z?p.jsxs("div",{className:"flex items-center gap-0.5",children:[p.jsx(be.Separator,{orientation:"vertical",className:we}),p.jsx("button",{type:"button",title:"Inserir imagem","aria-label":"Inserir imagem",disabled:!_||se>0,onMouseDown:fe,onClick:H,className:Z.cn("flex h-8 w-8 items-center justify-center rounded-md transition-colors","disabled:cursor-not-allowed disabled:opacity-40","text-content-paragraph hover:bg-state-hover"),children:p.jsx(y.Image,{size:16})}),se>0&&p.jsxs("span",{className:"ml-2 flex items-center gap-1.5 text-xs text-content-paragraph",children:[p.jsx("span",{className:"h-3 w-3 animate-spin rounded-full border-2 border-primary-stroke border-t-transparent"}),"enviando imagem\u2026"]})]}):null]}),P?p.jsx("textarea",{ref:X,rows:1,value:W,onChange:ge,onKeyDown:ze,placeholder:I,"aria-label":"T\xEDtulo da anota\xE7\xE3o",readOnly:!_,className:nt}):null,z?p.jsx("input",{ref:E,type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:Oe}):null,p.jsx(Me.EditorContent,{editor:l}),l&&_&&ye?p.jsx(mt,{editor:l,image:ye,toolbarRef:V,onFocusLeave:He}):null,_&&d.active&&d.caret?ve.createPortal(p.jsx("div",{role:"listbox","aria-label":"Comandos",className:"fixed z-50 max-h-72 w-64 overflow-auto rounded-md border bg-surface-elevated p-1 text-sm shadow-lg",style:{left:d.caret.x,top:d.caret.y+d.caret.height+6},children:(()=>{const t=De(d.commandIds,!!z);return t.length===0?p.jsx("div",{className:"px-3 py-2 text-gray-foreground-muted",children:"Nenhum resultado"}):t.map((n,c)=>{const u=L.getSlashCommand(n);return u?p.jsxs("button",{type:"button",role:"option","aria-selected":c===v,className:Z.cn("flex w-full cursor-pointer flex-col items-start gap-0.5 rounded-sm px-3 py-1.5 text-left font-medium text-gray-foreground",c===v&&"bg-secondary-background-soft-emphasis"),onMouseEnter:()=>b(c),onMouseDown:h=>{var w;h.preventDefault(),(w=f.current)==null||w.run(n),n==="image"&&H()},children:[p.jsx("span",{className:"font-medium",children:u.label}),p.jsx("span",{className:"text-xs text-gray-foreground-muted",children:u.description})]},n):null})})()}),document.body):null]}))});Re.displayName="NoteEditor",exports.NoteEditor=Re;
3
+ "use strict";var c=require("react/jsx-runtime"),o=require("react"),we=require("react-dom"),Me=require("@tiptap/react"),ae=require("@tiptap/pm/state"),A=require("@medway-ui/notes-core"),le=require("@medway-ui/notes-core/schema"),at=require("../lib/image-toolbar-placement.js"),Y=require("../lib/utils.js"),ke=require("./Loading.js"),Ee=require("./Separator.js"),st=require("./NoteEditorLinkDialog.js"),be=require("./Tooltip.js"),se=require("./DropdownMenu.js"),E=require("@medway-ui/icons"),ut=Object.defineProperty,ct=Object.defineProperties,dt=Object.getOwnPropertyDescriptors,ve=Object.getOwnPropertySymbols,Te=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable,Re=(e,t,a)=>t in e?ut(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,Pe=(e,t)=>{for(var a in t||(t={}))Te.call(t,a)&&Re(e,a,t[a]);if(ve)for(var a of ve(t))Ae.call(t,a)&&Re(e,a,t[a]);return e},Ce=(e,t)=>ct(e,dt(t)),ft=(e,t)=>{var a={};for(var p in e)Te.call(e,p)&&t.indexOf(p)<0&&(a[p]=e[p]);if(e!=null&&ve)for(var p of ve(e))t.indexOf(p)<0&&Ae.call(e,p)&&(a[p]=e[p]);return a};const Le=e=>Array.from(e!=null?e:[]).filter(t=>t.type.startsWith("image/")),Ie=e=>e.replace(/\r?\n/g," "),mt=e=>{const{selection:t}=e;return t.empty&&t.from===ae.Selection.atStart(e.doc).from},pt=e=>{const t=new Set,a=p=>{var s;if(!p||typeof p!="object")return;const M=p;if(M.type==="image"){const y=(s=M.attrs)==null?void 0:s.src;typeof y=="string"&&t.add(y)}Array.isArray(M.content)&&M.content.forEach(a)};return a(e),t},Oe=e=>{const t=typeof e=="string"?le.generateJSON(e,le.buildExtensions()):e;return A.toEditorContent(A.normalizeDocument(t!=null?t:A.EMPTY_DOCUMENT))},gt=4e3,ht=e=>{e.chain().focus().undo().run()},bt=e=>{e.chain().focus().redo().run()},vt=e=>e.can().undo(),xt=e=>e.can().redo(),De=e=>{e.preventDefault()},yt=e=>{const{selection:t}=e.state;if(t instanceof ae.NodeSelection)return{from:t.to,to:t.to};e.isActive("link")&&e.commands.extendMarkRange("link");const{from:a,to:p}=e.state.selection;return{from:a,to:p}},ze=[[{id:"bold",label:"Negrito",shortcut:"Ctrl/Cmd+B",icon:E.Bold,isActive:e=>e.isActive("bold"),run:e=>e.chain().focus().toggleMark("bold").run()},{id:"italic",label:"It\xE1lico",shortcut:"Ctrl/Cmd+I",icon:E.Italic,isActive:e=>e.isActive("italic"),run:e=>e.chain().focus().toggleMark("italic").run()},{id:"underline",label:"Sublinhado",shortcut:"Ctrl/Cmd+U",icon:E.Underline,isActive:e=>e.isActive("underline"),run:e=>e.chain().focus().toggleMark("underline").run()},{id:"strike",label:"Tachado",shortcut:"Ctrl/Cmd+Shift+S",icon:E.Strikethrough,isActive:e=>e.isActive("strike"),run:e=>e.chain().focus().toggleMark("strike").run()},{id:"code",label:"C\xF3digo",icon:E.Code,isActive:e=>e.isActive("code"),run:e=>e.chain().focus().toggleMark("code").run()}],[{id:"heading2",label:"T\xEDtulo 2",icon:E.HeadingH2,isActive:e=>e.isActive("heading",{level:2}),run:e=>e.chain().focus().toggleNode("heading","paragraph",{level:2}).run()},{id:"heading3",label:"T\xEDtulo 3",icon:E.HeadingH3,isActive:e=>e.isActive("heading",{level:3}),run:e=>e.chain().focus().toggleNode("heading","paragraph",{level:3}).run()}],[{id:"bulletList",label:"Lista com marcadores",icon:E.ListUnordered,isActive:e=>e.isActive("bulletList"),run:e=>e.chain().focus().toggleList("bulletList","listItem").run()},{id:"orderedList",label:"Lista numerada",icon:E.ListOrdered,isActive:e=>e.isActive("orderedList"),run:e=>e.chain().focus().toggleList("orderedList","listItem").run()},{id:"blockquote",label:"Cita\xE7\xE3o",icon:E.DoubleQuotesL,isActive:e=>e.isActive("blockquote"),run:e=>e.chain().focus().toggleWrap("blockquote").run()},{id:"codeBlock",label:"Bloco de c\xF3digo",icon:E.WindowCodeBlock,isActive:e=>e.isActive("codeBlock"),run:e=>e.chain().focus().toggleNode("codeBlock","paragraph").run()}],[{id:"link",label:"Inserir link",shortcut:"Ctrl/Cmd+K",icon:E.Link,isActive:e=>e.isActive("link"),run:(e,t)=>t.openLinkDialog()}],[{id:"undo",label:"Desfazer",icon:E.ArrowUndoUpLeft,isDisabled:e=>!vt(e),run:e=>ht(e)},{id:"redo",label:"Refazer",icon:E.Redo,isDisabled:e=>!xt(e),run:e=>bt(e)}]],_t="mx-1 data-[orientation=vertical]:h-5",qe=1,wt=.5,Fe="shrink-0 data-[orientation=vertical]:h-5",He=e=>Y.cn("flex size-10 shrink-0 items-center justify-center rounded-pill transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary-foreground","disabled:pointer-events-none disabled:opacity-40",e?"bg-primary-background-soft text-primary-foreground":"text-content-title hover:bg-state-hover aria-expanded:bg-state-hover dark:hover:bg-state-focus dark:aria-expanded:bg-state-focus"),Ue=e=>Y.cn("gap-3 rounded-md py-2.5 pl-3 text-md text-content-title",e&&"bg-primary-background-soft text-primary-foreground"),xe=ze.flatMap((e,t)=>e.map(a=>Ce(Pe({},a),{group:t}))),Mt=e=>e?["Control","Meta"].map(t=>e.replace("Ctrl/Cmd",t)).join(" "):void 0,kt=(e,t,a)=>{var p;if(e.clientWidth===0)return null;const s=getComputedStyle(e),M=(parseFloat(s.paddingLeft)||0)+(parseFloat(s.paddingRight)||0),y=(p=t==null?void 0:t.getBoundingClientRect().width)!=null?p:0;return y===0?null:{available:e.clientWidth-M,item:y,gap:parseFloat(s.columnGap)||0,status:a!=null&&a.textContent?a.getBoundingClientRect().width:0}},Et=(e,t)=>e===t||e!==null&&t!==null&&e.available===t.available&&e.item===t.item&&e.gap===t.gap&&e.status===t.status,Be=(e,t,{item:a,gap:p})=>{let s=0,M=0;const y=L=>{s+=L,M+=1};return e.forEach((L,w)=>{w>0&&L.group!==e[w-1].group&&y(qe),y(a)}),t&&(e.length>0&&y(qe),y(a)),s+Math.max(0,M-1)*p},Pt=(e,t)=>{const a=t.available-(t.status>0?t.status+t.gap:0)+wt;if(Be(e,!1,t)<=a)return e.length;let p=e.length-1;for(;p>0&&Be(e.slice(0,p),!0,t)>a;)p-=1;return p},We=({label:e,disabled:t,children:a})=>c.jsxs(be.Tooltip,{children:[c.jsx(be.TooltipTrigger,{asChild:!0,children:c.jsx("span",{className:Y.cn("flex shrink-0",t&&"cursor-not-allowed"),children:a})}),c.jsx(be.TooltipContent,{sideOffset:4,children:e})]}),Ct=o.memo(function({editor:e,editable:t,onInsertImage:a,isUploadingImage:p,onOpenLinkDialog:s}){const M=o.useRef(null),y=o.useRef(null),L=o.useRef(null),[w,ee]=o.useState(null),J=Me.useEditorState({editor:e,selector:({editor:d})=>({active:Object.fromEntries(xe.map(g=>{var i,f;return[g.id,(f=(i=g.isActive)==null?void 0:i.call(g,d))!=null?f:!1]})),disabled:Object.fromEntries(xe.map(g=>{var i,f;return[g.id,(f=(i=g.isDisabled)==null?void 0:i.call(g,d))!=null?f:!1]}))})}),k=o.useCallback(()=>{const d=M.current;if(!d)return;const g=kt(d,y.current,L.current);ee(i=>Et(i,g)?i:g)},[]);o.useLayoutEffect(()=>{const d=M.current;if(!d||(k(),typeof ResizeObserver=="undefined"))return;const g=new ResizeObserver(k);return g.observe(d),y.current&&g.observe(y.current),L.current&&g.observe(L.current),()=>g.disconnect()},[k,a]),o.useLayoutEffect(k,[k,p]);const D=o.useMemo(()=>a?[...xe,{id:"image",label:"Inserir imagem",icon:E.Image,group:ze.length,busy:p,run:()=>a()}]:xe,[a,p]),$=w===null?D.length:Pt(D,w),N=D.slice(0,$),U=D.slice($),te=U.length>0,re=d=>{var g;return(g=J.active[d.id])!=null?g:!1},O=d=>{var g;return!t||(d.id==="image"?p:(g=J.disabled[d.id])!=null?g:!1)},oe=d=>{e.isEditable&&d.run(e,{openLinkDialog:s})},[B,W]=o.useState(!1),K=o.useRef(!1);return o.useEffect(()=>{if(te||!B)return;W(!1);const d=document.activeElement;(!d||d===document.body)&&e.isEditable&&e.commands.focus()},[e,te,B]),c.jsx(be.TooltipProvider,{delayDuration:300,children:c.jsxs("div",{ref:M,role:"toolbar","aria-label":"Formata\xE7\xE3o",className:"sticky top-0 z-10 mb-6 flex w-full items-center gap-2 overflow-hidden rounded-lg border border-gray-stroke-muted bg-surface-elevated px-2 py-1",children:[c.jsx("span",{ref:y,"aria-hidden":"true",className:"pointer-events-none invisible absolute left-0 top-0 size-10"}),N.map((d,g)=>{const i=d.icon,f=re(d),v=O(d),x=d.shortcut?`${d.label} (${d.shortcut})`:d.label,_=g>0&&d.group!==N[g-1].group;return c.jsxs(o.Fragment,{children:[_?c.jsx(Ee.Separator,{orientation:"vertical",className:Fe}):null,c.jsx(We,{label:x,disabled:v,children:c.jsx("button",{type:"button","aria-label":d.label,"aria-keyshortcuts":Mt(d.shortcut),"aria-pressed":d.isActive?f:void 0,"aria-busy":d.busy||void 0,disabled:v,onMouseDown:De,onClick:()=>oe(d),className:He(f),children:d.busy?c.jsx(ke.Loading,{size:16,className:"shrink-0"}):c.jsx(i,{size:20,className:"shrink-0"})})})]},d.id)}),te?c.jsxs(c.Fragment,{children:[N.length>0?c.jsx(Ee.Separator,{orientation:"vertical",className:Fe}):null,c.jsxs(se.DropdownMenu,{modal:!1,open:B,onOpenChange:W,children:[c.jsx(We,{label:"Mais op\xE7\xF5es",disabled:!t,children:c.jsx(se.DropdownMenuTrigger,{asChild:!0,children:c.jsx("button",{type:"button","aria-label":"Mais op\xE7\xF5es",disabled:!t,className:He(!1),children:c.jsx(E.MoreVertical,{size:20,className:"shrink-0"})})})}),c.jsx(se.DropdownMenuContent,{align:"end",className:"min-w-[12rem] rounded-lg p-2",onCloseAutoFocus:d=>{const g=K.current;if(K.current=!1,!g)return;d.preventDefault();const i=document.activeElement;i!=null&&i.closest('[role="dialog"]')||!e.isFocused&&e.isEditable&&e.commands.focus()},children:U.map((d,g)=>{const i=d.icon,f=re(d),v=g>0&&d.group!==U[g-1].group,x=d.busy?c.jsx(ke.Loading,{size:16,className:"size-4"}):c.jsx(i,{size:20,className:"size-5"}),_=()=>{K.current=!0,oe(d)};return c.jsxs(o.Fragment,{children:[v?c.jsx(se.DropdownMenuSeparator,{className:"-mx-2"}):null,d.isActive?c.jsxs(se.DropdownMenuCheckboxItem,{checked:f,disabled:O(d),onSelect:_,className:Y.cn(Ue(f),"pr-9"),children:[x,d.label]}):c.jsxs(se.DropdownMenuItem,{disabled:O(d),onSelect:_,className:Y.cn(Ue(!1),"pr-3"),children:[x,d.label]})]},d.id)})})]})]}):null,a?c.jsx("span",{ref:L,role:"status",className:Y.cn("flex shrink-0 items-center gap-1.5 whitespace-nowrap text-xs text-content-paragraph",p?"ml-auto":"sr-only"),children:p?c.jsxs(c.Fragment,{children:[c.jsx(ke.Loading,{size:12,className:"shrink-0 text-primary-stroke"}),"enviando imagem\u2026"]}):null}):null]})})}),Ke=(e,t)=>t?e:e.filter(a=>a!=="image"),Lt=["max-w-none focus:outline-none","[&_.ProseMirror]:min-h-[8rem] [&_.ProseMirror]:outline-none","[&_.ProseMirror]:text-gray-foreground [&_.ProseMirror]:text-md [&_.ProseMirror]:font-regular [&_.ProseMirror]:leading-md","[&_.ProseMirror>*+*]:mt-3","[&_.ProseMirror_p]:my-0","[&_.ProseMirror_h1]:mt-4 [&_.ProseMirror_h1]:text-title-xs [&_.ProseMirror_h1]:font-semibold [&_.ProseMirror_h1]:leading-lg [&_.ProseMirror_h1]:text-gray-foreground","[&_.ProseMirror_h2]:mt-3 [&_.ProseMirror_h2]:text-lg [&_.ProseMirror_h2]:font-semibold [&_.ProseMirror_h2]:leading-lg [&_.ProseMirror_h2]:text-gray-foreground","[&_.ProseMirror_h3]:mt-3 [&_.ProseMirror_h3]:text-md [&_.ProseMirror_h3]:font-semibold [&_.ProseMirror_h3]:leading-lg [&_.ProseMirror_h3]:text-gray-foreground","[&_.ProseMirror>h1:first-child]:mt-0 [&_.ProseMirror>h2:first-child]:mt-0 [&_.ProseMirror>h3:first-child]:mt-0","[&_.ProseMirror_ul]:list-disc [&_.ProseMirror_ol]:list-decimal [&_.ProseMirror_ul]:pl-5 [&_.ProseMirror_ol]:pl-5","[&_.ProseMirror_li]:my-1 [&_.ProseMirror_li_p]:my-0","[&_.ProseMirror_ul[data-type=taskList]]:list-none [&_.ProseMirror_ul[data-type=taskList]]:pl-0","[&_.ProseMirror_ul[data-type=taskList]_li]:flex [&_.ProseMirror_ul[data-type=taskList]_li]:items-start [&_.ProseMirror_ul[data-type=taskList]_li]:gap-2","[&_.ProseMirror_ul[data-type=taskList]_li>label]:mt-0.5","[&_.ProseMirror_ul[data-type=taskList]_li[data-checked=true]>div>p]:text-gray-foreground-muted [&_.ProseMirror_ul[data-type=taskList]_li[data-checked=true]>div>p]:line-through","[&_.ProseMirror_blockquote]:border-l-2 [&_.ProseMirror_blockquote]:border-gray-stroke-muted [&_.ProseMirror_blockquote]:pl-3 [&_.ProseMirror_blockquote]:text-gray-foreground-muted","[&_.ProseMirror_code]:rounded [&_.ProseMirror_code]:bg-gray-background-soft [&_.ProseMirror_code]:px-1 [&_.ProseMirror_code]:py-0.5 [&_.ProseMirror_code]:font-mono [&_.ProseMirror_code]:text-xs","[&_.ProseMirror_pre]:rounded-md [&_.ProseMirror_pre]:bg-gray-background-soft [&_.ProseMirror_pre]:p-3 [&_.ProseMirror_pre_code]:bg-transparent [&_.ProseMirror_pre_code]:p-0","[&_.ProseMirror_hr]:my-4 [&_.ProseMirror_hr]:border-gray-stroke-muted","[&_.ProseMirror_a]:text-content-link [&_.ProseMirror_a]:underline","[&_.ProseMirror_img]:max-w-full [&_.ProseMirror_img]:rounded-md","[&_.ProseMirror_img.ProseMirror-selectednode]:outline [&_.ProseMirror_img.ProseMirror-selectednode]:outline-2 [&_.ProseMirror_img.ProseMirror-selectednode]:outline-offset-2 [&_.ProseMirror_img.ProseMirror-selectednode]:outline-gray-stroke","[&_.ProseMirror_p.is-empty]:before:content-[attr(data-placeholder)] [&_.ProseMirror_p.is-empty]:before:pointer-events-none [&_.ProseMirror_p.is-empty]:before:float-left [&_.ProseMirror_p.is-empty]:before:h-0 [&_.ProseMirror_p.is-empty]:before:text-gray-foreground-muted [&_.ProseMirror_p.is-empty]:before:opacity-50","[&_.ProseMirror_.medway-slash]:rounded [&_.ProseMirror_.medway-slash]:bg-gray-background-soft"].join(" "),Dt=["mb-1 block w-full resize-none overflow-hidden border-0 bg-transparent p-0","text-title-xs font-bold leading-title-xs text-gray-foreground","focus:outline-none focus:ring-0","placeholder:text-gray-foreground-muted placeholder:opacity-50"].join(" "),jt=(e,t)=>{const{selection:a}=e.state;return!e.isEditable||!(e.isFocused||t)||!(a instanceof ae.NodeSelection)||a.node.type.name!=="image"?null:{pos:a.from,width:A.sanitizeImageWidth(a.node.attrs.width)}},Nt=[{label:"25%",title:"Pequena (25% da largura)",width:25},{label:"50%",title:"M\xE9dia (50% da largura)",width:50},{label:"75%",title:"Grande (75% da largura)",width:75},{label:"100%",title:"Largura total (100% da largura)",width:100}],St=42,Ye=e=>{var t;return{width:(t=e==null?void 0:e.offsetWidth)!=null?t:0,height:(e==null?void 0:e.offsetHeight)||St}},Tt=e=>{const t=e.parentElement;if(!t)return e.getBoundingClientRect().width||1;const a=window.getComputedStyle(t),p=t.clientWidth-parseFloat(a.paddingLeft||"0")-parseFloat(a.paddingRight||"0");return p>0?p:1},At=e=>{const t={top:0,left:0,right:window.innerWidth,bottom:window.innerHeight};for(let a=e.parentElement;a&&a!==document.body&&a!==document.documentElement;a=a.parentElement){const p=window.getComputedStyle(a);if(p.overflowX==="visible"&&p.overflowY==="visible")continue;const s=a.getBoundingClientRect();t.top=Math.max(t.top,s.top),t.left=Math.max(t.left,s.left),t.right=Math.min(t.right,s.right),t.bottom=Math.min(t.bottom,s.bottom)}return t},$e=(e,t,a)=>e.chain().command(({tr:p})=>{const s=p.doc.nodeAt(t);return!s||s.type.name!=="image"?!1:(p.setNodeMarkup(t,void 0,Ce(Pe({},s.attrs),{width:a})),p.setSelection(ae.NodeSelection.create(p.doc,t)),!0)}).run(),Rt=["nw","ne","sw","se"],ye=6,It={nw:"-left-1.5 -top-1.5 cursor-nwse-resize",ne:"-right-1.5 -top-1.5 cursor-nesw-resize",sw:"-bottom-1.5 -left-1.5 cursor-nesw-resize",se:"-bottom-1.5 -right-1.5 cursor-nwse-resize"},Ot=(e,t)=>e.top===t.top&&e.left===t.left&&e.width===t.width&&e.height===t.height&&e.clip.top===t.clip.top&&e.clip.left===t.clip.left&&e.clip.right===t.clip.right&&e.clip.bottom===t.clip.bottom&&e.originTop===t.originTop&&e.originLeft===t.originLeft&&e.toolbarWidth===t.toolbarWidth&&e.toolbarHeight===t.toolbarHeight&&e.toolbar.side===t.toolbar.side&&e.toolbar.top===t.toolbar.top&&e.toolbar.left===t.toolbar.left,zt=({editor:e,image:t,toolbarRef:a,onFocusLeave:p})=>{const[s,M]=o.useState(null),[y,L]=o.useState(null),[w,ee]=o.useState(null),J=o.useRef(null),k=o.useRef(null),D=o.useRef(null),$=o.useMemo(()=>{var i;return(i=e.view.dom.closest('[role="dialog"]'))!=null?i:document.body},[e]),N=o.useCallback(()=>{const i=e.view.nodeDOM(t.pos);return i instanceof HTMLElement?i:null},[e,t.pos]),U=o.useCallback(()=>{var i;const f=N();if(!f){M(null);return}const v=f.getBoundingClientRect(),x=(i=J.current)==null?void 0:i.getBoundingClientRect(),_=At(f),h=Ye(a.current),G=k.current!==null,z=D.current===f;D.current=f,M(R=>{var S,j,ne;const X={top:v.top,left:v.left,width:v.width,height:v.height,clip:_,originTop:(S=x==null?void 0:x.top)!=null?S:0,originLeft:(j=x==null?void 0:x.left)!=null?j:0,toolbarWidth:h.width,toolbarHeight:h.height,toolbar:at.getImageToolbarPlacement({imageTop:v.top,imageLeft:v.left,imageHeight:v.height,clip:_,toolbarWidth:h.width,toolbarHeight:h.height,previousSide:z&&(ne=R==null?void 0:R.toolbar.side)!=null?ne:null,keepSide:G})};return R&&Ot(R,X)?R:X})},[N,a]);o.useLayoutEffect(()=>{U();const i=N();let f=0;const v=()=>{f||(f=requestAnimationFrame(()=>{f=0,U()}))},x=typeof ResizeObserver!="undefined"?new ResizeObserver(v):null;return i&&(x==null||x.observe(i)),x==null||x.observe(e.view.dom),window.addEventListener("scroll",v,!0),window.addEventListener("resize",v),e.on("transaction",v),()=>{x==null||x.disconnect(),window.removeEventListener("scroll",v,!0),window.removeEventListener("resize",v),e.off("transaction",v),f&&cancelAnimationFrame(f)}},[e,N,U,t.width]),o.useLayoutEffect(()=>{if(!s||!a.current||k.current)return;const i=Ye(a.current);(i.width!==s.toolbarWidth||i.height!==s.toolbarHeight)&&U()}),o.useEffect(()=>()=>{var i;return(i=k.current)==null?void 0:i.cancel()},[]);const te=i=>f=>{var v,x;const _=N();if(!_||f.button!==0)return;f.preventDefault(),f.stopPropagation(),(v=k.current)==null||v.cancel();const h=f.currentTarget,G=f.pointerId;h.setPointerCapture(G);const z=i==="nw"||i==="sw"?-1:1,R=f.clientX,S=_.getBoundingClientRect().width,j=Tt(_),ne=_.style.width,X=(x=e.state.doc.nodeAt(t.pos))==null?void 0:x.attrs.src;let V=t.pos,q=!1,F=null;const fe=({transaction:P})=>{const Q=P.mapping.mapResult(V);Q.deleted&&(q=!0),V=Q.pos},me=P=>{var Q;const ce=S+z*(P.clientX-R);F=(Q=A.sanitizeImageWidth(ce/j*100))!=null?Q:A.MIN_IMAGE_WIDTH,_.style.width=`${F}%`,L(F)},T=()=>{var P;h.removeEventListener("pointermove",me),h.removeEventListener("pointerup",ue),h.removeEventListener("pointercancel",T),h.removeEventListener("lostpointercapture",T),e.off("transaction",fe),(P=h.hasPointerCapture)!=null&&P.call(h,G)&&h.releasePointerCapture(G),_.style.width=ne,k.current=null,L(null),ee(null)},ue=()=>{if(T(),F===null||q)return;const P=e.state.doc.nodeAt(V);!P||P.type.name!=="image"||P.attrs.src!==X||F!==A.sanitizeImageWidth(P.attrs.width)&&$e(e,V,F)};e.on("transaction",fe),h.addEventListener("pointermove",me),h.addEventListener("pointerup",ue),h.addEventListener("pointercancel",T),h.addEventListener("lostpointercapture",T),k.current={cancel:T},ee(i)},re=i=>{i!==t.width&&$e(e,t.pos,i)},O=i=>{var f,v,x,_;const h=Array.from(i.currentTarget.querySelectorAll("button")),G=h.indexOf(document.activeElement);switch(i.key){case"ArrowRight":case"ArrowLeft":{i.preventDefault();const z=i.key==="ArrowRight"?1:-1;(f=h[(G+z+h.length)%h.length])==null||f.focus();return}case"Home":i.preventDefault(),(v=h[0])==null||v.focus();return;case"End":i.preventDefault(),(x=h[h.length-1])==null||x.focus();return;case"Escape":i.preventDefault(),e.view.focus();return;case"Tab":{if(i.preventDefault(),i.shiftKey){e.view.focus();return}const z=e.state.doc.nodeAt(t.pos),R=t.pos+((_=z==null?void 0:z.nodeSize)!=null?_:1);e.chain().focus().command(({tr:S})=>(S.setSelection(ae.Selection.near(S.doc.resolve(R))),!0)).run();return}default:return}},oe=c.jsx("span",{ref:J,"aria-hidden":!0,className:"pointer-events-none fixed left-0 top-0 h-0 w-0"}),B=s!==null&&(s.width>0||s.height>0)&&s.top<s.clip.bottom&&s.top+s.height>s.clip.top&&s.left<s.clip.right&&s.left+s.width>s.clip.left;if(!s||!B)return we.createPortal(oe,$);const{clip:W}=s,K=y!=null?y:t.width,d=i=>{const f=i==="nw"||i==="sw"?s.left-ye:s.left+s.width+ye,v=i==="nw"||i==="ne"?s.top-ye:s.top+s.height+ye;return f>=W.left&&f<=W.right&&v>=W.top&&v<=W.bottom},g=i=>Y.cn("flex h-8 min-w-8 items-center justify-center rounded-md px-2 text-xs font-medium transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-stroke",i?"bg-primary-background-soft text-primary-foreground":"text-content-paragraph hover:bg-state-hover");return we.createPortal(c.jsxs(c.Fragment,{children:[oe,c.jsxs("div",{ref:a,role:"toolbar","aria-label":"Tamanho da imagem",className:"pointer-events-auto fixed z-50 flex items-center gap-0.5 rounded-md border bg-surface-elevated p-1 shadow-lg",style:{left:s.toolbar.left-s.originLeft,top:s.toolbar.top-s.originTop},onMouseDown:De,onKeyDown:O,onBlur:i=>{i.currentTarget.contains(i.relatedTarget)||p(i.relatedTarget)},children:[Nt.map(i=>{const f=K===i.width;return c.jsx("button",{type:"button",title:i.title,"aria-label":i.title,"aria-pressed":f,onClick:()=>re(i.width),className:g(f),children:i.label},i.width)}),c.jsx(Ee.Separator,{orientation:"vertical",className:_t}),c.jsx("button",{type:"button",title:"Tamanho original","aria-label":"Tamanho original","aria-pressed":K===null,onClick:()=>re(null),className:g(K===null),children:"Original"})]}),c.jsxs("div",{"aria-hidden":!0,className:"pointer-events-none fixed z-50",style:{left:s.left-s.originLeft,top:s.top-s.originTop,width:s.width,height:s.height},children:[Rt.filter(i=>i===w||d(i)).map(i=>c.jsx("span",{onPointerDown:te(i),onMouseDown:De,className:Y.cn("pointer-events-auto absolute h-3 w-3 touch-none rounded-full border-2 border-surface-elevated bg-primary-stroke shadow-sm","before:absolute before:-inset-2 before:content-['']",It[i])},i)),y!==null?c.jsxs("span",{className:"absolute bottom-2 right-2 rounded bg-gray-foreground px-1.5 py-0.5 text-xs font-medium text-surface-elevated",children:[y,"%"]}):null]})]}),$)},Ge=o.forwardRef((e,t)=>{var a=e,{document:p,initialTitle:s,titlePlaceholder:M="T\xEDtulo",showTitle:y=!0,onChange:L,editable:w=!0,autofocus:ee=!1,extraExtensions:J,toolbar:k=!1,onImageUpload:D,onImageRemoved:$,imageDeleteGraceMs:N=gt,className:U}=a,te=ft(a,["document","initialTitle","titlePlaceholder","showTitle","onChange","editable","autofocus","extraExtensions","toolbar","onImageUpload","onImageRemoved","imageDeleteGraceMs","className"]);const re=o.useMemo(()=>Oe(p),[]),[O,oe]=o.useState(()=>Ie(s!=null?s:"")),B=o.useRef(null),W=o.useRef(y&&!!ee&&O.length===0),K=o.useCallback(()=>{const r=B.current;r&&(r.style.height="auto",r.style.height=`${r.scrollHeight}px`)},[]);o.useLayoutEffect(()=>{K()},[O,K]),o.useEffect(()=>{var r;W.current&&((r=B.current)==null||r.focus())},[]);const d=o.useCallback(r=>{oe(Ie(r.target.value))},[]),g=o.useCallback(()=>{const r=B.current;if(!r)return;r.focus();const n=r.value.length;r.setSelectionRange(n,n)},[]),i=o.useRef(y);o.useEffect(()=>{i.current=y},[y]);const[f,v]=o.useState(A.EMPTY_SLASH_STATE),[x,_]=o.useState(0),h=o.useRef(null);h.current||(h.current=le.createSlashCommand(v));const G=h.current,z=o.useRef(f),R=o.useRef(x);o.useEffect(()=>{z.current=f},[f]),o.useEffect(()=>{R.current=x},[x]),o.useEffect(()=>{_(0)},[f.query,f.active]);const S=o.useRef(D),j=o.useRef($),ne=o.useRef(N);o.useEffect(()=>{S.current=D},[D]),o.useEffect(()=>{j.current=$},[$]),o.useEffect(()=>{ne.current=N},[N]);const X=o.useRef(new Set),V=o.useRef(new Set),q=o.useRef(new Map),F=o.useRef(!0),fe=o.useCallback(r=>{const n=q.current.get(r);n&&clearTimeout(n);const m=setTimeout(()=>{var u;q.current.delete(r),X.current.delete(r),(u=j.current)==null||u.call(j,r)},ne.current);q.current.set(r,m)},[]),me=o.useCallback(r=>{const n=q.current.get(r);n&&(clearTimeout(n),q.current.delete(r))},[]);o.useEffect(()=>{F.current=!0;const r=q.current;return()=>{F.current=!1,r.forEach(n=>clearTimeout(n)),r.clear()}},[]);const T=o.useRef(w),ue=o.useRef(()=>{}),P=o.useRef(null);T.current=w;const Q=o.useRef(null),ce=o.useCallback(()=>{var r;T.current&&((r=Q.current)==null||r.click())},[]),[Xe,je]=o.useState(0),_e=o.useRef(()=>{}),Je=o.useMemo(()=>le.buildExtensions({extra:[...J!=null?J:[],G.extension]}),[]),Ve=o.useMemo(()=>({attributes:{role:"textbox","aria-label":"Conte\xFAdo da anota\xE7\xE3o","aria-multiline":"true","aria-readonly":w?"false":"true"},handleKeyDown:(r,n)=>{var m,u,b;const C=z.current;if((n.metaKey||n.ctrlKey)&&!n.shiftKey&&!n.altKey&&n.key.toLowerCase()==="k"&&T.current)return n.preventDefault(),ue.current(),!0;if(i.current&&n.key==="Backspace"&&!C.active&&mt(r.state))return n.preventDefault(),g(),!0;const{selection:ie}=r.state;if(n.key==="Tab"&&!n.shiftKey&&!n.altKey&&!n.ctrlKey&&!n.metaKey&&!C.active&&T.current&&ie instanceof ae.NodeSelection&&ie.node.type.name==="image"){const I=(m=P.current)==null?void 0:m.querySelector("button");if(I)return n.preventDefault(),I.focus(),!0}const H=Ke(C.commandIds,!!S.current);if(!C.active||H.length===0)return!1;switch(n.key){case"ArrowDown":return n.preventDefault(),_(I=>(I+1)%H.length),!0;case"ArrowUp":return n.preventDefault(),_(I=>(I-1+H.length)%H.length),!0;case"Enter":case"Tab":{if(!T.current)return!1;n.preventDefault();const I=(u=H[R.current])!=null?u:H[0];return(b=h.current)==null||b.run(I),I==="image"&&ce(),!0}default:return!1}},handleDrop:(r,n)=>{var m,u;const b=Le((m=n.dataTransfer)==null?void 0:m.files);if(!b.length||!S.current)return!1;n.preventDefault();const C=(u=r.posAtCoords({left:n.clientX,top:n.clientY}))==null?void 0:u.pos;return b.forEach(ie=>_e.current(ie,C)),!0},handleDOMEvents:{click:(r,n)=>{var m;const u=n.target,b=(m=u==null?void 0:u.closest)==null?void 0:m.call(u,"a[href]");if(!b||!r.dom.contains(b)||(n.preventDefault(),n.button!==0||!r.state.selection.empty))return!1;const C=A.sanitizeLinkHref(b.getAttribute("href"));return C&&window.open(C,"_blank","noopener,noreferrer"),!1}},handlePaste:(r,n)=>{var m;const u=Le((m=n.clipboardData)==null?void 0:m.files);return!u.length||!S.current?!1:(n.preventDefault(),u.forEach(b=>_e.current(b)),!0)}}),[w]),l=Me.useEditor({extensions:Je,content:re,editable:w,autofocus:W.current?!1:ee,editorProps:Ve,onUpdate:({editor:r})=>{const n=r.getJSON();L==null||L(n);const m=pt(n);V.current.forEach(u=>{!m.has(u)&&X.current.has(u)&&fe(u)}),m.forEach(u=>me(u)),V.current=m}}),Qe=o.useCallback(r=>{r.key!=="Enter"||r.nativeEvent.isComposing||(r.preventDefault(),l==null||l.commands.focus("start"))},[l]);o.useEffect(()=>{if(!l)return;const r=le.assertSchemaContract(l.schema);r.length&&process.env.NODE_ENV!=="production"&&console.error(`@medway-ui/core NoteEditor: schema is missing ${r.join(", ")}`)},[l]),o.useEffect(()=>{l&&l.isEditable!==w&&l.setEditable(w)},[l,w]);const pe=o.useCallback((r,n)=>{const m=S.current;!m||!l||!l.isEditable||(je(u=>u+1),m(r).then(u=>{var b,C,ie;if(!F.current||l.isDestroyed){(b=j.current)==null||b.call(j,u);return}if(!T.current){(C=j.current)==null||C.call(j,u);return}const H=A.sanitizeImageSrc(u);if(!H){console.error("@medway-ui/core NoteEditor: rejected invalid image URL",u),(ie=j.current)==null||ie.call(j,u);return}X.current.add(H);const I=l.chain().focus();typeof n=="number"?I.insertContentAt(n,{type:"image",attrs:{src:H,alt:r.name}}).run():I.setImage({src:H,alt:r.name}).run()}).catch(u=>{console.error("@medway-ui/core NoteEditor: onImageUpload failed",u)}).finally(()=>{F.current&&je(u=>u-1)}))},[l]);o.useEffect(()=>{_e.current=pe},[pe]);const Ze=o.useCallback(r=>{const n=Le(r.target.files);r.target.value="",n.forEach(m=>pe(m))},[pe]);o.useEffect(()=>{if(!l)return;let r=0;const n=()=>{r||(r=requestAnimationFrame(()=>{var m;r=0,(m=h.current)==null||m.refreshCaret()}))};return window.addEventListener("scroll",n,!0),window.addEventListener("resize",n),()=>{window.removeEventListener("scroll",n,!0),window.removeEventListener("resize",n),r&&cancelAnimationFrame(r)}},[l]);const[Z,ge]=o.useState(null),de=o.useRef(null),Ne=o.useCallback(()=>{var r;if(!l||!l.isEditable)return;const n=yt(l),m=(r=l.getAttributes("link").href)!=null?r:"";de.current=n,ge({range:n,text:l.state.doc.textBetween(n.from,n.to," "),href:m,isEditing:m!==""})},[l]);ue.current=Ne;const et=o.useCallback(()=>ge(null),[]),tt=o.useCallback(({text:r,href:n})=>{if(!l||!Z)return;const{from:m,to:u}=Z.range;if(m!==u&&r===Z.text)l.chain().setTextSelection({from:m,to:u}).setLink({href:n}).run(),de.current={from:u,to:u};else{l.chain().insertContentAt({from:m,to:u},{type:"text",text:r,marks:[{type:"link",attrs:{href:n}}]}).run();const b=m+r.length;de.current={from:b,to:b}}ge(null)},[l,Z]),rt=o.useCallback(()=>{!l||!Z||(l.chain().setTextSelection(Z.range).unsetLink().run(),ge(null))},[l,Z]),ot=o.useCallback(()=>{const r=de.current;if(de.current=null,!l||l.isDestroyed)return;const n=l.chain();if((r?n.setTextSelection(r):n).focus().run(),r&&r.from===r.to){const{state:m}=l,u=m.selection.$from.marks();u.some(b=>b.type.name==="link")&&l.view.dispatch(m.tr.setStoredMarks(u.filter(b=>b.type.name!=="link")))}},[l]),[,nt]=o.useReducer(r=>r+1,0);o.useEffect(()=>{if(!l||!k)return;const r=()=>nt();return l.on("transaction",r),l.on("selectionUpdate",r),()=>{l.off("transaction",r),l.off("selectionUpdate",r)}},[l,k]);const[Se,it]=o.useState(null),he=o.useCallback(r=>{if(!l)return;const n=P.current,m=r instanceof Node&&!!(n!=null&&n.contains(r)),u=jt(l,m);it(b=>(b==null?void 0:b.pos)===(u==null?void 0:u.pos)&&(b==null?void 0:b.width)===(u==null?void 0:u.width)?b:u)},[l]);o.useEffect(()=>{if(!l)return;const r=({transaction:n}={})=>{var m,u;const b=n==null?void 0:n.getMeta("blur");he(b?(u=(m=b.event)==null?void 0:m.relatedTarget)!=null?u:null:document.activeElement)};return r(),l.on("transaction",r),()=>{l.off("transaction",r)}},[l,he]);const lt=o.useCallback(r=>{r instanceof Node&&l!=null&&l.view.dom.contains(r)||he(r)},[l,he]);return o.useImperativeHandle(t,()=>({editor:l!=null?l:null,focus:r=>l==null?void 0:l.commands.focus(r!=null?r:"end"),blur:()=>l==null?void 0:l.commands.blur(),getDocument:()=>{var r;return(r=l==null?void 0:l.getJSON())!=null?r:A.EMPTY_DOCUMENT},getSaveData:()=>{var r;const n=(r=l==null?void 0:l.getJSON())!=null?r:A.EMPTY_DOCUMENT,m=l?le.generateHTML(n,le.buildExtensions()):"";return{title:O,json:n,html:m}},setDocument:(r,n)=>{l&&(q.current.forEach(m=>clearTimeout(m)),q.current.clear(),X.current=new Set,V.current=new Set,l.commands.setContent(Oe(r),{emitUpdate:!1}),n!=null&&n.focus&&l.commands.focus("end"))}}),[l,O]),c.jsxs("div",Ce(Pe({className:Y.cn(Lt,U)},te),{children:[k&&l&&c.jsx(Ct,{editor:l,editable:w,onInsertImage:D?ce:void 0,isUploadingImage:Xe>0,onOpenLinkDialog:Ne}),y?c.jsx("textarea",{ref:B,rows:1,value:O,onChange:d,onKeyDown:Qe,placeholder:M,"aria-label":"T\xEDtulo da anota\xE7\xE3o",readOnly:!w,className:Dt}):null,D?c.jsx("input",{ref:Q,type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:Ze}):null,c.jsx(Me.EditorContent,{editor:l}),l?c.jsx(st.NoteEditorLinkDialog,{draft:Z,onSave:tt,onRemove:rt,onCancel:et,onClosed:ot}):null,l&&w&&Se?c.jsx(zt,{editor:l,image:Se,toolbarRef:P,onFocusLeave:lt}):null,w&&f.active&&f.caret?we.createPortal(c.jsx("div",{role:"listbox","aria-label":"Comandos",className:"fixed z-50 max-h-72 w-64 overflow-auto rounded-md border bg-surface-elevated p-1 text-sm shadow-lg",style:{left:f.caret.x,top:f.caret.y+f.caret.height+6},children:(()=>{const r=Ke(f.commandIds,!!D);return r.length===0?c.jsx("div",{className:"px-3 py-2 text-gray-foreground-muted",children:"Nenhum resultado"}):r.map((n,m)=>{const u=A.getSlashCommand(n);return u?c.jsxs("button",{type:"button",role:"option","aria-selected":m===x,className:Y.cn("flex w-full cursor-pointer flex-col items-start gap-0.5 rounded-sm px-3 py-1.5 text-left font-medium text-gray-foreground",m===x&&"bg-secondary-background-soft-emphasis"),onMouseEnter:()=>_(m),onMouseDown:b=>{var C;b.preventDefault(),(C=h.current)==null||C.run(n),n==="image"&&ce()},children:[c.jsx("span",{className:"font-medium",children:u.label}),c.jsx("span",{className:"text-xs text-gray-foreground-muted",children:u.description})]},n):null})})()}),document.body):null]}))});Ge.displayName="NoteEditor",exports.NoteEditor=Ge;
4
4
  //# sourceMappingURL=NoteEditor.js.map